aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/SubmittingPatches4
-rw-r--r--Documentation/accounting/getdelays.c43
-rw-r--r--Documentation/feature-removal-schedule.txt9
-rw-r--r--Documentation/hwmon/sysfs-interface31
-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.txt5
-rw-r--r--Documentation/lguest/lguest.c26
-rw-r--r--Documentation/local_ops.txt23
-rw-r--r--Documentation/markers.txt6
-rw-r--r--Documentation/networking/00-INDEX10
-rw-r--r--Documentation/networking/3c505.txt3
-rw-r--r--Documentation/networking/Configurable34
-rw-r--r--Documentation/networking/comx.txt248
-rw-r--r--Documentation/networking/ncsa-telnet16
-rw-r--r--Documentation/networking/pt.txt58
-rw-r--r--Documentation/networking/routing.txt46
-rw-r--r--Documentation/networking/slicecom.hun371
-rw-r--r--Documentation/networking/slicecom.txt369
-rw-r--r--Documentation/parport-lowlevel.txt4
-rw-r--r--Documentation/powerpc/booting-without-of.txt280
-rw-r--r--Documentation/rtc.txt7
-rw-r--r--Documentation/scsi/link_power_management_policy.txt19
-rw-r--r--Documentation/thinkpad-acpi.txt73
-rw-r--r--Documentation/video4linux/CARDLIST.em28xx3
-rw-r--r--MAINTAINERS61
-rw-r--r--Makefile40
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/configs/zylonite_defconfig736
-rw-r--r--arch/arm/mach-iop32x/n2100.c11
-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.c39
-rw-r--r--arch/arm/mach-pxa/time.c26
-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/consistent.c1
-rw-r--r--arch/arm/mm/proc-arm926.S4
-rw-r--r--arch/arm/plat-omap/fb.c2
-rw-r--r--arch/avr32/Kconfig3
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c4
-rw-r--r--arch/avr32/mach-at32ap/hsmc.c1
-rw-r--r--arch/avr32/mach-at32ap/intc.c4
-rw-r--r--arch/blackfin/Kconfig317
-rw-r--r--arch/blackfin/Kconfig.debug178
-rw-r--r--arch/blackfin/Makefile2
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig25
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig39
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig39
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig81
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig293
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig47
-rw-r--r--arch/blackfin/configs/H8606_defconfig1160
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig73
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c1
-rw-r--r--arch/blackfin/kernel/bfin_ksyms.c7
-rw-r--r--arch/blackfin/kernel/cplbinit.c73
-rw-r--r--arch/blackfin/kernel/early_printk.c3
-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/process.c66
-rw-r--r--arch/blackfin/kernel/setup.c22
-rw-r--r--arch/blackfin/kernel/traps.c391
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S11
-rw-r--r--arch/blackfin/lib/Makefile2
-rw-r--r--arch/blackfin/lib/ins.S19
-rw-r--r--arch/blackfin/lib/strcmp.c11
-rw-r--r--arch/blackfin/lib/strcpy.c11
-rw-r--r--arch/blackfin/lib/strncmp.c11
-rw-r--r--arch/blackfin/lib/strncpy.c11
-rw-r--r--arch/blackfin/lib/udivdi3.S375
-rw-r--r--arch/blackfin/mach-bf527/Kconfig2
-rw-r--r--arch/blackfin/mach-bf527/boards/Kconfig12
-rw-r--r--arch/blackfin/mach-bf527/boards/Makefile6
-rw-r--r--arch/blackfin/mach-bf527/boards/eth_mac.c50
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c90
-rw-r--r--arch/blackfin/mach-bf533/Kconfig2
-rw-r--r--arch/blackfin/mach-bf533/boards/H8606.c343
-rw-r--r--arch/blackfin/mach-bf533/boards/Kconfig34
-rw-r--r--arch/blackfin/mach-bf533/boards/Makefile3
-rw-r--r--arch/blackfin/mach-bf533/boards/cm_bf533.c46
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c4
-rw-r--r--arch/blackfin/mach-bf533/boards/generic_board.c4
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c8
-rw-r--r--arch/blackfin/mach-bf537/Kconfig2
-rw-r--r--arch/blackfin/mach-bf537/boards/Kconfig29
-rw-r--r--arch/blackfin/mach-bf537/boards/Makefile9
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c15
-rw-r--r--arch/blackfin/mach-bf537/boards/eth_mac.c50
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c13
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c15
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c56
-rw-r--r--arch/blackfin/mach-bf548/Kconfig2
-rw-r--r--arch/blackfin/mach-bf548/boards/Kconfig12
-rw-r--r--arch/blackfin/mach-bf548/boards/Makefile2
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c20
-rw-r--r--arch/blackfin/mach-bf548/head.S21
-rw-r--r--arch/blackfin/mach-bf561/Kconfig4
-rw-r--r--arch/blackfin/mach-bf561/boards/Kconfig27
-rw-r--r--arch/blackfin/mach-bf561/boards/Makefile2
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c4
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c29
-rw-r--r--arch/blackfin/mach-bf561/boards/generic_board.c4
-rw-r--r--arch/blackfin/mach-bf561/boards/tepla.c4
-rw-r--r--arch/blackfin/mach-common/cplbinfo.c2
-rw-r--r--arch/blackfin/mach-common/cplbmgr.S25
-rw-r--r--arch/blackfin/mach-common/entry.S56
-rw-r--r--arch/blackfin/mach-common/interrupt.S1
-rw-r--r--arch/blackfin/mach-common/ints-priority-dc.c21
-rw-r--r--arch/blackfin/mach-common/ints-priority-sc.c28
-rw-r--r--arch/blackfin/mach-common/irqpanic.c14
-rw-r--r--arch/blackfin/mm/blackfin_sram.c1
-rw-r--r--arch/cris/Kconfig19
-rw-r--r--arch/cris/arch-v10/defconfig2
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig3
-rw-r--r--arch/cris/arch-v10/drivers/axisflashmap.c8
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c15
-rw-r--r--arch/cris/arch-v10/kernel/entry.S77
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c327
-rw-r--r--arch/cris/arch-v10/kernel/io_interface_mux.c2
-rw-r--r--arch/cris/arch-v10/kernel/irq.c59
-rw-r--r--arch/cris/arch-v10/kernel/setup.c5
-rw-r--r--arch/cris/arch-v10/kernel/time.c11
-rw-r--r--arch/cris/arch-v10/lib/memset.c82
-rw-r--r--arch/cris/arch-v10/lib/string.c54
-rw-r--r--arch/cris/arch-v10/lib/usercopy.c314
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig2
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c9
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c2
-rw-r--r--arch/cris/arch-v32/kernel/cache.c33
-rw-r--r--arch/cris/arch-v32/kernel/cacheflush.S94
-rw-r--r--arch/cris/arch-v32/kernel/io.c2
-rw-r--r--arch/cris/arch-v32/kernel/setup.c6
-rw-r--r--arch/cris/defconfig78
-rw-r--r--arch/cris/kernel/crisksyms.c17
-rw-r--r--arch/cris/kernel/irq.c6
-rw-r--r--arch/cris/kernel/process.c5
-rw-r--r--arch/cris/kernel/ptrace.c6
-rw-r--r--arch/cris/kernel/sys_cris.c1
-rw-r--r--arch/cris/kernel/time.c10
-rw-r--r--arch/frv/mb93090-mb00/pci-dma.c3
-rw-r--r--arch/frv/mm/init.c2
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/ia64/configs/sn2_defconfig106
-rw-r--r--arch/ia64/hp/sim/boot/fw-emu.c2
-rw-r--r--arch/ia64/ia32/ia32priv.h1
-rw-r--r--arch/ia64/kernel/.gitignore1
-rw-r--r--arch/ia64/kernel/acpi.c8
-rw-r--r--arch/ia64/kernel/efi.c13
-rw-r--r--arch/ia64/kernel/gate.lds.S3
-rw-r--r--arch/ia64/kernel/iosapic.c18
-rw-r--r--arch/ia64/kernel/irq.c6
-rw-r--r--arch/ia64/kernel/mca.c2
-rw-r--r--arch/ia64/kernel/msi_ia64.c2
-rw-r--r--arch/ia64/kernel/palinfo.c91
-rw-r--r--arch/ia64/kernel/patch.c3
-rw-r--r--arch/ia64/kernel/perfmon.c4
-rw-r--r--arch/ia64/kernel/setup.c49
-rw-r--r--arch/ia64/kernel/smpboot.c21
-rw-r--r--arch/ia64/mm/contig.c74
-rw-r--r--arch/ia64/mm/init.c4
-rw-r--r--arch/ia64/scripts/check-segrel.lds1
-rw-r--r--arch/ia64/sn/kernel/irq.c8
-rw-r--r--arch/ia64/sn/kernel/mca.c1
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c12
-rw-r--r--arch/m68k/atari/atakeyb.c3
-rw-r--r--arch/mips/Kconfig63
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/au1000/Kconfig1
-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/Makefile7
-rw-r--r--arch/mips/kernel/cevt-bcm1480.c153
-rw-r--r--arch/mips/kernel/cevt-gt641xx.c12
-rw-r--r--arch/mips/kernel/cevt-r4k.c55
-rw-r--r--arch/mips/kernel/cevt-sb1250.c152
-rw-r--r--arch/mips/kernel/cevt-txx9.c171
-rw-r--r--arch/mips/kernel/cpu-probe.c5
-rw-r--r--arch/mips/kernel/csrc-bcm1480.c54
-rw-r--r--arch/mips/kernel/csrc-r4k.c29
-rw-r--r--arch/mips/kernel/csrc-sb1250.c70
-rw-r--r--arch/mips/kernel/genex.S2
-rw-r--r--arch/mips/kernel/i8253.c25
-rw-r--r--arch/mips/kernel/irixsig.c9
-rw-r--r--arch/mips/kernel/irq-rm7000.c2
-rw-r--r--arch/mips/kernel/irq-rm9000.c2
-rw-r--r--arch/mips/kernel/irq_cpu.c2
-rw-r--r--arch/mips/kernel/proc.c2
-rw-r--r--arch/mips/kernel/ptrace.c18
-rw-r--r--arch/mips/kernel/ptrace32.c4
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/setup.c31
-rw-r--r--arch/mips/kernel/smp-up.c67
-rw-r--r--arch/mips/kernel/smtc.c57
-rw-r--r--arch/mips/kernel/syscall.c9
-rw-r--r--arch/mips/kernel/time.c180
-rw-r--r--arch/mips/kernel/traps.c68
-rw-r--r--arch/mips/kernel/vmlinux.lds.S32
-rw-r--r--arch/mips/kernel/vpe.c22
-rw-r--r--arch/mips/lasat/interrupt.c22
-rw-r--r--arch/mips/lasat/setup.c7
-rw-r--r--arch/mips/math-emu/ieee754.c2
-rw-r--r--arch/mips/math-emu/ieee754dp.c2
-rw-r--r--arch/mips/math-emu/ieee754sp.c2
-rw-r--r--arch/mips/mips-boards/generic/time.c52
-rw-r--r--arch/mips/mipssim/sim_time.c48
-rw-r--r--arch/mips/mm/c-r3k.c60
-rw-r--r--arch/mips/mm/c-r4k.c28
-rw-r--r--arch/mips/mm/cerr-sb1.c6
-rw-r--r--arch/mips/mm/dma-default.c39
-rw-r--r--arch/mips/mm/init.c45
-rw-r--r--arch/mips/pci/fixup-pmcmsp.c2
-rw-r--r--arch/mips/pci/fixup-sni.c23
-rw-r--r--arch/mips/pci/fixup-tb0219.c2
-rw-r--r--arch/mips/pci/ops-pmcmsp.c2
-rw-r--r--arch/mips/pci/pci-lasat.c32
-rw-r--r--arch/mips/pci/pci-vr41xx.c1
-rw-r--r--arch/mips/pmc-sierra/Kconfig2
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_serial.c2
-rw-r--r--arch/mips/qemu/Makefile3
-rw-r--r--arch/mips/qemu/q-console.c26
-rw-r--r--arch/mips/qemu/q-firmware.c6
-rw-r--r--arch/mips/qemu/q-irq.c1
-rw-r--r--arch/mips/qemu/q-setup.c3
-rw-r--r--arch/mips/sgi-ip22/ip22-eisa.c134
-rw-r--r--arch/mips/sgi-ip22/ip22-nvram.c40
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c11
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c152
-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.c61
-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/pcimt.c2
-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/mips/vr41xx/Kconfig6
-rw-r--r--arch/mips/vr41xx/common/icu.c2
-rw-r--r--arch/powerpc/Makefile3
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts16
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts9
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts9
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts20
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dts108
-rw-r--r--arch/powerpc/boot/dts/mpc8641_hpcn.dts126
-rw-r--r--arch/powerpc/boot/dts/walnut.dts4
-rwxr-xr-xarch/powerpc/boot/wrapper43
-rw-r--r--arch/powerpc/configs/mpc832x_mds_defconfig48
-rw-r--r--arch/powerpc/configs/mpc832x_rdb_defconfig41
-rw-r--r--arch/powerpc/configs/mpc834x_itx_defconfig2
-rw-r--r--arch/powerpc/configs/mpc834x_itxgp_defconfig88
-rw-r--r--arch/powerpc/configs/mpc834x_mds_defconfig48
-rw-r--r--arch/powerpc/configs/mpc836x_mds_defconfig48
-rw-r--r--arch/powerpc/configs/mpc8568mds_defconfig48
-rw-r--r--arch/powerpc/configs/pasemi_defconfig308
-rw-r--r--arch/powerpc/configs/ppc64_defconfig247
-rw-r--r--arch/powerpc/kernel/asm-offsets.c4
-rw-r--r--arch/powerpc/kernel/btext.c4
-rw-r--r--arch/powerpc/kernel/cputable.c36
-rw-r--r--arch/powerpc/kernel/entry_32.S29
-rw-r--r--arch/powerpc/kernel/head_64.S2
-rw-r--r--arch/powerpc/kernel/idle.c2
-rw-r--r--arch/powerpc/kernel/misc_32.S32
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/prom.c12
-rw-r--r--arch/powerpc/kernel/prom_init.c2
-rw-r--r--arch/powerpc/kernel/rtas.c111
-rw-r--r--arch/powerpc/kernel/setup_64.c19
-rw-r--r--arch/powerpc/kernel/swsusp_32.S2
-rw-r--r--arch/powerpc/kernel/time.c42
-rw-r--r--arch/powerpc/kernel/vdso.c11
-rw-r--r--arch/powerpc/kernel/vdso32/cacheflush.S41
-rw-r--r--arch/powerpc/kernel/vdso64/cacheflush.S41
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S3
-rw-r--r--arch/powerpc/mm/40x_mmu.c17
-rw-r--r--arch/powerpc/mm/44x_mmu.c1
-rw-r--r--arch/powerpc/mm/fault.c2
-rw-r--r--arch/powerpc/mm/hash_low_64.S5
-rw-r--r--arch/powerpc/mm/hash_utils_64.c7
-rw-r--r--arch/powerpc/mm/init_64.c16
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/powerpc/mm/mmu_decl.h6
-rw-r--r--arch/powerpc/mm/slb.c35
-rw-r--r--arch/powerpc/mm/stab.c1
-rw-r--r--arch/powerpc/mm/tlb_64.c2
-rw-r--r--arch/powerpc/platforms/40x/walnut.c3
-rw-r--r--arch/powerpc/platforms/44x/bamboo.c3
-rw-r--r--arch/powerpc/platforms/44x/ebony.c3
-rw-r--r--arch/powerpc/platforms/44x/sequoia.c3
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c31
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c14
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c24
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c55
-rw-r--r--arch/powerpc/platforms/83xx/usb.c8
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c24
-rw-r--r--arch/powerpc/platforms/cell/smp.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c1
-rw-r--r--arch/powerpc/platforms/celleb/setup.c1
-rw-r--r--arch/powerpc/platforms/embedded6xx/prpmc2800.c1
-rw-r--r--arch/powerpc/platforms/iseries/irq.h4
-rw-r--r--arch/powerpc/platforms/iseries/setup.c4
-rw-r--r--arch/powerpc/platforms/iseries/vio.c10
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c13
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c18
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c1
-rw-r--r--arch/powerpc/platforms/pseries/msi.c6
-rw-r--r--arch/powerpc/platforms/pseries/setup.c3
-rw-r--r--arch/powerpc/sysdev/cpm_common.c4
-rw-r--r--arch/powerpc/sysdev/i8259.c1
-rw-r--r--arch/powerpc/sysdev/mv64x60_pci.c10
-rw-r--r--arch/powerpc/sysdev/uic.c18
-rw-r--r--arch/ppc/kernel/entry.S29
-rw-r--r--arch/ppc/kernel/misc.S31
-rw-r--r--arch/ppc/kernel/setup.c7
-rw-r--r--arch/ppc/mm/44x_mmu.c1
-rw-r--r--arch/ppc/mm/4xx_mmu.c17
-rw-r--r--arch/ppc/mm/fault.c2
-rw-r--r--arch/ppc/mm/init.c2
-rw-r--r--arch/ppc/mm/mmu_decl.h6
-rw-r--r--arch/ppc/platforms/4xx/ebony.c2
-rw-r--r--arch/ppc/platforms/4xx/luan.c7
-rw-r--r--arch/ppc/platforms/4xx/ocotea.c2
-rw-r--r--arch/ppc/platforms/4xx/taishan.c2
-rw-r--r--arch/ppc/platforms/4xx/yucca.c1
-rw-r--r--arch/ppc/syslib/i8259.c1
-rw-r--r--arch/ppc/syslib/m8260_setup.c13
-rw-r--r--arch/ppc/syslib/virtex_devices.c31
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/appldata/appldata.h1
-rw-r--r--arch/s390/appldata/appldata_base.c74
-rw-r--r--arch/s390/appldata/appldata_mem.c1
-rw-r--r--arch/s390/appldata/appldata_net_sum.c1
-rw-r--r--arch/s390/appldata/appldata_os.c1
-rw-r--r--arch/s390/kernel/early.c4
-rw-r--r--arch/s390/kernel/entry.S120
-rw-r--r--arch/s390/kernel/entry64.S114
-rw-r--r--arch/s390/kernel/process.c8
-rw-r--r--arch/s390/kernel/setup.c6
-rw-r--r--arch/s390/kernel/smp.c62
-rw-r--r--arch/s390/kernel/time.c6
-rw-r--r--arch/s390/kernel/traps.c1
-rw-r--r--arch/s390/kernel/vtime.c8
-rw-r--r--arch/s390/mm/cmm.c3
-rw-r--r--arch/sh/Kconfig18
-rw-r--r--arch/sh/Kconfig.debug11
-rw-r--r--arch/sh/Makefile2
-rw-r--r--arch/sh/boards/renesas/hs7751rvoip/irq.c1
-rw-r--r--arch/sh/boards/renesas/hs7751rvoip/setup.c19
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c71
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c2
-rw-r--r--arch/sh/boards/renesas/sh7710voipgw/setup.c1
-rw-r--r--arch/sh/boards/se/7206/irq.c1
-rw-r--r--arch/sh/boards/se/770x/setup.c1
-rw-r--r--arch/sh/boards/se/7722/setup.c12
-rw-r--r--arch/sh/boards/se/7780/setup.c8
-rw-r--r--arch/sh/boards/snapgear/Makefile3
-rw-r--r--arch/sh/boards/snapgear/rtc.c309
-rw-r--r--arch/sh/boards/snapgear/setup.c16
-rw-r--r--arch/sh/boot/Makefile2
-rw-r--r--arch/sh/cchips/hd6446x/Makefile2
-rw-r--r--arch/sh/cchips/voyagergx/Makefile1
-rw-r--r--arch/sh/configs/r7780mp_defconfig287
-rw-r--r--arch/sh/configs/r7785rp_defconfig305
-rw-r--r--arch/sh/drivers/pci/Makefile1
-rw-r--r--arch/sh/drivers/pci/pci-st40.c488
-rw-r--r--arch/sh/drivers/pci/pci-st40.h136
-rw-r--r--arch/sh/kernel/Makefile3
-rw-r--r--arch/sh/kernel/cpu/irq/ipr.c9
-rw-r--r--arch/sh/kernel/cpu/sh3/ex.S2
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c8
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c27
-rw-r--r--arch/sh/kernel/irq.c9
-rw-r--r--arch/sh/kernel/kgdb_stub.c9
-rw-r--r--arch/sh/kernel/setup.c47
-rw-r--r--arch/sh/kernel/sh_ksyms.c2
-rw-r--r--arch/sh/kernel/vmlinux.lds.S201
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.lds.S5
-rw-r--r--arch/sh/lib/Makefile2
-rw-r--r--arch/sh/mm/Kconfig21
-rw-r--r--arch/sh/mm/Makefile2
-rw-r--r--arch/sh/mm/clear_page.S45
-rw-r--r--arch/sh/mm/copy_page.S65
-rw-r--r--arch/sh/mm/fault.c33
-rw-r--r--arch/sh/mm/pg-sh4.c75
-rw-r--r--arch/sh/oprofile/Makefile1
-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/sh64/kernel/process.c10
-rw-r--r--arch/sh64/kernel/traps.c5
-rw-r--r--arch/sparc/kernel/irq.c1
-rw-r--r--arch/sparc64/Kconfig2
-rw-r--r--arch/sparc64/defconfig69
-rw-r--r--arch/sparc64/kernel/ds.c1
-rw-r--r--arch/sparc64/kernel/module.c1
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c2
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c1
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c1
-rw-r--r--arch/sparc64/kernel/time.c4
-rw-r--r--arch/sparc64/mm/tsb.c4
-rw-r--r--arch/sparc64/mm/ultra.S7
-rw-r--r--arch/um/Kconfig.i3862
-rw-r--r--arch/um/Makefile13
-rw-r--r--arch/um/Makefile-i3869
-rw-r--r--arch/um/Makefile-x86_645
-rw-r--r--arch/um/drivers/net_kern.c14
-rw-r--r--arch/um/drivers/ubd_kern.c2
-rw-r--r--arch/um/include/user.h13
-rw-r--r--arch/um/kernel/irq.c13
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/kernel/skas/clone.c1
-rw-r--r--arch/um/os-Linux/file.c3
-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 (renamed from arch/x86/Kconfig.i386)567
-rw-r--r--arch/x86/Kconfig.cpu121
-rw-r--r--arch/x86/Kconfig.debug8
-rw-r--r--arch/x86/Kconfig.x86_64844
-rw-r--r--arch/x86/Makefile15
-rw-r--r--arch/x86/Makefile_328
-rw-r--r--arch/x86/Makefile_648
-rw-r--r--arch/x86/boot/Makefile6
-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/cpucheck.c6
-rw-r--r--arch/x86/boot/pmjump.S8
-rw-r--r--arch/x86/configs/x86_64_defconfig2
-rw-r--r--arch/x86/ia32/ia32entry.S19
-rw-r--r--arch/x86/ia32/ptrace32.c10
-rw-r--r--arch/x86/kernel/Makefile_323
-rw-r--r--arch/x86/kernel/Makefile_644
-rw-r--r--arch/x86/kernel/acpi/boot.c32
-rw-r--r--arch/x86/kernel/acpi/processor.c6
-rw-r--r--arch/x86/kernel/acpi/sleep_64.c3
-rw-r--r--arch/x86/kernel/aperture_64.c15
-rw-r--r--arch/x86/kernel/apic_32.c2
-rw-r--r--arch/x86/kernel/asm-offsets_64.c10
-rw-r--r--arch/x86/kernel/cpu/cpufreq/Kconfig (renamed from arch/x86/kernel/cpu/cpufreq/Kconfig_32)69
-rw-r--r--arch/x86/kernel/cpu/cpufreq/Kconfig_64108
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c90
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.h20
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c20
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c6
-rw-r--r--arch/x86/kernel/cpu/proc.c18
-rw-r--r--arch/x86/kernel/early-quirks.c14
-rw-r--r--arch/x86/kernel/i386_ksyms_32.c2
-rw-r--r--arch/x86/kernel/i387_64.c9
-rw-r--r--arch/x86/kernel/io_apic_32.c33
-rw-r--r--arch/x86/kernel/io_apic_64.c24
-rw-r--r--arch/x86/kernel/kprobes_32.c7
-rw-r--r--arch/x86/kernel/kprobes_64.c9
-rw-r--r--arch/x86/kernel/machine_kexec_64.c2
-rw-r--r--arch/x86/kernel/nmi_32.c13
-rw-r--r--arch/x86/kernel/pci-calgary_64.c2
-rw-r--r--arch/x86/kernel/pci-dma_64.c12
-rw-r--r--arch/x86/kernel/pci-gart_64.c20
-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/reboot_fixups_32.c1
-rw-r--r--arch/x86/kernel/setup_32.c3
-rw-r--r--arch/x86/kernel/setup_64.c19
-rw-r--r--arch/x86/kernel/smp_32.c8
-rw-r--r--arch/x86/kernel/time_64.c41
-rw-r--r--arch/x86/kernel/traps_32.c9
-rw-r--r--arch/x86/kernel/traps_64.c11
-rw-r--r--arch/x86/lguest/boot.c69
-rw-r--r--arch/x86/lib/delay_32.c3
-rw-r--r--arch/x86/lib/delay_64.c11
-rw-r--r--arch/x86/mach-voyager/voyager_cat.c2
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c8
-rw-r--r--arch/x86/mm/discontig_32.c4
-rw-r--r--arch/x86/mm/fault_32.c5
-rw-r--r--arch/x86/mm/fault_64.c5
-rw-r--r--arch/x86/mm/init_64.c6
-rw-r--r--arch/x86/pci/acpi.c8
-rw-r--r--arch/x86/pci/common.c16
-rw-r--r--arch/x86/vdso/Makefile2
-rw-r--r--arch/x86/vdso/vgetcpu.c19
-rw-r--r--arch/xtensa/Kconfig2
-rw-r--r--block/cfq-iosched.c41
-rw-r--r--block/compat_ioctl.c2
-rw-r--r--block/deadline-iosched.c53
-rw-r--r--block/ll_rw_blk.c89
-rw-r--r--crypto/algapi.c6
-rw-r--r--crypto/anubis.c1
-rw-r--r--crypto/authenc.c12
-rw-r--r--crypto/blowfish.c1
-rw-r--r--crypto/compress.c1
-rw-r--r--crypto/crypto_null.c1
-rw-r--r--crypto/khazad.c1
-rw-r--r--crypto/sha1_generic.c1
-rw-r--r--crypto/sha256_generic.c1
-rw-r--r--crypto/sha512.c1
-rw-r--r--crypto/tea.c1
-rw-r--r--crypto/tgr192.c1
-rw-r--r--crypto/wp512.c1
-rw-r--r--drivers/acpi/Kconfig26
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/ac.c40
-rw-r--r--drivers/acpi/battery.c192
-rw-r--r--drivers/acpi/bus.c8
-rw-r--r--drivers/acpi/button.c37
-rw-r--r--drivers/acpi/ec.c214
-rw-r--r--drivers/acpi/fan.c72
-rw-r--r--drivers/acpi/osl.c25
-rw-r--r--drivers/acpi/power.c63
-rw-r--r--drivers/acpi/processor_core.c19
-rw-r--r--drivers/acpi/processor_idle.c112
-rw-r--r--drivers/acpi/processor_throttling.c286
-rw-r--r--drivers/acpi/sbs.c43
-rw-r--r--drivers/acpi/sleep/main.c5
-rw-r--r--drivers/acpi/tables/tbutils.c2
-rw-r--r--drivers/acpi/toshiba_acpi.c3
-rw-r--r--drivers/acpi/video.c155
-rw-r--r--drivers/ata/ahci.c174
-rw-r--r--drivers/ata/ata_piix.c101
-rw-r--r--drivers/ata/libata-acpi.c10
-rw-r--r--drivers/ata/libata-core.c572
-rw-r--r--drivers/ata/libata-eh.c286
-rw-r--r--drivers/ata/libata-scsi.c144
-rw-r--r--drivers/ata/libata.h2
-rw-r--r--drivers/ata/pata_acpi.c4
-rw-r--r--drivers/ata/pata_ali.c20
-rw-r--r--drivers/ata/pata_bf54x.c6
-rw-r--r--drivers/ata/pata_hpt37x.c51
-rw-r--r--drivers/ata/pata_isapnp.c11
-rw-r--r--drivers/ata/pata_jmicron.c9
-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_platform.c35
-rw-r--r--drivers/ata/pata_scc.c13
-rw-r--r--drivers/ata/pata_serverworks.c11
-rw-r--r--drivers/ata/pata_sil680.c32
-rw-r--r--drivers/ata/pata_sis.c1
-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.c122
-rw-r--r--drivers/ata/sata_promise.c142
-rw-r--r--drivers/ata/sata_qstor.c117
-rw-r--r--drivers/ata/sata_sil.c11
-rw-r--r--drivers/ata/sata_sil24.c41
-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/atm/he.c10
-rw-r--r--drivers/base/core.c6
-rw-r--r--drivers/base/dmapool.c1
-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/nbd.c3
-rw-r--r--drivers/block/paride/pf.c25
-rw-r--r--drivers/block/paride/pt.c2
-rw-r--r--drivers/block/pktcdvd.c9
-rw-r--r--drivers/block/rd.c13
-rw-r--r--drivers/block/virtio_blk.c10
-rw-r--r--drivers/char/agp/Kconfig4
-rw-r--r--drivers/char/agp/amd64-agp.c2
-rw-r--r--drivers/char/drm/drmP.h2
-rw-r--r--drivers/char/drm/drm_ioctl.c2
-rw-r--r--drivers/char/drm/drm_os_linux.h8
-rw-r--r--drivers/char/drm/radeon_cp.c5
-rw-r--r--drivers/char/drm/radeon_drv.h1
-rw-r--r--drivers/char/drm/savage_bci.c3
-rw-r--r--drivers/char/drm/sis_mm.c1
-rw-r--r--drivers/char/mem.c4
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c2
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c2
-rw-r--r--drivers/char/random.c6
-rw-r--r--drivers/char/rtc.c52
-rw-r--r--drivers/char/tty_ioctl.c170
-rw-r--r--drivers/char/virtio_console.c2
-rw-r--r--drivers/connector/connector.c5
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c153
-rw-r--r--drivers/cpuidle/cpuidle.c1
-rw-r--r--drivers/cpuidle/governor.c3
-rw-r--r--drivers/crypto/geode-aes.c3
-rw-r--r--drivers/dma/Kconfig1
-rw-r--r--drivers/dma/dmaengine.c17
-rw-r--r--drivers/dma/ioat.c11
-rw-r--r--drivers/dma/ioat_dca.c164
-rw-r--r--drivers/dma/ioat_dma.c578
-rw-r--r--drivers/dma/ioatdma.h32
-rw-r--r--drivers/dma/ioatdma_hw.h33
-rw-r--r--drivers/dma/ioatdma_registers.h106
-rw-r--r--drivers/edac/i5000_edac.c2
-rw-r--r--drivers/firewire/fw-ohci.c37
-rw-r--r--drivers/firewire/fw-sbp2.c11
-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/hwmon/Kconfig10
-rw-r--r--drivers/hwmon/Makefile1
-rw-r--r--drivers/hwmon/abituguru3.c56
-rw-r--r--drivers/hwmon/applesmc.c107
-rw-r--r--drivers/hwmon/f75375s.c170
-rw-r--r--drivers/hwmon/i5k_amb.c552
-rw-r--r--drivers/hwmon/ibmpex.c48
-rw-r--r--drivers/hwmon/lm70.c11
-rw-r--r--drivers/hwmon/sis5595.c59
-rw-r--r--drivers/hwmon/w83627hf.c155
-rw-r--r--drivers/hwmon/w83781d.c3
-rw-r--r--drivers/i2c/busses/i2c-pasemi.c7
-rw-r--r--drivers/i2c/chips/eeprom.c37
-rw-r--r--drivers/i2c/i2c-core.c3
-rw-r--r--drivers/i2c/i2c-dev.c86
-rw-r--r--drivers/ide/Kconfig26
-rw-r--r--drivers/ide/arm/icside.c16
-rw-r--r--drivers/ide/cris/ide-cris.c3
-rw-r--r--drivers/ide/ide-dma.c5
-rw-r--r--drivers/ide/ide-io.c11
-rw-r--r--drivers/ide/ide-iops.c11
-rw-r--r--drivers/ide/ide-lib.c1
-rw-r--r--drivers/ide/ide-probe.c5
-rw-r--r--drivers/ide/ide-taskfile.c3
-rw-r--r--drivers/ide/pci/cmd64x.c5
-rw-r--r--drivers/ide/pci/cs5530.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/it821x.c3
-rw-r--r--drivers/ide/pci/jmicron.c3
-rw-r--r--drivers/ide/pci/piix.c1
-rw-r--r--drivers/ide/pci/sc1200.c12
-rw-r--r--drivers/ide/pci/sis5513.c1
-rw-r--r--drivers/ide/ppc/pmac.c1
-rw-r--r--drivers/ide/setup-pci.c5
-rw-r--r--drivers/ieee1394/dma.c3
-rw-r--r--drivers/ieee1394/ieee1394_transactions.c2
-rw-r--r--drivers/ieee1394/sbp2.c2
-rw-r--r--drivers/infiniband/core/fmr_pool.c8
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c1
-rw-r--r--drivers/infiniband/hw/ehca/ehca_av.c48
-rw-r--r--drivers/infiniband/hw/ehca/ehca_classes.h1
-rw-r--r--drivers/infiniband/hw/ehca/ehca_hca.c20
-rw-r--r--drivers/infiniband/hw/ehca/ehca_iverbs.h3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c29
-rw-r--r--drivers/infiniband/hw/ehca/hipz_hw.h6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_cq.c11
-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_rc.c5
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c14
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c2
-rw-r--r--drivers/input/misc/pcspkr.c2
-rw-r--r--drivers/input/serio/Kconfig2
-rw-r--r--drivers/isdn/capi/capidrv.c25
-rw-r--r--drivers/isdn/hisax/Kconfig18
-rw-r--r--drivers/isdn/hisax/avm_pci.c4
-rw-r--r--drivers/isdn/hisax/diva.c6
-rw-r--r--drivers/isdn/hisax/elsa.c6
-rw-r--r--drivers/isdn/hisax/gazel.c4
-rw-r--r--drivers/isdn/hisax/niccy.c7
-rw-r--r--drivers/isdn/hisax/sedlbauer.c4
-rw-r--r--drivers/isdn/i4l/isdn_net.c8
-rw-r--r--drivers/isdn/sc/card.h2
-rw-r--r--drivers/isdn/sc/packet.c2
-rw-r--r--drivers/isdn/sc/shmem.c2
-rw-r--r--drivers/kvm/svm.c18
-rw-r--r--drivers/kvm/x86_emulate.c26
-rw-r--r--drivers/leds/leds-gpio.c20
-rw-r--r--drivers/lguest/lguest_device.c5
-rw-r--r--drivers/lguest/lguest_user.c2
-rw-r--r--drivers/macintosh/windfarm_core.c10
-rw-r--r--drivers/md/bitmap.c3
-rw-r--r--drivers/md/dm-table.c10
-rw-r--r--drivers/md/linear.c3
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/md/multipath.c3
-rw-r--r--drivers/md/raid0.c3
-rw-r--r--drivers/md/raid1.c3
-rw-r--r--drivers/md/raid10.c3
-rw-r--r--drivers/md/raid5.c33
-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/Kconfig1
-rw-r--r--drivers/media/common/saa7146_core.c70
-rw-r--r--drivers/media/dvb/frontends/mt2131.c2
-rw-r--r--drivers/media/dvb/frontends/s5h1409.c96
-rw-r--r--drivers/media/dvb/frontends/stv0297.c22
-rw-r--r--drivers/media/dvb/frontends/tda10021.c6
-rw-r--r--drivers/media/dvb/frontends/ves1820.c2
-rw-r--r--drivers/media/dvb/ttpci/Kconfig2
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c6
-rw-r--r--drivers/media/video/bt8xx/bttvp.h2
-rw-r--r--drivers/media/video/cafe_ccic.c6
-rw-r--r--drivers/media/video/cx23885/Kconfig2
-rw-r--r--drivers/media/video/cx88/Kconfig2
-rw-r--r--drivers/media/video/em28xx/Kconfig2
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c6
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c1
-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/planb.c8
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ctrl.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-main.c5
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c8
-rw-r--r--drivers/media/video/saa7134/Kconfig2
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c4
-rw-r--r--drivers/media/video/tuner-core.c6
-rw-r--r--drivers/media/video/tvp5150.c16
-rw-r--r--drivers/message/i2o/i2o_block.c4
-rw-r--r--drivers/misc/fujitsu-laptop.c7
-rw-r--r--drivers/misc/ioc4.c10
-rw-r--r--drivers/misc/thinkpad_acpi.c231
-rw-r--r--drivers/misc/thinkpad_acpi.h4
-rw-r--r--drivers/mmc/card/block.c22
-rw-r--r--drivers/mmc/card/queue.c2
-rw-r--r--drivers/mmc/core/core.c1
-rw-r--r--drivers/mmc/core/mmc_ops.c1
-rw-r--r--drivers/mmc/core/sd_ops.c1
-rw-r--r--drivers/mmc/core/sdio_ops.c1
-rw-r--r--drivers/mmc/host/au1xmmc.c2
-rw-r--r--drivers/mmc/host/imxmmc.c2
-rw-r--r--drivers/mmc/host/pxamci.c11
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/mmc/host/tifm_sd.c18
-rw-r--r--drivers/net/82596.c3
-rw-r--r--drivers/net/Kconfig243
-rw-r--r--drivers/net/Makefile4
-rw-r--r--drivers/net/arcnet/Kconfig15
-rw-r--r--drivers/net/arm/ep93xx_eth.c2
-rw-r--r--drivers/net/bfin_mac.c4
-rw-r--r--drivers/net/bfin_mac.h2
-rw-r--r--drivers/net/bonding/bond_main.c5
-rw-r--r--drivers/net/bonding/bond_sysfs.c4
-rw-r--r--drivers/net/chelsio/sge.c2
-rw-r--r--drivers/net/cris/eth_v10.c440
-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.c20
-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.c21
-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/fs_enet/Kconfig11
-rw-r--r--drivers/net/fs_enet/Makefile15
-rw-r--r--drivers/net/hamradio/6pack.c26
-rw-r--r--drivers/net/irda/au1k_ir.c11
-rw-r--r--drivers/net/irda/irtty-sir.c7
-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/meth.c1
-rw-r--r--drivers/net/mlx4/alloc.c7
-rw-r--r--drivers/net/mlx4/qp.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c6
-rw-r--r--drivers/net/myri_sbus.c2
-rw-r--r--drivers/net/netx-eth.c6
-rw-r--r--drivers/net/pasemi_mac.c18
-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/phy/marvell.c23
-rw-r--r--drivers/net/phy/phy_device.c2
-rw-r--r--drivers/net/plip.c4
-rw-r--r--drivers/net/ppp_async.c44
-rw-r--r--drivers/net/ppp_generic.c126
-rw-r--r--drivers/net/ppp_synctty.c37
-rw-r--r--drivers/net/pppoe.c2
-rw-r--r--drivers/net/pppol2tp.c27
-rw-r--r--drivers/net/qla3xxx.c42
-rw-r--r--drivers/net/qla3xxx.h1
-rw-r--r--drivers/net/r8169.c38
-rw-r--r--drivers/net/rrunner.c18
-rw-r--r--drivers/net/s2io.c110
-rw-r--r--drivers/net/skge.c51
-rw-r--r--drivers/net/sky2.c116
-rw-r--r--drivers/net/sky2.h3
-rw-r--r--drivers/net/slip.c8
-rw-r--r--drivers/net/smc91x.h15
-rw-r--r--drivers/net/sungem.c11
-rw-r--r--drivers/net/sunhme.c13
-rw-r--r--drivers/net/tehuti.c8
-rw-r--r--drivers/net/tg3.c195
-rw-r--r--drivers/net/tg3.h44
-rw-r--r--drivers/net/tulip/Kconfig21
-rw-r--r--drivers/net/ucc_geth.c15
-rw-r--r--drivers/net/usb/Kconfig9
-rw-r--r--drivers/net/usb/dm9601.c4
-rw-r--r--drivers/net/usb/usbnet.c7
-rw-r--r--drivers/net/via-velocity.c5
-rw-r--r--drivers/net/virtio_net.c15
-rw-r--r--drivers/net/wan/lmc/lmc_main.c55
-rw-r--r--drivers/net/wan/x25_asy.c6
-rw-r--r--drivers/net/wireless/Kconfig2
-rw-r--r--drivers/net/wireless/b43/Kconfig10
-rw-r--r--drivers/net/wireless/b43/debugfs.c2
-rw-r--r--drivers/net/wireless/b43/main.c21
-rw-r--r--drivers/net/wireless/b43/pcmcia.c52
-rw-r--r--drivers/net/wireless/b43/rfkill.c115
-rw-r--r--drivers/net/wireless/b43/rfkill.h14
-rw-r--r--drivers/net/wireless/b43legacy/debugfs.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c23
-rw-r--r--drivers/net/wireless/hostap/hostap_pci.c6
-rw-r--r--drivers/net/wireless/ipw2100.c15
-rw-r--r--drivers/net/wireless/ipw2200.c6
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c56
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.h29
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c126
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c65
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c66
-rw-r--r--drivers/net/wireless/libertas/cmd.c10
-rw-r--r--drivers/net/wireless/libertas/if_cs.c7
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c11
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h15
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c6
-rw-r--r--drivers/net/wireless/rtl8187_dev.c20
-rw-r--r--drivers/net/wireless/strip.c10
-rw-r--r--drivers/oprofile/cpu_buffer.c7
-rw-r--r--drivers/oprofile/cpu_buffer.h1
-rw-r--r--drivers/oprofile/oprofile_stats.c4
-rw-r--r--drivers/pci/Kconfig11
-rw-r--r--drivers/pci/hotplug/Kconfig6
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c16
-rw-r--r--drivers/pci/intel-iommu.c13
-rw-r--r--drivers/pci/intel-iommu.h2
-rw-r--r--drivers/pci/msi.c18
-rw-r--r--drivers/pci/pci-driver.c5
-rw-r--r--drivers/pci/quirks.c51
-rw-r--r--drivers/pci/search.c9
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c24
-rw-r--r--drivers/rtc/Kconfig10
-rw-r--r--drivers/rtc/hctosys.c4
-rw-r--r--drivers/rtc/rtc-cmos.c3
-rw-r--r--drivers/rtc/rtc-ds1307.c93
-rw-r--r--drivers/rtc/rtc-ds1553.c2
-rw-r--r--drivers/rtc/rtc-ds1742.c5
-rw-r--r--drivers/rtc/rtc-m48t59.c9
-rw-r--r--drivers/rtc/rtc-s3c.c2
-rw-r--r--drivers/rtc/rtc-sh.c6
-rw-r--r--drivers/rtc/rtc-stk17ta8.c2
-rw-r--r--drivers/s390/block/dcssblk.c9
-rw-r--r--drivers/s390/cio/cmf.c4
-rw-r--r--drivers/s390/cio/css.c2
-rw-r--r--drivers/s390/cio/device.c2
-rw-r--r--drivers/s390/cio/device_fsm.c2
-rw-r--r--drivers/s390/cio/device_id.c45
-rw-r--r--drivers/s390/net/smsgiucv.c4
-rw-r--r--drivers/s390/scsi/zfcp_def.h5
-rw-r--r--drivers/scsi/Kconfig6
-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/aic94xx/aic94xx_sds.c4
-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/ibmvscsi/ibmvscsi.c19
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c5
-rw-r--r--drivers/scsi/osst.c6
-rw-r--r--drivers/scsi/scsi_lib.c138
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--drivers/scsi/scsi_sysfs.c47
-rw-r--r--drivers/scsi/sg.c1
-rw-r--r--drivers/serial/8250_early.c4
-rw-r--r--drivers/serial/8250_pci.c5
-rw-r--r--drivers/serial/8250_pnp.c10
-rw-r--r--drivers/serial/Kconfig2
-rw-r--r--drivers/serial/atmel_serial.c9
-rw-r--r--drivers/serial/crisv10.c1293
-rw-r--r--drivers/serial/crisv10.h146
-rw-r--r--drivers/serial/serial_cs.c2
-rw-r--r--drivers/serial/serial_txx9.c10
-rw-r--r--drivers/serial/sh-sci.h19
-rw-r--r--drivers/serial/uartlite.c10
-rw-r--r--drivers/sh/maple/maple.c3
-rw-r--r--drivers/sh/superhyway/superhyway.c7
-rw-r--r--drivers/spi/Kconfig2
-rw-r--r--drivers/spi/spi.c8
-rw-r--r--drivers/spi/spi_txx9.c40
-rw-r--r--drivers/spi/spidev.c6
-rw-r--r--drivers/spi/tle62x0.c5
-rw-r--r--drivers/ssb/main.c6
-rw-r--r--drivers/ssb/pcmcia.c56
-rw-r--r--drivers/telephony/phonedev.c5
-rw-r--r--drivers/usb/core/buffer.c1
-rw-r--r--drivers/usb/core/hcd.c1
-rw-r--r--drivers/usb/core/message.c2
-rw-r--r--drivers/usb/core/usb.c2
-rw-r--r--drivers/usb/serial/keyspan.c38
-rw-r--r--drivers/video/Kconfig10
-rw-r--r--drivers/video/aty/radeon_base.c1
-rw-r--r--drivers/video/aty/radeon_pm.c4
-rw-r--r--drivers/video/cirrusfb.c3
-rw-r--r--drivers/video/console/Kconfig2
-rw-r--r--drivers/video/cyber2000fb.c2
-rw-r--r--drivers/video/gbefb.c4
-rw-r--r--drivers/video/geode/lxfb.h2
-rw-r--r--drivers/video/omap/Kconfig2
-rw-r--r--drivers/video/ps3fb.c2
-rw-r--r--drivers/video/s1d13xxxfb.c5
-rw-r--r--drivers/video/sis/sis_main.c3
-rw-r--r--drivers/video/uvesafb.c6
-rw-r--r--drivers/virtio/virtio.c13
-rw-r--r--drivers/virtio/virtio_ring.c10
-rw-r--r--drivers/w1/Kconfig3
-rw-r--r--drivers/w1/masters/ds2490.c2
-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--drivers/zorro/zorro-driver.c15
-rw-r--r--fs/9p/v9fs.c6
-rw-r--r--fs/9p/vfs_super.c3
-rw-r--r--fs/Kconfig8
-rw-r--r--fs/afs/vlocation.c2
-rw-r--r--fs/bfs/bfs.h4
-rw-r--r--fs/bfs/dir.c146
-rw-r--r--fs/bfs/file.c62
-rw-r--r--fs/bfs/inode.c127
-rw-r--r--fs/cifs/CHANGES14
-rw-r--r--fs/cifs/Makefile7
-rw-r--r--fs/cifs/README27
-rw-r--r--fs/cifs/TODO2
-rw-r--r--fs/cifs/asn1.c35
-rw-r--r--fs/cifs/cifs_spnego.c134
-rw-r--r--fs/cifs/cifs_spnego.h47
-rw-r--r--fs/cifs/cifsacl.c347
-rw-r--r--fs/cifs/cifsacl.h17
-rw-r--r--fs/cifs/cifsencrypt.c9
-rw-r--r--fs/cifs/cifsfs.c24
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/cifsglob.h13
-rw-r--r--fs/cifs/cifspdu.h40
-rw-r--r--fs/cifs/cifsproto.h24
-rw-r--r--fs/cifs/cifssmb.c161
-rw-r--r--fs/cifs/connect.c147
-rw-r--r--fs/cifs/dir.c2
-rw-r--r--fs/cifs/file.c75
-rw-r--r--fs/cifs/inode.c41
-rw-r--r--fs/cifs/md5.c8
-rw-r--r--fs/cifs/misc.c10
-rw-r--r--fs/cifs/netmisc.c54
-rw-r--r--fs/cifs/readdir.c10
-rw-r--r--fs/cifs/sess.c93
-rw-r--r--fs/cifs/smbencrypt.c18
-rw-r--r--fs/cifs/transport.c91
-rw-r--r--fs/cifs/xattr.c11
-rw-r--r--fs/compat_ioctl.c2
-rw-r--r--fs/dlm/lowcomms.c6
-rw-r--r--fs/ecryptfs/crypto.c28
-rw-r--r--fs/ecryptfs/read_write.c2
-rw-r--r--fs/exec.c6
-rw-r--r--fs/ext2/balloc.c50
-rw-r--r--fs/ext2/ioctl.c5
-rw-r--r--fs/ext3/balloc.c48
-rw-r--r--fs/ext3/dir.c10
-rw-r--r--fs/ext3/ioctl.c5
-rw-r--r--fs/ext3/namei.c92
-rw-r--r--fs/ext4/balloc.c41
-rw-r--r--fs/ext4/ioctl.c5
-rw-r--r--fs/fuse/file.c5
-rw-r--r--fs/hugetlbfs/inode.c11
-rw-r--r--fs/ioprio.c4
-rw-r--r--fs/jfs/ioctl.c3
-rw-r--r--fs/locks.c11
-rw-r--r--fs/nfs/dir.c1
-rw-r--r--fs/nfs/direct.c142
-rw-r--r--fs/nfs/getroot.c81
-rw-r--r--fs/nfs/super.c11
-rw-r--r--fs/nfs/write.c3
-rw-r--r--fs/nfsd/nfs2acl.c2
-rw-r--r--fs/nfsd/nfs3acl.c2
-rw-r--r--fs/nfsd/nfs4recover.c2
-rw-r--r--fs/nfsd/nfsfh.c43
-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/ocfs2/alloc.c2
-rw-r--r--fs/ocfs2/aops.c22
-rw-r--r--fs/ocfs2/cluster/heartbeat.c2
-rw-r--r--fs/ocfs2/cluster/tcp.c4
-rw-r--r--fs/ocfs2/dcache.c2
-rw-r--r--fs/ocfs2/dir.c6
-rw-r--r--fs/ocfs2/dlmglue.c25
-rw-r--r--fs/ocfs2/file.c26
-rw-r--r--fs/ocfs2/namei.c13
-rw-r--r--fs/open.c2
-rw-r--r--fs/proc/array.c8
-rw-r--r--fs/proc/base.c15
-rw-r--r--fs/proc/generic.c39
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/proc_net.c9
-rw-r--r--fs/proc/root.c2
-rw-r--r--fs/read_write.c2
-rw-r--r--fs/reiserfs/ioctl.c3
-rw-r--r--fs/reiserfs/stree.c3
-rw-r--r--fs/smbfs/file.c7
-rw-r--r--fs/smbfs/inode.c2
-rw-r--r--fs/smbfs/proc.c2
-rw-r--r--fs/smbfs/smbiod.c2
-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/acpi/processor.h1
-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/hardware/iop3xx.h2
-rw-r--r--include/asm-arm/pgtable.h2
-rw-r--r--include/asm-arm/plat-s3c/regs-nand.h2
-rw-r--r--include/asm-arm26/irq_regs.h1
-rw-r--r--include/asm-avr32/sysreg.h2
-rw-r--r--include/asm-blackfin/bfin-global.h6
-rw-r--r--include/asm-blackfin/cplbinit.h33
-rw-r--r--include/asm-blackfin/delay.h66
-rw-r--r--include/asm-blackfin/fixed_code.h4
-rw-r--r--include/asm-blackfin/gptimers.h2
-rw-r--r--include/asm-blackfin/io.h1
-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-bf527/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf527/mem_map.h3
-rw-r--r--include/asm-blackfin/mach-bf533/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf533/mem_map.h4
-rw-r--r--include/asm-blackfin/mach-bf537/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf537/mem_map.h3
-rw-r--r--include/asm-blackfin/mach-bf548/bf548.h34
-rw-r--r--include/asm-blackfin/mach-bf548/defBF544.h2
-rw-r--r--include/asm-blackfin/mach-bf548/defBF548.h2
-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/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf548/mem_map.h18
-rw-r--r--include/asm-blackfin/mach-bf548/portmux.h14
-rw-r--r--include/asm-blackfin/mach-bf561/bf561.h19
-rw-r--r--include/asm-blackfin/mach-bf561/defBF561.h18
-rw-r--r--include/asm-blackfin/mach-bf561/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf561/mem_map.h7
-rw-r--r--include/asm-blackfin/mach-common/def_LPBlackfin.h8
-rw-r--r--include/asm-blackfin/page_offset.h2
-rw-r--r--include/asm-blackfin/string.h2
-rw-r--r--include/asm-blackfin/traps.h96
-rw-r--r--include/asm-cris/atomic.h2
-rw-r--r--include/asm-cris/checksum.h2
-rw-r--r--include/asm-cris/ethernet.h3
-rw-r--r--include/asm-cris/fasttimer.h16
-rw-r--r--include/asm-cris/hardirq.h1
-rw-r--r--include/asm-cris/posix_types.h1
-rw-r--r--include/asm-cris/termbits.h13
-rw-r--r--include/asm-cris/thread_info.h9
-rw-r--r--include/asm-cris/tlb.h2
-rw-r--r--include/asm-cris/unistd.h39
-rw-r--r--include/asm-frv/irq.h3
-rw-r--r--include/asm-generic/resource.h2
-rw-r--r--include/asm-ia64/acpi.h1
-rw-r--r--include/asm-ia64/pal.h5
-rw-r--r--include/asm-ia64/percpu.h2
-rw-r--r--include/asm-ia64/smp.h1
-rw-r--r--include/asm-m68knommu/unistd.h4
-rw-r--r--include/asm-mips/8253pit.h10
-rw-r--r--include/asm-mips/cpu-info.h1
-rw-r--r--include/asm-mips/dma.h1
-rw-r--r--include/asm-mips/futex.h6
-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/lasat/lasatint.h5
-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-lasat/irq.h13
-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/system.h8
-rw-r--r--include/asm-mips/time.h36
-rw-r--r--include/asm-mips/timex.h27
-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-powerpc/commproc.h2
-rw-r--r--include/asm-powerpc/cputable.h22
-rw-r--r--include/asm-powerpc/page_32.h4
-rw-r--r--include/asm-powerpc/pci-bridge.h5
-rw-r--r--include/asm-powerpc/pgtable-ppc32.h13
-rw-r--r--include/asm-powerpc/rtas.h3
-rw-r--r--include/asm-powerpc/systbl.h2
-rw-r--r--include/asm-powerpc/time.h20
-rw-r--r--include/asm-powerpc/tlbflush.h12
-rw-r--r--include/asm-powerpc/vdso_datapage.h8
-rw-r--r--include/asm-s390/system.h5
-rw-r--r--include/asm-sh/cache.h3
-rw-r--r--include/asm-sh/cacheflush.h18
-rw-r--r--include/asm-sh/cpu-sh3/timer.h6
-rw-r--r--include/asm-sh/irq.h2
-rw-r--r--include/asm-sh/page.h12
-rw-r--r--include/asm-sh/pgtable.h6
-rw-r--r--include/asm-sh/processor.h4
-rw-r--r--include/asm-sh/ptrace.h3
-rw-r--r--include/asm-sh/setup.h14
-rw-r--r--include/asm-sh/vga.h6
-rw-r--r--include/asm-sh64/dma-mapping.h5
-rw-r--r--include/asm-sh64/pci.h9
-rw-r--r--include/asm-sh64/ptrace.h2
-rw-r--r--include/asm-sh64/scatterlist.h9
-rw-r--r--include/asm-sparc64/futex.h6
-rw-r--r--include/asm-sparc64/system.h4
-rw-r--r--include/asm-sparc64/uaccess.h6
-rw-r--r--include/asm-sparc64/vio.h4
-rw-r--r--include/asm-um/pgtable-3level.h2
-rw-r--r--include/asm-um/unistd.h1
-rw-r--r--include/asm-x86/acpi.h27
-rw-r--r--include/asm-x86/apic_32.h1
-rw-r--r--include/asm-x86/gart.h29
-rw-r--r--include/asm-x86/i387_64.h5
-rw-r--r--include/asm-x86/iommu.h4
-rw-r--r--include/asm-x86/irqflags_32.h21
-rw-r--r--include/asm-x86/irqflags_64.h20
-rw-r--r--include/asm-x86/lguest_hcall.h3
-rw-r--r--include/asm-x86/mach-default/mach_reboot.h2
-rw-r--r--include/asm-x86/mach-es7000/mach_mpparse.h6
-rw-r--r--include/asm-x86/mach-voyager/setup_arch.h4
-rw-r--r--include/asm-x86/pci_64.h2
-rw-r--r--include/asm-x86/ptrace.h2
-rw-r--r--include/asm-x86/smp_32.h9
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/acpi.h5
-rw-r--r--include/linux/ata.h39
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/cpu_acct.h14
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--include/linux/device-mapper.h1
-rw-r--r--include/linux/eventpoll.h7
-rw-r--r--include/linux/ext3_fs.h20
-rw-r--r--include/linux/f75375s.h21
-rw-r--r--include/linux/futex.h4
-rw-r--r--include/linux/hugetlb.h10
-rw-r--r--include/linux/i2c.h5
-rw-r--r--include/linux/ide.h9
-rw-r--r--include/linux/ipmi_smi.h2
-rw-r--r--include/linux/kallsyms.h1
-rw-r--r--include/linux/libata.h37
-rw-r--r--include/linux/mc146818rtc.h3
-rw-r--r--include/linux/mroute.h12
-rw-r--r--include/linux/mv643xx_eth.h3
-rw-r--r--include/linux/net.h8
-rw-r--r--include/linux/netdevice.h10
-rw-r--r--include/linux/netfilter/Kbuild18
-rw-r--r--include/linux/netfilter_ipv4/Kbuild28
-rw-r--r--include/linux/netfilter_ipv6/Kbuild2
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/pci.h14
-rw-r--r--include/linux/pci_ids.h9
-rw-r--r--include/linux/pid_namespace.h23
-rw-r--r--include/linux/proc_fs.h3
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/scatterlist.h70
-rw-r--r--include/linux/sched.h18
-rw-r--r--include/linux/selinux.h2
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/linux/smp.h7
-rw-r--r--include/linux/string.h12
-rw-r--r--include/linux/sunrpc/debug.h5
-rw-r--r--include/linux/sunrpc/rpc_rdma.h32
-rw-r--r--include/linux/sunrpc/xprtsock.h6
-rw-r--r--include/linux/sysctl.h6
-rw-r--r--include/linux/timex.h1
-rw-r--r--include/linux/tty.h4
-rw-r--r--include/linux/types.h2
-rw-r--r--include/linux/virtio_ring.h21
-rw-r--r--include/net/af_unix.h2
-rw-r--r--include/net/dst.h7
-rw-r--r--include/net/esp.h2
-rw-r--r--include/net/fib_rules.h3
-rw-r--r--include/net/ieee80211.h8
-rw-r--r--include/net/inet_common.h4
-rw-r--r--include/net/inet_hashtables.h71
-rw-r--r--include/net/inetpeer.h2
-rw-r--r--include/net/ip_fib.h15
-rw-r--r--include/net/ip_vs.h42
-rw-r--r--include/net/mac80211.h26
-rw-r--r--include/net/net_namespace.h35
-rw-r--r--include/net/request_sock.h18
-rw-r--r--include/net/sctp/auth.h2
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/constants.h3
-rw-r--r--include/net/sctp/sctp.h5
-rw-r--r--include/net/sctp/structs.h22
-rw-r--r--include/net/sock.h92
-rw-r--r--include/net/tcp.h3
-rw-r--r--include/pcmcia/cs_types.h2
-rw-r--r--include/rdma/ib_verbs.h2
-rw-r--r--include/scsi/libsas.h2
-rw-r--r--include/scsi/scsi_device.h25
-rw-r--r--include/sound/version.h2
-rw-r--r--init/Kconfig21
-rw-r--r--init/main.c4
-rw-r--r--ipc/mqueue.c6
-rw-r--r--kernel/Makefile1
-rw-r--r--kernel/acct.c2
-rw-r--r--kernel/cgroup.c9
-rw-r--r--kernel/cpu_acct.c186
-rw-r--r--kernel/exit.c3
-rw-r--r--kernel/fork.c8
-rw-r--r--kernel/futex.c11
-rw-r--r--kernel/futex_compat.c26
-rw-r--r--kernel/hrtimer.c2
-rw-r--r--kernel/irq/handle.c8
-rw-r--r--kernel/lockdep.c2
-rw-r--r--kernel/marker.c41
-rw-r--r--kernel/module.c8
-rw-r--r--kernel/params.c15
-rw-r--r--kernel/pid.c2
-rw-r--r--kernel/power/disk.c12
-rw-r--r--kernel/resource.c2
-rw-r--r--kernel/sched.c201
-rw-r--r--kernel/sched_debug.c9
-rw-r--r--kernel/sched_fair.c98
-rw-r--r--kernel/sched_stats.h11
-rw-r--r--kernel/signal.c6
-rw-r--r--kernel/sys.c20
-rw-r--r--kernel/sys_ni.c4
-rw-r--r--kernel/sysctl.c27
-rw-r--r--kernel/sysctl_check.c48
-rw-r--r--kernel/taskstats.c36
-rw-r--r--kernel/time/ntp.c11
-rw-r--r--kernel/time/tick-broadcast.c2
-rw-r--r--kernel/time/tick-sched.c4
-rw-r--r--kernel/time/timer_list.c6
-rw-r--r--kernel/timer.c23
-rw-r--r--kernel/user.c7
-rw-r--r--lib/Kconfig.debug4
-rw-r--r--lib/Makefile4
-rw-r--r--lib/bitmap.c4
-rw-r--r--lib/kobject.c13
-rw-r--r--lib/libcrc32c.c7
-rw-r--r--mm/filemap.c30
-rw-r--r--mm/hugetlb.c95
-rw-r--r--mm/memory.c5
-rw-r--r--mm/memory_hotplug.c6
-rw-r--r--mm/mempolicy.c21
-rw-r--r--mm/nommu.c1
-rw-r--r--mm/page-writeback.c27
-rw-r--r--mm/page_alloc.c20
-rw-r--r--mm/page_isolation.c6
-rw-r--r--mm/rmap.c16
-rw-r--r--mm/shmem.c15
-rw-r--r--mm/slab.c2
-rw-r--r--mm/slob.c3
-rw-r--r--mm/slub.c24
-rw-r--r--mm/sparse-vmemmap.c1
-rw-r--r--mm/sparse.c11
-rw-r--r--mm/util.c4
-rw-r--r--mm/vmstat.c2
-rw-r--r--net/8021q/vlan.c6
-rw-r--r--net/8021q/vlan.h1
-rw-r--r--net/8021q/vlan_dev.c26
-rw-r--r--net/9p/mod.c4
-rw-r--r--net/9p/trans_fd.c3
-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/bridge/br_netfilter.c3
-rw-r--r--net/bridge/netfilter/ebt_among.c2
-rw-r--r--net/bridge/netfilter/ebt_arp.c2
-rw-r--r--net/core/dev.c149
-rw-r--r--net/core/dev_mcast.c16
-rw-r--r--net/core/dst.c1
-rw-r--r--net/core/fib_rules.c22
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/net_namespace.c182
-rw-r--r--net/core/netpoll.c37
-rw-r--r--net/core/pktgen.c2
-rw-r--r--net/core/request_sock.c35
-rw-r--r--net/core/skbuff.c47
-rw-r--r--net/core/sock.c178
-rw-r--r--net/dccp/ccids/lib/loss_interval.c2
-rw-r--r--net/dccp/ipv4.c3
-rw-r--r--net/dccp/ipv6.c3
-rw-r--r--net/dccp/proto.c9
-rw-r--r--net/decnet/af_decnet.c2
-rw-r--r--net/decnet/dn_dev.c2
-rw-r--r--net/decnet/dn_route.c16
-rw-r--r--net/decnet/dn_rules.c13
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ieee80211/ieee80211_crypt_ccmp.c3
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c5
-rw-r--r--net/ieee80211/ieee80211_crypt_wep.c1
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_wx.c2
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/ah4.c1
-rw-r--r--net/ipv4/arp.c22
-rw-r--r--net/ipv4/esp4.c12
-rw-r--r--net/ipv4/fib_frontend.c15
-rw-r--r--net/ipv4/fib_rules.c51
-rw-r--r--net/ipv4/inet_diag.c9
-rw-r--r--net/ipv4/inet_hashtables.c7
-rw-r--r--net/ipv4/inet_timewait_sock.c13
-rw-r--r--net/ipv4/inetpeer.c42
-rw-r--r--net/ipv4/ip_output.c28
-rw-r--r--net/ipv4/ip_sockglue.c39
-rw-r--r--net/ipv4/ipcomp.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_conn.c18
-rw-r--r--net/ipv4/ipvs/ip_vs_core.c22
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c49
-rw-r--r--net/ipv4/ipvs/ip_vs_lblc.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_lblcr.c78
-rw-r--r--net/ipv4/ipvs/ip_vs_proto.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_sync.c29
-rw-r--r--net/ipv4/netfilter/Kconfig4
-rw-r--r--net/ipv4/netfilter/Makefile20
-rw-r--r--net/ipv4/netfilter/ip_queue.c37
-rw-r--r--net/ipv4/netfilter/iptable_raw.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_amanda.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c7
-rw-r--r--net/ipv4/netfilter/nf_nat_ftp.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_h323.c18
-rw-r--r--net/ipv4/netfilter/nf_nat_irc.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_pptp.c8
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_tftp.c2
-rw-r--r--net/ipv4/proc.c21
-rw-r--r--net/ipv4/raw.c3
-rw-r--r--net/ipv4/route.c28
-rw-r--r--net/ipv4/sysctl_net_ipv4.c2
-rw-r--r--net/ipv4/tcp.c6
-rw-r--r--net/ipv4/tcp_input.c142
-rw-r--r--net/ipv4/tcp_ipv4.c37
-rw-r--r--net/ipv4/tcp_output.c21
-rw-r--r--net/ipv4/tcp_vegas.c37
-rw-r--r--net/ipv4/tunnel4.c24
-rw-r--r--net/ipv4/udp.c3
-rw-r--r--net/ipv4/udplite.c3
-rw-r--r--net/ipv6/addrconf.c6
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/ah6.c1
-rw-r--r--net/ipv6/esp6.c13
-rw-r--r--net/ipv6/fib6_rules.c37
-rw-r--r--net/ipv6/inet6_hashtables.c19
-rw-r--r--net/ipv6/ip6_output.c36
-rw-r--r--net/ipv6/ipcomp6.c4
-rw-r--r--net/ipv6/ndisc.c3
-rw-r--r--net/ipv6/netfilter/Makefile28
-rw-r--r--net/ipv6/netfilter/ip6_queue.c37
-rw-r--r--net/ipv6/proc.c19
-rw-r--r--net/ipv6/raw.c3
-rw-r--r--net/ipv6/route.c97
-rw-r--r--net/ipv6/tcp_ipv6.c26
-rw-r--r--net/ipv6/udp.c8
-rw-r--r--net/ipv6/udplite.c3
-rw-r--r--net/ipx/af_ipx.c24
-rw-r--r--net/irda/af_irda.c2
-rw-r--r--net/irda/iriap.c2
-rw-r--r--net/irda/irlan/irlan_eth.c2
-rw-r--r--net/irda/irnet/irnet_ppp.c10
-rw-r--r--net/iucv/af_iucv.c2
-rw-r--r--net/iucv/iucv.c107
-rw-r--r--net/key/af_key.c10
-rw-r--r--net/llc/llc_conn.c2
-rw-r--r--net/mac80211/Kconfig12
-rw-r--r--net/mac80211/Makefile3
-rw-r--r--net/mac80211/aes_ccm.c1
-rw-r--r--net/mac80211/ieee80211.c43
-rw-r--r--net/mac80211/ieee80211_common.h91
-rw-r--r--net/mac80211/ieee80211_i.h4
-rw-r--r--net/mac80211/ieee80211_ioctl.c21
-rw-r--r--net/mac80211/ieee80211_rate.c24
-rw-r--r--net/mac80211/ieee80211_rate.h3
-rw-r--r--net/mac80211/ieee80211_sta.c28
-rw-r--r--net/mac80211/rc80211_simple.c25
-rw-r--r--net/mac80211/rx.c2
-rw-r--r--net/mac80211/wep.c2
-rw-r--r--net/mac80211/wpa.c18
-rw-r--r--net/netfilter/Kconfig2
-rw-r--r--net/netfilter/Makefile14
-rw-r--r--net/netfilter/nf_conntrack_core.c2
-rw-r--r--net/netfilter/nf_conntrack_extend.c2
-rw-r--r--net/netfilter/nf_sockopt.c117
-rw-r--r--net/netfilter/xt_connlimit.c5
-rw-r--r--net/netfilter/xt_time.c5
-rw-r--r--net/netfilter/xt_u32.c5
-rw-r--r--net/netlink/af_netlink.c14
-rw-r--r--net/netrom/af_netrom.c6
-rw-r--r--net/packet/af_packet.c33
-rw-r--r--net/rfkill/rfkill.c37
-rw-r--r--net/rose/af_rose.c6
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/rxrpc/ar-local.c4
-rw-r--r--net/rxrpc/rxkad.c9
-rw-r--r--net/sched/cls_u32.c14
-rw-r--r--net/sched/sch_generic.c5
-rw-r--r--net/sched/sch_teql.c3
-rw-r--r--net/sctp/associola.c10
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sctp/bind_addr.c13
-rw-r--r--net/sctp/endpointola.c35
-rw-r--r--net/sctp/input.c43
-rw-r--r--net/sctp/inqueue.c4
-rw-r--r--net/sctp/ipv6.c2
-rw-r--r--net/sctp/outqueue.c41
-rw-r--r--net/sctp/proc.c6
-rw-r--r--net/sctp/protocol.c10
-rw-r--r--net/sctp/sm_make_chunk.c170
-rw-r--r--net/sctp/sm_sideeffect.c10
-rw-r--r--net/sctp/sm_statefuns.c14
-rw-r--r--net/sctp/socket.c22
-rw-r--r--net/sctp/sysctl.c9
-rw-r--r--net/sctp/transport.c5
-rw-r--r--net/sctp/ulpqueue.c2
-rw-r--r--net/socket.c11
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c4
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c6
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_mech.c8
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_seal.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_wrap.c1
-rw-r--r--net/sunrpc/rpc_pipe.c2
-rw-r--r--net/sunrpc/sysctl.c3
-rw-r--r--net/sunrpc/xprt.c2
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c34
-rw-r--r--net/sunrpc/xprtrdma/transport.c12
-rw-r--r--net/sunrpc/xprtsock.c4
-rw-r--r--net/tipc/socket.c2
-rw-r--r--net/unix/af_unix.c11
-rw-r--r--net/unix/garbage.c26
-rw-r--r--net/wireless/wext.c2
-rw-r--r--net/x25/af_x25.c2
-rw-r--r--net/xfrm/xfrm_algo.c1
-rw-r--r--net/xfrm/xfrm_state.c2
-rw-r--r--net/xfrm/xfrm_user.c2
-rw-r--r--samples/markers/marker-example.c3
-rw-r--r--samples/markers/probe-example.c2
-rw-r--r--scripts/kconfig/Makefile7
-rw-r--r--scripts/kconfig/confdata.c119
-rw-r--r--security/commoncap.c4
-rw-r--r--security/selinux/ss/avtab.c32
-rw-r--r--security/selinux/ss/avtab.h5
-rw-r--r--security/selinux/ss/conditional.c3
-rw-r--r--security/selinux/ss/ebitmap.c2
-rw-r--r--security/selinux/ss/mls.c66
-rw-r--r--security/selinux/ss/mls.h2
-rw-r--r--security/selinux/ss/policydb.c45
-rw-r--r--security/selinux/ss/policydb.h3
-rw-r--r--security/selinux/xfrm.c13
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c12
-rw-r--r--sound/drivers/portman2x4.c2
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c18
-rw-r--r--sound/pci/ca0106/ca0106_proc.c4
-rw-r--r--sound/pci/cmipci.c5
-rw-r--r--sound/pci/emu10k1/emumixer.c65
-rw-r--r--sound/pci/emu10k1/p16v.c4
-rw-r--r--sound/pci/hda/hda_codec.c40
-rw-r--r--sound/pci/hda/hda_local.h1
-rw-r--r--sound/pci/hda/patch_analog.c8
-rw-r--r--sound/pci/hda/patch_realtek.c1
-rw-r--r--sound/pci/hda/patch_sigmatel.c57
-rw-r--r--sound/soc/codecs/cs4270.c3
-rw-r--r--sound/soc/s3c24xx/s3c2443-ac97.c2
1560 files changed, 27051 insertions, 19033 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/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index ab82b7f53312..d6cb1a86fd61 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -25,6 +25,7 @@
25 25
26#include <linux/genetlink.h> 26#include <linux/genetlink.h>
27#include <linux/taskstats.h> 27#include <linux/taskstats.h>
28#include <linux/cgroupstats.h>
28 29
29/* 30/*
30 * Generic macros for dealing with netlink sockets. Might be duplicated 31 * Generic macros for dealing with netlink sockets. Might be duplicated
@@ -78,6 +79,7 @@ static void usage(void)
78 fprintf(stderr, " -i: print IO accounting (works only with -p)\n"); 79 fprintf(stderr, " -i: print IO accounting (works only with -p)\n");
79 fprintf(stderr, " -l: listen forever\n"); 80 fprintf(stderr, " -l: listen forever\n");
80 fprintf(stderr, " -v: debug on\n"); 81 fprintf(stderr, " -v: debug on\n");
82 fprintf(stderr, " -C: container path\n");
81} 83}
82 84
83/* 85/*
@@ -212,6 +214,14 @@ void task_context_switch_counts(struct taskstats *t)
212 t->nvcsw, t->nivcsw); 214 t->nvcsw, t->nivcsw);
213} 215}
214 216
217void print_cgroupstats(struct cgroupstats *c)
218{
219 printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, "
220 "uninterruptible %llu\n", c->nr_sleeping, c->nr_io_wait,
221 c->nr_running, c->nr_stopped, c->nr_uninterruptible);
222}
223
224
215void print_ioacct(struct taskstats *t) 225void print_ioacct(struct taskstats *t)
216{ 226{
217 printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n", 227 printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n",
@@ -239,11 +249,14 @@ int main(int argc, char *argv[])
239 int maskset = 0; 249 int maskset = 0;
240 char *logfile = NULL; 250 char *logfile = NULL;
241 int loop = 0; 251 int loop = 0;
252 int containerset = 0;
253 char containerpath[1024];
254 int cfd = 0;
242 255
243 struct msgtemplate msg; 256 struct msgtemplate msg;
244 257
245 while (1) { 258 while (1) {
246 c = getopt(argc, argv, "qdiw:r:m:t:p:vl"); 259 c = getopt(argc, argv, "qdiw:r:m:t:p:vlC:");
247 if (c < 0) 260 if (c < 0)
248 break; 261 break;
249 262
@@ -260,6 +273,10 @@ int main(int argc, char *argv[])
260 printf("printing task/process context switch rates\n"); 273 printf("printing task/process context switch rates\n");
261 print_task_context_switch_counts = 1; 274 print_task_context_switch_counts = 1;
262 break; 275 break;
276 case 'C':
277 containerset = 1;
278 strncpy(containerpath, optarg, strlen(optarg) + 1);
279 break;
263 case 'w': 280 case 'w':
264 logfile = strdup(optarg); 281 logfile = strdup(optarg);
265 printf("write to file %s\n", logfile); 282 printf("write to file %s\n", logfile);
@@ -334,6 +351,11 @@ int main(int argc, char *argv[])
334 } 351 }
335 } 352 }
336 353
354 if (tid && containerset) {
355 fprintf(stderr, "Select either -t or -C, not both\n");
356 goto err;
357 }
358
337 if (tid) { 359 if (tid) {
338 rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET, 360 rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
339 cmd_type, &tid, sizeof(__u32)); 361 cmd_type, &tid, sizeof(__u32));
@@ -344,6 +366,20 @@ int main(int argc, char *argv[])
344 } 366 }
345 } 367 }
346 368
369 if (containerset) {
370 cfd = open(containerpath, O_RDONLY);
371 if (cfd < 0) {
372 perror("error opening container file");
373 goto err;
374 }
375 rc = send_cmd(nl_sd, id, mypid, CGROUPSTATS_CMD_GET,
376 CGROUPSTATS_CMD_ATTR_FD, &cfd, sizeof(__u32));
377 if (rc < 0) {
378 perror("error sending cgroupstats command");
379 goto err;
380 }
381 }
382
347 do { 383 do {
348 int i; 384 int i;
349 385
@@ -422,6 +458,9 @@ int main(int argc, char *argv[])
422 } 458 }
423 break; 459 break;
424 460
461 case CGROUPSTATS_TYPE_CGROUP_STATS:
462 print_cgroupstats(NLA_DATA(na));
463 break;
425 default: 464 default:
426 fprintf(stderr, "Unknown nla_type %d\n", 465 fprintf(stderr, "Unknown nla_type %d\n",
427 na->nla_type); 466 na->nla_type);
@@ -443,5 +482,7 @@ err:
443 close(nl_sd); 482 close(nl_sd);
444 if (fd) 483 if (fd)
445 close(fd); 484 close(fd);
485 if (cfd)
486 close(cfd);
446 return 0; 487 return 0;
447} 488}
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 6bb9be54ab76..20c4c8bac9d7 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -181,15 +181,6 @@ Who: Nick Piggin <npiggin@suse.de>
181 181
182--------------------------- 182---------------------------
183 183
184What: Interrupt only SA_* flags
185When: September 2007
186Why: The interrupt related SA_* flags are replaced by IRQF_* to move them
187 out of the signal namespace.
188
189Who: Thomas Gleixner <tglx@linutronix.de>
190
191---------------------------
192
193What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment 184What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment
194When: October 2008 185When: October 2008
195Why: The stacking of class devices makes these values misleading and 186Why: The stacking of class devices makes these values misleading and
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface
index a17b692d2679..f4a8ebc1ef1a 100644
--- a/Documentation/hwmon/sysfs-interface
+++ b/Documentation/hwmon/sysfs-interface
@@ -328,6 +328,37 @@ curr[1-*]_input Current input value
328 Unit: milliampere 328 Unit: milliampere
329 RO 329 RO
330 330
331*********
332* Power *
333*********
334
335power[1-*]_average Average power use
336 Unit: microWatt
337 RO
338
339power[1-*]_average_highest Historical average maximum power use
340 Unit: microWatt
341 RO
342
343power[1-*]_average_lowest Historical average minimum power use
344 Unit: microWatt
345 RO
346
347power[1-*]_input Instantaneous power use
348 Unit: microWatt
349 RO
350
351power[1-*]_input_highest Historical maximum power use
352 Unit: microWatt
353 RO
354
355power[1-*]_input_lowest Historical minimum power use
356 Unit: microWatt
357 RO
358
359power[1-*]_reset_history Reset input_highest, input_lowest,
360 average_highest and average_lowest.
361 WO
331 362
332********** 363**********
333* Alarms * 364* Alarms *
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 8ae5fac08dfa..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
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index f2668390e8f7..9b0e322118b5 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -62,8 +62,8 @@ typedef uint8_t u8;
62#endif 62#endif
63/* We can have up to 256 pages for devices. */ 63/* We can have up to 256 pages for devices. */
64#define DEVICE_PAGES 256 64#define DEVICE_PAGES 256
65/* This fits nicely in a single 4096-byte page. */ 65/* This will occupy 2 pages: it must be a power of 2. */
66#define VIRTQUEUE_NUM 127 66#define VIRTQUEUE_NUM 128
67 67
68/*L:120 verbose is both a global flag and a macro. The C preprocessor allows 68/*L:120 verbose is both a global flag and a macro. The C preprocessor allows
69 * this, and although I wouldn't recommend it, it works quite nicely here. */ 69 * this, and although I wouldn't recommend it, it works quite nicely here. */
@@ -1036,16 +1036,22 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1036 void *p; 1036 void *p;
1037 1037
1038 /* First we need some pages for this virtqueue. */ 1038 /* First we need some pages for this virtqueue. */
1039 pages = (vring_size(num_descs) + getpagesize() - 1) / getpagesize(); 1039 pages = (vring_size(num_descs, getpagesize()) + getpagesize() - 1)
1040 / getpagesize();
1040 p = get_pages(pages); 1041 p = get_pages(pages);
1041 1042
1043 /* Initialize the virtqueue */
1044 vq->next = NULL;
1045 vq->last_avail_idx = 0;
1046 vq->dev = dev;
1047
1042 /* Initialize the configuration. */ 1048 /* Initialize the configuration. */
1043 vq->config.num = num_descs; 1049 vq->config.num = num_descs;
1044 vq->config.irq = devices.next_irq++; 1050 vq->config.irq = devices.next_irq++;
1045 vq->config.pfn = to_guest_phys(p) / getpagesize(); 1051 vq->config.pfn = to_guest_phys(p) / getpagesize();
1046 1052
1047 /* Initialize the vring. */ 1053 /* Initialize the vring. */
1048 vring_init(&vq->vring, num_descs, p); 1054 vring_init(&vq->vring, num_descs, p, getpagesize());
1049 1055
1050 /* Add the configuration information to this device's descriptor. */ 1056 /* Add the configuration information to this device's descriptor. */
1051 add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE, 1057 add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE,
@@ -1056,9 +1062,6 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1056 for (i = &dev->vq; *i; i = &(*i)->next); 1062 for (i = &dev->vq; *i; i = &(*i)->next);
1057 *i = vq; 1063 *i = vq;
1058 1064
1059 /* Link virtqueue back to device. */
1060 vq->dev = dev;
1061
1062 /* Set the routine to call when the Guest does something to this 1065 /* Set the routine to call when the Guest does something to this
1063 * virtqueue. */ 1066 * virtqueue. */
1064 vq->handle_output = handle_output; 1067 vq->handle_output = handle_output;
@@ -1092,6 +1095,7 @@ static struct device *new_device(const char *name, u16 type, int fd,
1092 dev->desc = new_dev_desc(type); 1095 dev->desc = new_dev_desc(type);
1093 dev->handle_input = handle_input; 1096 dev->handle_input = handle_input;
1094 dev->name = name; 1097 dev->name = name;
1098 dev->vq = NULL;
1095 return dev; 1099 return dev;
1096} 1100}
1097 1101
@@ -1342,7 +1346,7 @@ static bool service_io(struct device *dev)
1342 if (out->type & VIRTIO_BLK_T_SCSI_CMD) { 1346 if (out->type & VIRTIO_BLK_T_SCSI_CMD) {
1343 fprintf(stderr, "Scsi commands unsupported\n"); 1347 fprintf(stderr, "Scsi commands unsupported\n");
1344 in->status = VIRTIO_BLK_S_UNSUPP; 1348 in->status = VIRTIO_BLK_S_UNSUPP;
1345 wlen = sizeof(in); 1349 wlen = sizeof(*in);
1346 } else if (out->type & VIRTIO_BLK_T_OUT) { 1350 } else if (out->type & VIRTIO_BLK_T_OUT) {
1347 /* Write */ 1351 /* Write */
1348 1352
@@ -1363,7 +1367,7 @@ static bool service_io(struct device *dev)
1363 /* Die, bad Guest, die. */ 1367 /* Die, bad Guest, die. */
1364 errx(1, "Write past end %llu+%u", off, ret); 1368 errx(1, "Write past end %llu+%u", off, ret);
1365 } 1369 }
1366 wlen = sizeof(in); 1370 wlen = sizeof(*in);
1367 in->status = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR); 1371 in->status = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR);
1368 } else { 1372 } else {
1369 /* Read */ 1373 /* Read */
@@ -1376,10 +1380,10 @@ static bool service_io(struct device *dev)
1376 ret = readv(vblk->fd, iov+1, in_num-1); 1380 ret = readv(vblk->fd, iov+1, in_num-1);
1377 verbose("READ from sector %llu: %i\n", out->sector, ret); 1381 verbose("READ from sector %llu: %i\n", out->sector, ret);
1378 if (ret >= 0) { 1382 if (ret >= 0) {
1379 wlen = sizeof(in) + ret; 1383 wlen = sizeof(*in) + ret;
1380 in->status = VIRTIO_BLK_S_OK; 1384 in->status = VIRTIO_BLK_S_OK;
1381 } else { 1385 } else {
1382 wlen = sizeof(in); 1386 wlen = sizeof(*in);
1383 in->status = VIRTIO_BLK_S_IOERR; 1387 in->status = VIRTIO_BLK_S_IOERR;
1384 } 1388 }
1385 } 1389 }
diff --git a/Documentation/local_ops.txt b/Documentation/local_ops.txt
index 4269a1105b37..1a45f11e645e 100644
--- a/Documentation/local_ops.txt
+++ b/Documentation/local_ops.txt
@@ -68,6 +68,29 @@ typedef struct { atomic_long_t a; } local_t;
68 variable can be read when reading some _other_ cpu's variables. 68 variable can be read when reading some _other_ cpu's variables.
69 69
70 70
71* Rules to follow when using local atomic operations
72
73- Variables touched by local ops must be per cpu variables.
74- _Only_ the CPU owner of these variables must write to them.
75- This CPU can use local ops from any context (process, irq, softirq, nmi, ...)
76 to update its local_t variables.
77- Preemption (or interrupts) must be disabled when using local ops in
78 process context to make sure the process won't be migrated to a
79 different CPU between getting the per-cpu variable and doing the
80 actual local op.
81- When using local ops in interrupt context, no special care must be
82 taken on a mainline kernel, since they will run on the local CPU with
83 preemption already disabled. I suggest, however, to explicitly
84 disable preemption anyway to make sure it will still work correctly on
85 -rt kernels.
86- Reading the local cpu variable will provide the current copy of the
87 variable.
88- Reads of these variables can be done from any CPU, because updates to
89 "long", aligned, variables are always atomic. Since no memory
90 synchronization is done by the writer CPU, an outdated copy of the
91 variable can be read when reading some _other_ cpu's variables.
92
93
71* How to use local atomic operations 94* How to use local atomic operations
72 95
73#include <linux/percpu.h> 96#include <linux/percpu.h>
diff --git a/Documentation/markers.txt b/Documentation/markers.txt
index 295a71bc301e..d9f50a19fa0c 100644
--- a/Documentation/markers.txt
+++ b/Documentation/markers.txt
@@ -35,12 +35,14 @@ In order to use the macro trace_mark, you should include linux/marker.h.
35 35
36And, 36And,
37 37
38trace_mark(subsystem_event, "%d %s", someint, somestring); 38trace_mark(subsystem_event, "myint %d mystring %s", someint, somestring);
39Where : 39Where :
40- subsystem_event is an identifier unique to your event 40- subsystem_event is an identifier unique to your event
41 - subsystem is the name of your subsystem. 41 - subsystem is the name of your subsystem.
42 - event is the name of the event to mark. 42 - event is the name of the event to mark.
43- "%d %s" is the formatted string for the serializer. 43- "myint %d mystring %s" is the formatted string for the serializer. "myint" and
44 "mystring" are repectively the field names associated with the first and
45 second parameter.
44- someint is an integer. 46- someint is an integer.
45- somestring is a char pointer. 47- somestring is a char pointer.
46 48
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX
index f5a5e6d3d541..563e442f2d42 100644
--- a/Documentation/networking/00-INDEX
+++ b/Documentation/networking/00-INDEX
@@ -4,8 +4,6 @@
4 - information on the 3Com EtherLink Plus (3c505) driver. 4 - information on the 3Com EtherLink Plus (3c505) driver.
56pack.txt 56pack.txt
6 - info on the 6pack protocol, an alternative to KISS for AX.25 6 - info on the 6pack protocol, an alternative to KISS for AX.25
7Configurable
8 - info on some of the configurable network parameters
9DLINK.txt 7DLINK.txt
10 - info on the D-Link DE-600/DE-620 parallel port pocket adapters 8 - info on the D-Link DE-600/DE-620 parallel port pocket adapters
11PLIP.txt 9PLIP.txt
@@ -26,8 +24,6 @@ baycom.txt
26 - info on the driver for Baycom style amateur radio modems 24 - info on the driver for Baycom style amateur radio modems
27bridge.txt 25bridge.txt
28 - where to get user space programs for ethernet bridging with Linux. 26 - where to get user space programs for ethernet bridging with Linux.
29comx.txt
30 - info on drivers for COMX line of synchronous serial adapters.
31cops.txt 27cops.txt
32 - info on the COPS LocalTalk Linux driver 28 - info on the COPS LocalTalk Linux driver
33cs89x0.txt 29cs89x0.txt
@@ -78,20 +74,14 @@ ltpc.txt
78 - the Apple or Farallon LocalTalk PC card driver 74 - the Apple or Farallon LocalTalk PC card driver
79multicast.txt 75multicast.txt
80 - Behaviour of cards under Multicast 76 - Behaviour of cards under Multicast
81ncsa-telnet
82 - notes on how NCSA telnet (DOS) breaks with MTU discovery enabled.
83netdevices.txt 77netdevices.txt
84 - info on network device driver functions exported to the kernel. 78 - info on network device driver functions exported to the kernel.
85olympic.txt 79olympic.txt
86 - IBM PCI Pit/Pit-Phy/Olympic Token Ring driver info. 80 - IBM PCI Pit/Pit-Phy/Olympic Token Ring driver info.
87policy-routing.txt 81policy-routing.txt
88 - IP policy-based routing 82 - IP policy-based routing
89pt.txt
90 - the Gracilis Packetwin AX.25 device driver
91ray_cs.txt 83ray_cs.txt
92 - Raylink Wireless LAN card driver info. 84 - Raylink Wireless LAN card driver info.
93routing.txt
94 - the new routing mechanism
95shaper.txt 85shaper.txt
96 - info on the module that can shape/limit transmitted traffic. 86 - info on the module that can shape/limit transmitted traffic.
97sk98lin.txt 87sk98lin.txt
diff --git a/Documentation/networking/3c505.txt b/Documentation/networking/3c505.txt
index b9d5b7230118..72f38b13101d 100644
--- a/Documentation/networking/3c505.txt
+++ b/Documentation/networking/3c505.txt
@@ -14,8 +14,7 @@ If no base address is given at boot time, the driver will autoprobe
14ports 0x300, 0x280 and 0x310 (in that order). If no IRQ is given, the driver 14ports 0x300, 0x280 and 0x310 (in that order). If no IRQ is given, the driver
15will try to probe for it. 15will try to probe for it.
16 16
17The driver can be used as a loadable module. See net-modules.txt for details 17The driver can be used as a loadable module.
18of the parameters it can take.
19 18
20Theoretically, one instance of the driver can now run multiple cards, 19Theoretically, one instance of the driver can now run multiple cards,
21in the standard way (when loading a module, say "modprobe 3c505 20in the standard way (when loading a module, say "modprobe 3c505
diff --git a/Documentation/networking/Configurable b/Documentation/networking/Configurable
deleted file mode 100644
index 69c0dd466ead..000000000000
--- a/Documentation/networking/Configurable
+++ /dev/null
@@ -1,34 +0,0 @@
1
2There are a few network parameters that can be tuned to better match
3the kernel to your system hardware and intended usage. The defaults
4are usually a good choice for 99% of the people 99% of the time, but
5you should be aware they do exist and can be changed.
6
7The current list of parameters can be found in the files:
8
9 linux/net/TUNABLE
10 Documentation/networking/ip-sysctl.txt
11
12Some of these are accessible via the sysctl interface, and many more are
13scheduled to be added in this way. For example, some parameters related
14to Address Resolution Protocol (ARP) are very easily viewed and altered.
15
16 # cat /proc/sys/net/ipv4/arp_timeout
17 6000
18 # echo 7000 > /proc/sys/net/ipv4/arp_timeout
19 # cat /proc/sys/net/ipv4/arp_timeout
20 7000
21
22Others are already accessible via the related user space programs.
23For example, MAX_WINDOW has a default of 32 k which is a good choice for
24modern hardware, but if you have a slow (8 bit) Ethernet card and/or a slow
25machine, then this will be far too big for the card to keep up with fast
26machines transmitting on the same net, resulting in overruns and receive errors.
27A value of about 4 k would be more appropriate, which can be set via:
28
29 # route add -net 192.168.3.0 window 4096
30
31The remainder of these can only be presently changed by altering a #define
32in the related header file. This means an edit and recompile cycle.
33
34 Paul Gortmaker 06/96
diff --git a/Documentation/networking/comx.txt b/Documentation/networking/comx.txt
deleted file mode 100644
index d1526eba2645..000000000000
--- a/Documentation/networking/comx.txt
+++ /dev/null
@@ -1,248 +0,0 @@
1
2 COMX drivers for the 2.2 kernel
3
4Originally written by: Tivadar Szemethy, <tiv@itc.hu>
5Currently maintained by: Gergely Madarasz <gorgo@itc.hu>
6
7Last change: 21/06/1999.
8
9INTRODUCTION
10
11This document describes the software drivers and their use for the
12COMX line of synchronous serial adapters for Linux version 2.2.0 and
13above.
14The cards are produced and sold by ITC-Pro Ltd. Budapest, Hungary
15For further info contact <info@itc.hu>
16or http://www.itc.hu (mostly in Hungarian).
17The firmware files and software are available from ftp://ftp.itc.hu
18
19Currently, the drivers support the following cards and protocols:
20
21COMX (2x64 kbps intelligent board)
22CMX (1x256 + 1x128 kbps intelligent board)
23HiCOMX (2x2Mbps intelligent board)
24LoCOMX (1x512 kbps passive board)
25MixCOM (1x512 or 2x512kbps passive board with a hardware watchdog an
26 optional BRI interface and optional flashROM (1-32M))
27SliceCOM (1x2Mbps channelized E1 board)
28PciCOM (X21)
29
30At the moment of writing this document, the (Cisco)-HDLC, LAPB, SyncPPP and
31Frame Relay (DTE, rfc1294 IP encapsulation with partially implemented Q933a
32LMI) protocols are available as link-level protocol.
33X.25 support is being worked on.
34
35USAGE
36
37Load the comx.o module and the hardware-specific and protocol-specific
38modules you'll need into the running kernel using the insmod utility.
39This creates the /proc/comx directory.
40See the example scripts in the 'etc' directory.
41
42/proc INTERFACE INTRO
43
44The COMX driver set has a new type of user interface based on the /proc
45filesystem which eliminates the need for external user-land software doing
46IOCTL calls.
47Each network interface or device (i.e. those ones you configure with 'ifconfig'
48and 'route' etc.) has a corresponding directory under /proc/comx. You can
49dynamically create a new interface by saying 'mkdir /proc/comx/comx0' (or you
50can name it whatever you want up to 8 characters long, comx[n] is just a
51convention).
52Generally the files contained in these directories are text files, which can
53be viewed by 'cat filename' and you can write a string to such a file by
54saying 'echo _string_ >filename'. This is very similar to the sysctl interface.
55Don't use a text editor to edit these files, always use 'echo' (or 'cat'
56where appropriate).
57When you've created the comx[n] directory, two files are created automagically
58in it: 'boardtype' and 'protocol'. You have to fill in these files correctly
59for your board and protocol you intend to use (see the board and protocol
60descriptions in this file below or the example scripts in the 'etc' directory).
61After filling in these files, other files will appear in the directory for
62setting the various hardware- and protocol-related informations (for example
63irq and io addresses, keepalive values etc.) These files are set to default
64values upon creation, so you don't necessarily have to change all of them.
65
66When you're ready with filling in the files in the comx[n] directory, you can
67configure the corresponding network interface with the standard network
68configuration utilities. If you're unable to bring the interfaces up, look up
69the various kernel log files on your system, and consult the messages for
70a probable reason.
71
72EXAMPLE
73
74To create the interface 'comx0' which is the first channel of a COMX card:
75
76insmod comx
77# insmod comx-hw-comx ; insmod comx-proto-ppp (these are usually
78autoloaded if you use the kernel module loader)
79
80mkdir /proc/comx/comx0
81echo comx >/proc/comx/comx0/boardtype
82echo 0x360 >/proc/comx/comx0/io <- jumper-selectable I/O port
83echo 0x0a >/proc/comx/comx0/irq <- jumper-selectable IRQ line
84echo 0xd000 >/proc/comx/comx0/memaddr <- software-configurable memory
85 address. COMX uses 64 KB, and this
86 can be: 0xa000, 0xb000, 0xc000,
87 0xd000, 0xe000. Avoid conflicts
88 with other hardware.
89cat </etc/siol1.rom >/proc/comx/comx0/firmware <- the firmware for the card
90echo HDLC >/proc/comx/comx0/protocol <- the data-link protocol
91echo 10 >/proc/comx/comx0/keepalive <- the keepalive for the protocol
92ifconfig comx0 1.2.3.4 pointopoint 5.6.7.8 netmask 255.255.255.255 <-
93 finally configure it with ifconfig
94Check its status:
95cat /proc/comx/comx0/status
96
97If you want to use the second channel of this board:
98
99mkdir /proc/comx/comx1
100echo comx >/proc/comx/comx1/boardtype
101echo 0x360 >/proc/comx/comx1/io
102echo 10 >/proc/comx/comx1/irq
103echo 0xd000 >/proc/comx/comx1/memaddr
104echo 1 >/proc/comx/comx1/channel <- channels are numbered
105 as 0 (default) and 1
106
107Now, check if the driver recognized that you're going to use the other
108channel of the same adapter:
109
110cat /proc/comx/comx0/twin
111comx1
112cat /proc/comx/comx1/twin
113comx0
114
115You don't have to load the firmware twice, if you use both channels of
116an adapter, just write it into the channel 0's /proc firmware file.
117
118Default values: io 0x360 for COMX, 0x320 (HICOMX), irq 10, memaddr 0xd0000
119
120THE LOCOMX HARDWARE DRIVER
121
122The LoCOMX driver doesn't require firmware, and it doesn't use memory either,
123but it uses DMA channels 1 and 3. You can set the clock rate (if enabled by
124jumpers on the board) by writing the kbps value into the file named 'clock'.
125Set it to 'external' (it is the default) if you have external clock source.
126
127(Note: currently the LoCOMX driver does not support the internal clock)
128
129THE COMX, CMX AND HICOMX DRIVERS
130
131On the HICOMX, COMX and CMX, you have to load the firmware (it is different for
132the three cards!). All these adapters can share the same memory
133address (we usually use 0xd0000). On the CMX you can set the internal
134clock rate (if enabled by jumpers on the small adapter boards) by writing
135the kbps value into the 'clock' file. You have to do this before initializing
136the card. If you use both HICOMX and CMX/COMX cards, initialize the HICOMX
137first. The I/O address of the HICOMX board is not configurable by any
138method available to the user: it is hardwired to 0x320, and if you have to
139change it, consult ITC-Pro Ltd.
140
141THE MIXCOM DRIVER
142
143The MixCOM board doesn't require firmware, the driver communicates with
144it through I/O ports. You can have three of these cards in one machine.
145
146THE SLICECOM DRIVER
147
148The SliceCOM board doesn't require firmware. You can have 4 of these cards
149in one machine. The driver doesn't (yet) support shared interrupts, so
150you will need a separate IRQ line for every board.
151Read Documentation/networking/slicecom.txt for help on configuring
152this adapter.
153
154THE HDLC/PPP LINE PROTOCOL DRIVER
155
156The HDLC/SyncPPP line protocol driver uses the kernel's built-in syncppp
157driver (syncppp.o). You don't have to manually select syncppp.o when building
158the kernel, the dependencies compile it in automatically.
159
160
161
162
163EXAMPLE
164(setting up hw parameters, see above)
165
166# using HDLC:
167echo hdlc >/proc/comx/comx0/protocol
168echo 10 >/proc/comx/comx0/keepalive <- not necessary, 10 is the default
169ifconfig comx0 1.2.3.4 pointopoint 5.6.7.8 netmask 255.255.255.255
170
171(setting up hw parameters, see above)
172
173# using PPP:
174echo ppp >/proc/comx/comx0/protocol
175ifconfig comx0 up
176ifconfig comx0 1.2.3.4 pointopoint 5.6.7.8 netmask 255.255.255.255
177
178
179THE LAPB LINE PROTOCOL DRIVER
180
181For this, you'll need to configure LAPB support (See 'LAPB Data Link Driver' in
182'Network options' section) into your kernel (thanks to Jonathan Naylor for his
183excellent implementation).
184comx-proto-lapb.o provides the following files in the appropriate directory
185(the default values in parens): t1 (5), t2 (1), n2 (20), mode (DTE, STD) and
186window (7). Agree with the administrator of your peer router on these
187settings (most people use defaults, but you have to know if you are DTE or
188DCE).
189
190EXAMPLE
191
192(setting up hw parameters, see above)
193echo lapb >/proc/comx/comx0/protocol
194echo dce >/proc/comx/comx0/mode <- DCE interface in this example
195ifconfig comx0 1.2.3.4 pointopoint 5.6.7.8 netmask 255.255.255.255
196
197
198THE FRAME RELAY PROTOCOL DRIVER
199
200You DON'T need any other frame relay related modules from the kernel to use
201COMX-Frame Relay. This protocol is a bit more complicated than the others,
202because it allows to use 'subinterfaces' or DLCIs within one physical device.
203First you have to create the 'master' device (the actual physical interface)
204as you would do for other protocols. Specify 'frad' as protocol type.
205Now you can bring this interface up by saying 'ifconfig comx0 up' (or whatever
206you've named the interface). Do not assign any IP address to this interface
207and do not set any routes through it.
208Then, set up your DLCIs the following way: create a comx interface for each
209DLCI you intend to use (with mkdir), and write 'dlci' to the 'boardtype' file,
210and 'ietf-ip' to the 'protocol' file. Currently, the only supported
211encapsulation type is this (also called as RFC1294/1490 IP encapsulation).
212Write the DLCI number to the 'dlci' file, and write the name of the physical
213COMX device to the file called 'master'.
214Now you can assign an IP address to this interface and set routes using it.
215See the example file for further info and example config script.
216Notes: this driver implements a DTE interface with partially implemented
217Q933a LMI.
218You can find an extensively commented example in the 'etc' directory.
219
220FURTHER /proc FILES
221
222boardtype:
223Type of the hardware. Valid values are:
224 'comx', 'hicomx', 'locomx', 'cmx', 'slicecom'.
225
226protocol:
227Data-link protocol on this channel. Can be: HDLC, LAPB, PPP, FRAD
228
229status:
230You can read the channel's actual status from the 'status' file, for example
231'cat /proc/comx/comx3/status'.
232
233lineup_delay:
234Interpreted in seconds (default is 1). Used to avoid line jitter: the system
235will consider the line status 'UP' only if it is up for at least this number
236of seconds.
237
238debug:
239You can set various debug options through this file. Valid options are:
240'comx_events', 'comx_tx', 'comx_rx', 'hw_events', 'hw_tx', 'hw_rx'.
241You can enable a debug options by writing its name prepended by a '+' into
242the debug file, for example 'echo +comx_rx >comx0/debug'.
243Disabling an option happens similarly, use the '-' prefix
244(e.g. 'echo -hw_rx >debug').
245Debug results can be read from the debug file, for example:
246tail -f /proc/comx/comx2/debug
247
248
diff --git a/Documentation/networking/ncsa-telnet b/Documentation/networking/ncsa-telnet
deleted file mode 100644
index d77d28b09093..000000000000
--- a/Documentation/networking/ncsa-telnet
+++ /dev/null
@@ -1,16 +0,0 @@
1NCSA telnet doesn't work with path MTU discovery enabled. This is due to a
2bug in NCSA that also stops it working with other modern networking code
3such as Solaris.
4
5The following information is courtesy of
6Marek <marekm@i17linuxb.ists.pwr.wroc.pl>
7
8There is a fixed version somewhere on ftp.upe.ac.za (sorry, I don't
9remember the exact pathname, and this site is very slow from here).
10It may or may not be faster for you to get it from
11ftp://ftp.ists.pwr.wroc.pl/pub/msdos/telnet/ncsa_upe/tel23074.zip
12(source is in v230704s.zip). I have tested it with 1.3.79 (with
13path mtu discovery enabled - ncsa 2.3.08 didn't work) and it seems
14to work. I don't know if anyone is working on this code - this
15version is over a year old. Too bad - it's faster and often more
16stable than these windoze telnets, and runs on almost anything...
diff --git a/Documentation/networking/pt.txt b/Documentation/networking/pt.txt
deleted file mode 100644
index 72e888c1d988..000000000000
--- a/Documentation/networking/pt.txt
+++ /dev/null
@@ -1,58 +0,0 @@
1This is the README for the Gracilis Packetwin device driver, version 0.5
2ALPHA for Linux 1.3.43.
3
4These files will allow you to talk to the PackeTwin (now know as PT) and
5connect through it just like a pair of TNCs. To do this you will also
6require the AX.25 code in the kernel enabled.
7
8There are four files in this archive; this readme, a patch file, a .c file
9and finally a .h file. The two program files need to be put into the
10drivers/net directory in the Linux source tree, for me this is the
11directory /usr/src/linux/drivers/net. The patch file needs to be patched in
12at the top of the Linux source tree (/usr/src/linux in my case).
13
14You will most probably have to edit the pt.c file to suit your own setup,
15this should just involve changing some of the defines at the top of the file.
16Please note that if you run an external modem you must specify a speed of 0.
17
18The program is currently setup to run a 4800 baud external modem on port A
19and a Kantronics DE-9600 daughter board on port B so if you have this (or
20something similar) then you're right.
21
22To compile in the driver, put the files in the correct place and patch in
23the diff. You will have to re-configure the kernel again before you
24recompile it.
25
26The driver is not real good at the moment for finding the card. You can
27'help' it by changing the order of the potential addresses in the structure
28found in the pt_init() function so the address of where the card is is put
29first.
30
31After compiling, you have to get them going, they are pretty well like any
32other net device and just need ifconfig to get them going.
33As an example, here is my /etc/rc.net
34--------------------------
35
36#
37# Configure the PackeTwin, port A.
38/sbin/ifconfig pt0a 44.136.8.87 hw ax25 vk2xlz mtu 512
39/sbin/ifconfig pt0a 44.136.8.87 broadcast 44.136.8.255 netmask 255.255.255.0
40/sbin/route add -net 44.136.8.0 netmask 255.255.255.0 dev pt0a
41/sbin/route add -net 44.0.0.0 netmask 255.0.0.0 gw 44.136.8.68 dev pt0a
42/sbin/route add -net 138.25.16.0 netmask 255.255.240.0 dev pt0a
43/sbin/route add -host 44.136.8.255 dev pt0a
44#
45# Configure the PackeTwin, port B.
46/sbin/ifconfig pt0b 44.136.8.87 hw ax25 vk2xlz-1 mtu 512
47/sbin/ifconfig pt0b 44.136.8.87 broadcast 44.255.255.255 netmask 255.0.0.0
48/sbin/route add -host 44.136.8.216 dev pt0b
49/sbin/route add -host 44.136.8.95 dev pt0b
50/sbin/route add -host 44.255.255.255 dev pt0b
51
52This version of the driver comes under the GNU GPL. If you have one of my
53previous (non-GPL) versions of the driver, please update to this one.
54
55I hope that this all works well for you. I would be pleased to hear how
56many people use the driver and if it does its job.
57
58 - Craig vk2xlz <csmall@small.dropbear.id.au>
diff --git a/Documentation/networking/routing.txt b/Documentation/networking/routing.txt
deleted file mode 100644
index a26838b930f2..000000000000
--- a/Documentation/networking/routing.txt
+++ /dev/null
@@ -1,46 +0,0 @@
1The directory ftp.inr.ac.ru:/ip-routing contains:
2
3- iproute.c - "professional" routing table maintenance utility.
4
5- rdisc.tar.gz - rdisc daemon, ported from Sun.
6 STRONGLY RECOMMENDED FOR ALL HOSTS.
7
8- routing.tgz - original Mike McLagan's route by source patch.
9 Currently it is obsolete.
10
11- gated.dif-ss<NEWEST>.gz - gated-R3_6Alpha_2 fixes.
12 Look at README.gated
13
14- mrouted-3.8.dif.gz - mrouted-3.8 fixes.
15
16- rtmon.c - trivial debugging utility: reads and stores netlink.
17
18
19NEWS for user.
20
21- Policy based routing. Routing decisions are made on the basis
22 not only of destination address, but also source address,
23 TOS and incoming interface.
24- Complete set of IP level control messages.
25 Now Linux is the only OS in the world complying to RFC requirements.
26 Great win 8)
27- New interface addressing paradigm.
28 Assignment of address ranges to interface,
29 multiple prefixes etc. etc.
30 Do not bother, it is compatible with the old one. Moreover:
31- You don't need to do "route add aaa.bbb.ccc... eth0" anymore,
32 it is done automatically.
33- "Abstract" UNIX sockets and security enhancements.
34 This is necessary to use TIRPC and TLI emulation library.
35
36NEWS for hacker.
37
38- New destination cache. Flexible, robust and just beautiful.
39- Network stack is reordered, simplified, optimized, a lot of bugs fixed.
40 (well, and new bugs were introduced, but I haven't seen them yet 8))
41 It is difficult to describe all the changes, look into source.
42
43If you see this file, then this patch works 8)
44
45Alexey Kuznetsov.
46kuznet@ms2.inr.ac.ru
diff --git a/Documentation/networking/slicecom.hun b/Documentation/networking/slicecom.hun
deleted file mode 100644
index bed2f045e550..000000000000
--- a/Documentation/networking/slicecom.hun
+++ /dev/null
@@ -1,371 +0,0 @@
1
2SliceCOM adapter felhasznaloi dokumentacioja - 0.51 verziohoz
3
4Bartók István <bartoki@itc.hu>
5Utolso modositas: Wed Aug 29 17:26:58 CEST 2001
6
7-----------------------------------------------------------------
8
9Hasznalata:
10
11Forditas:
12
13Code maturity level options
14 [*] Prompt for development and/or incomplete code/drivers
15
16Network device support
17 Wan interfaces
18 <M> MultiGate (COMX) synchronous
19 <M> Support for MUNICH based boards: SliceCOM, PCICOM (NEW)
20 <M> Support for HDLC and syncPPP...
21
22
23A modulok betoltese:
24
25modprobe comx
26
27modprobe comx-proto-ppp # a Cisco-HDLC es a SyncPPP protokollt is
28 # ez a modul adja
29
30modprobe comx-hw-munich # a modul betoltodeskor azonnal jelent a
31 # syslogba a detektalt kartyakrol
32
33
34Konfiguralas:
35
36# Ezen az interfeszen Cisco-HDLC vonali protokoll fog futni
37# Az interfeszhez rendelt idoszeletek: 1,2 (128 kbit/sec-es vonal)
38# (a G.703 keretben az elso adatot vivo idoszelet az 1-es)
39#
40mkdir /proc/comx/comx0.1/
41echo slicecom >/proc/comx/comx0.1/boardtype
42echo hdlc >/proc/comx/comx0.1/protocol
43echo 1 2 >/proc/comx/comx0.1/timeslots
44
45
46# Ezen az interfeszen SyncPPP vonali protokoll fog futni
47# Az interfeszhez rendelt idoszelet: 3 (64 kbit/sec-es vonal)
48#
49mkdir /proc/comx/comx0.2/
50echo slicecom >/proc/comx/comx0.2/boardtype
51echo ppp >/proc/comx/comx0.2/protocol
52echo 3 >/proc/comx/comx0.2/timeslots
53
54...
55
56ifconfig comx0.1 up
57ifconfig comx0.2 up
58
59-----------------------------------------------------------------
60
61A COMX driverek default 20 csomagnyi transmit queue-t rendelnek a halozati
62interfeszekhez. WAN halozatokban ennel hosszabbat is szokas hasznalni
63(20 es 100 kozott), hogy a vonal kihasznaltsaga nagy terheles eseten jobb
64legyen (bar ezzel megno a varhato kesleltetes a csomagok sorban allasa miatt):
65
66# ifconfig comx0 txqueuelen 50
67
68Ezt a beallitasi lehetoseget csak az ujabb disztribuciok ifconfig parancsa
69tamogatja (amik mar a 2.2 kernelekhez keszultek, mint a RedHat 6.1 vagy a
70Debian 2.2).
71
72A 2.1-es Debian disztribuciohoz a http://www.debian.org/~rcw/2.2/netbase/
73cimrol toltheto le ujabb netbase csomag, ami mar ilyet tamogato ifconfig
74parancsot tartalmaz. Bovebben a 2.2 kernel hasznalatarol Debian 2.1 alatt:
75http://www.debian.org/releases/stable/running-kernel-2.2
76
77-----------------------------------------------------------------
78
79A kartya LED-jeinek jelentese:
80
81piros - eg, ha Remote Alarm-ot kuld a tuloldal
82zold - eg, ha a vett jelben megtalalja a keretszinkront
83
84Reszletesebben:
85
86piros: zold: jelentes:
87
88- - nincs keretszinkron (nincs jel, vagy rossz a jel)
89- eg "minden rendben"
90eg eg a vetel OK, de a tuloldal Remote Alarm-ot kuld
91eg - ez nincs ertelmezve, egyelore funkcio nelkul
92
93-----------------------------------------------------------------
94
95Reszletesebb leiras a hardver beallitasi lehetosegeirol:
96
97Az altalanos,- es a protokoll-retegek beallitasi lehetosegeirol a 'comx.txt'
98fajlban leirtak SliceCOM kartyanal is ervenyesek, itt csak a hardver-specifikus
99beallitasi lehetosegek vannak osszefoglalva:
100
101Konfiguralasi interfesz a /proc/comx/ alatt:
102
103Minden timeslot-csoportnak kulon comx* interfeszt kell letrehozni mkdir-rel:
104comx0, comx1, .. stb. Itt beallithato, hogy az adott interfesz hanyadik kartya
105melyik timeslotja(i)bol alljon ossze. A Cisco-fele serial3:1 elnevezesek
106(serial3:1 = a 3. kartyaban az 1-es idoszelet-csoport) Linuxon aliasing-ot
107jelentenenek, ezert mi nem tudunk ilyen elnevezest hasznalni.
108
109Tobb kartya eseten a comx0.1, comx0.2, ... vagy slice0.1, slice0.2 nevek
110hasznalhatoak.
111
112Tobb SliceCOM kartya is lehet egy gepben, de sajat interrupt kell mindegyiknek,
113nem tud meg megosztott interruptot kezelni.
114
115Az egesz kartyat erinto beallitasok:
116
117Az ioport es irq beallitas nincs: amit a PCI BIOS kioszt a rendszernek,
118azt hasznalja a driver.
119
120
121comx0/boardnum - hanyadik SliceCOM kartya a gepben (a 'termeszetes' PCI
122 sorrendben ertve: ahogyan a /proc/pci-ban vagy az 'lspci'
123 kimeneteben megjelenik, altalaban az alaplapi PCI meghajto
124 aramkorokhoz kozelebb eso kartyak a kisebb sorszamuak)
125
126 Default: 0 (0-tol kezdodik a szamolas)
127
128
129Bar a kovetkezoket csak egy-egy interfeszen allitjuk at, megis az egesz kartya
130mukodeset egyszerre allitjak. A megkotes hogy csak UP-ban levo interfeszen
131hasznalhatoak, azert van, mert kulonben nem vart eredmenyekre vezetne egy ilyen
132paranccsorozat:
133
134 echo 0 >boardnum
135 echo internal >clock_source
136 echo 1 >boardnum
137
138- Ez a 0-s board clock_source-at allitana at.
139
140Ezek a beallitasok megmaradnak az osszes interfesz torlesekor, de torlodnek
141a driver modul ki/betoltesekor.
142
143
144comx0/clock_source - A Tx orajelforrasa, a Cisco-val hasonlatosra keszult.
145 Hasznalata:
146
147 papaya:# echo line >/proc/comx/comx0/clock_source
148 papaya:# echo internal >/proc/comx/comx0/clock_source
149
150 line - A Tx orajelet a vett adatfolyambol dekodolja, igyekszik
151 igazodni hozza. Ha nem lat orajelet az inputon, akkor
152 atall a sajat orajelgeneratorara.
153 internal - A Tx orajelet a sajat orajelgeneratora szolgaltatja.
154
155 Default: line
156
157 Normal osszeallitas eseten a tavkozlesi szolgaltato eszkoze
158 (pl. HDSL modem) adja az orajelet, ezert ez a default.
159
160
161comx0/framing - A CRC4 ki/be kapcsolasa
162
163 A CRC4: 16 PCM keretet (A PCM keret az, amibe a 32 darab 64
164 kilobites csatorna van bemultiplexalva. Nem osszetevesztendo a HDLC
165 kerettel.) 2x8 -as csoportokra osztanak, es azokhoz 4-4 bites CRC-t
166 szamolnak. Elsosorban a vonal minosegenek a monitorozasara szolgal.
167
168 papaya:~# echo crc4 >/proc/comx/comx0/framing
169 papaya:~# echo no-crc4 >/proc/comx/comx0/framing
170
171 Default a 'crc4', a MATAV vonalak altalaban igy futnak. De ha nem
172 egyforma is a beallitas a vonal ket vegen, attol a forgalom altalaban
173 at tud menni.
174
175
176comx0/linecode - A vonali kodolas beallitasa
177
178 papaya:~# echo hdb3 >/proc/comx/comx0/linecode
179 papaya:~# echo ami >/proc/comx/comx0/linecode
180
181 Default a 'hdb3', a MATAV vonalak igy futnak.
182
183 (az AMI kodolas igen ritka E1-es vonalaknal). Ha ez a beallitas nem
184 egyezik a vonal ket vegen, akkor elofordulhat hogy a keretszinkron
185 osszejon, de CRC4-hibak es a vonalakon atvitt adatokban is hibak
186 keletkeznek (amit a HDLC/SyncPPP szinten CRC-hibaval jelez)
187
188
189comx0/reg - a kartya aramkoreinek, a MUNICH (reg) es a FALC (lbireg)
190comx0/lbireg regisztereinek kozvetlen elerese. Hasznalata:
191
192 echo >reg 0x04 0x0 - a 4-es regiszterbe 0-t ir
193 echo >reg 0x104 - printk()-val kiirja a 4-es regiszter
194 tartalmat a syslogba.
195
196 WARNING: ezek csak a fejleszteshez keszultek, sok galibat
197 lehet veluk okozni!
198
199
200comx0/loopback - A kartya G.703 jelenek a visszahurkolasara is van lehetoseg:
201
202 papaya:# echo none >/proc/comx/comx0/loopback
203 papaya:# echo local >/proc/comx/comx0/loopback
204 papaya:# echo remote >/proc/comx/comx0/loopback
205
206 none - nincs visszahurkolas, normal mukodes
207 local - a kartya a sajat maga altal adott jelet kapja vissza
208 remote - a kartya a kivulrol vett jelet adja kifele
209
210 Default: none
211
212-----------------------------------------------------------------
213
214Az interfeszhez (Cisco terminologiaban 'channel-group') kapcsolodo beallitasok:
215
216comx0/timeslots - mely timeslotok (idoszeletek) tartoznak az adott interfeszhez.
217
218 papaya:~# cat /proc/comx/comx0/timeslots
219 1 3 4 5 6
220 papaya:~#
221
222 Egy timeslot megkeresese (hanyas interfeszbe tartozik nalunk):
223
224 papaya:~# grep ' 4' /proc/comx/comx*/timeslots
225 /proc/comx/comx0/timeslots:1 3 4 5 6
226 papaya:~#
227
228 Beallitasa:
229 papaya:~# echo '1 5 2 6 7 8' >/proc/comx/comx0/timeslots
230
231 A timeslotok sorrendje nem szamit, '1 3 2' ugyanaz mint az '1 2 3'.
232
233 Beallitashoz az adott interfesznek DOWN-ban kell lennie
234 (ifconfig comx0 down), de ugyanannak a kartyanak a tobbi interfesze
235 uzemelhet kozben.
236
237 Beallitaskor leellenorzi, hogy az uj timeslotok nem utkoznek-e egy
238 masik interfesz timeslotjaival. Ha utkoznek, akkor nem allitja at.
239
240 Mindig 10-es szamrendszerben tortenik a timeslotok ertelmezese, nehogy
241 a 08, 09 alaku felirast rosszul ertelmezze.
242
243-----------------------------------------------------------------
244
245Az interfeszek es a kartya allapotanak lekerdezese:
246
247- A ' '-szel kezdodo sorok az eredeti kimenetet, a //-rel kezdodo sorok a
248magyarazatot jelzik.
249
250 papaya:~$ cat /proc/comx/comx1/status
251 Interface administrative status is UP, modem status is UP, protocol is UP
252 Modem status changes: 0, Transmitter status is IDLE, tbusy: 0
253 Interface load (input): 978376 / 947808 / 951024 bits/s (5s/5m/15m)
254 (output): 978376 / 947848 / 951024 bits/s (5s/5m/15m)
255 Debug flags: none
256 RX errors: len: 22, overrun: 1, crc: 0, aborts: 0
257 buffer overrun: 0, pbuffer overrun: 0
258 TX errors: underrun: 0
259 Line keepalive (value: 10) status UP [0]
260
261// Itt kezdodik a hardver-specifikus resz:
262 Controller status:
263 No alarms
264
265// Alarm: hibajelzes:
266//
267// No alarms - minden rendben
268//
269// LOS - Loss Of Signal - nem erzekel jelet a bemeneten.
270// AIS - Alarm Indication Signal - csak egymas utani 1-esek jonnek
271// a bemeneten, a tuloldal igy is jelezheti hogy meghibasodott vagy
272// nincs inicializalva.
273// AUXP - Auxiliary Pattern Indication - 01010101.. sorozat jon a bemeneten.
274// LFA - Loss of Frame Alignment - nincs keretszinkron
275// RRA - Receive Remote Alarm - a tuloldal el, de hibat jelez.
276// LMFA - Loss of CRC4 Multiframe Alignment - nincs CRC4-multikeret-szinkron
277// NMF - No Multiframe alignment Found after 400 msec - ilyen alarm a no-crc4
278// es crc4 keretezesek eseten nincs, lasd lentebb
279//
280// Egyeb lehetseges hibajelzesek:
281//
282// Transmit Line Short - a kartya ugy erzi hogy az adasi kimenete rovidre
283// van zarva, ezert kikapcsolta az adast. (nem feltetlenul veszi eszre
284// a kulso rovidzarat)
285
286// A veteli oldal csomagjainak lancolt listai, debug celokra:
287
288 Rx ring:
289 rafutott: 0
290 lastcheck: 50845731, jiffies: 51314281
291 base: 017b1858
292 rx_desc_ptr: 0
293 rx_desc_ptr: 017b1858
294 hw_curr_ptr: 017b1858
295 06040000 017b1868 017b1898 c016ff00
296 06040000 017b1878 017b1e9c c016ff00
297 46040000 017b1888 017b24a0 c016ff00
298 06040000 017b1858 017b2aa4 c016ff00
299
300// A kartyat hasznalo tobbi interfesz: a 0-s channel-group a comx1 interfesz,
301// es az 1,2,...,16 timeslotok tartoznak hozza:
302
303 Interfaces using this board: (channel-group, interface, timeslots)
304 0 comx1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
305 1 comx2: 17
306 2 comx3: 18
307 3 comx4: 19
308 4 comx5: 20
309 5 comx6: 21
310 6 comx7: 22
311 7 comx8: 23
312 8 comx9: 24
313 9 comx10: 25
314 10 comx11: 26
315 11 comx12: 27
316 12 comx13: 28
317 13 comx14: 29
318 14 comx15: 30
319 15 comx16: 31
320
321// Hany esemenyt kezelt le a driver egy-egy hardver-interrupt kiszolgalasanal:
322
323 Interrupt work histogram:
324 hist[ 0]: 0 hist[ 1]: 2 hist[ 2]: 18574 hist[ 3]: 79
325 hist[ 4]: 14 hist[ 5]: 1 hist[ 6]: 0 hist[ 7]: 1
326 hist[ 8]: 0 hist[ 9]: 7
327
328// Hany kikuldendo csomag volt mar a Tx-ringben amikor ujabb lett irva bele:
329
330 Tx ring histogram:
331 hist[ 0]: 2329 hist[ 1]: 0 hist[ 2]: 0 hist[ 3]: 0
332
333// Az E1-interfesz hiba-szamlaloi, az rfc2495-nek megfeleloen:
334// (kb. a Cisco routerek "show controllers e1" formatumaban: http://www.cisco.com/univercd/cc/td/doc/product/software/ios11/rbook/rinterfc.htm#xtocid25669126)
335
336Data in current interval (91 seconds elapsed):
337 9516 Line Code Violations, 65 Path Code Violations, 2 E-Bit Errors
338 0 Slip Secs, 2 Fr Loss Secs, 2 Line Err Secs, 0 Degraded Mins
339 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 11 Unavail Secs
340Data in Interval 1 (15 minutes):
341 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors
342 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins
343 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
344Data in last 4 intervals (1 hour):
345 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors
346 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins
347 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
348Data in last 96 intervals (24 hours):
349 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors
350 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins
351 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
352
353-----------------------------------------------------------------
354
355Nehany kulonlegesebb beallitasi lehetoseg (idovel beepulhetnek majd a driverbe):
356Ezekkel sok galibat lehet okozni, nagyon ovatosan kell oket hasznalni!
357
358 modified CRC-4, for improved interworking of CRC-4 and non-CRC-4
359 devices: (lasd page 107 es g706 Annex B)
360 lbireg[ 0x1b ] |= 0x08
361 lbireg[ 0x1c ] |= 0xc0
362 - ilyenkor ertelmezett az NMF - 'No Multiframe alignment Found after
363 400 msec' alarm.
364
365 FALC - a vonali meghajto IC
366 local loop - a sajat adasomat halljam vissza
367 remote loop - a kivulrol jovo adast adom vissza
368
369 Egy hibakeresesre hasznalhato dolog:
370 - 1-es timeslot local loop a FALC-ban: echo >lbireg 0x1d 0x21
371 - local loop kikapcsolasa: echo >lbireg 0x1d 0x00
diff --git a/Documentation/networking/slicecom.txt b/Documentation/networking/slicecom.txt
deleted file mode 100644
index c82c0cf981b4..000000000000
--- a/Documentation/networking/slicecom.txt
+++ /dev/null
@@ -1,369 +0,0 @@
1
2SliceCOM adapter user's documentation - for the 0.51 driver version
3
4Written by Bartók István <bartoki@itc.hu>
5
6English translation: Lakatos György <gyuri@itc.hu>
7Mon Dec 11 15:28:42 CET 2000
8
9Last modified: Wed Aug 29 17:25:37 CEST 2001
10
11-----------------------------------------------------------------
12
13Usage:
14
15Compiling the kernel:
16
17Code maturity level options
18 [*] Prompt for development and/or incomplete code/drivers
19
20Network device support
21 Wan interfaces
22 <M> MultiGate (COMX) synchronous
23 <M> Support for MUNICH based boards: SliceCOM, PCICOM (NEW)
24 <M> Support for HDLC and syncPPP...
25
26
27Loading the modules:
28
29modprobe comx
30
31modprobe comx-proto-ppp # module for Cisco-HDLC and SyncPPP protocols
32
33modprobe comx-hw-munich # the module logs information by the kernel
34 # about the detected boards
35
36
37Configuring the board:
38
39# This interface will use the Cisco-HDLC line protocol,
40# the timeslices assigned are 1,2 (128 KiBit line speed)
41# (the first data timeslice in the G.703 frame is no. 1)
42#
43mkdir /proc/comx/comx0.1/
44echo slicecom >/proc/comx/comx0.1/boardtype
45echo hdlc >/proc/comx/comx0.1/protocol
46echo 1 2 >/proc/comx/comx0.1/timeslots
47
48
49# This interface uses SyncPPP line protocol, the assigned
50# is no. 3 (64 KiBit line speed)
51#
52mkdir /proc/comx/comx0.2/
53echo slicecom >/proc/comx/comx0.2/boardtype
54echo ppp >/proc/comx/comx0.2/protocol
55echo 3 >/proc/comx/comx0.2/timeslots
56
57...
58
59ifconfig comx0.1 up
60ifconfig comx0.2 up
61
62-----------------------------------------------------------------
63
64The COMX interfaces use a 10 packet transmit queue by default, however WAN
65networks sometimes use bigger values (20 to 100), to utilize the line better
66by large traffic (though the line delay increases because of more packets
67join the queue).
68
69# ifconfig comx0 txqueuelen 50
70
71This option is only supported by the ifconfig command of the later
72distributions, which came with 2.2 kernels, such as RedHat 6.1 or Debian 2.2.
73
74You can download a newer netbase packet from
75http://www.debian.org/~rcw/2.2/netbase/ for Debian 2.1, which has a new
76ifconfig. You can get further information about using 2.2 kernel with
77Debian 2.1 from http://www.debian.org/releases/stable/running-kernel-2.2
78
79-----------------------------------------------------------------
80
81The SliceCom LEDs:
82
83red - on, if the interface is unconfigured, or it gets Remote Alarm-s
84green - on, if the board finds frame-sync in the received signal
85
86A bit more detailed:
87
88red: green: meaning:
89
90- - no frame-sync, no signal received, or signal SNAFU.
91- on "Everything is OK"
92on on Reception is ok, but the remote end sends Remote Alarm
93on - The interface is unconfigured
94
95-----------------------------------------------------------------
96
97A more detailed description of the hardware setting options:
98
99The general and the protocol layer options described in the 'comx.txt' file
100apply to the SliceCom as well, I only summarize the SliceCom hardware specific
101settings below.
102
103The '/proc/comx' configuring interface:
104
105An interface directory should be created for every timeslot group with
106'mkdir', e,g: 'comx0', 'comx1' etc. The timeslots can be assigned here to the
107specific interface. The Cisco-like naming convention (serial3:1 - first
108timeslot group of the 3rd. board) can't be used here, because these mean IP
109aliasing in Linux.
110
111You can give any meaningful name to keep the configuration clear;
112e.g: 'comx0.1', 'comx0.2', 'comx1.1', comx1.2', if you have two boards
113with two interfaces each.
114
115Settings, which apply to the board:
116
117Neither 'io' nor 'irq' settings required, the driver uses the resources
118given by the PCI BIOS.
119
120comx0/boardnum - board number of the SliceCom in the PC (using the 'natural'
121 PCI order) as listed in '/proc/pci' or the output of the
122 'lspci' command, generally the slots nearer to the motherboard
123 PCI driver chips have the lower numbers.
124
125 Default: 0 (the counting starts with 0)
126
127Though the options below are to be set on a single interface, they apply to the
128whole board. The restriction, to use them on 'UP' interfaces, is because the
129command sequence below could lead to unpredictable results.
130
131 # echo 0 >boardnum
132 # echo internal >clock_source
133 # echo 1 >boardnum
134
135The sequence would set the clock source of board 0.
136
137These settings will persist after all the interfaces are cleared, but are
138cleared when the driver module is unloaded and loaded again.
139
140comx0/clock_source - source of the transmit clock
141 Usage:
142
143 # echo line >/proc/comx/comx0/clock_source
144 # echo internal >/proc/comx/comx0/clock_source
145
146 line - The Tx clock is being decoded if the input data stream,
147 if no clock seen on the input, then the board will use it's
148 own clock generator.
149
150 internal - The Tx clock is supplied by the builtin clock generator.
151
152 Default: line
153
154 Normally, the telecommunication company's end device (the HDSL
155 modem) provides the Tx clock, that's why 'line' is the default.
156
157comx0/framing - Switching CRC4 off/on
158
159 CRC4: 16 PCM frames (The 32 64Kibit channels are multiplexed into a
160 PCM frame, nothing to do with HDLC frames) are divided into 2x8
161 groups, each group has a 4 bit CRC.
162
163 # echo crc4 >/proc/comx/comx0/framing
164 # echo no-crc4 >/proc/comx/comx0/framing
165
166 Default is 'crc4', the Hungarian MATAV lines behave like this.
167 The traffic generally passes if this setting on both ends don't match.
168
169comx0/linecode - Setting the line coding
170
171 # echo hdb3 >/proc/comx/comx0/linecode
172 # echo ami >/proc/comx/comx0/linecode
173
174 Default a 'hdb3', MATAV lines use this.
175
176 (AMI coding is rarely used with E1 lines). Frame sync may occur, if
177 this setting doesn't match the other end's, but CRC4 and data errors
178 will come, which will result in CRC errors on HDLC/SyncPPP level.
179
180comx0/reg - direct access to the board's MUNICH (reg) and FALC (lbireg)
181comx0/lbireg circuit's registers
182
183 # echo >reg 0x04 0x0 - write 0 to register 4
184 # echo >reg 0x104 - write the contents of register 4 with
185 printk() to syslog
186
187WARNING! These are only for development purposes, messing with this will
188 result much trouble!
189
190comx0/loopback - Places a loop to the board's G.703 signals
191
192 # echo none >/proc/comx/comx0/loopback
193 # echo local >/proc/comx/comx0/loopback
194 # echo remote >/proc/comx/comx0/loopback
195
196 none - normal operation, no loop
197 local - the board receives it's own output
198 remote - the board sends the received data to the remote side
199
200 Default: none
201
202-----------------------------------------------------------------
203
204Interface (channel group in Cisco terms) settings:
205
206comx0/timeslots - which timeslots belong to the given interface
207
208 Setting:
209
210 # echo '1 5 2 6 7 8' >/proc/comx/comx0/timeslots
211
212 # cat /proc/comx/comx0/timeslots
213 1 2 5 6 7 8
214 #
215
216 Finding a timeslot:
217
218 # grep ' 4' /proc/comx/comx*/timeslots
219 /proc/comx/comx0/timeslots:1 3 4 5 6
220 #
221
222 The timeslots can be in any order, '1 2 3' is the same as '1 3 2'.
223
224 The interface has to be DOWN during the setting ('ifconfig comx0
225 down'), but the other interfaces could operate normally.
226
227 The driver checks if the assigned timeslots are vacant, if not, then
228 the setting won't be applied.
229
230 The timeslot values are treated as decimal numbers, not to misunderstand
231 values of 08, 09 form.
232
233-----------------------------------------------------------------
234
235Checking the interface and board status:
236
237- Lines beginning with ' ' (space) belong to the original output, the lines
238which begin with '//' are the comments.
239
240 papaya:~$ cat /proc/comx/comx1/status
241 Interface administrative status is UP, modem status is UP, protocol is UP
242 Modem status changes: 0, Transmitter status is IDLE, tbusy: 0
243 Interface load (input): 978376 / 947808 / 951024 bits/s (5s/5m/15m)
244 (output): 978376 / 947848 / 951024 bits/s (5s/5m/15m)
245 Debug flags: none
246 RX errors: len: 22, overrun: 1, crc: 0, aborts: 0
247 buffer overrun: 0, pbuffer overrun: 0
248 TX errors: underrun: 0
249 Line keepalive (value: 10) status UP [0]
250
251// The hardware specific part starts here:
252 Controller status:
253 No alarms
254
255// Alarm:
256//
257// No alarms - Everything OK
258//
259// LOS - Loss Of Signal - No signal sensed on the input
260// AIS - Alarm Indication Signal - The remote side sends '11111111'-s,
261// it tells, that there's an error condition, or it's not
262// initialised.
263// AUXP - Auxiliary Pattern Indication - 01010101.. received.
264// LFA - Loss of Frame Alignment - no frame sync received.
265// RRA - Receive Remote Alarm - the remote end's OK, but signals error cond.
266// LMFA - Loss of CRC4 Multiframe Alignment - no CRC4 multiframe sync.
267// NMF - No Multiframe alignment Found after 400 msec - no such alarm using
268// no-crc4 or crc4 framing, see below.
269//
270// Other possible error messages:
271//
272// Transmit Line Short - the board felt, that it's output is short-circuited,
273// so it switched the transmission off. (The board can't definitely tell,
274// that it's output is short-circuited.)
275
276// Chained list of the received packets, for debug purposes:
277
278 Rx ring:
279 rafutott: 0
280 lastcheck: 50845731, jiffies: 51314281
281 base: 017b1858
282 rx_desc_ptr: 0
283 rx_desc_ptr: 017b1858
284 hw_curr_ptr: 017b1858
285 06040000 017b1868 017b1898 c016ff00
286 06040000 017b1878 017b1e9c c016ff00
287 46040000 017b1888 017b24a0 c016ff00
288 06040000 017b1858 017b2aa4 c016ff00
289
290// All the interfaces using the board: comx1, using the 1,2,...16 timeslots,
291// comx2, using timeslot 17, etc.
292
293 Interfaces using this board: (channel-group, interface, timeslots)
294 0 comx1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
295 1 comx2: 17
296 2 comx3: 18
297 3 comx4: 19
298 4 comx5: 20
299 5 comx6: 21
300 6 comx7: 22
301 7 comx8: 23
302 8 comx9: 24
303 9 comx10: 25
304 10 comx11: 26
305 11 comx12: 27
306 12 comx13: 28
307 13 comx14: 29
308 14 comx15: 30
309 15 comx16: 31
310
311// The number of events handled by the driver during an interrupt cycle:
312
313 Interrupt work histogram:
314 hist[ 0]: 0 hist[ 1]: 2 hist[ 2]: 18574 hist[ 3]: 79
315 hist[ 4]: 14 hist[ 5]: 1 hist[ 6]: 0 hist[ 7]: 1
316 hist[ 8]: 0 hist[ 9]: 7
317
318// The number of packets to send in the Tx ring, when a new one arrived:
319
320 Tx ring histogram:
321 hist[ 0]: 2329 hist[ 1]: 0 hist[ 2]: 0 hist[ 3]: 0
322
323// The error counters of the E1 interface, according to the RFC2495,
324// (similar to the Cisco "show controllers e1" command's output:
325// http://www.cisco.com/univercd/cc/td/doc/product/software/ios11/rbook/rinterfc.htm#xtocid25669126)
326
327Data in current interval (91 seconds elapsed):
328 9516 Line Code Violations, 65 Path Code Violations, 2 E-Bit Errors
329 0 Slip Secs, 2 Fr Loss Secs, 2 Line Err Secs, 0 Degraded Mins
330 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 11 Unavail Secs
331Data in Interval 1 (15 minutes):
332 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors
333 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins
334 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
335Data in last 4 intervals (1 hour):
336 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors
337 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins
338 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
339Data in last 96 intervals (24 hours):
340 0 Line Code Violations, 0 Path Code Violations, 0 E-Bit Errors
341 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins
342 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
343
344-----------------------------------------------------------------
345
346Some unique options, (may get into the driver later):
347Treat them very carefully, these can cause much trouble!
348
349 modified CRC-4, for improved interworking of CRC-4 and non-CRC-4
350 devices: (see page 107 and g706 Annex B)
351 lbireg[ 0x1b ] |= 0x08
352 lbireg[ 0x1c ] |= 0xc0
353
354 - The NMF - 'No Multiframe alignment Found after 400 msec' alarm
355 comes into account.
356
357 FALC - the line driver chip.
358 local loop - I hear my transmission back.
359 remote loop - I echo the remote transmission back.
360
361 Something useful for finding errors:
362
363 - local loop for timeslot 1 in the FALC chip:
364
365 # echo >lbireg 0x1d 0x21
366
367 - Switching the loop off:
368
369 # echo >lbireg 0x1d 0x00
diff --git a/Documentation/parport-lowlevel.txt b/Documentation/parport-lowlevel.txt
index 265fcdcb8e5f..120eb20dbb09 100644
--- a/Documentation/parport-lowlevel.txt
+++ b/Documentation/parport-lowlevel.txt
@@ -339,6 +339,10 @@ Use this function to register your device driver on a parallel port
339('port'). Once you have done that, you will be able to use 339('port'). Once you have done that, you will be able to use
340parport_claim and parport_release in order to use the port. 340parport_claim and parport_release in order to use the port.
341 341
342The ('name') argument is the name of the device that appears in /proc
343filesystem. The string must be valid for the whole lifetime of the
344device (until parport_unregister_device is called).
345
342This function will register three callbacks into your driver: 346This function will register three callbacks into your driver:
343'preempt', 'wakeup' and 'irq'. Each of these may be NULL in order to 347'preempt', 'wakeup' and 'irq'. Each of these may be NULL in order to
344indicate that you do not want a callback. 348indicate that you do not want a callback.
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index a96e85397eb7..e9a3cb1d6b06 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -52,6 +52,7 @@ Table of Contents
52 i) Freescale QUICC Engine module (QE) 52 i) Freescale QUICC Engine module (QE)
53 j) CFI or JEDEC memory-mapped NOR flash 53 j) CFI or JEDEC memory-mapped NOR flash
54 k) Global Utilities Block 54 k) Global Utilities Block
55 l) Xilinx IP cores
55 56
56 VII - Specifying interrupt information for devices 57 VII - Specifying interrupt information for devices
57 1) interrupts property 58 1) interrupts property
@@ -851,12 +852,18 @@ address which can extend beyond that limit.
851 /cpus/PowerPC,970FX@0 852 /cpus/PowerPC,970FX@0
852 /cpus/PowerPC,970FX@1 853 /cpus/PowerPC,970FX@1
853 (unit addresses do not require leading zeroes) 854 (unit addresses do not require leading zeroes)
854 - d-cache-line-size : one cell, L1 data cache line size in bytes 855 - d-cache-block-size : one cell, L1 data cache block size in bytes (*)
855 - i-cache-line-size : one cell, L1 instruction cache line size in 856 - i-cache-block-size : one cell, L1 instruction cache block size in
856 bytes 857 bytes
857 - d-cache-size : one cell, size of L1 data cache in bytes 858 - d-cache-size : one cell, size of L1 data cache in bytes
858 - i-cache-size : one cell, size of L1 instruction cache in bytes 859 - i-cache-size : one cell, size of L1 instruction cache in bytes
859 860
861(*) The cache "block" size is the size on which the cache management
862instructions operate. Historically, this document used the cache
863"line" size here which is incorrect. The kernel will prefer the cache
864block size and will fallback to cache line size for backward
865compatibility.
866
860 Recommended properties: 867 Recommended properties:
861 868
862 - timebase-frequency : a cell indicating the frequency of the 869 - timebase-frequency : a cell indicating the frequency of the
@@ -870,6 +877,10 @@ address which can extend beyond that limit.
870 for the above, the common code doesn't use that property, but 877 for the above, the common code doesn't use that property, but
871 you are welcome to re-use the pSeries or Maple one. A future 878 you are welcome to re-use the pSeries or Maple one. A future
872 kernel version might provide a common function for this. 879 kernel version might provide a common function for this.
880 - d-cache-line-size : one cell, L1 data cache line size in bytes
881 if different from the block size
882 - i-cache-line-size : one cell, L1 instruction cache line size in
883 bytes if different from the block size
873 884
874 You are welcome to add any property you find relevant to your board, 885 You are welcome to add any property you find relevant to your board,
875 like some information about the mechanism used to soft-reset the 886 like some information about the mechanism used to soft-reset the
@@ -1634,8 +1645,9 @@ platforms are moved over to use the flattened-device-tree model.
1634 MAC addresses passed by the firmware when no information other 1645 MAC addresses passed by the firmware when no information other
1635 than indices is available to associate an address with a device. 1646 than indices is available to associate an address with a device.
1636 - phy-connection-type : a string naming the controller/PHY interface type, 1647 - phy-connection-type : a string naming the controller/PHY interface type,
1637 i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "tbi", 1648 i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id" (Internal
1638 or "rtbi". 1649 Delay), "rgmii-txid" (delay on TX only), "rgmii-rxid" (delay on RX only),
1650 "tbi", or "rtbi".
1639 1651
1640 Example: 1652 Example:
1641 ucc@2000 { 1653 ucc@2000 {
@@ -2242,6 +2254,266 @@ platforms are moved over to use the flattened-device-tree model.
2242 available. 2254 available.
2243 For Axon: 0x0000012a 2255 For Axon: 0x0000012a
2244 2256
2257 l) Xilinx IP cores
2258
2259 The Xilinx EDK toolchain ships with a set of IP cores (devices) for use
2260 in Xilinx Spartan and Virtex FPGAs. The devices cover the whole range
2261 of standard device types (network, serial, etc.) and miscellanious
2262 devices (gpio, LCD, spi, etc). Also, since these devices are
2263 implemented within the fpga fabric every instance of the device can be
2264 synthesised with different options that change the behaviour.
2265
2266 Each IP-core has a set of parameters which the FPGA designer can use to
2267 control how the core is synthesized. Historically, the EDK tool would
2268 extract the device parameters relevant to device drivers and copy them
2269 into an 'xparameters.h' in the form of #define symbols. This tells the
2270 device drivers how the IP cores are configured, but it requres the kernel
2271 to be recompiled every time the FPGA bitstream is resynthesized.
2272
2273 The new approach is to export the parameters into the device tree and
2274 generate a new device tree each time the FPGA bitstream changes. The
2275 parameters which used to be exported as #defines will now become
2276 properties of the device node. In general, device nodes for IP-cores
2277 will take the following form:
2278
2279 (name)@(base-address) {
2280 compatible = "xlnx,(ip-core-name)-(HW_VER)"
2281 [, (list of compatible devices), ...];
2282 reg = <(baseaddr) (size)>;
2283 interrupt-parent = <&interrupt-controller-phandle>;
2284 interrupts = < ... >;
2285 xlnx,(parameter1) = "(string-value)";
2286 xlnx,(parameter2) = <(int-value)>;
2287 };
2288
2289 (ip-core-name): the name of the ip block (given after the BEGIN
2290 directive in system.mhs). Should be in lowercase
2291 and all underscores '_' converted to dashes '-'.
2292 (name): is derived from the "PARAMETER INSTANCE" value.
2293 (parameter#): C_* parameters from system.mhs. The C_ prefix is
2294 dropped from the parameter name, the name is converted
2295 to lowercase and all underscore '_' characters are
2296 converted to dashes '-'.
2297 (baseaddr): the C_BASEADDR parameter.
2298 (HW_VER): from the HW_VER parameter.
2299 (size): equals C_HIGHADDR - C_BASEADDR + 1
2300
2301 Typically, the compatible list will include the exact IP core version
2302 followed by an older IP core version which implements the same
2303 interface or any other device with the same interface.
2304
2305 'reg', 'interrupt-parent' and 'interrupts' are all optional properties.
2306
2307 For example, the following block from system.mhs:
2308
2309 BEGIN opb_uartlite
2310 PARAMETER INSTANCE = opb_uartlite_0
2311 PARAMETER HW_VER = 1.00.b
2312 PARAMETER C_BAUDRATE = 115200
2313 PARAMETER C_DATA_BITS = 8
2314 PARAMETER C_ODD_PARITY = 0
2315 PARAMETER C_USE_PARITY = 0
2316 PARAMETER C_CLK_FREQ = 50000000
2317 PARAMETER C_BASEADDR = 0xEC100000
2318 PARAMETER C_HIGHADDR = 0xEC10FFFF
2319 BUS_INTERFACE SOPB = opb_7
2320 PORT OPB_Clk = CLK_50MHz
2321 PORT Interrupt = opb_uartlite_0_Interrupt
2322 PORT RX = opb_uartlite_0_RX
2323 PORT TX = opb_uartlite_0_TX
2324 PORT OPB_Rst = sys_bus_reset_0
2325 END
2326
2327 becomes the following device tree node:
2328
2329 opb-uartlite-0@ec100000 {
2330 device_type = "serial";
2331 compatible = "xlnx,opb-uartlite-1.00.b";
2332 reg = <ec100000 10000>;
2333 interrupt-parent = <&opb-intc>;
2334 interrupts = <1 0>; // got this from the opb_intc parameters
2335 current-speed = <d#115200>; // standard serial device prop
2336 clock-frequency = <d#50000000>; // standard serial device prop
2337 xlnx,data-bits = <8>;
2338 xlnx,odd-parity = <0>;
2339 xlnx,use-parity = <0>;
2340 };
2341
2342 Some IP cores actually implement 2 or more logical devices. In this case,
2343 the device should still describe the whole IP core with a single node
2344 and add a child node for each logical device. The ranges property can
2345 be used to translate from parent IP-core to the registers of each device.
2346 (Note: this makes the assumption that both logical devices have the same
2347 bus binding. If this is not true, then separate nodes should be used for
2348 each logical device). The 'cell-index' property can be used to enumerate
2349 logical devices within an IP core. For example, the following is the
2350 system.mhs entry for the dual ps2 controller found on the ml403 reference
2351 design.
2352
2353 BEGIN opb_ps2_dual_ref
2354 PARAMETER INSTANCE = opb_ps2_dual_ref_0
2355 PARAMETER HW_VER = 1.00.a
2356 PARAMETER C_BASEADDR = 0xA9000000
2357 PARAMETER C_HIGHADDR = 0xA9001FFF
2358 BUS_INTERFACE SOPB = opb_v20_0
2359 PORT Sys_Intr1 = ps2_1_intr
2360 PORT Sys_Intr2 = ps2_2_intr
2361 PORT Clkin1 = ps2_clk_rx_1
2362 PORT Clkin2 = ps2_clk_rx_2
2363 PORT Clkpd1 = ps2_clk_tx_1
2364 PORT Clkpd2 = ps2_clk_tx_2
2365 PORT Rx1 = ps2_d_rx_1
2366 PORT Rx2 = ps2_d_rx_2
2367 PORT Txpd1 = ps2_d_tx_1
2368 PORT Txpd2 = ps2_d_tx_2
2369 END
2370
2371 It would result in the following device tree nodes:
2372
2373 opb_ps2_dual_ref_0@a9000000 {
2374 ranges = <0 a9000000 2000>;
2375 // If this device had extra parameters, then they would
2376 // go here.
2377 ps2@0 {
2378 compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
2379 reg = <0 40>;
2380 interrupt-parent = <&opb-intc>;
2381 interrupts = <3 0>;
2382 cell-index = <0>;
2383 };
2384 ps2@1000 {
2385 compatible = "xlnx,opb-ps2-dual-ref-1.00.a";
2386 reg = <1000 40>;
2387 interrupt-parent = <&opb-intc>;
2388 interrupts = <3 0>;
2389 cell-index = <0>;
2390 };
2391 };
2392
2393 Also, the system.mhs file defines bus attachments from the processor
2394 to the devices. The device tree structure should reflect the bus
2395 attachments. Again an example; this system.mhs fragment:
2396
2397 BEGIN ppc405_virtex4
2398 PARAMETER INSTANCE = ppc405_0
2399 PARAMETER HW_VER = 1.01.a
2400 BUS_INTERFACE DPLB = plb_v34_0
2401 BUS_INTERFACE IPLB = plb_v34_0
2402 END
2403
2404 BEGIN opb_intc
2405 PARAMETER INSTANCE = opb_intc_0
2406 PARAMETER HW_VER = 1.00.c
2407 PARAMETER C_BASEADDR = 0xD1000FC0
2408 PARAMETER C_HIGHADDR = 0xD1000FDF
2409 BUS_INTERFACE SOPB = opb_v20_0
2410 END
2411
2412 BEGIN opb_uart16550
2413 PARAMETER INSTANCE = opb_uart16550_0
2414 PARAMETER HW_VER = 1.00.d
2415 PARAMETER C_BASEADDR = 0xa0000000
2416 PARAMETER C_HIGHADDR = 0xa0001FFF
2417 BUS_INTERFACE SOPB = opb_v20_0
2418 END
2419
2420 BEGIN plb_v34
2421 PARAMETER INSTANCE = plb_v34_0
2422 PARAMETER HW_VER = 1.02.a
2423 END
2424
2425 BEGIN plb_bram_if_cntlr
2426 PARAMETER INSTANCE = plb_bram_if_cntlr_0
2427 PARAMETER HW_VER = 1.00.b
2428 PARAMETER C_BASEADDR = 0xFFFF0000
2429 PARAMETER C_HIGHADDR = 0xFFFFFFFF
2430 BUS_INTERFACE SPLB = plb_v34_0
2431 END
2432
2433 BEGIN plb2opb_bridge
2434 PARAMETER INSTANCE = plb2opb_bridge_0
2435 PARAMETER HW_VER = 1.01.a
2436 PARAMETER C_RNG0_BASEADDR = 0x20000000
2437 PARAMETER C_RNG0_HIGHADDR = 0x3FFFFFFF
2438 PARAMETER C_RNG1_BASEADDR = 0x60000000
2439 PARAMETER C_RNG1_HIGHADDR = 0x7FFFFFFF
2440 PARAMETER C_RNG2_BASEADDR = 0x80000000
2441 PARAMETER C_RNG2_HIGHADDR = 0xBFFFFFFF
2442 PARAMETER C_RNG3_BASEADDR = 0xC0000000
2443 PARAMETER C_RNG3_HIGHADDR = 0xDFFFFFFF
2444 BUS_INTERFACE SPLB = plb_v34_0
2445 BUS_INTERFACE MOPB = opb_v20_0
2446 END
2447
2448 Gives this device tree (some properties removed for clarity):
2449
2450 plb-v34-0 {
2451 #address-cells = <1>;
2452 #size-cells = <1>;
2453 device_type = "ibm,plb";
2454 ranges; // 1:1 translation
2455
2456 plb-bram-if-cntrl-0@ffff0000 {
2457 reg = <ffff0000 10000>;
2458 }
2459
2460 opb-v20-0 {
2461 #address-cells = <1>;
2462 #size-cells = <1>;
2463 ranges = <20000000 20000000 20000000
2464 60000000 60000000 20000000
2465 80000000 80000000 40000000
2466 c0000000 c0000000 20000000>;
2467
2468 opb-uart16550-0@a0000000 {
2469 reg = <a00000000 2000>;
2470 };
2471
2472 opb-intc-0@d1000fc0 {
2473 reg = <d1000fc0 20>;
2474 };
2475 };
2476 };
2477
2478 That covers the general approach to binding xilinx IP cores into the
2479 device tree. The following are bindings for specific devices:
2480
2481 i) Xilinx ML300 Framebuffer
2482
2483 Simple framebuffer device from the ML300 reference design (also on the
2484 ML403 reference design as well as others).
2485
2486 Optional properties:
2487 - resolution = <xres yres> : pixel resolution of framebuffer. Some
2488 implementations use a different resolution.
2489 Default is <d#640 d#480>
2490 - virt-resolution = <xvirt yvirt> : Size of framebuffer in memory.
2491 Default is <d#1024 d#480>.
2492 - rotate-display (empty) : rotate display 180 degrees.
2493
2494 ii) Xilinx SystemACE
2495
2496 The Xilinx SystemACE device is used to program FPGAs from an FPGA
2497 bitstream stored on a CF card. It can also be used as a generic CF
2498 interface device.
2499
2500 Optional properties:
2501 - 8-bit (empty) : Set this property for SystemACE in 8 bit mode
2502
2503 iii) Xilinx EMAC and Xilinx TEMAC
2504
2505 Xilinx Ethernet devices. In addition to general xilinx properties
2506 listed above, nodes for these devices should include a phy-handle
2507 property, and may include other common network device properties
2508 like local-mac-address.
2509
2510 iv) Xilinx Uartlite
2511
2512 Xilinx uartlite devices are simple fixed speed serial ports.
2513
2514 Requred properties:
2515 - current-speed : Baud rate of uartlite
2516
2245 More devices will be defined as this spec matures. 2517 More devices will be defined as this spec matures.
2246 2518
2247VII - Specifying interrupt information for devices 2519VII - Specifying interrupt information for devices
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt
index c931d613f641..e20b19c1b60d 100644
--- a/Documentation/rtc.txt
+++ b/Documentation/rtc.txt
@@ -180,9 +180,10 @@ driver returns ENOIOCTLCMD. Some common examples:
180 * RTC_IRQP_SET, RTC_IRQP_READ: the irq_set_freq function will be called 180 * RTC_IRQP_SET, RTC_IRQP_READ: the irq_set_freq function will be called
181 to set the frequency while the framework will handle the read for you 181 to set the frequency while the framework will handle the read for you
182 since the frequency is stored in the irq_freq member of the rtc_device 182 since the frequency is stored in the irq_freq member of the rtc_device
183 structure. Also make sure you set the max_user_freq member in your 183 structure. Your driver needs to initialize the irq_freq member during
184 initialization routines so the framework can sanity check the user 184 init. Make sure you check the requested frequency is in range of your
185 input for you. 185 hardware in the irq_set_freq function. If you cannot actually change
186 the frequency, just return -ENOTTY.
186 187
187If all else fails, check out the rtc-test.c driver! 188If all else fails, check out the rtc-test.c driver!
188 189
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/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index ec499265deca..10c041ca13c7 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -1,7 +1,7 @@
1 ThinkPad ACPI Extras Driver 1 ThinkPad ACPI Extras Driver
2 2
3 Version 0.16 3 Version 0.17
4 August 2nd, 2007 4 October 04th, 2007
5 5
6 Borislav Deianov <borislav@users.sf.net> 6 Borislav Deianov <borislav@users.sf.net>
7 Henrique de Moraes Holschuh <hmh@hmh.eng.br> 7 Henrique de Moraes Holschuh <hmh@hmh.eng.br>
@@ -923,19 +923,34 @@ sysfs backlight device "thinkpad_screen"
923This feature allows software control of the LCD brightness on ThinkPad 923This feature allows software control of the LCD brightness on ThinkPad
924models which don't have a hardware brightness slider. 924models which don't have a hardware brightness slider.
925 925
926It has some limitations: the LCD backlight cannot be actually turned on or off 926It has some limitations: the LCD backlight cannot be actually turned on or
927by this interface, and in many ThinkPad models, the "dim while on battery" 927off by this interface, and in many ThinkPad models, the "dim while on
928functionality will be enabled by the BIOS when this interface is used, and 928battery" functionality will be enabled by the BIOS when this interface is
929cannot be controlled. 929used, and cannot be controlled.
930 930
931The backlight control has eight levels, ranging from 0 to 7. Some of the 931On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control
932levels may not be distinct. 932has eight brightness levels, ranging from 0 to 7. Some of the levels
933 933may not be distinct. Later Lenovo models that implement the ACPI
934There are two interfaces to the firmware for brightness control, EC and CMOS. 934display backlight brightness control methods have 16 levels, ranging
935To select which one should be used, use the brightness_mode module parameter: 935from 0 to 15.
936brightness_mode=1 selects EC mode, brightness_mode=2 selects CMOS mode, 936
937brightness_mode=3 selects both EC and CMOS. The driver tries to autodetect 937There are two interfaces to the firmware for direct brightness control,
938which interface to use. 938EC and CMOS. To select which one should be used, use the
939brightness_mode module parameter: brightness_mode=1 selects EC mode,
940brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC
941and CMOS. The driver tries to autodetect which interface to use.
942
943When display backlight brightness controls are available through the
944standard ACPI interface, it is best to use it instead of this direct
945ThinkPad-specific interface. The driver will disable its native
946backlight brightness control interface if it detects that the standard
947ACPI interface is available in the ThinkPad.
948
949The brightness_enable module parameter can be used to control whether
950the LCD brightness control feature will be enabled when available.
951brightness_enable=0 forces it to be disabled. brightness_enable=1
952forces it to be enabled when available, even if the standard ACPI
953interface is also available.
939 954
940Procfs notes: 955Procfs notes:
941 956
@@ -947,11 +962,11 @@ Procfs notes:
947 962
948Sysfs notes: 963Sysfs notes:
949 964
950The interface is implemented through the backlight sysfs class, which is poorly 965The interface is implemented through the backlight sysfs class, which is
951documented at this time. 966poorly documented at this time.
952 967
953Locate the thinkpad_screen device under /sys/class/backlight, and inside it 968Locate the thinkpad_screen device under /sys/class/backlight, and inside
954there will be the following attributes: 969it there will be the following attributes:
955 970
956 max_brightness: 971 max_brightness:
957 Reads the maximum brightness the hardware can be set to. 972 Reads the maximum brightness the hardware can be set to.
@@ -961,17 +976,19 @@ there will be the following attributes:
961 Reads what brightness the screen is set to at this instant. 976 Reads what brightness the screen is set to at this instant.
962 977
963 brightness: 978 brightness:
964 Writes request the driver to change brightness to the given 979 Writes request the driver to change brightness to the
965 value. Reads will tell you what brightness the driver is trying 980 given value. Reads will tell you what brightness the
966 to set the display to when "power" is set to zero and the display 981 driver is trying to set the display to when "power" is set
967 has not been dimmed by a kernel power management event. 982 to zero and the display has not been dimmed by a kernel
983 power management event.
968 984
969 power: 985 power:
970 power management mode, where 0 is "display on", and 1 to 3 will 986 power management mode, where 0 is "display on", and 1 to 3
971 dim the display backlight to brightness level 0 because 987 will dim the display backlight to brightness level 0
972 thinkpad-acpi cannot really turn the backlight off. Kernel 988 because thinkpad-acpi cannot really turn the backlight
973 power management events can temporarily increase the current 989 off. Kernel power management events can temporarily
974 power management level, i.e. they can dim the display. 990 increase the current power management level, i.e. they can
991 dim the display.
975 992
976 993
977Volume control -- /proc/acpi/ibm/volume 994Volume control -- /proc/acpi/ibm/volume
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index a3026689bbe6..37f0e3cedf43 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -8,4 +8,7 @@
8 7 -> Leadtek Winfast USB II (em2800) 8 7 -> Leadtek Winfast USB II (em2800)
9 8 -> Kworld USB2800 (em2800) 9 8 -> Kworld USB2800 (em2800)
10 9 -> Pinnacle Dazzle DVC 90 (em2820/em2840) [2304:0207] 10 9 -> Pinnacle Dazzle DVC 90 (em2820/em2840) [2304:0207]
11 10 -> Hauppauge WinTV HVR 900 (em2880)
12 11 -> Terratec Hybrid XS (em2880)
11 12 -> Kworld PVR TV 2800 RF (em2820/em2840) 13 12 -> Kworld PVR TV 2800 RF (em2820/em2840)
14 13 -> Terratec Prodigy XS (em2880)
diff --git a/MAINTAINERS b/MAINTAINERS
index 892afcb81f30..f5bd9bab7ed6 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
@@ -787,23 +787,25 @@ B43 WIRELESS DRIVER
787P: Michael Buesch 787P: Michael Buesch
788M: mb@bu3sch.de 788M: mb@bu3sch.de
789P: Stefano Brivio 789P: Stefano Brivio
790M: st3@riseup.net 790M: stefano.brivio@polimi.it
791L: linux-wireless@vger.kernel.org 791L: linux-wireless@vger.kernel.org
792W: http://bcm43xx.berlios.de/ 792W: http://linuxwireless.org/en/users/Drivers/b43
793S: Maintained 793S: Maintained
794 794
795B43LEGACY WIRELESS DRIVER 795B43LEGACY WIRELESS DRIVER
796P: Larry Finger 796P: Larry Finger
797M: Larry.Finger@lwfinger.net 797M: Larry.Finger@lwfinger.net
798P: Stefano Brivio
799M: stefano.brivio@polimi.it
798L: linux-wireless@vger.kernel.org 800L: linux-wireless@vger.kernel.org
799W: http://bcm43xx.berlios.de/ 801W: http://linuxwireless.org/en/users/Drivers/b43
800S: Maintained 802S: Maintained
801 803
802BCM43XX WIRELESS DRIVER (SOFTMAC BASED VERSION) 804BCM43XX WIRELESS DRIVER (SOFTMAC BASED VERSION)
803P: Larry Finger 805P: Larry Finger
804M: Larry.Finger@lwfinger.net 806M: Larry.Finger@lwfinger.net
805P: Stefano Brivio 807P: Stefano Brivio
806M: st3@riseup.net 808M: stefano.brivio@polimi.it
807L: linux-wireless@vger.kernel.org 809L: linux-wireless@vger.kernel.org
808W: http://bcm43xx.berlios.de/ 810W: http://bcm43xx.berlios.de/
809S: Maintained 811S: Maintained
@@ -1912,10 +1914,8 @@ L: linux1394-devel@lists.sourceforge.net
1912S: Maintained 1914S: Maintained
1913 1915
1914IMS TWINTURBO FRAMEBUFFER DRIVER 1916IMS TWINTURBO FRAMEBUFFER DRIVER
1915P: Paul Mundt
1916M: lethal@chaoticdreams.org
1917L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1917L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
1918S: Maintained 1918S: Orphan
1919 1919
1920INFINIBAND SUBSYSTEM 1920INFINIBAND SUBSYSTEM
1921P: Roland Dreier 1921P: Roland Dreier
@@ -2444,7 +2444,7 @@ M68K ON APPLE MACINTOSH
2444P: Joshua Thompson 2444P: Joshua Thompson
2445M: funaho@jurai.org 2445M: funaho@jurai.org
2446W: http://www.mac.linux-m68k.org/ 2446W: http://www.mac.linux-m68k.org/
2447L: linux-mac68k@mac.linux-m68k.org 2447L: linux-m68k@lists.linux-m68k.org
2448S: Maintained 2448S: Maintained
2449 2449
2450M68K ON HP9000/300 2450M68K ON HP9000/300
@@ -2549,7 +2549,7 @@ S: Supported
2549 2549
2550MISCELLANEOUS MCA-SUPPORT 2550MISCELLANEOUS MCA-SUPPORT
2551P: James Bottomley 2551P: James Bottomley
2552M: jejb@steeleye.com 2552M: James.Bottomley@HansenPartnership.com
2553L: linux-kernel@vger.kernel.org 2553L: linux-kernel@vger.kernel.org
2554S: Maintained 2554S: Maintained
2555 2555
@@ -3301,9 +3301,11 @@ S: Maintained
3301 3301
3302SCSI SUBSYSTEM 3302SCSI SUBSYSTEM
3303P: James E.J. Bottomley 3303P: James E.J. Bottomley
3304M: James.Bottomley@SteelEye.com 3304M: James.Bottomley@HansenPartnership.com
3305L: linux-scsi@vger.kernel.org 3305L: linux-scsi@vger.kernel.org
3306T: git kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git 3306T: git kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
3307T: git kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6.git
3308T: git kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-pending-2.6.git
3307S: Maintained 3309S: Maintained
3308 3310
3309SCSI TAPE DRIVER 3311SCSI TAPE DRIVER
@@ -3450,15 +3452,10 @@ L: lm-sensors@lm-sensors.org
3450S: Maintained 3452S: Maintained
3451 3453
3452SOFTMAC LAYER (IEEE 802.11) 3454SOFTMAC LAYER (IEEE 802.11)
3453P: Johannes Berg
3454M: johannes@sipsolutions.net
3455P: Joe Jezak
3456M: josejx@gentoo.org
3457P: Daniel Drake 3455P: Daniel Drake
3458M: dsd@gentoo.org 3456M: dsd@gentoo.org
3459W: http://softmac.sipsolutions.net/
3460L: linux-wireless@vger.kernel.org 3457L: linux-wireless@vger.kernel.org
3461S: Maintained 3458S: Obsolete
3462 3459
3463SOFTWARE RAID (Multiple Disks) SUPPORT 3460SOFTWARE RAID (Multiple Disks) SUPPORT
3464P: Ingo Molnar 3461P: Ingo Molnar
@@ -3477,12 +3474,14 @@ L: linux-pm@lists.linux-foundation.org
3477S: Supported 3474S: Supported
3478 3475
3479SUSPEND TO RAM: 3476SUSPEND TO RAM:
3477P: Len Brown
3478M: len.brown@intel.com
3480P: Pavel Machek 3479P: Pavel Machek
3481M: pavel@suse.cz 3480M: pavel@suse.cz
3482P: Rafael J. Wysocki 3481P: Rafael J. Wysocki
3483M: rjw@sisk.pl 3482M: rjw@sisk.pl
3484L: linux-pm@lists.linux-foundation.org 3483L: linux-pm@lists.linux-foundation.org
3485S: Maintained 3484S: Supported
3486 3485
3487SONIC NETWORK DRIVER 3486SONIC NETWORK DRIVER
3488P: Thomas Bogendoerfer 3487P: Thomas Bogendoerfer
@@ -3635,18 +3634,12 @@ M: laredo@gnu.org
3635W: http://www.stradis.com/ 3634W: http://www.stradis.com/
3636S: Maintained 3635S: Maintained
3637 3636
3638SUPERH (sh) 3637SUPERH
3639P: Paul Mundt
3640M: lethal@linux-sh.org
3641L: linuxsh-dev@lists.sourceforge.net (subscribers-only)
3642W: http://www.linux-sh.org
3643S: Maintained
3644
3645SUPERH64 (sh64)
3646P: Paul Mundt 3638P: Paul Mundt
3647M: lethal@linux-sh.org 3639M: lethal@linux-sh.org
3648L: linuxsh-shmedia-dev@lists.sourceforge.net 3640L: linux-sh@vger.kernel.org
3649W: http://www.linux-sh.org 3641W: http://www.linux-sh.org
3642T: git kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6.git
3650S: Maintained 3643S: Maintained
3651 3644
3652SUN3/3X 3645SUN3/3X
@@ -3732,7 +3725,7 @@ S: Maintained
3732TLAN NETWORK DRIVER 3725TLAN NETWORK DRIVER
3733P: Samuel Chessman 3726P: Samuel Chessman
3734M: chessman@tux.org 3727M: chessman@tux.org
3735L: tlan-devel@lists.sourceforge.net 3728L: tlan-devel@lists.sourceforge.net (subscribers-only)
3736W: http://sourceforge.net/projects/tlan/ 3729W: http://sourceforge.net/projects/tlan/
3737S: Maintained 3730S: Maintained
3738 3731
diff --git a/Makefile b/Makefile
index 8816060cdf40..a65ffd27de6b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 24 3SUBLEVEL = 24
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc3
5NAME = Arr Matey! A Hairy Bilge Rat! 5NAME = Arr Matey! A Hairy Bilge Rat!
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -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,8 +197,13 @@ CROSS_COMPILE ?=
196UTS_MACHINE := $(ARCH) 197UTS_MACHINE := $(ARCH)
197SRCARCH := $(ARCH) 198SRCARCH := $(ARCH)
198 199
199# for i386 and x86_64 we use SRCARCH equal to x86 200# Additional ARCH settings for x86
200SRCARCH := $(if $(filter x86_64 i386,$(SRCARCH)),x86,$(SRCARCH)) 201ifeq ($(ARCH),i386)
202 SRCARCH := x86
203endif
204ifeq ($(ARCH),x86_64)
205 SRCARCH := x86
206endif
201 207
202KCONFIG_CONFIG ?= .config 208KCONFIG_CONFIG ?= .config
203 209
@@ -527,9 +533,22 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
527KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) 533KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
528 534
529# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments 535# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
530KBUILD_CPPFLAGS += $(CPPFLAGS) 536# But warn user when we do so
531KBUILD_AFLAGS += $(AFLAGS) 537warn-assign = \
532KBUILD_CFLAGS += $(CFLAGS) 538$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)")
539
540ifneq ($(KCPPFLAGS),)
541 $(call warn-assign,CPPFLAGS)
542 KBUILD_CPPFLAGS += $(KCPPFLAGS)
543endif
544ifneq ($(KAFLAGS),)
545 $(call warn-assign,AFLAGS)
546 KBUILD_AFLAGS += $(KAFLAGS)
547endif
548ifneq ($(KCFLAGS),)
549 $(call warn-assign,CFLAGS)
550 KBUILD_CFLAGS += $(KCFLAGS)
551endif
533 552
534# Use --build-id when available. 553# Use --build-id when available.
535LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ 554LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
@@ -1313,12 +1332,7 @@ else
1313ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) 1332ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
1314endif 1333endif
1315 1334
1316# Take care of arch/x86 1335ALLSOURCE_ARCHS := $(SRCARCH)
1317ifeq ($(ARCH), $(SRCARCH))
1318ALLSOURCE_ARCHS := $(ARCH)
1319else
1320ALLSOURCE_ARCHS := $(ARCH) $(SRCARCH)
1321endif
1322 1336
1323define find-sources 1337define find-sources
1324 ( for arch in $(ALLSOURCE_ARCHS) ; do \ 1338 ( for arch in $(ALLSOURCE_ARCHS) ; do \
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a0cdaafa115b..a7e9fea978a6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1040,6 +1040,8 @@ source "drivers/power/Kconfig"
1040 1040
1041source "drivers/hwmon/Kconfig" 1041source "drivers/hwmon/Kconfig"
1042 1042
1043source "drivers/watchdog/Kconfig"
1044
1043source "drivers/ssb/Kconfig" 1045source "drivers/ssb/Kconfig"
1044 1046
1045#source "drivers/l3/Kconfig" 1047#source "drivers/l3/Kconfig"
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-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index 1873bd8cd1b2..bc91d6e66bc4 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/f75375s.h>
19#include <linux/delay.h> 20#include <linux/delay.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/pci.h> 22#include <linux/pci.h>
@@ -200,11 +201,21 @@ static struct platform_device n2100_serial_device = {
200 .resource = &n2100_uart_resource, 201 .resource = &n2100_uart_resource,
201}; 202};
202 203
204static struct f75375s_platform_data n2100_f75375s = {
205 .pwm = { 255, 255 },
206 .pwm_enable = { 0, 0 },
207};
208
203static struct i2c_board_info __initdata n2100_i2c_devices[] = { 209static struct i2c_board_info __initdata n2100_i2c_devices[] = {
204 { 210 {
205 I2C_BOARD_INFO("rtc-rs5c372", 0x32), 211 I2C_BOARD_INFO("rtc-rs5c372", 0x32),
206 .type = "rs5c372b", 212 .type = "rs5c372b",
207 }, 213 },
214 {
215 I2C_BOARD_INFO("f75375", 0x2e),
216 .type = "f75375",
217 .platform_data = &n2100_f75375s,
218 },
208}; 219};
209 220
210/* 221/*
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..ca9c5b61283a 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..61d9c9d69e6b 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
@@ -150,22 +150,45 @@ static void clk_pxa3xx_cken_disable(struct clk *clk)
150 local_irq_enable(); 150 local_irq_enable();
151} 151}
152 152
153static const struct clkops clk_pxa3xx_cken_ops = {
154 .enable = clk_pxa3xx_cken_enable,
155 .disable = clk_pxa3xx_cken_disable,
156};
157
153static const struct clkops clk_pxa3xx_hsio_ops = { 158static const struct clkops clk_pxa3xx_hsio_ops = {
154 .enable = clk_pxa3xx_cken_enable, 159 .enable = clk_pxa3xx_cken_enable,
155 .disable = clk_pxa3xx_cken_disable, 160 .disable = clk_pxa3xx_cken_disable,
156 .getrate = clk_pxa3xx_hsio_getrate, 161 .getrate = clk_pxa3xx_hsio_getrate,
157}; 162};
158 163
164#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \
165 { \
166 .name = _name, \
167 .dev = _dev, \
168 .ops = &clk_pxa3xx_cken_ops, \
169 .rate = _rate, \
170 .cken = CKEN_##_cken, \
171 .delay = _delay, \
172 }
173
174#define PXA3xx_CK(_name, _cken, _ops, _dev) \
175 { \
176 .name = _name, \
177 .dev = _dev, \
178 .ops = _ops, \
179 .cken = CKEN_##_cken, \
180 }
181
159static struct clk pxa3xx_clks[] = { 182static struct clk pxa3xx_clks[] = {
160 INIT_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), 183 PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
161 INIT_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), 184 PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL),
162 185
163 INIT_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), 186 PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
164 INIT_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), 187 PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
165 INIT_CKEN("UARTCLK", STUART, 14857000, 1, NULL), 188 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
166 189
167 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 190 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
168 INIT_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), 191 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev),
169}; 192};
170 193
171void __init pxa3xx_init_irq(void) 194void __init pxa3xx_init_irq(void)
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index ec4286c7931c..fbfa1920353d 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -68,6 +68,7 @@ pxa_ost0_interrupt(int irq, void *dev_id)
68 if (c->mode == CLOCK_EVT_MODE_ONESHOT) { 68 if (c->mode == CLOCK_EVT_MODE_ONESHOT) {
69 /* Disarm the compare/match, signal the event. */ 69 /* Disarm the compare/match, signal the event. */
70 OIER &= ~OIER_E0; 70 OIER &= ~OIER_E0;
71 OSSR = OSSR_M0;
71 c->event_handler(c); 72 c->event_handler(c);
72 } else if (c->mode == CLOCK_EVT_MODE_PERIODIC) { 73 } else if (c->mode == CLOCK_EVT_MODE_PERIODIC) {
73 /* Call the event handler as many times as necessary 74 /* Call the event handler as many times as necessary
@@ -100,9 +101,9 @@ pxa_ost0_interrupt(int irq, void *dev_id)
100 * anything that might put us "very close". 101 * anything that might put us "very close".
101 */ 102 */
102#define MIN_OSCR_DELTA 16 103#define MIN_OSCR_DELTA 16
103 do { 104 do {
104 OSSR = OSSR_M0; 105 OSSR = OSSR_M0;
105 next_match = (OSMR0 += LATCH); 106 next_match = (OSMR0 += LATCH);
106 c->event_handler(c); 107 c->event_handler(c);
107 } while (((signed long)(next_match - OSCR) <= MIN_OSCR_DELTA) 108 } while (((signed long)(next_match - OSCR) <= MIN_OSCR_DELTA)
108 && (c->mode == CLOCK_EVT_MODE_PERIODIC)); 109 && (c->mode == CLOCK_EVT_MODE_PERIODIC));
@@ -114,14 +115,16 @@ pxa_ost0_interrupt(int irq, void *dev_id)
114static int 115static int
115pxa_osmr0_set_next_event(unsigned long delta, struct clock_event_device *dev) 116pxa_osmr0_set_next_event(unsigned long delta, struct clock_event_device *dev)
116{ 117{
117 unsigned long irqflags; 118 unsigned long flags, next, oscr;
118 119
119 raw_local_irq_save(irqflags); 120 raw_local_irq_save(flags);
120 OSMR0 = OSCR + delta;
121 OSSR = OSSR_M0;
122 OIER |= OIER_E0; 121 OIER |= OIER_E0;
123 raw_local_irq_restore(irqflags); 122 next = OSCR + delta;
124 return 0; 123 OSMR0 = next;
124 oscr = OSCR;
125 raw_local_irq_restore(flags);
126
127 return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0;
125} 128}
126 129
127static void 130static void
@@ -132,15 +135,16 @@ pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev)
132 switch (mode) { 135 switch (mode) {
133 case CLOCK_EVT_MODE_PERIODIC: 136 case CLOCK_EVT_MODE_PERIODIC:
134 raw_local_irq_save(irqflags); 137 raw_local_irq_save(irqflags);
135 OSMR0 = OSCR + LATCH;
136 OSSR = OSSR_M0; 138 OSSR = OSSR_M0;
137 OIER |= OIER_E0; 139 OIER |= OIER_E0;
140 OSMR0 = OSCR + LATCH;
138 raw_local_irq_restore(irqflags); 141 raw_local_irq_restore(irqflags);
139 break; 142 break;
140 143
141 case CLOCK_EVT_MODE_ONESHOT: 144 case CLOCK_EVT_MODE_ONESHOT:
142 raw_local_irq_save(irqflags); 145 raw_local_irq_save(irqflags);
143 OIER &= ~OIER_E0; 146 OIER &= ~OIER_E0;
147 OSSR = OSSR_M0;
144 raw_local_irq_restore(irqflags); 148 raw_local_irq_restore(irqflags);
145 break; 149 break;
146 150
@@ -149,8 +153,12 @@ pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev)
149 /* initializing, released, or preparing for suspend */ 153 /* initializing, released, or preparing for suspend */
150 raw_local_irq_save(irqflags); 154 raw_local_irq_save(irqflags);
151 OIER &= ~OIER_E0; 155 OIER &= ~OIER_E0;
156 OSSR = OSSR_M0;
152 raw_local_irq_restore(irqflags); 157 raw_local_irq_restore(irqflags);
153 break; 158 break;
159
160 case CLOCK_EVT_MODE_RESUME:
161 break;
154 } 162 }
155} 163}
156 164
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/consistent.c b/arch/arm/mm/consistent.c
index cefdf2f9f26e..333a82a3717e 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -322,7 +322,6 @@ static int dma_mmap(struct device *dev, struct vm_area_struct *vma,
322 322
323 if (off < kern_size && 323 if (off < kern_size &&
324 user_size <= (kern_size - off)) { 324 user_size <= (kern_size - off)) {
325 vma->vm_flags |= VM_RESERVED;
326 ret = remap_pfn_range(vma, vma->vm_start, 325 ret = remap_pfn_range(vma, vma->vm_start,
327 page_to_pfn(c->vm_pages) + off, 326 page_to_pfn(c->vm_pages) + off,
328 user_size << PAGE_SHIFT, 327 user_size << PAGE_SHIFT,
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/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index 4493bcff5172..ee40c1a0b83d 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -171,7 +171,7 @@ static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg,
171 * Called from map_io. We need to call to this early enough so that we 171 * Called from map_io. We need to call to this early enough so that we
172 * can reserve the fixed SDRAM regions before VM could get hold of them. 172 * can reserve the fixed SDRAM regions before VM could get hold of them.
173 */ 173 */
174void omapfb_reserve_sdram(void) 174void __init omapfb_reserve_sdram(void)
175{ 175{
176 struct bootmem_data *bdata; 176 struct bootmem_data *bdata;
177 unsigned long sdram_start, sdram_size; 177 unsigned long sdram_start, sdram_size;
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index bbecbd8469b5..4f402c924504 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -19,9 +19,6 @@ config AVR32
19 There is an AVR32 Linux project with a web page at 19 There is an AVR32 Linux project with a web page at
20 http://avr32linux.org/. 20 http://avr32linux.org/.
21 21
22config UID16
23 bool
24
25config GENERIC_GPIO 22config GENERIC_GPIO
26 bool 23 bool
27 default y 24 default y
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index a9d9ec081e3d..7c4388f4f17f 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -474,7 +474,7 @@ static struct resource at32ap700x_rtc0_resource[] = {
474static struct resource at32_wdt0_resource[] = { 474static struct resource at32_wdt0_resource[] = {
475 { 475 {
476 .start = 0xfff000b0, 476 .start = 0xfff000b0,
477 .end = 0xfff000bf, 477 .end = 0xfff000cf,
478 .flags = IORESOURCE_MEM, 478 .flags = IORESOURCE_MEM,
479 }, 479 },
480}; 480};
@@ -690,7 +690,7 @@ static struct resource atmel_usart0_resource[] = {
690 IRQ(6), 690 IRQ(6),
691}; 691};
692DEFINE_DEV_DATA(atmel_usart, 0); 692DEFINE_DEV_DATA(atmel_usart, 0);
693DEV_CLK(usart, atmel_usart0, pba, 4); 693DEV_CLK(usart, atmel_usart0, pba, 3);
694 694
695static struct atmel_uart_data atmel_usart1_data = { 695static struct atmel_uart_data atmel_usart1_data = {
696 .use_dma_tx = 1, 696 .use_dma_tx = 1,
diff --git a/arch/avr32/mach-at32ap/hsmc.c b/arch/avr32/mach-at32ap/hsmc.c
index 704607fbcc69..fa427ed42787 100644
--- a/arch/avr32/mach-at32ap/hsmc.c
+++ b/arch/avr32/mach-at32ap/hsmc.c
@@ -7,7 +7,6 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#define DEBUG
11#include <linux/clk.h> 10#include <linux/clk.h>
12#include <linux/err.h> 11#include <linux/err.h>
13#include <linux/init.h> 12#include <linux/init.h>
diff --git a/arch/avr32/mach-at32ap/intc.c b/arch/avr32/mach-at32ap/intc.c
index dd5c009cf224..0b286cd53028 100644
--- a/arch/avr32/mach-at32ap/intc.c
+++ b/arch/avr32/mach-at32ap/intc.c
@@ -13,6 +13,7 @@
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15 15
16#include <asm/intc.h>
16#include <asm/io.h> 17#include <asm/io.h>
17 18
18#include "intc.h" 19#include "intc.h"
@@ -136,7 +137,8 @@ fail:
136 panic("Interrupt controller initialization failed!\n"); 137 panic("Interrupt controller initialization failed!\n");
137} 138}
138 139
139unsigned long intc_get_pending(int group) 140unsigned long intc_get_pending(unsigned int group)
140{ 141{
141 return intc_readl(&intc0, INTREQ0 + 4 * group); 142 return intc_readl(&intc0, INTREQ0 + 4 * group);
142} 143}
144EXPORT_SYMBOL_GPL(intc_get_pending);
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 7888551ed939..2a3a7ea5958c 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -3,7 +3,7 @@
3# see Documentation/kbuild/kconfig-language.txt. 3# see Documentation/kbuild/kconfig-language.txt.
4# 4#
5 5
6mainmenu "uClinux/Blackfin (w/o MMU) Kernel Configuration" 6mainmenu "Blackfin Kernel Configuration"
7 7
8config MMU 8config MMU
9 bool 9 bool
@@ -29,10 +29,6 @@ config ZONE_DMA
29 bool 29 bool
30 default y 30 default y
31 31
32config BFIN
33 bool
34 default y
35
36config SEMAPHORE_SLEEPERS 32config SEMAPHORE_SLEEPERS
37 bool 33 bool
38 default y 34 default y
@@ -50,7 +46,7 @@ config GENERIC_HARDIRQS
50 default y 46 default y
51 47
52config GENERIC_IRQ_PROBE 48config GENERIC_IRQ_PROBE
53 bool 49 bool
54 default y 50 default y
55 51
56config GENERIC_TIME 52config GENERIC_TIME
@@ -69,11 +65,6 @@ config GENERIC_CALIBRATE_DELAY
69 bool 65 bool
70 default y 66 default y
71 67
72config IRQCHIP_DEMUX_GPIO
73 bool
74 depends on (BF52x || BF53x || BF561 || BF54x)
75 default y
76
77source "init/Kconfig" 68source "init/Kconfig"
78source "kernel/Kconfig.preempt" 69source "kernel/Kconfig.preempt"
79 70
@@ -140,6 +131,11 @@ config BF544
140 help 131 help
141 BF544 Processor Support. 132 BF544 Processor Support.
142 133
134config BF547
135 bool "BF547"
136 help
137 BF547 Processor Support.
138
143config BF548 139config BF548
144 bool "BF548" 140 bool "BF548"
145 help 141 help
@@ -166,11 +162,11 @@ choice
166 162
167config BF_REV_0_0 163config BF_REV_0_0
168 bool "0.0" 164 bool "0.0"
169 depends on (BF549 || BF527) 165 depends on (BF52x || BF54x)
170 166
171config BF_REV_0_1 167config BF_REV_0_1
172 bool "0.2" 168 bool "0.1"
173 depends on (BF549 || BF527) 169 depends on (BF52x || BF54x)
174 170
175config BF_REV_0_2 171config BF_REV_0_2
176 bool "0.2" 172 bool "0.2"
@@ -208,7 +204,7 @@ config BF53x
208 204
209config BF54x 205config BF54x
210 bool 206 bool
211 depends on (BF542 || BF544 || BF548 || BF549) 207 depends on (BF542 || BF544 || BF547 || BF548 || BF549)
212 default y 208 default y
213 209
214config BFIN_DUAL_CORE 210config BFIN_DUAL_CORE
@@ -221,89 +217,6 @@ config BFIN_SINGLE_CORE
221 depends on !BFIN_DUAL_CORE 217 depends on !BFIN_DUAL_CORE
222 default y 218 default y
223 219
224choice
225 prompt "System type"
226 default BFIN533_STAMP
227 help
228 Do NOT change the board here. Please use the top level
229 configuration to ensure that all the other settings are
230 correct.
231
232config BFIN527_EZKIT
233 bool "BF527-EZKIT"
234 depends on (BF522 || BF525 || BF527)
235 help
236 BF533-EZKIT-LITE board Support.
237
238config BFIN533_EZKIT
239 bool "BF533-EZKIT"
240 depends on (BF533 || BF532 || BF531)
241 help
242 BF533-EZKIT-LITE board Support.
243
244config BFIN533_STAMP
245 bool "BF533-STAMP"
246 depends on (BF533 || BF532 || BF531)
247 help
248 BF533-STAMP board Support.
249
250config BFIN537_STAMP
251 bool "BF537-STAMP"
252 depends on (BF537 || BF536 || BF534)
253 help
254 BF537-STAMP board Support.
255
256config BFIN533_BLUETECHNIX_CM
257 bool "Bluetechnix CM-BF533"
258 depends on (BF533)
259 help
260 CM-BF533 support for EVAL- and DEV-Board.
261
262config BFIN537_BLUETECHNIX_CM
263 bool "Bluetechnix CM-BF537"
264 depends on (BF537)
265 help
266 CM-BF537 support for EVAL- and DEV-Board.
267
268config BFIN548_EZKIT
269 bool "BF548-EZKIT"
270 depends on (BF548 || BF549)
271 help
272 BFIN548-EZKIT board Support.
273
274config BFIN561_BLUETECHNIX_CM
275 bool "Bluetechnix CM-BF561"
276 depends on (BF561)
277 help
278 CM-BF561 support for EVAL- and DEV-Board.
279
280config BFIN561_EZKIT
281 bool "BF561-EZKIT"
282 depends on (BF561)
283 help
284 BF561-EZKIT-LITE board Support.
285
286config BFIN561_TEPLA
287 bool "BF561-TEPLA"
288 depends on (BF561)
289 help
290 BF561-TEPLA board Support.
291
292config PNAV10
293 bool "PNAV 1.0 board"
294 depends on (BF537)
295 help
296 PNAV 1.0 board Support.
297
298config GENERIC_BOARD
299 bool "Custom"
300 depends on (BF537 || BF536 \
301 || BF534 || BF561 || BF535 || BF533 || BF532 || BF531)
302 help
303 GENERIC or Custom board Support.
304
305endchoice
306
307config MEM_GENERIC_BOARD 220config MEM_GENERIC_BOARD
308 bool 221 bool
309 depends on GENERIC_BOARD 222 depends on GENERIC_BOARD
@@ -317,7 +230,8 @@ config MEM_MT48LC64M4A2FB_7E
317config MEM_MT48LC16M16A2TG_75 230config MEM_MT48LC16M16A2TG_75
318 bool 231 bool
319 depends on (BFIN533_EZKIT || BFIN561_EZKIT \ 232 depends on (BFIN533_EZKIT || BFIN561_EZKIT \
320 || BFIN533_BLUETECHNIX_CM || BFIN537_BLUETECHNIX_CM) 233 || BFIN533_BLUETECHNIX_CM || BFIN537_BLUETECHNIX_CM \
234 || H8606_HVSISTEMAS)
321 default y 235 default y
322 236
323config MEM_MT48LC32M8A2_75 237config MEM_MT48LC32M8A2_75
@@ -366,7 +280,7 @@ config CLKIN_HZ
366 int "Crystal Frequency in Hz" 280 int "Crystal Frequency in Hz"
367 default "11059200" if BFIN533_STAMP 281 default "11059200" if BFIN533_STAMP
368 default "27000000" if BFIN533_EZKIT 282 default "27000000" if BFIN533_EZKIT
369 default "25000000" if (BFIN537_STAMP || BFIN527_EZKIT) 283 default "25000000" if (BFIN537_STAMP || BFIN527_EZKIT || H8606_HVSISTEMAS)
370 default "30000000" if BFIN561_EZKIT 284 default "30000000" if BFIN561_EZKIT
371 default "24576000" if PNAV10 285 default "24576000" if PNAV10
372 help 286 help
@@ -382,9 +296,9 @@ config BFIN_KERNEL_CLOCK
382 configuration. 296 configuration.
383 297
384config PLL_BYPASS 298config PLL_BYPASS
385 bool "Bypass PLL" 299 bool "Bypass PLL"
386 depends on BFIN_KERNEL_CLOCK 300 depends on BFIN_KERNEL_CLOCK
387 default n 301 default n
388 302
389config CLKIN_HALF 303config CLKIN_HALF
390 bool "Half Clock In" 304 bool "Half Clock In"
@@ -404,6 +318,7 @@ config VCO_MULT
404 default "20" if BFIN537_BLUETECHNIX_CM 318 default "20" if BFIN537_BLUETECHNIX_CM
405 default "20" if BFIN561_BLUETECHNIX_CM 319 default "20" if BFIN561_BLUETECHNIX_CM
406 default "20" if BFIN561_EZKIT 320 default "20" if BFIN561_EZKIT
321 default "16" if H8606_HVSISTEMAS
407 help 322 help
408 This controls the frequency of the on-chip PLL. This can be between 1 and 64. 323 This controls the frequency of the on-chip PLL. This can be between 1 and 64.
409 PLL Frequency = (Crystal Frequency) * (this setting) 324 PLL Frequency = (Crystal Frequency) * (this setting)
@@ -440,6 +355,7 @@ config SCLK_DIV
440 default 4 if BFIN537_BLUETECHNIX_CM 355 default 4 if BFIN537_BLUETECHNIX_CM
441 default 4 if BFIN561_BLUETECHNIX_CM 356 default 4 if BFIN561_BLUETECHNIX_CM
442 default 5 if BFIN561_EZKIT 357 default 5 if BFIN561_EZKIT
358 default 3 if H8606_HVSISTEMAS
443 help 359 help
444 This sets the frequency of the system clock (including SDRAM or DDR). 360 This sets the frequency of the system clock (including SDRAM or DDR).
445 This can be between 1 and 15 361 This can be between 1 and 15
@@ -459,11 +375,11 @@ config MAX_VCO_HZ
459 default 500000000 if BF534 375 default 500000000 if BF534
460 default 400000000 if BF536 376 default 400000000 if BF536
461 default 600000000 if BF537 377 default 600000000 if BF537
462 default 533000000 if BF538 378 default 533333333 if BF538
463 default 533000000 if BF539 379 default 533333333 if BF539
464 default 600000000 if BF542 380 default 600000000 if BF542
465 default 533000000 if BF544 381 default 533333333 if BF544
466 default 533000000 if BF549 382 default 533333333 if BF549
467 default 600000000 if BF561 383 default 600000000 if BF561
468 384
469config MIN_VCO_HZ 385config MIN_VCO_HZ
@@ -472,7 +388,7 @@ config MIN_VCO_HZ
472 388
473config MAX_SCLK_HZ 389config MAX_SCLK_HZ
474 int 390 int
475 default 133000000 391 default 133333333
476 392
477config MIN_SCLK_HZ 393config MIN_SCLK_HZ
478 int 394 int
@@ -492,11 +408,13 @@ config MEM_SIZE
492 default 64 if BFIN561_EZKIT 408 default 64 if BFIN561_EZKIT
493 default 128 if BFIN533_STAMP 409 default 128 if BFIN533_STAMP
494 default 64 if PNAV10 410 default 64 if PNAV10
411 default 32 if H8606_HVSISTEMAS
495 412
496config MEM_ADD_WIDTH 413config MEM_ADD_WIDTH
497 int "SDRAM Memory Address Width" 414 int "SDRAM Memory Address Width"
498 default 9 if BFIN533_EZKIT 415 default 9 if BFIN533_EZKIT
499 default 9 if BFIN561_EZKIT 416 default 9 if BFIN561_EZKIT
417 default 9 if H8606_HVSISTEMAS
500 default 10 if BFIN527_EZKIT 418 default 10 if BFIN527_EZKIT
501 default 10 if BFIN537_STAMP 419 default 10 if BFIN537_STAMP
502 default 11 if BFIN533_STAMP 420 default 11 if BFIN533_STAMP
@@ -948,6 +866,20 @@ config BANK_3
948 default 0x99B3 866 default 0x99B3
949endmenu 867endmenu
950 868
869config EBIU_MBSCTLVAL
870 hex "EBIU Bank Select Control Register"
871 depends on BF54x
872 default 0
873
874config EBIU_MODEVAL
875 hex "Flash Memory Mode Control Register"
876 depends on BF54x
877 default 1
878
879config EBIU_FCTLVAL
880 hex "Flash Memory Bank Control Register"
881 depends on BF54x
882 default 6
951endmenu 883endmenu
952 884
953############################################################################# 885#############################################################################
@@ -1064,174 +996,7 @@ source "fs/Kconfig"
1064 996
1065source "kernel/Kconfig.instrumentation" 997source "kernel/Kconfig.instrumentation"
1066 998
1067menu "Kernel hacking" 999source "arch/blackfin/Kconfig.debug"
1068
1069source "lib/Kconfig.debug"
1070
1071config DEBUG_HWERR
1072 bool "Hardware error interrupt debugging"
1073 depends on DEBUG_KERNEL
1074 help
1075 When enabled, the hardware error interrupt is never disabled, and
1076 will happen immediately when an error condition occurs. This comes
1077 at a slight cost in code size, but is necessary if you are getting
1078 hardware error interrupts and need to know where they are coming
1079 from.
1080
1081config DEBUG_ICACHE_CHECK
1082 bool "Check Instruction cache coherency"
1083 depends on DEBUG_KERNEL
1084 depends on DEBUG_HWERR
1085 help
1086 Say Y here if you are getting weird unexplained errors. This will
1087 ensure that icache is what SDRAM says it should be by doing a
1088 byte wise comparison between SDRAM and instruction cache. This
1089 also relocates the irq_panic() function to L1 memory, (which is
1090 un-cached).
1091
1092config DEBUG_HUNT_FOR_ZERO
1093 bool "Catch NULL pointer reads/writes"
1094 default y
1095 help
1096 Say Y here to catch reads/writes to anywhere in the memory range
1097 from 0x0000 - 0x0FFF (the first 4k) of memory. This is useful in
1098 catching common programming errors such as NULL pointer dereferences.
1099
1100 Misbehaving applications will be killed (generate a SEGV) while the
1101 kernel will trigger a panic.
1102
1103 Enabling this option will take up an extra entry in CPLB table.
1104 Otherwise, there is no extra overhead.
1105
1106config DEBUG_BFIN_HWTRACE_ON
1107 bool "Turn on Blackfin's Hardware Trace"
1108 default y
1109 help
1110 All Blackfins include a Trace Unit which stores a history of the last
1111 16 changes in program flow taken by the program sequencer. The history
1112 allows the user to recreate the program sequencer’s recent path. This
1113 can be handy when an application dies - we print out the execution
1114 path of how it got to the offending instruction.
1115
1116 By turning this off, you may save a tiny amount of power.
1117
1118choice
1119 prompt "Omit loop Tracing"
1120 default DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
1121 depends on DEBUG_BFIN_HWTRACE_ON
1122 help
1123 The trace buffer can be configured to omit recording of changes in
1124 program flow that match either the last entry or one of the last
1125 two entries. Omitting one of these entries from the record prevents
1126 the trace buffer from overflowing because of any sort of loop (for, do
1127 while, etc) in the program.
1128
1129 Because zero-overhead Hardware loops are not recorded in the trace buffer,
1130 this feature can be used to prevent trace overflow from loops that
1131 are nested four deep.
1132
1133config DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
1134 bool "Trace all Loops"
1135 help
1136 The trace buffer records all changes of flow
1137
1138config DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
1139 bool "Compress single-level loops"
1140 help
1141 The trace buffer does not record single loops - helpful if trace
1142 is spinning on a while or do loop.
1143
1144config DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
1145 bool "Compress two-level loops"
1146 help
1147 The trace buffer does not record loops two levels deep. Helpful if
1148 the trace is spinning in a nested loop
1149
1150endchoice
1151
1152config DEBUG_BFIN_HWTRACE_COMPRESSION
1153 int
1154 depends on DEBUG_BFIN_HWTRACE_ON
1155 default 0 if DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
1156 default 1 if DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
1157 default 2 if DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
1158
1159
1160config DEBUG_BFIN_HWTRACE_EXPAND
1161 bool "Expand Trace Buffer greater than 16 entries"
1162 depends on DEBUG_BFIN_HWTRACE_ON
1163 default n
1164 help
1165 By selecting this option, every time the 16 hardware entries in
1166 the Blackfin's HW Trace buffer are full, the kernel will move them
1167 into a software buffer, for dumping when there is an issue. This
1168 has a great impact on performance, (an interrupt every 16 change of
1169 flows) and should normally be turned off, except in those nasty
1170 debugging sessions
1171
1172config DEBUG_BFIN_HWTRACE_EXPAND_LEN
1173 int "Size of Trace buffer (in power of 2k)"
1174 range 0 4
1175 depends on DEBUG_BFIN_HWTRACE_EXPAND
1176 default 1
1177 help
1178 This sets the size of the software buffer that the trace information
1179 is kept in.
1180 0 for (2^0) 1k, or 256 entries,
1181 1 for (2^1) 2k, or 512 entries,
1182 2 for (2^2) 4k, or 1024 entries,
1183 3 for (2^3) 8k, or 2048 entries,
1184 4 for (2^4) 16k, or 4096 entries
1185
1186config DEBUG_BFIN_NO_KERN_HWTRACE
1187 bool "Trace user apps (turn off hwtrace in kernel)"
1188 depends on DEBUG_BFIN_HWTRACE_ON
1189 default n
1190 help
1191 Some pieces of the kernel contain a lot of flow changes which can
1192 quickly fill up the hardware trace buffer. When debugging crashes,
1193 the hardware trace may indicate that the problem lies in kernel
1194 space when in reality an application is buggy.
1195
1196 Say Y here to disable hardware tracing in some known "jumpy" pieces
1197 of code so that the trace buffer will extend further back.
1198
1199config EARLY_PRINTK
1200 bool "Early printk"
1201 default n
1202 help
1203 This option enables special console drivers which allow the kernel
1204 to print messages very early in the bootup process.
1205
1206 This is useful for kernel debugging when your machine crashes very
1207 early before the console code is initialized. After enabling this
1208 feature, you must add "earlyprintk=serial,uart0,57600" to the
1209 command line (bootargs). It is safe to say Y here in all cases, as
1210 all of this lives in the init section and is thrown away after the
1211 kernel boots completely.
1212
1213config DUAL_CORE_TEST_MODULE
1214 tristate "Dual Core Test Module"
1215 depends on (BF561)
1216 default n
1217 help
1218 Say Y here to build-in dual core test module for dual core test.
1219
1220config CPLB_INFO
1221 bool "Display the CPLB information"
1222 help
1223 Display the CPLB information.
1224
1225config ACCESS_CHECK
1226 bool "Check the user pointer address"
1227 default y
1228 help
1229 Usually the pointer transfer from user space is checked to see if its
1230 address is in the kernel space.
1231
1232 Say N here to disable that check to improve the performance.
1233
1234endmenu
1235 1000
1236source "security/Kconfig" 1001source "security/Kconfig"
1237 1002
diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug
new file mode 100644
index 000000000000..59b87a483c68
--- /dev/null
+++ b/arch/blackfin/Kconfig.debug
@@ -0,0 +1,178 @@
1menu "Kernel hacking"
2
3source "lib/Kconfig.debug"
4
5config DEBUG_MMRS
6 bool "Generate Blackfin MMR tree"
7 select DEBUG_FS
8 help
9 Create a tree of Blackfin MMRs via the debugfs tree. If
10 you enable this, you will find all MMRs laid out in the
11 /sys/kernel/debug/blackfin/ directory where you can read/write
12 MMRs directly from userspace. This is obviously just a debug
13 feature.
14
15config DEBUG_HWERR
16 bool "Hardware error interrupt debugging"
17 depends on DEBUG_KERNEL
18 help
19 When enabled, the hardware error interrupt is never disabled, and
20 will happen immediately when an error condition occurs. This comes
21 at a slight cost in code size, but is necessary if you are getting
22 hardware error interrupts and need to know where they are coming
23 from.
24
25config DEBUG_ICACHE_CHECK
26 bool "Check Instruction cache coherency"
27 depends on DEBUG_KERNEL
28 depends on DEBUG_HWERR
29 help
30 Say Y here if you are getting weird unexplained errors. This will
31 ensure that icache is what SDRAM says it should be by doing a
32 byte wise comparison between SDRAM and instruction cache. This
33 also relocates the irq_panic() function to L1 memory, (which is
34 un-cached).
35
36config DEBUG_HUNT_FOR_ZERO
37 bool "Catch NULL pointer reads/writes"
38 default y
39 help
40 Say Y here to catch reads/writes to anywhere in the memory range
41 from 0x0000 - 0x0FFF (the first 4k) of memory. This is useful in
42 catching common programming errors such as NULL pointer dereferences.
43
44 Misbehaving applications will be killed (generate a SEGV) while the
45 kernel will trigger a panic.
46
47 Enabling this option will take up an extra entry in CPLB table.
48 Otherwise, there is no extra overhead.
49
50config DEBUG_BFIN_HWTRACE_ON
51 bool "Turn on Blackfin's Hardware Trace"
52 default y
53 help
54 All Blackfins include a Trace Unit which stores a history of the last
55 16 changes in program flow taken by the program sequencer. The history
56 allows the user to recreate the program sequencer’s recent path. This
57 can be handy when an application dies - we print out the execution
58 path of how it got to the offending instruction.
59
60 By turning this off, you may save a tiny amount of power.
61
62choice
63 prompt "Omit loop Tracing"
64 default DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
65 depends on DEBUG_BFIN_HWTRACE_ON
66 help
67 The trace buffer can be configured to omit recording of changes in
68 program flow that match either the last entry or one of the last
69 two entries. Omitting one of these entries from the record prevents
70 the trace buffer from overflowing because of any sort of loop (for, do
71 while, etc) in the program.
72
73 Because zero-overhead Hardware loops are not recorded in the trace buffer,
74 this feature can be used to prevent trace overflow from loops that
75 are nested four deep.
76
77config DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
78 bool "Trace all Loops"
79 help
80 The trace buffer records all changes of flow
81
82config DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
83 bool "Compress single-level loops"
84 help
85 The trace buffer does not record single loops - helpful if trace
86 is spinning on a while or do loop.
87
88config DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
89 bool "Compress two-level loops"
90 help
91 The trace buffer does not record loops two levels deep. Helpful if
92 the trace is spinning in a nested loop
93
94endchoice
95
96config DEBUG_BFIN_HWTRACE_COMPRESSION
97 int
98 depends on DEBUG_BFIN_HWTRACE_ON
99 default 0 if DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
100 default 1 if DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
101 default 2 if DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
102
103
104config DEBUG_BFIN_HWTRACE_EXPAND
105 bool "Expand Trace Buffer greater than 16 entries"
106 depends on DEBUG_BFIN_HWTRACE_ON
107 default n
108 help
109 By selecting this option, every time the 16 hardware entries in
110 the Blackfin's HW Trace buffer are full, the kernel will move them
111 into a software buffer, for dumping when there is an issue. This
112 has a great impact on performance, (an interrupt every 16 change of
113 flows) and should normally be turned off, except in those nasty
114 debugging sessions
115
116config DEBUG_BFIN_HWTRACE_EXPAND_LEN
117 int "Size of Trace buffer (in power of 2k)"
118 range 0 4
119 depends on DEBUG_BFIN_HWTRACE_EXPAND
120 default 1
121 help
122 This sets the size of the software buffer that the trace information
123 is kept in.
124 0 for (2^0) 1k, or 256 entries,
125 1 for (2^1) 2k, or 512 entries,
126 2 for (2^2) 4k, or 1024 entries,
127 3 for (2^3) 8k, or 2048 entries,
128 4 for (2^4) 16k, or 4096 entries
129
130config DEBUG_BFIN_NO_KERN_HWTRACE
131 bool "Trace user apps (turn off hwtrace in kernel)"
132 depends on DEBUG_BFIN_HWTRACE_ON
133 default n
134 help
135 Some pieces of the kernel contain a lot of flow changes which can
136 quickly fill up the hardware trace buffer. When debugging crashes,
137 the hardware trace may indicate that the problem lies in kernel
138 space when in reality an application is buggy.
139
140 Say Y here to disable hardware tracing in some known "jumpy" pieces
141 of code so that the trace buffer will extend further back.
142
143config EARLY_PRINTK
144 bool "Early printk"
145 default n
146 help
147 This option enables special console drivers which allow the kernel
148 to print messages very early in the bootup process.
149
150 This is useful for kernel debugging when your machine crashes very
151 early before the console code is initialized. After enabling this
152 feature, you must add "earlyprintk=serial,uart0,57600" to the
153 command line (bootargs). It is safe to say Y here in all cases, as
154 all of this lives in the init section and is thrown away after the
155 kernel boots completely.
156
157config DUAL_CORE_TEST_MODULE
158 tristate "Dual Core Test Module"
159 depends on (BF561)
160 default n
161 help
162 Say Y here to build-in dual core test module for dual core test.
163
164config CPLB_INFO
165 bool "Display the CPLB information"
166 help
167 Display the CPLB information.
168
169config ACCESS_CHECK
170 bool "Check the user pointer address"
171 default y
172 help
173 Usually the pointer transfer from user space is checked to see if its
174 address is in the kernel space.
175
176 Say N here to disable that check to improve the performance.
177
178endmenu
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index f7cac7c51e7e..c47e000f8324 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -31,6 +31,7 @@ machine-$(CONFIG_BF536) := bf537
31machine-$(CONFIG_BF537) := bf537 31machine-$(CONFIG_BF537) := bf537
32machine-$(CONFIG_BF542) := bf548 32machine-$(CONFIG_BF542) := bf548
33machine-$(CONFIG_BF544) := bf548 33machine-$(CONFIG_BF544) := bf548
34machine-$(CONFIG_BF547) := bf548
34machine-$(CONFIG_BF548) := bf548 35machine-$(CONFIG_BF548) := bf548
35machine-$(CONFIG_BF549) := bf548 36machine-$(CONFIG_BF549) := bf548
36machine-$(CONFIG_BF561) := bf561 37machine-$(CONFIG_BF561) := bf561
@@ -48,6 +49,7 @@ cpu-$(CONFIG_BF536) := bf536
48cpu-$(CONFIG_BF537) := bf537 49cpu-$(CONFIG_BF537) := bf537
49cpu-$(CONFIG_BF542) := bf542 50cpu-$(CONFIG_BF542) := bf542
50cpu-$(CONFIG_BF544) := bf544 51cpu-$(CONFIG_BF544) := bf544
52cpu-$(CONFIG_BF547) := bf547
51cpu-$(CONFIG_BF548) := bf548 53cpu-$(CONFIG_BF548) := bf548
52cpu-$(CONFIG_BF549) := bf549 54cpu-$(CONFIG_BF549) := bf549
53cpu-$(CONFIG_BF561) := bf561 55cpu-$(CONFIG_BF561) := bf561
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index df974e785ee2..fa6eb4e00fae 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -1,6 +1,6 @@
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.9 3# Linux kernel version: 2.6.22.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -127,6 +125,7 @@ CONFIG_BF527=y
127# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
128# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
129# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
130# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
131# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
132# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
@@ -140,19 +139,8 @@ CONFIG_BF_REV_0_0=y
140# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
141CONFIG_BF52x=y 140CONFIG_BF52x=y
142CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
143CONFIG_BFIN527_EZKIT=y
144# CONFIG_BFIN533_EZKIT is not set
145# CONFIG_BFIN533_STAMP is not set
146# CONFIG_BFIN537_STAMP is not set
147# CONFIG_BFIN533_BLUETECHNIX_CM is not set
148# CONFIG_BFIN537_BLUETECHNIX_CM is not set
149# CONFIG_BFIN548_EZKIT is not set
150# CONFIG_BFIN561_BLUETECHNIX_CM is not set
151# CONFIG_BFIN561_EZKIT is not set
152# CONFIG_BFIN561_TEPLA is not set
153# CONFIG_PNAV10 is not set
154# CONFIG_GENERIC_BOARD is not set
155CONFIG_MEM_MT48LC32M16A2TG_75=y 142CONFIG_MEM_MT48LC32M16A2TG_75=y
143CONFIG_BFIN527_EZKIT=y
156 144
157# 145#
158# BF527 Specific Configuration 146# BF527 Specific Configuration
@@ -301,6 +289,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
301# CONFIG_RESOURCES_64BIT is not set 289# CONFIG_RESOURCES_64BIT is not set
302CONFIG_ZONE_DMA_FLAG=1 290CONFIG_ZONE_DMA_FLAG=1
303CONFIG_LARGE_ALLOCS=y 291CONFIG_LARGE_ALLOCS=y
292# CONFIG_BFIN_GPTIMERS is not set
304CONFIG_BFIN_DMA_5XX=y 293CONFIG_BFIN_DMA_5XX=y
305# CONFIG_DMA_UNCACHED_2M is not set 294# CONFIG_DMA_UNCACHED_2M is not set
306CONFIG_DMA_UNCACHED_1M=y 295CONFIG_DMA_UNCACHED_1M=y
@@ -322,7 +311,7 @@ CONFIG_L1_MAX_PIECE=16
322# 311#
323 312
324# 313#
325# EBIU_AMBCTL Global Control 314# EBIU_AMGCTL Global Control
326# 315#
327CONFIG_C_AMCKEN=y 316CONFIG_C_AMCKEN=y
328CONFIG_C_CDPRIO=y 317CONFIG_C_CDPRIO=y
@@ -548,6 +537,7 @@ CONFIG_BFIN_NAND_CLE=2
548CONFIG_BFIN_NAND_ALE=1 537CONFIG_BFIN_NAND_ALE=1
549CONFIG_BFIN_NAND_READY=3 538CONFIG_BFIN_NAND_READY=3
550CONFIG_MTD_NAND_IDS=m 539CONFIG_MTD_NAND_IDS=m
540# CONFIG_MTD_NAND_BF5XX is not set
551# CONFIG_MTD_NAND_DISKONCHIP is not set 541# CONFIG_MTD_NAND_DISKONCHIP is not set
552# CONFIG_MTD_NAND_NANDSIM is not set 542# CONFIG_MTD_NAND_NANDSIM is not set
553# CONFIG_MTD_NAND_PLATFORM is not set 543# CONFIG_MTD_NAND_PLATFORM is not set
@@ -637,6 +627,7 @@ CONFIG_BFIN_MAC_RMII=y
637# CONFIG_DM9000 is not set 627# CONFIG_DM9000 is not set
638CONFIG_NETDEV_1000=y 628CONFIG_NETDEV_1000=y
639CONFIG_NETDEV_10000=y 629CONFIG_NETDEV_10000=y
630# CONFIG_AX88180 is not set
640 631
641# 632#
642# Wireless LAN 633# Wireless LAN
@@ -708,7 +699,7 @@ CONFIG_INPUT_MISC=y
708# CONFIG_SPI_ADC_BF533 is not set 699# CONFIG_SPI_ADC_BF533 is not set
709# CONFIG_BF5xx_PFLAGS is not set 700# CONFIG_BF5xx_PFLAGS is not set
710# CONFIG_BF5xx_PPIFCD is not set 701# CONFIG_BF5xx_PPIFCD is not set
711# CONFIG_BF5xx_TIMERS is not set 702# CONFIG_BFIN_SIMPLE_TIMER is not set
712# CONFIG_BF5xx_PPI is not set 703# CONFIG_BF5xx_PPI is not set
713# CONFIG_BFIN_SPORT is not set 704# CONFIG_BFIN_SPORT is not set
714# CONFIG_BFIN_TIMER_LATENCY is not set 705# CONFIG_BFIN_TIMER_LATENCY is not set
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 57f58d5cd47a..4fdb49362ba3 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -1,6 +1,6 @@
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.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122CONFIG_BF533=y 122CONFIG_BF533=y
@@ -125,10 +125,12 @@ CONFIG_BF533=y
125# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
130# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
131# CONFIG_BF_REV_0_0 is not set 132# CONFIG_BF_REV_0_0 is not set
133# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set 134# CONFIG_BF_REV_0_2 is not set
133CONFIG_BF_REV_0_3=y 135CONFIG_BF_REV_0_3=y
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -137,18 +139,12 @@ CONFIG_BF_REV_0_3=y
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y 140CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
142CONFIG_MEM_MT48LC16M16A2TG_75=y
140CONFIG_BFIN533_EZKIT=y 143CONFIG_BFIN533_EZKIT=y
141# CONFIG_BFIN533_STAMP is not set 144# CONFIG_BFIN533_STAMP is not set
142# CONFIG_BFIN537_STAMP is not set
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set 145# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144# CONFIG_BFIN537_BLUETECHNIX_CM is not set 146# CONFIG_H8606_HVSISTEMAS is not set
145# CONFIG_BFIN548_EZKIT is not set 147# CONFIG_GENERIC_BF533_BOARD is not set
146# CONFIG_BFIN561_BLUETECHNIX_CM is not set
147# CONFIG_BFIN561_EZKIT is not set
148# CONFIG_BFIN561_TEPLA is not set
149# CONFIG_PNAV10 is not set
150# CONFIG_GENERIC_BOARD is not set
151CONFIG_MEM_MT48LC16M16A2TG_75=y
152 148
153# 149#
154# BF533/2/1 Specific Configuration 150# BF533/2/1 Specific Configuration
@@ -255,6 +251,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
255# CONFIG_RESOURCES_64BIT is not set 251# CONFIG_RESOURCES_64BIT is not set
256CONFIG_ZONE_DMA_FLAG=1 252CONFIG_ZONE_DMA_FLAG=1
257CONFIG_LARGE_ALLOCS=y 253CONFIG_LARGE_ALLOCS=y
254# CONFIG_BFIN_GPTIMERS is not set
258CONFIG_BFIN_DMA_5XX=y 255CONFIG_BFIN_DMA_5XX=y
259# CONFIG_DMA_UNCACHED_2M is not set 256# CONFIG_DMA_UNCACHED_2M is not set
260CONFIG_DMA_UNCACHED_1M=y 257CONFIG_DMA_UNCACHED_1M=y
@@ -276,7 +273,7 @@ CONFIG_L1_MAX_PIECE=16
276# 273#
277 274
278# 275#
279# EBIU_AMBCTL Global Control 276# EBIU_AMGCTL Global Control
280# 277#
281CONFIG_C_AMCKEN=y 278CONFIG_C_AMCKEN=y
282CONFIG_C_CDPRIO=y 279CONFIG_C_CDPRIO=y
@@ -526,14 +523,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
526CONFIG_MTD_BF5xx=m 523CONFIG_MTD_BF5xx=m
527CONFIG_BFIN_FLASH_SIZE=0x400000 524CONFIG_BFIN_FLASH_SIZE=0x400000
528CONFIG_EBIU_FLASH_BASE=0x20000000 525CONFIG_EBIU_FLASH_BASE=0x20000000
529
530#
531# FLASH_EBIU_AMBCTL Control
532#
533CONFIG_BFIN_FLASH_BANK_0=0x7BB0
534CONFIG_BFIN_FLASH_BANK_1=0x7BB0
535CONFIG_BFIN_FLASH_BANK_2=0x7BB0
536CONFIG_BFIN_FLASH_BANK_3=0x7BB0
537# CONFIG_MTD_UCLINUX is not set 526# CONFIG_MTD_UCLINUX is not set
538# CONFIG_MTD_PLATRAM is not set 527# CONFIG_MTD_PLATRAM is not set
539 528
@@ -622,6 +611,7 @@ CONFIG_SMC91X=y
622# CONFIG_DM9000 is not set 611# CONFIG_DM9000 is not set
623CONFIG_NETDEV_1000=y 612CONFIG_NETDEV_1000=y
624CONFIG_NETDEV_10000=y 613CONFIG_NETDEV_10000=y
614# CONFIG_AX88180 is not set
625 615
626# 616#
627# Wireless LAN 617# Wireless LAN
@@ -683,9 +673,9 @@ CONFIG_INPUT_EVDEV=m
683# 673#
684# CONFIG_AD9960 is not set 674# CONFIG_AD9960 is not set
685# CONFIG_SPI_ADC_BF533 is not set 675# CONFIG_SPI_ADC_BF533 is not set
686# CONFIG_BFIN_PFLAGS is not set 676# CONFIG_BF5xx_PFLAGS is not set
687# CONFIG_BF5xx_PPIFCD is not set 677# CONFIG_BF5xx_PPIFCD is not set
688# CONFIG_BF5xx_TIMERS is not set 678# CONFIG_BFIN_SIMPLE_TIMER is not set
689# CONFIG_BF5xx_PPI is not set 679# CONFIG_BF5xx_PPI is not set
690CONFIG_BFIN_SPORT=y 680CONFIG_BFIN_SPORT=y
691# CONFIG_BFIN_TIMER_LATENCY is not set 681# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -708,6 +698,7 @@ CONFIG_SERIAL_BFIN_DMA=y
708# CONFIG_SERIAL_BFIN_PIO is not set 698# CONFIG_SERIAL_BFIN_PIO is not set
709CONFIG_SERIAL_BFIN_UART0=y 699CONFIG_SERIAL_BFIN_UART0=y
710# CONFIG_BFIN_UART0_CTSRTS is not set 700# CONFIG_BFIN_UART0_CTSRTS is not set
701# CONFIG_SERIAL_BFIN_UART1 is not set
711CONFIG_SERIAL_CORE=y 702CONFIG_SERIAL_CORE=y
712CONFIG_SERIAL_CORE_CONSOLE=y 703CONFIG_SERIAL_CORE_CONSOLE=y
713# CONFIG_SERIAL_BFIN_SPORT is not set 704# CONFIG_SERIAL_BFIN_SPORT is not set
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index 306302baff06..b04e8e533e9a 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -1,6 +1,6 @@
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.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122CONFIG_BF533=y 122CONFIG_BF533=y
@@ -125,10 +125,12 @@ CONFIG_BF533=y
125# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
130# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
131# CONFIG_BF_REV_0_0 is not set 132# CONFIG_BF_REV_0_0 is not set
133# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set 134# CONFIG_BF_REV_0_2 is not set
133CONFIG_BF_REV_0_3=y 135CONFIG_BF_REV_0_3=y
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -137,19 +139,13 @@ CONFIG_BF_REV_0_3=y
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y 140CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
142CONFIG_MEM_MT48LC64M4A2FB_7E=y
143CONFIG_BFIN_SHARED_FLASH_ENET=y
140# CONFIG_BFIN533_EZKIT is not set 144# CONFIG_BFIN533_EZKIT is not set
141CONFIG_BFIN533_STAMP=y 145CONFIG_BFIN533_STAMP=y
142# CONFIG_BFIN537_STAMP is not set
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set 146# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144# CONFIG_BFIN537_BLUETECHNIX_CM is not set 147# CONFIG_H8606_HVSISTEMAS is not set
145# CONFIG_BFIN548_EZKIT is not set 148# CONFIG_GENERIC_BF533_BOARD is not set
146# CONFIG_BFIN561_BLUETECHNIX_CM is not set
147# CONFIG_BFIN561_EZKIT is not set
148# CONFIG_BFIN561_TEPLA is not set
149# CONFIG_PNAV10 is not set
150# CONFIG_GENERIC_BOARD is not set
151CONFIG_MEM_MT48LC64M4A2FB_7E=y
152CONFIG_BFIN_SHARED_FLASH_ENET=y
153 149
154# 150#
155# BF533/2/1 Specific Configuration 151# BF533/2/1 Specific Configuration
@@ -267,6 +263,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
267# CONFIG_RESOURCES_64BIT is not set 263# CONFIG_RESOURCES_64BIT is not set
268CONFIG_ZONE_DMA_FLAG=1 264CONFIG_ZONE_DMA_FLAG=1
269CONFIG_LARGE_ALLOCS=y 265CONFIG_LARGE_ALLOCS=y
266# CONFIG_BFIN_GPTIMERS is not set
270CONFIG_BFIN_DMA_5XX=y 267CONFIG_BFIN_DMA_5XX=y
271# CONFIG_DMA_UNCACHED_2M is not set 268# CONFIG_DMA_UNCACHED_2M is not set
272CONFIG_DMA_UNCACHED_1M=y 269CONFIG_DMA_UNCACHED_1M=y
@@ -288,7 +285,7 @@ CONFIG_L1_MAX_PIECE=16
288# 285#
289 286
290# 287#
291# EBIU_AMBCTL Global Control 288# EBIU_AMGCTL Global Control
292# 289#
293CONFIG_C_AMCKEN=y 290CONFIG_C_AMCKEN=y
294CONFIG_C_CDPRIO=y 291CONFIG_C_CDPRIO=y
@@ -634,6 +631,7 @@ CONFIG_SMC91X=y
634# CONFIG_DM9000 is not set 631# CONFIG_DM9000 is not set
635CONFIG_NETDEV_1000=y 632CONFIG_NETDEV_1000=y
636CONFIG_NETDEV_10000=y 633CONFIG_NETDEV_10000=y
634# CONFIG_AX88180 is not set
637 635
638# 636#
639# Wireless LAN 637# Wireless LAN
@@ -704,9 +702,9 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=39
704# 702#
705# CONFIG_AD9960 is not set 703# CONFIG_AD9960 is not set
706# CONFIG_SPI_ADC_BF533 is not set 704# CONFIG_SPI_ADC_BF533 is not set
707# CONFIG_BFIN_PFLAGS is not set 705# CONFIG_BF5xx_PFLAGS is not set
708# CONFIG_BF5xx_PPIFCD is not set 706# CONFIG_BF5xx_PPIFCD is not set
709# CONFIG_BF5xx_TIMERS is not set 707# CONFIG_BFIN_SIMPLE_TIMER is not set
710# CONFIG_BF5xx_PPI is not set 708# CONFIG_BF5xx_PPI is not set
711CONFIG_BFIN_SPORT=y 709CONFIG_BFIN_SPORT=y
712# CONFIG_BFIN_TIMER_LATENCY is not set 710# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -732,6 +730,7 @@ CONFIG_SERIAL_BFIN_DMA=y
732# CONFIG_SERIAL_BFIN_PIO is not set 730# CONFIG_SERIAL_BFIN_PIO is not set
733CONFIG_SERIAL_BFIN_UART0=y 731CONFIG_SERIAL_BFIN_UART0=y
734# CONFIG_BFIN_UART0_CTSRTS is not set 732# CONFIG_BFIN_UART0_CTSRTS is not set
733# CONFIG_SERIAL_BFIN_UART1 is not set
735CONFIG_SERIAL_CORE=y 734CONFIG_SERIAL_CORE=y
736CONFIG_SERIAL_CORE_CONSOLE=y 735CONFIG_SERIAL_CORE_CONSOLE=y
737# CONFIG_SERIAL_BFIN_SPORT is not set 736# CONFIG_SERIAL_BFIN_SPORT is not set
@@ -925,6 +924,7 @@ CONFIG_NTSC=y
925# CONFIG_PAL_YCBCR is not set 924# CONFIG_PAL_YCBCR is not set
926CONFIG_ADV7393_1XMEM=y 925CONFIG_ADV7393_1XMEM=y
927# CONFIG_ADV7393_2XMEM is not set 926# CONFIG_ADV7393_2XMEM is not set
927# CONFIG_FB_BFIN_T350MCQB is not set
928# CONFIG_FB_S1D13XXX is not set 928# CONFIG_FB_S1D13XXX is not set
929# CONFIG_FB_VIRTUAL is not set 929# CONFIG_FB_VIRTUAL is not set
930# CONFIG_LOGO is not set 930# CONFIG_LOGO is not set
@@ -979,11 +979,6 @@ CONFIG_SND_BFIN_AD73311_SE=4
979# CONFIG_SND_SOC is not set 979# CONFIG_SND_SOC is not set
980 980
981# 981#
982# SoC Audio for the ADI Blackfin
983#
984# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
985
986#
987# Open Sound System 982# Open Sound System
988# 983#
989# CONFIG_SOUND_PRIME is not set 984# CONFIG_SOUND_PRIME is not set
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 828b604438eb..f812b66318b9 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -1,6 +1,6 @@
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.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122# CONFIG_BF533 is not set 122# CONFIG_BF533 is not set
@@ -125,10 +125,12 @@ CONFIG_PREEMPT_VOLUNTARY=y
125CONFIG_BF537=y 125CONFIG_BF537=y
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
130# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
131# CONFIG_BF_REV_0_0 is not set 132# CONFIG_BF_REV_0_0 is not set
133# CONFIG_BF_REV_0_1 is not set
132CONFIG_BF_REV_0_2=y 134CONFIG_BF_REV_0_2=y
133# CONFIG_BF_REV_0_3 is not set 135# CONFIG_BF_REV_0_3 is not set
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -137,33 +139,8 @@ CONFIG_BF_REV_0_2=y
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y 140CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
140# CONFIG_BFIN533_EZKIT is not set
141# CONFIG_BFIN533_STAMP is not set
142CONFIG_BFIN537_STAMP=y
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144# CONFIG_BFIN537_BLUETECHNIX_CM is not set
145# CONFIG_BFIN548_EZKIT is not set
146# CONFIG_BFIN561_BLUETECHNIX_CM is not set
147# CONFIG_BFIN561_EZKIT is not set
148# CONFIG_BFIN561_TEPLA is not set
149# CONFIG_PNAV10 is not set
150# CONFIG_GENERIC_BOARD is not set
151CONFIG_MEM_MT48LC32M8A2_75=y 142CONFIG_MEM_MT48LC32M8A2_75=y
152CONFIG_IRQ_PLL_WAKEUP=7 143CONFIG_IRQ_PLL_WAKEUP=7
153
154#
155# BF537 Specific Configuration
156#
157
158#
159# Interrupt Priority Assignment
160#
161
162#
163# Priority
164#
165CONFIG_IRQ_DMA_ERROR=7
166CONFIG_IRQ_ERROR=7
167CONFIG_IRQ_RTC=8 144CONFIG_IRQ_RTC=8
168CONFIG_IRQ_PPI=8 145CONFIG_IRQ_PPI=8
169CONFIG_IRQ_SPORT0_RX=9 146CONFIG_IRQ_SPORT0_RX=9
@@ -176,8 +153,6 @@ CONFIG_IRQ_UART0_RX=10
176CONFIG_IRQ_UART0_TX=10 153CONFIG_IRQ_UART0_TX=10
177CONFIG_IRQ_UART1_RX=10 154CONFIG_IRQ_UART1_RX=10
178CONFIG_IRQ_UART1_TX=10 155CONFIG_IRQ_UART1_TX=10
179CONFIG_IRQ_CAN_RX=11
180CONFIG_IRQ_CAN_TX=11
181CONFIG_IRQ_MAC_RX=11 156CONFIG_IRQ_MAC_RX=11
182CONFIG_IRQ_MAC_TX=11 157CONFIG_IRQ_MAC_TX=11
183CONFIG_IRQ_TMR0=12 158CONFIG_IRQ_TMR0=12
@@ -188,11 +163,31 @@ CONFIG_IRQ_TMR4=12
188CONFIG_IRQ_TMR5=12 163CONFIG_IRQ_TMR5=12
189CONFIG_IRQ_TMR6=12 164CONFIG_IRQ_TMR6=12
190CONFIG_IRQ_TMR7=12 165CONFIG_IRQ_TMR7=12
191CONFIG_IRQ_PROG_INTA=12
192CONFIG_IRQ_PORTG_INTB=12 166CONFIG_IRQ_PORTG_INTB=12
193CONFIG_IRQ_MEM_DMA0=13 167CONFIG_IRQ_MEM_DMA0=13
194CONFIG_IRQ_MEM_DMA1=13 168CONFIG_IRQ_MEM_DMA1=13
195CONFIG_IRQ_WATCH=13 169CONFIG_IRQ_WATCH=13
170CONFIG_BFIN537_STAMP=y
171# CONFIG_BFIN537_BLUETECHNIX_CM is not set
172# CONFIG_PNAV10 is not set
173# CONFIG_GENERIC_BF537_BOARD is not set
174
175#
176# BF537 Specific Configuration
177#
178
179#
180# Interrupt Priority Assignment
181#
182
183#
184# Priority
185#
186CONFIG_IRQ_DMA_ERROR=7
187CONFIG_IRQ_ERROR=7
188CONFIG_IRQ_CAN_RX=11
189CONFIG_IRQ_CAN_TX=11
190CONFIG_IRQ_PROG_INTA=12
196 191
197# 192#
198# Board customizations 193# Board customizations
@@ -263,6 +258,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
263# CONFIG_RESOURCES_64BIT is not set 258# CONFIG_RESOURCES_64BIT is not set
264CONFIG_ZONE_DMA_FLAG=1 259CONFIG_ZONE_DMA_FLAG=1
265CONFIG_LARGE_ALLOCS=y 260CONFIG_LARGE_ALLOCS=y
261# CONFIG_BFIN_GPTIMERS is not set
266CONFIG_BFIN_DMA_5XX=y 262CONFIG_BFIN_DMA_5XX=y
267# CONFIG_DMA_UNCACHED_2M is not set 263# CONFIG_DMA_UNCACHED_2M is not set
268CONFIG_DMA_UNCACHED_1M=y 264CONFIG_DMA_UNCACHED_1M=y
@@ -284,7 +280,7 @@ CONFIG_L1_MAX_PIECE=16
284# 280#
285 281
286# 282#
287# EBIU_AMBCTL Global Control 283# EBIU_AMGCTL Global Control
288# 284#
289CONFIG_C_AMCKEN=y 285CONFIG_C_AMCKEN=y
290CONFIG_C_CDPRIO=y 286CONFIG_C_CDPRIO=y
@@ -534,14 +530,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
534CONFIG_MTD_BF5xx=m 530CONFIG_MTD_BF5xx=m
535CONFIG_BFIN_FLASH_SIZE=0x400000 531CONFIG_BFIN_FLASH_SIZE=0x400000
536CONFIG_EBIU_FLASH_BASE=0x20000000 532CONFIG_EBIU_FLASH_BASE=0x20000000
537
538#
539# FLASH_EBIU_AMBCTL Control
540#
541CONFIG_BFIN_FLASH_BANK_0=0x7BB0
542CONFIG_BFIN_FLASH_BANK_1=0x7BB0
543CONFIG_BFIN_FLASH_BANK_2=0x7BB0
544CONFIG_BFIN_FLASH_BANK_3=0x7BB0
545# CONFIG_MTD_UCLINUX is not set 533# CONFIG_MTD_UCLINUX is not set
546# CONFIG_MTD_PLATRAM is not set 534# CONFIG_MTD_PLATRAM is not set
547 535
@@ -660,6 +648,7 @@ CONFIG_BFIN_RX_DESC_NUM=20
660# CONFIG_DM9000 is not set 648# CONFIG_DM9000 is not set
661CONFIG_NETDEV_1000=y 649CONFIG_NETDEV_1000=y
662CONFIG_NETDEV_10000=y 650CONFIG_NETDEV_10000=y
651# CONFIG_AX88180 is not set
663 652
664# 653#
665# Wireless LAN 654# Wireless LAN
@@ -730,9 +719,9 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
730# 719#
731# CONFIG_AD9960 is not set 720# CONFIG_AD9960 is not set
732# CONFIG_SPI_ADC_BF533 is not set 721# CONFIG_SPI_ADC_BF533 is not set
733# CONFIG_BFIN_PFLAGS is not set 722# CONFIG_BF5xx_PFLAGS is not set
734# CONFIG_BF5xx_PPIFCD is not set 723# CONFIG_BF5xx_PPIFCD is not set
735# CONFIG_BF5xx_TIMERS is not set 724# CONFIG_BFIN_SIMPLE_TIMER is not set
736# CONFIG_BF5xx_PPI is not set 725# CONFIG_BF5xx_PPI is not set
737CONFIG_BFIN_SPORT=y 726CONFIG_BFIN_SPORT=y
738# CONFIG_BFIN_TIMER_LATENCY is not set 727# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -967,6 +956,7 @@ CONFIG_FB_BF537_LQ035=m
967CONFIG_LQ035_SLAVE_ADDR=0x58 956CONFIG_LQ035_SLAVE_ADDR=0x58
968# CONFIG_FB_BFIN_LANDSCAPE is not set 957# CONFIG_FB_BFIN_LANDSCAPE is not set
969# CONFIG_FB_BFIN_BGR is not set 958# CONFIG_FB_BFIN_BGR is not set
959# CONFIG_FB_BFIN_T350MCQB is not set
970# CONFIG_FB_S1D13XXX is not set 960# CONFIG_FB_S1D13XXX is not set
971# CONFIG_FB_VIRTUAL is not set 961# CONFIG_FB_VIRTUAL is not set
972# CONFIG_LOGO is not set 962# CONFIG_LOGO is not set
@@ -1021,11 +1011,6 @@ CONFIG_SND_BFIN_AD73311_SE=4
1021# CONFIG_SND_SOC is not set 1011# CONFIG_SND_SOC is not set
1022 1012
1023# 1013#
1024# SoC Audio for the ADI Blackfin
1025#
1026# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
1027
1028#
1029# Open Sound System 1014# Open Sound System
1030# 1015#
1031# CONFIG_SOUND_PRIME is not set 1016# CONFIG_SOUND_PRIME is not set
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index d8569888a1c8..48367cc9fe35 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -1,6 +1,6 @@
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.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122# CONFIG_BF533 is not set 122# CONFIG_BF533 is not set
@@ -125,10 +125,12 @@ CONFIG_PREEMPT_VOLUNTARY=y
125# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129CONFIG_BF549=y 130CONFIG_BF549=y
130# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
131CONFIG_BF_REV_0_0=y 132CONFIG_BF_REV_0_0=y
133# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set 134# CONFIG_BF_REV_0_2 is not set
133# CONFIG_BF_REV_0_3 is not set 135# CONFIG_BF_REV_0_3 is not set
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -137,18 +139,21 @@ CONFIG_BF_REV_0_0=y
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BF54x=y 140CONFIG_BF54x=y
139CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
140# CONFIG_BFIN533_EZKIT is not set
141# CONFIG_BFIN533_STAMP is not set
142# CONFIG_BFIN537_STAMP is not set
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144# CONFIG_BFIN537_BLUETECHNIX_CM is not set
145CONFIG_BFIN548_EZKIT=y
146# CONFIG_BFIN561_BLUETECHNIX_CM is not set
147# CONFIG_BFIN561_EZKIT is not set
148# CONFIG_BFIN561_TEPLA is not set
149# CONFIG_PNAV10 is not set
150# CONFIG_GENERIC_BOARD is not set
151CONFIG_IRQ_PLL_WAKEUP=7 142CONFIG_IRQ_PLL_WAKEUP=7
143CONFIG_IRQ_RTC=8
144CONFIG_IRQ_SPORT0_RX=9
145CONFIG_IRQ_SPORT0_TX=9
146CONFIG_IRQ_SPORT1_RX=9
147CONFIG_IRQ_SPORT1_TX=9
148CONFIG_IRQ_UART0_RX=10
149CONFIG_IRQ_UART0_TX=10
150CONFIG_IRQ_UART1_RX=10
151CONFIG_IRQ_UART1_TX=10
152CONFIG_IRQ_CNT=8
153CONFIG_IRQ_USB_INT0=11
154CONFIG_IRQ_USB_INT1=11
155CONFIG_IRQ_USB_INT2=11
156CONFIG_IRQ_USB_DMA=11
152CONFIG_IRQ_TIMER0=11 157CONFIG_IRQ_TIMER0=11
153CONFIG_IRQ_TIMER1=11 158CONFIG_IRQ_TIMER1=11
154CONFIG_IRQ_TIMER2=11 159CONFIG_IRQ_TIMER2=11
@@ -160,15 +165,7 @@ CONFIG_IRQ_TIMER7=11
160CONFIG_IRQ_TIMER8=11 165CONFIG_IRQ_TIMER8=11
161CONFIG_IRQ_TIMER9=11 166CONFIG_IRQ_TIMER9=11
162CONFIG_IRQ_TIMER10=11 167CONFIG_IRQ_TIMER10=11
163CONFIG_IRQ_RTC=8 168CONFIG_BFIN548_EZKIT=y
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 169
173# 170#
174# BF548 Specific Configuration 171# BF548 Specific Configuration
@@ -236,16 +233,11 @@ CONFIG_IRQ_PIXC_IN0=8
236CONFIG_IRQ_PIXC_IN1=8 233CONFIG_IRQ_PIXC_IN1=8
237CONFIG_IRQ_PIXC_OUT=8 234CONFIG_IRQ_PIXC_OUT=8
238CONFIG_IRQ_SDH=8 235CONFIG_IRQ_SDH=8
239CONFIG_IRQ_CNT=8
240CONFIG_IRQ_KEY=8 236CONFIG_IRQ_KEY=8
241CONFIG_IRQ_CAN1_RX=11 237CONFIG_IRQ_CAN1_RX=11
242CONFIG_IRQ_CAN1_TX=11 238CONFIG_IRQ_CAN1_TX=11
243CONFIG_IRQ_SDH_MASK0=11 239CONFIG_IRQ_SDH_MASK0=11
244CONFIG_IRQ_SDH_MASK1=11 240CONFIG_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 241CONFIG_IRQ_OTPSEC=11
250CONFIG_IRQ_PINT2=11 242CONFIG_IRQ_PINT2=11
251CONFIG_IRQ_PINT3=11 243CONFIG_IRQ_PINT3=11
@@ -332,9 +324,10 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
332# CONFIG_RESOURCES_64BIT is not set 324# CONFIG_RESOURCES_64BIT is not set
333CONFIG_ZONE_DMA_FLAG=1 325CONFIG_ZONE_DMA_FLAG=1
334CONFIG_LARGE_ALLOCS=y 326CONFIG_LARGE_ALLOCS=y
327# CONFIG_BFIN_GPTIMERS is not set
335CONFIG_BFIN_DMA_5XX=y 328CONFIG_BFIN_DMA_5XX=y
336# CONFIG_DMA_UNCACHED_2M is not set 329CONFIG_DMA_UNCACHED_2M=y
337CONFIG_DMA_UNCACHED_1M=y 330# CONFIG_DMA_UNCACHED_1M is not set
338# CONFIG_DMA_UNCACHED_NONE is not set 331# CONFIG_DMA_UNCACHED_NONE is not set
339 332
340# 333#
@@ -353,7 +346,7 @@ CONFIG_L1_MAX_PIECE=16
353# 346#
354 347
355# 348#
356# EBIU_AMBCTL Global Control 349# EBIU_AMGCTL Global Control
357# 350#
358CONFIG_C_AMCKEN=y 351CONFIG_C_AMCKEN=y
359# CONFIG_C_AMBEN is not set 352# CONFIG_C_AMBEN is not set
@@ -369,6 +362,9 @@ CONFIG_BANK_0=0x7BB0
369CONFIG_BANK_1=0x5554 362CONFIG_BANK_1=0x5554
370CONFIG_BANK_2=0x7BB0 363CONFIG_BANK_2=0x7BB0
371CONFIG_BANK_3=0x99B3 364CONFIG_BANK_3=0x99B3
365CONFIG_EBUI_MBSCTLVAL=0x0
366CONFIG_EBUI_MODEVAL=0x1
367CONFIG_EBUI_FCTLVAL=0x6
372 368
373# 369#
374# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 370# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -695,6 +691,7 @@ CONFIG_SMSC911X=y
695# CONFIG_DM9000 is not set 691# CONFIG_DM9000 is not set
696CONFIG_NETDEV_1000=y 692CONFIG_NETDEV_1000=y
697CONFIG_NETDEV_10000=y 693CONFIG_NETDEV_10000=y
694# CONFIG_AX88180 is not set
698 695
699# 696#
700# Wireless LAN 697# Wireless LAN
@@ -722,7 +719,7 @@ CONFIG_NETDEV_10000=y
722# 719#
723# Input device support 720# Input device support
724# 721#
725CONFIG_INPUT=y 722CONFIG_INPUT=m
726# CONFIG_INPUT_FF_MEMLESS is not set 723# CONFIG_INPUT_FF_MEMLESS is not set
727# CONFIG_INPUT_POLLDEV is not set 724# CONFIG_INPUT_POLLDEV is not set
728 725
@@ -731,18 +728,39 @@ CONFIG_INPUT=y
731# 728#
732# CONFIG_INPUT_MOUSEDEV is not set 729# CONFIG_INPUT_MOUSEDEV is not set
733# CONFIG_INPUT_JOYDEV is not set 730# CONFIG_INPUT_JOYDEV is not set
734# CONFIG_INPUT_TSDEV is not set 731CONFIG_INPUT_TSDEV=m
735# CONFIG_INPUT_EVDEV is not set 732CONFIG_INPUT_TSDEV_SCREEN_X=240
736# CONFIG_INPUT_EVBUG is not set 733CONFIG_INPUT_TSDEV_SCREEN_Y=320
734CONFIG_INPUT_EVDEV=m
735CONFIG_INPUT_EVBUG=m
737 736
738# 737#
739# Input Device Drivers 738# Input Device Drivers
740# 739#
741# CONFIG_INPUT_KEYBOARD is not set 740CONFIG_INPUT_KEYBOARD=y
741# CONFIG_KEYBOARD_ATKBD is not set
742# CONFIG_KEYBOARD_SUNKBD is not set
743# CONFIG_KEYBOARD_LKKBD is not set
744# CONFIG_KEYBOARD_XTKBD is not set
745# CONFIG_KEYBOARD_NEWTON is not set
746# CONFIG_KEYBOARD_STOWAWAY is not set
747# CONFIG_KEYBOARD_GPIO is not set
748CONFIG_KEYBOARD_BFIN=m
742# CONFIG_INPUT_MOUSE is not set 749# CONFIG_INPUT_MOUSE is not set
743# CONFIG_INPUT_JOYSTICK is not set 750# CONFIG_INPUT_JOYSTICK is not set
744# CONFIG_INPUT_TABLET is not set 751# CONFIG_INPUT_TABLET is not set
745# CONFIG_INPUT_TOUCHSCREEN is not set 752CONFIG_INPUT_TOUCHSCREEN=y
753# CONFIG_TOUCHSCREEN_ADS7846 is not set
754CONFIG_TOUCHSCREEN_AD7877=m
755# CONFIG_TOUCHSCREEN_GUNZE is not set
756# CONFIG_TOUCHSCREEN_ELO is not set
757# CONFIG_TOUCHSCREEN_MTOUCH is not set
758# CONFIG_TOUCHSCREEN_MK712 is not set
759# CONFIG_TOUCHSCREEN_PENMOUNT is not set
760# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
761# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
762# CONFIG_TOUCHSCREEN_UCB1400 is not set
763# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
746CONFIG_INPUT_MISC=y 764CONFIG_INPUT_MISC=y
747# CONFIG_INPUT_ATI_REMOTE is not set 765# CONFIG_INPUT_ATI_REMOTE is not set
748# CONFIG_INPUT_ATI_REMOTE2 is not set 766# CONFIG_INPUT_ATI_REMOTE2 is not set
@@ -764,9 +782,9 @@ CONFIG_INPUT_MISC=y
764# 782#
765# CONFIG_AD9960 is not set 783# CONFIG_AD9960 is not set
766# CONFIG_SPI_ADC_BF533 is not set 784# CONFIG_SPI_ADC_BF533 is not set
767# CONFIG_BFIN_PFLAGS is not set 785# CONFIG_BF5xx_PFLAGS is not set
768# CONFIG_BF5xx_PPIFCD is not set 786# CONFIG_BF5xx_PPIFCD is not set
769# CONFIG_BF5xx_TIMERS is not set 787# CONFIG_BFIN_SIMPLE_TIMER is not set
770# CONFIG_BF5xx_PPI is not set 788# CONFIG_BF5xx_PPI is not set
771# CONFIG_BFIN_SPORT is not set 789# CONFIG_BFIN_SPORT is not set
772# CONFIG_BFIN_TIMER_LATENCY is not set 790# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -958,17 +976,94 @@ CONFIG_DAB=y
958# 976#
959# CONFIG_DISPLAY_SUPPORT is not set 977# CONFIG_DISPLAY_SUPPORT is not set
960# CONFIG_VGASTATE is not set 978# CONFIG_VGASTATE is not set
961# CONFIG_FB is not set 979CONFIG_FB=m
980CONFIG_FIRMWARE_EDID=y
981# CONFIG_FB_DDC is not set
982CONFIG_FB_CFB_FILLRECT=m
983CONFIG_FB_CFB_COPYAREA=m
984CONFIG_FB_CFB_IMAGEBLIT=m
985# CONFIG_FB_SYS_FILLRECT is not set
986# CONFIG_FB_SYS_COPYAREA is not set
987# CONFIG_FB_SYS_IMAGEBLIT is not set
988# CONFIG_FB_SYS_FOPS is not set
989CONFIG_FB_DEFERRED_IO=y
990# CONFIG_FB_SVGALIB is not set
991# CONFIG_FB_MACMODES is not set
992# CONFIG_FB_BACKLIGHT is not set
993# CONFIG_FB_MODE_HELPERS is not set
994# CONFIG_FB_TILEBLITTING is not set
995
996#
997# Frame buffer hardware drivers
998#
999# CONFIG_FB_BFIN_7171 is not set
1000# CONFIG_FB_BFIN_7393 is not set
1001CONFIG_FB_BF54X_LQ043=m
1002# CONFIG_FB_BFIN_T350MCQB is not set
1003# CONFIG_FB_S1D13XXX is not set
1004# CONFIG_FB_VIRTUAL is not set
1005# CONFIG_LOGO is not set
962 1006
963# 1007#
964# Sound 1008# Sound
965# 1009#
966# CONFIG_SOUND is not set 1010CONFIG_SOUND=y
1011
1012#
1013# Advanced Linux Sound Architecture
1014#
1015CONFIG_SND=y
1016CONFIG_SND_TIMER=y
1017CONFIG_SND_PCM=y
1018# CONFIG_SND_SEQUENCER is not set
1019CONFIG_SND_OSSEMUL=y
1020CONFIG_SND_MIXER_OSS=y
1021CONFIG_SND_PCM_OSS=y
1022CONFIG_SND_PCM_OSS_PLUGINS=y
1023# CONFIG_SND_DYNAMIC_MINORS is not set
1024CONFIG_SND_SUPPORT_OLD_API=y
1025CONFIG_SND_VERBOSE_PROCFS=y
1026# CONFIG_SND_VERBOSE_PRINTK is not set
1027# CONFIG_SND_DEBUG is not set
1028
1029#
1030# Generic devices
1031#
1032# CONFIG_SND_DUMMY is not set
1033# CONFIG_SND_MTPAV is not set
1034# CONFIG_SND_SERIAL_U16550 is not set
1035# CONFIG_SND_MPU401 is not set
1036
1037#
1038# ALSA Blackfin devices
1039#
1040# CONFIG_SND_BLACKFIN_AD1836 is not set
1041# CONFIG_SND_BFIN_AD73311 is not set
1042
1043#
1044# System on Chip audio support
1045#
1046CONFIG_SND_SOC_AC97_BUS=y
1047CONFIG_SND_SOC=y
1048CONFIG_SND_BF5XX_SOC=y
1049CONFIG_SND_BF5XX_SOC_AC97=y
1050CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y
1051# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1052# CONFIG_SND_BF5XX_SOC_WM8731 is not set
1053CONFIG_SND_BF5XX_SPORT_NUM=0
1054# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
1055CONFIG_SND_SOC_AD1980=y
1056
1057#
1058# Open Sound System
1059#
1060# CONFIG_SOUND_PRIME is not set
1061CONFIG_AC97_BUS=y
967 1062
968# 1063#
969# HID Devices 1064# HID Devices
970# 1065#
971CONFIG_HID=y 1066CONFIG_HID=m
972# CONFIG_HID_DEBUG is not set 1067# CONFIG_HID_DEBUG is not set
973 1068
974# 1069#
@@ -1101,8 +1196,13 @@ CONFIG_EXT2_FS=y
1101CONFIG_EXT2_FS_XATTR=y 1196CONFIG_EXT2_FS_XATTR=y
1102# CONFIG_EXT2_FS_POSIX_ACL is not set 1197# CONFIG_EXT2_FS_POSIX_ACL is not set
1103# CONFIG_EXT2_FS_SECURITY is not set 1198# CONFIG_EXT2_FS_SECURITY is not set
1104# CONFIG_EXT3_FS is not set 1199CONFIG_EXT3_FS=y
1200CONFIG_EXT3_FS_XATTR=y
1201# CONFIG_EXT3_FS_POSIX_ACL is not set
1202# CONFIG_EXT3_FS_SECURITY is not set
1105# CONFIG_EXT4DEV_FS is not set 1203# CONFIG_EXT4DEV_FS is not set
1204CONFIG_JBD=y
1205# CONFIG_JBD_DEBUG is not set
1106CONFIG_FS_MBCACHE=y 1206CONFIG_FS_MBCACHE=y
1107# CONFIG_REISERFS_FS is not set 1207# CONFIG_REISERFS_FS is not set
1108# CONFIG_JFS_FS is not set 1208# CONFIG_JFS_FS is not set
@@ -1123,15 +1223,22 @@ CONFIG_DNOTIFY=y
1123# 1223#
1124# CD-ROM/DVD Filesystems 1224# CD-ROM/DVD Filesystems
1125# 1225#
1126# CONFIG_ISO9660_FS is not set 1226CONFIG_ISO9660_FS=m
1227CONFIG_JOLIET=y
1228CONFIG_ZISOFS=y
1127# CONFIG_UDF_FS is not set 1229# CONFIG_UDF_FS is not set
1128 1230
1129# 1231#
1130# DOS/FAT/NT Filesystems 1232# DOS/FAT/NT Filesystems
1131# 1233#
1132# CONFIG_MSDOS_FS is not set 1234CONFIG_FAT_FS=m
1133# CONFIG_VFAT_FS is not set 1235CONFIG_MSDOS_FS=m
1134# CONFIG_NTFS_FS is not set 1236CONFIG_VFAT_FS=m
1237CONFIG_FAT_DEFAULT_CODEPAGE=437
1238CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1239CONFIG_NTFS_FS=m
1240# CONFIG_NTFS_DEBUG is not set
1241CONFIG_NTFS_RW=y
1135 1242
1136# 1243#
1137# Pseudo filesystems 1244# Pseudo filesystems
@@ -1183,10 +1290,33 @@ CONFIG_JFFS2_RTIME=y
1183# 1290#
1184# Network File Systems 1291# Network File Systems
1185# 1292#
1186# CONFIG_NFS_FS is not set 1293CONFIG_NFS_FS=m
1187# CONFIG_NFSD is not set 1294CONFIG_NFS_V3=y
1188# CONFIG_SMB_FS is not set 1295# CONFIG_NFS_V3_ACL is not set
1189# CONFIG_CIFS is not set 1296# CONFIG_NFS_V4 is not set
1297# CONFIG_NFS_DIRECTIO is not set
1298CONFIG_NFSD=m
1299CONFIG_NFSD_V3=y
1300# CONFIG_NFSD_V3_ACL is not set
1301# CONFIG_NFSD_V4 is not set
1302CONFIG_NFSD_TCP=y
1303CONFIG_LOCKD=m
1304CONFIG_LOCKD_V4=y
1305CONFIG_EXPORTFS=m
1306CONFIG_NFS_COMMON=y
1307CONFIG_SUNRPC=m
1308# CONFIG_SUNRPC_BIND34 is not set
1309# CONFIG_RPCSEC_GSS_KRB5 is not set
1310# CONFIG_RPCSEC_GSS_SPKM3 is not set
1311CONFIG_SMB_FS=m
1312CONFIG_SMB_NLS_DEFAULT=y
1313CONFIG_SMB_NLS_REMOTE="cp437"
1314CONFIG_CIFS=y
1315# CONFIG_CIFS_STATS is not set
1316# CONFIG_CIFS_WEAK_PW_HASH is not set
1317# CONFIG_CIFS_XATTR is not set
1318# CONFIG_CIFS_DEBUG2 is not set
1319# CONFIG_CIFS_EXPERIMENTAL is not set
1190# CONFIG_NCP_FS is not set 1320# CONFIG_NCP_FS is not set
1191# CONFIG_CODA_FS is not set 1321# CONFIG_CODA_FS is not set
1192# CONFIG_AFS_FS is not set 1322# CONFIG_AFS_FS is not set
@@ -1195,13 +1325,68 @@ CONFIG_JFFS2_RTIME=y
1195# 1325#
1196# Partition Types 1326# Partition Types
1197# 1327#
1198# CONFIG_PARTITION_ADVANCED is not set 1328CONFIG_PARTITION_ADVANCED=y
1329# CONFIG_ACORN_PARTITION is not set
1330# CONFIG_OSF_PARTITION is not set
1331# CONFIG_AMIGA_PARTITION is not set
1332# CONFIG_ATARI_PARTITION is not set
1333# CONFIG_MAC_PARTITION is not set
1199CONFIG_MSDOS_PARTITION=y 1334CONFIG_MSDOS_PARTITION=y
1335# CONFIG_BSD_DISKLABEL is not set
1336# CONFIG_MINIX_SUBPARTITION is not set
1337# CONFIG_SOLARIS_X86_PARTITION is not set
1338# CONFIG_UNIXWARE_DISKLABEL is not set
1339# CONFIG_LDM_PARTITION is not set
1340# CONFIG_SGI_PARTITION is not set
1341# CONFIG_ULTRIX_PARTITION is not set
1342# CONFIG_SUN_PARTITION is not set
1343# CONFIG_KARMA_PARTITION is not set
1344# CONFIG_EFI_PARTITION is not set
1345# CONFIG_SYSV68_PARTITION is not set
1200 1346
1201# 1347#
1202# Native Language Support 1348# Native Language Support
1203# 1349#
1204# CONFIG_NLS is not set 1350CONFIG_NLS=y
1351CONFIG_NLS_DEFAULT="iso8859-1"
1352CONFIG_NLS_CODEPAGE_437=m
1353CONFIG_NLS_CODEPAGE_737=m
1354CONFIG_NLS_CODEPAGE_775=m
1355CONFIG_NLS_CODEPAGE_850=m
1356CONFIG_NLS_CODEPAGE_852=m
1357CONFIG_NLS_CODEPAGE_855=m
1358CONFIG_NLS_CODEPAGE_857=m
1359CONFIG_NLS_CODEPAGE_860=m
1360CONFIG_NLS_CODEPAGE_861=m
1361CONFIG_NLS_CODEPAGE_862=m
1362CONFIG_NLS_CODEPAGE_863=m
1363CONFIG_NLS_CODEPAGE_864=m
1364CONFIG_NLS_CODEPAGE_865=m
1365CONFIG_NLS_CODEPAGE_866=m
1366CONFIG_NLS_CODEPAGE_869=m
1367CONFIG_NLS_CODEPAGE_936=m
1368CONFIG_NLS_CODEPAGE_950=m
1369CONFIG_NLS_CODEPAGE_932=m
1370CONFIG_NLS_CODEPAGE_949=m
1371CONFIG_NLS_CODEPAGE_874=m
1372CONFIG_NLS_ISO8859_8=m
1373CONFIG_NLS_CODEPAGE_1250=m
1374CONFIG_NLS_CODEPAGE_1251=m
1375CONFIG_NLS_ASCII=m
1376CONFIG_NLS_ISO8859_1=m
1377CONFIG_NLS_ISO8859_2=m
1378CONFIG_NLS_ISO8859_3=m
1379CONFIG_NLS_ISO8859_4=m
1380CONFIG_NLS_ISO8859_5=m
1381CONFIG_NLS_ISO8859_6=m
1382CONFIG_NLS_ISO8859_7=m
1383CONFIG_NLS_ISO8859_9=m
1384CONFIG_NLS_ISO8859_13=m
1385CONFIG_NLS_ISO8859_14=m
1386CONFIG_NLS_ISO8859_15=m
1387CONFIG_NLS_KOI8_R=m
1388CONFIG_NLS_KOI8_U=m
1389CONFIG_NLS_UTF8=m
1205 1390
1206# 1391#
1207# Distributed Lock Manager 1392# Distributed Lock Manager
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index 85e647f87759..e9f100b45eb1 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -1,6 +1,6 @@
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.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122# CONFIG_BF533 is not set 122# CONFIG_BF533 is not set
@@ -125,10 +125,12 @@ CONFIG_PREEMPT_VOLUNTARY=y
125# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
130CONFIG_BF561=y 131CONFIG_BF561=y
131# CONFIG_BF_REV_0_0 is not set 132# CONFIG_BF_REV_0_0 is not set
133# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set 134# CONFIG_BF_REV_0_2 is not set
133CONFIG_BF_REV_0_3=y 135CONFIG_BF_REV_0_3=y
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -136,18 +138,15 @@ CONFIG_BF_REV_0_3=y
136# CONFIG_BF_REV_ANY is not set 138# CONFIG_BF_REV_ANY is not set
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BFIN_DUAL_CORE=y 140CONFIG_BFIN_DUAL_CORE=y
139# CONFIG_BFIN533_EZKIT is not set 141CONFIG_MEM_MT48LC16M16A2TG_75=y
140# CONFIG_BFIN533_STAMP is not set 142CONFIG_IRQ_PLL_WAKEUP=7
141# CONFIG_BFIN537_STAMP is not set 143CONFIG_IRQ_SPORT0_ERROR=7
142# CONFIG_BFIN533_BLUETECHNIX_CM is not set 144CONFIG_IRQ_SPORT1_ERROR=7
143# CONFIG_BFIN537_BLUETECHNIX_CM is not set 145CONFIG_IRQ_SPI_ERROR=7
144# CONFIG_BFIN548_EZKIT is not set
145# CONFIG_BFIN561_BLUETECHNIX_CM is not set
146CONFIG_BFIN561_EZKIT=y 146CONFIG_BFIN561_EZKIT=y
147# CONFIG_BFIN561_TEPLA is not set 147# CONFIG_BFIN561_TEPLA is not set
148# CONFIG_PNAV10 is not set 148# CONFIG_BFIN561_BLUETECHNIX_CM is not set
149# CONFIG_GENERIC_BOARD is not set 149# CONFIG_GENERIC_BF561_BOARD is not set
150CONFIG_MEM_MT48LC16M16A2TG_75=y
151 150
152# 151#
153# BF561 Specific Configuration 152# BF561 Specific Configuration
@@ -170,15 +169,11 @@ CONFIG_BF561_COREB_RESET=y
170# 169#
171# Priority 170# Priority
172# 171#
173CONFIG_IRQ_PLL_WAKEUP=7
174CONFIG_IRQ_DMA1_ERROR=7 172CONFIG_IRQ_DMA1_ERROR=7
175CONFIG_IRQ_DMA2_ERROR=7 173CONFIG_IRQ_DMA2_ERROR=7
176CONFIG_IRQ_IMDMA_ERROR=7 174CONFIG_IRQ_IMDMA_ERROR=7
177CONFIG_IRQ_PPI0_ERROR=7 175CONFIG_IRQ_PPI0_ERROR=7
178CONFIG_IRQ_PPI1_ERROR=7 176CONFIG_IRQ_PPI1_ERROR=7
179CONFIG_IRQ_SPORT0_ERROR=7
180CONFIG_IRQ_SPORT1_ERROR=7
181CONFIG_IRQ_SPI_ERROR=7
182CONFIG_IRQ_UART_ERROR=7 177CONFIG_IRQ_UART_ERROR=7
183CONFIG_IRQ_RESERVED_ERROR=7 178CONFIG_IRQ_RESERVED_ERROR=7
184CONFIG_IRQ_DMA1_0=8 179CONFIG_IRQ_DMA1_0=8
@@ -300,6 +295,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
300# CONFIG_RESOURCES_64BIT is not set 295# CONFIG_RESOURCES_64BIT is not set
301CONFIG_ZONE_DMA_FLAG=1 296CONFIG_ZONE_DMA_FLAG=1
302CONFIG_LARGE_ALLOCS=y 297CONFIG_LARGE_ALLOCS=y
298# CONFIG_BFIN_GPTIMERS is not set
303CONFIG_BFIN_DMA_5XX=y 299CONFIG_BFIN_DMA_5XX=y
304# CONFIG_DMA_UNCACHED_2M is not set 300# CONFIG_DMA_UNCACHED_2M is not set
305CONFIG_DMA_UNCACHED_1M=y 301CONFIG_DMA_UNCACHED_1M=y
@@ -321,7 +317,7 @@ CONFIG_L1_MAX_PIECE=16
321# 317#
322 318
323# 319#
324# EBIU_AMBCTL Global Control 320# EBIU_AMGCTL Global Control
325# 321#
326CONFIG_C_AMCKEN=y 322CONFIG_C_AMCKEN=y
327CONFIG_C_CDPRIO=y 323CONFIG_C_CDPRIO=y
@@ -564,14 +560,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
564CONFIG_MTD_BF5xx=m 560CONFIG_MTD_BF5xx=m
565CONFIG_BFIN_FLASH_SIZE=0x0400000 561CONFIG_BFIN_FLASH_SIZE=0x0400000
566CONFIG_EBIU_FLASH_BASE=0x20000000 562CONFIG_EBIU_FLASH_BASE=0x20000000
567
568#
569# FLASH_EBIU_AMBCTL Control
570#
571CONFIG_BFIN_FLASH_BANK_0=0x7BB0
572CONFIG_BFIN_FLASH_BANK_1=0x7BB0
573CONFIG_BFIN_FLASH_BANK_2=0x7BB0
574CONFIG_BFIN_FLASH_BANK_3=0x7BB0
575# CONFIG_MTD_UCLINUX is not set 563# CONFIG_MTD_UCLINUX is not set
576# CONFIG_MTD_PLATRAM is not set 564# CONFIG_MTD_PLATRAM is not set
577 565
@@ -660,6 +648,7 @@ CONFIG_SMC91X=y
660# CONFIG_DM9000 is not set 648# CONFIG_DM9000 is not set
661CONFIG_NETDEV_1000=y 649CONFIG_NETDEV_1000=y
662CONFIG_NETDEV_10000=y 650CONFIG_NETDEV_10000=y
651# CONFIG_AX88180 is not set
663 652
664# 653#
665# Wireless LAN 654# Wireless LAN
@@ -721,9 +710,9 @@ CONFIG_INPUT_EVDEV=m
721# 710#
722# CONFIG_AD9960 is not set 711# CONFIG_AD9960 is not set
723# CONFIG_SPI_ADC_BF533 is not set 712# CONFIG_SPI_ADC_BF533 is not set
724# CONFIG_BFIN_PFLAGS is not set 713# CONFIG_BF5xx_PFLAGS is not set
725# CONFIG_BF5xx_PPIFCD is not set 714# CONFIG_BF5xx_PPIFCD is not set
726# CONFIG_BF5xx_TIMERS is not set 715# CONFIG_BFIN_SIMPLE_TIMER is not set
727# CONFIG_BF5xx_PPI is not set 716# CONFIG_BF5xx_PPI is not set
728# CONFIG_BFIN_SPORT is not set 717# CONFIG_BFIN_SPORT is not set
729# CONFIG_BFIN_TIMER_LATENCY is not set 718# CONFIG_BFIN_TIMER_LATENCY is not set
diff --git a/arch/blackfin/configs/H8606_defconfig b/arch/blackfin/configs/H8606_defconfig
new file mode 100644
index 000000000000..18cbb8c3c373
--- /dev/null
+++ b/arch/blackfin/configs/H8606_defconfig
@@ -0,0 +1,1160 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12
4#
5# CONFIG_MMU is not set
6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y
16# CONFIG_GENERIC_TIME is not set
17CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21
22#
23# Code maturity level options
24#
25CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set
41# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set
46# CONFIG_BLK_DEV_INITRD is not set
47# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
48CONFIG_SYSCTL=y
49CONFIG_EMBEDDED=y
50CONFIG_UID16=y
51CONFIG_SYSCTL_SYSCALL=y
52CONFIG_KALLSYMS=y
53# CONFIG_KALLSYMS_EXTRA_PASS is not set
54CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y
56CONFIG_BUG=y
57CONFIG_ELF_CORE=y
58CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y
61CONFIG_EPOLL=y
62CONFIG_SIGNALFD=y
63CONFIG_EVENTFD=y
64CONFIG_VM_EVENT_COUNTERS=y
65CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
66# CONFIG_NP2 is not set
67CONFIG_SLAB=y
68# CONFIG_SLUB is not set
69# CONFIG_SLOB is not set
70CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0
73
74#
75# Loadable module support
76#
77CONFIG_MODULES=y
78CONFIG_MODULE_UNLOAD=y
79# CONFIG_MODULE_FORCE_UNLOAD is not set
80# CONFIG_MODVERSIONS is not set
81# CONFIG_MODULE_SRCVERSION_ALL is not set
82CONFIG_KMOD=y
83
84#
85# Block layer
86#
87CONFIG_BLOCK=y
88# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set
91
92#
93# IO Schedulers
94#
95CONFIG_IOSCHED_NOOP=y
96CONFIG_IOSCHED_AS=y
97# CONFIG_IOSCHED_DEADLINE is not set
98CONFIG_IOSCHED_CFQ=y
99CONFIG_DEFAULT_AS=y
100# CONFIG_DEFAULT_DEADLINE is not set
101# CONFIG_DEFAULT_CFQ is not set
102# CONFIG_DEFAULT_NOOP is not set
103CONFIG_DEFAULT_IOSCHED="anticipatory"
104CONFIG_PREEMPT_NONE=y
105# CONFIG_PREEMPT_VOLUNTARY is not set
106# CONFIG_PREEMPT is not set
107
108#
109# Blackfin Processor Options
110#
111
112#
113# Processor and Board Settings
114#
115# CONFIG_BF522 is not set
116# CONFIG_BF525 is not set
117# CONFIG_BF527 is not set
118# CONFIG_BF531 is not set
119CONFIG_BF532=y
120# CONFIG_BF533 is not set
121# CONFIG_BF534 is not set
122# CONFIG_BF536 is not set
123# CONFIG_BF537 is not set
124# CONFIG_BF542 is not set
125# CONFIG_BF544 is not set
126# CONFIG_BF547 is not set
127# CONFIG_BF548 is not set
128# CONFIG_BF549 is not set
129# CONFIG_BF561 is not set
130# CONFIG_BF_REV_0_0 is not set
131# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set
133# CONFIG_BF_REV_0_3 is not set
134# CONFIG_BF_REV_0_4 is not set
135CONFIG_BF_REV_0_5=y
136# CONFIG_BF_REV_ANY is not set
137# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y
140CONFIG_MEM_MT48LC16M16A2TG_75=y
141# CONFIG_BFIN533_EZKIT is not set
142# CONFIG_BFIN533_STAMP is not set
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144CONFIG_H8606_HVSISTEMAS=y
145# CONFIG_GENERIC_BF533_BOARD is not set
146
147#
148# BF533/2/1 Specific Configuration
149#
150
151#
152# Interrupt Priority Assignment
153#
154
155#
156# Priority
157#
158CONFIG_UART_ERROR=7
159CONFIG_SPORT0_ERROR=7
160CONFIG_SPI_ERROR=7
161CONFIG_SPORT1_ERROR=7
162CONFIG_PPI_ERROR=7
163CONFIG_DMA_ERROR=7
164CONFIG_PLLWAKE_ERROR=7
165CONFIG_RTC_ERROR=8
166CONFIG_DMA0_PPI=8
167CONFIG_DMA1_SPORT0RX=9
168CONFIG_DMA2_SPORT0TX=9
169CONFIG_DMA3_SPORT1RX=9
170CONFIG_DMA4_SPORT1TX=9
171CONFIG_DMA5_SPI=10
172CONFIG_DMA6_UARTRX=10
173CONFIG_DMA7_UARTTX=10
174CONFIG_TIMER0=11
175CONFIG_TIMER1=11
176CONFIG_TIMER2=11
177CONFIG_PFA=12
178CONFIG_PFB=12
179CONFIG_MEMDMA0=13
180CONFIG_MEMDMA1=13
181CONFIG_WDTIMER=13
182
183#
184# Board customizations
185#
186# CONFIG_CMDLINE_BOOL is not set
187
188#
189# Clock/PLL Setup
190#
191CONFIG_CLKIN_HZ=25000000
192# CONFIG_BFIN_KERNEL_CLOCK is not set
193CONFIG_MAX_VCO_HZ=400000000
194CONFIG_MIN_VCO_HZ=50000000
195CONFIG_MAX_SCLK_HZ=133000000
196CONFIG_MIN_SCLK_HZ=27000000
197
198#
199# Kernel Timer/Scheduler
200#
201# CONFIG_HZ_100 is not set
202CONFIG_HZ_250=y
203# CONFIG_HZ_300 is not set
204# CONFIG_HZ_1000 is not set
205CONFIG_HZ=250
206
207#
208# Memory Setup
209#
210CONFIG_MEM_SIZE=32
211CONFIG_MEM_ADD_WIDTH=9
212CONFIG_BOOT_LOAD=0x1000
213CONFIG_BFIN_SCRATCH_REG_RETN=y
214# CONFIG_BFIN_SCRATCH_REG_RETE is not set
215# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
216
217#
218# Blackfin Kernel Optimizations
219#
220
221#
222# Memory Optimizations
223#
224CONFIG_I_ENTRY_L1=y
225CONFIG_EXCPT_IRQ_SYSC_L1=y
226CONFIG_DO_IRQ_L1=y
227CONFIG_CORE_TIMER_IRQ_L1=y
228CONFIG_IDLE_L1=y
229CONFIG_SCHEDULE_L1=y
230CONFIG_ARITHMETIC_OPS_L1=y
231CONFIG_ACCESS_OK_L1=y
232CONFIG_MEMSET_L1=y
233CONFIG_MEMCPY_L1=y
234CONFIG_SYS_BFIN_SPINLOCK_L1=y
235# CONFIG_IP_CHECKSUM_L1 is not set
236# CONFIG_CACHELINE_ALIGNED_L1 is not set
237# CONFIG_SYSCALL_TAB_L1 is not set
238# CONFIG_CPLB_SWITCH_TAB_L1 is not set
239CONFIG_RAMKERNEL=y
240# CONFIG_ROMKERNEL is not set
241CONFIG_SELECT_MEMORY_MODEL=y
242CONFIG_FLATMEM_MANUAL=y
243# CONFIG_DISCONTIGMEM_MANUAL is not set
244# CONFIG_SPARSEMEM_MANUAL is not set
245CONFIG_FLATMEM=y
246CONFIG_FLAT_NODE_MEM_MAP=y
247# CONFIG_SPARSEMEM_STATIC is not set
248CONFIG_SPLIT_PTLOCK_CPUS=4
249# CONFIG_RESOURCES_64BIT is not set
250CONFIG_ZONE_DMA_FLAG=1
251CONFIG_LARGE_ALLOCS=y
252CONFIG_BFIN_GPTIMERS=y
253CONFIG_BFIN_DMA_5XX=y
254# CONFIG_DMA_UNCACHED_2M is not set
255CONFIG_DMA_UNCACHED_1M=y
256# CONFIG_DMA_UNCACHED_NONE is not set
257
258#
259# Cache Support
260#
261CONFIG_BFIN_ICACHE=y
262CONFIG_BFIN_DCACHE=y
263# CONFIG_BFIN_DCACHE_BANKA is not set
264CONFIG_BFIN_ICACHE_LOCK=y
265CONFIG_BFIN_WB=y
266# CONFIG_BFIN_WT is not set
267CONFIG_L1_MAX_PIECE=16
268
269#
270# Asynchonous Memory Configuration
271#
272
273#
274# EBIU_AMGCTL Global Control
275#
276CONFIG_C_AMCKEN=y
277CONFIG_C_CDPRIO=y
278# CONFIG_C_AMBEN is not set
279# CONFIG_C_AMBEN_B0 is not set
280# CONFIG_C_AMBEN_B0_B1 is not set
281# CONFIG_C_AMBEN_B0_B1_B2 is not set
282CONFIG_C_AMBEN_ALL=y
283
284#
285# EBIU_AMBCTL Control
286#
287CONFIG_BANK_0=0x7BB0
288CONFIG_BANK_1=0x7BB0
289CONFIG_BANK_2=0x7BB0
290CONFIG_BANK_3=0x99B3
291
292#
293# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
294#
295# CONFIG_PCI is not set
296# CONFIG_ARCH_SUPPORTS_MSI is not set
297
298#
299# PCCARD (PCMCIA/CardBus) support
300#
301# CONFIG_PCCARD is not set
302
303#
304# Executable file formats
305#
306CONFIG_BINFMT_ELF_FDPIC=y
307CONFIG_BINFMT_FLAT=y
308CONFIG_BINFMT_ZFLAT=y
309# CONFIG_BINFMT_SHARED_FLAT is not set
310# CONFIG_BINFMT_MISC is not set
311
312#
313# Power management options
314#
315CONFIG_PM=y
316CONFIG_PM_LEGACY=y
317# CONFIG_PM_DEBUG is not set
318# CONFIG_PM_SYSFS_DEPRECATED is not set
319CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
320# CONFIG_PM_WAKEUP_BY_GPIO is not set
321# CONFIG_PM_WAKEUP_GPIO_API is not set
322CONFIG_PM_WAKEUP_SIC_IWR=0x100000
323
324#
325# Networking
326#
327CONFIG_NET=y
328
329#
330# Networking options
331#
332CONFIG_PACKET=y
333# CONFIG_PACKET_MMAP is not set
334CONFIG_UNIX=y
335CONFIG_XFRM=y
336# CONFIG_XFRM_USER is not set
337# CONFIG_XFRM_SUB_POLICY is not set
338# CONFIG_XFRM_MIGRATE is not set
339# CONFIG_NET_KEY is not set
340CONFIG_INET=y
341# CONFIG_IP_MULTICAST is not set
342# CONFIG_IP_ADVANCED_ROUTER is not set
343CONFIG_IP_FIB_HASH=y
344CONFIG_IP_PNP=y
345# CONFIG_IP_PNP_DHCP is not set
346# CONFIG_IP_PNP_BOOTP is not set
347# CONFIG_IP_PNP_RARP is not set
348# CONFIG_NET_IPIP is not set
349# CONFIG_NET_IPGRE is not set
350# CONFIG_ARPD is not set
351CONFIG_SYN_COOKIES=y
352# CONFIG_INET_AH is not set
353# CONFIG_INET_ESP is not set
354# CONFIG_INET_IPCOMP is not set
355# CONFIG_INET_XFRM_TUNNEL is not set
356# CONFIG_INET_TUNNEL is not set
357CONFIG_INET_XFRM_MODE_TRANSPORT=y
358CONFIG_INET_XFRM_MODE_TUNNEL=y
359CONFIG_INET_XFRM_MODE_BEET=y
360CONFIG_INET_DIAG=y
361CONFIG_INET_TCP_DIAG=y
362# CONFIG_TCP_CONG_ADVANCED is not set
363CONFIG_TCP_CONG_CUBIC=y
364CONFIG_DEFAULT_TCP_CONG="cubic"
365# CONFIG_TCP_MD5SIG is not set
366# CONFIG_IPV6 is not set
367# CONFIG_INET6_XFRM_TUNNEL is not set
368# CONFIG_INET6_TUNNEL is not set
369# CONFIG_NETLABEL is not set
370# CONFIG_NETWORK_SECMARK is not set
371# CONFIG_NETFILTER is not set
372# CONFIG_IP_DCCP is not set
373# CONFIG_IP_SCTP is not set
374# CONFIG_TIPC is not set
375# CONFIG_ATM is not set
376# CONFIG_BRIDGE is not set
377# CONFIG_VLAN_8021Q is not set
378# CONFIG_DECNET is not set
379# CONFIG_LLC2 is not set
380# CONFIG_IPX is not set
381# CONFIG_ATALK is not set
382# CONFIG_X25 is not set
383# CONFIG_LAPB is not set
384# CONFIG_ECONET is not set
385# CONFIG_WAN_ROUTER is not set
386
387#
388# QoS and/or fair queueing
389#
390# CONFIG_NET_SCHED is not set
391
392#
393# Network testing
394#
395# CONFIG_NET_PKTGEN is not set
396# CONFIG_HAMRADIO is not set
397CONFIG_IRDA=m
398
399#
400# IrDA protocols
401#
402CONFIG_IRLAN=m
403CONFIG_IRCOMM=m
404# CONFIG_IRDA_ULTRA is not set
405
406#
407# IrDA options
408#
409CONFIG_IRDA_CACHE_LAST_LSAP=y
410# CONFIG_IRDA_FAST_RR is not set
411# CONFIG_IRDA_DEBUG is not set
412
413#
414# Infrared-port device drivers
415#
416
417#
418# SIR device drivers
419#
420CONFIG_IRTTY_SIR=m
421
422#
423# Dongle support
424#
425# CONFIG_DONGLE is not set
426
427#
428# Old SIR device drivers
429#
430# CONFIG_IRPORT_SIR is not set
431
432#
433# Old Serial dongle support
434#
435
436#
437# FIR device drivers
438#
439# CONFIG_BT is not set
440# CONFIG_AF_RXRPC is not set
441
442#
443# Wireless
444#
445# CONFIG_CFG80211 is not set
446# CONFIG_WIRELESS_EXT is not set
447# CONFIG_MAC80211 is not set
448# CONFIG_IEEE80211 is not set
449# CONFIG_RFKILL is not set
450
451#
452# Device Drivers
453#
454
455#
456# Generic Driver Options
457#
458CONFIG_STANDALONE=y
459CONFIG_PREVENT_FIRMWARE_BUILD=y
460# CONFIG_FW_LOADER is not set
461# CONFIG_SYS_HYPERVISOR is not set
462
463#
464# Connector - unified userspace <-> kernelspace linker
465#
466# CONFIG_CONNECTOR is not set
467CONFIG_MTD=y
468# CONFIG_MTD_DEBUG is not set
469# CONFIG_MTD_CONCAT is not set
470CONFIG_MTD_PARTITIONS=y
471# CONFIG_MTD_REDBOOT_PARTS is not set
472# CONFIG_MTD_CMDLINE_PARTS is not set
473
474#
475# User Modules And Translation Layers
476#
477CONFIG_MTD_CHAR=y
478CONFIG_MTD_BLKDEVS=y
479CONFIG_MTD_BLOCK=y
480# CONFIG_FTL is not set
481# CONFIG_NFTL is not set
482# CONFIG_INFTL is not set
483# CONFIG_RFD_FTL is not set
484# CONFIG_SSFDC is not set
485
486#
487# RAM/ROM/Flash chip drivers
488#
489# CONFIG_MTD_CFI is not set
490# CONFIG_MTD_JEDECPROBE is not set
491CONFIG_MTD_MAP_BANK_WIDTH_1=y
492CONFIG_MTD_MAP_BANK_WIDTH_2=y
493CONFIG_MTD_MAP_BANK_WIDTH_4=y
494# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
495# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
496# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
497CONFIG_MTD_CFI_I1=y
498CONFIG_MTD_CFI_I2=y
499# CONFIG_MTD_CFI_I4 is not set
500# CONFIG_MTD_CFI_I8 is not set
501CONFIG_MTD_RAM=y
502CONFIG_MTD_ROM=y
503# CONFIG_MTD_ABSENT is not set
504
505#
506# Mapping drivers for chip access
507#
508CONFIG_MTD_COMPLEX_MAPPINGS=y
509# CONFIG_MTD_PHYSMAP is not set
510# CONFIG_MTD_BF5xx is not set
511# CONFIG_MTD_UCLINUX is not set
512# CONFIG_MTD_PLATRAM is not set
513
514#
515# Self-contained MTD device drivers
516#
517# CONFIG_MTD_DATAFLASH is not set
518CONFIG_MTD_M25P80=y
519CONFIG_M25PXX_USE_FAST_READ=y
520# CONFIG_MTD_SLRAM is not set
521# CONFIG_MTD_PHRAM is not set
522# CONFIG_MTD_MTDRAM is not set
523# CONFIG_MTD_BLOCK2MTD is not set
524
525#
526# Disk-On-Chip Device Drivers
527#
528# CONFIG_MTD_DOC2000 is not set
529# CONFIG_MTD_DOC2001 is not set
530# CONFIG_MTD_DOC2001PLUS is not set
531# CONFIG_MTD_NAND is not set
532# CONFIG_MTD_ONENAND is not set
533
534#
535# UBI - Unsorted block images
536#
537# CONFIG_MTD_UBI is not set
538
539#
540# Parallel port support
541#
542# CONFIG_PARPORT is not set
543
544#
545# Plug and Play support
546#
547# CONFIG_PNPACPI is not set
548
549#
550# Block devices
551#
552# CONFIG_BLK_DEV_COW_COMMON is not set
553# CONFIG_BLK_DEV_LOOP is not set
554# CONFIG_BLK_DEV_NBD is not set
555CONFIG_BLK_DEV_RAM=y
556CONFIG_BLK_DEV_RAM_COUNT=16
557CONFIG_BLK_DEV_RAM_SIZE=4096
558CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
559# CONFIG_CDROM_PKTCDVD is not set
560# CONFIG_ATA_OVER_ETH is not set
561
562#
563# Misc devices
564#
565# CONFIG_IDE is not set
566
567#
568# SCSI device support
569#
570# CONFIG_RAID_ATTRS is not set
571# CONFIG_SCSI is not set
572# CONFIG_SCSI_NETLINK is not set
573# CONFIG_ATA is not set
574
575#
576# Multi-device support (RAID and LVM)
577#
578# CONFIG_MD is not set
579
580#
581# Network device support
582#
583CONFIG_NETDEVICES=y
584# CONFIG_DUMMY is not set
585# CONFIG_BONDING is not set
586# CONFIG_EQUALIZER is not set
587# CONFIG_TUN is not set
588# CONFIG_PHYLIB is not set
589
590#
591# Ethernet (10 or 100Mbit)
592#
593CONFIG_NET_ETHERNET=y
594CONFIG_MII=y
595# CONFIG_SMC91X is not set
596# CONFIG_SMSC911X is not set
597CONFIG_DM9000=y
598CONFIG_NETDEV_1000=y
599CONFIG_NETDEV_10000=y
600# CONFIG_AX88180 is not set
601
602#
603# Wireless LAN
604#
605# CONFIG_WLAN_PRE80211 is not set
606# CONFIG_WLAN_80211 is not set
607# CONFIG_WAN is not set
608# CONFIG_PPP is not set
609# CONFIG_SLIP is not set
610# CONFIG_SHAPER is not set
611# CONFIG_NETCONSOLE is not set
612# CONFIG_NETPOLL is not set
613# CONFIG_NET_POLL_CONTROLLER is not set
614
615#
616# ISDN subsystem
617#
618# CONFIG_ISDN is not set
619
620#
621# Telephony Support
622#
623# CONFIG_PHONE is not set
624
625#
626# Input device support
627#
628CONFIG_INPUT=y
629# CONFIG_INPUT_FF_MEMLESS is not set
630# CONFIG_INPUT_POLLDEV is not set
631
632#
633# Userland interfaces
634#
635# CONFIG_INPUT_MOUSEDEV is not set
636# CONFIG_INPUT_JOYDEV is not set
637# CONFIG_INPUT_TSDEV is not set
638CONFIG_INPUT_EVDEV=m
639# CONFIG_INPUT_EVBUG is not set
640
641#
642# Input Device Drivers
643#
644# CONFIG_INPUT_KEYBOARD is not set
645# CONFIG_INPUT_MOUSE is not set
646# CONFIG_INPUT_JOYSTICK is not set
647# CONFIG_INPUT_TABLET is not set
648# CONFIG_INPUT_TOUCHSCREEN is not set
649CONFIG_INPUT_MISC=y
650# CONFIG_INPUT_ATI_REMOTE is not set
651# CONFIG_INPUT_ATI_REMOTE2 is not set
652# CONFIG_INPUT_KEYSPAN_REMOTE is not set
653# CONFIG_INPUT_POWERMATE is not set
654# CONFIG_INPUT_YEALINK is not set
655# CONFIG_INPUT_UINPUT is not set
656# CONFIG_BF53X_PFBUTTONS is not set
657
658#
659# Hardware I/O ports
660#
661# CONFIG_SERIO is not set
662# CONFIG_GAMEPORT is not set
663
664#
665# Character devices
666#
667# CONFIG_AD9960 is not set
668# CONFIG_SPI_ADC_BF533 is not set
669CONFIG_BF5xx_PFLAGS=y
670# CONFIG_BF5xx_PFLAGS_PROC is not set
671# CONFIG_BF5xx_PPIFCD is not set
672CONFIG_BFIN_SIMPLE_TIMER=y
673# CONFIG_BF5xx_PPI is not set
674CONFIG_BFIN_SPORT=y
675CONFIG_BFIN_TIMER_LATENCY=y
676# CONFIG_AD5304 is not set
677# CONFIG_BF5xx_FBDMA is not set
678# CONFIG_VT is not set
679# CONFIG_SERIAL_NONSTANDARD is not set
680
681#
682# Serial drivers
683#
684# CONFIG_SERIAL_8250 is not set
685
686#
687# Non-8250 serial port support
688#
689CONFIG_SERIAL_BFIN=y
690CONFIG_SERIAL_BFIN_CONSOLE=y
691CONFIG_SERIAL_BFIN_DMA=y
692# CONFIG_SERIAL_BFIN_PIO is not set
693CONFIG_SERIAL_BFIN_UART0=y
694# CONFIG_BFIN_UART0_CTSRTS is not set
695# CONFIG_SERIAL_BFIN_UART1 is not set
696CONFIG_SERIAL_CORE=y
697CONFIG_SERIAL_CORE_CONSOLE=y
698# CONFIG_SERIAL_BFIN_SPORT is not set
699CONFIG_UNIX98_PTYS=y
700# CONFIG_LEGACY_PTYS is not set
701
702#
703# CAN, the car bus and industrial fieldbus
704#
705# CONFIG_CAN4LINUX is not set
706
707#
708# IPMI
709#
710# CONFIG_IPMI_HANDLER is not set
711CONFIG_WATCHDOG=y
712# CONFIG_WATCHDOG_NOWAYOUT is not set
713
714#
715# Watchdog Device Drivers
716#
717# CONFIG_SOFT_WATCHDOG is not set
718# CONFIG_BFIN_WDT is not set
719# CONFIG_HW_RANDOM is not set
720# CONFIG_GEN_RTC is not set
721CONFIG_BLACKFIN_DPMC=y
722# CONFIG_R3964 is not set
723# CONFIG_RAW_DRIVER is not set
724
725#
726# TPM devices
727#
728# CONFIG_TCG_TPM is not set
729# CONFIG_I2C is not set
730
731#
732# SPI support
733#
734CONFIG_SPI=y
735CONFIG_SPI_MASTER=y
736
737#
738# SPI Master Controller Drivers
739#
740CONFIG_SPI_BFIN=y
741# CONFIG_SPI_BITBANG is not set
742
743#
744# SPI Protocol Masters
745#
746CONFIG_SPI_AT25=y
747CONFIG_SPI_SPIDEV=y
748
749#
750# Dallas's 1-wire bus
751#
752# CONFIG_W1 is not set
753CONFIG_HWMON=y
754# CONFIG_HWMON_VID is not set
755# CONFIG_SENSORS_ABITUGURU is not set
756# CONFIG_SENSORS_F71805F is not set
757# CONFIG_SENSORS_LM70 is not set
758# CONFIG_SENSORS_PC87427 is not set
759# CONFIG_SENSORS_SMSC47M1 is not set
760# CONFIG_SENSORS_SMSC47B397 is not set
761# CONFIG_SENSORS_VT1211 is not set
762# CONFIG_SENSORS_W83627HF is not set
763# CONFIG_HWMON_DEBUG_CHIP is not set
764
765#
766# Multifunction device drivers
767#
768# CONFIG_MFD_SM501 is not set
769
770#
771# Multimedia devices
772#
773# CONFIG_VIDEO_DEV is not set
774# CONFIG_DVB_CORE is not set
775CONFIG_DAB=y
776
777#
778# Graphics support
779#
780# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
781
782#
783# Display device support
784#
785# CONFIG_DISPLAY_SUPPORT is not set
786# CONFIG_VGASTATE is not set
787# CONFIG_FB is not set
788
789#
790# Sound
791#
792CONFIG_SOUND=m
793
794#
795# Advanced Linux Sound Architecture
796#
797CONFIG_SND=m
798CONFIG_SND_TIMER=m
799CONFIG_SND_PCM=m
800# CONFIG_SND_SEQUENCER is not set
801CONFIG_SND_OSSEMUL=y
802CONFIG_SND_MIXER_OSS=m
803CONFIG_SND_PCM_OSS=m
804CONFIG_SND_PCM_OSS_PLUGINS=y
805# CONFIG_SND_DYNAMIC_MINORS is not set
806CONFIG_SND_SUPPORT_OLD_API=y
807CONFIG_SND_VERBOSE_PROCFS=y
808# CONFIG_SND_VERBOSE_PRINTK is not set
809# CONFIG_SND_DEBUG is not set
810
811#
812# Generic devices
813#
814# CONFIG_SND_DUMMY is not set
815# CONFIG_SND_MTPAV is not set
816# CONFIG_SND_SERIAL_U16550 is not set
817# CONFIG_SND_MPU401 is not set
818
819#
820# ALSA Blackfin devices
821#
822CONFIG_SND_BLACKFIN_AD1836=m
823CONFIG_SND_BLACKFIN_AD1836_TDM=y
824# CONFIG_SND_BLACKFIN_AD1836_I2S is not set
825CONFIG_SND_BLACKFIN_AD1836_MULSUB=y
826# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set
827CONFIG_SND_BLACKFIN_SPORT=0
828CONFIG_SND_BLACKFIN_SPI_PFBIT=4
829# CONFIG_SND_BFIN_AD73311 is not set
830
831#
832# System on Chip audio support
833#
834# CONFIG_SND_SOC is not set
835
836#
837# Open Sound System
838#
839# CONFIG_SOUND_PRIME is not set
840
841#
842# HID Devices
843#
844CONFIG_HID=y
845# CONFIG_HID_DEBUG is not set
846
847#
848# USB support
849#
850CONFIG_USB_ARCH_HAS_HCD=y
851# CONFIG_USB_ARCH_HAS_OHCI is not set
852# CONFIG_USB_ARCH_HAS_EHCI is not set
853# CONFIG_USB is not set
854
855#
856# Enable Host or Gadget support to see Inventra options
857#
858
859#
860# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
861#
862
863#
864# USB Gadget Support
865#
866# CONFIG_USB_GADGET is not set
867# CONFIG_MMC is not set
868
869#
870# LED devices
871#
872# CONFIG_NEW_LEDS is not set
873
874#
875# LED drivers
876#
877
878#
879# LED Triggers
880#
881
882#
883# InfiniBand support
884#
885
886#
887# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
888#
889
890#
891# Real Time Clock
892#
893CONFIG_RTC_LIB=y
894CONFIG_RTC_CLASS=y
895CONFIG_RTC_HCTOSYS=y
896CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
897# CONFIG_RTC_DEBUG is not set
898
899#
900# RTC interfaces
901#
902CONFIG_RTC_INTF_SYSFS=y
903CONFIG_RTC_INTF_PROC=y
904CONFIG_RTC_INTF_DEV=y
905CONFIG_RTC_INTF_DEV_UIE_EMUL=y
906# CONFIG_RTC_DRV_TEST is not set
907
908#
909# I2C RTC drivers
910#
911
912#
913# SPI RTC drivers
914#
915# CONFIG_RTC_DRV_RS5C348 is not set
916# CONFIG_RTC_DRV_MAX6902 is not set
917
918#
919# Platform RTC drivers
920#
921# CONFIG_RTC_DRV_DS1553 is not set
922# CONFIG_RTC_DRV_DS1742 is not set
923# CONFIG_RTC_DRV_M48T86 is not set
924# CONFIG_RTC_DRV_V3020 is not set
925
926#
927# on-CPU RTC drivers
928#
929CONFIG_RTC_DRV_BFIN=y
930
931#
932# DMA Engine support
933#
934# CONFIG_DMA_ENGINE is not set
935
936#
937# DMA Clients
938#
939
940#
941# DMA Devices
942#
943
944#
945# PBX support
946#
947# CONFIG_PBX is not set
948
949#
950# File systems
951#
952CONFIG_EXT2_FS=y
953CONFIG_EXT2_FS_XATTR=y
954# CONFIG_EXT2_FS_POSIX_ACL is not set
955# CONFIG_EXT2_FS_SECURITY is not set
956# CONFIG_EXT3_FS is not set
957# CONFIG_EXT4DEV_FS is not set
958CONFIG_FS_MBCACHE=y
959# CONFIG_REISERFS_FS is not set
960# CONFIG_JFS_FS is not set
961# CONFIG_FS_POSIX_ACL is not set
962# CONFIG_XFS_FS is not set
963# CONFIG_GFS2_FS is not set
964# CONFIG_OCFS2_FS is not set
965# CONFIG_MINIX_FS is not set
966# CONFIG_ROMFS_FS is not set
967CONFIG_INOTIFY=y
968CONFIG_INOTIFY_USER=y
969# CONFIG_QUOTA is not set
970CONFIG_DNOTIFY=y
971# CONFIG_AUTOFS_FS is not set
972# CONFIG_AUTOFS4_FS is not set
973# CONFIG_FUSE_FS is not set
974
975#
976# CD-ROM/DVD Filesystems
977#
978# CONFIG_ISO9660_FS is not set
979# CONFIG_UDF_FS is not set
980
981#
982# DOS/FAT/NT Filesystems
983#
984# CONFIG_MSDOS_FS is not set
985# CONFIG_VFAT_FS is not set
986# CONFIG_NTFS_FS is not set
987
988#
989# Pseudo filesystems
990#
991CONFIG_PROC_FS=y
992CONFIG_PROC_SYSCTL=y
993CONFIG_SYSFS=y
994# CONFIG_TMPFS is not set
995# CONFIG_HUGETLB_PAGE is not set
996CONFIG_RAMFS=y
997# CONFIG_CONFIGFS_FS is not set
998
999#
1000# Miscellaneous filesystems
1001#
1002# CONFIG_ADFS_FS is not set
1003# CONFIG_AFFS_FS is not set
1004# CONFIG_HFS_FS is not set
1005# CONFIG_HFSPLUS_FS is not set
1006# CONFIG_BEFS_FS is not set
1007# CONFIG_BFS_FS is not set
1008# CONFIG_EFS_FS is not set
1009# CONFIG_YAFFS_FS is not set
1010CONFIG_JFFS2_FS=y
1011CONFIG_JFFS2_FS_DEBUG=0
1012CONFIG_JFFS2_FS_WRITEBUFFER=y
1013# CONFIG_JFFS2_SUMMARY is not set
1014# CONFIG_JFFS2_FS_XATTR is not set
1015# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1016CONFIG_JFFS2_ZLIB=y
1017CONFIG_JFFS2_RTIME=y
1018# CONFIG_JFFS2_RUBIN is not set
1019# CONFIG_CRAMFS is not set
1020# CONFIG_VXFS_FS is not set
1021# CONFIG_HPFS_FS is not set
1022# CONFIG_QNX4FS_FS is not set
1023# CONFIG_SYSV_FS is not set
1024# CONFIG_UFS_FS is not set
1025
1026#
1027# Network File Systems
1028#
1029CONFIG_NFS_FS=m
1030CONFIG_NFS_V3=y
1031# CONFIG_NFS_V3_ACL is not set
1032# CONFIG_NFS_V4 is not set
1033# CONFIG_NFS_DIRECTIO is not set
1034# CONFIG_NFSD is not set
1035CONFIG_LOCKD=m
1036CONFIG_LOCKD_V4=y
1037CONFIG_NFS_COMMON=y
1038CONFIG_SUNRPC=m
1039# CONFIG_SUNRPC_BIND34 is not set
1040# CONFIG_RPCSEC_GSS_KRB5 is not set
1041# CONFIG_RPCSEC_GSS_SPKM3 is not set
1042# CONFIG_SMB_FS is not set
1043# CONFIG_CIFS is not set
1044# CONFIG_NCP_FS is not set
1045# CONFIG_CODA_FS is not set
1046# CONFIG_AFS_FS is not set
1047# CONFIG_9P_FS is not set
1048
1049#
1050# Partition Types
1051#
1052# CONFIG_PARTITION_ADVANCED is not set
1053CONFIG_MSDOS_PARTITION=y
1054
1055#
1056# Native Language Support
1057#
1058CONFIG_NLS=m
1059CONFIG_NLS_DEFAULT="iso8859-1"
1060# CONFIG_NLS_CODEPAGE_437 is not set
1061# CONFIG_NLS_CODEPAGE_737 is not set
1062# CONFIG_NLS_CODEPAGE_775 is not set
1063# CONFIG_NLS_CODEPAGE_850 is not set
1064# CONFIG_NLS_CODEPAGE_852 is not set
1065# CONFIG_NLS_CODEPAGE_855 is not set
1066# CONFIG_NLS_CODEPAGE_857 is not set
1067# CONFIG_NLS_CODEPAGE_860 is not set
1068# CONFIG_NLS_CODEPAGE_861 is not set
1069# CONFIG_NLS_CODEPAGE_862 is not set
1070# CONFIG_NLS_CODEPAGE_863 is not set
1071# CONFIG_NLS_CODEPAGE_864 is not set
1072# CONFIG_NLS_CODEPAGE_865 is not set
1073# CONFIG_NLS_CODEPAGE_866 is not set
1074# CONFIG_NLS_CODEPAGE_869 is not set
1075# CONFIG_NLS_CODEPAGE_936 is not set
1076# CONFIG_NLS_CODEPAGE_950 is not set
1077# CONFIG_NLS_CODEPAGE_932 is not set
1078# CONFIG_NLS_CODEPAGE_949 is not set
1079# CONFIG_NLS_CODEPAGE_874 is not set
1080# CONFIG_NLS_ISO8859_8 is not set
1081# CONFIG_NLS_CODEPAGE_1250 is not set
1082# CONFIG_NLS_CODEPAGE_1251 is not set
1083# CONFIG_NLS_ASCII is not set
1084# CONFIG_NLS_ISO8859_1 is not set
1085# CONFIG_NLS_ISO8859_2 is not set
1086# CONFIG_NLS_ISO8859_3 is not set
1087# CONFIG_NLS_ISO8859_4 is not set
1088# CONFIG_NLS_ISO8859_5 is not set
1089# CONFIG_NLS_ISO8859_6 is not set
1090# CONFIG_NLS_ISO8859_7 is not set
1091# CONFIG_NLS_ISO8859_9 is not set
1092# CONFIG_NLS_ISO8859_13 is not set
1093# CONFIG_NLS_ISO8859_14 is not set
1094# CONFIG_NLS_ISO8859_15 is not set
1095# CONFIG_NLS_KOI8_R is not set
1096# CONFIG_NLS_KOI8_U is not set
1097# CONFIG_NLS_UTF8 is not set
1098
1099#
1100# Distributed Lock Manager
1101#
1102# CONFIG_DLM is not set
1103
1104#
1105# Profiling support
1106#
1107# CONFIG_PROFILING is not set
1108
1109#
1110# Kernel hacking
1111#
1112# CONFIG_PRINTK_TIME is not set
1113CONFIG_ENABLE_MUST_CHECK=y
1114# CONFIG_MAGIC_SYSRQ is not set
1115# CONFIG_UNUSED_SYMBOLS is not set
1116# CONFIG_DEBUG_FS is not set
1117# CONFIG_HEADERS_CHECK is not set
1118# CONFIG_DEBUG_KERNEL is not set
1119# CONFIG_DEBUG_BUGVERBOSE is not set
1120# CONFIG_DEBUG_MMRS is not set
1121CONFIG_DEBUG_HUNT_FOR_ZERO=y
1122CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1123CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
1124# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set
1125# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_TWO is not set
1126CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
1127# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
1128# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1129# CONFIG_EARLY_PRINTK is not set
1130CONFIG_CPLB_INFO=y
1131CONFIG_ACCESS_CHECK=y
1132
1133#
1134# Security options
1135#
1136# CONFIG_KEYS is not set
1137CONFIG_SECURITY=y
1138# CONFIG_SECURITY_NETWORK is not set
1139CONFIG_SECURITY_CAPABILITIES=y
1140
1141#
1142# Cryptographic options
1143#
1144# CONFIG_CRYPTO is not set
1145
1146#
1147# Library routines
1148#
1149CONFIG_BITREVERSE=y
1150CONFIG_CRC_CCITT=m
1151# CONFIG_CRC16 is not set
1152# CONFIG_CRC_ITU_T is not set
1153CONFIG_CRC32=y
1154# CONFIG_LIBCRC32C is not set
1155CONFIG_ZLIB_INFLATE=y
1156CONFIG_ZLIB_DEFLATE=y
1157CONFIG_PLIST=y
1158CONFIG_HAS_IOMEM=y
1159CONFIG_HAS_IOPORT=y
1160CONFIG_HAS_DMA=y
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index 15e36aaf2186..25709f504d8f 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -1,6 +1,6 @@
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.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -62,7 +60,6 @@ CONFIG_FUTEX=y
62CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
63CONFIG_EPOLL=y 61CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
65CONFIG_TIMERFD=y
66CONFIG_EVENTFD=y 63CONFIG_EVENTFD=y
67CONFIG_VM_EVENT_COUNTERS=y 64CONFIG_VM_EVENT_COUNTERS=y
68CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=9 65CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=9
@@ -115,6 +112,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# 112#
116# Processor and Board Settings 113# Processor and Board Settings
117# 114#
115# CONFIG_BF522 is not set
116# CONFIG_BF525 is not set
117# CONFIG_BF527 is not set
118# CONFIG_BF531 is not set 118# CONFIG_BF531 is not set
119# CONFIG_BF532 is not set 119# CONFIG_BF532 is not set
120# CONFIG_BF533 is not set 120# CONFIG_BF533 is not set
@@ -123,10 +123,12 @@ CONFIG_PREEMPT_VOLUNTARY=y
123CONFIG_BF537=y 123CONFIG_BF537=y
124# CONFIG_BF542 is not set 124# CONFIG_BF542 is not set
125# CONFIG_BF544 is not set 125# CONFIG_BF544 is not set
126# CONFIG_BF547 is not set
126# CONFIG_BF548 is not set 127# CONFIG_BF548 is not set
127# CONFIG_BF549 is not set 128# CONFIG_BF549 is not set
128# CONFIG_BF561 is not set 129# CONFIG_BF561 is not set
129# CONFIG_BF_REV_0_0 is not set 130# CONFIG_BF_REV_0_0 is not set
131# CONFIG_BF_REV_0_1 is not set
130CONFIG_BF_REV_0_2=y 132CONFIG_BF_REV_0_2=y
131# CONFIG_BF_REV_0_3 is not set 133# CONFIG_BF_REV_0_3 is not set
132# CONFIG_BF_REV_0_4 is not set 134# CONFIG_BF_REV_0_4 is not set
@@ -135,33 +137,8 @@ CONFIG_BF_REV_0_2=y
135# CONFIG_BF_REV_NONE is not set 137# CONFIG_BF_REV_NONE is not set
136CONFIG_BF53x=y 138CONFIG_BF53x=y
137CONFIG_BFIN_SINGLE_CORE=y 139CONFIG_BFIN_SINGLE_CORE=y
138# CONFIG_BFIN533_EZKIT is not set
139# CONFIG_BFIN533_STAMP is not set
140# CONFIG_BFIN537_STAMP is not set
141# CONFIG_BFIN533_BLUETECHNIX_CM is not set
142# CONFIG_BFIN537_BLUETECHNIX_CM is not set
143# CONFIG_BFIN548_EZKIT is not set
144# CONFIG_BFIN561_BLUETECHNIX_CM is not set
145# CONFIG_BFIN561_EZKIT is not set
146# CONFIG_BFIN561_TEPLA is not set
147CONFIG_PNAV10=y
148# CONFIG_GENERIC_BOARD is not set
149CONFIG_MEM_MT48LC32M8A2_75=y 140CONFIG_MEM_MT48LC32M8A2_75=y
150CONFIG_IRQ_PLL_WAKEUP=7 141CONFIG_IRQ_PLL_WAKEUP=7
151
152#
153# BF537 Specific Configuration
154#
155
156#
157# Interrupt Priority Assignment
158#
159
160#
161# Priority
162#
163CONFIG_IRQ_DMA_ERROR=7
164CONFIG_IRQ_ERROR=7
165CONFIG_IRQ_RTC=8 142CONFIG_IRQ_RTC=8
166CONFIG_IRQ_PPI=8 143CONFIG_IRQ_PPI=8
167CONFIG_IRQ_SPORT0_RX=9 144CONFIG_IRQ_SPORT0_RX=9
@@ -174,8 +151,6 @@ CONFIG_IRQ_UART0_RX=10
174CONFIG_IRQ_UART0_TX=10 151CONFIG_IRQ_UART0_TX=10
175CONFIG_IRQ_UART1_RX=10 152CONFIG_IRQ_UART1_RX=10
176CONFIG_IRQ_UART1_TX=10 153CONFIG_IRQ_UART1_TX=10
177CONFIG_IRQ_CAN_RX=11
178CONFIG_IRQ_CAN_TX=11
179CONFIG_IRQ_MAC_RX=11 154CONFIG_IRQ_MAC_RX=11
180CONFIG_IRQ_MAC_TX=11 155CONFIG_IRQ_MAC_TX=11
181CONFIG_IRQ_TMR0=12 156CONFIG_IRQ_TMR0=12
@@ -186,11 +161,31 @@ CONFIG_IRQ_TMR4=12
186CONFIG_IRQ_TMR5=12 161CONFIG_IRQ_TMR5=12
187CONFIG_IRQ_TMR6=12 162CONFIG_IRQ_TMR6=12
188CONFIG_IRQ_TMR7=12 163CONFIG_IRQ_TMR7=12
189CONFIG_IRQ_PROG_INTA=12
190CONFIG_IRQ_PORTG_INTB=12 164CONFIG_IRQ_PORTG_INTB=12
191CONFIG_IRQ_MEM_DMA0=13 165CONFIG_IRQ_MEM_DMA0=13
192CONFIG_IRQ_MEM_DMA1=13 166CONFIG_IRQ_MEM_DMA1=13
193CONFIG_IRQ_WATCH=13 167CONFIG_IRQ_WATCH=13
168# CONFIG_BFIN537_STAMP is not set
169# CONFIG_BFIN537_BLUETECHNIX_CM is not set
170CONFIG_PNAV10=y
171# CONFIG_GENERIC_BF537_BOARD is not set
172
173#
174# BF537 Specific Configuration
175#
176
177#
178# Interrupt Priority Assignment
179#
180
181#
182# Priority
183#
184CONFIG_IRQ_DMA_ERROR=7
185CONFIG_IRQ_ERROR=7
186CONFIG_IRQ_CAN_RX=11
187CONFIG_IRQ_CAN_TX=11
188CONFIG_IRQ_PROG_INTA=12
194 189
195# 190#
196# Board customizations 191# Board customizations
@@ -261,6 +256,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
261# CONFIG_RESOURCES_64BIT is not set 256# CONFIG_RESOURCES_64BIT is not set
262CONFIG_ZONE_DMA_FLAG=1 257CONFIG_ZONE_DMA_FLAG=1
263CONFIG_LARGE_ALLOCS=y 258CONFIG_LARGE_ALLOCS=y
259# CONFIG_BFIN_GPTIMERS is not set
264CONFIG_BFIN_DMA_5XX=y 260CONFIG_BFIN_DMA_5XX=y
265# CONFIG_DMA_UNCACHED_2M is not set 261# CONFIG_DMA_UNCACHED_2M is not set
266CONFIG_DMA_UNCACHED_1M=y 262CONFIG_DMA_UNCACHED_1M=y
@@ -282,7 +278,7 @@ CONFIG_L1_MAX_PIECE=16
282# 278#
283 279
284# 280#
285# EBIU_AMBCTL Global Control 281# EBIU_AMGCTL Global Control
286# 282#
287CONFIG_C_AMCKEN=y 283CONFIG_C_AMCKEN=y
288CONFIG_C_CDPRIO=y 284CONFIG_C_CDPRIO=y
@@ -593,6 +589,7 @@ CONFIG_BFIN_MAC_RMII=y
593# CONFIG_DM9000 is not set 589# CONFIG_DM9000 is not set
594CONFIG_NETDEV_1000=y 590CONFIG_NETDEV_1000=y
595CONFIG_NETDEV_10000=y 591CONFIG_NETDEV_10000=y
592# CONFIG_AX88180 is not set
596 593
597# 594#
598# Wireless LAN 595# Wireless LAN
@@ -675,9 +672,9 @@ CONFIG_INPUT_UINPUT=y
675# 672#
676# CONFIG_AD9960 is not set 673# CONFIG_AD9960 is not set
677# CONFIG_SPI_ADC_BF533 is not set 674# CONFIG_SPI_ADC_BF533 is not set
678# CONFIG_BFIN_PFLAGS is not set 675# CONFIG_BF5xx_PFLAGS is not set
679# CONFIG_BF5xx_PPIFCD is not set 676# CONFIG_BF5xx_PPIFCD is not set
680# CONFIG_BF5xx_TIMERS is not set 677# CONFIG_BFIN_SIMPLE_TIMER is not set
681# CONFIG_BF5xx_PPI is not set 678# CONFIG_BF5xx_PPI is not set
682CONFIG_BFIN_SPORT=y 679CONFIG_BFIN_SPORT=y
683# CONFIG_BFIN_TIMER_LATENCY is not set 680# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -897,6 +894,7 @@ CONFIG_FB_BF537_LQ035=y
897CONFIG_LQ035_SLAVE_ADDR=0x58 894CONFIG_LQ035_SLAVE_ADDR=0x58
898CONFIG_FB_BFIN_LANDSCAPE=y 895CONFIG_FB_BFIN_LANDSCAPE=y
899# CONFIG_FB_BFIN_BGR is not set 896# CONFIG_FB_BFIN_BGR is not set
897# CONFIG_FB_BFIN_T350MCQB is not set
900# CONFIG_FB_S1D13XXX is not set 898# CONFIG_FB_S1D13XXX is not set
901# CONFIG_FB_VIRTUAL is not set 899# CONFIG_FB_VIRTUAL is not set
902# CONFIG_LOGO is not set 900# CONFIG_LOGO is not set
@@ -939,11 +937,6 @@ CONFIG_SND=m
939# CONFIG_SND_SOC is not set 937# CONFIG_SND_SOC is not set
940 938
941# 939#
942# SoC Audio for the ADI Blackfin
943#
944# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
945
946#
947# Open Sound System 940# Open Sound System
948# 941#
949CONFIG_SOUND_PRIME=y 942CONFIG_SOUND_PRIME=y
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 503eef4c7fec..b54446055a43 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -436,6 +436,7 @@ unsigned long get_dma_curr_desc_ptr(unsigned int channel)
436 436
437 return dma_ch[channel].regs->curr_desc_ptr; 437 return dma_ch[channel].regs->curr_desc_ptr;
438} 438}
439EXPORT_SYMBOL(get_dma_curr_desc_ptr);
439 440
440unsigned long get_dma_curr_addr(unsigned int channel) 441unsigned long get_dma_curr_addr(unsigned int channel)
441{ 442{
diff --git a/arch/blackfin/kernel/bfin_ksyms.c b/arch/blackfin/kernel/bfin_ksyms.c
index 2198afe40f33..0bfbb269e350 100644
--- a/arch/blackfin/kernel/bfin_ksyms.c
+++ b/arch/blackfin/kernel/bfin_ksyms.c
@@ -37,9 +37,6 @@
37/* platform dependent support */ 37/* platform dependent support */
38 38
39EXPORT_SYMBOL(__ioremap); 39EXPORT_SYMBOL(__ioremap);
40EXPORT_SYMBOL(strcmp);
41EXPORT_SYMBOL(strncmp);
42EXPORT_SYMBOL(dump_thread);
43 40
44EXPORT_SYMBOL(ip_fast_csum); 41EXPORT_SYMBOL(ip_fast_csum);
45 42
@@ -51,6 +48,7 @@ EXPORT_SYMBOL(__down_trylock);
51EXPORT_SYMBOL(__down_interruptible); 48EXPORT_SYMBOL(__down_interruptible);
52 49
53EXPORT_SYMBOL(is_in_rom); 50EXPORT_SYMBOL(is_in_rom);
51EXPORT_SYMBOL(bfin_return_from_exception);
54 52
55/* Networking helper routines. */ 53/* Networking helper routines. */
56EXPORT_SYMBOL(csum_partial_copy); 54EXPORT_SYMBOL(csum_partial_copy);
@@ -60,13 +58,11 @@ EXPORT_SYMBOL(csum_partial_copy);
60 * their interface isn't gonna change any time soon now, so 58 * their interface isn't gonna change any time soon now, so
61 * it's OK to leave it out of version control. 59 * it's OK to leave it out of version control.
62 */ 60 */
63EXPORT_SYMBOL(strcpy);
64EXPORT_SYMBOL(memcpy); 61EXPORT_SYMBOL(memcpy);
65EXPORT_SYMBOL(memset); 62EXPORT_SYMBOL(memset);
66EXPORT_SYMBOL(memcmp); 63EXPORT_SYMBOL(memcmp);
67EXPORT_SYMBOL(memmove); 64EXPORT_SYMBOL(memmove);
68EXPORT_SYMBOL(memchr); 65EXPORT_SYMBOL(memchr);
69EXPORT_SYMBOL(get_wchan);
70 66
71/* 67/*
72 * libgcc functions - functions that are used internally by the 68 * libgcc functions - functions that are used internally by the
@@ -102,6 +98,7 @@ EXPORT_SYMBOL(outsw);
102EXPORT_SYMBOL(insw); 98EXPORT_SYMBOL(insw);
103EXPORT_SYMBOL(outsl); 99EXPORT_SYMBOL(outsl);
104EXPORT_SYMBOL(insl); 100EXPORT_SYMBOL(insl);
101EXPORT_SYMBOL(insl_16);
105EXPORT_SYMBOL(irq_flags); 102EXPORT_SYMBOL(irq_flags);
106EXPORT_SYMBOL(iounmap); 103EXPORT_SYMBOL(iounmap);
107EXPORT_SYMBOL(blackfin_dcache_invalidate_range); 104EXPORT_SYMBOL(blackfin_dcache_invalidate_range);
diff --git a/arch/blackfin/kernel/cplbinit.c b/arch/blackfin/kernel/cplbinit.c
index f2db6a5e2b5b..6320bc45fbba 100644
--- a/arch/blackfin/kernel/cplbinit.c
+++ b/arch/blackfin/kernel/cplbinit.c
@@ -26,29 +26,22 @@
26#include <asm/cplb.h> 26#include <asm/cplb.h>
27#include <asm/cplbinit.h> 27#include <asm/cplbinit.h>
28 28
29u_long icplb_table[MAX_CPLBS+1]; 29u_long icplb_table[MAX_CPLBS + 1];
30u_long dcplb_table[MAX_CPLBS+1]; 30u_long dcplb_table[MAX_CPLBS + 1];
31 31
32#ifdef CONFIG_CPLB_SWITCH_TAB_L1 32#ifdef CONFIG_CPLB_SWITCH_TAB_L1
33u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]__attribute__((l1_data)); 33# define PDT_ATTR __attribute__((l1_data))
34u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]__attribute__((l1_data));
35
36#ifdef CONFIG_CPLB_INFO
37u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]__attribute__((l1_data));
38u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]__attribute__((l1_data));
39#endif /* CONFIG_CPLB_INFO */
40
41#else 34#else
35# define PDT_ATTR
36#endif
42 37
43u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]; 38u_long ipdt_table[MAX_SWITCH_I_CPLBS + 1] PDT_ATTR;
44u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]; 39u_long dpdt_table[MAX_SWITCH_D_CPLBS + 1] PDT_ATTR;
45 40
46#ifdef CONFIG_CPLB_INFO 41#ifdef CONFIG_CPLB_INFO
47u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]; 42u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS] PDT_ATTR;
48u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]; 43u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS] PDT_ATTR;
49#endif /* CONFIG_CPLB_INFO */ 44#endif
50
51#endif /*CONFIG_CPLB_SWITCH_TAB_L1*/
52 45
53struct s_cplb { 46struct s_cplb {
54 struct cplb_tab init_i; 47 struct cplb_tab init_i;
@@ -71,7 +64,7 @@ static struct cplb_desc cplb_data[] = {
71#else 64#else
72 .valid = 0, 65 .valid = 0,
73#endif 66#endif
74 .name = "ZERO Pointer Saveguard", 67 .name = "Zero Pointer Guard Page",
75 }, 68 },
76 { 69 {
77 .start = L1_CODE_START, 70 .start = L1_CODE_START,
@@ -102,20 +95,20 @@ static struct cplb_desc cplb_data[] = {
102 .end = 0, /* dynamic */ 95 .end = 0, /* dynamic */
103 .psize = 0, 96 .psize = 0,
104 .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB, 97 .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB,
105 .i_conf = SDRAM_IGENERIC, 98 .i_conf = SDRAM_IGENERIC,
106 .d_conf = SDRAM_DGENERIC, 99 .d_conf = SDRAM_DGENERIC,
107 .valid = 1, 100 .valid = 1,
108 .name = "SDRAM Kernel", 101 .name = "Kernel Memory",
109 }, 102 },
110 { 103 {
111 .start = 0, /* dynamic */ 104 .start = 0, /* dynamic */
112 .end = 0, /* dynamic */ 105 .end = 0, /* dynamic */
113 .psize = 0, 106 .psize = 0,
114 .attr = INITIAL_T | SWITCH_T | D_CPLB, 107 .attr = INITIAL_T | SWITCH_T | D_CPLB,
115 .i_conf = SDRAM_IGENERIC, 108 .i_conf = SDRAM_IGENERIC,
116 .d_conf = SDRAM_DNON_CHBL, 109 .d_conf = SDRAM_DNON_CHBL,
117 .valid = 1, 110 .valid = 1,
118 .name = "SDRAM RAM MTD", 111 .name = "uClinux MTD Memory",
119 }, 112 },
120 { 113 {
121 .start = 0, /* dynamic */ 114 .start = 0, /* dynamic */
@@ -124,7 +117,7 @@ static struct cplb_desc cplb_data[] = {
124 .attr = INITIAL_T | SWITCH_T | D_CPLB, 117 .attr = INITIAL_T | SWITCH_T | D_CPLB,
125 .d_conf = SDRAM_DNON_CHBL, 118 .d_conf = SDRAM_DNON_CHBL,
126 .valid = 1, 119 .valid = 1,
127 .name = "SDRAM Uncached DMA ZONE", 120 .name = "Uncached DMA Zone",
128 }, 121 },
129 { 122 {
130 .start = 0, /* dynamic */ 123 .start = 0, /* dynamic */
@@ -134,7 +127,7 @@ static struct cplb_desc cplb_data[] = {
134 .i_conf = 0, /* dynamic */ 127 .i_conf = 0, /* dynamic */
135 .d_conf = 0, /* dynamic */ 128 .d_conf = 0, /* dynamic */
136 .valid = 1, 129 .valid = 1,
137 .name = "SDRAM Reserved Memory", 130 .name = "Reserved Memory",
138 }, 131 },
139 { 132 {
140 .start = ASYNC_BANK0_BASE, 133 .start = ASYNC_BANK0_BASE,
@@ -143,14 +136,14 @@ static struct cplb_desc cplb_data[] = {
143 .attr = SWITCH_T | D_CPLB, 136 .attr = SWITCH_T | D_CPLB,
144 .d_conf = SDRAM_EBIU, 137 .d_conf = SDRAM_EBIU,
145 .valid = 1, 138 .valid = 1,
146 .name = "ASYNC Memory", 139 .name = "Asynchronous Memory Banks",
147 }, 140 },
148 { 141 {
149#if defined(CONFIG_BF561) 142#ifdef L2_START
150 .start = L2_SRAM, 143 .start = L2_START,
151 .end = L2_SRAM_END, 144 .end = L2_START + L2_LENGTH,
152 .psize = SIZE_1M, 145 .psize = SIZE_1M,
153 .attr = SWITCH_T | D_CPLB, 146 .attr = SWITCH_T | I_CPLB | D_CPLB,
154 .i_conf = L2_MEMORY, 147 .i_conf = L2_MEMORY,
155 .d_conf = L2_MEMORY, 148 .d_conf = L2_MEMORY,
156 .valid = 1, 149 .valid = 1,
@@ -158,13 +151,23 @@ static struct cplb_desc cplb_data[] = {
158 .valid = 0, 151 .valid = 0,
159#endif 152#endif
160 .name = "L2 Memory", 153 .name = "L2 Memory",
161 } 154 },
155 {
156 .start = BOOT_ROM_START,
157 .end = BOOT_ROM_START + BOOT_ROM_LENGTH,
158 .psize = SIZE_1M,
159 .attr = SWITCH_T | I_CPLB | D_CPLB,
160 .i_conf = SDRAM_IGENERIC,
161 .d_conf = SDRAM_DGENERIC,
162 .valid = 1,
163 .name = "On-Chip BootROM",
164 },
162}; 165};
163 166
164static u16 __init lock_kernel_check(u32 start, u32 end) 167static u16 __init lock_kernel_check(u32 start, u32 end)
165{ 168{
166 if ((start <= (u32) _stext && end >= (u32) _end) 169 if ((end <= (u32) _end && end >= (u32)_stext) ||
167 || (start >= (u32) _stext && end <= (u32) _end)) 170 (start <= (u32) _end && start >= (u32)_stext))
168 return IN_KERNEL; 171 return IN_KERNEL;
169 return 0; 172 return 0;
170} 173}
@@ -350,7 +353,7 @@ void __init generate_cpl_tables(void)
350 else 353 else
351 cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL; 354 cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL;
352 355
353 for (i = ZERO_P; i <= L2_MEM; i++) { 356 for (i = ZERO_P; i < ARRAY_SIZE(cplb_data); ++i) {
354 if (!cplb_data[i].valid) 357 if (!cplb_data[i].valid)
355 continue; 358 continue;
356 359
diff --git a/arch/blackfin/kernel/early_printk.c b/arch/blackfin/kernel/early_printk.c
index 6ec518a81113..724f4a5a1d46 100644
--- a/arch/blackfin/kernel/early_printk.c
+++ b/arch/blackfin/kernel/early_printk.c
@@ -205,7 +205,8 @@ asmlinkage void __init early_trap_c(struct pt_regs *fp, void *retaddr)
205 if (likely(early_console == NULL)) 205 if (likely(early_console == NULL))
206 setup_early_printk(DEFAULT_EARLY_PORT); 206 setup_early_printk(DEFAULT_EARLY_PORT);
207 207
208 dump_bfin_regs(fp, retaddr); 208 dump_bfin_mem((void *)fp->retx);
209 show_regs(fp);
209 dump_bfin_trace_buffer(); 210 dump_bfin_trace_buffer();
210 211
211 panic("Died early"); 212 panic("Died early");
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/process.c b/arch/blackfin/kernel/process.c
index 9124467651c4..5bf15125f0d6 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -134,27 +134,6 @@ void cpu_idle(void)
134 } 134 }
135} 135}
136 136
137void show_regs(struct pt_regs *regs)
138{
139 printk(KERN_NOTICE "\n");
140 printk(KERN_NOTICE
141 "PC: %08lu Status: %04lu SysStatus: %04lu RETS: %08lu\n",
142 regs->pc, regs->astat, regs->seqstat, regs->rets);
143 printk(KERN_NOTICE
144 "A0.x: %08lx A0.w: %08lx A1.x: %08lx A1.w: %08lx\n",
145 regs->a0x, regs->a0w, regs->a1x, regs->a1w);
146 printk(KERN_NOTICE "P0: %08lx P1: %08lx P2: %08lx P3: %08lx\n",
147 regs->p0, regs->p1, regs->p2, regs->p3);
148 printk(KERN_NOTICE "P4: %08lx P5: %08lx\n", regs->p4, regs->p5);
149 printk(KERN_NOTICE "R0: %08lx R1: %08lx R2: %08lx R3: %08lx\n",
150 regs->r0, regs->r1, regs->r2, regs->r3);
151 printk(KERN_NOTICE "R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n",
152 regs->r4, regs->r5, regs->r6, regs->r7);
153
154 if (!regs->ipend)
155 printk(KERN_NOTICE "USP: %08lx\n", rdusp());
156}
157
158/* Fill in the fpu structure for a core dump. */ 137/* Fill in the fpu structure for a core dump. */
159 138
160int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpregs) 139int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpregs)
@@ -239,51 +218,6 @@ copy_thread(int nr, unsigned long clone_flags,
239} 218}
240 219
241/* 220/*
242 * fill in the user structure for a core dump..
243 */
244void dump_thread(struct pt_regs *regs, struct user *dump)
245{
246 dump->magic = CMAGIC;
247 dump->start_code = 0;
248 dump->start_stack = rdusp() & ~(PAGE_SIZE - 1);
249 dump->u_tsize = ((unsigned long)current->mm->end_code) >> PAGE_SHIFT;
250 dump->u_dsize = ((unsigned long)(current->mm->brk +
251 (PAGE_SIZE - 1))) >> PAGE_SHIFT;
252 dump->u_dsize -= dump->u_tsize;
253 dump->u_ssize = 0;
254
255 if (dump->start_stack < TASK_SIZE)
256 dump->u_ssize =
257 ((unsigned long)(TASK_SIZE -
258 dump->start_stack)) >> PAGE_SHIFT;
259
260 dump->u_ar0 = (struct user_regs_struct *)((int)&dump->regs - (int)dump);
261
262 dump->regs.r0 = regs->r0;
263 dump->regs.r1 = regs->r1;
264 dump->regs.r2 = regs->r2;
265 dump->regs.r3 = regs->r3;
266 dump->regs.r4 = regs->r4;
267 dump->regs.r5 = regs->r5;
268 dump->regs.r6 = regs->r6;
269 dump->regs.r7 = regs->r7;
270 dump->regs.p0 = regs->p0;
271 dump->regs.p1 = regs->p1;
272 dump->regs.p2 = regs->p2;
273 dump->regs.p3 = regs->p3;
274 dump->regs.p4 = regs->p4;
275 dump->regs.p5 = regs->p5;
276 dump->regs.orig_p0 = regs->orig_p0;
277 dump->regs.a0w = regs->a0w;
278 dump->regs.a1w = regs->a1w;
279 dump->regs.a0x = regs->a0x;
280 dump->regs.a1x = regs->a1x;
281 dump->regs.rets = regs->rets;
282 dump->regs.astat = regs->astat;
283 dump->regs.pc = regs->pc;
284}
285
286/*
287 * sys_execve() executes a new program. 221 * sys_execve() executes a new program.
288 */ 222 */
289 223
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index f1b059e5a06c..d2822010b7ce 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -43,6 +43,7 @@
43#include <asm/cacheflush.h> 43#include <asm/cacheflush.h>
44#include <asm/blackfin.h> 44#include <asm/blackfin.h>
45#include <asm/cplbinit.h> 45#include <asm/cplbinit.h>
46#include <asm/div64.h>
46#include <asm/fixed_code.h> 47#include <asm/fixed_code.h>
47#include <asm/early_printk.h> 48#include <asm/early_printk.h>
48 49
@@ -316,6 +317,15 @@ void __init setup_arch(char **cmdline_p)
316 317
317 init_leds(); 318 init_leds();
318 319
320 _bfin_swrst = bfin_read_SWRST();
321
322 if (_bfin_swrst & RESET_DOUBLE)
323 printk(KERN_INFO "Recovering from Double Fault event\n");
324 else if (_bfin_swrst & RESET_WDOG)
325 printk(KERN_INFO "Recovering from Watchdog event\n");
326 else if (_bfin_swrst & RESET_SOFTWARE)
327 printk(KERN_NOTICE "Reset caused by Software reset\n");
328
319 printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n"); 329 printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
320 if (bfin_compiled_revid() == 0xffff) 330 if (bfin_compiled_revid() == 0xffff)
321 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU); 331 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
@@ -402,8 +412,6 @@ void __init setup_arch(char **cmdline_p)
402 if (l1_length > L1_DATA_A_LENGTH) 412 if (l1_length > L1_DATA_A_LENGTH)
403 panic("L1 data memory overflow\n"); 413 panic("L1 data memory overflow\n");
404 414
405 _bfin_swrst = bfin_read_SWRST();
406
407 /* Copy atomic sequences to their fixed location, and sanity check that 415 /* Copy atomic sequences to their fixed location, and sanity check that
408 these locations are the ones that we advertise to userspace. */ 416 these locations are the ones that we advertise to userspace. */
409 memcpy((void *)FIXED_CODE_START, &fixed_code_start, 417 memcpy((void *)FIXED_CODE_START, &fixed_code_start,
@@ -424,6 +432,8 @@ void __init setup_arch(char **cmdline_p)
424 != ATOMIC_AND32 - FIXED_CODE_START); 432 != ATOMIC_AND32 - FIXED_CODE_START);
425 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start 433 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
426 != ATOMIC_XOR32 - FIXED_CODE_START); 434 != ATOMIC_XOR32 - FIXED_CODE_START);
435 BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start
436 != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
427 437
428 init_exception_vectors(); 438 init_exception_vectors();
429 bf53x_cache_init(); 439 bf53x_cache_init();
@@ -495,13 +505,17 @@ EXPORT_SYMBOL(get_sclk);
495 505
496unsigned long sclk_to_usecs(unsigned long sclk) 506unsigned long sclk_to_usecs(unsigned long sclk)
497{ 507{
498 return (USEC_PER_SEC * (u64)sclk) / get_sclk(); 508 u64 tmp = USEC_PER_SEC * (u64)sclk;
509 do_div(tmp, get_sclk());
510 return tmp;
499} 511}
500EXPORT_SYMBOL(sclk_to_usecs); 512EXPORT_SYMBOL(sclk_to_usecs);
501 513
502unsigned long usecs_to_sclk(unsigned long usecs) 514unsigned long usecs_to_sclk(unsigned long usecs)
503{ 515{
504 return (get_sclk() * (u64)usecs) / USEC_PER_SEC; 516 u64 tmp = get_sclk() * (u64)usecs;
517 do_div(tmp, USEC_PER_SEC);
518 return tmp;
505} 519}
506EXPORT_SYMBOL(usecs_to_sclk); 520EXPORT_SYMBOL(usecs_to_sclk);
507 521
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index afd044e78af6..21a55ef19cbd 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,27 +144,34 @@ 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> /* unknown address */", (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_process(fp);
173 dump_bfin_mem((void *)fp->retx);
174 show_regs(fp);
141 panic("Double Fault - unrecoverable event\n"); 175 panic("Double Fault - unrecoverable event\n");
142 176
143} 177}
@@ -151,22 +185,29 @@ asmlinkage void trap_c(struct pt_regs *fp)
151 siginfo_t info; 185 siginfo_t info;
152 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE; 186 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE;
153 187
188 trace_buffer_save(j);
189
190 /* Important - be very careful dereferncing pointers - will lead to
191 * double faults if the stack has become corrupt
192 */
193
194 /* If the fault was caused by a kernel thread, or interrupt handler
195 * we will kernel panic, so the system reboots.
196 * If KGDB is enabled, don't set this for kernel breakpoints
197 */
198 if ((bfin_read_IPEND() & 0xFFC0)
154#ifdef CONFIG_KGDB 199#ifdef CONFIG_KGDB
155# define CHK_DEBUGGER_TRAP() \ 200 && 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 201#endif
168 202 ){
169 trace_buffer_save(j); 203 console_verbose();
204 oops_in_progress = 1;
205 } else if (current) {
206 if (current->mm == NULL) {
207 console_verbose();
208 oops_in_progress = 1;
209 }
210 }
170 211
171 /* trap_c() will be called for exceptions. During exceptions 212 /* trap_c() will be called for exceptions. During exceptions
172 * processing, the pc value should be set with retx value. 213 * processing, the pc value should be set with retx value.
@@ -211,7 +252,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
211 case VEC_EXCPT03: 252 case VEC_EXCPT03:
212 info.si_code = SEGV_STACKFLOW; 253 info.si_code = SEGV_STACKFLOW;
213 sig = SIGSEGV; 254 sig = SIGSEGV;
214 printk(KERN_EMERG EXC_0x03); 255 printk(KERN_NOTICE EXC_0x03(KERN_NOTICE));
215 CHK_DEBUGGER_TRAP(); 256 CHK_DEBUGGER_TRAP();
216 break; 257 break;
217 /* 0x04 - User Defined, Caught by default */ 258 /* 0x04 - User Defined, Caught by default */
@@ -240,7 +281,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
240 case VEC_OVFLOW: 281 case VEC_OVFLOW:
241 info.si_code = TRAP_TRACEFLOW; 282 info.si_code = TRAP_TRACEFLOW;
242 sig = SIGTRAP; 283 sig = SIGTRAP;
243 printk(KERN_EMERG EXC_0x11); 284 printk(KERN_NOTICE EXC_0x11(KERN_NOTICE));
244 CHK_DEBUGGER_TRAP(); 285 CHK_DEBUGGER_TRAP();
245 break; 286 break;
246 /* 0x12 - Reserved, Caught by default */ 287 /* 0x12 - Reserved, Caught by default */
@@ -262,36 +303,35 @@ asmlinkage void trap_c(struct pt_regs *fp)
262 case VEC_UNDEF_I: 303 case VEC_UNDEF_I:
263 info.si_code = ILL_ILLOPC; 304 info.si_code = ILL_ILLOPC;
264 sig = SIGILL; 305 sig = SIGILL;
265 printk(KERN_EMERG EXC_0x21); 306 printk(KERN_NOTICE EXC_0x21(KERN_NOTICE));
266 CHK_DEBUGGER_TRAP(); 307 CHK_DEBUGGER_TRAP();
267 break; 308 break;
268 /* 0x22 - Illegal Instruction Combination, handled here */ 309 /* 0x22 - Illegal Instruction Combination, handled here */
269 case VEC_ILGAL_I: 310 case VEC_ILGAL_I:
270 info.si_code = ILL_ILLPARAOP; 311 info.si_code = ILL_ILLPARAOP;
271 sig = SIGILL; 312 sig = SIGILL;
272 printk(KERN_EMERG EXC_0x22); 313 printk(KERN_NOTICE EXC_0x22(KERN_NOTICE));
273 CHK_DEBUGGER_TRAP(); 314 CHK_DEBUGGER_TRAP();
274 break; 315 break;
275 /* 0x23 - Data CPLB Protection Violation, 316 /* 0x23 - Data CPLB protection violation, handled here */
276 normal case is handled in _cplb_hdr */
277 case VEC_CPLB_VL: 317 case VEC_CPLB_VL:
278 info.si_code = ILL_CPLB_VI; 318 info.si_code = ILL_CPLB_VI;
279 sig = SIGILL; 319 sig = SIGBUS;
280 printk(KERN_EMERG EXC_0x23); 320 printk(KERN_NOTICE EXC_0x23(KERN_NOTICE));
281 CHK_DEBUGGER_TRAP(); 321 CHK_DEBUGGER_TRAP();
282 break; 322 break;
283 /* 0x24 - Data access misaligned, handled here */ 323 /* 0x24 - Data access misaligned, handled here */
284 case VEC_MISALI_D: 324 case VEC_MISALI_D:
285 info.si_code = BUS_ADRALN; 325 info.si_code = BUS_ADRALN;
286 sig = SIGBUS; 326 sig = SIGBUS;
287 printk(KERN_EMERG EXC_0x24); 327 printk(KERN_NOTICE EXC_0x24(KERN_NOTICE));
288 CHK_DEBUGGER_TRAP(); 328 CHK_DEBUGGER_TRAP();
289 break; 329 break;
290 /* 0x25 - Unrecoverable Event, handled here */ 330 /* 0x25 - Unrecoverable Event, handled here */
291 case VEC_UNCOV: 331 case VEC_UNCOV:
292 info.si_code = ILL_ILLEXCPT; 332 info.si_code = ILL_ILLEXCPT;
293 sig = SIGILL; 333 sig = SIGILL;
294 printk(KERN_EMERG EXC_0x25); 334 printk(KERN_NOTICE EXC_0x25(KERN_NOTICE));
295 CHK_DEBUGGER_TRAP(); 335 CHK_DEBUGGER_TRAP();
296 break; 336 break;
297 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr, 337 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr,
@@ -299,7 +339,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
299 case VEC_CPLB_M: 339 case VEC_CPLB_M:
300 info.si_code = BUS_ADRALN; 340 info.si_code = BUS_ADRALN;
301 sig = SIGBUS; 341 sig = SIGBUS;
302 printk(KERN_EMERG EXC_0x26); 342 printk(KERN_NOTICE EXC_0x26(KERN_NOTICE));
303 CHK_DEBUGGER_TRAP(); 343 CHK_DEBUGGER_TRAP();
304 break; 344 break;
305 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ 345 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */
@@ -307,11 +347,10 @@ asmlinkage void trap_c(struct pt_regs *fp)
307 info.si_code = ILL_CPLB_MULHIT; 347 info.si_code = ILL_CPLB_MULHIT;
308#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO 348#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
309 sig = SIGSEGV; 349 sig = SIGSEGV;
310 printk(KERN_EMERG "\n" 350 printk(KERN_NOTICE "NULL pointer access (probably)\n");
311 KERN_EMERG "NULL pointer access (probably)\n");
312#else 351#else
313 sig = SIGILL; 352 sig = SIGILL;
314 printk(KERN_EMERG EXC_0x27); 353 printk(KERN_NOTICE EXC_0x27(KERN_NOTICE));
315#endif 354#endif
316 CHK_DEBUGGER_TRAP(); 355 CHK_DEBUGGER_TRAP();
317 break; 356 break;
@@ -319,7 +358,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
319 case VEC_WATCH: 358 case VEC_WATCH:
320 info.si_code = TRAP_WATCHPT; 359 info.si_code = TRAP_WATCHPT;
321 sig = SIGTRAP; 360 sig = SIGTRAP;
322 pr_debug(EXC_0x28); 361 pr_debug(EXC_0x28(KERN_DEBUG));
323 CHK_DEBUGGER_TRAP_MAYBE(); 362 CHK_DEBUGGER_TRAP_MAYBE();
324 /* Check if this is a watchpoint in kernel space */ 363 /* Check if this is a watchpoint in kernel space */
325 if (fp->ipend & 0xffc0) 364 if (fp->ipend & 0xffc0)
@@ -331,7 +370,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
331 case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */ 370 case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */
332 info.si_code = BUS_OPFETCH; 371 info.si_code = BUS_OPFETCH;
333 sig = SIGBUS; 372 sig = SIGBUS;
334 printk(KERN_EMERG "BF535: VEC_ISTRU_VL\n"); 373 printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n");
335 CHK_DEBUGGER_TRAP(); 374 CHK_DEBUGGER_TRAP();
336 break; 375 break;
337#else 376#else
@@ -341,22 +380,21 @@ asmlinkage void trap_c(struct pt_regs *fp)
341 case VEC_MISALI_I: 380 case VEC_MISALI_I:
342 info.si_code = BUS_ADRALN; 381 info.si_code = BUS_ADRALN;
343 sig = SIGBUS; 382 sig = SIGBUS;
344 printk(KERN_EMERG EXC_0x2A); 383 printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE));
345 CHK_DEBUGGER_TRAP(); 384 CHK_DEBUGGER_TRAP();
346 break; 385 break;
347 /* 0x2B - Instruction CPLB protection Violation, 386 /* 0x2B - Instruction CPLB protection violation, handled here */
348 handled in _cplb_hdr */
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 = SIGBUS;
352 printk(KERN_EMERG EXC_0x2B); 390 printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE));
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(KERN_NOTICE));
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(KERN_NOTICE));
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(KERN_NOTICE));
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,37 +442,44 @@ 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_process(fp);
410 dump_bfin_trace_buffer(); 450 dump_bfin_mem((void *)fp->retx);
451 show_regs(fp);
452
453 /* Print out the trace buffer if it makes sense */
454#ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
455 if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M)
456 printk(KERN_NOTICE "No trace since you do not have "
457 "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n"
458 KERN_NOTICE "\n");
459 else
460#endif
461 dump_bfin_trace_buffer();
411 show_stack(current, &stack); 462 show_stack(current, &stack);
412 if (current->mm == NULL) 463 if (oops_in_progress) {
464#ifndef CONFIG_ACCESS_CHECK
465 printk(KERN_EMERG "Please turn on "
466 "CONFIG_ACCESS_CHECK\n");
467#endif
413 panic("Kernel exception"); 468 panic("Kernel exception");
469 }
414 } 470 }
471
415 info.si_signo = sig; 472 info.si_signo = sig;
416 info.si_errno = 0; 473 info.si_errno = 0;
417 info.si_addr = (void *)fp->pc; 474 info.si_addr = (void *)fp->pc;
418 force_sig_info(sig, &info, current); 475 force_sig_info(sig, &info, current);
419 476
420 /* if the address that we are about to return to is not valid, set it 477 /* Ensure that bad return addresses don't end up in an infinite
421 * to a valid address, if we have a current application or panic 478 * loop, due to speculative loads/reads. This needs to be done after
479 * the signal has been sent.
422 */ 480 */
423 if (!(fp->pc <= physical_mem_end 481 if (trapnr == VEC_CPLB_I_M && sig != SIGTRAP)
424#if L1_CODE_LENGTH != 0 482 fp->pc = SAFE_USER_INSTRUCTION;
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 483
439 trace_buffer_restore(j); 484 trace_buffer_restore(j);
440 return; 485 return;
@@ -448,21 +493,21 @@ void dump_bfin_trace_buffer(void)
448{ 493{
449#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON 494#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
450 int tflags, i = 0; 495 int tflags, i = 0;
496 char buf[150];
451#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND 497#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
452 int j, index; 498 int j, index;
453#endif 499#endif
454 500
455 trace_buffer_save(tflags); 501 trace_buffer_save(tflags);
456 502
457 printk(KERN_EMERG "Hardware Trace:\n"); 503 printk(KERN_NOTICE "Hardware Trace:\n");
458 504
459 if (likely(bfin_read_TBUFSTAT() & TBUFCNT)) { 505 if (likely(bfin_read_TBUFSTAT() & TBUFCNT)) {
460 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) { 506 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) {
461 printk(KERN_EMERG "%4i Target : ", i); 507 decode_address(buf, (unsigned long)bfin_read_TBUF());
462 printk_address((unsigned long)bfin_read_TBUF()); 508 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
463 printk("\n" KERN_EMERG " Source : "); 509 decode_address(buf, (unsigned long)bfin_read_TBUF());
464 printk_address((unsigned long)bfin_read_TBUF()); 510 printk(KERN_NOTICE " Source : %s\n", buf);
465 printk("\n");
466 } 511 }
467 } 512 }
468 513
@@ -474,17 +519,16 @@ void dump_bfin_trace_buffer(void)
474 519
475 j = (1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 128; 520 j = (1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 128;
476 while (j) { 521 while (j) {
477 printk(KERN_EMERG "%4i Target : ", i); 522 decode_address(buf, software_trace_buff[index]);
478 printk_address(software_trace_buff[index]); 523 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
479 index -= 1; 524 index -= 1;
480 if (index < 0 ) 525 if (index < 0 )
481 index = EXPAND_LEN; 526 index = EXPAND_LEN;
482 printk("\n" KERN_EMERG " Source : "); 527 decode_address(buf, software_trace_buff[index]);
483 printk_address(software_trace_buff[index]); 528 printk(KERN_NOTICE " Source : %s\n", buf);
484 index -= 1; 529 index -= 1;
485 if (index < 0) 530 if (index < 0)
486 index = EXPAND_LEN; 531 index = EXPAND_LEN;
487 printk("\n");
488 j--; 532 j--;
489 i++; 533 i++;
490 } 534 }
@@ -499,10 +543,7 @@ static void show_trace(struct task_struct *tsk, unsigned long *sp)
499{ 543{
500 unsigned long addr; 544 unsigned long addr;
501 545
502 printk("\nCall Trace:"); 546 printk(KERN_NOTICE "\n" KERN_NOTICE "Call Trace:\n");
503#ifdef CONFIG_KALLSYMS
504 printk("\n");
505#endif
506 547
507 while (!kstack_end(sp)) { 548 while (!kstack_end(sp)) {
508 addr = *sp++; 549 addr = *sp++;
@@ -518,7 +559,7 @@ static void show_trace(struct task_struct *tsk, unsigned long *sp)
518 print_ip_sym(addr); 559 print_ip_sym(addr);
519 } 560 }
520 561
521 printk("\n"); 562 printk(KERN_NOTICE "\n");
522} 563}
523 564
524void show_stack(struct task_struct *task, unsigned long *stack) 565void show_stack(struct task_struct *task, unsigned long *stack)
@@ -540,14 +581,15 @@ void show_stack(struct task_struct *task, unsigned long *stack)
540 addr = (unsigned long)stack; 581 addr = (unsigned long)stack;
541 endstack = (unsigned long *)PAGE_ALIGN(addr); 582 endstack = (unsigned long *)PAGE_ALIGN(addr);
542 583
543 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack); 584 printk(KERN_NOTICE "Stack from %08lx:", (unsigned long)stack);
544 for (i = 0; i < kstack_depth_to_print; i++) { 585 for (i = 0; i < kstack_depth_to_print; i++) {
545 if (stack + 1 > endstack) 586 if (stack + 1 > endstack)
546 break; 587 break;
547 if (i % 8 == 0) 588 if (i % 8 == 0)
548 printk("\n" KERN_EMERG " "); 589 printk("\n" KERN_NOTICE " ");
549 printk(" %08lx", *stack++); 590 printk(" %08lx", *stack++);
550 } 591 }
592 printk("\n");
551 593
552 show_trace(task, stack); 594 show_trace(task, stack);
553} 595}
@@ -563,38 +605,50 @@ void dump_stack(void)
563 show_stack(current, &stack); 605 show_stack(current, &stack);
564 trace_buffer_restore(tflags); 606 trace_buffer_restore(tflags);
565} 607}
566
567EXPORT_SYMBOL(dump_stack); 608EXPORT_SYMBOL(dump_stack);
568 609
569void dump_bfin_regs(struct pt_regs *fp, void *retaddr) 610void dump_bfin_process(struct pt_regs *fp)
570{ 611{
571 if (current->pid) { 612 /* We should be able to look at fp->ipend, but we don't push it on the
572 printk(KERN_EMERG "\n" KERN_EMERG "CURRENT PROCESS:\n" 613 * stack all the time, so do this until we fix that */
573 KERN_EMERG "\n"); 614 unsigned int context = bfin_read_IPEND();
574 printk(KERN_EMERG "COMM=%s PID=%d\n", 615
616 if (oops_in_progress)
617 printk(KERN_EMERG "Kernel OOPS in progress\n");
618
619 if (context & 0x0020)
620 printk(KERN_NOTICE "Deferred excecption or HW Error context\n");
621 else if (context & 0x3FC0)
622 printk(KERN_NOTICE "Interrupt context\n");
623 else if (context & 0x4000)
624 printk(KERN_NOTICE "Deferred Interrupt context\n");
625 else if (context & 0x8000)
626 printk(KERN_NOTICE "Kernel process context\n");
627
628 if (current->pid && current->mm) {
629 printk(KERN_NOTICE "CURRENT PROCESS:\n");
630 printk(KERN_NOTICE "COMM=%s PID=%d\n",
575 current->comm, current->pid); 631 current->comm, current->pid);
576 } else {
577 printk
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 632
583 if (current->mm) { 633 printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
584 printk(KERN_EMERG "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" 634 KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
585 KERN_EMERG "BSS = 0x%p-0x%p USER-STACK = 0x%p\n" 635 KERN_NOTICE "\n",
586 KERN_EMERG "\n", 636 (void *)current->mm->start_code,
587 (void *)current->mm->start_code, 637 (void *)current->mm->end_code,
588 (void *)current->mm->end_code, 638 (void *)current->mm->start_data,
589 (void *)current->mm->start_data, 639 (void *)current->mm->end_data,
590 (void *)current->mm->end_data, 640 (void *)current->mm->end_data,
591 (void *)current->mm->end_data, 641 (void *)current->mm->brk,
592 (void *)current->mm->brk, 642 (void *)current->mm->start_stack);
593 (void *)current->mm->start_stack); 643 } else
594 } 644 printk(KERN_NOTICE "\n" KERN_NOTICE
645 "No Valid process in current context\n");
646}
595 647
596 printk(KERN_EMERG "return address: [0x%p]; contents of:", retaddr); 648void dump_bfin_mem(void *retaddr)
597 if (retaddr != 0 && retaddr <= (void *)physical_mem_end 649{
650
651 if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end
598#if L1_CODE_LENGTH != 0 652#if L1_CODE_LENGTH != 0
599 /* FIXME: Copy the code out of L1 Instruction SRAM through dma 653 /* FIXME: Copy the code out of L1 Instruction SRAM through dma
600 memcpy. */ 654 memcpy. */
@@ -604,18 +658,20 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
604 ) { 658 ) {
605 int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32; 659 int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32;
606 unsigned short x = 0; 660 unsigned short x = 0;
661 printk(KERN_NOTICE "return address: [0x%p]; contents of:", retaddr);
607 for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) { 662 for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) {
608 if (!(i & 0xF)) 663 if (!(i & 0xF))
609 printk("\n" KERN_EMERG "0x%08x: ", i); 664 printk("\n" KERN_NOTICE "0x%08x: ", i);
610 665
611 if (get_user(x, (unsigned short *)i)) 666 if (get_user(x, (unsigned short *)i))
612 break; 667 break;
613#ifndef CONFIG_DEBUG_HWERR 668#ifndef CONFIG_DEBUG_HWERR
614 /* If one of the last few instructions was a STI 669 /* If one of the last few instructions was a STI
615 * it is likely that the error occured awhile ago 670 * it is likely that the error occured awhile ago
616 * and we just noticed 671 * and we just noticed. This only happens in kernel
672 * context, which should mean an oops is happening
617 */ 673 */
618 if (x >= 0x0040 && x <= 0x0047 && i <= 0) 674 if (oops_in_progress && x >= 0x0040 && x <= 0x0047 && i <= 0)
619 panic("\n\nWARNING : You should reconfigure" 675 panic("\n\nWARNING : You should reconfigure"
620 " the kernel to turn on\n" 676 " the kernel to turn on\n"
621 " 'Hardware error interrupt" 677 " 'Hardware error interrupt"
@@ -628,56 +684,67 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
628 else 684 else
629 printk(" %04x ", x); 685 printk(" %04x ", x);
630 } 686 }
631 printk("\n" KERN_EMERG "\n"); 687 printk("\n");
632 } else 688 } else
633 printk(KERN_EMERG 689 printk("\n" KERN_NOTICE
634 "Cannot look at the [PC] for it is" 690 "Cannot look at the [PC] <%p> for it is"
635 "in unreadable L1 SRAM - sorry\n"); 691 " in unreadable memory - sorry\n", retaddr);
636 692}
637 693
638 printk(KERN_EMERG 694void show_regs(struct pt_regs *fp)
639 "RETE: %08lx RETN: %08lx RETX: %08lx RETS: %08lx\n", 695{
640 fp->rete, fp->retn, fp->retx, fp->rets); 696 char buf [150];
641 printk(KERN_EMERG "IPEND: %04lx SYSCFG: %04lx\n", 697
642 fp->ipend, fp->syscfg); 698 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n");
643 printk(KERN_EMERG "SEQSTAT: %08lx SP: %08lx\n", 699 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
644 (long)fp->seqstat, (long)fp); 700 (long)fp->seqstat, fp->ipend, fp->syscfg);
645 printk(KERN_EMERG "R0: %08lx R1: %08lx R2: %08lx R3: %08lx\n", 701
702 decode_address(buf, fp->rete);
703 printk(KERN_NOTICE " RETE: %s\n", buf);
704 decode_address(buf, fp->retn);
705 printk(KERN_NOTICE " RETN: %s\n", buf);
706 decode_address(buf, fp->retx);
707 printk(KERN_NOTICE " RETX: %s\n", buf);
708 decode_address(buf, fp->rets);
709 printk(KERN_NOTICE " RETS: %s\n", buf);
710 decode_address(buf, fp->pc);
711 printk(KERN_NOTICE " PC: %s\n", buf);
712
713 if ((long)fp->seqstat & SEQSTAT_EXCAUSE) {
714 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR());
715 printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf);
716 decode_address(buf, bfin_read_ICPLB_FAULT_ADDR());
717 printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf);
718 }
719
720 printk(KERN_NOTICE "\n" KERN_NOTICE "PROCESSOR STATE:\n");
721 printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n",
646 fp->r0, fp->r1, fp->r2, fp->r3); 722 fp->r0, fp->r1, fp->r2, fp->r3);
647 printk(KERN_EMERG "R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n", 723 printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n",
648 fp->r4, fp->r5, fp->r6, fp->r7); 724 fp->r4, fp->r5, fp->r6, fp->r7);
649 printk(KERN_EMERG "P0: %08lx P1: %08lx P2: %08lx P3: %08lx\n", 725 printk(KERN_NOTICE " P0 : %08lx P1 : %08lx P2 : %08lx P3 : %08lx\n",
650 fp->p0, fp->p1, fp->p2, fp->p3); 726 fp->p0, fp->p1, fp->p2, fp->p3);
651 printk(KERN_EMERG 727 printk(KERN_NOTICE " P4 : %08lx P5 : %08lx FP : %08lx SP : %08lx\n",
652 "P4: %08lx P5: %08lx FP: %08lx\n", 728 fp->p4, fp->p5, fp->fp, (long)fp);
653 fp->p4, fp->p5, fp->fp); 729 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); 730 fp->lb0, fp->lt0, fp->lc0);
660 printk(KERN_EMERG "LB1: %08lx LT1: %08lx LC1: %08lx\n", 731 printk(KERN_NOTICE " LB1: %08lx LT1: %08lx LC1: %08lx\n",
661 fp->lb1, fp->lt1, fp->lc1); 732 fp->lb1, fp->lt1, fp->lc1);
662 printk(KERN_EMERG "B0: %08lx L0: %08lx M0: %08lx I0: %08lx\n", 733 printk(KERN_NOTICE " B0 : %08lx L0 : %08lx M0 : %08lx I0 : %08lx\n",
663 fp->b0, fp->l0, fp->m0, fp->i0); 734 fp->b0, fp->l0, fp->m0, fp->i0);
664 printk(KERN_EMERG "B1: %08lx L1: %08lx M1: %08lx I1: %08lx\n", 735 printk(KERN_NOTICE " B1 : %08lx L1 : %08lx M1 : %08lx I1 : %08lx\n",
665 fp->b1, fp->l1, fp->m1, fp->i1); 736 fp->b1, fp->l1, fp->m1, fp->i1);
666 printk(KERN_EMERG "B2: %08lx L2: %08lx M2: %08lx I2: %08lx\n", 737 printk(KERN_NOTICE " B2 : %08lx L2 : %08lx M2 : %08lx I2 : %08lx\n",
667 fp->b2, fp->l2, fp->m2, fp->i2); 738 fp->b2, fp->l2, fp->m2, fp->i2);
668 printk(KERN_EMERG "B3: %08lx L3: %08lx M3: %08lx I3: %08lx\n", 739 printk(KERN_NOTICE " B3 : %08lx L3 : %08lx M3 : %08lx I3 : %08lx\n",
669 fp->b3, fp->l3, fp->m3, fp->i3); 740 fp->b3, fp->l3, fp->m3, fp->i3);
741 printk(KERN_NOTICE "A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n",
742 fp->a0w, fp->a0x, fp->a1w, fp->a1x);
670 743
671 printk(KERN_EMERG "\n" KERN_EMERG "USP: %08lx ASTAT: %08lx\n", 744 printk(KERN_NOTICE "USP : %08lx ASTAT: %08lx\n",
672 rdusp(), fp->astat); 745 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 746
680 printk("\n\n"); 747 printk(KERN_NOTICE "\n");
681} 748}
682 749
683#ifdef CONFIG_SYS_BFIN_SPINLOCK_L1 750#ifdef CONFIG_SYS_BFIN_SPINLOCK_L1
@@ -752,9 +819,13 @@ void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
752 break; 819 break;
753 } 820 }
754 821
822 oops_in_progress = 1;
823
755 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR()); 824 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()); 825 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR());
757 dump_bfin_regs(fp, (void *)fp->retx); 826 dump_bfin_process(fp);
827 dump_bfin_mem((void *)fp->retx);
828 show_regs(fp);
758 dump_stack(); 829 dump_stack();
759 panic("Unrecoverable event\n"); 830 panic("Unrecoverable event\n");
760} 831}
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/lib/Makefile b/arch/blackfin/lib/Makefile
index bfdad52c570b..635288fc5f54 100644
--- a/arch/blackfin/lib/Makefile
+++ b/arch/blackfin/lib/Makefile
@@ -4,7 +4,7 @@
4 4
5lib-y := \ 5lib-y := \
6 ashldi3.o ashrdi3.o lshrdi3.o \ 6 ashldi3.o ashrdi3.o lshrdi3.o \
7 muldi3.o divsi3.o udivsi3.o udivdi3.o modsi3.o umodsi3.o \ 7 muldi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
8 checksum.o memcpy.o memset.o memcmp.o memchr.o memmove.o \ 8 checksum.o memcpy.o memset.o memcmp.o memchr.o memmove.o \
9 strcmp.o strcpy.o strncmp.o strncpy.o \ 9 strcmp.o strcpy.o strncmp.o strncpy.o \
10 umulsi3_highpart.o smulsi3_highpart.o \ 10 umulsi3_highpart.o smulsi3_highpart.o \
diff --git a/arch/blackfin/lib/ins.S b/arch/blackfin/lib/ins.S
index a17cc77ac36f..df7b8833a0c5 100644
--- a/arch/blackfin/lib/ins.S
+++ b/arch/blackfin/lib/ins.S
@@ -77,3 +77,22 @@ ENTRY(_insb)
77 sti R3; 77 sti R3;
78 RTS; 78 RTS;
79ENDPROC(_insb) 79ENDPROC(_insb)
80
81
82
83ENTRY(_insl_16)
84 P0 = R0; /* P0 = port */
85 cli R3;
86 P1 = R1; /* P1 = address */
87 P2 = R2; /* P2 = count */
88 SSYNC;
89 LSETUP( .Llong16_loop_s, .Llong16_loop_e) LC0 = P2;
90.Llong16_loop_s: R0 = [P0];
91 W[P1++] = R0;
92 R0 = R0 >> 16;
93 W[P1++] = R0;
94 NOP;
95.Llong16_loop_e: NOP;
96 sti R3;
97 RTS;
98ENDPROC(_insl_16)
diff --git a/arch/blackfin/lib/strcmp.c b/arch/blackfin/lib/strcmp.c
index 4eeefd86907f..fde39a1950ce 100644
--- a/arch/blackfin/lib/strcmp.c
+++ b/arch/blackfin/lib/strcmp.c
@@ -1,10 +1,19 @@
1#include <linux/types.h> 1/*
2 * Provide symbol in case str func is not inlined.
3 *
4 * Copyright (c) 2006-2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
2 8
3#define strcmp __inline_strcmp 9#define strcmp __inline_strcmp
4#include <asm/string.h> 10#include <asm/string.h>
5#undef strcmp 11#undef strcmp
6 12
13#include <linux/module.h>
14
7int strcmp(const char *dest, const char *src) 15int strcmp(const char *dest, const char *src)
8{ 16{
9 return __inline_strcmp(dest, src); 17 return __inline_strcmp(dest, src);
10} 18}
19EXPORT_SYMBOL(strcmp);
diff --git a/arch/blackfin/lib/strcpy.c b/arch/blackfin/lib/strcpy.c
index 534589db7256..2a8836b1f4d3 100644
--- a/arch/blackfin/lib/strcpy.c
+++ b/arch/blackfin/lib/strcpy.c
@@ -1,10 +1,19 @@
1#include <linux/types.h> 1/*
2 * Provide symbol in case str func is not inlined.
3 *
4 * Copyright (c) 2006-2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
2 8
3#define strcpy __inline_strcpy 9#define strcpy __inline_strcpy
4#include <asm/string.h> 10#include <asm/string.h>
5#undef strcpy 11#undef strcpy
6 12
13#include <linux/module.h>
14
7char *strcpy(char *dest, const char *src) 15char *strcpy(char *dest, const char *src)
8{ 16{
9 return __inline_strcpy(dest, src); 17 return __inline_strcpy(dest, src);
10} 18}
19EXPORT_SYMBOL(strcpy);
diff --git a/arch/blackfin/lib/strncmp.c b/arch/blackfin/lib/strncmp.c
index d791f120bff7..2aaae78a68e0 100644
--- a/arch/blackfin/lib/strncmp.c
+++ b/arch/blackfin/lib/strncmp.c
@@ -1,10 +1,19 @@
1#include <linux/types.h> 1/*
2 * Provide symbol in case str func is not inlined.
3 *
4 * Copyright (c) 2006-2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
2 8
3#define strncmp __inline_strncmp 9#define strncmp __inline_strncmp
4#include <asm/string.h> 10#include <asm/string.h>
5#undef strncmp 11#undef strncmp
6 12
13#include <linux/module.h>
14
7int strncmp(const char *cs, const char *ct, size_t count) 15int strncmp(const char *cs, const char *ct, size_t count)
8{ 16{
9 return __inline_strncmp(cs, ct, count); 17 return __inline_strncmp(cs, ct, count);
10} 18}
19EXPORT_SYMBOL(strncmp);
diff --git a/arch/blackfin/lib/strncpy.c b/arch/blackfin/lib/strncpy.c
index 1fecb5c71ffb..ea1dc6bf2373 100644
--- a/arch/blackfin/lib/strncpy.c
+++ b/arch/blackfin/lib/strncpy.c
@@ -1,10 +1,19 @@
1#include <linux/types.h> 1/*
2 * Provide symbol in case str func is not inlined.
3 *
4 * Copyright (c) 2006-2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
2 8
3#define strncpy __inline_strncpy 9#define strncpy __inline_strncpy
4#include <asm/string.h> 10#include <asm/string.h>
5#undef strncpy 11#undef strncpy
6 12
13#include <linux/module.h>
14
7char *strncpy(char *dest, const char *src, size_t n) 15char *strncpy(char *dest, const char *src, size_t n)
8{ 16{
9 return __inline_strncpy(dest, src, n); 17 return __inline_strncpy(dest, src, n);
10} 18}
19EXPORT_SYMBOL(strncpy);
diff --git a/arch/blackfin/lib/udivdi3.S b/arch/blackfin/lib/udivdi3.S
deleted file mode 100644
index ad1ebee675e1..000000000000
--- a/arch/blackfin/lib/udivdi3.S
+++ /dev/null
@@ -1,375 +0,0 @@
1/*
2 * udivdi3.S - unsigned long long division
3 *
4 * Copyright 2003-2007 Analog Devices Inc.
5 * Enter bugs at http://blackfin.uclinux.org/
6 *
7 * Licensed under the GPLv2 or later.
8 */
9
10#include <linux/linkage.h>
11
12#define CARRY AC0
13
14#ifdef CONFIG_ARITHMETIC_OPS_L1
15.section .l1.text
16#else
17.text
18#endif
19
20
21ENTRY(___udivdi3)
22 R3 = [SP + 12];
23 [--SP] = (R7:4, P5:3);
24
25 /* Attempt to use divide primitive first; these will handle
26 ** most cases, and they're quick - avoids stalls incurred by
27 ** testing for identities.
28 */
29
30 R4 = R2 | R3;
31 CC = R4 == 0;
32 IF CC JUMP .LDIV_BY_ZERO;
33
34 R4.H = 0x8000;
35 R4 >>>= 16; // R4 now 0xFFFF8000
36 R5 = R0 | R2; // If either dividend or
37 R4 = R5 & R4; // divisor have bits in
38 CC = R4; // top half or low half's sign
39 IF CC JUMP .LIDENTS; // bit, skip builtins.
40 R4 = R1 | R3; // Also check top halves
41 CC = R4;
42 IF CC JUMP .LIDENTS;
43
44 /* Can use the builtins. */
45
46 AQ = CC; // Clear AQ (CC==0)
47 DIVQ(R0, R2);
48 DIVQ(R0, R2);
49 DIVQ(R0, R2);
50 DIVQ(R0, R2);
51 DIVQ(R0, R2);
52 DIVQ(R0, R2);
53 DIVQ(R0, R2);
54 DIVQ(R0, R2);
55 DIVQ(R0, R2);
56 DIVQ(R0, R2);
57 DIVQ(R0, R2);
58 DIVQ(R0, R2);
59 DIVQ(R0, R2);
60 DIVQ(R0, R2);
61 DIVQ(R0, R2);
62 DIVQ(R0, R2);
63 DIVQ(R0, R2);
64 R0 = R0.L (Z);
65 R1 = 0;
66 (R7:4, P5:3) = [SP++];
67 RTS;
68
69.LIDENTS:
70 /* Test for common identities. Value to be returned is
71 ** placed in R6,R7.
72 */
73 // Check for 0/y, return 0
74 R4 = R0 | R1;
75 CC = R4 == 0;
76 IF CC JUMP .LRETURN_R0;
77
78 // Check for x/x, return 1
79 R6 = R0 - R2; // If x == y, then both R6 and R7 will be zero
80 R7 = R1 - R3;
81 R4 = R6 | R7; // making R4 zero.
82 R6 += 1; // which would now make R6:R7==1.
83 CC = R4 == 0;
84 IF CC JUMP .LRETURN_IDENT;
85
86 // Check for x/1, return x
87 R6 = R0;
88 R7 = R1;
89 CC = R3 == 0;
90 IF !CC JUMP .Lnexttest;
91 CC = R2 == 1;
92 IF CC JUMP .LRETURN_IDENT;
93
94.Lnexttest:
95 R4.L = ONES R2; // check for div by power of two which
96 R5.L = ONES R3; // can be done using a shift
97 R6 = PACK (R5.L, R4.L);
98 CC = R6 == 1;
99 IF CC JUMP .Lpower_of_two_upper_zero;
100 R6 = PACK (R4.L, R5.L);
101 CC = R6 == 1;
102 IF CC JUMP .Lpower_of_two_lower_zero;
103
104 // Check for x < y, return 0
105 R6 = 0;
106 R7 = R6;
107 CC = R1 < R3 (IU);
108 IF CC JUMP .LRETURN_IDENT;
109 CC = R1 == R3;
110 IF !CC JUMP .Lno_idents;
111 CC = R0 < R2 (IU);
112 IF CC JUMP .LRETURN_IDENT;
113
114.Lno_idents: // Idents don't match. Go for the full operation
115
116
117 // If X, or X and Y have high bit set, it'll affect the
118 // results, so shift right one to stop this. Note: we've already
119 // checked that X >= Y, so Y's msb won't be set unless X's
120 // is.
121
122 R4 = 0;
123 CC = R1 < 0;
124 IF !CC JUMP .Lx_msb_clear;
125 CC = !CC; // 1 -> 0;
126 R1 = ROT R1 BY -1; // Shift X >> 1
127 R0 = ROT R0 BY -1; // lsb -> CC
128 BITSET(R4,31); // to record only x msb was set
129 CC = R3 < 0;
130 IF !CC JUMP .Ly_msb_clear;
131 CC = !CC;
132 R3 = ROT R3 BY -1; // Shift Y >> 1
133 R2 = ROT R2 BY -1;
134 BITCLR(R4,31); // clear bit to record only x msb was set
135
136.Ly_msb_clear:
137.Lx_msb_clear:
138 // Bit 31 in R4 indicates X msb set, but Y msb wasn't, and no bits
139 // were lost, so we should shift result left by one.
140
141 [--SP] = R4; // save for later
142
143 // In the loop that follows, each iteration we add
144 // either Y' or -Y' to the Remainder. We compute the
145 // negated Y', and store, for convenience. Y' goes
146 // into P0:P1, while -Y' goes into P2:P3.
147
148 P0 = R2;
149 P1 = R3;
150 R2 = -R2;
151 CC = CARRY;
152 CC = !CC;
153 R4 = CC;
154 R3 = -R3;
155 R3 = R3 - R4;
156
157 R6 = 0; // remainder = 0
158 R7 = R6;
159
160 [--SP] = R2; P2 = SP;
161 [--SP] = R3; P3 = SP;
162 [--SP] = R6; P5 = SP; // AQ = 0
163 [--SP] = P1;
164
165 /* In the loop that follows, we use the following
166 ** register assignments:
167 ** R0,R1 X, workspace
168 ** R2,R3 Y, workspace
169 ** R4,R5 partial Div
170 ** R6,R7 partial remainder
171 ** P5 AQ
172 ** The remainder and div form a 128-bit number, with
173 ** the remainder in the high 64-bits.
174 */
175 R4 = R0; // Div = X'
176 R5 = R1;
177 R3 = 0;
178
179 P4 = 64; // Iterate once per bit
180 LSETUP(.LULST,.LULEND) LC0 = P4;
181.LULST:
182 /* Shift Div and remainder up by one. The bit shifted
183 ** out of the top of the quotient is shifted into the bottom
184 ** of the remainder.
185 */
186 CC = R3;
187 R4 = ROT R4 BY 1;
188 R5 = ROT R5 BY 1 || // low q to high q
189 R2 = [P5]; // load saved AQ
190 R6 = ROT R6 BY 1 || // high q to low r
191 R0 = [P2]; // load -Y'
192 R7 = ROT R7 BY 1 || // low r to high r
193 R1 = [P3];
194
195 // Assume add -Y'
196 CC = R2 < 0; // But if AQ is set...
197 IF CC R0 = P0; // then add Y' instead
198 IF CC R1 = P1;
199
200 R6 = R6 + R0; // Rem += (Y' or -Y')
201 CC = CARRY;
202 R0 = CC;
203 R7 = R7 + R1;
204 R7 = R7 + R0 (NS) ||
205 R1 = [SP];
206 // Set the next AQ bit
207 R1 = R7 ^ R1; // from Remainder and Y'
208 R1 = R1 >> 31 || // Negate AQ's value, and
209 [P5] = R1; // save next AQ
210 BITTGL(R1, 0); // add neg AQ to the Div
211.LULEND: R4 = R4 + R1;
212
213 R6 = [SP + 16];
214
215 R0 = R4;
216 R1 = R5;
217 CC = BITTST(R6,30); // Just set CC=0
218 R4 = ROT R0 BY 1; // but if we had to shift X,
219 R5 = ROT R1 BY 1; // and didn't shift any bits out,
220 CC = BITTST(R6,31); // then the result will be half as
221 IF CC R0 = R4; // much as required, so shift left
222 IF CC R1 = R5; // one space.
223
224 SP += 20;
225 (R7:4, P5:3) = [SP++];
226 RTS;
227
228.Lpower_of_two:
229 /* Y has a single bit set, which means it's a power of two.
230 ** That means we can perform the division just by shifting
231 ** X to the right the appropriate number of bits
232 */
233
234 /* signbits returns the number of sign bits, minus one.
235 ** 1=>30, 2=>29, ..., 0x40000000=>0. Which means we need
236 ** to shift right n-signbits spaces. It also means 0x80000000
237 ** is a special case, because that *also* gives a signbits of 0
238 */
239.Lpower_of_two_lower_zero:
240 R7 = 0;
241 R6 = R1 >> 31;
242 CC = R3 < 0;
243 IF CC JUMP .LRETURN_IDENT;
244
245 R2.L = SIGNBITS R3;
246 R2 = R2.L (Z);
247 R2 += -62;
248 (R7:4, P5:3) = [SP++];
249 JUMP ___lshftli;
250
251.Lpower_of_two_upper_zero:
252 CC = R2 < 0;
253 IF CC JUMP .Lmaxint_shift;
254
255 R2.L = SIGNBITS R2;
256 R2 = R2.L (Z);
257 R2 += -30;
258 (R7:4, P5:3) = [SP++];
259 JUMP ___lshftli;
260
261.Lmaxint_shift:
262 R2 = -31;
263 (R7:4, P5:3) = [SP++];
264 JUMP ___lshftli;
265
266.LRETURN_IDENT:
267 R0 = R6;
268 R1 = R7;
269.LRETURN_R0:
270 (R7:4, P5:3) = [SP++];
271 RTS;
272.LDIV_BY_ZERO:
273 R0 = ~R2;
274 R1 = R0;
275 (R7:4, P5:3) = [SP++];
276 RTS;
277
278ENDPROC(___udivdi3)
279
280
281ENTRY(___lshftli)
282 CC = R2 == 0;
283 IF CC JUMP .Lfinished; // nothing to do
284 CC = R2 < 0;
285 IF CC JUMP .Lrshift;
286 R3 = 64;
287 CC = R2 < R3;
288 IF !CC JUMP .Lretzero;
289
290 // We're shifting left, and it's less than 64 bits, so
291 // a valid result will be returned.
292
293 R3 >>= 1; // R3 now 32
294 CC = R2 < R3;
295
296 IF !CC JUMP .Lzerohalf;
297
298 // We're shifting left, between 1 and 31 bits, which means
299 // some of the low half will be shifted into the high half.
300 // Work out how much.
301
302 R3 = R3 - R2;
303
304 // Save that much data from the bottom half.
305
306 P1 = R7;
307 R7 = R0;
308 R7 >>= R3;
309
310 // Adjust both parts of the parameter.
311
312 R0 <<= R2;
313 R1 <<= R2;
314
315 // And include the bits moved across.
316
317 R1 = R1 | R7;
318 R7 = P1;
319 RTS;
320
321.Lzerohalf:
322 // We're shifting left, between 32 and 63 bits, so the
323 // bottom half will become zero, and the top half will
324 // lose some bits. How many?
325
326 R2 = R2 - R3; // N - 32
327 R1 = LSHIFT R0 BY R2.L;
328 R0 = R0 - R0;
329 RTS;
330
331.Lretzero:
332 R0 = R0 - R0;
333 R1 = R0;
334.Lfinished:
335 RTS;
336
337.Lrshift:
338 // We're shifting right, but by how much?
339 R2 = -R2;
340 R3 = 64;
341 CC = R2 < R3;
342 IF !CC JUMP .Lretzero;
343
344 // Shifting right less than 64 bits, so some result bits will
345 // be retained.
346
347 R3 >>= 1; // R3 now 32
348 CC = R2 < R3;
349 IF !CC JUMP .Lsignhalf;
350
351 // Shifting right between 1 and 31 bits, so need to copy
352 // data across words.
353
354 P1 = R7;
355 R3 = R3 - R2;
356 R7 = R1;
357 R7 <<= R3;
358 R1 >>= R2;
359 R0 >>= R2;
360 R0 = R7 | R0;
361 R7 = P1;
362 RTS;
363
364.Lsignhalf:
365 // Shifting right between 32 and 63 bits, so the top half
366 // will become all zero-bits, and the bottom half is some
367 // of the top half. But how much?
368
369 R2 = R2 - R3;
370 R0 = R1;
371 R0 >>= R2;
372 R1 = 0;
373 RTS;
374
375ENDPROC(___lshftli)
diff --git a/arch/blackfin/mach-bf527/Kconfig b/arch/blackfin/mach-bf527/Kconfig
index 50321f723dee..5c736837d4bf 100644
--- a/arch/blackfin/mach-bf527/Kconfig
+++ b/arch/blackfin/mach-bf527/Kconfig
@@ -1,5 +1,7 @@
1if (BF52x) 1if (BF52x)
2 2
3source "arch/blackfin/mach-bf527/boards/Kconfig"
4
3menu "BF527 Specific Configuration" 5menu "BF527 Specific Configuration"
4 6
5comment "Alternative Multiplexing Scheme" 7comment "Alternative Multiplexing Scheme"
diff --git a/arch/blackfin/mach-bf527/boards/Kconfig b/arch/blackfin/mach-bf527/boards/Kconfig
new file mode 100644
index 000000000000..6a570ad03746
--- /dev/null
+++ b/arch/blackfin/mach-bf527/boards/Kconfig
@@ -0,0 +1,12 @@
1choice
2 prompt "System type"
3 default BFIN527_EZKIT
4 help
5 Select your board!
6
7config BFIN527_EZKIT
8 bool "BF527-EZKIT"
9 help
10 BF527-EZKIT-LITE board support.
11
12endchoice
diff --git a/arch/blackfin/mach-bf527/boards/Makefile b/arch/blackfin/mach-bf527/boards/Makefile
index 912ac8ebc889..7277d35ef111 100644
--- a/arch/blackfin/mach-bf527/boards/Makefile
+++ b/arch/blackfin/mach-bf527/boards/Makefile
@@ -1,7 +1,5 @@
1# 1#
2# arch/blackfin/mach-bf532/boards/Makefile 2# arch/blackfin/mach-bf527/boards/Makefile
3# 3#
4 4
5obj-y += eth_mac.o 5obj-$(CONFIG_BFIN527_EZKIT) += ezkit.o
6obj-$(CONFIG_BFIN527_EZKIT) += ezkit.o
7
diff --git a/arch/blackfin/mach-bf527/boards/eth_mac.c b/arch/blackfin/mach-bf527/boards/eth_mac.c
deleted file mode 100644
index a725cc8a9290..000000000000
--- a/arch/blackfin/mach-bf527/boards/eth_mac.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/blackfin/mach-bf537/board/eth_mac.c
3 *
4 * Copyright (C) 2007 Analog Devices, Inc.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/module.h>
21#include <asm/blackfin.h>
22
23#if defined(CONFIG_GENERIC_BOARD) || defined(CONFIG_BFIN537_STAMP)
24
25/*
26 * Currently the MAC address is saved in Flash by U-Boot
27 */
28#define FLASH_MAC 0x203f0000
29
30void get_bf537_ether_addr(char *addr)
31{
32 unsigned int flash_mac = (unsigned int) FLASH_MAC;
33 *(u32 *)(&(addr[0])) = bfin_read32(flash_mac);
34 flash_mac += 4;
35 *(u16 *)(&(addr[4])) = bfin_read16(flash_mac);
36}
37
38#else
39
40/*
41 * Provide MAC address function for other specific board setting
42 */
43void get_bf537_ether_addr(char *addr)
44{
45 printk(KERN_WARNING "%s: No valid Ethernet MAC address found\n", __FILE__);
46}
47
48#endif
49
50EXPORT_SYMBOL(get_bf537_ether_addr);
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 3e884f3a8182..003e2ac654d8 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -35,15 +35,18 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
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>
49#include <asm/portmux.h>
47#include <linux/spi/ad7877.h> 50#include <linux/spi/ad7877.h>
48 51
49/* 52/*
@@ -102,6 +105,53 @@ void __exit bfin_isp1761_exit(void)
102arch_initcall(bfin_isp1761_init); 105arch_initcall(bfin_isp1761_init);
103#endif 106#endif
104 107
108#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
109static struct mtd_partition partition_info[] = {
110 {
111 .name = "Linux Kernel",
112 .offset = 0,
113 .size = 4 * SIZE_1M,
114 },
115 {
116 .name = "File System",
117 .offset = 4 * SIZE_1M,
118 .size = (256 - 4) * SIZE_1M,
119 },
120};
121
122static struct bf5xx_nand_platform bf5xx_nand_platform = {
123 .page_size = NFC_PG_SIZE_256,
124 .data_width = NFC_NWIDTH_8,
125 .partitions = partition_info,
126 .nr_partitions = ARRAY_SIZE(partition_info),
127 .rd_dly = 3,
128 .wr_dly = 3,
129};
130
131static struct resource bf5xx_nand_resources[] = {
132 {
133 .start = NFC_CTL,
134 .end = NFC_DATA_RD + 2,
135 .flags = IORESOURCE_MEM,
136 },
137 {
138 .start = CH_NFC,
139 .end = CH_NFC,
140 .flags = IORESOURCE_IRQ,
141 },
142};
143
144static struct platform_device bf5xx_nand_device = {
145 .name = "bf5xx-nand",
146 .id = 0,
147 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
148 .resource = bf5xx_nand_resources,
149 .dev = {
150 .platform_data = &bf5xx_nand_platform,
151 },
152};
153#endif
154
105#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 155#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
106static struct resource bfin_pcmcia_cf_resources[] = { 156static struct resource bfin_pcmcia_cf_resources[] = {
107 { 157 {
@@ -401,6 +451,13 @@ static const struct ad7877_platform_data bfin_ad7877_ts_info = {
401}; 451};
402#endif 452#endif
403 453
454#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
455 && defined(CONFIG_SND_SOC_WM8731_SPI)
456static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
457 .enable_dma = 0,
458 .bits_per_word = 16,
459};
460#endif
404static struct spi_board_info bfin_spi_board_info[] __initdata = { 461static struct spi_board_info bfin_spi_board_info[] __initdata = {
405#if defined(CONFIG_MTD_M25P80) \ 462#if defined(CONFIG_MTD_M25P80) \
406 || defined(CONFIG_MTD_M25P80_MODULE) 463 || defined(CONFIG_MTD_M25P80_MODULE)
@@ -502,17 +559,29 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
502 .platform_data = &bfin_ad7877_ts_info, 559 .platform_data = &bfin_ad7877_ts_info,
503 .irq = IRQ_PF6, 560 .irq = IRQ_PF6,
504 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 561 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
505 .bus_num = 1, 562 .bus_num = 0,
506 .chip_select = 1, 563 .chip_select = 1,
507 .controller_data = &spi_ad7877_chip_info, 564 .controller_data = &spi_ad7877_chip_info,
508 }, 565 },
509#endif 566#endif
567#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
568 && defined(CONFIG_SND_SOC_WM8731_SPI)
569 {
570 .modalias = "wm8731",
571 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
572 .bus_num = 0,
573 .chip_select = 5,
574 .controller_data = &spi_wm8731_chip_info,
575 .mode = SPI_MODE_0,
576 },
577#endif
510}; 578};
511 579
512/* SPI controller data */ 580/* SPI controller data */
513static struct bfin5xx_spi_master bfin_spi0_info = { 581static struct bfin5xx_spi_master bfin_spi0_info = {
514 .num_chipselect = 8, 582 .num_chipselect = 8,
515 .enable_dma = 1, /* master has the ability to do dma transfer */ 583 .enable_dma = 1, /* master has the ability to do dma transfer */
584 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
516}; 585};
517 586
518/* SPI (0) */ 587/* SPI (0) */
@@ -650,6 +719,10 @@ static struct platform_device bfin_pata_device = {
650#endif 719#endif
651 720
652static struct platform_device *stamp_devices[] __initdata = { 721static struct platform_device *stamp_devices[] __initdata = {
722#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
723 &bf5xx_nand_device,
724#endif
725
653#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 726#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
654 &bfin_pcmcia_cf_device, 727 &bfin_pcmcia_cf_device,
655#endif 728#endif
@@ -735,3 +808,14 @@ void native_machine_restart(char *cmd)
735 if ((bfin_read_SYSCR() & 0x7) == 0x3) 808 if ((bfin_read_SYSCR() & 0x7) == 0x3)
736 bfin_gpio_reset_spi0_ssel1(); 809 bfin_gpio_reset_spi0_ssel1();
737} 810}
811
812/*
813 * Currently the MAC address is saved in Flash by U-Boot
814 */
815#define FLASH_MAC 0x203f0000
816void bfin_get_ether_addr(char *addr)
817{
818 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
819 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
820}
821EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf533/Kconfig b/arch/blackfin/mach-bf533/Kconfig
index 14297b3ed5c3..76beb75f12da 100644
--- a/arch/blackfin/mach-bf533/Kconfig
+++ b/arch/blackfin/mach-bf533/Kconfig
@@ -1,5 +1,7 @@
1if (BF533 || BF532 || BF531) 1if (BF533 || BF532 || BF531)
2 2
3source "arch/blackfin/mach-bf533/boards/Kconfig"
4
3menu "BF533/2/1 Specific Configuration" 5menu "BF533/2/1 Specific Configuration"
4 6
5comment "Interrupt Priority Assignment" 7comment "Interrupt Priority Assignment"
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
new file mode 100644
index 000000000000..6bcf4047f89c
--- /dev/null
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -0,0 +1,343 @@
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#include <asm/portmux.h>
47
48/*
49 * Name the Board for the /proc/cpuinfo
50 */
51const char bfin_board_name[] = "HV Sistemas H8606";
52
53#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
54static struct platform_device rtc_device = {
55 .name = "rtc-bfin",
56 .id = -1,
57};
58#endif
59
60/*
61* Driver needs to know address, irq and flag pin.
62 */
63 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
64static struct resource dm9000_resources[] = {
65 [0] = {
66 .start = 0x20300000,
67 .end = 0x20300000 + 8,
68 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
71 .start = IRQ_PF10,
72 .end = IRQ_PF10,
73 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
74 },
75};
76
77static struct platform_device dm9000_device = {
78 .id = 0,
79 .name = "dm9000",
80 .resource = dm9000_resources,
81 .num_resources = ARRAY_SIZE(dm9000_resources),
82};
83#endif
84
85#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
86static struct resource smc91x_resources[] = {
87 {
88 .name = "smc91x-regs",
89 .start = 0x20300300,
90 .end = 0x20300300 + 16,
91 .flags = IORESOURCE_MEM,
92 }, {
93 .start = IRQ_PROG_INTB,
94 .end = IRQ_PROG_INTB,
95 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
96 }, {
97 .start = IRQ_PF7,
98 .end = IRQ_PF7,
99 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
100 },
101};
102
103static struct platform_device smc91x_device = {
104 .name = "smc91x",
105 .id = 0,
106 .num_resources = ARRAY_SIZE(smc91x_resources),
107 .resource = smc91x_resources,
108};
109#endif
110
111#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
112static struct resource net2272_bfin_resources[] = {
113 {
114 .start = 0x20300000,
115 .end = 0x20300000 + 0x100,
116 .flags = IORESOURCE_MEM,
117 }, {
118 .start = IRQ_PF10,
119 .end = IRQ_PF10,
120 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
121 },
122};
123
124static struct platform_device net2272_bfin_device = {
125 .name = "net2272",
126 .id = -1,
127 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
128 .resource = net2272_bfin_resources,
129};
130#endif
131
132#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
133/* all SPI peripherals info goes here */
134
135#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
136static struct mtd_partition bfin_spi_flash_partitions[] = {
137 {
138 .name = "bootloader",
139 .size = 0x00060000,
140 .offset = 0,
141 .mask_flags = MTD_CAP_ROM
142 }, {
143 .name = "kernel",
144 .size = 0x100000,
145 .offset = 0x60000
146 }, {
147 .name = "file system",
148 .size = 0x6a0000,
149 .offset = 0x00160000,
150 }
151};
152
153static struct flash_platform_data bfin_spi_flash_data = {
154 .name = "m25p80",
155 .parts = bfin_spi_flash_partitions,
156 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
157 .type = "m25p64",
158};
159
160/* SPI flash chip (m25p64) */
161static struct bfin5xx_spi_chip spi_flash_chip_info = {
162 .enable_dma = 0, /* use dma transfer with this chip*/
163 .bits_per_word = 8,
164};
165#endif
166
167#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
168/* SPI ADC chip */
169static struct bfin5xx_spi_chip spi_adc_chip_info = {
170 .ctl_reg = 0x1000,
171 .enable_dma = 1, /* use dma transfer with this chip*/
172 .bits_per_word = 16,
173};
174#endif
175
176#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
177static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
178 .ctl_reg = 0x1000,
179 .enable_dma = 0,
180 .bits_per_word = 16,
181};
182#endif
183
184#if defined(CONFIG_PBX)
185static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
186 .ctl_reg = 0x1c04,
187 .enable_dma = 0,
188 .bits_per_word = 8,
189 .cs_change_per_word = 1,
190};
191#endif
192
193/* Notice: for blackfin, the speed_hz is the value of register
194 * SPI_BAUD, not the real baudrate */
195static struct spi_board_info bfin_spi_board_info[] __initdata = {
196#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
197 {
198 /* the modalias must be the same as spi device driver name */
199 .modalias = "m25p80", /* Name of spi_driver for this device */
200 /* this value is the baudrate divisor */
201 .max_speed_hz = 50000000, /* actual baudrate is SCLK/(2xspeed_hz) */
202 .bus_num = 0, /* Framework bus number */
203 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
204 .platform_data = &bfin_spi_flash_data,
205 .controller_data = &spi_flash_chip_info,
206 .mode = SPI_MODE_3,
207 },
208#endif
209
210#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
211 {
212 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
213 .max_speed_hz = 4, /* actual baudrate is SCLK/(2xspeed_hz) */
214 .bus_num = 1, /* Framework bus number */
215 .chip_select = 1, /* Framework chip select. */
216 .platform_data = NULL, /* No spi_driver specific config */
217 .controller_data = &spi_adc_chip_info,
218 },
219#endif
220
221#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
222 {
223 .modalias = "ad1836-spi",
224 .max_speed_hz = 16,
225 .bus_num = 1,
226 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
227 .controller_data = &ad1836_spi_chip_info,
228 },
229#endif
230
231#if defined(CONFIG_PBX)
232 {
233 .modalias = "fxs-spi",
234 .max_speed_hz = 4,
235 .bus_num = 1,
236 .chip_select = 3,
237 .controller_data = &spi_si3xxx_chip_info,
238 },
239
240 {
241 .modalias = "fxo-spi",
242 .max_speed_hz = 4,
243 .bus_num = 1,
244 .chip_select = 2,
245 .controller_data = &spi_si3xxx_chip_info,
246 },
247#endif
248};
249
250/* SPI (0) */
251static struct resource bfin_spi0_resource[] = {
252 [0] = {
253 .start = SPI0_REGBASE,
254 .end = SPI0_REGBASE + 0xFF,
255 .flags = IORESOURCE_MEM,
256 },
257 [1] = {
258 .start = CH_SPI,
259 .end = CH_SPI,
260 .flags = IORESOURCE_IRQ,
261 }
262};
263
264
265/* SPI controller data */
266static struct bfin5xx_spi_master bfin_spi0_info = {
267 .num_chipselect = 8,
268 .enable_dma = 1, /* master has the ability to do dma transfer */
269 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
270};
271
272static struct platform_device bfin_spi0_device = {
273 .name = "bfin-spi",
274 .id = 0, /* Bus number */
275 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
276 .resource = bfin_spi0_resource,
277 .dev = {
278 .platform_data = &bfin_spi0_info, /* Passed to driver */
279 },
280};
281#endif /* spi master and devices */
282
283#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
284static struct platform_device bfin_fb_device = {
285 .name = "bf537-fb",
286};
287#endif
288
289#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
290static struct resource bfin_uart_resources[] = {
291 {
292 .start = 0xFFC00400,
293 .end = 0xFFC004FF,
294 .flags = IORESOURCE_MEM,
295 },
296};
297
298static struct platform_device bfin_uart_device = {
299 .name = "bfin-uart",
300 .id = 1,
301 .num_resources = ARRAY_SIZE(bfin_uart_resources),
302 .resource = bfin_uart_resources,
303};
304#endif
305
306static struct platform_device *stamp_devices[] __initdata = {
307#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
308 &rtc_device,
309#endif
310
311#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
312 &dm9000_device,
313#endif
314
315#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
316 &smc91x_device,
317#endif
318
319#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
320 &net2272_bfin_device,
321#endif
322
323#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
324 &bfin_spi0_device,
325#endif
326
327#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
328 &bfin_uart_device,
329#endif
330};
331
332static int __init H8606_init(void)
333{
334 printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n");
335 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
336 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
337#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
338 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
339#endif
340 return 0;
341}
342
343arch_initcall(H8606_init);
diff --git a/arch/blackfin/mach-bf533/boards/Kconfig b/arch/blackfin/mach-bf533/boards/Kconfig
new file mode 100644
index 000000000000..751de5110afc
--- /dev/null
+++ b/arch/blackfin/mach-bf533/boards/Kconfig
@@ -0,0 +1,34 @@
1choice
2 prompt "System type"
3 default BFIN533_STAMP
4 help
5 Select your board!
6
7config BFIN533_EZKIT
8 bool "BF533-EZKIT"
9 help
10 BF533-EZKIT-LITE board support.
11
12config BFIN533_STAMP
13 bool "BF533-STAMP"
14 help
15 BF533-STAMP board support.
16
17config BFIN533_BLUETECHNIX_CM
18 bool "Bluetechnix CM-BF533"
19 depends on (BF533)
20 help
21 CM-BF533 support for EVAL- and DEV-Board.
22
23config H8606_HVSISTEMAS
24 bool "HV Sistemas H8606"
25 depends on (BF532)
26 help
27 HV Sistemas H8606 board support.
28
29config GENERIC_BF533_BOARD
30 bool "Generic"
31 help
32 Generic or Custom board support.
33
34endchoice
diff --git a/arch/blackfin/mach-bf533/boards/Makefile b/arch/blackfin/mach-bf533/boards/Makefile
index 12a631ab389d..54f57fb9791e 100644
--- a/arch/blackfin/mach-bf533/boards/Makefile
+++ b/arch/blackfin/mach-bf533/boards/Makefile
@@ -2,7 +2,8 @@
2# arch/blackfin/mach-bf533/boards/Makefile 2# arch/blackfin/mach-bf533/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_GENERIC_BOARD) += generic_board.o 5obj-$(CONFIG_GENERIC_BF533_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..21df2f375497 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -33,11 +33,12 @@
33#include <linux/mtd/partitions.h> 33#include <linux/mtd/partitions.h>
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/flash.h> 35#include <linux/spi/flash.h>
36#include <linux/usb_isp1362.h> 36#include <linux/usb/isp1362.h>
37#include <linux/pata_platform.h> 37#include <linux/pata_platform.h>
38#include <linux/irq.h> 38#include <linux/irq.h>
39#include <asm/dma.h> 39#include <asm/dma.h>
40#include <asm/bfin5xx_spi.h> 40#include <asm/bfin5xx_spi.h>
41#include <asm/portmux.h>
41 42
42/* 43/*
43 * Name the Board for the /proc/cpuinfo 44 * Name the Board for the /proc/cpuinfo
@@ -46,7 +47,7 @@ const char bfin_board_name[] = "Bluetechnix CM BF533";
46 47
47#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 48#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
48/* all SPI peripherals info goes here */ 49/* all SPI peripherals info goes here */
49 50#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
50static struct mtd_partition bfin_spi_flash_partitions[] = { 51static struct mtd_partition bfin_spi_flash_partitions[] = {
51 { 52 {
52 .name = "bootloader", 53 .name = "bootloader",
@@ -76,12 +77,15 @@ static struct bfin5xx_spi_chip spi_flash_chip_info = {
76 .enable_dma = 0, /* use dma transfer with this chip*/ 77 .enable_dma = 0, /* use dma transfer with this chip*/
77 .bits_per_word = 8, 78 .bits_per_word = 8,
78}; 79};
80#endif
79 81
80/* SPI ADC chip */ 82/* SPI ADC chip */
83#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
81static struct bfin5xx_spi_chip spi_adc_chip_info = { 84static struct bfin5xx_spi_chip spi_adc_chip_info = {
82 .enable_dma = 1, /* use dma transfer with this chip*/ 85 .enable_dma = 1, /* use dma transfer with this chip*/
83 .bits_per_word = 16, 86 .bits_per_word = 16,
84}; 87};
88#endif
85 89
86#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) 90#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
87static struct bfin5xx_spi_chip ad1836_spi_chip_info = { 91static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
@@ -90,7 +94,15 @@ static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
90}; 94};
91#endif 95#endif
92 96
97#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
98static struct bfin5xx_spi_chip spi_mmc_chip_info = {
99 .enable_dma = 1,
100 .bits_per_word = 8,
101};
102#endif
103
93static struct spi_board_info bfin_spi_board_info[] __initdata = { 104static struct spi_board_info bfin_spi_board_info[] __initdata = {
105#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
94 { 106 {
95 /* the modalias must be the same as spi device driver name */ 107 /* the modalias must be the same as spi device driver name */
96 .modalias = "m25p80", /* Name of spi_driver for this device */ 108 .modalias = "m25p80", /* Name of spi_driver for this device */
@@ -100,7 +112,11 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
100 .platform_data = &bfin_spi_flash_data, 112 .platform_data = &bfin_spi_flash_data,
101 .controller_data = &spi_flash_chip_info, 113 .controller_data = &spi_flash_chip_info,
102 .mode = SPI_MODE_3, 114 .mode = SPI_MODE_3,
103 }, { 115 },
116#endif
117
118#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
119 {
104 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ 120 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
105 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ 121 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
106 .bus_num = 0, /* Framework bus number */ 122 .bus_num = 0, /* Framework bus number */
@@ -108,6 +124,8 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
108 .platform_data = NULL, /* No spi_driver specific config */ 124 .platform_data = NULL, /* No spi_driver specific config */
109 .controller_data = &spi_adc_chip_info, 125 .controller_data = &spi_adc_chip_info,
110 }, 126 },
127#endif
128
111#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) 129#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
112 { 130 {
113 .modalias = "ad1836-spi", 131 .modalias = "ad1836-spi",
@@ -117,6 +135,27 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
117 .controller_data = &ad1836_spi_chip_info, 135 .controller_data = &ad1836_spi_chip_info,
118 }, 136 },
119#endif 137#endif
138
139#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
140 {
141 .modalias = "spi_mmc_dummy",
142 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
143 .bus_num = 0,
144 .chip_select = 0,
145 .platform_data = NULL,
146 .controller_data = &spi_mmc_chip_info,
147 .mode = SPI_MODE_3,
148 },
149 {
150 .modalias = "spi_mmc",
151 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
152 .bus_num = 0,
153 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
154 .platform_data = NULL,
155 .controller_data = &spi_mmc_chip_info,
156 .mode = SPI_MODE_3,
157 },
158#endif
120}; 159};
121 160
122/* SPI (0) */ 161/* SPI (0) */
@@ -137,6 +176,7 @@ static struct resource bfin_spi0_resource[] = {
137static struct bfin5xx_spi_master bfin_spi0_info = { 176static struct bfin5xx_spi_master bfin_spi0_info = {
138 .num_chipselect = 8, 177 .num_chipselect = 8,
139 .enable_dma = 1, /* master has the ability to do dma transfer */ 178 .enable_dma = 1, /* master has the ability to do dma transfer */
179 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
140}; 180};
141 181
142static struct platform_device bfin_spi0_device = { 182static struct platform_device bfin_spi0_device = {
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index 34b63920e272..be852034a68b 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -34,11 +34,12 @@
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#include <linux/usb_isp1362.h> 37#include <linux/usb/isp1362.h>
38#include <linux/pata_platform.h> 38#include <linux/pata_platform.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <asm/dma.h> 40#include <asm/dma.h>
41#include <asm/bfin5xx_spi.h> 41#include <asm/bfin5xx_spi.h>
42#include <asm/portmux.h>
42 43
43/* 44/*
44 * Name the Board for the /proc/cpuinfo 45 * Name the Board for the /proc/cpuinfo
@@ -187,6 +188,7 @@ static struct resource bfin_spi0_resource[] = {
187static struct bfin5xx_spi_master bfin_spi0_info = { 188static struct bfin5xx_spi_master bfin_spi0_info = {
188 .num_chipselect = 8, 189 .num_chipselect = 8,
189 .enable_dma = 1, /* master has the ability to do dma transfer */ 190 .enable_dma = 1, /* master has the ability to do dma transfer */
191 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
190}; 192};
191 193
192static struct platform_device bfin_spi0_device = { 194static struct platform_device bfin_spi0_device = {
diff --git a/arch/blackfin/mach-bf533/boards/generic_board.c b/arch/blackfin/mach-bf533/boards/generic_board.c
index 310b7772c458..e359a0d6467f 100644
--- a/arch/blackfin/mach-bf533/boards/generic_board.c
+++ b/arch/blackfin/mach-bf533/boards/generic_board.c
@@ -58,10 +58,6 @@ static struct resource smc91x_resources[] = {
58 .end = IRQ_PROG_INTB, 58 .end = IRQ_PROG_INTB,
59 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 59 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
60 }, { 60 }, {
61 /*
62 * denotes the flag pin and is used directly if
63 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
64 */
65 .start = IRQ_PF7, 61 .start = IRQ_PF7,
66 .end = IRQ_PF7, 62 .end = IRQ_PF7,
67 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 63 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index f84be4eabfd1..8fde8d832850 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -35,13 +35,14 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <asm/dma.h> 42#include <asm/dma.h>
43#include <asm/bfin5xx_spi.h> 43#include <asm/bfin5xx_spi.h>
44#include <asm/reboot.h> 44#include <asm/reboot.h>
45#include <asm/portmux.h>
45 46
46/* 47/*
47 * Name the Board for the /proc/cpuinfo 48 * Name the Board for the /proc/cpuinfo
@@ -218,7 +219,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
218#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 219#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
219 { 220 {
220 .modalias = "spi_mmc_dummy", 221 .modalias = "spi_mmc_dummy",
221 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 222 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
222 .bus_num = 0, 223 .bus_num = 0,
223 .chip_select = 0, 224 .chip_select = 0,
224 .platform_data = NULL, 225 .platform_data = NULL,
@@ -227,7 +228,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
227 }, 228 },
228 { 229 {
229 .modalias = "spi_mmc", 230 .modalias = "spi_mmc",
230 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 231 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
231 .bus_num = 0, 232 .bus_num = 0,
232 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 233 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
233 .platform_data = NULL, 234 .platform_data = NULL,
@@ -286,6 +287,7 @@ static struct resource bfin_spi0_resource[] = {
286static struct bfin5xx_spi_master bfin_spi0_info = { 287static struct bfin5xx_spi_master bfin_spi0_info = {
287 .num_chipselect = 8, 288 .num_chipselect = 8,
288 .enable_dma = 1, /* master has the ability to do dma transfer */ 289 .enable_dma = 1, /* master has the ability to do dma transfer */
290 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
289}; 291};
290 292
291static struct platform_device bfin_spi0_device = { 293static struct platform_device bfin_spi0_device = {
diff --git a/arch/blackfin/mach-bf537/Kconfig b/arch/blackfin/mach-bf537/Kconfig
index e6648db09519..8255374c04aa 100644
--- a/arch/blackfin/mach-bf537/Kconfig
+++ b/arch/blackfin/mach-bf537/Kconfig
@@ -1,5 +1,7 @@
1if (BF537 || BF534 || BF536) 1if (BF537 || BF534 || BF536)
2 2
3source "arch/blackfin/mach-bf537/boards/Kconfig"
4
3menu "BF537 Specific Configuration" 5menu "BF537 Specific Configuration"
4 6
5comment "Interrupt Priority Assignment" 7comment "Interrupt Priority Assignment"
diff --git a/arch/blackfin/mach-bf537/boards/Kconfig b/arch/blackfin/mach-bf537/boards/Kconfig
new file mode 100644
index 000000000000..96a15196e416
--- /dev/null
+++ b/arch/blackfin/mach-bf537/boards/Kconfig
@@ -0,0 +1,29 @@
1choice
2 prompt "System type"
3 default BFIN537_STAMP
4 help
5 Select your board!
6
7config BFIN537_STAMP
8 bool "BF537-STAMP"
9 help
10 BF537-STAMP board support.
11
12config BFIN537_BLUETECHNIX_CM
13 bool "Bluetechnix CM-BF537"
14 depends on (BF537)
15 help
16 CM-BF537 support for EVAL- and DEV-Board.
17
18config PNAV10
19 bool "PNAV board"
20 depends on (BF537)
21 help
22 PNAV board support.
23
24config GENERIC_BF537_BOARD
25 bool "Generic"
26 help
27 Generic or Custom board support.
28
29endchoice
diff --git a/arch/blackfin/mach-bf537/boards/Makefile b/arch/blackfin/mach-bf537/boards/Makefile
index 23323cacc3aa..94a85174283a 100644
--- a/arch/blackfin/mach-bf537/boards/Makefile
+++ b/arch/blackfin/mach-bf537/boards/Makefile
@@ -2,8 +2,7 @@
2# arch/blackfin/mach-bf537/boards/Makefile 2# arch/blackfin/mach-bf537/boards/Makefile
3# 3#
4 4
5obj-y += eth_mac.o 5obj-$(CONFIG_GENERIC_BF537_BOARD) += generic_board.o
6obj-$(CONFIG_GENERIC_BOARD) += generic_board.o 6obj-$(CONFIG_BFIN537_STAMP) += stamp.o led.o
7obj-$(CONFIG_BFIN537_STAMP) += stamp.o led.o 7obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o
8obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o 8obj-$(CONFIG_PNAV10) += pnav10.o
9obj-$(CONFIG_PNAV10) += pnav10.o
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index 52e2320307de..c0fb06dbc42e 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -34,11 +34,12 @@
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#include <linux/usb_isp1362.h> 37#include <linux/usb/isp1362.h>
38#include <linux/pata_platform.h> 38#include <linux/pata_platform.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <asm/dma.h> 40#include <asm/dma.h>
41#include <asm/bfin5xx_spi.h> 41#include <asm/bfin5xx_spi.h>
42#include <asm/portmux.h>
42 43
43/* 44/*
44 * Name the Board for the /proc/cpuinfo 45 * Name the Board for the /proc/cpuinfo
@@ -194,6 +195,7 @@ static struct resource bfin_spi0_resource[] = {
194static struct bfin5xx_spi_master bfin_spi0_info = { 195static struct bfin5xx_spi_master bfin_spi0_info = {
195 .num_chipselect = 8, 196 .num_chipselect = 8,
196 .enable_dma = 1, /* master has the ability to do dma transfer */ 197 .enable_dma = 1, /* master has the ability to do dma transfer */
198 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
197}; 199};
198 200
199static struct platform_device bfin_spi0_device = { 201static struct platform_device bfin_spi0_device = {
@@ -281,8 +283,8 @@ static struct resource net2272_bfin_resources[] = {
281 .end = 0x20200000 + 0x100, 283 .end = 0x20200000 + 0x100,
282 .flags = IORESOURCE_MEM, 284 .flags = IORESOURCE_MEM,
283 }, { 285 }, {
284 .start = IRQ_PF7, 286 .start = IRQ_PH14,
285 .end = IRQ_PF7, 287 .end = IRQ_PH14,
286 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 288 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
287 }, 289 },
288}; 290};
@@ -425,3 +427,10 @@ static int __init cm_bf537_init(void)
425} 427}
426 428
427arch_initcall(cm_bf537_init); 429arch_initcall(cm_bf537_init);
430
431void bfin_get_ether_addr(char *addr)
432{
433 random_ether_addr(addr);
434 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
435}
436EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf537/boards/eth_mac.c b/arch/blackfin/mach-bf537/boards/eth_mac.c
deleted file mode 100644
index a725cc8a9290..000000000000
--- a/arch/blackfin/mach-bf537/boards/eth_mac.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/blackfin/mach-bf537/board/eth_mac.c
3 *
4 * Copyright (C) 2007 Analog Devices, Inc.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/module.h>
21#include <asm/blackfin.h>
22
23#if defined(CONFIG_GENERIC_BOARD) || defined(CONFIG_BFIN537_STAMP)
24
25/*
26 * Currently the MAC address is saved in Flash by U-Boot
27 */
28#define FLASH_MAC 0x203f0000
29
30void get_bf537_ether_addr(char *addr)
31{
32 unsigned int flash_mac = (unsigned int) FLASH_MAC;
33 *(u32 *)(&(addr[0])) = bfin_read32(flash_mac);
34 flash_mac += 4;
35 *(u16 *)(&(addr[4])) = bfin_read16(flash_mac);
36}
37
38#else
39
40/*
41 * Provide MAC address function for other specific board setting
42 */
43void get_bf537_ether_addr(char *addr)
44{
45 printk(KERN_WARNING "%s: No valid Ethernet MAC address found\n", __FILE__);
46}
47
48#endif
49
50EXPORT_SYMBOL(get_bf537_ether_addr);
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 255da7a98481..09f4bfbd2350 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -35,7 +35,7 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
@@ -44,6 +44,7 @@
44#include <asm/dma.h> 44#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h> 45#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h> 46#include <asm/reboot.h>
47#include <asm/portmux.h>
47#include <linux/spi/ad7877.h> 48#include <linux/spi/ad7877.h>
48 49
49/* 50/*
@@ -502,7 +503,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
502 .platform_data = &bfin_ad7877_ts_info, 503 .platform_data = &bfin_ad7877_ts_info,
503 .irq = IRQ_PF6, 504 .irq = IRQ_PF6,
504 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 505 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
505 .bus_num = 1, 506 .bus_num = 0,
506 .chip_select = 1, 507 .chip_select = 1,
507 .controller_data = &spi_ad7877_chip_info, 508 .controller_data = &spi_ad7877_chip_info,
508 }, 509 },
@@ -513,6 +514,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
513static struct bfin5xx_spi_master bfin_spi0_info = { 514static struct bfin5xx_spi_master bfin_spi0_info = {
514 .num_chipselect = 8, 515 .num_chipselect = 8,
515 .enable_dma = 1, /* master has the ability to do dma transfer */ 516 .enable_dma = 1, /* master has the ability to do dma transfer */
517 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
516}; 518};
517 519
518/* SPI (0) */ 520/* SPI (0) */
@@ -730,3 +732,10 @@ void native_machine_restart(char *cmd)
730 if ((bfin_read_SYSCR() & 0x7) == 0x3) 732 if ((bfin_read_SYSCR() & 0x7) == 0x3)
731 bfin_gpio_reset_spi0_ssel1(); 733 bfin_gpio_reset_spi0_ssel1();
732} 734}
735
736void bfin_get_ether_addr(char *addr)
737{
738 random_ether_addr(addr);
739 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
740}
741EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index 87b808926789..fd5f4a6f08e4 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -35,11 +35,12 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/irq.h> 40#include <linux/irq.h>
41#include <asm/dma.h> 41#include <asm/dma.h>
42#include <asm/bfin5xx_spi.h> 42#include <asm/bfin5xx_spi.h>
43#include <asm/portmux.h>
43#include <linux/usb/sl811.h> 44#include <linux/usb/sl811.h>
44 45
45#include <linux/spi/ad7877.h> 46#include <linux/spi/ad7877.h>
@@ -295,7 +296,7 @@ static struct bfin5xx_spi_chip spi_mmc_chip_info = {
295 296
296#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 297#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
297static struct bfin5xx_spi_chip spi_ad7877_chip_info = { 298static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
298 .cs_change_per_word = 1, 299 .cs_change_per_word = 0,
299 .enable_dma = 0, 300 .enable_dma = 0,
300 .bits_per_word = 16, 301 .bits_per_word = 16,
301}; 302};
@@ -387,7 +388,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
387 .platform_data = &bfin_ad7877_ts_info, 388 .platform_data = &bfin_ad7877_ts_info,
388 .irq = IRQ_PF2, 389 .irq = IRQ_PF2,
389 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 390 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
390 .bus_num = 1, 391 .bus_num = 0,
391 .chip_select = 5, 392 .chip_select = 5,
392 .controller_data = &spi_ad7877_chip_info, 393 .controller_data = &spi_ad7877_chip_info,
393}, 394},
@@ -413,6 +414,7 @@ static struct resource bfin_spi0_resource[] = {
413static struct bfin5xx_spi_master bfin_spi0_info = { 414static struct bfin5xx_spi_master bfin_spi0_info = {
414 .num_chipselect = 8, 415 .num_chipselect = 8,
415 .enable_dma = 1, /* master has the ability to do dma transfer */ 416 .enable_dma = 1, /* master has the ability to do dma transfer */
417 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
416}; 418};
417 419
418static struct platform_device bfin_spi0_device = { 420static struct platform_device bfin_spi0_device = {
@@ -508,3 +510,10 @@ static int __init stamp_init(void)
508} 510}
509 511
510arch_initcall(stamp_init); 512arch_initcall(stamp_init);
513
514void bfin_get_ether_addr(char *addr)
515{
516 random_ether_addr(addr);
517 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
518}
519EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index cc41f6c2ef4f..07b0dc273d2f 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -35,7 +35,7 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
@@ -44,6 +44,7 @@
44#include <asm/dma.h> 44#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h> 45#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h> 46#include <asm/reboot.h>
47#include <asm/portmux.h>
47#include <linux/spi/ad7877.h> 48#include <linux/spi/ad7877.h>
48 49
49/* 50/*
@@ -182,6 +183,28 @@ static struct platform_device dm9000_device = {
182}; 183};
183#endif 184#endif
184 185
186#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
187static struct resource ax88180_resources[] = {
188 [0] = {
189 .start = 0x20300000,
190 .end = 0x20300000 + 0x8000,
191 .flags = IORESOURCE_MEM,
192 },
193 [1] = {
194 .start = IRQ_PF7,
195 .end = IRQ_PF7,
196 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
197 },
198};
199
200static struct platform_device ax88180_device = {
201 .name = "ax88180",
202 .id = -1,
203 .num_resources = ARRAY_SIZE(ax88180_resources),
204 .resource = ax88180_resources,
205};
206#endif
207
185#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) 208#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
186static struct resource sl811_hcd_resources[] = { 209static struct resource sl811_hcd_resources[] = {
187 { 210 {
@@ -450,7 +473,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
450#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) 473#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
451 { 474 {
452 .modalias = "spi_mmc_dummy", 475 .modalias = "spi_mmc_dummy",
453 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 476 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
454 .bus_num = 0, 477 .bus_num = 0,
455 .chip_select = 0, 478 .chip_select = 0,
456 .platform_data = NULL, 479 .platform_data = NULL,
@@ -459,7 +482,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
459 }, 482 },
460 { 483 {
461 .modalias = "spi_mmc", 484 .modalias = "spi_mmc",
462 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 485 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
463 .bus_num = 0, 486 .bus_num = 0,
464 .chip_select = CONFIG_SPI_MMC_CS_CHAN, 487 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
465 .platform_data = NULL, 488 .platform_data = NULL,
@@ -502,7 +525,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
502 .platform_data = &bfin_ad7877_ts_info, 525 .platform_data = &bfin_ad7877_ts_info,
503 .irq = IRQ_PF6, 526 .irq = IRQ_PF6,
504 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 527 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
505 .bus_num = 1, 528 .bus_num = 0,
506 .chip_select = 1, 529 .chip_select = 1,
507 .controller_data = &spi_ad7877_chip_info, 530 .controller_data = &spi_ad7877_chip_info,
508 }, 531 },
@@ -513,6 +536,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
513static struct bfin5xx_spi_master bfin_spi0_info = { 536static struct bfin5xx_spi_master bfin_spi0_info = {
514 .num_chipselect = 8, 537 .num_chipselect = 8,
515 .enable_dma = 1, /* master has the ability to do dma transfer */ 538 .enable_dma = 1, /* master has the ability to do dma transfer */
539 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
516}; 540};
517 541
518/* SPI (0) */ 542/* SPI (0) */
@@ -554,15 +578,20 @@ static struct platform_device bfin_fb_adv7393_device = {
554 578
555#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 579#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
556static struct resource bfin_uart_resources[] = { 580static struct resource bfin_uart_resources[] = {
581#ifdef CONFIG_SERIAL_BFIN_UART0
557 { 582 {
558 .start = 0xFFC00400, 583 .start = 0xFFC00400,
559 .end = 0xFFC004FF, 584 .end = 0xFFC004FF,
560 .flags = IORESOURCE_MEM, 585 .flags = IORESOURCE_MEM,
561 }, { 586 },
587#endif
588#ifdef CONFIG_SERIAL_BFIN_UART1
589 {
562 .start = 0xFFC02000, 590 .start = 0xFFC02000,
563 .end = 0xFFC020FF, 591 .end = 0xFFC020FF,
564 .flags = IORESOURCE_MEM, 592 .flags = IORESOURCE_MEM,
565 }, 593 },
594#endif
566}; 595};
567 596
568static struct platform_device bfin_uart_device = { 597static struct platform_device bfin_uart_device = {
@@ -612,7 +641,7 @@ static struct platform_device bfin_sport1_uart_device = {
612 641
613static struct pata_platform_info bfin_pata_platform_data = { 642static struct pata_platform_info bfin_pata_platform_data = {
614 .ioport_shift = 1, 643 .ioport_shift = 1,
615 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, 644 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
616}; 645};
617 646
618static struct resource bfin_pata_resources[] = { 647static struct resource bfin_pata_resources[] = {
@@ -669,6 +698,10 @@ static struct platform_device *stamp_devices[] __initdata = {
669 &dm9000_device, 698 &dm9000_device,
670#endif 699#endif
671 700
701#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
702 &ax88180_device,
703#endif
704
672#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 705#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
673 &bfin_mac_device, 706 &bfin_mac_device,
674#endif 707#endif
@@ -730,3 +763,14 @@ void native_machine_restart(char *cmd)
730 if ((bfin_read_SYSCR() & 0x7) == 0x3) 763 if ((bfin_read_SYSCR() & 0x7) == 0x3)
731 bfin_gpio_reset_spi0_ssel1(); 764 bfin_gpio_reset_spi0_ssel1();
732} 765}
766
767/*
768 * Currently the MAC address is saved in Flash by U-Boot
769 */
770#define FLASH_MAC 0x203f0000
771void bfin_get_ether_addr(char *addr)
772{
773 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
774 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
775}
776EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf548/Kconfig b/arch/blackfin/mach-bf548/Kconfig
index 08d8dc83701c..d8bd3b49f150 100644
--- a/arch/blackfin/mach-bf548/Kconfig
+++ b/arch/blackfin/mach-bf548/Kconfig
@@ -1,5 +1,7 @@
1if (BF54x) 1if (BF54x)
2 2
3source "arch/blackfin/mach-bf548/boards/Kconfig"
4
3menu "BF548 Specific Configuration" 5menu "BF548 Specific Configuration"
4 6
5config DEB_DMA_URGENT 7config DEB_DMA_URGENT
diff --git a/arch/blackfin/mach-bf548/boards/Kconfig b/arch/blackfin/mach-bf548/boards/Kconfig
new file mode 100644
index 000000000000..057129064037
--- /dev/null
+++ b/arch/blackfin/mach-bf548/boards/Kconfig
@@ -0,0 +1,12 @@
1choice
2 prompt "System type"
3 default BFIN548_EZKIT
4 help
5 Select your board!
6
7config BFIN548_EZKIT
8 bool "BF548-EZKIT"
9 help
10 BFIN548-EZKIT board support.
11
12endchoice
diff --git a/arch/blackfin/mach-bf548/boards/Makefile b/arch/blackfin/mach-bf548/boards/Makefile
index 486e07c99a51..a444cc739578 100644
--- a/arch/blackfin/mach-bf548/boards/Makefile
+++ b/arch/blackfin/mach-bf548/boards/Makefile
@@ -2,4 +2,4 @@
2# arch/blackfin/mach-bf548/boards/Makefile 2# arch/blackfin/mach-bf548/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_BFIN548_EZKIT) += ezkit.o led.o 5obj-$(CONFIG_BFIN548_EZKIT) += ezkit.o led.o
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 6b6490e66b30..d37d6653c4bc 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -42,6 +42,7 @@
42#include <asm/dma.h> 42#include <asm/dma.h>
43#include <asm/gpio.h> 43#include <asm/gpio.h>
44#include <asm/nand.h> 44#include <asm/nand.h>
45#include <asm/portmux.h>
45#include <asm/mach/bf54x_keys.h> 46#include <asm/mach/bf54x_keys.h>
46#include <linux/input.h> 47#include <linux/input.h>
47#include <linux/spi/ad7877.h> 48#include <linux/spi/ad7877.h>
@@ -377,7 +378,7 @@ static struct bfin5xx_spi_chip spi_flash_chip_info = {
377 378
378#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 379#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
379static struct bfin5xx_spi_chip spi_ad7877_chip_info = { 380static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
380 .cs_change_per_word = 1, 381 .cs_change_per_word = 0,
381 .enable_dma = 0, 382 .enable_dma = 0,
382 .bits_per_word = 16, 383 .bits_per_word = 16,
383}; 384};
@@ -453,9 +454,10 @@ static struct resource bfin_spi1_resource[] = {
453}; 454};
454 455
455/* SPI controller data */ 456/* SPI controller data */
456static struct bfin5xx_spi_master bf54x_spi_master_info = { 457static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
457 .num_chipselect = 8, 458 .num_chipselect = 8,
458 .enable_dma = 1, /* master has the ability to do dma transfer */ 459 .enable_dma = 1, /* master has the ability to do dma transfer */
460 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
459}; 461};
460 462
461static struct platform_device bf54x_spi_master0 = { 463static struct platform_device bf54x_spi_master0 = {
@@ -464,17 +466,23 @@ static struct platform_device bf54x_spi_master0 = {
464 .num_resources = ARRAY_SIZE(bfin_spi0_resource), 466 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
465 .resource = bfin_spi0_resource, 467 .resource = bfin_spi0_resource,
466 .dev = { 468 .dev = {
467 .platform_data = &bf54x_spi_master_info, /* Passed to driver */ 469 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
468 }, 470 },
469}; 471};
470 472
473static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
474 .num_chipselect = 8,
475 .enable_dma = 1, /* master has the ability to do dma transfer */
476 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
477};
478
471static struct platform_device bf54x_spi_master1 = { 479static struct platform_device bf54x_spi_master1 = {
472 .name = "bfin-spi", 480 .name = "bfin-spi",
473 .id = 1, /* Bus number */ 481 .id = 1, /* Bus number */
474 .num_resources = ARRAY_SIZE(bfin_spi1_resource), 482 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
475 .resource = bfin_spi1_resource, 483 .resource = bfin_spi1_resource,
476 .dev = { 484 .dev = {
477 .platform_data = &bf54x_spi_master_info, /* Passed to driver */ 485 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
478 }, 486 },
479}; 487};
480#endif /* spi master and devices */ 488#endif /* spi master and devices */
@@ -500,6 +508,7 @@ static struct platform_device i2c_bfin_twi0_device = {
500 .resource = bfin_twi0_resource, 508 .resource = bfin_twi0_resource,
501}; 509};
502 510
511#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
503static struct resource bfin_twi1_resource[] = { 512static struct resource bfin_twi1_resource[] = {
504 [0] = { 513 [0] = {
505 .start = TWI1_REGBASE, 514 .start = TWI1_REGBASE,
@@ -520,6 +529,7 @@ static struct platform_device i2c_bfin_twi1_device = {
520 .resource = bfin_twi1_resource, 529 .resource = bfin_twi1_resource,
521}; 530};
522#endif 531#endif
532#endif
523 533
524static struct platform_device *ezkit_devices[] __initdata = { 534static struct platform_device *ezkit_devices[] __initdata = {
525#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 535#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
@@ -569,8 +579,10 @@ static struct platform_device *ezkit_devices[] __initdata = {
569 579
570#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 580#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
571 &i2c_bfin_twi0_device, 581 &i2c_bfin_twi0_device,
582#if !defined(CONFIG_BF542)
572 &i2c_bfin_twi1_device, 583 &i2c_bfin_twi1_device,
573#endif 584#endif
585#endif
574}; 586};
575 587
576static int __init stamp_init(void) 588static int __init stamp_init(void)
diff --git a/arch/blackfin/mach-bf548/head.S b/arch/blackfin/mach-bf548/head.S
index 3071c243d426..74b34c7f3629 100644
--- a/arch/blackfin/mach-bf548/head.S
+++ b/arch/blackfin/mach-bf548/head.S
@@ -158,6 +158,27 @@ ENTRY(__stext)
158 w[p2] = r0; 158 w[p2] = r0;
159 ssync; 159 ssync;
160 160
161 p2.h = hi(EBIU_MBSCTL);
162 p2.l = lo(EBIU_MBSCTL);
163 r0.h = hi(CONFIG_EBIU_MBSCTLVAL);
164 r0.l = lo(CONFIG_EBIU_MBSCTLVAL);
165 [p2] = r0;
166 ssync;
167
168 p2.h = hi(EBIU_MODE);
169 p2.l = lo(EBIU_MODE);
170 r0.h = hi(CONFIG_EBIU_MODEVAL);
171 r0.l = lo(CONFIG_EBIU_MODEVAL);
172 [p2] = r0;
173 ssync;
174
175 p2.h = hi(EBIU_FCTL);
176 p2.l = lo(EBIU_FCTL);
177 r0.h = hi(CONFIG_EBIU_FCTLVAL);
178 r0.l = lo(CONFIG_EBIU_FCTLVAL);
179 [p2] = r0;
180 ssync;
181
161 /* This section keeps the processor in supervisor mode 182 /* This section keeps the processor in supervisor mode
162 * during kernel boot. Switches to user mode at end of boot. 183 * during kernel boot. Switches to user mode at end of boot.
163 * See page 3-9 of Hardware Reference manual for documentation. 184 * See page 3-9 of Hardware Reference manual for documentation.
diff --git a/arch/blackfin/mach-bf561/Kconfig b/arch/blackfin/mach-bf561/Kconfig
index 0a17c4cf0059..3f4895450bea 100644
--- a/arch/blackfin/mach-bf561/Kconfig
+++ b/arch/blackfin/mach-bf561/Kconfig
@@ -1,4 +1,6 @@
1if BF561 1if (BF561)
2
3source "arch/blackfin/mach-bf561/boards/Kconfig"
2 4
3menu "BF561 Specific Configuration" 5menu "BF561 Specific Configuration"
4 6
diff --git a/arch/blackfin/mach-bf561/boards/Kconfig b/arch/blackfin/mach-bf561/boards/Kconfig
new file mode 100644
index 000000000000..e41a67b1fb53
--- /dev/null
+++ b/arch/blackfin/mach-bf561/boards/Kconfig
@@ -0,0 +1,27 @@
1choice
2 prompt "System type"
3 default BFIN561_EZKIT
4 help
5 Select your board!
6
7config BFIN561_EZKIT
8 bool "BF561-EZKIT"
9 help
10 BF561-EZKIT-LITE board support.
11
12config BFIN561_TEPLA
13 bool "BF561-TEPLA"
14 help
15 BF561-TEPLA board support.
16
17config BFIN561_BLUETECHNIX_CM
18 bool "Bluetechnix CM-BF561"
19 help
20 CM-BF561 support for EVAL- and DEV-Board.
21
22config GENERIC_BF561_BOARD
23 bool "Generic"
24 help
25 Generic or Custom board support.
26
27endchoice
diff --git a/arch/blackfin/mach-bf561/boards/Makefile b/arch/blackfin/mach-bf561/boards/Makefile
index 495a1cf9d452..04add010b568 100644
--- a/arch/blackfin/mach-bf561/boards/Makefile
+++ b/arch/blackfin/mach-bf561/boards/Makefile
@@ -2,7 +2,7 @@
2# arch/blackfin/mach-bf561/boards/Makefile 2# arch/blackfin/mach-bf561/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_GENERIC_BOARD) += generic_board.o 5obj-$(CONFIG_GENERIC_BF561_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN561_BLUETECHNIX_CM) += cm_bf561.o 6obj-$(CONFIG_BFIN561_BLUETECHNIX_CM) += cm_bf561.o
7obj-$(CONFIG_BFIN561_EZKIT) += ezkit.o 7obj-$(CONFIG_BFIN561_EZKIT) += ezkit.o
8obj-$(CONFIG_BFIN561_TEPLA) += tepla.o 8obj-$(CONFIG_BFIN561_TEPLA) += tepla.o
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 97aeb43fd8b4..c19cd29b948a 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -33,11 +33,12 @@
33#include <linux/mtd/partitions.h> 33#include <linux/mtd/partitions.h>
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/flash.h> 35#include <linux/spi/flash.h>
36#include <linux/usb_isp1362.h> 36#include <linux/usb/isp1362.h>
37#include <linux/pata_platform.h> 37#include <linux/pata_platform.h>
38#include <linux/irq.h> 38#include <linux/irq.h>
39#include <asm/dma.h> 39#include <asm/dma.h>
40#include <asm/bfin5xx_spi.h> 40#include <asm/bfin5xx_spi.h>
41#include <asm/portmux.h>
41 42
42/* 43/*
43 * Name the Board for the /proc/cpuinfo 44 * Name the Board for the /proc/cpuinfo
@@ -182,6 +183,7 @@ static struct resource bfin_spi0_resource[] = {
182static struct bfin5xx_spi_master bfin_spi0_info = { 183static struct bfin5xx_spi_master bfin_spi0_info = {
183 .num_chipselect = 8, 184 .num_chipselect = 8,
184 .enable_dma = 1, /* master has the ability to do dma transfer */ 185 .enable_dma = 1, /* master has the ability to do dma transfer */
186 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
185}; 187};
186 188
187static struct platform_device bfin_spi0_device = { 189static struct platform_device bfin_spi0_device = {
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 059d516cec23..4ff8f6e7a11f 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -35,6 +35,7 @@
35#include <linux/pata_platform.h> 35#include <linux/pata_platform.h>
36#include <asm/dma.h> 36#include <asm/dma.h>
37#include <asm/bfin5xx_spi.h> 37#include <asm/bfin5xx_spi.h>
38#include <asm/portmux.h>
38 39
39/* 40/*
40 * Name the Board for the /proc/cpuinfo 41 * Name the Board for the /proc/cpuinfo
@@ -115,6 +116,28 @@ static struct platform_device smc91x_device = {
115}; 116};
116#endif 117#endif
117 118
119#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
120static struct resource ax88180_resources[] = {
121 [0] = {
122 .start = 0x2c000000,
123 .end = 0x2c000000 + 0x8000,
124 .flags = IORESOURCE_MEM,
125 },
126 [1] = {
127 .start = IRQ_PF10,
128 .end = IRQ_PF10,
129 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
130 },
131};
132
133static struct platform_device ax88180_device = {
134 .name = "ax88180",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(ax88180_resources),
137 .resource = ax88180_resources,
138};
139#endif
140
118#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 141#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
119static struct resource bfin_uart_resources[] = { 142static struct resource bfin_uart_resources[] = {
120 { 143 {
@@ -160,6 +183,7 @@ static struct resource bfin_spi0_resource[] = {
160static struct bfin5xx_spi_master bfin_spi0_info = { 183static struct bfin5xx_spi_master bfin_spi0_info = {
161 .num_chipselect = 8, 184 .num_chipselect = 8,
162 .enable_dma = 1, /* master has the ability to do dma transfer */ 185 .enable_dma = 1, /* master has the ability to do dma transfer */
186 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
163}; 187};
164 188
165static struct platform_device bfin_spi0_device = { 189static struct platform_device bfin_spi0_device = {
@@ -226,6 +250,11 @@ static struct platform_device *ezkit_devices[] __initdata = {
226#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 250#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
227 &smc91x_device, 251 &smc91x_device,
228#endif 252#endif
253
254#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
255 &ax88180_device,
256#endif
257
229#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 258#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
230 &bfin_spi0_device, 259 &bfin_spi0_device,
231#endif 260#endif
diff --git a/arch/blackfin/mach-bf561/boards/generic_board.c b/arch/blackfin/mach-bf561/boards/generic_board.c
index 46816be4b2ba..fc80c5d059f8 100644
--- a/arch/blackfin/mach-bf561/boards/generic_board.c
+++ b/arch/blackfin/mach-bf561/boards/generic_board.c
@@ -48,10 +48,6 @@ static struct resource smc91x_resources[] = {
48 .end = IRQ_PROG_INTB, 48 .end = IRQ_PROG_INTB,
49 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 49 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
50 }, { 50 }, {
51 /*
52 * denotes the flag pin and is used directly if
53 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
54 */
55 .start = IRQ_PF9, 51 .start = IRQ_PF9,
56 .end = IRQ_PF9, 52 .end = IRQ_PF9,
57 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 53 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
diff --git a/arch/blackfin/mach-bf561/boards/tepla.c b/arch/blackfin/mach-bf561/boards/tepla.c
index 4a17c6da2a59..ec6a2207c202 100644
--- a/arch/blackfin/mach-bf561/boards/tepla.c
+++ b/arch/blackfin/mach-bf561/boards/tepla.c
@@ -31,10 +31,6 @@ static struct resource smc91x_resources[] = {
31 .end = IRQ_PROG_INTB, 31 .end = IRQ_PROG_INTB,
32 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL, 32 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
33 }, { 33 }, {
34 /*
35 * denotes the flag pin and is used directly if
36 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
37 */
38 .start = IRQ_PF7, 34 .start = IRQ_PF7,
39 .end = IRQ_PF7, 35 .end = IRQ_PF7,
40 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL, 36 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
diff --git a/arch/blackfin/mach-common/cplbinfo.c b/arch/blackfin/mach-common/cplbinfo.c
index 785ca9816971..a4f0b428a34d 100644
--- a/arch/blackfin/mach-common/cplbinfo.c
+++ b/arch/blackfin/mach-common/cplbinfo.c
@@ -91,7 +91,7 @@ static char *cplb_print_entry(char *buf, int type)
91 } else 91 } else
92 buf += sprintf(buf, "Data CPLB entry:\n"); 92 buf += sprintf(buf, "Data CPLB entry:\n");
93 93
94 buf += sprintf(buf, "Address\t\tData\tSize\tValid\tLocked\tSwapin\n\tiCount\toCount\n"); 94 buf += sprintf(buf, "Address\t\tData\tSize\tValid\tLocked\tSwapin\tiCount\toCount\n");
95 95
96 while (*p_addr != 0xffffffff) { 96 while (*p_addr != 0xffffffff) {
97 entry = cplb_find_entry(cplb_addr, cplb_data, *p_addr, *p_data); 97 entry = cplb_find_entry(cplb_addr, cplb_data, *p_addr, *p_data);
diff --git a/arch/blackfin/mach-common/cplbmgr.S b/arch/blackfin/mach-common/cplbmgr.S
index 946703ef48ff..6f909cbfac7b 100644
--- a/arch/blackfin/mach-common/cplbmgr.S
+++ b/arch/blackfin/mach-common/cplbmgr.S
@@ -73,7 +73,7 @@ ENTRY(_cplb_mgr)
73 /* ICPLB Miss Exception. We need to choose one of the 73 /* ICPLB Miss Exception. We need to choose one of the
74 * currently-installed CPLBs, and replace it with one 74 * currently-installed CPLBs, and replace it with one
75 * from the configuration table. 75 * from the configuration table.
76 */ 76 */
77 77
78 P4.L = LO(ICPLB_FAULT_ADDR); 78 P4.L = LO(ICPLB_FAULT_ADDR);
79 P4.H = HI(ICPLB_FAULT_ADDR); 79 P4.H = HI(ICPLB_FAULT_ADDR);
@@ -222,7 +222,7 @@ ENTRY(_cplb_mgr)
222 222
223 /* See if failed address > start address */ 223 /* See if failed address > start address */
224 CC = R4 <= R0(IU); 224 CC = R4 <= R0(IU);
225 IF !CC JUMP .Linext; 225 IF !CC JUMP .Linext;
226 226
227 /* extract page size (17:16)*/ 227 /* extract page size (17:16)*/
228 R3 = EXTRACT(R2, R1.L) (Z); 228 R3 = EXTRACT(R2, R1.L) (Z);
@@ -271,16 +271,27 @@ ENTRY(_cplb_mgr)
271 271
272/* FAILED CASES*/ 272/* FAILED CASES*/
273.Lno_page_in_table: 273.Lno_page_in_table:
274 ( R7:4,P5:3 ) = [SP++];
275 R0 = CPLB_NO_ADDR_MATCH; 274 R0 = CPLB_NO_ADDR_MATCH;
276 RTS; 275 JUMP .Lfail_ret;
276
277.Lall_locked: 277.Lall_locked:
278 ( R7:4,P5:3 ) = [SP++];
279 R0 = CPLB_NO_UNLOCKED; 278 R0 = CPLB_NO_UNLOCKED;
280 RTS; 279 JUMP .Lfail_ret;
280
281.Lprot_violation: 281.Lprot_violation:
282 ( R7:4,P5:3 ) = [SP++];
283 R0 = CPLB_PROT_VIOL; 282 R0 = CPLB_PROT_VIOL;
283
284.Lfail_ret:
285 /* Make sure we turn protection/cache back on, even in the failing case */
286 BITSET(R5,ENICPLB_P);
287 CLI R2;
288 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
289 .align 8;
290 [P4] = R5;
291 SSYNC;
292 STI R2;
293
294 ( R7:4,P5:3 ) = [SP++];
284 RTS; 295 RTS;
285 296
286.Ldcplb_write: 297.Ldcplb_write:
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index e3ad5802868a..dc9d3ee2e691 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -33,7 +33,7 @@
33 * after a timer-interrupt and after each system call. 33 * after a timer-interrupt and after each system call.
34 */ 34 */
35 35
36 36#include <linux/init.h>
37#include <linux/linkage.h> 37#include <linux/linkage.h>
38#include <linux/unistd.h> 38#include <linux/unistd.h>
39#include <asm/blackfin.h> 39#include <asm/blackfin.h>
@@ -71,25 +71,44 @@ ENDPROC(_safe_speculative_execution)
71 * This one does not lower the level to IRQ5, and thus can be used to 71 * This one does not lower the level to IRQ5, and thus can be used to
72 * patch up CPLB misses on the kernel stack. 72 * patch up CPLB misses on the kernel stack.
73 */ 73 */
74ENTRY(_ex_dcplb)
75#if ANOMALY_05000261 74#if ANOMALY_05000261
75#define _ex_dviol _ex_workaround_261
76#define _ex_dmiss _ex_workaround_261
77#define _ex_dmult _ex_workaround_261
78
79ENTRY(_ex_workaround_261)
76 /* 80 /*
77 * Work around an anomaly: if we see a new DCPLB fault, return 81 * Work around an anomaly: if we see a new DCPLB fault, return
78 * without doing anything. Then, if we get the same fault again, 82 * without doing anything. Then, if we get the same fault again,
79 * handle it. 83 * handle it.
80 */ 84 */
85 P4 = R7; /* Store EXCAUSE */
81 p5.l = _last_cplb_fault_retx; 86 p5.l = _last_cplb_fault_retx;
82 p5.h = _last_cplb_fault_retx; 87 p5.h = _last_cplb_fault_retx;
83 r7 = [p5]; 88 r7 = [p5];
84 r6 = retx; 89 r6 = retx;
85 [p5] = r6; 90 [p5] = r6;
86 cc = r6 == r7; 91 cc = r6 == r7;
87 if !cc jump _return_from_exception; 92 if !cc jump _bfin_return_from_exception;
88 /* fall through */ 93 /* fall through */
94 R7 = P4;
95 R6 = 0x26; /* Data CPLB Miss */
96 cc = R6 == R7;
97 if cc jump _ex_dcplb_miss (BP);
98 /* Handle 0x23 Data CPLB Protection Violation
99 * and Data CPLB Multiple Hits - Linux Trap Zero
100 */
101 jump _ex_trap_c;
102ENDPROC(_ex_workaround_261)
103
104#else
105#define _ex_dviol _ex_trap_c
106#define _ex_dmiss _ex_dcplb_miss
107#define _ex_dmult _ex_trap_c
89#endif 108#endif
90ENDPROC(_ex_dcplb)
91 109
92ENTRY(_ex_icplb) 110ENTRY(_ex_dcplb_miss)
111ENTRY(_ex_icplb_miss)
93 (R7:6,P5:4) = [sp++]; 112 (R7:6,P5:4) = [sp++];
94 ASTAT = [sp++]; 113 ASTAT = [sp++];
95 SAVE_ALL_SYS 114 SAVE_ALL_SYS
@@ -98,7 +117,7 @@ ENTRY(_ex_icplb)
98 RESTORE_ALL_SYS 117 RESTORE_ALL_SYS
99 SP = EX_SCRATCH_REG; 118 SP = EX_SCRATCH_REG;
100 rtx; 119 rtx;
101ENDPROC(_ex_icplb) 120ENDPROC(_ex_icplb_miss)
102 121
103ENTRY(_ex_syscall) 122ENTRY(_ex_syscall)
104 DEBUG_START_HWTRACE(p5, r7) 123 DEBUG_START_HWTRACE(p5, r7)
@@ -120,7 +139,7 @@ ENTRY(_ex_single_step)
120 r7 = retx; 139 r7 = retx;
121 r6 = reti; 140 r6 = reti;
122 cc = r7 == r6; 141 cc = r7 == r6;
123 if cc jump _return_from_exception 142 if cc jump _bfin_return_from_exception
124 r7 = syscfg; 143 r7 = syscfg;
125 bitclr (r7, 0); 144 bitclr (r7, 0);
126 syscfg = R7; 145 syscfg = R7;
@@ -137,8 +156,9 @@ ENTRY(_ex_single_step)
137 r7 = [p4]; 156 r7 = [p4];
138 cc = r6 == r7; 157 cc = r6 == r7;
139 if !cc jump _ex_trap_c; 158 if !cc jump _ex_trap_c;
159ENDPROC(_ex_single_step)
140 160
141ENTRY(_return_from_exception) 161ENTRY(_bfin_return_from_exception)
142 DEBUG_START_HWTRACE(p5, r7) 162 DEBUG_START_HWTRACE(p5, r7)
143#if ANOMALY_05000257 163#if ANOMALY_05000257
144 R7=LC0; 164 R7=LC0;
@@ -150,7 +170,7 @@ ENTRY(_return_from_exception)
150 ASTAT = [sp++]; 170 ASTAT = [sp++];
151 sp = EX_SCRATCH_REG; 171 sp = EX_SCRATCH_REG;
152 rtx; 172 rtx;
153ENDPROC(_ex_soft_bp) 173ENDPROC(_bfin_return_from_exception)
154 174
155ENTRY(_handle_bad_cplb) 175ENTRY(_handle_bad_cplb)
156 /* To get here, we just tried and failed to change a CPLB 176 /* To get here, we just tried and failed to change a CPLB
@@ -843,7 +863,7 @@ ENTRY(_ex_trace_buff_full)
843 LC0 = [sp++]; 863 LC0 = [sp++];
844 P2 = [sp++]; 864 P2 = [sp++];
845 P3 = [sp++]; 865 P3 = [sp++];
846 jump _return_from_exception; 866 jump _bfin_return_from_exception;
847ENDPROC(_ex_trace_buff_full) 867ENDPROC(_ex_trace_buff_full)
848 868
849#if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4 869#if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
@@ -861,7 +881,7 @@ ENTRY(_software_trace_buff)
861#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */ 881#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
862 882
863#if CONFIG_EARLY_PRINTK 883#if CONFIG_EARLY_PRINTK
864.section .init.text 884__INIT
865ENTRY(_early_trap) 885ENTRY(_early_trap)
866 SAVE_ALL_SYS 886 SAVE_ALL_SYS
867 trace_buffer_stop(p0,r0); 887 trace_buffer_stop(p0,r0);
@@ -896,6 +916,7 @@ ENTRY(_early_trap)
896 call _early_trap_c; 916 call _early_trap_c;
897 SP += 12; 917 SP += 12;
898ENDPROC(_early_trap) 918ENDPROC(_early_trap)
919__FINIT
899#endif /* CONFIG_EARLY_PRINTK */ 920#endif /* CONFIG_EARLY_PRINTK */
900 921
901/* 922/*
@@ -908,6 +929,7 @@ ENDPROC(_early_trap)
908#else 929#else
909.data 930.data
910#endif 931#endif
932
911ENTRY(_ex_table) 933ENTRY(_ex_table)
912 /* entry for each EXCAUSE[5:0] 934 /* entry for each EXCAUSE[5:0]
913 * This table must be in sync with the table in ./kernel/traps.c 935 * This table must be in sync with the table in ./kernel/traps.c
@@ -917,7 +939,7 @@ ENTRY(_ex_table)
917 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */ 939 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */
918 .long _ex_replaceable /* 0x02 - User Defined */ 940 .long _ex_replaceable /* 0x02 - User Defined */
919 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */ 941 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
920 .long _ex_replaceable /* 0x04 - User Defined */ 942 .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */
921 .long _ex_replaceable /* 0x05 - User Defined */ 943 .long _ex_replaceable /* 0x05 - User Defined */
922 .long _ex_replaceable /* 0x06 - User Defined */ 944 .long _ex_replaceable /* 0x06 - User Defined */
923 .long _ex_replaceable /* 0x07 - User Defined */ 945 .long _ex_replaceable /* 0x07 - User Defined */
@@ -952,16 +974,16 @@ ENTRY(_ex_table)
952 .long _ex_trap_c /* 0x20 - Reserved */ 974 .long _ex_trap_c /* 0x20 - Reserved */
953 .long _ex_trap_c /* 0x21 - Undefined Instruction */ 975 .long _ex_trap_c /* 0x21 - Undefined Instruction */
954 .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */ 976 .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */
955 .long _ex_dcplb /* 0x23 - Data CPLB Protection Violation */ 977 .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */
956 .long _ex_trap_c /* 0x24 - Data access misaligned */ 978 .long _ex_trap_c /* 0x24 - Data access misaligned */
957 .long _ex_trap_c /* 0x25 - Unrecoverable Event */ 979 .long _ex_trap_c /* 0x25 - Unrecoverable Event */
958 .long _ex_dcplb /* 0x26 - Data CPLB Miss */ 980 .long _ex_dmiss /* 0x26 - Data CPLB Miss */
959 .long _ex_trap_c /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */ 981 .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
960 .long _ex_trap_c /* 0x28 - Emulation Watchpoint */ 982 .long _ex_trap_c /* 0x28 - Emulation Watchpoint */
961 .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */ 983 .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */
962 .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */ 984 .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */
963 .long _ex_icplb /* 0x2B - Instruction CPLB protection Violation */ 985 .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */
964 .long _ex_icplb /* 0x2C - Instruction CPLB miss */ 986 .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */
965 .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */ 987 .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */
966 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ 988 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
967 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ 989 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index c6b32fe0f6e9..4de376418a18 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -30,7 +30,6 @@
30 30
31#include <asm/blackfin.h> 31#include <asm/blackfin.h>
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33#include <linux/autoconf.h>
34#include <linux/linkage.h> 33#include <linux/linkage.h>
35#include <asm/entry.h> 34#include <asm/entry.h>
36#include <asm/asm-offsets.h> 35#include <asm/asm-offsets.h>
diff --git a/arch/blackfin/mach-common/ints-priority-dc.c b/arch/blackfin/mach-common/ints-priority-dc.c
index c2f05fabedc1..4882f0e801a9 100644
--- a/arch/blackfin/mach-common/ints-priority-dc.c
+++ b/arch/blackfin/mach-common/ints-priority-dc.c
@@ -181,7 +181,6 @@ static struct irq_chip bf561_internal_irqchip = {
181 .unmask = bf561_internal_unmask_irq, 181 .unmask = bf561_internal_unmask_irq,
182}; 182};
183 183
184#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
185static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)]; 184static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
186static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)]; 185static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)];
187 186
@@ -362,8 +361,6 @@ static void bf561_demux_gpio_irq(unsigned int inta_irq,
362 361
363} 362}
364 363
365#endif /* CONFIG_IRQCHIP_DEMUX_GPIO */
366
367void __init init_exception_vectors(void) 364void __init init_exception_vectors(void)
368{ 365{
369 SSYNC(); 366 SSYNC();
@@ -413,26 +410,21 @@ int __init init_arch_irq(void)
413 set_irq_chip(irq, &bf561_core_irqchip); 410 set_irq_chip(irq, &bf561_core_irqchip);
414 else 411 else
415 set_irq_chip(irq, &bf561_internal_irqchip); 412 set_irq_chip(irq, &bf561_internal_irqchip);
416#ifdef CONFIG_IRQCHIP_DEMUX_GPIO 413
417 if ((irq != IRQ_PROG0_INTA) && 414 if ((irq != IRQ_PROG0_INTA) &&
418 (irq != IRQ_PROG1_INTA) && (irq != IRQ_PROG2_INTA)) { 415 (irq != IRQ_PROG1_INTA) &&
419#endif 416 (irq != IRQ_PROG2_INTA))
420 set_irq_handler(irq, handle_simple_irq); 417 set_irq_handler(irq, handle_simple_irq);
421#ifdef CONFIG_IRQCHIP_DEMUX_GPIO 418 else
422 } else {
423 set_irq_chained_handler(irq, bf561_demux_gpio_irq); 419 set_irq_chained_handler(irq, bf561_demux_gpio_irq);
424 }
425#endif
426
427 } 420 }
428 421
429#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
430 for (irq = IRQ_PF0; irq <= IRQ_PF47; irq++) { 422 for (irq = IRQ_PF0; irq <= IRQ_PF47; irq++) {
431 set_irq_chip(irq, &bf561_gpio_irqchip); 423 set_irq_chip(irq, &bf561_gpio_irqchip);
432 /* if configured as edge, then will be changed to do_edge_IRQ */ 424 /* if configured as edge, then will be changed to do_edge_IRQ */
433 set_irq_handler(irq, handle_level_irq); 425 set_irq_handler(irq, handle_level_irq);
434 } 426 }
435#endif 427
436 bfin_write_IMASK(0); 428 bfin_write_IMASK(0);
437 CSYNC(); 429 CSYNC();
438 ilat = bfin_read_ILAT(); 430 ilat = bfin_read_ILAT();
@@ -457,9 +449,8 @@ int __init init_arch_irq(void)
457} 449}
458 450
459#ifdef CONFIG_DO_IRQ_L1 451#ifdef CONFIG_DO_IRQ_L1
460void do_irq(int vec, struct pt_regs *fp)__attribute__((l1_text)); 452__attribute__((l1_text))
461#endif 453#endif
462
463void do_irq(int vec, struct pt_regs *fp) 454void do_irq(int vec, struct pt_regs *fp)
464{ 455{
465 if (vec == EVT_IVTMR_P) { 456 if (vec == EVT_IVTMR_P) {
diff --git a/arch/blackfin/mach-common/ints-priority-sc.c b/arch/blackfin/mach-common/ints-priority-sc.c
index 2d2b63567b30..147f0731087a 100644
--- a/arch/blackfin/mach-common/ints-priority-sc.c
+++ b/arch/blackfin/mach-common/ints-priority-sc.c
@@ -308,7 +308,7 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
308} 308}
309#endif /* BF537_GENERIC_ERROR_INT_DEMUX */ 309#endif /* BF537_GENERIC_ERROR_INT_DEMUX */
310 310
311#if defined(CONFIG_IRQCHIP_DEMUX_GPIO) && !defined(CONFIG_BF54x) 311#if !defined(CONFIG_BF54x)
312 312
313static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)]; 313static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
314static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)]; 314static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)];
@@ -464,7 +464,7 @@ static void bfin_demux_gpio_irq(unsigned int intb_irq,
464 } 464 }
465} 465}
466 466
467#else /* CONFIG_IRQCHIP_DEMUX_GPIO */ 467#else /* CONFIG_BF54x */
468 468
469#define NR_PINT_SYS_IRQS 4 469#define NR_PINT_SYS_IRQS 4
470#define NR_PINT_BITS 32 470#define NR_PINT_BITS 32
@@ -726,7 +726,7 @@ static void bfin_demux_gpio_irq(unsigned int intb_irq,
726 } 726 }
727 727
728} 728}
729#endif /* CONFIG_IRQCHIP_DEMUX_GPIO */ 729#endif
730 730
731void __init init_exception_vectors(void) 731void __init init_exception_vectors(void)
732{ 732{
@@ -766,10 +766,10 @@ int __init init_arch_irq(void)
766 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL); 766 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL);
767 bfin_write_SIC_IWR0(IWR_ENABLE_ALL); 767 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
768 bfin_write_SIC_IWR1(IWR_ENABLE_ALL); 768 bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
769#ifdef CONFIG_BF54x 769# ifdef CONFIG_BF54x
770 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); 770 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL);
771 bfin_write_SIC_IWR2(IWR_ENABLE_ALL); 771 bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
772#endif 772# endif
773#else 773#else
774 bfin_write_SIC_IMASK(SIC_UNMASK_ALL); 774 bfin_write_SIC_IMASK(SIC_UNMASK_ALL);
775 bfin_write_SIC_IWR(IWR_ENABLE_ALL); 775 bfin_write_SIC_IWR(IWR_ENABLE_ALL);
@@ -778,13 +778,13 @@ int __init init_arch_irq(void)
778 778
779 local_irq_disable(); 779 local_irq_disable();
780 780
781#if defined(CONFIG_IRQCHIP_DEMUX_GPIO) && defined(CONFIG_BF54x) 781#ifdef CONFIG_BF54x
782#ifdef CONFIG_PINTx_REASSIGN 782# ifdef CONFIG_PINTx_REASSIGN
783 pint[0]->assign = CONFIG_PINT0_ASSIGN; 783 pint[0]->assign = CONFIG_PINT0_ASSIGN;
784 pint[1]->assign = CONFIG_PINT1_ASSIGN; 784 pint[1]->assign = CONFIG_PINT1_ASSIGN;
785 pint[2]->assign = CONFIG_PINT2_ASSIGN; 785 pint[2]->assign = CONFIG_PINT2_ASSIGN;
786 pint[3]->assign = CONFIG_PINT3_ASSIGN; 786 pint[3]->assign = CONFIG_PINT3_ASSIGN;
787#endif 787# endif
788 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ 788 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */
789 init_pint_lut(); 789 init_pint_lut();
790#endif 790#endif
@@ -799,18 +799,17 @@ int __init init_arch_irq(void)
799#endif 799#endif
800 800
801 switch (irq) { 801 switch (irq) {
802#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
803#if defined(CONFIG_BF53x) 802#if defined(CONFIG_BF53x)
804 case IRQ_PROG_INTA: 803 case IRQ_PROG_INTA:
805 set_irq_chained_handler(irq, 804 set_irq_chained_handler(irq,
806 bfin_demux_gpio_irq); 805 bfin_demux_gpio_irq);
807 break; 806 break;
808#if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) 807# if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE))
809 case IRQ_MAC_RX: 808 case IRQ_MAC_RX:
810 set_irq_chained_handler(irq, 809 set_irq_chained_handler(irq,
811 bfin_demux_gpio_irq); 810 bfin_demux_gpio_irq);
812 break; 811 break;
813#endif 812# endif
814#elif defined(CONFIG_BF54x) 813#elif defined(CONFIG_BF54x)
815 case IRQ_PINT0: 814 case IRQ_PINT0:
816 set_irq_chained_handler(irq, 815 set_irq_chained_handler(irq,
@@ -842,7 +841,6 @@ int __init init_arch_irq(void)
842 bfin_demux_gpio_irq); 841 bfin_demux_gpio_irq);
843 break; 842 break;
844#endif 843#endif
845#endif
846 default: 844 default:
847 set_irq_handler(irq, handle_simple_irq); 845 set_irq_handler(irq, handle_simple_irq);
848 break; 846 break;
@@ -861,7 +859,6 @@ int __init init_arch_irq(void)
861 } 859 }
862#endif 860#endif
863 861
864#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
865#ifndef CONFIG_BF54x 862#ifndef CONFIG_BF54x
866 for (irq = IRQ_PF0; irq < NR_IRQS; irq++) { 863 for (irq = IRQ_PF0; irq < NR_IRQS; irq++) {
867#else 864#else
@@ -871,7 +868,7 @@ int __init init_arch_irq(void)
871 /* if configured as edge, then will be changed to do_edge_IRQ */ 868 /* if configured as edge, then will be changed to do_edge_IRQ */
872 set_irq_handler(irq, handle_level_irq); 869 set_irq_handler(irq, handle_level_irq);
873 } 870 }
874#endif 871
875 bfin_write_IMASK(0); 872 bfin_write_IMASK(0);
876 CSYNC(); 873 CSYNC();
877 ilat = bfin_read_ILAT(); 874 ilat = bfin_read_ILAT();
@@ -896,9 +893,8 @@ int __init init_arch_irq(void)
896} 893}
897 894
898#ifdef CONFIG_DO_IRQ_L1 895#ifdef CONFIG_DO_IRQ_L1
899void do_irq(int vec, struct pt_regs *fp) __attribute__((l1_text)); 896__attribute__((l1_text))
900#endif 897#endif
901
902void do_irq(int vec, struct pt_regs *fp) 898void do_irq(int vec, struct pt_regs *fp)
903{ 899{
904 if (vec == EVT_IVTMR_P) { 900 if (vec == EVT_IVTMR_P) {
diff --git a/arch/blackfin/mach-common/irqpanic.c b/arch/blackfin/mach-common/irqpanic.c
index f05e3dadaf33..b22959b197e5 100644
--- a/arch/blackfin/mach-common/irqpanic.c
+++ b/arch/blackfin/mach-common/irqpanic.c
@@ -153,27 +153,29 @@ asmlinkage void irq_panic(int reason, struct pt_regs *regs)
153 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): /* System MMR Error */ 153 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): /* System MMR Error */
154 info.si_code = BUS_ADRALN; 154 info.si_code = BUS_ADRALN;
155 sig = SIGBUS; 155 sig = SIGBUS;
156 printk(KERN_EMERG HWC_x2); 156 printk(KERN_EMERG HWC_x2(KERN_EMERG));
157 break; 157 break;
158 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): /* External Memory Addressing Error */ 158 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): /* External Memory Addressing Error */
159 info.si_code = BUS_ADRERR; 159 info.si_code = BUS_ADRERR;
160 sig = SIGBUS; 160 sig = SIGBUS;
161 printk(KERN_EMERG HWC_x3); 161 printk(KERN_EMERG HWC_x3(KERN_EMERG));
162 break; 162 break;
163 case (SEQSTAT_HWERRCAUSE_PERF_FLOW): /* Performance Monitor Overflow */ 163 case (SEQSTAT_HWERRCAUSE_PERF_FLOW): /* Performance Monitor Overflow */
164 printk(KERN_EMERG HWC_x12); 164 printk(KERN_EMERG HWC_x12(KERN_EMERG));
165 break; 165 break;
166 case (SEQSTAT_HWERRCAUSE_RAISE_5): /* RAISE 5 instruction */ 166 case (SEQSTAT_HWERRCAUSE_RAISE_5): /* RAISE 5 instruction */
167 printk(KERN_EMERG HWC_x18); 167 printk(KERN_EMERG HWC_x18(KERN_EMERG));
168 break; 168 break;
169 default: /* Reserved */ 169 default: /* Reserved */
170 printk(KERN_EMERG HWC_default); 170 printk(KERN_EMERG HWC_default(KERN_EMERG));
171 break; 171 break;
172 } 172 }
173 } 173 }
174 174
175 regs->ipend = bfin_read_IPEND(); 175 regs->ipend = bfin_read_IPEND();
176 dump_bfin_regs(regs, (void *)regs->pc); 176 dump_bfin_process(regs);
177 dump_bfin_mem((void *)regs->pc);
178 show_regs(regs);
177 if (0 == (info.si_signo = sig) || 0 == user_mode(regs)) /* in kernelspace */ 179 if (0 == (info.si_signo = sig) || 0 == user_mode(regs)) /* in kernelspace */
178 panic("Unhandled IRQ or exceptions!\n"); 180 panic("Unhandled IRQ or exceptions!\n");
179 else { /* in userspace */ 181 else { /* in userspace */
diff --git a/arch/blackfin/mm/blackfin_sram.c b/arch/blackfin/mm/blackfin_sram.c
index b99ea883cd22..e41f0e8ecacb 100644
--- a/arch/blackfin/mm/blackfin_sram.c
+++ b/arch/blackfin/mm/blackfin_sram.c
@@ -27,7 +27,6 @@
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 28 */
29 29
30#include <linux/autoconf.h>
31#include <linux/module.h> 30#include <linux/module.h>
32#include <linux/kernel.h> 31#include <linux/kernel.h>
33#include <linux/types.h> 32#include <linux/types.h>
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 21900a9378bb..222da1501f47 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -13,6 +13,10 @@ config ZONE_DMA
13 bool 13 bool
14 default y 14 default y
15 15
16config NO_DMA
17 bool
18 default y
19
16config RWSEM_GENERIC_SPINLOCK 20config RWSEM_GENERIC_SPINLOCK
17 bool 21 bool
18 default y 22 default y
@@ -57,6 +61,10 @@ menu "General setup"
57 61
58source "fs/Kconfig.binfmt" 62source "fs/Kconfig.binfmt"
59 63
64config GENERIC_HARDIRQS
65 bool
66 default y
67
60config ETRAX_CMDLINE 68config ETRAX_CMDLINE
61 string "Kernel command line" 69 string "Kernel command line"
62 default "root=/dev/mtdblock3" 70 default "root=/dev/mtdblock3"
@@ -149,7 +157,8 @@ source "net/Kconfig"
149 157
150# bring in ETRAX built-in drivers 158# bring in ETRAX built-in drivers
151menu "Drivers for built-in interfaces" 159menu "Drivers for built-in interfaces"
152source arch/cris/arch-v10/drivers/Kconfig 160# arch/cris/arch is a symlink to correct arch (arch-v10 or arch-v32)
161source arch/cris/arch/drivers/Kconfig
153 162
154endmenu 163endmenu
155 164
@@ -180,6 +189,10 @@ source "drivers/isdn/Kconfig"
180 189
181source "drivers/telephony/Kconfig" 190source "drivers/telephony/Kconfig"
182 191
192source "drivers/i2c/Kconfig"
193
194source "drivers/rtc/Kconfig"
195
183# 196#
184# input before char - char/joystick depends on it. As does USB. 197# input before char - char/joystick depends on it. As does USB.
185# 198#
@@ -194,6 +207,10 @@ source "fs/Kconfig"
194 207
195source "sound/Kconfig" 208source "sound/Kconfig"
196 209
210source "drivers/pcmcia/Kconfig"
211
212source "drivers/pci/Kconfig"
213
197source "drivers/usb/Kconfig" 214source "drivers/usb/Kconfig"
198 215
199source "kernel/Kconfig.instrumentation" 216source "kernel/Kconfig.instrumentation"
diff --git a/arch/cris/arch-v10/defconfig b/arch/cris/arch-v10/defconfig
index 710c20ba2be7..572f11926399 100644
--- a/arch/cris/arch-v10/defconfig
+++ b/arch/cris/arch-v10/defconfig
@@ -99,7 +99,6 @@ CONFIG_MTD=y
99CONFIG_MTD_CFI=y 99CONFIG_MTD_CFI=y
100# CONFIG_MTD_CFI_INTELEXT is not set 100# CONFIG_MTD_CFI_INTELEXT is not set
101CONFIG_MTD_CFI_AMDSTD=y 101CONFIG_MTD_CFI_AMDSTD=y
102CONFIG_MTD_AMDSTD=y
103CONFIG_MTD_CHAR=y 102CONFIG_MTD_CHAR=y
104CONFIG_MTD_BLOCK=y 103CONFIG_MTD_BLOCK=y
105CONFIG_ETRAX_I2C=y 104CONFIG_ETRAX_I2C=y
@@ -145,7 +144,6 @@ CONFIG_MTD_CFI=y
145# CONFIG_MTD_CFI_GEOMETRY is not set 144# CONFIG_MTD_CFI_GEOMETRY is not set
146# CONFIG_MTD_CFI_INTELEXT is not set 145# CONFIG_MTD_CFI_INTELEXT is not set
147CONFIG_MTD_CFI_AMDSTD=y 146CONFIG_MTD_CFI_AMDSTD=y
148CONFIG_MTD_AMDSTD=y
149# CONFIG_MTD_SHARP is not set 147# CONFIG_MTD_SHARP is not set
150# CONFIG_MTD_PHYSMAP is not set 148# CONFIG_MTD_PHYSMAP is not set
151# CONFIG_MTD_NORA is not set 149# CONFIG_MTD_NORA is not set
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index 03e2e68f947d..faf8b4d3ca01 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -2,6 +2,7 @@ config ETRAX_ETHERNET
2 bool "Ethernet support" 2 bool "Ethernet support"
3 depends on ETRAX_ARCH_V10 3 depends on ETRAX_ARCH_V10
4 select NET_ETHERNET 4 select NET_ETHERNET
5 select MII
5 help 6 help
6 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet 7 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
7 controller. 8 controller.
@@ -605,8 +606,6 @@ config ETRAX_AXISFLASHMAP
605 select MTD 606 select MTD
606 select MTD_CFI 607 select MTD_CFI
607 select MTD_CFI_AMDSTD 608 select MTD_CFI_AMDSTD
608 select MTD_OBSOLETE_CHIPS
609 select MTD_AMDSTD
610 select MTD_CHAR 609 select MTD_CHAR
611 select MTD_BLOCK 610 select MTD_BLOCK
612 select MTD_PARTITIONS 611 select MTD_PARTITIONS
diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c
index efd7b0f3a910..ea3cf2e39a14 100644
--- a/arch/cris/arch-v10/drivers/axisflashmap.c
+++ b/arch/cris/arch-v10/drivers/axisflashmap.c
@@ -312,12 +312,12 @@ static struct mtd_info *probe_cs(struct map_info *map_cs)
312 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", 312 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
313 map_cs->name, map_cs->size, map_cs->map_priv_1); 313 map_cs->name, map_cs->size, map_cs->map_priv_1);
314 314
315#ifdef CONFIG_MTD_AMDSTD
316 mtd_cs = do_map_probe("amd_flash", map_cs);
317#endif
318#ifdef CONFIG_MTD_CFI 315#ifdef CONFIG_MTD_CFI
316 mtd_cs = do_map_probe("cfi_probe", map_cs);
317#endif
318#ifdef CONFIG_MTD_JEDECPROBE
319 if (!mtd_cs) { 319 if (!mtd_cs) {
320 mtd_cs = do_map_probe("cfi_probe", map_cs); 320 mtd_cs = do_map_probe("jedec_probe", map_cs);
321 } 321 }
322#endif 322#endif
323 323
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index f389ed6998fe..0d347a705835 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -297,8 +297,10 @@ gpio_poll(struct file *file,
297 data = *R_PORT_PB_DATA; 297 data = *R_PORT_PB_DATA;
298 else if (priv->minor == GPIO_MINOR_G) 298 else if (priv->minor == GPIO_MINOR_G)
299 data = *R_PORT_G_DATA; 299 data = *R_PORT_G_DATA;
300 else 300 else {
301 spin_unlock(&gpio_lock);
301 return 0; 302 return 0;
303 }
302 304
303 if ((data & priv->highalarm) || 305 if ((data & priv->highalarm) ||
304 (~data & priv->lowalarm)) { 306 (~data & priv->lowalarm)) {
@@ -381,18 +383,21 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
381 383
382 ssize_t retval = count; 384 ssize_t retval = count;
383 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) { 385 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) {
384 return -EFAULT; 386 retval = -EFAULT;
387 goto out;
385 } 388 }
386 389
387 if (!access_ok(VERIFY_READ, buf, count)) { 390 if (!access_ok(VERIFY_READ, buf, count)) {
388 return -EFAULT; 391 retval = -EFAULT;
392 goto out;
389 } 393 }
390 clk_mask = priv->clk_mask; 394 clk_mask = priv->clk_mask;
391 data_mask = priv->data_mask; 395 data_mask = priv->data_mask;
392 /* It must have been configured using the IO_CFG_WRITE_MODE */ 396 /* It must have been configured using the IO_CFG_WRITE_MODE */
393 /* Perhaps a better error code? */ 397 /* Perhaps a better error code? */
394 if (clk_mask == 0 || data_mask == 0) { 398 if (clk_mask == 0 || data_mask == 0) {
395 return -EPERM; 399 retval = -EPERM;
400 goto out;
396 } 401 }
397 write_msb = priv->write_msb; 402 write_msb = priv->write_msb;
398 D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb)); 403 D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb));
@@ -425,6 +430,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
425 } 430 }
426 } 431 }
427 } 432 }
433out:
428 spin_unlock(&gpio_lock); 434 spin_unlock(&gpio_lock);
429 return retval; 435 return retval;
430} 436}
@@ -506,6 +512,7 @@ gpio_release(struct inode *inode, struct file *filp)
506 while (p) { 512 while (p) {
507 if (p->highalarm | p->lowalarm) { 513 if (p->highalarm | p->lowalarm) {
508 gpio_some_alarms = 1; 514 gpio_some_alarms = 1;
515 spin_unlock(&gpio_lock);
509 return 0; 516 return 0;
510 } 517 }
511 p = p->next; 518 p = p->next;
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index c5844cb70f09..ec62c951fa3c 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -500,9 +500,8 @@ _work_notifysig:
500 ;; deal with pending signals and notify-resume requests 500 ;; deal with pending signals and notify-resume requests
501 501
502 move.d $r9, $r10 ; do_notify_resume syscall/irq param 502 move.d $r9, $r10 ; do_notify_resume syscall/irq param
503 moveq 0, $r11 ; oldset param - 0 in this case 503 move.d $sp, $r11 ; the regs param
504 move.d $sp, $r12 ; the regs param 504 move.d $r1, $r12 ; the thread_info_flags parameter
505 move.d $r1, $r13 ; the thread_info_flags parameter
506 jsr do_notify_resume 505 jsr do_notify_resume
507 506
508 ba _Rexit 507 ba _Rexit
@@ -678,13 +677,19 @@ IRQ1_interrupt:
678 push $r10 ; push orig_r10 677 push $r10 ; push orig_r10
679 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 678 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
680 679
680 ;; If there is a glitch on the NMI pin shorter than ~100ns
681 ;; (i.e. non-active by the time we get here) then the nmi_pin bit
682 ;; in R_IRQ_MASK0_RD will already be cleared. The watchdog_nmi bit
683 ;; is cleared by us however (when feeding the watchdog), which is why
684 ;; we use that bit to determine what brought us here.
685
681 move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog? 686 move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog?
682 and.d 0x80000000, $r1 687 and.d (1<<30), $r1
683 beq wdog 688 bne wdog
684 move.d $sp, $r10 689 move.d $sp, $r10
685 jsr handle_nmi 690 jsr handle_nmi
686 setf m ; Enable NMI again 691 setf m ; Enable NMI again
687 retb ; Return from NMI 692 ba _Rexit ; Return the standard way
688 nop 693 nop
689wdog: 694wdog:
690#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 695#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
@@ -775,22 +780,9 @@ multiple_interrupt:
775 push $r10 ; push orig_r10 780 push $r10 ; push orig_r10
776 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 781 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
777 782
778 moveq 2, $r2 ; first bit we care about is the timer0 irq 783 move.d $sp, $r10
779 move.d [R_VECT_MASK_RD], $r0; read the irq bits that triggered the multiple irq 784 jsr do_multiple_IRQ
780 move.d $r0, [R_VECT_MASK_CLR] ; Block all active IRQs
7811:
782 btst $r2, $r0 ; check for the irq given by bit r2
783 bpl 2f
784 move.d $r2, $r10 ; First argument to do_IRQ
785 move.d $sp, $r11 ; second argument to do_IRQ
786 jsr do_IRQ
7872:
788 addq 1, $r2 ; next vector bit
789 cmp.b 32, $r2
790 bne 1b ; process all irq's up to and including number 31
791 moveq 0, $r9 ; make ret_from_intr realise we came from an ir
792 785
793 move.d $r0, [R_VECT_MASK_SET] ; Unblock all the IRQs
794 jump ret_from_intr 786 jump ret_from_intr
795 787
796do_sigtrap: 788do_sigtrap:
@@ -837,6 +829,13 @@ _ugdb_handle_breakpoint:
837 ba do_sigtrap ; SIGTRAP the offending process. 829 ba do_sigtrap ; SIGTRAP the offending process.
838 pop $dccr ; Restore dccr in delay slot. 830 pop $dccr ; Restore dccr in delay slot.
839 831
832 .global kernel_execve
833kernel_execve:
834 move.d __NR_execve, $r9
835 break 13
836 ret
837 nop
838
840 .data 839 .data
841 840
842hw_bp_trigs: 841hw_bp_trigs:
@@ -1135,6 +1134,42 @@ sys_call_table:
1135 .long sys_add_key 1134 .long sys_add_key
1136 .long sys_request_key 1135 .long sys_request_key
1137 .long sys_keyctl 1136 .long sys_keyctl
1137 .long sys_ioprio_set
1138 .long sys_ioprio_get /* 290 */
1139 .long sys_inotify_init
1140 .long sys_inotify_add_watch
1141 .long sys_inotify_rm_watch
1142 .long sys_migrate_pages
1143 .long sys_openat /* 295 */
1144 .long sys_mkdirat
1145 .long sys_mknodat
1146 .long sys_fchownat
1147 .long sys_futimesat
1148 .long sys_fstatat64 /* 300 */
1149 .long sys_unlinkat
1150 .long sys_renameat
1151 .long sys_linkat
1152 .long sys_symlinkat
1153 .long sys_readlinkat /* 305 */
1154 .long sys_fchmodat
1155 .long sys_faccessat
1156 .long sys_pselect6
1157 .long sys_ppoll
1158 .long sys_unshare /* 310 */
1159 .long sys_set_robust_list
1160 .long sys_get_robust_list
1161 .long sys_splice
1162 .long sys_sync_file_range
1163 .long sys_tee /* 315 */
1164 .long sys_vmsplice
1165 .long sys_move_pages
1166 .long sys_getcpu
1167 .long sys_epoll_pwait
1168 .long sys_utimensat /* 320 */
1169 .long sys_signalfd
1170 .long sys_timerfd
1171 .long sys_eventfd
1172 .long sys_fallocate
1138 1173
1139 /* 1174 /*
1140 * NOTE!! This doesn't have to be exact - we just have 1175 * NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index d3ea052e5ee1..c1a3a2100ee7 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -1,97 +1,9 @@
1/* $Id: fasttimer.c,v 1.9 2005/03/04 08:16:16 starvik Exp $ 1/*
2 * linux/arch/cris/kernel/fasttimer.c 2 * linux/arch/cris/kernel/fasttimer.c
3 * 3 *
4 * Fast timers for ETRAX100/ETRAX100LX 4 * Fast timers for ETRAX100/ETRAX100LX
5 * This may be useful in other OS than Linux so use 2 space indentation...
6 * 5 *
7 * $Log: fasttimer.c,v $ 6 * Copyright (C) 2000-2007 Axis Communications AB, Lund, Sweden
8 * Revision 1.9 2005/03/04 08:16:16 starvik
9 * Merge of Linux 2.6.11.
10 *
11 * Revision 1.8 2005/01/05 06:09:29 starvik
12 * cli()/sti() will be obsolete in 2.6.11.
13 *
14 * Revision 1.7 2005/01/03 13:35:46 starvik
15 * Removed obsolete stuff.
16 * Mark fast timer IRQ as not shared.
17 *
18 * Revision 1.6 2004/05/14 10:18:39 starvik
19 * Export fast_timer_list
20 *
21 * Revision 1.5 2004/05/14 07:58:01 starvik
22 * Merge of changes from 2.4
23 *
24 * Revision 1.4 2003/07/04 08:27:41 starvik
25 * Merge of Linux 2.5.74
26 *
27 * Revision 1.3 2002/12/12 08:26:32 starvik
28 * Don't use C-comments inside CVS comments
29 *
30 * Revision 1.2 2002/12/11 15:42:02 starvik
31 * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/
32 *
33 * Revision 1.1 2002/11/18 07:58:06 starvik
34 * Fast timers (from Linux 2.4)
35 *
36 * Revision 1.5 2002/10/15 06:21:39 starvik
37 * Added call to init_waitqueue_head
38 *
39 * Revision 1.4 2002/05/28 17:47:59 johana
40 * Added del_fast_timer()
41 *
42 * Revision 1.3 2002/05/28 16:16:07 johana
43 * Handle empty fast_timer_list
44 *
45 * Revision 1.2 2002/05/27 15:38:42 johana
46 * Made it compile without warnings on Linux 2.4.
47 * (includes, wait_queue, PROC_FS and snprintf)
48 *
49 * Revision 1.1 2002/05/27 15:32:25 johana
50 * arch/etrax100/kernel/fasttimer.c v1.8 from the elinux tree.
51 *
52 * Revision 1.8 2001/11/27 13:50:40 pkj
53 * Disable interrupts while stopping the timer and while modifying the
54 * list of active timers in timer1_handler() as it may be interrupted
55 * by other interrupts (e.g., the serial interrupt) which may add fast
56 * timers.
57 *
58 * Revision 1.7 2001/11/22 11:50:32 pkj
59 * * Only store information about the last 16 timers.
60 * * proc_fasttimer_read() now uses an allocated buffer, since it
61 * requires more space than just a page even for only writing the
62 * last 16 timers. The buffer is only allocated on request, so
63 * unless /proc/fasttimer is read, it is never allocated.
64 * * Renamed fast_timer_started to fast_timers_started to match
65 * fast_timers_added and fast_timers_expired.
66 * * Some clean-up.
67 *
68 * Revision 1.6 2000/12/13 14:02:08 johana
69 * Removed volatile for fast_timer_list
70 *
71 * Revision 1.5 2000/12/13 13:55:35 johana
72 * Added DEBUG_LOG, added som cli() and cleanup
73 *
74 * Revision 1.4 2000/12/05 13:48:50 johana
75 * Added range check when writing proc file, modified timer int handling
76 *
77 * Revision 1.3 2000/11/23 10:10:20 johana
78 * More debug/logging possibilities.
79 * Moved GET_JIFFIES_USEC() to timex.h and time.c
80 *
81 * Revision 1.2 2000/11/01 13:41:04 johana
82 * Clean up and bugfixes.
83 * Created new do_gettimeofday_fast() that gets a timeval struct
84 * with time based on jiffies and *R_TIMER0_DATA, uses a table
85 * for fast conversion of timer value to microseconds.
86 * (Much faster the standard do_gettimeofday() and we don't really
87 * want to use the true time - we want the "uptime" so timers don't screw up
88 * when we change the time.
89 * TODO: Add efficient support for continuous timers as well.
90 *
91 * Revision 1.1 2000/10/26 15:49:16 johana
92 * Added fasttimer, highresolution timers.
93 *
94 * Copyright (C) 2000,2001 2002 Axis Communications AB, Lund, Sweden
95 */ 7 */
96 8
97#include <linux/errno.h> 9#include <linux/errno.h>
@@ -125,7 +37,7 @@
125 37
126#ifdef FAST_TIMER_SANITY_CHECKS 38#ifdef FAST_TIMER_SANITY_CHECKS
127#define SANITYCHECK(x) x 39#define SANITYCHECK(x) x
128static int sanity_failed = 0; 40static int sanity_failed;
129#else 41#else
130#define SANITYCHECK(x) 42#define SANITYCHECK(x)
131#endif 43#endif
@@ -134,15 +46,13 @@ static int sanity_failed = 0;
134#define D2(x) 46#define D2(x)
135#define DP(x) 47#define DP(x)
136 48
137#define __INLINE__ inline 49static unsigned int fast_timer_running;
138 50static unsigned int fast_timers_added;
139static int fast_timer_running = 0; 51static unsigned int fast_timers_started;
140static int fast_timers_added = 0; 52static unsigned int fast_timers_expired;
141static int fast_timers_started = 0; 53static unsigned int fast_timers_deleted;
142static int fast_timers_expired = 0; 54static unsigned int fast_timer_is_init;
143static int fast_timers_deleted = 0; 55static unsigned int fast_timer_ints;
144static int fast_timer_is_init = 0;
145static int fast_timer_ints = 0;
146 56
147struct fast_timer *fast_timer_list = NULL; 57struct fast_timer *fast_timer_list = NULL;
148 58
@@ -150,8 +60,8 @@ struct fast_timer *fast_timer_list = NULL;
150#define DEBUG_LOG_MAX 128 60#define DEBUG_LOG_MAX 128
151static const char * debug_log_string[DEBUG_LOG_MAX]; 61static const char * debug_log_string[DEBUG_LOG_MAX];
152static unsigned long debug_log_value[DEBUG_LOG_MAX]; 62static unsigned long debug_log_value[DEBUG_LOG_MAX];
153static int debug_log_cnt = 0; 63static unsigned int debug_log_cnt;
154static int debug_log_cnt_wrapped = 0; 64static unsigned int debug_log_cnt_wrapped;
155 65
156#define DEBUG_LOG(string, value) \ 66#define DEBUG_LOG(string, value) \
157{ \ 67{ \
@@ -206,45 +116,29 @@ int timer_freq_settings[NUM_TIMER_STATS];
206int timer_delay_settings[NUM_TIMER_STATS]; 116int timer_delay_settings[NUM_TIMER_STATS];
207 117
208/* Not true gettimeofday, only checks the jiffies (uptime) + useconds */ 118/* Not true gettimeofday, only checks the jiffies (uptime) + useconds */
209void __INLINE__ do_gettimeofday_fast(struct timeval *tv) 119inline void do_gettimeofday_fast(struct fasttime_t *tv)
210{ 120{
211 unsigned long sec = jiffies; 121 tv->tv_jiff = jiffies;
212 unsigned long usec = GET_JIFFIES_USEC(); 122 tv->tv_usec = GET_JIFFIES_USEC();
213
214 usec += (sec % HZ) * (1000000 / HZ);
215 sec = sec / HZ;
216
217 if (usec > 1000000)
218 {
219 usec -= 1000000;
220 sec++;
221 }
222 tv->tv_sec = sec;
223 tv->tv_usec = usec;
224} 123}
225 124
226int __INLINE__ timeval_cmp(struct timeval *t0, struct timeval *t1) 125inline int fasttime_cmp(struct fasttime_t *t0, struct fasttime_t *t1)
227{ 126{
228 if (t0->tv_sec < t1->tv_sec) 127 /* Compare jiffies. Takes care of wrapping */
229 { 128 if (time_before(t0->tv_jiff, t1->tv_jiff))
230 return -1; 129 return -1;
231 } 130 else if (time_after(t0->tv_jiff, t1->tv_jiff))
232 else if (t0->tv_sec > t1->tv_sec) 131 return 1;
233 { 132
234 return 1; 133 /* Compare us */
235 } 134 if (t0->tv_usec < t1->tv_usec)
236 if (t0->tv_usec < t1->tv_usec) 135 return -1;
237 { 136 else if (t0->tv_usec > t1->tv_usec)
238 return -1; 137 return 1;
239 } 138 return 0;
240 else if (t0->tv_usec > t1->tv_usec)
241 {
242 return 1;
243 }
244 return 0;
245} 139}
246 140
247void __INLINE__ start_timer1(unsigned long delay_us) 141inline void start_timer1(unsigned long delay_us)
248{ 142{
249 int freq_index = 0; /* This is the lowest resolution */ 143 int freq_index = 0; /* This is the lowest resolution */
250 unsigned long upper_limit = MAX_DELAY_US; 144 unsigned long upper_limit = MAX_DELAY_US;
@@ -285,7 +179,7 @@ void __INLINE__ start_timer1(unsigned long delay_us)
285 timer_freq_settings[fast_timers_started % NUM_TIMER_STATS] = freq_index; 179 timer_freq_settings[fast_timers_started % NUM_TIMER_STATS] = freq_index;
286 timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us; 180 timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us;
287 181
288 D1(printk("start_timer1 : %d us freq: %i div: %i\n", 182 D1(printk(KERN_DEBUG "start_timer1 : %d us freq: %i div: %i\n",
289 delay_us, freq_index, div)); 183 delay_us, freq_index, div));
290 /* Clear timer1 irq */ 184 /* Clear timer1 irq */
291 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); 185 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr);
@@ -340,7 +234,7 @@ void start_one_shot_timer(struct fast_timer *t,
340 printk(KERN_WARNING 234 printk(KERN_WARNING
341 "timer name: %s data: 0x%08lX already in list!\n", name, data); 235 "timer name: %s data: 0x%08lX already in list!\n", name, data);
342 sanity_failed++; 236 sanity_failed++;
343 return; 237 goto done;
344 } 238 }
345 else 239 else
346 { 240 {
@@ -356,11 +250,11 @@ void start_one_shot_timer(struct fast_timer *t,
356 t->name = name; 250 t->name = name;
357 251
358 t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000; 252 t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000;
359 t->tv_expires.tv_sec = t->tv_set.tv_sec + delay_us / 1000000; 253 t->tv_expires.tv_jiff = t->tv_set.tv_jiff + delay_us / 1000000 / HZ;
360 if (t->tv_expires.tv_usec > 1000000) 254 if (t->tv_expires.tv_usec > 1000000)
361 { 255 {
362 t->tv_expires.tv_usec -= 1000000; 256 t->tv_expires.tv_usec -= 1000000;
363 t->tv_expires.tv_sec++; 257 t->tv_expires.tv_jiff += HZ;
364 } 258 }
365#ifdef FAST_TIMER_LOG 259#ifdef FAST_TIMER_LOG
366 timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t; 260 timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t;
@@ -368,7 +262,7 @@ void start_one_shot_timer(struct fast_timer *t,
368 fast_timers_added++; 262 fast_timers_added++;
369 263
370 /* Check if this should timeout before anything else */ 264 /* Check if this should timeout before anything else */
371 if (tmp == NULL || timeval_cmp(&t->tv_expires, &tmp->tv_expires) < 0) 265 if (tmp == NULL || fasttime_cmp(&t->tv_expires, &tmp->tv_expires) < 0)
372 { 266 {
373 /* Put first in list and modify the timer value */ 267 /* Put first in list and modify the timer value */
374 t->prev = NULL; 268 t->prev = NULL;
@@ -384,8 +278,8 @@ void start_one_shot_timer(struct fast_timer *t,
384 start_timer1(delay_us); 278 start_timer1(delay_us);
385 } else { 279 } else {
386 /* Put in correct place in list */ 280 /* Put in correct place in list */
387 while (tmp->next && 281 while (tmp->next && fasttime_cmp(&t->tv_expires,
388 timeval_cmp(&t->tv_expires, &tmp->next->tv_expires) > 0) 282 &tmp->next->tv_expires) > 0)
389 { 283 {
390 tmp = tmp->next; 284 tmp = tmp->next;
391 } 285 }
@@ -401,6 +295,7 @@ void start_one_shot_timer(struct fast_timer *t,
401 295
402 D2(printk("start_one_shot_timer: %d us done\n", delay_us)); 296 D2(printk("start_one_shot_timer: %d us done\n", delay_us));
403 297
298done:
404 local_irq_restore(flags); 299 local_irq_restore(flags);
405} /* start_one_shot_timer */ 300} /* start_one_shot_timer */
406 301
@@ -444,11 +339,18 @@ int del_fast_timer(struct fast_timer * t)
444/* Timer 1 interrupt handler */ 339/* Timer 1 interrupt handler */
445 340
446static irqreturn_t 341static irqreturn_t
447timer1_handler(int irq, void *dev_id, struct pt_regs *regs) 342timer1_handler(int irq, void *dev_id)
448{ 343{
449 struct fast_timer *t; 344 struct fast_timer *t;
450 unsigned long flags; 345 unsigned long flags;
451 346
347 /* We keep interrupts disabled not only when we modify the
348 * fast timer list, but any time we hold a reference to a
349 * timer in the list, since del_fast_timer may be called
350 * from (another) interrupt context. Thus, the only time
351 * when interrupts are enabled is when calling the timer
352 * callback function.
353 */
452 local_irq_save(flags); 354 local_irq_save(flags);
453 355
454 /* Clear timer1 irq */ 356 /* Clear timer1 irq */
@@ -466,18 +368,19 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
466 fast_timer_running = 0; 368 fast_timer_running = 0;
467 fast_timer_ints++; 369 fast_timer_ints++;
468 370
469 local_irq_restore(flags);
470
471 t = fast_timer_list; 371 t = fast_timer_list;
472 while (t) 372 while (t)
473 { 373 {
474 struct timeval tv; 374 struct fasttime_t tv;
375 fast_timer_function_type *f;
376 unsigned long d;
475 377
476 /* Has it really expired? */ 378 /* Has it really expired? */
477 do_gettimeofday_fast(&tv); 379 do_gettimeofday_fast(&tv);
478 D1(printk("t: %is %06ius\n", tv.tv_sec, tv.tv_usec)); 380 D1(printk(KERN_DEBUG "t: %is %06ius\n",
381 tv.tv_jiff, tv.tv_usec));
479 382
480 if (timeval_cmp(&t->tv_expires, &tv) <= 0) 383 if (fasttime_cmp(&t->tv_expires, &tv) <= 0)
481 { 384 {
482 /* Yes it has expired */ 385 /* Yes it has expired */
483#ifdef FAST_TIMER_LOG 386#ifdef FAST_TIMER_LOG
@@ -486,7 +389,6 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
486 fast_timers_expired++; 389 fast_timers_expired++;
487 390
488 /* Remove this timer before call, since it may reuse the timer */ 391 /* Remove this timer before call, since it may reuse the timer */
489 local_irq_save(flags);
490 if (t->prev) 392 if (t->prev)
491 { 393 {
492 t->prev->next = t->next; 394 t->prev->next = t->next;
@@ -501,16 +403,23 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
501 } 403 }
502 t->prev = NULL; 404 t->prev = NULL;
503 t->next = NULL; 405 t->next = NULL;
504 local_irq_restore(flags);
505 406
506 if (t->function != NULL) 407 /* Save function callback data before enabling
507 { 408 * interrupts, since the timer may be removed and
508 t->function(t->data); 409 * we don't know how it was allocated
509 } 410 * (e.g. ->function and ->data may become overwritten
510 else 411 * after deletion if the timer was stack-allocated).
511 { 412 */
413 f = t->function;
414 d = t->data;
415
416 if (f != NULL) {
417 /* Run callback with interrupts enabled. */
418 local_irq_restore(flags);
419 f(d);
420 local_irq_save(flags);
421 } else
512 DEBUG_LOG("!timer1 %i function==NULL!\n", fast_timer_ints); 422 DEBUG_LOG("!timer1 %i function==NULL!\n", fast_timer_ints);
513 }
514 } 423 }
515 else 424 else
516 { 425 {
@@ -518,16 +427,20 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
518 D1(printk(".\n")); 427 D1(printk(".\n"));
519 } 428 }
520 429
521 local_irq_save(flags);
522 if ((t = fast_timer_list) != NULL) 430 if ((t = fast_timer_list) != NULL)
523 { 431 {
524 /* Start next timer.. */ 432 /* Start next timer.. */
525 long us; 433 long us = 0;
526 struct timeval tv; 434 struct fasttime_t tv;
527 435
528 do_gettimeofday_fast(&tv); 436 do_gettimeofday_fast(&tv);
529 us = ((t->tv_expires.tv_sec - tv.tv_sec) * 1000000 + 437
530 t->tv_expires.tv_usec - tv.tv_usec); 438 /* time_after_eq takes care of wrapping */
439 if (time_after_eq(t->tv_expires.tv_jiff, tv.tv_jiff))
440 us = ((t->tv_expires.tv_jiff - tv.tv_jiff) *
441 1000000 / HZ + t->tv_expires.tv_usec -
442 tv.tv_usec);
443
531 if (us > 0) 444 if (us > 0)
532 { 445 {
533 if (!fast_timer_running) 446 if (!fast_timer_running)
@@ -537,7 +450,6 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
537#endif 450#endif
538 start_timer1(us); 451 start_timer1(us);
539 } 452 }
540 local_irq_restore(flags);
541 break; 453 break;
542 } 454 }
543 else 455 else
@@ -548,9 +460,10 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
548 D1(printk("e! %d\n", us)); 460 D1(printk("e! %d\n", us));
549 } 461 }
550 } 462 }
551 local_irq_restore(flags);
552 } 463 }
553 464
465 local_irq_restore(flags);
466
554 if (!t) 467 if (!t)
555 { 468 {
556 D1(printk("t1 stop!\n")); 469 D1(printk("t1 stop!\n"));
@@ -575,28 +488,17 @@ static void wake_up_func(unsigned long data)
575void schedule_usleep(unsigned long us) 488void schedule_usleep(unsigned long us)
576{ 489{
577 struct fast_timer t; 490 struct fast_timer t;
578#ifdef DECLARE_WAITQUEUE
579 wait_queue_head_t sleep_wait; 491 wait_queue_head_t sleep_wait;
580 init_waitqueue_head(&sleep_wait); 492 init_waitqueue_head(&sleep_wait);
581 {
582 DECLARE_WAITQUEUE(wait, current);
583#else
584 struct wait_queue *sleep_wait = NULL;
585 struct wait_queue wait = { current, NULL };
586#endif
587 493
588 D1(printk("schedule_usleep(%d)\n", us)); 494 D1(printk("schedule_usleep(%d)\n", us));
589 add_wait_queue(&sleep_wait, &wait);
590 set_current_state(TASK_INTERRUPTIBLE);
591 start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us, 495 start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us,
592 "usleep"); 496 "usleep");
593 schedule(); 497 /* Uninterruptible sleep on the fast timer. (The condition is somewhat
594 set_current_state(TASK_RUNNING); 498 * redundant since the timer is what wakes us up.) */
595 remove_wait_queue(&sleep_wait, &wait); 499 wait_event(sleep_wait, !fast_timer_pending(&t));
500
596 D1(printk("done schedule_usleep(%d)\n", us)); 501 D1(printk("done schedule_usleep(%d)\n", us));
597#ifdef DECLARE_WAITQUEUE
598 }
599#endif
600} 502}
601 503
602#ifdef CONFIG_PROC_FS 504#ifdef CONFIG_PROC_FS
@@ -616,7 +518,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
616 unsigned long flags; 518 unsigned long flags;
617 int i = 0; 519 int i = 0;
618 int num_to_show; 520 int num_to_show;
619 struct timeval tv; 521 struct fasttime_t tv;
620 struct fast_timer *t, *nextt; 522 struct fast_timer *t, *nextt;
621 static char *bigbuf = NULL; 523 static char *bigbuf = NULL;
622 static unsigned long used; 524 static unsigned long used;
@@ -624,7 +526,8 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
624 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) 526 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE)))
625 { 527 {
626 used = 0; 528 used = 0;
627 bigbuf[0] = '\0'; 529 if (buf)
530 buf[0] = '\0';
628 return 0; 531 return 0;
629 } 532 }
630 533
@@ -646,7 +549,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
646 used += sprintf(bigbuf + used, "Fast timer running: %s\n", 549 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
647 fast_timer_running ? "yes" : "no"); 550 fast_timer_running ? "yes" : "no");
648 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", 551 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
649 (unsigned long)tv.tv_sec, 552 (unsigned long)tv.tv_jiff,
650 (unsigned long)tv.tv_usec); 553 (unsigned long)tv.tv_usec);
651#ifdef FAST_TIMER_SANITY_CHECKS 554#ifdef FAST_TIMER_SANITY_CHECKS
652 used += sprintf(bigbuf + used, "Sanity failed: %i\n", 555 used += sprintf(bigbuf + used, "Sanity failed: %i\n",
@@ -696,9 +599,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
696 "d: %6li us data: 0x%08lX" 599 "d: %6li us data: 0x%08lX"
697 "\n", 600 "\n",
698 t->name, 601 t->name,
699 (unsigned long)t->tv_set.tv_sec, 602 (unsigned long)t->tv_set.tv_jiff,
700 (unsigned long)t->tv_set.tv_usec, 603 (unsigned long)t->tv_set.tv_usec,
701 (unsigned long)t->tv_expires.tv_sec, 604 (unsigned long)t->tv_expires.tv_jiff,
702 (unsigned long)t->tv_expires.tv_usec, 605 (unsigned long)t->tv_expires.tv_usec,
703 t->delay_us, 606 t->delay_us,
704 t->data 607 t->data
@@ -718,9 +621,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
718 "d: %6li us data: 0x%08lX" 621 "d: %6li us data: 0x%08lX"
719 "\n", 622 "\n",
720 t->name, 623 t->name,
721 (unsigned long)t->tv_set.tv_sec, 624 (unsigned long)t->tv_set.tv_jiff,
722 (unsigned long)t->tv_set.tv_usec, 625 (unsigned long)t->tv_set.tv_usec,
723 (unsigned long)t->tv_expires.tv_sec, 626 (unsigned long)t->tv_expires.tv_jiff,
724 (unsigned long)t->tv_expires.tv_usec, 627 (unsigned long)t->tv_expires.tv_usec,
725 t->delay_us, 628 t->delay_us,
726 t->data 629 t->data
@@ -738,9 +641,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
738 "d: %6li us data: 0x%08lX" 641 "d: %6li us data: 0x%08lX"
739 "\n", 642 "\n",
740 t->name, 643 t->name,
741 (unsigned long)t->tv_set.tv_sec, 644 (unsigned long)t->tv_set.tv_jiff,
742 (unsigned long)t->tv_set.tv_usec, 645 (unsigned long)t->tv_set.tv_usec,
743 (unsigned long)t->tv_expires.tv_sec, 646 (unsigned long)t->tv_expires.tv_jiff,
744 (unsigned long)t->tv_expires.tv_usec, 647 (unsigned long)t->tv_expires.tv_usec,
745 t->delay_us, 648 t->delay_us,
746 t->data 649 t->data
@@ -761,15 +664,15 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
761/* " func: 0x%08lX" */ 664/* " func: 0x%08lX" */
762 "\n", 665 "\n",
763 t->name, 666 t->name,
764 (unsigned long)t->tv_set.tv_sec, 667 (unsigned long)t->tv_set.tv_jiff,
765 (unsigned long)t->tv_set.tv_usec, 668 (unsigned long)t->tv_set.tv_usec,
766 (unsigned long)t->tv_expires.tv_sec, 669 (unsigned long)t->tv_expires.tv_jiff,
767 (unsigned long)t->tv_expires.tv_usec, 670 (unsigned long)t->tv_expires.tv_usec,
768 t->delay_us, 671 t->delay_us,
769 t->data 672 t->data
770/* , t->function */ 673/* , t->function */
771 ); 674 );
772 local_irq_disable(); 675 local_irq_save(flags);
773 if (t->next != nextt) 676 if (t->next != nextt)
774 { 677 {
775 printk(KERN_WARNING "timer removed!\n"); 678 printk(KERN_WARNING "timer removed!\n");
@@ -798,7 +701,7 @@ static volatile int num_test_timeout = 0;
798static struct fast_timer tr[10]; 701static struct fast_timer tr[10];
799static int exp_num[10]; 702static int exp_num[10];
800 703
801static struct timeval tv_exp[100]; 704static struct fasttime_t tv_exp[100];
802 705
803static void test_timeout(unsigned long data) 706static void test_timeout(unsigned long data)
804{ 707{
@@ -836,7 +739,7 @@ static void fast_timer_test(void)
836 int prev_num; 739 int prev_num;
837 int j; 740 int j;
838 741
839 struct timeval tv, tv0, tv1, tv2; 742 struct fasttime_t tv, tv0, tv1, tv2;
840 743
841 printk("fast_timer_test() start\n"); 744 printk("fast_timer_test() start\n");
842 do_gettimeofday_fast(&tv); 745 do_gettimeofday_fast(&tv);
@@ -849,7 +752,8 @@ static void fast_timer_test(void)
849 { 752 {
850 do_gettimeofday_fast(&tv_exp[j]); 753 do_gettimeofday_fast(&tv_exp[j]);
851 } 754 }
852 printk("fast_timer_test() %is %06i\n", tv.tv_sec, tv.tv_usec); 755 printk(KERN_DEBUG "fast_timer_test() %is %06i\n",
756 tv.tv_jiff, tv.tv_usec);
853 757
854 for (j = 0; j < 1000; j++) 758 for (j = 0; j < 1000; j++)
855 { 759 {
@@ -858,12 +762,12 @@ static void fast_timer_test(void)
858 } 762 }
859 for (j = 0; j < 100; j++) 763 for (j = 0; j < 100; j++)
860 { 764 {
861 printk("%i.%i %i.%i %i.%i %i.%i %i.%i\n", 765 printk(KERN_DEBUG "%i.%i %i.%i %i.%i %i.%i %i.%i\n",
862 tv_exp[j].tv_sec,tv_exp[j].tv_usec, 766 tv_exp[j].tv_jiff, tv_exp[j].tv_usec,
863 tv_exp[j+1].tv_sec,tv_exp[j+1].tv_usec, 767 tv_exp[j+1].tv_jiff, tv_exp[j+1].tv_usec,
864 tv_exp[j+2].tv_sec,tv_exp[j+2].tv_usec, 768 tv_exp[j+2].tv_jiff, tv_exp[j+2].tv_usec,
865 tv_exp[j+3].tv_sec,tv_exp[j+3].tv_usec, 769 tv_exp[j+3].tv_jiff, tv_exp[j+3].tv_usec,
866 tv_exp[j+4].tv_sec,tv_exp[j+4].tv_usec); 770 tv_exp[j+4].tv_jiff, tv_exp[j+4].tv_usec);
867 j += 4; 771 j += 4;
868 } 772 }
869 do_gettimeofday_fast(&tv0); 773 do_gettimeofday_fast(&tv0);
@@ -895,9 +799,12 @@ static void fast_timer_test(void)
895 } 799 }
896 } 800 }
897 do_gettimeofday_fast(&tv2); 801 do_gettimeofday_fast(&tv2);
898 printk("Timers started %is %06i\n", tv0.tv_sec, tv0.tv_usec); 802 printk(KERN_DEBUG "Timers started %is %06i\n",
899 printk("Timers started at %is %06i\n", tv1.tv_sec, tv1.tv_usec); 803 tv0.tv_jiff, tv0.tv_usec);
900 printk("Timers done %is %06i\n", tv2.tv_sec, tv2.tv_usec); 804 printk(KERN_DEBUG "Timers started at %is %06i\n",
805 tv1.tv_jiff, tv1.tv_usec);
806 printk(KERN_DEBUG "Timers done %is %06i\n",
807 tv2.tv_jiff, tv2.tv_usec);
901 DP(printk("buf0:\n"); 808 DP(printk("buf0:\n");
902 printk(buf0); 809 printk(buf0);
903 printk("buf1:\n"); 810 printk("buf1:\n");
@@ -919,9 +826,9 @@ static void fast_timer_test(void)
919 printk("%-10s set: %6is %06ius exp: %6is %06ius " 826 printk("%-10s set: %6is %06ius exp: %6is %06ius "
920 "data: 0x%08X func: 0x%08X\n", 827 "data: 0x%08X func: 0x%08X\n",
921 t->name, 828 t->name,
922 t->tv_set.tv_sec, 829 t->tv_set.tv_jiff,
923 t->tv_set.tv_usec, 830 t->tv_set.tv_usec,
924 t->tv_expires.tv_sec, 831 t->tv_expires.tv_jiff,
925 t->tv_expires.tv_usec, 832 t->tv_expires.tv_usec,
926 t->data, 833 t->data,
927 t->function 834 t->function
@@ -929,10 +836,12 @@ static void fast_timer_test(void)
929 836
930 printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n", 837 printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n",
931 t->delay_us, 838 t->delay_us,
932 tv_exp[j].tv_sec, 839 tv_exp[j].tv_jiff,
933 tv_exp[j].tv_usec, 840 tv_exp[j].tv_usec,
934 exp_num[j], 841 exp_num[j],
935 (tv_exp[j].tv_sec - t->tv_expires.tv_sec)*1000000 + tv_exp[j].tv_usec - t->tv_expires.tv_usec); 842 (tv_exp[j].tv_jiff - t->tv_expires.tv_jiff) *
843 1000000 + tv_exp[j].tv_usec -
844 t->tv_expires.tv_usec);
936 } 845 }
937 proc_fasttimer_read(buf5, NULL, 0, 0, 0); 846 proc_fasttimer_read(buf5, NULL, 0, 0, 0);
938 printk("buf5 after all done:\n"); 847 printk("buf5 after all done:\n");
@@ -942,7 +851,7 @@ static void fast_timer_test(void)
942#endif 851#endif
943 852
944 853
945void fast_timer_init(void) 854int fast_timer_init(void)
946{ 855{
947 /* For some reason, request_irq() hangs when called froom time_init() */ 856 /* For some reason, request_irq() hangs when called froom time_init() */
948 if (!fast_timer_is_init) 857 if (!fast_timer_is_init)
@@ -975,4 +884,6 @@ void fast_timer_init(void)
975 fast_timer_test(); 884 fast_timer_test();
976#endif 885#endif
977 } 886 }
887 return 0;
978} 888}
889__initcall(fast_timer_init);
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c
index 29d48ad00df9..3a9114e89edf 100644
--- a/arch/cris/arch-v10/kernel/io_interface_mux.c
+++ b/arch/cris/arch-v10/kernel/io_interface_mux.c
@@ -304,7 +304,7 @@ static unsigned char clear_group_from_set(const unsigned char groups, struct if_
304static struct if_group *get_group(const unsigned char groups) 304static struct if_group *get_group(const unsigned char groups)
305{ 305{
306 int i; 306 int i;
307 for (i = 0; i < sizeof(if_groups)/sizeof(struct if_group); i++) { 307 for (i = 0; i < ARRAY_SIZE(if_groups); i++) {
308 if (groups & if_groups[i].group) { 308 if (groups & if_groups[i].group) {
309 return &if_groups[i]; 309 return &if_groups[i];
310 } 310 }
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index 845c95f6e871..e06ab0050d37 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -12,10 +12,16 @@
12 */ 12 */
13 13
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <asm/current.h>
15#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/interrupt.h>
16#include <linux/kernel.h> 18#include <linux/kernel.h>
17#include <linux/init.h> 19#include <linux/init.h>
18 20
21/* From kgdb.c. */
22extern void kgdb_init(void);
23extern void breakpoint(void);
24
19#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr)); 25#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
20#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr)); 26#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
21 27
@@ -75,8 +81,8 @@ BUILD_IRQ(12, 0x1000)
75BUILD_IRQ(13, 0x2000) 81BUILD_IRQ(13, 0x2000)
76void mmu_bus_fault(void); /* IRQ 14 is the bus fault interrupt */ 82void mmu_bus_fault(void); /* IRQ 14 is the bus fault interrupt */
77void multiple_interrupt(void); /* IRQ 15 is the multiple IRQ interrupt */ 83void multiple_interrupt(void); /* IRQ 15 is the multiple IRQ interrupt */
78BUILD_IRQ(16, 0x10000) 84BUILD_IRQ(16, 0x10000 | 0x20000) /* ethernet tx interrupt needs to block rx */
79BUILD_IRQ(17, 0x20000) 85BUILD_IRQ(17, 0x20000 | 0x10000) /* ...and vice versa */
80BUILD_IRQ(18, 0x40000) 86BUILD_IRQ(18, 0x40000)
81BUILD_IRQ(19, 0x80000) 87BUILD_IRQ(19, 0x80000)
82BUILD_IRQ(20, 0x100000) 88BUILD_IRQ(20, 0x100000)
@@ -147,6 +153,55 @@ void system_call(void); /* from entry.S */
147void do_sigtrap(void); /* from entry.S */ 153void do_sigtrap(void); /* from entry.S */
148void gdb_handle_breakpoint(void); /* from entry.S */ 154void gdb_handle_breakpoint(void); /* from entry.S */
149 155
156extern void do_IRQ(int irq, struct pt_regs * regs);
157
158/* Handle multiple IRQs */
159void do_multiple_IRQ(struct pt_regs* regs)
160{
161 int bit;
162 unsigned masked;
163 unsigned mask;
164 unsigned ethmask = 0;
165
166 /* Get interrupts to mask and handle */
167 mask = masked = *R_VECT_MASK_RD;
168
169 /* Never mask timer IRQ */
170 mask &= ~(IO_MASK(R_VECT_MASK_RD, timer0));
171
172 /*
173 * If either ethernet interrupt (rx or tx) is active then block
174 * the other one too. Unblock afterwards also.
175 */
176 if (mask &
177 (IO_STATE(R_VECT_MASK_RD, dma0, active) |
178 IO_STATE(R_VECT_MASK_RD, dma1, active))) {
179 ethmask = (IO_MASK(R_VECT_MASK_RD, dma0) |
180 IO_MASK(R_VECT_MASK_RD, dma1));
181 }
182
183 /* Block them */
184 *R_VECT_MASK_CLR = (mask | ethmask);
185
186 /* An extra irq_enter here to prevent softIRQs to run after
187 * each do_IRQ. This will decrease the interrupt latency.
188 */
189 irq_enter();
190
191 /* Handle all IRQs */
192 for (bit = 2; bit < 32; bit++) {
193 if (masked & (1 << bit)) {
194 do_IRQ(bit, regs);
195 }
196 }
197
198 /* This irq_exit() will trigger the soft IRQs. */
199 irq_exit();
200
201 /* Unblock the IRQs again */
202 *R_VECT_MASK_SET = (masked | ethmask);
203}
204
150/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and 205/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and
151 setting the irq vector table. 206 setting the irq vector table.
152*/ 207*/
diff --git a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c
index 682ef955aec4..de27b50b72a2 100644
--- a/arch/cris/arch-v10/kernel/setup.c
+++ b/arch/cris/arch-v10/kernel/setup.c
@@ -13,6 +13,7 @@
13#include <linux/seq_file.h> 13#include <linux/seq_file.h>
14#include <linux/proc_fs.h> 14#include <linux/proc_fs.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/param.h>
16 17
17#ifdef CONFIG_PROC_FS 18#ifdef CONFIG_PROC_FS
18#define HAS_FPU 0x0001 19#define HAS_FPU 0x0001
@@ -56,8 +57,8 @@ int show_cpuinfo(struct seq_file *m, void *v)
56 57
57 revision = rdvr(); 58 revision = rdvr();
58 59
59 if (revision >= sizeof cpu_info/sizeof *cpu_info) 60 if (revision >= ARRAY_SIZE(cpu_info))
60 info = &cpu_info[sizeof cpu_info/sizeof *cpu_info - 1]; 61 info = &cpu_info[ARRAY_SIZE(cpu_info) - 1];
61 else 62 else
62 info = &cpu_info[revision]; 63 info = &cpu_info[revision];
63 64
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 575a14bb1106..5976f6199c47 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -1,5 +1,4 @@
1/* $Id: time.c,v 1.5 2004/09/29 06:12:46 starvik Exp $ 1/*
2 *
3 * linux/arch/cris/arch-v10/kernel/time.c 2 * linux/arch/cris/arch-v10/kernel/time.c
4 * 3 *
5 * Copyright (C) 1991, 1992, 1995 Linus Torvalds 4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
@@ -20,6 +19,7 @@
20#include <asm/io.h> 19#include <asm/io.h>
21#include <asm/delay.h> 20#include <asm/delay.h>
22#include <asm/rtc.h> 21#include <asm/rtc.h>
22#include <asm/irq_regs.h>
23 23
24/* define this if you need to use print_timestamp */ 24/* define this if you need to use print_timestamp */
25/* it will make jiffies at 96 hz instead of 100 hz though */ 25/* it will make jiffies at 96 hz instead of 100 hz though */
@@ -201,8 +201,9 @@ static long last_rtc_update = 0;
201extern void cris_do_profile(struct pt_regs *regs); 201extern void cris_do_profile(struct pt_regs *regs);
202 202
203static inline irqreturn_t 203static inline irqreturn_t
204timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 204timer_interrupt(int irq, void *dev_id)
205{ 205{
206 struct pt_regs *regs = get_irq_regs();
206 /* acknowledge the timer irq */ 207 /* acknowledge the timer irq */
207 208
208#ifdef USE_CASCADE_TIMERS 209#ifdef USE_CASCADE_TIMERS
@@ -221,9 +222,11 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
221#endif 222#endif
222 223
223 /* reset watchdog otherwise it resets us! */ 224 /* reset watchdog otherwise it resets us! */
224
225 reset_watchdog(); 225 reset_watchdog();
226 226
227 /* Update statistics. */
228 update_process_times(user_mode(regs));
229
227 /* call the real timer interrupt handler */ 230 /* call the real timer interrupt handler */
228 231
229 do_timer(1); 232 do_timer(1);
diff --git a/arch/cris/arch-v10/lib/memset.c b/arch/cris/arch-v10/lib/memset.c
index 82bb66839171..42c1101043a3 100644
--- a/arch/cris/arch-v10/lib/memset.c
+++ b/arch/cris/arch-v10/lib/memset.c
@@ -66,7 +66,7 @@ void *memset(void *pdst,
66 66
67 { 67 {
68 register char *dst __asm__ ("r13") = pdst; 68 register char *dst __asm__ ("r13") = pdst;
69 69
70 /* This is NONPORTABLE, but since this whole routine is */ 70 /* This is NONPORTABLE, but since this whole routine is */
71 /* grossly nonportable that doesn't matter. */ 71 /* grossly nonportable that doesn't matter. */
72 72
@@ -110,52 +110,52 @@ void *memset(void *pdst,
110 If you want to check that the allocation was right; then 110 If you want to check that the allocation was right; then
111 check the equalities in the first comment. It should say 111 check the equalities in the first comment. It should say
112 "r13=r13, r12=r12, r11=r11" */ 112 "r13=r13, r12=r12, r11=r11" */
113 __asm__ volatile (" 113 __asm__ volatile ("\n\
114 ;; Check that the following is true (same register names on 114 ;; Check that the following is true (same register names on \n\
115 ;; both sides of equal sign, as in r8=r8): 115 ;; both sides of equal sign, as in r8=r8): \n\
116 ;; %0=r13, %1=r12, %4=r11 116 ;; %0=r13, %1=r12, %4=r11 \n\
117 ;; 117 ;; \n\
118 ;; Save the registers we'll clobber in the movem process 118 ;; Save the registers we'll clobber in the movem process \n\
119 ;; on the stack. Don't mention them to gcc, it will only be 119 ;; on the stack. Don't mention them to gcc, it will only be \n\
120 ;; upset. 120 ;; upset. \n\
121 subq 11*4,$sp 121 subq 11*4,$sp \n\
122 movem $r10,[$sp] 122 movem $r10,[$sp] \n\
123 123 \n\
124 move.d $r11,$r0 124 move.d $r11,$r0 \n\
125 move.d $r11,$r1 125 move.d $r11,$r1 \n\
126 move.d $r11,$r2 126 move.d $r11,$r2 \n\
127 move.d $r11,$r3 127 move.d $r11,$r3 \n\
128 move.d $r11,$r4 128 move.d $r11,$r4 \n\
129 move.d $r11,$r5 129 move.d $r11,$r5 \n\
130 move.d $r11,$r6 130 move.d $r11,$r6 \n\
131 move.d $r11,$r7 131 move.d $r11,$r7 \n\
132 move.d $r11,$r8 132 move.d $r11,$r8 \n\
133 move.d $r11,$r9 133 move.d $r11,$r9 \n\
134 move.d $r11,$r10 134 move.d $r11,$r10 \n\
135 135 \n\
136 ;; Now we've got this: 136 ;; Now we've got this: \n\
137 ;; r13 - dst 137 ;; r13 - dst \n\
138 ;; r12 - n 138 ;; r12 - n \n\
139 139 \n\
140 ;; Update n for the first loop 140 ;; Update n for the first loop \n\
141 subq 12*4,$r12 141 subq 12*4,$r12 \n\
1420: 1420: \n\
143 subq 12*4,$r12 143 subq 12*4,$r12 \n\
144 bge 0b 144 bge 0b \n\
145 movem $r11,[$r13+] 145 movem $r11,[$r13+] \n\
146 146 \n\
147 addq 12*4,$r12 ;; compensate for last loop underflowing n 147 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\
148 148 \n\
149 ;; Restore registers from stack 149 ;; Restore registers from stack \n\
150 movem [$sp+],$r10" 150 movem [$sp+],$r10"
151 151
152 /* Outputs */ : "=r" (dst), "=r" (n) 152 /* Outputs */ : "=r" (dst), "=r" (n)
153 /* Inputs */ : "0" (dst), "1" (n), "r" (lc)); 153 /* Inputs */ : "0" (dst), "1" (n), "r" (lc));
154 154
155 } 155 }
156 156
157 /* Either we directly starts copying, using dword copying 157 /* Either we directly starts copying, using dword copying
158 in a loop, or we copy as much as possible with 'movem' 158 in a loop, or we copy as much as possible with 'movem'
159 and then the last block (<44 bytes) is copied here. 159 and then the last block (<44 bytes) is copied here.
160 This will work since 'movem' will have updated src,dst,n. */ 160 This will work since 'movem' will have updated src,dst,n. */
161 161
diff --git a/arch/cris/arch-v10/lib/string.c b/arch/cris/arch-v10/lib/string.c
index 15d6662b03b1..7161a2bef4fe 100644
--- a/arch/cris/arch-v10/lib/string.c
+++ b/arch/cris/arch-v10/lib/string.c
@@ -95,33 +95,33 @@ void *memcpy(void *pdst,
95 If you want to check that the allocation was right; then 95 If you want to check that the allocation was right; then
96 check the equalities in the first comment. It should say 96 check the equalities in the first comment. It should say
97 "r13=r13, r11=r11, r12=r12" */ 97 "r13=r13, r11=r11, r12=r12" */
98 __asm__ volatile (" 98 __asm__ volatile ("\n\
99 ;; Check that the following is true (same register names on 99 ;; Check that the following is true (same register names on \n\
100 ;; both sides of equal sign, as in r8=r8): 100 ;; both sides of equal sign, as in r8=r8): \n\
101 ;; %0=r13, %1=r11, %2=r12 101 ;; %0=r13, %1=r11, %2=r12 \n\
102 ;; 102 ;; \n\
103 ;; Save the registers we'll use in the movem process 103 ;; Save the registers we'll use in the movem process \n\
104 ;; on the stack. 104 ;; on the stack. \n\
105 subq 11*4,$sp 105 subq 11*4,$sp \n\
106 movem $r10,[$sp] 106 movem $r10,[$sp] \n\
107 107 \n\
108 ;; Now we've got this: 108 ;; Now we've got this: \n\
109 ;; r11 - src 109 ;; r11 - src \n\
110 ;; r13 - dst 110 ;; r13 - dst \n\
111 ;; r12 - n 111 ;; r12 - n \n\
112 112 \n\
113 ;; Update n for the first loop 113 ;; Update n for the first loop \n\
114 subq 44,$r12 114 subq 44,$r12 \n\
1150: 1150: \n\
116 movem [$r11+],$r10 116 movem [$r11+],$r10 \n\
117 subq 44,$r12 117 subq 44,$r12 \n\
118 bge 0b 118 bge 0b \n\
119 movem $r10,[$r13+] 119 movem $r10,[$r13+] \n\
120 120 \n\
121 addq 44,$r12 ;; compensate for last loop underflowing n 121 addq 44,$r12 ;; compensate for last loop underflowing n \n\
122 122 \n\
123 ;; Restore registers from stack 123 ;; Restore registers from stack \n\
124 movem [$sp+],$r10" 124 movem [$sp+],$r10"
125 125
126 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n) 126 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n)
127 /* Inputs */ : "0" (dst), "1" (src), "2" (n)); 127 /* Inputs */ : "0" (dst), "1" (src), "2" (n));
diff --git a/arch/cris/arch-v10/lib/usercopy.c b/arch/cris/arch-v10/lib/usercopy.c
index a12c708afc9a..b8e6c0430e5b 100644
--- a/arch/cris/arch-v10/lib/usercopy.c
+++ b/arch/cris/arch-v10/lib/usercopy.c
@@ -92,58 +92,58 @@ __copy_user (void __user *pdst, const void *psrc, unsigned long pn)
92 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ 92 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
93 .err \n\ 93 .err \n\
94 .endif \n\ 94 .endif \n\
95 95 \n\
96 ;; Save the registers we'll use in the movem process 96 ;; Save the registers we'll use in the movem process \n\
97 ;; on the stack. 97 ;; on the stack. \n\
98 subq 11*4,$sp 98 subq 11*4,$sp \n\
99 movem $r10,[$sp] 99 movem $r10,[$sp] \n\
100 100 \n\
101 ;; Now we've got this: 101 ;; Now we've got this: \n\
102 ;; r11 - src 102 ;; r11 - src \n\
103 ;; r13 - dst 103 ;; r13 - dst \n\
104 ;; r12 - n 104 ;; r12 - n \n\
105 105 \n\
106 ;; Update n for the first loop 106 ;; Update n for the first loop \n\
107 subq 44,$r12 107 subq 44,$r12 \n\
108 108 \n\
109; Since the noted PC of a faulting instruction in a delay-slot of a taken 109; Since the noted PC of a faulting instruction in a delay-slot of a taken \n\
110; branch, is that of the branch target, we actually point at the from-movem 110; branch, is that of the branch target, we actually point at the from-movem \n\
111; for this case. There is no ambiguity here; if there was a fault in that 111; for this case. There is no ambiguity here; if there was a fault in that \n\
112; instruction (meaning a kernel oops), the faulted PC would be the address 112; instruction (meaning a kernel oops), the faulted PC would be the address \n\
113; after *that* movem. 113; after *that* movem. \n\
114 114 \n\
1150: 1150: \n\
116 movem [$r11+],$r10 116 movem [$r11+],$r10 \n\
117 subq 44,$r12 117 subq 44,$r12 \n\
118 bge 0b 118 bge 0b \n\
119 movem $r10,[$r13+] 119 movem $r10,[$r13+] \n\
1201: 1201: \n\
121 addq 44,$r12 ;; compensate for last loop underflowing n 121 addq 44,$r12 ;; compensate for last loop underflowing n \n\
122 122 \n\
123 ;; Restore registers from stack 123 ;; Restore registers from stack \n\
124 movem [$sp+],$r10 124 movem [$sp+],$r10 \n\
1252: 1252: \n\
126 .section .fixup,\"ax\" 126 .section .fixup,\"ax\" \n\
127 127 \n\
128; To provide a correct count in r10 of bytes that failed to be copied, 128; To provide a correct count in r10 of bytes that failed to be copied, \n\
129; we jump back into the loop if the loop-branch was taken. There is no 129; we jump back into the loop if the loop-branch was taken. There is no \n\
130; performance penalty for sany use; the program will segfault soon enough. 130; performance penalty for sany use; the program will segfault soon enough.\n\
131 131 \n\
1323: 1323: \n\
133 move.d [$sp],$r10 133 move.d [$sp],$r10 \n\
134 addq 44,$r10 134 addq 44,$r10 \n\
135 move.d $r10,[$sp] 135 move.d $r10,[$sp] \n\
136 jump 0b 136 jump 0b \n\
1374: 1374: \n\
138 movem [$sp+],$r10 138 movem [$sp+],$r10 \n\
139 addq 44,$r10 139 addq 44,$r10 \n\
140 addq 44,$r12 140 addq 44,$r12 \n\
141 jump 2b 141 jump 2b \n\
142 142 \n\
143 .previous 143 .previous \n\
144 .section __ex_table,\"a\" 144 .section __ex_table,\"a\" \n\
145 .dword 0b,3b 145 .dword 0b,3b \n\
146 .dword 1b,4b 146 .dword 1b,4b \n\
147 .previous" 147 .previous"
148 148
149 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) 149 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
@@ -253,59 +253,59 @@ __copy_user_zeroing (void __user *pdst, const void *psrc, unsigned long pn)
253 If you want to check that the allocation was right; then 253 If you want to check that the allocation was right; then
254 check the equalities in the first comment. It should say 254 check the equalities in the first comment. It should say
255 "r13=r13, r11=r11, r12=r12" */ 255 "r13=r13, r11=r11, r12=r12" */
256 __asm__ volatile (" 256 __asm__ volatile ("\n\
257 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ 257 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
258 .err \n\ 258 .err \n\
259 .endif \n\ 259 .endif \n\
260 260 \n\
261 ;; Save the registers we'll use in the movem process 261 ;; Save the registers we'll use in the movem process \n\
262 ;; on the stack. 262 ;; on the stack. \n\
263 subq 11*4,$sp 263 subq 11*4,$sp \n\
264 movem $r10,[$sp] 264 movem $r10,[$sp] \n\
265 265 \n\
266 ;; Now we've got this: 266 ;; Now we've got this: \n\
267 ;; r11 - src 267 ;; r11 - src \n\
268 ;; r13 - dst 268 ;; r13 - dst \n\
269 ;; r12 - n 269 ;; r12 - n \n\
270 270 \n\
271 ;; Update n for the first loop 271 ;; Update n for the first loop \n\
272 subq 44,$r12 272 subq 44,$r12 \n\
2730: 2730: \n\
274 movem [$r11+],$r10 274 movem [$r11+],$r10 \n\
2751: 2751: \n\
276 subq 44,$r12 276 subq 44,$r12 \n\
277 bge 0b 277 bge 0b \n\
278 movem $r10,[$r13+] 278 movem $r10,[$r13+] \n\
279 279 \n\
280 addq 44,$r12 ;; compensate for last loop underflowing n 280 addq 44,$r12 ;; compensate for last loop underflowing n \n\
281 281 \n\
282 ;; Restore registers from stack 282 ;; Restore registers from stack \n\
283 movem [$sp+],$r10 283 movem [$sp+],$r10 \n\
2844: 2844: \n\
285 .section .fixup,\"ax\" 285 .section .fixup,\"ax\" \n\
286 286 \n\
287;; Do not jump back into the loop if we fail. For some uses, we get a 287;; Do not jump back into the loop if we fail. For some uses, we get a \n\
288;; page fault somewhere on the line. Without checking for page limits, 288;; page fault somewhere on the line. Without checking for page limits, \n\
289;; we don't know where, but we need to copy accurately and keep an 289;; we don't know where, but we need to copy accurately and keep an \n\
290;; accurate count; not just clear the whole line. To do that, we fall 290;; accurate count; not just clear the whole line. To do that, we fall \n\
291;; down in the code below, proceeding with smaller amounts. It should 291;; down in the code below, proceeding with smaller amounts. It should \n\
292;; be kept in mind that we have to cater to code like what at one time 292;; be kept in mind that we have to cater to code like what at one time \n\
293;; was in fs/super.c: 293;; was in fs/super.c: \n\
294;; i = size - copy_from_user((void *)page, data, size); 294;; i = size - copy_from_user((void *)page, data, size); \n\
295;; which would cause repeated faults while clearing the remainder of 295;; which would cause repeated faults while clearing the remainder of \n\
296;; the SIZE bytes at PAGE after the first fault. 296;; the SIZE bytes at PAGE after the first fault. \n\
297;; A caveat here is that we must not fall through from a failing page 297;; A caveat here is that we must not fall through from a failing page \n\
298;; to a valid page. 298;; to a valid page. \n\
299 299 \n\
3003: 3003: \n\
301 movem [$sp+],$r10 301 movem [$sp+],$r10 \n\
302 addq 44,$r12 ;; Get back count before faulting point. 302 addq 44,$r12 ;; Get back count before faulting point. \n\
303 subq 44,$r11 ;; Get back pointer to faulting movem-line. 303 subq 44,$r11 ;; Get back pointer to faulting movem-line. \n\
304 jump 4b ;; Fall through, pretending the fault didn't happen. 304 jump 4b ;; Fall through, pretending the fault didn't happen.\n\
305 305 \n\
306 .previous 306 .previous \n\
307 .section __ex_table,\"a\" 307 .section __ex_table,\"a\" \n\
308 .dword 1b,3b 308 .dword 1b,3b \n\
309 .previous" 309 .previous"
310 310
311 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) 311 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
@@ -425,64 +425,64 @@ __do_clear_user (void __user *pto, unsigned long pn)
425 If you want to check that the allocation was right; then 425 If you want to check that the allocation was right; then
426 check the equalities in the first comment. It should say 426 check the equalities in the first comment. It should say
427 something like "r13=r13, r11=r11, r12=r12". */ 427 something like "r13=r13, r11=r11, r12=r12". */
428 __asm__ volatile (" 428 __asm__ volatile ("\n\
429 .ifnc %0%1%2,$r13$r12$r10 \n\ 429 .ifnc %0%1%2,$r13$r12$r10 \n\
430 .err \n\ 430 .err \n\
431 .endif \n\ 431 .endif \n\
432 432 \n\
433 ;; Save the registers we'll clobber in the movem process 433 ;; Save the registers we'll clobber in the movem process \n\
434 ;; on the stack. Don't mention them to gcc, it will only be 434 ;; on the stack. Don't mention them to gcc, it will only be \n\
435 ;; upset. 435 ;; upset. \n\
436 subq 11*4,$sp 436 subq 11*4,$sp \n\
437 movem $r10,[$sp] 437 movem $r10,[$sp] \n\
438 438 \n\
439 clear.d $r0 439 clear.d $r0 \n\
440 clear.d $r1 440 clear.d $r1 \n\
441 clear.d $r2 441 clear.d $r2 \n\
442 clear.d $r3 442 clear.d $r3 \n\
443 clear.d $r4 443 clear.d $r4 \n\
444 clear.d $r5 444 clear.d $r5 \n\
445 clear.d $r6 445 clear.d $r6 \n\
446 clear.d $r7 446 clear.d $r7 \n\
447 clear.d $r8 447 clear.d $r8 \n\
448 clear.d $r9 448 clear.d $r9 \n\
449 clear.d $r10 449 clear.d $r10 \n\
450 clear.d $r11 450 clear.d $r11 \n\
451 451 \n\
452 ;; Now we've got this: 452 ;; Now we've got this: \n\
453 ;; r13 - dst 453 ;; r13 - dst \n\
454 ;; r12 - n 454 ;; r12 - n \n\
455 455 \n\
456 ;; Update n for the first loop 456 ;; Update n for the first loop \n\
457 subq 12*4,$r12 457 subq 12*4,$r12 \n\
4580: 4580: \n\
459 subq 12*4,$r12 459 subq 12*4,$r12 \n\
460 bge 0b 460 bge 0b \n\
461 movem $r11,[$r13+] 461 movem $r11,[$r13+] \n\
4621: 4621: \n\
463 addq 12*4,$r12 ;; compensate for last loop underflowing n 463 addq 12*4,$r12 ;; compensate for last loop underflowing n\n\
464 464 \n\
465 ;; Restore registers from stack 465 ;; Restore registers from stack \n\
466 movem [$sp+],$r10 466 movem [$sp+],$r10 \n\
4672: 4672: \n\
468 .section .fixup,\"ax\" 468 .section .fixup,\"ax\" \n\
4693: 4693: \n\
470 move.d [$sp],$r10 470 move.d [$sp],$r10 \n\
471 addq 12*4,$r10 471 addq 12*4,$r10 \n\
472 move.d $r10,[$sp] 472 move.d $r10,[$sp] \n\
473 clear.d $r10 473 clear.d $r10 \n\
474 jump 0b 474 jump 0b \n\
475 475 \n\
4764: 4764: \n\
477 movem [$sp+],$r10 477 movem [$sp+],$r10 \n\
478 addq 12*4,$r10 478 addq 12*4,$r10 \n\
479 addq 12*4,$r12 479 addq 12*4,$r12 \n\
480 jump 2b 480 jump 2b \n\
481 481 \n\
482 .previous 482 .previous \n\
483 .section __ex_table,\"a\" 483 .section __ex_table,\"a\" \n\
484 .dword 0b,3b 484 .dword 0b,3b \n\
485 .dword 1b,4b 485 .dword 1b,4b \n\
486 .previous" 486 .previous"
487 487
488 /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn) 488 /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn)
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index cc6ba5423754..7f72d7c9e1ce 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -362,8 +362,6 @@ config ETRAX_AXISFLASHMAP
362 select MTD 362 select MTD
363 select MTD_CFI 363 select MTD_CFI
364 select MTD_CFI_AMDSTD 364 select MTD_CFI_AMDSTD
365 select MTD_OBSOLETE_CHIPS
366 select MTD_AMDSTD
367 select MTD_CHAR 365 select MTD_CHAR
368 select MTD_BLOCK 366 select MTD_BLOCK
369 select MTD_PARTITIONS 367 select MTD_PARTITIONS
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
index 3ec12ea44e8e..c5ff95e18269 100644
--- a/arch/cris/arch-v32/drivers/axisflashmap.c
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -190,13 +190,12 @@ static struct mtd_info *probe_cs(struct map_info *map_cs)
190 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", 190 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
191 map_cs->name, map_cs->size, map_cs->map_priv_1); 191 map_cs->name, map_cs->size, map_cs->map_priv_1);
192 192
193#ifdef CONFIG_MTD_AMDSTD
194 mtd_cs = do_map_probe("amd_flash", map_cs);
195#endif
196#ifdef CONFIG_MTD_CFI 193#ifdef CONFIG_MTD_CFI
197 if (!mtd_cs) {
198 mtd_cs = do_map_probe("cfi_probe", map_cs); 194 mtd_cs = do_map_probe("cfi_probe", map_cs);
199 } 195#endif
196#ifdef CONFIG_MTD_JEDECPROBE
197 if (!mtd_cs)
198 mtd_cs = do_map_probe("jedec_probe", map_cs);
200#endif 199#endif
201 200
202 return mtd_cs; 201 return mtd_cs;
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index df89298aafc4..d581b0a92a3f 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -185,7 +185,7 @@ static struct sync_port ports[]=
185 } 185 }
186}; 186};
187 187
188#define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port)) 188#define NUMBER_OF_PORTS ARRAY_SIZE(ports)
189 189
190static const struct file_operations sync_serial_fops = { 190static const struct file_operations sync_serial_fops = {
191 .owner = THIS_MODULE, 191 .owner = THIS_MODULE,
diff --git a/arch/cris/arch-v32/kernel/cache.c b/arch/cris/arch-v32/kernel/cache.c
new file mode 100644
index 000000000000..80da7b88a72b
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/cache.c
@@ -0,0 +1,33 @@
1#include <linux/module.h>
2#include <asm/io.h>
3#include <asm/arch/cache.h>
4#include <asm/arch/hwregs/dma.h>
5
6/* This file is used to workaround a cache bug, Guinness TR 106. */
7
8inline void flush_dma_descr(struct dma_descr_data *descr, int flush_buf)
9{
10 /* Flush descriptor to make sure we get correct in_eop and after. */
11 asm volatile ("ftagd [%0]" :: "r" (descr));
12 /* Flush buffer pointed out by descriptor. */
13 if (flush_buf)
14 cris_flush_cache_range(phys_to_virt((unsigned)descr->buf),
15 (unsigned)(descr->after - descr->buf));
16}
17EXPORT_SYMBOL(flush_dma_descr);
18
19void flush_dma_list(struct dma_descr_data *descr)
20{
21 while (1) {
22 flush_dma_descr(descr, 1);
23 if (descr->eol)
24 break;
25 descr = phys_to_virt((unsigned)descr->next);
26 }
27}
28EXPORT_SYMBOL(flush_dma_list);
29
30/* From cacheflush.S */
31EXPORT_SYMBOL(cris_flush_cache);
32/* From cacheflush.S */
33EXPORT_SYMBOL(cris_flush_cache_range);
diff --git a/arch/cris/arch-v32/kernel/cacheflush.S b/arch/cris/arch-v32/kernel/cacheflush.S
new file mode 100644
index 000000000000..956e8fb82f01
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/cacheflush.S
@@ -0,0 +1,94 @@
1 .global cris_flush_cache_range
2cris_flush_cache_range:
3 move.d 1024, $r12
4 cmp.d $r11, $r12
5 bhi cris_flush_1KB
6 nop
7 add.d $r10, $r11
8 ftagd [$r10]
9cris_flush_last:
10 addq 32, $r10
11 cmp.d $r11, $r10
12 blt cris_flush_last
13 ftagd [$r10]
14 ret
15 nop
16cris_flush_1KB:
17 ftagd [$r10]
18 addq 32, $r10
19 ftagd [$r10]
20 addq 32, $r10
21 ftagd [$r10]
22 addq 32, $r10
23 ftagd [$r10]
24 addq 32, $r10
25 ftagd [$r10]
26 addq 32, $r10
27 ftagd [$r10]
28 addq 32, $r10
29 ftagd [$r10]
30 addq 32, $r10
31 ftagd [$r10]
32 addq 32, $r10
33 ftagd [$r10]
34 addq 32, $r10
35 ftagd [$r10]
36 addq 32, $r10
37 ftagd [$r10]
38 addq 32, $r10
39 ftagd [$r10]
40 addq 32, $r10
41 ftagd [$r10]
42 addq 32, $r10
43 ftagd [$r10]
44 addq 32, $r10
45 ftagd [$r10]
46 addq 32, $r10
47 ftagd [$r10]
48 addq 32, $r10
49 ftagd [$r10]
50 addq 32, $r10
51 ftagd [$r10]
52 addq 32, $r10
53 ftagd [$r10]
54 addq 32, $r10
55 ftagd [$r10]
56 addq 32, $r10
57 ftagd [$r10]
58 addq 32, $r10
59 ftagd [$r10]
60 addq 32, $r10
61 ftagd [$r10]
62 addq 32, $r10
63 ftagd [$r10]
64 addq 32, $r10
65 ftagd [$r10]
66 addq 32, $r10
67 ftagd [$r10]
68 addq 32, $r10
69 ftagd [$r10]
70 addq 32, $r10
71 ftagd [$r10]
72 addq 32, $r10
73 ftagd [$r10]
74 addq 32, $r10
75 ftagd [$r10]
76 addq 32, $r10
77 ftagd [$r10]
78 addq 32, $r10
79 ftagd [$r10]
80 addq 32, $r10
81 ba cris_flush_cache_range
82 sub.d $r12, $r11
83
84 .global cris_flush_cache
85cris_flush_cache:
86 moveq 0, $r10
87cris_flush_line:
88 move.d 16*1024, $r11
89 addq 16, $r10
90 cmp.d $r10, $r11
91 blt cris_flush_line
92 fidxd [$r10]
93 ret
94 nop
diff --git a/arch/cris/arch-v32/kernel/io.c b/arch/cris/arch-v32/kernel/io.c
index dfbfcb8d2585..a22a9e02e093 100644
--- a/arch/cris/arch-v32/kernel/io.c
+++ b/arch/cris/arch-v32/kernel/io.c
@@ -49,7 +49,7 @@ struct crisv32_ioport crisv32_ioports[] =
49 } 49 }
50}; 50};
51 51
52#define NBR_OF_PORTS sizeof(crisv32_ioports)/sizeof(struct crisv32_ioport) 52#define NBR_OF_PORTS ARRAY_SIZE(crisv32_ioports)
53 53
54struct crisv32_iopin crisv32_led1_green; 54struct crisv32_iopin crisv32_led1_green;
55struct crisv32_iopin crisv32_led1_red; 55struct crisv32_iopin crisv32_led1_red;
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c
index 4662f363df63..72e9e8331f63 100644
--- a/arch/cris/arch-v32/kernel/setup.c
+++ b/arch/cris/arch-v32/kernel/setup.c
@@ -54,12 +54,10 @@ show_cpuinfo(struct seq_file *m, void *v)
54{ 54{
55 int i; 55 int i;
56 int cpu = (int)v - 1; 56 int cpu = (int)v - 1;
57 int entries;
58 unsigned long revision; 57 unsigned long revision;
59 struct cpu_info *info; 58 struct cpu_info *info;
60 59
61 entries = sizeof cpinfo / sizeof(struct cpu_info); 60 info = &cpinfo[ARRAY_SIZE(cpinfo) - 1];
62 info = &cpinfo[entries - 1];
63 61
64#ifdef CONFIG_SMP 62#ifdef CONFIG_SMP
65 if (!cpu_online(cpu)) 63 if (!cpu_online(cpu))
@@ -68,7 +66,7 @@ show_cpuinfo(struct seq_file *m, void *v)
68 66
69 revision = rdvr(); 67 revision = rdvr();
70 68
71 for (i = 0; i < entries; i++) { 69 for (i = 0; i < ARRAY_SIZE(cpinfo); i++) {
72 if (cpinfo[i].rev == revision) { 70 if (cpinfo[i].rev == revision) {
73 info = &cpinfo[i]; 71 info = &cpinfo[i];
74 break; 72 break;
diff --git a/arch/cris/defconfig b/arch/cris/defconfig
index 142a10818af3..9c33ae659934 100644
--- a/arch/cris/defconfig
+++ b/arch/cris/defconfig
@@ -226,8 +226,6 @@ CONFIG_MTD_CFI_UTIL=y
226CONFIG_MTD_RAM=y 226CONFIG_MTD_RAM=y
227# CONFIG_MTD_ROM is not set 227# CONFIG_MTD_ROM is not set
228# CONFIG_MTD_ABSENT is not set 228# CONFIG_MTD_ABSENT is not set
229CONFIG_MTD_OBSOLETE_CHIPS=y
230CONFIG_MTD_AMDSTD=y
231# CONFIG_MTD_SHARP is not set 229# CONFIG_MTD_SHARP is not set
232# CONFIG_MTD_JEDEC is not set 230# CONFIG_MTD_JEDEC is not set
233 231
@@ -276,6 +274,7 @@ CONFIG_MTDRAM_ABS_POS=0x0
276# CONFIG_BLK_DEV_FD is not set 274# CONFIG_BLK_DEV_FD is not set
277# CONFIG_BLK_DEV_COW_COMMON is not set 275# CONFIG_BLK_DEV_COW_COMMON is not set
278# CONFIG_BLK_DEV_LOOP is not set 276# CONFIG_BLK_DEV_LOOP is not set
277# CONFIG_BLK_DEV_CRYPTOLOOP is not set
279# CONFIG_BLK_DEV_NBD is not set 278# CONFIG_BLK_DEV_NBD is not set
280# CONFIG_BLK_DEV_UB is not set 279# CONFIG_BLK_DEV_UB is not set
281CONFIG_BLK_DEV_RAM=y 280CONFIG_BLK_DEV_RAM=y
@@ -302,16 +301,14 @@ CONFIG_IOSCHED_CFQ=y
302# 301#
303# ATA/ATAPI/MFM/RLL support 302# ATA/ATAPI/MFM/RLL support
304# 303#
305CONFIG_IDE=y 304# CONFIG_IDE is not set
306CONFIG_BLK_DEV_IDE=y 305# CONFIG_PARIDE is not set
307 306
308# 307#
309# Please see Documentation/ide.txt for help/info on IDE drives 308# Please see Documentation/ide.txt for help/info on IDE drives
310# 309#
311# CONFIG_BLK_DEV_IDE_SATA is not set 310# CONFIG_BLK_DEV_IDE_SATA is not set
312CONFIG_BLK_DEV_IDEDISK=y
313# CONFIG_IDEDISK_MULTI_MODE is not set 311# CONFIG_IDEDISK_MULTI_MODE is not set
314CONFIG_BLK_DEV_IDECD=y
315# CONFIG_BLK_DEV_IDETAPE is not set 312# CONFIG_BLK_DEV_IDETAPE is not set
316# CONFIG_BLK_DEV_IDEFLOPPY is not set 313# CONFIG_BLK_DEV_IDEFLOPPY is not set
317# CONFIG_IDE_TASK_IOCTL is not set 314# CONFIG_IDE_TASK_IOCTL is not set
@@ -321,7 +318,6 @@ CONFIG_BLK_DEV_IDECD=y
321# 318#
322# CONFIG_IDE_GENERIC is not set 319# CONFIG_IDE_GENERIC is not set
323# CONFIG_IDE_ARM is not set 320# CONFIG_IDE_ARM is not set
324CONFIG_BLK_DEV_IDEDMA=y
325# CONFIG_IDEDMA_AUTO is not set 321# CONFIG_IDEDMA_AUTO is not set
326# CONFIG_BLK_DEV_HD is not set 322# CONFIG_BLK_DEV_HD is not set
327 323
@@ -329,6 +325,7 @@ CONFIG_BLK_DEV_IDEDMA=y
329# SCSI device support 325# SCSI device support
330# 326#
331# CONFIG_SCSI is not set 327# CONFIG_SCSI is not set
328# CONFIG_ISCSI_TCP is not set
332 329
333# 330#
334# IEEE 1394 (FireWire) support 331# IEEE 1394 (FireWire) support
@@ -414,26 +411,11 @@ CONFIG_NETFILTER=y
414# CONFIG_NET_POLL_CONTROLLER is not set 411# CONFIG_NET_POLL_CONTROLLER is not set
415# CONFIG_HAMRADIO is not set 412# CONFIG_HAMRADIO is not set
416# CONFIG_IRDA is not set 413# CONFIG_IRDA is not set
417CONFIG_BT=y 414# CONFIG_AF_RXRPC is not set
418CONFIG_BT_L2CAP=y 415# CONFIG_AF_RXRPC_DEBUG is not set
419# CONFIG_BT_SCO is not set 416# CONFIG_BT is not set
420CONFIG_BT_RFCOMM=y 417# CONFIG_I2C is not set
421# CONFIG_BT_RFCOMM_TTY is not set 418
422CONFIG_BT_BNEP=y
423# CONFIG_BT_BNEP_MC_FILTER is not set
424# CONFIG_BT_BNEP_PROTO_FILTER is not set
425# CONFIG_BT_HIDP is not set
426
427#
428# Bluetooth device drivers
429#
430CONFIG_BT_HCIUSB=y
431# CONFIG_BT_HCIUSB_SCO is not set
432# CONFIG_BT_HCIUART is not set
433# CONFIG_BT_HCIBCM203X is not set
434# CONFIG_BT_HCIBPA10X is not set
435# CONFIG_BT_HCIBFUSB is not set
436# CONFIG_BT_HCIVHCI is not set
437CONFIG_NETDEVICES=y 419CONFIG_NETDEVICES=y
438# CONFIG_DUMMY is not set 420# CONFIG_DUMMY is not set
439# CONFIG_BONDING is not set 421# CONFIG_BONDING is not set
@@ -485,31 +467,17 @@ CONFIG_NET_ETHERNET=y
485# 467#
486# Input device support 468# Input device support
487# 469#
488CONFIG_INPUT=y 470# CONFIG_INPUT is not set
489
490#
491# Userland interfaces
492#
493CONFIG_INPUT_MOUSEDEV=y
494CONFIG_INPUT_MOUSEDEV_PSAUX=y
495CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
496CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
497# CONFIG_INPUT_JOYDEV is not set
498# CONFIG_INPUT_TSDEV is not set
499# CONFIG_INPUT_EVDEV is not set
500# CONFIG_INPUT_EVBUG is not set
501 471
502# 472#
503# Input I/O drivers 473# Input I/O drivers
504# 474#
505# CONFIG_GAMEPORT is not set
506CONFIG_SOUND_GAMEPORT=y
507CONFIG_SERIO=y 475CONFIG_SERIO=y
508# CONFIG_SERIO_I8042 is not set 476# CONFIG_SERIO_I8042 is not set
509# CONFIG_SERIO_SERPORT is not set 477# CONFIG_SERIO_SERPORT is not set
510# CONFIG_SERIO_CT82C710 is not set 478# CONFIG_SERIO_LIBPS2 is not set
511CONFIG_SERIO_LIBPS2=y
512# CONFIG_SERIO_RAW is not set 479# CONFIG_SERIO_RAW is not set
480# CONFIG_GAMEPORT is not set
513 481
514# 482#
515# Input Device Drivers 483# Input Device Drivers
@@ -525,6 +493,7 @@ CONFIG_MOUSE_PS2=y
525# CONFIG_MOUSE_SERIAL is not set 493# CONFIG_MOUSE_SERIAL is not set
526# CONFIG_MOUSE_VSXXXAA is not set 494# CONFIG_MOUSE_VSXXXAA is not set
527# CONFIG_INPUT_JOYSTICK is not set 495# CONFIG_INPUT_JOYSTICK is not set
496# CONFIG_INPUT_TABLET is not set
528# CONFIG_INPUT_TOUCHSCREEN is not set 497# CONFIG_INPUT_TOUCHSCREEN is not set
529# CONFIG_INPUT_MISC is not set 498# CONFIG_INPUT_MISC is not set
530 499
@@ -542,6 +511,8 @@ CONFIG_MOUSE_PS2=y
542# 511#
543# Non-8250 serial port support 512# Non-8250 serial port support
544# 513#
514CONFIG_SERIAL_CORE=y
515CONFIG_SERIAL_CORE_CONSOLE=y
545CONFIG_UNIX98_PTYS=y 516CONFIG_UNIX98_PTYS=y
546CONFIG_LEGACY_PTYS=y 517CONFIG_LEGACY_PTYS=y
547CONFIG_LEGACY_PTY_COUNT=256 518CONFIG_LEGACY_PTY_COUNT=256
@@ -559,6 +530,8 @@ CONFIG_LEGACY_PTY_COUNT=256
559# CONFIG_GEN_RTC is not set 530# CONFIG_GEN_RTC is not set
560# CONFIG_DTLK is not set 531# CONFIG_DTLK is not set
561# CONFIG_R3964 is not set 532# CONFIG_R3964 is not set
533# CONFIG_RTC_LIB is not set
534# CONFIG_RTC_CLASS is not set
562 535
563# 536#
564# Ftape, the floppy tape device driver 537# Ftape, the floppy tape device driver
@@ -660,7 +633,9 @@ CONFIG_NFS_V3=y
660# CONFIG_NFSD is not set 633# CONFIG_NFSD is not set
661CONFIG_LOCKD=y 634CONFIG_LOCKD=y
662CONFIG_LOCKD_V4=y 635CONFIG_LOCKD_V4=y
636CONFIG_NFS_COMMON=y
663CONFIG_SUNRPC=y 637CONFIG_SUNRPC=y
638# CONFIG_SUNRPC_BIND34 is not set
664# CONFIG_RPCSEC_GSS_KRB5 is not set 639# CONFIG_RPCSEC_GSS_KRB5 is not set
665# CONFIG_RPCSEC_GSS_SPKM3 is not set 640# CONFIG_RPCSEC_GSS_SPKM3 is not set
666# CONFIG_SMB_FS is not set 641# CONFIG_SMB_FS is not set
@@ -686,9 +661,21 @@ CONFIG_MSDOS_PARTITION=y
686# CONFIG_SOUND is not set 661# CONFIG_SOUND is not set
687 662
688# 663#
664# Generic devices
665#
666# CONFIG_SND_MPU401_UART is not set
667# CONFIG_SND_DUMMY is not set
668# CONFIG_SND_VIRMIDI is not set
669# CONFIG_SND_MTPAV is not set
670# CONFIG_SND_SERIAL_U16550 is not set
671# CONFIG_SND_MPU401 is not set
672
673#
689# PCCARD (PCMCIA/CardBus) support 674# PCCARD (PCMCIA/CardBus) support
690# 675#
691# CONFIG_PCCARD is not set 676# CONFIG_PCCARD is not set
677# CONFIG_PARPORT_PC_PCMCIA is not set
678# CONFIG_NET_PCMCIA is not set
692 679
693# 680#
694# PC-card bridges 681# PC-card bridges
@@ -734,6 +721,7 @@ CONFIG_USB_DEVICEFS=y
734# USB Input Devices 721# USB Input Devices
735# 722#
736# CONFIG_USB_HID is not set 723# CONFIG_USB_HID is not set
724# HID_SUPPORT is not set
737 725
738# 726#
739# USB HID Boot Protocol drivers 727# USB HID Boot Protocol drivers
@@ -829,7 +817,7 @@ CONFIG_USB_RTL8150=y
829 817
830# 818#
831# Hardware crypto devices 819# Hardware crypto devices
832# 820# CONFIG_CRYPTO_HW is not set
833 821
834# 822#
835# Library routines 823# Library routines
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 105bb5ed48f7..62f0e752915a 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -27,6 +27,7 @@ extern void __Mod(void);
27extern void __ashldi3(void); 27extern void __ashldi3(void);
28extern void __ashrdi3(void); 28extern void __ashrdi3(void);
29extern void __lshrdi3(void); 29extern void __lshrdi3(void);
30extern void __negdi2(void);
30extern void iounmap(volatile void * __iomem); 31extern void iounmap(volatile void * __iomem);
31 32
32/* Platform dependent support */ 33/* Platform dependent support */
@@ -34,19 +35,6 @@ EXPORT_SYMBOL(kernel_thread);
34EXPORT_SYMBOL(get_cmos_time); 35EXPORT_SYMBOL(get_cmos_time);
35EXPORT_SYMBOL(loops_per_usec); 36EXPORT_SYMBOL(loops_per_usec);
36 37
37/* String functions */
38EXPORT_SYMBOL(memcmp);
39EXPORT_SYMBOL(memmove);
40EXPORT_SYMBOL(strstr);
41EXPORT_SYMBOL(strcpy);
42EXPORT_SYMBOL(strchr);
43EXPORT_SYMBOL(strcmp);
44EXPORT_SYMBOL(strlen);
45EXPORT_SYMBOL(strcat);
46EXPORT_SYMBOL(strncat);
47EXPORT_SYMBOL(strncmp);
48EXPORT_SYMBOL(strncpy);
49
50/* Math functions */ 38/* Math functions */
51EXPORT_SYMBOL(__Udiv); 39EXPORT_SYMBOL(__Udiv);
52EXPORT_SYMBOL(__Umod); 40EXPORT_SYMBOL(__Umod);
@@ -55,6 +43,7 @@ EXPORT_SYMBOL(__Mod);
55EXPORT_SYMBOL(__ashldi3); 43EXPORT_SYMBOL(__ashldi3);
56EXPORT_SYMBOL(__ashrdi3); 44EXPORT_SYMBOL(__ashrdi3);
57EXPORT_SYMBOL(__lshrdi3); 45EXPORT_SYMBOL(__lshrdi3);
46EXPORT_SYMBOL(__negdi2);
58 47
59/* Memory functions */ 48/* Memory functions */
60EXPORT_SYMBOL(__ioremap); 49EXPORT_SYMBOL(__ioremap);
@@ -84,4 +73,4 @@ EXPORT_SYMBOL(start_one_shot_timer);
84EXPORT_SYMBOL(del_fast_timer); 73EXPORT_SYMBOL(del_fast_timer);
85EXPORT_SYMBOL(schedule_usleep); 74EXPORT_SYMBOL(schedule_usleep);
86#endif 75#endif
87 76EXPORT_SYMBOL(csum_partial);
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index 5c27ff86121b..2dfac8c79090 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * linux/arch/cris/kernel/irq.c 3 * linux/arch/cris/kernel/irq.c
4 * 4 *
5 * Copyright (c) 2000,2001 Axis Communications AB 5 * Copyright (c) 2000,2007 Axis Communications AB
6 * 6 *
7 * Authors: Bjorn Wesen (bjornw@axis.com) 7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 * 8 *
@@ -92,14 +92,16 @@ skip:
92asmlinkage void do_IRQ(int irq, struct pt_regs * regs) 92asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
93{ 93{
94 unsigned long sp; 94 unsigned long sp;
95 struct pt_regs *old_regs = set_irq_regs(regs);
95 irq_enter(); 96 irq_enter();
96 sp = rdsp(); 97 sp = rdsp();
97 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) { 98 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
98 printk("do_IRQ: stack overflow: %lX\n", sp); 99 printk("do_IRQ: stack overflow: %lX\n", sp);
99 show_stack(NULL, (unsigned long *)sp); 100 show_stack(NULL, (unsigned long *)sp);
100 } 101 }
101 __do_IRQ(irq, regs); 102 __do_IRQ(irq);
102 irq_exit(); 103 irq_exit();
104 set_irq_regs(old_regs);
103} 105}
104 106
105void weird_irq(void) 107void weird_irq(void)
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 123451c44154..9ca558fc5bc8 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -195,6 +195,11 @@ EXPORT_SYMBOL(enable_hlt);
195 */ 195 */
196void (*pm_idle)(void); 196void (*pm_idle)(void);
197 197
198extern void default_idle(void);
199
200void (*pm_power_off)(void);
201EXPORT_SYMBOL(pm_power_off);
202
198/* 203/*
199 * The idle thread. There's no useful work to be 204 * The idle thread. There's no useful work to be
200 * done, so just try to conserve power and have a 205 * done, so just try to conserve power and have a
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c
index 1085d037027b..3ccd20e85dce 100644
--- a/arch/cris/kernel/ptrace.c
+++ b/arch/cris/kernel/ptrace.c
@@ -81,13 +81,13 @@
81/* notification of userspace execution resumption 81/* notification of userspace execution resumption
82 * - triggered by current->work.notify_resume 82 * - triggered by current->work.notify_resume
83 */ 83 */
84extern int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs); 84extern int do_signal(int canrestart, struct pt_regs *regs);
85 85
86 86
87void do_notify_resume(int canrestart, sigset_t *oldset, struct pt_regs *regs, 87void do_notify_resume(int canrestart, struct pt_regs *regs,
88 __u32 thread_info_flags ) 88 __u32 thread_info_flags )
89{ 89{
90 /* deal with pending signal delivery */ 90 /* deal with pending signal delivery */
91 if (thread_info_flags & _TIF_SIGPENDING) 91 if (thread_info_flags & _TIF_SIGPENDING)
92 do_signal(canrestart,oldset,regs); 92 do_signal(canrestart,regs);
93} 93}
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 514359b8122e..8b9984197edc 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -13,6 +13,7 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/syscalls.h> 14#include <linux/syscalls.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/fs.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
17#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
18#include <linux/sem.h> 19#include <linux/sem.h>
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index acfd04559405..7a2cc7efbcf8 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -171,10 +171,6 @@ get_cmos_time(void)
171 mon = CMOS_READ(RTC_MONTH); 171 mon = CMOS_READ(RTC_MONTH);
172 year = CMOS_READ(RTC_YEAR); 172 year = CMOS_READ(RTC_YEAR);
173 173
174 printk(KERN_DEBUG
175 "rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n",
176 sec, min, hour, day, mon, year);
177
178 BCD_TO_BIN(sec); 174 BCD_TO_BIN(sec);
179 BCD_TO_BIN(min); 175 BCD_TO_BIN(min);
180 BCD_TO_BIN(hour); 176 BCD_TO_BIN(hour);
@@ -207,12 +203,12 @@ void
207cris_do_profile(struct pt_regs* regs) 203cris_do_profile(struct pt_regs* regs)
208{ 204{
209 205
210#if CONFIG_SYSTEM_PROFILER 206#ifdef CONFIG_SYSTEM_PROFILER
211 cris_profile_sample(regs); 207 cris_profile_sample(regs);
212#endif 208#endif
213 209
214#if CONFIG_PROFILING 210#ifdef CONFIG_PROFILING
215 profile_tick(CPU_PROFILING, regs); 211 profile_tick(CPU_PROFILING);
216#endif 212#endif
217} 213}
218 214
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/frv/mm/init.c b/arch/frv/mm/init.c
index 4103c2c487f3..b841ecfd5d5a 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -197,7 +197,7 @@ void __init mem_init(void)
197/* 197/*
198 * free the memory that was only required for initialisation 198 * free the memory that was only required for initialisation
199 */ 199 */
200void __init free_initmem(void) 200void free_initmem(void)
201{ 201{
202#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL) 202#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
203 unsigned long start, end, addr; 203 unsigned long start, end, addr;
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/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/hp/sim/boot/fw-emu.c b/arch/ia64/hp/sim/boot/fw-emu.c
index 1189d035d316..bf6d9d8c802f 100644
--- a/arch/ia64/hp/sim/boot/fw-emu.c
+++ b/arch/ia64/hp/sim/boot/fw-emu.c
@@ -285,7 +285,7 @@ sys_fw_init (const char *args, int arglen)
285 } 285 }
286 cmd_line[arglen] = '\0'; 286 cmd_line[arglen] = '\0';
287 287
288 memset(efi_systab, 0, sizeof(efi_systab)); 288 memset(efi_systab, 0, sizeof(*efi_systab));
289 efi_systab->hdr.signature = EFI_SYSTEM_TABLE_SIGNATURE; 289 efi_systab->hdr.signature = EFI_SYSTEM_TABLE_SIGNATURE;
290 efi_systab->hdr.revision = ((1 << 16) | 00); 290 efi_systab->hdr.revision = ((1 << 16) | 00);
291 efi_systab->hdr.headersize = sizeof(efi_systab->hdr); 291 efi_systab->hdr.headersize = sizeof(efi_systab->hdr);
diff --git a/arch/ia64/ia32/ia32priv.h b/arch/ia64/ia32/ia32priv.h
index 466bbcb138b2..c5c872b250da 100644
--- a/arch/ia64/ia32/ia32priv.h
+++ b/arch/ia64/ia32/ia32priv.h
@@ -290,7 +290,6 @@ struct old_linux32_dirent {
290#define _ASM_IA64_ELF_H /* Don't include elf.h */ 290#define _ASM_IA64_ELF_H /* Don't include elf.h */
291 291
292#include <linux/sched.h> 292#include <linux/sched.h>
293#include <asm/processor.h>
294 293
295/* 294/*
296 * This is used to ensure we don't load something for the wrong architecture. 295 * This is used to ensure we don't load something for the wrong architecture.
diff --git a/arch/ia64/kernel/.gitignore b/arch/ia64/kernel/.gitignore
new file mode 100644
index 000000000000..98307759a3b8
--- /dev/null
+++ b/arch/ia64/kernel/.gitignore
@@ -0,0 +1 @@
gate.lds
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 3d45d24a9d61..897e2083a3b1 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -678,9 +678,11 @@ int __init acpi_boot_init(void)
678 /* I/O APIC */ 678 /* I/O APIC */
679 679
680 if (acpi_table_parse_madt 680 if (acpi_table_parse_madt
681 (ACPI_MADT_TYPE_IO_SAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) 681 (ACPI_MADT_TYPE_IO_SAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) {
682 printk(KERN_ERR PREFIX 682 if (!ia64_platform_is("sn2"))
683 "Error parsing MADT - no IOSAPIC entries\n"); 683 printk(KERN_ERR PREFIX
684 "Error parsing MADT - no IOSAPIC entries\n");
685 }
684 686
685 /* System-Level Interrupt Routing */ 687 /* System-Level Interrupt Routing */
686 688
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 3f7ea13358e9..8e8f8b6193ee 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -218,9 +218,10 @@ efi_gettimeofday (struct timespec *ts)
218{ 218{
219 efi_time_t tm; 219 efi_time_t tm;
220 220
221 memset(ts, 0, sizeof(ts)); 221 if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS) {
222 if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS) 222 memset(ts, 0, sizeof(*ts));
223 return; 223 return;
224 }
224 225
225 ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second); 226 ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
226 ts->tv_nsec = tm.nanosecond; 227 ts->tv_nsec = tm.nanosecond;
@@ -1112,7 +1113,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1112 if (md->num_pages == 0) /* should not happen */ 1113 if (md->num_pages == 0) /* should not happen */
1113 continue; 1114 continue;
1114 1115
1115 flags = IORESOURCE_MEM; 1116 flags = IORESOURCE_MEM | IORESOURCE_BUSY;
1116 switch (md->type) { 1117 switch (md->type) {
1117 1118
1118 case EFI_MEMORY_MAPPED_IO: 1119 case EFI_MEMORY_MAPPED_IO:
@@ -1134,12 +1135,11 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1134 1135
1135 case EFI_ACPI_MEMORY_NVS: 1136 case EFI_ACPI_MEMORY_NVS:
1136 name = "ACPI Non-volatile Storage"; 1137 name = "ACPI Non-volatile Storage";
1137 flags |= IORESOURCE_BUSY;
1138 break; 1138 break;
1139 1139
1140 case EFI_UNUSABLE_MEMORY: 1140 case EFI_UNUSABLE_MEMORY:
1141 name = "reserved"; 1141 name = "reserved";
1142 flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED; 1142 flags |= IORESOURCE_DISABLED;
1143 break; 1143 break;
1144 1144
1145 case EFI_RESERVED_TYPE: 1145 case EFI_RESERVED_TYPE:
@@ -1148,7 +1148,6 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1148 case EFI_ACPI_RECLAIM_MEMORY: 1148 case EFI_ACPI_RECLAIM_MEMORY:
1149 default: 1149 default:
1150 name = "reserved"; 1150 name = "reserved";
1151 flags |= IORESOURCE_BUSY;
1152 break; 1151 break;
1153 } 1152 }
1154 1153
@@ -1231,7 +1230,7 @@ kdump_find_rsvd_region (unsigned long size,
1231 1230
1232#ifdef CONFIG_PROC_VMCORE 1231#ifdef CONFIG_PROC_VMCORE
1233/* locate the size find a the descriptor at a certain address */ 1232/* locate the size find a the descriptor at a certain address */
1234unsigned long 1233unsigned long __init
1235vmcore_find_descriptor_size (unsigned long address) 1234vmcore_find_descriptor_size (unsigned long address)
1236{ 1235{
1237 void *efi_map_start, *efi_map_end, *p; 1236 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/iosapic.c b/arch/ia64/kernel/iosapic.c
index cfe4654838f4..274a59383043 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -748,6 +748,15 @@ skip_numa_setup:
748#endif 748#endif
749} 749}
750 750
751static inline unsigned char choose_dmode(void)
752{
753#ifdef CONFIG_SMP
754 if (smp_int_redirect & SMP_IRQ_REDIRECTION)
755 return IOSAPIC_LOWEST_PRIORITY;
756#endif
757 return IOSAPIC_FIXED;
758}
759
751/* 760/*
752 * ACPI can describe IOSAPIC interrupts via static tables and namespace 761 * ACPI can describe IOSAPIC interrupts via static tables and namespace
753 * methods. This provides an interface to register those interrupts and 762 * methods. This provides an interface to register those interrupts and
@@ -762,6 +771,7 @@ iosapic_register_intr (unsigned int gsi,
762 unsigned long flags; 771 unsigned long flags;
763 struct iosapic_rte_info *rte; 772 struct iosapic_rte_info *rte;
764 u32 low32; 773 u32 low32;
774 unsigned char dmode;
765 775
766 /* 776 /*
767 * If this GSI has already been registered (i.e., it's a 777 * If this GSI has already been registered (i.e., it's a
@@ -791,8 +801,8 @@ iosapic_register_intr (unsigned int gsi,
791 801
792 spin_lock(&irq_desc[irq].lock); 802 spin_lock(&irq_desc[irq].lock);
793 dest = get_target_cpu(gsi, irq); 803 dest = get_target_cpu(gsi, irq);
794 err = register_intr(gsi, irq, IOSAPIC_LOWEST_PRIORITY, 804 dmode = choose_dmode();
795 polarity, trigger); 805 err = register_intr(gsi, irq, dmode, polarity, trigger);
796 if (err < 0) { 806 if (err < 0) {
797 spin_unlock(&irq_desc[irq].lock); 807 spin_unlock(&irq_desc[irq].lock);
798 irq = err; 808 irq = err;
@@ -961,10 +971,12 @@ iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
961{ 971{
962 int vector, irq; 972 int vector, irq;
963 unsigned int dest = cpu_physical_id(smp_processor_id()); 973 unsigned int dest = cpu_physical_id(smp_processor_id());
974 unsigned char dmode;
964 975
965 irq = vector = isa_irq_to_vector(isa_irq); 976 irq = vector = isa_irq_to_vector(isa_irq);
966 BUG_ON(bind_irq_vector(irq, vector, CPU_MASK_ALL)); 977 BUG_ON(bind_irq_vector(irq, vector, CPU_MASK_ALL));
967 register_intr(gsi, irq, IOSAPIC_LOWEST_PRIORITY, polarity, trigger); 978 dmode = choose_dmode();
979 register_intr(gsi, irq, dmode, polarity, trigger);
968 980
969 DBG("ISA: IRQ %u -> GSI %u (%s,%s) -> CPU %d (0x%04x) vector %d\n", 981 DBG("ISA: IRQ %u -> GSI %u (%s,%s) -> CPU %d (0x%04x) vector %d\n",
970 isa_irq, gsi, trigger == IOSAPIC_EDGE ? "edge" : "level", 982 isa_irq, gsi, trigger == IOSAPIC_EDGE ? "edge" : "level",
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 44be1c952b7c..6dee579f205f 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -61,9 +61,11 @@ int show_interrupts(struct seq_file *p, void *v)
61 unsigned long flags; 61 unsigned long flags;
62 62
63 if (i == 0) { 63 if (i == 0) {
64 seq_printf(p, " "); 64 char cpuname[16];
65 seq_printf(p, " ");
65 for_each_online_cpu(j) { 66 for_each_online_cpu(j) {
66 seq_printf(p, "CPU%d ",j); 67 snprintf(cpuname, 10, "CPU%d", j);
68 seq_printf(p, "%10s ", cpuname);
67 } 69 }
68 seq_putc(p, '\n'); 70 seq_putc(p, '\n');
69 } 71 }
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index cc87025e8f54..10b48cd15a87 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -571,7 +571,7 @@ out:
571 * Outputs 571 * Outputs
572 * None 572 * None
573 */ 573 */
574static void __init 574void
575ia64_mca_register_cpev (int cpev) 575ia64_mca_register_cpev (int cpev)
576{ 576{
577 /* Register the CPE interrupt vector with SAL */ 577 /* Register the CPE interrupt vector with SAL */
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/palinfo.c b/arch/ia64/kernel/palinfo.c
index 6ef6ffb943a0..396004e8cd14 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -470,7 +470,7 @@ register_info(char *page)
470 return p - page; 470 return p - page;
471} 471}
472 472
473static const char *proc_features[]={ 473static char *proc_features_0[]={ /* Feature set 0 */
474 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 474 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
475 NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL, 475 NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,
476 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 476 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
@@ -502,25 +502,92 @@ static const char *proc_features[]={
502 "Enable BERR promotion" 502 "Enable BERR promotion"
503}; 503};
504 504
505static char *proc_features_16[]={ /* Feature set 16 */
506 "Disable ETM",
507 "Enable ETM",
508 "Enable MCA on half-way timer",
509 "Enable snoop WC",
510 NULL,
511 "Enable Fast Deferral",
512 "Disable MCA on memory aliasing",
513 "Enable RSB",
514 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
515 "DP system processor",
516 "Low Voltage",
517 "HT supported",
518 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
519 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
520 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
521 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
522 NULL, NULL, NULL, NULL, NULL
523};
524
525static char **proc_features[]={
526 proc_features_0,
527 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
528 NULL, NULL, NULL, NULL,
529 proc_features_16,
530 NULL, NULL, NULL, NULL,
531};
532
533static char *
534feature_set_info(char *page, u64 avail, u64 status, u64 control, u64 set)
535{
536 char *p = page;
537 char **vf, **v;
538 int i;
539
540 vf = v = proc_features[set];
541 for(i=0; i < 64; i++, avail >>=1, status >>=1, control >>=1) {
542
543 if (!(control)) /* No remaining bits set */
544 break;
545 if (!(avail & 0x1)) /* Print only bits that are available */
546 continue;
547 if (vf)
548 v = vf + i;
549 if ( v && *v ) {
550 p += sprintf(p, "%-40s : %s %s\n", *v,
551 avail & 0x1 ? (status & 0x1 ?
552 "On " : "Off"): "",
553 avail & 0x1 ? (control & 0x1 ?
554 "Ctrl" : "NoCtrl"): "");
555 } else {
556 p += sprintf(p, "Feature set %2ld bit %2d\t\t\t"
557 " : %s %s\n",
558 set, i,
559 avail & 0x1 ? (status & 0x1 ?
560 "On " : "Off"): "",
561 avail & 0x1 ? (control & 0x1 ?
562 "Ctrl" : "NoCtrl"): "");
563 }
564 }
565 return p;
566}
505 567
506static int 568static int
507processor_info(char *page) 569processor_info(char *page)
508{ 570{
509 char *p = page; 571 char *p = page;
510 const char **v = proc_features; 572 u64 avail=1, status=1, control=1, feature_set=0;
511 u64 avail=1, status=1, control=1;
512 int i;
513 s64 ret; 573 s64 ret;
514 574
515 if ((ret=ia64_pal_proc_get_features(&avail, &status, &control)) != 0) return 0; 575 do {
576 ret = ia64_pal_proc_get_features(&avail, &status, &control,
577 feature_set);
578 if (ret < 0) {
579 return p - page;
580 }
581 if (ret == 1) {
582 feature_set++;
583 continue;
584 }
585
586 p = feature_set_info(p, avail, status, control, feature_set);
587
588 feature_set++;
589 } while(1);
516 590
517 for(i=0; i < 64; i++, v++,avail >>=1, status >>=1, control >>=1) {
518 if ( ! *v ) continue;
519 p += sprintf(p, "%-40s : %s%s %s\n", *v,
520 avail & 0x1 ? "" : "NotImpl",
521 avail & 0x1 ? (status & 0x1 ? "On" : "Off"): "",
522 avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): "");
523 }
524 return p - page; 591 return p - page;
525} 592}
526 593
diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
index e796e29f8e15..2cb9425e0421 100644
--- a/arch/ia64/kernel/patch.c
+++ b/arch/ia64/kernel/patch.c
@@ -129,9 +129,6 @@ ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
129 first_time = 0; 129 first_time = 0;
130 if (need_workaround) 130 if (need_workaround)
131 printk(KERN_INFO "Leaving McKinley Errata 9 workaround enabled\n"); 131 printk(KERN_INFO "Leaving McKinley Errata 9 workaround enabled\n");
132 else
133 printk(KERN_INFO "McKinley Errata 9 workaround not needed; "
134 "disabling it\n");
135 } 132 }
136 if (need_workaround) 133 if (need_workaround)
137 return; 134 return;
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 59169bf7145f..73e7c2e40b54 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -558,7 +558,7 @@ static ctl_table pfm_sysctl_dir[] = {
558 { 558 {
559 .ctl_name = CTL_UNNUMBERED, 559 .ctl_name = CTL_UNNUMBERED,
560 .procname = "perfmon", 560 .procname = "perfmon",
561 .mode = 0755, 561 .mode = 0555,
562 .child = pfm_ctl_table, 562 .child = pfm_ctl_table,
563 }, 563 },
564 {} 564 {}
@@ -567,7 +567,7 @@ static ctl_table pfm_sysctl_root[] = {
567 { 567 {
568 .ctl_name = CTL_KERN, 568 .ctl_name = CTL_KERN,
569 .procname = "kernel", 569 .procname = "kernel",
570 .mode = 0755, 570 .mode = 0555,
571 .child = pfm_sysctl_dir, 571 .child = pfm_sysctl_dir,
572 }, 572 },
573 {} 573 {}
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/contig.c b/arch/ia64/mm/contig.c
index d3c538be466c..7e9c275ea148 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -146,6 +146,46 @@ find_bootmap_location (unsigned long start, unsigned long end, void *arg)
146 return 0; 146 return 0;
147} 147}
148 148
149#ifdef CONFIG_SMP
150static void *cpu_data;
151/**
152 * per_cpu_init - setup per-cpu variables
153 *
154 * Allocate and setup per-cpu data areas.
155 */
156void * __cpuinit
157per_cpu_init (void)
158{
159 int cpu;
160 static int first_time=1;
161
162 /*
163 * get_free_pages() cannot be used before cpu_init() done. BSP
164 * allocates "NR_CPUS" pages for all CPUs to avoid that AP calls
165 * get_zeroed_page().
166 */
167 if (first_time) {
168 first_time=0;
169 for (cpu = 0; cpu < NR_CPUS; cpu++) {
170 memcpy(cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start);
171 __per_cpu_offset[cpu] = (char *) cpu_data - __per_cpu_start;
172 cpu_data += PERCPU_PAGE_SIZE;
173 per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
174 }
175 }
176 return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
177}
178
179static inline void
180alloc_per_cpu_data(void)
181{
182 cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * NR_CPUS,
183 PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
184}
185#else
186#define alloc_per_cpu_data() do { } while (0)
187#endif /* CONFIG_SMP */
188
149/** 189/**
150 * find_memory - setup memory map 190 * find_memory - setup memory map
151 * 191 *
@@ -182,41 +222,9 @@ find_memory (void)
182 222
183 find_initrd(); 223 find_initrd();
184 224
225 alloc_per_cpu_data();
185} 226}
186 227
187#ifdef CONFIG_SMP
188/**
189 * per_cpu_init - setup per-cpu variables
190 *
191 * Allocate and setup per-cpu data areas.
192 */
193void * __cpuinit
194per_cpu_init (void)
195{
196 void *cpu_data;
197 int cpu;
198 static int first_time=1;
199
200 /*
201 * get_free_pages() cannot be used before cpu_init() done. BSP
202 * allocates "NR_CPUS" pages for all CPUs to avoid that AP calls
203 * get_zeroed_page().
204 */
205 if (first_time) {
206 first_time=0;
207 cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * NR_CPUS,
208 PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
209 for (cpu = 0; cpu < NR_CPUS; cpu++) {
210 memcpy(cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start);
211 __per_cpu_offset[cpu] = (char *) cpu_data - __per_cpu_start;
212 cpu_data += PERCPU_PAGE_SIZE;
213 per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
214 }
215 }
216 return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
217}
218#endif /* CONFIG_SMP */
219
220static int 228static int
221count_pages (u64 start, u64 end, void *arg) 229count_pages (u64 start, u64 end, void *arg)
222{ 230{
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/irq.c b/arch/ia64/sn/kernel/irq.c
index 0f9b12683bf3..53351c3cd7b1 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -5,7 +5,7 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. 8 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
9 */ 9 */
10 10
11#include <linux/irq.h> 11#include <linux/irq.h>
@@ -85,12 +85,18 @@ static void sn_shutdown_irq(unsigned int irq)
85{ 85{
86} 86}
87 87
88extern void ia64_mca_register_cpev(int);
89
88static void sn_disable_irq(unsigned int irq) 90static void sn_disable_irq(unsigned int irq)
89{ 91{
92 if (irq == local_vector_to_irq(IA64_CPE_VECTOR))
93 ia64_mca_register_cpev(0);
90} 94}
91 95
92static void sn_enable_irq(unsigned int irq) 96static void sn_enable_irq(unsigned int irq)
93{ 97{
98 if (irq == local_vector_to_irq(IA64_CPE_VECTOR))
99 ia64_mca_register_cpev(irq);
94} 100}
95 101
96static void sn_ack_irq(unsigned int irq) 102static void sn_ack_irq(unsigned int irq)
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/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index e336e1692a73..81785b78bc1e 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -257,7 +257,9 @@ xpc_hb_checker(void *ignore)
257 257
258 set_cpus_allowed(current, cpumask_of_cpu(XPC_HB_CHECK_CPU)); 258 set_cpus_allowed(current, cpumask_of_cpu(XPC_HB_CHECK_CPU));
259 259
260 /* set our heartbeating to other partitions into motion */
260 xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ); 261 xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ);
262 xpc_hb_beater(0);
261 263
262 while (!(volatile int) xpc_exiting) { 264 while (!(volatile int) xpc_exiting) {
263 265
@@ -1338,16 +1340,8 @@ xpc_init(void)
1338 dev_warn(xpc_part, "can't register die notifier\n"); 1340 dev_warn(xpc_part, "can't register die notifier\n");
1339 } 1341 }
1340 1342
1341
1342 /*
1343 * Set the beating to other partitions into motion. This is
1344 * the last requirement for other partitions' discovery to
1345 * initiate communications with us.
1346 */
1347 init_timer(&xpc_hb_timer); 1343 init_timer(&xpc_hb_timer);
1348 xpc_hb_timer.function = xpc_hb_beater; 1344 xpc_hb_timer.function = xpc_hb_beater;
1349 xpc_hb_beater(0);
1350
1351 1345
1352 /* 1346 /*
1353 * The real work-horse behind xpc. This processes incoming 1347 * The real work-horse behind xpc. This processes incoming
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 880add120eb3..8a2a53b33616 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -565,7 +565,7 @@ void atari_kbd_leds(unsigned int leds)
565 565
566static int atari_keyb_done = 0; 566static int atari_keyb_done = 0;
567 567
568int __init atari_keyb_init(void) 568int atari_keyb_init(void)
569{ 569{
570 if (atari_keyb_done) 570 if (atari_keyb_done)
571 return 0; 571 return 0;
@@ -631,6 +631,7 @@ int __init atari_keyb_init(void)
631 atari_keyb_done = 1; 631 atari_keyb_done = 1;
632 return 0; 632 return 0;
633} 633}
634EXPORT_SYMBOL_GPL(atari_keyb_init);
634 635
635int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode) 636int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
636{ 637{
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 61262c5f9c62..455bd1f560aa 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -22,6 +22,7 @@ config MACH_ALCHEMY
22config BASLER_EXCITE 22config BASLER_EXCITE
23 bool "Basler eXcite smart camera" 23 bool "Basler eXcite smart camera"
24 select CEVT_R4K 24 select CEVT_R4K
25 select CSRC_R4K
25 select DMA_COHERENT 26 select DMA_COHERENT
26 select HW_HAS_PCI 27 select HW_HAS_PCI
27 select IRQ_CPU 28 select IRQ_CPU
@@ -49,6 +50,7 @@ config BASLER_EXCITE_PROTOTYPE
49config BCM47XX 50config BCM47XX
50 bool "BCM47XX based boards" 51 bool "BCM47XX based boards"
51 select CEVT_R4K 52 select CEVT_R4K
53 select CSRC_R4K
52 select DMA_NONCOHERENT 54 select DMA_NONCOHERENT
53 select HW_HAS_PCI 55 select HW_HAS_PCI
54 select IRQ_CPU 56 select IRQ_CPU
@@ -66,6 +68,7 @@ config BCM47XX
66config MIPS_COBALT 68config MIPS_COBALT
67 bool "Cobalt Server" 69 bool "Cobalt Server"
68 select CEVT_R4K 70 select CEVT_R4K
71 select CSRC_R4K
69 select CEVT_GT641XX 72 select CEVT_GT641XX
70 select DMA_NONCOHERENT 73 select DMA_NONCOHERENT
71 select HW_HAS_PCI 74 select HW_HAS_PCI
@@ -85,6 +88,7 @@ config MACH_DECSTATION
85 bool "DECstations" 88 bool "DECstations"
86 select BOOT_ELF32 89 select BOOT_ELF32
87 select CEVT_R4K 90 select CEVT_R4K
91 select CSRC_R4K
88 select DMA_NONCOHERENT 92 select DMA_NONCOHERENT
89 select NO_IOPORT 93 select NO_IOPORT
90 select IRQ_CPU 94 select IRQ_CPU
@@ -117,6 +121,7 @@ config MACH_JAZZ
117 select ARC32 121 select ARC32
118 select ARCH_MAY_HAVE_PC_FDC 122 select ARCH_MAY_HAVE_PC_FDC
119 select CEVT_R4K 123 select CEVT_R4K
124 select CSRC_R4K
120 select GENERIC_ISA_DMA 125 select GENERIC_ISA_DMA
121 select IRQ_CPU 126 select IRQ_CPU
122 select I8253 127 select I8253
@@ -137,6 +142,7 @@ config MACH_JAZZ
137config LASAT 142config LASAT
138 bool "LASAT Networks platforms" 143 bool "LASAT Networks platforms"
139 select CEVT_R4K 144 select CEVT_R4K
145 select CSRC_R4K
140 select DMA_NONCOHERENT 146 select DMA_NONCOHERENT
141 select SYS_HAS_EARLY_PRINTK 147 select SYS_HAS_EARLY_PRINTK
142 select HW_HAS_PCI 148 select HW_HAS_PCI
@@ -154,6 +160,7 @@ config LEMOTE_FULONG
154 bool "Lemote Fulong mini-PC" 160 bool "Lemote Fulong mini-PC"
155 select ARCH_SPARSEMEM_ENABLE 161 select ARCH_SPARSEMEM_ENABLE
156 select CEVT_R4K 162 select CEVT_R4K
163 select CSRC_R4K
157 select SYS_HAS_CPU_LOONGSON2 164 select SYS_HAS_CPU_LOONGSON2
158 select DMA_NONCOHERENT 165 select DMA_NONCOHERENT
159 select BOOT_ELF32 166 select BOOT_ELF32
@@ -179,6 +186,7 @@ config MIPS_ATLAS
179 bool "MIPS Atlas board" 186 bool "MIPS Atlas board"
180 select BOOT_ELF32 187 select BOOT_ELF32
181 select CEVT_R4K 188 select CEVT_R4K
189 select CSRC_R4K
182 select DMA_NONCOHERENT 190 select DMA_NONCOHERENT
183 select SYS_HAS_EARLY_PRINTK 191 select SYS_HAS_EARLY_PRINTK
184 select IRQ_CPU 192 select IRQ_CPU
@@ -210,6 +218,7 @@ config MIPS_MALTA
210 select ARCH_MAY_HAVE_PC_FDC 218 select ARCH_MAY_HAVE_PC_FDC
211 select BOOT_ELF32 219 select BOOT_ELF32
212 select CEVT_R4K 220 select CEVT_R4K
221 select CSRC_R4K
213 select DMA_NONCOHERENT 222 select DMA_NONCOHERENT
214 select GENERIC_ISA_DMA 223 select GENERIC_ISA_DMA
215 select IRQ_CPU 224 select IRQ_CPU
@@ -241,6 +250,7 @@ config MIPS_MALTA
241config MIPS_SEAD 250config MIPS_SEAD
242 bool "MIPS SEAD board" 251 bool "MIPS SEAD board"
243 select CEVT_R4K 252 select CEVT_R4K
253 select CSRC_R4K
244 select IRQ_CPU 254 select IRQ_CPU
245 select DMA_NONCOHERENT 255 select DMA_NONCOHERENT
246 select SYS_HAS_EARLY_PRINTK 256 select SYS_HAS_EARLY_PRINTK
@@ -260,6 +270,7 @@ config MIPS_SEAD
260config MIPS_SIM 270config MIPS_SIM
261 bool 'MIPS simulator (MIPSsim)' 271 bool 'MIPS simulator (MIPSsim)'
262 select CEVT_R4K 272 select CEVT_R4K
273 select CSRC_R4K
263 select DMA_NONCOHERENT 274 select DMA_NONCOHERENT
264 select SYS_HAS_EARLY_PRINTK 275 select SYS_HAS_EARLY_PRINTK
265 select IRQ_CPU 276 select IRQ_CPU
@@ -278,6 +289,7 @@ config MIPS_SIM
278config MARKEINS 289config MARKEINS
279 bool "NEC EMMA2RH Mark-eins" 290 bool "NEC EMMA2RH Mark-eins"
280 select CEVT_R4K 291 select CEVT_R4K
292 select CSRC_R4K
281 select DMA_NONCOHERENT 293 select DMA_NONCOHERENT
282 select HW_HAS_PCI 294 select HW_HAS_PCI
283 select IRQ_CPU 295 select IRQ_CPU
@@ -293,6 +305,7 @@ config MARKEINS
293config MACH_VR41XX 305config MACH_VR41XX
294 bool "NEC VR4100 series based machines" 306 bool "NEC VR4100 series based machines"
295 select CEVT_R4K 307 select CEVT_R4K
308 select CSRC_R4K
296 select SYS_HAS_CPU_VR41XX 309 select SYS_HAS_CPU_VR41XX
297 select GENERIC_HARDIRQS_NO__DO_IRQ 310 select GENERIC_HARDIRQS_NO__DO_IRQ
298 311
@@ -330,6 +343,7 @@ config PMC_MSP
330config PMC_YOSEMITE 343config PMC_YOSEMITE
331 bool "PMC-Sierra Yosemite eval board" 344 bool "PMC-Sierra Yosemite eval board"
332 select CEVT_R4K 345 select CEVT_R4K
346 select CSRC_R4K
333 select DMA_COHERENT 347 select DMA_COHERENT
334 select HW_HAS_PCI 348 select HW_HAS_PCI
335 select IRQ_CPU 349 select IRQ_CPU
@@ -351,6 +365,7 @@ config PMC_YOSEMITE
351config QEMU 365config QEMU
352 bool "Qemu" 366 bool "Qemu"
353 select CEVT_R4K 367 select CEVT_R4K
368 select CSRC_R4K
354 select DMA_COHERENT 369 select DMA_COHERENT
355 select GENERIC_ISA_DMA 370 select GENERIC_ISA_DMA
356 select HAVE_STD_PC_SERIAL_PORT 371 select HAVE_STD_PC_SERIAL_PORT
@@ -361,10 +376,10 @@ config QEMU
361 select PCSPEAKER 376 select PCSPEAKER
362 select SWAP_IO_SPACE 377 select SWAP_IO_SPACE
363 select SYS_HAS_CPU_MIPS32_R1 378 select SYS_HAS_CPU_MIPS32_R1
379 select SYS_HAS_EARLY_PRINTK
364 select SYS_SUPPORTS_32BIT_KERNEL 380 select SYS_SUPPORTS_32BIT_KERNEL
365 select SYS_SUPPORTS_BIG_ENDIAN 381 select SYS_SUPPORTS_BIG_ENDIAN
366 select SYS_SUPPORTS_LITTLE_ENDIAN 382 select SYS_SUPPORTS_LITTLE_ENDIAN
367 select ARCH_SPARSEMEM_ENABLE
368 select GENERIC_HARDIRQS_NO__DO_IRQ 383 select GENERIC_HARDIRQS_NO__DO_IRQ
369 select NR_CPUS_DEFAULT_1 384 select NR_CPUS_DEFAULT_1
370 select SYS_SUPPORTS_SMP 385 select SYS_SUPPORTS_SMP
@@ -382,9 +397,11 @@ config SGI_IP22
382 select ARC32 397 select ARC32
383 select BOOT_ELF32 398 select BOOT_ELF32
384 select CEVT_R4K 399 select CEVT_R4K
400 select CSRC_R4K
385 select DMA_NONCOHERENT 401 select DMA_NONCOHERENT
386 select HW_HAS_EISA 402 select HW_HAS_EISA
387 select I8253 403 select I8253
404 select I8259
388 select IP22_CPU_SCACHE 405 select IP22_CPU_SCACHE
389 select IRQ_CPU 406 select IRQ_CPU
390 select GENERIC_ISA_DMA_SUPPORT_BROKEN 407 select GENERIC_ISA_DMA_SUPPORT_BROKEN
@@ -427,6 +444,7 @@ config SGI_IP32
427 select ARC32 444 select ARC32
428 select BOOT_ELF32 445 select BOOT_ELF32
429 select CEVT_R4K 446 select CEVT_R4K
447 select CSRC_R4K
430 select DMA_NONCOHERENT 448 select DMA_NONCOHERENT
431 select HW_HAS_PCI 449 select HW_HAS_PCI
432 select IRQ_CPU 450 select IRQ_CPU
@@ -498,6 +516,7 @@ config SIBYTE_SWARM
498 select SYS_SUPPORTS_HIGHMEM 516 select SYS_SUPPORTS_HIGHMEM
499 select SYS_SUPPORTS_KGDB 517 select SYS_SUPPORTS_KGDB
500 select SYS_SUPPORTS_LITTLE_ENDIAN 518 select SYS_SUPPORTS_LITTLE_ENDIAN
519 select ZONE_DMA32 if 64BIT
501 520
502config SIBYTE_LITTLESUR 521config SIBYTE_LITTLESUR
503 bool "Sibyte BCM91250C2-LittleSur" 522 bool "Sibyte BCM91250C2-LittleSur"
@@ -546,7 +565,9 @@ config SIBYTE_BIGSUR
546 select SWAP_IO_SPACE 565 select SWAP_IO_SPACE
547 select SYS_HAS_CPU_SB1 566 select SYS_HAS_CPU_SB1
548 select SYS_SUPPORTS_BIG_ENDIAN 567 select SYS_SUPPORTS_BIG_ENDIAN
568 select SYS_SUPPORTS_HIGHMEM
549 select SYS_SUPPORTS_LITTLE_ENDIAN 569 select SYS_SUPPORTS_LITTLE_ENDIAN
570 select ZONE_DMA32 if 64BIT
550 571
551config SNI_RM 572config SNI_RM
552 bool "SNI RM200/300/400" 573 bool "SNI RM200/300/400"
@@ -555,6 +576,7 @@ config SNI_RM
555 select ARCH_MAY_HAVE_PC_FDC 576 select ARCH_MAY_HAVE_PC_FDC
556 select BOOT_ELF32 577 select BOOT_ELF32
557 select CEVT_R4K 578 select CEVT_R4K
579 select CSRC_R4K
558 select DMA_NONCOHERENT 580 select DMA_NONCOHERENT
559 select GENERIC_ISA_DMA 581 select GENERIC_ISA_DMA
560 select HW_HAS_EISA 582 select HW_HAS_EISA
@@ -583,6 +605,7 @@ config SNI_RM
583 605
584config TOSHIBA_JMR3927 606config TOSHIBA_JMR3927
585 bool "Toshiba JMR-TX3927 board" 607 bool "Toshiba JMR-TX3927 board"
608 select CEVT_TXX9
586 select DMA_NONCOHERENT 609 select DMA_NONCOHERENT
587 select HW_HAS_PCI 610 select HW_HAS_PCI
588 select MIPS_TX3927 611 select MIPS_TX3927
@@ -597,6 +620,8 @@ config TOSHIBA_JMR3927
597config TOSHIBA_RBTX4927 620config TOSHIBA_RBTX4927
598 bool "Toshiba RBTX49[23]7 board" 621 bool "Toshiba RBTX49[23]7 board"
599 select CEVT_R4K 622 select CEVT_R4K
623 select CSRC_R4K
624 select CEVT_TXX9
600 select DMA_NONCOHERENT 625 select DMA_NONCOHERENT
601 select HAS_TXX9_SERIAL 626 select HAS_TXX9_SERIAL
602 select HW_HAS_PCI 627 select HW_HAS_PCI
@@ -618,6 +643,8 @@ config TOSHIBA_RBTX4927
618config TOSHIBA_RBTX4938 643config TOSHIBA_RBTX4938
619 bool "Toshiba RBTX4938 board" 644 bool "Toshiba RBTX4938 board"
620 select CEVT_R4K 645 select CEVT_R4K
646 select CSRC_R4K
647 select CEVT_TXX9
621 select DMA_NONCOHERENT 648 select DMA_NONCOHERENT
622 select HAS_TXX9_SERIAL 649 select HAS_TXX9_SERIAL
623 select HW_HAS_PCI 650 select HW_HAS_PCI
@@ -638,6 +665,7 @@ config TOSHIBA_RBTX4938
638config WR_PPMC 665config WR_PPMC
639 bool "Wind River PPMC board" 666 bool "Wind River PPMC board"
640 select CEVT_R4K 667 select CEVT_R4K
668 select CSRC_R4K
641 select IRQ_CPU 669 select IRQ_CPU
642 select BOOT_ELF32 670 select BOOT_ELF32
643 select DMA_NONCOHERENT 671 select DMA_NONCOHERENT
@@ -730,12 +758,30 @@ config ARCH_MAY_HAVE_PC_FDC
730config BOOT_RAW 758config BOOT_RAW
731 bool 759 bool
732 760
761config CEVT_BCM1480
762 bool
763
733config CEVT_GT641XX 764config CEVT_GT641XX
734 bool 765 bool
735 766
736config CEVT_R4K 767config CEVT_R4K
737 bool 768 bool
738 769
770config CEVT_SB1250
771 bool
772
773config CEVT_TXX9
774 bool
775
776config CSRC_BCM1480
777 bool
778
779config CSRC_R4K
780 bool
781
782config CSRC_SB1250
783 bool
784
739config CFE 785config CFE
740 bool 786 bool
741 787
@@ -1390,7 +1436,6 @@ config MIPS_MT_SMP
1390 depends on SYS_SUPPORTS_MULTITHREADING 1436 depends on SYS_SUPPORTS_MULTITHREADING
1391 select CPU_MIPSR2_IRQ_VI 1437 select CPU_MIPSR2_IRQ_VI
1392 select CPU_MIPSR2_IRQ_EI 1438 select CPU_MIPSR2_IRQ_EI
1393 select CPU_MIPSR2_SRS
1394 select MIPS_MT 1439 select MIPS_MT
1395 select NR_CPUS_DEFAULT_2 1440 select NR_CPUS_DEFAULT_2
1396 select SMP 1441 select SMP
@@ -1407,7 +1452,6 @@ config MIPS_MT_SMTC
1407 select GENERIC_CLOCKEVENTS_BROADCAST 1452 select GENERIC_CLOCKEVENTS_BROADCAST
1408 select CPU_MIPSR2_IRQ_VI 1453 select CPU_MIPSR2_IRQ_VI
1409 select CPU_MIPSR2_IRQ_EI 1454 select CPU_MIPSR2_IRQ_EI
1410 select CPU_MIPSR2_SRS
1411 select MIPS_MT 1455 select MIPS_MT
1412 select NR_CPUS_DEFAULT_8 1456 select NR_CPUS_DEFAULT_8
1413 select SMP 1457 select SMP
@@ -1434,7 +1478,6 @@ config MIPS_VPE_LOADER
1434 depends on SYS_SUPPORTS_MULTITHREADING 1478 depends on SYS_SUPPORTS_MULTITHREADING
1435 select CPU_MIPSR2_IRQ_VI 1479 select CPU_MIPSR2_IRQ_VI
1436 select CPU_MIPSR2_IRQ_EI 1480 select CPU_MIPSR2_IRQ_EI
1437 select CPU_MIPSR2_SRS
1438 select MIPS_MT 1481 select MIPS_MT
1439 help 1482 help
1440 Includes a loader for loading an elf relocatable object 1483 Includes a loader for loading an elf relocatable object
@@ -1563,12 +1606,6 @@ config CPU_MIPSR2_IRQ_VI
1563config CPU_MIPSR2_IRQ_EI 1606config CPU_MIPSR2_IRQ_EI
1564 bool 1607 bool
1565 1608
1566#
1567# Shadow registers are an R2 feature
1568#
1569config CPU_MIPSR2_SRS
1570 bool
1571
1572config CPU_HAS_SYNC 1609config CPU_HAS_SYNC
1573 bool 1610 bool
1574 depends on !CPU_R3000 1611 depends on !CPU_R3000
@@ -1630,6 +1667,9 @@ config ARCH_DISCONTIGMEM_ENABLE
1630 or have huge holes in the physical address space for other reasons. 1667 or have huge holes in the physical address space for other reasons.
1631 See <file:Documentation/vm/numa> for more. 1668 See <file:Documentation/vm/numa> for more.
1632 1669
1670config ARCH_POPULATES_NODE_MAP
1671 def_bool y
1672
1633config ARCH_SPARSEMEM_ENABLE 1673config ARCH_SPARSEMEM_ENABLE
1634 bool 1674 bool
1635 select SPARSEMEM_STATIC 1675 select SPARSEMEM_STATIC
@@ -1935,6 +1975,9 @@ config I8253
1935config PCSPEAKER 1975config PCSPEAKER
1936 bool 1976 bool
1937 1977
1978config ZONE_DMA32
1979 bool
1980
1938source "drivers/pcmcia/Kconfig" 1981source "drivers/pcmcia/Kconfig"
1939 1982
1940source "drivers/pci/hotplug/Kconfig" 1983source "drivers/pci/hotplug/Kconfig"
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 23c17755eca0..a1f8d8b96b03 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -44,7 +44,7 @@ endif
44 44
45ifneq ($(SUBARCH),$(ARCH)) 45ifneq ($(SUBARCH),$(ARCH))
46 ifeq ($(CROSS_COMPILE),) 46 ifeq ($(CROSS_COMPILE),)
47 CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-gnu-linux- $(tool-archpref)-unknown-gnu-linux-) 47 CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-)
48 endif 48 endif
49endif 49endif
50 50
diff --git a/arch/mips/au1000/Kconfig b/arch/mips/au1000/Kconfig
index b36cec58a9a8..05d1354aad3a 100644
--- a/arch/mips/au1000/Kconfig
+++ b/arch/mips/au1000/Kconfig
@@ -138,6 +138,7 @@ config SOC_AU1X00
138 bool 138 bool
139 select 64BIT_PHYS_ADDR 139 select 64BIT_PHYS_ADDR
140 select CEVT_R4K 140 select CEVT_R4K
141 select CSRC_R4K
141 select IRQ_CPU 142 select IRQ_CPU
142 select SYS_HAS_CPU_MIPS32_R1 143 select SYS_HAS_CPU_MIPS32_R1
143 select SYS_SUPPORTS_32BIT_KERNEL 144 select SYS_SUPPORTS_32BIT_KERNEL
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..ffa08362de17 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -8,8 +8,14 @@ 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_R4K) += csrc-r4k.o
18obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
13 19
14binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ 20binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
15 irix5sys.o sysirix.o 21 irix5sys.o sysirix.o
@@ -38,6 +44,7 @@ obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
38obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o 44obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o
39 45
40obj-$(CONFIG_SMP) += smp.o 46obj-$(CONFIG_SMP) += smp.o
47obj-$(CONFIG_SMP_UP) += smp-up.o
41 48
42obj-$(CONFIG_MIPS_MT) += mips-mt.o 49obj-$(CONFIG_MIPS_MT) += mips-mt.o
43obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o 50obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c
new file mode 100644
index 000000000000..0a57f86945f1
--- /dev/null
+++ b/arch/mips/kernel/cevt-bcm1480.c
@@ -0,0 +1,153 @@
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(0, cfg);
79 __raw_writeq(delta - 1, init);
80 __raw_writeq(M_SCD_TIMER_ENABLE, cfg);
81
82 return 0;
83}
84
85static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
86{
87 unsigned int cpu = smp_processor_id();
88 struct clock_event_device *cd = dev_id;
89 void __iomem *cfg;
90 unsigned long tmode;
91
92 if (cd->mode == CLOCK_EVT_MODE_PERIODIC)
93 tmode = M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS;
94 else
95 tmode = 0;
96
97 /* ACK interrupt */
98 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
99 ____raw_writeq(tmode, cfg);
100
101 cd->event_handler(cd);
102
103 return IRQ_HANDLED;
104}
105
106static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
107static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
108static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
109
110void __cpuinit sb1480_clockevent_init(void)
111{
112 unsigned int cpu = smp_processor_id();
113 unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu;
114 struct irqaction *action = &per_cpu(sibyte_hpt_irqaction, cpu);
115 struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
116 unsigned char *name = per_cpu(sibyte_hpt_name, cpu);
117
118 BUG_ON(cpu > 3); /* Only have 4 general purpose timers */
119
120 sprintf(name, "bcm1480-counter-%d", cpu);
121 cd->name = name;
122 cd->features = CLOCK_EVT_FEAT_PERIODIC |
123 CLOCK_EVT_FEAT_ONESHOT;
124 clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
125 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
126 cd->min_delta_ns = clockevent_delta2ns(2, cd);
127 cd->rating = 200;
128 cd->irq = irq;
129 cd->cpumask = cpumask_of_cpu(cpu);
130 cd->set_next_event = sibyte_next_event;
131 cd->set_mode = sibyte_set_mode;
132 clockevents_register_device(cd);
133
134 bcm1480_mask_irq(cpu, irq);
135
136 /*
137 * Map the timer interrupt to IP[4] of this cpu
138 */
139 __raw_writeq(IMR_IP4_VAL,
140 IOADDR(A_BCM1480_IMR_REGISTER(cpu,
141 R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) + (irq << 3)));
142
143 bcm1480_unmask_irq(cpu, irq);
144
145 action->handler = sibyte_counter_handler;
146 action->flags = IRQF_DISABLED | IRQF_PERCPU;
147 action->mask = cpumask_of_cpu(cpu);
148 action->name = name;
149 action->dev_id = cd;
150
151 irq_set_affinity(irq, cpumask_of_cpu(cpu));
152 setup_irq(irq, action);
153}
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..24a2d907aa0d 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())
@@ -213,15 +219,15 @@ static int c0_compare_int_usable(void)
213 return 1; 219 return 1;
214} 220}
215 221
216void __cpuinit mips_clockevent_init(void) 222int __cpuinit mips_clockevent_init(void)
217{ 223{
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 -ENXIO;
225 231
226#ifdef CONFIG_MIPS_MT_SMTC 232#ifdef CONFIG_MIPS_MT_SMTC
227 setup_smtc_dummy_clockevent_device(); 233 setup_smtc_dummy_clockevent_device();
@@ -231,11 +237,20 @@ void __cpuinit mips_clockevent_init(void)
231 * device. 237 * device.
232 */ 238 */
233 if (cpu) 239 if (cpu)
234 return; 240 return 0;
235#endif 241#endif
236 242
237 if (!c0_compare_int_usable()) 243 if (!c0_compare_int_usable())
238 return; 244 return -ENXIO;
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();
239 254
240 cd = &per_cpu(mips_clockevent_device, cpu); 255 cd = &per_cpu(mips_clockevent_device, cpu);
241 256
@@ -261,13 +276,17 @@ 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 0;
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; 290
272 } 291 return 0;
273} 292}
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c
new file mode 100644
index 000000000000..63ac3ad462bc
--- /dev/null
+++ b/arch/mips/kernel/cevt-sb1250.c
@@ -0,0 +1,152 @@
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(0, cfg);
77 __raw_writeq(delta - 1, init);
78 __raw_writeq(M_SCD_TIMER_ENABLE, cfg);
79
80 return 0;
81}
82
83static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
84{
85 unsigned int cpu = smp_processor_id();
86 struct clock_event_device *cd = dev_id;
87 void __iomem *cfg;
88 unsigned long tmode;
89
90 if (cd->mode == CLOCK_EVT_MODE_PERIODIC)
91 tmode = M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS;
92 else
93 tmode = 0;
94
95 /* ACK interrupt */
96 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
97 ____raw_writeq(tmode, cfg);
98
99 cd->event_handler(cd);
100
101 return IRQ_HANDLED;
102}
103
104static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
105static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
106static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
107
108void __cpuinit sb1250_clockevent_init(void)
109{
110 unsigned int cpu = smp_processor_id();
111 unsigned int irq = K_INT_TIMER_0 + cpu;
112 struct irqaction *action = &per_cpu(sibyte_hpt_irqaction, cpu);
113 struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
114 unsigned char *name = per_cpu(sibyte_hpt_name, cpu);
115
116 /* Only have 4 general purpose timers, and we use last one as hpt */
117 BUG_ON(cpu > 2);
118
119 sprintf(name, "sb1250-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(2, 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 sb1250_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_IMR_REGISTER(cpu, R_IMR_INTERRUPT_MAP_BASE) +
140 (irq << 3)));
141
142 sb1250_unmask_irq(cpu, irq);
143
144 action->handler = sibyte_counter_handler;
145 action->flags = IRQF_DISABLED | IRQF_PERCPU;
146 action->mask = cpumask_of_cpu(cpu);
147 action->name = name;
148 action->dev_id = cd;
149
150 irq_set_affinity(irq, cpumask_of_cpu(cpu));
151 setup_irq(irq, action);
152}
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/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index c8c47a2d1972..5c2794391bf5 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -943,6 +943,11 @@ __init void cpu_probe(void)
943 } 943 }
944 944
945 __cpu_name[cpu] = cpu_to_name(c); 945 __cpu_name[cpu] = cpu_to_name(c);
946
947 if (cpu_has_mips_r2)
948 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
949 else
950 c->srsets = 1;
946} 951}
947 952
948__init void cpu_report(void) 953__init void cpu_report(void)
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-r4k.c b/arch/mips/kernel/csrc-r4k.c
new file mode 100644
index 000000000000..74c5c62365a8
--- /dev/null
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -0,0 +1,29 @@
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) 2007 by Ralf Baechle
7 */
8
9static cycle_t c0_hpt_read(void)
10{
11 return read_c0_count();
12}
13
14static struct clocksource clocksource_mips = {
15 .name = "MIPS",
16 .read = c0_hpt_read,
17 .mask = CLOCKSOURCE_MASK(32),
18 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
19};
20
21static void __init init_mips_clocksource(void)
22{
23 /* Calclate a somewhat reasonable rating value */
24 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
25
26 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
27
28 clocksource_register(&clocksource_mips);
29}
diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
new file mode 100644
index 000000000000..92212bbb8e45
--- /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 = "bcm1250-counter-3",
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/genex.S b/arch/mips/kernel/genex.S
index c0f19d638b98..e76a76bf0b3d 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -146,7 +146,7 @@ NESTED(handle_int, PT_SIZE, sp)
146 and k0, ST0_IEP 146 and k0, ST0_IEP
147 bnez k0, 1f 147 bnez k0, 1f
148 148
149 mfc0 k0, EP0_EPC 149 mfc0 k0, CP0_EPC
150 .set noreorder 150 .set noreorder
151 j k0 151 j k0
152 rfe 152 rfe
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..5b10ac133ec8 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 {
@@ -426,6 +430,7 @@ asmlinkage int irix_sigprocmask(int how, irix_sigset_t __user *new,
426 break; 430 break;
427 431
428 default: 432 default:
433 spin_unlock_irq(&current->sighand->siglock);
429 return -EINVAL; 434 return -EINVAL;
430 } 435 }
431 recalc_sigpending(); 436 recalc_sigpending();
@@ -527,7 +532,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long __user *set,
527 532
528 expire = schedule_timeout_interruptible(expire); 533 expire = schedule_timeout_interruptible(expire);
529 534
530 for (i=0; i<=4; i++) 535 for (i=0; i < _IRIX_NSIG_WORDS; i++)
531 tmp |= (current->pending.signal.sig[i] & kset.sig[i]); 536 tmp |= (current->pending.signal.sig[i] & kset.sig[i]);
532 537
533 if (tmp) 538 if (tmp)
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index 250732883488..971adf6ef4f4 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -44,5 +44,5 @@ void __init rm7k_cpu_irq_init(void)
44 44
45 for (i = base; i < base + 4; i++) 45 for (i = base; i < base + 4; i++)
46 set_irq_chip_and_handler(i, &rm7k_irq_controller, 46 set_irq_chip_and_handler(i, &rm7k_irq_controller,
47 handle_level_irq); 47 handle_percpu_irq);
48} 48}
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index ae83d2df6f31..7b04583bd800 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -104,5 +104,5 @@ void __init rm9k_cpu_irq_init(void)
104 104
105 rm9000_perfcount_irq = base + 1; 105 rm9000_perfcount_irq = base + 1;
106 set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq, 106 set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq,
107 handle_level_irq); 107 handle_percpu_irq);
108} 108}
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 7b66e03b5899..0ee2567b780d 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -116,5 +116,5 @@ void __init mips_cpu_irq_init(void)
116 116
117 for (i = irq_base + 2; i < irq_base + 8; i++) 117 for (i = irq_base + 2; i < irq_base + 8; i++)
118 set_irq_chip_and_handler(i, &mips_cpu_irq_controller, 118 set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
119 handle_level_irq); 119 handle_percpu_irq);
120} 120}
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index efd2d1314123..6e6e947cce1e 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -60,6 +60,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
60 cpu_has_dsp ? " dsp" : "", 60 cpu_has_dsp ? " dsp" : "",
61 cpu_has_mipsmt ? " mt" : "" 61 cpu_has_mipsmt ? " mt" : ""
62 ); 62 );
63 seq_printf(m, "shadow register sets\t: %d\n",
64 cpu_data[n].srsets);
63 65
64 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", 66 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
65 cpu_has_vce ? "%u" : "not available"); 67 cpu_has_vce ? "%u" : "not available");
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/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 118be24224f2..01993ec3368b 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -293,7 +293,7 @@ EXPORT(sysn32_call_table)
293 PTR sys_ni_syscall /* 6170, was get_kernel_syms */ 293 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
294 PTR sys_ni_syscall /* was query_module */ 294 PTR sys_ni_syscall /* was query_module */
295 PTR sys_quotactl 295 PTR sys_quotactl
296 PTR sys_nfsservctl 296 PTR compat_sys_nfsservctl
297 PTR sys_ni_syscall /* res. for getpmsg */ 297 PTR sys_ni_syscall /* res. for getpmsg */
298 PTR sys_ni_syscall /* 6175 for putpmsg */ 298 PTR sys_ni_syscall /* 6175 for putpmsg */
299 PTR sys_ni_syscall /* res. for afs_syscall */ 299 PTR sys_ni_syscall /* res. for afs_syscall */
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a06a27d6cfcd..7f6ddcb5d485 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -269,7 +269,7 @@ static void __init bootmem_init(void)
269 269
270static void __init bootmem_init(void) 270static void __init bootmem_init(void)
271{ 271{
272 unsigned long reserved_end; 272 unsigned long init_begin, reserved_end;
273 unsigned long mapstart = ~0UL; 273 unsigned long mapstart = ~0UL;
274 unsigned long bootmap_size; 274 unsigned long bootmap_size;
275 int i; 275 int i;
@@ -342,6 +342,35 @@ static void __init bootmem_init(void)
342 */ 342 */
343 bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart, 343 bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart,
344 min_low_pfn, max_low_pfn); 344 min_low_pfn, max_low_pfn);
345
346
347 init_begin = PFN_UP(__pa_symbol(&__init_begin));
348 for (i = 0; i < boot_mem_map.nr_map; i++) {
349 unsigned long start, end;
350
351 start = PFN_UP(boot_mem_map.map[i].addr);
352 end = PFN_DOWN(boot_mem_map.map[i].addr
353 + boot_mem_map.map[i].size);
354
355 if (start <= init_begin)
356 start = init_begin;
357 if (start >= end)
358 continue;
359
360#ifndef CONFIG_HIGHMEM
361 if (end > max_low_pfn)
362 end = max_low_pfn;
363
364 /*
365 * ... finally, is the area going away?
366 */
367 if (end <= start)
368 continue;
369#endif
370
371 add_active_range(0, start, end);
372 }
373
345 /* 374 /*
346 * Register fully available low RAM pages with the bootmem allocator. 375 * Register fully available low RAM pages with the bootmem allocator.
347 */ 376 */
diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c
new file mode 100644
index 000000000000..ead6c30eeb14
--- /dev/null
+++ b/arch/mips/kernel/smp-up.c
@@ -0,0 +1,67 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006, 07 by Ralf Baechle (ralf@linux-mips.org)
7 *
8 * Symmetric Uniprocessor (TM) Support
9 */
10#include <linux/kernel.h>
11#include <linux/sched.h>
12
13/*
14 * Send inter-processor interrupt
15 */
16void up_send_ipi_single(int cpu, unsigned int action)
17{
18 panic(KERN_ERR "%s called", __func__);
19}
20
21static inline void up_send_ipi_mask(cpumask_t mask, unsigned int action)
22{
23 panic(KERN_ERR "%s called", __func__);
24}
25
26/*
27 * After we've done initial boot, this function is called to allow the
28 * board code to clean up state, if needed
29 */
30void __cpuinit up_init_secondary(void)
31{
32}
33
34void __cpuinit up_smp_finish(void)
35{
36}
37
38/* Hook for after all CPUs are online */
39void up_cpus_done(void)
40{
41}
42
43/*
44 * Firmware CPU startup hook
45 */
46void __cpuinit up_boot_secondary(int cpu, struct task_struct *idle)
47{
48}
49
50void __init up_smp_setup(void)
51{
52}
53
54void __init up_prepare_cpus(unsigned int max_cpus)
55{
56}
57
58struct plat_smp_ops up_smp_ops = {
59 .send_ipi_single = up_send_ipi_single,
60 .send_ipi_mask = up_send_ipi_mask,
61 .init_secondary = up_init_secondary,
62 .smp_finish = up_smp_finish,
63 .cpus_done = up_cpus_done,
64 .boot_secondary = up_boot_secondary,
65 .smp_setup = up_smp_setup,
66 .prepare_cpus = up_prepare_cpus,
67};
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..52075426c373 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 */
@@ -61,40 +50,8 @@ int update_persistent_clock(struct timespec now)
61 return rtc_mips_set_mmss(now.tv_sec); 50 return rtc_mips_set_mmss(now.tv_sec);
62} 51}
63 52
64/*
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.
74 */
75static cycle_t c0_hpt_read(void)
76{
77 return read_c0_count();
78}
79
80int (*mips_timer_state)(void); 53int (*mips_timer_state)(void);
81 54
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) 55int null_perf_irq(void)
99{ 56{
100 return 0; 57 return 0;
@@ -115,62 +72,10 @@ EXPORT_SYMBOL(perf_irq);
115 * (only needed if you intended to use cpu counter as timer interrupt 72 * (only needed if you intended to use cpu counter as timer interrupt
116 * source) 73 * source)
117 * 2) calculate a couple of cached variables for later usage 74 * 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 */ 75 */
123 76
124unsigned int mips_hpt_frequency; 77unsigned int mips_hpt_frequency;
125 78
126static unsigned int __init calibrate_hpt(void)
127{
128 cycle_t frequency, hpt_start, hpt_end, hpt_count, hz;
129
130 const int loops = HZ / 10;
131 int log_2_loops = 0;
132 int i;
133
134 /*
135 * We want to calibrate for 0.1s, but to avoid a 64-bit
136 * division we round the number of loops up to the nearest
137 * power of 2.
138 */
139 while (loops > 1 << log_2_loops)
140 log_2_loops++;
141 i = 1 << log_2_loops;
142
143 /*
144 * Wait for a rising edge of the timer interrupt.
145 */
146 while (mips_timer_state());
147 while (!mips_timer_state());
148
149 /*
150 * Now see how many high precision timer ticks happen
151 * during the calculated number of periods between timer
152 * interrupts.
153 */
154 hpt_start = clocksource_mips.read();
155 do {
156 while (mips_timer_state());
157 while (!mips_timer_state());
158 } while (--i);
159 hpt_end = clocksource_mips.read();
160
161 hpt_count = (hpt_end - hpt_start) & clocksource_mips.mask;
162 hz = HZ;
163 frequency = hpt_count * hz;
164
165 return frequency >> log_2_loops;
166}
167
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) 79void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
175{ 80{
176 u64 temp; 81 u64 temp;
@@ -204,55 +109,60 @@ void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
204 cd->mult = (u32) temp; 109 cd->mult = (u32) temp;
205} 110}
206 111
207static void __init init_mips_clocksource(void) 112void __init __weak plat_time_init(void)
208{ 113{
209 if (!mips_hpt_frequency || clocksource_mips.read == null_hpt_read)
210 return;
211
212 /* Calclate a somewhat reasonable rating value */
213 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
214
215 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
216
217 clocksource_register(&clocksource_mips);
218} 114}
219 115
220void __init __weak plat_time_init(void) 116/*
117 * This function exists in order to cause an error due to a duplicate
118 * definition if platform code should have its own implementation. The hook
119 * to use instead is plat_time_init. plat_time_init does not receive the
120 * irqaction pointer argument anymore. This is because any function which
121 * initializes an interrupt timer now takes care of its own request_irq rsp.
122 * setup_irq calls and each clock_event_device should use its own
123 * struct irqrequest.
124 */
125void __init plat_timer_setup(void)
221{ 126{
127 BUG();
222} 128}
223 129
224void __init __weak plat_timer_setup(struct irqaction *irq) 130static __init int cpu_has_mfc0_count_bug(void)
225{ 131{
132 switch (current_cpu_type()) {
133 case CPU_R4000PC:
134 case CPU_R4000SC:
135 case CPU_R4000MC:
136 /*
137 * V3.0 is documented as suffering from the mfc0 from count bug.
138 * Afaik this is the last version of the R4000. Later versions
139 * were marketed as R4400.
140 */
141 return 1;
142
143 case CPU_R4400PC:
144 case CPU_R4400SC:
145 case CPU_R4400MC:
146 /*
147 * The published errata for the R4400 upto 3.0 say the CPU
148 * has the mfc0 from count bug.
149 */
150 if ((current_cpu_data.processor_id & 0xff) <= 0x30)
151 return 1;
152
153 /*
154 * I don't have erratas for newer R4400 so be paranoid.
155 */
156 return 1;
157 }
158
159 return 0;
226} 160}
227 161
228void __init time_init(void) 162void __init time_init(void)
229{ 163{
230 plat_time_init(); 164 plat_time_init();
231 165
232 /* Choose appropriate high precision timer routines. */ 166 if (mips_clockevent_init() || !cpu_has_mfc0_count_bug())
233 if (!cpu_has_counter && !clocksource_mips.read) 167 init_mips_clocksource();
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. */
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)
248 mips_hpt_frequency = calibrate_hpt();
249
250 /* Report the high precision timer rate for a reference. */
251 printk("Using %u.%03u MHz high precision timer.\n",
252 ((mips_hpt_frequency + 500) / 1000) / 1000,
253 ((mips_hpt_frequency + 500) / 1000) % 1000);
254 }
255
256 init_mips_clocksource();
257 mips_clockevent_init();
258} 168}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index fa500787152d..23e73d0650a3 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1100,59 +1100,6 @@ void *set_except_vector(int n, void *addr)
1100 return (void *)old_handler; 1100 return (void *)old_handler;
1101} 1101}
1102 1102
1103#ifdef CONFIG_CPU_MIPSR2_SRS
1104/*
1105 * MIPSR2 shadow register set allocation
1106 * FIXME: SMP...
1107 */
1108
1109static struct shadow_registers {
1110 /*
1111 * Number of shadow register sets supported
1112 */
1113 unsigned long sr_supported;
1114 /*
1115 * Bitmap of allocated shadow registers
1116 */
1117 unsigned long sr_allocated;
1118} shadow_registers;
1119
1120static void mips_srs_init(void)
1121{
1122 shadow_registers.sr_supported = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
1123 printk(KERN_INFO "%ld MIPSR2 register sets available\n",
1124 shadow_registers.sr_supported);
1125 shadow_registers.sr_allocated = 1; /* Set 0 used by kernel */
1126}
1127
1128int mips_srs_max(void)
1129{
1130 return shadow_registers.sr_supported;
1131}
1132
1133int mips_srs_alloc(void)
1134{
1135 struct shadow_registers *sr = &shadow_registers;
1136 int set;
1137
1138again:
1139 set = find_first_zero_bit(&sr->sr_allocated, sr->sr_supported);
1140 if (set >= sr->sr_supported)
1141 return -1;
1142
1143 if (test_and_set_bit(set, &sr->sr_allocated))
1144 goto again;
1145
1146 return set;
1147}
1148
1149void mips_srs_free(int set)
1150{
1151 struct shadow_registers *sr = &shadow_registers;
1152
1153 clear_bit(set, &sr->sr_allocated);
1154}
1155
1156static asmlinkage void do_default_vi(void) 1103static asmlinkage void do_default_vi(void)
1157{ 1104{
1158 show_regs(get_irq_regs()); 1105 show_regs(get_irq_regs());
@@ -1163,6 +1110,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1163{ 1110{
1164 unsigned long handler; 1111 unsigned long handler;
1165 unsigned long old_handler = vi_handlers[n]; 1112 unsigned long old_handler = vi_handlers[n];
1113 int srssets = current_cpu_data.srsets;
1166 u32 *w; 1114 u32 *w;
1167 unsigned char *b; 1115 unsigned char *b;
1168 1116
@@ -1178,7 +1126,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1178 1126
1179 b = (unsigned char *)(ebase + 0x200 + n*VECTORSPACING); 1127 b = (unsigned char *)(ebase + 0x200 + n*VECTORSPACING);
1180 1128
1181 if (srs >= mips_srs_max()) 1129 if (srs >= srssets)
1182 panic("Shadow register set %d not supported", srs); 1130 panic("Shadow register set %d not supported", srs);
1183 1131
1184 if (cpu_has_veic) { 1132 if (cpu_has_veic) {
@@ -1186,7 +1134,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1186 board_bind_eic_interrupt(n, srs); 1134 board_bind_eic_interrupt(n, srs);
1187 } else if (cpu_has_vint) { 1135 } else if (cpu_has_vint) {
1188 /* SRSMap is only defined if shadow sets are implemented */ 1136 /* SRSMap is only defined if shadow sets are implemented */
1189 if (mips_srs_max() > 1) 1137 if (srssets > 1)
1190 change_c0_srsmap(0xf << n*4, srs << n*4); 1138 change_c0_srsmap(0xf << n*4, srs << n*4);
1191 } 1139 }
1192 1140
@@ -1253,14 +1201,6 @@ void *set_vi_handler(int n, vi_handler_t addr)
1253 return set_vi_srs_handler(n, addr, 0); 1201 return set_vi_srs_handler(n, addr, 0);
1254} 1202}
1255 1203
1256#else
1257
1258static inline void mips_srs_init(void)
1259{
1260}
1261
1262#endif /* CONFIG_CPU_MIPSR2_SRS */
1263
1264/* 1204/*
1265 * This is used by native signal handling 1205 * This is used by native signal handling
1266 */ 1206 */
@@ -1503,8 +1443,6 @@ void __init trap_init(void)
1503 else 1443 else
1504 ebase = CAC_BASE; 1444 ebase = CAC_BASE;
1505 1445
1506 mips_srs_init();
1507
1508 per_cpu_trap_init(); 1446 per_cpu_trap_init();
1509 1447
1510 /* 1448 /*
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..c06eb812a95e 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -470,7 +470,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
470 */ 470 */
471 if (v != l->value) { 471 if (v != l->value) {
472 printk(KERN_DEBUG "VPE loader: " 472 printk(KERN_DEBUG "VPE loader: "
473 "apply_r_mips_lo16/hi16: " 473 "apply_r_mips_lo16/hi16: \t"
474 "inconsistent value information\n"); 474 "inconsistent value information\n");
475 return -ENOEXEC; 475 return -ENOEXEC;
476 } 476 }
@@ -629,7 +629,7 @@ static void simplify_symbols(Elf_Shdr * sechdrs,
629 break; 629 break;
630 630
631 case SHN_MIPS_SCOMMON: 631 case SHN_MIPS_SCOMMON:
632 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON" 632 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON "
633 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name, 633 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name,
634 sym[i].st_shndx); 634 sym[i].st_shndx);
635 // .sbss section 635 // .sbss section
@@ -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
@@ -1003,6 +1003,7 @@ static void cleanup_tc(struct tc *tc)
1003 write_tc_c0_tcstatus(tmp); 1003 write_tc_c0_tcstatus(tmp);
1004 1004
1005 write_tc_c0_tchalt(TCHALT_H); 1005 write_tc_c0_tchalt(TCHALT_H);
1006 mips_ihb();
1006 1007
1007 /* bind it to anything other than VPE1 */ 1008 /* bind it to anything other than VPE1 */
1008// write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE 1009// write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE
@@ -1235,9 +1236,12 @@ int vpe_free(vpe_handle vpe)
1235 settc(t->index); 1236 settc(t->index);
1236 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~VPECONF0_VPA); 1237 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~VPECONF0_VPA);
1237 1238
1238 /* mark the TC unallocated and halt'ed */ 1239 /* halt the TC */
1239 write_tc_c0_tcstatus(read_tc_c0_tcstatus() & ~TCSTATUS_A);
1240 write_tc_c0_tchalt(TCHALT_H); 1240 write_tc_c0_tchalt(TCHALT_H);
1241 mips_ihb();
1242
1243 /* mark the TC unallocated */
1244 write_tc_c0_tcstatus(read_tc_c0_tcstatus() & ~TCSTATUS_A);
1241 1245
1242 v->state = VPE_STATE_UNUSED; 1246 v->state = VPE_STATE_UNUSED;
1243 1247
@@ -1533,14 +1537,16 @@ static int __init vpe_module_init(void)
1533 t->pvpe = get_vpe(0); /* set the parent vpe */ 1537 t->pvpe = get_vpe(0); /* set the parent vpe */
1534 } 1538 }
1535 1539
1540 /* halt the TC */
1541 write_tc_c0_tchalt(TCHALT_H);
1542 mips_ihb();
1543
1536 tmp = read_tc_c0_tcstatus(); 1544 tmp = read_tc_c0_tcstatus();
1537 1545
1538 /* mark not activated and not dynamically allocatable */ 1546 /* mark not activated and not dynamically allocatable */
1539 tmp &= ~(TCSTATUS_A | TCSTATUS_DA); 1547 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
1540 tmp |= TCSTATUS_IXMT; /* interrupt exempt */ 1548 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
1541 write_tc_c0_tcstatus(tmp); 1549 write_tc_c0_tcstatus(tmp);
1542
1543 write_tc_c0_tchalt(TCHALT_H);
1544 } 1550 }
1545 } 1551 }
1546 1552
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index ba9692be3564..cfeab669782f 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -19,17 +19,14 @@
19 * Lasat boards. 19 * Lasat boards.
20 */ 20 */
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/irq.h>
23#include <linux/sched.h>
24#include <linux/slab.h>
25#include <linux/interrupt.h> 22#include <linux/interrupt.h>
26#include <linux/kernel_stat.h> 23#include <linux/irq.h>
27 24
28#include <asm/bootinfo.h> 25#include <asm/bootinfo.h>
29#include <asm/irq_cpu.h> 26#include <asm/irq_cpu.h>
30#include <asm/lasat/lasatint.h> 27#include <asm/lasat/lasatint.h>
31#include <asm/time.h> 28
32#include <asm/gdb-stub.h> 29#include <irq.h>
33 30
34static volatile int *lasat_int_status; 31static volatile int *lasat_int_status;
35static volatile int *lasat_int_mask; 32static volatile int *lasat_int_mask;
@@ -97,12 +94,18 @@ asmlinkage void plat_irq_dispatch(void)
97 94
98 /* if int_status == 0, then the interrupt has already been cleared */ 95 /* if int_status == 0, then the interrupt has already been cleared */
99 if (int_status) { 96 if (int_status) {
100 irq = LASATINT_BASE + ls1bit32(int_status); 97 irq = LASAT_IRQ_BASE + ls1bit32(int_status);
101 98
102 do_IRQ(irq); 99 do_IRQ(irq);
103 } 100 }
104} 101}
105 102
103static struct irqaction cascade = {
104 .handler = no_action,
105 .mask = CPU_MASK_NONE,
106 .name = "cascade",
107};
108
106void __init arch_init_irq(void) 109void __init arch_init_irq(void)
107{ 110{
108 int i; 111 int i;
@@ -127,6 +130,9 @@ void __init arch_init_irq(void)
127 } 130 }
128 131
129 mips_cpu_irq_init(); 132 mips_cpu_irq_init();
130 for (i = LASATINT_BASE; i <= LASATINT_END; i++) 133
134 for (i = LASAT_IRQ_BASE; i <= LASAT_IRQ_END; i++)
131 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq); 135 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq);
136
137 setup_irq(LASAT_CASCADE_IRQ, &cascade);
132} 138}
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/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c
index 946aee331788..cb1b6822711a 100644
--- a/arch/mips/math-emu/ieee754.c
+++ b/arch/mips/math-emu/ieee754.c
@@ -108,6 +108,7 @@ int ieee754si_xcpt(int r, const char *op, ...)
108 ax.rv.si = r; 108 ax.rv.si = r;
109 va_start(ax.ap, op); 109 va_start(ax.ap, op);
110 ieee754_xcpt(&ax); 110 ieee754_xcpt(&ax);
111 va_end(ax.ap);
111 return ax.rv.si; 112 return ax.rv.si;
112} 113}
113 114
@@ -122,5 +123,6 @@ s64 ieee754di_xcpt(s64 r, const char *op, ...)
122 ax.rv.di = r; 123 ax.rv.di = r;
123 va_start(ax.ap, op); 124 va_start(ax.ap, op);
124 ieee754_xcpt(&ax); 125 ieee754_xcpt(&ax);
126 va_end(ax.ap);
125 return ax.rv.di; 127 return ax.rv.di;
126} 128}
diff --git a/arch/mips/math-emu/ieee754dp.c b/arch/mips/math-emu/ieee754dp.c
index 3e214aac4b12..6d2d89f32472 100644
--- a/arch/mips/math-emu/ieee754dp.c
+++ b/arch/mips/math-emu/ieee754dp.c
@@ -57,6 +57,7 @@ ieee754dp ieee754dp_xcpt(ieee754dp r, const char *op, ...)
57 ax.rv.dp = r; 57 ax.rv.dp = r;
58 va_start(ax.ap, op); 58 va_start(ax.ap, op);
59 ieee754_xcpt(&ax); 59 ieee754_xcpt(&ax);
60 va_end(ax.ap);
60 return ax.rv.dp; 61 return ax.rv.dp;
61} 62}
62 63
@@ -83,6 +84,7 @@ ieee754dp ieee754dp_nanxcpt(ieee754dp r, const char *op, ...)
83 ax.rv.dp = r; 84 ax.rv.dp = r;
84 va_start(ax.ap, op); 85 va_start(ax.ap, op);
85 ieee754_xcpt(&ax); 86 ieee754_xcpt(&ax);
87 va_end(ax.ap);
86 return ax.rv.dp; 88 return ax.rv.dp;
87} 89}
88 90
diff --git a/arch/mips/math-emu/ieee754sp.c b/arch/mips/math-emu/ieee754sp.c
index adda851cd04f..463534045ab6 100644
--- a/arch/mips/math-emu/ieee754sp.c
+++ b/arch/mips/math-emu/ieee754sp.c
@@ -58,6 +58,7 @@ ieee754sp ieee754sp_xcpt(ieee754sp r, const char *op, ...)
58 ax.rv.sp = r; 58 ax.rv.sp = r;
59 va_start(ax.ap, op); 59 va_start(ax.ap, op);
60 ieee754_xcpt(&ax); 60 ieee754_xcpt(&ax);
61 va_end(ax.ap);
61 return ax.rv.sp; 62 return ax.rv.sp;
62} 63}
63 64
@@ -84,6 +85,7 @@ ieee754sp ieee754sp_nanxcpt(ieee754sp r, const char *op, ...)
84 ax.rv.sp = r; 85 ax.rv.sp = r;
85 va_start(ax.ap, op); 86 va_start(ax.ap, op);
86 ieee754_xcpt(&ax); 87 ieee754_xcpt(&ax);
88 va_end(ax.ap);
87 return ax.rv.sp; 89 return ax.rv.sp;
88} 90}
89 91
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..e39bbe989da3 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,33 @@ 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;
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 /* Set Data mode - binary. */
124 irq_desc[mips_cpu_timer_irq].flags |= IRQ_PER_CPU; 107 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL);
125 set_irq_handler(mips_cpu_timer_irq, handle_percpu_irq); 108
126#endif 109 est_freq = estimate_cpu_frequency();
110
111 printk(KERN_INFO "CPU frequency %d.%02d MHz\n", est_freq / 1000000,
112 (est_freq % 1000000) * 100 / 1000000);
113
114 cpu_khz = est_freq / 1000;
127} 115}
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..9355f1c9325f 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -7,6 +7,7 @@
7 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Ralf Baechle (ralf@gnu.org) 7 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Ralf Baechle (ralf@gnu.org)
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */ 9 */
10#include <linux/hardirq.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/highmem.h> 12#include <linux/highmem.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -345,11 +346,26 @@ static void r4k___flush_cache_all(void)
345 r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1); 346 r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1);
346} 347}
347 348
349static inline int has_valid_asid(const struct mm_struct *mm)
350{
351#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
352 int i;
353
354 for_each_online_cpu(i)
355 if (cpu_context(i, mm))
356 return 1;
357
358 return 0;
359#else
360 return cpu_context(smp_processor_id(), mm);
361#endif
362}
363
348static inline void local_r4k_flush_cache_range(void * args) 364static inline void local_r4k_flush_cache_range(void * args)
349{ 365{
350 struct vm_area_struct *vma = args; 366 struct vm_area_struct *vma = args;
351 367
352 if (!(cpu_context(smp_processor_id(), vma->vm_mm))) 368 if (!(has_valid_asid(vma->vm_mm)))
353 return; 369 return;
354 370
355 r4k_blast_dcache(); 371 r4k_blast_dcache();
@@ -368,7 +384,7 @@ static inline void local_r4k_flush_cache_mm(void * args)
368{ 384{
369 struct mm_struct *mm = args; 385 struct mm_struct *mm = args;
370 386
371 if (!cpu_context(smp_processor_id(), mm)) 387 if (!has_valid_asid(mm))
372 return; 388 return;
373 389
374 /* 390 /*
@@ -420,7 +436,7 @@ static inline void local_r4k_flush_cache_page(void *args)
420 * If ownes no valid ASID yet, cannot possibly have gotten 436 * If ownes no valid ASID yet, cannot possibly have gotten
421 * this page into the cache. 437 * this page into the cache.
422 */ 438 */
423 if (cpu_context(smp_processor_id(), mm) == 0) 439 if (!has_valid_asid(mm))
424 return; 440 return;
425 441
426 addr &= PAGE_MASK; 442 addr &= PAGE_MASK;
@@ -492,7 +508,11 @@ static inline void local_r4k_flush_data_cache_page(void * addr)
492 508
493static void r4k_flush_data_cache_page(unsigned long addr) 509static void r4k_flush_data_cache_page(unsigned long addr)
494{ 510{
495 r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 1, 1); 511 if (in_atomic())
512 local_r4k_flush_data_cache_page((void *)addr);
513 else
514 r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr,
515 1, 1);
496} 516}
497 517
498struct flush_icache_range_args { 518struct flush_icache_range_args {
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
index e7f539e3284b..1bd1f18ac23c 100644
--- a/arch/mips/mm/cerr-sb1.c
+++ b/arch/mips/mm/cerr-sb1.c
@@ -154,7 +154,7 @@ static void check_bus_watcher(void)
154 if (status & ~(1UL << 31)) { 154 if (status & ~(1UL << 31)) {
155 l2_err = csr_in32(IOADDR(A_BUS_L2_ERRORS)); 155 l2_err = csr_in32(IOADDR(A_BUS_L2_ERRORS));
156#ifdef DUMP_L2_ECC_TAG_ON_ERROR 156#ifdef DUMP_L2_ECC_TAG_ON_ERROR
157 l2_tag = in64(IO_SPACE_BASE | A_L2_ECC_TAG); 157 l2_tag = in64(IOADDR(A_L2_ECC_TAG));
158#endif 158#endif
159 memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS)); 159 memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS));
160 printk("Bus watcher error counters: %08x %08x\n", l2_err, memio_err); 160 printk("Bus watcher error counters: %08x %08x\n", l2_err, memio_err);
@@ -183,9 +183,9 @@ asmlinkage void sb1_cache_error(void)
183#ifdef CONFIG_SIBYTE_BW_TRACE 183#ifdef CONFIG_SIBYTE_BW_TRACE
184 /* Freeze the trace buffer now */ 184 /* Freeze the trace buffer now */
185#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 185#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
186 csr_out32(M_BCM1480_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG); 186 csr_out32(M_BCM1480_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
187#else 187#else
188 csr_out32(M_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG); 188 csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
189#endif 189#endif
190 printk("Trace buffer frozen\n"); 190 printk("Trace buffer frozen\n");
191#endif 191#endif
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index b1b40527658b..ae76795685cc 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>
@@ -40,16 +40,38 @@ static inline int cpu_is_noncoherent_r10000(struct device *dev)
40 current_cpu_type() == CPU_R12000); 40 current_cpu_type() == CPU_R12000);
41} 41}
42 42
43static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
44{
45 /* ignore region specifiers */
46 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
47
48#ifdef CONFIG_ZONE_DMA32
49 if (dev == NULL)
50 gfp |= __GFP_DMA;
51 else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
52 gfp |= __GFP_DMA;
53 else
54#endif
55#ifdef CONFIG_ZONE_DMA32
56 if (dev->coherent_dma_mask < DMA_BIT_MASK(32))
57 gfp |= __GFP_DMA32;
58 else
59#endif
60 ;
61
62 /* Don't invoke OOM killer */
63 gfp |= __GFP_NORETRY;
64
65 return gfp;
66}
67
43void *dma_alloc_noncoherent(struct device *dev, size_t size, 68void *dma_alloc_noncoherent(struct device *dev, size_t size,
44 dma_addr_t * dma_handle, gfp_t gfp) 69 dma_addr_t * dma_handle, gfp_t gfp)
45{ 70{
46 void *ret; 71 void *ret;
47 72
48 /* ignore region specifiers */ 73 gfp = massage_gfp_flags(dev, gfp);
49 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
50 74
51 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
52 gfp |= GFP_DMA;
53 ret = (void *) __get_free_pages(gfp, get_order(size)); 75 ret = (void *) __get_free_pages(gfp, get_order(size));
54 76
55 if (ret != NULL) { 77 if (ret != NULL) {
@@ -67,11 +89,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
67{ 89{
68 void *ret; 90 void *ret;
69 91
70 /* ignore region specifiers */ 92 gfp = massage_gfp_flags(dev, gfp);
71 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
72 93
73 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
74 gfp |= GFP_DMA;
75 ret = (void *) __get_free_pages(gfp, get_order(size)); 94 ret = (void *) __get_free_pages(gfp, get_order(size));
76 95
77 if (ret) { 96 if (ret) {
@@ -343,7 +362,7 @@ int dma_supported(struct device *dev, u64 mask)
343 * so we can't guarantee allocations that must be 362 * so we can't guarantee allocations that must be
344 * within a tighter range than GFP_DMA.. 363 * within a tighter range than GFP_DMA..
345 */ 364 */
346 if (mask < 0x00ffffff) 365 if (mask < DMA_BIT_MASK(24))
347 return 0; 366 return 0;
348 367
349 return 1; 368 return 1;
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 110ee7656b41..480dec04f552 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -347,11 +347,8 @@ static int __init page_is_ram(unsigned long pagenr)
347 347
348void __init paging_init(void) 348void __init paging_init(void)
349{ 349{
350 unsigned long zones_size[MAX_NR_ZONES] = { 0, }; 350 unsigned long max_zone_pfns[MAX_NR_ZONES];
351#ifndef CONFIG_FLATMEM 351 unsigned long lastpfn;
352 unsigned long zholes_size[MAX_NR_ZONES] = { 0, };
353 unsigned long i, j, pfn;
354#endif
355 352
356 pagetable_init(); 353 pagetable_init();
357 354
@@ -361,35 +358,27 @@ void __init paging_init(void)
361 kmap_coherent_init(); 358 kmap_coherent_init();
362 359
363#ifdef CONFIG_ZONE_DMA 360#ifdef CONFIG_ZONE_DMA
364 if (min_low_pfn < MAX_DMA_PFN && MAX_DMA_PFN <= max_low_pfn) { 361 max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
365 zones_size[ZONE_DMA] = MAX_DMA_PFN - min_low_pfn;
366 zones_size[ZONE_NORMAL] = max_low_pfn - MAX_DMA_PFN;
367 } else if (max_low_pfn < MAX_DMA_PFN)
368 zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn;
369 else
370#endif 362#endif
371 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; 363#ifdef CONFIG_ZONE_DMA32
372 364 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
365#endif
366 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
367 lastpfn = max_low_pfn;
373#ifdef CONFIG_HIGHMEM 368#ifdef CONFIG_HIGHMEM
374 zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn; 369 max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
370 lastpfn = highend_pfn;
375 371
376 if (cpu_has_dc_aliases && zones_size[ZONE_HIGHMEM]) { 372 if (cpu_has_dc_aliases && max_low_pfn != highend_pfn) {
377 printk(KERN_WARNING "This processor doesn't support highmem." 373 printk(KERN_WARNING "This processor doesn't support highmem."
378 " %ldk highmem ignored\n", zones_size[ZONE_HIGHMEM]); 374 " %ldk highmem ignored\n",
379 zones_size[ZONE_HIGHMEM] = 0; 375 (highend_pfn - max_low_pfn) << (PAGE_SHIFT - 10));
376 max_zone_pfns[ZONE_HIGHMEM] = max_low_pfn;
377 lastpfn = max_low_pfn;
380 } 378 }
381#endif 379#endif
382 380
383#ifdef CONFIG_FLATMEM 381 free_area_init_nodes(max_zone_pfns);
384 free_area_init(zones_size);
385#else
386 pfn = min_low_pfn;
387 for (i = 0; i < MAX_NR_ZONES; i++)
388 for (j = 0; j < zones_size[i]; j++, pfn++)
389 if (!page_is_ram(pfn))
390 zholes_size[i]++;
391 free_area_init_node(0, NODE_DATA(0), zones_size, 0, zholes_size);
392#endif
393} 382}
394 383
395static struct kcore_list kcore_mem, kcore_vmalloc; 384static struct kcore_list kcore_mem, kcore_vmalloc;
@@ -426,7 +415,7 @@ void __init mem_init(void)
426 415
427#ifdef CONFIG_HIGHMEM 416#ifdef CONFIG_HIGHMEM
428 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) { 417 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
429 struct page *page = mem_map + tmp; 418 struct page *page = pfn_to_page(tmp);
430 419
431 if (!page_is_ram(tmp)) { 420 if (!page_is_ram(tmp)) {
432 SetPageReserved(page); 421 SetPageReserved(page);
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-sni.c b/arch/mips/pci/fixup-sni.c
index a45bedd17233..5c8a79bb2661 100644
--- a/arch/mips/pci/fixup-sni.c
+++ b/arch/mips/pci/fixup-sni.c
@@ -113,6 +113,16 @@ static char irq_tab_pcit[13][5] __initdata = {
113 { 0, INTA, INTB, INTC, INTD }, /* Slot 5 */ 113 { 0, INTA, INTB, INTC, INTD }, /* Slot 5 */
114}; 114};
115 115
116static char irq_tab_pcit_cplus[13][5] __initdata = {
117 /* INTA INTB INTC INTD */
118 { 0, 0, 0, 0, 0 }, /* HOST bridge */
119 { 0, INTB, INTC, INTD, INTA }, /* PCI Slot 9 */
120 { 0, 0, 0, 0, 0 }, /* PCI-EISA */
121 { 0, 0, 0, 0, 0 }, /* Unused */
122 { 0, INTA, INTB, INTC, INTD }, /* PCI-PCI bridge */
123 { 0, INTB, INTC, INTD, INTA }, /* fixup */
124};
125
116static inline int is_rm300_revd(void) 126static inline int is_rm300_revd(void)
117{ 127{
118 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR; 128 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
@@ -123,8 +133,19 @@ static inline int is_rm300_revd(void)
123int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 133int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
124{ 134{
125 switch (sni_brd_type) { 135 switch (sni_brd_type) {
126 case SNI_BRD_PCI_TOWER:
127 case SNI_BRD_PCI_TOWER_CPLUS: 136 case SNI_BRD_PCI_TOWER_CPLUS:
137 if (slot == 4) {
138 /*
139 * SNI messed up interrupt wiring for onboard
140 * PCI bus 1; we need to fix this up here
141 */
142 while (dev && dev->bus->number != 1)
143 dev = dev->bus->self;
144 if (dev && dev->devfn >= PCI_DEVFN(4, 0))
145 slot = 5;
146 }
147 return irq_tab_pcit_cplus[slot][pin];
148 case SNI_BRD_PCI_TOWER:
128 return irq_tab_pcit[slot][pin]; 149 return irq_tab_pcit[slot][pin];
129 150
130 case SNI_BRD_PCI_MTOWER: 151 case SNI_BRD_PCI_MTOWER:
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/pci/pci-lasat.c b/arch/mips/pci/pci-lasat.c
index 174f314933b5..e70ae3236e0b 100644
--- a/arch/mips/pci/pci-lasat.c
+++ b/arch/mips/pci/pci-lasat.c
@@ -5,12 +5,14 @@
5 * 5 *
6 * Copyright (C) 2000, 2001, 04 Keith M Wesolowski 6 * Copyright (C) 2000, 2001, 04 Keith M Wesolowski
7 */ 7 */
8#include <linux/kernel.h>
9#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/types.h> 11#include <linux/types.h>
12
12#include <asm/bootinfo.h> 13#include <asm/bootinfo.h>
13#include <asm/lasat/lasatint.h> 14
15#include <irq.h>
14 16
15extern struct pci_ops nile4_pci_ops; 17extern struct pci_ops nile4_pci_ops;
16extern struct pci_ops gt64xxx_pci0_ops; 18extern struct pci_ops gt64xxx_pci0_ops;
@@ -55,15 +57,15 @@ static int __init lasat_pci_setup(void)
55 57
56arch_initcall(lasat_pci_setup); 58arch_initcall(lasat_pci_setup);
57 59
58#define LASATINT_ETH1 (LASATINT_BASE + 0) 60#define LASAT_IRQ_ETH1 (LASAT_IRQ_BASE + 0)
59#define LASATINT_ETH0 (LASATINT_BASE + 1) 61#define LASAT_IRQ_ETH0 (LASAT_IRQ_BASE + 1)
60#define LASATINT_HDC (LASATINT_BASE + 2) 62#define LASAT_IRQ_HDC (LASAT_IRQ_BASE + 2)
61#define LASATINT_COMP (LASATINT_BASE + 3) 63#define LASAT_IRQ_COMP (LASAT_IRQ_BASE + 3)
62#define LASATINT_HDLC (LASATINT_BASE + 4) 64#define LASAT_IRQ_HDLC (LASAT_IRQ_BASE + 4)
63#define LASATINT_PCIA (LASATINT_BASE + 5) 65#define LASAT_IRQ_PCIA (LASAT_IRQ_BASE + 5)
64#define LASATINT_PCIB (LASATINT_BASE + 6) 66#define LASAT_IRQ_PCIB (LASAT_IRQ_BASE + 6)
65#define LASATINT_PCIC (LASATINT_BASE + 7) 67#define LASAT_IRQ_PCIC (LASAT_IRQ_BASE + 7)
66#define LASATINT_PCID (LASATINT_BASE + 8) 68#define LASAT_IRQ_PCID (LASAT_IRQ_BASE + 8)
67 69
68int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 70int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
69{ 71{
@@ -71,13 +73,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
71 case 1: 73 case 1:
72 case 2: 74 case 2:
73 case 3: 75 case 3:
74 return LASATINT_PCIA + (((slot-1) + (pin-1)) % 4); 76 return LASAT_IRQ_PCIA + (((slot-1) + (pin-1)) % 4);
75 case 4: 77 case 4:
76 return LASATINT_ETH1; /* Ethernet 1 (LAN 2) */ 78 return LASAT_IRQ_ETH1; /* Ethernet 1 (LAN 2) */
77 case 5: 79 case 5:
78 return LASATINT_ETH0; /* Ethernet 0 (LAN 1) */ 80 return LASAT_IRQ_ETH0; /* Ethernet 0 (LAN 1) */
79 case 6: 81 case 6:
80 return LASATINT_HDC; /* IDE controller */ 82 return LASAT_IRQ_HDC; /* IDE controller */
81 default: 83 default:
82 return 0xff; /* Illegal */ 84 return 0xff; /* Illegal */
83 } 85 }
diff --git a/arch/mips/pci/pci-vr41xx.c b/arch/mips/pci/pci-vr41xx.c
index 240df9e33813..33c4f683d067 100644
--- a/arch/mips/pci/pci-vr41xx.c
+++ b/arch/mips/pci/pci-vr41xx.c
@@ -154,6 +154,7 @@ static int __init vr41xx_pciu_init(void)
154 pciu_write(PCICLKSELREG, QUARTER_VTCLOCK); 154 pciu_write(PCICLKSELREG, QUARTER_VTCLOCK);
155 else { 155 else {
156 printk(KERN_ERR "PCI Clock is over 33MHz.\n"); 156 printk(KERN_ERR "PCI Clock is over 33MHz.\n");
157 iounmap(pciu_base);
157 return -EINVAL; 158 return -EINVAL;
158 } 159 }
159 160
diff --git a/arch/mips/pmc-sierra/Kconfig b/arch/mips/pmc-sierra/Kconfig
index 6b293ce0935f..90261b83db04 100644
--- a/arch/mips/pmc-sierra/Kconfig
+++ b/arch/mips/pmc-sierra/Kconfig
@@ -5,12 +5,14 @@ choice
5config PMC_MSP4200_EVAL 5config PMC_MSP4200_EVAL
6 bool "PMC-Sierra MSP4200 Eval Board" 6 bool "PMC-Sierra MSP4200 Eval Board"
7 select CEVT_R4K 7 select CEVT_R4K
8 select CSRC_R4K
8 select IRQ_MSP_SLP 9 select IRQ_MSP_SLP
9 select HW_HAS_PCI 10 select HW_HAS_PCI
10 11
11config PMC_MSP4200_GW 12config PMC_MSP4200_GW
12 bool "PMC-Sierra MSP4200 VoIP Gateway" 13 bool "PMC-Sierra MSP4200 VoIP Gateway"
13 select CEVT_R4K 14 select CEVT_R4K
15 select CSRC_R4K
14 select IRQ_MSP_SLP 16 select IRQ_MSP_SLP
15 select HW_HAS_PCI 17 select HW_HAS_PCI
16 18
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/Makefile b/arch/mips/qemu/Makefile
index cec24c117f6e..2ba4ef34b4a7 100644
--- a/arch/mips/qemu/Makefile
+++ b/arch/mips/qemu/Makefile
@@ -4,6 +4,7 @@
4 4
5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o 5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o
6 6
7obj-$(CONFIG_SMP) += q-smp.o 7obj-$(CONFIG_EARLY_PRINTK) += q-console.o
8obj-$(CONFIG_SMP) += q-smp.o
8 9
9EXTRA_CFLAGS += -Werror 10EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/qemu/q-console.c b/arch/mips/qemu/q-console.c
new file mode 100644
index 000000000000..81101ae5017a
--- /dev/null
+++ b/arch/mips/qemu/q-console.c
@@ -0,0 +1,26 @@
1#include <linux/console.h>
2#include <linux/init.h>
3#include <linux/serial_reg.h>
4#include <asm/io.h>
5
6#define PORT(offset) (0x3f8 + (offset))
7
8static inline unsigned int serial_in(int offset)
9{
10 return inb(PORT(offset));
11}
12
13static inline void serial_out(int offset, int value)
14{
15 outb(value, PORT(offset));
16}
17
18int prom_putchar(char c)
19{
20 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
21 ;
22
23 serial_out(UART_TX, c);
24
25 return 1;
26}
diff --git a/arch/mips/qemu/q-firmware.c b/arch/mips/qemu/q-firmware.c
index c2239b417587..3ed43f416cd1 100644
--- a/arch/mips/qemu/q-firmware.c
+++ b/arch/mips/qemu/q-firmware.c
@@ -2,6 +2,9 @@
2#include <linux/string.h> 2#include <linux/string.h>
3#include <asm/addrspace.h> 3#include <asm/addrspace.h>
4#include <asm/bootinfo.h> 4#include <asm/bootinfo.h>
5#include <asm/io.h>
6
7#define QEMU_PORT_BASE 0xb4000000
5 8
6void __init prom_init(void) 9void __init prom_init(void)
7{ 10{
@@ -15,4 +18,7 @@ void __init prom_init(void)
15 } else { 18 } else {
16 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM); 19 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM);
17 } 20 }
21
22
23 set_io_port_base(QEMU_PORT_BASE);
18} 24}
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/qemu/q-setup.c b/arch/mips/qemu/q-setup.c
index 23d34c1917c0..969cedc8d8b9 100644
--- a/arch/mips/qemu/q-setup.c
+++ b/arch/mips/qemu/q-setup.c
@@ -6,8 +6,6 @@
6 6
7extern void qemu_reboot_setup(void); 7extern void qemu_reboot_setup(void);
8 8
9#define QEMU_PORT_BASE 0xb4000000
10
11const char *get_system_type(void) 9const char *get_system_type(void)
12{ 10{
13 return "Qemu"; 11 return "Qemu";
@@ -20,6 +18,5 @@ void __init plat_time_init(void)
20 18
21void __init plat_mem_setup(void) 19void __init plat_mem_setup(void)
22{ 20{
23 set_io_port_base(QEMU_PORT_BASE);
24 qemu_reboot_setup(); 21 qemu_reboot_setup();
25} 22}
diff --git a/arch/mips/sgi-ip22/ip22-eisa.c b/arch/mips/sgi-ip22/ip22-eisa.c
index 26854fb11e7c..1617241d2737 100644
--- a/arch/mips/sgi-ip22/ip22-eisa.c
+++ b/arch/mips/sgi-ip22/ip22-eisa.c
@@ -36,6 +36,7 @@
36#include <asm/sgi/ioc.h> 36#include <asm/sgi/ioc.h>
37#include <asm/sgi/mc.h> 37#include <asm/sgi/mc.h>
38#include <asm/sgi/ip22.h> 38#include <asm/sgi/ip22.h>
39#include <asm/i8259.h>
39 40
40/* I2 has four EISA slots. */ 41/* I2 has four EISA slots. */
41#define IP22_EISA_MAX_SLOTS 4 42#define IP22_EISA_MAX_SLOTS 4
@@ -93,126 +94,11 @@ static irqreturn_t ip22_eisa_intr(int irq, void *dev_id)
93 return IRQ_NONE; 94 return IRQ_NONE;
94} 95}
95 96
96static void enable_eisa1_irq(unsigned int irq)
97{
98 u8 mask;
99
100 mask = inb(EISA_INT1_MASK);
101 mask &= ~((u8) (1 << irq));
102 outb(mask, EISA_INT1_MASK);
103}
104
105static unsigned int startup_eisa1_irq(unsigned int irq)
106{
107 u8 edge;
108
109 /* Only use edge interrupts for EISA */
110
111 edge = inb(EISA_INT1_EDGE_LEVEL);
112 edge &= ~((u8) (1 << irq));
113 outb(edge, EISA_INT1_EDGE_LEVEL);
114
115 enable_eisa1_irq(irq);
116 return 0;
117}
118
119static void disable_eisa1_irq(unsigned int irq)
120{
121 u8 mask;
122
123 mask = inb(EISA_INT1_MASK);
124 mask |= ((u8) (1 << irq));
125 outb(mask, EISA_INT1_MASK);
126}
127
128static void mask_and_ack_eisa1_irq(unsigned int irq)
129{
130 disable_eisa1_irq(irq);
131
132 outb(0x20, EISA_INT1_CTRL);
133}
134
135static void end_eisa1_irq(unsigned int irq)
136{
137 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
138 enable_eisa1_irq(irq);
139}
140
141static struct irq_chip ip22_eisa1_irq_type = {
142 .name = "IP22 EISA",
143 .startup = startup_eisa1_irq,
144 .ack = mask_and_ack_eisa1_irq,
145 .mask = disable_eisa1_irq,
146 .mask_ack = mask_and_ack_eisa1_irq,
147 .unmask = enable_eisa1_irq,
148 .end = end_eisa1_irq,
149};
150
151static void enable_eisa2_irq(unsigned int irq)
152{
153 u8 mask;
154
155 mask = inb(EISA_INT2_MASK);
156 mask &= ~((u8) (1 << (irq - 8)));
157 outb(mask, EISA_INT2_MASK);
158}
159
160static unsigned int startup_eisa2_irq(unsigned int irq)
161{
162 u8 edge;
163
164 /* Only use edge interrupts for EISA */
165
166 edge = inb(EISA_INT2_EDGE_LEVEL);
167 edge &= ~((u8) (1 << (irq - 8)));
168 outb(edge, EISA_INT2_EDGE_LEVEL);
169
170 enable_eisa2_irq(irq);
171 return 0;
172}
173
174static void disable_eisa2_irq(unsigned int irq)
175{
176 u8 mask;
177
178 mask = inb(EISA_INT2_MASK);
179 mask |= ((u8) (1 << (irq - 8)));
180 outb(mask, EISA_INT2_MASK);
181}
182
183static void mask_and_ack_eisa2_irq(unsigned int irq)
184{
185 disable_eisa2_irq(irq);
186
187 outb(0x20, EISA_INT2_CTRL);
188}
189
190static void end_eisa2_irq(unsigned int irq)
191{
192 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
193 enable_eisa2_irq(irq);
194}
195
196static struct irq_chip ip22_eisa2_irq_type = {
197 .name = "IP22 EISA",
198 .startup = startup_eisa2_irq,
199 .ack = mask_and_ack_eisa2_irq,
200 .mask = disable_eisa2_irq,
201 .mask_ack = mask_and_ack_eisa2_irq,
202 .unmask = enable_eisa2_irq,
203 .end = end_eisa2_irq,
204};
205
206static struct irqaction eisa_action = { 97static struct irqaction eisa_action = {
207 .handler = ip22_eisa_intr, 98 .handler = ip22_eisa_intr,
208 .name = "EISA", 99 .name = "EISA",
209}; 100};
210 101
211static struct irqaction cascade_action = {
212 .handler = no_action,
213 .name = "EISA cascade",
214};
215
216int __init ip22_eisa_init(void) 102int __init ip22_eisa_init(void)
217{ 103{
218 int i, c; 104 int i, c;
@@ -248,29 +134,13 @@ int __init ip22_eisa_init(void)
248 outb(1, EISA_EXT_NMI_RESET_CTRL); 134 outb(1, EISA_EXT_NMI_RESET_CTRL);
249 udelay(50); /* Wait long enough for the dust to settle */ 135 udelay(50); /* Wait long enough for the dust to settle */
250 outb(0, EISA_EXT_NMI_RESET_CTRL); 136 outb(0, EISA_EXT_NMI_RESET_CTRL);
251 outb(0x11, EISA_INT1_CTRL);
252 outb(0x11, EISA_INT2_CTRL);
253 outb(0, EISA_INT1_MASK);
254 outb(8, EISA_INT2_MASK);
255 outb(4, EISA_INT1_MASK);
256 outb(2, EISA_INT2_MASK);
257 outb(1, EISA_INT1_MASK);
258 outb(1, EISA_INT2_MASK);
259 outb(0xfb, EISA_INT1_MASK);
260 outb(0xff, EISA_INT2_MASK);
261 outb(0, EISA_DMA2_WRITE_SINGLE); 137 outb(0, EISA_DMA2_WRITE_SINGLE);
262 138
263 for (i = SGINT_EISA; i < (SGINT_EISA + EISA_MAX_IRQ); i++) { 139 init_i8259_irqs();
264 if (i < (SGINT_EISA + 8))
265 set_irq_chip(i, &ip22_eisa1_irq_type);
266 else
267 set_irq_chip(i, &ip22_eisa2_irq_type);
268 }
269 140
270 /* Cannot use request_irq because of kmalloc not being ready at such 141 /* Cannot use request_irq because of kmalloc not being ready at such
271 * an early stage. Yes, I've been bitten... */ 142 * an early stage. Yes, I've been bitten... */
272 setup_irq(SGI_EISA_IRQ, &eisa_action); 143 setup_irq(SGI_EISA_IRQ, &eisa_action);
273 setup_irq(SGINT_EISA + 2, &cascade_action);
274 144
275 EISA_bus = 1; 145 EISA_bus = 1;
276 return 0; 146 return 0;
diff --git a/arch/mips/sgi-ip22/ip22-nvram.c b/arch/mips/sgi-ip22/ip22-nvram.c
index e19d60d5fcc1..0177566475d4 100644
--- a/arch/mips/sgi-ip22/ip22-nvram.c
+++ b/arch/mips/sgi-ip22/ip22-nvram.c
@@ -32,19 +32,19 @@
32 for (x=0; x<100000; x++) __asm__ __volatile__(""); }) 32 for (x=0; x<100000; x++) __asm__ __volatile__(""); })
33 33
34#define eeprom_cs_on(ptr) ({ \ 34#define eeprom_cs_on(ptr) ({ \
35 *ptr &= ~EEPROM_DATO; \ 35 __raw_writel(__raw_readl(ptr) & ~EEPROM_DATO, ptr); \
36 *ptr &= ~EEPROM_ECLK; \ 36 __raw_writel(__raw_readl(ptr) & ~EEPROM_ECLK, ptr); \
37 *ptr &= ~EEPROM_EPROT; \ 37 __raw_writel(__raw_readl(ptr) & ~EEPROM_EPROT, ptr); \
38 delay(); \ 38 delay(); \
39 *ptr |= EEPROM_CSEL; \ 39 __raw_writel(__raw_readl(ptr) | EEPROM_CSEL, ptr); \
40 *ptr |= EEPROM_ECLK; }) 40 __raw_writel(__raw_readl(ptr) | EEPROM_ECLK, ptr); })
41 41
42 42
43#define eeprom_cs_off(ptr) ({ \ 43#define eeprom_cs_off(ptr) ({ \
44 *ptr &= ~EEPROM_ECLK; \ 44 __raw_writel(__raw_readl(ptr) & ~EEPROM_ECLK, ptr); \
45 *ptr &= ~EEPROM_CSEL; \ 45 __raw_writel(__raw_readl(ptr) & ~EEPROM_CSEL, ptr); \
46 *ptr |= EEPROM_EPROT; \ 46 __raw_writel(__raw_readl(ptr) | EEPROM_EPROT, ptr); \
47 *ptr |= EEPROM_ECLK; }) 47 __raw_writel(__raw_readl(ptr) | EEPROM_ECLK, ptr); })
48 48
49#define BITS_IN_COMMAND 11 49#define BITS_IN_COMMAND 11
50/* 50/*
@@ -60,15 +60,17 @@ static inline void eeprom_cmd(unsigned int *ctrl, unsigned cmd, unsigned reg)
60 ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND)); 60 ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND));
61 for (i = 0; i < BITS_IN_COMMAND; i++) { 61 for (i = 0; i < BITS_IN_COMMAND; i++) {
62 if (ser_cmd & (1<<15)) /* if high order bit set */ 62 if (ser_cmd & (1<<15)) /* if high order bit set */
63 writel(readl(ctrl) | EEPROM_DATO, ctrl); 63 __raw_writel(__raw_readl(ctrl) | EEPROM_DATO, ctrl);
64 else 64 else
65 writel(readl(ctrl) & ~EEPROM_DATO, ctrl); 65 __raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
66 writel(readl(ctrl) & ~EEPROM_ECLK, ctrl); 66 __raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
67 writel(readl(ctrl) | EEPROM_ECLK, ctrl); 67 delay();
68 __raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
69 delay();
68 ser_cmd <<= 1; 70 ser_cmd <<= 1;
69 } 71 }
70 /* see data sheet timing diagram */ 72 /* see data sheet timing diagram */
71 writel(readl(ctrl) & ~EEPROM_DATO, ctrl); 73 __raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
72} 74}
73 75
74unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg) 76unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg)
@@ -76,18 +78,18 @@ unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg)
76 unsigned short res = 0; 78 unsigned short res = 0;
77 int i; 79 int i;
78 80
79 writel(readl(ctrl) & ~EEPROM_EPROT, ctrl); 81 __raw_writel(__raw_readl(ctrl) & ~EEPROM_EPROT, ctrl);
80 eeprom_cs_on(ctrl); 82 eeprom_cs_on(ctrl);
81 eeprom_cmd(ctrl, EEPROM_READ, reg); 83 eeprom_cmd(ctrl, EEPROM_READ, reg);
82 84
83 /* clock the data ouf of serial mem */ 85 /* clock the data ouf of serial mem */
84 for (i = 0; i < 16; i++) { 86 for (i = 0; i < 16; i++) {
85 writel(readl(ctrl) & ~EEPROM_ECLK, ctrl); 87 __raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
86 delay(); 88 delay();
87 writel(readl(ctrl) | EEPROM_ECLK, ctrl); 89 __raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
88 delay(); 90 delay();
89 res <<= 1; 91 res <<= 1;
90 if (readl(ctrl) & EEPROM_DATI) 92 if (__raw_readl(ctrl) & EEPROM_DATI)
91 res |= 1; 93 res |= 1;
92 } 94 }
93 95
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..cab7cc22ab67 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/*
@@ -191,18 +209,18 @@ static unsigned long macepci_mask;
191 209
192static void enable_macepci_irq(unsigned int irq) 210static void enable_macepci_irq(unsigned int irq)
193{ 211{
194 macepci_mask |= MACEPCI_CONTROL_INT(irq - 9); 212 macepci_mask |= MACEPCI_CONTROL_INT(irq - MACEPCI_SCSI0_IRQ);
195 mace->pci.control = macepci_mask; 213 mace->pci.control = macepci_mask;
196 crime_mask |= 1 << (irq - 1); 214 crime_mask |= 1 << (irq - CRIME_IRQ_BASE);
197 crime->imask = crime_mask; 215 crime->imask = crime_mask;
198} 216}
199 217
200static void disable_macepci_irq(unsigned int irq) 218static void disable_macepci_irq(unsigned int irq)
201{ 219{
202 crime_mask &= ~(1 << (irq - 1)); 220 crime_mask &= ~(1 << (irq - CRIME_IRQ_BASE));
203 crime->imask = crime_mask; 221 crime->imask = crime_mask;
204 flush_crime_bus(); 222 flush_crime_bus();
205 macepci_mask &= ~MACEPCI_CONTROL_INT(irq - 9); 223 macepci_mask &= ~MACEPCI_CONTROL_INT(irq - MACEPCI_SCSI0_IRQ);
206 mace->pci.control = macepci_mask; 224 mace->pci.control = macepci_mask;
207 flush_mace_bus(); 225 flush_mace_bus();
208} 226}
@@ -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,10 +296,10 @@ 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 - MACEISA_AUDIO_SW_IRQ);
285 mace->perif.ctrl.imask = maceisa_mask; 303 mace->perif.ctrl.imask = maceisa_mask;
286} 304}
287 305
@@ -289,12 +307,12 @@ static void disable_maceisa_irq(unsigned int irq)
289{ 307{
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 - MACEISA_AUDIO_SW_IRQ));
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;
@@ -313,7 +331,7 @@ static void mask_and_ack_maceisa_irq(unsigned int irq)
313 case MACEISA_SERIAL2_TDMAPR_IRQ: 331 case MACEISA_SERIAL2_TDMAPR_IRQ:
314 /* edge triggered */ 332 /* edge triggered */
315 mace_int = mace->perif.ctrl.istat; 333 mace_int = mace->perif.ctrl.istat;
316 mace_int &= ~(1 << (irq - 33)); 334 mace_int &= ~(1 << (irq - MACEISA_AUDIO_SW_IRQ));
317 mace->perif.ctrl.istat = mace_int; 335 mace->perif.ctrl.istat = mace_int;
318 break; 336 break;
319 } 337 }
@@ -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
@@ -341,13 +359,17 @@ static struct irq_chip ip32_maceisa_interrupt = {
341 359
342static void enable_mace_irq(unsigned int irq) 360static void enable_mace_irq(unsigned int irq)
343{ 361{
344 crime_mask |= 1 << (irq - 1); 362 unsigned int bit = irq - CRIME_IRQ_BASE;
363
364 crime_mask |= (1 << bit);
345 crime->imask = crime_mask; 365 crime->imask = crime_mask;
346} 366}
347 367
348static void disable_mace_irq(unsigned int irq) 368static void disable_mace_irq(unsigned int irq)
349{ 369{
350 crime_mask &= ~(1 << (irq - 1)); 370 unsigned int bit = irq - CRIME_IRQ_BASE;
371
372 crime_mask &= ~(1 << bit);
351 crime->imask = crime_mask; 373 crime->imask = crime_mask;
352 flush_crime_bus(); 374 flush_crime_bus();
353} 375}
@@ -411,7 +433,7 @@ static void ip32_irq0(void)
411 irq = __ffs(mace_int & maceisa_mask) + MACEISA_AUDIO_SW_IRQ; 433 irq = __ffs(mace_int & maceisa_mask) + MACEISA_AUDIO_SW_IRQ;
412 } 434 }
413 435
414 DBG("*irq %u*\n", irq); 436 pr_debug("*irq %u*\n", irq);
415 do_IRQ(irq); 437 do_IRQ(irq);
416} 438}
417 439
@@ -471,24 +493,32 @@ void __init arch_init_irq(void)
471 mace->perif.ctrl.imask = 0; 493 mace->perif.ctrl.imask = 0;
472 494
473 mips_cpu_irq_init(); 495 mips_cpu_irq_init();
474 for (irq = MIPS_CPU_IRQ_BASE + 8; irq <= IP32_IRQ_MAX; irq++) { 496 for (irq = CRIME_IRQ_BASE; irq <= IP32_IRQ_MAX; irq++) {
475 struct irq_chip *chip;
476
477 switch (irq) { 497 switch (irq) {
478 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ: 498 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ:
479 chip = &ip32_mace_interrupt; 499 set_irq_chip(irq, &ip32_mace_interrupt);
480 break; 500 break;
481 case MACEPCI_SCSI0_IRQ ... MACEPCI_SHARED2_IRQ: 501 case MACEPCI_SCSI0_IRQ ... MACEPCI_SHARED2_IRQ:
482 chip = &ip32_macepci_interrupt; 502 set_irq_chip(irq, &ip32_macepci_interrupt);
503 break;
504 case CRIME_GBE0_IRQ ... CRIME_GBE3_IRQ:
505 set_irq_chip(irq, &crime_edge_interrupt);
506 break;
507 case CRIME_CPUERR_IRQ:
508 case CRIME_MEMERR_IRQ:
509 set_irq_chip(irq, &crime_level_interrupt);
483 break; 510 break;
484 case CRIME_GBE0_IRQ ... CRIME_VICE_IRQ: 511 case CRIME_RE_EMPTY_E_IRQ ... CRIME_RE_IDLE_E_IRQ:
485 chip = &ip32_crime_interrupt; 512 case CRIME_SOFT0_IRQ ... CRIME_SOFT2_IRQ:
513 set_irq_chip(irq, &crime_edge_interrupt);
514 break;
515 case CRIME_VICE_IRQ:
516 set_irq_chip(irq, &crime_edge_interrupt);
486 break; 517 break;
487 default: 518 default:
488 chip = &ip32_maceisa_interrupt; 519 set_irq_chip(irq, &ip32_maceisa_interrupt);
520 break;
489 } 521 }
490
491 set_irq_chip(irq, chip);
492 } 522 }
493 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq); 523 setup_irq(CRIME_MEMERR_IRQ, &memerr_irq);
494 setup_irq(CRIME_CPUERR_IRQ, &cpuerr_irq); 524 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..db372a0f106d 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
@@ -409,12 +370,11 @@ void __init arch_init_irq(void)
409#endif 370#endif
410 /* Setup uart 1 settings, mapper */ 371 /* Setup uart 1 settings, mapper */
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, IOADDR(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 IOADDR(A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) +
417 (kgdb_irq<<3)); 377 (kgdb_irq << 3)));
418 bcm1480_unmask_irq(0, kgdb_irq); 378 bcm1480_unmask_irq(0, kgdb_irq);
419 379
420#ifdef CONFIG_GDB_CONSOLE 380#ifdef CONFIG_GDB_CONSOLE
@@ -452,18 +412,6 @@ static void bcm1480_kgdb_interrupt(void)
452 412
453extern void bcm1480_mailbox_interrupt(void); 413extern void bcm1480_mailbox_interrupt(void);
454 414
455static inline void dispatch_ip4(void)
456{
457 int cpu = smp_processor_id();
458 int irq = K_BCM1480_INT_TIMER_0 + cpu;
459
460 /* Reset the timer */
461 __raw_writeq(M_SCD_TIMER_ENABLE|M_SCD_TIMER_MODE_CONTINUOUS,
462 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
463
464 do_IRQ(irq);
465}
466
467static inline void dispatch_ip2(void) 415static inline void dispatch_ip2(void)
468{ 416{
469 unsigned long long mask_h, mask_l; 417 unsigned long long mask_h, mask_l;
@@ -491,6 +439,7 @@ static inline void dispatch_ip2(void)
491 439
492asmlinkage void plat_irq_dispatch(void) 440asmlinkage void plat_irq_dispatch(void)
493{ 441{
442 unsigned int cpu = smp_processor_id();
494 unsigned int pending; 443 unsigned int pending;
495 444
496#ifdef CONFIG_SIBYTE_BCM1480_PROF 445#ifdef CONFIG_SIBYTE_BCM1480_PROF
@@ -507,7 +456,7 @@ asmlinkage void plat_irq_dispatch(void)
507#endif 456#endif
508 457
509 if (pending & CAUSEF_IP4) 458 if (pending & CAUSEF_IP4)
510 dispatch_ip4(); 459 do_IRQ(K_BCM1480_INT_TIMER_0 + cpu);
511#ifdef CONFIG_SMP 460#ifdef CONFIG_SMP
512 else if (pending & CAUSEF_IP3) 461 else if (pending & CAUSEF_IP3)
513 bcm1480_mailbox_interrupt(); 462 bcm1480_mailbox_interrupt();
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/pcimt.c b/arch/mips/sni/pcimt.c
index 4df070f2ff5d..834650f371e0 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -244,7 +244,7 @@ static void pcimt_hwint1(void)
244 if (pend & IT_EISA) { 244 if (pend & IT_EISA) {
245 int irq; 245 int irq;
246 /* 246 /*
247 * Note: ASIC PCI's builtin interrupt achknowledge feature is 247 * Note: ASIC PCI's builtin interrupt acknowledge feature is
248 * broken. Using it may result in loss of some or all i8259 248 * broken. Using it may result in loss of some or all i8259
249 * interrupts, so don't use PCIMT_INT_ACKNOWLEDGE ... 249 * interrupts, so don't use PCIMT_INT_ACKNOWLEDGE ...
250 */ 250 */
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/mips/vr41xx/Kconfig b/arch/mips/vr41xx/Kconfig
index eeb089f20c0d..559acc09c819 100644
--- a/arch/mips/vr41xx/Kconfig
+++ b/arch/mips/vr41xx/Kconfig
@@ -6,6 +6,7 @@ choice
6config CASIO_E55 6config CASIO_E55
7 bool "CASIO CASSIOPEIA E-10/15/55/65" 7 bool "CASIO CASSIOPEIA E-10/15/55/65"
8 select CEVT_R4K 8 select CEVT_R4K
9 select CSRC_R4K
9 select DMA_NONCOHERENT 10 select DMA_NONCOHERENT
10 select IRQ_CPU 11 select IRQ_CPU
11 select ISA 12 select ISA
@@ -15,6 +16,7 @@ config CASIO_E55
15config IBM_WORKPAD 16config IBM_WORKPAD
16 bool "IBM WorkPad z50" 17 bool "IBM WorkPad z50"
17 select CEVT_R4K 18 select CEVT_R4K
19 select CSRC_R4K
18 select DMA_NONCOHERENT 20 select DMA_NONCOHERENT
19 select IRQ_CPU 21 select IRQ_CPU
20 select ISA 22 select ISA
@@ -24,6 +26,7 @@ config IBM_WORKPAD
24config NEC_CMBVR4133 26config NEC_CMBVR4133
25 bool "NEC CMB-VR4133" 27 bool "NEC CMB-VR4133"
26 select CEVT_R4K 28 select CEVT_R4K
29 select CSRC_R4K
27 select DMA_NONCOHERENT 30 select DMA_NONCOHERENT
28 select IRQ_CPU 31 select IRQ_CPU
29 select HW_HAS_PCI 32 select HW_HAS_PCI
@@ -33,6 +36,7 @@ config NEC_CMBVR4133
33config TANBAC_TB022X 36config TANBAC_TB022X
34 bool "TANBAC VR4131 multichip module and TANBAC VR4131DIMM" 37 bool "TANBAC VR4131 multichip module and TANBAC VR4131DIMM"
35 select CEVT_R4K 38 select CEVT_R4K
39 select CSRC_R4K
36 select DMA_NONCOHERENT 40 select DMA_NONCOHERENT
37 select IRQ_CPU 41 select IRQ_CPU
38 select HW_HAS_PCI 42 select HW_HAS_PCI
@@ -48,6 +52,7 @@ config TANBAC_TB022X
48config VICTOR_MPC30X 52config VICTOR_MPC30X
49 bool "Victor MP-C303/304" 53 bool "Victor MP-C303/304"
50 select CEVT_R4K 54 select CEVT_R4K
55 select CSRC_R4K
51 select DMA_NONCOHERENT 56 select DMA_NONCOHERENT
52 select IRQ_CPU 57 select IRQ_CPU
53 select HW_HAS_PCI 58 select HW_HAS_PCI
@@ -58,6 +63,7 @@ config VICTOR_MPC30X
58config ZAO_CAPCELLA 63config ZAO_CAPCELLA
59 bool "ZAO Networks Capcella" 64 bool "ZAO Networks Capcella"
60 select CEVT_R4K 65 select CEVT_R4K
66 select CSRC_R4K
61 select DMA_NONCOHERENT 67 select DMA_NONCOHERENT
62 select IRQ_CPU 68 select IRQ_CPU
63 select HW_HAS_PCI 69 select HW_HAS_PCI
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index 1899601e5862..3f23d9fda662 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -525,6 +525,7 @@ static inline int set_sysint1_assign(unsigned int irq, unsigned char assign)
525 intassign1 |= (uint16_t)assign << 9; 525 intassign1 |= (uint16_t)assign << 9;
526 break; 526 break;
527 default: 527 default:
528 spin_unlock_irq(&desc->lock);
528 return -EINVAL; 529 return -EINVAL;
529 } 530 }
530 531
@@ -592,6 +593,7 @@ static inline int set_sysint2_assign(unsigned int irq, unsigned char assign)
592 intassign3 |= (uint16_t)assign << 12; 593 intassign3 |= (uint16_t)assign << 12;
593 break; 594 break;
594 default: 595 default:
596 spin_unlock_irq(&desc->lock);
595 return -EINVAL; 597 return -EINVAL;
596 } 598 }
597 599
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 4e165342210a..bd87626c1f60 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -107,6 +107,9 @@ endif
107# No AltiVec instruction when building kernel 107# No AltiVec instruction when building kernel
108KBUILD_CFLAGS += $(call cc-option,-mno-altivec) 108KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
109 109
110# No SPE instruction when building kernel
111KBUILD_CFLAGS += $(call cc-option,-mno-spe)
112
110# Enable unit-at-a-time mode when possible. It shrinks the 113# Enable unit-at-a-time mode when possible. It shrinks the
111# kernel considerably. 114# kernel considerably.
112KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) 115KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index fcd333c391ec..c64f3037a13b 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -57,12 +57,19 @@
57 }; 57 };
58 58
59 i2c@3000 { 59 i2c@3000 {
60 #address-cells = <1>;
61 #size-cells = <0>;
60 device_type = "i2c"; 62 device_type = "i2c";
61 compatible = "fsl-i2c"; 63 compatible = "fsl-i2c";
62 reg = <3000 100>; 64 reg = <3000 100>;
63 interrupts = <e 8>; 65 interrupts = <e 8>;
64 interrupt-parent = < &ipic >; 66 interrupt-parent = < &ipic >;
65 dfsrr; 67 dfsrr;
68
69 rtc@68 {
70 compatible = "dallas,ds1374";
71 reg = <68>;
72 };
66 }; 73 };
67 74
68 serial@4500 { 75 serial@4500 {
@@ -104,7 +111,7 @@
104 reg = <700 100>; 111 reg = <700 100>;
105 device_type = "ipic"; 112 device_type = "ipic";
106 }; 113 };
107 114
108 par_io@1400 { 115 par_io@1400 {
109 reg = <1400 100>; 116 reg = <1400 100>;
110 device_type = "par_io"; 117 device_type = "par_io";
@@ -117,7 +124,6 @@
117 3 5 1 0 2 0 /* MDC */ 124 3 5 1 0 2 0 /* MDC */
118 0 d 2 0 1 0 /* RX_CLK (CLK9) */ 125 0 d 2 0 1 0 /* RX_CLK (CLK9) */
119 3 18 2 0 1 0 /* TX_CLK (CLK10) */ 126 3 18 2 0 1 0 /* TX_CLK (CLK10) */
120 1 1 1 0 1 0 /* TxD1 */
121 1 0 1 0 1 0 /* TxD0 */ 127 1 0 1 0 1 0 /* TxD0 */
122 1 1 1 0 1 0 /* TxD1 */ 128 1 1 1 0 1 0 /* TxD1 */
123 1 2 1 0 1 0 /* TxD2 */ 129 1 2 1 0 1 0 /* TxD2 */
@@ -165,11 +171,11 @@
165 reg = <e0100000 480>; 171 reg = <e0100000 480>;
166 brg-frequency = <0>; 172 brg-frequency = <0>;
167 bus-frequency = <BCD3D80>; 173 bus-frequency = <BCD3D80>;
168 174
169 muram@10000 { 175 muram@10000 {
170 device_type = "muram"; 176 device_type = "muram";
171 ranges = <0 00010000 00004000>; 177 ranges = <0 00010000 00004000>;
172 178
173 data-only@0 { 179 data-only@0 {
174 reg = <0 4000>; 180 reg = <0 4000>;
175 }; 181 };
@@ -228,7 +234,7 @@
228 compatible = "ucc_geth"; 234 compatible = "ucc_geth";
229 model = "UCC"; 235 model = "UCC";
230 device-id = <4>; 236 device-id = <4>;
231 reg = <3000 200>; 237 reg = <3200 200>;
232 interrupts = <23>; 238 interrupts = <23>;
233 interrupt-parent = < &qeic >; 239 interrupt-parent = < &qeic >;
234 /* 240 /*
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index e5a84ef9f4b0..49363f89cb71 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -57,15 +57,24 @@
57 }; 57 };
58 58
59 i2c@3000 { 59 i2c@3000 {
60 #address-cells = <1>;
61 #size-cells = <0>;
60 device_type = "i2c"; 62 device_type = "i2c";
61 compatible = "fsl-i2c"; 63 compatible = "fsl-i2c";
62 reg = <3000 100>; 64 reg = <3000 100>;
63 interrupts = <e 8>; 65 interrupts = <e 8>;
64 interrupt-parent = < &ipic >; 66 interrupt-parent = < &ipic >;
65 dfsrr; 67 dfsrr;
68
69 rtc@68 {
70 compatible = "dallas,ds1374";
71 reg = <68>;
72 };
66 }; 73 };
67 74
68 i2c@3100 { 75 i2c@3100 {
76 #address-cells = <1>;
77 #size-cells = <0>;
69 device_type = "i2c"; 78 device_type = "i2c";
70 compatible = "fsl-i2c"; 79 compatible = "fsl-i2c";
71 reg = <3100 100>; 80 reg = <3100 100>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index fbd1573c348b..0b2d2b588daa 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -62,15 +62,24 @@
62 }; 62 };
63 63
64 i2c@3000 { 64 i2c@3000 {
65 #address-cells = <1>;
66 #size-cells = <0>;
65 device_type = "i2c"; 67 device_type = "i2c";
66 compatible = "fsl-i2c"; 68 compatible = "fsl-i2c";
67 reg = <3000 100>; 69 reg = <3000 100>;
68 interrupts = <e 8>; 70 interrupts = <e 8>;
69 interrupt-parent = < &ipic >; 71 interrupt-parent = < &ipic >;
70 dfsrr; 72 dfsrr;
73
74 rtc@68 {
75 compatible = "dallas,ds1374";
76 reg = <68>;
77 };
71 }; 78 };
72 79
73 i2c@3100 { 80 i2c@3100 {
81 #address-cells = <1>;
82 #size-cells = <0>;
74 device_type = "i2c"; 83 device_type = "i2c";
75 compatible = "fsl-i2c"; 84 compatible = "fsl-i2c";
76 reg = <3100 100>; 85 reg = <3100 100>;
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index 3f9d15cf13e0..6c608de1fc1b 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -272,24 +272,24 @@
272 clock-frequency = <1fca055>; 272 clock-frequency = <1fca055>;
273 interrupt-parent = <&mpic>; 273 interrupt-parent = <&mpic>;
274 interrupts = <1b 2>; 274 interrupts = <1b 2>;
275 interrupt-map-mask = <fb00 0 0 0>; 275 interrupt-map-mask = <ff00 0 0 1>;
276 interrupt-map = < 276 interrupt-map = <
277 // IDSEL 0x1c USB 277 // IDSEL 0x1c USB
278 e000 0 0 0 &i8259 c 2 278 e000 0 0 1 &i8259 c 2
279 e100 0 0 0 &i8259 9 2 279 e100 0 0 1 &i8259 9 2
280 e200 0 0 0 &i8259 a 2 280 e200 0 0 1 &i8259 a 2
281 e300 0 0 0 &i8259 b 2 281 e300 0 0 1 &i8259 b 2
282 282
283 // IDSEL 0x1d Audio 283 // IDSEL 0x1d Audio
284 e800 0 0 0 &i8259 6 2 284 e800 0 0 1 &i8259 6 2
285 285
286 // IDSEL 0x1e Legacy 286 // IDSEL 0x1e Legacy
287 f000 0 0 0 &i8259 7 2 287 f000 0 0 1 &i8259 7 2
288 f100 0 0 0 &i8259 7 2 288 f100 0 0 1 &i8259 7 2
289 289
290 // IDSEL 0x1f IDE/SATA 290 // IDSEL 0x1f IDE/SATA
291 f800 0 0 0 &i8259 e 2 291 f800 0 0 1 &i8259 e 2
292 f900 0 0 0 &i8259 5 2 292 f900 0 0 1 &i8259 5 2
293 >; 293 >;
294 294
295 pcie@0 { 295 pcie@0 {
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dts b/arch/powerpc/boot/dts/mpc8572ds.dts
index d638deec7652..0eb44fb9647d 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds.dts
@@ -219,36 +219,120 @@
219 clock-frequency = <1fca055>; 219 clock-frequency = <1fca055>;
220 interrupt-parent = <&mpic>; 220 interrupt-parent = <&mpic>;
221 interrupts = <18 2>; 221 interrupts = <18 2>;
222 interrupt-map-mask = <fb00 0 0 0>; 222 interrupt-map-mask = <ff00 0 0 7>;
223 interrupt-map = < 223 interrupt-map = <
224 /* IDSEL 0x11 - PCI slot 1 */ 224 /* IDSEL 0x11 func 0 - PCI slot 1 */
225 8800 0 0 1 &mpic 2 1 225 8800 0 0 1 &mpic 2 1
226 8800 0 0 2 &mpic 3 1 226 8800 0 0 2 &mpic 3 1
227 8800 0 0 3 &mpic 4 1 227 8800 0 0 3 &mpic 4 1
228 8800 0 0 4 &mpic 1 1 228 8800 0 0 4 &mpic 1 1
229 229
230 /* IDSEL 0x12 - PCI slot 2 */ 230 /* IDSEL 0x11 func 1 - PCI slot 1 */
231 8900 0 0 1 &mpic 2 1
232 8900 0 0 2 &mpic 3 1
233 8900 0 0 3 &mpic 4 1
234 8900 0 0 4 &mpic 1 1
235
236 /* IDSEL 0x11 func 2 - PCI slot 1 */
237 8a00 0 0 1 &mpic 2 1
238 8a00 0 0 2 &mpic 3 1
239 8a00 0 0 3 &mpic 4 1
240 8a00 0 0 4 &mpic 1 1
241
242 /* IDSEL 0x11 func 3 - PCI slot 1 */
243 8b00 0 0 1 &mpic 2 1
244 8b00 0 0 2 &mpic 3 1
245 8b00 0 0 3 &mpic 4 1
246 8b00 0 0 4 &mpic 1 1
247
248 /* IDSEL 0x11 func 4 - PCI slot 1 */
249 8c00 0 0 1 &mpic 2 1
250 8c00 0 0 2 &mpic 3 1
251 8c00 0 0 3 &mpic 4 1
252 8c00 0 0 4 &mpic 1 1
253
254 /* IDSEL 0x11 func 5 - PCI slot 1 */
255 8d00 0 0 1 &mpic 2 1
256 8d00 0 0 2 &mpic 3 1
257 8d00 0 0 3 &mpic 4 1
258 8d00 0 0 4 &mpic 1 1
259
260 /* IDSEL 0x11 func 6 - PCI slot 1 */
261 8e00 0 0 1 &mpic 2 1
262 8e00 0 0 2 &mpic 3 1
263 8e00 0 0 3 &mpic 4 1
264 8e00 0 0 4 &mpic 1 1
265
266 /* IDSEL 0x11 func 7 - PCI slot 1 */
267 8f00 0 0 1 &mpic 2 1
268 8f00 0 0 2 &mpic 3 1
269 8f00 0 0 3 &mpic 4 1
270 8f00 0 0 4 &mpic 1 1
271
272 /* IDSEL 0x12 func 0 - PCI slot 2 */
231 9000 0 0 1 &mpic 3 1 273 9000 0 0 1 &mpic 3 1
232 9000 0 0 2 &mpic 4 1 274 9000 0 0 2 &mpic 4 1
233 9000 0 0 3 &mpic 1 1 275 9000 0 0 3 &mpic 1 1
234 9000 0 0 4 &mpic 2 1 276 9000 0 0 4 &mpic 2 1
235 277
278 /* IDSEL 0x12 func 1 - PCI slot 2 */
279 9100 0 0 1 &mpic 3 1
280 9100 0 0 2 &mpic 4 1
281 9100 0 0 3 &mpic 1 1
282 9100 0 0 4 &mpic 2 1
283
284 /* IDSEL 0x12 func 2 - PCI slot 2 */
285 9200 0 0 1 &mpic 3 1
286 9200 0 0 2 &mpic 4 1
287 9200 0 0 3 &mpic 1 1
288 9200 0 0 4 &mpic 2 1
289
290 /* IDSEL 0x12 func 3 - PCI slot 2 */
291 9300 0 0 1 &mpic 3 1
292 9300 0 0 2 &mpic 4 1
293 9300 0 0 3 &mpic 1 1
294 9300 0 0 4 &mpic 2 1
295
296 /* IDSEL 0x12 func 4 - PCI slot 2 */
297 9400 0 0 1 &mpic 3 1
298 9400 0 0 2 &mpic 4 1
299 9400 0 0 3 &mpic 1 1
300 9400 0 0 4 &mpic 2 1
301
302 /* IDSEL 0x12 func 5 - PCI slot 2 */
303 9500 0 0 1 &mpic 3 1
304 9500 0 0 2 &mpic 4 1
305 9500 0 0 3 &mpic 1 1
306 9500 0 0 4 &mpic 2 1
307
308 /* IDSEL 0x12 func 6 - PCI slot 2 */
309 9600 0 0 1 &mpic 3 1
310 9600 0 0 2 &mpic 4 1
311 9600 0 0 3 &mpic 1 1
312 9600 0 0 4 &mpic 2 1
313
314 /* IDSEL 0x12 func 7 - PCI slot 2 */
315 9700 0 0 1 &mpic 3 1
316 9700 0 0 2 &mpic 4 1
317 9700 0 0 3 &mpic 1 1
318 9700 0 0 4 &mpic 2 1
319
236 // IDSEL 0x1c USB 320 // IDSEL 0x1c USB
237 e000 0 0 0 &i8259 c 2 321 e000 0 0 1 &i8259 c 2
238 e100 0 0 0 &i8259 9 2 322 e100 0 0 1 &i8259 9 2
239 e200 0 0 0 &i8259 a 2 323 e200 0 0 1 &i8259 a 2
240 e300 0 0 0 &i8259 b 2 324 e300 0 0 1 &i8259 b 2
241 325
242 // IDSEL 0x1d Audio 326 // IDSEL 0x1d Audio
243 e800 0 0 0 &i8259 6 2 327 e800 0 0 1 &i8259 6 2
244 328
245 // IDSEL 0x1e Legacy 329 // IDSEL 0x1e Legacy
246 f000 0 0 0 &i8259 7 2 330 f000 0 0 1 &i8259 7 2
247 f100 0 0 0 &i8259 7 2 331 f100 0 0 1 &i8259 7 2
248 332
249 // IDSEL 0x1f IDE/SATA 333 // IDSEL 0x1f IDE/SATA
250 f800 0 0 0 &i8259 e 2 334 f800 0 0 1 &i8259 e 2
251 f900 0 0 0 &i8259 5 2 335 f900 0 0 1 &i8259 5 2
252 336
253 >; 337 >;
254 338
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
index 367765937a06..abb26dc42558 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -235,36 +235,120 @@
235 clock-frequency = <1fca055>; 235 clock-frequency = <1fca055>;
236 interrupt-parent = <&mpic>; 236 interrupt-parent = <&mpic>;
237 interrupts = <18 2>; 237 interrupts = <18 2>;
238 interrupt-map-mask = <fb00 0 0 0>; 238 interrupt-map-mask = <ff00 0 0 7>;
239 interrupt-map = < 239 interrupt-map = <
240 /* IDSEL 0x11 */ 240 /* IDSEL 0x11 func 0 - PCI slot 1 */
241 8800 0 0 1 &i8259 9 2 241 8800 0 0 1 &mpic 2 1
242 8800 0 0 2 &i8259 a 2 242 8800 0 0 2 &mpic 3 1
243 8800 0 0 3 &i8259 b 2 243 8800 0 0 3 &mpic 4 1
244 8800 0 0 4 &i8259 c 2 244 8800 0 0 4 &mpic 1 1
245 245
246 /* IDSEL 0x12 */ 246 /* IDSEL 0x11 func 1 - PCI slot 1 */
247 9000 0 0 1 &i8259 a 2 247 8900 0 0 1 &mpic 2 1
248 9000 0 0 2 &i8259 b 2 248 8900 0 0 2 &mpic 3 1
249 9000 0 0 3 &i8259 c 2 249 8900 0 0 3 &mpic 4 1
250 9000 0 0 4 &i8259 9 2 250 8900 0 0 4 &mpic 1 1
251
252 /* IDSEL 0x11 func 2 - PCI slot 1 */
253 8a00 0 0 1 &mpic 2 1
254 8a00 0 0 2 &mpic 3 1
255 8a00 0 0 3 &mpic 4 1
256 8a00 0 0 4 &mpic 1 1
257
258 /* IDSEL 0x11 func 3 - PCI slot 1 */
259 8b00 0 0 1 &mpic 2 1
260 8b00 0 0 2 &mpic 3 1
261 8b00 0 0 3 &mpic 4 1
262 8b00 0 0 4 &mpic 1 1
263
264 /* IDSEL 0x11 func 4 - PCI slot 1 */
265 8c00 0 0 1 &mpic 2 1
266 8c00 0 0 2 &mpic 3 1
267 8c00 0 0 3 &mpic 4 1
268 8c00 0 0 4 &mpic 1 1
269
270 /* IDSEL 0x11 func 5 - PCI slot 1 */
271 8d00 0 0 1 &mpic 2 1
272 8d00 0 0 2 &mpic 3 1
273 8d00 0 0 3 &mpic 4 1
274 8d00 0 0 4 &mpic 1 1
275
276 /* IDSEL 0x11 func 6 - PCI slot 1 */
277 8e00 0 0 1 &mpic 2 1
278 8e00 0 0 2 &mpic 3 1
279 8e00 0 0 3 &mpic 4 1
280 8e00 0 0 4 &mpic 1 1
281
282 /* IDSEL 0x11 func 7 - PCI slot 1 */
283 8f00 0 0 1 &mpic 2 1
284 8f00 0 0 2 &mpic 3 1
285 8f00 0 0 3 &mpic 4 1
286 8f00 0 0 4 &mpic 1 1
287
288 /* IDSEL 0x12 func 0 - PCI slot 2 */
289 9000 0 0 1 &mpic 3 1
290 9000 0 0 2 &mpic 4 1
291 9000 0 0 3 &mpic 1 1
292 9000 0 0 4 &mpic 2 1
293
294 /* IDSEL 0x12 func 1 - PCI slot 2 */
295 9100 0 0 1 &mpic 3 1
296 9100 0 0 2 &mpic 4 1
297 9100 0 0 3 &mpic 1 1
298 9100 0 0 4 &mpic 2 1
299
300 /* IDSEL 0x12 func 2 - PCI slot 2 */
301 9200 0 0 1 &mpic 3 1
302 9200 0 0 2 &mpic 4 1
303 9200 0 0 3 &mpic 1 1
304 9200 0 0 4 &mpic 2 1
305
306 /* IDSEL 0x12 func 3 - PCI slot 2 */
307 9300 0 0 1 &mpic 3 1
308 9300 0 0 2 &mpic 4 1
309 9300 0 0 3 &mpic 1 1
310 9300 0 0 4 &mpic 2 1
311
312 /* IDSEL 0x12 func 4 - PCI slot 2 */
313 9400 0 0 1 &mpic 3 1
314 9400 0 0 2 &mpic 4 1
315 9400 0 0 3 &mpic 1 1
316 9400 0 0 4 &mpic 2 1
317
318 /* IDSEL 0x12 func 5 - PCI slot 2 */
319 9500 0 0 1 &mpic 3 1
320 9500 0 0 2 &mpic 4 1
321 9500 0 0 3 &mpic 1 1
322 9500 0 0 4 &mpic 2 1
323
324 /* IDSEL 0x12 func 6 - PCI slot 2 */
325 9600 0 0 1 &mpic 3 1
326 9600 0 0 2 &mpic 4 1
327 9600 0 0 3 &mpic 1 1
328 9600 0 0 4 &mpic 2 1
329
330 /* IDSEL 0x12 func 7 - PCI slot 2 */
331 9700 0 0 1 &mpic 3 1
332 9700 0 0 2 &mpic 4 1
333 9700 0 0 3 &mpic 1 1
334 9700 0 0 4 &mpic 2 1
251 335
252 // IDSEL 0x1c USB 336 // IDSEL 0x1c USB
253 e000 0 0 0 &i8259 c 2 337 e000 0 0 1 &i8259 c 2
254 e100 0 0 0 &i8259 9 2 338 e100 0 0 1 &i8259 9 2
255 e200 0 0 0 &i8259 a 2 339 e200 0 0 1 &i8259 a 2
256 e300 0 0 0 &i8259 b 2 340 e300 0 0 1 &i8259 b 2
257 341
258 // IDSEL 0x1d Audio 342 // IDSEL 0x1d Audio
259 e800 0 0 0 &i8259 6 2 343 e800 0 0 1 &i8259 6 2
260 344
261 // IDSEL 0x1e Legacy 345 // IDSEL 0x1e Legacy
262 f000 0 0 0 &i8259 7 2 346 f000 0 0 1 &i8259 7 2
263 f100 0 0 0 &i8259 7 2 347 f100 0 0 1 &i8259 7 2
264 348
265 // IDSEL 0x1f IDE/SATA 349 // IDSEL 0x1f IDE/SATA
266 f800 0 0 0 &i8259 e 2 350 f800 0 0 1 &i8259 e 2
267 f900 0 0 0 &i8259 5 2 351 f900 0 0 1 &i8259 5 2
268 >; 352 >;
269 353
270 pcie@0 { 354 pcie@0 {
diff --git a/arch/powerpc/boot/dts/walnut.dts b/arch/powerpc/boot/dts/walnut.dts
index fa681f5343fe..754fa3960f83 100644
--- a/arch/powerpc/boot/dts/walnut.dts
+++ b/arch/powerpc/boot/dts/walnut.dts
@@ -122,7 +122,9 @@
122 device_type = "network"; 122 device_type = "network";
123 compatible = "ibm,emac-405gp", "ibm,emac"; 123 compatible = "ibm,emac-405gp", "ibm,emac";
124 interrupt-parent = <&UIC0>; 124 interrupt-parent = <&UIC0>;
125 interrupts = <9 4 f 4>; 125 interrupts = <
126 f 4 /* Ethernet */
127 9 4 /* Ethernet Wake Up */>;
126 local-mac-address = [000000000000]; /* Filled in by zImage */ 128 local-mac-address = [000000000000]; /* Filled in by zImage */
127 reg = <ef600800 70>; 129 reg = <ef600800 70>;
128 mal-device = <&MAL>; 130 mal-device = <&MAL>;
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 39b27e5ef6c1..31147a037728 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -21,6 +21,14 @@
21# (default ./arch/powerpc/boot) 21# (default ./arch/powerpc/boot)
22# -W dir specify working directory for temporary files (default .) 22# -W dir specify working directory for temporary files (default .)
23 23
24# Stop execution if any command fails
25set -e
26
27# Allow for verbose output
28if [ "$V" = 1 ]; then
29 set -x
30fi
31
24# defaults 32# defaults
25kernel= 33kernel=
26ofile=zImage 34ofile=zImage
@@ -111,7 +119,7 @@ if [ -n "$dts" ]; then
111 if [ -z "$dtb" ]; then 119 if [ -z "$dtb" ]; then
112 dtb="$platform.dtb" 120 dtb="$platform.dtb"
113 fi 121 fi
114 dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1 122 dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts"
115fi 123fi
116 124
117if [ -z "$kernel" ]; then 125if [ -z "$kernel" ]; then
@@ -149,7 +157,6 @@ cuboot*)
149ps3) 157ps3)
150 platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o" 158 platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o"
151 lds=$object/zImage.ps3.lds 159 lds=$object/zImage.ps3.lds
152 binary=y
153 gzip= 160 gzip=
154 ext=bin 161 ext=bin
155 objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data" 162 objflags="-O binary --set-section-flags=.bss=contents,alloc,load,data"
@@ -233,7 +240,7 @@ entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | cut -d' ' -f3`
233 240
234if [ -n "$binary" ]; then 241if [ -n "$binary" ]; then
235 mv "$ofile" "$ofile".elf 242 mv "$ofile" "$ofile".elf
236 ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin 243 ${CROSS}objcopy -O binary "$ofile".elf "$ofile"
237fi 244fi
238 245
239# post-processing needed for some platforms 246# post-processing needed for some platforms
@@ -246,9 +253,9 @@ coff)
246 $object/hack-coff "$ofile" 253 $object/hack-coff "$ofile"
247 ;; 254 ;;
248cuboot*) 255cuboot*)
249 gzip -f -9 "$ofile".bin 256 gzip -f -9 "$ofile"
250 mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \ 257 mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
251 $uboot_version -d "$ofile".bin.gz "$ofile" 258 $uboot_version -d "$ofile".gz "$ofile"
252 ;; 259 ;;
253treeboot*) 260treeboot*)
254 mv "$ofile" "$ofile.elf" 261 mv "$ofile" "$ofile.elf"
@@ -269,11 +276,11 @@ ps3)
269 # then copied to offset 0x100. At runtime the bootwrapper program 276 # then copied to offset 0x100. At runtime the bootwrapper program
270 # copies the 0x100 bytes at __system_reset_kernel to addr 0x100. 277 # copies the 0x100 bytes at __system_reset_kernel to addr 0x100.
271 278
272 system_reset_overlay=0x`${CROSS}nm "$ofile".elf \ 279 system_reset_overlay=0x`${CROSS}nm "$ofile" \
273 | grep ' __system_reset_overlay$' \ 280 | grep ' __system_reset_overlay$' \
274 | cut -d' ' -f1` 281 | cut -d' ' -f1`
275 system_reset_overlay=`printf "%d" $system_reset_overlay` 282 system_reset_overlay=`printf "%d" $system_reset_overlay`
276 system_reset_kernel=0x`${CROSS}nm "$ofile".elf \ 283 system_reset_kernel=0x`${CROSS}nm "$ofile" \
277 | grep ' __system_reset_kernel$' \ 284 | grep ' __system_reset_kernel$' \
278 | cut -d' ' -f1` 285 | cut -d' ' -f1`
279 system_reset_kernel=`printf "%d" $system_reset_kernel` 286 system_reset_kernel=`printf "%d" $system_reset_kernel`
@@ -282,23 +289,15 @@ ps3)
282 289
283 rm -f "$object/otheros.bld" 290 rm -f "$object/otheros.bld"
284 291
285 msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \ 292 ${CROSS}objcopy -O binary "$ofile" "$ofile.bin"
286 skip=$overlay_dest seek=$system_reset_kernel \
287 count=$overlay_size bs=1 2>&1)
288 293
289 if [ $? -ne "0" ]; then 294 dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \
290 echo $msg 295 skip=$overlay_dest seek=$system_reset_kernel \
291 exit 1 296 count=$overlay_size bs=1
292 fi
293
294 msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \
295 skip=$system_reset_overlay seek=$overlay_dest \
296 count=$overlay_size bs=1 2>&1)
297 297
298 if [ $? -ne "0" ]; then 298 dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \
299 echo $msg 299 skip=$system_reset_overlay seek=$overlay_dest \
300 exit 2 300 count=$overlay_size bs=1
301 fi
302 301
303 gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld" 302 gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld"
304 ;; 303 ;;
diff --git a/arch/powerpc/configs/mpc832x_mds_defconfig b/arch/powerpc/configs/mpc832x_mds_defconfig
index dd68d1818d6b..e069018276ca 100644
--- a/arch/powerpc/configs/mpc832x_mds_defconfig
+++ b/arch/powerpc/configs/mpc832x_mds_defconfig
@@ -774,7 +774,53 @@ CONFIG_USB_ARCH_HAS_EHCI=y
774# CONFIG_NEW_LEDS is not set 774# CONFIG_NEW_LEDS is not set
775# CONFIG_INFINIBAND is not set 775# CONFIG_INFINIBAND is not set
776# CONFIG_EDAC is not set 776# CONFIG_EDAC is not set
777# CONFIG_RTC_CLASS is not set 777CONFIG_RTC_LIB=y
778CONFIG_RTC_CLASS=y
779CONFIG_RTC_HCTOSYS=y
780CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
781# CONFIG_RTC_DEBUG is not set
782
783#
784# RTC interfaces
785#
786CONFIG_RTC_INTF_SYSFS=y
787CONFIG_RTC_INTF_PROC=y
788CONFIG_RTC_INTF_DEV=y
789# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
790# CONFIG_RTC_DRV_TEST is not set
791
792#
793# I2C RTC drivers
794#
795# CONFIG_RTC_DRV_DS1307 is not set
796CONFIG_RTC_DRV_DS1374=y
797# CONFIG_RTC_DRV_DS1672 is not set
798# CONFIG_RTC_DRV_MAX6900 is not set
799# CONFIG_RTC_DRV_RS5C372 is not set
800# CONFIG_RTC_DRV_ISL1208 is not set
801# CONFIG_RTC_DRV_X1205 is not set
802# CONFIG_RTC_DRV_PCF8563 is not set
803# CONFIG_RTC_DRV_PCF8583 is not set
804# CONFIG_RTC_DRV_M41T80 is not set
805
806#
807# SPI RTC drivers
808#
809
810#
811# Platform RTC drivers
812#
813# CONFIG_RTC_DRV_CMOS is not set
814# CONFIG_RTC_DRV_DS1553 is not set
815# CONFIG_RTC_DRV_STK17TA8 is not set
816# CONFIG_RTC_DRV_DS1742 is not set
817# CONFIG_RTC_DRV_M48T86 is not set
818# CONFIG_RTC_DRV_M48T59 is not set
819# CONFIG_RTC_DRV_V3020 is not set
820
821#
822# on-CPU RTC drivers
823#
778 824
779# 825#
780# DMA Engine support 826# DMA Engine support
diff --git a/arch/powerpc/configs/mpc832x_rdb_defconfig b/arch/powerpc/configs/mpc832x_rdb_defconfig
index 4f391028c79c..7a5b13f4140f 100644
--- a/arch/powerpc/configs/mpc832x_rdb_defconfig
+++ b/arch/powerpc/configs/mpc832x_rdb_defconfig
@@ -685,8 +685,21 @@ CONFIG_I2C_MPC=y
685# 685#
686# SPI support 686# SPI support
687# 687#
688# CONFIG_SPI is not set 688CONFIG_SPI=y
689# CONFIG_SPI_MASTER is not set 689CONFIG_SPI_MASTER=y
690
691#
692# SPI Master Controller Drivers
693#
694CONFIG_SPI_BITBANG=y
695CONFIG_SPI_MPC83xx=y
696
697#
698# SPI Protocol Masters
699#
700# CONFIG_SPI_AT25 is not set
701# CONFIG_SPI_SPIDEV is not set
702# CONFIG_SPI_TLE62X0 is not set
690# CONFIG_W1 is not set 703# CONFIG_W1 is not set
691# CONFIG_POWER_SUPPLY is not set 704# CONFIG_POWER_SUPPLY is not set
692CONFIG_HWMON=y 705CONFIG_HWMON=y
@@ -710,6 +723,7 @@ CONFIG_HWMON=y
710# CONFIG_SENSORS_GL520SM is not set 723# CONFIG_SENSORS_GL520SM is not set
711# CONFIG_SENSORS_IT87 is not set 724# CONFIG_SENSORS_IT87 is not set
712# CONFIG_SENSORS_LM63 is not set 725# CONFIG_SENSORS_LM63 is not set
726# CONFIG_SENSORS_LM70 is not set
713# CONFIG_SENSORS_LM75 is not set 727# CONFIG_SENSORS_LM75 is not set
714# CONFIG_SENSORS_LM77 is not set 728# CONFIG_SENSORS_LM77 is not set
715# CONFIG_SENSORS_LM78 is not set 729# CONFIG_SENSORS_LM78 is not set
@@ -896,7 +910,24 @@ CONFIG_USB_MON=y
896# USB Gadget Support 910# USB Gadget Support
897# 911#
898# CONFIG_USB_GADGET is not set 912# CONFIG_USB_GADGET is not set
899# CONFIG_MMC is not set 913CONFIG_MMC=y
914# CONFIG_MMC_DEBUG is not set
915# CONFIG_MMC_UNSAFE_RESUME is not set
916
917#
918# MMC/SD Card Drivers
919#
920CONFIG_MMC_BLOCK=y
921CONFIG_MMC_BLOCK_BOUNCE=y
922# CONFIG_SDIO_UART is not set
923
924#
925# MMC/SD Host Controller Drivers
926#
927# CONFIG_MMC_SDHCI is not set
928# CONFIG_MMC_WBSD is not set
929# CONFIG_MMC_TIFM_SD is not set
930CONFIG_MMC_SPI=y
900# CONFIG_NEW_LEDS is not set 931# CONFIG_NEW_LEDS is not set
901# CONFIG_INFINIBAND is not set 932# CONFIG_INFINIBAND is not set
902# CONFIG_EDAC is not set 933# CONFIG_EDAC is not set
@@ -1101,9 +1132,9 @@ CONFIG_UCC=y
1101CONFIG_BITREVERSE=y 1132CONFIG_BITREVERSE=y
1102# CONFIG_CRC_CCITT is not set 1133# CONFIG_CRC_CCITT is not set
1103# CONFIG_CRC16 is not set 1134# CONFIG_CRC16 is not set
1104# CONFIG_CRC_ITU_T is not set 1135CONFIG_CRC_ITU_T=y
1105CONFIG_CRC32=y 1136CONFIG_CRC32=y
1106# CONFIG_CRC7 is not set 1137CONFIG_CRC7=y
1107# CONFIG_LIBCRC32C is not set 1138# CONFIG_LIBCRC32C is not set
1108CONFIG_PLIST=y 1139CONFIG_PLIST=y
1109CONFIG_HAS_IOMEM=y 1140CONFIG_HAS_IOMEM=y
diff --git a/arch/powerpc/configs/mpc834x_itx_defconfig b/arch/powerpc/configs/mpc834x_itx_defconfig
index eb28dd85cb2b..ba512d13f3a3 100644
--- a/arch/powerpc/configs/mpc834x_itx_defconfig
+++ b/arch/powerpc/configs/mpc834x_itx_defconfig
@@ -867,7 +867,7 @@ CONFIG_USB_EHCI_ROOT_HUB_TT=y
867CONFIG_USB_EHCI_FSL=y 867CONFIG_USB_EHCI_FSL=y
868# CONFIG_USB_ISP116X_HCD is not set 868# CONFIG_USB_ISP116X_HCD is not set
869# CONFIG_USB_OHCI_HCD is not set 869# CONFIG_USB_OHCI_HCD is not set
870# CONFIG_USB_UHCI_HCD is not set 870CONFIG_USB_UHCI_HCD=y
871# CONFIG_USB_SL811_HCD is not set 871# CONFIG_USB_SL811_HCD is not set
872# CONFIG_USB_R8A66597_HCD is not set 872# CONFIG_USB_R8A66597_HCD is not set
873 873
diff --git a/arch/powerpc/configs/mpc834x_itxgp_defconfig b/arch/powerpc/configs/mpc834x_itxgp_defconfig
index 22b95462c913..9faa948c22ad 100644
--- a/arch/powerpc/configs/mpc834x_itxgp_defconfig
+++ b/arch/powerpc/configs/mpc834x_itxgp_defconfig
@@ -760,15 +760,101 @@ CONFIG_USB_SUPPORT=y
760CONFIG_USB_ARCH_HAS_HCD=y 760CONFIG_USB_ARCH_HAS_HCD=y
761CONFIG_USB_ARCH_HAS_OHCI=y 761CONFIG_USB_ARCH_HAS_OHCI=y
762CONFIG_USB_ARCH_HAS_EHCI=y 762CONFIG_USB_ARCH_HAS_EHCI=y
763# CONFIG_USB is not set 763CONFIG_USB=y
764# CONFIG_USB_DEBUG is not set
765
766#
767# Miscellaneous USB options
768#
769# CONFIG_USB_DEVICEFS is not set
770CONFIG_USB_DEVICE_CLASS=y
771# CONFIG_USB_DYNAMIC_MINORS is not set
772# CONFIG_USB_OTG is not set
773
774#
775# USB Host Controller Drivers
776#
777CONFIG_USB_EHCI_HCD=y
778# CONFIG_USB_EHCI_SPLIT_ISO is not set
764CONFIG_USB_EHCI_ROOT_HUB_TT=y 779CONFIG_USB_EHCI_ROOT_HUB_TT=y
780# CONFIG_USB_EHCI_TT_NEWSCHED is not set
765CONFIG_USB_EHCI_FSL=y 781CONFIG_USB_EHCI_FSL=y
782# CONFIG_USB_ISP116X_HCD is not set
783# CONFIG_USB_OHCI_HCD is not set
784CONFIG_USB_UHCI_HCD=y
785# CONFIG_USB_SL811_HCD is not set
786# CONFIG_USB_R8A66597_HCD is not set
787
788#
789# USB Device Class drivers
790#
791# CONFIG_USB_ACM is not set
792# CONFIG_USB_PRINTER is not set
766 793
767# 794#
768# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 795# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
769# 796#
770 797
771# 798#
799# may also be needed; see USB_STORAGE Help for more information
800#
801CONFIG_USB_STORAGE=y
802# CONFIG_USB_STORAGE_DEBUG is not set
803# CONFIG_USB_STORAGE_DATAFAB is not set
804# CONFIG_USB_STORAGE_FREECOM is not set
805# CONFIG_USB_STORAGE_DPCM is not set
806# CONFIG_USB_STORAGE_USBAT is not set
807# CONFIG_USB_STORAGE_SDDR09 is not set
808# CONFIG_USB_STORAGE_SDDR55 is not set
809# CONFIG_USB_STORAGE_JUMPSHOT is not set
810# CONFIG_USB_STORAGE_ALAUDA is not set
811# CONFIG_USB_STORAGE_KARMA is not set
812# CONFIG_USB_LIBUSUAL is not set
813
814#
815# USB Imaging devices
816#
817# CONFIG_USB_MDC800 is not set
818# CONFIG_USB_MICROTEK is not set
819CONFIG_USB_MON=y
820
821#
822# USB port drivers
823#
824
825#
826# USB Serial Converter support
827#
828# CONFIG_USB_SERIAL is not set
829
830#
831# USB Miscellaneous drivers
832#
833# CONFIG_USB_EMI62 is not set
834# CONFIG_USB_EMI26 is not set
835# CONFIG_USB_ADUTUX is not set
836# CONFIG_USB_AUERSWALD is not set
837# CONFIG_USB_RIO500 is not set
838# CONFIG_USB_LEGOTOWER is not set
839# CONFIG_USB_LCD is not set
840# CONFIG_USB_BERRY_CHARGE is not set
841# CONFIG_USB_LED is not set
842# CONFIG_USB_CYPRESS_CY7C63 is not set
843# CONFIG_USB_CYTHERM is not set
844# CONFIG_USB_PHIDGET is not set
845# CONFIG_USB_IDMOUSE is not set
846# CONFIG_USB_FTDI_ELAN is not set
847# CONFIG_USB_APPLEDISPLAY is not set
848# CONFIG_USB_SISUSBVGA is not set
849# CONFIG_USB_LD is not set
850# CONFIG_USB_TRANCEVIBRATOR is not set
851# CONFIG_USB_IOWARRIOR is not set
852
853#
854# USB DSL modem support
855#
856
857#
772# USB Gadget Support 858# USB Gadget Support
773# 859#
774# CONFIG_USB_GADGET is not set 860# CONFIG_USB_GADGET is not set
diff --git a/arch/powerpc/configs/mpc834x_mds_defconfig b/arch/powerpc/configs/mpc834x_mds_defconfig
index e59a88e95486..356f736a5d3d 100644
--- a/arch/powerpc/configs/mpc834x_mds_defconfig
+++ b/arch/powerpc/configs/mpc834x_mds_defconfig
@@ -721,7 +721,53 @@ CONFIG_USB_EHCI_FSL=y
721# CONFIG_NEW_LEDS is not set 721# CONFIG_NEW_LEDS is not set
722# CONFIG_INFINIBAND is not set 722# CONFIG_INFINIBAND is not set
723# CONFIG_EDAC is not set 723# CONFIG_EDAC is not set
724# CONFIG_RTC_CLASS is not set 724CONFIG_RTC_LIB=y
725CONFIG_RTC_CLASS=y
726CONFIG_RTC_HCTOSYS=y
727CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
728# CONFIG_RTC_DEBUG is not set
729
730#
731# RTC interfaces
732#
733CONFIG_RTC_INTF_SYSFS=y
734CONFIG_RTC_INTF_PROC=y
735CONFIG_RTC_INTF_DEV=y
736# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
737# CONFIG_RTC_DRV_TEST is not set
738
739#
740# I2C RTC drivers
741#
742# CONFIG_RTC_DRV_DS1307 is not set
743CONFIG_RTC_DRV_DS1374=y
744# CONFIG_RTC_DRV_DS1672 is not set
745# CONFIG_RTC_DRV_MAX6900 is not set
746# CONFIG_RTC_DRV_RS5C372 is not set
747# CONFIG_RTC_DRV_ISL1208 is not set
748# CONFIG_RTC_DRV_X1205 is not set
749# CONFIG_RTC_DRV_PCF8563 is not set
750# CONFIG_RTC_DRV_PCF8583 is not set
751# CONFIG_RTC_DRV_M41T80 is not set
752
753#
754# SPI RTC drivers
755#
756
757#
758# Platform RTC drivers
759#
760# CONFIG_RTC_DRV_CMOS is not set
761# CONFIG_RTC_DRV_DS1553 is not set
762# CONFIG_RTC_DRV_STK17TA8 is not set
763# CONFIG_RTC_DRV_DS1742 is not set
764# CONFIG_RTC_DRV_M48T86 is not set
765# CONFIG_RTC_DRV_M48T59 is not set
766# CONFIG_RTC_DRV_V3020 is not set
767
768#
769# on-CPU RTC drivers
770#
725 771
726# 772#
727# DMA Engine support 773# DMA Engine support
diff --git a/arch/powerpc/configs/mpc836x_mds_defconfig b/arch/powerpc/configs/mpc836x_mds_defconfig
index 75657528518e..1b4d37570eb1 100644
--- a/arch/powerpc/configs/mpc836x_mds_defconfig
+++ b/arch/powerpc/configs/mpc836x_mds_defconfig
@@ -773,7 +773,53 @@ CONFIG_USB_ARCH_HAS_EHCI=y
773# CONFIG_NEW_LEDS is not set 773# CONFIG_NEW_LEDS is not set
774# CONFIG_INFINIBAND is not set 774# CONFIG_INFINIBAND is not set
775# CONFIG_EDAC is not set 775# CONFIG_EDAC is not set
776# CONFIG_RTC_CLASS is not set 776CONFIG_RTC_LIB=y
777CONFIG_RTC_CLASS=y
778CONFIG_RTC_HCTOSYS=y
779CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
780# CONFIG_RTC_DEBUG is not set
781
782#
783# RTC interfaces
784#
785CONFIG_RTC_INTF_SYSFS=y
786CONFIG_RTC_INTF_PROC=y
787CONFIG_RTC_INTF_DEV=y
788# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
789# CONFIG_RTC_DRV_TEST is not set
790
791#
792# I2C RTC drivers
793#
794# CONFIG_RTC_DRV_DS1307 is not set
795CONFIG_RTC_DRV_DS1374=y
796# CONFIG_RTC_DRV_DS1672 is not set
797# CONFIG_RTC_DRV_MAX6900 is not set
798# CONFIG_RTC_DRV_RS5C372 is not set
799# CONFIG_RTC_DRV_ISL1208 is not set
800# CONFIG_RTC_DRV_X1205 is not set
801# CONFIG_RTC_DRV_PCF8563 is not set
802# CONFIG_RTC_DRV_PCF8583 is not set
803# CONFIG_RTC_DRV_M41T80 is not set
804
805#
806# SPI RTC drivers
807#
808
809#
810# Platform RTC drivers
811#
812# CONFIG_RTC_DRV_CMOS is not set
813# CONFIG_RTC_DRV_DS1553 is not set
814# CONFIG_RTC_DRV_STK17TA8 is not set
815# CONFIG_RTC_DRV_DS1742 is not set
816# CONFIG_RTC_DRV_M48T86 is not set
817# CONFIG_RTC_DRV_M48T59 is not set
818# CONFIG_RTC_DRV_V3020 is not set
819
820#
821# on-CPU RTC drivers
822#
777 823
778# 824#
779# DMA Engine support 825# DMA Engine support
diff --git a/arch/powerpc/configs/mpc8568mds_defconfig b/arch/powerpc/configs/mpc8568mds_defconfig
index 883d8af9debd..d665e7a797c0 100644
--- a/arch/powerpc/configs/mpc8568mds_defconfig
+++ b/arch/powerpc/configs/mpc8568mds_defconfig
@@ -768,7 +768,53 @@ CONFIG_USB_ARCH_HAS_EHCI=y
768# CONFIG_NEW_LEDS is not set 768# CONFIG_NEW_LEDS is not set
769# CONFIG_INFINIBAND is not set 769# CONFIG_INFINIBAND is not set
770# CONFIG_EDAC is not set 770# CONFIG_EDAC is not set
771# CONFIG_RTC_CLASS is not set 771CONFIG_RTC_LIB=y
772CONFIG_RTC_CLASS=y
773CONFIG_RTC_HCTOSYS=y
774CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
775# CONFIG_RTC_DEBUG is not set
776
777#
778# RTC interfaces
779#
780CONFIG_RTC_INTF_SYSFS=y
781CONFIG_RTC_INTF_PROC=y
782CONFIG_RTC_INTF_DEV=y
783# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
784# CONFIG_RTC_DRV_TEST is not set
785
786#
787# I2C RTC drivers
788#
789# CONFIG_RTC_DRV_DS1307 is not set
790CONFIG_RTC_DRV_DS1374=y
791# CONFIG_RTC_DRV_DS1672 is not set
792# CONFIG_RTC_DRV_MAX6900 is not set
793# CONFIG_RTC_DRV_RS5C372 is not set
794# CONFIG_RTC_DRV_ISL1208 is not set
795# CONFIG_RTC_DRV_X1205 is not set
796# CONFIG_RTC_DRV_PCF8563 is not set
797# CONFIG_RTC_DRV_PCF8583 is not set
798# CONFIG_RTC_DRV_M41T80 is not set
799
800#
801# SPI RTC drivers
802#
803
804#
805# Platform RTC drivers
806#
807# CONFIG_RTC_DRV_CMOS is not set
808# CONFIG_RTC_DRV_DS1553 is not set
809# CONFIG_RTC_DRV_STK17TA8 is not set
810# CONFIG_RTC_DRV_DS1742 is not set
811# CONFIG_RTC_DRV_M48T86 is not set
812# CONFIG_RTC_DRV_M48T59 is not set
813# CONFIG_RTC_DRV_V3020 is not set
814
815#
816# on-CPU RTC drivers
817#
772 818
773# 819#
774# DMA Engine support 820# DMA Engine support
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig
index 1ccf3ed7693e..78c968aade4e 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_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-rc4 3# Linux kernel version: 2.6.24-rc2
4# Thu Aug 30 16:40:47 2007 4# Tue Nov 6 23:23:50 2007
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7 7
@@ -10,6 +10,7 @@ CONFIG_PPC64=y
10# 10#
11CONFIG_POWER4_ONLY=y 11CONFIG_POWER4_ONLY=y
12CONFIG_POWER4=y 12CONFIG_POWER4=y
13# CONFIG_TUNE_CELL is not set
13CONFIG_PPC_FPU=y 14CONFIG_PPC_FPU=y
14CONFIG_ALTIVEC=y 15CONFIG_ALTIVEC=y
15CONFIG_PPC_STD_MMU=y 16CONFIG_PPC_STD_MMU=y
@@ -18,8 +19,13 @@ CONFIG_PPC_MM_SLICES=y
18CONFIG_SMP=y 19CONFIG_SMP=y
19CONFIG_NR_CPUS=2 20CONFIG_NR_CPUS=2
20CONFIG_64BIT=y 21CONFIG_64BIT=y
22CONFIG_WORD_SIZE=64
21CONFIG_PPC_MERGE=y 23CONFIG_PPC_MERGE=y
22CONFIG_MMU=y 24CONFIG_MMU=y
25CONFIG_GENERIC_CMOS_UPDATE=y
26CONFIG_GENERIC_TIME=y
27CONFIG_GENERIC_TIME_VSYSCALL=y
28CONFIG_GENERIC_CLOCKEVENTS=y
23CONFIG_GENERIC_HARDIRQS=y 29CONFIG_GENERIC_HARDIRQS=y
24CONFIG_IRQ_PER_CPU=y 30CONFIG_IRQ_PER_CPU=y
25CONFIG_RWSEM_XCHGADD_ALGORITHM=y 31CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -65,7 +71,10 @@ CONFIG_SYSVIPC_SYSCTL=y
65# CONFIG_AUDIT is not set 71# CONFIG_AUDIT is not set
66# CONFIG_IKCONFIG is not set 72# CONFIG_IKCONFIG is not set
67CONFIG_LOG_BUF_SHIFT=17 73CONFIG_LOG_BUF_SHIFT=17
68# CONFIG_CPUSETS is not set 74# CONFIG_CGROUPS is not set
75CONFIG_FAIR_GROUP_SCHED=y
76CONFIG_FAIR_USER_SCHED=y
77# CONFIG_FAIR_CGROUP_SCHED is not set
69CONFIG_SYSFS_DEPRECATED=y 78CONFIG_SYSFS_DEPRECATED=y
70# CONFIG_RELAY is not set 79# CONFIG_RELAY is not set
71CONFIG_BLK_DEV_INITRD=y 80CONFIG_BLK_DEV_INITRD=y
@@ -86,7 +95,6 @@ CONFIG_FUTEX=y
86CONFIG_ANON_INODES=y 95CONFIG_ANON_INODES=y
87CONFIG_EPOLL=y 96CONFIG_EPOLL=y
88CONFIG_SIGNALFD=y 97CONFIG_SIGNALFD=y
89CONFIG_TIMERFD=y
90CONFIG_EVENTFD=y 98CONFIG_EVENTFD=y
91CONFIG_SHMEM=y 99CONFIG_SHMEM=y
92CONFIG_VM_EVENT_COUNTERS=y 100CONFIG_VM_EVENT_COUNTERS=y
@@ -107,14 +115,15 @@ CONFIG_STOP_MACHINE=y
107CONFIG_BLOCK=y 115CONFIG_BLOCK=y
108# CONFIG_BLK_DEV_IO_TRACE is not set 116# CONFIG_BLK_DEV_IO_TRACE is not set
109# CONFIG_BLK_DEV_BSG is not set 117# CONFIG_BLK_DEV_BSG is not set
118CONFIG_BLOCK_COMPAT=y
110 119
111# 120#
112# IO Schedulers 121# IO Schedulers
113# 122#
114CONFIG_IOSCHED_NOOP=y 123CONFIG_IOSCHED_NOOP=y
115CONFIG_IOSCHED_AS=y 124CONFIG_IOSCHED_AS=y
116# CONFIG_IOSCHED_DEADLINE is not set 125CONFIG_IOSCHED_DEADLINE=y
117# CONFIG_IOSCHED_CFQ is not set 126CONFIG_IOSCHED_CFQ=y
118CONFIG_DEFAULT_AS=y 127CONFIG_DEFAULT_AS=y
119# CONFIG_DEFAULT_DEADLINE is not set 128# CONFIG_DEFAULT_DEADLINE is not set
120# CONFIG_DEFAULT_CFQ is not set 129# CONFIG_DEFAULT_CFQ is not set
@@ -125,7 +134,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
125# Platform support 134# Platform support
126# 135#
127CONFIG_PPC_MULTIPLATFORM=y 136CONFIG_PPC_MULTIPLATFORM=y
128# CONFIG_EMBEDDED6xx is not set
129# CONFIG_PPC_82xx is not set 137# CONFIG_PPC_82xx is not set
130# CONFIG_PPC_83xx is not set 138# CONFIG_PPC_83xx is not set
131# CONFIG_PPC_86xx is not set 139# CONFIG_PPC_86xx is not set
@@ -141,6 +149,7 @@ CONFIG_PPC_PASEMI=y
141# PA Semi PWRficient options 149# PA Semi PWRficient options
142# 150#
143CONFIG_PPC_PASEMI_IOMMU=y 151CONFIG_PPC_PASEMI_IOMMU=y
152# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set
144CONFIG_PPC_PASEMI_MDIO=y 153CONFIG_PPC_PASEMI_MDIO=y
145CONFIG_ELECTRA_IDE=y 154CONFIG_ELECTRA_IDE=y
146# CONFIG_PPC_CELLEB is not set 155# CONFIG_PPC_CELLEB is not set
@@ -156,29 +165,52 @@ CONFIG_MPIC=y
156# CONFIG_U3_DART is not set 165# CONFIG_U3_DART is not set
157# CONFIG_PPC_RTAS is not set 166# CONFIG_PPC_RTAS is not set
158# CONFIG_MMIO_NVRAM is not set 167# CONFIG_MMIO_NVRAM is not set
168CONFIG_MPIC_BROKEN_REGREAD=y
159# CONFIG_PPC_MPC106 is not set 169# CONFIG_PPC_MPC106 is not set
160# CONFIG_PPC_970_NAP is not set 170# CONFIG_PPC_970_NAP is not set
161# CONFIG_PPC_INDIRECT_IO is not set 171# CONFIG_PPC_INDIRECT_IO is not set
162# CONFIG_GENERIC_IOMAP is not set 172# CONFIG_GENERIC_IOMAP is not set
163# CONFIG_CPU_FREQ is not set 173CONFIG_CPU_FREQ=y
174CONFIG_CPU_FREQ_TABLE=y
175CONFIG_CPU_FREQ_DEBUG=y
176CONFIG_CPU_FREQ_STAT=y
177# CONFIG_CPU_FREQ_STAT_DETAILS is not set
178CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
179# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
180# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
181# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
182CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
183CONFIG_CPU_FREQ_GOV_POWERSAVE=y
184CONFIG_CPU_FREQ_GOV_USERSPACE=y
185CONFIG_CPU_FREQ_GOV_ONDEMAND=y
186# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
187
188#
189# CPU Frequency drivers
190#
191CONFIG_PPC_PASEMI_CPUFREQ=y
164# CONFIG_CPM2 is not set 192# CONFIG_CPM2 is not set
165# CONFIG_FSL_ULI1575 is not set 193# CONFIG_FSL_ULI1575 is not set
166 194
167# 195#
168# Kernel options 196# Kernel options
169# 197#
170CONFIG_HZ_100=y 198CONFIG_TICK_ONESHOT=y
199CONFIG_NO_HZ=y
200CONFIG_HIGH_RES_TIMERS=y
201CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
202# CONFIG_HZ_100 is not set
171# CONFIG_HZ_250 is not set 203# CONFIG_HZ_250 is not set
172# CONFIG_HZ_300 is not set 204# CONFIG_HZ_300 is not set
173# CONFIG_HZ_1000 is not set 205CONFIG_HZ_1000=y
174CONFIG_HZ=100 206CONFIG_HZ=1000
175CONFIG_PREEMPT_NONE=y 207CONFIG_PREEMPT_NONE=y
176# CONFIG_PREEMPT_VOLUNTARY is not set 208# CONFIG_PREEMPT_VOLUNTARY is not set
177# CONFIG_PREEMPT is not set 209# CONFIG_PREEMPT is not set
178CONFIG_PREEMPT_BKL=y 210# CONFIG_PREEMPT_BKL is not set
179CONFIG_BINFMT_ELF=y 211CONFIG_BINFMT_ELF=y
180# CONFIG_BINFMT_MISC is not set 212# CONFIG_BINFMT_MISC is not set
181CONFIG_FORCE_MAX_ZONEORDER=13 213CONFIG_FORCE_MAX_ZONEORDER=9
182CONFIG_IOMMU_VMERGE=y 214CONFIG_IOMMU_VMERGE=y
183CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 215CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
184# CONFIG_KEXEC is not set 216# CONFIG_KEXEC is not set
@@ -196,12 +228,13 @@ CONFIG_FLATMEM_MANUAL=y
196CONFIG_FLATMEM=y 228CONFIG_FLATMEM=y
197CONFIG_FLAT_NODE_MEM_MAP=y 229CONFIG_FLAT_NODE_MEM_MAP=y
198# CONFIG_SPARSEMEM_STATIC is not set 230# CONFIG_SPARSEMEM_STATIC is not set
231CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
199CONFIG_SPLIT_PTLOCK_CPUS=4 232CONFIG_SPLIT_PTLOCK_CPUS=4
200CONFIG_RESOURCES_64BIT=y 233CONFIG_RESOURCES_64BIT=y
201CONFIG_ZONE_DMA_FLAG=1 234CONFIG_ZONE_DMA_FLAG=1
202CONFIG_BOUNCE=y 235CONFIG_BOUNCE=y
203# CONFIG_PPC_HAS_HASH_64K is not set 236CONFIG_PPC_HAS_HASH_64K=y
204# CONFIG_PPC_64K_PAGES is not set 237CONFIG_PPC_64K_PAGES=y
205# CONFIG_SCHED_SMT is not set 238# CONFIG_SCHED_SMT is not set
206CONFIG_PROC_DEVICETREE=y 239CONFIG_PROC_DEVICETREE=y
207# CONFIG_CMDLINE_BOOL is not set 240# CONFIG_CMDLINE_BOOL is not set
@@ -222,11 +255,8 @@ CONFIG_PCI_SYSCALL=y
222# CONFIG_PCIEPORTBUS is not set 255# CONFIG_PCIEPORTBUS is not set
223CONFIG_ARCH_SUPPORTS_MSI=y 256CONFIG_ARCH_SUPPORTS_MSI=y
224# CONFIG_PCI_MSI is not set 257# CONFIG_PCI_MSI is not set
258CONFIG_PCI_LEGACY=y
225# CONFIG_PCI_DEBUG is not set 259# CONFIG_PCI_DEBUG is not set
226
227#
228# PCCARD (PCMCIA/CardBus) support
229#
230CONFIG_PCCARD=y 260CONFIG_PCCARD=y
231CONFIG_PCMCIA_DEBUG=y 261CONFIG_PCMCIA_DEBUG=y
232CONFIG_PCMCIA=y 262CONFIG_PCMCIA=y
@@ -240,6 +270,7 @@ CONFIG_CARDBUS=y
240# CONFIG_YENTA is not set 270# CONFIG_YENTA is not set
241# CONFIG_PD6729 is not set 271# CONFIG_PD6729 is not set
242# CONFIG_I82092 is not set 272# CONFIG_I82092 is not set
273# CONFIG_ELECTRA_CF is not set
243# CONFIG_HOTPLUG_PCI is not set 274# CONFIG_HOTPLUG_PCI is not set
244CONFIG_KERNEL_START=0xc000000000000000 275CONFIG_KERNEL_START=0xc000000000000000
245 276
@@ -255,7 +286,7 @@ CONFIG_PACKET=y
255# CONFIG_PACKET_MMAP is not set 286# CONFIG_PACKET_MMAP is not set
256CONFIG_UNIX=y 287CONFIG_UNIX=y
257CONFIG_XFRM=y 288CONFIG_XFRM=y
258# CONFIG_XFRM_USER is not set 289CONFIG_XFRM_USER=y
259# CONFIG_XFRM_SUB_POLICY is not set 290# CONFIG_XFRM_SUB_POLICY is not set
260# CONFIG_XFRM_MIGRATE is not set 291# CONFIG_XFRM_MIGRATE is not set
261CONFIG_NET_KEY=y 292CONFIG_NET_KEY=y
@@ -281,6 +312,7 @@ CONFIG_INET_TUNNEL=y
281CONFIG_INET_XFRM_MODE_TRANSPORT=y 312CONFIG_INET_XFRM_MODE_TRANSPORT=y
282CONFIG_INET_XFRM_MODE_TUNNEL=y 313CONFIG_INET_XFRM_MODE_TUNNEL=y
283CONFIG_INET_XFRM_MODE_BEET=y 314CONFIG_INET_XFRM_MODE_BEET=y
315CONFIG_INET_LRO=y
284CONFIG_INET_DIAG=y 316CONFIG_INET_DIAG=y
285CONFIG_INET_TCP_DIAG=y 317CONFIG_INET_TCP_DIAG=y
286# CONFIG_TCP_CONG_ADVANCED is not set 318# CONFIG_TCP_CONG_ADVANCED is not set
@@ -306,10 +338,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
306# CONFIG_LAPB is not set 338# CONFIG_LAPB is not set
307# CONFIG_ECONET is not set 339# CONFIG_ECONET is not set
308# CONFIG_WAN_ROUTER is not set 340# CONFIG_WAN_ROUTER is not set
309
310#
311# QoS and/or fair queueing
312#
313# CONFIG_NET_SCHED is not set 341# CONFIG_NET_SCHED is not set
314 342
315# 343#
@@ -338,6 +366,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
338# 366#
339# Generic Driver Options 367# Generic Driver Options
340# 368#
369CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
341CONFIG_STANDALONE=y 370CONFIG_STANDALONE=y
342CONFIG_PREVENT_FIRMWARE_BUILD=y 371CONFIG_PREVENT_FIRMWARE_BUILD=y
343CONFIG_FW_LOADER=y 372CONFIG_FW_LOADER=y
@@ -361,6 +390,7 @@ CONFIG_MTD_BLOCK=y
361# CONFIG_INFTL is not set 390# CONFIG_INFTL is not set
362# CONFIG_RFD_FTL is not set 391# CONFIG_RFD_FTL is not set
363# CONFIG_SSFDC is not set 392# CONFIG_SSFDC is not set
393# CONFIG_MTD_OOPS is not set
364 394
365# 395#
366# RAM/ROM/Flash chip drivers 396# RAM/ROM/Flash chip drivers
@@ -385,6 +415,7 @@ CONFIG_MTD_CFI_I2=y
385# Mapping drivers for chip access 415# Mapping drivers for chip access
386# 416#
387# CONFIG_MTD_COMPLEX_MAPPINGS is not set 417# CONFIG_MTD_COMPLEX_MAPPINGS is not set
418# CONFIG_MTD_INTEL_VR_NOR is not set
388# CONFIG_MTD_PLATRAM is not set 419# CONFIG_MTD_PLATRAM is not set
389 420
390# 421#
@@ -402,7 +433,15 @@ CONFIG_MTD_PHRAM=y
402# CONFIG_MTD_DOC2000 is not set 433# CONFIG_MTD_DOC2000 is not set
403# CONFIG_MTD_DOC2001 is not set 434# CONFIG_MTD_DOC2001 is not set
404# CONFIG_MTD_DOC2001PLUS is not set 435# CONFIG_MTD_DOC2001PLUS is not set
405# CONFIG_MTD_NAND is not set 436CONFIG_MTD_NAND=y
437# CONFIG_MTD_NAND_VERIFY_WRITE is not set
438# CONFIG_MTD_NAND_ECC_SMC is not set
439# CONFIG_MTD_NAND_MUSEUM_IDS is not set
440CONFIG_MTD_NAND_IDS=y
441# CONFIG_MTD_NAND_DISKONCHIP is not set
442# CONFIG_MTD_NAND_CAFE is not set
443# CONFIG_MTD_NAND_PLATFORM is not set
444# CONFIG_MTD_ALAUDA is not set
406# CONFIG_MTD_ONENAND is not set 445# CONFIG_MTD_ONENAND is not set
407 446
408# 447#
@@ -455,10 +494,42 @@ CONFIG_IDE_PROC_FS=y
455# IDE chipset support/bugfixes 494# IDE chipset support/bugfixes
456# 495#
457# CONFIG_IDE_GENERIC is not set 496# CONFIG_IDE_GENERIC is not set
458# CONFIG_BLK_DEV_IDEPCI is not set 497# CONFIG_BLK_DEV_PLATFORM is not set
498
499#
500# PCI IDE chipsets support
501#
459# CONFIG_IDEPCI_PCIBUS_ORDER is not set 502# CONFIG_IDEPCI_PCIBUS_ORDER is not set
503# CONFIG_BLK_DEV_GENERIC is not set
504# CONFIG_BLK_DEV_OPTI621 is not set
505# CONFIG_BLK_DEV_AEC62XX is not set
506# CONFIG_BLK_DEV_ALI15X3 is not set
507# CONFIG_BLK_DEV_AMD74XX is not set
508# CONFIG_BLK_DEV_CMD64X is not set
509# CONFIG_BLK_DEV_TRIFLEX is not set
510# CONFIG_BLK_DEV_CY82C693 is not set
511# CONFIG_BLK_DEV_CS5520 is not set
512# CONFIG_BLK_DEV_CS5530 is not set
513# CONFIG_BLK_DEV_HPT34X is not set
514# CONFIG_BLK_DEV_HPT366 is not set
515# CONFIG_BLK_DEV_JMICRON is not set
516# CONFIG_BLK_DEV_SC1200 is not set
517# CONFIG_BLK_DEV_PIIX is not set
518# CONFIG_BLK_DEV_IT8213 is not set
519# CONFIG_BLK_DEV_IT821X is not set
520# CONFIG_BLK_DEV_NS87415 is not set
521# CONFIG_BLK_DEV_PDC202XX_OLD is not set
522# CONFIG_BLK_DEV_PDC202XX_NEW is not set
523# CONFIG_BLK_DEV_SVWKS is not set
524# CONFIG_BLK_DEV_SIIMAGE is not set
525# CONFIG_BLK_DEV_SL82C105 is not set
526# CONFIG_BLK_DEV_SLC90E66 is not set
527# CONFIG_BLK_DEV_TRM290 is not set
528# CONFIG_BLK_DEV_VIA82CXXX is not set
529# CONFIG_BLK_DEV_TC86C001 is not set
460# CONFIG_IDE_ARM is not set 530# CONFIG_IDE_ARM is not set
461# CONFIG_BLK_DEV_IDEDMA is not set 531# CONFIG_BLK_DEV_IDEDMA is not set
532CONFIG_IDE_ARCH_OBSOLETE_INIT=y
462# CONFIG_BLK_DEV_HD is not set 533# CONFIG_BLK_DEV_HD is not set
463 534
464# 535#
@@ -498,10 +569,11 @@ CONFIG_SCSI_WAIT_SCAN=m
498# CONFIG_SCSI_FC_ATTRS is not set 569# CONFIG_SCSI_FC_ATTRS is not set
499# CONFIG_SCSI_ISCSI_ATTRS is not set 570# CONFIG_SCSI_ISCSI_ATTRS is not set
500# CONFIG_SCSI_SAS_LIBSAS is not set 571# CONFIG_SCSI_SAS_LIBSAS is not set
572# CONFIG_SCSI_SRP_ATTRS is not set
501CONFIG_SCSI_LOWLEVEL=y 573CONFIG_SCSI_LOWLEVEL=y
502# CONFIG_ISCSI_TCP is not set 574# CONFIG_ISCSI_TCP is not set
503CONFIG_BLK_DEV_3W_XXXX_RAID=y 575# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
504CONFIG_SCSI_3W_9XXX=y 576# CONFIG_SCSI_3W_9XXX is not set
505# CONFIG_SCSI_ACARD is not set 577# CONFIG_SCSI_ACARD is not set
506# CONFIG_SCSI_AACRAID is not set 578# CONFIG_SCSI_AACRAID is not set
507# CONFIG_SCSI_AIC7XXX is not set 579# CONFIG_SCSI_AIC7XXX is not set
@@ -574,9 +646,10 @@ CONFIG_ATA_GENERIC=y
574# CONFIG_PATA_OLDPIIX is not set 646# CONFIG_PATA_OLDPIIX is not set
575# CONFIG_PATA_NETCELL is not set 647# CONFIG_PATA_NETCELL is not set
576# CONFIG_PATA_NS87410 is not set 648# CONFIG_PATA_NS87410 is not set
649# CONFIG_PATA_NS87415 is not set
577# CONFIG_PATA_OPTI is not set 650# CONFIG_PATA_OPTI is not set
578# CONFIG_PATA_OPTIDMA is not set 651# CONFIG_PATA_OPTIDMA is not set
579# CONFIG_PATA_PCMCIA is not set 652CONFIG_PATA_PCMCIA=y
580# CONFIG_PATA_PDC_OLD is not set 653# CONFIG_PATA_PDC_OLD is not set
581# CONFIG_PATA_RADISYS is not set 654# CONFIG_PATA_RADISYS is not set
582# CONFIG_PATA_RZ1000 is not set 655# CONFIG_PATA_RZ1000 is not set
@@ -589,41 +662,13 @@ CONFIG_ATA_GENERIC=y
589# CONFIG_PATA_WINBOND is not set 662# CONFIG_PATA_WINBOND is not set
590CONFIG_PATA_PLATFORM=y 663CONFIG_PATA_PLATFORM=y
591# CONFIG_MD is not set 664# CONFIG_MD is not set
592
593#
594# Fusion MPT device support
595#
596# CONFIG_FUSION is not set 665# CONFIG_FUSION is not set
597# CONFIG_FUSION_SPI is not set
598# CONFIG_FUSION_FC is not set
599# CONFIG_FUSION_SAS is not set
600 666
601# 667#
602# IEEE 1394 (FireWire) support 668# IEEE 1394 (FireWire) support
603# 669#
604# CONFIG_FIREWIRE is not set 670# CONFIG_FIREWIRE is not set
605CONFIG_IEEE1394=y 671# CONFIG_IEEE1394 is not set
606
607#
608# Subsystem Options
609#
610# CONFIG_IEEE1394_VERBOSEDEBUG is not set
611
612#
613# Controllers
614#
615CONFIG_IEEE1394_PCILYNX=y
616CONFIG_IEEE1394_OHCI1394=y
617
618#
619# Protocols
620#
621# CONFIG_IEEE1394_VIDEO1394 is not set
622CONFIG_IEEE1394_SBP2=y
623# CONFIG_IEEE1394_ETH1394_ROM_ENTRY is not set
624# CONFIG_IEEE1394_ETH1394 is not set
625# CONFIG_IEEE1394_DV1394 is not set
626CONFIG_IEEE1394_RAWIO=y
627# CONFIG_I2O is not set 672# CONFIG_I2O is not set
628# CONFIG_MACINTOSH_DRIVERS is not set 673# CONFIG_MACINTOSH_DRIVERS is not set
629CONFIG_NETDEVICES=y 674CONFIG_NETDEVICES=y
@@ -633,6 +678,8 @@ CONFIG_DUMMY=y
633# CONFIG_MACVLAN is not set 678# CONFIG_MACVLAN is not set
634# CONFIG_EQUALIZER is not set 679# CONFIG_EQUALIZER is not set
635# CONFIG_TUN is not set 680# CONFIG_TUN is not set
681# CONFIG_VETH is not set
682# CONFIG_IP1000 is not set
636# CONFIG_ARCNET is not set 683# CONFIG_ARCNET is not set
637CONFIG_PHYLIB=y 684CONFIG_PHYLIB=y
638 685
@@ -649,6 +696,7 @@ CONFIG_MARVELL_PHY=y
649# CONFIG_BROADCOM_PHY is not set 696# CONFIG_BROADCOM_PHY is not set
650# CONFIG_ICPLUS_PHY is not set 697# CONFIG_ICPLUS_PHY is not set
651# CONFIG_FIXED_PHY is not set 698# CONFIG_FIXED_PHY is not set
699# CONFIG_MDIO_BITBANG is not set
652CONFIG_NET_ETHERNET=y 700CONFIG_NET_ETHERNET=y
653CONFIG_MII=y 701CONFIG_MII=y
654# CONFIG_HAPPYMEAL is not set 702# CONFIG_HAPPYMEAL is not set
@@ -657,13 +705,16 @@ CONFIG_MII=y
657# CONFIG_NET_VENDOR_3COM is not set 705# CONFIG_NET_VENDOR_3COM is not set
658# CONFIG_NET_TULIP is not set 706# CONFIG_NET_TULIP is not set
659# CONFIG_HP100 is not set 707# CONFIG_HP100 is not set
708# CONFIG_IBM_NEW_EMAC_ZMII is not set
709# CONFIG_IBM_NEW_EMAC_RGMII is not set
710# CONFIG_IBM_NEW_EMAC_TAH is not set
711# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
660CONFIG_NET_PCI=y 712CONFIG_NET_PCI=y
661# CONFIG_PCNET32 is not set 713# CONFIG_PCNET32 is not set
662# CONFIG_AMD8111_ETH is not set 714# CONFIG_AMD8111_ETH is not set
663# CONFIG_ADAPTEC_STARFIRE is not set 715# CONFIG_ADAPTEC_STARFIRE is not set
664# CONFIG_B44 is not set 716# CONFIG_B44 is not set
665# CONFIG_FORCEDETH is not set 717# CONFIG_FORCEDETH is not set
666# CONFIG_DGRS is not set
667# CONFIG_EEPRO100 is not set 718# CONFIG_EEPRO100 is not set
668# CONFIG_E100 is not set 719# CONFIG_E100 is not set
669# CONFIG_FEALNX is not set 720# CONFIG_FEALNX is not set
@@ -682,6 +733,7 @@ CONFIG_NETDEV_1000=y
682CONFIG_E1000=y 733CONFIG_E1000=y
683CONFIG_E1000_NAPI=y 734CONFIG_E1000_NAPI=y
684# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 735# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
736# CONFIG_E1000E is not set
685# CONFIG_NS83820 is not set 737# CONFIG_NS83820 is not set
686# CONFIG_HAMACHI is not set 738# CONFIG_HAMACHI is not set
687# CONFIG_YELLOWFIN is not set 739# CONFIG_YELLOWFIN is not set
@@ -689,6 +741,7 @@ CONFIG_E1000_NAPI=y
689# CONFIG_SIS190 is not set 741# CONFIG_SIS190 is not set
690# CONFIG_SKGE is not set 742# CONFIG_SKGE is not set
691# CONFIG_SKY2 is not set 743# CONFIG_SKY2 is not set
744# CONFIG_SK98LIN is not set
692# CONFIG_VIA_VELOCITY is not set 745# CONFIG_VIA_VELOCITY is not set
693CONFIG_TIGON3=y 746CONFIG_TIGON3=y
694# CONFIG_BNX2 is not set 747# CONFIG_BNX2 is not set
@@ -697,12 +750,15 @@ CONFIG_TIGON3=y
697CONFIG_NETDEV_10000=y 750CONFIG_NETDEV_10000=y
698# CONFIG_CHELSIO_T1 is not set 751# CONFIG_CHELSIO_T1 is not set
699# CONFIG_CHELSIO_T3 is not set 752# CONFIG_CHELSIO_T3 is not set
753# CONFIG_IXGBE is not set
700# CONFIG_IXGB is not set 754# CONFIG_IXGB is not set
701# CONFIG_S2IO is not set 755# CONFIG_S2IO is not set
702# CONFIG_MYRI10GE is not set 756# CONFIG_MYRI10GE is not set
703# CONFIG_NETXEN_NIC is not set 757# CONFIG_NETXEN_NIC is not set
758# CONFIG_NIU is not set
704CONFIG_PASEMI_MAC=y 759CONFIG_PASEMI_MAC=y
705# CONFIG_MLX4_CORE is not set 760# CONFIG_MLX4_CORE is not set
761# CONFIG_TEHUTI is not set
706# CONFIG_TR is not set 762# CONFIG_TR is not set
707 763
708# 764#
@@ -749,7 +805,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
749CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 805CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
750CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 806CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
751CONFIG_INPUT_JOYDEV=y 807CONFIG_INPUT_JOYDEV=y
752# CONFIG_INPUT_TSDEV is not set
753CONFIG_INPUT_EVDEV=y 808CONFIG_INPUT_EVDEV=y
754# CONFIG_INPUT_EVBUG is not set 809# CONFIG_INPUT_EVBUG is not set
755 810
@@ -810,15 +865,12 @@ CONFIG_UNIX98_PTYS=y
810CONFIG_LEGACY_PTYS=y 865CONFIG_LEGACY_PTYS=y
811CONFIG_LEGACY_PTY_COUNT=4 866CONFIG_LEGACY_PTY_COUNT=4
812# CONFIG_IPMI_HANDLER is not set 867# CONFIG_IPMI_HANDLER is not set
813# CONFIG_WATCHDOG is not set
814CONFIG_HW_RANDOM=y 868CONFIG_HW_RANDOM=y
815CONFIG_HW_RANDOM_PASEMI=y 869CONFIG_HW_RANDOM_PASEMI=y
816CONFIG_GEN_RTC=y 870CONFIG_GEN_RTC=y
817CONFIG_GEN_RTC_X=y 871CONFIG_GEN_RTC_X=y
818# CONFIG_R3964 is not set 872# CONFIG_R3964 is not set
819# CONFIG_APPLICOM is not set 873# CONFIG_APPLICOM is not set
820# CONFIG_AGP is not set
821# CONFIG_DRM is not set
822 874
823# 875#
824# PCMCIA character devices 876# PCMCIA character devices
@@ -896,8 +948,6 @@ CONFIG_SENSORS_EEPROM=y
896# CONFIG_POWER_SUPPLY is not set 948# CONFIG_POWER_SUPPLY is not set
897CONFIG_HWMON=y 949CONFIG_HWMON=y
898CONFIG_HWMON_VID=y 950CONFIG_HWMON_VID=y
899# CONFIG_SENSORS_ABITUGURU is not set
900# CONFIG_SENSORS_ABITUGURU3 is not set
901# CONFIG_SENSORS_AD7418 is not set 951# CONFIG_SENSORS_AD7418 is not set
902# CONFIG_SENSORS_ADM1021 is not set 952# CONFIG_SENSORS_ADM1021 is not set
903# CONFIG_SENSORS_ADM1025 is not set 953# CONFIG_SENSORS_ADM1025 is not set
@@ -905,12 +955,12 @@ CONFIG_HWMON_VID=y
905# CONFIG_SENSORS_ADM1029 is not set 955# CONFIG_SENSORS_ADM1029 is not set
906# CONFIG_SENSORS_ADM1031 is not set 956# CONFIG_SENSORS_ADM1031 is not set
907# CONFIG_SENSORS_ADM9240 is not set 957# CONFIG_SENSORS_ADM9240 is not set
908# CONFIG_SENSORS_ASB100 is not set 958# CONFIG_SENSORS_ADT7470 is not set
909# CONFIG_SENSORS_ATXP1 is not set 959# CONFIG_SENSORS_ATXP1 is not set
910# CONFIG_SENSORS_DS1621 is not set 960# CONFIG_SENSORS_DS1621 is not set
911# CONFIG_SENSORS_F71805F is not set 961# CONFIG_SENSORS_F71805F is not set
912# CONFIG_SENSORS_FSCHER is not set 962# CONFIG_SENSORS_F71882FG is not set
913# CONFIG_SENSORS_FSCPOS is not set 963# CONFIG_SENSORS_F75375S is not set
914# CONFIG_SENSORS_GL518SM is not set 964# CONFIG_SENSORS_GL518SM is not set
915# CONFIG_SENSORS_GL520SM is not set 965# CONFIG_SENSORS_GL520SM is not set
916# CONFIG_SENSORS_IT87 is not set 966# CONFIG_SENSORS_IT87 is not set
@@ -946,6 +996,13 @@ CONFIG_SENSORS_LM90=y
946# CONFIG_SENSORS_W83627HF is not set 996# CONFIG_SENSORS_W83627HF is not set
947# CONFIG_SENSORS_W83627EHF is not set 997# CONFIG_SENSORS_W83627EHF is not set
948# CONFIG_HWMON_DEBUG_CHIP is not set 998# CONFIG_HWMON_DEBUG_CHIP is not set
999# CONFIG_WATCHDOG is not set
1000
1001#
1002# Sonics Silicon Backplane
1003#
1004CONFIG_SSB_POSSIBLE=y
1005# CONFIG_SSB is not set
949 1006
950# 1007#
951# Multifunction device drivers 1008# Multifunction device drivers
@@ -963,14 +1020,14 @@ CONFIG_DAB=y
963# 1020#
964# Graphics support 1021# Graphics support
965# 1022#
966CONFIG_BACKLIGHT_LCD_SUPPORT=y 1023# CONFIG_AGP is not set
967CONFIG_LCD_CLASS_DEVICE=m 1024CONFIG_DRM=y
968CONFIG_BACKLIGHT_CLASS_DEVICE=y 1025# CONFIG_DRM_TDFX is not set
969 1026# CONFIG_DRM_R128 is not set
970# 1027CONFIG_DRM_RADEON=y
971# Display device support 1028# CONFIG_DRM_MGA is not set
972# 1029# CONFIG_DRM_VIA is not set
973# CONFIG_DISPLAY_SUPPORT is not set 1030# CONFIG_DRM_SAVAGE is not set
974CONFIG_VGASTATE=y 1031CONFIG_VGASTATE=y
975# CONFIG_VIDEO_OUTPUT_CONTROL is not set 1032# CONFIG_VIDEO_OUTPUT_CONTROL is not set
976CONFIG_FB=y 1033CONFIG_FB=y
@@ -979,6 +1036,7 @@ CONFIG_FB_DDC=y
979CONFIG_FB_CFB_FILLRECT=y 1036CONFIG_FB_CFB_FILLRECT=y
980CONFIG_FB_CFB_COPYAREA=y 1037CONFIG_FB_CFB_COPYAREA=y
981CONFIG_FB_CFB_IMAGEBLIT=y 1038CONFIG_FB_CFB_IMAGEBLIT=y
1039# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
982# CONFIG_FB_SYS_FILLRECT is not set 1040# CONFIG_FB_SYS_FILLRECT is not set
983# CONFIG_FB_SYS_COPYAREA is not set 1041# CONFIG_FB_SYS_COPYAREA is not set
984# CONFIG_FB_SYS_IMAGEBLIT is not set 1042# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -1026,6 +1084,15 @@ CONFIG_FB_RADEON_BACKLIGHT=y
1026# CONFIG_FB_PM3 is not set 1084# CONFIG_FB_PM3 is not set
1027# CONFIG_FB_IBM_GXT4500 is not set 1085# CONFIG_FB_IBM_GXT4500 is not set
1028# CONFIG_FB_VIRTUAL is not set 1086# CONFIG_FB_VIRTUAL is not set
1087CONFIG_BACKLIGHT_LCD_SUPPORT=y
1088# CONFIG_LCD_CLASS_DEVICE is not set
1089CONFIG_BACKLIGHT_CLASS_DEVICE=y
1090# CONFIG_BACKLIGHT_CORGI is not set
1091
1092#
1093# Display device support
1094#
1095# CONFIG_DISPLAY_SUPPORT is not set
1029 1096
1030# 1097#
1031# Console display driver support 1098# Console display driver support
@@ -1178,6 +1245,7 @@ CONFIG_SND_USB_USX2Y=y
1178CONFIG_HID_SUPPORT=y 1245CONFIG_HID_SUPPORT=y
1179CONFIG_HID=y 1246CONFIG_HID=y
1180# CONFIG_HID_DEBUG is not set 1247# CONFIG_HID_DEBUG is not set
1248# CONFIG_HIDRAW is not set
1181 1249
1182# 1250#
1183# USB Input Devices 1251# USB Input Devices
@@ -1328,6 +1396,7 @@ CONFIG_RTC_INTF_DEV=y
1328# I2C RTC drivers 1396# I2C RTC drivers
1329# 1397#
1330CONFIG_RTC_DRV_DS1307=y 1398CONFIG_RTC_DRV_DS1307=y
1399# CONFIG_RTC_DRV_DS1374 is not set
1331# CONFIG_RTC_DRV_DS1672 is not set 1400# CONFIG_RTC_DRV_DS1672 is not set
1332# CONFIG_RTC_DRV_MAX6900 is not set 1401# CONFIG_RTC_DRV_MAX6900 is not set
1333# CONFIG_RTC_DRV_RS5C372 is not set 1402# CONFIG_RTC_DRV_RS5C372 is not set
@@ -1357,19 +1426,6 @@ CONFIG_RTC_DRV_DS1307=y
1357# 1426#
1358 1427
1359# 1428#
1360# DMA Engine support
1361#
1362# CONFIG_DMA_ENGINE is not set
1363
1364#
1365# DMA Clients
1366#
1367
1368#
1369# DMA Devices
1370#
1371
1372#
1373# Userspace I/O 1429# Userspace I/O
1374# 1430#
1375# CONFIG_UIO is not set 1431# CONFIG_UIO is not set
@@ -1388,7 +1444,6 @@ CONFIG_EXT3_FS_XATTR=y
1388# CONFIG_EXT3_FS_SECURITY is not set 1444# CONFIG_EXT3_FS_SECURITY is not set
1389# CONFIG_EXT4DEV_FS is not set 1445# CONFIG_EXT4DEV_FS is not set
1390CONFIG_JBD=y 1446CONFIG_JBD=y
1391# CONFIG_JBD_DEBUG is not set
1392CONFIG_FS_MBCACHE=y 1447CONFIG_FS_MBCACHE=y
1393# CONFIG_REISERFS_FS is not set 1448# CONFIG_REISERFS_FS is not set
1394# CONFIG_JFS_FS is not set 1449# CONFIG_JFS_FS is not set
@@ -1436,7 +1491,6 @@ CONFIG_TMPFS=y
1436# CONFIG_TMPFS_POSIX_ACL is not set 1491# CONFIG_TMPFS_POSIX_ACL is not set
1437CONFIG_HUGETLBFS=y 1492CONFIG_HUGETLBFS=y
1438CONFIG_HUGETLB_PAGE=y 1493CONFIG_HUGETLB_PAGE=y
1439CONFIG_RAMFS=y
1440CONFIG_CONFIGFS_FS=y 1494CONFIG_CONFIGFS_FS=y
1441 1495
1442# 1496#
@@ -1449,30 +1503,43 @@ CONFIG_CONFIGFS_FS=y
1449# CONFIG_BEFS_FS is not set 1503# CONFIG_BEFS_FS is not set
1450# CONFIG_BFS_FS is not set 1504# CONFIG_BFS_FS is not set
1451# CONFIG_EFS_FS is not set 1505# CONFIG_EFS_FS is not set
1452# CONFIG_JFFS2_FS is not set 1506CONFIG_JFFS2_FS=y
1507CONFIG_JFFS2_FS_DEBUG=0
1508CONFIG_JFFS2_FS_WRITEBUFFER=y
1509# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1510# CONFIG_JFFS2_SUMMARY is not set
1511# CONFIG_JFFS2_FS_XATTR is not set
1512# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1513CONFIG_JFFS2_ZLIB=y
1514# CONFIG_JFFS2_LZO is not set
1515CONFIG_JFFS2_RTIME=y
1516# CONFIG_JFFS2_RUBIN is not set
1453# CONFIG_CRAMFS is not set 1517# CONFIG_CRAMFS is not set
1454# CONFIG_VXFS_FS is not set 1518# CONFIG_VXFS_FS is not set
1455# CONFIG_HPFS_FS is not set 1519# CONFIG_HPFS_FS is not set
1456# CONFIG_QNX4FS_FS is not set 1520# CONFIG_QNX4FS_FS is not set
1457# CONFIG_SYSV_FS is not set 1521# CONFIG_SYSV_FS is not set
1458# CONFIG_UFS_FS is not set 1522# CONFIG_UFS_FS is not set
1459 1523CONFIG_NETWORK_FILESYSTEMS=y
1460#
1461# Network File Systems
1462#
1463CONFIG_NFS_FS=y 1524CONFIG_NFS_FS=y
1464CONFIG_NFS_V3=y 1525CONFIG_NFS_V3=y
1465# CONFIG_NFS_V3_ACL is not set 1526# CONFIG_NFS_V3_ACL is not set
1466# CONFIG_NFS_V4 is not set 1527# CONFIG_NFS_V4 is not set
1467# CONFIG_NFS_DIRECTIO is not set 1528# CONFIG_NFS_DIRECTIO is not set
1468# CONFIG_NFSD is not set 1529CONFIG_NFSD=y
1530CONFIG_NFSD_V3=y
1531# CONFIG_NFSD_V3_ACL is not set
1532CONFIG_NFSD_V4=y
1533CONFIG_NFSD_TCP=y
1469CONFIG_ROOT_NFS=y 1534CONFIG_ROOT_NFS=y
1470CONFIG_LOCKD=y 1535CONFIG_LOCKD=y
1471CONFIG_LOCKD_V4=y 1536CONFIG_LOCKD_V4=y
1537CONFIG_EXPORTFS=y
1472CONFIG_NFS_COMMON=y 1538CONFIG_NFS_COMMON=y
1473CONFIG_SUNRPC=y 1539CONFIG_SUNRPC=y
1540CONFIG_SUNRPC_GSS=y
1474# CONFIG_SUNRPC_BIND34 is not set 1541# CONFIG_SUNRPC_BIND34 is not set
1475# CONFIG_RPCSEC_GSS_KRB5 is not set 1542CONFIG_RPCSEC_GSS_KRB5=y
1476# CONFIG_RPCSEC_GSS_SPKM3 is not set 1543# CONFIG_RPCSEC_GSS_SPKM3 is not set
1477# CONFIG_SMB_FS is not set 1544# CONFIG_SMB_FS is not set
1478# CONFIG_CIFS is not set 1545# CONFIG_CIFS is not set
@@ -1501,10 +1568,6 @@ CONFIG_MSDOS_PARTITION=y
1501# CONFIG_KARMA_PARTITION is not set 1568# CONFIG_KARMA_PARTITION is not set
1502# CONFIG_EFI_PARTITION is not set 1569# CONFIG_EFI_PARTITION is not set
1503# CONFIG_SYSV68_PARTITION is not set 1570# CONFIG_SYSV68_PARTITION is not set
1504
1505#
1506# Native Language Support
1507#
1508CONFIG_NLS=y 1571CONFIG_NLS=y
1509CONFIG_NLS_DEFAULT="iso8859-1" 1572CONFIG_NLS_DEFAULT="iso8859-1"
1510CONFIG_NLS_CODEPAGE_437=y 1573CONFIG_NLS_CODEPAGE_437=y
@@ -1545,10 +1608,6 @@ CONFIG_NLS_ISO8859_1=y
1545# CONFIG_NLS_KOI8_R is not set 1608# CONFIG_NLS_KOI8_R is not set
1546# CONFIG_NLS_KOI8_U is not set 1609# CONFIG_NLS_KOI8_U is not set
1547# CONFIG_NLS_UTF8 is not set 1610# CONFIG_NLS_UTF8 is not set
1548
1549#
1550# Distributed Lock Manager
1551#
1552# CONFIG_DLM is not set 1611# CONFIG_DLM is not set
1553# CONFIG_UCC_SLOW is not set 1612# CONFIG_UCC_SLOW is not set
1554 1613
@@ -1561,23 +1620,24 @@ CONFIG_CRC_CCITT=y
1561# CONFIG_CRC_ITU_T is not set 1620# CONFIG_CRC_ITU_T is not set
1562CONFIG_CRC32=y 1621CONFIG_CRC32=y
1563# CONFIG_CRC7 is not set 1622# CONFIG_CRC7 is not set
1564# CONFIG_LIBCRC32C is not set 1623CONFIG_LIBCRC32C=m
1624CONFIG_ZLIB_INFLATE=y
1625CONFIG_ZLIB_DEFLATE=y
1565CONFIG_PLIST=y 1626CONFIG_PLIST=y
1566CONFIG_HAS_IOMEM=y 1627CONFIG_HAS_IOMEM=y
1567CONFIG_HAS_IOPORT=y 1628CONFIG_HAS_IOPORT=y
1568CONFIG_HAS_DMA=y 1629CONFIG_HAS_DMA=y
1569 1630CONFIG_INSTRUMENTATION=y
1570#
1571# Instrumentation Support
1572#
1573CONFIG_PROFILING=y 1631CONFIG_PROFILING=y
1574CONFIG_OPROFILE=y 1632CONFIG_OPROFILE=y
1575# CONFIG_KPROBES is not set 1633# CONFIG_KPROBES is not set
1634# CONFIG_MARKERS is not set
1576 1635
1577# 1636#
1578# Kernel hacking 1637# Kernel hacking
1579# 1638#
1580# CONFIG_PRINTK_TIME is not set 1639# CONFIG_PRINTK_TIME is not set
1640CONFIG_ENABLE_WARN_DEPRECATED=y
1581CONFIG_ENABLE_MUST_CHECK=y 1641CONFIG_ENABLE_MUST_CHECK=y
1582CONFIG_MAGIC_SYSRQ=y 1642CONFIG_MAGIC_SYSRQ=y
1583# CONFIG_UNUSED_SYMBOLS is not set 1643# CONFIG_UNUSED_SYMBOLS is not set
@@ -1586,7 +1646,7 @@ CONFIG_MAGIC_SYSRQ=y
1586CONFIG_DEBUG_KERNEL=y 1646CONFIG_DEBUG_KERNEL=y
1587# CONFIG_DEBUG_SHIRQ is not set 1647# CONFIG_DEBUG_SHIRQ is not set
1588CONFIG_DETECT_SOFTLOCKUP=y 1648CONFIG_DETECT_SOFTLOCKUP=y
1589CONFIG_SCHED_DEBUG=y 1649# CONFIG_SCHED_DEBUG is not set
1590# CONFIG_SCHEDSTATS is not set 1650# CONFIG_SCHEDSTATS is not set
1591# CONFIG_TIMER_STATS is not set 1651# CONFIG_TIMER_STATS is not set
1592# CONFIG_SLUB_DEBUG_ON is not set 1652# CONFIG_SLUB_DEBUG_ON is not set
@@ -1601,9 +1661,12 @@ CONFIG_DEBUG_BUGVERBOSE=y
1601# CONFIG_DEBUG_INFO is not set 1661# CONFIG_DEBUG_INFO is not set
1602# CONFIG_DEBUG_VM is not set 1662# CONFIG_DEBUG_VM is not set
1603# CONFIG_DEBUG_LIST is not set 1663# CONFIG_DEBUG_LIST is not set
1664# CONFIG_DEBUG_SG is not set
1604# CONFIG_FORCED_INLINING is not set 1665# CONFIG_FORCED_INLINING is not set
1666# CONFIG_BOOT_PRINTK_DELAY is not set
1605# CONFIG_RCU_TORTURE_TEST is not set 1667# CONFIG_RCU_TORTURE_TEST is not set
1606# CONFIG_FAULT_INJECTION is not set 1668# CONFIG_FAULT_INJECTION is not set
1669# CONFIG_SAMPLES is not set
1607# CONFIG_DEBUG_STACKOVERFLOW is not set 1670# CONFIG_DEBUG_STACKOVERFLOW is not set
1608# CONFIG_DEBUG_STACK_USAGE is not set 1671# CONFIG_DEBUG_STACK_USAGE is not set
1609# CONFIG_DEBUG_PAGEALLOC is not set 1672# CONFIG_DEBUG_PAGEALLOC is not set
@@ -1620,6 +1683,7 @@ CONFIG_XMON_DISASSEMBLY=y
1620# 1683#
1621# CONFIG_KEYS is not set 1684# CONFIG_KEYS is not set
1622# CONFIG_SECURITY is not set 1685# CONFIG_SECURITY is not set
1686# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1623CONFIG_CRYPTO=y 1687CONFIG_CRYPTO=y
1624CONFIG_CRYPTO_ALGAPI=y 1688CONFIG_CRYPTO_ALGAPI=y
1625CONFIG_CRYPTO_BLKCIPHER=y 1689CONFIG_CRYPTO_BLKCIPHER=y
@@ -1628,34 +1692,38 @@ CONFIG_CRYPTO_MANAGER=y
1628CONFIG_CRYPTO_HMAC=y 1692CONFIG_CRYPTO_HMAC=y
1629# CONFIG_CRYPTO_XCBC is not set 1693# CONFIG_CRYPTO_XCBC is not set
1630# CONFIG_CRYPTO_NULL is not set 1694# CONFIG_CRYPTO_NULL is not set
1631# CONFIG_CRYPTO_MD4 is not set 1695CONFIG_CRYPTO_MD4=y
1632CONFIG_CRYPTO_MD5=y 1696CONFIG_CRYPTO_MD5=y
1633CONFIG_CRYPTO_SHA1=y 1697CONFIG_CRYPTO_SHA1=y
1634# CONFIG_CRYPTO_SHA256 is not set 1698CONFIG_CRYPTO_SHA256=y
1635# CONFIG_CRYPTO_SHA512 is not set 1699CONFIG_CRYPTO_SHA512=y
1636# CONFIG_CRYPTO_WP512 is not set 1700# CONFIG_CRYPTO_WP512 is not set
1637# CONFIG_CRYPTO_TGR192 is not set 1701# CONFIG_CRYPTO_TGR192 is not set
1638# CONFIG_CRYPTO_GF128MUL is not set 1702# CONFIG_CRYPTO_GF128MUL is not set
1639CONFIG_CRYPTO_ECB=m 1703# CONFIG_CRYPTO_ECB is not set
1640CONFIG_CRYPTO_CBC=y 1704CONFIG_CRYPTO_CBC=y
1641CONFIG_CRYPTO_PCBC=m 1705# CONFIG_CRYPTO_PCBC is not set
1642# CONFIG_CRYPTO_LRW is not set 1706# CONFIG_CRYPTO_LRW is not set
1707# CONFIG_CRYPTO_XTS is not set
1643# CONFIG_CRYPTO_CRYPTD is not set 1708# CONFIG_CRYPTO_CRYPTD is not set
1644CONFIG_CRYPTO_DES=y 1709CONFIG_CRYPTO_DES=y
1645# CONFIG_CRYPTO_FCRYPT is not set 1710# CONFIG_CRYPTO_FCRYPT is not set
1646# CONFIG_CRYPTO_BLOWFISH is not set 1711CONFIG_CRYPTO_BLOWFISH=y
1647# CONFIG_CRYPTO_TWOFISH is not set 1712# CONFIG_CRYPTO_TWOFISH is not set
1648# CONFIG_CRYPTO_SERPENT is not set 1713# CONFIG_CRYPTO_SERPENT is not set
1649# CONFIG_CRYPTO_AES is not set 1714CONFIG_CRYPTO_AES=y
1650# CONFIG_CRYPTO_CAST5 is not set 1715# CONFIG_CRYPTO_CAST5 is not set
1651# CONFIG_CRYPTO_CAST6 is not set 1716# CONFIG_CRYPTO_CAST6 is not set
1652# CONFIG_CRYPTO_TEA is not set 1717# CONFIG_CRYPTO_TEA is not set
1653# CONFIG_CRYPTO_ARC4 is not set 1718# CONFIG_CRYPTO_ARC4 is not set
1654# CONFIG_CRYPTO_KHAZAD is not set 1719# CONFIG_CRYPTO_KHAZAD is not set
1655# CONFIG_CRYPTO_ANUBIS is not set 1720# CONFIG_CRYPTO_ANUBIS is not set
1721# CONFIG_CRYPTO_SEED is not set
1656# CONFIG_CRYPTO_DEFLATE is not set 1722# CONFIG_CRYPTO_DEFLATE is not set
1657# CONFIG_CRYPTO_MICHAEL_MIC is not set 1723# CONFIG_CRYPTO_MICHAEL_MIC is not set
1658# CONFIG_CRYPTO_CRC32C is not set 1724# CONFIG_CRYPTO_CRC32C is not set
1659# CONFIG_CRYPTO_CAMELLIA is not set 1725# CONFIG_CRYPTO_CAMELLIA is not set
1660# CONFIG_CRYPTO_TEST is not set 1726# CONFIG_CRYPTO_TEST is not set
1661# CONFIG_CRYPTO_HW is not set 1727# CONFIG_CRYPTO_AUTHENC is not set
1728CONFIG_CRYPTO_HW=y
1729# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 05582af50c5b..3e90c835fe12 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc4 3# Linux kernel version: 2.6.24-rc2
4# Thu Aug 30 16:47:09 2007 4# Tue Nov 6 23:43:56 2007
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7 7
@@ -11,6 +11,7 @@ CONFIG_PPC64=y
11# CONFIG_POWER4_ONLY is not set 11# CONFIG_POWER4_ONLY is not set
12CONFIG_POWER3=y 12CONFIG_POWER3=y
13CONFIG_POWER4=y 13CONFIG_POWER4=y
14# CONFIG_TUNE_CELL is not set
14CONFIG_PPC_FPU=y 15CONFIG_PPC_FPU=y
15CONFIG_ALTIVEC=y 16CONFIG_ALTIVEC=y
16CONFIG_PPC_STD_MMU=y 17CONFIG_PPC_STD_MMU=y
@@ -19,8 +20,13 @@ CONFIG_VIRT_CPU_ACCOUNTING=y
19CONFIG_SMP=y 20CONFIG_SMP=y
20CONFIG_NR_CPUS=32 21CONFIG_NR_CPUS=32
21CONFIG_64BIT=y 22CONFIG_64BIT=y
23CONFIG_WORD_SIZE=64
22CONFIG_PPC_MERGE=y 24CONFIG_PPC_MERGE=y
23CONFIG_MMU=y 25CONFIG_MMU=y
26CONFIG_GENERIC_CMOS_UPDATE=y
27CONFIG_GENERIC_TIME=y
28CONFIG_GENERIC_TIME_VSYSCALL=y
29CONFIG_GENERIC_CLOCKEVENTS=y
24CONFIG_GENERIC_HARDIRQS=y 30CONFIG_GENERIC_HARDIRQS=y
25CONFIG_IRQ_PER_CPU=y 31CONFIG_IRQ_PER_CPU=y
26CONFIG_RWSEM_XCHGADD_ALGORITHM=y 32CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -72,8 +78,15 @@ CONFIG_IKCONFIG=y
72CONFIG_IKCONFIG_PROC=y 78CONFIG_IKCONFIG_PROC=y
73CONFIG_LOG_BUF_SHIFT=17 79CONFIG_LOG_BUF_SHIFT=17
74CONFIG_CGROUPS=y 80CONFIG_CGROUPS=y
81# CONFIG_CGROUP_DEBUG is not set
82# CONFIG_CGROUP_NS is not set
83# CONFIG_CGROUP_CPUACCT is not set
75CONFIG_CPUSETS=y 84CONFIG_CPUSETS=y
85CONFIG_FAIR_GROUP_SCHED=y
86CONFIG_FAIR_USER_SCHED=y
87# CONFIG_FAIR_CGROUP_SCHED is not set
76CONFIG_SYSFS_DEPRECATED=y 88CONFIG_SYSFS_DEPRECATED=y
89CONFIG_PROC_PID_CPUSET=y
77CONFIG_RELAY=y 90CONFIG_RELAY=y
78CONFIG_BLK_DEV_INITRD=y 91CONFIG_BLK_DEV_INITRD=y
79CONFIG_INITRAMFS_SOURCE="" 92CONFIG_INITRAMFS_SOURCE=""
@@ -93,7 +106,6 @@ CONFIG_FUTEX=y
93CONFIG_ANON_INODES=y 106CONFIG_ANON_INODES=y
94CONFIG_EPOLL=y 107CONFIG_EPOLL=y
95CONFIG_SIGNALFD=y 108CONFIG_SIGNALFD=y
96CONFIG_TIMERFD=y
97CONFIG_EVENTFD=y 109CONFIG_EVENTFD=y
98CONFIG_SHMEM=y 110CONFIG_SHMEM=y
99CONFIG_VM_EVENT_COUNTERS=y 111CONFIG_VM_EVENT_COUNTERS=y
@@ -114,6 +126,7 @@ CONFIG_STOP_MACHINE=y
114CONFIG_BLOCK=y 126CONFIG_BLOCK=y
115CONFIG_BLK_DEV_IO_TRACE=y 127CONFIG_BLK_DEV_IO_TRACE=y
116CONFIG_BLK_DEV_BSG=y 128CONFIG_BLK_DEV_BSG=y
129CONFIG_BLOCK_COMPAT=y
117 130
118# 131#
119# IO Schedulers 132# IO Schedulers
@@ -132,7 +145,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
132# Platform support 145# Platform support
133# 146#
134CONFIG_PPC_MULTIPLATFORM=y 147CONFIG_PPC_MULTIPLATFORM=y
135# CONFIG_EMBEDDED6xx is not set
136# CONFIG_PPC_82xx is not set 148# CONFIG_PPC_82xx is not set
137# CONFIG_PPC_83xx is not set 149# CONFIG_PPC_83xx is not set
138# CONFIG_PPC_86xx is not set 150# CONFIG_PPC_86xx is not set
@@ -155,7 +167,15 @@ CONFIG_VIOPATH=y
155CONFIG_PPC_PMAC=y 167CONFIG_PPC_PMAC=y
156CONFIG_PPC_PMAC64=y 168CONFIG_PPC_PMAC64=y
157CONFIG_PPC_MAPLE=y 169CONFIG_PPC_MAPLE=y
158# CONFIG_PPC_PASEMI is not set 170CONFIG_PPC_PASEMI=y
171
172#
173# PA Semi PWRficient options
174#
175CONFIG_PPC_PASEMI_IOMMU=y
176# CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set
177CONFIG_PPC_PASEMI_MDIO=y
178CONFIG_ELECTRA_IDE=y
159CONFIG_PPC_CELLEB=y 179CONFIG_PPC_CELLEB=y
160# CONFIG_PPC_PS3 is not set 180# CONFIG_PPC_PS3 is not set
161CONFIG_PPC_CELL=y 181CONFIG_PPC_CELL=y
@@ -188,6 +208,7 @@ CONFIG_RTAS_FLASH=m
188CONFIG_PPC_PMI=m 208CONFIG_PPC_PMI=m
189CONFIG_MMIO_NVRAM=y 209CONFIG_MMIO_NVRAM=y
190CONFIG_MPIC_U3_HT_IRQS=y 210CONFIG_MPIC_U3_HT_IRQS=y
211CONFIG_MPIC_BROKEN_REGREAD=y
191CONFIG_IBMVIO=y 212CONFIG_IBMVIO=y
192# CONFIG_IBMEBUS is not set 213# CONFIG_IBMEBUS is not set
193# CONFIG_PPC_MPC106 is not set 214# CONFIG_PPC_MPC106 is not set
@@ -201,6 +222,8 @@ CONFIG_CPU_FREQ_STAT=y
201# CONFIG_CPU_FREQ_STAT_DETAILS is not set 222# CONFIG_CPU_FREQ_STAT_DETAILS is not set
202CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 223CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
203# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 224# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
225# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
226# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
204CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 227CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
205CONFIG_CPU_FREQ_GOV_POWERSAVE=y 228CONFIG_CPU_FREQ_GOV_POWERSAVE=y
206CONFIG_CPU_FREQ_GOV_USERSPACE=y 229CONFIG_CPU_FREQ_GOV_USERSPACE=y
@@ -211,6 +234,7 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y
211# CPU Frequency drivers 234# CPU Frequency drivers
212# 235#
213CONFIG_CPU_FREQ_PMAC64=y 236CONFIG_CPU_FREQ_PMAC64=y
237CONFIG_PPC_PASEMI_CPUFREQ=y
214# CONFIG_CPM2 is not set 238# CONFIG_CPM2 is not set
215CONFIG_AXON_RAM=m 239CONFIG_AXON_RAM=m
216# CONFIG_FSL_ULI1575 is not set 240# CONFIG_FSL_ULI1575 is not set
@@ -254,6 +278,8 @@ CONFIG_SPARSEMEM=y
254CONFIG_HAVE_MEMORY_PRESENT=y 278CONFIG_HAVE_MEMORY_PRESENT=y
255# CONFIG_SPARSEMEM_STATIC is not set 279# CONFIG_SPARSEMEM_STATIC is not set
256CONFIG_SPARSEMEM_EXTREME=y 280CONFIG_SPARSEMEM_EXTREME=y
281CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
282CONFIG_SPARSEMEM_VMEMMAP=y
257CONFIG_MEMORY_HOTPLUG=y 283CONFIG_MEMORY_HOTPLUG=y
258CONFIG_MEMORY_HOTPLUG_SPARSE=y 284CONFIG_MEMORY_HOTPLUG_SPARSE=y
259CONFIG_SPLIT_PTLOCK_CPUS=4 285CONFIG_SPLIT_PTLOCK_CPUS=4
@@ -268,6 +294,7 @@ CONFIG_PROC_DEVICETREE=y
268# CONFIG_CMDLINE_BOOL is not set 294# CONFIG_CMDLINE_BOOL is not set
269# CONFIG_PM is not set 295# CONFIG_PM is not set
270CONFIG_SUSPEND_SMP_POSSIBLE=y 296CONFIG_SUSPEND_SMP_POSSIBLE=y
297CONFIG_HIBERNATION_SMP_POSSIBLE=y
271CONFIG_SECCOMP=y 298CONFIG_SECCOMP=y
272# CONFIG_WANT_DEVICE_TREE is not set 299# CONFIG_WANT_DEVICE_TREE is not set
273CONFIG_ISA_DMA_API=y 300CONFIG_ISA_DMA_API=y
@@ -284,12 +311,22 @@ CONFIG_PCI_SYSCALL=y
284# CONFIG_PCIEPORTBUS is not set 311# CONFIG_PCIEPORTBUS is not set
285CONFIG_ARCH_SUPPORTS_MSI=y 312CONFIG_ARCH_SUPPORTS_MSI=y
286CONFIG_PCI_MSI=y 313CONFIG_PCI_MSI=y
314CONFIG_PCI_LEGACY=y
287# CONFIG_PCI_DEBUG is not set 315# CONFIG_PCI_DEBUG is not set
316CONFIG_PCCARD=y
317# CONFIG_PCMCIA_DEBUG is not set
318CONFIG_PCMCIA=y
319CONFIG_PCMCIA_LOAD_CIS=y
320CONFIG_PCMCIA_IOCTL=y
321CONFIG_CARDBUS=y
288 322
289# 323#
290# PCCARD (PCMCIA/CardBus) support 324# PC-card bridges
291# 325#
292# CONFIG_PCCARD is not set 326# CONFIG_YENTA is not set
327# CONFIG_PD6729 is not set
328# CONFIG_I82092 is not set
329CONFIG_ELECTRA_CF=y
293CONFIG_HOTPLUG_PCI=m 330CONFIG_HOTPLUG_PCI=m
294# CONFIG_HOTPLUG_PCI_FAKE is not set 331# CONFIG_HOTPLUG_PCI_FAKE is not set
295# CONFIG_HOTPLUG_PCI_CPCI is not set 332# CONFIG_HOTPLUG_PCI_CPCI is not set
@@ -319,7 +356,10 @@ CONFIG_INET=y
319CONFIG_IP_MULTICAST=y 356CONFIG_IP_MULTICAST=y
320# CONFIG_IP_ADVANCED_ROUTER is not set 357# CONFIG_IP_ADVANCED_ROUTER is not set
321CONFIG_IP_FIB_HASH=y 358CONFIG_IP_FIB_HASH=y
322# CONFIG_IP_PNP is not set 359CONFIG_IP_PNP=y
360CONFIG_IP_PNP_DHCP=y
361CONFIG_IP_PNP_BOOTP=y
362# CONFIG_IP_PNP_RARP is not set
323CONFIG_NET_IPIP=y 363CONFIG_NET_IPIP=y
324# CONFIG_NET_IPGRE is not set 364# CONFIG_NET_IPGRE is not set
325# CONFIG_IP_MROUTE is not set 365# CONFIG_IP_MROUTE is not set
@@ -333,6 +373,7 @@ CONFIG_INET_TUNNEL=y
333CONFIG_INET_XFRM_MODE_TRANSPORT=y 373CONFIG_INET_XFRM_MODE_TRANSPORT=y
334CONFIG_INET_XFRM_MODE_TUNNEL=y 374CONFIG_INET_XFRM_MODE_TUNNEL=y
335CONFIG_INET_XFRM_MODE_BEET=y 375CONFIG_INET_XFRM_MODE_BEET=y
376# CONFIG_INET_LRO is not set
336CONFIG_INET_DIAG=y 377CONFIG_INET_DIAG=y
337CONFIG_INET_TCP_DIAG=y 378CONFIG_INET_TCP_DIAG=y
338# CONFIG_TCP_CONG_ADVANCED is not set 379# CONFIG_TCP_CONG_ADVANCED is not set
@@ -404,6 +445,7 @@ CONFIG_NETFILTER_XT_MATCH_STATE=m
404CONFIG_NETFILTER_XT_MATCH_STATISTIC=m 445CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
405CONFIG_NETFILTER_XT_MATCH_STRING=m 446CONFIG_NETFILTER_XT_MATCH_STRING=m
406CONFIG_NETFILTER_XT_MATCH_TCPMSS=m 447CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
448# CONFIG_NETFILTER_XT_MATCH_TIME is not set
407CONFIG_NETFILTER_XT_MATCH_U32=m 449CONFIG_NETFILTER_XT_MATCH_U32=m
408CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 450CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
409 451
@@ -465,10 +507,6 @@ CONFIG_LLC=y
465# CONFIG_LAPB is not set 507# CONFIG_LAPB is not set
466# CONFIG_ECONET is not set 508# CONFIG_ECONET is not set
467# CONFIG_WAN_ROUTER is not set 509# CONFIG_WAN_ROUTER is not set
468
469#
470# QoS and/or fair queueing
471#
472# CONFIG_NET_SCHED is not set 510# CONFIG_NET_SCHED is not set
473CONFIG_NET_CLS_ROUTE=y 511CONFIG_NET_CLS_ROUTE=y
474 512
@@ -498,6 +536,7 @@ CONFIG_NET_CLS_ROUTE=y
498# 536#
499# Generic Driver Options 537# Generic Driver Options
500# 538#
539CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
501CONFIG_STANDALONE=y 540CONFIG_STANDALONE=y
502CONFIG_PREVENT_FIRMWARE_BUILD=y 541CONFIG_PREVENT_FIRMWARE_BUILD=y
503CONFIG_FW_LOADER=y 542CONFIG_FW_LOADER=y
@@ -539,6 +578,8 @@ CONFIG_BLK_DEV_IDE=y
539# CONFIG_BLK_DEV_IDE_SATA is not set 578# CONFIG_BLK_DEV_IDE_SATA is not set
540CONFIG_BLK_DEV_IDEDISK=y 579CONFIG_BLK_DEV_IDEDISK=y
541# CONFIG_IDEDISK_MULTI_MODE is not set 580# CONFIG_IDEDISK_MULTI_MODE is not set
581# CONFIG_BLK_DEV_IDECS is not set
582# CONFIG_BLK_DEV_DELKIN is not set
542CONFIG_BLK_DEV_IDECD=y 583CONFIG_BLK_DEV_IDECD=y
543# CONFIG_BLK_DEV_IDETAPE is not set 584# CONFIG_BLK_DEV_IDETAPE is not set
544# CONFIG_BLK_DEV_IDEFLOPPY is not set 585# CONFIG_BLK_DEV_IDEFLOPPY is not set
@@ -550,6 +591,11 @@ CONFIG_IDE_PROC_FS=y
550# IDE chipset support/bugfixes 591# IDE chipset support/bugfixes
551# 592#
552CONFIG_IDE_GENERIC=y 593CONFIG_IDE_GENERIC=y
594# CONFIG_BLK_DEV_PLATFORM is not set
595
596#
597# PCI IDE chipsets support
598#
553CONFIG_BLK_DEV_IDEPCI=y 599CONFIG_BLK_DEV_IDEPCI=y
554CONFIG_IDEPCI_SHARE_IRQ=y 600CONFIG_IDEPCI_SHARE_IRQ=y
555CONFIG_IDEPCI_PCIBUS_ORDER=y 601CONFIG_IDEPCI_PCIBUS_ORDER=y
@@ -557,8 +603,6 @@ CONFIG_IDEPCI_PCIBUS_ORDER=y
557CONFIG_BLK_DEV_GENERIC=y 603CONFIG_BLK_DEV_GENERIC=y
558# CONFIG_BLK_DEV_OPTI621 is not set 604# CONFIG_BLK_DEV_OPTI621 is not set
559CONFIG_BLK_DEV_IDEDMA_PCI=y 605CONFIG_BLK_DEV_IDEDMA_PCI=y
560# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
561# CONFIG_IDEDMA_ONLYDISK is not set
562# CONFIG_BLK_DEV_AEC62XX is not set 606# CONFIG_BLK_DEV_AEC62XX is not set
563# CONFIG_BLK_DEV_ALI15X3 is not set 607# CONFIG_BLK_DEV_ALI15X3 is not set
564CONFIG_BLK_DEV_AMD74XX=y 608CONFIG_BLK_DEV_AMD74XX=y
@@ -590,7 +634,7 @@ CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
590CONFIG_BLK_DEV_IDEDMA_PMAC=y 634CONFIG_BLK_DEV_IDEDMA_PMAC=y
591# CONFIG_IDE_ARM is not set 635# CONFIG_IDE_ARM is not set
592CONFIG_BLK_DEV_IDEDMA=y 636CONFIG_BLK_DEV_IDEDMA=y
593# CONFIG_IDEDMA_IVB is not set 637CONFIG_IDE_ARCH_OBSOLETE_INIT=y
594# CONFIG_BLK_DEV_HD is not set 638# CONFIG_BLK_DEV_HD is not set
595 639
596# 640#
@@ -631,6 +675,7 @@ CONFIG_SCSI_FC_ATTRS=y
631CONFIG_SCSI_ISCSI_ATTRS=m 675CONFIG_SCSI_ISCSI_ATTRS=m
632# CONFIG_SCSI_SAS_ATTRS is not set 676# CONFIG_SCSI_SAS_ATTRS is not set
633# CONFIG_SCSI_SAS_LIBSAS is not set 677# CONFIG_SCSI_SAS_LIBSAS is not set
678CONFIG_SCSI_SRP_ATTRS=y
634CONFIG_SCSI_LOWLEVEL=y 679CONFIG_SCSI_LOWLEVEL=y
635# CONFIG_ISCSI_TCP is not set 680# CONFIG_ISCSI_TCP is not set
636# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 681# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -671,19 +716,20 @@ CONFIG_SCSI_LPFC=m
671# CONFIG_SCSI_DC390T is not set 716# CONFIG_SCSI_DC390T is not set
672CONFIG_SCSI_DEBUG=m 717CONFIG_SCSI_DEBUG=m
673# CONFIG_SCSI_SRP is not set 718# CONFIG_SCSI_SRP is not set
719# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
674CONFIG_ATA=y 720CONFIG_ATA=y
675CONFIG_ATA_NONSTANDARD=y 721CONFIG_ATA_NONSTANDARD=y
676# CONFIG_SATA_AHCI is not set 722# CONFIG_SATA_AHCI is not set
677CONFIG_SATA_SVW=y 723CONFIG_SATA_SVW=y
678# CONFIG_ATA_PIIX is not set 724# CONFIG_ATA_PIIX is not set
679# CONFIG_SATA_MV is not set 725CONFIG_SATA_MV=y
680# CONFIG_SATA_NV is not set 726# CONFIG_SATA_NV is not set
681# CONFIG_PDC_ADMA is not set 727# CONFIG_PDC_ADMA is not set
682# CONFIG_SATA_QSTOR is not set 728# CONFIG_SATA_QSTOR is not set
683# CONFIG_SATA_PROMISE is not set 729# CONFIG_SATA_PROMISE is not set
684# CONFIG_SATA_SX4 is not set 730# CONFIG_SATA_SX4 is not set
685# CONFIG_SATA_SIL is not set 731# CONFIG_SATA_SIL is not set
686# CONFIG_SATA_SIL24 is not set 732CONFIG_SATA_SIL24=y
687# CONFIG_SATA_SIS is not set 733# CONFIG_SATA_SIS is not set
688# CONFIG_SATA_ULI is not set 734# CONFIG_SATA_ULI is not set
689# CONFIG_SATA_VIA is not set 735# CONFIG_SATA_VIA is not set
@@ -713,8 +759,10 @@ CONFIG_SATA_SVW=y
713# CONFIG_PATA_OLDPIIX is not set 759# CONFIG_PATA_OLDPIIX is not set
714# CONFIG_PATA_NETCELL is not set 760# CONFIG_PATA_NETCELL is not set
715# CONFIG_PATA_NS87410 is not set 761# CONFIG_PATA_NS87410 is not set
762# CONFIG_PATA_NS87415 is not set
716# CONFIG_PATA_OPTI is not set 763# CONFIG_PATA_OPTI is not set
717# CONFIG_PATA_OPTIDMA is not set 764# CONFIG_PATA_OPTIDMA is not set
765CONFIG_PATA_PCMCIA=y
718# CONFIG_PATA_PDC_OLD is not set 766# CONFIG_PATA_PDC_OLD is not set
719# CONFIG_PATA_RADISYS is not set 767# CONFIG_PATA_RADISYS is not set
720# CONFIG_PATA_RZ1000 is not set 768# CONFIG_PATA_RZ1000 is not set
@@ -725,6 +773,7 @@ CONFIG_SATA_SVW=y
725# CONFIG_PATA_SIS is not set 773# CONFIG_PATA_SIS is not set
726# CONFIG_PATA_VIA is not set 774# CONFIG_PATA_VIA is not set
727CONFIG_PATA_WINBOND=y 775CONFIG_PATA_WINBOND=y
776CONFIG_PATA_PLATFORM=y
728CONFIG_PATA_SCC=y 777CONFIG_PATA_SCC=y
729CONFIG_MD=y 778CONFIG_MD=y
730CONFIG_BLK_DEV_MD=y 779CONFIG_BLK_DEV_MD=y
@@ -745,15 +794,10 @@ CONFIG_DM_ZERO=m
745CONFIG_DM_MULTIPATH=m 794CONFIG_DM_MULTIPATH=m
746CONFIG_DM_MULTIPATH_EMC=m 795CONFIG_DM_MULTIPATH_EMC=m
747# CONFIG_DM_MULTIPATH_RDAC is not set 796# CONFIG_DM_MULTIPATH_RDAC is not set
797# CONFIG_DM_MULTIPATH_HP is not set
748# CONFIG_DM_DELAY is not set 798# CONFIG_DM_DELAY is not set
749 799# CONFIG_DM_UEVENT is not set
750#
751# Fusion MPT device support
752#
753# CONFIG_FUSION is not set 800# CONFIG_FUSION is not set
754# CONFIG_FUSION_SPI is not set
755# CONFIG_FUSION_FC is not set
756# CONFIG_FUSION_SAS is not set
757 801
758# 802#
759# IEEE 1394 (FireWire) support 803# IEEE 1394 (FireWire) support
@@ -800,13 +844,15 @@ CONFIG_BONDING=m
800# CONFIG_MACVLAN is not set 844# CONFIG_MACVLAN is not set
801# CONFIG_EQUALIZER is not set 845# CONFIG_EQUALIZER is not set
802CONFIG_TUN=m 846CONFIG_TUN=m
847# CONFIG_VETH is not set
848# CONFIG_IP1000 is not set
803# CONFIG_ARCNET is not set 849# CONFIG_ARCNET is not set
804CONFIG_PHYLIB=m 850CONFIG_PHYLIB=y
805 851
806# 852#
807# MII PHY device drivers 853# MII PHY device drivers
808# 854#
809CONFIG_MARVELL_PHY=m 855CONFIG_MARVELL_PHY=y
810# CONFIG_DAVICOM_PHY is not set 856# CONFIG_DAVICOM_PHY is not set
811# CONFIG_QSEMI_PHY is not set 857# CONFIG_QSEMI_PHY is not set
812# CONFIG_LXT_PHY is not set 858# CONFIG_LXT_PHY is not set
@@ -818,6 +864,9 @@ CONFIG_BROADCOM_PHY=m
818CONFIG_FIXED_PHY=m 864CONFIG_FIXED_PHY=m
819CONFIG_FIXED_MII_10_FDX=y 865CONFIG_FIXED_MII_10_FDX=y
820CONFIG_FIXED_MII_100_FDX=y 866CONFIG_FIXED_MII_100_FDX=y
867# CONFIG_FIXED_MII_1000_FDX is not set
868CONFIG_FIXED_MII_AMNT=1
869# CONFIG_MDIO_BITBANG is not set
821CONFIG_NET_ETHERNET=y 870CONFIG_NET_ETHERNET=y
822CONFIG_MII=y 871CONFIG_MII=y
823# CONFIG_HAPPYMEAL is not set 872# CONFIG_HAPPYMEAL is not set
@@ -829,6 +878,11 @@ CONFIG_VORTEX=y
829# CONFIG_NET_TULIP is not set 878# CONFIG_NET_TULIP is not set
830# CONFIG_HP100 is not set 879# CONFIG_HP100 is not set
831CONFIG_IBMVETH=m 880CONFIG_IBMVETH=m
881# CONFIG_IBM_NEW_EMAC is not set
882CONFIG_IBM_NEW_EMAC_ZMII=y
883CONFIG_IBM_NEW_EMAC_RGMII=y
884CONFIG_IBM_NEW_EMAC_TAH=y
885CONFIG_IBM_NEW_EMAC_EMAC4=y
832CONFIG_NET_PCI=y 886CONFIG_NET_PCI=y
833CONFIG_PCNET32=y 887CONFIG_PCNET32=y
834# CONFIG_PCNET32_NAPI is not set 888# CONFIG_PCNET32_NAPI is not set
@@ -836,7 +890,6 @@ CONFIG_PCNET32=y
836# CONFIG_ADAPTEC_STARFIRE is not set 890# CONFIG_ADAPTEC_STARFIRE is not set
837# CONFIG_B44 is not set 891# CONFIG_B44 is not set
838# CONFIG_FORCEDETH is not set 892# CONFIG_FORCEDETH is not set
839# CONFIG_DGRS is not set
840# CONFIG_EEPRO100 is not set 893# CONFIG_EEPRO100 is not set
841CONFIG_E100=y 894CONFIG_E100=y
842# CONFIG_FEALNX is not set 895# CONFIG_FEALNX is not set
@@ -856,6 +909,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
856CONFIG_E1000=y 909CONFIG_E1000=y
857# CONFIG_E1000_NAPI is not set 910# CONFIG_E1000_NAPI is not set
858# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 911# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
912# CONFIG_E1000E is not set
859# CONFIG_NS83820 is not set 913# CONFIG_NS83820 is not set
860# CONFIG_HAMACHI is not set 914# CONFIG_HAMACHI is not set
861# CONFIG_YELLOWFIN is not set 915# CONFIG_YELLOWFIN is not set
@@ -863,6 +917,7 @@ CONFIG_E1000=y
863# CONFIG_SIS190 is not set 917# CONFIG_SIS190 is not set
864# CONFIG_SKGE is not set 918# CONFIG_SKGE is not set
865# CONFIG_SKY2 is not set 919# CONFIG_SKY2 is not set
920# CONFIG_SK98LIN is not set
866# CONFIG_VIA_VELOCITY is not set 921# CONFIG_VIA_VELOCITY is not set
867CONFIG_TIGON3=y 922CONFIG_TIGON3=y
868# CONFIG_BNX2 is not set 923# CONFIG_BNX2 is not set
@@ -872,13 +927,16 @@ CONFIG_SPIDER_NET=m
872CONFIG_NETDEV_10000=y 927CONFIG_NETDEV_10000=y
873# CONFIG_CHELSIO_T1 is not set 928# CONFIG_CHELSIO_T1 is not set
874# CONFIG_CHELSIO_T3 is not set 929# CONFIG_CHELSIO_T3 is not set
930# CONFIG_IXGBE is not set
875CONFIG_IXGB=m 931CONFIG_IXGB=m
876# CONFIG_IXGB_NAPI is not set 932# CONFIG_IXGB_NAPI is not set
877# CONFIG_S2IO is not set 933# CONFIG_S2IO is not set
878# CONFIG_MYRI10GE is not set 934# CONFIG_MYRI10GE is not set
879# CONFIG_NETXEN_NIC is not set 935# CONFIG_NETXEN_NIC is not set
880CONFIG_PASEMI_MAC=m 936# CONFIG_NIU is not set
937CONFIG_PASEMI_MAC=y
881# CONFIG_MLX4_CORE is not set 938# CONFIG_MLX4_CORE is not set
939# CONFIG_TEHUTI is not set
882CONFIG_TR=y 940CONFIG_TR=y
883CONFIG_IBMOL=y 941CONFIG_IBMOL=y
884# CONFIG_3C359 is not set 942# CONFIG_3C359 is not set
@@ -899,6 +957,7 @@ CONFIG_IBMOL=y
899# CONFIG_USB_RTL8150 is not set 957# CONFIG_USB_RTL8150 is not set
900# CONFIG_USB_USBNET_MII is not set 958# CONFIG_USB_USBNET_MII is not set
901# CONFIG_USB_USBNET is not set 959# CONFIG_USB_USBNET is not set
960# CONFIG_NET_PCMCIA is not set
902# CONFIG_WAN is not set 961# CONFIG_WAN is not set
903CONFIG_ISERIES_VETH=m 962CONFIG_ISERIES_VETH=m
904# CONFIG_FDDI is not set 963# CONFIG_FDDI is not set
@@ -918,6 +977,7 @@ CONFIG_SLHC=m
918# CONFIG_NET_FC is not set 977# CONFIG_NET_FC is not set
919# CONFIG_SHAPER is not set 978# CONFIG_SHAPER is not set
920CONFIG_NETCONSOLE=y 979CONFIG_NETCONSOLE=y
980# CONFIG_NETCONSOLE_DYNAMIC is not set
921CONFIG_NETPOLL=y 981CONFIG_NETPOLL=y
922CONFIG_NETPOLL_TRAP=y 982CONFIG_NETPOLL_TRAP=y
923CONFIG_NET_POLL_CONTROLLER=y 983CONFIG_NET_POLL_CONTROLLER=y
@@ -939,7 +999,6 @@ CONFIG_INPUT_MOUSEDEV=y
939CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 999CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
940CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 1000CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
941# CONFIG_INPUT_JOYDEV is not set 1001# CONFIG_INPUT_JOYDEV is not set
942# CONFIG_INPUT_TSDEV is not set
943CONFIG_INPUT_EVDEV=m 1002CONFIG_INPUT_EVDEV=m
944# CONFIG_INPUT_EVBUG is not set 1003# CONFIG_INPUT_EVBUG is not set
945 1004
@@ -1002,6 +1061,7 @@ CONFIG_HW_CONSOLE=y
1002CONFIG_SERIAL_8250=y 1061CONFIG_SERIAL_8250=y
1003CONFIG_SERIAL_8250_CONSOLE=y 1062CONFIG_SERIAL_8250_CONSOLE=y
1004CONFIG_SERIAL_8250_PCI=y 1063CONFIG_SERIAL_8250_PCI=y
1064# CONFIG_SERIAL_8250_CS is not set
1005CONFIG_SERIAL_8250_NR_UARTS=4 1065CONFIG_SERIAL_8250_NR_UARTS=4
1006CONFIG_SERIAL_8250_RUNTIME_UARTS=4 1066CONFIG_SERIAL_8250_RUNTIME_UARTS=4
1007# CONFIG_SERIAL_8250_EXTENDED is not set 1067# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -1029,14 +1089,18 @@ CONFIG_HVC_RTAS=y
1029CONFIG_HVC_BEAT=y 1089CONFIG_HVC_BEAT=y
1030CONFIG_HVCS=m 1090CONFIG_HVCS=m
1031# CONFIG_IPMI_HANDLER is not set 1091# CONFIG_IPMI_HANDLER is not set
1032# CONFIG_WATCHDOG is not set
1033# CONFIG_HW_RANDOM is not set 1092# CONFIG_HW_RANDOM is not set
1034CONFIG_GEN_RTC=y 1093CONFIG_GEN_RTC=y
1035# CONFIG_GEN_RTC_X is not set 1094# CONFIG_GEN_RTC_X is not set
1036# CONFIG_R3964 is not set 1095# CONFIG_R3964 is not set
1037# CONFIG_APPLICOM is not set 1096# CONFIG_APPLICOM is not set
1038# CONFIG_AGP is not set 1097
1039# CONFIG_DRM is not set 1098#
1099# PCMCIA character devices
1100#
1101# CONFIG_SYNCLINK_CS is not set
1102# CONFIG_CARDMAN_4000 is not set
1103# CONFIG_CARDMAN_4040 is not set
1040CONFIG_RAW_DRIVER=y 1104CONFIG_RAW_DRIVER=y
1041CONFIG_MAX_RAW_DEVS=256 1105CONFIG_MAX_RAW_DEVS=256
1042# CONFIG_HANGCHECK_TIMER is not set 1106# CONFIG_HANGCHECK_TIMER is not set
@@ -1068,6 +1132,7 @@ CONFIG_I2C_POWERMAC=y
1068# CONFIG_I2C_NFORCE2 is not set 1132# CONFIG_I2C_NFORCE2 is not set
1069# CONFIG_I2C_OCORES is not set 1133# CONFIG_I2C_OCORES is not set
1070# CONFIG_I2C_PARPORT_LIGHT is not set 1134# CONFIG_I2C_PARPORT_LIGHT is not set
1135CONFIG_I2C_PASEMI=y
1071# CONFIG_I2C_PROSAVAGE is not set 1136# CONFIG_I2C_PROSAVAGE is not set
1072# CONFIG_I2C_SAVAGE4 is not set 1137# CONFIG_I2C_SAVAGE4 is not set
1073# CONFIG_I2C_SIMTEC is not set 1138# CONFIG_I2C_SIMTEC is not set
@@ -1106,6 +1171,13 @@ CONFIG_I2C_POWERMAC=y
1106# CONFIG_W1 is not set 1171# CONFIG_W1 is not set
1107# CONFIG_POWER_SUPPLY is not set 1172# CONFIG_POWER_SUPPLY is not set
1108# CONFIG_HWMON is not set 1173# CONFIG_HWMON is not set
1174# CONFIG_WATCHDOG is not set
1175
1176#
1177# Sonics Silicon Backplane
1178#
1179CONFIG_SSB_POSSIBLE=y
1180# CONFIG_SSB is not set
1109 1181
1110# 1182#
1111# Multifunction device drivers 1183# Multifunction device drivers
@@ -1122,18 +1194,8 @@ CONFIG_I2C_POWERMAC=y
1122# 1194#
1123# Graphics support 1195# Graphics support
1124# 1196#
1125CONFIG_BACKLIGHT_LCD_SUPPORT=y 1197# CONFIG_AGP is not set
1126CONFIG_LCD_CLASS_DEVICE=y 1198# CONFIG_DRM is not set
1127CONFIG_BACKLIGHT_CLASS_DEVICE=y
1128
1129#
1130# Display device support
1131#
1132CONFIG_DISPLAY_SUPPORT=y
1133
1134#
1135# Display hardware drivers
1136#
1137# CONFIG_VGASTATE is not set 1199# CONFIG_VGASTATE is not set
1138CONFIG_VIDEO_OUTPUT_CONTROL=m 1200CONFIG_VIDEO_OUTPUT_CONTROL=m
1139CONFIG_FB=y 1201CONFIG_FB=y
@@ -1142,6 +1204,7 @@ CONFIG_FB_DDC=y
1142CONFIG_FB_CFB_FILLRECT=y 1204CONFIG_FB_CFB_FILLRECT=y
1143CONFIG_FB_CFB_COPYAREA=y 1205CONFIG_FB_CFB_COPYAREA=y
1144CONFIG_FB_CFB_IMAGEBLIT=y 1206CONFIG_FB_CFB_IMAGEBLIT=y
1207# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1145# CONFIG_FB_SYS_FILLRECT is not set 1208# CONFIG_FB_SYS_FILLRECT is not set
1146# CONFIG_FB_SYS_COPYAREA is not set 1209# CONFIG_FB_SYS_COPYAREA is not set
1147# CONFIG_FB_SYS_IMAGEBLIT is not set 1210# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -1192,6 +1255,19 @@ CONFIG_FB_RADEON_BACKLIGHT=y
1192# CONFIG_FB_PM3 is not set 1255# CONFIG_FB_PM3 is not set
1193CONFIG_FB_IBM_GXT4500=y 1256CONFIG_FB_IBM_GXT4500=y
1194# CONFIG_FB_VIRTUAL is not set 1257# CONFIG_FB_VIRTUAL is not set
1258CONFIG_BACKLIGHT_LCD_SUPPORT=y
1259CONFIG_LCD_CLASS_DEVICE=y
1260CONFIG_BACKLIGHT_CLASS_DEVICE=y
1261# CONFIG_BACKLIGHT_CORGI is not set
1262
1263#
1264# Display device support
1265#
1266CONFIG_DISPLAY_SUPPORT=y
1267
1268#
1269# Display hardware drivers
1270#
1195 1271
1196# 1272#
1197# Console display driver support 1273# Console display driver support
@@ -1333,6 +1409,12 @@ CONFIG_SND_AOA_SOUNDBUS_I2S=m
1333# CONFIG_SND_USB_CAIAQ is not set 1409# CONFIG_SND_USB_CAIAQ is not set
1334 1410
1335# 1411#
1412# PCMCIA devices
1413#
1414# CONFIG_SND_VXPOCKET is not set
1415# CONFIG_SND_PDAUDIOCF is not set
1416
1417#
1336# System on Chip audio support 1418# System on Chip audio support
1337# 1419#
1338# CONFIG_SND_SOC is not set 1420# CONFIG_SND_SOC is not set
@@ -1348,6 +1430,7 @@ CONFIG_SND_AOA_SOUNDBUS_I2S=m
1348CONFIG_HID_SUPPORT=y 1430CONFIG_HID_SUPPORT=y
1349CONFIG_HID=y 1431CONFIG_HID=y
1350# CONFIG_HID_DEBUG is not set 1432# CONFIG_HID_DEBUG is not set
1433# CONFIG_HIDRAW is not set
1351 1434
1352# 1435#
1353# USB Input Devices 1436# USB Input Devices
@@ -1489,19 +1572,53 @@ CONFIG_EDAC=y
1489# 1572#
1490# CONFIG_EDAC_DEBUG is not set 1573# CONFIG_EDAC_DEBUG is not set
1491CONFIG_EDAC_MM_EDAC=y 1574CONFIG_EDAC_MM_EDAC=y
1492# CONFIG_RTC_CLASS is not set 1575CONFIG_EDAC_PASEMI=y
1576CONFIG_RTC_LIB=y
1577CONFIG_RTC_CLASS=y
1578CONFIG_RTC_HCTOSYS=y
1579CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1580# CONFIG_RTC_DEBUG is not set
1581
1582#
1583# RTC interfaces
1584#
1585CONFIG_RTC_INTF_SYSFS=y
1586CONFIG_RTC_INTF_PROC=y
1587CONFIG_RTC_INTF_DEV=y
1588# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1589# CONFIG_RTC_DRV_TEST is not set
1590
1591#
1592# I2C RTC drivers
1593#
1594CONFIG_RTC_DRV_DS1307=y
1595# CONFIG_RTC_DRV_DS1374 is not set
1596# CONFIG_RTC_DRV_DS1672 is not set
1597# CONFIG_RTC_DRV_MAX6900 is not set
1598# CONFIG_RTC_DRV_RS5C372 is not set
1599# CONFIG_RTC_DRV_ISL1208 is not set
1600# CONFIG_RTC_DRV_X1205 is not set
1601# CONFIG_RTC_DRV_PCF8563 is not set
1602# CONFIG_RTC_DRV_PCF8583 is not set
1603# CONFIG_RTC_DRV_M41T80 is not set
1493 1604
1494# 1605#
1495# DMA Engine support 1606# SPI RTC drivers
1496# 1607#
1497# CONFIG_DMA_ENGINE is not set
1498 1608
1499# 1609#
1500# DMA Clients 1610# Platform RTC drivers
1501# 1611#
1612# CONFIG_RTC_DRV_CMOS is not set
1613# CONFIG_RTC_DRV_DS1553 is not set
1614# CONFIG_RTC_DRV_STK17TA8 is not set
1615# CONFIG_RTC_DRV_DS1742 is not set
1616# CONFIG_RTC_DRV_M48T86 is not set
1617# CONFIG_RTC_DRV_M48T59 is not set
1618# CONFIG_RTC_DRV_V3020 is not set
1502 1619
1503# 1620#
1504# DMA Devices 1621# on-CPU RTC drivers
1505# 1622#
1506 1623
1507# 1624#
@@ -1585,7 +1702,6 @@ CONFIG_TMPFS=y
1585# CONFIG_TMPFS_POSIX_ACL is not set 1702# CONFIG_TMPFS_POSIX_ACL is not set
1586CONFIG_HUGETLBFS=y 1703CONFIG_HUGETLBFS=y
1587CONFIG_HUGETLB_PAGE=y 1704CONFIG_HUGETLB_PAGE=y
1588CONFIG_RAMFS=y
1589# CONFIG_CONFIGFS_FS is not set 1705# CONFIG_CONFIGFS_FS is not set
1590 1706
1591# 1707#
@@ -1604,10 +1720,7 @@ CONFIG_CRAMFS=y
1604# CONFIG_QNX4FS_FS is not set 1720# CONFIG_QNX4FS_FS is not set
1605# CONFIG_SYSV_FS is not set 1721# CONFIG_SYSV_FS is not set
1606# CONFIG_UFS_FS is not set 1722# CONFIG_UFS_FS is not set
1607 1723CONFIG_NETWORK_FILESYSTEMS=y
1608#
1609# Network File Systems
1610#
1611CONFIG_NFS_FS=y 1724CONFIG_NFS_FS=y
1612CONFIG_NFS_V3=y 1725CONFIG_NFS_V3=y
1613CONFIG_NFS_V3_ACL=y 1726CONFIG_NFS_V3_ACL=y
@@ -1619,6 +1732,7 @@ CONFIG_NFSD_V3=y
1619CONFIG_NFSD_V3_ACL=y 1732CONFIG_NFSD_V3_ACL=y
1620CONFIG_NFSD_V4=y 1733CONFIG_NFSD_V4=y
1621CONFIG_NFSD_TCP=y 1734CONFIG_NFSD_TCP=y
1735CONFIG_ROOT_NFS=y
1622CONFIG_LOCKD=y 1736CONFIG_LOCKD=y
1623CONFIG_LOCKD_V4=y 1737CONFIG_LOCKD_V4=y
1624CONFIG_EXPORTFS=m 1738CONFIG_EXPORTFS=m
@@ -1626,6 +1740,7 @@ CONFIG_NFS_ACL_SUPPORT=y
1626CONFIG_NFS_COMMON=y 1740CONFIG_NFS_COMMON=y
1627CONFIG_SUNRPC=y 1741CONFIG_SUNRPC=y
1628CONFIG_SUNRPC_GSS=y 1742CONFIG_SUNRPC_GSS=y
1743CONFIG_SUNRPC_XPRT_RDMA=m
1629# CONFIG_SUNRPC_BIND34 is not set 1744# CONFIG_SUNRPC_BIND34 is not set
1630CONFIG_RPCSEC_GSS_KRB5=y 1745CONFIG_RPCSEC_GSS_KRB5=y
1631CONFIG_RPCSEC_GSS_SPKM3=m 1746CONFIG_RPCSEC_GSS_SPKM3=m
@@ -1662,10 +1777,6 @@ CONFIG_MSDOS_PARTITION=y
1662# CONFIG_KARMA_PARTITION is not set 1777# CONFIG_KARMA_PARTITION is not set
1663# CONFIG_EFI_PARTITION is not set 1778# CONFIG_EFI_PARTITION is not set
1664# CONFIG_SYSV68_PARTITION is not set 1779# CONFIG_SYSV68_PARTITION is not set
1665
1666#
1667# Native Language Support
1668#
1669CONFIG_NLS=y 1780CONFIG_NLS=y
1670CONFIG_NLS_DEFAULT="iso8859-1" 1781CONFIG_NLS_DEFAULT="iso8859-1"
1671CONFIG_NLS_CODEPAGE_437=y 1782CONFIG_NLS_CODEPAGE_437=y
@@ -1706,10 +1817,6 @@ CONFIG_NLS_ISO8859_15=m
1706CONFIG_NLS_KOI8_R=m 1817CONFIG_NLS_KOI8_R=m
1707CONFIG_NLS_KOI8_U=m 1818CONFIG_NLS_KOI8_U=m
1708CONFIG_NLS_UTF8=m 1819CONFIG_NLS_UTF8=m
1709
1710#
1711# Distributed Lock Manager
1712#
1713# CONFIG_DLM is not set 1820# CONFIG_DLM is not set
1714# CONFIG_UCC_SLOW is not set 1821# CONFIG_UCC_SLOW is not set
1715 1822
@@ -1733,18 +1840,17 @@ CONFIG_PLIST=y
1733CONFIG_HAS_IOMEM=y 1840CONFIG_HAS_IOMEM=y
1734CONFIG_HAS_IOPORT=y 1841CONFIG_HAS_IOPORT=y
1735CONFIG_HAS_DMA=y 1842CONFIG_HAS_DMA=y
1736 1843CONFIG_INSTRUMENTATION=y
1737#
1738# Instrumentation Support
1739#
1740CONFIG_PROFILING=y 1844CONFIG_PROFILING=y
1741CONFIG_OPROFILE=y 1845CONFIG_OPROFILE=y
1742# CONFIG_KPROBES is not set 1846# CONFIG_KPROBES is not set
1847# CONFIG_MARKERS is not set
1743 1848
1744# 1849#
1745# Kernel hacking 1850# Kernel hacking
1746# 1851#
1747# CONFIG_PRINTK_TIME is not set 1852# CONFIG_PRINTK_TIME is not set
1853CONFIG_ENABLE_WARN_DEPRECATED=y
1748CONFIG_ENABLE_MUST_CHECK=y 1854CONFIG_ENABLE_MUST_CHECK=y
1749CONFIG_MAGIC_SYSRQ=y 1855CONFIG_MAGIC_SYSRQ=y
1750# CONFIG_UNUSED_SYMBOLS is not set 1856# CONFIG_UNUSED_SYMBOLS is not set
@@ -1768,9 +1874,12 @@ CONFIG_DEBUG_BUGVERBOSE=y
1768# CONFIG_DEBUG_INFO is not set 1874# CONFIG_DEBUG_INFO is not set
1769# CONFIG_DEBUG_VM is not set 1875# CONFIG_DEBUG_VM is not set
1770# CONFIG_DEBUG_LIST is not set 1876# CONFIG_DEBUG_LIST is not set
1877# CONFIG_DEBUG_SG is not set
1771CONFIG_FORCED_INLINING=y 1878CONFIG_FORCED_INLINING=y
1879# CONFIG_BOOT_PRINTK_DELAY is not set
1772# CONFIG_RCU_TORTURE_TEST is not set 1880# CONFIG_RCU_TORTURE_TEST is not set
1773# CONFIG_FAULT_INJECTION is not set 1881# CONFIG_FAULT_INJECTION is not set
1882# CONFIG_SAMPLES is not set
1774CONFIG_DEBUG_STACKOVERFLOW=y 1883CONFIG_DEBUG_STACKOVERFLOW=y
1775CONFIG_DEBUG_STACK_USAGE=y 1884CONFIG_DEBUG_STACK_USAGE=y
1776# CONFIG_DEBUG_PAGEALLOC is not set 1885# CONFIG_DEBUG_PAGEALLOC is not set
@@ -1780,6 +1889,7 @@ CONFIG_XMON=y
1780# CONFIG_XMON_DEFAULT is not set 1889# CONFIG_XMON_DEFAULT is not set
1781CONFIG_XMON_DISASSEMBLY=y 1890CONFIG_XMON_DISASSEMBLY=y
1782CONFIG_IRQSTACKS=y 1891CONFIG_IRQSTACKS=y
1892# CONFIG_VIRQ_DEBUG is not set
1783CONFIG_BOOTX_TEXT=y 1893CONFIG_BOOTX_TEXT=y
1784# CONFIG_PPC_EARLY_DEBUG is not set 1894# CONFIG_PPC_EARLY_DEBUG is not set
1785 1895
@@ -1788,6 +1898,7 @@ CONFIG_BOOTX_TEXT=y
1788# 1898#
1789# CONFIG_KEYS is not set 1899# CONFIG_KEYS is not set
1790# CONFIG_SECURITY is not set 1900# CONFIG_SECURITY is not set
1901# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1791CONFIG_XOR_BLOCKS=y 1902CONFIG_XOR_BLOCKS=y
1792CONFIG_ASYNC_CORE=y 1903CONFIG_ASYNC_CORE=y
1793CONFIG_ASYNC_MEMCPY=y 1904CONFIG_ASYNC_MEMCPY=y
@@ -1812,6 +1923,7 @@ CONFIG_CRYPTO_ECB=m
1812CONFIG_CRYPTO_CBC=y 1923CONFIG_CRYPTO_CBC=y
1813CONFIG_CRYPTO_PCBC=m 1924CONFIG_CRYPTO_PCBC=m
1814# CONFIG_CRYPTO_LRW is not set 1925# CONFIG_CRYPTO_LRW is not set
1926# CONFIG_CRYPTO_XTS is not set
1815# CONFIG_CRYPTO_CRYPTD is not set 1927# CONFIG_CRYPTO_CRYPTD is not set
1816CONFIG_CRYPTO_DES=y 1928CONFIG_CRYPTO_DES=y
1817# CONFIG_CRYPTO_FCRYPT is not set 1929# CONFIG_CRYPTO_FCRYPT is not set
@@ -1826,9 +1938,12 @@ CONFIG_CRYPTO_TEA=m
1826CONFIG_CRYPTO_ARC4=m 1938CONFIG_CRYPTO_ARC4=m
1827CONFIG_CRYPTO_KHAZAD=m 1939CONFIG_CRYPTO_KHAZAD=m
1828CONFIG_CRYPTO_ANUBIS=m 1940CONFIG_CRYPTO_ANUBIS=m
1941# CONFIG_CRYPTO_SEED is not set
1829CONFIG_CRYPTO_DEFLATE=m 1942CONFIG_CRYPTO_DEFLATE=m
1830CONFIG_CRYPTO_MICHAEL_MIC=m 1943CONFIG_CRYPTO_MICHAEL_MIC=m
1831CONFIG_CRYPTO_CRC32C=m 1944CONFIG_CRYPTO_CRC32C=m
1832# CONFIG_CRYPTO_CAMELLIA is not set 1945# CONFIG_CRYPTO_CAMELLIA is not set
1833CONFIG_CRYPTO_TEST=m 1946CONFIG_CRYPTO_TEST=m
1947# CONFIG_CRYPTO_AUTHENC is not set
1834# CONFIG_CRYPTO_HW is not set 1948# CONFIG_CRYPTO_HW is not set
1949# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 2c8e756d19a3..d67bcd84f329 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -284,6 +284,10 @@ int main(void)
284 DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32)); 284 DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32));
285 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec)); 285 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec));
286 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); 286 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
287 DEFINE(CFG_ICACHE_BLOCKSZ, offsetof(struct vdso_data, icache_block_size));
288 DEFINE(CFG_DCACHE_BLOCKSZ, offsetof(struct vdso_data, dcache_block_size));
289 DEFINE(CFG_ICACHE_LOGBLOCKSZ, offsetof(struct vdso_data, icache_log_block_size));
290 DEFINE(CFG_DCACHE_LOGBLOCKSZ, offsetof(struct vdso_data, dcache_log_block_size));
287#ifdef CONFIG_PPC64 291#ifdef CONFIG_PPC64
288 DEFINE(CFG_SYSCALL_MAP64, offsetof(struct vdso_data, syscall_map_64)); 292 DEFINE(CFG_SYSCALL_MAP64, offsetof(struct vdso_data, syscall_map_64));
289 DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec)); 293 DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec));
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 3ef51fb6f107..9c74fdf29eec 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -186,7 +186,9 @@ int btext_initialize(struct device_node *np)
186 pitch = *prop; 186 pitch = *prop;
187 if (pitch == 1) 187 if (pitch == 1)
188 pitch = 0x1000; 188 pitch = 0x1000;
189 prop = of_get_property(np, "address", NULL); 189 prop = of_get_property(np, "linux,bootx-addr", NULL);
190 if (prop == NULL)
191 prop = of_get_property(np, "address", NULL);
190 if (prop) 192 if (prop)
191 address = *prop; 193 address = *prop;
192 194
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index d3fb7d0c6c1c..9ed351f3c966 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1104,6 +1104,16 @@ static struct cpu_spec __initdata cpu_specs[] = {
1104 { 1104 {
1105 .pvr_mask = 0xf0000fff, 1105 .pvr_mask = 0xf0000fff,
1106 .pvr_value = 0x40000850, 1106 .pvr_value = 0x40000850,
1107 .cpu_name = "440GR Rev. A",
1108 .cpu_features = CPU_FTRS_44X,
1109 .cpu_user_features = COMMON_USER_BOOKE,
1110 .icache_bsize = 32,
1111 .dcache_bsize = 32,
1112 .platform = "ppc440",
1113 },
1114 { /* Use logical PVR for 440EP (logical pvr = pvr | 0x8) */
1115 .pvr_mask = 0xf0000fff,
1116 .pvr_value = 0x40000858,
1107 .cpu_name = "440EP Rev. A", 1117 .cpu_name = "440EP Rev. A",
1108 .cpu_features = CPU_FTRS_44X, 1118 .cpu_features = CPU_FTRS_44X,
1109 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1119 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
@@ -1115,28 +1125,27 @@ static struct cpu_spec __initdata cpu_specs[] = {
1115 { 1125 {
1116 .pvr_mask = 0xf0000fff, 1126 .pvr_mask = 0xf0000fff,
1117 .pvr_value = 0x400008d3, 1127 .pvr_value = 0x400008d3,
1118 .cpu_name = "440EP Rev. B", 1128 .cpu_name = "440GR Rev. B",
1119 .cpu_features = CPU_FTRS_44X, 1129 .cpu_features = CPU_FTRS_44X,
1120 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1130 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1121 .icache_bsize = 32, 1131 .icache_bsize = 32,
1122 .dcache_bsize = 32, 1132 .dcache_bsize = 32,
1123 .cpu_setup = __setup_cpu_440ep,
1124 .platform = "ppc440", 1133 .platform = "ppc440",
1125 }, 1134 },
1126 { /* 440EPX */ 1135 { /* Use logical PVR for 440EP (logical pvr = pvr | 0x8) */
1127 .pvr_mask = 0xf0000ffb, 1136 .pvr_mask = 0xf0000fff,
1128 .pvr_value = 0x200008D0, 1137 .pvr_value = 0x400008db,
1129 .cpu_name = "440EPX", 1138 .cpu_name = "440EP Rev. B",
1130 .cpu_features = CPU_FTRS_44X, 1139 .cpu_features = CPU_FTRS_44X,
1131 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 1140 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1132 .icache_bsize = 32, 1141 .icache_bsize = 32,
1133 .dcache_bsize = 32, 1142 .dcache_bsize = 32,
1134 .cpu_setup = __setup_cpu_440epx, 1143 .cpu_setup = __setup_cpu_440ep,
1135 .platform = "ppc440", 1144 .platform = "ppc440",
1136 }, 1145 },
1137 { /* 440GRX */ 1146 { /* 440GRX */
1138 .pvr_mask = 0xf0000ffb, 1147 .pvr_mask = 0xf0000ffb,
1139 .pvr_value = 0x200008D8, 1148 .pvr_value = 0x200008D0,
1140 .cpu_name = "440GRX", 1149 .cpu_name = "440GRX",
1141 .cpu_features = CPU_FTRS_44X, 1150 .cpu_features = CPU_FTRS_44X,
1142 .cpu_user_features = COMMON_USER_BOOKE, 1151 .cpu_user_features = COMMON_USER_BOOKE,
@@ -1145,6 +1154,17 @@ static struct cpu_spec __initdata cpu_specs[] = {
1145 .cpu_setup = __setup_cpu_440grx, 1154 .cpu_setup = __setup_cpu_440grx,
1146 .platform = "ppc440", 1155 .platform = "ppc440",
1147 }, 1156 },
1157 { /* Use logical PVR for 440EPx (logical pvr = pvr | 0x8) */
1158 .pvr_mask = 0xf0000ffb,
1159 .pvr_value = 0x200008D8,
1160 .cpu_name = "440EPX",
1161 .cpu_features = CPU_FTRS_44X,
1162 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
1163 .icache_bsize = 32,
1164 .dcache_bsize = 32,
1165 .cpu_setup = __setup_cpu_440epx,
1166 .platform = "ppc440",
1167 },
1148 { /* 440GP Rev. B */ 1168 { /* 440GP Rev. B */
1149 .pvr_mask = 0xf0000fff, 1169 .pvr_mask = 0xf0000fff,
1150 .pvr_value = 0x40000440, 1170 .pvr_value = 0x40000440,
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 21d889e63e87..69a91bd46115 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -244,6 +244,16 @@ syscall_exit_cont:
244 andis. r10,r0,DBCR0_IC@h 244 andis. r10,r0,DBCR0_IC@h
245 bnel- load_dbcr0 245 bnel- load_dbcr0
246#endif 246#endif
247#ifdef CONFIG_44x
248 lis r4,icache_44x_need_flush@ha
249 lwz r5,icache_44x_need_flush@l(r4)
250 cmplwi cr0,r5,0
251 bne- 2f
2521:
253#endif /* CONFIG_44x */
254BEGIN_FTR_SECTION
255 lwarx r7,0,r1
256END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
247 stwcx. r0,0,r1 /* to clear the reservation */ 257 stwcx. r0,0,r1 /* to clear the reservation */
248 lwz r4,_LINK(r1) 258 lwz r4,_LINK(r1)
249 lwz r5,_CCR(r1) 259 lwz r5,_CCR(r1)
@@ -258,6 +268,12 @@ syscall_exit_cont:
258 mtspr SPRN_SRR1,r8 268 mtspr SPRN_SRR1,r8
259 SYNC 269 SYNC
260 RFI 270 RFI
271#ifdef CONFIG_44x
2722: li r7,0
273 iccci r0,r0
274 stw r7,icache_44x_need_flush@l(r4)
275 b 1b
276#endif /* CONFIG_44x */
261 277
26266: li r3,-ENOSYS 27866: li r3,-ENOSYS
263 b ret_from_syscall 279 b ret_from_syscall
@@ -683,6 +699,16 @@ resume_kernel:
683 699
684 /* interrupts are hard-disabled at this point */ 700 /* interrupts are hard-disabled at this point */
685restore: 701restore:
702#ifdef CONFIG_44x
703 lis r4,icache_44x_need_flush@ha
704 lwz r5,icache_44x_need_flush@l(r4)
705 cmplwi cr0,r5,0
706 beq+ 1f
707 li r6,0
708 iccci r0,r0
709 stw r6,icache_44x_need_flush@l(r4)
7101:
711#endif /* CONFIG_44x */
686 lwz r0,GPR0(r1) 712 lwz r0,GPR0(r1)
687 lwz r2,GPR2(r1) 713 lwz r2,GPR2(r1)
688 REST_4GPRS(3, r1) 714 REST_4GPRS(3, r1)
@@ -694,6 +720,9 @@ restore:
694 mtctr r11 720 mtctr r11
695 721
696 PPC405_ERR77(0,r1) 722 PPC405_ERR77(0,r1)
723BEGIN_FTR_SECTION
724 lwarx r11,0,r1
725END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
697 stwcx. r0,0,r1 /* to clear the reservation */ 726 stwcx. r0,0,r1 /* to clear the reservation */
698 727
699#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 728#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 97c5857faf00..c34986835a4e 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -904,7 +904,7 @@ handle_page_fault:
904 */ 904 */
90512: bl .save_nvgprs 90512: bl .save_nvgprs
906 addi r3,r1,STACK_FRAME_OVERHEAD 906 addi r3,r1,STACK_FRAME_OVERHEAD
907 lwz r4,_DAR(r1) 907 ld r4,_DAR(r1)
908 bl .low_hash_fault 908 bl .low_hash_fault
909 b .ret_from_except 909 b .ret_from_except
910 910
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index abd2957fe537..c3cf0e8f3ac1 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -122,7 +122,7 @@ static ctl_table powersave_nap_sysctl_root[] = {
122 { 122 {
123 .ctl_name = CTL_KERN, 123 .ctl_name = CTL_KERN,
124 .procname = "kernel", 124 .procname = "kernel",
125 .mode = 0755, 125 .mode = 0555,
126 .child = powersave_nap_ctl_table, 126 .child = powersave_nap_ctl_table,
127 }, 127 },
128 {} 128 {}
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 8533de50347d..8b642ab26d37 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -288,7 +288,16 @@ _GLOBAL(_tlbia)
288 */ 288 */
289_GLOBAL(_tlbie) 289_GLOBAL(_tlbie)
290#if defined(CONFIG_40x) 290#if defined(CONFIG_40x)
291 /* We run the search with interrupts disabled because we have to change
292 * the PID and I don't want to preempt when that happens.
293 */
294 mfmsr r5
295 mfspr r6,SPRN_PID
296 wrteei 0
297 mtspr SPRN_PID,r4
291 tlbsx. r3, 0, r3 298 tlbsx. r3, 0, r3
299 mtspr SPRN_PID,r6
300 wrtee r5
292 bne 10f 301 bne 10f
293 sync 302 sync
294 /* There are only 64 TLB entries, so r3 < 64, which means bit 25 is clear. 303 /* There are only 64 TLB entries, so r3 < 64, which means bit 25 is clear.
@@ -297,23 +306,23 @@ _GLOBAL(_tlbie)
297 tlbwe r3, r3, TLB_TAG 306 tlbwe r3, r3, TLB_TAG
298 isync 307 isync
29910: 30810:
309
300#elif defined(CONFIG_44x) 310#elif defined(CONFIG_44x)
301 mfspr r4,SPRN_MMUCR 311 mfspr r5,SPRN_MMUCR
302 mfspr r5,SPRN_PID /* Get PID */ 312 rlwimi r5,r4,0,24,31 /* Set TID */
303 rlwimi r4,r5,0,24,31 /* Set TID */
304 313
305 /* We have to run the search with interrupts disabled, even critical 314 /* We have to run the search with interrupts disabled, even critical
306 * and debug interrupts (in fact the only critical exceptions we have 315 * and debug interrupts (in fact the only critical exceptions we have
307 * are debug and machine check). Otherwise an interrupt which causes 316 * are debug and machine check). Otherwise an interrupt which causes
308 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */ 317 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
309 mfmsr r5 318 mfmsr r4
310 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha 319 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
311 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l 320 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
312 andc r6,r5,r6 321 andc r6,r4,r6
313 mtmsr r6 322 mtmsr r6
314 mtspr SPRN_MMUCR,r4 323 mtspr SPRN_MMUCR,r5
315 tlbsx. r3, 0, r3 324 tlbsx. r3, 0, r3
316 mtmsr r5 325 mtmsr r4
317 bne 10f 326 bne 10f
318 sync 327 sync
319 /* There are only 64 TLB entries, so r3 < 64, 328 /* There are only 64 TLB entries, so r3 < 64,
@@ -534,12 +543,21 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
534 addi r3,r3,L1_CACHE_BYTES 543 addi r3,r3,L1_CACHE_BYTES
535 bdnz 0b 544 bdnz 0b
536 sync 545 sync
546#ifndef CONFIG_44x
547 /* We don't flush the icache on 44x. Those have a virtual icache
548 * and we don't have access to the virtual address here (it's
549 * not the page vaddr but where it's mapped in user space). The
550 * flushing of the icache on these is handled elsewhere, when
551 * a change in the address space occurs, before returning to
552 * user space
553 */
537 mtctr r4 554 mtctr r4
5381: icbi 0,r6 5551: icbi 0,r6
539 addi r6,r6,L1_CACHE_BYTES 556 addi r6,r6,L1_CACHE_BYTES
540 bdnz 1b 557 bdnz 1b
541 sync 558 sync
542 isync 559 isync
560#endif /* CONFIG_44x */
543 blr 561 blr
544 562
545/* 563/*
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index b9d88374f14f..41e13f4cc6e3 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -350,7 +350,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
350 local_irq_save(flags); 350 local_irq_save(flags);
351 351
352 account_system_vtime(current); 352 account_system_vtime(current);
353 account_process_vtime(current); 353 account_process_tick(current, 0);
354 calculate_steal_time(); 354 calculate_steal_time();
355 355
356 last = _switch(old_thread, new_thread); 356 last = _switch(old_thread, new_thread);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 9f329a8928ea..acc0d247d3c3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -697,6 +697,18 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
697 prop = of_get_flat_dt_prop(node, "cpu-version", NULL); 697 prop = of_get_flat_dt_prop(node, "cpu-version", NULL);
698 if (prop && (*prop & 0xff000000) == 0x0f000000) 698 if (prop && (*prop & 0xff000000) == 0x0f000000)
699 identify_cpu(0, *prop); 699 identify_cpu(0, *prop);
700#if defined(CONFIG_44x) && defined(CONFIG_PPC_FPU)
701 /*
702 * Since 440GR(x)/440EP(x) processors have the same pvr,
703 * we check the node path and set bit 28 in the cur_cpu_spec
704 * pvr for EP(x) processor version. This bit is always 0 in
705 * the "real" pvr. Then we call identify_cpu again with
706 * the new logical pvr to enable FPU support.
707 */
708 if (strstr(uname, "440EP")) {
709 identify_cpu(0, cur_cpu_spec->pvr_value | 0x8);
710 }
711#endif
700 } 712 }
701 713
702 check_cpu_feature_properties(node); 714 check_cpu_feature_properties(node);
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 1db10f70ae69..1add6efdb315 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1244,7 +1244,7 @@ static void __init prom_initialize_tce_table(void)
1244 local_alloc_bottom = base; 1244 local_alloc_bottom = base;
1245 1245
1246 /* It seems OF doesn't null-terminate the path :-( */ 1246 /* It seems OF doesn't null-terminate the path :-( */
1247 memset(path, 0, sizeof(path)); 1247 memset(path, 0, PROM_SCRATCH_SIZE);
1248 /* Call OF to setup the TCE hardware */ 1248 /* Call OF to setup the TCE hardware */
1249 if (call_prom("package-to-path", 3, 1, node, 1249 if (call_prom("package-to-path", 3, 1, node,
1250 path, PROM_SCRATCH_SIZE-1) == PROM_ERROR) { 1250 path, PROM_SCRATCH_SIZE-1) == PROM_ERROR) {
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 214780798289..053cac19f714 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -19,6 +19,9 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/smp.h>
23#include <linux/completion.h>
24#include <linux/cpumask.h>
22 25
23#include <asm/prom.h> 26#include <asm/prom.h>
24#include <asm/rtas.h> 27#include <asm/rtas.h>
@@ -34,6 +37,8 @@
34#include <asm/lmb.h> 37#include <asm/lmb.h>
35#include <asm/udbg.h> 38#include <asm/udbg.h>
36#include <asm/syscalls.h> 39#include <asm/syscalls.h>
40#include <asm/smp.h>
41#include <asm/atomic.h>
37 42
38struct rtas_t rtas = { 43struct rtas_t rtas = {
39 .lock = SPIN_LOCK_UNLOCKED 44 .lock = SPIN_LOCK_UNLOCKED
@@ -41,8 +46,10 @@ struct rtas_t rtas = {
41EXPORT_SYMBOL(rtas); 46EXPORT_SYMBOL(rtas);
42 47
43struct rtas_suspend_me_data { 48struct rtas_suspend_me_data {
44 long waiting; 49 atomic_t working; /* number of cpus accessing this struct */
45 struct rtas_args *args; 50 int token; /* ibm,suspend-me */
51 int error;
52 struct completion *complete; /* wait on this until working == 0 */
46}; 53};
47 54
48DEFINE_SPINLOCK(rtas_data_buf_lock); 55DEFINE_SPINLOCK(rtas_data_buf_lock);
@@ -631,18 +638,18 @@ void rtas_halt(void)
631/* Must be in the RMO region, so we place it here */ 638/* Must be in the RMO region, so we place it here */
632static char rtas_os_term_buf[2048]; 639static char rtas_os_term_buf[2048];
633 640
634void rtas_os_term(char *str) 641void rtas_panic_msg(char *str)
635{ 642{
636 int status; 643 snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str);
644}
637 645
638 if (panic_timeout) 646void rtas_os_term(void)
639 return; 647{
648 int status;
640 649
641 if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term")) 650 if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term"))
642 return; 651 return;
643 652
644 snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str);
645
646 do { 653 do {
647 status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL, 654 status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL,
648 __pa(rtas_os_term_buf)); 655 __pa(rtas_os_term_buf));
@@ -657,50 +664,62 @@ static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
657#ifdef CONFIG_PPC_PSERIES 664#ifdef CONFIG_PPC_PSERIES
658static void rtas_percpu_suspend_me(void *info) 665static void rtas_percpu_suspend_me(void *info)
659{ 666{
660 int i;
661 long rc; 667 long rc;
662 long flags; 668 unsigned long msr_save;
669 int cpu;
663 struct rtas_suspend_me_data *data = 670 struct rtas_suspend_me_data *data =
664 (struct rtas_suspend_me_data *)info; 671 (struct rtas_suspend_me_data *)info;
665 672
666 /* 673 atomic_inc(&data->working);
667 * We use "waiting" to indicate our state. As long 674
668 * as it is >0, we are still trying to all join up. 675 /* really need to ensure MSR.EE is off for H_JOIN */
669 * If it goes to 0, we have successfully joined up and 676 msr_save = mfmsr();
670 * one thread got H_CONTINUE. If any error happens, 677 mtmsr(msr_save & ~(MSR_EE));
671 * we set it to <0. 678
672 */ 679 rc = plpar_hcall_norets(H_JOIN);
673 local_irq_save(flags);
674 do {
675 rc = plpar_hcall_norets(H_JOIN);
676 smp_rmb();
677 } while (rc == H_SUCCESS && data->waiting > 0);
678 if (rc == H_SUCCESS)
679 goto out;
680 680
681 if (rc == H_CONTINUE) { 681 mtmsr(msr_save);
682 data->waiting = 0; 682
683 data->args->args[data->args->nargs] = 683 if (rc == H_SUCCESS) {
684 rtas_call(ibm_suspend_me_token, 0, 1, NULL); 684 /* This cpu was prodded and the suspend is complete. */
685 for_each_possible_cpu(i) 685 goto out;
686 plpar_hcall_norets(H_PROD,i); 686 } else if (rc == H_CONTINUE) {
687 /* All other cpus are in H_JOIN, this cpu does
688 * the suspend.
689 */
690 printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n",
691 smp_processor_id());
692 data->error = rtas_call(data->token, 0, 1, NULL);
693
694 if (data->error)
695 printk(KERN_DEBUG "ibm,suspend-me returned %d\n",
696 data->error);
687 } else { 697 } else {
688 data->waiting = -EBUSY; 698 printk(KERN_ERR "H_JOIN on cpu %i failed with rc = %ld\n",
689 printk(KERN_ERR "Error on H_JOIN hypervisor call\n"); 699 smp_processor_id(), rc);
700 data->error = rc;
690 } 701 }
691 702 /* This cpu did the suspend or got an error; in either case,
703 * we need to prod all other other cpus out of join state.
704 * Extra prods are harmless.
705 */
706 for_each_online_cpu(cpu)
707 plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu));
692out: 708out:
693 local_irq_restore(flags); 709 if (atomic_dec_return(&data->working) == 0)
694 return; 710 complete(data->complete);
695} 711}
696 712
697static int rtas_ibm_suspend_me(struct rtas_args *args) 713static int rtas_ibm_suspend_me(struct rtas_args *args)
698{ 714{
699 int i;
700 long state; 715 long state;
701 long rc; 716 long rc;
702 unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 717 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
703 struct rtas_suspend_me_data data; 718 struct rtas_suspend_me_data data;
719 DECLARE_COMPLETION_ONSTACK(done);
720
721 if (!rtas_service_present("ibm,suspend-me"))
722 return -ENOSYS;
704 723
705 /* Make sure the state is valid */ 724 /* Make sure the state is valid */
706 rc = plpar_hcall(H_VASI_STATE, retbuf, 725 rc = plpar_hcall(H_VASI_STATE, retbuf,
@@ -721,25 +740,23 @@ static int rtas_ibm_suspend_me(struct rtas_args *args)
721 return 0; 740 return 0;
722 } 741 }
723 742
724 data.waiting = 1; 743 atomic_set(&data.working, 0);
725 data.args = args; 744 data.token = rtas_token("ibm,suspend-me");
745 data.error = 0;
746 data.complete = &done;
726 747
727 /* Call function on all CPUs. One of us will make the 748 /* Call function on all CPUs. One of us will make the
728 * rtas call 749 * rtas call
729 */ 750 */
730 if (on_each_cpu(rtas_percpu_suspend_me, &data, 1, 0)) 751 if (on_each_cpu(rtas_percpu_suspend_me, &data, 1, 0))
731 data.waiting = -EINVAL; 752 data.error = -EINVAL;
732 753
733 if (data.waiting != 0) 754 wait_for_completion(&done);
734 printk(KERN_ERR "Error doing global join\n");
735 755
736 /* Prod each CPU. This won't hurt, and will wake 756 if (data.error != 0)
737 * anyone we successfully put to sleep with H_JOIN. 757 printk(KERN_ERR "Error doing global join\n");
738 */
739 for_each_possible_cpu(i)
740 plpar_hcall_norets(H_PROD, i);
741 758
742 return data.waiting; 759 return data.error;
743} 760}
744#else /* CONFIG_PPC_PSERIES */ 761#else /* CONFIG_PPC_PSERIES */
745static int rtas_ibm_suspend_me(struct rtas_args *args) 762static int rtas_ibm_suspend_me(struct rtas_args *args)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index ede77dbbd4df..3b1529c103ef 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -291,23 +291,16 @@ static void __init initialize_cache_info(void)
291 if ( num_cpus == 1 ) { 291 if ( num_cpus == 1 ) {
292 const u32 *sizep, *lsizep; 292 const u32 *sizep, *lsizep;
293 u32 size, lsize; 293 u32 size, lsize;
294 const char *dc, *ic;
295
296 /* Then read cache informations */
297 if (machine_is(powermac)) {
298 dc = "d-cache-block-size";
299 ic = "i-cache-block-size";
300 } else {
301 dc = "d-cache-line-size";
302 ic = "i-cache-line-size";
303 }
304 294
305 size = 0; 295 size = 0;
306 lsize = cur_cpu_spec->dcache_bsize; 296 lsize = cur_cpu_spec->dcache_bsize;
307 sizep = of_get_property(np, "d-cache-size", NULL); 297 sizep = of_get_property(np, "d-cache-size", NULL);
308 if (sizep != NULL) 298 if (sizep != NULL)
309 size = *sizep; 299 size = *sizep;
310 lsizep = of_get_property(np, dc, NULL); 300 lsizep = of_get_property(np, "d-cache-block-size", NULL);
301 /* fallback if block size missing */
302 if (lsizep == NULL)
303 lsizep = of_get_property(np, "d-cache-line-size", NULL);
311 if (lsizep != NULL) 304 if (lsizep != NULL)
312 lsize = *lsizep; 305 lsize = *lsizep;
313 if (sizep == 0 || lsizep == 0) 306 if (sizep == 0 || lsizep == 0)
@@ -324,7 +317,9 @@ static void __init initialize_cache_info(void)
324 sizep = of_get_property(np, "i-cache-size", NULL); 317 sizep = of_get_property(np, "i-cache-size", NULL);
325 if (sizep != NULL) 318 if (sizep != NULL)
326 size = *sizep; 319 size = *sizep;
327 lsizep = of_get_property(np, ic, NULL); 320 lsizep = of_get_property(np, "i-cache-block-size", NULL);
321 if (lsizep == NULL)
322 lsizep = of_get_property(np, "i-cache-line-size", NULL);
328 if (lsizep != NULL) 323 if (lsizep != NULL)
329 lsize = *lsizep; 324 lsize = *lsizep;
330 if (sizep == 0 || lsizep == 0) 325 if (sizep == 0 || lsizep == 0)
diff --git a/arch/powerpc/kernel/swsusp_32.S b/arch/powerpc/kernel/swsusp_32.S
index 69e8f86aa4f8..77fc76607ab2 100644
--- a/arch/powerpc/kernel/swsusp_32.S
+++ b/arch/powerpc/kernel/swsusp_32.S
@@ -133,10 +133,12 @@ _GLOBAL(swsusp_arch_suspend)
133/* Resume code */ 133/* Resume code */
134_GLOBAL(swsusp_arch_resume) 134_GLOBAL(swsusp_arch_resume)
135 135
136#ifdef CONFIG_ALTIVEC
136 /* Stop pending alitvec streams and memory accesses */ 137 /* Stop pending alitvec streams and memory accesses */
137BEGIN_FTR_SECTION 138BEGIN_FTR_SECTION
138 DSSALL 139 DSSALL
139END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 140END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
141#endif
140 sync 142 sync
141 143
142 /* Disable MSR:DR to make sure we don't take a TLB or 144 /* Disable MSR:DR to make sure we don't take a TLB or
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 9eb3284deac4..a925a8eae121 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -241,8 +241,9 @@ void account_system_vtime(struct task_struct *tsk)
241 /* deltascaled includes both user and system time. 241 /* deltascaled includes both user and system time.
242 * Hence scale it based on the purr ratio to estimate 242 * Hence scale it based on the purr ratio to estimate
243 * the system time */ 243 * the system time */
244 deltascaled = deltascaled * get_paca()->system_time / 244 if (get_paca()->user_time)
245 (get_paca()->system_time + get_paca()->user_time); 245 deltascaled = deltascaled * get_paca()->system_time /
246 (get_paca()->system_time + get_paca()->user_time);
246 delta += get_paca()->system_time; 247 delta += get_paca()->system_time;
247 get_paca()->system_time = 0; 248 get_paca()->system_time = 0;
248 } 249 }
@@ -259,7 +260,7 @@ void account_system_vtime(struct task_struct *tsk)
259 * user and system time records. 260 * user and system time records.
260 * Must be called with interrupts disabled. 261 * Must be called with interrupts disabled.
261 */ 262 */
262void account_process_vtime(struct task_struct *tsk) 263void account_process_tick(struct task_struct *tsk, int user_tick)
263{ 264{
264 cputime_t utime, utimescaled; 265 cputime_t utime, utimescaled;
265 266
@@ -274,18 +275,6 @@ void account_process_vtime(struct task_struct *tsk)
274 account_user_time_scaled(tsk, utimescaled); 275 account_user_time_scaled(tsk, utimescaled);
275} 276}
276 277
277static void account_process_time(struct pt_regs *regs)
278{
279 int cpu = smp_processor_id();
280
281 account_process_vtime(current);
282 run_local_timers();
283 if (rcu_pending(cpu))
284 rcu_check_callbacks(cpu, user_mode(regs));
285 scheduler_tick();
286 run_posix_cpu_timers(current);
287}
288
289/* 278/*
290 * Stuff for accounting stolen time. 279 * Stuff for accounting stolen time.
291 */ 280 */
@@ -375,7 +364,6 @@ static void snapshot_purr(void)
375 364
376#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */ 365#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */
377#define calc_cputime_factors() 366#define calc_cputime_factors()
378#define account_process_time(regs) update_process_times(user_mode(regs))
379#define calculate_steal_time() do { } while (0) 367#define calculate_steal_time() do { } while (0)
380#endif 368#endif
381 369
@@ -586,7 +574,7 @@ void timer_interrupt(struct pt_regs * regs)
586 /* not time for this event yet */ 574 /* not time for this event yet */
587 now = per_cpu(decrementer_next_tb, cpu) - now; 575 now = per_cpu(decrementer_next_tb, cpu) - now;
588 if (now <= DECREMENTER_MAX) 576 if (now <= DECREMENTER_MAX)
589 set_dec((unsigned int)now - 1); 577 set_dec((int)now);
590 return; 578 return;
591 } 579 }
592 old_regs = set_irq_regs(regs); 580 old_regs = set_irq_regs(regs);
@@ -599,20 +587,8 @@ void timer_interrupt(struct pt_regs * regs)
599 get_lppaca()->int_dword.fields.decr_int = 0; 587 get_lppaca()->int_dword.fields.decr_int = 0;
600#endif 588#endif
601 589
602 /*
603 * We cannot disable the decrementer, so in the period
604 * between this cpu's being marked offline in cpu_online_map
605 * and calling stop-self, it is taking timer interrupts.
606 * Avoid calling into the scheduler rebalancing code if this
607 * is the case.
608 */
609 if (!cpu_is_offline(cpu))
610 account_process_time(regs);
611
612 if (evt->event_handler) 590 if (evt->event_handler)
613 evt->event_handler(evt); 591 evt->event_handler(evt);
614 else
615 evt->set_next_event(DECREMENTER_MAX, evt);
616 592
617#ifdef CONFIG_PPC_ISERIES 593#ifdef CONFIG_PPC_ISERIES
618 if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending()) 594 if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending())
@@ -836,9 +812,6 @@ static int decrementer_set_next_event(unsigned long evt,
836 struct clock_event_device *dev) 812 struct clock_event_device *dev)
837{ 813{
838 __get_cpu_var(decrementer_next_tb) = get_tb_or_rtc() + evt; 814 __get_cpu_var(decrementer_next_tb) = get_tb_or_rtc() + evt;
839 /* The decrementer interrupts on the 0 -> -1 transition */
840 if (evt)
841 --evt;
842 set_dec(evt); 815 set_dec(evt);
843 return 0; 816 return 0;
844} 817}
@@ -857,7 +830,7 @@ static void register_decrementer_clockevent(int cpu)
857 *dec = decrementer_clockevent; 830 *dec = decrementer_clockevent;
858 dec->cpumask = cpumask_of_cpu(cpu); 831 dec->cpumask = cpumask_of_cpu(cpu);
859 832
860 printk(KERN_INFO "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n", 833 printk(KERN_DEBUG "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n",
861 dec->name, dec->mult, dec->shift, cpu); 834 dec->name, dec->mult, dec->shift, cpu);
862 835
863 clockevents_register_device(dec); 836 clockevents_register_device(dec);
@@ -871,7 +844,8 @@ void init_decrementer_clockevent(void)
871 decrementer_clockevent.shift); 844 decrementer_clockevent.shift);
872 decrementer_clockevent.max_delta_ns = 845 decrementer_clockevent.max_delta_ns =
873 clockevent_delta2ns(DECREMENTER_MAX, &decrementer_clockevent); 846 clockevent_delta2ns(DECREMENTER_MAX, &decrementer_clockevent);
874 decrementer_clockevent.min_delta_ns = 1000; 847 decrementer_clockevent.min_delta_ns =
848 clockevent_delta2ns(2, &decrementer_clockevent);
875 849
876 register_decrementer_clockevent(cpu); 850 register_decrementer_clockevent(cpu);
877} 851}
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 2322ba5cce4c..3702df7dc567 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -699,11 +699,22 @@ static int __init vdso_init(void)
699 vdso_data->icache_size = ppc64_caches.isize; 699 vdso_data->icache_size = ppc64_caches.isize;
700 vdso_data->icache_line_size = ppc64_caches.iline_size; 700 vdso_data->icache_line_size = ppc64_caches.iline_size;
701 701
702 /* XXXOJN: Blocks should be added to ppc64_caches and used instead */
703 vdso_data->dcache_block_size = ppc64_caches.dline_size;
704 vdso_data->icache_block_size = ppc64_caches.iline_size;
705 vdso_data->dcache_log_block_size = ppc64_caches.log_dline_size;
706 vdso_data->icache_log_block_size = ppc64_caches.log_iline_size;
707
702 /* 708 /*
703 * Calculate the size of the 64 bits vDSO 709 * Calculate the size of the 64 bits vDSO
704 */ 710 */
705 vdso64_pages = (&vdso64_end - &vdso64_start) >> PAGE_SHIFT; 711 vdso64_pages = (&vdso64_end - &vdso64_start) >> PAGE_SHIFT;
706 DBG("vdso64_kbase: %p, 0x%x pages\n", vdso64_kbase, vdso64_pages); 712 DBG("vdso64_kbase: %p, 0x%x pages\n", vdso64_kbase, vdso64_pages);
713#else
714 vdso_data->dcache_block_size = L1_CACHE_BYTES;
715 vdso_data->dcache_log_block_size = L1_CACHE_SHIFT;
716 vdso_data->icache_block_size = L1_CACHE_BYTES;
717 vdso_data->icache_log_block_size = L1_CACHE_SHIFT;
707#endif /* CONFIG_PPC64 */ 718#endif /* CONFIG_PPC64 */
708 719
709 720
diff --git a/arch/powerpc/kernel/vdso32/cacheflush.S b/arch/powerpc/kernel/vdso32/cacheflush.S
index 9cb319992c38..1ba6feb71b31 100644
--- a/arch/powerpc/kernel/vdso32/cacheflush.S
+++ b/arch/powerpc/kernel/vdso32/cacheflush.S
@@ -23,29 +23,46 @@
23 * 23 *
24 * Flushes the data cache & invalidate the instruction cache for the 24 * Flushes the data cache & invalidate the instruction cache for the
25 * provided range [start, end[ 25 * provided range [start, end[
26 *
27 * Note: all CPUs supported by this kernel have a 128 bytes cache
28 * line size so we don't have to peek that info from the datapage
29 */ 26 */
30V_FUNCTION_BEGIN(__kernel_sync_dicache) 27V_FUNCTION_BEGIN(__kernel_sync_dicache)
31 .cfi_startproc 28 .cfi_startproc
32 li r5,127 29 mflr r12
33 andc r6,r3,r5 /* round low to line bdy */ 30 .cfi_register lr,r12
31 mr r11,r3
32 bl __get_datapage@local
33 mtlr r12
34 mr r10,r3
35
36 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
37 addi r5,r7,-1
38 andc r6,r11,r5 /* round low to line bdy */
34 subf r8,r6,r4 /* compute length */ 39 subf r8,r6,r4 /* compute length */
35 add r8,r8,r5 /* ensure we get enough */ 40 add r8,r8,r5 /* ensure we get enough */
36 srwi. r8,r8,7 /* compute line count */ 41 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
42 srw. r8,r8,r9 /* compute line count */
37 crclr cr0*4+so 43 crclr cr0*4+so
38 beqlr /* nothing to do? */ 44 beqlr /* nothing to do? */
39 mtctr r8 45 mtctr r8
40 mr r3,r6 461: dcbst 0,r6
411: dcbst 0,r3 47 add r6,r6,r7
42 addi r3,r3,128
43 bdnz 1b 48 bdnz 1b
44 sync 49 sync
50
51/* Now invalidate the instruction cache */
52
53 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
54 addi r5,r7,-1
55 andc r6,r11,r5 /* round low to line bdy */
56 subf r8,r6,r4 /* compute length */
57 add r8,r8,r5
58 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
59 srw. r8,r8,r9 /* compute line count */
60 crclr cr0*4+so
61 beqlr /* nothing to do? */
45 mtctr r8 62 mtctr r8
461: icbi 0,r6 632: icbi 0,r6
47 addi r6,r6,128 64 add r6,r6,r7
48 bdnz 1b 65 bdnz 2b
49 isync 66 isync
50 li r3,0 67 li r3,0
51 blr 68 blr
diff --git a/arch/powerpc/kernel/vdso64/cacheflush.S b/arch/powerpc/kernel/vdso64/cacheflush.S
index 66a36d3cc6ad..69c5af2b3c96 100644
--- a/arch/powerpc/kernel/vdso64/cacheflush.S
+++ b/arch/powerpc/kernel/vdso64/cacheflush.S
@@ -23,29 +23,46 @@
23 * 23 *
24 * Flushes the data cache & invalidate the instruction cache for the 24 * Flushes the data cache & invalidate the instruction cache for the
25 * provided range [start, end[ 25 * provided range [start, end[
26 *
27 * Note: all CPUs supported by this kernel have a 128 bytes cache
28 * line size so we don't have to peek that info from the datapage
29 */ 26 */
30V_FUNCTION_BEGIN(__kernel_sync_dicache) 27V_FUNCTION_BEGIN(__kernel_sync_dicache)
31 .cfi_startproc 28 .cfi_startproc
32 li r5,127 29 mflr r12
33 andc r6,r3,r5 /* round low to line bdy */ 30 .cfi_register lr,r12
31 mr r11,r3
32 bl V_LOCAL_FUNC(__get_datapage)
33 mtlr r12
34 mr r10,r3
35
36 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
37 addi r5,r7,-1
38 andc r6,r11,r5 /* round low to line bdy */
34 subf r8,r6,r4 /* compute length */ 39 subf r8,r6,r4 /* compute length */
35 add r8,r8,r5 /* ensure we get enough */ 40 add r8,r8,r5 /* ensure we get enough */
36 srwi. r8,r8,7 /* compute line count */ 41 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
42 srw. r8,r8,r9 /* compute line count */
37 crclr cr0*4+so 43 crclr cr0*4+so
38 beqlr /* nothing to do? */ 44 beqlr /* nothing to do? */
39 mtctr r8 45 mtctr r8
40 mr r3,r6 461: dcbst 0,r6
411: dcbst 0,r3 47 add r6,r6,r7
42 addi r3,r3,128
43 bdnz 1b 48 bdnz 1b
44 sync 49 sync
50
51/* Now invalidate the instruction cache */
52
53 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
54 addi r5,r7,-1
55 andc r6,r11,r5 /* round low to line bdy */
56 subf r8,r6,r4 /* compute length */
57 add r8,r8,r5
58 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
59 srw. r8,r8,r9 /* compute line count */
60 crclr cr0*4+so
61 beqlr /* nothing to do? */
45 mtctr r8 62 mtctr r8
461: icbi 0,r6 632: icbi 0,r6
47 addi r6,r6,128 64 add r6,r6,r7
48 bdnz 1b 65 bdnz 2b
49 isync 66 isync
50 li r3,0 67 li r3,0
51 blr 68 blr
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 823a8cbd60b5..f66fa5d966b0 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -37,11 +37,10 @@ SECTIONS
37 ALIGN_FUNCTION(); 37 ALIGN_FUNCTION();
38 *(.text.head) 38 *(.text.head)
39 _text = .; 39 _text = .;
40 TEXT_TEXT 40 *(.text .fixup .text.init.refok .exit.text.refok)
41 SCHED_TEXT 41 SCHED_TEXT
42 LOCK_TEXT 42 LOCK_TEXT
43 KPROBES_TEXT 43 KPROBES_TEXT
44 *(.fixup)
45 44
46#ifdef CONFIG_PPC32 45#ifdef CONFIG_PPC32
47 *(.got1) 46 *(.got1)
diff --git a/arch/powerpc/mm/40x_mmu.c b/arch/powerpc/mm/40x_mmu.c
index e067df836be2..3899ea97fbdf 100644
--- a/arch/powerpc/mm/40x_mmu.c
+++ b/arch/powerpc/mm/40x_mmu.c
@@ -98,13 +98,12 @@ unsigned long __init mmu_mapin_ram(void)
98 98
99 v = KERNELBASE; 99 v = KERNELBASE;
100 p = PPC_MEMSTART; 100 p = PPC_MEMSTART;
101 s = 0; 101 s = total_lowmem;
102 102
103 if (__map_without_ltlbs) { 103 if (__map_without_ltlbs)
104 return s; 104 return 0;
105 }
106 105
107 while (s <= (total_lowmem - LARGE_PAGE_SIZE_16M)) { 106 while (s >= LARGE_PAGE_SIZE_16M) {
108 pmd_t *pmdp; 107 pmd_t *pmdp;
109 unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE; 108 unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE;
110 109
@@ -116,10 +115,10 @@ unsigned long __init mmu_mapin_ram(void)
116 115
117 v += LARGE_PAGE_SIZE_16M; 116 v += LARGE_PAGE_SIZE_16M;
118 p += LARGE_PAGE_SIZE_16M; 117 p += LARGE_PAGE_SIZE_16M;
119 s += LARGE_PAGE_SIZE_16M; 118 s -= LARGE_PAGE_SIZE_16M;
120 } 119 }
121 120
122 while (s <= (total_lowmem - LARGE_PAGE_SIZE_4M)) { 121 while (s >= LARGE_PAGE_SIZE_4M) {
123 pmd_t *pmdp; 122 pmd_t *pmdp;
124 unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE; 123 unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE;
125 124
@@ -128,8 +127,8 @@ unsigned long __init mmu_mapin_ram(void)
128 127
129 v += LARGE_PAGE_SIZE_4M; 128 v += LARGE_PAGE_SIZE_4M;
130 p += LARGE_PAGE_SIZE_4M; 129 p += LARGE_PAGE_SIZE_4M;
131 s += LARGE_PAGE_SIZE_4M; 130 s -= LARGE_PAGE_SIZE_4M;
132 } 131 }
133 132
134 return s; 133 return total_lowmem - s;
135} 134}
diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
index c3df50476539..04dc08798d3d 100644
--- a/arch/powerpc/mm/44x_mmu.c
+++ b/arch/powerpc/mm/44x_mmu.c
@@ -35,6 +35,7 @@
35 */ 35 */
36unsigned int tlb_44x_index; /* = 0 */ 36unsigned int tlb_44x_index; /* = 0 */
37unsigned int tlb_44x_hwater = PPC44x_TLB_SIZE - 1 - PPC44x_EARLY_TLBS; 37unsigned int tlb_44x_hwater = PPC44x_TLB_SIZE - 1 - PPC44x_EARLY_TLBS;
38int icache_44x_need_flush;
38 39
39/* 40/*
40 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem 41 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index a18fda361cc0..8135da06e0a4 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -309,7 +309,7 @@ good_area:
309 set_bit(PG_arch_1, &page->flags); 309 set_bit(PG_arch_1, &page->flags);
310 } 310 }
311 pte_update(ptep, 0, _PAGE_HWEXEC); 311 pte_update(ptep, 0, _PAGE_HWEXEC);
312 _tlbie(address); 312 _tlbie(address, mm->context.id);
313 pte_unmap_unlock(ptep, ptl); 313 pte_unmap_unlock(ptep, ptl);
314 up_read(&mm->mmap_sem); 314 up_read(&mm->mmap_sem);
315 return 0; 315 return 0;
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index ad253b959030..e935edd6b72b 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -331,7 +331,7 @@ htab_pte_insert_failure:
331 *****************************************************************************/ 331 *****************************************************************************/
332 332
333/* _hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, 333/* _hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,
334 * pte_t *ptep, unsigned long trap, int local) 334 * pte_t *ptep, unsigned long trap, int local, int ssize)
335 */ 335 */
336 336
337/* 337/*
@@ -557,7 +557,8 @@ htab_inval_old_hpte:
557 mr r4,r31 /* PTE.pte */ 557 mr r4,r31 /* PTE.pte */
558 li r5,0 /* PTE.hidx */ 558 li r5,0 /* PTE.hidx */
559 li r6,MMU_PAGE_64K /* psize */ 559 li r6,MMU_PAGE_64K /* psize */
560 ld r7,STK_PARM(r8)(r1) /* local */ 560 ld r7,STK_PARM(r9)(r1) /* ssize */
561 ld r8,STK_PARM(r8)(r1) /* local */
561 bl .flush_hash_page 562 bl .flush_hash_page
562 b htab_insert_pte 563 b htab_insert_pte
563 564
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index c78dc912411f..f09730bf3a33 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -51,6 +51,7 @@
51#include <asm/cputable.h> 51#include <asm/cputable.h>
52#include <asm/sections.h> 52#include <asm/sections.h>
53#include <asm/spu.h> 53#include <asm/spu.h>
54#include <asm/udbg.h>
54 55
55#ifdef DEBUG 56#ifdef DEBUG
56#define DBG(fmt...) udbg_printf(fmt) 57#define DBG(fmt...) udbg_printf(fmt)
@@ -791,8 +792,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
791 } 792 }
792 if (user_region) { 793 if (user_region) {
793 if (psize != get_paca()->context.user_psize) { 794 if (psize != get_paca()->context.user_psize) {
794 get_paca()->context.user_psize = 795 get_paca()->context = mm->context;
795 mm->context.user_psize;
796 slb_flush_and_rebolt(); 796 slb_flush_and_rebolt();
797 } 797 }
798 } else if (get_paca()->vmalloc_sllp != 798 } else if (get_paca()->vmalloc_sllp !=
@@ -885,6 +885,9 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
885 local_irq_restore(flags); 885 local_irq_restore(flags);
886} 886}
887 887
888/* WARNING: This is called from hash_low_64.S, if you change this prototype,
889 * do not forget to update the assembly call site !
890 */
888void flush_hash_page(unsigned long va, real_pte_t pte, int psize, int ssize, 891void flush_hash_page(unsigned long va, real_pte_t pte, int psize, int ssize,
889 int local) 892 int local)
890{ 893{
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index d9c82d3d6482..c0f5cff77035 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -19,8 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#undef DEBUG
23
24#include <linux/signal.h> 22#include <linux/signal.h>
25#include <linux/sched.h> 23#include <linux/sched.h>
26#include <linux/kernel.h> 24#include <linux/kernel.h>
@@ -66,12 +64,6 @@
66 64
67#include "mmu_decl.h" 65#include "mmu_decl.h"
68 66
69#ifdef DEBUG
70#define DBG(fmt...) printk(fmt)
71#else
72#define DBG(fmt...)
73#endif
74
75#if PGTABLE_RANGE > USER_VSID_RANGE 67#if PGTABLE_RANGE > USER_VSID_RANGE
76#warning Limited user VSID range means pagetable space is wasted 68#warning Limited user VSID range means pagetable space is wasted
77#endif 69#endif
@@ -175,8 +167,8 @@ void pgtable_cache_init(void)
175 int size = pgtable_cache_size[i]; 167 int size = pgtable_cache_size[i];
176 const char *name = pgtable_cache_name[i]; 168 const char *name = pgtable_cache_name[i];
177 169
178 DBG("Allocating page table cache %s (#%d) " 170 pr_debug("Allocating page table cache %s (#%d) "
179 "for size: %08x...\n", name, i, size); 171 "for size: %08x...\n", name, i, size);
180 pgtable_cache[i] = kmem_cache_create(name, 172 pgtable_cache[i] = kmem_cache_create(name,
181 size, size, 173 size, size,
182 SLAB_PANIC, 174 SLAB_PANIC,
@@ -239,8 +231,8 @@ int __meminit vmemmap_populate(struct page *start_page,
239 if (!p) 231 if (!p)
240 return -ENOMEM; 232 return -ENOMEM;
241 233
242 printk(KERN_WARNING "vmemmap %08lx allocated at %p, " 234 pr_debug("vmemmap %08lx allocated at %p, physical %08lx.\n",
243 "physical %08lx.\n", start, p, __pa(p)); 235 start, p, __pa(p));
244 236
245 mapped = htab_bolt_mapping(start, start + page_size, 237 mapped = htab_bolt_mapping(start, start + page_size,
246 __pa(p), mode_rw, mmu_linear_psize, 238 __pa(p), mode_rw, mmu_linear_psize,
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 81eb96ec13b2..5402fb6b3aae 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -464,7 +464,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
464 * we invalidate the TLB here, thus avoiding dcbst 464 * we invalidate the TLB here, thus avoiding dcbst
465 * misbehaviour. 465 * misbehaviour.
466 */ 466 */
467 _tlbie(address); 467 _tlbie(address, 0 /* 8xx doesn't care about PID */);
468#endif 468#endif
469 if (!PageReserved(page) 469 if (!PageReserved(page)
470 && !test_bit(PG_arch_1, &page->flags)) { 470 && !test_bit(PG_arch_1, &page->flags)) {
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index c94a64fd3c01..ebfd13dc9d19 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -56,17 +56,17 @@ extern unsigned long total_lowmem;
56 * architectures. -- Dan 56 * architectures. -- Dan
57 */ 57 */
58#if defined(CONFIG_8xx) 58#if defined(CONFIG_8xx)
59#define flush_HPTE(X, va, pg) _tlbie(va) 59#define flush_HPTE(X, va, pg) _tlbie(va, 0 /* 8xx doesn't care about PID */)
60#define MMU_init_hw() do { } while(0) 60#define MMU_init_hw() do { } while(0)
61#define mmu_mapin_ram() (0UL) 61#define mmu_mapin_ram() (0UL)
62 62
63#elif defined(CONFIG_4xx) 63#elif defined(CONFIG_4xx)
64#define flush_HPTE(X, va, pg) _tlbie(va) 64#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
65extern void MMU_init_hw(void); 65extern void MMU_init_hw(void);
66extern unsigned long mmu_mapin_ram(void); 66extern unsigned long mmu_mapin_ram(void);
67 67
68#elif defined(CONFIG_FSL_BOOKE) 68#elif defined(CONFIG_FSL_BOOKE)
69#define flush_HPTE(X, va, pg) _tlbie(va) 69#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
70extern void MMU_init_hw(void); 70extern void MMU_init_hw(void);
71extern unsigned long mmu_mapin_ram(void); 71extern unsigned long mmu_mapin_ram(void);
72extern void adjust_total_lowmem(void); 72extern void adjust_total_lowmem(void);
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index bbd2c512ee05..27922dff8b94 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -25,6 +25,7 @@
25#include <asm/smp.h> 25#include <asm/smp.h>
26#include <asm/firmware.h> 26#include <asm/firmware.h>
27#include <linux/compiler.h> 27#include <linux/compiler.h>
28#include <asm/udbg.h>
28 29
29#ifdef DEBUG 30#ifdef DEBUG
30#define DBG(fmt...) udbg_printf(fmt) 31#define DBG(fmt...) udbg_printf(fmt)
@@ -148,6 +149,35 @@ void slb_vmalloc_update(void)
148 slb_flush_and_rebolt(); 149 slb_flush_and_rebolt();
149} 150}
150 151
152/* Helper function to compare esids. There are four cases to handle.
153 * 1. The system is not 1T segment size capable. Use the GET_ESID compare.
154 * 2. The system is 1T capable, both addresses are < 1T, use the GET_ESID compare.
155 * 3. The system is 1T capable, only one of the two addresses is > 1T. This is not a match.
156 * 4. The system is 1T capable, both addresses are > 1T, use the GET_ESID_1T macro to compare.
157 */
158static inline int esids_match(unsigned long addr1, unsigned long addr2)
159{
160 int esid_1t_count;
161
162 /* System is not 1T segment size capable. */
163 if (!cpu_has_feature(CPU_FTR_1T_SEGMENT))
164 return (GET_ESID(addr1) == GET_ESID(addr2));
165
166 esid_1t_count = (((addr1 >> SID_SHIFT_1T) != 0) +
167 ((addr2 >> SID_SHIFT_1T) != 0));
168
169 /* both addresses are < 1T */
170 if (esid_1t_count == 0)
171 return (GET_ESID(addr1) == GET_ESID(addr2));
172
173 /* One address < 1T, the other > 1T. Not a match */
174 if (esid_1t_count == 1)
175 return 0;
176
177 /* Both addresses are > 1T. */
178 return (GET_ESID_1T(addr1) == GET_ESID_1T(addr2));
179}
180
151/* Flush all user entries from the segment table of the current processor. */ 181/* Flush all user entries from the segment table of the current processor. */
152void switch_slb(struct task_struct *tsk, struct mm_struct *mm) 182void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
153{ 183{
@@ -193,15 +223,14 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
193 return; 223 return;
194 slb_allocate(pc); 224 slb_allocate(pc);
195 225
196 if (GET_ESID(pc) == GET_ESID(stack)) 226 if (esids_match(pc,stack))
197 return; 227 return;
198 228
199 if (is_kernel_addr(stack)) 229 if (is_kernel_addr(stack))
200 return; 230 return;
201 slb_allocate(stack); 231 slb_allocate(stack);
202 232
203 if ((GET_ESID(pc) == GET_ESID(unmapped_base)) 233 if (esids_match(pc,unmapped_base) || esids_match(stack,unmapped_base))
204 || (GET_ESID(stack) == GET_ESID(unmapped_base)))
205 return; 234 return;
206 235
207 if (is_kernel_addr(unmapped_base)) 236 if (is_kernel_addr(unmapped_base))
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 9e85bda76216..50448d5de9d2 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -20,6 +20,7 @@
20#include <asm/lmb.h> 20#include <asm/lmb.h>
21#include <asm/abs_addr.h> 21#include <asm/abs_addr.h>
22#include <asm/firmware.h> 22#include <asm/firmware.h>
23#include <asm/iseries/hv_call.h>
23 24
24struct stab_entry { 25struct stab_entry {
25 unsigned long esid_data; 26 unsigned long esid_data;
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index eafbca52bff9..e2d867ce1c7e 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -54,12 +54,10 @@ unsigned long pte_freelist_forced_free;
54 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \ 54 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \
55 / sizeof(pgtable_free_t)) 55 / sizeof(pgtable_free_t))
56 56
57#ifdef CONFIG_SMP
58static void pte_free_smp_sync(void *arg) 57static void pte_free_smp_sync(void *arg)
59{ 58{
60 /* Do nothing, just ensure we sync with all CPUs */ 59 /* Do nothing, just ensure we sync with all CPUs */
61} 60}
62#endif
63 61
64/* This is only called when we are critically out of memory 62/* This is only called when we are critically out of memory
65 * (and fail to get a page in pte_free_tlb). 63 * (and fail to get a page in pte_free_tlb).
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index eb0c136b1c44..ff6db2431798 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -17,12 +17,13 @@
17 */ 17 */
18 18
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/of_platform.h>
21
20#include <asm/machdep.h> 22#include <asm/machdep.h>
21#include <asm/prom.h> 23#include <asm/prom.h>
22#include <asm/udbg.h> 24#include <asm/udbg.h>
23#include <asm/time.h> 25#include <asm/time.h>
24#include <asm/uic.h> 26#include <asm/uic.h>
25#include <asm/of_platform.h>
26 27
27static struct of_device_id walnut_of_bus[] = { 28static struct of_device_id walnut_of_bus[] = {
28 { .compatible = "ibm,plb3", }, 29 { .compatible = "ibm,plb3", },
diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
index 470e1a3fd755..be23f112184f 100644
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ b/arch/powerpc/platforms/44x/bamboo.c
@@ -14,12 +14,13 @@
14 * option) any later version. 14 * option) any later version.
15 */ 15 */
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/of_platform.h>
18
17#include <asm/machdep.h> 19#include <asm/machdep.h>
18#include <asm/prom.h> 20#include <asm/prom.h>
19#include <asm/udbg.h> 21#include <asm/udbg.h>
20#include <asm/time.h> 22#include <asm/time.h>
21#include <asm/uic.h> 23#include <asm/uic.h>
22#include <asm/of_platform.h>
23#include "44x.h" 24#include "44x.h"
24 25
25static struct of_device_id bamboo_of_bus[] = { 26static struct of_device_id bamboo_of_bus[] = {
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 40e18fcb666c..6cd3476767cc 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -17,12 +17,13 @@
17 */ 17 */
18 18
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/of_platform.h>
21
20#include <asm/machdep.h> 22#include <asm/machdep.h>
21#include <asm/prom.h> 23#include <asm/prom.h>
22#include <asm/udbg.h> 24#include <asm/udbg.h>
23#include <asm/time.h> 25#include <asm/time.h>
24#include <asm/uic.h> 26#include <asm/uic.h>
25#include <asm/of_platform.h>
26 27
27#include "44x.h" 28#include "44x.h"
28 29
diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
index 30700b31d43b..21a9dd14f297 100644
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ b/arch/powerpc/platforms/44x/sequoia.c
@@ -14,12 +14,13 @@
14 * option) any later version. 14 * option) any later version.
15 */ 15 */
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/of_platform.h>
18
17#include <asm/machdep.h> 19#include <asm/machdep.h>
18#include <asm/prom.h> 20#include <asm/prom.h>
19#include <asm/udbg.h> 21#include <asm/udbg.h>
20#include <asm/time.h> 22#include <asm/time.h>
21#include <asm/uic.h> 23#include <asm/uic.h>
22#include <asm/of_platform.h>
23#include "44x.h" 24#include "44x.h"
24 25
25static struct of_device_id sequoia_of_bus[] = { 26static struct of_device_id sequoia_of_bus[] = {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 972fa8528a8c..39ee7a13b25a 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -90,10 +90,11 @@ static void __init mpc832x_sys_setup_arch(void)
90 90
91 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth")) 91 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
92 != NULL){ 92 != NULL){
93 /* Reset the Ethernet PHY */ 93 /* Reset the Ethernet PHYs */
94 bcsr_regs[9] &= ~0x20; 94#define BCSR8_FETH_RST 0x50
95 bcsr_regs[8] &= ~BCSR8_FETH_RST;
95 udelay(1000); 96 udelay(1000);
96 bcsr_regs[9] |= 0x20; 97 bcsr_regs[8] |= BCSR8_FETH_RST;
97 iounmap(bcsr_regs); 98 iounmap(bcsr_regs);
98 of_node_put(np); 99 of_node_put(np);
99 } 100 }
@@ -145,30 +146,6 @@ static void __init mpc832x_sys_init_IRQ(void)
145#endif /* CONFIG_QUICC_ENGINE */ 146#endif /* CONFIG_QUICC_ENGINE */
146} 147}
147 148
148#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
149extern ulong ds1374_get_rtc_time(void);
150extern int ds1374_set_rtc_time(ulong);
151
152static int __init mpc832x_rtc_hookup(void)
153{
154 struct timespec tv;
155
156 if (!machine_is(mpc832x_mds))
157 return 0;
158
159 ppc_md.get_rtc_time = ds1374_get_rtc_time;
160 ppc_md.set_rtc_time = ds1374_set_rtc_time;
161
162 tv.tv_nsec = 0;
163 tv.tv_sec = (ppc_md.get_rtc_time) ();
164 do_settimeofday(&tv);
165
166 return 0;
167}
168
169late_initcall(mpc832x_rtc_hookup);
170#endif
171
172/* 149/*
173 * Called very early, MMU is off, device-tree isn't unflattened 150 * Called very early, MMU is off, device-tree isn't unflattened
174 */ 151 */
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index fbca336aa0ae..d4bd04001b99 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -15,7 +15,10 @@
15 */ 15 */
16 16
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/interrupt.h>
18#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/spi/mmc_spi.h>
21#include <linux/mmc/host.h>
19 22
20#include <asm/of_platform.h> 23#include <asm/of_platform.h>
21#include <asm/time.h> 24#include <asm/time.h>
@@ -46,15 +49,16 @@ static void mpc83xx_spi_deactivate_cs(u8 cs, u8 polarity)
46 par_io_data_set(3, 13, !polarity); 49 par_io_data_set(3, 13, !polarity);
47} 50}
48 51
52static struct mmc_spi_platform_data mpc832x_mmc_pdata = {
53 .ocr_mask = MMC_VDD_33_34,
54};
55
49static struct spi_board_info mpc832x_spi_boardinfo = { 56static struct spi_board_info mpc832x_spi_boardinfo = {
50 .bus_num = 0x4c0, 57 .bus_num = 0x4c0,
51 .chip_select = 0, 58 .chip_select = 0,
52 .max_speed_hz = 50000000, 59 .max_speed_hz = 50000000,
53 /* 60 .modalias = "mmc_spi",
54 * XXX: This is spidev (spi in userspace) stub, should 61 .platform_data = &mpc832x_mmc_pdata,
55 * be replaced by "mmc_spi" when mmc_spi will hit mainline.
56 */
57 .modalias = "spidev",
58}; 62};
59 63
60static int __init mpc832x_spi_init(void) 64static int __init mpc832x_spi_init(void)
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index 00aed7c2269e..a81bb3ce6b94 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -106,30 +106,6 @@ static void __init mpc834x_mds_init_IRQ(void)
106 ipic_set_default_priority(); 106 ipic_set_default_priority();
107} 107}
108 108
109#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
110extern ulong ds1374_get_rtc_time(void);
111extern int ds1374_set_rtc_time(ulong);
112
113static int __init mpc834x_rtc_hookup(void)
114{
115 struct timespec tv;
116
117 if (!machine_is(mpc834x_mds))
118 return 0;
119
120 ppc_md.get_rtc_time = ds1374_get_rtc_time;
121 ppc_md.set_rtc_time = ds1374_set_rtc_time;
122
123 tv.tv_nsec = 0;
124 tv.tv_sec = (ppc_md.get_rtc_time) ();
125 do_settimeofday(&tv);
126
127 return 0;
128}
129
130late_initcall(mpc834x_rtc_hookup);
131#endif
132
133/* 109/*
134 * Called very early, MMU is off, device-tree isn't unflattened 110 * Called very early, MMU is off, device-tree isn't unflattened
135 */ 111 */
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 0f3855c95ff5..e40012f8f488 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -96,14 +96,39 @@ static void __init mpc836x_mds_setup_arch(void)
96 96
97 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth")) 97 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
98 != NULL){ 98 != NULL){
99 uint svid;
100
99 /* Reset the Ethernet PHY */ 101 /* Reset the Ethernet PHY */
100 bcsr_regs[9] &= ~0x20; 102#define BCSR9_GETHRST 0x20
103 clrbits8(&bcsr_regs[9], BCSR9_GETHRST);
101 udelay(1000); 104 udelay(1000);
102 bcsr_regs[9] |= 0x20; 105 setbits8(&bcsr_regs[9], BCSR9_GETHRST);
106
107 /* handle mpc8360ea rev.2.1 erratum 2: RGMII Timing */
108 svid = mfspr(SPRN_SVR);
109 if (svid == 0x80480021) {
110 void __iomem *immap;
111
112 immap = ioremap(get_immrbase() + 0x14a8, 8);
113
114 /*
115 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2)
116 * IMMR + 0x14A8[18:19] = 11 (clk delay for UCC 1)
117 */
118 setbits32(immap, 0x0c003000);
119
120 /*
121 * IMMR + 0x14AC[20:27] = 10101010
122 * (data delay for both UCC's)
123 */
124 clrsetbits_be32(immap + 4, 0xff0, 0xaa0);
125
126 iounmap(immap);
127 }
128
103 iounmap(bcsr_regs); 129 iounmap(bcsr_regs);
104 of_node_put(np); 130 of_node_put(np);
105 } 131 }
106
107#endif /* CONFIG_QUICC_ENGINE */ 132#endif /* CONFIG_QUICC_ENGINE */
108} 133}
109 134
@@ -152,30 +177,6 @@ static void __init mpc836x_mds_init_IRQ(void)
152#endif /* CONFIG_QUICC_ENGINE */ 177#endif /* CONFIG_QUICC_ENGINE */
153} 178}
154 179
155#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
156extern ulong ds1374_get_rtc_time(void);
157extern int ds1374_set_rtc_time(ulong);
158
159static int __init mpc8360_rtc_hookup(void)
160{
161 struct timespec tv;
162
163 if (!machine_is(mpc836x_mds))
164 return 0;
165
166 ppc_md.get_rtc_time = ds1374_get_rtc_time;
167 ppc_md.set_rtc_time = ds1374_set_rtc_time;
168
169 tv.tv_nsec = 0;
170 tv.tv_sec = (ppc_md.get_rtc_time) ();
171 do_settimeofday(&tv);
172
173 return 0;
174}
175
176late_initcall(mpc8360_rtc_hookup);
177#endif
178
179/* 180/*
180 * Called very early, MMU is off, device-tree isn't unflattened 181 * Called very early, MMU is off, device-tree isn't unflattened
181 */ 182 */
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index eafe7605cdac..b45160f8d084 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -130,7 +130,7 @@ int mpc831x_usb_cfg(void)
130 out_be32(immap + MPC83XX_SCCR_OFFS, temp); 130 out_be32(immap + MPC83XX_SCCR_OFFS, temp);
131 131
132 /* Configure pin mux for ULPI. There is no pin mux for UTMI */ 132 /* Configure pin mux for ULPI. There is no pin mux for UTMI */
133 if (!strcmp(prop, "ulpi")) { 133 if (prop && !strcmp(prop, "ulpi")) {
134 temp = in_be32(immap + MPC83XX_SICRL_OFFS); 134 temp = in_be32(immap + MPC83XX_SICRL_OFFS);
135 temp &= ~MPC831X_SICRL_USB_MASK; 135 temp &= ~MPC831X_SICRL_USB_MASK;
136 temp |= MPC831X_SICRL_USB_ULPI; 136 temp |= MPC831X_SICRL_USB_ULPI;
@@ -153,13 +153,13 @@ int mpc831x_usb_cfg(void)
153 usb_regs = ioremap(res.start, res.end - res.start + 1); 153 usb_regs = ioremap(res.start, res.end - res.start + 1);
154 154
155 /* Using on-chip PHY */ 155 /* Using on-chip PHY */
156 if (!strcmp(prop, "utmi_wide") || 156 if (prop && (!strcmp(prop, "utmi_wide") ||
157 !strcmp(prop, "utmi")) { 157 !strcmp(prop, "utmi"))) {
158 /* Set UTMI_PHY_EN, REFSEL to 48MHZ */ 158 /* Set UTMI_PHY_EN, REFSEL to 48MHZ */
159 out_be32(usb_regs + FSL_USB2_CONTROL_OFFS, 159 out_be32(usb_regs + FSL_USB2_CONTROL_OFFS,
160 CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ); 160 CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ);
161 /* Using external UPLI PHY */ 161 /* Using external UPLI PHY */
162 } else if (!strcmp(prop, "ulpi")) { 162 } else if (prop && !strcmp(prop, "ulpi")) {
163 /* Set PHY_CLK_SEL to ULPI */ 163 /* Set PHY_CLK_SEL to ULPI */
164 temp = CONTROL_PHY_CLK_SEL_ULPI; 164 temp = CONTROL_PHY_CLK_SEL_ULPI;
165#ifdef CONFIG_USB_OTG 165#ifdef CONFIG_USB_OTG
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 151fd8b82d63..04f74f9f9ab6 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -158,6 +158,18 @@ static unsigned int iic_get_irq(void)
158 return virq; 158 return virq;
159} 159}
160 160
161void iic_setup_cpu(void)
162{
163 out_be64(&__get_cpu_var(iic).regs->prio, 0xff);
164}
165
166u8 iic_get_target_id(int cpu)
167{
168 return per_cpu(iic, cpu).target_id;
169}
170
171EXPORT_SYMBOL_GPL(iic_get_target_id);
172
161#ifdef CONFIG_SMP 173#ifdef CONFIG_SMP
162 174
163/* Use the highest interrupt priorities for IPI */ 175/* Use the highest interrupt priorities for IPI */
@@ -166,29 +178,17 @@ static inline int iic_ipi_to_irq(int ipi)
166 return IIC_IRQ_TYPE_IPI + 0xf - ipi; 178 return IIC_IRQ_TYPE_IPI + 0xf - ipi;
167} 179}
168 180
169void iic_setup_cpu(void)
170{
171 out_be64(&__get_cpu_var(iic).regs->prio, 0xff);
172}
173
174void iic_cause_IPI(int cpu, int mesg) 181void iic_cause_IPI(int cpu, int mesg)
175{ 182{
176 out_be64(&per_cpu(iic, cpu).regs->generate, (0xf - mesg) << 4); 183 out_be64(&per_cpu(iic, cpu).regs->generate, (0xf - mesg) << 4);
177} 184}
178 185
179u8 iic_get_target_id(int cpu)
180{
181 return per_cpu(iic, cpu).target_id;
182}
183EXPORT_SYMBOL_GPL(iic_get_target_id);
184
185struct irq_host *iic_get_irq_host(int node) 186struct irq_host *iic_get_irq_host(int node)
186{ 187{
187 return iic_host; 188 return iic_host;
188} 189}
189EXPORT_SYMBOL_GPL(iic_get_irq_host); 190EXPORT_SYMBOL_GPL(iic_get_irq_host);
190 191
191
192static irqreturn_t iic_ipi_action(int irq, void *dev_id) 192static irqreturn_t iic_ipi_action(int irq, void *dev_id)
193{ 193{
194 int ipi = (int)(long)dev_id; 194 int ipi = (int)(long)dev_id;
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index 1c0acbad7425..e4438456c867 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -44,6 +44,7 @@
44#include <asm/rtas.h> 44#include <asm/rtas.h>
45 45
46#include "interrupt.h" 46#include "interrupt.h"
47#include <asm/udbg.h>
47 48
48#ifdef DEBUG 49#ifdef DEBUG
49#define DBG(fmt...) udbg_printf(fmt) 50#define DBG(fmt...) udbg_printf(fmt)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 0966d093db43..c0e968a4c211 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -171,6 +171,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir)
171{ 171{
172 /* remove all entries */ 172 /* remove all entries */
173 spufs_prune_dir(dir); 173 spufs_prune_dir(dir);
174 d_drop(dir);
174 175
175 return simple_rmdir(parent, dir); 176 return simple_rmdir(parent, dir);
176} 177}
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
index 1769d755eff3..ddfb35ae741f 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -49,6 +49,7 @@
49#include <asm/machdep.h> 49#include <asm/machdep.h>
50#include <asm/cputable.h> 50#include <asm/cputable.h>
51#include <asm/irq.h> 51#include <asm/irq.h>
52#include <asm/time.h>
52#include <asm/spu_priv1.h> 53#include <asm/spu_priv1.h>
53#include <asm/firmware.h> 54#include <asm/firmware.h>
54#include <asm/of_platform.h> 55#include <asm/of_platform.h>
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index e484cac75095..653a5eb91c90 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -144,6 +144,7 @@ static int __init prpmc2800_probe(void)
144 strncpy(prpmc2800_platform_name, m, 144 strncpy(prpmc2800_platform_name, m,
145 min((int)len, PLATFORM_NAME_MAX - 1)); 145 min((int)len, PLATFORM_NAME_MAX - 1));
146 146
147 _set_L2CR(_get_L2CR() | L2CR_L2E);
147 return 1; 148 return 1;
148} 149}
149 150
diff --git a/arch/powerpc/platforms/iseries/irq.h b/arch/powerpc/platforms/iseries/irq.h
index 69f1b437fc7b..a1c236074034 100644
--- a/arch/powerpc/platforms/iseries/irq.h
+++ b/arch/powerpc/platforms/iseries/irq.h
@@ -1,9 +1,13 @@
1#ifndef _ISERIES_IRQ_H 1#ifndef _ISERIES_IRQ_H
2#define _ISERIES_IRQ_H 2#define _ISERIES_IRQ_H
3 3
4#ifdef CONFIG_PCI
4extern void iSeries_init_IRQ(void); 5extern void iSeries_init_IRQ(void);
5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, u32); 6extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, u32);
6extern void iSeries_activate_IRQs(void); 7extern void iSeries_activate_IRQs(void);
8#else
9#define iSeries_init_IRQ NULL
10#endif
7extern unsigned int iSeries_get_irq(void); 11extern unsigned int iSeries_get_irq(void);
8 12
9#endif /* _ISERIES_IRQ_H */ 13#endif /* _ISERIES_IRQ_H */
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 37ae07ee54a9..0877a8834110 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -617,10 +617,6 @@ static void iseries_dedicated_idle(void)
617 } 617 }
618} 618}
619 619
620#ifndef CONFIG_PCI
621void __init iSeries_init_IRQ(void) { }
622#endif
623
624static void __iomem *iseries_ioremap(phys_addr_t address, unsigned long size, 620static void __iomem *iseries_ioremap(phys_addr_t address, unsigned long size,
625 unsigned long flags) 621 unsigned long flags)
626{ 622{
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
index d6435b03971f..be06cfd9fa3d 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -523,15 +523,16 @@ static void __init get_viotape_info(struct device_node *vio_root)
523static int __init iseries_vio_init(void) 523static int __init iseries_vio_init(void)
524{ 524{
525 struct device_node *vio_root; 525 struct device_node *vio_root;
526 int ret = -ENODEV;
526 527
527 if (!firmware_has_feature(FW_FEATURE_ISERIES)) 528 if (!firmware_has_feature(FW_FEATURE_ISERIES))
528 return -ENODEV; 529 goto out;
529 530
530 iommu_vio_init(); 531 iommu_vio_init();
531 532
532 vio_root = of_find_node_by_path("/vdevice"); 533 vio_root = of_find_node_by_path("/vdevice");
533 if (!vio_root) 534 if (!vio_root)
534 return -ENODEV; 535 goto out;
535 536
536 if (viopath_hostLp == HvLpIndexInvalid) { 537 if (viopath_hostLp == HvLpIndexInvalid) {
537 vio_set_hostlp(); 538 vio_set_hostlp();
@@ -544,10 +545,11 @@ static int __init iseries_vio_init(void)
544 get_viocd_info(vio_root); 545 get_viocd_info(vio_root);
545 get_viotape_info(vio_root); 546 get_viotape_info(vio_root);
546 547
547 return 0; 548 ret = 0;
548 549
549 put_node: 550 put_node:
550 of_node_put(vio_root); 551 of_node_put(vio_root);
551 return -ENODEV; 552 out:
553 return ret;
552} 554}
553arch_initcall(iseries_vio_init); 555arch_initcall(iseries_vio_init);
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 3a5d112af5e0..3d62060498b4 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -214,7 +214,7 @@ static __init void pas_init_IRQ(void)
214 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 214 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
215 215
216 mpic = mpic_alloc(mpic_node, openpic_addr, 216 mpic = mpic_alloc(mpic_node, openpic_addr,
217 MPIC_PRIMARY|MPIC_LARGE_VECTORS|MPIC_WANTS_RESET, 217 MPIC_PRIMARY|MPIC_LARGE_VECTORS,
218 0, 0, " PAS-OPIC "); 218 0, 0, " PAS-OPIC ");
219 BUG_ON(!mpic); 219 BUG_ON(!mpic);
220 220
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 16e4e401b820..306a9d07491d 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -21,7 +21,7 @@ config PPC_SPLPAR
21 21
22config EEH 22config EEH
23 bool "PCI Extended Error Handling (EEH)" if EMBEDDED 23 bool "PCI Extended Error Handling (EEH)" if EMBEDDED
24 depends on PPC_PSERIES 24 depends on PPC_PSERIES && PCI
25 default y if !EMBEDDED 25 default y if !EMBEDDED
26 26
27config SCANLOG 27config SCANLOG
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 22322b35a0ff..fb3d636e088b 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -186,6 +186,11 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
186 n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); 186 n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg);
187 printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg); 187 printk(KERN_WARNING "EEH: PCI cmd/status register: %08x\n", cfg);
188 188
189 if (!dev) {
190 printk(KERN_WARNING "EEH: no PCI device for this of node\n");
191 return n;
192 }
193
189 /* Gather bridge-specific registers */ 194 /* Gather bridge-specific registers */
190 if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { 195 if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) {
191 rtas_read_config(pdn, PCI_SEC_STATUS, 2, &cfg); 196 rtas_read_config(pdn, PCI_SEC_STATUS, 2, &cfg);
@@ -198,7 +203,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
198 } 203 }
199 204
200 /* Dump out the PCI-X command and status regs */ 205 /* Dump out the PCI-X command and status regs */
201 cap = pci_find_capability(pdn->pcidev, PCI_CAP_ID_PCIX); 206 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
202 if (cap) { 207 if (cap) {
203 rtas_read_config(pdn, cap, 4, &cfg); 208 rtas_read_config(pdn, cap, 4, &cfg);
204 n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg); 209 n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg);
@@ -210,7 +215,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
210 } 215 }
211 216
212 /* If PCI-E capable, dump PCI-E cap 10, and the AER */ 217 /* If PCI-E capable, dump PCI-E cap 10, and the AER */
213 cap = pci_find_capability(pdn->pcidev, PCI_CAP_ID_EXP); 218 cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
214 if (cap) { 219 if (cap) {
215 n += scnprintf(buf+n, len-n, "pci-e cap10:\n"); 220 n += scnprintf(buf+n, len-n, "pci-e cap10:\n");
216 printk(KERN_WARNING 221 printk(KERN_WARNING
@@ -222,7 +227,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
222 printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg); 227 printk(KERN_WARNING "EEH: PCI-E %02x: %08x\n", i, cfg);
223 } 228 }
224 229
225 cap = pci_find_ext_capability(pdn->pcidev, PCI_EXT_CAP_ID_ERR); 230 cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
226 if (cap) { 231 if (cap) {
227 n += scnprintf(buf+n, len-n, "pci-e AER:\n"); 232 n += scnprintf(buf+n, len-n, "pci-e AER:\n");
228 printk(KERN_WARNING 233 printk(KERN_WARNING
@@ -318,7 +323,7 @@ eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs)
318 323
319 if (rets[2] == 0) return -1; /* permanently unavailable */ 324 if (rets[2] == 0) return -1; /* permanently unavailable */
320 325
321 if (max_wait_msecs <= 0) return -1; 326 if (max_wait_msecs <= 0) break;
322 327
323 mwait = rets[2]; 328 mwait = rets[2];
324 if (mwait <= 0) { 329 if (mwait <= 0) {
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 15e015ef6865..57e025e84ab4 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -105,17 +105,18 @@ static void eeh_report_error(struct pci_dev *dev, void *userdata)
105 return; 105 return;
106 106
107 rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen); 107 rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen);
108
109 /* A driver that needs a reset trumps all others */
110 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
108 if (*res == PCI_ERS_RESULT_NONE) *res = rc; 111 if (*res == PCI_ERS_RESULT_NONE) *res = rc;
109 if (*res == PCI_ERS_RESULT_DISCONNECT &&
110 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
111} 112}
112 113
113/** 114/**
114 * eeh_report_mmio_enabled - tell drivers that MMIO has been enabled 115 * eeh_report_mmio_enabled - tell drivers that MMIO has been enabled
115 * 116 *
116 * Report an EEH error to each device driver, collect up and 117 * Tells each device driver that IO ports, MMIO and config space I/O
117 * merge the device driver responses. Cumulative response 118 * are now enabled. Collects up and merges the device driver responses.
118 * passed back in "userdata". 119 * Cumulative response passed back in "userdata".
119 */ 120 */
120 121
121static void eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata) 122static void eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata)
@@ -123,17 +124,16 @@ static void eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata)
123 enum pci_ers_result rc, *res = userdata; 124 enum pci_ers_result rc, *res = userdata;
124 struct pci_driver *driver = dev->driver; 125 struct pci_driver *driver = dev->driver;
125 126
126 // dev->error_state = pci_channel_mmio_enabled;
127
128 if (!driver || 127 if (!driver ||
129 !driver->err_handler || 128 !driver->err_handler ||
130 !driver->err_handler->mmio_enabled) 129 !driver->err_handler->mmio_enabled)
131 return; 130 return;
132 131
133 rc = driver->err_handler->mmio_enabled (dev); 132 rc = driver->err_handler->mmio_enabled (dev);
133
134 /* A driver that needs a reset trumps all others */
135 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
134 if (*res == PCI_ERS_RESULT_NONE) *res = rc; 136 if (*res == PCI_ERS_RESULT_NONE) *res = rc;
135 if (*res == PCI_ERS_RESULT_DISCONNECT &&
136 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
137} 137}
138 138
139/** 139/**
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 8b18a1c40092..b765b7c77b65 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -25,6 +25,7 @@
25 25
26#include <asm/firmware.h> 26#include <asm/firmware.h>
27#include <asm/prom.h> 27#include <asm/prom.h>
28#include <asm/udbg.h>
28 29
29#ifdef DEBUG 30#ifdef DEBUG
30#define DBG(fmt...) udbg_printf(fmt) 31#define DBG(fmt...) udbg_printf(fmt)
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 2793a1b100e6..f15222bbe136 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -171,6 +171,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
171 struct pci_dn *pdn; 171 struct pci_dn *pdn;
172 int hwirq, virq, i, rc; 172 int hwirq, virq, i, rc;
173 struct msi_desc *entry; 173 struct msi_desc *entry;
174 struct msi_msg msg;
174 175
175 pdn = get_pdn(pdev); 176 pdn = get_pdn(pdev);
176 if (!pdn) 177 if (!pdn)
@@ -213,6 +214,11 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
213 214
214 dev_dbg(&pdev->dev, "rtas_msi: allocated virq %d\n", virq); 215 dev_dbg(&pdev->dev, "rtas_msi: allocated virq %d\n", virq);
215 set_irq_msi(virq, entry); 216 set_irq_msi(virq, entry);
217
218 /* Read config space back so we can restore after reset */
219 read_msi_msg(virq, &msg);
220 entry->msg = msg;
221
216 unmask_msi_irq(virq); 222 unmask_msi_irq(virq);
217 } 223 }
218 224
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index fdb9b1c8f977..fdeefe54ea91 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -507,7 +507,8 @@ define_machine(pseries) {
507 .restart = rtas_restart, 507 .restart = rtas_restart,
508 .power_off = pSeries_power_off, 508 .power_off = pSeries_power_off,
509 .halt = rtas_halt, 509 .halt = rtas_halt,
510 .panic = rtas_os_term, 510 .panic = rtas_panic_msg,
511 .machine_shutdown = rtas_os_term,
511 .get_boot_time = rtas_get_boot_time, 512 .get_boot_time = rtas_get_boot_time,
512 .get_rtc_time = rtas_get_rtc_time, 513 .get_rtc_time = rtas_get_rtc_time,
513 .set_rtc_time = rtas_set_rtc_time, 514 .set_rtc_time = rtas_set_rtc_time,
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 66c8ad4cfce6..165981c87786 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -77,8 +77,6 @@ int __init cpm_muram_init(void)
77 int i = 0; 77 int i = 0;
78 int ret = 0; 78 int ret = 0;
79 79
80 printk("cpm_muram_init\n");
81
82 spin_lock_init(&cpm_muram_lock); 80 spin_lock_init(&cpm_muram_lock);
83 /* initialize the info header */ 81 /* initialize the info header */
84 rh_init(&cpm_muram_info, 1, 82 rh_init(&cpm_muram_info, 1,
@@ -193,7 +191,7 @@ void __iomem *cpm_muram_addr(unsigned long offset)
193EXPORT_SYMBOL(cpm_muram_addr); 191EXPORT_SYMBOL(cpm_muram_addr);
194 192
195/** 193/**
196 * cpm_muram_phys - turn a muram virtual address into a DMA address 194 * cpm_muram_dma - turn a muram virtual address into a DMA address
197 * @offset: virtual address from cpm_muram_addr() to convert 195 * @offset: virtual address from cpm_muram_addr() to convert
198 */ 196 */
199dma_addr_t cpm_muram_dma(void __iomem *addr) 197dma_addr_t cpm_muram_dma(void __iomem *addr)
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index 7c1b27ac7d3c..216c0f5680d2 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -137,6 +137,7 @@ static void i8259_unmask_irq(unsigned int irq_nr)
137static struct irq_chip i8259_pic = { 137static struct irq_chip i8259_pic = {
138 .typename = " i8259 ", 138 .typename = " i8259 ",
139 .mask = i8259_mask_irq, 139 .mask = i8259_mask_irq,
140 .disable = i8259_mask_irq,
140 .unmask = i8259_unmask_irq, 141 .unmask = i8259_unmask_irq,
141 .mask_ack = i8259_mask_and_ack_irq, 142 .mask_ack = i8259_mask_and_ack_irq,
142}; 143};
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index 9b3baa7317d7..6933f9c73b43 100644
--- a/arch/powerpc/sysdev/mv64x60_pci.c
+++ b/arch/powerpc/sysdev/mv64x60_pci.c
@@ -24,8 +24,9 @@
24#define MV64X60_VAL_LEN_MAX 11 24#define MV64X60_VAL_LEN_MAX 11
25#define MV64X60_PCICFG_CPCI_HOTSWAP 0x68 25#define MV64X60_PCICFG_CPCI_HOTSWAP 0x68
26 26
27static ssize_t mv64x60_hs_reg_read(struct kobject *kobj, char *buf, loff_t off, 27static ssize_t mv64x60_hs_reg_read(struct kobject *kobj,
28 size_t count) 28 struct bin_attribute *attr, char *buf,
29 loff_t off, size_t count)
29{ 30{
30 struct pci_dev *phb; 31 struct pci_dev *phb;
31 u32 v; 32 u32 v;
@@ -44,8 +45,9 @@ static ssize_t mv64x60_hs_reg_read(struct kobject *kobj, char *buf, loff_t off,
44 return sprintf(buf, "0x%08x\n", v); 45 return sprintf(buf, "0x%08x\n", v);
45} 46}
46 47
47static ssize_t mv64x60_hs_reg_write(struct kobject *kobj, char *buf, loff_t off, 48static ssize_t mv64x60_hs_reg_write(struct kobject *kobj,
48 size_t count) 49 struct bin_attribute *attr, char *buf,
50 loff_t off, size_t count)
49{ 51{
50 struct pci_dev *phb; 52 struct pci_dev *phb;
51 u32 v; 53 u32 v;
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 5149716c734d..847a5496b869 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -97,6 +97,22 @@ static void uic_ack_irq(unsigned int virq)
97 spin_unlock_irqrestore(&uic->lock, flags); 97 spin_unlock_irqrestore(&uic->lock, flags);
98} 98}
99 99
100static void uic_mask_ack_irq(unsigned int virq)
101{
102 struct uic *uic = get_irq_chip_data(virq);
103 unsigned int src = uic_irq_to_hw(virq);
104 unsigned long flags;
105 u32 er, sr;
106
107 sr = 1 << (31-src);
108 spin_lock_irqsave(&uic->lock, flags);
109 er = mfdcr(uic->dcrbase + UIC_ER);
110 er &= ~sr;
111 mtdcr(uic->dcrbase + UIC_ER, er);
112 mtdcr(uic->dcrbase + UIC_SR, sr);
113 spin_unlock_irqrestore(&uic->lock, flags);
114}
115
100static int uic_set_irq_type(unsigned int virq, unsigned int flow_type) 116static int uic_set_irq_type(unsigned int virq, unsigned int flow_type)
101{ 117{
102 struct uic *uic = get_irq_chip_data(virq); 118 struct uic *uic = get_irq_chip_data(virq);
@@ -152,7 +168,7 @@ static struct irq_chip uic_irq_chip = {
152 .typename = " UIC ", 168 .typename = " UIC ",
153 .unmask = uic_unmask_irq, 169 .unmask = uic_unmask_irq,
154 .mask = uic_mask_irq, 170 .mask = uic_mask_irq,
155/* .mask_ack = uic_mask_irq_and_ack, */ 171 .mask_ack = uic_mask_ack_irq,
156 .ack = uic_ack_irq, 172 .ack = uic_ack_irq,
157 .set_type = uic_set_irq_type, 173 .set_type = uic_set_irq_type,
158}; 174};
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index fba7ca17a67e..59e77eb63338 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -244,6 +244,16 @@ syscall_exit_cont:
244 andis. r10,r0,DBCR0_IC@h 244 andis. r10,r0,DBCR0_IC@h
245 bnel- load_dbcr0 245 bnel- load_dbcr0
246#endif 246#endif
247#ifdef CONFIG_44x
248 lis r4,icache_44x_need_flush@ha
249 lwz r5,icache_44x_need_flush@l(r4)
250 cmplwi cr0,r5,0
251 bne- 2f
2521:
253#endif /* CONFIG_44x */
254BEGIN_FTR_SECTION
255 lwarx r7,0,r1
256END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
247 stwcx. r0,0,r1 /* to clear the reservation */ 257 stwcx. r0,0,r1 /* to clear the reservation */
248 lwz r4,_LINK(r1) 258 lwz r4,_LINK(r1)
249 lwz r5,_CCR(r1) 259 lwz r5,_CCR(r1)
@@ -258,6 +268,12 @@ syscall_exit_cont:
258 mtspr SPRN_SRR1,r8 268 mtspr SPRN_SRR1,r8
259 SYNC 269 SYNC
260 RFI 270 RFI
271#ifdef CONFIG_44x
2722: li r7,0
273 iccci r0,r0
274 stw r7,icache_44x_need_flush@l(r4)
275 b 1b
276#endif /* CONFIG_44x */
261 277
26266: li r3,-ENOSYS 27866: li r3,-ENOSYS
263 b ret_from_syscall 279 b ret_from_syscall
@@ -679,6 +695,16 @@ resume_kernel:
679 695
680 /* interrupts are hard-disabled at this point */ 696 /* interrupts are hard-disabled at this point */
681restore: 697restore:
698#ifdef CONFIG_44x
699 lis r4,icache_44x_need_flush@ha
700 lwz r5,icache_44x_need_flush@l(r4)
701 cmplwi cr0,r5,0
702 beq+ 1f
703 li r6,0
704 iccci r0,r0
705 stw r6,icache_44x_need_flush@l(r4)
7061:
707#endif /* CONFIG_44x */
682 lwz r0,GPR0(r1) 708 lwz r0,GPR0(r1)
683 lwz r2,GPR2(r1) 709 lwz r2,GPR2(r1)
684 REST_4GPRS(3, r1) 710 REST_4GPRS(3, r1)
@@ -690,6 +716,9 @@ restore:
690 mtctr r11 716 mtctr r11
691 717
692 PPC405_ERR77(0,r1) 718 PPC405_ERR77(0,r1)
719BEGIN_FTR_SECTION
720 lwarx r11,0,r1
721END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
693 stwcx. r0,0,r1 /* to clear the reservation */ 722 stwcx. r0,0,r1 /* to clear the reservation */
694 723
695#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 724#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index a22e1f4d94c8..e0c850d85c53 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -224,7 +224,16 @@ _GLOBAL(_tlbia)
224 */ 224 */
225_GLOBAL(_tlbie) 225_GLOBAL(_tlbie)
226#if defined(CONFIG_40x) 226#if defined(CONFIG_40x)
227 /* We run the search with interrupts disabled because we have to change
228 * the PID and I don't want to preempt when that happens.
229 */
230 mfmsr r5
231 mfspr r6,SPRN_PID
232 wrteei 0
233 mtspr SPRN_PID,r4
227 tlbsx. r3, 0, r3 234 tlbsx. r3, 0, r3
235 mtspr SPRN_PID,r6
236 wrtee r5
228 bne 10f 237 bne 10f
229 sync 238 sync
230 /* There are only 64 TLB entries, so r3 < 64, which means bit 25 is clear. 239 /* There are only 64 TLB entries, so r3 < 64, which means bit 25 is clear.
@@ -234,22 +243,21 @@ _GLOBAL(_tlbie)
234 isync 243 isync
23510: 24410:
236#elif defined(CONFIG_44x) 245#elif defined(CONFIG_44x)
237 mfspr r4,SPRN_MMUCR 246 mfspr r5,SPRN_MMUCR
238 mfspr r5,SPRN_PID /* Get PID */ 247 rlwimi r5,r4,0,24,31 /* Set TID */
239 rlwimi r4,r5,0,24,31 /* Set TID */
240 248
241 /* We have to run the search with interrupts disabled, even critical 249 /* We have to run the search with interrupts disabled, even critical
242 * and debug interrupts (in fact the only critical exceptions we have 250 * and debug interrupts (in fact the only critical exceptions we have
243 * are debug and machine check). Otherwise an interrupt which causes 251 * are debug and machine check). Otherwise an interrupt which causes
244 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */ 252 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
245 mfmsr r5 253 mfmsr r4
246 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha 254 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
247 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l 255 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
248 andc r6,r5,r6 256 andc r6,r4,r6
249 mtmsr r6 257 mtmsr r6
250 mtspr SPRN_MMUCR,r4 258 mtspr SPRN_MMUCR,r5
251 tlbsx. r3, 0, r3 259 tlbsx. r3, 0, r3
252 mtmsr r5 260 mtmsr r4
253 bne 10f 261 bne 10f
254 sync 262 sync
255 /* There are only 64 TLB entries, so r3 < 64, 263 /* There are only 64 TLB entries, so r3 < 64,
@@ -491,12 +499,21 @@ END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
491 addi r3,r3,L1_CACHE_BYTES 499 addi r3,r3,L1_CACHE_BYTES
492 bdnz 0b 500 bdnz 0b
493 sync 501 sync
502#ifndef CONFIG_44x
503 /* We don't flush the icache on 44x. Those have a virtual icache
504 * and we don't have access to the virtual address here (it's
505 * not the page vaddr but where it's mapped in user space). The
506 * flushing of the icache on these is handled elsewhere, when
507 * a change in the address space occurs, before returning to
508 * user space
509 */
494 mtctr r4 510 mtctr r4
4951: icbi 0,r6 5111: icbi 0,r6
496 addi r6,r6,L1_CACHE_BYTES 512 addi r6,r6,L1_CACHE_BYTES
497 bdnz 1b 513 bdnz 1b
498 sync 514 sync
499 isync 515 isync
516#endif /* CONFIG_44x */
500 blr 517 blr
501 518
502/* 519/*
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index aac88c2f3db9..5255bd80aa6b 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -312,7 +312,14 @@ early_init(int r3, int r4, int r5)
312 * Identify the CPU type and fix up code sections 312 * Identify the CPU type and fix up code sections
313 * that depend on which cpu we have. 313 * that depend on which cpu we have.
314 */ 314 */
315#if defined(CONFIG_440EP) && defined(CONFIG_PPC_FPU)
316 /* We pass the virtual PVR here for 440EP as 440EP and 440GR have
317 * identical PVRs and there is no reliable way to check for the FPU
318 */
319 spec = identify_cpu(offset, (mfspr(SPRN_PVR) | 0x8));
320#else
315 spec = identify_cpu(offset, mfspr(SPRN_PVR)); 321 spec = identify_cpu(offset, mfspr(SPRN_PVR));
322#endif
316 do_feature_fixups(spec->cpu_features, 323 do_feature_fixups(spec->cpu_features,
317 PTRRELOC(&__start___ftr_fixup), 324 PTRRELOC(&__start___ftr_fixup),
318 PTRRELOC(&__stop___ftr_fixup)); 325 PTRRELOC(&__stop___ftr_fixup));
diff --git a/arch/ppc/mm/44x_mmu.c b/arch/ppc/mm/44x_mmu.c
index 0a0a0487b334..6536a25cfcb8 100644
--- a/arch/ppc/mm/44x_mmu.c
+++ b/arch/ppc/mm/44x_mmu.c
@@ -61,6 +61,7 @@ extern char etext[], _stext[];
61 */ 61 */
62unsigned int tlb_44x_index = 0; 62unsigned int tlb_44x_index = 0;
63unsigned int tlb_44x_hwater = 62; 63unsigned int tlb_44x_hwater = 62;
64int icache_44x_need_flush;
64 65
65/* 66/*
66 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem 67 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem
diff --git a/arch/ppc/mm/4xx_mmu.c b/arch/ppc/mm/4xx_mmu.c
index 838e09db71d9..ea785dbaac7c 100644
--- a/arch/ppc/mm/4xx_mmu.c
+++ b/arch/ppc/mm/4xx_mmu.c
@@ -99,13 +99,12 @@ unsigned long __init mmu_mapin_ram(void)
99 99
100 v = KERNELBASE; 100 v = KERNELBASE;
101 p = PPC_MEMSTART; 101 p = PPC_MEMSTART;
102 s = 0; 102 s = total_lowmem;
103 103
104 if (__map_without_ltlbs) { 104 if (__map_without_ltlbs)
105 return s; 105 return 0;
106 }
107 106
108 while (s <= (total_lowmem - LARGE_PAGE_SIZE_16M)) { 107 while (s >= LARGE_PAGE_SIZE_16M) {
109 pmd_t *pmdp; 108 pmd_t *pmdp;
110 unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE; 109 unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE;
111 110
@@ -117,10 +116,10 @@ unsigned long __init mmu_mapin_ram(void)
117 116
118 v += LARGE_PAGE_SIZE_16M; 117 v += LARGE_PAGE_SIZE_16M;
119 p += LARGE_PAGE_SIZE_16M; 118 p += LARGE_PAGE_SIZE_16M;
120 s += LARGE_PAGE_SIZE_16M; 119 s -= LARGE_PAGE_SIZE_16M;
121 } 120 }
122 121
123 while (s <= (total_lowmem - LARGE_PAGE_SIZE_4M)) { 122 while (s >= LARGE_PAGE_SIZE_4M) {
124 pmd_t *pmdp; 123 pmd_t *pmdp;
125 unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE; 124 unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE;
126 125
@@ -129,8 +128,8 @@ unsigned long __init mmu_mapin_ram(void)
129 128
130 v += LARGE_PAGE_SIZE_4M; 129 v += LARGE_PAGE_SIZE_4M;
131 p += LARGE_PAGE_SIZE_4M; 130 p += LARGE_PAGE_SIZE_4M;
132 s += LARGE_PAGE_SIZE_4M; 131 s -= LARGE_PAGE_SIZE_4M;
133 } 132 }
134 133
135 return s; 134 return total_lowmem - s;
136} 135}
diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
index 254c23b755e6..36c0e7529edb 100644
--- a/arch/ppc/mm/fault.c
+++ b/arch/ppc/mm/fault.c
@@ -227,7 +227,7 @@ good_area:
227 set_bit(PG_arch_1, &page->flags); 227 set_bit(PG_arch_1, &page->flags);
228 } 228 }
229 pte_update(ptep, 0, _PAGE_HWEXEC); 229 pte_update(ptep, 0, _PAGE_HWEXEC);
230 _tlbie(address); 230 _tlbie(address, mm->context.id);
231 pte_unmap_unlock(ptep, ptl); 231 pte_unmap_unlock(ptep, ptl);
232 up_read(&mm->mmap_sem); 232 up_read(&mm->mmap_sem);
233 return 0; 233 return 0;
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
index 390dd1995c2a..dd898d32480e 100644
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -561,7 +561,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
561 * That means the zeroed TLB has to be invalidated 561 * That means the zeroed TLB has to be invalidated
562 * whenever a page miss occurs. 562 * whenever a page miss occurs.
563 */ 563 */
564 _tlbie(address); 564 _tlbie(address, 0 /* 8xx doesn't care about PID */);
565#endif 565#endif
566 if (!PageReserved(page) 566 if (!PageReserved(page)
567 && !test_bit(PG_arch_1, &page->flags)) { 567 && !test_bit(PG_arch_1, &page->flags)) {
diff --git a/arch/ppc/mm/mmu_decl.h b/arch/ppc/mm/mmu_decl.h
index 540f3292b229..b298b60c202f 100644
--- a/arch/ppc/mm/mmu_decl.h
+++ b/arch/ppc/mm/mmu_decl.h
@@ -49,17 +49,17 @@ extern unsigned int num_tlbcam_entries;
49 * architectures. -- Dan 49 * architectures. -- Dan
50 */ 50 */
51#if defined(CONFIG_8xx) 51#if defined(CONFIG_8xx)
52#define flush_HPTE(X, va, pg) _tlbie(va) 52#define flush_HPTE(X, va, pg) _tlbie(va, 0 /* 8xx doesn't care about PID */)
53#define MMU_init_hw() do { } while(0) 53#define MMU_init_hw() do { } while(0)
54#define mmu_mapin_ram() (0UL) 54#define mmu_mapin_ram() (0UL)
55 55
56#elif defined(CONFIG_4xx) 56#elif defined(CONFIG_4xx)
57#define flush_HPTE(X, va, pg) _tlbie(va) 57#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
58extern void MMU_init_hw(void); 58extern void MMU_init_hw(void);
59extern unsigned long mmu_mapin_ram(void); 59extern unsigned long mmu_mapin_ram(void);
60 60
61#elif defined(CONFIG_FSL_BOOKE) 61#elif defined(CONFIG_FSL_BOOKE)
62#define flush_HPTE(X, va, pg) _tlbie(va) 62#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
63extern void MMU_init_hw(void); 63extern void MMU_init_hw(void);
64extern unsigned long mmu_mapin_ram(void); 64extern unsigned long mmu_mapin_ram(void);
65extern void adjust_total_lowmem(void); 65extern void adjust_total_lowmem(void);
diff --git a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
index 05d7184d7e14..453643a0eeea 100644
--- a/arch/ppc/platforms/4xx/ebony.c
+++ b/arch/ppc/platforms/4xx/ebony.c
@@ -236,7 +236,7 @@ ebony_early_serial_map(void)
236 gen550_init(0, &port); 236 gen550_init(0, &port);
237 237
238 /* Purge TLB entry added in head_44x.S for early serial access */ 238 /* Purge TLB entry added in head_44x.S for early serial access */
239 _tlbie(UART0_IO_BASE); 239 _tlbie(UART0_IO_BASE, 0);
240#endif 240#endif
241 241
242 port.membase = ioremap64(PPC440GP_UART1_ADDR, 8); 242 port.membase = ioremap64(PPC440GP_UART1_ADDR, 8);
diff --git a/arch/ppc/platforms/4xx/luan.c b/arch/ppc/platforms/4xx/luan.c
index 4b169610f154..b79ebb8a3e6c 100644
--- a/arch/ppc/platforms/4xx/luan.c
+++ b/arch/ppc/platforms/4xx/luan.c
@@ -230,9 +230,14 @@ luan_setup_hoses(void)
230 230
231 /* Allocate hoses for PCIX1 and PCIX2 */ 231 /* Allocate hoses for PCIX1 and PCIX2 */
232 hose1 = pcibios_alloc_controller(); 232 hose1 = pcibios_alloc_controller();
233 if (!hose1)
234 return;
235
233 hose2 = pcibios_alloc_controller(); 236 hose2 = pcibios_alloc_controller();
234 if (!hose1 || !hose2) 237 if (!hose2) {
238 pcibios_free_controller(hose1);
235 return; 239 return;
240 }
236 241
237 /* Setup PCIX1 */ 242 /* Setup PCIX1 */
238 hose1->first_busno = 0; 243 hose1->first_busno = 0;
diff --git a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
index fd0f971881d6..28a712cd4800 100644
--- a/arch/ppc/platforms/4xx/ocotea.c
+++ b/arch/ppc/platforms/4xx/ocotea.c
@@ -259,7 +259,7 @@ ocotea_early_serial_map(void)
259 gen550_init(0, &port); 259 gen550_init(0, &port);
260 260
261 /* Purge TLB entry added in head_44x.S for early serial access */ 261 /* Purge TLB entry added in head_44x.S for early serial access */
262 _tlbie(UART0_IO_BASE); 262 _tlbie(UART0_IO_BASE, 0);
263#endif 263#endif
264 264
265 port.membase = ioremap64(PPC440GX_UART1_ADDR, 8); 265 port.membase = ioremap64(PPC440GX_UART1_ADDR, 8);
diff --git a/arch/ppc/platforms/4xx/taishan.c b/arch/ppc/platforms/4xx/taishan.c
index 888c492b4a45..f6a0c6650f33 100644
--- a/arch/ppc/platforms/4xx/taishan.c
+++ b/arch/ppc/platforms/4xx/taishan.c
@@ -316,7 +316,7 @@ taishan_early_serial_map(void)
316 gen550_init(0, &port); 316 gen550_init(0, &port);
317 317
318 /* Purge TLB entry added in head_44x.S for early serial access */ 318 /* Purge TLB entry added in head_44x.S for early serial access */
319 _tlbie(UART0_IO_BASE); 319 _tlbie(UART0_IO_BASE, 0);
320#endif 320#endif
321 321
322 port.membase = ioremap64(PPC440GX_UART1_ADDR, 8); 322 port.membase = ioremap64(PPC440GX_UART1_ADDR, 8);
diff --git a/arch/ppc/platforms/4xx/yucca.c b/arch/ppc/platforms/4xx/yucca.c
index a83b0baea011..66a44ff0d926 100644
--- a/arch/ppc/platforms/4xx/yucca.c
+++ b/arch/ppc/platforms/4xx/yucca.c
@@ -211,6 +211,7 @@ static void __init yucca_setup_pcie_fpga_rootpoint(int port)
211 break; 211 break;
212 212
213 default: 213 default:
214 iounmap(pcie_reg_fpga_base);
214 return; 215 return;
215 } 216 }
216 217
diff --git a/arch/ppc/syslib/i8259.c b/arch/ppc/syslib/i8259.c
index 1e5a00a4b5f5..559f27c6aefe 100644
--- a/arch/ppc/syslib/i8259.c
+++ b/arch/ppc/syslib/i8259.c
@@ -127,6 +127,7 @@ static void i8259_unmask_irq(unsigned int irq_nr)
127static struct irq_chip i8259_pic = { 127static struct irq_chip i8259_pic = {
128 .typename = " i8259 ", 128 .typename = " i8259 ",
129 .mask = i8259_mask_irq, 129 .mask = i8259_mask_irq,
130 .disable = i8259_mask_irq,
130 .unmask = i8259_unmask_irq, 131 .unmask = i8259_unmask_irq,
131 .mask_ack = i8259_mask_and_ack_irq, 132 .mask_ack = i8259_mask_and_ack_irq,
132}; 133};
diff --git a/arch/ppc/syslib/m8260_setup.c b/arch/ppc/syslib/m8260_setup.c
index 15f0d7323535..46588fa94381 100644
--- a/arch/ppc/syslib/m8260_setup.c
+++ b/arch/ppc/syslib/m8260_setup.c
@@ -25,6 +25,7 @@
25#include <asm/machdep.h> 25#include <asm/machdep.h>
26#include <asm/bootinfo.h> 26#include <asm/bootinfo.h>
27#include <asm/time.h> 27#include <asm/time.h>
28#include <asm/ppc_sys.h>
28 29
29#include "cpm2_pic.h" 30#include "cpm2_pic.h"
30 31
@@ -61,7 +62,7 @@ m8260_setup_arch(void)
61#endif 62#endif
62 63
63 identify_ppc_sys_by_name_and_id(BOARD_CHIP_NAME, 64 identify_ppc_sys_by_name_and_id(BOARD_CHIP_NAME,
64 in_be32(CPM_MAP_ADDR + CPM_IMMR_OFFSET)); 65 in_be32((void *)CPM_MAP_ADDR + CPM_IMMR_OFFSET));
65 66
66 m82xx_board_setup(); 67 m82xx_board_setup();
67} 68}
@@ -147,12 +148,12 @@ m8260_show_cpuinfo(struct seq_file *m)
147 seq_printf(m, "vendor\t\t: %s\n" 148 seq_printf(m, "vendor\t\t: %s\n"
148 "machine\t\t: %s\n" 149 "machine\t\t: %s\n"
149 "\n" 150 "\n"
150 "mem size\t\t: 0x%08x\n" 151 "mem size\t\t: 0x%08lx\n"
151 "console baud\t\t: %d\n" 152 "console baud\t\t: %ld\n"
152 "\n" 153 "\n"
153 "core clock\t: %u MHz\n" 154 "core clock\t: %lu MHz\n"
154 "CPM clock\t: %u MHz\n" 155 "CPM clock\t: %lu MHz\n"
155 "bus clock\t: %u MHz\n", 156 "bus clock\t: %lu MHz\n",
156 CPUINFO_VENDOR, CPUINFO_MACHINE, bp->bi_memsize, 157 CPUINFO_VENDOR, CPUINFO_MACHINE, bp->bi_memsize,
157 bp->bi_baudrate, bp->bi_intfreq / 1000000, 158 bp->bi_baudrate, bp->bi_intfreq / 1000000,
158 bp->bi_cpmfreq / 1000000, bp->bi_busfreq / 1000000); 159 bp->bi_cpmfreq / 1000000, bp->bi_busfreq / 1000000);
diff --git a/arch/ppc/syslib/virtex_devices.c b/arch/ppc/syslib/virtex_devices.c
index ace4ec08de51..f658ff3b3890 100644
--- a/arch/ppc/syslib/virtex_devices.c
+++ b/arch/ppc/syslib/virtex_devices.c
@@ -87,6 +87,29 @@
87 }, \ 87 }, \
88} 88}
89 89
90#define XPAR_AC97_CONTROLLER_REFERENCE(num) { \
91 .name = "ml403_ac97cr", \
92 .id = num, \
93 .num_resources = 3, \
94 .resource = (struct resource[]) { \
95 { \
96 .start = XPAR_OPB_AC97_CONTROLLER_REF_##num##_BASEADDR, \
97 .end = XPAR_OPB_AC97_CONTROLLER_REF_##num##_HIGHADDR, \
98 .flags = IORESOURCE_MEM, \
99 }, \
100 { \
101 .start = XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_PLAYBACK_INTERRUPT_INTR, \
102 .end = XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_PLAYBACK_INTERRUPT_INTR, \
103 .flags = IORESOURCE_IRQ, \
104 }, \
105 { \
106 .start = XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_RECORD_INTERRUPT_INTR, \
107 .end = XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_RECORD_INTERRUPT_INTR, \
108 .flags = IORESOURCE_IRQ, \
109 }, \
110 }, \
111}
112
90/* UART 8250 driver platform data table */ 113/* UART 8250 driver platform data table */
91struct plat_serial8250_port virtex_serial_platform_data[] = { 114struct plat_serial8250_port virtex_serial_platform_data[] = {
92#if defined(XPAR_UARTNS550_0_BASEADDR) 115#if defined(XPAR_UARTNS550_0_BASEADDR)
@@ -173,6 +196,14 @@ struct platform_device virtex_platform_devices[] = {
173#if defined(XPAR_TFT_3_BASEADDR) 196#if defined(XPAR_TFT_3_BASEADDR)
174 XPAR_TFT(3), 197 XPAR_TFT(3),
175#endif 198#endif
199
200 /* AC97 Controller Reference instances */
201#if defined(XPAR_OPB_AC97_CONTROLLER_REF_0_BASEADDR)
202 XPAR_AC97_CONTROLLER_REFERENCE(0),
203#endif
204#if defined(XPAR_OPB_AC97_CONTROLLER_REF_1_BASEADDR)
205 XPAR_AC97_CONTROLLER_REFERENCE(1),
206#endif
176}; 207};
177 208
178/* Early serial support functions */ 209/* Early serial support functions */
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/s390/appldata/appldata.h b/arch/s390/appldata/appldata.h
index 4069b81f7f1d..db3ae8505103 100644
--- a/arch/s390/appldata/appldata.h
+++ b/arch/s390/appldata/appldata.h
@@ -45,7 +45,6 @@ struct appldata_ops {
45 int active; /* monitoring status */ 45 int active; /* monitoring status */
46 46
47 /* fill in from here */ 47 /* fill in from here */
48 unsigned int ctl_nr; /* sysctl ID */
49 char name[APPLDATA_PROC_NAME_LENGTH]; /* name of /proc fs node */ 48 char name[APPLDATA_PROC_NAME_LENGTH]; /* name of /proc fs node */
50 unsigned char record_nr; /* Record Nr. for Product ID */ 49 unsigned char record_nr; /* Record Nr. for Product ID */
51 void (*callback)(void *data); /* callback function */ 50 void (*callback)(void *data); /* callback function */
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index ac61cf43a7d9..655d52543e2d 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -53,29 +53,26 @@ static int appldata_interval_handler(ctl_table *ctl, int write,
53static struct ctl_table_header *appldata_sysctl_header; 53static struct ctl_table_header *appldata_sysctl_header;
54static struct ctl_table appldata_table[] = { 54static struct ctl_table appldata_table[] = {
55 { 55 {
56 .ctl_name = CTL_APPLDATA_TIMER,
57 .procname = "timer", 56 .procname = "timer",
58 .mode = S_IRUGO | S_IWUSR, 57 .mode = S_IRUGO | S_IWUSR,
59 .proc_handler = &appldata_timer_handler, 58 .proc_handler = &appldata_timer_handler,
60 }, 59 },
61 { 60 {
62 .ctl_name = CTL_APPLDATA_INTERVAL,
63 .procname = "interval", 61 .procname = "interval",
64 .mode = S_IRUGO | S_IWUSR, 62 .mode = S_IRUGO | S_IWUSR,
65 .proc_handler = &appldata_interval_handler, 63 .proc_handler = &appldata_interval_handler,
66 }, 64 },
67 { .ctl_name = 0 } 65 { },
68}; 66};
69 67
70static struct ctl_table appldata_dir_table[] = { 68static struct ctl_table appldata_dir_table[] = {
71 { 69 {
72 .ctl_name = CTL_APPLDATA,
73 .procname = appldata_proc_name, 70 .procname = appldata_proc_name,
74 .maxlen = 0, 71 .maxlen = 0,
75 .mode = S_IRUGO | S_IXUGO, 72 .mode = S_IRUGO | S_IXUGO,
76 .child = appldata_table, 73 .child = appldata_table,
77 }, 74 },
78 { .ctl_name = 0 } 75 { },
79}; 76};
80 77
81/* 78/*
@@ -441,75 +438,38 @@ out:
441 */ 438 */
442int appldata_register_ops(struct appldata_ops *ops) 439int appldata_register_ops(struct appldata_ops *ops)
443{ 440{
444 struct list_head *lh; 441 if ((ops->size > APPLDATA_MAX_REC_SIZE) || (ops->size < 0))
445 struct appldata_ops *tmp_ops; 442 return -EINVAL;
446 int i;
447
448 i = 0;
449 443
450 if ((ops->size > APPLDATA_MAX_REC_SIZE) || 444 ops->ctl_table = kzalloc(4 * sizeof(struct ctl_table), GFP_KERNEL);
451 (ops->size < 0)){ 445 if (!ops->ctl_table)
452 P_ERROR("Invalid size of %s record = %i, maximum = %i!\n",
453 ops->name, ops->size, APPLDATA_MAX_REC_SIZE);
454 return -ENOMEM;
455 }
456 if ((ops->ctl_nr == CTL_APPLDATA) ||
457 (ops->ctl_nr == CTL_APPLDATA_TIMER) ||
458 (ops->ctl_nr == CTL_APPLDATA_INTERVAL)) {
459 P_ERROR("ctl_nr %i already in use!\n", ops->ctl_nr);
460 return -EBUSY;
461 }
462 ops->ctl_table = kzalloc(4*sizeof(struct ctl_table), GFP_KERNEL);
463 if (ops->ctl_table == NULL) {
464 P_ERROR("Not enough memory for %s ctl_table!\n", ops->name);
465 return -ENOMEM; 446 return -ENOMEM;
466 }
467 447
468 spin_lock(&appldata_ops_lock); 448 spin_lock(&appldata_ops_lock);
469 list_for_each(lh, &appldata_ops_list) {
470 tmp_ops = list_entry(lh, struct appldata_ops, list);
471 P_DEBUG("register_ops loop: %i) name = %s, ctl = %i\n",
472 ++i, tmp_ops->name, tmp_ops->ctl_nr);
473 P_DEBUG("Comparing %s (ctl %i) with %s (ctl %i)\n",
474 tmp_ops->name, tmp_ops->ctl_nr, ops->name,
475 ops->ctl_nr);
476 if (strncmp(tmp_ops->name, ops->name,
477 APPLDATA_PROC_NAME_LENGTH) == 0) {
478 P_ERROR("Name \"%s\" already registered!\n", ops->name);
479 kfree(ops->ctl_table);
480 spin_unlock(&appldata_ops_lock);
481 return -EBUSY;
482 }
483 if (tmp_ops->ctl_nr == ops->ctl_nr) {
484 P_ERROR("ctl_nr %i already registered!\n", ops->ctl_nr);
485 kfree(ops->ctl_table);
486 spin_unlock(&appldata_ops_lock);
487 return -EBUSY;
488 }
489 }
490 list_add(&ops->list, &appldata_ops_list); 449 list_add(&ops->list, &appldata_ops_list);
491 spin_unlock(&appldata_ops_lock); 450 spin_unlock(&appldata_ops_lock);
492 451
493 ops->ctl_table[0].ctl_name = CTL_APPLDATA;
494 ops->ctl_table[0].procname = appldata_proc_name; 452 ops->ctl_table[0].procname = appldata_proc_name;
495 ops->ctl_table[0].maxlen = 0; 453 ops->ctl_table[0].maxlen = 0;
496 ops->ctl_table[0].mode = S_IRUGO | S_IXUGO; 454 ops->ctl_table[0].mode = S_IRUGO | S_IXUGO;
497 ops->ctl_table[0].child = &ops->ctl_table[2]; 455 ops->ctl_table[0].child = &ops->ctl_table[2];
498 456
499 ops->ctl_table[1].ctl_name = 0;
500
501 ops->ctl_table[2].ctl_name = ops->ctl_nr;
502 ops->ctl_table[2].procname = ops->name; 457 ops->ctl_table[2].procname = ops->name;
503 ops->ctl_table[2].mode = S_IRUGO | S_IWUSR; 458 ops->ctl_table[2].mode = S_IRUGO | S_IWUSR;
504 ops->ctl_table[2].proc_handler = appldata_generic_handler; 459 ops->ctl_table[2].proc_handler = appldata_generic_handler;
505 ops->ctl_table[2].data = ops; 460 ops->ctl_table[2].data = ops;
506 461
507 ops->ctl_table[3].ctl_name = 0;
508
509 ops->sysctl_header = register_sysctl_table(ops->ctl_table); 462 ops->sysctl_header = register_sysctl_table(ops->ctl_table);
510 463 if (!ops->sysctl_header)
464 goto out;
511 P_INFO("%s-ops registered!\n", ops->name); 465 P_INFO("%s-ops registered!\n", ops->name);
512 return 0; 466 return 0;
467out:
468 spin_lock(&appldata_ops_lock);
469 list_del(&ops->list);
470 spin_unlock(&appldata_ops_lock);
471 kfree(ops->ctl_table);
472 return -ENOMEM;
513} 473}
514 474
515/* 475/*
@@ -519,15 +479,11 @@ int appldata_register_ops(struct appldata_ops *ops)
519 */ 479 */
520void appldata_unregister_ops(struct appldata_ops *ops) 480void appldata_unregister_ops(struct appldata_ops *ops)
521{ 481{
522 void *table;
523 spin_lock(&appldata_ops_lock); 482 spin_lock(&appldata_ops_lock);
524 list_del(&ops->list); 483 list_del(&ops->list);
525 /* at that point any incoming access will fail */
526 table = ops->ctl_table;
527 ops->ctl_table = NULL;
528 spin_unlock(&appldata_ops_lock); 484 spin_unlock(&appldata_ops_lock);
529 unregister_sysctl_table(ops->sysctl_header); 485 unregister_sysctl_table(ops->sysctl_header);
530 kfree(table); 486 kfree(ops->ctl_table);
531 P_INFO("%s-ops unregistered!\n", ops->name); 487 P_INFO("%s-ops unregistered!\n", ops->name);
532} 488}
533/********************** module-ops management <END> **************************/ 489/********************** module-ops management <END> **************************/
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index 697eb30a68a3..51181ccdb87b 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -147,7 +147,6 @@ static void appldata_get_mem_data(void *data)
147 147
148 148
149static struct appldata_ops ops = { 149static struct appldata_ops ops = {
150 .ctl_nr = CTL_APPLDATA_MEM,
151 .name = "mem", 150 .name = "mem",
152 .record_nr = APPLDATA_RECORD_MEM_ID, 151 .record_nr = APPLDATA_RECORD_MEM_ID,
153 .size = sizeof(struct appldata_mem_data), 152 .size = sizeof(struct appldata_mem_data),
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 6c1815a47714..4d8344336001 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -142,7 +142,6 @@ static void appldata_get_net_sum_data(void *data)
142 142
143 143
144static struct appldata_ops ops = { 144static struct appldata_ops ops = {
145 .ctl_nr = CTL_APPLDATA_NET_SUM,
146 .name = "net_sum", 145 .name = "net_sum",
147 .record_nr = APPLDATA_RECORD_NET_SUM_ID, 146 .record_nr = APPLDATA_RECORD_NET_SUM_ID,
148 .size = sizeof(struct appldata_net_sum_data), 147 .size = sizeof(struct appldata_net_sum_data),
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c
index 76a15523ae9e..6b3eafe10453 100644
--- a/arch/s390/appldata/appldata_os.c
+++ b/arch/s390/appldata/appldata_os.c
@@ -82,7 +82,6 @@ struct appldata_os_data {
82static struct appldata_os_data *appldata_os_data; 82static struct appldata_os_data *appldata_os_data;
83 83
84static struct appldata_ops ops = { 84static struct appldata_ops ops = {
85 .ctl_nr = CTL_APPLDATA_OS,
86 .name = "os", 85 .name = "os",
87 .record_nr = APPLDATA_RECORD_OS_ID, 86 .record_nr = APPLDATA_RECORD_OS_ID,
88 .owner = THIS_MODULE, 87 .owner = THIS_MODULE,
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index e6289ee74ecd..1b3af7dab816 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -200,11 +200,13 @@ static noinline __init void find_memory_chunks(unsigned long memsize)
200 cc = __tprot(addr); 200 cc = __tprot(addr);
201 while (cc == old_cc) { 201 while (cc == old_cc) {
202 addr += CHUNK_INCR; 202 addr += CHUNK_INCR;
203 cc = __tprot(addr); 203 if (memsize && addr >= memsize)
204 break;
204#ifndef CONFIG_64BIT 205#ifndef CONFIG_64BIT
205 if (addr == ADDR2G) 206 if (addr == ADDR2G)
206 break; 207 break;
207#endif 208#endif
209 cc = __tprot(addr);
208 } 210 }
209 211
210 if (old_addr != addr && 212 if (old_addr != addr &&
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 139ca153d5cc..b2b2edc40eb1 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -69,13 +69,31 @@ STACK_SIZE = 1 << STACK_SHIFT
69 basr %r14,%r1 69 basr %r14,%r1
70 .endm 70 .endm
71 71
72 .macro LOCKDEP_SYS_EXIT 72 .macro TRACE_IRQS_CHECK
73 l %r1,BASED(.Llockdep_sys_exit) 73 tm SP_PSW(%r15),0x03 # irqs enabled?
74 jz 0f
75 l %r1,BASED(.Ltrace_irq_on)
74 basr %r14,%r1 76 basr %r14,%r1
77 j 1f
780: l %r1,BASED(.Ltrace_irq_off)
79 basr %r14,%r1
801:
75 .endm 81 .endm
76#else 82#else
77#define TRACE_IRQS_ON 83#define TRACE_IRQS_ON
78#define TRACE_IRQS_OFF 84#define TRACE_IRQS_OFF
85#define TRACE_IRQS_CHECK
86#endif
87
88#ifdef CONFIG_LOCKDEP
89 .macro LOCKDEP_SYS_EXIT
90 tm SP_PSW+1(%r15),0x01 # returning to user ?
91 jz 0f
92 l %r1,BASED(.Llockdep_sys_exit)
93 basr %r14,%r1
940:
95 .endm
96#else
79#define LOCKDEP_SYS_EXIT 97#define LOCKDEP_SYS_EXIT
80#endif 98#endif
81 99
@@ -234,8 +252,6 @@ sysc_saveall:
234 lh %r7,0x8a # get svc number from lowcore 252 lh %r7,0x8a # get svc number from lowcore
235#ifdef CONFIG_VIRT_CPU_ACCOUNTING 253#ifdef CONFIG_VIRT_CPU_ACCOUNTING
236sysc_vtime: 254sysc_vtime:
237 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
238 bz BASED(sysc_do_svc)
239 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 255 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
240sysc_stime: 256sysc_stime:
241 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 257 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
@@ -263,19 +279,34 @@ sysc_do_restart:
263 279
264sysc_return: 280sysc_return:
265 tm SP_PSW+1(%r15),0x01 # returning to user ? 281 tm SP_PSW+1(%r15),0x01 # returning to user ?
266 bno BASED(sysc_leave) 282 bno BASED(sysc_restore)
267 tm __TI_flags+3(%r9),_TIF_WORK_SVC 283 tm __TI_flags+3(%r9),_TIF_WORK_SVC
268 bnz BASED(sysc_work) # there is work to do (signals etc.) 284 bnz BASED(sysc_work) # there is work to do (signals etc.)
285sysc_restore:
286#ifdef CONFIG_TRACE_IRQFLAGS
287 la %r1,BASED(sysc_restore_trace_psw)
288 lpsw 0(%r1)
289sysc_restore_trace:
290 TRACE_IRQS_CHECK
269 LOCKDEP_SYS_EXIT 291 LOCKDEP_SYS_EXIT
292#endif
270sysc_leave: 293sysc_leave:
271 RESTORE_ALL __LC_RETURN_PSW,1 294 RESTORE_ALL __LC_RETURN_PSW,1
295sysc_done:
296
297#ifdef CONFIG_TRACE_IRQFLAGS
298 .align 8
299 .globl sysc_restore_trace_psw
300sysc_restore_trace_psw:
301 .long 0, sysc_restore_trace + 0x80000000
302#endif
272 303
273# 304#
274# recheck if there is more work to do 305# recheck if there is more work to do
275# 306#
276sysc_work_loop: 307sysc_work_loop:
277 tm __TI_flags+3(%r9),_TIF_WORK_SVC 308 tm __TI_flags+3(%r9),_TIF_WORK_SVC
278 bz BASED(sysc_leave) # there is no work to do 309 bz BASED(sysc_restore) # there is no work to do
279# 310#
280# One of the work bits is on. Find out which one. 311# One of the work bits is on. Find out which one.
281# 312#
@@ -290,8 +321,8 @@ sysc_work:
290 bo BASED(sysc_restart) 321 bo BASED(sysc_restart)
291 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP 322 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP
292 bo BASED(sysc_singlestep) 323 bo BASED(sysc_singlestep)
293 LOCKDEP_SYS_EXIT 324 b BASED(sysc_restore)
294 b BASED(sysc_leave) 325sysc_work_done:
295 326
296# 327#
297# _TIF_NEED_RESCHED is set, call schedule 328# _TIF_NEED_RESCHED is set, call schedule
@@ -458,6 +489,7 @@ pgm_check_handler:
458pgm_no_vtime: 489pgm_no_vtime:
459#endif 490#endif
460 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 491 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
492 TRACE_IRQS_OFF
461 l %r3,__LC_PGM_ILC # load program interruption code 493 l %r3,__LC_PGM_ILC # load program interruption code
462 la %r8,0x7f 494 la %r8,0x7f
463 nr %r8,%r3 495 nr %r8,%r3
@@ -497,6 +529,7 @@ pgm_per_std:
497pgm_no_vtime2: 529pgm_no_vtime2:
498#endif 530#endif
499 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 531 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
532 TRACE_IRQS_OFF
500 l %r1,__TI_task(%r9) 533 l %r1,__TI_task(%r9)
501 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID 534 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
502 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS 535 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
@@ -517,15 +550,13 @@ pgm_svcper:
517 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 550 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA
518 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA 551 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA
519#ifdef CONFIG_VIRT_CPU_ACCOUNTING 552#ifdef CONFIG_VIRT_CPU_ACCOUNTING
520 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
521 bz BASED(pgm_no_vtime3)
522 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 553 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
523 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 554 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
524 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 555 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
525pgm_no_vtime3:
526#endif 556#endif
527 lh %r7,0x8a # get svc number from lowcore 557 lh %r7,0x8a # get svc number from lowcore
528 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 558 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
559 TRACE_IRQS_OFF
529 l %r1,__TI_task(%r9) 560 l %r1,__TI_task(%r9)
530 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID 561 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
531 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS 562 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
@@ -542,7 +573,7 @@ kernel_per:
542 mvi SP_TRAP+1(%r15),0x28 # set trap indication to pgm check 573 mvi SP_TRAP+1(%r15),0x28 # set trap indication to pgm check
543 la %r2,SP_PTREGS(%r15) # address of register-save area 574 la %r2,SP_PTREGS(%r15) # address of register-save area
544 l %r1,BASED(.Lhandle_per) # load adr. of per handler 575 l %r1,BASED(.Lhandle_per) # load adr. of per handler
545 la %r14,BASED(sysc_leave) # load adr. of system return 576 la %r14,BASED(sysc_restore)# load adr. of system return
546 br %r1 # branch to do_single_step 577 br %r1 # branch to do_single_step
547 578
548/* 579/*
@@ -569,26 +600,38 @@ io_no_vtime:
569 l %r1,BASED(.Ldo_IRQ) # load address of do_IRQ 600 l %r1,BASED(.Ldo_IRQ) # load address of do_IRQ
570 la %r2,SP_PTREGS(%r15) # address of register-save area 601 la %r2,SP_PTREGS(%r15) # address of register-save area
571 basr %r14,%r1 # branch to standard irq handler 602 basr %r14,%r1 # branch to standard irq handler
572 TRACE_IRQS_ON
573
574io_return: 603io_return:
575 tm SP_PSW+1(%r15),0x01 # returning to user ? 604 tm SP_PSW+1(%r15),0x01 # returning to user ?
576#ifdef CONFIG_PREEMPT 605#ifdef CONFIG_PREEMPT
577 bno BASED(io_preempt) # no -> check for preemptive scheduling 606 bno BASED(io_preempt) # no -> check for preemptive scheduling
578#else 607#else
579 bno BASED(io_leave) # no-> skip resched & signal 608 bno BASED(io_restore) # no-> skip resched & signal
580#endif 609#endif
581 tm __TI_flags+3(%r9),_TIF_WORK_INT 610 tm __TI_flags+3(%r9),_TIF_WORK_INT
582 bnz BASED(io_work) # there is work to do (signals etc.) 611 bnz BASED(io_work) # there is work to do (signals etc.)
612io_restore:
613#ifdef CONFIG_TRACE_IRQFLAGS
614 la %r1,BASED(io_restore_trace_psw)
615 lpsw 0(%r1)
616io_restore_trace:
617 TRACE_IRQS_CHECK
583 LOCKDEP_SYS_EXIT 618 LOCKDEP_SYS_EXIT
619#endif
584io_leave: 620io_leave:
585 RESTORE_ALL __LC_RETURN_PSW,0 621 RESTORE_ALL __LC_RETURN_PSW,0
586io_done: 622io_done:
587 623
624#ifdef CONFIG_TRACE_IRQFLAGS
625 .align 8
626 .globl io_restore_trace_psw
627io_restore_trace_psw:
628 .long 0, io_restore_trace + 0x80000000
629#endif
630
588#ifdef CONFIG_PREEMPT 631#ifdef CONFIG_PREEMPT
589io_preempt: 632io_preempt:
590 icm %r0,15,__TI_precount(%r9) 633 icm %r0,15,__TI_precount(%r9)
591 bnz BASED(io_leave) 634 bnz BASED(io_restore)
592 l %r1,SP_R15(%r15) 635 l %r1,SP_R15(%r15)
593 s %r1,BASED(.Lc_spsize) 636 s %r1,BASED(.Lc_spsize)
594 mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) 637 mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15)
@@ -596,14 +639,10 @@ io_preempt:
596 lr %r15,%r1 639 lr %r15,%r1
597io_resume_loop: 640io_resume_loop:
598 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED 641 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
599 bno BASED(io_leave) 642 bno BASED(io_restore)
600 mvc __TI_precount(4,%r9),BASED(.Lc_pactive) 643 l %r1,BASED(.Lpreempt_schedule_irq)
601 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 644 la %r14,BASED(io_resume_loop)
602 l %r1,BASED(.Lschedule) 645 br %r1 # call schedule
603 basr %r14,%r1 # call schedule
604 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
605 xc __TI_precount(4,%r9),__TI_precount(%r9)
606 b BASED(io_resume_loop)
607#endif 646#endif
608 647
609# 648#
@@ -627,40 +666,42 @@ io_work_loop:
627 bo BASED(io_reschedule) 666 bo BASED(io_reschedule)
628 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 667 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
629 bnz BASED(io_sigpending) 668 bnz BASED(io_sigpending)
630 LOCKDEP_SYS_EXIT 669 b BASED(io_restore)
631 b BASED(io_leave) 670io_work_done:
632 671
633# 672#
634# _TIF_MCCK_PENDING is set, call handler 673# _TIF_MCCK_PENDING is set, call handler
635# 674#
636io_mcck_pending: 675io_mcck_pending:
637 TRACE_IRQS_OFF
638 l %r1,BASED(.Ls390_handle_mcck) 676 l %r1,BASED(.Ls390_handle_mcck)
639 basr %r14,%r1 # TIF bit will be cleared by handler 677 basr %r14,%r1 # TIF bit will be cleared by handler
640 TRACE_IRQS_ON
641 b BASED(io_work_loop) 678 b BASED(io_work_loop)
642 679
643# 680#
644# _TIF_NEED_RESCHED is set, call schedule 681# _TIF_NEED_RESCHED is set, call schedule
645# 682#
646io_reschedule: 683io_reschedule:
684 TRACE_IRQS_ON
647 l %r1,BASED(.Lschedule) 685 l %r1,BASED(.Lschedule)
648 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 686 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
649 basr %r14,%r1 # call scheduler 687 basr %r14,%r1 # call scheduler
650 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 688 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
689 TRACE_IRQS_OFF
651 tm __TI_flags+3(%r9),_TIF_WORK_INT 690 tm __TI_flags+3(%r9),_TIF_WORK_INT
652 bz BASED(io_leave) # there is no work to do 691 bz BASED(io_restore) # there is no work to do
653 b BASED(io_work_loop) 692 b BASED(io_work_loop)
654 693
655# 694#
656# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal 695# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal
657# 696#
658io_sigpending: 697io_sigpending:
698 TRACE_IRQS_ON
659 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 699 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
660 la %r2,SP_PTREGS(%r15) # load pt_regs 700 la %r2,SP_PTREGS(%r15) # load pt_regs
661 l %r1,BASED(.Ldo_signal) 701 l %r1,BASED(.Ldo_signal)
662 basr %r14,%r1 # call do_signal 702 basr %r14,%r1 # call do_signal
663 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 703 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
704 TRACE_IRQS_OFF
664 b BASED(io_work_loop) 705 b BASED(io_work_loop)
665 706
666/* 707/*
@@ -688,7 +729,6 @@ ext_no_vtime:
688 lh %r3,__LC_EXT_INT_CODE # get interruption code 729 lh %r3,__LC_EXT_INT_CODE # get interruption code
689 l %r1,BASED(.Ldo_extint) 730 l %r1,BASED(.Ldo_extint)
690 basr %r14,%r1 731 basr %r14,%r1
691 TRACE_IRQS_ON
692 b BASED(io_return) 732 b BASED(io_return)
693 733
694__critical_end: 734__critical_end:
@@ -853,15 +893,15 @@ cleanup_table_system_call:
853cleanup_table_sysc_return: 893cleanup_table_sysc_return:
854 .long sysc_return + 0x80000000, sysc_leave + 0x80000000 894 .long sysc_return + 0x80000000, sysc_leave + 0x80000000
855cleanup_table_sysc_leave: 895cleanup_table_sysc_leave:
856 .long sysc_leave + 0x80000000, sysc_work_loop + 0x80000000 896 .long sysc_leave + 0x80000000, sysc_done + 0x80000000
857cleanup_table_sysc_work_loop: 897cleanup_table_sysc_work_loop:
858 .long sysc_work_loop + 0x80000000, sysc_reschedule + 0x80000000 898 .long sysc_work_loop + 0x80000000, sysc_work_done + 0x80000000
859cleanup_table_io_return: 899cleanup_table_io_return:
860 .long io_return + 0x80000000, io_leave + 0x80000000 900 .long io_return + 0x80000000, io_leave + 0x80000000
861cleanup_table_io_leave: 901cleanup_table_io_leave:
862 .long io_leave + 0x80000000, io_done + 0x80000000 902 .long io_leave + 0x80000000, io_done + 0x80000000
863cleanup_table_io_work_loop: 903cleanup_table_io_work_loop:
864 .long io_work_loop + 0x80000000, io_mcck_pending + 0x80000000 904 .long io_work_loop + 0x80000000, io_work_done + 0x80000000
865 905
866cleanup_critical: 906cleanup_critical:
867 clc 4(4,%r12),BASED(cleanup_table_system_call) 907 clc 4(4,%r12),BASED(cleanup_table_system_call)
@@ -930,8 +970,6 @@ cleanup_system_call:
930cleanup_vtime: 970cleanup_vtime:
931 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+12) 971 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+12)
932 bhe BASED(cleanup_stime) 972 bhe BASED(cleanup_stime)
933 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
934 bz BASED(cleanup_novtime)
935 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 973 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
936cleanup_stime: 974cleanup_stime:
937 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+16) 975 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+16)
@@ -939,7 +977,6 @@ cleanup_stime:
939 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 977 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
940cleanup_update: 978cleanup_update:
941 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 979 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
942cleanup_novtime:
943#endif 980#endif
944 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_system_call+4) 981 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_system_call+4)
945 la %r12,__LC_RETURN_PSW 982 la %r12,__LC_RETURN_PSW
@@ -978,10 +1015,10 @@ cleanup_sysc_leave:
9782: la %r12,__LC_RETURN_PSW 10152: la %r12,__LC_RETURN_PSW
979 br %r14 1016 br %r14
980cleanup_sysc_leave_insn: 1017cleanup_sysc_leave_insn:
1018 .long sysc_done - 4 + 0x80000000
981#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1019#ifdef CONFIG_VIRT_CPU_ACCOUNTING
982 .long sysc_leave + 14 + 0x80000000 1020 .long sysc_done - 8 + 0x80000000
983#endif 1021#endif
984 .long sysc_leave + 10 + 0x80000000
985 1022
986cleanup_io_return: 1023cleanup_io_return:
987 mvc __LC_RETURN_PSW(4),0(%r12) 1024 mvc __LC_RETURN_PSW(4),0(%r12)
@@ -1008,10 +1045,10 @@ cleanup_io_leave:
10082: la %r12,__LC_RETURN_PSW 10452: la %r12,__LC_RETURN_PSW
1009 br %r14 1046 br %r14
1010cleanup_io_leave_insn: 1047cleanup_io_leave_insn:
1048 .long io_done - 4 + 0x80000000
1011#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1049#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1012 .long io_leave + 18 + 0x80000000 1050 .long io_done - 8 + 0x80000000
1013#endif 1051#endif
1014 .long io_leave + 14 + 0x80000000
1015 1052
1016/* 1053/*
1017 * Integer constants 1054 * Integer constants
@@ -1019,7 +1056,6 @@ cleanup_io_leave_insn:
1019 .align 4 1056 .align 4
1020.Lc_spsize: .long SP_SIZE 1057.Lc_spsize: .long SP_SIZE
1021.Lc_overhead: .long STACK_FRAME_OVERHEAD 1058.Lc_overhead: .long STACK_FRAME_OVERHEAD
1022.Lc_pactive: .long PREEMPT_ACTIVE
1023.Lnr_syscalls: .long NR_syscalls 1059.Lnr_syscalls: .long NR_syscalls
1024.L0x018: .short 0x018 1060.L0x018: .short 0x018
1025.L0x020: .short 0x020 1061.L0x020: .short 0x020
@@ -1043,6 +1079,8 @@ cleanup_io_leave_insn:
1043.Lexecve_tail: .long execve_tail 1079.Lexecve_tail: .long execve_tail
1044.Ljump_table: .long pgm_check_table 1080.Ljump_table: .long pgm_check_table
1045.Lschedule: .long schedule 1081.Lschedule: .long schedule
1082.Lpreempt_schedule_irq:
1083 .long preempt_schedule_irq
1046.Ltrace: .long syscall_trace 1084.Ltrace: .long syscall_trace
1047.Lschedtail: .long schedule_tail 1085.Lschedtail: .long schedule_tail
1048.Lsysc_table: .long sys_call_table 1086.Lsysc_table: .long sys_call_table
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 05e26d1fdf40..a3e47b893f07 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -67,12 +67,28 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \
67 brasl %r14,trace_hardirqs_off 67 brasl %r14,trace_hardirqs_off
68 .endm 68 .endm
69 69
70 .macro LOCKDEP_SYS_EXIT 70 .macro TRACE_IRQS_CHECK
71 brasl %r14,lockdep_sys_exit 71 tm SP_PSW(%r15),0x03 # irqs enabled?
72 jz 0f
73 brasl %r14,trace_hardirqs_on
74 j 1f
750: brasl %r14,trace_hardirqs_off
761:
72 .endm 77 .endm
73#else 78#else
74#define TRACE_IRQS_ON 79#define TRACE_IRQS_ON
75#define TRACE_IRQS_OFF 80#define TRACE_IRQS_OFF
81#define TRACE_IRQS_CHECK
82#endif
83
84#ifdef CONFIG_LOCKDEP
85 .macro LOCKDEP_SYS_EXIT
86 tm SP_PSW+1(%r15),0x01 # returning to user ?
87 jz 0f
88 brasl %r14,lockdep_sys_exit
890:
90 .endm
91#else
76#define LOCKDEP_SYS_EXIT 92#define LOCKDEP_SYS_EXIT
77#endif 93#endif
78 94
@@ -222,8 +238,6 @@ sysc_saveall:
222 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore 238 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore
223#ifdef CONFIG_VIRT_CPU_ACCOUNTING 239#ifdef CONFIG_VIRT_CPU_ACCOUNTING
224sysc_vtime: 240sysc_vtime:
225 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
226 jz sysc_do_svc
227 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 241 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
228sysc_stime: 242sysc_stime:
229 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 243 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
@@ -257,19 +271,34 @@ sysc_noemu:
257 271
258sysc_return: 272sysc_return:
259 tm SP_PSW+1(%r15),0x01 # returning to user ? 273 tm SP_PSW+1(%r15),0x01 # returning to user ?
260 jno sysc_leave 274 jno sysc_restore
261 tm __TI_flags+7(%r9),_TIF_WORK_SVC 275 tm __TI_flags+7(%r9),_TIF_WORK_SVC
262 jnz sysc_work # there is work to do (signals etc.) 276 jnz sysc_work # there is work to do (signals etc.)
277sysc_restore:
278#ifdef CONFIG_TRACE_IRQFLAGS
279 larl %r1,sysc_restore_trace_psw
280 lpswe 0(%r1)
281sysc_restore_trace:
282 TRACE_IRQS_CHECK
263 LOCKDEP_SYS_EXIT 283 LOCKDEP_SYS_EXIT
284#endif
264sysc_leave: 285sysc_leave:
265 RESTORE_ALL __LC_RETURN_PSW,1 286 RESTORE_ALL __LC_RETURN_PSW,1
287sysc_done:
288
289#ifdef CONFIG_TRACE_IRQFLAGS
290 .align 8
291 .globl sysc_restore_trace_psw
292sysc_restore_trace_psw:
293 .quad 0, sysc_restore_trace
294#endif
266 295
267# 296#
268# recheck if there is more work to do 297# recheck if there is more work to do
269# 298#
270sysc_work_loop: 299sysc_work_loop:
271 tm __TI_flags+7(%r9),_TIF_WORK_SVC 300 tm __TI_flags+7(%r9),_TIF_WORK_SVC
272 jz sysc_leave # there is no work to do 301 jz sysc_restore # there is no work to do
273# 302#
274# One of the work bits is on. Find out which one. 303# One of the work bits is on. Find out which one.
275# 304#
@@ -284,8 +313,8 @@ sysc_work:
284 jo sysc_restart 313 jo sysc_restart
285 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP 314 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP
286 jo sysc_singlestep 315 jo sysc_singlestep
287 LOCKDEP_SYS_EXIT 316 j sysc_restore
288 j sysc_leave 317sysc_work_done:
289 318
290# 319#
291# _TIF_NEED_RESCHED is set, call schedule 320# _TIF_NEED_RESCHED is set, call schedule
@@ -445,6 +474,7 @@ pgm_check_handler:
445pgm_no_vtime: 474pgm_no_vtime:
446#endif 475#endif
447 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 476 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
477 TRACE_IRQS_OFF
448 lgf %r3,__LC_PGM_ILC # load program interruption code 478 lgf %r3,__LC_PGM_ILC # load program interruption code
449 lghi %r8,0x7f 479 lghi %r8,0x7f
450 ngr %r8,%r3 480 ngr %r8,%r3
@@ -484,6 +514,7 @@ pgm_per_std:
484pgm_no_vtime2: 514pgm_no_vtime2:
485#endif 515#endif
486 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 516 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
517 TRACE_IRQS_OFF
487 lg %r1,__TI_task(%r9) 518 lg %r1,__TI_task(%r9)
488 tm SP_PSW+1(%r15),0x01 # kernel per event ? 519 tm SP_PSW+1(%r15),0x01 # kernel per event ?
489 jz kernel_per 520 jz kernel_per
@@ -504,12 +535,9 @@ pgm_svcper:
504 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 535 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA
505 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA 536 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA
506#ifdef CONFIG_VIRT_CPU_ACCOUNTING 537#ifdef CONFIG_VIRT_CPU_ACCOUNTING
507 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
508 jz pgm_no_vtime3
509 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 538 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
510 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 539 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
511 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 540 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
512pgm_no_vtime3:
513#endif 541#endif
514 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore 542 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore
515 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 543 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
@@ -529,7 +557,7 @@ kernel_per:
529 lhi %r0,__LC_PGM_OLD_PSW 557 lhi %r0,__LC_PGM_OLD_PSW
530 sth %r0,SP_TRAP(%r15) # set trap indication to pgm check 558 sth %r0,SP_TRAP(%r15) # set trap indication to pgm check
531 la %r2,SP_PTREGS(%r15) # address of register-save area 559 la %r2,SP_PTREGS(%r15) # address of register-save area
532 larl %r14,sysc_leave # load adr. of system ret, no work 560 larl %r14,sysc_restore # load adr. of system ret, no work
533 jg do_single_step # branch to do_single_step 561 jg do_single_step # branch to do_single_step
534 562
535/* 563/*
@@ -554,26 +582,38 @@ io_no_vtime:
554 TRACE_IRQS_OFF 582 TRACE_IRQS_OFF
555 la %r2,SP_PTREGS(%r15) # address of register-save area 583 la %r2,SP_PTREGS(%r15) # address of register-save area
556 brasl %r14,do_IRQ # call standard irq handler 584 brasl %r14,do_IRQ # call standard irq handler
557 TRACE_IRQS_ON
558
559io_return: 585io_return:
560 tm SP_PSW+1(%r15),0x01 # returning to user ? 586 tm SP_PSW+1(%r15),0x01 # returning to user ?
561#ifdef CONFIG_PREEMPT 587#ifdef CONFIG_PREEMPT
562 jno io_preempt # no -> check for preemptive scheduling 588 jno io_preempt # no -> check for preemptive scheduling
563#else 589#else
564 jno io_leave # no-> skip resched & signal 590 jno io_restore # no-> skip resched & signal
565#endif 591#endif
566 tm __TI_flags+7(%r9),_TIF_WORK_INT 592 tm __TI_flags+7(%r9),_TIF_WORK_INT
567 jnz io_work # there is work to do (signals etc.) 593 jnz io_work # there is work to do (signals etc.)
594io_restore:
595#ifdef CONFIG_TRACE_IRQFLAGS
596 larl %r1,io_restore_trace_psw
597 lpswe 0(%r1)
598io_restore_trace:
599 TRACE_IRQS_CHECK
568 LOCKDEP_SYS_EXIT 600 LOCKDEP_SYS_EXIT
601#endif
569io_leave: 602io_leave:
570 RESTORE_ALL __LC_RETURN_PSW,0 603 RESTORE_ALL __LC_RETURN_PSW,0
571io_done: 604io_done:
572 605
606#ifdef CONFIG_TRACE_IRQFLAGS
607 .align 8
608 .globl io_restore_trace_psw
609io_restore_trace_psw:
610 .quad 0, io_restore_trace
611#endif
612
573#ifdef CONFIG_PREEMPT 613#ifdef CONFIG_PREEMPT
574io_preempt: 614io_preempt:
575 icm %r0,15,__TI_precount(%r9) 615 icm %r0,15,__TI_precount(%r9)
576 jnz io_leave 616 jnz io_restore
577 # switch to kernel stack 617 # switch to kernel stack
578 lg %r1,SP_R15(%r15) 618 lg %r1,SP_R15(%r15)
579 aghi %r1,-SP_SIZE 619 aghi %r1,-SP_SIZE
@@ -582,14 +622,9 @@ io_preempt:
582 lgr %r15,%r1 622 lgr %r15,%r1
583io_resume_loop: 623io_resume_loop:
584 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED 624 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED
585 jno io_leave 625 jno io_restore
586 larl %r1,.Lc_pactive 626 larl %r14,io_resume_loop
587 mvc __TI_precount(4,%r9),0(%r1) 627 jg preempt_schedule_irq
588 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
589 brasl %r14,schedule # call schedule
590 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
591 xc __TI_precount(4,%r9),__TI_precount(%r9)
592 j io_resume_loop
593#endif 628#endif
594 629
595# 630#
@@ -613,37 +648,39 @@ io_work_loop:
613 jo io_reschedule 648 jo io_reschedule
614 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 649 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
615 jnz io_sigpending 650 jnz io_sigpending
616 LOCKDEP_SYS_EXIT 651 j io_restore
617 j io_leave 652io_work_done:
618 653
619# 654#
620# _TIF_MCCK_PENDING is set, call handler 655# _TIF_MCCK_PENDING is set, call handler
621# 656#
622io_mcck_pending: 657io_mcck_pending:
623 TRACE_IRQS_OFF
624 brasl %r14,s390_handle_mcck # TIF bit will be cleared by handler 658 brasl %r14,s390_handle_mcck # TIF bit will be cleared by handler
625 TRACE_IRQS_ON
626 j io_work_loop 659 j io_work_loop
627 660
628# 661#
629# _TIF_NEED_RESCHED is set, call schedule 662# _TIF_NEED_RESCHED is set, call schedule
630# 663#
631io_reschedule: 664io_reschedule:
665 TRACE_IRQS_ON
632 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 666 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
633 brasl %r14,schedule # call scheduler 667 brasl %r14,schedule # call scheduler
634 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 668 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
669 TRACE_IRQS_OFF
635 tm __TI_flags+7(%r9),_TIF_WORK_INT 670 tm __TI_flags+7(%r9),_TIF_WORK_INT
636 jz io_leave # there is no work to do 671 jz io_restore # there is no work to do
637 j io_work_loop 672 j io_work_loop
638 673
639# 674#
640# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal 675# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal
641# 676#
642io_sigpending: 677io_sigpending:
678 TRACE_IRQS_ON
643 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 679 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
644 la %r2,SP_PTREGS(%r15) # load pt_regs 680 la %r2,SP_PTREGS(%r15) # load pt_regs
645 brasl %r14,do_signal # call do_signal 681 brasl %r14,do_signal # call do_signal
646 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 682 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
683 TRACE_IRQS_OFF
647 j io_work_loop 684 j io_work_loop
648 685
649/* 686/*
@@ -669,7 +706,6 @@ ext_no_vtime:
669 la %r2,SP_PTREGS(%r15) # address of register-save area 706 la %r2,SP_PTREGS(%r15) # address of register-save area
670 llgh %r3,__LC_EXT_INT_CODE # get interruption code 707 llgh %r3,__LC_EXT_INT_CODE # get interruption code
671 brasl %r14,do_extint 708 brasl %r14,do_extint
672 TRACE_IRQS_ON
673 j io_return 709 j io_return
674 710
675__critical_end: 711__critical_end:
@@ -824,15 +860,15 @@ cleanup_table_system_call:
824cleanup_table_sysc_return: 860cleanup_table_sysc_return:
825 .quad sysc_return, sysc_leave 861 .quad sysc_return, sysc_leave
826cleanup_table_sysc_leave: 862cleanup_table_sysc_leave:
827 .quad sysc_leave, sysc_work_loop 863 .quad sysc_leave, sysc_done
828cleanup_table_sysc_work_loop: 864cleanup_table_sysc_work_loop:
829 .quad sysc_work_loop, sysc_reschedule 865 .quad sysc_work_loop, sysc_work_done
830cleanup_table_io_return: 866cleanup_table_io_return:
831 .quad io_return, io_leave 867 .quad io_return, io_leave
832cleanup_table_io_leave: 868cleanup_table_io_leave:
833 .quad io_leave, io_done 869 .quad io_leave, io_done
834cleanup_table_io_work_loop: 870cleanup_table_io_work_loop:
835 .quad io_work_loop, io_mcck_pending 871 .quad io_work_loop, io_work_done
836 872
837cleanup_critical: 873cleanup_critical:
838 clc 8(8,%r12),BASED(cleanup_table_system_call) 874 clc 8(8,%r12),BASED(cleanup_table_system_call)
@@ -901,8 +937,6 @@ cleanup_system_call:
901cleanup_vtime: 937cleanup_vtime:
902 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24) 938 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24)
903 jhe cleanup_stime 939 jhe cleanup_stime
904 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
905 jz cleanup_novtime
906 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 940 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
907cleanup_stime: 941cleanup_stime:
908 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+32) 942 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+32)
@@ -910,7 +944,6 @@ cleanup_stime:
910 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 944 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
911cleanup_update: 945cleanup_update:
912 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 946 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
913cleanup_novtime:
914#endif 947#endif
915 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_system_call+8) 948 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_system_call+8)
916 la %r12,__LC_RETURN_PSW 949 la %r12,__LC_RETURN_PSW
@@ -949,10 +982,10 @@ cleanup_sysc_leave:
9492: la %r12,__LC_RETURN_PSW 9822: la %r12,__LC_RETURN_PSW
950 br %r14 983 br %r14
951cleanup_sysc_leave_insn: 984cleanup_sysc_leave_insn:
985 .quad sysc_done - 4
952#ifdef CONFIG_VIRT_CPU_ACCOUNTING 986#ifdef CONFIG_VIRT_CPU_ACCOUNTING
953 .quad sysc_leave + 16 987 .quad sysc_done - 8
954#endif 988#endif
955 .quad sysc_leave + 12
956 989
957cleanup_io_return: 990cleanup_io_return:
958 mvc __LC_RETURN_PSW(8),0(%r12) 991 mvc __LC_RETURN_PSW(8),0(%r12)
@@ -979,17 +1012,16 @@ cleanup_io_leave:
9792: la %r12,__LC_RETURN_PSW 10122: la %r12,__LC_RETURN_PSW
980 br %r14 1013 br %r14
981cleanup_io_leave_insn: 1014cleanup_io_leave_insn:
1015 .quad io_done - 4
982#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1016#ifdef CONFIG_VIRT_CPU_ACCOUNTING
983 .quad io_leave + 20 1017 .quad io_done - 8
984#endif 1018#endif
985 .quad io_leave + 16
986 1019
987/* 1020/*
988 * Integer constants 1021 * Integer constants
989 */ 1022 */
990 .align 4 1023 .align 4
991.Lconst: 1024.Lconst:
992.Lc_pactive: .long PREEMPT_ACTIVE
993.Lnr_syscalls: .long NR_syscalls 1025.Lnr_syscalls: .long NR_syscalls
994.L0x0130: .short 0x130 1026.L0x0130: .short 0x130
995.L0x0140: .short 0x140 1027.L0x0140: .short 0x140
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 96492cf2d491..29f7884b4ffa 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -92,6 +92,7 @@ EXPORT_SYMBOL(unregister_idle_notifier);
92 92
93void do_monitor_call(struct pt_regs *regs, long interruption_code) 93void do_monitor_call(struct pt_regs *regs, long interruption_code)
94{ 94{
95#ifdef CONFIG_SMP
95 struct s390_idle_data *idle; 96 struct s390_idle_data *idle;
96 97
97 idle = &__get_cpu_var(s390_idle); 98 idle = &__get_cpu_var(s390_idle);
@@ -99,7 +100,7 @@ void do_monitor_call(struct pt_regs *regs, long interruption_code)
99 idle->idle_time += get_clock() - idle->idle_enter; 100 idle->idle_time += get_clock() - idle->idle_enter;
100 idle->in_idle = 0; 101 idle->in_idle = 0;
101 spin_unlock(&idle->lock); 102 spin_unlock(&idle->lock);
102 103#endif
103 /* disable monitor call class 0 */ 104 /* disable monitor call class 0 */
104 __ctl_clear_bit(8, 15); 105 __ctl_clear_bit(8, 15);
105 106
@@ -114,7 +115,9 @@ extern void s390_handle_mcck(void);
114static void default_idle(void) 115static void default_idle(void)
115{ 116{
116 int cpu, rc; 117 int cpu, rc;
118#ifdef CONFIG_SMP
117 struct s390_idle_data *idle; 119 struct s390_idle_data *idle;
120#endif
118 121
119 /* CPU is going idle. */ 122 /* CPU is going idle. */
120 cpu = smp_processor_id(); 123 cpu = smp_processor_id();
@@ -151,13 +154,14 @@ static void default_idle(void)
151 s390_handle_mcck(); 154 s390_handle_mcck();
152 return; 155 return;
153 } 156 }
154 157#ifdef CONFIG_SMP
155 idle = &__get_cpu_var(s390_idle); 158 idle = &__get_cpu_var(s390_idle);
156 spin_lock(&idle->lock); 159 spin_lock(&idle->lock);
157 idle->idle_count++; 160 idle->idle_count++;
158 idle->in_idle = 1; 161 idle->in_idle = 1;
159 idle->idle_enter = get_clock(); 162 idle->idle_enter = get_clock();
160 spin_unlock(&idle->lock); 163 spin_unlock(&idle->lock);
164#endif
161 trace_hardirqs_on(); 165 trace_hardirqs_on();
162 /* Wait for external, I/O or machine check interrupt. */ 166 /* Wait for external, I/O or machine check interrupt. */
163 __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT | 167 __load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 7e1bfb984064..50f8f1e3760e 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -347,7 +347,7 @@ void (*_machine_power_off)(void) = do_machine_power_off_nonsmp;
347 347
348void machine_restart(char *command) 348void machine_restart(char *command)
349{ 349{
350 if (!in_interrupt() || oops_in_progress) 350 if ((!in_interrupt() && !in_atomic()) || oops_in_progress)
351 /* 351 /*
352 * Only unblank the console if we are called in enabled 352 * Only unblank the console if we are called in enabled
353 * context or a bust_spinlocks cleared the way for us. 353 * context or a bust_spinlocks cleared the way for us.
@@ -492,6 +492,10 @@ static void setup_addressing_mode(void)
492 printk("S390 address spaces switched, "); 492 printk("S390 address spaces switched, ");
493 set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY); 493 set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY);
494 } 494 }
495#ifdef CONFIG_TRACE_IRQFLAGS
496 sysc_restore_trace_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK;
497 io_restore_trace_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK;
498#endif
495} 499}
496 500
497static void __init 501static void __init
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 1d97fe1c0e53..264ea906db4c 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -193,72 +193,30 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
193} 193}
194EXPORT_SYMBOL(smp_call_function_single); 194EXPORT_SYMBOL(smp_call_function_single);
195 195
196static void do_send_stop(void) 196void smp_send_stop(void)
197{ 197{
198 int cpu, rc; 198 int cpu, rc;
199 199
200 /* stop all processors */ 200 /* Disable all interrupts/machine checks */
201 for_each_online_cpu(cpu) { 201 __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
202 if (cpu == smp_processor_id())
203 continue;
204 do {
205 rc = signal_processor(cpu, sigp_stop);
206 } while (rc == sigp_busy);
207 }
208}
209 202
210static void do_store_status(void) 203 /* write magic number to zero page (absolute 0) */
211{ 204 lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC;
212 int cpu, rc;
213 205
214 /* store status of all processors in their lowcores (real 0) */ 206 /* stop all processors */
215 for_each_online_cpu(cpu) { 207 for_each_online_cpu(cpu) {
216 if (cpu == smp_processor_id()) 208 if (cpu == smp_processor_id())
217 continue; 209 continue;
218 do { 210 do {
219 rc = signal_processor_p( 211 rc = signal_processor(cpu, sigp_stop);
220 (__u32)(unsigned long) lowcore_ptr[cpu], cpu,
221 sigp_store_status_at_address);
222 } while (rc == sigp_busy); 212 } while (rc == sigp_busy);
223 }
224}
225 213
226static void do_wait_for_stop(void)
227{
228 int cpu;
229
230 /* Wait for all other cpus to enter stopped state */
231 for_each_online_cpu(cpu) {
232 if (cpu == smp_processor_id())
233 continue;
234 while (!smp_cpu_not_running(cpu)) 214 while (!smp_cpu_not_running(cpu))
235 cpu_relax(); 215 cpu_relax();
236 } 216 }
237} 217}
238 218
239/* 219/*
240 * this function sends a 'stop' sigp to all other CPUs in the system.
241 * it goes straight through.
242 */
243void smp_send_stop(void)
244{
245 /* Disable all interrupts/machine checks */
246 __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
247
248 /* write magic number to zero page (absolute 0) */
249 lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC;
250
251 /* stop other processors. */
252 do_send_stop();
253
254 /* wait until other processors are stopped */
255 do_wait_for_stop();
256
257 /* store status of other processors. */
258 do_store_status();
259}
260
261/*
262 * Reboot, halt and power_off routines for SMP. 220 * Reboot, halt and power_off routines for SMP.
263 */ 221 */
264void machine_restart_smp(char *__unused) 222void machine_restart_smp(char *__unused)
@@ -788,14 +746,14 @@ static ssize_t show_idle_time(struct sys_device *dev, char *buf)
788 } 746 }
789 new_time = idle->idle_time; 747 new_time = idle->idle_time;
790 spin_unlock_irq(&idle->lock); 748 spin_unlock_irq(&idle->lock);
791 return sprintf(buf, "%llu us\n", new_time >> 12); 749 return sprintf(buf, "%llu\n", new_time >> 12);
792} 750}
793static SYSDEV_ATTR(idle_time, 0444, show_idle_time, NULL); 751static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL);
794 752
795static struct attribute *cpu_attrs[] = { 753static struct attribute *cpu_attrs[] = {
796 &attr_capability.attr, 754 &attr_capability.attr,
797 &attr_idle_count.attr, 755 &attr_idle_count.attr,
798 &attr_idle_time.attr, 756 &attr_idle_time_us.attr,
799 NULL, 757 NULL,
800}; 758};
801 759
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 48dae49bc1ec..22b800ce2126 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -145,12 +145,8 @@ void account_ticks(u64 time)
145 do_timer(ticks); 145 do_timer(ticks);
146#endif 146#endif
147 147
148#ifdef CONFIG_VIRT_CPU_ACCOUNTING
149 account_tick_vtime(current);
150#else
151 while (ticks--) 148 while (ticks--)
152 update_process_times(user_mode(get_irq_regs())); 149 update_process_times(user_mode(get_irq_regs()));
153#endif
154 150
155 s390_do_profile(); 151 s390_do_profile();
156} 152}
@@ -307,7 +303,7 @@ static cycle_t read_tod_clock(void)
307 303
308static struct clocksource clocksource_tod = { 304static struct clocksource clocksource_tod = {
309 .name = "tod", 305 .name = "tod",
310 .rating = 100, 306 .rating = 400,
311 .read = read_tod_clock, 307 .read = read_tod_clock,
312 .mask = -1ULL, 308 .mask = -1ULL,
313 .mult = 1000, 309 .mult = 1000,
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 8ec9def83ccb..8ed16a83fba7 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -260,6 +260,7 @@ void die(const char * str, struct pt_regs * regs, long err)
260 bust_spinlocks(1); 260 bust_spinlocks(1);
261 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 261 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
262 print_modules(); 262 print_modules();
263 notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
263 show_regs(regs); 264 show_regs(regs);
264 bust_spinlocks(0); 265 bust_spinlocks(0);
265 add_taint(TAINT_DIE); 266 add_taint(TAINT_DIE);
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 84ff78de6bac..c5f05b3fb2c3 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -32,7 +32,7 @@ static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
32 * Update process times based on virtual cpu times stored by entry.S 32 * Update process times based on virtual cpu times stored by entry.S
33 * to the lowcore fields user_timer, system_timer & steal_clock. 33 * to the lowcore fields user_timer, system_timer & steal_clock.
34 */ 34 */
35void account_tick_vtime(struct task_struct *tsk) 35void account_process_tick(struct task_struct *tsk, int user_tick)
36{ 36{
37 cputime_t cputime; 37 cputime_t cputime;
38 __u64 timer, clock; 38 __u64 timer, clock;
@@ -64,12 +64,6 @@ void account_tick_vtime(struct task_struct *tsk)
64 S390_lowcore.steal_clock -= cputime << 12; 64 S390_lowcore.steal_clock -= cputime << 12;
65 account_steal_time(tsk, cputime); 65 account_steal_time(tsk, cputime);
66 } 66 }
67
68 run_local_timers();
69 if (rcu_pending(smp_processor_id()))
70 rcu_check_callbacks(smp_processor_id(), rcu_user_flag);
71 scheduler_tick();
72 run_posix_cpu_timers(tsk);
73} 67}
74 68
75/* 69/*
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index d4ed93dfb9c7..413c240cbca7 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -341,19 +341,16 @@ cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
341 341
342static struct ctl_table cmm_table[] = { 342static struct ctl_table cmm_table[] = {
343 { 343 {
344 .ctl_name = VM_CMM_PAGES,
345 .procname = "cmm_pages", 344 .procname = "cmm_pages",
346 .mode = 0644, 345 .mode = 0644,
347 .proc_handler = &cmm_pages_handler, 346 .proc_handler = &cmm_pages_handler,
348 }, 347 },
349 { 348 {
350 .ctl_name = VM_CMM_TIMED_PAGES,
351 .procname = "cmm_timed_pages", 349 .procname = "cmm_timed_pages",
352 .mode = 0644, 350 .mode = 0644,
353 .proc_handler = &cmm_pages_handler, 351 .proc_handler = &cmm_pages_handler,
354 }, 352 },
355 { 353 {
356 .ctl_name = VM_CMM_TIMEOUT,
357 .procname = "cmm_timeout", 354 .procname = "cmm_timeout",
358 .mode = 0644, 355 .mode = 0644,
359 .proc_handler = &cmm_timeout_handler, 356 .proc_handler = &cmm_timeout_handler,
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 247f8a65e733..496d635f89b2 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
@@ -213,10 +211,12 @@ config SH_SOLUTION_ENGINE
213 bool "SolutionEngine" 211 bool "SolutionEngine"
214 select SOLUTION_ENGINE 212 select SOLUTION_ENGINE
215 select CPU_HAS_IPR_IRQ 213 select CPU_HAS_IPR_IRQ
216 depends on CPU_SUBTYPE_SH7709 || CPU_SUBTYPE_SH7750 214 depends on CPU_SUBTYPE_SH7705 || CPU_SUBTYPE_SH7709 || CPU_SUBTYPE_SH7710 || \
215 CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \
216 CPU_SUBTYPE_SH7750R
217 help 217 help
218 Select SolutionEngine if configuring for a Hitachi SH7709 218 Select SolutionEngine if configuring for a Hitachi SH7705, SH7709,
219 or SH7750 evaluation board. 219 SH7710, SH7712, SH7750, SH7750S or SH7750R evaluation board.
220 220
221config SH_7206_SOLUTION_ENGINE 221config SH_7206_SOLUTION_ENGINE
222 bool "SolutionEngine7206" 222 bool "SolutionEngine7206"
@@ -291,9 +291,7 @@ config SH_DREAMCAST
291 depends on CPU_SUBTYPE_SH7091 291 depends on CPU_SUBTYPE_SH7091
292 help 292 help
293 Select Dreamcast if configuring for a SEGA Dreamcast. 293 Select Dreamcast if configuring for a SEGA Dreamcast.
294 More information at 294 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 295
298config SH_MPC1211 296config SH_MPC1211
299 bool "Interface MPC1211" 297 bool "Interface MPC1211"
@@ -607,7 +605,7 @@ config BOOT_LINK_OFFSET
607 605
608config UBC_WAKEUP 606config UBC_WAKEUP
609 bool "Wakeup UBC on startup" 607 bool "Wakeup UBC on startup"
610 depends on CPU_SH4 608 depends on CPU_SH4 && !CPU_SH4A
611 help 609 help
612 Selecting this option will wakeup the User Break Controller (UBC) on 610 Selecting this option will wakeup the User Break Controller (UBC) on
613 startup. Although the UBC is left in an awake state when the processor 611 startup. Although the UBC is left in an awake state when the processor
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index b507b501f0cf..722da6851f56 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
@@ -116,12 +124,13 @@ config KGDB_NMI
116 124
117config SH_KGDB_CONSOLE 125config SH_KGDB_CONSOLE
118 bool "Console messages through GDB" 126 bool "Console messages through GDB"
119 depends on !SERIAL_SH_SCI_CONSOLE 127 depends on !SERIAL_SH_SCI_CONSOLE && SERIAL_SH_SCI=y
120 select SERIAL_CORE_CONSOLE 128 select SERIAL_CORE_CONSOLE
121 default n 129 default n
122 130
123config KGDB_SYSRQ 131config KGDB_SYSRQ
124 bool "Allow SysRq 'G' to enter KGDB" 132 bool "Allow SysRq 'G' to enter KGDB"
133 depends on MAGIC_SYSRQ
125 default y 134 default y
126 135
127comment "Serial port setup" 136comment "Serial port setup"
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/hs7751rvoip/irq.c b/arch/sh/boards/renesas/hs7751rvoip/irq.c
index 943f93aa6052..e55c6686b21f 100644
--- a/arch/sh/boards/renesas/hs7751rvoip/irq.c
+++ b/arch/sh/boards/renesas/hs7751rvoip/irq.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/interrupt.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
17#include <asm/hs7751rvoip.h> 18#include <asm/hs7751rvoip.h>
diff --git a/arch/sh/boards/renesas/hs7751rvoip/setup.c b/arch/sh/boards/renesas/hs7751rvoip/setup.c
index fa5fa3920222..c05625975f2c 100644
--- a/arch/sh/boards/renesas/hs7751rvoip/setup.c
+++ b/arch/sh/boards/renesas/hs7751rvoip/setup.c
@@ -15,20 +15,6 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/machvec.h> 16#include <asm/machvec.h>
17 17
18static struct ipr_data hs77501rvoip_ipr_map[] = {
19#if defined(CONFIG_HS7751RVOIP_CODEC)
20 { DMTE0_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY },
21 { DMTE1_IRQ, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY },
22#endif
23};
24
25static void __init hs7751rvoip_init_irq(void)
26{
27 make_ipr_irq(hs77501rvoip_ipr_map, ARRAY_SIZE(hs77501rvoip_ipr_map));
28
29 init_hs7751rvoip_IRQ();
30}
31
32static void hs7751rvoip_power_off(void) 18static void hs7751rvoip_power_off(void)
33{ 19{
34 ctrl_outw(ctrl_inw(PA_OUTPORTR) & 0xffdf, PA_OUTPORTR); 20 ctrl_outw(ctrl_inw(PA_OUTPORTR) & 0xffdf, PA_OUTPORTR);
@@ -75,14 +61,13 @@ static int __init hs7751rvoip_cf_init(void)
75 61
76 return 0; 62 return 0;
77} 63}
64device_initcall(hs7751rvoip_cf_init);
78 65
79/* 66/*
80 * Initialize the board 67 * Initialize the board
81 */ 68 */
82static void __init hs7751rvoip_setup(char **cmdline_p) 69static void __init hs7751rvoip_setup(char **cmdline_p)
83{ 70{
84 device_initcall(hs7751rvoip_cf_init);
85
86 ctrl_outb(0xf0, PA_OUTPORTR); 71 ctrl_outb(0xf0, PA_OUTPORTR);
87 pm_power_off = hs7751rvoip_power_off; 72 pm_power_off = hs7751rvoip_power_off;
88 73
@@ -115,6 +100,6 @@ static struct sh_machine_vector mv_hs7751rvoip __initmv = {
115 .mv_outsw = hs7751rvoip_outsw, 100 .mv_outsw = hs7751rvoip_outsw,
116 .mv_outsl = hs7751rvoip_outsl, 101 .mv_outsl = hs7751rvoip_outsl,
117 102
118 .mv_init_irq = hs7751rvoip_init_irq, 103 .mv_init_irq = init_hs7751rvoip_IRQ,
119 .mv_ioport_map = hs7751rvoip_ioport_map, 104 .mv_ioport_map = hs7751rvoip_ioport_map,
120}; 105};
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/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 37f2c0b447fe..8125d20fdbd8 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -53,10 +53,12 @@ static struct resource cf_ide_resources[] = {
53 .end = PA_AREA5_IO + 0x80c, 53 .end = PA_AREA5_IO + 0x80c,
54 .flags = IORESOURCE_MEM, 54 .flags = IORESOURCE_MEM,
55 }, 55 },
56#ifndef CONFIG_RTS7751R2D_1 /* For R2D-1 polling is preferred */
56 [2] = { 57 [2] = {
57 .start = IRQ_CF_IDE, 58 .start = IRQ_CF_IDE,
58 .flags = IORESOURCE_IRQ, 59 .flags = IORESOURCE_IRQ,
59 }, 60 },
61#endif
60}; 62};
61 63
62static struct pata_platform_info pata_info = { 64static struct pata_platform_info pata_info = {
diff --git a/arch/sh/boards/renesas/sh7710voipgw/setup.c b/arch/sh/boards/renesas/sh7710voipgw/setup.c
index 2dce8bd97f90..0d56fd83bcba 100644
--- a/arch/sh/boards/renesas/sh7710voipgw/setup.c
+++ b/arch/sh/boards/renesas/sh7710voipgw/setup.c
@@ -11,7 +11,6 @@
11#include <asm/machvec.h> 11#include <asm/machvec.h>
12#include <asm/irq.h> 12#include <asm/irq.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/irq.h>
15 14
16static struct ipr_data sh7710voipgw_ipr_map[] = { 15static struct ipr_data sh7710voipgw_ipr_map[] = {
17 { TIMER2_IRQ, TIMER2_IPR_ADDR, TIMER2_IPR_POS, TIMER2_PRIORITY }, 16 { TIMER2_IRQ, TIMER2_IPR_ADDR, TIMER2_IPR_POS, TIMER2_PRIORITY },
diff --git a/arch/sh/boards/se/7206/irq.c b/arch/sh/boards/se/7206/irq.c
index 27da88486f73..9d5bfc77d0de 100644
--- a/arch/sh/boards/se/7206/irq.c
+++ b/arch/sh/boards/se/7206/irq.c
@@ -9,7 +9,6 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/irq.h> 10#include <linux/irq.h>
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/irq.h>
13#include <linux/interrupt.h> 12#include <linux/interrupt.h>
14#include <asm/se7206.h> 13#include <asm/se7206.h>
15 14
diff --git a/arch/sh/boards/se/770x/setup.c b/arch/sh/boards/se/770x/setup.c
index d07a3368f546..318bc8a3969c 100644
--- a/arch/sh/boards/se/770x/setup.c
+++ b/arch/sh/boards/se/770x/setup.c
@@ -94,6 +94,7 @@ static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
94static struct heartbeat_data heartbeat_data = { 94static struct heartbeat_data heartbeat_data = {
95 .bit_pos = heartbeat_bit_pos, 95 .bit_pos = heartbeat_bit_pos,
96 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos), 96 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
97 .regsize = 16,
97}; 98};
98 99
99static struct resource heartbeat_resources[] = { 100static struct resource heartbeat_resources[] = {
diff --git a/arch/sh/boards/se/7722/setup.c b/arch/sh/boards/se/7722/setup.c
index 03b63457e178..eb97dca5b736 100644
--- a/arch/sh/boards/se/7722/setup.c
+++ b/arch/sh/boards/se/7722/setup.c
@@ -16,8 +16,13 @@
16#include <asm/machvec.h> 16#include <asm/machvec.h>
17#include <asm/se7722.h> 17#include <asm/se7722.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/heartbeat.h>
19 20
20/* Heartbeat */ 21/* Heartbeat */
22static struct heartbeat_data heartbeat_data = {
23 .regsize = 16,
24};
25
21static struct resource heartbeat_resources[] = { 26static struct resource heartbeat_resources[] = {
22 [0] = { 27 [0] = {
23 .start = PA_LED, 28 .start = PA_LED,
@@ -29,6 +34,9 @@ static struct resource heartbeat_resources[] = {
29static struct platform_device heartbeat_device = { 34static struct platform_device heartbeat_device = {
30 .name = "heartbeat", 35 .name = "heartbeat",
31 .id = -1, 36 .id = -1,
37 .dev = {
38 .platform_data = &heartbeat_data,
39 },
32 .num_resources = ARRAY_SIZE(heartbeat_resources), 40 .num_resources = ARRAY_SIZE(heartbeat_resources),
33 .resource = heartbeat_resources, 41 .resource = heartbeat_resources,
34}; 42};
@@ -103,8 +111,8 @@ static void __init se7722_setup(char **cmdline_p)
103 111
104 ctrl_outl(0x00051001, MSTPCR0); 112 ctrl_outl(0x00051001, MSTPCR0);
105 ctrl_outl(0x00000000, MSTPCR1); 113 ctrl_outl(0x00000000, MSTPCR1);
106 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC */ 114 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */
107 ctrl_outl(0xffffbfC0, MSTPCR2); 115 ctrl_outl(0xffffb7c0, MSTPCR2);
108 116
109 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */ 117 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 */ 118 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
diff --git a/arch/sh/boards/se/7780/setup.c b/arch/sh/boards/se/7780/setup.c
index 76e53b26a808..0f08ab3b2bec 100644
--- a/arch/sh/boards/se/7780/setup.c
+++ b/arch/sh/boards/se/7780/setup.c
@@ -14,8 +14,13 @@
14#include <asm/machvec.h> 14#include <asm/machvec.h>
15#include <asm/se7780.h> 15#include <asm/se7780.h>
16#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/heartbeat.h>
17 18
18/* Heartbeat */ 19/* Heartbeat */
20static struct heartbeat_data heartbeat_data = {
21 .regsize = 16,
22};
23
19static struct resource heartbeat_resources[] = { 24static struct resource heartbeat_resources[] = {
20 [0] = { 25 [0] = {
21 .start = PA_LED, 26 .start = PA_LED,
@@ -27,6 +32,9 @@ static struct resource heartbeat_resources[] = {
27static struct platform_device heartbeat_device = { 32static struct platform_device heartbeat_device = {
28 .name = "heartbeat", 33 .name = "heartbeat",
29 .id = -1, 34 .id = -1,
35 .dev = {
36 .platform_data = &heartbeat_data,
37 },
30 .num_resources = ARRAY_SIZE(heartbeat_resources), 38 .num_resources = ARRAY_SIZE(heartbeat_resources),
31 .resource = heartbeat_resources, 39 .resource = heartbeat_resources,
32}; 40};
diff --git a/arch/sh/boards/snapgear/Makefile b/arch/sh/boards/snapgear/Makefile
index 59fc976bfc2f..d2d2f4b6a502 100644
--- a/arch/sh/boards/snapgear/Makefile
+++ b/arch/sh/boards/snapgear/Makefile
@@ -2,5 +2,4 @@
2# Makefile for the SnapGear specific parts of the kernel 2# Makefile for the SnapGear specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o rtc.o 5obj-y := setup.o io.o
6
diff --git a/arch/sh/boards/snapgear/rtc.c b/arch/sh/boards/snapgear/rtc.c
deleted file mode 100644
index edb3dd936cbb..000000000000
--- a/arch/sh/boards/snapgear/rtc.c
+++ /dev/null
@@ -1,309 +0,0 @@
1/****************************************************************************/
2/*
3 * linux/arch/sh/boards/snapgear/rtc.c -- Secureedge5410 RTC code
4 *
5 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
6 * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
7 *
8 * The SecureEdge5410 can have one of 2 real time clocks, the SH
9 * built in version or the preferred external DS1302. Here we work out
10 * each to see what we have and then run with it.
11 */
12/****************************************************************************/
13
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/time.h>
18#include <linux/rtc.h>
19#include <linux/mc146818rtc.h>
20#include <asm/io.h>
21
22static int use_ds1302;
23
24/****************************************************************************/
25/*
26 * we need to implement a DS1302 driver here that can operate in
27 * conjunction with the builtin rtc driver which is already quite friendly
28 */
29/*****************************************************************************/
30
31#define RTC_CMD_READ 0x81 /* Read command */
32#define RTC_CMD_WRITE 0x80 /* Write command */
33
34#define RTC_ADDR_YEAR 0x06 /* Address of year register */
35#define RTC_ADDR_DAY 0x05 /* Address of day of week register */
36#define RTC_ADDR_MON 0x04 /* Address of month register */
37#define RTC_ADDR_DATE 0x03 /* Address of day of month register */
38#define RTC_ADDR_HOUR 0x02 /* Address of hour register */
39#define RTC_ADDR_MIN 0x01 /* Address of minute register */
40#define RTC_ADDR_SEC 0x00 /* Address of second register */
41
42#define RTC_RESET 0x1000
43#define RTC_IODATA 0x0800
44#define RTC_SCLK 0x0400
45
46#define set_dirp(x)
47#define get_dirp(x) 0
48#define set_dp(x) SECUREEDGE_WRITE_IOPORT(x, 0x1c00)
49#define get_dp(x) SECUREEDGE_READ_IOPORT()
50
51static void ds1302_sendbits(unsigned int val)
52{
53 int i;
54
55 for (i = 8; (i); i--, val >>= 1) {
56 set_dp((get_dp() & ~RTC_IODATA) | ((val & 0x1) ? RTC_IODATA : 0));
57 set_dp(get_dp() | RTC_SCLK); // clock high
58 set_dp(get_dp() & ~RTC_SCLK); // clock low
59 }
60}
61
62static unsigned int ds1302_recvbits(void)
63{
64 unsigned int val;
65 int i;
66
67 for (i = 0, val = 0; (i < 8); i++) {
68 val |= (((get_dp() & RTC_IODATA) ? 1 : 0) << i);
69 set_dp(get_dp() | RTC_SCLK); // clock high
70 set_dp(get_dp() & ~RTC_SCLK); // clock low
71 }
72 return(val);
73}
74
75static unsigned int ds1302_readbyte(unsigned int addr)
76{
77 unsigned int val;
78 unsigned long flags;
79
80 local_irq_save(flags);
81 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
82 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));
83
84 set_dp(get_dp() | RTC_RESET);
85 ds1302_sendbits(((addr & 0x3f) << 1) | RTC_CMD_READ);
86 set_dirp(get_dirp() & ~RTC_IODATA);
87 val = ds1302_recvbits();
88 set_dp(get_dp() & ~RTC_RESET);
89 local_irq_restore(flags);
90
91 return(val);
92}
93
94static void ds1302_writebyte(unsigned int addr, unsigned int val)
95{
96 unsigned long flags;
97
98 local_irq_save(flags);
99 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
100 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));
101 set_dp(get_dp() | RTC_RESET);
102 ds1302_sendbits(((addr & 0x3f) << 1) | RTC_CMD_WRITE);
103 ds1302_sendbits(val);
104 set_dp(get_dp() & ~RTC_RESET);
105 local_irq_restore(flags);
106}
107
108static void ds1302_reset(void)
109{
110 unsigned long flags;
111 /* Hardware dependent reset/init */
112 local_irq_save(flags);
113 set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
114 set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));
115 local_irq_restore(flags);
116}
117
118/*****************************************************************************/
119
120static inline int bcd2int(int val)
121{
122 return((((val & 0xf0) >> 4) * 10) + (val & 0xf));
123}
124
125static inline int int2bcd(int val)
126{
127 return(((val / 10) << 4) + (val % 10));
128}
129
130/*****************************************************************************/
131/*
132 * Write and Read some RAM in the DS1302, if it works assume it's there
133 * Otherwise use the SH4 internal RTC
134 */
135
136void snapgear_rtc_gettimeofday(struct timespec *);
137int snapgear_rtc_settimeofday(const time_t);
138
139void __init secureedge5410_rtc_init(void)
140{
141 unsigned char *test = "snapgear";
142 int i;
143
144 ds1302_reset();
145
146 use_ds1302 = 1;
147
148 for (i = 0; test[i]; i++)
149 ds1302_writebyte(32 + i, test[i]);
150
151 for (i = 0; test[i]; i++)
152 if (ds1302_readbyte(32 + i) != test[i]) {
153 use_ds1302 = 0;
154 break;
155 }
156
157 if (use_ds1302) {
158 rtc_sh_get_time = snapgear_rtc_gettimeofday;
159 rtc_sh_set_time = snapgear_rtc_settimeofday;
160 }
161
162 printk("SnapGear RTC: using %s rtc.\n", use_ds1302 ? "ds1302" : "internal");
163}
164
165/****************************************************************************/
166/*
167 * our generic interface that chooses the correct code to use
168 */
169
170void snapgear_rtc_gettimeofday(struct timespec *ts)
171{
172 unsigned int sec, min, hr, day, mon, yr;
173
174 if (!use_ds1302)
175 return;
176
177 sec = bcd2int(ds1302_readbyte(RTC_ADDR_SEC));
178 min = bcd2int(ds1302_readbyte(RTC_ADDR_MIN));
179 hr = bcd2int(ds1302_readbyte(RTC_ADDR_HOUR));
180 day = bcd2int(ds1302_readbyte(RTC_ADDR_DATE));
181 mon = bcd2int(ds1302_readbyte(RTC_ADDR_MON));
182 yr = bcd2int(ds1302_readbyte(RTC_ADDR_YEAR));
183
184bad_time:
185 if (yr > 99 || mon < 1 || mon > 12 || day > 31 || day < 1 ||
186 hr > 23 || min > 59 || sec > 59) {
187 printk(KERN_ERR
188 "SnapGear RTC: invalid value, resetting to 1 Jan 2000\n");
189 ds1302_writebyte(RTC_ADDR_MIN, min = 0);
190 ds1302_writebyte(RTC_ADDR_HOUR, hr = 0);
191 ds1302_writebyte(RTC_ADDR_DAY, 7);
192 ds1302_writebyte(RTC_ADDR_DATE, day = 1);
193 ds1302_writebyte(RTC_ADDR_MON, mon = 1);
194 ds1302_writebyte(RTC_ADDR_YEAR, yr = 0);
195 ds1302_writebyte(RTC_ADDR_SEC, sec = 0);
196 }
197
198 ts->tv_sec = mktime(2000 + yr, mon, day, hr, min, sec);
199 if (ts->tv_sec < 0) {
200#if 0
201 printk("BAD TIME %d %d %d %d %d %d\n", yr, mon, day, hr, min, sec);
202#endif
203 yr = 100;
204 goto bad_time;
205 }
206 ts->tv_nsec = 0;
207}
208
209int snapgear_rtc_settimeofday(const time_t secs)
210{
211 int retval = 0;
212 int real_seconds, real_minutes, cmos_minutes;
213 unsigned long nowtime;
214
215 if (!use_ds1302)
216 return 0;
217
218/*
219 * This is called direct from the kernel timer handling code.
220 * It is supposed to synchronize the kernel clock to the RTC.
221 */
222
223 nowtime = secs;
224
225 /* STOP RTC */
226 ds1302_writebyte(RTC_ADDR_SEC, ds1302_readbyte(RTC_ADDR_SEC) | 0x80);
227
228 cmos_minutes = bcd2int(ds1302_readbyte(RTC_ADDR_MIN));
229
230 /*
231 * since we're only adjusting minutes and seconds,
232 * don't interfere with hour overflow. This avoids
233 * messing with unknown time zones but requires your
234 * RTC not to be off by more than 15 minutes
235 */
236 real_seconds = nowtime % 60;
237 real_minutes = nowtime / 60;
238 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
239 real_minutes += 30; /* correct for half hour time zone */
240 real_minutes %= 60;
241
242 if (abs(real_minutes - cmos_minutes) < 30) {
243 ds1302_writebyte(RTC_ADDR_MIN, int2bcd(real_minutes));
244 ds1302_writebyte(RTC_ADDR_SEC, int2bcd(real_seconds));
245 } else {
246 printk(KERN_WARNING
247 "SnapGear RTC: can't update from %d to %d\n",
248 cmos_minutes, real_minutes);
249 retval = -1;
250 }
251
252 /* START RTC */
253 ds1302_writebyte(RTC_ADDR_SEC, ds1302_readbyte(RTC_ADDR_SEC) & ~0x80);
254 return(0);
255}
256
257unsigned char secureedge5410_cmos_read(int addr)
258{
259 unsigned char val = 0;
260
261 if (!use_ds1302)
262 return(__CMOS_READ(addr, w));
263
264 switch(addr) {
265 case RTC_SECONDS: val = ds1302_readbyte(RTC_ADDR_SEC); break;
266 case RTC_SECONDS_ALARM: break;
267 case RTC_MINUTES: val = ds1302_readbyte(RTC_ADDR_MIN); break;
268 case RTC_MINUTES_ALARM: break;
269 case RTC_HOURS: val = ds1302_readbyte(RTC_ADDR_HOUR); break;
270 case RTC_HOURS_ALARM: break;
271 case RTC_DAY_OF_WEEK: val = ds1302_readbyte(RTC_ADDR_DAY); break;
272 case RTC_DAY_OF_MONTH: val = ds1302_readbyte(RTC_ADDR_DATE); break;
273 case RTC_MONTH: val = ds1302_readbyte(RTC_ADDR_MON); break;
274 case RTC_YEAR: val = ds1302_readbyte(RTC_ADDR_YEAR); break;
275 case RTC_REG_A: /* RTC_FREQ_SELECT */ break;
276 case RTC_REG_B: /* RTC_CONTROL */ break;
277 case RTC_REG_C: /* RTC_INTR_FLAGS */ break;
278 case RTC_REG_D: val = RTC_VRT /* RTC_VALID */; break;
279 default: break;
280 }
281
282 return(val);
283}
284
285void secureedge5410_cmos_write(unsigned char val, int addr)
286{
287 if (!use_ds1302) {
288 __CMOS_WRITE(val, addr, w);
289 return;
290 }
291
292 switch(addr) {
293 case RTC_SECONDS: ds1302_writebyte(RTC_ADDR_SEC, val); break;
294 case RTC_SECONDS_ALARM: break;
295 case RTC_MINUTES: ds1302_writebyte(RTC_ADDR_MIN, val); break;
296 case RTC_MINUTES_ALARM: break;
297 case RTC_HOURS: ds1302_writebyte(RTC_ADDR_HOUR, val); break;
298 case RTC_HOURS_ALARM: break;
299 case RTC_DAY_OF_WEEK: ds1302_writebyte(RTC_ADDR_DAY, val); break;
300 case RTC_DAY_OF_MONTH: ds1302_writebyte(RTC_ADDR_DATE, val); break;
301 case RTC_MONTH: ds1302_writebyte(RTC_ADDR_MON, val); break;
302 case RTC_YEAR: ds1302_writebyte(RTC_ADDR_YEAR, val); break;
303 case RTC_REG_A: /* RTC_FREQ_SELECT */ break;
304 case RTC_REG_B: /* RTC_CONTROL */ break;
305 case RTC_REG_C: /* RTC_INTR_FLAGS */ break;
306 case RTC_REG_D: /* RTC_VALID */ break;
307 default: break;
308 }
309}
diff --git a/arch/sh/boards/snapgear/setup.c b/arch/sh/boards/snapgear/setup.c
index 2b594f600002..7022483f98e8 100644
--- a/arch/sh/boards/snapgear/setup.c
+++ b/arch/sh/boards/snapgear/setup.c
@@ -22,20 +22,15 @@
22#include <asm/snapgear.h> 22#include <asm/snapgear.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/rtc.h>
26#include <asm/cpu/timer.h> 25#include <asm/cpu/timer.h>
27 26
28extern void secureedge5410_rtc_init(void);
29extern void pcibios_init(void);
30
31/****************************************************************************/
32/* 27/*
33 * EraseConfig handling functions 28 * EraseConfig handling functions
34 */ 29 */
35 30
36static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id) 31static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
37{ 32{
38 volatile char dummy __attribute__((unused)) = * (volatile char *) 0xb8000000; 33 (void)ctrl_inb(0xb8000000); /* dummy read */
39 34
40 printk("SnapGear: erase switch interrupt!\n"); 35 printk("SnapGear: erase switch interrupt!\n");
41 36
@@ -76,19 +71,10 @@ static void __init init_snapgear_IRQ(void)
76} 71}
77 72
78/* 73/*
79 * Initialize the board
80 */
81static void __init snapgear_setup(char **cmdline_p)
82{
83 board_time_init = secureedge5410_rtc_init;
84}
85
86/*
87 * The Machine Vector 74 * The Machine Vector
88 */ 75 */
89static struct sh_machine_vector mv_snapgear __initmv = { 76static struct sh_machine_vector mv_snapgear __initmv = {
90 .mv_name = "SnapGear SecureEdge5410", 77 .mv_name = "SnapGear SecureEdge5410",
91 .mv_setup = snapgear_setup,
92 .mv_nr_irqs = 72, 78 .mv_nr_irqs = 72,
93 79
94 .mv_inb = snapgear_inb, 80 .mv_inb = snapgear_inb,
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index 4c5ffdcd55b6..1b0f5be01d10 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -39,7 +39,7 @@ KERNEL_LOAD := $(shell /bin/bash -c 'printf "0x%8x" \
39 39
40quiet_cmd_uimage = UIMAGE $@ 40quiet_cmd_uimage = UIMAGE $@
41 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \ 41 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
42 -C gzip -a $(KERNEL_LOAD) -e $(KERNEL_LOAD) \ 42 -C none -a $(KERNEL_LOAD) -e $(KERNEL_LOAD) \
43 -n 'Linux-$(KERNELRELEASE)' -d $< $@ 43 -n 'Linux-$(KERNELRELEASE)' -d $< $@
44 44
45$(obj)/uImage: $(obj)/zImage FORCE 45$(obj)/uImage: $(obj)/zImage FORCE
diff --git a/arch/sh/cchips/hd6446x/Makefile b/arch/sh/cchips/hd6446x/Makefile
index a106dd9db986..f7de4076e242 100644
--- a/arch/sh/cchips/hd6446x/Makefile
+++ b/arch/sh/cchips/hd6446x/Makefile
@@ -1,2 +1,4 @@
1obj-$(CONFIG_HD64461) += hd64461.o 1obj-$(CONFIG_HD64461) += hd64461.o
2obj-$(CONFIG_HD64465) += hd64465/ 2obj-$(CONFIG_HD64465) += hd64465/
3
4EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/cchips/voyagergx/Makefile b/arch/sh/cchips/voyagergx/Makefile
index 085de72fd327..f73963cb3744 100644
--- a/arch/sh/cchips/voyagergx/Makefile
+++ b/arch/sh/cchips/voyagergx/Makefile
@@ -6,3 +6,4 @@ obj-y := irq.o setup.o
6 6
7obj-$(CONFIG_USB_OHCI_HCD) += consistent.o 7obj-$(CONFIG_USB_OHCI_HCD) += consistent.o
8 8
9EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/configs/r7780mp_defconfig b/arch/sh/configs/r7780mp_defconfig
index ac4de4973b60..2ad804ec920a 100644
--- a/arch/sh/configs/r7780mp_defconfig
+++ b/arch/sh/configs/r7780mp_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-rc2
4# Mon Jun 11 10:24:57 2007 4# Tue Nov 13 20:32:39 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
@@ -13,38 +13,39 @@ 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_PCI=y
16CONFIG_STACKTRACE_SUPPORT=y 17CONFIG_STACKTRACE_SUPPORT=y
17CONFIG_LOCKDEP_SUPPORT=y 18CONFIG_LOCKDEP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set 19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set 20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 23
22# 24#
23# Code maturity level options 25# General setup
24# 26#
25CONFIG_EXPERIMENTAL=y 27CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 28CONFIG_BROKEN_ON_SMP=y
27CONFIG_LOCK_KERNEL=y 29CONFIG_LOCK_KERNEL=y
28CONFIG_INIT_ENV_ARG_LIMIT=32 30CONFIG_INIT_ENV_ARG_LIMIT=32
29
30#
31# General setup
32#
33CONFIG_LOCALVERSION="" 31CONFIG_LOCALVERSION=""
34CONFIG_LOCALVERSION_AUTO=y 32CONFIG_LOCALVERSION_AUTO=y
35CONFIG_SWAP=y 33CONFIG_SWAP=y
36CONFIG_SYSVIPC=y 34CONFIG_SYSVIPC=y
37# CONFIG_IPC_NS is not set
38CONFIG_SYSVIPC_SYSCTL=y 35CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set 36# CONFIG_POSIX_MQUEUE is not set
40CONFIG_BSD_PROCESS_ACCT=y 37CONFIG_BSD_PROCESS_ACCT=y
41# CONFIG_BSD_PROCESS_ACCT_V3 is not set 38# CONFIG_BSD_PROCESS_ACCT_V3 is not set
42# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
43# CONFIG_UTS_NS is not set 40# CONFIG_USER_NS is not set
44# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
45CONFIG_IKCONFIG=y 42CONFIG_IKCONFIG=y
46CONFIG_IKCONFIG_PROC=y 43CONFIG_IKCONFIG_PROC=y
47CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
45# CONFIG_CGROUPS is not set
46CONFIG_FAIR_GROUP_SCHED=y
47CONFIG_FAIR_USER_SCHED=y
48# CONFIG_FAIR_CGROUP_SCHED is not set
48# CONFIG_SYSFS_DEPRECATED is not set 49# CONFIG_SYSFS_DEPRECATED is not set
49# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
50# CONFIG_BLK_DEV_INITRD is not set 51# CONFIG_BLK_DEV_INITRD is not set
@@ -65,7 +66,6 @@ CONFIG_BASE_FULL=y
65CONFIG_ANON_INODES=y 66CONFIG_ANON_INODES=y
66# CONFIG_EPOLL is not set 67# CONFIG_EPOLL is not set
67CONFIG_SIGNALFD=y 68CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y 69CONFIG_EVENTFD=y
70CONFIG_SHMEM=y 70CONFIG_SHMEM=y
71CONFIG_VM_EVENT_COUNTERS=y 71CONFIG_VM_EVENT_COUNTERS=y
@@ -74,24 +74,17 @@ CONFIG_SLAB=y
74# CONFIG_SLOB is not set 74# CONFIG_SLOB is not set
75# CONFIG_TINY_SHMEM is not set 75# CONFIG_TINY_SHMEM is not set
76CONFIG_BASE_SMALL=0 76CONFIG_BASE_SMALL=0
77
78#
79# Loadable module support
80#
81CONFIG_MODULES=y 77CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y 78CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set 79# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set 80# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set 81# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y 82CONFIG_KMOD=y
87
88#
89# Block layer
90#
91CONFIG_BLOCK=y 83CONFIG_BLOCK=y
92# CONFIG_LBD is not set 84# CONFIG_LBD is not set
93# CONFIG_BLK_DEV_IO_TRACE is not set 85# CONFIG_BLK_DEV_IO_TRACE is not set
94# CONFIG_LSF is not set 86# CONFIG_LSF is not set
87# CONFIG_BLK_DEV_BSG is not set
95 88
96# 89#
97# IO Schedulers 90# IO Schedulers
@@ -113,7 +106,6 @@ CONFIG_CPU_SH4=y
113CONFIG_CPU_SH4A=y 106CONFIG_CPU_SH4A=y
114# CONFIG_CPU_SUBTYPE_SH7619 is not set 107# CONFIG_CPU_SUBTYPE_SH7619 is not set
115# CONFIG_CPU_SUBTYPE_SH7206 is not set 108# CONFIG_CPU_SUBTYPE_SH7206 is not set
116# CONFIG_CPU_SUBTYPE_SH7300 is not set
117# CONFIG_CPU_SUBTYPE_SH7705 is not set 109# CONFIG_CPU_SUBTYPE_SH7705 is not set
118# CONFIG_CPU_SUBTYPE_SH7706 is not set 110# CONFIG_CPU_SUBTYPE_SH7706 is not set
119# CONFIG_CPU_SUBTYPE_SH7707 is not set 111# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -121,6 +113,7 @@ CONFIG_CPU_SH4A=y
121# CONFIG_CPU_SUBTYPE_SH7709 is not set 113# CONFIG_CPU_SUBTYPE_SH7709 is not set
122# CONFIG_CPU_SUBTYPE_SH7710 is not set 114# CONFIG_CPU_SUBTYPE_SH7710 is not set
123# CONFIG_CPU_SUBTYPE_SH7712 is not set 115# CONFIG_CPU_SUBTYPE_SH7712 is not set
116# CONFIG_CPU_SUBTYPE_SH7720 is not set
124# CONFIG_CPU_SUBTYPE_SH7750 is not set 117# CONFIG_CPU_SUBTYPE_SH7750 is not set
125# CONFIG_CPU_SUBTYPE_SH7091 is not set 118# CONFIG_CPU_SUBTYPE_SH7091 is not set
126# CONFIG_CPU_SUBTYPE_SH7750R is not set 119# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -129,12 +122,10 @@ CONFIG_CPU_SH4A=y
129# CONFIG_CPU_SUBTYPE_SH7751R is not set 122# CONFIG_CPU_SUBTYPE_SH7751R is not set
130# CONFIG_CPU_SUBTYPE_SH7760 is not set 123# CONFIG_CPU_SUBTYPE_SH7760 is not set
131# CONFIG_CPU_SUBTYPE_SH4_202 is not set 124# CONFIG_CPU_SUBTYPE_SH4_202 is not set
132# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
133# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
134# CONFIG_CPU_SUBTYPE_SH7770 is not set 125# CONFIG_CPU_SUBTYPE_SH7770 is not set
135CONFIG_CPU_SUBTYPE_SH7780=y 126CONFIG_CPU_SUBTYPE_SH7780=y
136# CONFIG_CPU_SUBTYPE_SH7785 is not set 127# CONFIG_CPU_SUBTYPE_SH7785 is not set
137# CONFIG_CPU_SUBTYPE_SH73180 is not set 128# CONFIG_CPU_SUBTYPE_SHX3 is not set
138# CONFIG_CPU_SUBTYPE_SH7343 is not set 129# CONFIG_CPU_SUBTYPE_SH7343 is not set
139# CONFIG_CPU_SUBTYPE_SH7722 is not set 130# CONFIG_CPU_SUBTYPE_SH7722 is not set
140 131
@@ -169,6 +160,7 @@ CONFIG_FLATMEM_MANUAL=y
169CONFIG_FLATMEM=y 160CONFIG_FLATMEM=y
170CONFIG_FLAT_NODE_MEM_MAP=y 161CONFIG_FLAT_NODE_MEM_MAP=y
171CONFIG_SPARSEMEM_STATIC=y 162CONFIG_SPARSEMEM_STATIC=y
163# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
172CONFIG_SPLIT_PTLOCK_CPUS=4 164CONFIG_SPLIT_PTLOCK_CPUS=4
173# CONFIG_RESOURCES_64BIT is not set 165# CONFIG_RESOURCES_64BIT is not set
174CONFIG_ZONE_DMA_FLAG=0 166CONFIG_ZONE_DMA_FLAG=0
@@ -178,8 +170,9 @@ CONFIG_NR_QUICK=2
178# Cache configuration 170# Cache configuration
179# 171#
180# CONFIG_SH_DIRECT_MAPPED is not set 172# CONFIG_SH_DIRECT_MAPPED is not set
181# CONFIG_SH_WRITETHROUGH is not set 173CONFIG_CACHE_WRITEBACK=y
182# CONFIG_SH_OCRAM is not set 174# CONFIG_CACHE_WRITETHROUGH is not set
175# CONFIG_CACHE_OFF is not set
183 176
184# 177#
185# Processor features 178# Processor features
@@ -187,12 +180,11 @@ CONFIG_NR_QUICK=2
187CONFIG_CPU_LITTLE_ENDIAN=y 180CONFIG_CPU_LITTLE_ENDIAN=y
188# CONFIG_CPU_BIG_ENDIAN is not set 181# CONFIG_CPU_BIG_ENDIAN is not set
189CONFIG_SH_FPU=y 182CONFIG_SH_FPU=y
190# CONFIG_SH_DSP is not set
191CONFIG_SH_STORE_QUEUES=y 183CONFIG_SH_STORE_QUEUES=y
192CONFIG_SPECULATIVE_EXECUTION=y 184CONFIG_SPECULATIVE_EXECUTION=y
193CONFIG_CPU_HAS_INTEVT=y 185CONFIG_CPU_HAS_INTEVT=y
194CONFIG_CPU_HAS_INTC_IRQ=y
195CONFIG_CPU_HAS_SR_RB=y 186CONFIG_CPU_HAS_SR_RB=y
187CONFIG_CPU_HAS_FPU=y
196 188
197# 189#
198# Board support 190# Board support
@@ -212,6 +204,7 @@ CONFIG_SH_PCLK_FREQ=32000000
212# CONFIG_TICK_ONESHOT is not set 204# CONFIG_TICK_ONESHOT is not set
213# CONFIG_NO_HZ is not set 205# CONFIG_NO_HZ is not set
214# CONFIG_HIGH_RES_TIMERS is not set 206# CONFIG_HIGH_RES_TIMERS is not set
207CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
215 208
216# 209#
217# CPU Frequency scaling 210# CPU Frequency scaling
@@ -226,7 +219,6 @@ CONFIG_SH_PCLK_FREQ=32000000
226# 219#
227# Companion Chips 220# Companion Chips
228# 221#
229# CONFIG_HD6446X_SERIES is not set
230 222
231# 223#
232# Additional SuperH Device Drivers 224# Additional SuperH Device Drivers
@@ -244,18 +236,17 @@ CONFIG_HZ_250=y
244CONFIG_HZ=250 236CONFIG_HZ=250
245CONFIG_KEXEC=y 237CONFIG_KEXEC=y
246# CONFIG_CRASH_DUMP is not set 238# CONFIG_CRASH_DUMP is not set
247# CONFIG_SMP is not set
248# CONFIG_PREEMPT_NONE is not set 239# CONFIG_PREEMPT_NONE is not set
249# CONFIG_PREEMPT_VOLUNTARY is not set 240# CONFIG_PREEMPT_VOLUNTARY is not set
250CONFIG_PREEMPT=y 241CONFIG_PREEMPT=y
251CONFIG_PREEMPT_BKL=y 242CONFIG_PREEMPT_BKL=y
243CONFIG_GUSA=y
252 244
253# 245#
254# Boot options 246# Boot options
255# 247#
256CONFIG_ZERO_PAGE_OFFSET=0x00001000 248CONFIG_ZERO_PAGE_OFFSET=0x00001000
257CONFIG_BOOT_LINK_OFFSET=0x00800000 249CONFIG_BOOT_LINK_OFFSET=0x00800000
258# CONFIG_UBC_WAKEUP is not set
259CONFIG_CMDLINE_BOOL=y 250CONFIG_CMDLINE_BOOL=y
260CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1" 251CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
261 252
@@ -267,11 +258,8 @@ CONFIG_SH_PCIDMA_NONCOHERENT=y
267CONFIG_PCI_AUTO=y 258CONFIG_PCI_AUTO=y
268CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 259CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
269# CONFIG_ARCH_SUPPORTS_MSI is not set 260# CONFIG_ARCH_SUPPORTS_MSI is not set
261CONFIG_PCI_LEGACY=y
270# CONFIG_PCI_DEBUG is not set 262# CONFIG_PCI_DEBUG is not set
271
272#
273# PCCARD (PCMCIA/CardBus) support
274#
275# CONFIG_PCCARD is not set 263# CONFIG_PCCARD is not set
276# CONFIG_HOTPLUG_PCI is not set 264# CONFIG_HOTPLUG_PCI is not set
277 265
@@ -282,11 +270,6 @@ CONFIG_BINFMT_ELF=y
282# CONFIG_BINFMT_MISC is not set 270# CONFIG_BINFMT_MISC is not set
283 271
284# 272#
285# Power management options (EXPERIMENTAL)
286#
287# CONFIG_PM is not set
288
289#
290# Networking 273# Networking
291# 274#
292CONFIG_NET=y 275CONFIG_NET=y
@@ -327,6 +310,7 @@ CONFIG_IP_PNP_DHCP=y
327CONFIG_INET_XFRM_MODE_TRANSPORT=y 310CONFIG_INET_XFRM_MODE_TRANSPORT=y
328CONFIG_INET_XFRM_MODE_TUNNEL=y 311CONFIG_INET_XFRM_MODE_TUNNEL=y
329CONFIG_INET_XFRM_MODE_BEET=y 312CONFIG_INET_XFRM_MODE_BEET=y
313# CONFIG_INET_LRO is not set
330CONFIG_INET_DIAG=y 314CONFIG_INET_DIAG=y
331CONFIG_INET_TCP_DIAG=y 315CONFIG_INET_TCP_DIAG=y
332# CONFIG_TCP_CONG_ADVANCED is not set 316# CONFIG_TCP_CONG_ADVANCED is not set
@@ -353,10 +337,6 @@ CONFIG_LLC=m
353# CONFIG_LAPB is not set 337# CONFIG_LAPB is not set
354# CONFIG_ECONET is not set 338# CONFIG_ECONET is not set
355# CONFIG_WAN_ROUTER is not set 339# CONFIG_WAN_ROUTER is not set
356
357#
358# QoS and/or fair queueing
359#
360# CONFIG_NET_SCHED is not set 340# CONFIG_NET_SCHED is not set
361 341
362# 342#
@@ -376,6 +356,7 @@ CONFIG_WIRELESS_EXT=y
376# CONFIG_MAC80211 is not set 356# CONFIG_MAC80211 is not set
377# CONFIG_IEEE80211 is not set 357# CONFIG_IEEE80211 is not set
378# CONFIG_RFKILL is not set 358# CONFIG_RFKILL is not set
359# CONFIG_NET_9P is not set
379 360
380# 361#
381# Device Drivers 362# Device Drivers
@@ -384,33 +365,17 @@ CONFIG_WIRELESS_EXT=y
384# 365#
385# Generic Driver Options 366# Generic Driver Options
386# 367#
368CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
387CONFIG_STANDALONE=y 369CONFIG_STANDALONE=y
388CONFIG_PREVENT_FIRMWARE_BUILD=y 370CONFIG_PREVENT_FIRMWARE_BUILD=y
389CONFIG_FW_LOADER=m 371CONFIG_FW_LOADER=m
390# CONFIG_DEBUG_DRIVER is not set 372# CONFIG_DEBUG_DRIVER is not set
391# CONFIG_DEBUG_DEVRES is not set 373# CONFIG_DEBUG_DEVRES is not set
392# CONFIG_SYS_HYPERVISOR is not set 374# CONFIG_SYS_HYPERVISOR is not set
393
394#
395# Connector - unified userspace <-> kernelspace linker
396#
397# CONFIG_CONNECTOR is not set 375# CONFIG_CONNECTOR is not set
398# CONFIG_MTD is not set 376# CONFIG_MTD is not set
399
400#
401# Parallel port support
402#
403# CONFIG_PARPORT is not set 377# CONFIG_PARPORT is not set
404 378CONFIG_BLK_DEV=y
405#
406# Plug and Play support
407#
408# CONFIG_PNPACPI is not set
409
410#
411# Block devices
412#
413# CONFIG_BLK_CPQ_DA is not set
414# CONFIG_BLK_CPQ_CISS_DA is not set 379# CONFIG_BLK_CPQ_CISS_DA is not set
415# CONFIG_BLK_DEV_DAC960 is not set 380# CONFIG_BLK_DEV_DAC960 is not set
416# CONFIG_BLK_DEV_UMEM is not set 381# CONFIG_BLK_DEV_UMEM is not set
@@ -424,14 +389,11 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
424CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 389CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
425# CONFIG_CDROM_PKTCDVD is not set 390# CONFIG_CDROM_PKTCDVD is not set
426# CONFIG_ATA_OVER_ETH is not set 391# CONFIG_ATA_OVER_ETH is not set
427 392CONFIG_MISC_DEVICES=y
428#
429# Misc devices
430#
431# CONFIG_PHANTOM is not set 393# CONFIG_PHANTOM is not set
394CONFIG_EEPROM_93CX6=y
432# CONFIG_SGI_IOC4 is not set 395# CONFIG_SGI_IOC4 is not set
433# CONFIG_TIFM_CORE is not set 396# CONFIG_TIFM_CORE is not set
434# CONFIG_BLINK is not set
435# CONFIG_IDE is not set 397# CONFIG_IDE is not set
436 398
437# 399#
@@ -439,6 +401,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
439# 401#
440# CONFIG_RAID_ATTRS is not set 402# CONFIG_RAID_ATTRS is not set
441CONFIG_SCSI=y 403CONFIG_SCSI=y
404CONFIG_SCSI_DMA=y
442# CONFIG_SCSI_TGT is not set 405# CONFIG_SCSI_TGT is not set
443# CONFIG_SCSI_NETLINK is not set 406# CONFIG_SCSI_NETLINK is not set
444CONFIG_SCSI_PROC_FS=y 407CONFIG_SCSI_PROC_FS=y
@@ -468,12 +431,9 @@ CONFIG_SCSI_WAIT_SCAN=m
468# CONFIG_SCSI_SPI_ATTRS is not set 431# CONFIG_SCSI_SPI_ATTRS is not set
469# CONFIG_SCSI_FC_ATTRS is not set 432# CONFIG_SCSI_FC_ATTRS is not set
470# CONFIG_SCSI_ISCSI_ATTRS is not set 433# CONFIG_SCSI_ISCSI_ATTRS is not set
471# CONFIG_SCSI_SAS_ATTRS is not set
472# CONFIG_SCSI_SAS_LIBSAS is not set 434# CONFIG_SCSI_SAS_LIBSAS is not set
473 435# CONFIG_SCSI_SRP_ATTRS is not set
474# 436CONFIG_SCSI_LOWLEVEL=y
475# SCSI low-level drivers
476#
477# CONFIG_ISCSI_TCP is not set 437# CONFIG_ISCSI_TCP is not set
478# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 438# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
479# CONFIG_SCSI_3W_9XXX is not set 439# CONFIG_SCSI_3W_9XXX is not set
@@ -483,7 +443,6 @@ CONFIG_SCSI_WAIT_SCAN=m
483# CONFIG_SCSI_AIC7XXX_OLD is not set 443# CONFIG_SCSI_AIC7XXX_OLD is not set
484# CONFIG_SCSI_AIC79XX is not set 444# CONFIG_SCSI_AIC79XX is not set
485# CONFIG_SCSI_AIC94XX is not set 445# CONFIG_SCSI_AIC94XX is not set
486# CONFIG_SCSI_DPT_I2O is not set
487# CONFIG_SCSI_ARCMSR is not set 446# CONFIG_SCSI_ARCMSR is not set
488# CONFIG_MEGARAID_NEWGEN is not set 447# CONFIG_MEGARAID_NEWGEN is not set
489# CONFIG_MEGARAID_LEGACY is not set 448# CONFIG_MEGARAID_LEGACY is not set
@@ -548,6 +507,7 @@ CONFIG_SATA_SIL=y
548# CONFIG_PATA_OLDPIIX is not set 507# CONFIG_PATA_OLDPIIX is not set
549# CONFIG_PATA_NETCELL is not set 508# CONFIG_PATA_NETCELL is not set
550# CONFIG_PATA_NS87410 is not set 509# CONFIG_PATA_NS87410 is not set
510# CONFIG_PATA_NS87415 is not set
551# CONFIG_PATA_OPTI is not set 511# CONFIG_PATA_OPTI is not set
552# CONFIG_PATA_OPTIDMA is not set 512# CONFIG_PATA_OPTIDMA is not set
553# CONFIG_PATA_PDC_OLD is not set 513# CONFIG_PATA_PDC_OLD is not set
@@ -561,59 +521,43 @@ CONFIG_SATA_SIL=y
561# CONFIG_PATA_VIA is not set 521# CONFIG_PATA_VIA is not set
562# CONFIG_PATA_WINBOND is not set 522# CONFIG_PATA_WINBOND is not set
563CONFIG_PATA_PLATFORM=y 523CONFIG_PATA_PLATFORM=y
564
565#
566# Multi-device support (RAID and LVM)
567#
568# CONFIG_MD is not set 524# CONFIG_MD is not set
569
570#
571# Fusion MPT device support
572#
573# CONFIG_FUSION is not set 525# CONFIG_FUSION is not set
574# CONFIG_FUSION_SPI is not set
575# CONFIG_FUSION_FC is not set
576# CONFIG_FUSION_SAS is not set
577 526
578# 527#
579# IEEE 1394 (FireWire) support 528# IEEE 1394 (FireWire) support
580# 529#
581# CONFIG_FIREWIRE is not set 530# CONFIG_FIREWIRE is not set
582# CONFIG_IEEE1394 is not set 531# CONFIG_IEEE1394 is not set
583
584#
585# I2O device support
586#
587# CONFIG_I2O is not set 532# CONFIG_I2O is not set
588
589#
590# Network device support
591#
592CONFIG_NETDEVICES=y 533CONFIG_NETDEVICES=y
534# CONFIG_NETDEVICES_MULTIQUEUE is not set
593# CONFIG_DUMMY is not set 535# CONFIG_DUMMY is not set
594# CONFIG_BONDING is not set 536# CONFIG_BONDING is not set
537# CONFIG_MACVLAN is not set
595# CONFIG_EQUALIZER is not set 538# CONFIG_EQUALIZER is not set
596# CONFIG_TUN is not set 539# CONFIG_TUN is not set
540# CONFIG_VETH is not set
541# CONFIG_IP1000 is not set
597# CONFIG_ARCNET is not set 542# CONFIG_ARCNET is not set
598# CONFIG_PHYLIB is not set 543# CONFIG_PHYLIB is not set
599
600#
601# Ethernet (10 or 100Mbit)
602#
603CONFIG_NET_ETHERNET=y 544CONFIG_NET_ETHERNET=y
604CONFIG_MII=y 545CONFIG_MII=y
546CONFIG_AX88796=y
547CONFIG_AX88796_93CX6=y
605# CONFIG_STNIC is not set 548# CONFIG_STNIC is not set
606# CONFIG_HAPPYMEAL is not set 549# CONFIG_HAPPYMEAL is not set
607# CONFIG_SUNGEM is not set 550# CONFIG_SUNGEM is not set
608# CONFIG_CASSINI is not set 551# CONFIG_CASSINI is not set
609# CONFIG_NET_VENDOR_3COM is not set 552# CONFIG_NET_VENDOR_3COM is not set
610# CONFIG_SMC91X is not set 553# CONFIG_SMC91X is not set
611 554# CONFIG_SMC911X is not set
612#
613# Tulip family network device support
614#
615# CONFIG_NET_TULIP is not set 555# CONFIG_NET_TULIP is not set
616# CONFIG_HP100 is not set 556# CONFIG_HP100 is not set
557# CONFIG_IBM_NEW_EMAC_ZMII is not set
558# CONFIG_IBM_NEW_EMAC_RGMII is not set
559# CONFIG_IBM_NEW_EMAC_TAH is not set
560# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
617CONFIG_NET_PCI=y 561CONFIG_NET_PCI=y
618CONFIG_PCNET32=m 562CONFIG_PCNET32=m
619# CONFIG_PCNET32_NAPI is not set 563# CONFIG_PCNET32_NAPI is not set
@@ -621,7 +565,6 @@ CONFIG_PCNET32=m
621# CONFIG_ADAPTEC_STARFIRE is not set 565# CONFIG_ADAPTEC_STARFIRE is not set
622# CONFIG_B44 is not set 566# CONFIG_B44 is not set
623# CONFIG_FORCEDETH is not set 567# CONFIG_FORCEDETH is not set
624# CONFIG_DGRS is not set
625# CONFIG_EEPRO100 is not set 568# CONFIG_EEPRO100 is not set
626# CONFIG_E100 is not set 569# CONFIG_E100 is not set
627# CONFIG_FEALNX is not set 570# CONFIG_FEALNX is not set
@@ -647,6 +590,7 @@ CONFIG_NETDEV_1000=y
647CONFIG_E1000=m 590CONFIG_E1000=m
648# CONFIG_E1000_NAPI is not set 591# CONFIG_E1000_NAPI is not set
649# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 592# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
593# CONFIG_E1000E is not set
650# CONFIG_NS83820 is not set 594# CONFIG_NS83820 is not set
651# CONFIG_HAMACHI is not set 595# CONFIG_HAMACHI is not set
652# CONFIG_YELLOWFIN is not set 596# CONFIG_YELLOWFIN is not set
@@ -664,11 +608,14 @@ CONFIG_R8169=y
664CONFIG_NETDEV_10000=y 608CONFIG_NETDEV_10000=y
665# CONFIG_CHELSIO_T1 is not set 609# CONFIG_CHELSIO_T1 is not set
666# CONFIG_CHELSIO_T3 is not set 610# CONFIG_CHELSIO_T3 is not set
611# CONFIG_IXGBE is not set
667# CONFIG_IXGB is not set 612# CONFIG_IXGB is not set
668# CONFIG_S2IO is not set 613# CONFIG_S2IO is not set
669# CONFIG_MYRI10GE is not set 614# CONFIG_MYRI10GE is not set
670# CONFIG_NETXEN_NIC is not set 615# CONFIG_NETXEN_NIC is not set
616# CONFIG_NIU is not set
671# CONFIG_MLX4_CORE is not set 617# CONFIG_MLX4_CORE is not set
618# CONFIG_TEHUTI is not set
672# CONFIG_TR is not set 619# CONFIG_TR is not set
673 620
674# 621#
@@ -686,15 +633,7 @@ CONFIG_NETDEV_10000=y
686# CONFIG_NETCONSOLE is not set 633# CONFIG_NETCONSOLE is not set
687# CONFIG_NETPOLL is not set 634# CONFIG_NETPOLL is not set
688# CONFIG_NET_POLL_CONTROLLER is not set 635# CONFIG_NET_POLL_CONTROLLER is not set
689
690#
691# ISDN subsystem
692#
693# CONFIG_ISDN is not set 636# CONFIG_ISDN is not set
694
695#
696# Telephony Support
697#
698# CONFIG_PHONE is not set 637# CONFIG_PHONE is not set
699 638
700# 639#
@@ -702,6 +641,7 @@ CONFIG_NETDEV_10000=y
702# 641#
703CONFIG_INPUT=y 642CONFIG_INPUT=y
704# CONFIG_INPUT_FF_MEMLESS is not set 643# CONFIG_INPUT_FF_MEMLESS is not set
644# CONFIG_INPUT_POLLDEV is not set
705 645
706# 646#
707# Userland interfaces 647# Userland interfaces
@@ -711,7 +651,6 @@ CONFIG_INPUT_MOUSEDEV=y
711CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 651CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
712CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 652CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
713# CONFIG_INPUT_JOYDEV is not set 653# CONFIG_INPUT_JOYDEV is not set
714# CONFIG_INPUT_TSDEV is not set
715# CONFIG_INPUT_EVDEV is not set 654# CONFIG_INPUT_EVDEV is not set
716# CONFIG_INPUT_EVBUG is not set 655# CONFIG_INPUT_EVBUG is not set
717 656
@@ -765,21 +704,11 @@ CONFIG_SERIAL_CORE_CONSOLE=y
765CONFIG_UNIX98_PTYS=y 704CONFIG_UNIX98_PTYS=y
766CONFIG_LEGACY_PTYS=y 705CONFIG_LEGACY_PTYS=y
767CONFIG_LEGACY_PTY_COUNT=256 706CONFIG_LEGACY_PTY_COUNT=256
768
769#
770# IPMI
771#
772# CONFIG_IPMI_HANDLER is not set 707# CONFIG_IPMI_HANDLER is not set
773# CONFIG_WATCHDOG is not set
774CONFIG_HW_RANDOM=y 708CONFIG_HW_RANDOM=y
775# CONFIG_R3964 is not set 709# CONFIG_R3964 is not set
776# CONFIG_APPLICOM is not set 710# CONFIG_APPLICOM is not set
777# CONFIG_DRM is not set
778# CONFIG_RAW_DRIVER is not set 711# CONFIG_RAW_DRIVER is not set
779
780#
781# TPM devices
782#
783# CONFIG_TCG_TPM is not set 712# CONFIG_TCG_TPM is not set
784CONFIG_DEVPORT=y 713CONFIG_DEVPORT=y
785# CONFIG_I2C is not set 714# CONFIG_I2C is not set
@@ -789,21 +718,31 @@ CONFIG_DEVPORT=y
789# 718#
790# CONFIG_SPI is not set 719# CONFIG_SPI is not set
791# CONFIG_SPI_MASTER is not set 720# CONFIG_SPI_MASTER is not set
792
793#
794# Dallas's 1-wire bus
795#
796# CONFIG_W1 is not set 721# CONFIG_W1 is not set
722# CONFIG_POWER_SUPPLY is not set
797CONFIG_HWMON=y 723CONFIG_HWMON=y
798# CONFIG_HWMON_VID is not set 724# CONFIG_HWMON_VID is not set
799# CONFIG_SENSORS_ABITUGURU is not set
800# CONFIG_SENSORS_F71805F is not set 725# CONFIG_SENSORS_F71805F is not set
726# CONFIG_SENSORS_F71882FG is not set
727# CONFIG_SENSORS_IT87 is not set
728# CONFIG_SENSORS_PC87360 is not set
801# CONFIG_SENSORS_PC87427 is not set 729# CONFIG_SENSORS_PC87427 is not set
730# CONFIG_SENSORS_SIS5595 is not set
802# CONFIG_SENSORS_SMSC47M1 is not set 731# CONFIG_SENSORS_SMSC47M1 is not set
803# CONFIG_SENSORS_SMSC47B397 is not set 732# CONFIG_SENSORS_SMSC47B397 is not set
733# CONFIG_SENSORS_VIA686A is not set
804# CONFIG_SENSORS_VT1211 is not set 734# CONFIG_SENSORS_VT1211 is not set
735# CONFIG_SENSORS_VT8231 is not set
805# CONFIG_SENSORS_W83627HF is not set 736# CONFIG_SENSORS_W83627HF is not set
737# CONFIG_SENSORS_W83627EHF is not set
806# CONFIG_HWMON_DEBUG_CHIP is not set 738# CONFIG_HWMON_DEBUG_CHIP is not set
739# CONFIG_WATCHDOG is not set
740
741#
742# Sonics Silicon Backplane
743#
744CONFIG_SSB_POSSIBLE=y
745# CONFIG_SSB is not set
807 746
808# 747#
809# Multifunction device drivers 748# Multifunction device drivers
@@ -820,14 +759,16 @@ CONFIG_DAB=y
820# 759#
821# Graphics support 760# Graphics support
822# 761#
762# CONFIG_DRM is not set
763# CONFIG_VGASTATE is not set
764# CONFIG_VIDEO_OUTPUT_CONTROL is not set
765# CONFIG_FB is not set
823# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 766# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
824 767
825# 768#
826# Display device support 769# Display device support
827# 770#
828# CONFIG_DISPLAY_SUPPORT is not set 771# CONFIG_DISPLAY_SUPPORT is not set
829# CONFIG_VGASTATE is not set
830# CONFIG_FB is not set
831 772
832# 773#
833# Sound 774# Sound
@@ -843,20 +784,14 @@ CONFIG_SOUND=m
843# Open Sound System 784# Open Sound System
844# 785#
845CONFIG_SOUND_PRIME=m 786CONFIG_SOUND_PRIME=m
846# CONFIG_OSS_OBSOLETE is not set
847# CONFIG_SOUND_TRIDENT is not set 787# CONFIG_SOUND_TRIDENT is not set
848# CONFIG_SOUND_MSNDCLAS is not set 788# CONFIG_SOUND_MSNDCLAS is not set
849# CONFIG_SOUND_MSNDPIN is not set 789# CONFIG_SOUND_MSNDPIN is not set
850 790CONFIG_HID_SUPPORT=y
851#
852# HID Devices
853#
854CONFIG_HID=y 791CONFIG_HID=y
855# CONFIG_HID_DEBUG is not set 792# CONFIG_HID_DEBUG is not set
856 793# CONFIG_HIDRAW is not set
857# 794CONFIG_USB_SUPPORT=y
858# USB support
859#
860CONFIG_USB_ARCH_HAS_HCD=y 795CONFIG_USB_ARCH_HAS_HCD=y
861CONFIG_USB_ARCH_HAS_OHCI=y 796CONFIG_USB_ARCH_HAS_OHCI=y
862CONFIG_USB_ARCH_HAS_EHCI=y 797CONFIG_USB_ARCH_HAS_EHCI=y
@@ -871,32 +806,8 @@ CONFIG_USB_ARCH_HAS_EHCI=y
871# 806#
872# CONFIG_USB_GADGET is not set 807# CONFIG_USB_GADGET is not set
873# CONFIG_MMC is not set 808# CONFIG_MMC is not set
874
875#
876# LED devices
877#
878# CONFIG_NEW_LEDS is not set 809# CONFIG_NEW_LEDS is not set
879
880#
881# LED drivers
882#
883
884#
885# LED Triggers
886#
887
888#
889# InfiniBand support
890#
891# CONFIG_INFINIBAND is not set 810# CONFIG_INFINIBAND is not set
892
893#
894# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
895#
896
897#
898# Real Time Clock
899#
900CONFIG_RTC_LIB=y 811CONFIG_RTC_LIB=y
901CONFIG_RTC_CLASS=y 812CONFIG_RTC_CLASS=y
902CONFIG_RTC_HCTOSYS=y 813CONFIG_RTC_HCTOSYS=y
@@ -913,10 +824,6 @@ CONFIG_RTC_INTF_DEV=y
913# CONFIG_RTC_DRV_TEST is not set 824# CONFIG_RTC_DRV_TEST is not set
914 825
915# 826#
916# I2C RTC drivers
917#
918
919#
920# SPI RTC drivers 827# SPI RTC drivers
921# 828#
922 829
@@ -924,8 +831,10 @@ CONFIG_RTC_INTF_DEV=y
924# Platform RTC drivers 831# Platform RTC drivers
925# 832#
926# CONFIG_RTC_DRV_DS1553 is not set 833# CONFIG_RTC_DRV_DS1553 is not set
834# CONFIG_RTC_DRV_STK17TA8 is not set
927# CONFIG_RTC_DRV_DS1742 is not set 835# CONFIG_RTC_DRV_DS1742 is not set
928# CONFIG_RTC_DRV_M48T86 is not set 836# CONFIG_RTC_DRV_M48T86 is not set
837# CONFIG_RTC_DRV_M48T59 is not set
929# CONFIG_RTC_DRV_V3020 is not set 838# CONFIG_RTC_DRV_V3020 is not set
930 839
931# 840#
@@ -934,17 +843,9 @@ CONFIG_RTC_INTF_DEV=y
934CONFIG_RTC_DRV_SH=y 843CONFIG_RTC_DRV_SH=y
935 844
936# 845#
937# DMA Engine support 846# Userspace I/O
938#
939# CONFIG_DMA_ENGINE is not set
940
941#
942# DMA Clients
943#
944
945#
946# DMA Devices
947# 847#
848# CONFIG_UIO is not set
948 849
949# 850#
950# File systems 851# File systems
@@ -1005,7 +906,6 @@ CONFIG_TMPFS=y
1005# CONFIG_TMPFS_POSIX_ACL is not set 906# CONFIG_TMPFS_POSIX_ACL is not set
1006CONFIG_HUGETLBFS=y 907CONFIG_HUGETLBFS=y
1007CONFIG_HUGETLB_PAGE=y 908CONFIG_HUGETLB_PAGE=y
1008CONFIG_RAMFS=y
1009CONFIG_CONFIGFS_FS=m 909CONFIG_CONFIGFS_FS=m
1010 910
1011# 911#
@@ -1024,10 +924,7 @@ CONFIG_CONFIGFS_FS=m
1024# CONFIG_QNX4FS_FS is not set 924# CONFIG_QNX4FS_FS is not set
1025# CONFIG_SYSV_FS is not set 925# CONFIG_SYSV_FS is not set
1026# CONFIG_UFS_FS is not set 926# CONFIG_UFS_FS is not set
1027 927CONFIG_NETWORK_FILESYSTEMS=y
1028#
1029# Network File Systems
1030#
1031CONFIG_NFS_FS=y 928CONFIG_NFS_FS=y
1032CONFIG_NFS_V3=y 929CONFIG_NFS_V3=y
1033# CONFIG_NFS_V3_ACL is not set 930# CONFIG_NFS_V3_ACL is not set
@@ -1053,17 +950,12 @@ CONFIG_RPCSEC_GSS_KRB5=y
1053# CONFIG_NCP_FS is not set 950# CONFIG_NCP_FS is not set
1054# CONFIG_CODA_FS is not set 951# CONFIG_CODA_FS is not set
1055# CONFIG_AFS_FS is not set 952# CONFIG_AFS_FS is not set
1056# CONFIG_9P_FS is not set
1057 953
1058# 954#
1059# Partition Types 955# Partition Types
1060# 956#
1061# CONFIG_PARTITION_ADVANCED is not set 957# CONFIG_PARTITION_ADVANCED is not set
1062CONFIG_MSDOS_PARTITION=y 958CONFIG_MSDOS_PARTITION=y
1063
1064#
1065# Native Language Support
1066#
1067CONFIG_NLS=y 959CONFIG_NLS=y
1068CONFIG_NLS_DEFAULT="iso8859-1" 960CONFIG_NLS_DEFAULT="iso8859-1"
1069CONFIG_NLS_CODEPAGE_437=y 961CONFIG_NLS_CODEPAGE_437=y
@@ -1104,23 +996,18 @@ CONFIG_NLS_ISO8859_1=y
1104# CONFIG_NLS_KOI8_R is not set 996# CONFIG_NLS_KOI8_R is not set
1105# CONFIG_NLS_KOI8_U is not set 997# CONFIG_NLS_KOI8_U is not set
1106# CONFIG_NLS_UTF8 is not set 998# CONFIG_NLS_UTF8 is not set
1107
1108#
1109# Distributed Lock Manager
1110#
1111# CONFIG_DLM is not set 999# CONFIG_DLM is not set
1112 1000CONFIG_INSTRUMENTATION=y
1113#
1114# Profiling support
1115#
1116CONFIG_PROFILING=y 1001CONFIG_PROFILING=y
1117CONFIG_OPROFILE=m 1002CONFIG_OPROFILE=m
1003# CONFIG_MARKERS is not set
1118 1004
1119# 1005#
1120# Kernel hacking 1006# Kernel hacking
1121# 1007#
1122CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1008CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1123# CONFIG_PRINTK_TIME is not set 1009# CONFIG_PRINTK_TIME is not set
1010CONFIG_ENABLE_WARN_DEPRECATED=y
1124CONFIG_ENABLE_MUST_CHECK=y 1011CONFIG_ENABLE_MUST_CHECK=y
1125CONFIG_MAGIC_SYSRQ=y 1012CONFIG_MAGIC_SYSRQ=y
1126# CONFIG_UNUSED_SYMBOLS is not set 1013# CONFIG_UNUSED_SYMBOLS is not set
@@ -1129,6 +1016,7 @@ CONFIG_DEBUG_FS=y
1129CONFIG_DEBUG_KERNEL=y 1016CONFIG_DEBUG_KERNEL=y
1130# CONFIG_DEBUG_SHIRQ is not set 1017# CONFIG_DEBUG_SHIRQ is not set
1131CONFIG_DETECT_SOFTLOCKUP=y 1018CONFIG_DETECT_SOFTLOCKUP=y
1019CONFIG_SCHED_DEBUG=y
1132# CONFIG_SCHEDSTATS is not set 1020# CONFIG_SCHEDSTATS is not set
1133# CONFIG_TIMER_STATS is not set 1021# CONFIG_TIMER_STATS is not set
1134# CONFIG_DEBUG_SLAB is not set 1022# CONFIG_DEBUG_SLAB is not set
@@ -1137,6 +1025,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1137# CONFIG_DEBUG_MUTEXES is not set 1025# CONFIG_DEBUG_MUTEXES is not set
1138# CONFIG_DEBUG_LOCK_ALLOC is not set 1026# CONFIG_DEBUG_LOCK_ALLOC is not set
1139# CONFIG_PROVE_LOCKING is not set 1027# CONFIG_PROVE_LOCKING is not set
1028# CONFIG_LOCK_STAT is not set
1140# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1029# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1141# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1030# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1142# CONFIG_DEBUG_KOBJECT is not set 1031# CONFIG_DEBUG_KOBJECT is not set
@@ -1144,10 +1033,13 @@ CONFIG_DEBUG_BUGVERBOSE=y
1144CONFIG_DEBUG_INFO=y 1033CONFIG_DEBUG_INFO=y
1145# CONFIG_DEBUG_VM is not set 1034# CONFIG_DEBUG_VM is not set
1146# CONFIG_DEBUG_LIST is not set 1035# CONFIG_DEBUG_LIST is not set
1036# CONFIG_DEBUG_SG is not set
1147# CONFIG_FRAME_POINTER is not set 1037# CONFIG_FRAME_POINTER is not set
1148CONFIG_FORCED_INLINING=y 1038CONFIG_FORCED_INLINING=y
1039# CONFIG_BOOT_PRINTK_DELAY is not set
1149# CONFIG_RCU_TORTURE_TEST is not set 1040# CONFIG_RCU_TORTURE_TEST is not set
1150# CONFIG_FAULT_INJECTION is not set 1041# CONFIG_FAULT_INJECTION is not set
1042# CONFIG_SAMPLES is not set
1151CONFIG_SH_STANDARD_BIOS=y 1043CONFIG_SH_STANDARD_BIOS=y
1152# CONFIG_EARLY_SCIF_CONSOLE is not set 1044# CONFIG_EARLY_SCIF_CONSOLE is not set
1153CONFIG_EARLY_PRINTK=y 1045CONFIG_EARLY_PRINTK=y
@@ -1155,6 +1047,7 @@ CONFIG_EARLY_PRINTK=y
1155CONFIG_DEBUG_STACKOVERFLOW=y 1047CONFIG_DEBUG_STACKOVERFLOW=y
1156# CONFIG_DEBUG_STACK_USAGE is not set 1048# CONFIG_DEBUG_STACK_USAGE is not set
1157# CONFIG_4KSTACKS is not set 1049# CONFIG_4KSTACKS is not set
1050# CONFIG_IRQSTACKS is not set
1158# CONFIG_SH_KGDB is not set 1051# CONFIG_SH_KGDB is not set
1159 1052
1160# 1053#
@@ -1162,10 +1055,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y
1162# 1055#
1163# CONFIG_KEYS is not set 1056# CONFIG_KEYS is not set
1164# CONFIG_SECURITY is not set 1057# CONFIG_SECURITY is not set
1165 1058# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1166#
1167# Cryptographic options
1168#
1169CONFIG_CRYPTO=y 1059CONFIG_CRYPTO=y
1170CONFIG_CRYPTO_ALGAPI=y 1060CONFIG_CRYPTO_ALGAPI=y
1171CONFIG_CRYPTO_BLKCIPHER=y 1061CONFIG_CRYPTO_BLKCIPHER=y
@@ -1186,6 +1076,7 @@ CONFIG_CRYPTO_ECB=m
1186CONFIG_CRYPTO_CBC=y 1076CONFIG_CRYPTO_CBC=y
1187CONFIG_CRYPTO_PCBC=m 1077CONFIG_CRYPTO_PCBC=m
1188# CONFIG_CRYPTO_LRW is not set 1078# CONFIG_CRYPTO_LRW is not set
1079# CONFIG_CRYPTO_XTS is not set
1189# CONFIG_CRYPTO_CRYPTD is not set 1080# CONFIG_CRYPTO_CRYPTD is not set
1190CONFIG_CRYPTO_DES=y 1081CONFIG_CRYPTO_DES=y
1191# CONFIG_CRYPTO_FCRYPT is not set 1082# CONFIG_CRYPTO_FCRYPT is not set
@@ -1199,15 +1090,14 @@ CONFIG_CRYPTO_DES=y
1199# CONFIG_CRYPTO_ARC4 is not set 1090# CONFIG_CRYPTO_ARC4 is not set
1200# CONFIG_CRYPTO_KHAZAD is not set 1091# CONFIG_CRYPTO_KHAZAD is not set
1201# CONFIG_CRYPTO_ANUBIS is not set 1092# CONFIG_CRYPTO_ANUBIS is not set
1093# CONFIG_CRYPTO_SEED is not set
1202# CONFIG_CRYPTO_DEFLATE is not set 1094# CONFIG_CRYPTO_DEFLATE is not set
1203# CONFIG_CRYPTO_MICHAEL_MIC is not set 1095# CONFIG_CRYPTO_MICHAEL_MIC is not set
1204# CONFIG_CRYPTO_CRC32C is not set 1096# CONFIG_CRYPTO_CRC32C is not set
1205# CONFIG_CRYPTO_CAMELLIA is not set 1097# CONFIG_CRYPTO_CAMELLIA is not set
1206# CONFIG_CRYPTO_TEST is not set 1098# CONFIG_CRYPTO_TEST is not set
1207 1099# CONFIG_CRYPTO_AUTHENC is not set
1208# 1100CONFIG_CRYPTO_HW=y
1209# Hardware crypto devices
1210#
1211 1101
1212# 1102#
1213# Library routines 1103# Library routines
@@ -1217,6 +1107,7 @@ CONFIG_BITREVERSE=y
1217# CONFIG_CRC16 is not set 1107# CONFIG_CRC16 is not set
1218# CONFIG_CRC_ITU_T is not set 1108# CONFIG_CRC_ITU_T is not set
1219CONFIG_CRC32=y 1109CONFIG_CRC32=y
1110# CONFIG_CRC7 is not set
1220# CONFIG_LIBCRC32C is not set 1111# CONFIG_LIBCRC32C is not set
1221CONFIG_HAS_IOMEM=y 1112CONFIG_HAS_IOMEM=y
1222CONFIG_HAS_IOPORT=y 1113CONFIG_HAS_IOPORT=y
diff --git a/arch/sh/configs/r7785rp_defconfig b/arch/sh/configs/r7785rp_defconfig
index 5c29338532da..2e43a2a971a9 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-rc2
4# Thu Jul 12 12:33:15 2007 4# Tue Nov 13 20:34:57 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
@@ -131,13 +124,10 @@ CONFIG_CPU_SHX2=y
131# CONFIG_CPU_SUBTYPE_SH7751R is not set 124# CONFIG_CPU_SUBTYPE_SH7751R is not set
132# CONFIG_CPU_SUBTYPE_SH7760 is not set 125# CONFIG_CPU_SUBTYPE_SH7760 is not set
133# CONFIG_CPU_SUBTYPE_SH4_202 is not set 126# CONFIG_CPU_SUBTYPE_SH4_202 is not set
134# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
135# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
136# CONFIG_CPU_SUBTYPE_SH7770 is not set 127# CONFIG_CPU_SUBTYPE_SH7770 is not set
137# CONFIG_CPU_SUBTYPE_SH7780 is not set 128# CONFIG_CPU_SUBTYPE_SH7780 is not set
138CONFIG_CPU_SUBTYPE_SH7785=y 129CONFIG_CPU_SUBTYPE_SH7785=y
139# CONFIG_CPU_SUBTYPE_SHX3 is not set 130# CONFIG_CPU_SUBTYPE_SHX3 is not set
140# CONFIG_CPU_SUBTYPE_SH73180 is not set
141# CONFIG_CPU_SUBTYPE_SH7343 is not set 131# CONFIG_CPU_SUBTYPE_SH7343 is not set
142# CONFIG_CPU_SUBTYPE_SH7722 is not set 132# CONFIG_CPU_SUBTYPE_SH7722 is not set
143 133
@@ -149,15 +139,17 @@ CONFIG_MMU=y
149CONFIG_PAGE_OFFSET=0x80000000 139CONFIG_PAGE_OFFSET=0x80000000
150CONFIG_MEMORY_START=0x08000000 140CONFIG_MEMORY_START=0x08000000
151CONFIG_MEMORY_SIZE=0x08000000 141CONFIG_MEMORY_SIZE=0x08000000
152CONFIG_32BIT=y 142# CONFIG_32BIT is not set
153# CONFIG_X2TLB is not set 143# CONFIG_X2TLB is not set
154CONFIG_VSYSCALL=y 144CONFIG_VSYSCALL=y
145# CONFIG_NUMA is not set
155CONFIG_ARCH_FLATMEM_ENABLE=y 146CONFIG_ARCH_FLATMEM_ENABLE=y
156CONFIG_ARCH_SPARSEMEM_ENABLE=y 147CONFIG_ARCH_SPARSEMEM_ENABLE=y
157CONFIG_ARCH_SPARSEMEM_DEFAULT=y 148CONFIG_ARCH_SPARSEMEM_DEFAULT=y
158CONFIG_MAX_ACTIVE_REGIONS=1 149CONFIG_MAX_ACTIVE_REGIONS=2
159CONFIG_ARCH_POPULATES_NODE_MAP=y 150CONFIG_ARCH_POPULATES_NODE_MAP=y
160CONFIG_ARCH_SELECT_MEMORY_MODEL=y 151CONFIG_ARCH_SELECT_MEMORY_MODEL=y
152CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
161CONFIG_PAGE_SIZE_4KB=y 153CONFIG_PAGE_SIZE_4KB=y
162# CONFIG_PAGE_SIZE_8KB is not set 154# CONFIG_PAGE_SIZE_8KB is not set
163# CONFIG_PAGE_SIZE_64KB is not set 155# CONFIG_PAGE_SIZE_64KB is not set
@@ -167,12 +159,14 @@ CONFIG_HUGETLB_PAGE_SIZE_1MB=y
167# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set 159# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set
168# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set 160# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set
169CONFIG_SELECT_MEMORY_MODEL=y 161CONFIG_SELECT_MEMORY_MODEL=y
170CONFIG_FLATMEM_MANUAL=y 162# CONFIG_FLATMEM_MANUAL is not set
171# CONFIG_DISCONTIGMEM_MANUAL is not set 163# CONFIG_DISCONTIGMEM_MANUAL is not set
172# CONFIG_SPARSEMEM_MANUAL is not set 164CONFIG_SPARSEMEM_MANUAL=y
173CONFIG_FLATMEM=y 165CONFIG_SPARSEMEM=y
174CONFIG_FLAT_NODE_MEM_MAP=y 166CONFIG_HAVE_MEMORY_PRESENT=y
175CONFIG_SPARSEMEM_STATIC=y 167CONFIG_SPARSEMEM_STATIC=y
168# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
169# CONFIG_MEMORY_HOTPLUG is not set
176CONFIG_SPLIT_PTLOCK_CPUS=4 170CONFIG_SPLIT_PTLOCK_CPUS=4
177# CONFIG_RESOURCES_64BIT is not set 171# CONFIG_RESOURCES_64BIT is not set
178CONFIG_ZONE_DMA_FLAG=0 172CONFIG_ZONE_DMA_FLAG=0
@@ -182,7 +176,9 @@ CONFIG_NR_QUICK=2
182# Cache configuration 176# Cache configuration
183# 177#
184# CONFIG_SH_DIRECT_MAPPED is not set 178# CONFIG_SH_DIRECT_MAPPED is not set
185# CONFIG_SH_WRITETHROUGH is not set 179CONFIG_CACHE_WRITEBACK=y
180# CONFIG_CACHE_WRITETHROUGH is not set
181# CONFIG_CACHE_OFF is not set
186 182
187# 183#
188# Processor features 184# Processor features
@@ -190,12 +186,11 @@ CONFIG_NR_QUICK=2
190CONFIG_CPU_LITTLE_ENDIAN=y 186CONFIG_CPU_LITTLE_ENDIAN=y
191# CONFIG_CPU_BIG_ENDIAN is not set 187# CONFIG_CPU_BIG_ENDIAN is not set
192CONFIG_SH_FPU=y 188CONFIG_SH_FPU=y
193# CONFIG_SH_DSP is not set
194CONFIG_SH_STORE_QUEUES=y 189CONFIG_SH_STORE_QUEUES=y
195CONFIG_CPU_HAS_INTEVT=y 190CONFIG_CPU_HAS_INTEVT=y
196CONFIG_CPU_HAS_INTC2_IRQ=y
197CONFIG_CPU_HAS_SR_RB=y 191CONFIG_CPU_HAS_SR_RB=y
198CONFIG_CPU_HAS_PTEA=y 192CONFIG_CPU_HAS_PTEA=y
193CONFIG_CPU_HAS_FPU=y
199 194
200# 195#
201# Board support 196# Board support
@@ -214,6 +209,7 @@ CONFIG_SH_PCLK_FREQ=50000000
214# CONFIG_TICK_ONESHOT is not set 209# CONFIG_TICK_ONESHOT is not set
215# CONFIG_NO_HZ is not set 210# CONFIG_NO_HZ is not set
216# CONFIG_HIGH_RES_TIMERS is not set 211# CONFIG_HIGH_RES_TIMERS is not set
212CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
217 213
218# 214#
219# CPU Frequency scaling 215# CPU Frequency scaling
@@ -249,13 +245,13 @@ CONFIG_KEXEC=y
249# CONFIG_PREEMPT_VOLUNTARY is not set 245# CONFIG_PREEMPT_VOLUNTARY is not set
250CONFIG_PREEMPT=y 246CONFIG_PREEMPT=y
251CONFIG_PREEMPT_BKL=y 247CONFIG_PREEMPT_BKL=y
248CONFIG_GUSA=y
252 249
253# 250#
254# Boot options 251# Boot options
255# 252#
256CONFIG_ZERO_PAGE_OFFSET=0x00001000 253CONFIG_ZERO_PAGE_OFFSET=0x00001000
257CONFIG_BOOT_LINK_OFFSET=0x00800000 254CONFIG_BOOT_LINK_OFFSET=0x00800000
258# CONFIG_UBC_WAKEUP is not set
259CONFIG_CMDLINE_BOOL=y 255CONFIG_CMDLINE_BOOL=y
260CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1" 256CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
261 257
@@ -267,11 +263,8 @@ CONFIG_SH_PCIDMA_NONCOHERENT=y
267CONFIG_PCI_AUTO=y 263CONFIG_PCI_AUTO=y
268CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 264CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
269# CONFIG_ARCH_SUPPORTS_MSI is not set 265# CONFIG_ARCH_SUPPORTS_MSI is not set
266CONFIG_PCI_LEGACY=y
270# CONFIG_PCI_DEBUG is not set 267# CONFIG_PCI_DEBUG is not set
271
272#
273# PCCARD (PCMCIA/CardBus) support
274#
275# CONFIG_PCCARD is not set 268# CONFIG_PCCARD is not set
276# CONFIG_HOTPLUG_PCI is not set 269# CONFIG_HOTPLUG_PCI is not set
277 270
@@ -322,6 +315,7 @@ CONFIG_IP_PNP_DHCP=y
322CONFIG_INET_XFRM_MODE_TRANSPORT=y 315CONFIG_INET_XFRM_MODE_TRANSPORT=y
323CONFIG_INET_XFRM_MODE_TUNNEL=y 316CONFIG_INET_XFRM_MODE_TUNNEL=y
324CONFIG_INET_XFRM_MODE_BEET=y 317CONFIG_INET_XFRM_MODE_BEET=y
318# CONFIG_INET_LRO is not set
325CONFIG_INET_DIAG=y 319CONFIG_INET_DIAG=y
326CONFIG_INET_TCP_DIAG=y 320CONFIG_INET_TCP_DIAG=y
327# CONFIG_TCP_CONG_ADVANCED is not set 321# CONFIG_TCP_CONG_ADVANCED is not set
@@ -348,10 +342,6 @@ CONFIG_LLC=m
348# CONFIG_LAPB is not set 342# CONFIG_LAPB is not set
349# CONFIG_ECONET is not set 343# CONFIG_ECONET is not set
350# CONFIG_WAN_ROUTER is not set 344# CONFIG_WAN_ROUTER is not set
351
352#
353# QoS and/or fair queueing
354#
355# CONFIG_NET_SCHED is not set 345# CONFIG_NET_SCHED is not set
356 346
357# 347#
@@ -371,6 +361,7 @@ CONFIG_WIRELESS_EXT=y
371# CONFIG_MAC80211 is not set 361# CONFIG_MAC80211 is not set
372# CONFIG_IEEE80211 is not set 362# CONFIG_IEEE80211 is not set
373# CONFIG_RFKILL is not set 363# CONFIG_RFKILL is not set
364# CONFIG_NET_9P is not set
374 365
375# 366#
376# Device Drivers 367# Device Drivers
@@ -379,33 +370,17 @@ CONFIG_WIRELESS_EXT=y
379# 370#
380# Generic Driver Options 371# Generic Driver Options
381# 372#
373CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
382CONFIG_STANDALONE=y 374CONFIG_STANDALONE=y
383CONFIG_PREVENT_FIRMWARE_BUILD=y 375CONFIG_PREVENT_FIRMWARE_BUILD=y
384CONFIG_FW_LOADER=m 376CONFIG_FW_LOADER=m
385# CONFIG_DEBUG_DRIVER is not set 377# CONFIG_DEBUG_DRIVER is not set
386# CONFIG_DEBUG_DEVRES is not set 378# CONFIG_DEBUG_DEVRES is not set
387# CONFIG_SYS_HYPERVISOR is not set 379# CONFIG_SYS_HYPERVISOR is not set
388
389#
390# Connector - unified userspace <-> kernelspace linker
391#
392# CONFIG_CONNECTOR is not set 380# CONFIG_CONNECTOR is not set
393# CONFIG_MTD is not set 381# CONFIG_MTD is not set
394
395#
396# Parallel port support
397#
398# CONFIG_PARPORT is not set 382# CONFIG_PARPORT is not set
399 383CONFIG_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 384# CONFIG_BLK_CPQ_CISS_DA is not set
410# CONFIG_BLK_DEV_DAC960 is not set 385# CONFIG_BLK_DEV_DAC960 is not set
411# CONFIG_BLK_DEV_UMEM is not set 386# CONFIG_BLK_DEV_UMEM is not set
@@ -419,14 +394,11 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
419CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 394CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
420# CONFIG_CDROM_PKTCDVD is not set 395# CONFIG_CDROM_PKTCDVD is not set
421# CONFIG_ATA_OVER_ETH is not set 396# CONFIG_ATA_OVER_ETH is not set
422 397CONFIG_MISC_DEVICES=y
423#
424# Misc devices
425#
426# CONFIG_PHANTOM is not set 398# CONFIG_PHANTOM is not set
399CONFIG_EEPROM_93CX6=y
427# CONFIG_SGI_IOC4 is not set 400# CONFIG_SGI_IOC4 is not set
428# CONFIG_TIFM_CORE is not set 401# CONFIG_TIFM_CORE is not set
429# CONFIG_BLINK is not set
430# CONFIG_IDE is not set 402# CONFIG_IDE is not set
431 403
432# 404#
@@ -434,6 +406,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
434# 406#
435# CONFIG_RAID_ATTRS is not set 407# CONFIG_RAID_ATTRS is not set
436CONFIG_SCSI=y 408CONFIG_SCSI=y
409CONFIG_SCSI_DMA=y
437# CONFIG_SCSI_TGT is not set 410# CONFIG_SCSI_TGT is not set
438# CONFIG_SCSI_NETLINK is not set 411# CONFIG_SCSI_NETLINK is not set
439CONFIG_SCSI_PROC_FS=y 412CONFIG_SCSI_PROC_FS=y
@@ -463,12 +436,9 @@ CONFIG_SCSI_WAIT_SCAN=m
463# CONFIG_SCSI_SPI_ATTRS is not set 436# CONFIG_SCSI_SPI_ATTRS is not set
464# CONFIG_SCSI_FC_ATTRS is not set 437# CONFIG_SCSI_FC_ATTRS is not set
465# CONFIG_SCSI_ISCSI_ATTRS is not set 438# CONFIG_SCSI_ISCSI_ATTRS is not set
466# CONFIG_SCSI_SAS_ATTRS is not set
467# CONFIG_SCSI_SAS_LIBSAS is not set 439# CONFIG_SCSI_SAS_LIBSAS is not set
468 440# CONFIG_SCSI_SRP_ATTRS is not set
469# 441CONFIG_SCSI_LOWLEVEL=y
470# SCSI low-level drivers
471#
472# CONFIG_ISCSI_TCP is not set 442# CONFIG_ISCSI_TCP is not set
473# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 443# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
474# CONFIG_SCSI_3W_9XXX is not set 444# CONFIG_SCSI_3W_9XXX is not set
@@ -478,7 +448,6 @@ CONFIG_SCSI_WAIT_SCAN=m
478# CONFIG_SCSI_AIC7XXX_OLD is not set 448# CONFIG_SCSI_AIC7XXX_OLD is not set
479# CONFIG_SCSI_AIC79XX is not set 449# CONFIG_SCSI_AIC79XX is not set
480# CONFIG_SCSI_AIC94XX is not set 450# CONFIG_SCSI_AIC94XX is not set
481# CONFIG_SCSI_DPT_I2O is not set
482# CONFIG_SCSI_ARCMSR is not set 451# CONFIG_SCSI_ARCMSR is not set
483# CONFIG_MEGARAID_NEWGEN is not set 452# CONFIG_MEGARAID_NEWGEN is not set
484# CONFIG_MEGARAID_LEGACY is not set 453# CONFIG_MEGARAID_LEGACY is not set
@@ -543,6 +512,7 @@ CONFIG_SATA_SIL=y
543# CONFIG_PATA_OLDPIIX is not set 512# CONFIG_PATA_OLDPIIX is not set
544# CONFIG_PATA_NETCELL is not set 513# CONFIG_PATA_NETCELL is not set
545# CONFIG_PATA_NS87410 is not set 514# CONFIG_PATA_NS87410 is not set
515# CONFIG_PATA_NS87415 is not set
546# CONFIG_PATA_OPTI is not set 516# CONFIG_PATA_OPTI is not set
547# CONFIG_PATA_OPTIDMA is not set 517# CONFIG_PATA_OPTIDMA is not set
548# CONFIG_PATA_PDC_OLD is not set 518# CONFIG_PATA_PDC_OLD is not set
@@ -556,64 +526,50 @@ CONFIG_SATA_SIL=y
556# CONFIG_PATA_VIA is not set 526# CONFIG_PATA_VIA is not set
557# CONFIG_PATA_WINBOND is not set 527# CONFIG_PATA_WINBOND is not set
558CONFIG_PATA_PLATFORM=y 528CONFIG_PATA_PLATFORM=y
559
560#
561# Multi-device support (RAID and LVM)
562#
563# CONFIG_MD is not set 529# CONFIG_MD is not set
564
565#
566# Fusion MPT device support
567#
568# CONFIG_FUSION is not set 530# 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 531
573# 532#
574# IEEE 1394 (FireWire) support 533# IEEE 1394 (FireWire) support
575# 534#
576# CONFIG_FIREWIRE is not set 535# CONFIG_FIREWIRE is not set
577# CONFIG_IEEE1394 is not set 536# CONFIG_IEEE1394 is not set
578
579#
580# I2O device support
581#
582# CONFIG_I2O is not set 537# CONFIG_I2O is not set
583
584#
585# Network device support
586#
587CONFIG_NETDEVICES=y 538CONFIG_NETDEVICES=y
539# CONFIG_NETDEVICES_MULTIQUEUE is not set
588# CONFIG_DUMMY is not set 540# CONFIG_DUMMY is not set
589# CONFIG_BONDING is not set 541# CONFIG_BONDING is not set
542# CONFIG_MACVLAN is not set
590# CONFIG_EQUALIZER is not set 543# CONFIG_EQUALIZER is not set
591# CONFIG_TUN is not set 544# CONFIG_TUN is not set
545# CONFIG_VETH is not set
546# CONFIG_IP1000 is not set
592# CONFIG_ARCNET is not set 547# CONFIG_ARCNET is not set
593# CONFIG_PHYLIB is not set 548# CONFIG_PHYLIB is not set
594
595#
596# Ethernet (10 or 100Mbit)
597#
598CONFIG_NET_ETHERNET=y 549CONFIG_NET_ETHERNET=y
599CONFIG_MII=y 550CONFIG_MII=y
551CONFIG_AX88796=y
552CONFIG_AX88796_93CX6=y
600# CONFIG_STNIC is not set 553# CONFIG_STNIC is not set
601# CONFIG_HAPPYMEAL is not set 554# CONFIG_HAPPYMEAL is not set
602# CONFIG_SUNGEM is not set 555# CONFIG_SUNGEM is not set
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/Makefile b/arch/sh/drivers/pci/Makefile
index 2f65ac72f48a..fba6b5ba0b3a 100644
--- a/arch/sh/drivers/pci/Makefile
+++ b/arch/sh/drivers/pci/Makefile
@@ -5,7 +5,6 @@
5obj-y += pci.o 5obj-y += pci.o
6obj-$(CONFIG_PCI_AUTO) += pci-auto.o 6obj-$(CONFIG_PCI_AUTO) += pci-auto.o
7 7
8obj-$(CONFIG_CPU_SUBTYPE_ST40STB1) += pci-st40.o
9obj-$(CONFIG_CPU_SUBTYPE_SH7751) += pci-sh7751.o ops-sh4.o 8obj-$(CONFIG_CPU_SUBTYPE_SH7751) += pci-sh7751.o ops-sh4.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7751R) += pci-sh7751.o ops-sh4.o 9obj-$(CONFIG_CPU_SUBTYPE_SH7751R) += pci-sh7751.o ops-sh4.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7780) += pci-sh7780.o ops-sh4.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7780) += pci-sh7780.o ops-sh4.o
diff --git a/arch/sh/drivers/pci/pci-st40.c b/arch/sh/drivers/pci/pci-st40.c
deleted file mode 100644
index 1502a14386b6..000000000000
--- a/arch/sh/drivers/pci/pci-st40.c
+++ /dev/null
@@ -1,488 +0,0 @@
1/*
2 * Copyright (C) 2001 David J. Mckay (david.mckay@st.com)
3 *
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
6 *
7 * Support functions for the ST40 PCI hardware.
8 */
9
10#include <linux/kernel.h>
11#include <linux/smp.h>
12#include <linux/init.h>
13#include <linux/errno.h>
14#include <linux/pci.h>
15#include <linux/delay.h>
16#include <linux/types.h>
17#include <asm/pci.h>
18#include <linux/irq.h>
19#include <linux/interrupt.h> /* irqreturn_t */
20
21#include "pci-st40.h"
22
23/* This is in P2 of course */
24#define ST40PCI_BASE_ADDRESS (0xb0000000)
25#define ST40PCI_MEM_ADDRESS (ST40PCI_BASE_ADDRESS+0x0)
26#define ST40PCI_IO_ADDRESS (ST40PCI_BASE_ADDRESS+0x06000000)
27#define ST40PCI_REG_ADDRESS (ST40PCI_BASE_ADDRESS+0x07000000)
28
29#define ST40PCI_REG(x) (ST40PCI_REG_ADDRESS+(ST40PCI_##x))
30#define ST40PCI_REG_INDEXED(reg, index) \
31 (ST40PCI_REG(reg##0) + \
32 ((ST40PCI_REG(reg##1) - ST40PCI_REG(reg##0))*index))
33
34#define ST40PCI_WRITE(reg,val) writel((val),ST40PCI_REG(reg))
35#define ST40PCI_WRITE_SHORT(reg,val) writew((val),ST40PCI_REG(reg))
36#define ST40PCI_WRITE_BYTE(reg,val) writeb((val),ST40PCI_REG(reg))
37#define ST40PCI_WRITE_INDEXED(reg, index, val) \
38 writel((val), ST40PCI_REG_INDEXED(reg, index));
39
40#define ST40PCI_READ(reg) readl(ST40PCI_REG(reg))
41#define ST40PCI_READ_SHORT(reg) readw(ST40PCI_REG(reg))
42#define ST40PCI_READ_BYTE(reg) readb(ST40PCI_REG(reg))
43
44#define ST40PCI_SERR_IRQ 64
45#define ST40PCI_ERR_IRQ 65
46
47
48/* Macros to extract PLL params */
49#define PLL_MDIV(reg) ( ((unsigned)reg) & 0xff )
50#define PLL_NDIV(reg) ( (((unsigned)reg)>>8) & 0xff )
51#define PLL_PDIV(reg) ( (((unsigned)reg)>>16) & 0x3 )
52#define PLL_SETUP(reg) ( (((unsigned)reg)>>19) & 0x1ff )
53
54/* Build up the appropriate settings */
55#define PLL_SET(mdiv,ndiv,pdiv,setup) \
56( ((mdiv)&0xff) | (((ndiv)&0xff)<<8) | (((pdiv)&3)<<16)| (((setup)&0x1ff)<<19))
57
58#define PLLPCICR (0xbb040000+0x10)
59
60#define PLLPCICR_POWERON (1<<28)
61#define PLLPCICR_OUT_EN (1<<29)
62#define PLLPCICR_LOCKSELECT (1<<30)
63#define PLLPCICR_LOCK (1<<31)
64
65
66#define PLL_25MHZ 0x793c8512
67#define PLL_33MHZ PLL_SET(18,88,3,295)
68
69static void pci_set_rbar_region(unsigned int region, unsigned long localAddr,
70 unsigned long pciOffset, unsigned long regionSize);
71
72static __init void SetPCIPLL(void)
73{
74 {
75 /* Lets play with the PLL values */
76 unsigned long pll1cr1;
77 unsigned long mdiv, ndiv, pdiv;
78 unsigned long muxcr;
79 unsigned int muxcr_ratios[4] = { 8, 16, 21, 1 };
80 unsigned int freq;
81
82#define CLKGENA 0xbb040000
83#define CLKGENA_PLL2_MUXCR CLKGENA + 0x48
84 pll1cr1 = ctrl_inl(PLLPCICR);
85 printk("PLL1CR1 %08lx\n", pll1cr1);
86 mdiv = PLL_MDIV(pll1cr1);
87 ndiv = PLL_NDIV(pll1cr1);
88 pdiv = PLL_PDIV(pll1cr1);
89 printk("mdiv %02lx ndiv %02lx pdiv %02lx\n", mdiv, ndiv, pdiv);
90 freq = ((2*27*ndiv)/mdiv) / (1 << pdiv);
91 printk("PLL freq %dMHz\n", freq);
92 muxcr = ctrl_inl(CLKGENA_PLL2_MUXCR);
93 printk("PCI freq %dMhz\n", freq / muxcr_ratios[muxcr & 3]);
94 }
95}
96
97
98struct pci_err {
99 unsigned mask;
100 const char *error_string;
101};
102
103static struct pci_err int_error[]={
104 { INT_MNLTDIM,"MNLTDIM: Master non-lock transfer"},
105 { INT_TTADI, "TTADI: Illegal byte enable in I/O transfer"},
106 { INT_TMTO, "TMTO: Target memory read/write timeout"},
107 { INT_MDEI, "MDEI: Master function disable error"},
108 { INT_APEDI, "APEDI: Address parity error"},
109 { INT_SDI, "SDI: SERR detected"},
110 { INT_DPEITW, "DPEITW: Data parity error target write"},
111 { INT_PEDITR, "PEDITR: PERR detected"},
112 { INT_TADIM, "TADIM: Target abort detected"},
113 { INT_MADIM, "MADIM: Master abort detected"},
114 { INT_MWPDI, "MWPDI: PERR from target at data write"},
115 { INT_MRDPEI, "MRDPEI: Master read data parity error"}
116};
117#define NUM_PCI_INT_ERRS (sizeof(int_error)/sizeof(struct pci_err))
118
119static struct pci_err aint_error[]={
120 { AINT_MBI, "MBI: Master broken"},
121 { AINT_TBTOI, "TBTOI: Target bus timeout"},
122 { AINT_MBTOI, "MBTOI: Master bus timeout"},
123 { AINT_TAI, "TAI: Target abort"},
124 { AINT_MAI, "MAI: Master abort"},
125 { AINT_RDPEI, "RDPEI: Read data parity"},
126 { AINT_WDPE, "WDPE: Write data parity"}
127};
128
129#define NUM_PCI_AINT_ERRS (sizeof(aint_error)/sizeof(struct pci_err))
130
131static void print_pci_errors(unsigned reg,struct pci_err *error,int num_errors)
132{
133 int i;
134
135 for(i=0;i<num_errors;i++) {
136 if(reg & error[i].mask) {
137 printk("%s\n",error[i].error_string);
138 }
139 }
140
141}
142
143
144static char * pci_commands[16]={
145 "Int Ack",
146 "Special Cycle",
147 "I/O Read",
148 "I/O Write",
149 "Reserved",
150 "Reserved",
151 "Memory Read",
152 "Memory Write",
153 "Reserved",
154 "Reserved",
155 "Configuration Read",
156 "Configuration Write",
157 "Memory Read Multiple",
158 "Dual Address Cycle",
159 "Memory Read Line",
160 "Memory Write-and-Invalidate"
161};
162
163static irqreturn_t st40_pci_irq(int irq, void *dev_instance)
164{
165 unsigned pci_int, pci_air, pci_cir, pci_aint;
166 static int count=0;
167
168
169 pci_int = ST40PCI_READ(INT);pci_aint = ST40PCI_READ(AINT);
170 pci_cir = ST40PCI_READ(CIR);pci_air = ST40PCI_READ(AIR);
171
172 /* Reset state to stop multiple interrupts */
173 ST40PCI_WRITE(INT, ~0); ST40PCI_WRITE(AINT, ~0);
174
175
176 if(++count>1) return IRQ_HANDLED;
177
178 printk("** PCI ERROR **\n");
179
180 if(pci_int) {
181 printk("** INT register status\n");
182 print_pci_errors(pci_int,int_error,NUM_PCI_INT_ERRS);
183 }
184
185 if(pci_aint) {
186 printk("** AINT register status\n");
187 print_pci_errors(pci_aint,aint_error,NUM_PCI_AINT_ERRS);
188 }
189
190 printk("** Address and command info\n");
191
192 printk("** Command %s : Address 0x%x\n",
193 pci_commands[pci_cir&0xf],pci_air);
194
195 if(pci_cir&CIR_PIOTEM) {
196 printk("CIR_PIOTEM:PIO transfer error for master\n");
197 }
198 if(pci_cir&CIR_RWTET) {
199 printk("CIR_RWTET:Read/Write transfer error for target\n");
200 }
201
202 return IRQ_HANDLED;
203}
204
205
206/* Rounds a number UP to the nearest power of two. Used for
207 * sizing the PCI window.
208 */
209static u32 r2p2(u32 num)
210{
211 int i = 31;
212 u32 tmp = num;
213
214 if (num == 0)
215 return 0;
216
217 do {
218 if (tmp & (1 << 31))
219 break;
220 i--;
221 tmp <<= 1;
222 } while (i >= 0);
223
224 tmp = 1 << i;
225 /* If the original number isn't a power of 2, round it up */
226 if (tmp != num)
227 tmp <<= 1;
228
229 return tmp;
230}
231
232static void __init pci_fixup_ide_bases(struct pci_dev *d)
233{
234 int i;
235
236 /*
237 * PCI IDE controllers use non-standard I/O port decoding, respect it.
238 */
239 if ((d->class >> 8) != PCI_CLASS_STORAGE_IDE)
240 return;
241 printk("PCI: IDE base address fixup for %s\n", pci_name(d));
242 for(i=0; i<4; i++) {
243 struct resource *r = &d->resource[i];
244 if ((r->start & ~0x80) == 0x374) {
245 r->start |= 2;
246 r->end = r->start;
247 }
248 }
249}
250DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_ide_bases);
251
252int __init st40pci_init(unsigned memStart, unsigned memSize)
253{
254 u32 lsr0;
255
256 SetPCIPLL();
257
258 /* Initialises the ST40 pci subsystem, performing a reset, then programming
259 * up the address space decoders appropriately
260 */
261
262 /* Should reset core here as well methink */
263
264 ST40PCI_WRITE(CR, CR_LOCK_MASK | CR_SOFT_RESET);
265
266 /* Loop while core resets */
267 while (ST40PCI_READ(CR) & CR_SOFT_RESET);
268
269 /* Switch off interrupts */
270 ST40PCI_WRITE(INTM, 0);
271 ST40PCI_WRITE(AINT, 0);
272
273 /* Now, lets reset all the cards on the bus with extreme prejudice */
274 ST40PCI_WRITE(CR, CR_LOCK_MASK | CR_RSTCTL);
275 udelay(250);
276
277 /* Set bus active, take it out of reset */
278 ST40PCI_WRITE(CR, CR_LOCK_MASK | CR_BMAM | CR_CFINT | CR_PFCS | CR_PFE);
279
280 /* The PCI spec says that no access must be made to the bus until 1 second
281 * after reset. This seem ludicrously long, but some delay is needed here
282 */
283 mdelay(1000);
284
285 /* Switch off interrupts */
286 ST40PCI_WRITE(INTM, 0);
287 ST40PCI_WRITE(AINT, 0);
288
289 /* Allow it to be a master */
290
291 ST40PCI_WRITE_SHORT(CSR_CMD,
292 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
293 PCI_COMMAND_IO);
294
295 /* Access to the 0xb0000000 -> 0xb6000000 area will go through to 0x10000000 -> 0x16000000
296 * on the PCI bus. This allows a nice 1-1 bus to phys mapping.
297 */
298
299
300 ST40PCI_WRITE(MBR, 0x10000000);
301 /* Always set the max size 128M (actually, it is only 96MB wide) */
302 ST40PCI_WRITE(MBMR, 0x07ff0000);
303
304 /* I/O addresses are mapped at 0xb6000000 -> 0xb7000000. These are changed to 0, to
305 * allow cards that have legacy io such as vga to function correctly. This gives a
306 * maximum of 64K of io/space as only the bottom 16 bits of the address are copied
307 * over to the bus when the transaction is made. 64K of io space is more than enough
308 */
309 ST40PCI_WRITE(IOBR, 0x0);
310 /* Set up the 64K window */
311 ST40PCI_WRITE(IOBMR, 0x0);
312
313 /* Now we set up the mbars so the PCI bus can see the local memory */
314 /* Expose a 256M window starting at PCI address 0... */
315 ST40PCI_WRITE(CSR_MBAR0, 0);
316 ST40PCI_WRITE(LSR0, 0x0fff0001);
317
318 /* ... and set up the initial incoming window to expose all of RAM */
319 pci_set_rbar_region(7, memStart, memStart, memSize);
320
321 /* Maximise timeout values */
322 ST40PCI_WRITE_BYTE(CSR_TRDY, 0xff);
323 ST40PCI_WRITE_BYTE(CSR_RETRY, 0xff);
324 ST40PCI_WRITE_BYTE(CSR_MIT, 0xff);
325
326 ST40PCI_WRITE_BYTE(PERF,PERF_MASTER_WRITE_POSTING);
327
328 return 1;
329}
330
331char * __devinit pcibios_setup(char *str)
332{
333 return str;
334}
335
336
337#define SET_CONFIG_BITS(bus,devfn,where)\
338 (((bus) << 16) | ((devfn) << 8) | ((where) & ~3) | (bus!=0))
339
340#define CONFIG_CMD(bus, devfn, where) SET_CONFIG_BITS(bus->number,devfn,where)
341
342
343static int CheckForMasterAbort(void)
344{
345 if (ST40PCI_READ(INT) & INT_MADIM) {
346 /* Should we clear config space version as well ??? */
347 ST40PCI_WRITE(INT, INT_MADIM);
348 ST40PCI_WRITE_SHORT(CSR_STATUS, 0);
349 return 1;
350 }
351
352 return 0;
353}
354
355/* Write to config register */
356static int st40pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 * val)
357{
358 ST40PCI_WRITE(PAR, CONFIG_CMD(bus, devfn, where));
359 switch (size) {
360 case 1:
361 *val = (u8)ST40PCI_READ_BYTE(PDR + (where & 3));
362 break;
363 case 2:
364 *val = (u16)ST40PCI_READ_SHORT(PDR + (where & 2));
365 break;
366 case 4:
367 *val = ST40PCI_READ(PDR);
368 break;
369 }
370
371 if (CheckForMasterAbort()){
372 switch (size) {
373 case 1:
374 *val = (u8)0xff;
375 break;
376 case 2:
377 *val = (u16)0xffff;
378 break;
379 case 4:
380 *val = 0xffffffff;
381 break;
382 }
383 }
384
385 return PCIBIOS_SUCCESSFUL;
386}
387
388static int st40pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
389{
390 ST40PCI_WRITE(PAR, CONFIG_CMD(bus, devfn, where));
391
392 switch (size) {
393 case 1:
394 ST40PCI_WRITE_BYTE(PDR + (where & 3), (u8)val);
395 break;
396 case 2:
397 ST40PCI_WRITE_SHORT(PDR + (where & 2), (u16)val);
398 break;
399 case 4:
400 ST40PCI_WRITE(PDR, val);
401 break;
402 }
403
404 CheckForMasterAbort();
405
406 return PCIBIOS_SUCCESSFUL;
407}
408
409struct pci_ops st40pci_config_ops = {
410 .read = st40pci_read,
411 .write = st40pci_write,
412};
413
414
415/* Everything hangs off this */
416static struct pci_bus *pci_root_bus;
417
418static int __init pcibios_init(void)
419{
420 extern unsigned long memory_start, memory_end;
421
422 printk(KERN_ALERT "pci-st40.c: pcibios_init\n");
423
424 if (sh_mv.mv_init_pci != NULL) {
425 sh_mv.mv_init_pci();
426 }
427
428 /* The pci subsytem needs to know where memory is and how much
429 * of it there is. I've simply made these globals. A better mechanism
430 * is probably needed.
431 */
432 st40pci_init(PHYSADDR(memory_start),
433 PHYSADDR(memory_end) - PHYSADDR(memory_start));
434
435 if (request_irq(ST40PCI_ERR_IRQ, st40_pci_irq,
436 IRQF_DISABLED, "st40pci", NULL)) {
437 printk(KERN_ERR "st40pci: Cannot hook interrupt\n");
438 return -EIO;
439 }
440
441 /* Enable the PCI interrupts on the device */
442 ST40PCI_WRITE(INTM, ~0);
443 ST40PCI_WRITE(AINT, ~0);
444
445 /* Map the io address apprioately */
446#ifdef CONFIG_HD64465
447 hd64465_port_map(PCIBIOS_MIN_IO, (64 * 1024) - PCIBIOS_MIN_IO + 1,
448 ST40_IO_ADDR + PCIBIOS_MIN_IO, 0);
449#endif
450
451 /* ok, do the scan man */
452 pci_root_bus = pci_scan_bus(0, &st40pci_config_ops, NULL);
453 pci_assign_unassigned_resources();
454
455 return 0;
456}
457subsys_initcall(pcibios_init);
458
459/*
460 * Publish a region of local address space over the PCI bus
461 * to other devices.
462 */
463static void pci_set_rbar_region(unsigned int region, unsigned long localAddr,
464 unsigned long pciOffset, unsigned long regionSize)
465{
466 unsigned long mask;
467
468 if (region > 7)
469 return;
470
471 if (regionSize > (512 * 1024 * 1024))
472 return;
473
474 mask = r2p2(regionSize) - 0x10000;
475
476 /* Disable the region (in case currently in use, should never happen) */
477 ST40PCI_WRITE_INDEXED(RSR, region, 0);
478
479 /* Start of local address space to publish */
480 ST40PCI_WRITE_INDEXED(RLAR, region, PHYSADDR(localAddr) );
481
482 /* Start of region in PCI address space as an offset from MBAR0 */
483 ST40PCI_WRITE_INDEXED(RBAR, region, pciOffset);
484
485 /* Size of region */
486 ST40PCI_WRITE_INDEXED(RSR, region, mask | 1);
487}
488
diff --git a/arch/sh/drivers/pci/pci-st40.h b/arch/sh/drivers/pci/pci-st40.h
deleted file mode 100644
index cf0d35bd135c..000000000000
--- a/arch/sh/drivers/pci/pci-st40.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * Copyright (C) 2001 David J. Mckay (david.mckay@st.com)
3 *
4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information.
6 *
7 * Definitions for the ST40 PCI hardware.
8 */
9
10#ifndef __PCI_ST40_H__
11#define __PCI_ST40_H__
12
13#define ST40PCI_VCR_STATUS 0x00
14
15#define ST40PCI_VCR_VERSION 0x08
16
17#define ST40PCI_CR 0x10
18
19#define CR_SOFT_RESET (1<<12)
20#define CR_PFCS (1<<11)
21#define CR_PFE (1<<9)
22#define CR_BMAM (1<<6)
23#define CR_HOST (1<<5)
24#define CR_CLKEN (1<<4)
25#define CR_SOCS (1<<3)
26#define CR_IOCS (1<<2)
27#define CR_RSTCTL (1<<1)
28#define CR_CFINT (1<<0)
29#define CR_LOCK_MASK 0x5a000000
30
31
32#define ST40PCI_LSR0 0X14
33#define ST40PCI_LAR0 0x1c
34
35#define ST40PCI_INT 0x24
36#define INT_MNLTDIM (1<<15)
37#define INT_TTADI (1<<14)
38#define INT_TMTO (1<<9)
39#define INT_MDEI (1<<8)
40#define INT_APEDI (1<<7)
41#define INT_SDI (1<<6)
42#define INT_DPEITW (1<<5)
43#define INT_PEDITR (1<<4)
44#define INT_TADIM (1<<3)
45#define INT_MADIM (1<<2)
46#define INT_MWPDI (1<<1)
47#define INT_MRDPEI (1<<0)
48
49
50#define ST40PCI_INTM 0x28
51#define ST40PCI_AIR 0x2c
52
53#define ST40PCI_CIR 0x30
54#define CIR_PIOTEM (1<<31)
55#define CIR_RWTET (1<<26)
56
57#define ST40PCI_AINT 0x40
58#define AINT_MBI (1<<13)
59#define AINT_TBTOI (1<<12)
60#define AINT_MBTOI (1<<11)
61#define AINT_TAI (1<<3)
62#define AINT_MAI (1<<2)
63#define AINT_RDPEI (1<<1)
64#define AINT_WDPE (1<<0)
65
66#define ST40PCI_AINTM 0x44
67#define ST40PCI_BMIR 0x48
68#define ST40PCI_PAR 0x4c
69#define ST40PCI_MBR 0x50
70#define ST40PCI_IOBR 0x54
71#define ST40PCI_PINT 0x58
72#define ST40PCI_PINTM 0x5c
73#define ST40PCI_MBMR 0x70
74#define ST40PCI_IOBMR 0x74
75#define ST40PCI_PDR 0x78
76
77/* H8 specific registers start here */
78#define ST40PCI_WCBAR 0x7c
79#define ST40PCI_LOCCFG_UNLOCK 0x34
80
81#define ST40PCI_RBAR0 0x100
82#define ST40PCI_RSR0 0x104
83#define ST40PCI_RLAR0 0x108
84
85#define ST40PCI_RBAR1 0x110
86#define ST40PCI_RSR1 0x114
87#define ST40PCI_RLAR1 0x118
88
89
90#define ST40PCI_RBAR2 0x120
91#define ST40PCI_RSR2 0x124
92#define ST40PCI_RLAR2 0x128
93
94#define ST40PCI_RBAR3 0x130
95#define ST40PCI_RSR3 0x134
96#define ST40PCI_RLAR3 0x138
97
98#define ST40PCI_RBAR4 0x140
99#define ST40PCI_RSR4 0x144
100#define ST40PCI_RLAR4 0x148
101
102#define ST40PCI_RBAR5 0x150
103#define ST40PCI_RSR5 0x154
104#define ST40PCI_RLAR5 0x158
105
106#define ST40PCI_RBAR6 0x160
107#define ST40PCI_RSR6 0x164
108#define ST40PCI_RLAR6 0x168
109
110#define ST40PCI_RBAR7 0x170
111#define ST40PCI_RSR7 0x174
112#define ST40PCI_RLAR7 0x178
113
114
115#define ST40PCI_RBAR(n) (0x100+(0x10*(n)))
116#define ST40PCI_RSR(n) (0x104+(0x10*(n)))
117#define ST40PCI_RLAR(n) (0x108+(0x10*(n)))
118
119#define ST40PCI_PERF 0x80
120#define PERF_MASTER_WRITE_POSTING (1<<4)
121/* H8 specific registers end here */
122
123
124/* These are configs space registers */
125#define ST40PCI_CSR_VID 0x10000
126#define ST40PCI_CSR_DID 0x10002
127#define ST40PCI_CSR_CMD 0x10004
128#define ST40PCI_CSR_STATUS 0x10006
129#define ST40PCI_CSR_MBAR0 0x10010
130#define ST40PCI_CSR_TRDY 0x10040
131#define ST40PCI_CSR_RETRY 0x10041
132#define ST40PCI_CSR_MIT 0x1000d
133
134#define ST40_IO_ADDR 0xb6000000
135
136#endif /* __PCI_ST40_H__ */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 1f141a8ba17c..4b81d9c47b00 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -10,7 +10,6 @@ obj-y := debugtraps.o io.o io_generic.o irq.o machvec.o process.o ptrace.o \
10 10
11obj-y += cpu/ timers/ 11obj-y += cpu/ timers/
12obj-$(CONFIG_VSYSCALL) += vsyscall/ 12obj-$(CONFIG_VSYSCALL) += vsyscall/
13
14obj-$(CONFIG_SMP) += smp.o 13obj-$(CONFIG_SMP) += smp.o
15obj-$(CONFIG_CF_ENABLER) += cf-enabler.o 14obj-$(CONFIG_CF_ENABLER) += cf-enabler.o
16obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o 15obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
@@ -22,3 +21,5 @@ obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
22obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 21obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
23obj-$(CONFIG_PM) += pm.o 22obj-$(CONFIG_PM) += pm.o
24obj-$(CONFIG_STACKTRACE) += stacktrace.o 23obj-$(CONFIG_STACKTRACE) += stacktrace.o
24
25EXTRA_CFLAGS += -Werror
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/sh3/ex.S b/arch/sh/kernel/cpu/sh3/ex.S
index 2b2a9e02fb75..b6abf38d3a8d 100644
--- a/arch/sh/kernel/cpu/sh3/ex.S
+++ b/arch/sh/kernel/cpu/sh3/ex.S
@@ -46,7 +46,7 @@ ENTRY(exception_handling_table)
46 .long exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/ 46 .long exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/
47ENTRY(nmi_slot) 47ENTRY(nmi_slot)
48#if defined (CONFIG_KGDB_NMI) 48#if defined (CONFIG_KGDB_NMI)
49 .long debug_enter /* 1C0 */ ! Allow trap to debugger 49 .long kgdb_handle_exception /* 1C0 */ ! Allow trap to debugger
50#else 50#else
51 .long exception_none /* 1C0 */ ! Not implemented yet 51 .long exception_none /* 1C0 */ ! Not implemented yet
52#endif 52#endif
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index 21375d777e99..bc9c28a69bf1 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -139,14 +139,6 @@ int __init detect_cpu_and_cache_system(void)
139 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER | 139 boot_cpu_data.flags |= CPU_HAS_FPU | CPU_HAS_PERF_COUNTER |
140 CPU_HAS_LLSC; 140 CPU_HAS_LLSC;
141 break; 141 break;
142 case 0x8000:
143 boot_cpu_data.type = CPU_ST40RA;
144 boot_cpu_data.flags |= CPU_HAS_FPU;
145 break;
146 case 0x8100:
147 boot_cpu_data.type = CPU_ST40GX1;
148 boot_cpu_data.flags |= CPU_HAS_FPU;
149 break;
150 case 0x700: 142 case 0x700:
151 boot_cpu_data.type = CPU_SH4_501; 143 boot_cpu_data.type = CPU_SH4_501;
152 boot_cpu_data.icache.ways = 2; 144 boot_cpu_data.icache.ways = 2;
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..0586bc62ad96 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -11,7 +11,6 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel_stat.h> 12#include <linux/kernel_stat.h>
13#include <linux/seq_file.h> 13#include <linux/seq_file.h>
14#include <linux/irq.h>
15#include <asm/processor.h> 14#include <asm/processor.h>
16#include <asm/machvec.h> 15#include <asm/machvec.h>
17#include <asm/uaccess.h> 16#include <asm/uaccess.h>
@@ -69,7 +68,7 @@ unlock:
69} 68}
70#endif 69#endif
71 70
72#ifdef CONFIG_4KSTACKS 71#ifdef CONFIG_IRQSTACKS
73/* 72/*
74 * per-CPU IRQ handling contexts (thread information and stack) 73 * per-CPU IRQ handling contexts (thread information and stack)
75 */ 74 */
@@ -85,7 +84,7 @@ static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
85asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs) 84asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
86{ 85{
87 struct pt_regs *old_regs = set_irq_regs(regs); 86 struct pt_regs *old_regs = set_irq_regs(regs);
88#ifdef CONFIG_4KSTACKS 87#ifdef CONFIG_IRQSTACKS
89 union irq_ctx *curctx, *irqctx; 88 union irq_ctx *curctx, *irqctx;
90#endif 89#endif
91 90
@@ -109,7 +108,7 @@ asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
109 108
110 irq = irq_demux(evt2irq(irq)); 109 irq = irq_demux(evt2irq(irq));
111 110
112#ifdef CONFIG_4KSTACKS 111#ifdef CONFIG_IRQSTACKS
113 curctx = (union irq_ctx *)current_thread_info(); 112 curctx = (union irq_ctx *)current_thread_info();
114 irqctx = hardirq_ctx[smp_processor_id()]; 113 irqctx = hardirq_ctx[smp_processor_id()];
115 114
@@ -157,7 +156,7 @@ asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
157 return 1; 156 return 1;
158} 157}
159 158
160#ifdef CONFIG_4KSTACKS 159#ifdef CONFIG_IRQSTACKS
161static char softirq_stack[NR_CPUS * THREAD_SIZE] 160static char softirq_stack[NR_CPUS * THREAD_SIZE]
162 __attribute__((__section__(".bss.page_aligned"))); 161 __attribute__((__section__(".bss.page_aligned")));
163 162
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
index 2fdc700dfd6e..d453c3a1c79f 100644
--- a/arch/sh/kernel/kgdb_stub.c
+++ b/arch/sh/kernel/kgdb_stub.c
@@ -102,6 +102,7 @@
102#include <linux/init.h> 102#include <linux/init.h>
103#include <linux/console.h> 103#include <linux/console.h>
104#include <linux/sysrq.h> 104#include <linux/sysrq.h>
105#include <linux/module.h>
105#include <asm/system.h> 106#include <asm/system.h>
106#include <asm/cacheflush.h> 107#include <asm/cacheflush.h>
107#include <asm/current.h> 108#include <asm/current.h>
@@ -116,7 +117,9 @@ kgdb_debug_hook_t *kgdb_debug_hook;
116kgdb_bus_error_hook_t *kgdb_bus_err_hook; 117kgdb_bus_error_hook_t *kgdb_bus_err_hook;
117 118
118int (*kgdb_getchar)(void); 119int (*kgdb_getchar)(void);
120EXPORT_SYMBOL_GPL(kgdb_getchar);
119void (*kgdb_putchar)(int); 121void (*kgdb_putchar)(int);
122EXPORT_SYMBOL_GPL(kgdb_putchar);
120 123
121static void put_debug_char(int c) 124static void put_debug_char(int c)
122{ 125{
@@ -136,7 +139,7 @@ static int get_debug_char(void)
136#define NUMREGBYTES (MAXREG*4) 139#define NUMREGBYTES (MAXREG*4)
137#define OUTBUFMAX (NUMREGBYTES*2+512) 140#define OUTBUFMAX (NUMREGBYTES*2+512)
138 141
139enum regs { 142enum {
140 R0 = 0, R1, R2, R3, R4, R5, R6, R7, 143 R0 = 0, R1, R2, R3, R4, R5, R6, R7,
141 R8, R9, R10, R11, R12, R13, R14, R15, 144 R8, R9, R10, R11, R12, R13, R14, R15,
142 PC, PR, GBR, VBR, MACH, MACL, SR, 145 PC, PR, GBR, VBR, MACH, MACL, SR,
@@ -176,9 +179,13 @@ int kgdb_nofault; /* Boolean to ignore bus errs (i.e. in GDB) */
176 179
177/* SCI/UART settings, used in kgdb_console_setup() */ 180/* SCI/UART settings, used in kgdb_console_setup() */
178int kgdb_portnum = CONFIG_KGDB_DEFPORT; 181int kgdb_portnum = CONFIG_KGDB_DEFPORT;
182EXPORT_SYMBOL_GPL(kgdb_portnum);
179int kgdb_baud = CONFIG_KGDB_DEFBAUD; 183int kgdb_baud = CONFIG_KGDB_DEFBAUD;
184EXPORT_SYMBOL_GPL(kgdb_baud);
180char kgdb_parity = CONFIG_KGDB_DEFPARITY; 185char kgdb_parity = CONFIG_KGDB_DEFPARITY;
186EXPORT_SYMBOL_GPL(kgdb_parity);
181char kgdb_bits = CONFIG_KGDB_DEFBITS; 187char kgdb_bits = CONFIG_KGDB_DEFBITS;
188EXPORT_SYMBOL_GPL(kgdb_bits);
182 189
183/* Jump buffer for setjmp/longjmp */ 190/* Jump buffer for setjmp/longjmp */
184static jmp_buf rem_com_env; 191static jmp_buf rem_com_env;
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index b749403f6b38..4156aac8c27d 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));
@@ -323,7 +303,6 @@ static const char *cpu_name[] = {
323 [CPU_SH7750S] = "SH7750S", [CPU_SH7750R] = "SH7750R", 303 [CPU_SH7750S] = "SH7750S", [CPU_SH7750R] = "SH7750R",
324 [CPU_SH7751] = "SH7751", [CPU_SH7751R] = "SH7751R", 304 [CPU_SH7751] = "SH7751", [CPU_SH7751R] = "SH7751R",
325 [CPU_SH7760] = "SH7760", 305 [CPU_SH7760] = "SH7760",
326 [CPU_ST40RA] = "ST40RA", [CPU_ST40GX1] = "ST40GX1",
327 [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501", 306 [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501",
328 [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780", 307 [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780",
329 [CPU_SH7781] = "SH7781", [CPU_SH7343] = "SH7343", 308 [CPU_SH7781] = "SH7781", [CPU_SH7343] = "SH7343",
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c
index 548e4285b375..e1a6de9088b5 100644
--- a/arch/sh/kernel/sh_ksyms.c
+++ b/arch/sh/kernel/sh_ksyms.c
@@ -106,7 +106,6 @@ DECLARE_EXPORT(__movmem);
106DECLARE_EXPORT(__movstr); 106DECLARE_EXPORT(__movstr);
107#endif 107#endif
108 108
109#ifdef CONFIG_CPU_SH4
110#if __GNUC__ == 4 109#if __GNUC__ == 4
111DECLARE_EXPORT(__movmem_i4_even); 110DECLARE_EXPORT(__movmem_i4_even);
112DECLARE_EXPORT(__movmem_i4_odd); 111DECLARE_EXPORT(__movmem_i4_odd);
@@ -126,7 +125,6 @@ DECLARE_EXPORT(__movstr_i4_even);
126DECLARE_EXPORT(__movstr_i4_odd); 125DECLARE_EXPORT(__movstr_i4_odd);
127DECLARE_EXPORT(__movstrSI12_i4); 126DECLARE_EXPORT(__movstrSI12_i4);
128#endif /* __GNUC__ == 4 */ 127#endif /* __GNUC__ == 4 */
129#endif
130 128
131#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \ 129#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \
132 defined(CONFIG_SH7705_CACHE_32KB)) 130 defined(CONFIG_SH7705_CACHE_32KB))
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/lib/Makefile b/arch/sh/lib/Makefile
index e23dd1a3fccd..9dc7b6985052 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -9,3 +9,5 @@ memcpy-y := memcpy.o
9memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o 9memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o
10 10
11lib-y += $(memcpy-y) 11lib-y += $(memcpy-y)
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index cf446bbab5b0..1265f204f7d1 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -17,7 +17,7 @@ config CPU_SH4
17 bool 17 bool
18 select CPU_HAS_INTEVT 18 select CPU_HAS_INTEVT
19 select CPU_HAS_SR_RB 19 select CPU_HAS_SR_RB
20 select CPU_HAS_PTEA if (!CPU_SUBTYPE_ST40 && !CPU_SH4A) || CPU_SHX2 20 select CPU_HAS_PTEA if !CPU_SH4A || CPU_SHX2
21 select CPU_HAS_FPU if !CPU_SH4AL_DSP 21 select CPU_HAS_FPU if !CPU_SH4AL_DSP
22 22
23config CPU_SH4A 23config CPU_SH4A
@@ -29,10 +29,6 @@ config CPU_SH4AL_DSP
29 select CPU_SH4A 29 select CPU_SH4A
30 select CPU_HAS_DSP 30 select CPU_HAS_DSP
31 31
32config CPU_SUBTYPE_ST40
33 bool
34 select CPU_SH4
35
36config CPU_SHX2 32config CPU_SHX2
37 bool 33 bool
38 34
@@ -152,21 +148,6 @@ config CPU_SUBTYPE_SH4_202
152 bool "Support SH4-202 processor" 148 bool "Support SH4-202 processor"
153 select CPU_SH4 149 select CPU_SH4
154 150
155# ST40 Processor Support
156
157config CPU_SUBTYPE_ST40STB1
158 bool "Support ST40STB1/ST40RA processors"
159 select CPU_SUBTYPE_ST40
160 help
161 Select ST40STB1 if you have a ST40RA CPU.
162 This was previously called the ST40STB1, hence the option name.
163
164config CPU_SUBTYPE_ST40GX1
165 bool "Support ST40GX1 processor"
166 select CPU_SUBTYPE_ST40
167 help
168 Select ST40GX1 if you have a ST40GX1 CPU.
169
170# SH-4A Processor Support 151# SH-4A Processor Support
171 152
172config CPU_SUBTYPE_SH7770 153config CPU_SUBTYPE_SH7770
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index ee30fb44dfe1..aa44607f072d 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -33,3 +33,5 @@ endif
33obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 33obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
34obj-$(CONFIG_32BIT) += pmb.o 34obj-$(CONFIG_32BIT) += pmb.o
35obj-$(CONFIG_NUMA) += numa.o 35obj-$(CONFIG_NUMA) += numa.o
36
37EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/mm/clear_page.S b/arch/sh/mm/clear_page.S
index 8a706131e521..7a7c81ee3f01 100644
--- a/arch/sh/mm/clear_page.S
+++ b/arch/sh/mm/clear_page.S
@@ -150,48 +150,3 @@ ENTRY(__clear_user)
150 .long 8b, .Lbad_clear_user 150 .long 8b, .Lbad_clear_user
151 .long 9b, .Lbad_clear_user 151 .long 9b, .Lbad_clear_user
152.previous 152.previous
153
154#if defined(CONFIG_CPU_SH4)
155/*
156 * __clear_user_page
157 * @to: P3 address (with same color)
158 * @orig_to: P1 address
159 *
160 * void __clear_user_page(void *to, void *orig_to)
161 */
162
163/*
164 * r0 --- scratch
165 * r4 --- to
166 * r5 --- orig_to
167 * r6 --- to + PAGE_SIZE
168 */
169ENTRY(__clear_user_page)
170 mov.l .Lpsz,r0
171 mov r4,r6
172 add r0,r6
173 mov #0,r0
174 !
1751: ocbi @r5
176 add #32,r5
177 movca.l r0,@r4
178 mov r4,r1
179 add #32,r4
180 mov.l r0,@-r4
181 mov.l r0,@-r4
182 mov.l r0,@-r4
183 mov.l r0,@-r4
184 mov.l r0,@-r4
185 mov.l r0,@-r4
186 mov.l r0,@-r4
187 add #28,r4
188 cmp/eq r6,r4
189 bf/s 1b
190 ocbwb @r1
191 !
192 rts
193 nop
194.Lpsz: .long PAGE_SIZE
195
196#endif
197
diff --git a/arch/sh/mm/copy_page.S b/arch/sh/mm/copy_page.S
index a81dbdb05596..40685018b952 100644
--- a/arch/sh/mm/copy_page.S
+++ b/arch/sh/mm/copy_page.S
@@ -68,67 +68,6 @@ ENTRY(copy_page_slow)
68 rts 68 rts
69 nop 69 nop
70 70
71#if defined(CONFIG_CPU_SH4)
72/*
73 * __copy_user_page
74 * @to: P1 address (with same color)
75 * @from: P1 address
76 * @orig_to: P1 address
77 *
78 * void __copy_user_page(void *to, void *from, void *orig_to)
79 */
80
81/*
82 * r0, r1, r2, r3, r4, r5, r6, r7 --- scratch
83 * r8 --- from + PAGE_SIZE
84 * r9 --- orig_to
85 * r10 --- to
86 * r11 --- from
87 */
88ENTRY(__copy_user_page)
89 mov.l r8,@-r15
90 mov.l r9,@-r15
91 mov.l r10,@-r15
92 mov.l r11,@-r15
93 mov r4,r10
94 mov r5,r11
95 mov r6,r9
96 mov r5,r8
97 mov.l .Lpsz,r0
98 add r0,r8
99 !
1001: ocbi @r9
101 add #32,r9
102 mov.l @r11+,r0
103 mov.l @r11+,r1
104 mov.l @r11+,r2
105 mov.l @r11+,r3
106 mov.l @r11+,r4
107 mov.l @r11+,r5
108 mov.l @r11+,r6
109 mov.l @r11+,r7
110 movca.l r0,@r10
111 mov r10,r0
112 add #32,r10
113 mov.l r7,@-r10
114 mov.l r6,@-r10
115 mov.l r5,@-r10
116 mov.l r4,@-r10
117 mov.l r3,@-r10
118 mov.l r2,@-r10
119 mov.l r1,@-r10
120 ocbwb @r0
121 cmp/eq r11,r8
122 bf/s 1b
123 add #28,r10
124 !
125 mov.l @r15+,r11
126 mov.l @r15+,r10
127 mov.l @r15+,r9
128 mov.l @r15+,r8
129 rts
130 nop
131#endif
132 .align 2 71 .align 2
133.Lpsz: .long PAGE_SIZE 72.Lpsz: .long PAGE_SIZE
134/* 73/*
@@ -255,7 +194,11 @@ EX( mov.l @r5+,r8 )
255EX( mov.l @r5+,r9 ) 194EX( mov.l @r5+,r9 )
256EX( mov.l @r5+,r10 ) 195EX( mov.l @r5+,r10 )
257EX( mov.l @r5+,r11 ) 196EX( mov.l @r5+,r11 )
197#ifdef CONFIG_CPU_SH4
258EX( movca.l r0,@r4 ) 198EX( movca.l r0,@r4 )
199#else
200EX( mov.l r0,@r4 )
201#endif
259 add #-32, r6 202 add #-32, r6
260EX( mov.l r1,@(4,r4) ) 203EX( mov.l r1,@(4,r4) )
261 mov #32, r0 204 mov #32, r0
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index f33cedb353fc..60d74f793a1d 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -258,9 +258,6 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
258 pmd_t *pmd; 258 pmd_t *pmd;
259 pte_t *pte; 259 pte_t *pte;
260 pte_t entry; 260 pte_t entry;
261 struct mm_struct *mm = current->mm;
262 spinlock_t *ptl = NULL;
263 int ret = 1;
264 261
265#ifdef CONFIG_SH_KGDB 262#ifdef CONFIG_SH_KGDB
266 if (kgdb_nofault && kgdb_bus_err_hook) 263 if (kgdb_nofault && kgdb_bus_err_hook)
@@ -274,12 +271,11 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
274 */ 271 */
275 if (address >= P3SEG && address < P3_ADDR_MAX) { 272 if (address >= P3SEG && address < P3_ADDR_MAX) {
276 pgd = pgd_offset_k(address); 273 pgd = pgd_offset_k(address);
277 mm = NULL;
278 } else { 274 } else {
279 if (unlikely(address >= TASK_SIZE || !mm)) 275 if (unlikely(address >= TASK_SIZE || !current->mm))
280 return 1; 276 return 1;
281 277
282 pgd = pgd_offset(mm, address); 278 pgd = pgd_offset(current->mm, address);
283 } 279 }
284 280
285 pud = pud_offset(pgd, address); 281 pud = pud_offset(pgd, address);
@@ -289,34 +285,19 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
289 if (pmd_none_or_clear_bad(pmd)) 285 if (pmd_none_or_clear_bad(pmd))
290 return 1; 286 return 1;
291 287
292 if (mm) 288 pte = pte_offset_kernel(pmd, address);
293 pte = pte_offset_map_lock(mm, pmd, address, &ptl);
294 else
295 pte = pte_offset_kernel(pmd, address);
296
297 entry = *pte; 289 entry = *pte;
298 if (unlikely(pte_none(entry) || pte_not_present(entry))) 290 if (unlikely(pte_none(entry) || pte_not_present(entry)))
299 goto unlock; 291 return 1;
300 if (unlikely(writeaccess && !pte_write(entry))) 292 if (unlikely(writeaccess && !pte_write(entry)))
301 goto unlock; 293 return 1;
302 294
303 if (writeaccess) 295 if (writeaccess)
304 entry = pte_mkdirty(entry); 296 entry = pte_mkdirty(entry);
305 entry = pte_mkyoung(entry); 297 entry = pte_mkyoung(entry);
306 298
307#ifdef CONFIG_CPU_SH4
308 /*
309 * ITLB is not affected by "ldtlb" instruction.
310 * So, we need to flush the entry by ourselves.
311 */
312 local_flush_tlb_one(get_asid(), address & PAGE_MASK);
313#endif
314
315 set_pte(pte, entry); 299 set_pte(pte, entry);
316 update_mmu_cache(NULL, address, entry); 300 update_mmu_cache(NULL, address, entry);
317 ret = 0; 301
318unlock: 302 return 0;
319 if (mm)
320 pte_unmap_unlock(pte, ptl);
321 return ret;
322} 303}
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
index 25f5c6f6821d..8c7a9ca79879 100644
--- a/arch/sh/mm/pg-sh4.c
+++ b/arch/sh/mm/pg-sh4.c
@@ -9,6 +9,8 @@
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/highmem.h>
13#include <linux/module.h>
12#include <asm/mmu_context.h> 14#include <asm/mmu_context.h>
13#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
14 16
@@ -50,34 +52,61 @@ static inline void kunmap_coherent(struct page *page)
50void clear_user_page(void *to, unsigned long address, struct page *page) 52void clear_user_page(void *to, unsigned long address, struct page *page)
51{ 53{
52 __set_bit(PG_mapped, &page->flags); 54 __set_bit(PG_mapped, &page->flags);
53 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 55
54 clear_page(to); 56 clear_page(to);
55 else { 57 if ((((address & PAGE_MASK) ^ (unsigned long)to) & CACHE_ALIAS))
56 void *vto = kmap_coherent(page, address); 58 __flush_wback_region(to, PAGE_SIZE);
57 __clear_user_page(vto, to);
58 kunmap_coherent(vto);
59 }
60} 59}
61 60
62/* 61void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
63 * copy_user_page 62 unsigned long vaddr, void *dst, const void *src,
64 * @to: P1 address 63 unsigned long len)
65 * @from: P1 address
66 * @address: U0 address to be mapped
67 * @page: page (virt_to_page(to))
68 */
69void copy_user_page(void *to, void *from, unsigned long address,
70 struct page *page)
71{ 64{
65 void *vto;
66
72 __set_bit(PG_mapped, &page->flags); 67 __set_bit(PG_mapped, &page->flags);
73 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 68
74 copy_page(to, from); 69 vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
75 else { 70 memcpy(vto, src, len);
76 void *vfrom = kmap_coherent(page, address); 71 kunmap_coherent(vto);
77 __copy_user_page(vfrom, from, to); 72
78 kunmap_coherent(vfrom); 73 if (vma->vm_flags & VM_EXEC)
79 } 74 flush_cache_page(vma, vaddr, page_to_pfn(page));
75}
76
77void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
78 unsigned long vaddr, void *dst, const void *src,
79 unsigned long len)
80{
81 void *vfrom;
82
83 __set_bit(PG_mapped, &page->flags);
84
85 vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
86 memcpy(dst, vfrom, len);
87 kunmap_coherent(vfrom);
88}
89
90void copy_user_highpage(struct page *to, struct page *from,
91 unsigned long vaddr, struct vm_area_struct *vma)
92{
93 void *vfrom, *vto;
94
95 __set_bit(PG_mapped, &to->flags);
96
97 vto = kmap_atomic(to, KM_USER1);
98 vfrom = kmap_coherent(from, vaddr);
99 copy_page(vto, vfrom);
100 kunmap_coherent(vfrom);
101
102 if (((vaddr ^ (unsigned long)vto) & CACHE_ALIAS))
103 __flush_wback_region(vto, PAGE_SIZE);
104
105 kunmap_atomic(vto, KM_USER1);
106 /* Make sure this page is cleared on other CPU's too before using it */
107 smp_wmb();
80} 108}
109EXPORT_SYMBOL(copy_user_highpage);
81 110
82/* 111/*
83 * For SH-4, we have our own implementation for ptep_get_and_clear 112 * For SH-4, we have our own implementation for ptep_get_and_clear
diff --git a/arch/sh/oprofile/Makefile b/arch/sh/oprofile/Makefile
index 1f25d9bb7538..2efc2e79fd29 100644
--- a/arch/sh/oprofile/Makefile
+++ b/arch/sh/oprofile/Makefile
@@ -15,3 +15,4 @@ profdrvr-$(CONFIG_CPU_SUBTYPE_SH7091) := op_model_sh7750.o
15 15
16oprofile-y := $(DRIVER_OBJS) $(profdrvr-y) 16oprofile-y := $(DRIVER_OBJS) $(profdrvr-y)
17 17
18EXTRA_CFLAGS += -Werror
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/sh64/kernel/process.c b/arch/sh64/kernel/process.c
index ceb9458abda4..0761af4d2a42 100644
--- a/arch/sh64/kernel/process.c
+++ b/arch/sh64/kernel/process.c
@@ -26,6 +26,7 @@
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/proc_fs.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/pgtable.h> 31#include <asm/pgtable.h>
31 32
@@ -656,9 +657,6 @@ unsigned long get_wchan(struct task_struct *p)
656 */ 657 */
657 658
658#if defined(CONFIG_SH64_PROC_ASIDS) 659#if defined(CONFIG_SH64_PROC_ASIDS)
659#include <linux/init.h>
660#include <linux/proc_fs.h>
661
662static int 660static int
663asids_proc_info(char *buf, char **start, off_t fpos, int length, int *eof, void *data) 661asids_proc_info(char *buf, char **start, off_t fpos, int length, int *eof, void *data)
664{ 662{
@@ -686,10 +684,8 @@ asids_proc_info(char *buf, char **start, off_t fpos, int length, int *eof, void
686 684
687static int __init register_proc_asids(void) 685static int __init register_proc_asids(void)
688{ 686{
689 create_proc_read_entry("asids", 0, NULL, asids_proc_info, NULL); 687 create_proc_read_entry("asids", 0, NULL, asids_proc_info, NULL);
690 return 0; 688 return 0;
691} 689}
692
693__initcall(register_proc_asids); 690__initcall(register_proc_asids);
694#endif 691#endif
695
diff --git a/arch/sh64/kernel/traps.c b/arch/sh64/kernel/traps.c
index c03101fab467..f32df3831f45 100644
--- a/arch/sh64/kernel/traps.c
+++ b/arch/sh64/kernel/traps.c
@@ -30,7 +30,6 @@
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/sysctl.h> 31#include <linux/sysctl.h>
32#include <linux/module.h> 32#include <linux/module.h>
33
34#include <asm/system.h> 33#include <asm/system.h>
35#include <asm/uaccess.h> 34#include <asm/uaccess.h>
36#include <asm/io.h> 35#include <asm/io.h>
@@ -242,9 +241,6 @@ DO_ERROR(12, SIGILL, "reserved instruction", reserved_inst, current)
242 241
243#endif /* CONFIG_SH64_ID2815_WORKAROUND */ 242#endif /* CONFIG_SH64_ID2815_WORKAROUND */
244 243
245
246#include <asm/system.h>
247
248/* Called with interrupts disabled */ 244/* Called with interrupts disabled */
249asmlinkage void do_exception_error(unsigned long ex, struct pt_regs *regs) 245asmlinkage void do_exception_error(unsigned long ex, struct pt_regs *regs)
250{ 246{
@@ -984,4 +980,3 @@ asmlinkage void do_debug_interrupt(unsigned long code, struct pt_regs *regs)
984 /* Clear all DEBUGINT causes */ 980 /* Clear all DEBUGINT causes */
985 poke_real_address_q(DM_EXP_CAUSE_PHY, 0x0); 981 poke_real_address_q(DM_EXP_CAUSE_PHY, 0x0);
986} 982}
987
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index e1e24f31aa54..01a6756ba371 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -18,7 +18,6 @@
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19#include <linux/kernel_stat.h> 19#include <linux/kernel_stat.h>
20#include <linux/signal.h> 20#include <linux/signal.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h> 21#include <linux/interrupt.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <linux/random.h> 23#include <linux/random.h>
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/ds.c b/arch/sparc64/kernel/ds.c
index 9f472a79d37e..eeb5a2fc788d 100644
--- a/arch/sparc64/kernel/ds.c
+++ b/arch/sparc64/kernel/ds.c
@@ -6,7 +6,6 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/module.h>
10#include <linux/string.h> 9#include <linux/string.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/sched.h> 11#include <linux/sched.h>
diff --git a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c
index 579871527699..158484bf5999 100644
--- a/arch/sparc64/kernel/module.c
+++ b/arch/sparc64/kernel/module.c
@@ -11,7 +11,6 @@
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/vmalloc.h>
15#include <linux/mm.h> 14#include <linux/mm.h>
16 15
17#include <asm/processor.h> 16#include <asm/processor.h>
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_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 78caff926737..98c468803ce3 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -51,7 +51,6 @@
51#include <linux/vfs.h> 51#include <linux/vfs.h>
52#include <linux/netfilter_ipv4/ip_tables.h> 52#include <linux/netfilter_ipv4/ip_tables.h>
53#include <linux/ptrace.h> 53#include <linux/ptrace.h>
54#include <linux/highuid.h>
55 54
56#include <asm/types.h> 55#include <asm/types.h>
57#include <asm/uaccess.h> 56#include <asm/uaccess.h>
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index 170d6ca8de6f..cfc22d3fe54c 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -57,7 +57,6 @@
57#include <linux/personality.h> 57#include <linux/personality.h>
58 58
59/* For SOCKET_I */ 59/* For SOCKET_I */
60#include <linux/socket.h>
61#include <net/sock.h> 60#include <net/sock.h>
62#include <net/compat.h> 61#include <net/compat.h>
63 62
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index cd8c740cba1d..4352ee4d8dac 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -28,7 +28,6 @@
28#include <linux/jiffies.h> 28#include <linux/jiffies.h>
29#include <linux/cpufreq.h> 29#include <linux/cpufreq.h>
30#include <linux/percpu.h> 30#include <linux/percpu.h>
31#include <linux/profile.h>
32#include <linux/miscdevice.h> 31#include <linux/miscdevice.h>
33#include <linux/rtc.h> 32#include <linux/rtc.h>
34#include <linux/kernel_stat.h> 33#include <linux/kernel_stat.h>
@@ -47,7 +46,6 @@
47#include <asm/sections.h> 46#include <asm/sections.h>
48#include <asm/cpudata.h> 47#include <asm/cpudata.h>
49#include <asm/uaccess.h> 48#include <asm/uaccess.h>
50#include <asm/prom.h>
51#include <asm/irq_regs.h> 49#include <asm/irq_regs.h>
52 50
53DEFINE_SPINLOCK(mostek_lock); 51DEFINE_SPINLOCK(mostek_lock);
@@ -1070,7 +1068,7 @@ static int set_rtc_mmss(unsigned long nowtime)
1070 * Not having a register set can lead to trouble. 1068 * Not having a register set can lead to trouble.
1071 * Also starfire doesn't have a tod clock. 1069 * Also starfire doesn't have a tod clock.
1072 */ 1070 */
1073 if (!mregs && !dregs & !bregs) 1071 if (!mregs && !dregs && !bregs)
1074 return -1; 1072 return -1;
1075 1073
1076 if (mregs) { 1074 if (mregs) {
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/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 b/arch/um/Makefile
index 82c2ac48040d..31999bc1c8a4 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -70,9 +70,12 @@ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
70# in KBUILD_CFLAGS. Otherwise, it would cause ld to complain about the two different 70# in KBUILD_CFLAGS. Otherwise, it would cause ld to complain about the two different
71# errnos. 71# errnos.
72# These apply to kernelspace only. 72# These apply to kernelspace only.
73#
74# strip leading and trailing whitespace to make the USER_CFLAGS removal of these
75# defines more robust
73 76
74KERNEL_DEFINES = -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ 77KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
75 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES) 78 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES))
76KBUILD_CFLAGS += $(KERNEL_DEFINES) 79KBUILD_CFLAGS += $(KERNEL_DEFINES)
77KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,) 80KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
78 81
@@ -165,7 +168,7 @@ ifneq ($(KBUILD_SRC),)
165 $(Q)mkdir -p $(objtree)/include/asm-um 168 $(Q)mkdir -p $(objtree)/include/asm-um
166 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch 169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
167else 170else
168 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(HEADER_ARCH) arch 171 $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(SUBARCH) arch
169endif 172endif
170 173
171$(objtree)/$(ARCH_DIR)/include: 174$(objtree)/$(ARCH_DIR)/include:
@@ -177,7 +180,7 @@ $(ARCH_DIR)/include/sysdep: $(objtree)/$(ARCH_DIR)/include
177ifneq ($(KBUILD_SRC),) 180ifneq ($(KBUILD_SRC),)
178 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep 181 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep
179else 182else
180 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep 183 $(Q)cd $(ARCH_DIR)/include && ln -fsn sysdep-$(SUBARCH) sysdep
181endif 184endif
182 185
183$(ARCH_DIR)/os: 186$(ARCH_DIR)/os:
@@ -185,7 +188,7 @@ $(ARCH_DIR)/os:
185ifneq ($(KBUILD_SRC),) 188ifneq ($(KBUILD_SRC),)
186 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os 189 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os
187else 190else
188 $(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os 191 $(Q)cd $(ARCH_DIR) && ln -fsn os-$(OS) os
189endif 192endif
190 193
191# Generated files 194# Generated files
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 0178df306939..67290117d909 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)")
@@ -21,15 +22,13 @@ export LDFLAGS HOSTCFLAGS HOSTLDFLAGS UML_OBJCOPYFLAGS
21endif 22endif
22endif 23endif
23 24
24CFLAGS += -DCONFIG_X86_32 25KBUILD_CFLAGS += -DCONFIG_X86_32
25AFLAGS += -DCONFIG_X86_32 26KBUILD_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/net_kern.c b/arch/um/drivers/net_kern.c
index 8c01fa81a1ae..73681f14f9fc 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -753,6 +753,7 @@ static struct mc_device net_mc = {
753 .remove = net_remove, 753 .remove = net_remove,
754}; 754};
755 755
756#ifdef CONFIG_INET
756static int uml_inetaddr_event(struct notifier_block *this, unsigned long event, 757static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
757 void *ptr) 758 void *ptr)
758{ 759{
@@ -789,14 +790,13 @@ struct notifier_block uml_inetaddr_notifier = {
789 .notifier_call = uml_inetaddr_event, 790 .notifier_call = uml_inetaddr_event,
790}; 791};
791 792
792static int uml_net_init(void) 793static void inet_register(void)
793{ 794{
794 struct list_head *ele; 795 struct list_head *ele;
795 struct uml_net_private *lp; 796 struct uml_net_private *lp;
796 struct in_device *ip; 797 struct in_device *ip;
797 struct in_ifaddr *in; 798 struct in_ifaddr *in;
798 799
799 mconsole_register_dev(&net_mc);
800 register_inetaddr_notifier(&uml_inetaddr_notifier); 800 register_inetaddr_notifier(&uml_inetaddr_notifier);
801 801
802 /* Devices may have been opened already, so the uml_inetaddr_notifier 802 /* Devices may have been opened already, so the uml_inetaddr_notifier
@@ -816,7 +816,17 @@ static int uml_net_init(void)
816 } 816 }
817 } 817 }
818 spin_unlock(&opened_lock); 818 spin_unlock(&opened_lock);
819}
820#else
821static inline void inet_register(void)
822{
823}
824#endif
819 825
826static int uml_net_init(void)
827{
828 mconsole_register_dev(&net_mc);
829 inet_register();
820 return 0; 830 return 0;
821} 831}
822 832
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index e184b44b1011..7e6cdde62ead 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -705,7 +705,7 @@ static int ubd_add(int n, char **error_out)
705 ubd_dev->size = ROUND_BLOCK(ubd_dev->size); 705 ubd_dev->size = ROUND_BLOCK(ubd_dev->size);
706 706
707 INIT_LIST_HEAD(&ubd_dev->restart); 707 INIT_LIST_HEAD(&ubd_dev->restart);
708 sg_init_table(&ubd_dev->sg, MAX_SG); 708 sg_init_table(ubd_dev->sg, MAX_SG);
709 709
710 err = -ENOMEM; 710 err = -ENOMEM;
711 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/include/user.h b/arch/um/include/user.h
index 99033ff28a78..1723fac6f40d 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/user.h
@@ -1,11 +1,13 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __USER_H__ 6#ifndef __USER_H__
7#define __USER_H__ 7#define __USER_H__
8 8
9#include "uml-config.h"
10
9/* 11/*
10 * The usual definition - copied here because the kernel provides its own, 12 * The usual definition - copied here because the kernel provides its own,
11 * fancier, type-safe, definition. Using that one would require 13 * fancier, type-safe, definition. Using that one would require
@@ -23,8 +25,17 @@
23 25
24extern void panic(const char *fmt, ...) 26extern void panic(const char *fmt, ...)
25 __attribute__ ((format (printf, 1, 2))); 27 __attribute__ ((format (printf, 1, 2)));
28
29#ifdef UML_CONFIG_PRINTK
26extern int printk(const char *fmt, ...) 30extern int printk(const char *fmt, ...)
27 __attribute__ ((format (printf, 1, 2))); 31 __attribute__ ((format (printf, 1, 2)));
32#else
33static inline int printk(const char *fmt, ...)
34{
35 return 0;
36}
37#endif
38
28extern void schedule(void); 39extern void schedule(void);
29extern int in_aton(char *str); 40extern int in_aton(char *str);
30extern int open_gdb_chan(void); 41extern int open_gdb_chan(void);
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 70c2d625b070..ba11ccd6a8a3 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -347,14 +347,15 @@ int um_request_irq(unsigned int irq, int fd, int type,
347{ 347{
348 int err; 348 int err;
349 349
350 err = request_irq(irq, handler, irqflags, devname, dev_id); 350 if (fd != -1) {
351 if (err)
352 return err;
353
354 if (fd != -1)
355 err = activate_fd(irq, fd, type, dev_id); 351 err = activate_fd(irq, fd, type, dev_id);
356 return err; 352 if (err)
353 return err;
354 }
355
356 return request_irq(irq, handler, irqflags, devname, dev_id);
357} 357}
358
358EXPORT_SYMBOL(um_request_irq); 359EXPORT_SYMBOL(um_request_irq);
359EXPORT_SYMBOL(reactivate_fd); 360EXPORT_SYMBOL(reactivate_fd);
360 361
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/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
index d119f4f7d897..8d07a7acb909 100644
--- a/arch/um/kernel/skas/clone.c
+++ b/arch/um/kernel/skas/clone.c
@@ -3,7 +3,6 @@
3#include <sys/mman.h> 3#include <sys/mman.h>
4#include <sys/time.h> 4#include <sys/time.h>
5#include <asm/unistd.h> 5#include <asm/unistd.h>
6#include <asm/page.h>
7#include "as-layout.h" 6#include "as-layout.h"
8#include "ptrace_user.h" 7#include "ptrace_user.h"
9#include "skas.h" 8#include "skas.h"
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index b542a3a021bf..f83462758627 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -496,8 +496,7 @@ int os_rcv_fd(int fd, int *helper_pid_out)
496 n = recvmsg(fd, &msg, 0); 496 n = recvmsg(fd, &msg, 0);
497 if(n < 0) 497 if(n < 0)
498 return -errno; 498 return -errno;
499 499 else if(n != iov.iov_len)
500 else if(n != sizeof(iov.iov_len))
501 *helper_pid_out = -1; 500 *helper_pid_out = -1;
502 501
503 cmsg = CMSG_FIRSTHDR(&msg); 502 cmsg = CMSG_FIRSTHDR(&msg);
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/x86/Kconfig.i386 b/arch/x86/Kconfig
index 7331efe891a7..368864dfe6eb 100644
--- a/arch/x86/Kconfig.i386
+++ b/arch/x86/Kconfig
@@ -1,18 +1,24 @@
1# 1# x86 configuration
2# For a description of the syntax of this configuration file, 2mainmenu "Linux Kernel Configuration for x86"
3# see Documentation/kbuild/kconfig-language.txt.
4#
5 3
6mainmenu "Linux Kernel Configuration" 4# Select 32 or 64 bit
5config 64BIT
6 bool "64-bit kernel" if ARCH = "x86"
7 default ARCH = "x86_64"
8 help
9 Say yes to build a 64-bit kernel - formerly known as x86_64
10 Say no to build a 32-bit kernel - formerly known as i386
7 11
8config X86_32 12config X86_32
13 def_bool !64BIT
14
15config X86_64
16 def_bool 64BIT
17
18### Arch settings
19config X86
9 bool 20 bool
10 default y 21 default y
11 help
12 This is Linux's home port. Linux was originally native to the Intel
13 386, and runs on all the later x86 processors including the Intel
14 486, 586, Pentiums, and various instruction-set-compatible chips by
15 AMD, Cyrix, and others.
16 22
17config GENERIC_TIME 23config GENERIC_TIME
18 bool 24 bool
@@ -33,7 +39,7 @@ config GENERIC_CLOCKEVENTS
33config GENERIC_CLOCKEVENTS_BROADCAST 39config GENERIC_CLOCKEVENTS_BROADCAST
34 bool 40 bool
35 default y 41 default y
36 depends on X86_LOCAL_APIC 42 depends on X86_64 || (X86_32 && X86_LOCAL_APIC)
37 43
38config LOCKDEP_SUPPORT 44config LOCKDEP_SUPPORT
39 bool 45 bool
@@ -47,10 +53,6 @@ config SEMAPHORE_SLEEPERS
47 bool 53 bool
48 default y 54 default y
49 55
50config X86
51 bool
52 default y
53
54config MMU 56config MMU
55 bool 57 bool
56 default y 58 default y
@@ -61,7 +63,7 @@ config ZONE_DMA
61 63
62config QUICKLIST 64config QUICKLIST
63 bool 65 bool
64 default y 66 default X86_32
65 67
66config SBUS 68config SBUS
67 bool 69 bool
@@ -91,6 +93,76 @@ config DMI
91 bool 93 bool
92 default y 94 default y
93 95
96config RWSEM_GENERIC_SPINLOCK
97 def_bool !X86_XADD
98
99config RWSEM_XCHGADD_ALGORITHM
100 def_bool X86_XADD
101
102config ARCH_HAS_ILOG2_U32
103 def_bool n
104
105config ARCH_HAS_ILOG2_U64
106 def_bool n
107
108config GENERIC_CALIBRATE_DELAY
109 def_bool y
110
111config GENERIC_TIME_VSYSCALL
112 bool
113 default X86_64
114
115
116
117
118
119config ZONE_DMA32
120 bool
121 default X86_64
122
123config ARCH_POPULATES_NODE_MAP
124 def_bool y
125
126config AUDIT_ARCH
127 bool
128 default X86_64
129
130# Use the generic interrupt handling code in kernel/irq/:
131config GENERIC_HARDIRQS
132 bool
133 default y
134
135config GENERIC_IRQ_PROBE
136 bool
137 default y
138
139config GENERIC_PENDING_IRQ
140 bool
141 depends on GENERIC_HARDIRQS && SMP
142 default y
143
144config X86_SMP
145 bool
146 depends on X86_32 && SMP && !X86_VOYAGER
147 default y
148
149config X86_HT
150 bool
151 depends on SMP && !(X86_VISWS || X86_VOYAGER || MK8)
152 default y
153
154config X86_BIOS_REBOOT
155 bool
156 depends on X86_32 && !(X86_VISWS || X86_VOYAGER)
157 default y
158
159config X86_TRAMPOLINE
160 bool
161 depends on X86_SMP || (X86_VOYAGER && SMP)
162 default y
163
164config KTIME_SCALAR
165 def_bool X86_32
94source "init/Kconfig" 166source "init/Kconfig"
95 167
96menu "Processor type and features" 168menu "Processor type and features"
@@ -137,6 +209,7 @@ config X86_PC
137 209
138config X86_ELAN 210config X86_ELAN
139 bool "AMD Elan" 211 bool "AMD Elan"
212 depends on X86_32
140 help 213 help
141 Select this for an AMD Elan processor. 214 Select this for an AMD Elan processor.
142 215
@@ -146,6 +219,7 @@ config X86_ELAN
146 219
147config X86_VOYAGER 220config X86_VOYAGER
148 bool "Voyager (NCR)" 221 bool "Voyager (NCR)"
222 depends on X86_32
149 select SMP if !BROKEN 223 select SMP if !BROKEN
150 help 224 help
151 Voyager is an MCA-based 32-way capable SMP architecture proprietary 225 Voyager is an MCA-based 32-way capable SMP architecture proprietary
@@ -160,6 +234,7 @@ config X86_NUMAQ
160 bool "NUMAQ (IBM/Sequent)" 234 bool "NUMAQ (IBM/Sequent)"
161 select SMP 235 select SMP
162 select NUMA 236 select NUMA
237 depends on X86_32
163 help 238 help
164 This option is used for getting Linux to run on a (IBM/Sequent) NUMA 239 This option is used for getting Linux to run on a (IBM/Sequent) NUMA
165 multiquad box. This changes the way that processors are bootstrapped, 240 multiquad box. This changes the way that processors are bootstrapped,
@@ -169,7 +244,7 @@ config X86_NUMAQ
169 244
170config X86_SUMMIT 245config X86_SUMMIT
171 bool "Summit/EXA (IBM x440)" 246 bool "Summit/EXA (IBM x440)"
172 depends on SMP 247 depends on X86_32 && SMP
173 help 248 help
174 This option is needed for IBM systems that use the Summit/EXA chipset. 249 This option is needed for IBM systems that use the Summit/EXA chipset.
175 In particular, it is needed for the x440. 250 In particular, it is needed for the x440.
@@ -179,7 +254,7 @@ config X86_SUMMIT
179 254
180config X86_BIGSMP 255config X86_BIGSMP
181 bool "Support for other sub-arch SMP systems with more than 8 CPUs" 256 bool "Support for other sub-arch SMP systems with more than 8 CPUs"
182 depends on SMP 257 depends on X86_32 && SMP
183 help 258 help
184 This option is needed for the systems that have more than 8 CPUs 259 This option is needed for the systems that have more than 8 CPUs
185 and if the system is not of any sub-arch type above. 260 and if the system is not of any sub-arch type above.
@@ -188,6 +263,7 @@ config X86_BIGSMP
188 263
189config X86_VISWS 264config X86_VISWS
190 bool "SGI 320/540 (Visual Workstation)" 265 bool "SGI 320/540 (Visual Workstation)"
266 depends on X86_32
191 help 267 help
192 The SGI Visual Workstation series is an IA32-based workstation 268 The SGI Visual Workstation series is an IA32-based workstation
193 based on SGI systems chips with some legacy PC hardware attached. 269 based on SGI systems chips with some legacy PC hardware attached.
@@ -199,6 +275,7 @@ config X86_VISWS
199 275
200config X86_GENERICARCH 276config X86_GENERICARCH
201 bool "Generic architecture (Summit, bigsmp, ES7000, default)" 277 bool "Generic architecture (Summit, bigsmp, ES7000, default)"
278 depends on X86_32
202 help 279 help
203 This option compiles in the Summit, bigsmp, ES7000, default subarchitectures. 280 This option compiles in the Summit, bigsmp, ES7000, default subarchitectures.
204 It is intended for a generic binary kernel. 281 It is intended for a generic binary kernel.
@@ -206,18 +283,27 @@ config X86_GENERICARCH
206 283
207config X86_ES7000 284config X86_ES7000
208 bool "Support for Unisys ES7000 IA32 series" 285 bool "Support for Unisys ES7000 IA32 series"
209 depends on SMP 286 depends on X86_32 && SMP
210 help 287 help
211 Support for Unisys ES7000 systems. Say 'Y' here if this kernel is 288 Support for Unisys ES7000 systems. Say 'Y' here if this kernel is
212 supposed to run on an IA32-based Unisys ES7000 system. 289 supposed to run on an IA32-based Unisys ES7000 system.
213 Only choose this option if you have such a system, otherwise you 290 Only choose this option if you have such a system, otherwise you
214 should say N here. 291 should say N here.
215 292
293config X86_VSMP
294 bool "Support for ScaleMP vSMP"
295 depends on X86_64 && PCI
296 help
297 Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is
298 supposed to run on these EM64T-based machines. Only choose this option
299 if you have one of these machines.
300
216endchoice 301endchoice
217 302
218config SCHED_NO_NO_OMIT_FRAME_POINTER 303config SCHED_NO_NO_OMIT_FRAME_POINTER
219 bool "Single-depth WCHAN output" 304 bool "Single-depth WCHAN output"
220 default y 305 default y
306 depends on X86_32
221 help 307 help
222 Calculate simpler /proc/<PID>/wchan values. If this option 308 Calculate simpler /proc/<PID>/wchan values. If this option
223 is disabled then wchan values will recurse back to the 309 is disabled then wchan values will recurse back to the
@@ -228,7 +314,7 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
228 314
229config PARAVIRT 315config PARAVIRT
230 bool 316 bool
231 depends on !(X86_VISWS || X86_VOYAGER) 317 depends on X86_32 && !(X86_VISWS || X86_VOYAGER)
232 help 318 help
233 This changes the kernel so it can modify itself when it is run 319 This changes the kernel so it can modify itself when it is run
234 under a hypervisor, potentially improving performance significantly 320 under a hypervisor, potentially improving performance significantly
@@ -237,6 +323,7 @@ config PARAVIRT
237 323
238menuconfig PARAVIRT_GUEST 324menuconfig PARAVIRT_GUEST
239 bool "Paravirtualized guest support" 325 bool "Paravirtualized guest support"
326 depends on X86_32
240 help 327 help
241 Say Y here to get to see options related to running Linux under 328 Say Y here to get to see options related to running Linux under
242 various hypervisors. This option alone does not add any kernel code. 329 various hypervisors. This option alone does not add any kernel code.
@@ -264,7 +351,7 @@ endif
264config ACPI_SRAT 351config ACPI_SRAT
265 bool 352 bool
266 default y 353 default y
267 depends on ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH) 354 depends on X86_32 && ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH)
268 select ACPI_NUMA 355 select ACPI_NUMA
269 356
270config HAVE_ARCH_PARSE_SRAT 357config HAVE_ARCH_PARSE_SRAT
@@ -275,12 +362,12 @@ config HAVE_ARCH_PARSE_SRAT
275config X86_SUMMIT_NUMA 362config X86_SUMMIT_NUMA
276 bool 363 bool
277 default y 364 default y
278 depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) 365 depends on X86_32 && NUMA && (X86_SUMMIT || X86_GENERICARCH)
279 366
280config X86_CYCLONE_TIMER 367config X86_CYCLONE_TIMER
281 bool 368 bool
282 default y 369 default y
283 depends on X86_SUMMIT || X86_GENERICARCH 370 depends on X86_32 && X86_SUMMIT || X86_GENERICARCH
284 371
285config ES7000_CLUSTERED_APIC 372config ES7000_CLUSTERED_APIC
286 bool 373 bool
@@ -290,21 +377,89 @@ config ES7000_CLUSTERED_APIC
290source "arch/x86/Kconfig.cpu" 377source "arch/x86/Kconfig.cpu"
291 378
292config HPET_TIMER 379config HPET_TIMER
293 bool "HPET Timer Support" 380 bool
381 prompt "HPET Timer Support" if X86_32
382 default X86_64
294 help 383 help
295 This enables the use of the HPET for the kernel's internal timer. 384 Use the IA-PC HPET (High Precision Event Timer) to manage
296 HPET is the next generation timer replacing legacy 8254s. 385 time in preference to the PIT and RTC, if a HPET is
297 You can safely choose Y here. However, HPET will only be 386 present.
298 activated if the platform and the BIOS support this feature. 387 HPET is the next generation timer replacing legacy 8254s.
299 Otherwise the 8254 will be used for timing services. 388 The HPET provides a stable time base on SMP
389 systems, unlike the TSC, but it is more expensive to access,
390 as it is off-chip. You can find the HPET spec at
391 <http://www.intel.com/hardwaredesign/hpetspec.htm>.
392
393 You can safely choose Y here. However, HPET will only be
394 activated if the platform and the BIOS support this feature.
395 Otherwise the 8254 will be used for timing services.
300 396
301 Choose N to continue using the legacy 8254 timer. 397 Choose N to continue using the legacy 8254 timer.
302 398
303config HPET_EMULATE_RTC 399config HPET_EMULATE_RTC
304 bool 400 bool
305 depends on HPET_TIMER && RTC=y 401 depends on HPET_TIMER && RTC=y
306 default y 402 default y
307 403
404# Mark as embedded because too many people got it wrong.
405# The code disables itself when not needed.
406config GART_IOMMU
407 bool "GART IOMMU support" if EMBEDDED
408 default y
409 select SWIOTLB
410 select AGP
411 depends on X86_64 && PCI
412 help
413 Support for full DMA access of devices with 32bit memory access only
414 on systems with more than 3GB. This is usually needed for USB,
415 sound, many IDE/SATA chipsets and some other devices.
416 Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART
417 based hardware IOMMU and a software bounce buffer based IOMMU used
418 on Intel systems and as fallback.
419 The code is only active when needed (enough memory and limited
420 device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified
421 too.
422
423config CALGARY_IOMMU
424 bool "IBM Calgary IOMMU support"
425 select SWIOTLB
426 depends on X86_64 && PCI && EXPERIMENTAL
427 help
428 Support for hardware IOMMUs in IBM's xSeries x366 and x460
429 systems. Needed to run systems with more than 3GB of memory
430 properly with 32-bit PCI devices that do not support DAC
431 (Double Address Cycle). Calgary also supports bus level
432 isolation, where all DMAs pass through the IOMMU. This
433 prevents them from going anywhere except their intended
434 destination. This catches hard-to-find kernel bugs and
435 mis-behaving drivers and devices that do not use the DMA-API
436 properly to set up their DMA buffers. The IOMMU can be
437 turned off at boot time with the iommu=off parameter.
438 Normally the kernel will make the right choice by itself.
439 If unsure, say Y.
440
441config CALGARY_IOMMU_ENABLED_BY_DEFAULT
442 bool "Should Calgary be enabled by default?"
443 default y
444 depends on CALGARY_IOMMU
445 help
446 Should Calgary be enabled by default? if you choose 'y', Calgary
447 will be used (if it exists). If you choose 'n', Calgary will not be
448 used even if it exists. If you choose 'n' and would like to use
449 Calgary anyway, pass 'iommu=calgary' on the kernel command line.
450 If unsure, say Y.
451
452# need this always selected by IOMMU for the VIA workaround
453config SWIOTLB
454 bool
455 help
456 Support for software bounce buffers used on x86-64 systems
457 which don't have a hardware IOMMU (e.g. the current generation
458 of Intel's x86-64 CPUs). Using this PCI devices which can only
459 access 32-bits of memory can be used on systems with more than
460 3 GB of memory. If unsure, say Y.
461
462
308config NR_CPUS 463config NR_CPUS
309 int "Maximum number of CPUs (2-255)" 464 int "Maximum number of CPUs (2-255)"
310 range 2 255 465 range 2 255
@@ -321,7 +476,7 @@ config NR_CPUS
321 476
322config SCHED_SMT 477config SCHED_SMT
323 bool "SMT (Hyperthreading) scheduler support" 478 bool "SMT (Hyperthreading) scheduler support"
324 depends on X86_HT 479 depends on (X86_64 && SMP) || (X86_32 && X86_HT)
325 help 480 help
326 SMT scheduler support improves the CPU scheduler's decision making 481 SMT scheduler support improves the CPU scheduler's decision making
327 when dealing with Intel Pentium 4 chips with HyperThreading at a 482 when dealing with Intel Pentium 4 chips with HyperThreading at a
@@ -330,7 +485,7 @@ config SCHED_SMT
330 485
331config SCHED_MC 486config SCHED_MC
332 bool "Multi-core scheduler support" 487 bool "Multi-core scheduler support"
333 depends on X86_HT 488 depends on (X86_64 && SMP) || (X86_32 && X86_HT)
334 default y 489 default y
335 help 490 help
336 Multi-core scheduler support improves the CPU scheduler's decision 491 Multi-core scheduler support improves the CPU scheduler's decision
@@ -341,7 +496,7 @@ source "kernel/Kconfig.preempt"
341 496
342config X86_UP_APIC 497config X86_UP_APIC
343 bool "Local APIC support on uniprocessors" 498 bool "Local APIC support on uniprocessors"
344 depends on !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH) 499 depends on X86_32 && !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH)
345 help 500 help
346 A local APIC (Advanced Programmable Interrupt Controller) is an 501 A local APIC (Advanced Programmable Interrupt Controller) is an
347 integrated interrupt controller in the CPU. If you have a single-CPU 502 integrated interrupt controller in the CPU. If you have a single-CPU
@@ -366,17 +521,17 @@ config X86_UP_IOAPIC
366 521
367config X86_LOCAL_APIC 522config X86_LOCAL_APIC
368 bool 523 bool
369 depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH 524 depends on X86_64 || (X86_32 && (X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH))
370 default y 525 default y
371 526
372config X86_IO_APIC 527config X86_IO_APIC
373 bool 528 bool
374 depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH 529 depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH))
375 default y 530 default y
376 531
377config X86_VISWS_APIC 532config X86_VISWS_APIC
378 bool 533 bool
379 depends on X86_VISWS 534 depends on X86_32 && X86_VISWS
380 default y 535 default y
381 536
382config X86_MCE 537config X86_MCE
@@ -396,9 +551,25 @@ config X86_MCE
396 to disable it. MCE support simply ignores non-MCE processors like 551 to disable it. MCE support simply ignores non-MCE processors like
397 the 386 and 486, so nearly everyone can say Y here. 552 the 386 and 486, so nearly everyone can say Y here.
398 553
554config X86_MCE_INTEL
555 bool "Intel MCE features"
556 depends on X86_64 && X86_MCE && X86_LOCAL_APIC
557 default y
558 help
559 Additional support for intel specific MCE features such as
560 the thermal monitor.
561
562config X86_MCE_AMD
563 bool "AMD MCE features"
564 depends on X86_64 && X86_MCE && X86_LOCAL_APIC
565 default y
566 help
567 Additional support for AMD specific MCE features such as
568 the DRAM Error Threshold.
569
399config X86_MCE_NONFATAL 570config X86_MCE_NONFATAL
400 tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4" 571 tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4"
401 depends on X86_MCE 572 depends on X86_32 && X86_MCE
402 help 573 help
403 Enabling this feature starts a timer that triggers every 5 seconds which 574 Enabling this feature starts a timer that triggers every 5 seconds which
404 will look at the machine check registers to see if anything happened. 575 will look at the machine check registers to see if anything happened.
@@ -411,14 +582,15 @@ config X86_MCE_NONFATAL
411 582
412config X86_MCE_P4THERMAL 583config X86_MCE_P4THERMAL
413 bool "check for P4 thermal throttling interrupt." 584 bool "check for P4 thermal throttling interrupt."
414 depends on X86_MCE && (X86_UP_APIC || SMP) && !X86_VISWS 585 depends on X86_32 && X86_MCE && (X86_UP_APIC || SMP) && !X86_VISWS
415 help 586 help
416 Enabling this feature will cause a message to be printed when the P4 587 Enabling this feature will cause a message to be printed when the P4
417 enters thermal throttling. 588 enters thermal throttling.
418 589
419config VM86 590config VM86
420 default y
421 bool "Enable VM86 support" if EMBEDDED 591 bool "Enable VM86 support" if EMBEDDED
592 default y
593 depends on X86_32
422 help 594 help
423 This option is required by programs like DOSEMU to run 16-bit legacy 595 This option is required by programs like DOSEMU to run 16-bit legacy
424 code on X86 processors. It also may be needed by software like 596 code on X86 processors. It also may be needed by software like
@@ -427,6 +599,7 @@ config VM86
427 599
428config TOSHIBA 600config TOSHIBA
429 tristate "Toshiba Laptop support" 601 tristate "Toshiba Laptop support"
602 depends on X86_32
430 ---help--- 603 ---help---
431 This adds a driver to safely access the System Management Mode of 604 This adds a driver to safely access the System Management Mode of
432 the CPU on Toshiba portables with a genuine Toshiba BIOS. It does 605 the CPU on Toshiba portables with a genuine Toshiba BIOS. It does
@@ -442,6 +615,7 @@ config TOSHIBA
442 615
443config I8K 616config I8K
444 tristate "Dell laptop support" 617 tristate "Dell laptop support"
618 depends on X86_32
445 ---help--- 619 ---help---
446 This adds a driver to safely access the System Management Mode 620 This adds a driver to safely access the System Management Mode
447 of the CPU on the Dell Inspiron 8000. The System Management Mode 621 of the CPU on the Dell Inspiron 8000. The System Management Mode
@@ -462,7 +636,7 @@ config I8K
462 636
463config X86_REBOOTFIXUPS 637config X86_REBOOTFIXUPS
464 bool "Enable X86 board specific fixups for reboot" 638 bool "Enable X86 board specific fixups for reboot"
465 depends on X86 639 depends on X86_32 && X86
466 default n 640 default n
467 ---help--- 641 ---help---
468 This enables chipset and/or board specific fixups to be done 642 This enables chipset and/or board specific fixups to be done
@@ -517,12 +691,11 @@ config X86_CPUID
517 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to 691 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
518 /dev/cpu/31/cpuid. 692 /dev/cpu/31/cpuid.
519 693
520source "drivers/firmware/Kconfig"
521
522choice 694choice
523 prompt "High Memory Support" 695 prompt "High Memory Support"
524 default HIGHMEM4G if !X86_NUMAQ 696 default HIGHMEM4G if !X86_NUMAQ
525 default HIGHMEM64G if X86_NUMAQ 697 default HIGHMEM64G if X86_NUMAQ
698 depends on X86_32
526 699
527config NOHIGHMEM 700config NOHIGHMEM
528 bool "off" 701 bool "off"
@@ -582,6 +755,7 @@ choice
582 depends on EXPERIMENTAL 755 depends on EXPERIMENTAL
583 prompt "Memory split" if EMBEDDED 756 prompt "Memory split" if EMBEDDED
584 default VMSPLIT_3G 757 default VMSPLIT_3G
758 depends on X86_32
585 help 759 help
586 Select the desired split between kernel and user memory. 760 Select the desired split between kernel and user memory.
587 761
@@ -619,16 +793,17 @@ config PAGE_OFFSET
619 default 0x78000000 if VMSPLIT_2G_OPT 793 default 0x78000000 if VMSPLIT_2G_OPT
620 default 0x40000000 if VMSPLIT_1G 794 default 0x40000000 if VMSPLIT_1G
621 default 0xC0000000 795 default 0xC0000000
796 depends on X86_32
622 797
623config HIGHMEM 798config HIGHMEM
624 bool 799 bool
625 depends on HIGHMEM64G || HIGHMEM4G 800 depends on X86_32 && (HIGHMEM64G || HIGHMEM4G)
626 default y 801 default y
627 802
628config X86_PAE 803config X86_PAE
629 bool "PAE (Physical Address Extension) Support" 804 bool "PAE (Physical Address Extension) Support"
630 default n 805 default n
631 depends on !HIGHMEM4G 806 depends on X86_32 && !HIGHMEM4G
632 select RESOURCES_64BIT 807 select RESOURCES_64BIT
633 help 808 help
634 PAE is required for NX support, and furthermore enables 809 PAE is required for NX support, and furthermore enables
@@ -639,46 +814,82 @@ config X86_PAE
639# Common NUMA Features 814# Common NUMA Features
640config NUMA 815config NUMA
641 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)" 816 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
642 depends on SMP && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL 817 depends on SMP
818 depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL)
643 default n if X86_PC 819 default n if X86_PC
644 default y if (X86_NUMAQ || X86_SUMMIT) 820 default y if (X86_NUMAQ || X86_SUMMIT)
645 help 821 help
646 NUMA support for i386. This is currently highly experimental 822 Enable NUMA (Non Uniform Memory Access) support.
647 and should be only used for kernel development. It might also 823 The kernel will try to allocate memory used by a CPU on the
648 cause boot failures. 824 local memory controller of the CPU and add some more
825 NUMA awareness to the kernel.
826
827 For i386 this is currently highly experimental and should be only
828 used for kernel development. It might also cause boot failures.
829 For x86_64 this is recommended on all multiprocessor Opteron systems.
830 If the system is EM64T, you should say N unless your system is
831 EM64T NUMA.
649 832
650comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" 833comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI"
651 depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI) 834 depends on X86_32 && X86_SUMMIT && (!HIGHMEM64G || !ACPI)
835
836config K8_NUMA
837 bool "Old style AMD Opteron NUMA detection"
838 depends on X86_64 && NUMA && PCI
839 default y
840 help
841 Enable K8 NUMA node topology detection. You should say Y here if
842 you have a multi processor AMD K8 system. This uses an old
843 method to read the NUMA configuration directly from the builtin
844 Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA
845 instead, which also takes priority if both are compiled in.
846
847config X86_64_ACPI_NUMA
848 bool "ACPI NUMA detection"
849 depends on X86_64 && NUMA && ACPI && PCI
850 select ACPI_NUMA
851 default y
852 help
853 Enable ACPI SRAT based node topology detection.
854
855config NUMA_EMU
856 bool "NUMA emulation"
857 depends on X86_64 && NUMA
858 help
859 Enable NUMA emulation. A flat machine will be split
860 into virtual nodes when booted with "numa=fake=N", where N is the
861 number of nodes. This is only useful for debugging.
652 862
653config NODES_SHIFT 863config NODES_SHIFT
654 int 864 int
865 default "6" if X86_64
655 default "4" if X86_NUMAQ 866 default "4" if X86_NUMAQ
656 default "3" 867 default "3"
657 depends on NEED_MULTIPLE_NODES 868 depends on NEED_MULTIPLE_NODES
658 869
659config HAVE_ARCH_BOOTMEM_NODE 870config HAVE_ARCH_BOOTMEM_NODE
660 bool 871 bool
661 depends on NUMA 872 depends on X86_32 && NUMA
662 default y 873 default y
663 874
664config ARCH_HAVE_MEMORY_PRESENT 875config ARCH_HAVE_MEMORY_PRESENT
665 bool 876 bool
666 depends on DISCONTIGMEM 877 depends on X86_32 && DISCONTIGMEM
667 default y 878 default y
668 879
669config NEED_NODE_MEMMAP_SIZE 880config NEED_NODE_MEMMAP_SIZE
670 bool 881 bool
671 depends on DISCONTIGMEM || SPARSEMEM 882 depends on X86_32 && (DISCONTIGMEM || SPARSEMEM)
672 default y 883 default y
673 884
674config HAVE_ARCH_ALLOC_REMAP 885config HAVE_ARCH_ALLOC_REMAP
675 bool 886 bool
676 depends on NUMA 887 depends on X86_32 && NUMA
677 default y 888 default y
678 889
679config ARCH_FLATMEM_ENABLE 890config ARCH_FLATMEM_ENABLE
680 def_bool y 891 def_bool y
681 depends on (ARCH_SELECT_MEMORY_MODEL && X86_PC) 892 depends on (X86_32 && ARCH_SELECT_MEMORY_MODEL && X86_PC) || (X86_64 && !NUMA)
682 893
683config ARCH_DISCONTIGMEM_ENABLE 894config ARCH_DISCONTIGMEM_ENABLE
684 def_bool y 895 def_bool y
@@ -690,21 +901,23 @@ config ARCH_DISCONTIGMEM_DEFAULT
690 901
691config ARCH_SPARSEMEM_ENABLE 902config ARCH_SPARSEMEM_ENABLE
692 def_bool y 903 def_bool y
693 depends on (NUMA || (X86_PC && EXPERIMENTAL)) 904 depends on NUMA || (EXPERIMENTAL && (X86_PC || X86_64))
694 select SPARSEMEM_STATIC 905 select SPARSEMEM_STATIC if X86_32
906 select SPARSEMEM_VMEMMAP_ENABLE if X86_64
695 907
696config ARCH_SELECT_MEMORY_MODEL 908config ARCH_SELECT_MEMORY_MODEL
697 def_bool y 909 def_bool y
698 depends on ARCH_SPARSEMEM_ENABLE 910 depends on X86_32 && ARCH_SPARSEMEM_ENABLE
699 911
700config ARCH_POPULATES_NODE_MAP 912config ARCH_MEMORY_PROBE
701 def_bool y 913 def_bool X86_64
914 depends on MEMORY_HOTPLUG
702 915
703source "mm/Kconfig" 916source "mm/Kconfig"
704 917
705config HIGHPTE 918config HIGHPTE
706 bool "Allocate 3rd-level pagetables from highmem" 919 bool "Allocate 3rd-level pagetables from highmem"
707 depends on HIGHMEM4G || HIGHMEM64G 920 depends on X86_32 && (HIGHMEM4G || HIGHMEM64G)
708 help 921 help
709 The VM uses one page table entry for each page of physical memory. 922 The VM uses one page table entry for each page of physical memory.
710 For systems with a lot of RAM, this can be wasteful of precious 923 For systems with a lot of RAM, this can be wasteful of precious
@@ -712,7 +925,8 @@ config HIGHPTE
712 entries in high memory. 925 entries in high memory.
713 926
714config MATH_EMULATION 927config MATH_EMULATION
715 bool "Math emulation" 928 bool
929 prompt "Math emulation" if X86_32
716 ---help--- 930 ---help---
717 Linux can emulate a math coprocessor (used for floating point 931 Linux can emulate a math coprocessor (used for floating point
718 operations) if you don't have one. 486DX and Pentium processors have 932 operations) if you don't have one. 486DX and Pentium processors have
@@ -772,7 +986,7 @@ config MTRR
772 986
773config EFI 987config EFI
774 bool "Boot from EFI support" 988 bool "Boot from EFI support"
775 depends on ACPI 989 depends on X86_32 && ACPI
776 default n 990 default n
777 ---help--- 991 ---help---
778 This enables the kernel to boot on EFI platforms using 992 This enables the kernel to boot on EFI platforms using
@@ -789,18 +1003,18 @@ config EFI
789 kernel should continue to boot on existing non-EFI platforms. 1003 kernel should continue to boot on existing non-EFI platforms.
790 1004
791config IRQBALANCE 1005config IRQBALANCE
792 bool "Enable kernel irq balancing" 1006 bool "Enable kernel irq balancing"
793 depends on SMP && X86_IO_APIC 1007 depends on X86_32 && SMP && X86_IO_APIC
794 default y 1008 default y
795 help 1009 help
796 The default yes will allow the kernel to do irq load balancing. 1010 The default yes will allow the kernel to do irq load balancing.
797 Saying no will keep the kernel from doing irq load balancing. 1011 Saying no will keep the kernel from doing irq load balancing.
798 1012
799# turning this on wastes a bunch of space. 1013# turning this on wastes a bunch of space.
800# Summit needs it only when NUMA is on 1014# Summit needs it only when NUMA is on
801config BOOT_IOREMAP 1015config BOOT_IOREMAP
802 bool 1016 bool
803 depends on (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI)) 1017 depends on X86_32 && (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI))
804 default y 1018 default y
805 1019
806config SECCOMP 1020config SECCOMP
@@ -820,6 +1034,30 @@ config SECCOMP
820 1034
821 If unsure, say Y. Only embedded should say N here. 1035 If unsure, say Y. Only embedded should say N here.
822 1036
1037config CC_STACKPROTECTOR
1038 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
1039 depends on X86_64 && EXPERIMENTAL
1040 help
1041 This option turns on the -fstack-protector GCC feature. This
1042 feature puts, at the beginning of critical functions, a canary
1043 value on the stack just before the return address, and validates
1044 the value just before actually returning. Stack based buffer
1045 overflows (that need to overwrite this return address) now also
1046 overwrite the canary, which gets detected and the attack is then
1047 neutralized via a kernel panic.
1048
1049 This feature requires gcc version 4.2 or above, or a distribution
1050 gcc with the feature backported. Older versions are automatically
1051 detected and for those versions, this configuration option is ignored.
1052
1053config CC_STACKPROTECTOR_ALL
1054 bool "Use stack-protector for all functions"
1055 depends on CC_STACKPROTECTOR
1056 help
1057 Normally, GCC only inserts the canary value protection for
1058 functions that use large-ish on-stack buffers. By enabling
1059 this option, GCC will be asked to do this for ALL functions.
1060
823source kernel/Kconfig.hz 1061source kernel/Kconfig.hz
824 1062
825config KEXEC 1063config KEXEC
@@ -841,7 +1079,7 @@ config KEXEC
841config CRASH_DUMP 1079config CRASH_DUMP
842 bool "kernel crash dumps (EXPERIMENTAL)" 1080 bool "kernel crash dumps (EXPERIMENTAL)"
843 depends on EXPERIMENTAL 1081 depends on EXPERIMENTAL
844 depends on HIGHMEM 1082 depends on X86_64 || (X86_32 && HIGHMEM)
845 help 1083 help
846 Generate crash dump after being started by kexec. 1084 Generate crash dump after being started by kexec.
847 This should be normally only set in special crash dump kernels 1085 This should be normally only set in special crash dump kernels
@@ -856,6 +1094,7 @@ config CRASH_DUMP
856config PHYSICAL_START 1094config PHYSICAL_START
857 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) 1095 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
858 default "0x1000000" if X86_NUMAQ 1096 default "0x1000000" if X86_NUMAQ
1097 default "0x200000" if X86_64
859 default "0x100000" 1098 default "0x100000"
860 help 1099 help
861 This gives the physical address where the kernel is loaded. 1100 This gives the physical address where the kernel is loaded.
@@ -908,25 +1147,31 @@ config RELOCATABLE
908 must live at a different physical address than the primary 1147 must live at a different physical address than the primary
909 kernel. 1148 kernel.
910 1149
1150 Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
1151 it has been loaded at and the compile time physical address
1152 (CONFIG_PHYSICAL_START) is ignored.
1153
911config PHYSICAL_ALIGN 1154config PHYSICAL_ALIGN
912 hex "Alignment value to which kernel should be aligned" 1155 hex
913 default "0x100000" 1156 prompt "Alignment value to which kernel should be aligned" if X86_32
1157 default "0x100000" if X86_32
1158 default "0x200000" if X86_64
914 range 0x2000 0x400000 1159 range 0x2000 0x400000
915 help 1160 help
916 This value puts the alignment restrictions on physical address 1161 This value puts the alignment restrictions on physical address
917 where kernel is loaded and run from. Kernel is compiled for an 1162 where kernel is loaded and run from. Kernel is compiled for an
918 address which meets above alignment restriction. 1163 address which meets above alignment restriction.
919 1164
920 If bootloader loads the kernel at a non-aligned address and 1165 If bootloader loads the kernel at a non-aligned address and
921 CONFIG_RELOCATABLE is set, kernel will move itself to nearest 1166 CONFIG_RELOCATABLE is set, kernel will move itself to nearest
922 address aligned to above value and run from there. 1167 address aligned to above value and run from there.
923 1168
924 If bootloader loads the kernel at a non-aligned address and 1169 If bootloader loads the kernel at a non-aligned address and
925 CONFIG_RELOCATABLE is not set, kernel will ignore the run time 1170 CONFIG_RELOCATABLE is not set, kernel will ignore the run time
926 load address and decompress itself to the address it has been 1171 load address and decompress itself to the address it has been
927 compiled for and run from there. The address for which kernel is 1172 compiled for and run from there. The address for which kernel is
928 compiled already meets above alignment restrictions. Hence the 1173 compiled already meets above alignment restrictions. Hence the
929 end result is that kernel runs from a physical address meeting 1174 end result is that kernel runs from a physical address meeting
930 above alignment restrictions. 1175 above alignment restrictions.
931 1176
932 Don't change this unless you know what you are doing. 1177 Don't change this unless you know what you are doing.
@@ -938,10 +1183,13 @@ config HOTPLUG_CPU
938 Say Y here to experiment with turning CPUs off and on, and to 1183 Say Y here to experiment with turning CPUs off and on, and to
939 enable suspend on SMP systems. CPUs can be controlled through 1184 enable suspend on SMP systems. CPUs can be controlled through
940 /sys/devices/system/cpu. 1185 /sys/devices/system/cpu.
1186 Say N if you want to disable CPU hotplug and don't need to
1187 suspend.
941 1188
942config COMPAT_VDSO 1189config COMPAT_VDSO
943 bool "Compat VDSO support" 1190 bool "Compat VDSO support"
944 default y 1191 default y
1192 depends on X86_32
945 help 1193 help
946 Map the VDSO to the predictable old-style address too. 1194 Map the VDSO to the predictable old-style address too.
947 ---help--- 1195 ---help---
@@ -955,18 +1203,35 @@ endmenu
955 1203
956config ARCH_ENABLE_MEMORY_HOTPLUG 1204config ARCH_ENABLE_MEMORY_HOTPLUG
957 def_bool y 1205 def_bool y
958 depends on HIGHMEM 1206 depends on X86_64 || (X86_32 && HIGHMEM)
1207
1208config MEMORY_HOTPLUG_RESERVE
1209 def_bool X86_64
1210 depends on (MEMORY_HOTPLUG && DISCONTIGMEM)
1211
1212config HAVE_ARCH_EARLY_PFN_TO_NID
1213 def_bool X86_64
1214 depends on NUMA
959 1215
960menu "Power management options (ACPI, APM)" 1216config OUT_OF_LINE_PFN_TO_PAGE
1217 def_bool X86_64
1218 depends on DISCONTIGMEM
1219
1220menu "Power management options"
961 depends on !X86_VOYAGER 1221 depends on !X86_VOYAGER
962 1222
963source kernel/power/Kconfig 1223config ARCH_HIBERNATION_HEADER
1224 bool
1225 depends on X86_64 && HIBERNATION
1226 default y
1227
1228source "kernel/power/Kconfig"
964 1229
965source "drivers/acpi/Kconfig" 1230source "drivers/acpi/Kconfig"
966 1231
967menuconfig APM 1232menuconfig APM
968 tristate "APM (Advanced Power Management) BIOS support" 1233 tristate "APM (Advanced Power Management) BIOS support"
969 depends on PM_SLEEP && !X86_VISWS 1234 depends on X86_32 && PM_SLEEP && !X86_VISWS
970 ---help--- 1235 ---help---
971 APM is a BIOS specification for saving power using several different 1236 APM is a BIOS specification for saving power using several different
972 techniques. This is mostly useful for battery powered laptops with 1237 techniques. This is mostly useful for battery powered laptops with
@@ -1092,13 +1357,14 @@ config APM_REAL_MODE_POWER_OFF
1092 1357
1093endif # APM 1358endif # APM
1094 1359
1095source "arch/x86/kernel/cpu/cpufreq/Kconfig_32" 1360source "arch/x86/kernel/cpu/cpufreq/Kconfig"
1096 1361
1097source "drivers/cpuidle/Kconfig" 1362source "drivers/cpuidle/Kconfig"
1098 1363
1099endmenu 1364endmenu
1100 1365
1101menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" 1366
1367menu "Bus options (PCI etc.)"
1102 1368
1103config PCI 1369config PCI
1104 bool "PCI support" if !X86_VISWS 1370 bool "PCI support" if !X86_VISWS
@@ -1118,7 +1384,7 @@ config PCI
1118 1384
1119choice 1385choice
1120 prompt "PCI access mode" 1386 prompt "PCI access mode"
1121 depends on PCI && !X86_VISWS 1387 depends on X86_32 && PCI && !X86_VISWS
1122 default PCI_GOANY 1388 default PCI_GOANY
1123 ---help--- 1389 ---help---
1124 On PCI systems, the BIOS can be used to detect the PCI devices and 1390 On PCI systems, the BIOS can be used to detect the PCI devices and
@@ -1151,17 +1417,18 @@ endchoice
1151 1417
1152config PCI_BIOS 1418config PCI_BIOS
1153 bool 1419 bool
1154 depends on !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY) 1420 depends on X86_32 && !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY)
1155 default y 1421 default y
1156 1422
1423# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
1157config PCI_DIRECT 1424config PCI_DIRECT
1158 bool 1425 bool
1159 depends on PCI && ((PCI_GODIRECT || PCI_GOANY) || X86_VISWS) 1426 depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY) || X86_VISWS)
1160 default y 1427 default y
1161 1428
1162config PCI_MMCONFIG 1429config PCI_MMCONFIG
1163 bool 1430 bool
1164 depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) 1431 depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
1165 default y 1432 default y
1166 1433
1167config PCI_DOMAINS 1434config PCI_DOMAINS
@@ -1169,14 +1436,52 @@ config PCI_DOMAINS
1169 depends on PCI 1436 depends on PCI
1170 default y 1437 default y
1171 1438
1439config PCI_MMCONFIG
1440 bool "Support mmconfig PCI config space access"
1441 depends on X86_64 && PCI && ACPI
1442
1443config DMAR
1444 bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
1445 depends on X86_64 && PCI_MSI && ACPI && EXPERIMENTAL
1446 help
1447 DMA remapping (DMAR) devices support enables independent address
1448 translations for Direct Memory Access (DMA) from devices.
1449 These DMA remapping devices are reported via ACPI tables
1450 and include PCI device scope covered by these DMA
1451 remapping devices.
1452
1453config DMAR_GFX_WA
1454 bool "Support for Graphics workaround"
1455 depends on DMAR
1456 default y
1457 help
1458 Current Graphics drivers tend to use physical address
1459 for DMA and avoid using DMA APIs. Setting this config
1460 option permits the IOMMU driver to set a unity map for
1461 all the OS-visible memory. Hence the driver can continue
1462 to use physical addresses for DMA.
1463
1464config DMAR_FLOPPY_WA
1465 bool
1466 depends on DMAR
1467 default y
1468 help
1469 Floppy disk drivers are know to bypass DMA API calls
1470 thereby failing to work when IOMMU is enabled. This
1471 workaround will setup a 1:1 mapping for the first
1472 16M to make floppy (an ISA device) work.
1473
1172source "drivers/pci/pcie/Kconfig" 1474source "drivers/pci/pcie/Kconfig"
1173 1475
1174source "drivers/pci/Kconfig" 1476source "drivers/pci/Kconfig"
1175 1477
1478# x86_64 have no ISA slots, but do have ISA-style DMA.
1176config ISA_DMA_API 1479config ISA_DMA_API
1177 bool 1480 bool
1178 default y 1481 default y
1179 1482
1483if X86_32
1484
1180config ISA 1485config ISA
1181 bool "ISA support" 1486 bool "ISA support"
1182 depends on !(X86_VOYAGER || X86_VISWS) 1487 depends on !(X86_VOYAGER || X86_VISWS)
@@ -1248,9 +1553,11 @@ config GEODE_MFGPT_TIMER
1248 MFGPTs have a better resolution and max interval than the 1553 MFGPTs have a better resolution and max interval than the
1249 generic PIT, and are suitable for use as high-res timers. 1554 generic PIT, and are suitable for use as high-res timers.
1250 1555
1556endif # X86_32
1557
1251config K8_NB 1558config K8_NB
1252 def_bool y 1559 def_bool y
1253 depends on AGP_AMD64 1560 depends on AGP_AMD64 || (X86_64 && (GART_IOMMU || (PCI && NUMA)))
1254 1561
1255source "drivers/pcmcia/Kconfig" 1562source "drivers/pcmcia/Kconfig"
1256 1563
@@ -1258,16 +1565,48 @@ source "drivers/pci/hotplug/Kconfig"
1258 1565
1259endmenu 1566endmenu
1260 1567
1261menu "Executable file formats" 1568
1569menu "Executable file formats / Emulations"
1262 1570
1263source "fs/Kconfig.binfmt" 1571source "fs/Kconfig.binfmt"
1264 1572
1573config IA32_EMULATION
1574 bool "IA32 Emulation"
1575 depends on X86_64
1576 help
1577 Include code to run 32-bit programs under a 64-bit kernel. You should
1578 likely turn this on, unless you're 100% sure that you don't have any
1579 32-bit programs left.
1580
1581config IA32_AOUT
1582 tristate "IA32 a.out support"
1583 depends on IA32_EMULATION
1584 help
1585 Support old a.out binaries in the 32bit emulation.
1586
1587config COMPAT
1588 bool
1589 depends on IA32_EMULATION
1590 default y
1591
1592config COMPAT_FOR_U64_ALIGNMENT
1593 def_bool COMPAT
1594 depends on X86_64
1595
1596config SYSVIPC_COMPAT
1597 bool
1598 depends on X86_64 && COMPAT && SYSVIPC
1599 default y
1600
1265endmenu 1601endmenu
1266 1602
1603
1267source "net/Kconfig" 1604source "net/Kconfig"
1268 1605
1269source "drivers/Kconfig" 1606source "drivers/Kconfig"
1270 1607
1608source "drivers/firmware/Kconfig"
1609
1271source "fs/Kconfig" 1610source "fs/Kconfig"
1272 1611
1273source "kernel/Kconfig.instrumentation" 1612source "kernel/Kconfig.instrumentation"
@@ -1279,43 +1618,3 @@ source "security/Kconfig"
1279source "crypto/Kconfig" 1618source "crypto/Kconfig"
1280 1619
1281source "lib/Kconfig" 1620source "lib/Kconfig"
1282
1283#
1284# Use the generic interrupt handling code in kernel/irq/:
1285#
1286config GENERIC_HARDIRQS
1287 bool
1288 default y
1289
1290config GENERIC_IRQ_PROBE
1291 bool
1292 default y
1293
1294config GENERIC_PENDING_IRQ
1295 bool
1296 depends on GENERIC_HARDIRQS && SMP
1297 default y
1298
1299config X86_SMP
1300 bool
1301 depends on SMP && !X86_VOYAGER
1302 default y
1303
1304config X86_HT
1305 bool
1306 depends on SMP && !(X86_VISWS || X86_VOYAGER)
1307 default y
1308
1309config X86_BIOS_REBOOT
1310 bool
1311 depends on !(X86_VISWS || X86_VOYAGER)
1312 default y
1313
1314config X86_TRAMPOLINE
1315 bool
1316 depends on X86_SMP || (X86_VOYAGER && SMP)
1317 default y
1318
1319config KTIME_SCALAR
1320 bool
1321 default y
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 0e2adadf5905..c30162202dc4 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -3,11 +3,12 @@ if !X86_ELAN
3 3
4choice 4choice
5 prompt "Processor family" 5 prompt "Processor family"
6 default M686 6 default M686 if X86_32
7 default GENERIC_CPU if X86_64
7 8
8config M386 9config M386
9 bool "386" 10 bool "386"
10 depends on !UML 11 depends on X86_32 && !UML
11 ---help--- 12 ---help---
12 This is the processor type of your CPU. This information is used for 13 This is the processor type of your CPU. This information is used for
13 optimizing purposes. In order to compile a kernel that can run on 14 optimizing purposes. In order to compile a kernel that can run on
@@ -49,6 +50,7 @@ config M386
49 50
50config M486 51config M486
51 bool "486" 52 bool "486"
53 depends on X86_32
52 help 54 help
53 Select this for a 486 series processor, either Intel or one of the 55 Select this for a 486 series processor, either Intel or one of the
54 compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX, 56 compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX,
@@ -57,6 +59,7 @@ config M486
57 59
58config M586 60config M586
59 bool "586/K5/5x86/6x86/6x86MX" 61 bool "586/K5/5x86/6x86/6x86MX"
62 depends on X86_32
60 help 63 help
61 Select this for an 586 or 686 series processor such as the AMD K5, 64 Select this for an 586 or 686 series processor such as the AMD K5,
62 the Cyrix 5x86, 6x86 and 6x86MX. This choice does not 65 the Cyrix 5x86, 6x86 and 6x86MX. This choice does not
@@ -64,18 +67,21 @@ config M586
64 67
65config M586TSC 68config M586TSC
66 bool "Pentium-Classic" 69 bool "Pentium-Classic"
70 depends on X86_32
67 help 71 help
68 Select this for a Pentium Classic processor with the RDTSC (Read 72 Select this for a Pentium Classic processor with the RDTSC (Read
69 Time Stamp Counter) instruction for benchmarking. 73 Time Stamp Counter) instruction for benchmarking.
70 74
71config M586MMX 75config M586MMX
72 bool "Pentium-MMX" 76 bool "Pentium-MMX"
77 depends on X86_32
73 help 78 help
74 Select this for a Pentium with the MMX graphics/multimedia 79 Select this for a Pentium with the MMX graphics/multimedia
75 extended instructions. 80 extended instructions.
76 81
77config M686 82config M686
78 bool "Pentium-Pro" 83 bool "Pentium-Pro"
84 depends on X86_32
79 help 85 help
80 Select this for Intel Pentium Pro chips. This enables the use of 86 Select this for Intel Pentium Pro chips. This enables the use of
81 Pentium Pro extended instructions, and disables the init-time guard 87 Pentium Pro extended instructions, and disables the init-time guard
@@ -83,6 +89,7 @@ config M686
83 89
84config MPENTIUMII 90config MPENTIUMII
85 bool "Pentium-II/Celeron(pre-Coppermine)" 91 bool "Pentium-II/Celeron(pre-Coppermine)"
92 depends on X86_32
86 help 93 help
87 Select this for Intel chips based on the Pentium-II and 94 Select this for Intel chips based on the Pentium-II and
88 pre-Coppermine Celeron core. This option enables an unaligned 95 pre-Coppermine Celeron core. This option enables an unaligned
@@ -92,6 +99,7 @@ config MPENTIUMII
92 99
93config MPENTIUMIII 100config MPENTIUMIII
94 bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon" 101 bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon"
102 depends on X86_32
95 help 103 help
96 Select this for Intel chips based on the Pentium-III and 104 Select this for Intel chips based on the Pentium-III and
97 Celeron-Coppermine core. This option enables use of some 105 Celeron-Coppermine core. This option enables use of some
@@ -100,19 +108,14 @@ config MPENTIUMIII
100 108
101config MPENTIUMM 109config MPENTIUMM
102 bool "Pentium M" 110 bool "Pentium M"
111 depends on X86_32
103 help 112 help
104 Select this for Intel Pentium M (not Pentium-4 M) 113 Select this for Intel Pentium M (not Pentium-4 M)
105 notebook chips. 114 notebook chips.
106 115
107config MCORE2
108 bool "Core 2/newer Xeon"
109 help
110 Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx)
111 CPUs. You can distinguish newer from older Xeons by the CPU family
112 in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo)
113
114config MPENTIUM4 116config MPENTIUM4
115 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" 117 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon"
118 depends on X86_32
116 help 119 help
117 Select this for Intel Pentium 4 chips. This includes the 120 Select this for Intel Pentium 4 chips. This includes the
118 Pentium 4, Pentium D, P4-based Celeron and Xeon, and 121 Pentium 4, Pentium D, P4-based Celeron and Xeon, and
@@ -148,6 +151,7 @@ config MPENTIUM4
148 151
149config MK6 152config MK6
150 bool "K6/K6-II/K6-III" 153 bool "K6/K6-II/K6-III"
154 depends on X86_32
151 help 155 help
152 Select this for an AMD K6-family processor. Enables use of 156 Select this for an AMD K6-family processor. Enables use of
153 some extended instructions, and passes appropriate optimization 157 some extended instructions, and passes appropriate optimization
@@ -155,6 +159,7 @@ config MK6
155 159
156config MK7 160config MK7
157 bool "Athlon/Duron/K7" 161 bool "Athlon/Duron/K7"
162 depends on X86_32
158 help 163 help
159 Select this for an AMD Athlon K7-family processor. Enables use of 164 Select this for an AMD Athlon K7-family processor. Enables use of
160 some extended instructions, and passes appropriate optimization 165 some extended instructions, and passes appropriate optimization
@@ -169,6 +174,7 @@ config MK8
169 174
170config MCRUSOE 175config MCRUSOE
171 bool "Crusoe" 176 bool "Crusoe"
177 depends on X86_32
172 help 178 help
173 Select this for a Transmeta Crusoe processor. Treats the processor 179 Select this for a Transmeta Crusoe processor. Treats the processor
174 like a 586 with TSC, and sets some GCC optimization flags (like a 180 like a 586 with TSC, and sets some GCC optimization flags (like a
@@ -176,11 +182,13 @@ config MCRUSOE
176 182
177config MEFFICEON 183config MEFFICEON
178 bool "Efficeon" 184 bool "Efficeon"
185 depends on X86_32
179 help 186 help
180 Select this for a Transmeta Efficeon processor. 187 Select this for a Transmeta Efficeon processor.
181 188
182config MWINCHIPC6 189config MWINCHIPC6
183 bool "Winchip-C6" 190 bool "Winchip-C6"
191 depends on X86_32
184 help 192 help
185 Select this for an IDT Winchip C6 chip. Linux and GCC 193 Select this for an IDT Winchip C6 chip. Linux and GCC
186 treat this chip as a 586TSC with some extended instructions 194 treat this chip as a 586TSC with some extended instructions
@@ -188,6 +196,7 @@ config MWINCHIPC6
188 196
189config MWINCHIP2 197config MWINCHIP2
190 bool "Winchip-2" 198 bool "Winchip-2"
199 depends on X86_32
191 help 200 help
192 Select this for an IDT Winchip-2. Linux and GCC 201 Select this for an IDT Winchip-2. Linux and GCC
193 treat this chip as a 586TSC with some extended instructions 202 treat this chip as a 586TSC with some extended instructions
@@ -195,6 +204,7 @@ config MWINCHIP2
195 204
196config MWINCHIP3D 205config MWINCHIP3D
197 bool "Winchip-2A/Winchip-3" 206 bool "Winchip-2A/Winchip-3"
207 depends on X86_32
198 help 208 help
199 Select this for an IDT Winchip-2A or 3. Linux and GCC 209 Select this for an IDT Winchip-2A or 3. Linux and GCC
200 treat this chip as a 586TSC with some extended instructions 210 treat this chip as a 586TSC with some extended instructions
@@ -204,16 +214,19 @@ config MWINCHIP3D
204 214
205config MGEODEGX1 215config MGEODEGX1
206 bool "GeodeGX1" 216 bool "GeodeGX1"
217 depends on X86_32
207 help 218 help
208 Select this for a Geode GX1 (Cyrix MediaGX) chip. 219 Select this for a Geode GX1 (Cyrix MediaGX) chip.
209 220
210config MGEODE_LX 221config MGEODE_LX
211 bool "Geode GX/LX" 222 bool "Geode GX/LX"
223 depends on X86_32
212 help 224 help
213 Select this for AMD Geode GX and LX processors. 225 Select this for AMD Geode GX and LX processors.
214 226
215config MCYRIXIII 227config MCYRIXIII
216 bool "CyrixIII/VIA-C3" 228 bool "CyrixIII/VIA-C3"
229 depends on X86_32
217 help 230 help
218 Select this for a Cyrix III or C3 chip. Presently Linux and GCC 231 Select this for a Cyrix III or C3 chip. Presently Linux and GCC
219 treat this chip as a generic 586. Whilst the CPU is 686 class, 232 treat this chip as a generic 586. Whilst the CPU is 686 class,
@@ -225,6 +238,7 @@ config MCYRIXIII
225 238
226config MVIAC3_2 239config MVIAC3_2
227 bool "VIA C3-2 (Nehemiah)" 240 bool "VIA C3-2 (Nehemiah)"
241 depends on X86_32
228 help 242 help
229 Select this for a VIA C3 "Nehemiah". Selecting this enables usage 243 Select this for a VIA C3 "Nehemiah". Selecting this enables usage
230 of SSE and tells gcc to treat the CPU as a 686. 244 of SSE and tells gcc to treat the CPU as a 686.
@@ -232,15 +246,42 @@ config MVIAC3_2
232 246
233config MVIAC7 247config MVIAC7
234 bool "VIA C7" 248 bool "VIA C7"
249 depends on X86_32
235 help 250 help
236 Select this for a VIA C7. Selecting this uses the correct cache 251 Select this for a VIA C7. Selecting this uses the correct cache
237 shift and tells gcc to treat the CPU as a 686. 252 shift and tells gcc to treat the CPU as a 686.
238 253
254config MPSC
255 bool "Intel P4 / older Netburst based Xeon"
256 depends on X86_64
257 help
258 Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey
259 Xeon CPUs with Intel 64bit which is compatible with x86-64.
260 Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the
261 Netburst core and shouldn't use this option. You can distinguish them
262 using the cpu family field
263 in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one.
264
265config MCORE2
266 bool "Core 2/newer Xeon"
267 help
268 Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx)
269 CPUs. You can distinguish newer from older Xeons by the CPU family
270 in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo)
271
272config GENERIC_CPU
273 bool "Generic-x86-64"
274 depends on X86_64
275 help
276 Generic x86-64 CPU.
277 Run equally well on all x86-64 CPUs.
278
239endchoice 279endchoice
240 280
241config X86_GENERIC 281config X86_GENERIC
242 bool "Generic x86 support" 282 bool "Generic x86 support"
243 help 283 depends on X86_32
284 help
244 Instead of just including optimizations for the selected 285 Instead of just including optimizations for the selected
245 x86 variant (e.g. PII, Crusoe or Athlon), include some more 286 x86 variant (e.g. PII, Crusoe or Athlon), include some more
246 generic optimizations as well. This will make the kernel 287 generic optimizations as well. This will make the kernel
@@ -253,44 +294,31 @@ endif
253 294
254# 295#
255# Define implied options from the CPU selection here 296# Define implied options from the CPU selection here
256# 297config X86_L1_CACHE_BYTES
298 int
299 default "128" if GENERIC_CPU || MPSC
300 default "64" if MK8 || MCORE2
301 depends on X86_64
302
303config X86_INTERNODE_CACHE_BYTES
304 int
305 default "4096" if X86_VSMP
306 default X86_L1_CACHE_BYTES if !X86_VSMP
307 depends on X86_64
308
257config X86_CMPXCHG 309config X86_CMPXCHG
258 bool 310 def_bool X86_64 || (X86_32 && !M386)
259 depends on !M386
260 default y
261 311
262config X86_L1_CACHE_SHIFT 312config X86_L1_CACHE_SHIFT
263 int 313 int
264 default "7" if MPENTIUM4 || X86_GENERIC 314 default "7" if MPENTIUM4 || X86_GENERIC || GENERIC_CPU || MPSC
265 default "4" if X86_ELAN || M486 || M386 || MGEODEGX1 315 default "4" if X86_ELAN || M486 || M386 || MGEODEGX1
266 default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX 316 default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
267 default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7 317 default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7
268 318
269config X86_XADD 319config X86_XADD
270 bool 320 bool
271 depends on !M386 321 depends on X86_32 && !M386
272 default y
273
274config RWSEM_GENERIC_SPINLOCK
275 bool
276 depends on !X86_XADD
277 default y
278
279config RWSEM_XCHGADD_ALGORITHM
280 bool
281 depends on X86_XADD
282 default y
283
284config ARCH_HAS_ILOG2_U32
285 bool
286 default n
287
288config ARCH_HAS_ILOG2_U64
289 bool
290 default n
291
292config GENERIC_CALIBRATE_DELAY
293 bool
294 default y 322 default y
295 323
296config X86_PPRO_FENCE 324config X86_PPRO_FENCE
@@ -305,22 +333,22 @@ config X86_F00F_BUG
305 333
306config X86_WP_WORKS_OK 334config X86_WP_WORKS_OK
307 bool 335 bool
308 depends on !M386 336 depends on X86_32 && !M386
309 default y 337 default y
310 338
311config X86_INVLPG 339config X86_INVLPG
312 bool 340 bool
313 depends on !M386 341 depends on X86_32 && !M386
314 default y 342 default y
315 343
316config X86_BSWAP 344config X86_BSWAP
317 bool 345 bool
318 depends on !M386 346 depends on X86_32 && !M386
319 default y 347 default y
320 348
321config X86_POPAD_OK 349config X86_POPAD_OK
322 bool 350 bool
323 depends on !M386 351 depends on X86_32 && !M386
324 default y 352 default y
325 353
326config X86_ALIGNMENT_16 354config X86_ALIGNMENT_16
@@ -330,7 +358,7 @@ config X86_ALIGNMENT_16
330 358
331config X86_GOOD_APIC 359config X86_GOOD_APIC
332 bool 360 bool
333 depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON || MCORE2 || MVIAC7 361 depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON || MCORE2 || MVIAC7 || X86_64
334 default y 362 default y
335 363
336config X86_INTEL_USERCOPY 364config X86_INTEL_USERCOPY
@@ -355,7 +383,7 @@ config X86_OOSTORE
355 383
356config X86_TSC 384config X86_TSC
357 bool 385 bool
358 depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ 386 depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64
359 default y 387 default y
360 388
361# this should be set for all -march=.. options where the compiler 389# this should be set for all -march=.. options where the compiler
@@ -367,6 +395,7 @@ config X86_CMOV
367 395
368config X86_MINIMUM_CPU_FAMILY 396config X86_MINIMUM_CPU_FAMILY
369 int 397 int
370 default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK 398 default "64" if X86_64
399 default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK)
371 default "3" 400 default "3"
372 401
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 970b2defe7df..761ca7b5f120 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -6,9 +6,8 @@ config TRACE_IRQFLAGS_SUPPORT
6source "lib/Kconfig.debug" 6source "lib/Kconfig.debug"
7 7
8config EARLY_PRINTK 8config EARLY_PRINTK
9 bool "Early printk" if EMBEDDED && DEBUG_KERNEL 9 bool "Early printk" if EMBEDDED && DEBUG_KERNEL && X86_32
10 default y 10 default y
11 depends on X86_32
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
14 port. 13 port.
@@ -91,7 +90,7 @@ config DOUBLEFAULT
91 90
92config IOMMU_DEBUG 91config IOMMU_DEBUG
93 bool "Enable IOMMU debugging" 92 bool "Enable IOMMU debugging"
94 depends on IOMMU && DEBUG_KERNEL 93 depends on GART_IOMMU && DEBUG_KERNEL
95 depends on X86_64 94 depends on X86_64
96 help 95 help
97 Force the IOMMU to on even when you have less than 4GB of 96 Force the IOMMU to on even when you have less than 4GB of
@@ -113,7 +112,4 @@ config IOMMU_LEAK
113 Add a simple leak tracer to the IOMMU code. This is useful when you 112 Add a simple leak tracer to the IOMMU code. This is useful when you
114 are debugging a buggy device driver that leaks IOMMU mappings. 113 are debugging a buggy device driver that leaks IOMMU mappings.
115 114
116#config X86_REMOTE_DEBUG
117# bool "kgdb debugging stub"
118
119endmenu 115endmenu
diff --git a/arch/x86/Kconfig.x86_64 b/arch/x86/Kconfig.x86_64
deleted file mode 100644
index e2542e5b536c..000000000000
--- a/arch/x86/Kconfig.x86_64
+++ /dev/null
@@ -1,844 +0,0 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5# Note: ISA is disabled and will hopefully never be enabled.
6# If you managed to buy an ISA x86-64 box you'll have to fix all the
7# ISA drivers you need yourself.
8#
9
10mainmenu "Linux Kernel Configuration"
11
12config X86_64
13 bool
14 default y
15 help
16 Port to the x86-64 architecture. x86-64 is a 64-bit extension to the
17 classical 32-bit x86 architecture. For details see
18 <http://www.x86-64.org/>.
19
20config 64BIT
21 def_bool y
22
23config X86
24 bool
25 default y
26
27config GENERIC_TIME
28 bool
29 default y
30
31config GENERIC_TIME_VSYSCALL
32 bool
33 default y
34
35config GENERIC_CMOS_UPDATE
36 bool
37 default y
38
39config CLOCKSOURCE_WATCHDOG
40 bool
41 default y
42
43config GENERIC_CLOCKEVENTS
44 bool
45 default y
46
47config GENERIC_CLOCKEVENTS_BROADCAST
48 bool
49 default y
50
51config ZONE_DMA32
52 bool
53 default y
54
55config LOCKDEP_SUPPORT
56 bool
57 default y
58
59config STACKTRACE_SUPPORT
60 bool
61 default y
62
63config SEMAPHORE_SLEEPERS
64 bool
65 default y
66
67config MMU
68 bool
69 default y
70
71config ZONE_DMA
72 bool
73 default y
74
75config ISA
76 bool
77
78config SBUS
79 bool
80
81config RWSEM_GENERIC_SPINLOCK
82 bool
83 default y
84
85config RWSEM_XCHGADD_ALGORITHM
86 bool
87
88config GENERIC_HWEIGHT
89 bool
90 default y
91
92config GENERIC_CALIBRATE_DELAY
93 bool
94 default y
95
96config X86_CMPXCHG
97 bool
98 default y
99
100config EARLY_PRINTK
101 bool
102 default y
103
104config GENERIC_ISA_DMA
105 bool
106 default y
107
108config GENERIC_IOMAP
109 bool
110 default y
111
112config ARCH_MAY_HAVE_PC_FDC
113 bool
114 default y
115
116config ARCH_POPULATES_NODE_MAP
117 def_bool y
118
119config DMI
120 bool
121 default y
122
123config AUDIT_ARCH
124 bool
125 default y
126
127config GENERIC_BUG
128 bool
129 default y
130 depends on BUG
131
132config ARCH_HAS_ILOG2_U32
133 bool
134 default n
135
136config ARCH_HAS_ILOG2_U64
137 bool
138 default n
139
140source "init/Kconfig"
141
142
143menu "Processor type and features"
144
145source "kernel/time/Kconfig"
146
147choice
148 prompt "Subarchitecture Type"
149 default X86_PC
150
151config X86_PC
152 bool "PC-compatible"
153 help
154 Choose this option if your computer is a standard PC or compatible.
155
156config X86_VSMP
157 bool "Support for ScaleMP vSMP"
158 depends on PCI
159 help
160 Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is
161 supposed to run on these EM64T-based machines. Only choose this option
162 if you have one of these machines.
163
164endchoice
165
166choice
167 prompt "Processor family"
168 default GENERIC_CPU
169
170config MK8
171 bool "AMD-Opteron/Athlon64"
172 help
173 Optimize for AMD Opteron/Athlon64/Hammer/K8 CPUs.
174
175config MPSC
176 bool "Intel P4 / older Netburst based Xeon"
177 help
178 Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey
179 Xeon CPUs with Intel 64bit which is compatible with x86-64.
180 Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the
181 Netburst core and shouldn't use this option. You can distinguish them
182 using the cpu family field
183 in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one.
184
185config MCORE2
186 bool "Intel Core2 / newer Xeon"
187 help
188 Optimize for Intel Core2 and newer Xeons (51xx)
189 You can distinguish the newer Xeons from the older ones using
190 the cpu family field in /proc/cpuinfo. 15 is an older Xeon
191 (use CONFIG_MPSC then), 6 is a newer one.
192
193config GENERIC_CPU
194 bool "Generic-x86-64"
195 help
196 Generic x86-64 CPU.
197 Run equally well on all x86-64 CPUs.
198
199endchoice
200
201#
202# Define implied options from the CPU selection here
203#
204config X86_L1_CACHE_BYTES
205 int
206 default "128" if GENERIC_CPU || MPSC
207 default "64" if MK8 || MCORE2
208
209config X86_L1_CACHE_SHIFT
210 int
211 default "7" if GENERIC_CPU || MPSC
212 default "6" if MK8 || MCORE2
213
214config X86_INTERNODE_CACHE_BYTES
215 int
216 default "4096" if X86_VSMP
217 default X86_L1_CACHE_BYTES if !X86_VSMP
218
219config X86_TSC
220 bool
221 default y
222
223config X86_GOOD_APIC
224 bool
225 default y
226
227config MICROCODE
228 tristate "/dev/cpu/microcode - Intel CPU microcode support"
229 select FW_LOADER
230 ---help---
231 If you say Y here the 'File systems' section, you will be
232 able to update the microcode on Intel processors. You will
233 obviously need the actual microcode binary data itself which is
234 not shipped with the Linux kernel.
235
236 For latest news and information on obtaining all the required
237 ingredients for this driver, check:
238 <http://www.urbanmyth.org/microcode/>.
239
240 To compile this driver as a module, choose M here: the
241 module will be called microcode.
242 If you use modprobe or kmod you may also want to add the line
243 'alias char-major-10-184 microcode' to your /etc/modules.conf file.
244
245config MICROCODE_OLD_INTERFACE
246 bool
247 depends on MICROCODE
248 default y
249
250config X86_MSR
251 tristate "/dev/cpu/*/msr - Model-specific register support"
252 help
253 This device gives privileged processes access to the x86
254 Model-Specific Registers (MSRs). It is a character device with
255 major 202 and minors 0 to 31 for /dev/cpu/0/msr to /dev/cpu/31/msr.
256 MSR accesses are directed to a specific CPU on multi-processor
257 systems.
258
259config X86_CPUID
260 tristate "/dev/cpu/*/cpuid - CPU information support"
261 help
262 This device gives processes access to the x86 CPUID instruction to
263 be executed on a specific processor. It is a character device
264 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
265 /dev/cpu/31/cpuid.
266
267config X86_HT
268 bool
269 depends on SMP && !MK8
270 default y
271
272config MATH_EMULATION
273 bool
274
275config MCA
276 bool
277
278config EISA
279 bool
280
281config X86_IO_APIC
282 bool
283 default y
284
285config X86_LOCAL_APIC
286 bool
287 default y
288
289config MTRR
290 bool "MTRR (Memory Type Range Register) support"
291 ---help---
292 On Intel P6 family processors (Pentium Pro, Pentium II and later)
293 the Memory Type Range Registers (MTRRs) may be used to control
294 processor access to memory ranges. This is most useful if you have
295 a video (VGA) card on a PCI or AGP bus. Enabling write-combining
296 allows bus write transfers to be combined into a larger transfer
297 before bursting over the PCI/AGP bus. This can increase performance
298 of image write operations 2.5 times or more. Saying Y here creates a
299 /proc/mtrr file which may be used to manipulate your processor's
300 MTRRs. Typically the X server should use this.
301
302 This code has a reasonably generic interface so that similar
303 control registers on other processors can be easily supported
304 as well.
305
306 Saying Y here also fixes a problem with buggy SMP BIOSes which only
307 set the MTRRs for the boot CPU and not for the secondary CPUs. This
308 can lead to all sorts of problems, so it's good to say Y here.
309
310 Just say Y here, all x86-64 machines support MTRRs.
311
312 See <file:Documentation/mtrr.txt> for more information.
313
314config SMP
315 bool "Symmetric multi-processing support"
316 ---help---
317 This enables support for systems with more than one CPU. If you have
318 a system with only one CPU, like most personal computers, say N. If
319 you have a system with more than one CPU, say Y.
320
321 If you say N here, the kernel will run on single and multiprocessor
322 machines, but will use only one CPU of a multiprocessor machine. If
323 you say Y here, the kernel will run on many, but not all,
324 singleprocessor machines. On a singleprocessor machine, the kernel
325 will run faster if you say N here.
326
327 If you don't know what to do here, say N.
328
329config SCHED_SMT
330 bool "SMT (Hyperthreading) scheduler support"
331 depends on SMP
332 default n
333 help
334 SMT scheduler support improves the CPU scheduler's decision making
335 when dealing with Intel Pentium 4 chips with HyperThreading at a
336 cost of slightly increased overhead in some places. If unsure say
337 N here.
338
339config SCHED_MC
340 bool "Multi-core scheduler support"
341 depends on SMP
342 default y
343 help
344 Multi-core scheduler support improves the CPU scheduler's decision
345 making when dealing with multi-core CPU chips at a cost of slightly
346 increased overhead in some places. If unsure say N here.
347
348source "kernel/Kconfig.preempt"
349
350config NUMA
351 bool "Non Uniform Memory Access (NUMA) Support"
352 depends on SMP
353 help
354 Enable NUMA (Non Uniform Memory Access) support. The kernel
355 will try to allocate memory used by a CPU on the local memory
356 controller of the CPU and add some more NUMA awareness to the kernel.
357 This code is recommended on all multiprocessor Opteron systems.
358 If the system is EM64T, you should say N unless your system is EM64T
359 NUMA.
360
361config K8_NUMA
362 bool "Old style AMD Opteron NUMA detection"
363 depends on NUMA && PCI
364 default y
365 help
366 Enable K8 NUMA node topology detection. You should say Y here if
367 you have a multi processor AMD K8 system. This uses an old
368 method to read the NUMA configuration directly from the builtin
369 Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA
370 instead, which also takes priority if both are compiled in.
371
372config NODES_SHIFT
373 int
374 default "6"
375 depends on NEED_MULTIPLE_NODES
376
377# Dummy CONFIG option to select ACPI_NUMA from drivers/acpi/Kconfig.
378
379config X86_64_ACPI_NUMA
380 bool "ACPI NUMA detection"
381 depends on NUMA
382 select ACPI
383 select PCI
384 select ACPI_NUMA
385 default y
386 help
387 Enable ACPI SRAT based node topology detection.
388
389config NUMA_EMU
390 bool "NUMA emulation"
391 depends on NUMA
392 help
393 Enable NUMA emulation. A flat machine will be split
394 into virtual nodes when booted with "numa=fake=N", where N is the
395 number of nodes. This is only useful for debugging.
396
397config ARCH_DISCONTIGMEM_ENABLE
398 bool
399 depends on NUMA
400 default y
401
402config ARCH_DISCONTIGMEM_DEFAULT
403 def_bool y
404 depends on NUMA
405
406config ARCH_SPARSEMEM_ENABLE
407 def_bool y
408 depends on (NUMA || EXPERIMENTAL)
409 select SPARSEMEM_VMEMMAP_ENABLE
410
411config ARCH_MEMORY_PROBE
412 def_bool y
413 depends on MEMORY_HOTPLUG
414
415config ARCH_FLATMEM_ENABLE
416 def_bool y
417 depends on !NUMA
418
419source "mm/Kconfig"
420
421config MEMORY_HOTPLUG_RESERVE
422 def_bool y
423 depends on (MEMORY_HOTPLUG && DISCONTIGMEM)
424
425config HAVE_ARCH_EARLY_PFN_TO_NID
426 def_bool y
427 depends on NUMA
428
429config OUT_OF_LINE_PFN_TO_PAGE
430 def_bool y
431 depends on DISCONTIGMEM
432
433config NR_CPUS
434 int "Maximum number of CPUs (2-255)"
435 range 2 255
436 depends on SMP
437 default "8"
438 help
439 This allows you to specify the maximum number of CPUs which this
440 kernel will support. Current maximum is 255 CPUs due to
441 APIC addressing limits. Less depending on the hardware.
442
443 This is purely to save memory - each supported CPU requires
444 memory in the static kernel configuration.
445
446config PHYSICAL_ALIGN
447 hex
448 default "0x200000"
449
450config HOTPLUG_CPU
451 bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
452 depends on SMP && HOTPLUG && EXPERIMENTAL
453 help
454 Say Y here to experiment with turning CPUs off and on. CPUs
455 can be controlled through /sys/devices/system/cpu/cpu#.
456 This is also required for suspend/hibernation on SMP systems.
457
458 Say N if you want to disable CPU hotplug and don't need to
459 suspend.
460
461config ARCH_ENABLE_MEMORY_HOTPLUG
462 def_bool y
463
464config HPET_TIMER
465 bool
466 default y
467 help
468 Use the IA-PC HPET (High Precision Event Timer) to manage
469 time in preference to the PIT and RTC, if a HPET is
470 present. The HPET provides a stable time base on SMP
471 systems, unlike the TSC, but it is more expensive to access,
472 as it is off-chip. You can find the HPET spec at
473 <http://www.intel.com/hardwaredesign/hpetspec.htm>.
474
475config HPET_EMULATE_RTC
476 bool
477 depends on HPET_TIMER && RTC=y
478 default y
479
480# Mark as embedded because too many people got it wrong.
481# The code disables itself when not needed.
482config IOMMU
483 bool "IOMMU support" if EMBEDDED
484 default y
485 select SWIOTLB
486 select AGP
487 depends on PCI
488 help
489 Support for full DMA access of devices with 32bit memory access only
490 on systems with more than 3GB. This is usually needed for USB,
491 sound, many IDE/SATA chipsets and some other devices.
492 Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART
493 based hardware IOMMU and a software bounce buffer based IOMMU used
494 on Intel systems and as fallback.
495 The code is only active when needed (enough memory and limited
496 device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified
497 too.
498
499config CALGARY_IOMMU
500 bool "IBM Calgary IOMMU support"
501 select SWIOTLB
502 depends on PCI && EXPERIMENTAL
503 help
504 Support for hardware IOMMUs in IBM's xSeries x366 and x460
505 systems. Needed to run systems with more than 3GB of memory
506 properly with 32-bit PCI devices that do not support DAC
507 (Double Address Cycle). Calgary also supports bus level
508 isolation, where all DMAs pass through the IOMMU. This
509 prevents them from going anywhere except their intended
510 destination. This catches hard-to-find kernel bugs and
511 mis-behaving drivers and devices that do not use the DMA-API
512 properly to set up their DMA buffers. The IOMMU can be
513 turned off at boot time with the iommu=off parameter.
514 Normally the kernel will make the right choice by itself.
515 If unsure, say Y.
516
517config CALGARY_IOMMU_ENABLED_BY_DEFAULT
518 bool "Should Calgary be enabled by default?"
519 default y
520 depends on CALGARY_IOMMU
521 help
522 Should Calgary be enabled by default? if you choose 'y', Calgary
523 will be used (if it exists). If you choose 'n', Calgary will not be
524 used even if it exists. If you choose 'n' and would like to use
525 Calgary anyway, pass 'iommu=calgary' on the kernel command line.
526 If unsure, say Y.
527
528# need this always selected by IOMMU for the VIA workaround
529config SWIOTLB
530 bool
531 help
532 Support for software bounce buffers used on x86-64 systems
533 which don't have a hardware IOMMU (e.g. the current generation
534 of Intel's x86-64 CPUs). Using this PCI devices which can only
535 access 32-bits of memory can be used on systems with more than
536 3 GB of memory. If unsure, say Y.
537
538config X86_MCE
539 bool "Machine check support" if EMBEDDED
540 default y
541 help
542 Include a machine check error handler to report hardware errors.
543 This version will require the mcelog utility to decode some
544 machine check error logs. See
545 ftp://ftp.x86-64.org/pub/linux/tools/mcelog
546
547config X86_MCE_INTEL
548 bool "Intel MCE features"
549 depends on X86_MCE && X86_LOCAL_APIC
550 default y
551 help
552 Additional support for intel specific MCE features such as
553 the thermal monitor.
554
555config X86_MCE_AMD
556 bool "AMD MCE features"
557 depends on X86_MCE && X86_LOCAL_APIC
558 default y
559 help
560 Additional support for AMD specific MCE features such as
561 the DRAM Error Threshold.
562
563config KEXEC
564 bool "kexec system call"
565 help
566 kexec is a system call that implements the ability to shutdown your
567 current kernel, and to start another kernel. It is like a reboot
568 but it is independent of the system firmware. And like a reboot
569 you can start any kernel with it, not just Linux.
570
571 The name comes from the similarity to the exec system call.
572
573 It is an ongoing process to be certain the hardware in a machine
574 is properly shutdown, so do not be surprised if this code does not
575 initially work for you. It may help to enable device hotplugging
576 support. As of this writing the exact hardware interface is
577 strongly in flux, so no good recommendation can be made.
578
579config CRASH_DUMP
580 bool "kernel crash dumps (EXPERIMENTAL)"
581 depends on EXPERIMENTAL
582 help
583 Generate crash dump after being started by kexec.
584 This should be normally only set in special crash dump kernels
585 which are loaded in the main kernel with kexec-tools into
586 a specially reserved region and then later executed after
587 a crash by kdump/kexec. The crash dump kernel must be compiled
588 to a memory address not used by the main kernel or BIOS using
589 PHYSICAL_START, or it must be built as a relocatable image
590 (CONFIG_RELOCATABLE=y).
591 For more details see Documentation/kdump/kdump.txt
592
593config RELOCATABLE
594 bool "Build a relocatable kernel (EXPERIMENTAL)"
595 depends on EXPERIMENTAL
596 help
597 Builds a relocatable kernel. This enables loading and running
598 a kernel binary from a different physical address than it has
599 been compiled for.
600
601 One use is for the kexec on panic case where the recovery kernel
602 must live at a different physical address than the primary
603 kernel.
604
605 Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
606 it has been loaded at and the compile time physical address
607 (CONFIG_PHYSICAL_START) is ignored.
608
609config PHYSICAL_START
610 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
611 default "0x200000"
612 help
613 This gives the physical address where the kernel is loaded. It
614 should be aligned to 2MB boundary.
615
616 If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then
617 bzImage will decompress itself to above physical address and
618 run from there. Otherwise, bzImage will run from the address where
619 it has been loaded by the boot loader and will ignore above physical
620 address.
621
622 In normal kdump cases one does not have to set/change this option
623 as now bzImage can be compiled as a completely relocatable image
624 (CONFIG_RELOCATABLE=y) and be used to load and run from a different
625 address. This option is mainly useful for the folks who don't want
626 to use a bzImage for capturing the crash dump and want to use a
627 vmlinux instead.
628
629 So if you are using bzImage for capturing the crash dump, leave
630 the value here unchanged to 0x200000 and set CONFIG_RELOCATABLE=y.
631 Otherwise if you plan to use vmlinux for capturing the crash dump
632 change this value to start of the reserved region (Typically 16MB
633 0x1000000). In other words, it can be set based on the "X" value as
634 specified in the "crashkernel=YM@XM" command line boot parameter
635 passed to the panic-ed kernel. Typically this parameter is set as
636 crashkernel=64M@16M. Please take a look at
637 Documentation/kdump/kdump.txt for more details about crash dumps.
638
639 Usage of bzImage for capturing the crash dump is advantageous as
640 one does not have to build two kernels. Same kernel can be used
641 as production kernel and capture kernel.
642
643 Don't change this unless you know what you are doing.
644
645config SECCOMP
646 bool "Enable seccomp to safely compute untrusted bytecode"
647 depends on PROC_FS
648 default y
649 help
650 This kernel feature is useful for number crunching applications
651 that may need to compute untrusted bytecode during their
652 execution. By using pipes or other transports made available to
653 the process as file descriptors supporting the read/write
654 syscalls, it's possible to isolate those applications in
655 their own address space using seccomp. Once seccomp is
656 enabled via /proc/<pid>/seccomp, it cannot be disabled
657 and the task is only allowed to execute a few safe syscalls
658 defined by each seccomp mode.
659
660 If unsure, say Y. Only embedded should say N here.
661
662config CC_STACKPROTECTOR
663 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
664 depends on EXPERIMENTAL
665 help
666 This option turns on the -fstack-protector GCC feature. This
667 feature puts, at the beginning of critical functions, a canary
668 value on the stack just before the return address, and validates
669 the value just before actually returning. Stack based buffer
670 overflows (that need to overwrite this return address) now also
671 overwrite the canary, which gets detected and the attack is then
672 neutralized via a kernel panic.
673
674 This feature requires gcc version 4.2 or above, or a distribution
675 gcc with the feature backported. Older versions are automatically
676 detected and for those versions, this configuration option is ignored.
677
678config CC_STACKPROTECTOR_ALL
679 bool "Use stack-protector for all functions"
680 depends on CC_STACKPROTECTOR
681 help
682 Normally, GCC only inserts the canary value protection for
683 functions that use large-ish on-stack buffers. By enabling
684 this option, GCC will be asked to do this for ALL functions.
685
686source kernel/Kconfig.hz
687
688config K8_NB
689 def_bool y
690 depends on AGP_AMD64 || IOMMU || (PCI && NUMA)
691
692endmenu
693
694#
695# Use the generic interrupt handling code in kernel/irq/:
696#
697config GENERIC_HARDIRQS
698 bool
699 default y
700
701config GENERIC_IRQ_PROBE
702 bool
703 default y
704
705# we have no ISA slots, but we do have ISA-style DMA.
706config ISA_DMA_API
707 bool
708 default y
709
710config GENERIC_PENDING_IRQ
711 bool
712 depends on GENERIC_HARDIRQS && SMP
713 default y
714
715menu "Power management options"
716
717source kernel/power/Kconfig
718
719config ARCH_HIBERNATION_HEADER
720 bool
721 depends on HIBERNATION
722 default y
723
724source "drivers/acpi/Kconfig"
725
726source "arch/x86/kernel/cpu/cpufreq/Kconfig_64"
727
728source "drivers/cpuidle/Kconfig"
729
730endmenu
731
732menu "Bus options (PCI etc.)"
733
734config PCI
735 bool "PCI support"
736 select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC)
737
738# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
739config PCI_DIRECT
740 bool
741 depends on PCI
742 default y
743
744config PCI_MMCONFIG
745 bool "Support mmconfig PCI config space access"
746 depends on PCI && ACPI
747
748config PCI_DOMAINS
749 bool
750 depends on PCI
751 default y
752
753config DMAR
754 bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
755 depends on PCI_MSI && ACPI && EXPERIMENTAL
756 default y
757 help
758 DMA remapping (DMAR) devices support enables independent address
759 translations for Direct Memory Access (DMA) from devices.
760 These DMA remapping devices are reported via ACPI tables
761 and include PCI device scope covered by these DMA
762 remapping devices.
763
764config DMAR_GFX_WA
765 bool "Support for Graphics workaround"
766 depends on DMAR
767 default y
768 help
769 Current Graphics drivers tend to use physical address
770 for DMA and avoid using DMA APIs. Setting this config
771 option permits the IOMMU driver to set a unity map for
772 all the OS-visible memory. Hence the driver can continue
773 to use physical addresses for DMA.
774
775config DMAR_FLOPPY_WA
776 bool
777 depends on DMAR
778 default y
779 help
780 Floppy disk drivers are know to bypass DMA API calls
781 thereby failing to work when IOMMU is enabled. This
782 workaround will setup a 1:1 mapping for the first
783 16M to make floppy (an ISA device) work.
784
785source "drivers/pci/pcie/Kconfig"
786
787source "drivers/pci/Kconfig"
788
789source "drivers/pcmcia/Kconfig"
790
791source "drivers/pci/hotplug/Kconfig"
792
793endmenu
794
795
796menu "Executable file formats / Emulations"
797
798source "fs/Kconfig.binfmt"
799
800config IA32_EMULATION
801 bool "IA32 Emulation"
802 help
803 Include code to run 32-bit programs under a 64-bit kernel. You should
804 likely turn this on, unless you're 100% sure that you don't have any
805 32-bit programs left.
806
807config IA32_AOUT
808 tristate "IA32 a.out support"
809 depends on IA32_EMULATION
810 help
811 Support old a.out binaries in the 32bit emulation.
812
813config COMPAT
814 bool
815 depends on IA32_EMULATION
816 default y
817
818config COMPAT_FOR_U64_ALIGNMENT
819 def_bool COMPAT
820
821config SYSVIPC_COMPAT
822 bool
823 depends on COMPAT && SYSVIPC
824 default y
825
826endmenu
827
828source "net/Kconfig"
829
830source drivers/Kconfig
831
832source "drivers/firmware/Kconfig"
833
834source fs/Kconfig
835
836source "kernel/Kconfig.instrumentation"
837
838source "arch/x86/Kconfig.debug"
839
840source "security/Kconfig"
841
842source "crypto/Kconfig"
843
844source "lib/Kconfig"
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 309597386a77..7aa1dc6d67c8 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -1,16 +1,19 @@
1# Unified Makefile for i386 and x86_64 1# Unified Makefile for i386 and x86_64
2 2
3# select defconfig based on actual architecture 3# select defconfig based on actual architecture
4KBUILD_DEFCONFIG := $(ARCH)_defconfig 4ifeq ($(ARCH),x86)
5 KBUILD_DEFCONFIG := i386_defconfig
6else
7 KBUILD_DEFCONFIG := $(ARCH)_defconfig
8endif
5 9
6# # No need to remake these files 10# No need to remake these files
7$(srctree)/arch/x86/Makefile%: ; 11$(srctree)/arch/x86/Makefile%: ;
8 12
9ifeq ($(ARCH),i386) 13ifeq ($(CONFIG_X86_32),y)
14 UTS_MACHINE := i386
10 include $(srctree)/arch/x86/Makefile_32 15 include $(srctree)/arch/x86/Makefile_32
11else 16else
17 UTS_MACHINE := x86_64
12 include $(srctree)/arch/x86/Makefile_64 18 include $(srctree)/arch/x86/Makefile_64
13endif 19endif
14
15
16
diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32
index 346ac0766875..50394da2f6c1 100644
--- a/arch/x86/Makefile_32
+++ b/arch/x86/Makefile_32
@@ -160,7 +160,7 @@ archclean:
160 $(Q)$(MAKE) $(clean)=arch/x86/boot 160 $(Q)$(MAKE) $(clean)=arch/x86/boot
161 161
162define archhelp 162define archhelp
163 echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' 163 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
164 echo ' install - Install kernel using' 164 echo ' install - Install kernel using'
165 echo ' (your) ~/bin/installkernel or' 165 echo ' (your) ~/bin/installkernel or'
166 echo ' (distribution) /sbin/installkernel or' 166 echo ' (distribution) /sbin/installkernel or'
@@ -170,6 +170,6 @@ define archhelp
170 echo ' isoimage - Create a boot CD-ROM image' 170 echo ' isoimage - Create a boot CD-ROM image'
171endef 171endef
172 172
173CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ 173CLEAN_FILES += arch/x86/boot/fdimage \
174 arch/$(ARCH)/boot/image.iso \ 174 arch/x86/boot/image.iso \
175 arch/$(ARCH)/boot/mtools.conf 175 arch/x86/boot/mtools.conf
diff --git a/arch/x86/Makefile_64 b/arch/x86/Makefile_64
index 57e714a47af7..a804860022e6 100644
--- a/arch/x86/Makefile_64
+++ b/arch/x86/Makefile_64
@@ -127,7 +127,7 @@ archclean:
127 $(Q)$(MAKE) $(clean)=$(boot) 127 $(Q)$(MAKE) $(clean)=$(boot)
128 128
129define archhelp 129define archhelp
130 echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' 130 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
131 echo ' install - Install kernel using' 131 echo ' install - Install kernel using'
132 echo ' (your) ~/bin/installkernel or' 132 echo ' (your) ~/bin/installkernel or'
133 echo ' (distribution) /sbin/installkernel or' 133 echo ' (distribution) /sbin/installkernel or'
@@ -137,8 +137,8 @@ define archhelp
137 echo ' isoimage - Create a boot CD-ROM image' 137 echo ' isoimage - Create a boot CD-ROM image'
138endef 138endef
139 139
140CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ 140CLEAN_FILES += arch/x86/boot/fdimage \
141 arch/$(ARCH)/boot/image.iso \ 141 arch/x86/boot/image.iso \
142 arch/$(ARCH)/boot/mtools.conf 142 arch/x86/boot/mtools.conf
143 143
144 144
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 89dbf970e058..7a3116ccf387 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -49,10 +49,10 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE)
49 49
50# How to compile the 16-bit code. Note we always compile for -march=i386, 50# How to compile the 16-bit code. Note we always compile for -march=i386,
51# that way we can complain to the user if the CPU is insufficient. 51# that way we can complain to the user if the CPU is insufficient.
52cflags-i386 := 52cflags-$(CONFIG_X86_32) :=
53cflags-x86_64 := -m32 53cflags-$(CONFIG_X86_64) := -m32
54KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ 54KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
55 $(cflags-$(ARCH)) \ 55 $(cflags-y) \
56 -Wall -Wstrict-prototypes \ 56 -Wall -Wstrict-prototypes \
57 -march=i386 -mregparm=3 \ 57 -march=i386 -mregparm=3 \
58 -include $(srctree)/$(src)/code16gcc.h \ 58 -include $(srctree)/$(src)/code16gcc.h \
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/cpucheck.c b/arch/x86/boot/cpucheck.c
index e655a89c5510..769065bd23d7 100644
--- a/arch/x86/boot/cpucheck.c
+++ b/arch/x86/boot/cpucheck.c
@@ -42,13 +42,7 @@ static struct cpu_features cpu;
42static u32 cpu_vendor[3]; 42static u32 cpu_vendor[3];
43static u32 err_flags[NCAPINTS]; 43static u32 err_flags[NCAPINTS];
44 44
45#ifdef CONFIG_X86_64
46static const int req_level = 64;
47#elif defined(CONFIG_X86_MINIMUM_CPU_FAMILY)
48static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY; 45static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY;
49#else
50static const int req_level = 3;
51#endif
52 46
53static const u32 req_flags[NCAPINTS] = 47static const u32 req_flags[NCAPINTS] =
54{ 48{
diff --git a/arch/x86/boot/pmjump.S b/arch/x86/boot/pmjump.S
index 2e559233725a..fa6bed1fac14 100644
--- a/arch/x86/boot/pmjump.S
+++ b/arch/x86/boot/pmjump.S
@@ -28,17 +28,19 @@
28 * void protected_mode_jump(u32 entrypoint, u32 bootparams); 28 * void protected_mode_jump(u32 entrypoint, u32 bootparams);
29 */ 29 */
30protected_mode_jump: 30protected_mode_jump:
31 xorl %ebx, %ebx # Flag to indicate this is a boot
32 movl %edx, %esi # Pointer to boot_params table 31 movl %edx, %esi # Pointer to boot_params table
33 movl %eax, 2f # Patch ljmpl instruction 32 movl %eax, 2f # Patch ljmpl instruction
34 jmp 1f # Short jump to flush instruction q.
35 33
361:
37 movw $__BOOT_DS, %cx 34 movw $__BOOT_DS, %cx
35 xorl %ebx, %ebx # Per the 32-bit boot protocol
36 xorl %ebp, %ebp # Per the 32-bit boot protocol
37 xorl %edi, %edi # Per the 32-bit boot protocol
38 38
39 movl %cr0, %edx 39 movl %cr0, %edx
40 orb $1, %dl # Protected mode (PE) bit 40 orb $1, %dl # Protected mode (PE) bit
41 movl %edx, %cr0 41 movl %edx, %cr0
42 jmp 1f # Short jump to serialize on 386/486
431:
42 44
43 movw %cx, %ds 45 movw %cx, %ds
44 movw %cx, %es 46 movw %cx, %es
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index b091c5e35558..38a83f9c966f 100644
--- a/arch/x86/configs/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/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 18b231810908..df588f0f76e1 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -159,20 +159,16 @@ sysenter_do_call:
159 159
160sysenter_tracesys: 160sysenter_tracesys:
161 CFI_RESTORE_STATE 161 CFI_RESTORE_STATE
162 xchgl %r9d,%ebp
162 SAVE_REST 163 SAVE_REST
163 CLEAR_RREGS 164 CLEAR_RREGS
165 movq %r9,R9(%rsp)
164 movq $-ENOSYS,RAX(%rsp) /* really needed? */ 166 movq $-ENOSYS,RAX(%rsp) /* really needed? */
165 movq %rsp,%rdi /* &pt_regs -> arg1 */ 167 movq %rsp,%rdi /* &pt_regs -> arg1 */
166 call syscall_trace_enter 168 call syscall_trace_enter
167 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ 169 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
168 RESTORE_REST 170 RESTORE_REST
169 movl %ebp, %ebp 171 xchgl %ebp,%r9d
170 /* no need to do an access_ok check here because rbp has been
171 32bit zero extended */
1721: movl (%rbp),%r9d
173 .section __ex_table,"a"
174 .quad 1b,ia32_badarg
175 .previous
176 jmp sysenter_do_call 172 jmp sysenter_do_call
177 CFI_ENDPROC 173 CFI_ENDPROC
178ENDPROC(ia32_sysenter_target) 174ENDPROC(ia32_sysenter_target)
@@ -262,20 +258,17 @@ cstar_do_call:
262 258
263cstar_tracesys: 259cstar_tracesys:
264 CFI_RESTORE_STATE 260 CFI_RESTORE_STATE
261 xchgl %r9d,%ebp
265 SAVE_REST 262 SAVE_REST
266 CLEAR_RREGS 263 CLEAR_RREGS
264 movq %r9,R9(%rsp)
267 movq $-ENOSYS,RAX(%rsp) /* really needed? */ 265 movq $-ENOSYS,RAX(%rsp) /* really needed? */
268 movq %rsp,%rdi /* &pt_regs -> arg1 */ 266 movq %rsp,%rdi /* &pt_regs -> arg1 */
269 call syscall_trace_enter 267 call syscall_trace_enter
270 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ 268 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
271 RESTORE_REST 269 RESTORE_REST
270 xchgl %ebp,%r9d
272 movl RSP-ARGOFFSET(%rsp), %r8d 271 movl RSP-ARGOFFSET(%rsp), %r8d
273 /* no need to do an access_ok check here because r8 has been
274 32bit zero extended */
2751: movl (%r8),%r9d
276 .section __ex_table,"a"
277 .quad 1b,ia32_badarg
278 .previous
279 jmp cstar_do_call 272 jmp cstar_do_call
280END(ia32_cstar_target) 273END(ia32_cstar_target)
281 274
diff --git a/arch/x86/ia32/ptrace32.c b/arch/x86/ia32/ptrace32.c
index f52770ef0ee3..4a233ad6269c 100644
--- a/arch/x86/ia32/ptrace32.c
+++ b/arch/x86/ia32/ptrace32.c
@@ -228,8 +228,6 @@ static long ptrace32_siginfo(unsigned request, u32 pid, u32 addr, u32 data)
228 return ret; 228 return ret;
229} 229}
230 230
231#define COMPAT_GDT_ENTRY_TLS_MIN 6
232
233asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) 231asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
234{ 232{
235 struct task_struct *child; 233 struct task_struct *child;
@@ -248,6 +246,8 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
248 case PTRACE_SYSCALL: 246 case PTRACE_SYSCALL:
249 case PTRACE_OLDSETOPTIONS: 247 case PTRACE_OLDSETOPTIONS:
250 case PTRACE_SETOPTIONS: 248 case PTRACE_SETOPTIONS:
249 case PTRACE_SET_THREAD_AREA:
250 case PTRACE_GET_THREAD_AREA:
251 return sys_ptrace(request, pid, addr, data); 251 return sys_ptrace(request, pid, addr, data);
252 252
253 default: 253 default:
@@ -271,12 +271,6 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
271 case PTRACE_SETSIGINFO: 271 case PTRACE_SETSIGINFO:
272 case PTRACE_GETSIGINFO: 272 case PTRACE_GETSIGINFO:
273 return ptrace32_siginfo(request, pid, addr, data); 273 return ptrace32_siginfo(request, pid, addr, data);
274
275 case PTRACE_SET_THREAD_AREA:
276 case PTRACE_GET_THREAD_AREA:
277 return sys_ptrace(request, pid,
278 addr + GDT_ENTRY_TLS_MIN - COMPAT_GDT_ENTRY_TLS_MIN,
279 data);
280 } 274 }
281 275
282 child = ptrace_get_task_struct(pid); 276 child = ptrace_get_task_struct(pid);
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index b9d679820306..a7bc93c27662 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -3,6 +3,7 @@
3# 3#
4 4
5extra-y := head_32.o init_task.o vmlinux.lds 5extra-y := head_32.o init_task.o vmlinux.lds
6CPPFLAGS_vmlinux.lds += -Ui386
6 7
7obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ 8obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \
8 ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \ 9 ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \
@@ -60,7 +61,7 @@ quiet_cmd_syscall = SYSCALL $@
60 cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \ 61 cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
61 -Wl,-T,$(filter-out FORCE,$^) -o $@ 62 -Wl,-T,$(filter-out FORCE,$^) -o $@
62 63
63export CPPFLAGS_vsyscall_32.lds += -P -C -U$(ARCH) 64export CPPFLAGS_vsyscall_32.lds += -P -C -Ui386
64 65
65vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \ 66vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
66 $(call ld-option, -Wl$(comma)--hash-style=sysv) 67 $(call ld-option, -Wl$(comma)--hash-style=sysv)
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index 466337ae9a1e..5a88890d8ee9 100644
--- a/arch/x86/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -3,7 +3,9 @@
3# 3#
4 4
5extra-y := head_64.o head64.o init_task.o vmlinux.lds 5extra-y := head_64.o head64.o init_task.o vmlinux.lds
6CPPFLAGS_vmlinux.lds += -Ux86_64
6EXTRA_AFLAGS := -traditional 7EXTRA_AFLAGS := -traditional
8
7obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ 9obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \
8 ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \ 10 ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \
9 x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \ 11 x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \
@@ -25,7 +27,7 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump_64.o
25obj-$(CONFIG_PM) += suspend_64.o 27obj-$(CONFIG_PM) += suspend_64.o
26obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o 28obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o
27obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 29obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
28obj-$(CONFIG_IOMMU) += pci-gart_64.o aperture_64.o 30obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o
29obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o 31obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o
30obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o 32obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o
31obj-$(CONFIG_KPROBES) += kprobes_64.o 33obj-$(CONFIG_KPROBES) += kprobes_64.o
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 289247d974c6..0ca27c7b0e8d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -637,6 +637,38 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
637 } 637 }
638 638
639 hpet_address = hpet_tbl->address.address; 639 hpet_address = hpet_tbl->address.address;
640
641 /*
642 * Some broken BIOSes advertise HPET at 0x0. We really do not
643 * want to allocate a resource there.
644 */
645 if (!hpet_address) {
646 printk(KERN_WARNING PREFIX
647 "HPET id: %#x base: %#lx is invalid\n",
648 hpet_tbl->id, hpet_address);
649 return 0;
650 }
651#ifdef CONFIG_X86_64
652 /*
653 * Some even more broken BIOSes advertise HPET at
654 * 0xfed0000000000000 instead of 0xfed00000. Fix it up and add
655 * some noise:
656 */
657 if (hpet_address == 0xfed0000000000000UL) {
658 if (!hpet_force_user) {
659 printk(KERN_WARNING PREFIX "HPET id: %#x "
660 "base: 0xfed0000000000000 is bogus\n "
661 "try hpet=force on the kernel command line to "
662 "fix it up to 0xfed00000.\n", hpet_tbl->id);
663 hpet_address = 0;
664 return 0;
665 }
666 printk(KERN_WARNING PREFIX
667 "HPET id: %#x base: 0xfed0000000000000 fixed up "
668 "to 0xfed00000.\n", hpet_tbl->id);
669 hpet_address >>= 32;
670 }
671#endif
640 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 672 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
641 hpet_tbl->id, hpet_address); 673 hpet_tbl->id, hpet_address);
642 674
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index 2ed0a4ce62f0..a25db514c719 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
49 if (cpu_has(c, X86_FEATURE_EST)) 49 if (cpu_has(c, X86_FEATURE_EST))
50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; 50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
51 51
52 if (cpu_has(c, X86_FEATURE_ACPI))
53 buf[2] |= ACPI_PDC_T_FFH;
54
52 obj->type = ACPI_TYPE_BUFFER; 55 obj->type = ACPI_TYPE_BUFFER;
53 obj->buffer.length = 12; 56 obj->buffer.length = 12;
54 obj->buffer.pointer = (u8 *) buf; 57 obj->buffer.pointer = (u8 *) buf;
@@ -62,8 +65,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
62/* Initialize _PDC data based on the CPU vendor */ 65/* Initialize _PDC data based on the CPU vendor */
63void arch_acpi_processor_init_pdc(struct acpi_processor *pr) 66void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
64{ 67{
65 unsigned int cpu = pr->id; 68 struct cpuinfo_x86 *c = &cpu_data(pr->id);
66 struct cpuinfo_x86 *c = &cpu_data(cpu);
67 69
68 pr->pdc = NULL; 70 pr->pdc = NULL;
69 if (c->x86_vendor == X86_VENDOR_INTEL) 71 if (c->x86_vendor == X86_VENDOR_INTEL)
diff --git a/arch/x86/kernel/acpi/sleep_64.c b/arch/x86/kernel/acpi/sleep_64.c
index 79475d237071..da42de261ba8 100644
--- a/arch/x86/kernel/acpi/sleep_64.c
+++ b/arch/x86/kernel/acpi/sleep_64.c
@@ -115,6 +115,3 @@ static int __init acpi_sleep_setup(char *str)
115 115
116__setup("acpi_sleep=", acpi_sleep_setup); 116__setup("acpi_sleep=", acpi_sleep_setup);
117 117
118void acpi_pci_link_exit(void)
119{
120}
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/apic_32.c b/arch/x86/kernel/apic_32.c
index 08b07c176962..96986b46bc85 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -789,7 +789,7 @@ void __init sync_Arb_IDs(void)
789 * Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 And not 789 * Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 And not
790 * needed on AMD. 790 * needed on AMD.
791 */ 791 */
792 if (modern_apic()) 792 if (modern_apic() || boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
793 return; 793 return;
794 /* 794 /*
795 * Wait for idle. 795 * Wait for idle.
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/cpufreq/Kconfig_32 b/arch/x86/kernel/cpu/cpufreq/Kconfig
index d8c6f132dc7a..151eda0a23fc 100644
--- a/arch/x86/kernel/cpu/cpufreq/Kconfig_32
+++ b/arch/x86/kernel/cpu/cpufreq/Kconfig
@@ -19,6 +19,9 @@ config X86_ACPI_CPUFREQ
19 Processor Performance States. 19 Processor Performance States.
20 This driver also supports Intel Enhanced Speedstep. 20 This driver also supports Intel Enhanced Speedstep.
21 21
22 To compile this driver as a module, choose M here: the
23 module will be called acpi-cpufreq.
24
22 For details, take a look at <file:Documentation/cpu-freq/>. 25 For details, take a look at <file:Documentation/cpu-freq/>.
23 26
24 If in doubt, say N. 27 If in doubt, say N.
@@ -26,7 +29,7 @@ config X86_ACPI_CPUFREQ
26config ELAN_CPUFREQ 29config ELAN_CPUFREQ
27 tristate "AMD Elan SC400 and SC410" 30 tristate "AMD Elan SC400 and SC410"
28 select CPU_FREQ_TABLE 31 select CPU_FREQ_TABLE
29 depends on X86_ELAN 32 depends on X86_32 && X86_ELAN
30 ---help--- 33 ---help---
31 This adds the CPUFreq driver for AMD Elan SC400 and SC410 34 This adds the CPUFreq driver for AMD Elan SC400 and SC410
32 processors. 35 processors.
@@ -42,7 +45,7 @@ config ELAN_CPUFREQ
42config SC520_CPUFREQ 45config SC520_CPUFREQ
43 tristate "AMD Elan SC520" 46 tristate "AMD Elan SC520"
44 select CPU_FREQ_TABLE 47 select CPU_FREQ_TABLE
45 depends on X86_ELAN 48 depends on X86_32 && X86_ELAN
46 ---help--- 49 ---help---
47 This adds the CPUFreq driver for AMD Elan SC520 processor. 50 This adds the CPUFreq driver for AMD Elan SC520 processor.
48 51
@@ -54,6 +57,7 @@ config SC520_CPUFREQ
54config X86_POWERNOW_K6 57config X86_POWERNOW_K6
55 tristate "AMD Mobile K6-2/K6-3 PowerNow!" 58 tristate "AMD Mobile K6-2/K6-3 PowerNow!"
56 select CPU_FREQ_TABLE 59 select CPU_FREQ_TABLE
60 depends on X86_32
57 help 61 help
58 This adds the CPUFreq driver for mobile AMD K6-2+ and mobile 62 This adds the CPUFreq driver for mobile AMD K6-2+ and mobile
59 AMD K6-3+ processors. 63 AMD K6-3+ processors.
@@ -65,6 +69,7 @@ config X86_POWERNOW_K6
65config X86_POWERNOW_K7 69config X86_POWERNOW_K7
66 tristate "AMD Mobile Athlon/Duron PowerNow!" 70 tristate "AMD Mobile Athlon/Duron PowerNow!"
67 select CPU_FREQ_TABLE 71 select CPU_FREQ_TABLE
72 depends on X86_32
68 help 73 help
69 This adds the CPUFreq driver for mobile AMD K7 mobile processors. 74 This adds the CPUFreq driver for mobile AMD K7 mobile processors.
70 75
@@ -76,23 +81,27 @@ config X86_POWERNOW_K7_ACPI
76 bool 81 bool
77 depends on X86_POWERNOW_K7 && ACPI_PROCESSOR 82 depends on X86_POWERNOW_K7 && ACPI_PROCESSOR
78 depends on !(X86_POWERNOW_K7 = y && ACPI_PROCESSOR = m) 83 depends on !(X86_POWERNOW_K7 = y && ACPI_PROCESSOR = m)
84 depends on X86_32
79 default y 85 default y
80 86
81config X86_POWERNOW_K8 87config X86_POWERNOW_K8
82 tristate "AMD Opteron/Athlon64 PowerNow!" 88 tristate "AMD Opteron/Athlon64 PowerNow!"
83 select CPU_FREQ_TABLE 89 select CPU_FREQ_TABLE
84 depends on EXPERIMENTAL
85 help 90 help
86 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. 91 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
87 92
93 To compile this driver as a module, choose M here: the
94 module will be called powernow-k8.
95
88 For details, take a look at <file:Documentation/cpu-freq/>. 96 For details, take a look at <file:Documentation/cpu-freq/>.
89 97
90 If in doubt, say N. 98 If in doubt, say N.
91 99
92config X86_POWERNOW_K8_ACPI 100config X86_POWERNOW_K8_ACPI
93 bool "ACPI Support" 101 bool
94 select ACPI_PROCESSOR 102 prompt "ACPI Support" if X86_32
95 depends on ACPI && X86_POWERNOW_K8 103 depends on ACPI && X86_POWERNOW_K8 && ACPI_PROCESSOR
104 depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m)
96 default y 105 default y
97 help 106 help
98 This provides access to the K8s Processor Performance States via ACPI. 107 This provides access to the K8s Processor Performance States via ACPI.
@@ -104,7 +113,7 @@ config X86_POWERNOW_K8_ACPI
104 113
105config X86_GX_SUSPMOD 114config X86_GX_SUSPMOD
106 tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation" 115 tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
107 depends on PCI 116 depends on X86_32 && PCI
108 help 117 help
109 This add the CPUFreq driver for NatSemi Geode processors which 118 This add the CPUFreq driver for NatSemi Geode processors which
110 support suspend modulation. 119 support suspend modulation.
@@ -114,15 +123,20 @@ config X86_GX_SUSPMOD
114 If in doubt, say N. 123 If in doubt, say N.
115 124
116config X86_SPEEDSTEP_CENTRINO 125config X86_SPEEDSTEP_CENTRINO
117 tristate "Intel Enhanced SpeedStep" 126 tristate "Intel Enhanced SpeedStep (deprecated)"
118 select CPU_FREQ_TABLE 127 select CPU_FREQ_TABLE
119 select X86_SPEEDSTEP_CENTRINO_TABLE 128 select X86_SPEEDSTEP_CENTRINO_TABLE if X86_32
129 depends on X86_32 || (X86_64 && ACPI_PROCESSOR)
120 help 130 help
131 This is deprecated and this functionality is now merged into
132 acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
133 speedstep_centrino.
121 This adds the CPUFreq driver for Enhanced SpeedStep enabled 134 This adds the CPUFreq driver for Enhanced SpeedStep enabled
122 mobile CPUs. This means Intel Pentium M (Centrino) CPUs. However, 135 mobile CPUs. This means Intel Pentium M (Centrino) CPUs
123 you also need to say Y to "Use ACPI tables to decode..." below 136 or 64bit enabled Intel Xeons.
124 [which might imply enabling ACPI] if you want to use this driver 137
125 on non-Banias CPUs. 138 To compile this driver as a module, choose M here: the
139 module will be called speedstep-centrino.
126 140
127 For details, take a look at <file:Documentation/cpu-freq/>. 141 For details, take a look at <file:Documentation/cpu-freq/>.
128 142
@@ -130,7 +144,7 @@ config X86_SPEEDSTEP_CENTRINO
130 144
131config X86_SPEEDSTEP_CENTRINO_TABLE 145config X86_SPEEDSTEP_CENTRINO_TABLE
132 bool "Built-in tables for Banias CPUs" 146 bool "Built-in tables for Banias CPUs"
133 depends on X86_SPEEDSTEP_CENTRINO 147 depends on X86_32 && X86_SPEEDSTEP_CENTRINO
134 default y 148 default y
135 help 149 help
136 Use built-in tables for Banias CPUs if ACPI encoding 150 Use built-in tables for Banias CPUs if ACPI encoding
@@ -141,6 +155,7 @@ config X86_SPEEDSTEP_CENTRINO_TABLE
141config X86_SPEEDSTEP_ICH 155config X86_SPEEDSTEP_ICH
142 tristate "Intel Speedstep on ICH-M chipsets (ioport interface)" 156 tristate "Intel Speedstep on ICH-M chipsets (ioport interface)"
143 select CPU_FREQ_TABLE 157 select CPU_FREQ_TABLE
158 depends on X86_32
144 help 159 help
145 This adds the CPUFreq driver for certain mobile Intel Pentium III 160 This adds the CPUFreq driver for certain mobile Intel Pentium III
146 (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all 161 (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all
@@ -154,7 +169,7 @@ config X86_SPEEDSTEP_ICH
154config X86_SPEEDSTEP_SMI 169config X86_SPEEDSTEP_SMI
155 tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)" 170 tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)"
156 select CPU_FREQ_TABLE 171 select CPU_FREQ_TABLE
157 depends on EXPERIMENTAL 172 depends on X86_32 && EXPERIMENTAL
158 help 173 help
159 This adds the CPUFreq driver for certain mobile Intel Pentium III 174 This adds the CPUFreq driver for certain mobile Intel Pentium III
160 (Coppermine), all mobile Intel Pentium III-M (Tualatin) 175 (Coppermine), all mobile Intel Pentium III-M (Tualatin)
@@ -169,15 +184,24 @@ config X86_P4_CLOCKMOD
169 select CPU_FREQ_TABLE 184 select CPU_FREQ_TABLE
170 help 185 help
171 This adds the CPUFreq driver for Intel Pentium 4 / XEON 186 This adds the CPUFreq driver for Intel Pentium 4 / XEON
172 processors. 187 processors. When enabled it will lower CPU temperature by skipping
188 clocks.
189
190 This driver should be only used in exceptional
191 circumstances when very low power is needed because it causes severe
192 slowdowns and noticeable latencies. Normally Speedstep should be used
193 instead.
194
195 To compile this driver as a module, choose M here: the
196 module will be called p4-clockmod.
173 197
174 For details, take a look at <file:Documentation/cpu-freq/>. 198 For details, take a look at <file:Documentation/cpu-freq/>.
175 199
176 If in doubt, say N. 200 Unless you are absolutely sure say N.
177 201
178config X86_CPUFREQ_NFORCE2 202config X86_CPUFREQ_NFORCE2
179 tristate "nVidia nForce2 FSB changing" 203 tristate "nVidia nForce2 FSB changing"
180 depends on EXPERIMENTAL 204 depends on X86_32 && EXPERIMENTAL
181 help 205 help
182 This adds the CPUFreq driver for FSB changing on nVidia nForce2 206 This adds the CPUFreq driver for FSB changing on nVidia nForce2
183 platforms. 207 platforms.
@@ -188,6 +212,7 @@ config X86_CPUFREQ_NFORCE2
188 212
189config X86_LONGRUN 213config X86_LONGRUN
190 tristate "Transmeta LongRun" 214 tristate "Transmeta LongRun"
215 depends on X86_32
191 help 216 help
192 This adds the CPUFreq driver for Transmeta Crusoe and Efficeon processors 217 This adds the CPUFreq driver for Transmeta Crusoe and Efficeon processors
193 which support LongRun. 218 which support LongRun.
@@ -199,7 +224,7 @@ config X86_LONGRUN
199config X86_LONGHAUL 224config X86_LONGHAUL
200 tristate "VIA Cyrix III Longhaul" 225 tristate "VIA Cyrix III Longhaul"
201 select CPU_FREQ_TABLE 226 select CPU_FREQ_TABLE
202 depends on ACPI_PROCESSOR 227 depends on X86_32 && ACPI_PROCESSOR
203 help 228 help
204 This adds the CPUFreq driver for VIA Samuel/CyrixIII, 229 This adds the CPUFreq driver for VIA Samuel/CyrixIII,
205 VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T 230 VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T
@@ -212,7 +237,7 @@ config X86_LONGHAUL
212config X86_E_POWERSAVER 237config X86_E_POWERSAVER
213 tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)" 238 tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)"
214 select CPU_FREQ_TABLE 239 select CPU_FREQ_TABLE
215 depends on EXPERIMENTAL 240 depends on X86_32 && EXPERIMENTAL
216 help 241 help
217 This adds the CPUFreq driver for VIA C7 processors. 242 This adds the CPUFreq driver for VIA C7 processors.
218 243
@@ -233,11 +258,11 @@ config X86_ACPI_CPUFREQ_PROC_INTF
233 258
234config X86_SPEEDSTEP_LIB 259config X86_SPEEDSTEP_LIB
235 tristate 260 tristate
236 default X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD 261 default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD)
237 262
238config X86_SPEEDSTEP_RELAXED_CAP_CHECK 263config X86_SPEEDSTEP_RELAXED_CAP_CHECK
239 bool "Relaxed speedstep capability checks" 264 bool "Relaxed speedstep capability checks"
240 depends on (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH) 265 depends on X86_32 && (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH)
241 help 266 help
242 Don't perform all checks for a speedstep capable system which would 267 Don't perform all checks for a speedstep capable system which would
243 normally be done. Some ancient or strange systems, though speedstep 268 normally be done. Some ancient or strange systems, though speedstep
diff --git a/arch/x86/kernel/cpu/cpufreq/Kconfig_64 b/arch/x86/kernel/cpu/cpufreq/Kconfig_64
deleted file mode 100644
index 9c9699fdcf52..000000000000
--- a/arch/x86/kernel/cpu/cpufreq/Kconfig_64
+++ /dev/null
@@ -1,108 +0,0 @@
1#
2# CPU Frequency scaling
3#
4
5menu "CPU Frequency scaling"
6
7source "drivers/cpufreq/Kconfig"
8
9if CPU_FREQ
10
11comment "CPUFreq processor drivers"
12
13config X86_POWERNOW_K8
14 tristate "AMD Opteron/Athlon64 PowerNow!"
15 select CPU_FREQ_TABLE
16 help
17 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
18
19 To compile this driver as a module, choose M here: the
20 module will be called powernow-k8.
21
22 For details, take a look at <file:Documentation/cpu-freq/>.
23
24 If in doubt, say N.
25
26config X86_POWERNOW_K8_ACPI
27 bool
28 depends on X86_POWERNOW_K8 && ACPI_PROCESSOR
29 depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m)
30 default y
31
32config X86_SPEEDSTEP_CENTRINO
33 tristate "Intel Enhanced SpeedStep (deprecated)"
34 select CPU_FREQ_TABLE
35 depends on ACPI_PROCESSOR
36 help
37 This is deprecated and this functionality is now merged into
38 acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
39 speedstep_centrino.
40 This adds the CPUFreq driver for Enhanced SpeedStep enabled
41 mobile CPUs. This means Intel Pentium M (Centrino) CPUs
42 or 64bit enabled Intel Xeons.
43
44 To compile this driver as a module, choose M here: the
45 module will be called speedstep-centrino.
46
47 For details, take a look at <file:Documentation/cpu-freq/>.
48
49 If in doubt, say N.
50
51config X86_ACPI_CPUFREQ
52 tristate "ACPI Processor P-States driver"
53 select CPU_FREQ_TABLE
54 depends on ACPI_PROCESSOR
55 help
56 This driver adds a CPUFreq driver which utilizes the ACPI
57 Processor Performance States.
58 This driver also supports Intel Enhanced Speedstep.
59
60 To compile this driver as a module, choose M here: the
61 module will be called acpi-cpufreq.
62
63 For details, take a look at <file:Documentation/cpu-freq/>.
64
65 If in doubt, say N.
66
67comment "shared options"
68
69config X86_ACPI_CPUFREQ_PROC_INTF
70 bool "/proc/acpi/processor/../performance interface (deprecated)"
71 depends on PROC_FS
72 depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K8_ACPI
73 help
74 This enables the deprecated /proc/acpi/processor/../performance
75 interface. While it is helpful for debugging, the generic,
76 cross-architecture cpufreq interfaces should be used.
77
78 If in doubt, say N.
79
80config X86_P4_CLOCKMOD
81 tristate "Intel Pentium 4 clock modulation"
82 depends on EMBEDDED
83 select CPU_FREQ_TABLE
84 help
85 This adds the clock modulation driver for Intel Pentium 4 / XEON
86 processors. When enabled it will lower CPU temperature by skipping
87 clocks.
88
89 This driver should be only used in exceptional
90 circumstances when very low power is needed because it causes severe
91 slowdowns and noticeable latencies. Normally Speedstep should be used
92 instead.
93
94 To compile this driver as a module, choose M here: the
95 module will be called p4-clockmod.
96
97 For details, take a look at <file:Documentation/cpu-freq/>.
98
99 Unless you are absolutely sure say N.
100
101
102config X86_SPEEDSTEP_LIB
103 tristate
104 default X86_P4_CLOCKMOD
105
106endif
107
108endmenu
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 9c36a53676b7..99e1ef9939be 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -46,7 +46,7 @@
46 46
47#define PFX "powernow-k8: " 47#define PFX "powernow-k8: "
48#define BFX PFX "BIOS error: " 48#define BFX PFX "BIOS error: "
49#define VERSION "version 2.00.00" 49#define VERSION "version 2.20.00"
50#include "powernow-k8.h" 50#include "powernow-k8.h"
51 51
52/* serialize freq changes */ 52/* serialize freq changes */
@@ -73,33 +73,11 @@ static u32 find_khz_freq_from_fid(u32 fid)
73 return 1000 * find_freq_from_fid(fid); 73 return 1000 * find_freq_from_fid(fid);
74} 74}
75 75
76/* Return a frequency in MHz, given an input fid and did */ 76static u32 find_khz_freq_from_pstate(struct cpufreq_frequency_table *data, u32 pstate)
77static u32 find_freq_from_fiddid(u32 fid, u32 did)
78{ 77{
79 if (current_cpu_data.x86 == 0x10) 78 return data[pstate].frequency;
80 return 100 * (fid + 0x10) >> did;
81 else
82 return 100 * (fid + 0x8) >> did;
83}
84
85static u32 find_khz_freq_from_fiddid(u32 fid, u32 did)
86{
87 return 1000 * find_freq_from_fiddid(fid, did);
88}
89
90static u32 find_fid_from_pstate(u32 pstate)
91{
92 u32 hi, lo;
93 rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
94 return lo & HW_PSTATE_FID_MASK;
95} 79}
96 80
97static u32 find_did_from_pstate(u32 pstate)
98{
99 u32 hi, lo;
100 rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
101 return (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
102}
103 81
104/* Return the vco fid for an input fid 82/* Return the vco fid for an input fid
105 * 83 *
@@ -142,9 +120,7 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
142 if (cpu_family == CPU_HW_PSTATE) { 120 if (cpu_family == CPU_HW_PSTATE) {
143 rdmsr(MSR_PSTATE_STATUS, lo, hi); 121 rdmsr(MSR_PSTATE_STATUS, lo, hi);
144 i = lo & HW_PSTATE_MASK; 122 i = lo & HW_PSTATE_MASK;
145 rdmsr(MSR_PSTATE_DEF_BASE + i, lo, hi); 123 data->currpstate = i;
146 data->currfid = lo & HW_PSTATE_FID_MASK;
147 data->currdid = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
148 return 0; 124 return 0;
149 } 125 }
150 do { 126 do {
@@ -295,7 +271,7 @@ static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid,
295static int transition_pstate(struct powernow_k8_data *data, u32 pstate) 271static int transition_pstate(struct powernow_k8_data *data, u32 pstate)
296{ 272{
297 wrmsr(MSR_PSTATE_CTRL, pstate, 0); 273 wrmsr(MSR_PSTATE_CTRL, pstate, 0);
298 data->currfid = find_fid_from_pstate(pstate); 274 data->currpstate = pstate;
299 return 0; 275 return 0;
300} 276}
301 277
@@ -845,17 +821,20 @@ err_out:
845static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table) 821static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table)
846{ 822{
847 int i; 823 int i;
824 u32 hi = 0, lo = 0;
825 rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo);
826 data->max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT;
848 827
849 for (i = 0; i < data->acpi_data.state_count; i++) { 828 for (i = 0; i < data->acpi_data.state_count; i++) {
850 u32 index; 829 u32 index;
851 u32 hi = 0, lo = 0; 830 u32 hi = 0, lo = 0;
852 u32 fid;
853 u32 did;
854 831
855 index = data->acpi_data.states[i].control & HW_PSTATE_MASK; 832 index = data->acpi_data.states[i].control & HW_PSTATE_MASK;
856 if (index > MAX_HW_PSTATE) { 833 if (index > data->max_hw_pstate) {
857 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index); 834 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index);
858 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n"); 835 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n");
836 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
837 continue;
859 } 838 }
860 rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); 839 rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
861 if (!(hi & HW_PSTATE_VALID_MASK)) { 840 if (!(hi & HW_PSTATE_VALID_MASK)) {
@@ -864,22 +843,9 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpuf
864 continue; 843 continue;
865 } 844 }
866 845
867 fid = lo & HW_PSTATE_FID_MASK; 846 powernow_table[i].index = index;
868 did = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
869 847
870 dprintk(" %d : fid 0x%x, did 0x%x\n", index, fid, did); 848 powernow_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000;
871
872 powernow_table[i].index = index | (fid << HW_FID_INDEX_SHIFT) | (did << HW_DID_INDEX_SHIFT);
873
874 powernow_table[i].frequency = find_khz_freq_from_fiddid(fid, did);
875
876 if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) {
877 printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n",
878 powernow_table[i].frequency,
879 (unsigned int) (data->acpi_data.states[i].core_frequency * 1000));
880 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
881 continue;
882 }
883 } 849 }
884 return 0; 850 return 0;
885} 851}
@@ -1020,22 +986,18 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned i
1020/* Take a frequency, and issue the hardware pstate transition command */ 986/* Take a frequency, and issue the hardware pstate transition command */
1021static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index) 987static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index)
1022{ 988{
1023 u32 fid = 0;
1024 u32 did = 0;
1025 u32 pstate = 0; 989 u32 pstate = 0;
1026 int res, i; 990 int res, i;
1027 struct cpufreq_freqs freqs; 991 struct cpufreq_freqs freqs;
1028 992
1029 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); 993 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index);
1030 994
1031 /* get fid did for hardware pstate transition */ 995 /* get MSR index for hardware pstate transition */
1032 pstate = index & HW_PSTATE_MASK; 996 pstate = index & HW_PSTATE_MASK;
1033 if (pstate > MAX_HW_PSTATE) 997 if (pstate > data->max_hw_pstate)
1034 return 0; 998 return 0;
1035 fid = (index & HW_FID_INDEX_MASK) >> HW_FID_INDEX_SHIFT; 999 freqs.old = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1036 did = (index & HW_DID_INDEX_MASK) >> HW_DID_INDEX_SHIFT; 1000 freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
1037 freqs.old = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1038 freqs.new = find_khz_freq_from_fiddid(fid, did);
1039 1001
1040 for_each_cpu_mask(i, *(data->available_cores)) { 1002 for_each_cpu_mask(i, *(data->available_cores)) {
1041 freqs.cpu = i; 1003 freqs.cpu = i;
@@ -1043,9 +1005,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
1043 } 1005 }
1044 1006
1045 res = transition_pstate(data, pstate); 1007 res = transition_pstate(data, pstate);
1046 data->currfid = find_fid_from_pstate(pstate); 1008 freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
1047 data->currdid = find_did_from_pstate(pstate);
1048 freqs.new = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1049 1009
1050 for_each_cpu_mask(i, *(data->available_cores)) { 1010 for_each_cpu_mask(i, *(data->available_cores)) {
1051 freqs.cpu = i; 1011 freqs.cpu = i;
@@ -1090,10 +1050,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1090 if (query_current_values_with_pending_wait(data)) 1050 if (query_current_values_with_pending_wait(data))
1091 goto err_out; 1051 goto err_out;
1092 1052
1093 if (cpu_family == CPU_HW_PSTATE) 1053 if (cpu_family != CPU_HW_PSTATE) {
1094 dprintk("targ: curr fid 0x%x, did 0x%x\n",
1095 data->currfid, data->currdid);
1096 else {
1097 dprintk("targ: curr fid 0x%x, vid 0x%x\n", 1054 dprintk("targ: curr fid 0x%x, vid 0x%x\n",
1098 data->currfid, data->currvid); 1055 data->currfid, data->currvid);
1099 1056
@@ -1124,7 +1081,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1124 mutex_unlock(&fidvid_mutex); 1081 mutex_unlock(&fidvid_mutex);
1125 1082
1126 if (cpu_family == CPU_HW_PSTATE) 1083 if (cpu_family == CPU_HW_PSTATE)
1127 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1084 pol->cur = find_khz_freq_from_pstate(data->powernow_table, newstate);
1128 else 1085 else
1129 pol->cur = find_khz_freq_from_fid(data->currfid); 1086 pol->cur = find_khz_freq_from_fid(data->currfid);
1130 ret = 0; 1087 ret = 0;
@@ -1223,7 +1180,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1223 + (3 * (1 << data->irt) * 10)) * 1000; 1180 + (3 * (1 << data->irt) * 10)) * 1000;
1224 1181
1225 if (cpu_family == CPU_HW_PSTATE) 1182 if (cpu_family == CPU_HW_PSTATE)
1226 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1183 pol->cur = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1227 else 1184 else
1228 pol->cur = find_khz_freq_from_fid(data->currfid); 1185 pol->cur = find_khz_freq_from_fid(data->currfid);
1229 dprintk("policy current frequency %d kHz\n", pol->cur); 1186 dprintk("policy current frequency %d kHz\n", pol->cur);
@@ -1240,8 +1197,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1240 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); 1197 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu);
1241 1198
1242 if (cpu_family == CPU_HW_PSTATE) 1199 if (cpu_family == CPU_HW_PSTATE)
1243 dprintk("cpu_init done, current fid 0x%x, did 0x%x\n", 1200 dprintk("cpu_init done, current pstate 0x%x\n", data->currpstate);
1244 data->currfid, data->currdid);
1245 else 1201 else
1246 dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n", 1202 dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n",
1247 data->currfid, data->currvid); 1203 data->currfid, data->currvid);
@@ -1297,7 +1253,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
1297 goto out; 1253 goto out;
1298 1254
1299 if (cpu_family == CPU_HW_PSTATE) 1255 if (cpu_family == CPU_HW_PSTATE)
1300 khz = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1256 khz = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1301 else 1257 else
1302 khz = find_khz_freq_from_fid(data->currfid); 1258 khz = find_khz_freq_from_fid(data->currfid);
1303 1259
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
index 7c4f6e0faed4..afd2b520d35c 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
@@ -10,6 +10,7 @@ struct powernow_k8_data {
10 10
11 u32 numps; /* number of p-states */ 11 u32 numps; /* number of p-states */
12 u32 batps; /* number of p-states supported on battery */ 12 u32 batps; /* number of p-states supported on battery */
13 u32 max_hw_pstate; /* maximum legal hardware pstate */
13 14
14 /* these values are constant when the PSB is used to determine 15 /* these values are constant when the PSB is used to determine
15 * vid/fid pairings, but are modified during the ->target() call 16 * vid/fid pairings, but are modified during the ->target() call
@@ -21,8 +22,8 @@ struct powernow_k8_data {
21 u32 plllock; /* pll lock time, units 1 us */ 22 u32 plllock; /* pll lock time, units 1 us */
22 u32 exttype; /* extended interface = 1 */ 23 u32 exttype; /* extended interface = 1 */
23 24
24 /* keep track of the current fid / vid or did */ 25 /* keep track of the current fid / vid or pstate */
25 u32 currvid, currfid, currdid; 26 u32 currvid, currfid, currpstate;
26 27
27 /* the powernow_table includes all frequency and vid/fid pairings: 28 /* the powernow_table includes all frequency and vid/fid pairings:
28 * fid are the lower 8 bits of the index, vid are the upper 8 bits. 29 * fid are the lower 8 bits of the index, vid are the upper 8 bits.
@@ -87,23 +88,14 @@ struct powernow_k8_data {
87 88
88/* Hardware Pstate _PSS and MSR definitions */ 89/* Hardware Pstate _PSS and MSR definitions */
89#define USE_HW_PSTATE 0x00000080 90#define USE_HW_PSTATE 0x00000080
90#define HW_PSTATE_FID_MASK 0x0000003f
91#define HW_PSTATE_DID_MASK 0x000001c0
92#define HW_PSTATE_DID_SHIFT 6
93#define HW_PSTATE_MASK 0x00000007 91#define HW_PSTATE_MASK 0x00000007
94#define HW_PSTATE_VALID_MASK 0x80000000 92#define HW_PSTATE_VALID_MASK 0x80000000
95#define HW_FID_INDEX_SHIFT 8 93#define HW_PSTATE_MAX_MASK 0x000000f0
96#define HW_FID_INDEX_MASK 0x0000ff00 94#define HW_PSTATE_MAX_SHIFT 4
97#define HW_DID_INDEX_SHIFT 16
98#define HW_DID_INDEX_MASK 0x00ff0000
99#define HW_WATTS_MASK 0xff
100#define HW_PWR_DVR_MASK 0x300
101#define HW_PWR_DVR_SHIFT 8
102#define HW_PWR_MAX_MULT 3
103#define MAX_HW_PSTATE 8 /* hw pstate supports up to 8 */
104#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */ 95#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */
105#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */ 96#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */
106#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */ 97#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */
98#define MSR_PSTATE_CUR_LIMIT 0xc0010061 /* pstate current limit MSR */
107 99
108/* define the two driver architectures */ 100/* define the two driver architectures */
109#define CPU_OPTERON 0 101#define CPU_OPTERON 0
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index b9f802e35209..4b21d29fb5aa 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -802,13 +802,15 @@ static struct sysdev_attribute *mce_attributes[] = {
802 NULL 802 NULL
803}; 803};
804 804
805static cpumask_t mce_device_initialized = CPU_MASK_NONE;
806
805/* Per cpu sysdev init. All of the cpus still share the same ctl bank */ 807/* Per cpu sysdev init. All of the cpus still share the same ctl bank */
806static __cpuinit int mce_create_device(unsigned int cpu) 808static __cpuinit int mce_create_device(unsigned int cpu)
807{ 809{
808 int err; 810 int err;
809 int i; 811 int i;
810 812
811 if (!mce_available(&cpu_data(cpu))) 813 if (!mce_available(&boot_cpu_data))
812 return -EIO; 814 return -EIO;
813 815
814 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); 816 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject));
@@ -825,6 +827,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
825 if (err) 827 if (err)
826 goto error; 828 goto error;
827 } 829 }
830 cpu_set(cpu, mce_device_initialized);
828 831
829 return 0; 832 return 0;
830error: 833error:
@@ -841,10 +844,14 @@ static void mce_remove_device(unsigned int cpu)
841{ 844{
842 int i; 845 int i;
843 846
847 if (!cpu_isset(cpu, mce_device_initialized))
848 return;
849
844 for (i = 0; mce_attributes[i]; i++) 850 for (i = 0; mce_attributes[i]; i++)
845 sysdev_remove_file(&per_cpu(device_mce,cpu), 851 sysdev_remove_file(&per_cpu(device_mce,cpu),
846 mce_attributes[i]); 852 mce_attributes[i]);
847 sysdev_unregister(&per_cpu(device_mce,cpu)); 853 sysdev_unregister(&per_cpu(device_mce,cpu));
854 cpu_clear(cpu, mce_device_initialized);
848} 855}
849 856
850/* Get notified when a cpu comes on/off. Be hotplug friendly. */ 857/* Get notified when a cpu comes on/off. Be hotplug friendly. */
@@ -852,21 +859,18 @@ static int
852mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 859mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
853{ 860{
854 unsigned int cpu = (unsigned long)hcpu; 861 unsigned int cpu = (unsigned long)hcpu;
855 int err = 0;
856 862
857 switch (action) { 863 switch (action) {
858 case CPU_UP_PREPARE: 864 case CPU_ONLINE:
859 case CPU_UP_PREPARE_FROZEN: 865 case CPU_ONLINE_FROZEN:
860 err = mce_create_device(cpu); 866 mce_create_device(cpu);
861 break; 867 break;
862 case CPU_UP_CANCELED:
863 case CPU_UP_CANCELED_FROZEN:
864 case CPU_DEAD: 868 case CPU_DEAD:
865 case CPU_DEAD_FROZEN: 869 case CPU_DEAD_FROZEN:
866 mce_remove_device(cpu); 870 mce_remove_device(cpu);
867 break; 871 break;
868 } 872 }
869 return err ? NOTIFY_BAD : NOTIFY_OK; 873 return NOTIFY_OK;
870} 874}
871 875
872static struct notifier_block mce_cpu_notifier = { 876static struct notifier_block mce_cpu_notifier = {
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 9abbdf7562c5..3b20613325dc 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -139,13 +139,12 @@ struct set_mtrr_data {
139 mtrr_type smp_type; 139 mtrr_type smp_type;
140}; 140};
141 141
142#ifdef CONFIG_SMP
143
144static void ipi_handler(void *info) 142static void ipi_handler(void *info)
145/* [SUMMARY] Synchronisation handler. Executed by "other" CPUs. 143/* [SUMMARY] Synchronisation handler. Executed by "other" CPUs.
146 [RETURNS] Nothing. 144 [RETURNS] Nothing.
147*/ 145*/
148{ 146{
147#ifdef CONFIG_SMP
149 struct set_mtrr_data *data = info; 148 struct set_mtrr_data *data = info;
150 unsigned long flags; 149 unsigned long flags;
151 150
@@ -168,9 +167,8 @@ static void ipi_handler(void *info)
168 167
169 atomic_dec(&data->count); 168 atomic_dec(&data->count);
170 local_irq_restore(flags); 169 local_irq_restore(flags);
171}
172
173#endif 170#endif
171}
174 172
175static inline int types_compatible(mtrr_type type1, mtrr_type type2) { 173static inline int types_compatible(mtrr_type type1, mtrr_type type2) {
176 return type1 == MTRR_TYPE_UNCACHABLE || 174 return type1 == MTRR_TYPE_UNCACHABLE ||
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 2d42b414b777..3900e46d66db 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
@@ -89,8 +89,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
89 int fpu_exception; 89 int fpu_exception;
90 90
91#ifdef CONFIG_SMP 91#ifdef CONFIG_SMP
92 if (!cpu_online(n))
93 return 0;
94 n = c->cpu_index; 92 n = c->cpu_index;
95#endif 93#endif
96 seq_printf(m, "processor\t: %d\n" 94 seq_printf(m, "processor\t: %d\n"
@@ -177,14 +175,14 @@ static int show_cpuinfo(struct seq_file *m, void *v)
177static void *c_start(struct seq_file *m, loff_t *pos) 175static void *c_start(struct seq_file *m, loff_t *pos)
178{ 176{
179 if (*pos == 0) /* just in case, cpu 0 is not the first */ 177 if (*pos == 0) /* just in case, cpu 0 is not the first */
180 *pos = first_cpu(cpu_possible_map); 178 *pos = first_cpu(cpu_online_map);
181 if ((*pos) < NR_CPUS && cpu_possible(*pos)) 179 if ((*pos) < NR_CPUS && cpu_online(*pos))
182 return &cpu_data(*pos); 180 return &cpu_data(*pos);
183 return NULL; 181 return NULL;
184} 182}
185static void *c_next(struct seq_file *m, void *v, loff_t *pos) 183static void *c_next(struct seq_file *m, void *v, loff_t *pos)
186{ 184{
187 *pos = next_cpu(*pos, cpu_possible_map); 185 *pos = next_cpu(*pos, cpu_online_map);
188 return c_start(m, pos); 186 return c_start(m, pos);
189} 187}
190static void c_stop(struct seq_file *m, void *v) 188static void c_stop(struct seq_file *m, void *v)
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/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index edd39ccf139e..02112fcc0de7 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
+++ b/arch/x86/kernel/i386_ksyms_32.c
@@ -2,6 +2,7 @@
2#include <asm/semaphore.h> 2#include <asm/semaphore.h>
3#include <asm/checksum.h> 3#include <asm/checksum.h>
4#include <asm/desc.h> 4#include <asm/desc.h>
5#include <asm/pgtable.h>
5 6
6EXPORT_SYMBOL(__down_failed); 7EXPORT_SYMBOL(__down_failed);
7EXPORT_SYMBOL(__down_failed_interruptible); 8EXPORT_SYMBOL(__down_failed_interruptible);
@@ -29,3 +30,4 @@ EXPORT_SYMBOL(__read_lock_failed);
29#endif 30#endif
30 31
31EXPORT_SYMBOL(csum_partial); 32EXPORT_SYMBOL(csum_partial);
33EXPORT_SYMBOL(empty_zero_page);
diff --git a/arch/x86/kernel/i387_64.c b/arch/x86/kernel/i387_64.c
index 56c1f1147109..bfaff28fb134 100644
--- a/arch/x86/kernel/i387_64.c
+++ b/arch/x86/kernel/i387_64.c
@@ -92,13 +92,14 @@ int save_i387(struct _fpstate __user *buf)
92 if (task_thread_info(tsk)->status & TS_USEDFPU) { 92 if (task_thread_info(tsk)->status & TS_USEDFPU) {
93 err = save_i387_checking((struct i387_fxsave_struct __user *)buf); 93 err = save_i387_checking((struct i387_fxsave_struct __user *)buf);
94 if (err) return err; 94 if (err) return err;
95 task_thread_info(tsk)->status &= ~TS_USEDFPU;
95 stts(); 96 stts();
96 } else { 97 } else {
97 if (__copy_to_user(buf, &tsk->thread.i387.fxsave, 98 if (__copy_to_user(buf, &tsk->thread.i387.fxsave,
98 sizeof(struct i387_fxsave_struct))) 99 sizeof(struct i387_fxsave_struct)))
99 return -1; 100 return -1;
100 } 101 }
101 return 1; 102 return 1;
102} 103}
103 104
104/* 105/*
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index f35c6eb33da9..6cf27319a91c 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -962,7 +962,7 @@ static int EISA_ELCR(unsigned int irq)
962#define default_MCA_trigger(idx) (1) 962#define default_MCA_trigger(idx) (1)
963#define default_MCA_polarity(idx) (0) 963#define default_MCA_polarity(idx) (0)
964 964
965static int __init MPBIOS_polarity(int idx) 965static int MPBIOS_polarity(int idx)
966{ 966{
967 int bus = mp_irqs[idx].mpc_srcbus; 967 int bus = mp_irqs[idx].mpc_srcbus;
968 int polarity; 968 int polarity;
@@ -2166,6 +2166,10 @@ static inline void __init check_timer(void)
2166{ 2166{
2167 int apic1, pin1, apic2, pin2; 2167 int apic1, pin1, apic2, pin2;
2168 int vector; 2168 int vector;
2169 unsigned int ver;
2170
2171 ver = apic_read(APIC_LVR);
2172 ver = GET_APIC_VERSION(ver);
2169 2173
2170 /* 2174 /*
2171 * get/set the timer IRQ vector: 2175 * get/set the timer IRQ vector:
@@ -2179,11 +2183,15 @@ static inline void __init check_timer(void)
2179 * mode for the 8259A whenever interrupts are routed 2183 * mode for the 8259A whenever interrupts are routed
2180 * through I/O APICs. Also IRQ0 has to be enabled in 2184 * through I/O APICs. Also IRQ0 has to be enabled in
2181 * the 8259A which implies the virtual wire has to be 2185 * the 8259A which implies the virtual wire has to be
2182 * disabled in the local APIC. 2186 * disabled in the local APIC. Finally timer interrupts
2187 * need to be acknowledged manually in the 8259A for
2188 * timer_interrupt() and for the i82489DX when using
2189 * the NMI watchdog.
2183 */ 2190 */
2184 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 2191 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
2185 init_8259A(1); 2192 init_8259A(1);
2186 timer_ack = 1; 2193 timer_ack = !cpu_has_tsc;
2194 timer_ack |= (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver));
2187 if (timer_over_8254 > 0) 2195 if (timer_over_8254 > 0)
2188 enable_8259A_irq(0); 2196 enable_8259A_irq(0);
2189 2197
@@ -2830,6 +2838,25 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2830 return 0; 2838 return 0;
2831} 2839}
2832 2840
2841int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2842{
2843 int i;
2844
2845 if (skip_ioapic_setup)
2846 return -1;
2847
2848 for (i = 0; i < mp_irq_entries; i++)
2849 if (mp_irqs[i].mpc_irqtype == mp_INT &&
2850 mp_irqs[i].mpc_srcbusirq == bus_irq)
2851 break;
2852 if (i >= mp_irq_entries)
2853 return -1;
2854
2855 *trigger = irq_trigger(i);
2856 *polarity = irq_polarity(i);
2857 return 0;
2858}
2859
2833#endif /* CONFIG_ACPI */ 2860#endif /* CONFIG_ACPI */
2834 2861
2835static int __init parse_disable_timer_pin_1(char *arg) 2862static int __init parse_disable_timer_pin_1(char *arg)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 953328b55a30..435a8c9b55f8 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -546,7 +546,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
546#define default_PCI_trigger(idx) (1) 546#define default_PCI_trigger(idx) (1)
547#define default_PCI_polarity(idx) (1) 547#define default_PCI_polarity(idx) (1)
548 548
549static int __init MPBIOS_polarity(int idx) 549static int MPBIOS_polarity(int idx)
550{ 550{
551 int bus = mp_irqs[idx].mpc_srcbus; 551 int bus = mp_irqs[idx].mpc_srcbus;
552 int polarity; 552 int polarity;
@@ -2222,8 +2222,27 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
2222 return 0; 2222 return 0;
2223} 2223}
2224 2224
2225#endif /* CONFIG_ACPI */
2226 2225
2226int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2227{
2228 int i;
2229
2230 if (skip_ioapic_setup)
2231 return -1;
2232
2233 for (i = 0; i < mp_irq_entries; i++)
2234 if (mp_irqs[i].mpc_irqtype == mp_INT &&
2235 mp_irqs[i].mpc_srcbusirq == bus_irq)
2236 break;
2237 if (i >= mp_irq_entries)
2238 return -1;
2239
2240 *trigger = irq_trigger(i);
2241 *polarity = irq_polarity(i);
2242 return 0;
2243}
2244
2245#endif /* CONFIG_ACPI */
2227 2246
2228/* 2247/*
2229 * This function currently is only a helper for the i386 smp boot process where 2248 * This function currently is only a helper for the i386 smp boot process where
@@ -2260,3 +2279,4 @@ void __init setup_ioapic_dest(void)
2260 } 2279 }
2261} 2280}
2262#endif 2281#endif
2282
diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
index 90f778c04b3f..d87a523070d1 100644
--- a/arch/x86/kernel/kprobes_32.c
+++ b/arch/x86/kernel/kprobes_32.c
@@ -564,12 +564,7 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
564 564
565 resume_execution(cur, regs, kcb); 565 resume_execution(cur, regs, kcb);
566 regs->eflags |= kcb->kprobe_saved_eflags; 566 regs->eflags |= kcb->kprobe_saved_eflags;
567#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 567 trace_hardirqs_fixup_flags(regs->eflags);
568 if (raw_irqs_disabled_flags(regs->eflags))
569 trace_hardirqs_off();
570 else
571 trace_hardirqs_on();
572#endif
573 568
574 /*Restore back the original saved kprobes variables and continue. */ 569 /*Restore back the original saved kprobes variables and continue. */
575 if (kcb->kprobe_status == KPROBE_REENTER) { 570 if (kcb->kprobe_status == KPROBE_REENTER) {
diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index 681b801c5e26..0c467644589c 100644
--- a/arch/x86/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
@@ -58,7 +58,7 @@ const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
58/* 58/*
59 * returns non-zero if opcode modifies the interrupt flag. 59 * returns non-zero if opcode modifies the interrupt flag.
60 */ 60 */
61static __always_inline int is_IF_modifier(kprobe_opcode_t *insn) 61static int __kprobes is_IF_modifier(kprobe_opcode_t *insn)
62{ 62{
63 switch (*insn) { 63 switch (*insn) {
64 case 0xfa: /* cli */ 64 case 0xfa: /* cli */
@@ -551,12 +551,7 @@ int __kprobes post_kprobe_handler(struct pt_regs *regs)
551 551
552 resume_execution(cur, regs, kcb); 552 resume_execution(cur, regs, kcb);
553 regs->eflags |= kcb->kprobe_saved_rflags; 553 regs->eflags |= kcb->kprobe_saved_rflags;
554#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 554 trace_hardirqs_fixup_flags(regs->eflags);
555 if (raw_irqs_disabled_flags(regs->eflags))
556 trace_hardirqs_off();
557 else
558 trace_hardirqs_on();
559#endif
560 555
561 /* Restore the original saved kprobes variables and continue. */ 556 /* Restore the original saved kprobes variables and continue. */
562 if (kcb->kprobe_status == KPROBE_REENTER) { 557 if (kcb->kprobe_status == KPROBE_REENTER) {
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/nmi_32.c b/arch/x86/kernel/nmi_32.c
index f803ed0ed1c4..f5cc47c60b13 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -25,6 +25,7 @@
25 25
26#include <asm/smp.h> 26#include <asm/smp.h>
27#include <asm/nmi.h> 27#include <asm/nmi.h>
28#include <asm/timer.h>
28 29
29#include "mach_traps.h" 30#include "mach_traps.h"
30 31
@@ -51,13 +52,13 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
51 52
52static int endflag __initdata = 0; 53static int endflag __initdata = 0;
53 54
54#ifdef CONFIG_SMP
55/* The performance counters used by NMI_LOCAL_APIC don't trigger when 55/* The performance counters used by NMI_LOCAL_APIC don't trigger when
56 * the CPU is idle. To make sure the NMI watchdog really ticks on all 56 * the CPU is idle. To make sure the NMI watchdog really ticks on all
57 * CPUs during the test make them busy. 57 * CPUs during the test make them busy.
58 */ 58 */
59static __init void nmi_cpu_busy(void *data) 59static __init void nmi_cpu_busy(void *data)
60{ 60{
61#ifdef CONFIG_SMP
61 local_irq_enable_in_hardirq(); 62 local_irq_enable_in_hardirq();
62 /* Intentionally don't use cpu_relax here. This is 63 /* Intentionally don't use cpu_relax here. This is
63 to make sure that the performance counter really ticks, 64 to make sure that the performance counter really ticks,
@@ -67,8 +68,8 @@ static __init void nmi_cpu_busy(void *data)
67 care if they get somewhat less cycles. */ 68 care if they get somewhat less cycles. */
68 while (endflag == 0) 69 while (endflag == 0)
69 mb(); 70 mb();
70}
71#endif 71#endif
72}
72 73
73static int __init check_nmi_watchdog(void) 74static int __init check_nmi_watchdog(void)
74{ 75{
@@ -83,7 +84,7 @@ static int __init check_nmi_watchdog(void)
83 84
84 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); 85 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
85 if (!prev_nmi_count) 86 if (!prev_nmi_count)
86 return -1; 87 goto error;
87 88
88 printk(KERN_INFO "Testing NMI watchdog ... "); 89 printk(KERN_INFO "Testing NMI watchdog ... ");
89 90
@@ -117,7 +118,7 @@ static int __init check_nmi_watchdog(void)
117 if (!atomic_read(&nmi_active)) { 118 if (!atomic_read(&nmi_active)) {
118 kfree(prev_nmi_count); 119 kfree(prev_nmi_count);
119 atomic_set(&nmi_active, -1); 120 atomic_set(&nmi_active, -1);
120 return -1; 121 goto error;
121 } 122 }
122 printk("OK.\n"); 123 printk("OK.\n");
123 124
@@ -128,6 +129,10 @@ static int __init check_nmi_watchdog(void)
128 129
129 kfree(prev_nmi_count); 130 kfree(prev_nmi_count);
130 return 0; 131 return 0;
132error:
133 timer_ack = !cpu_has_tsc;
134
135 return -1;
131} 136}
132/* This needs to happen later in boot so counters are working */ 137/* This needs to happen later in boot so counters are working */
133late_initcall(check_nmi_watchdog); 138late_initcall(check_nmi_watchdog);
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..5552d23d23c2 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -9,10 +9,10 @@
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 = 0;
16EXPORT_SYMBOL(iommu_merge); 16EXPORT_SYMBOL(iommu_merge);
17 17
18dma_addr_t bad_dma_address __read_mostly; 18dma_addr_t bad_dma_address __read_mostly;
@@ -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 ae7e0161ce46..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;
@@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
435 435
436error: 436error:
437 flush_gart(); 437 flush_gart();
438 gart_unmap_sg(dev, sg, nents, dir); 438 gart_unmap_sg(dev, sg, out, dir);
439 /* 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 */
440 if (force_iommu || iommu_merge) { 440 if (force_iommu || iommu_merge) {
441 out = dma_map_sg_nonforce(dev, sg, nents, dir); 441 out = dma_map_sg_nonforce(dev, sg, nents, dir);
@@ -627,12 +627,12 @@ void __init gart_iommu_init(void)
627 return; 627 return;
628 628
629 /* Did we detect a different HW IOMMU? */ 629 /* Did we detect a different HW IOMMU? */
630 if (iommu_detected && !iommu_aperture) 630 if (iommu_detected && !gart_iommu_aperture)
631 return; 631 return;
632 632
633 if (no_iommu || 633 if (no_iommu ||
634 (!force_iommu && end_pfn <= MAX_DMA32_PFN) || 634 (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
635 !iommu_aperture || 635 !gart_iommu_aperture ||
636 (no_agp && init_k8_gatt(&info) < 0)) { 636 (no_agp && init_k8_gatt(&info) < 0)) {
637 if (end_pfn > MAX_DMA32_PFN) { 637 if (end_pfn > MAX_DMA32_PFN) {
638 printk(KERN_ERR "WARNING more than 4GB of memory " 638 printk(KERN_ERR "WARNING more than 4GB of memory "
@@ -733,9 +733,9 @@ void __init gart_parse_options(char *p)
733 fix_aperture = 0; 733 fix_aperture = 0;
734 /* duplicated from pci-dma.c */ 734 /* duplicated from pci-dma.c */
735 if (!strncmp(p,"force",5)) 735 if (!strncmp(p,"force",5))
736 iommu_aperture_allowed = 1; 736 gart_iommu_aperture_allowed = 1;
737 if (!strncmp(p,"allowed",7)) 737 if (!strncmp(p,"allowed",7))
738 iommu_aperture_allowed = 1; 738 gart_iommu_aperture_allowed = 1;
739 if (!strncmp(p, "memaper", 7)) { 739 if (!strncmp(p, "memaper", 7)) {
740 fallback_aper_force = 1; 740 fallback_aper_force = 1;
741 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/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 1a07bbea7be3..f452726c0fe2 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -39,6 +39,7 @@ struct device_fixup {
39static struct device_fixup fixups_table[] = { 39static struct device_fixup fixups_table[] = {
40{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset }, 40{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset },
41{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset }, 41{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset },
42{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE, cs5530a_warm_reset },
42}; 43};
43 44
44/* 45/*
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..30d94d1d5f5f 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -892,7 +892,6 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
892 892
893#ifdef CONFIG_SMP 893#ifdef CONFIG_SMP
894 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; 894 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
895 c->cpu_index = 0;
896#endif 895#endif
897} 896}
898 897
@@ -1040,7 +1039,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1040 /* Intel-defined (#2) */ 1039 /* Intel-defined (#2) */
1041 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 1040 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
1042 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 1041 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
1043 NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt", 1042 NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt",
1044 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1043 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1045 1044
1046 /* VIA/Cyrix/Centaur-defined */ 1045 /* VIA/Cyrix/Centaur-defined */
@@ -1050,10 +1049,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1050 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1049 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1051 1050
1052 /* AMD-defined (#2) */ 1051 /* AMD-defined (#2) */
1053 "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy", 1052 "lahf_lm", "cmp_legacy", "svm", "extapic",
1054 "altmovcr8", "abm", "sse4a", 1053 "cr8_legacy", "abm", "sse4a", "misalignsse",
1055 "misalignsse", "3dnowprefetch", 1054 "3dnowprefetch", "osvw", "ibs", "sse5",
1056 "osvw", "ibs", NULL, NULL, NULL, NULL, 1055 "skinit", "wdt", NULL, NULL,
1057 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1056 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1058 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1057 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1059 1058
@@ -1078,8 +1077,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1078 1077
1079 1078
1080#ifdef CONFIG_SMP 1079#ifdef CONFIG_SMP
1081 if (!cpu_online(c->cpu_index))
1082 return 0;
1083 cpu = c->cpu_index; 1080 cpu = c->cpu_index;
1084#endif 1081#endif
1085 1082
@@ -1171,15 +1168,15 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1171static void *c_start(struct seq_file *m, loff_t *pos) 1168static void *c_start(struct seq_file *m, loff_t *pos)
1172{ 1169{
1173 if (*pos == 0) /* just in case, cpu 0 is not the first */ 1170 if (*pos == 0) /* just in case, cpu 0 is not the first */
1174 *pos = first_cpu(cpu_possible_map); 1171 *pos = first_cpu(cpu_online_map);
1175 if ((*pos) < NR_CPUS && cpu_possible(*pos)) 1172 if ((*pos) < NR_CPUS && cpu_online(*pos))
1176 return &cpu_data(*pos); 1173 return &cpu_data(*pos);
1177 return NULL; 1174 return NULL;
1178} 1175}
1179 1176
1180static void *c_next(struct seq_file *m, void *v, loff_t *pos) 1177static void *c_next(struct seq_file *m, void *v, loff_t *pos)
1181{ 1178{
1182 *pos = next_cpu(*pos, cpu_possible_map); 1179 *pos = next_cpu(*pos, cpu_online_map);
1183 return c_start(m, pos); 1180 return c_start(m, pos);
1184} 1181}
1185 1182
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/kernel/time_64.c b/arch/x86/kernel/time_64.c
index c821edc32216..368b1942b39a 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -82,18 +82,15 @@ static int set_rtc_mmss(unsigned long nowtime)
82 int retval = 0; 82 int retval = 0;
83 int real_seconds, real_minutes, cmos_minutes; 83 int real_seconds, real_minutes, cmos_minutes;
84 unsigned char control, freq_select; 84 unsigned char control, freq_select;
85 unsigned long flags;
85 86
86/* 87/*
87 * IRQs are disabled when we're called from the timer interrupt, 88 * set_rtc_mmss is called when irqs are enabled, so disable irqs here
88 * no need for spin_lock_irqsave()
89 */ 89 */
90 90 spin_lock_irqsave(&rtc_lock, flags);
91 spin_lock(&rtc_lock);
92
93/* 91/*
94 * Tell the clock it's being set and stop it. 92 * Tell the clock it's being set and stop it.
95 */ 93 */
96
97 control = CMOS_READ(RTC_CONTROL); 94 control = CMOS_READ(RTC_CONTROL);
98 CMOS_WRITE(control | RTC_SET, RTC_CONTROL); 95 CMOS_WRITE(control | RTC_SET, RTC_CONTROL);
99 96
@@ -138,7 +135,7 @@ static int set_rtc_mmss(unsigned long nowtime)
138 CMOS_WRITE(control, RTC_CONTROL); 135 CMOS_WRITE(control, RTC_CONTROL);
139 CMOS_WRITE(freq_select, RTC_FREQ_SELECT); 136 CMOS_WRITE(freq_select, RTC_FREQ_SELECT);
140 137
141 spin_unlock(&rtc_lock); 138 spin_unlock_irqrestore(&rtc_lock, flags);
142 139
143 return retval; 140 return retval;
144} 141}
@@ -164,21 +161,27 @@ unsigned long read_persistent_clock(void)
164 unsigned century = 0; 161 unsigned century = 0;
165 162
166 spin_lock_irqsave(&rtc_lock, flags); 163 spin_lock_irqsave(&rtc_lock, flags);
164 /*
165 * if UIP is clear, then we have >= 244 microseconds before RTC
166 * registers will be updated. Spec sheet says that this is the
167 * reliable way to read RTC - registers invalid (off bus) during update
168 */
169 while ((CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
170 cpu_relax();
167 171
168 do { 172
169 sec = CMOS_READ(RTC_SECONDS); 173 /* now read all RTC registers while stable with interrupts disabled */
170 min = CMOS_READ(RTC_MINUTES); 174 sec = CMOS_READ(RTC_SECONDS);
171 hour = CMOS_READ(RTC_HOURS); 175 min = CMOS_READ(RTC_MINUTES);
172 day = CMOS_READ(RTC_DAY_OF_MONTH); 176 hour = CMOS_READ(RTC_HOURS);
173 mon = CMOS_READ(RTC_MONTH); 177 day = CMOS_READ(RTC_DAY_OF_MONTH);
174 year = CMOS_READ(RTC_YEAR); 178 mon = CMOS_READ(RTC_MONTH);
179 year = CMOS_READ(RTC_YEAR);
175#ifdef CONFIG_ACPI 180#ifdef CONFIG_ACPI
176 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && 181 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
177 acpi_gbl_FADT.century) 182 acpi_gbl_FADT.century)
178 century = CMOS_READ(acpi_gbl_FADT.century); 183 century = CMOS_READ(acpi_gbl_FADT.century);
179#endif 184#endif
180 } while (sec != CMOS_READ(RTC_SECONDS));
181
182 spin_unlock_irqrestore(&rtc_lock, flags); 185 spin_unlock_irqrestore(&rtc_lock, flags);
183 186
184 /* 187 /*
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index cc9acace7e23..ef6010262597 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -283,6 +283,11 @@ void dump_stack(void)
283{ 283{
284 unsigned long stack; 284 unsigned long stack;
285 285
286 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
287 current->pid, current->comm, print_tainted(),
288 init_utsname()->release,
289 (int)strcspn(init_utsname()->version, " "),
290 init_utsname()->version);
286 show_trace(current, NULL, &stack); 291 show_trace(current, NULL, &stack);
287} 292}
288 293
@@ -789,6 +794,8 @@ void restart_nmi(void)
789#ifdef CONFIG_KPROBES 794#ifdef CONFIG_KPROBES
790fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) 795fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code)
791{ 796{
797 trace_hardirqs_fixup();
798
792 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) 799 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP)
793 == NOTIFY_STOP) 800 == NOTIFY_STOP)
794 return; 801 return;
@@ -826,6 +833,8 @@ fastcall void __kprobes do_debug(struct pt_regs * regs, long error_code)
826 unsigned int condition; 833 unsigned int condition;
827 struct task_struct *tsk = current; 834 struct task_struct *tsk = current;
828 835
836 trace_hardirqs_fixup();
837
829 get_debugreg(condition, 6); 838 get_debugreg(condition, 6);
830 839
831 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, 840 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index d0c2bc7ab2ec..d11525ad81b4 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -31,6 +31,7 @@
31#include <linux/uaccess.h> 31#include <linux/uaccess.h>
32#include <linux/bug.h> 32#include <linux/bug.h>
33#include <linux/kdebug.h> 33#include <linux/kdebug.h>
34#include <linux/utsname.h>
34 35
35#if defined(CONFIG_EDAC) 36#if defined(CONFIG_EDAC)
36#include <linux/edac.h> 37#include <linux/edac.h>
@@ -400,6 +401,12 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp)
400void dump_stack(void) 401void dump_stack(void)
401{ 402{
402 unsigned long dummy; 403 unsigned long dummy;
404
405 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
406 current->pid, current->comm, print_tainted(),
407 init_utsname()->release,
408 (int)strcspn(init_utsname()->version, " "),
409 init_utsname()->version);
403 show_trace(NULL, NULL, &dummy); 410 show_trace(NULL, NULL, &dummy);
404} 411}
405 412
@@ -807,6 +814,8 @@ asmlinkage __kprobes void default_do_nmi(struct pt_regs *regs)
807/* runs on IST stack. */ 814/* runs on IST stack. */
808asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) 815asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code)
809{ 816{
817 trace_hardirqs_fixup();
818
810 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { 819 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) {
811 return; 820 return;
812 } 821 }
@@ -844,6 +853,8 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
844 struct task_struct *tsk = current; 853 struct task_struct *tsk = current;
845 siginfo_t info; 854 siginfo_t info;
846 855
856 trace_hardirqs_fixup();
857
847 get_debugreg(condition, 6); 858 get_debugreg(condition, 6);
848 859
849 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, 860 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index a55b0902f9d3..92c56117eae5 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -93,38 +93,7 @@ struct lguest_data lguest_data = {
93}; 93};
94static cycle_t clock_base; 94static cycle_t clock_base;
95 95
96/*G:035 Notice the lazy_hcall() above, rather than hcall(). This is our first 96/*G:037 async_hcall() is pretty simple: I'm quite proud of it really. We have a
97 * real optimization trick!
98 *
99 * When lazy_mode is set, it means we're allowed to defer all hypercalls and do
100 * them as a batch when lazy_mode is eventually turned off. Because hypercalls
101 * are reasonably expensive, batching them up makes sense. For example, a
102 * large munmap might update dozens of page table entries: that code calls
103 * paravirt_enter_lazy_mmu(), does the dozen updates, then calls
104 * lguest_leave_lazy_mode().
105 *
106 * So, when we're in lazy mode, we call async_hypercall() to store the call for
107 * future processing. When lazy mode is turned off we issue a hypercall to
108 * flush the stored calls.
109 */
110static void lguest_leave_lazy_mode(void)
111{
112 paravirt_leave_lazy(paravirt_get_lazy_mode());
113 hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0);
114}
115
116static void lazy_hcall(unsigned long call,
117 unsigned long arg1,
118 unsigned long arg2,
119 unsigned long arg3)
120{
121 if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
122 hcall(call, arg1, arg2, arg3);
123 else
124 async_hcall(call, arg1, arg2, arg3);
125}
126
127/* async_hcall() is pretty simple: I'm quite proud of it really. We have a
128 * ring buffer of stored hypercalls which the Host will run though next time we 97 * ring buffer of stored hypercalls which the Host will run though next time we
129 * do a normal hypercall. Each entry in the ring has 4 slots for the hypercall 98 * do a normal hypercall. Each entry in the ring has 4 slots for the hypercall
130 * arguments, and a "hcall_status" word which is 0 if the call is ready to go, 99 * arguments, and a "hcall_status" word which is 0 if the call is ready to go,
@@ -134,8 +103,8 @@ static void lazy_hcall(unsigned long call,
134 * full and we just make the hypercall directly. This has the nice side 103 * full and we just make the hypercall directly. This has the nice side
135 * effect of causing the Host to run all the stored calls in the ring buffer 104 * effect of causing the Host to run all the stored calls in the ring buffer
136 * which empties it for next time! */ 105 * which empties it for next time! */
137void async_hcall(unsigned long call, 106static void async_hcall(unsigned long call, unsigned long arg1,
138 unsigned long arg1, unsigned long arg2, unsigned long arg3) 107 unsigned long arg2, unsigned long arg3)
139{ 108{
140 /* Note: This code assumes we're uniprocessor. */ 109 /* Note: This code assumes we're uniprocessor. */
141 static unsigned int next_call; 110 static unsigned int next_call;
@@ -161,7 +130,37 @@ void async_hcall(unsigned long call,
161 } 130 }
162 local_irq_restore(flags); 131 local_irq_restore(flags);
163} 132}
164/*:*/ 133
134/*G:035 Notice the lazy_hcall() above, rather than hcall(). This is our first
135 * real optimization trick!
136 *
137 * When lazy_mode is set, it means we're allowed to defer all hypercalls and do
138 * them as a batch when lazy_mode is eventually turned off. Because hypercalls
139 * are reasonably expensive, batching them up makes sense. For example, a
140 * large munmap might update dozens of page table entries: that code calls
141 * paravirt_enter_lazy_mmu(), does the dozen updates, then calls
142 * lguest_leave_lazy_mode().
143 *
144 * So, when we're in lazy mode, we call async_hcall() to store the call for
145 * future processing. */
146static void lazy_hcall(unsigned long call,
147 unsigned long arg1,
148 unsigned long arg2,
149 unsigned long arg3)
150{
151 if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
152 hcall(call, arg1, arg2, arg3);
153 else
154 async_hcall(call, arg1, arg2, arg3);
155}
156
157/* When lazy mode is turned off reset the per-cpu lazy mode variable and then
158 * issue a hypercall to flush any stored calls. */
159static void lguest_leave_lazy_mode(void)
160{
161 paravirt_leave_lazy(paravirt_get_lazy_mode());
162 hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0);
163}
165 164
166/*G:033 165/*G:033
167 * After that diversion we return to our first native-instruction 166 * After that diversion we return to our first native-instruction
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c
index 952e7a89c2ac..aad9d95469dc 100644
--- a/arch/x86/lib/delay_32.c
+++ b/arch/x86/lib/delay_32.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/preempt.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
16 17
17#include <asm/processor.h> 18#include <asm/processor.h>
@@ -42,11 +43,13 @@ static void delay_tsc(unsigned long loops)
42{ 43{
43 unsigned long bclock, now; 44 unsigned long bclock, now;
44 45
46 preempt_disable(); /* TSC's are per-cpu */
45 rdtscl(bclock); 47 rdtscl(bclock);
46 do { 48 do {
47 rep_nop(); 49 rep_nop();
48 rdtscl(now); 50 rdtscl(now);
49 } while ((now-bclock) < loops); 51 } while ((now-bclock) < loops);
52 preempt_enable();
50} 53}
51 54
52/* 55/*
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c
index 0ebbfb9e7c7f..45cdd3fbd91c 100644
--- a/arch/x86/lib/delay_64.c
+++ b/arch/x86/lib/delay_64.c
@@ -10,7 +10,9 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/preempt.h>
13#include <linux/delay.h> 14#include <linux/delay.h>
15
14#include <asm/delay.h> 16#include <asm/delay.h>
15#include <asm/msr.h> 17#include <asm/msr.h>
16 18
@@ -27,14 +29,15 @@ int read_current_timer(unsigned long *timer_value)
27void __delay(unsigned long loops) 29void __delay(unsigned long loops)
28{ 30{
29 unsigned bclock, now; 31 unsigned bclock, now;
30 32
33 preempt_disable(); /* TSC's are pre-cpu */
31 rdtscl(bclock); 34 rdtscl(bclock);
32 do 35 do {
33 {
34 rep_nop(); 36 rep_nop();
35 rdtscl(now); 37 rdtscl(now);
36 } 38 }
37 while((now-bclock) < loops); 39 while ((now-bclock) < loops);
40 preempt_enable();
38} 41}
39EXPORT_SYMBOL(__delay); 42EXPORT_SYMBOL(__delay);
40 43
diff --git a/arch/x86/mach-voyager/voyager_cat.c b/arch/x86/mach-voyager/voyager_cat.c
index 26a2d4c54b68..2132ca652df1 100644
--- a/arch/x86/mach-voyager/voyager_cat.c
+++ b/arch/x86/mach-voyager/voyager_cat.c
@@ -568,7 +568,7 @@ static voyager_module_t *voyager_initial_module;
568 * boot cpu *after* all memory initialisation has been done (so we can 568 * boot cpu *after* all memory initialisation has been done (so we can
569 * use kmalloc) but before smp initialisation, so we can probe the SMP 569 * use kmalloc) but before smp initialisation, so we can probe the SMP
570 * configuration and pick up necessary information. */ 570 * configuration and pick up necessary information. */
571void 571void __init
572voyager_cat_init(void) 572voyager_cat_init(void)
573{ 573{
574 voyager_module_t **modpp = &voyager_initial_module; 574 voyager_module_t **modpp = &voyager_initial_module;
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 361ac5107b33..88124dd35406 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 */
@@ -1900,7 +1900,7 @@ voyager_smp_prepare_cpus(unsigned int max_cpus)
1900 smp_boot_cpus(); 1900 smp_boot_cpus();
1901} 1901}
1902 1902
1903static void __devinit voyager_smp_prepare_boot_cpu(void) 1903static void __cpuinit voyager_smp_prepare_boot_cpu(void)
1904{ 1904{
1905 init_gdt(smp_processor_id()); 1905 init_gdt(smp_processor_id());
1906 switch_to_new_gdt(); 1906 switch_to_new_gdt();
@@ -1911,7 +1911,7 @@ static void __devinit voyager_smp_prepare_boot_cpu(void)
1911 cpu_set(smp_processor_id(), cpu_present_map); 1911 cpu_set(smp_processor_id(), cpu_present_map);
1912} 1912}
1913 1913
1914static int __devinit 1914static int __cpuinit
1915voyager_cpu_up(unsigned int cpu) 1915voyager_cpu_up(unsigned int cpu)
1916{ 1916{
1917 /* This only works at boot for x86. See "rewrite" above. */ 1917 /* This only works at boot for x86. See "rewrite" above. */
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 33563ee8eb0f..a2273d44aa27 100644
--- a/arch/x86/mm/fault_32.c
+++ b/arch/x86/mm/fault_32.c
@@ -303,6 +303,11 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
303 int write, si_code; 303 int write, si_code;
304 int fault; 304 int fault;
305 305
306 /*
307 * We can fault from pretty much anywhere, with unknown IRQ state.
308 */
309 trace_hardirqs_fixup();
310
306 /* get the address */ 311 /* get the address */
307 address = read_cr2(); 312 address = read_cr2();
308 313
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c
index 644b4f7ece10..0e26230669ca 100644
--- a/arch/x86/mm/fault_64.c
+++ b/arch/x86/mm/fault_64.c
@@ -304,6 +304,11 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
304 unsigned long flags; 304 unsigned long flags;
305 siginfo_t info; 305 siginfo_t info;
306 306
307 /*
308 * We can fault from pretty much anywhere, with unknown IRQ state.
309 */
310 trace_hardirqs_fixup();
311
307 tsk = current; 312 tsk = current;
308 mm = tsk->mm; 313 mm = tsk->mm;
309 prefetchw(&mm->mmap_sem); 314 prefetchw(&mm->mmap_sem);
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/pci/acpi.c b/arch/x86/pci/acpi.c
index 2d88f7c6d6ac..0234f2831bf3 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -13,7 +13,7 @@ static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d)
13 return 0; 13 return 0;
14} 14}
15 15
16static struct dmi_system_id acpi_pciprobe_dmi_table[] = { 16static struct dmi_system_id acpi_pciprobe_dmi_table[] __devinitdata = {
17/* 17/*
18 * Systems where PCI IO resource ISA alignment can be skipped 18 * Systems where PCI IO resource ISA alignment can be skipped
19 * when the ISA enable bit in the bridge control is not set 19 * when the ISA enable bit in the bridge control is not set
@@ -77,6 +77,9 @@ count_resource(struct acpi_resource *acpi_res, void *data)
77 struct acpi_resource_address64 addr; 77 struct acpi_resource_address64 addr;
78 acpi_status status; 78 acpi_status status;
79 79
80 if (info->res_num >= PCI_BUS_NUM_RESOURCES)
81 return AE_OK;
82
80 status = resource_to_addr(acpi_res, &addr); 83 status = resource_to_addr(acpi_res, &addr);
81 if (ACPI_SUCCESS(status)) 84 if (ACPI_SUCCESS(status))
82 info->res_num++; 85 info->res_num++;
@@ -93,6 +96,9 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
93 unsigned long flags; 96 unsigned long flags;
94 struct resource *root; 97 struct resource *root;
95 98
99 if (info->res_num >= PCI_BUS_NUM_RESOURCES)
100 return AE_OK;
101
96 status = resource_to_addr(acpi_res, &addr); 102 status = resource_to_addr(acpi_res, &addr);
97 if (!ACPI_SUCCESS(status)) 103 if (!ACPI_SUCCESS(status))
98 return AE_OK; 104 return AE_OK;
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index f4386990b150..862746390666 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -315,6 +315,22 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
315 }, 315 },
316 }, 316 },
317#endif 317#endif
318 {
319 .callback = set_bf_sort,
320 .ident = "HP ProLiant DL385 G2",
321 .matches = {
322 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
323 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"),
324 },
325 },
326 {
327 .callback = set_bf_sort,
328 .ident = "HP ProLiant DL585 G2",
329 .matches = {
330 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
331 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"),
332 },
333 },
318 {} 334 {}
319}; 335};
320 336
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 7a2ba4583939..e7bff0fbac23 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -20,7 +20,7 @@ quiet_cmd_syscall = SYSCALL $@
20 cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \ 20 cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
21 -Wl,-T,$(filter-out FORCE,$^) -o $@ 21 -Wl,-T,$(filter-out FORCE,$^) -o $@
22 22
23export CPPFLAGS_vdso.lds += -P -C -U$(ARCH) 23export CPPFLAGS_vdso.lds += -P -C
24 24
25vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \ 25vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \
26 $(call ld-option, -Wl$(comma)--hash-style=sysv) \ 26 $(call ld-option, -Wl$(comma)--hash-style=sysv) \
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c
index 91f6e85d0fc2..3b1ae1abfba9 100644
--- a/arch/x86/vdso/vgetcpu.c
+++ b/arch/x86/vdso/vgetcpu.c
@@ -13,32 +13,17 @@
13#include <asm/vgtod.h> 13#include <asm/vgtod.h>
14#include "vextern.h" 14#include "vextern.h"
15 15
16long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache) 16long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
17{ 17{
18 unsigned int dummy, p; 18 unsigned int dummy, p;
19 unsigned long j = 0;
20 19
21 /* Fast cache - only recompute value once per jiffies and avoid 20 if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) {
22 relatively costly rdtscp/cpuid otherwise.
23 This works because the scheduler usually keeps the process
24 on the same CPU and this syscall doesn't guarantee its
25 results anyways.
26 We do this here because otherwise user space would do it on
27 its own in a likely inferior way (no access to jiffies).
28 If you don't like it pass NULL. */
29 if (tcache && tcache->blob[0] == (j = *vdso_jiffies)) {
30 p = tcache->blob[1];
31 } else if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) {
32 /* Load per CPU data from RDTSCP */ 21 /* Load per CPU data from RDTSCP */
33 rdtscp(dummy, dummy, p); 22 rdtscp(dummy, dummy, p);
34 } else { 23 } else {
35 /* Load per CPU data from GDT */ 24 /* Load per CPU data from GDT */
36 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); 25 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
37 } 26 }
38 if (tcache) {
39 tcache->blob[0] = j;
40 tcache->blob[1] = p;
41 }
42 if (cpu) 27 if (cpu)
43 *cpu = p & 0xfff; 28 *cpu = p & 0xfff;
44 if (node) 29 if (node)
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..0b4a47905575 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -789,6 +789,20 @@ static inline void cfq_slice_expired(struct cfq_data *cfqd, int timed_out)
789 __cfq_slice_expired(cfqd, cfqq, timed_out); 789 __cfq_slice_expired(cfqd, cfqq, timed_out);
790} 790}
791 791
792static int start_idle_class_timer(struct cfq_data *cfqd)
793{
794 unsigned long end = cfqd->last_end_request + CFQ_IDLE_GRACE;
795 unsigned long now = jiffies;
796
797 if (time_before(now, end) &&
798 time_after_eq(now, cfqd->last_end_request)) {
799 mod_timer(&cfqd->idle_class_timer, end);
800 return 1;
801 }
802
803 return 0;
804}
805
792/* 806/*
793 * Get next queue for service. Unless we have a queue preemption, 807 * Get next queue for service. Unless we have a queue preemption,
794 * we'll simply select the first cfqq in the service tree. 808 * we'll simply select the first cfqq in the service tree.
@@ -805,19 +819,14 @@ static struct cfq_queue *cfq_get_next_queue(struct cfq_data *cfqd)
805 cfqq = rb_entry(n, struct cfq_queue, rb_node); 819 cfqq = rb_entry(n, struct cfq_queue, rb_node);
806 820
807 if (cfq_class_idle(cfqq)) { 821 if (cfq_class_idle(cfqq)) {
808 unsigned long end;
809
810 /* 822 /*
811 * if we have idle queues and no rt or be queues had 823 * if we have idle queues and no rt or be queues had
812 * pending requests, either allow immediate service if 824 * pending requests, either allow immediate service if
813 * the grace period has passed or arm the idle grace 825 * the grace period has passed or arm the idle grace
814 * timer 826 * timer
815 */ 827 */
816 end = cfqd->last_end_request + CFQ_IDLE_GRACE; 828 if (start_idle_class_timer(cfqd))
817 if (time_before(jiffies, end)) {
818 mod_timer(&cfqd->idle_class_timer, end);
819 cfqq = NULL; 829 cfqq = NULL;
820 }
821 } 830 }
822 831
823 return cfqq; 832 return cfqq;
@@ -1443,8 +1452,11 @@ cfq_get_queue(struct cfq_data *cfqd, int is_sync, struct task_struct *tsk,
1443 cfqq = *async_cfqq; 1452 cfqq = *async_cfqq;
1444 } 1453 }
1445 1454
1446 if (!cfqq) 1455 if (!cfqq) {
1447 cfqq = cfq_find_alloc_queue(cfqd, is_sync, tsk, gfp_mask); 1456 cfqq = cfq_find_alloc_queue(cfqd, is_sync, tsk, gfp_mask);
1457 if (!cfqq)
1458 return NULL;
1459 }
1448 1460
1449 /* 1461 /*
1450 * pin the queue now that it's allocated, scheduler exit will prune it 1462 * pin the queue now that it's allocated, scheduler exit will prune it
@@ -2033,17 +2045,14 @@ out_cont:
2033static void cfq_idle_class_timer(unsigned long data) 2045static void cfq_idle_class_timer(unsigned long data)
2034{ 2046{
2035 struct cfq_data *cfqd = (struct cfq_data *) data; 2047 struct cfq_data *cfqd = (struct cfq_data *) data;
2036 unsigned long flags, end; 2048 unsigned long flags;
2037 2049
2038 spin_lock_irqsave(cfqd->queue->queue_lock, flags); 2050 spin_lock_irqsave(cfqd->queue->queue_lock, flags);
2039 2051
2040 /* 2052 /*
2041 * race with a non-idle queue, reset timer 2053 * race with a non-idle queue, reset timer
2042 */ 2054 */
2043 end = cfqd->last_end_request + CFQ_IDLE_GRACE; 2055 if (!start_idle_class_timer(cfqd))
2044 if (!time_after_eq(jiffies, end))
2045 mod_timer(&cfqd->idle_class_timer, end);
2046 else
2047 cfq_schedule_dispatch(cfqd); 2056 cfq_schedule_dispatch(cfqd);
2048 2057
2049 spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); 2058 spin_unlock_irqrestore(cfqd->queue->queue_lock, flags);
@@ -2053,7 +2062,7 @@ static void cfq_shutdown_timer_wq(struct cfq_data *cfqd)
2053{ 2062{
2054 del_timer_sync(&cfqd->idle_slice_timer); 2063 del_timer_sync(&cfqd->idle_slice_timer);
2055 del_timer_sync(&cfqd->idle_class_timer); 2064 del_timer_sync(&cfqd->idle_class_timer);
2056 blk_sync_queue(cfqd->queue); 2065 kblockd_flush_work(&cfqd->unplug_work);
2057} 2066}
2058 2067
2059static void cfq_put_async_queues(struct cfq_data *cfqd) 2068static void cfq_put_async_queues(struct cfq_data *cfqd)
@@ -2065,9 +2074,10 @@ static void cfq_put_async_queues(struct cfq_data *cfqd)
2065 cfq_put_queue(cfqd->async_cfqq[0][i]); 2074 cfq_put_queue(cfqd->async_cfqq[0][i]);
2066 if (cfqd->async_cfqq[1][i]) 2075 if (cfqd->async_cfqq[1][i])
2067 cfq_put_queue(cfqd->async_cfqq[1][i]); 2076 cfq_put_queue(cfqd->async_cfqq[1][i]);
2068 if (cfqd->async_idle_cfqq)
2069 cfq_put_queue(cfqd->async_idle_cfqq);
2070 } 2077 }
2078
2079 if (cfqd->async_idle_cfqq)
2080 cfq_put_queue(cfqd->async_idle_cfqq);
2071} 2081}
2072 2082
2073static void cfq_exit_queue(elevator_t *e) 2083static void cfq_exit_queue(elevator_t *e)
@@ -2122,6 +2132,7 @@ static void *cfq_init_queue(struct request_queue *q)
2122 2132
2123 INIT_WORK(&cfqd->unplug_work, cfq_kick_queue); 2133 INIT_WORK(&cfqd->unplug_work, cfq_kick_queue);
2124 2134
2135 cfqd->last_end_request = jiffies;
2125 cfqd->cfq_quantum = cfq_quantum; 2136 cfqd->cfq_quantum = cfq_quantum;
2126 cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0]; 2137 cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0];
2127 cfqd->cfq_fifo_expire[1] = cfq_fifo_expire[1]; 2138 cfqd->cfq_fifo_expire[1] = cfq_fifo_expire[1];
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/deadline-iosched.c b/block/deadline-iosched.c
index 1a511ffaf8a4..a054eef8dff6 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -55,6 +55,20 @@ static void deadline_move_request(struct deadline_data *, struct request *);
55 55
56#define RQ_RB_ROOT(dd, rq) (&(dd)->sort_list[rq_data_dir((rq))]) 56#define RQ_RB_ROOT(dd, rq) (&(dd)->sort_list[rq_data_dir((rq))])
57 57
58/*
59 * get the request after `rq' in sector-sorted order
60 */
61static inline struct request *
62deadline_latter_request(struct request *rq)
63{
64 struct rb_node *node = rb_next(&rq->rb_node);
65
66 if (node)
67 return rb_entry_rq(node);
68
69 return NULL;
70}
71
58static void 72static void
59deadline_add_rq_rb(struct deadline_data *dd, struct request *rq) 73deadline_add_rq_rb(struct deadline_data *dd, struct request *rq)
60{ 74{
@@ -74,13 +88,8 @@ deadline_del_rq_rb(struct deadline_data *dd, struct request *rq)
74{ 88{
75 const int data_dir = rq_data_dir(rq); 89 const int data_dir = rq_data_dir(rq);
76 90
77 if (dd->next_rq[data_dir] == rq) { 91 if (dd->next_rq[data_dir] == rq)
78 struct rb_node *rbnext = rb_next(&rq->rb_node); 92 dd->next_rq[data_dir] = deadline_latter_request(rq);
79
80 dd->next_rq[data_dir] = NULL;
81 if (rbnext)
82 dd->next_rq[data_dir] = rb_entry_rq(rbnext);
83 }
84 93
85 elv_rb_del(RQ_RB_ROOT(dd, rq), rq); 94 elv_rb_del(RQ_RB_ROOT(dd, rq), rq);
86} 95}
@@ -198,14 +207,11 @@ static void
198deadline_move_request(struct deadline_data *dd, struct request *rq) 207deadline_move_request(struct deadline_data *dd, struct request *rq)
199{ 208{
200 const int data_dir = rq_data_dir(rq); 209 const int data_dir = rq_data_dir(rq);
201 struct rb_node *rbnext = rb_next(&rq->rb_node);
202 210
203 dd->next_rq[READ] = NULL; 211 dd->next_rq[READ] = NULL;
204 dd->next_rq[WRITE] = NULL; 212 dd->next_rq[WRITE] = NULL;
213 dd->next_rq[data_dir] = deadline_latter_request(rq);
205 214
206 if (rbnext)
207 dd->next_rq[data_dir] = rb_entry_rq(rbnext);
208
209 dd->last_sector = rq->sector + rq->nr_sectors; 215 dd->last_sector = rq->sector + rq->nr_sectors;
210 216
211 /* 217 /*
@@ -301,30 +307,23 @@ dispatch_find_request:
301 /* 307 /*
302 * we are not running a batch, find best request for selected data_dir 308 * we are not running a batch, find best request for selected data_dir
303 */ 309 */
304 if (deadline_check_fifo(dd, data_dir)) { 310 if (deadline_check_fifo(dd, data_dir) || !dd->next_rq[data_dir]) {
305 /* An expired request exists - satisfy it */ 311 /*
306 dd->batching = 0; 312 * A deadline has expired, the last request was in the other
313 * direction, or we have run out of higher-sectored requests.
314 * Start again from the request with the earliest expiry time.
315 */
307 rq = rq_entry_fifo(dd->fifo_list[data_dir].next); 316 rq = rq_entry_fifo(dd->fifo_list[data_dir].next);
308 317 } else {
309 } else if (dd->next_rq[data_dir]) {
310 /* 318 /*
311 * The last req was the same dir and we have a next request in 319 * The last req was the same dir and we have a next request in
312 * sort order. No expired requests so continue on from here. 320 * sort order. No expired requests so continue on from here.
313 */ 321 */
314 rq = dd->next_rq[data_dir]; 322 rq = dd->next_rq[data_dir];
315 } else {
316 struct rb_node *node;
317 /*
318 * The last req was the other direction or we have run out of
319 * higher-sectored requests. Go back to the lowest sectored
320 * request (1 way elevator) and start a new batch.
321 */
322 dd->batching = 0;
323 node = rb_first(&dd->sort_list[data_dir]);
324 if (node)
325 rq = rb_entry_rq(node);
326 } 323 }
327 324
325 dd->batching = 0;
326
328dispatch_request: 327dispatch_request:
329 /* 328 /*
330 * rq is the selected appropriate request. 329 * rq is the selected appropriate request.
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index b01dee3ae7f3..3b927be03850 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,24 +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;
1151 1146
1152 list_for_each_safe(tmp, n, &bqt->busy_list) { 1147 list_for_each_safe(tmp, n, &q->tag_busy_list)
1153 rq = list_entry_rq(tmp); 1148 blk_requeue_request(q, list_entry_rq(tmp));
1154
1155 if (rq->tag == -1) {
1156 printk(KERN_ERR
1157 "%s: bad tag found on list\n", __FUNCTION__);
1158 list_del_init(&rq->queuelist);
1159 rq->cmd_flags &= ~REQ_QUEUED;
1160 } else
1161 blk_queue_end_tag(q, rq);
1162
1163 rq->cmd_flags &= ~REQ_STARTED;
1164 __elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 0);
1165 }
1166} 1149}
1167 1150
1168EXPORT_SYMBOL(blk_queue_invalidate_tags); 1151EXPORT_SYMBOL(blk_queue_invalidate_tags);
@@ -1373,7 +1356,7 @@ new_segment:
1373 } /* segments in rq */ 1356 } /* segments in rq */
1374 1357
1375 if (sg) 1358 if (sg)
1376 __sg_mark_end(sg); 1359 sg_mark_end(sg);
1377 1360
1378 return nsegs; 1361 return nsegs;
1379} 1362}
@@ -1638,15 +1621,7 @@ static void blk_backing_dev_unplug(struct backing_dev_info *bdi,
1638{ 1621{
1639 struct request_queue *q = bdi->unplug_io_data; 1622 struct request_queue *q = bdi->unplug_io_data;
1640 1623
1641 /* 1624 blk_unplug(q);
1642 * devices don't necessarily have an ->unplug_fn defined
1643 */
1644 if (q->unplug_fn) {
1645 blk_add_trace_pdu_int(q, BLK_TA_UNPLUG_IO, NULL,
1646 q->rq.count[READ] + q->rq.count[WRITE]);
1647
1648 q->unplug_fn(q);
1649 }
1650} 1625}
1651 1626
1652static void blk_unplug_work(struct work_struct *work) 1627static void blk_unplug_work(struct work_struct *work)
@@ -1670,6 +1645,20 @@ static void blk_unplug_timeout(unsigned long data)
1670 kblockd_schedule_work(&q->unplug_work); 1645 kblockd_schedule_work(&q->unplug_work);
1671} 1646}
1672 1647
1648void blk_unplug(struct request_queue *q)
1649{
1650 /*
1651 * devices don't necessarily have an ->unplug_fn defined
1652 */
1653 if (q->unplug_fn) {
1654 blk_add_trace_pdu_int(q, BLK_TA_UNPLUG_IO, NULL,
1655 q->rq.count[READ] + q->rq.count[WRITE]);
1656
1657 q->unplug_fn(q);
1658 }
1659}
1660EXPORT_SYMBOL(blk_unplug);
1661
1673/** 1662/**
1674 * blk_start_queue - restart a previously stopped queue 1663 * blk_start_queue - restart a previously stopped queue
1675 * @q: The &struct request_queue in question 1664 * @q: The &struct request_queue in question
@@ -1738,6 +1727,7 @@ EXPORT_SYMBOL(blk_stop_queue);
1738void blk_sync_queue(struct request_queue *q) 1727void blk_sync_queue(struct request_queue *q)
1739{ 1728{
1740 del_timer_sync(&q->unplug_timer); 1729 del_timer_sync(&q->unplug_timer);
1730 kblockd_flush_work(&q->unplug_work);
1741} 1731}
1742EXPORT_SYMBOL(blk_sync_queue); 1732EXPORT_SYMBOL(blk_sync_queue);
1743 1733
@@ -2341,7 +2331,7 @@ void blk_insert_request(struct request_queue *q, struct request *rq,
2341 if (blk_rq_tagged(rq)) 2331 if (blk_rq_tagged(rq))
2342 blk_queue_end_tag(q, rq); 2332 blk_queue_end_tag(q, rq);
2343 2333
2344 drive_stat_acct(rq, rq->nr_sectors, 1); 2334 drive_stat_acct(rq, 1);
2345 __elv_add_request(q, rq, where, 0); 2335 __elv_add_request(q, rq, where, 0);
2346 blk_start_queueing(q); 2336 blk_start_queueing(q);
2347 spin_unlock_irqrestore(q->queue_lock, flags); 2337 spin_unlock_irqrestore(q->queue_lock, flags);
@@ -2736,7 +2726,7 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
2736 2726
2737EXPORT_SYMBOL(blkdev_issue_flush); 2727EXPORT_SYMBOL(blkdev_issue_flush);
2738 2728
2739static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io) 2729static void drive_stat_acct(struct request *rq, int new_io)
2740{ 2730{
2741 int rw = rq_data_dir(rq); 2731 int rw = rq_data_dir(rq);
2742 2732
@@ -2758,7 +2748,7 @@ static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
2758 */ 2748 */
2759static inline void add_request(struct request_queue * q, struct request * req) 2749static inline void add_request(struct request_queue * q, struct request * req)
2760{ 2750{
2761 drive_stat_acct(req, req->nr_sectors, 1); 2751 drive_stat_acct(req, 1);
2762 2752
2763 /* 2753 /*
2764 * elevator indicated where it wants this request to be 2754 * elevator indicated where it wants this request to be
@@ -3015,7 +3005,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
3015 req->biotail = bio; 3005 req->biotail = bio;
3016 req->nr_sectors = req->hard_nr_sectors += nr_sectors; 3006 req->nr_sectors = req->hard_nr_sectors += nr_sectors;
3017 req->ioprio = ioprio_best(req->ioprio, prio); 3007 req->ioprio = ioprio_best(req->ioprio, prio);
3018 drive_stat_acct(req, nr_sectors, 0); 3008 drive_stat_acct(req, 0);
3019 if (!attempt_back_merge(q, req)) 3009 if (!attempt_back_merge(q, req))
3020 elv_merged_request(q, req, el_ret); 3010 elv_merged_request(q, req, el_ret);
3021 goto out; 3011 goto out;
@@ -3042,7 +3032,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
3042 req->sector = req->hard_sector = bio->bi_sector; 3032 req->sector = req->hard_sector = bio->bi_sector;
3043 req->nr_sectors = req->hard_nr_sectors += nr_sectors; 3033 req->nr_sectors = req->hard_nr_sectors += nr_sectors;
3044 req->ioprio = ioprio_best(req->ioprio, prio); 3034 req->ioprio = ioprio_best(req->ioprio, prio);
3045 drive_stat_acct(req, nr_sectors, 0); 3035 drive_stat_acct(req, 0);
3046 if (!attempt_front_merge(q, req)) 3036 if (!attempt_front_merge(q, req))
3047 elv_merged_request(q, req, el_ret); 3037 elv_merged_request(q, req, el_ret);
3048 goto out; 3038 goto out;
@@ -3224,6 +3214,7 @@ static inline void __generic_make_request(struct bio *bio)
3224 sector_t old_sector; 3214 sector_t old_sector;
3225 int ret, nr_sectors = bio_sectors(bio); 3215 int ret, nr_sectors = bio_sectors(bio);
3226 dev_t old_dev; 3216 dev_t old_dev;
3217 int err = -EIO;
3227 3218
3228 might_sleep(); 3219 might_sleep();
3229 3220
@@ -3251,7 +3242,7 @@ static inline void __generic_make_request(struct bio *bio)
3251 bdevname(bio->bi_bdev, b), 3242 bdevname(bio->bi_bdev, b),
3252 (long long) bio->bi_sector); 3243 (long long) bio->bi_sector);
3253end_io: 3244end_io:
3254 bio_endio(bio, -EIO); 3245 bio_endio(bio, err);
3255 break; 3246 break;
3256 } 3247 }
3257 3248
@@ -3286,6 +3277,10 @@ end_io:
3286 3277
3287 if (bio_check_eod(bio, nr_sectors)) 3278 if (bio_check_eod(bio, nr_sectors))
3288 goto end_io; 3279 goto end_io;
3280 if (bio_empty_barrier(bio) && !q->prepare_flush_fn) {
3281 err = -EOPNOTSUPP;
3282 goto end_io;
3283 }
3289 3284
3290 ret = q->make_request_fn(q, bio); 3285 ret = q->make_request_fn(q, bio);
3291 } while (ret); 3286 } while (ret);
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 8ff8c2656d9c..8383282de1dd 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -95,6 +95,9 @@ static void crypto_remove_spawn(struct crypto_spawn *spawn,
95 return; 95 return;
96 96
97 inst->alg.cra_flags |= CRYPTO_ALG_DEAD; 97 inst->alg.cra_flags |= CRYPTO_ALG_DEAD;
98 if (hlist_unhashed(&inst->list))
99 return;
100
98 if (!tmpl || !crypto_tmpl_get(tmpl)) 101 if (!tmpl || !crypto_tmpl_get(tmpl))
99 return; 102 return;
100 103
@@ -335,9 +338,6 @@ int crypto_register_instance(struct crypto_template *tmpl,
335 LIST_HEAD(list); 338 LIST_HEAD(list);
336 int err = -EINVAL; 339 int err = -EINVAL;
337 340
338 if (inst->alg.cra_destroy)
339 goto err;
340
341 err = crypto_check_alg(&inst->alg); 341 err = crypto_check_alg(&inst->alg);
342 if (err) 342 if (err)
343 goto err; 343 goto err;
diff --git a/crypto/anubis.c b/crypto/anubis.c
index 1c771f7f4dc5..4ff0e1e243ad 100644
--- a/crypto/anubis.c
+++ b/crypto/anubis.c
@@ -33,7 +33,6 @@
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <asm/byteorder.h> 35#include <asm/byteorder.h>
36#include <asm/scatterlist.h>
37#include <linux/crypto.h> 36#include <linux/crypto.h>
38#include <linux/types.h> 37#include <linux/types.h>
39 38
diff --git a/crypto/authenc.c b/crypto/authenc.c
index 0b29a6ae673d..126a529b496d 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -84,8 +84,8 @@ static int crypto_authenc_hash(struct aead_request *req)
84 .tfm = auth, 84 .tfm = auth,
85 }; 85 };
86 u8 *hash = aead_request_ctx(req); 86 u8 *hash = aead_request_ctx(req);
87 struct scatterlist *dst; 87 struct scatterlist *dst = req->dst;
88 unsigned int cryptlen; 88 unsigned int cryptlen = req->cryptlen;
89 int err; 89 int err;
90 90
91 hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth), 91 hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth),
@@ -100,8 +100,6 @@ static int crypto_authenc_hash(struct aead_request *req)
100 if (err) 100 if (err)
101 goto auth_unlock; 101 goto auth_unlock;
102 102
103 cryptlen = req->cryptlen;
104 dst = req->dst;
105 err = crypto_hash_update(&desc, dst, cryptlen); 103 err = crypto_hash_update(&desc, dst, cryptlen);
106 if (err) 104 if (err)
107 goto auth_unlock; 105 goto auth_unlock;
@@ -159,8 +157,8 @@ static int crypto_authenc_verify(struct aead_request *req)
159 }; 157 };
160 u8 *ohash = aead_request_ctx(req); 158 u8 *ohash = aead_request_ctx(req);
161 u8 *ihash; 159 u8 *ihash;
162 struct scatterlist *src; 160 struct scatterlist *src = req->src;
163 unsigned int cryptlen; 161 unsigned int cryptlen = req->cryptlen;
164 unsigned int authsize; 162 unsigned int authsize;
165 int err; 163 int err;
166 164
@@ -177,8 +175,6 @@ static int crypto_authenc_verify(struct aead_request *req)
177 if (err) 175 if (err)
178 goto auth_unlock; 176 goto auth_unlock;
179 177
180 cryptlen = req->cryptlen;
181 src = req->src;
182 err = crypto_hash_update(&desc, src, cryptlen); 178 err = crypto_hash_update(&desc, src, cryptlen);
183 if (err) 179 if (err)
184 goto auth_unlock; 180 goto auth_unlock;
diff --git a/crypto/blowfish.c b/crypto/blowfish.c
index 55238c4e37f0..80c3fd8be97c 100644
--- a/crypto/blowfish.c
+++ b/crypto/blowfish.c
@@ -20,7 +20,6 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <asm/byteorder.h> 22#include <asm/byteorder.h>
23#include <asm/scatterlist.h>
24#include <linux/crypto.h> 23#include <linux/crypto.h>
25#include <linux/types.h> 24#include <linux/types.h>
26 25
diff --git a/crypto/compress.c b/crypto/compress.c
index 0a6570048c1e..1ee357085d3a 100644
--- a/crypto/compress.c
+++ b/crypto/compress.c
@@ -14,7 +14,6 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/crypto.h> 15#include <linux/crypto.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <asm/scatterlist.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include "internal.h" 18#include "internal.h"
20 19
diff --git a/crypto/crypto_null.c b/crypto/crypto_null.c
index 24dbb5d8617e..29f77477d701 100644
--- a/crypto/crypto_null.c
+++ b/crypto/crypto_null.c
@@ -19,7 +19,6 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <asm/scatterlist.h>
23#include <linux/crypto.h> 22#include <linux/crypto.h>
24#include <linux/string.h> 23#include <linux/string.h>
25 24
diff --git a/crypto/khazad.c b/crypto/khazad.c
index 9fa24a2dd6ff..704ebfe26b55 100644
--- a/crypto/khazad.c
+++ b/crypto/khazad.c
@@ -23,7 +23,6 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <asm/byteorder.h> 25#include <asm/byteorder.h>
26#include <asm/scatterlist.h>
27#include <linux/crypto.h> 26#include <linux/crypto.h>
28#include <linux/types.h> 27#include <linux/types.h>
29 28
diff --git a/crypto/sha1_generic.c b/crypto/sha1_generic.c
index 48a3c3e0bf5f..68c62f528eb5 100644
--- a/crypto/sha1_generic.c
+++ b/crypto/sha1_generic.c
@@ -23,7 +23,6 @@
23#include <linux/cryptohash.h> 23#include <linux/cryptohash.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <crypto/sha.h> 25#include <crypto/sha.h>
26#include <asm/scatterlist.h>
27#include <asm/byteorder.h> 26#include <asm/byteorder.h>
28 27
29struct sha1_ctx { 28struct sha1_ctx {
diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c
index 5f4332edcf6b..fd3918be58b5 100644
--- a/crypto/sha256_generic.c
+++ b/crypto/sha256_generic.c
@@ -22,7 +22,6 @@
22#include <linux/crypto.h> 22#include <linux/crypto.h>
23#include <linux/types.h> 23#include <linux/types.h>
24#include <crypto/sha.h> 24#include <crypto/sha.h>
25#include <asm/scatterlist.h>
26#include <asm/byteorder.h> 25#include <asm/byteorder.h>
27 26
28struct sha256_ctx { 27struct sha256_ctx {
diff --git a/crypto/sha512.c b/crypto/sha512.c
index e736596ca574..c39c803ecc02 100644
--- a/crypto/sha512.c
+++ b/crypto/sha512.c
@@ -19,7 +19,6 @@
19#include <linux/types.h> 19#include <linux/types.h>
20#include <crypto/sha.h> 20#include <crypto/sha.h>
21 21
22#include <asm/scatterlist.h>
23#include <asm/byteorder.h> 22#include <asm/byteorder.h>
24 23
25struct sha512_ctx { 24struct sha512_ctx {
diff --git a/crypto/tea.c b/crypto/tea.c
index 1c54e26fa529..6893b3fdf9d6 100644
--- a/crypto/tea.c
+++ b/crypto/tea.c
@@ -23,7 +23,6 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <asm/byteorder.h> 25#include <asm/byteorder.h>
26#include <asm/scatterlist.h>
27#include <linux/crypto.h> 26#include <linux/crypto.h>
28#include <linux/types.h> 27#include <linux/types.h>
29 28
diff --git a/crypto/tgr192.c b/crypto/tgr192.c
index a0fadf3dd3e2..2e7ea1680c7f 100644
--- a/crypto/tgr192.c
+++ b/crypto/tgr192.c
@@ -25,7 +25,6 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <asm/byteorder.h> 27#include <asm/byteorder.h>
28#include <asm/scatterlist.h>
29#include <linux/crypto.h> 28#include <linux/crypto.h>
30#include <linux/types.h> 29#include <linux/types.h>
31 30
diff --git a/crypto/wp512.c b/crypto/wp512.c
index 727d05a19ff4..f746952b93fc 100644
--- a/crypto/wp512.c
+++ b/crypto/wp512.c
@@ -23,7 +23,6 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <asm/byteorder.h> 25#include <asm/byteorder.h>
26#include <asm/scatterlist.h>
27#include <linux/crypto.h> 26#include <linux/crypto.h>
28#include <linux/types.h> 27#include <linux/types.h>
29 28
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5d0e26a5c34c..b9f923ef173d 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
@@ -67,7 +67,21 @@ config ACPI_PROCFS
67 and functions which do not yet exist in /sys. 67 and functions which do not yet exist in /sys.
68 68
69 Say N to delete /proc/acpi/ files that have moved to /sys/ 69 Say N to delete /proc/acpi/ files that have moved to /sys/
70 70config ACPI_PROCFS_POWER
71 bool "Deprecated power /proc/acpi folders"
72 depends on PROC_FS
73 default y
74 ---help---
75 For backwards compatibility, this option allows
76 deprecated power /proc/acpi/ folders to exist, even when
77 they have been replaced by functions in /sys.
78 The deprecated folders (and their replacements) include:
79 /proc/acpi/battery/* (/sys/class/power_supply/*)
80 /proc/acpi/ac_adapter/* (sys/class/power_supply/*)
81 This option has no effect on /proc/acpi/ folders
82 and functions, which do not yet exist in /sys
83
84 Say N to delete power /proc/acpi/ folders that have moved to /sys/
71config ACPI_PROC_EVENT 85config ACPI_PROC_EVENT
72 bool "Deprecated /proc/acpi/event support" 86 bool "Deprecated /proc/acpi/event support"
73 depends on PROC_FS 87 depends on PROC_FS
@@ -88,7 +102,8 @@ config ACPI_PROC_EVENT
88 102
89config ACPI_AC 103config ACPI_AC
90 tristate "AC Adapter" 104 tristate "AC Adapter"
91 depends on X86 && POWER_SUPPLY 105 depends on X86
106 select POWER_SUPPLY
92 default y 107 default y
93 help 108 help
94 This driver adds support for the AC Adapter object, which indicates 109 This driver adds support for the AC Adapter object, which indicates
@@ -97,7 +112,8 @@ config ACPI_AC
97 112
98config ACPI_BATTERY 113config ACPI_BATTERY
99 tristate "Battery" 114 tristate "Battery"
100 depends on X86 && POWER_SUPPLY 115 depends on X86
116 select POWER_SUPPLY
101 default y 117 default y
102 help 118 help
103 This driver adds support for battery information through 119 This driver adds support for battery information through
@@ -352,7 +368,7 @@ config ACPI_HOTPLUG_MEMORY
352config ACPI_SBS 368config ACPI_SBS
353 tristate "Smart Battery System" 369 tristate "Smart Battery System"
354 depends on X86 370 depends on X86
355 depends on POWER_SUPPLY 371 select POWER_SUPPLY
356 help 372 help
357 This driver adds support for the Smart Battery System, another 373 This driver adds support for the Smart Battery System, another
358 type of access to battery information, found on some laptops. 374 type of access to battery information, found on some laptops.
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 54e3ab0e5fc0..456446f90077 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o
58obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o 58obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
59obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o 59obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
60obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o 60obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
61obj-y += cm_sbs.o 61obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
62obj-$(CONFIG_ACPI_SBS) += sbs.o 62obj-$(CONFIG_ACPI_SBS) += sbs.o
63obj-$(CONFIG_ACPI_SBS) += sbshc.o 63obj-$(CONFIG_ACPI_SBS) += sbshc.o
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index e03de37a750d..76ed4f52bebd 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -27,8 +27,10 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#ifdef CONFIG_ACPI_PROCFS_POWER
30#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
31#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#endif
32#include <linux/power_supply.h> 34#include <linux/power_supply.h>
33#include <acpi/acpi_bus.h> 35#include <acpi/acpi_bus.h>
34#include <acpi/acpi_drivers.h> 36#include <acpi/acpi_drivers.h>
@@ -49,12 +51,15 @@ MODULE_AUTHOR("Paul Diefenbaugh");
49MODULE_DESCRIPTION("ACPI AC Adapter Driver"); 51MODULE_DESCRIPTION("ACPI AC Adapter Driver");
50MODULE_LICENSE("GPL"); 52MODULE_LICENSE("GPL");
51 53
54#ifdef CONFIG_ACPI_PROCFS_POWER
52extern struct proc_dir_entry *acpi_lock_ac_dir(void); 55extern struct proc_dir_entry *acpi_lock_ac_dir(void);
53extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 56extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
57static int acpi_ac_open_fs(struct inode *inode, struct file *file);
58#endif
54 59
55static int acpi_ac_add(struct acpi_device *device); 60static int acpi_ac_add(struct acpi_device *device);
56static int acpi_ac_remove(struct acpi_device *device, int type); 61static int acpi_ac_remove(struct acpi_device *device, int type);
57static int acpi_ac_open_fs(struct inode *inode, struct file *file); 62static int acpi_ac_resume(struct acpi_device *device);
58 63
59const static struct acpi_device_id ac_device_ids[] = { 64const static struct acpi_device_id ac_device_ids[] = {
60 {"ACPI0003", 0}, 65 {"ACPI0003", 0},
@@ -69,6 +74,7 @@ static struct acpi_driver acpi_ac_driver = {
69 .ops = { 74 .ops = {
70 .add = acpi_ac_add, 75 .add = acpi_ac_add,
71 .remove = acpi_ac_remove, 76 .remove = acpi_ac_remove,
77 .resume = acpi_ac_resume,
72 }, 78 },
73}; 79};
74 80
@@ -80,12 +86,15 @@ struct acpi_ac {
80 86
81#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); 87#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);
82 88
89#ifdef CONFIG_ACPI_PROCFS_POWER
83static const struct file_operations acpi_ac_fops = { 90static const struct file_operations acpi_ac_fops = {
84 .open = acpi_ac_open_fs, 91 .open = acpi_ac_open_fs,
85 .read = seq_read, 92 .read = seq_read,
86 .llseek = seq_lseek, 93 .llseek = seq_lseek,
87 .release = single_release, 94 .release = single_release,
88}; 95};
96#endif
97
89static int get_ac_property(struct power_supply *psy, 98static int get_ac_property(struct power_supply *psy,
90 enum power_supply_property psp, 99 enum power_supply_property psp,
91 union power_supply_propval *val) 100 union power_supply_propval *val)
@@ -127,6 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
127 return 0; 136 return 0;
128} 137}
129 138
139#ifdef CONFIG_ACPI_PROCFS_POWER
130/* -------------------------------------------------------------------------- 140/* --------------------------------------------------------------------------
131 FS Interface (/proc) 141 FS Interface (/proc)
132 -------------------------------------------------------------------------- */ 142 -------------------------------------------------------------------------- */
@@ -206,6 +216,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
206 216
207 return 0; 217 return 0;
208} 218}
219#endif
209 220
210/* -------------------------------------------------------------------------- 221/* --------------------------------------------------------------------------
211 Driver Model 222 Driver Model
@@ -264,7 +275,9 @@ static int acpi_ac_add(struct acpi_device *device)
264 if (result) 275 if (result)
265 goto end; 276 goto end;
266 277
278#ifdef CONFIG_ACPI_PROCFS_POWER
267 result = acpi_ac_add_fs(device); 279 result = acpi_ac_add_fs(device);
280#endif
268 if (result) 281 if (result)
269 goto end; 282 goto end;
270 ac->charger.name = acpi_device_bid(device); 283 ac->charger.name = acpi_device_bid(device);
@@ -287,13 +300,30 @@ static int acpi_ac_add(struct acpi_device *device)
287 300
288 end: 301 end:
289 if (result) { 302 if (result) {
303#ifdef CONFIG_ACPI_PROCFS_POWER
290 acpi_ac_remove_fs(device); 304 acpi_ac_remove_fs(device);
305#endif
291 kfree(ac); 306 kfree(ac);
292 } 307 }
293 308
294 return result; 309 return result;
295} 310}
296 311
312static int acpi_ac_resume(struct acpi_device *device)
313{
314 struct acpi_ac *ac;
315 unsigned old_state;
316 if (!device || !acpi_driver_data(device))
317 return -EINVAL;
318 ac = acpi_driver_data(device);
319 old_state = ac->state;
320 if (acpi_ac_get_state(ac))
321 return 0;
322 if (old_state != ac->state)
323 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
324 return 0;
325}
326
297static int acpi_ac_remove(struct acpi_device *device, int type) 327static int acpi_ac_remove(struct acpi_device *device, int type)
298{ 328{
299 acpi_status status = AE_OK; 329 acpi_status status = AE_OK;
@@ -309,7 +339,9 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
309 ACPI_ALL_NOTIFY, acpi_ac_notify); 339 ACPI_ALL_NOTIFY, acpi_ac_notify);
310 if (ac->charger.dev) 340 if (ac->charger.dev)
311 power_supply_unregister(&ac->charger); 341 power_supply_unregister(&ac->charger);
342#ifdef CONFIG_ACPI_PROCFS_POWER
312 acpi_ac_remove_fs(device); 343 acpi_ac_remove_fs(device);
344#endif
313 345
314 kfree(ac); 346 kfree(ac);
315 347
@@ -323,13 +355,17 @@ static int __init acpi_ac_init(void)
323 if (acpi_disabled) 355 if (acpi_disabled)
324 return -ENODEV; 356 return -ENODEV;
325 357
358#ifdef CONFIG_ACPI_PROCFS_POWER
326 acpi_ac_dir = acpi_lock_ac_dir(); 359 acpi_ac_dir = acpi_lock_ac_dir();
327 if (!acpi_ac_dir) 360 if (!acpi_ac_dir)
328 return -ENODEV; 361 return -ENODEV;
362#endif
329 363
330 result = acpi_bus_register_driver(&acpi_ac_driver); 364 result = acpi_bus_register_driver(&acpi_ac_driver);
331 if (result < 0) { 365 if (result < 0) {
366#ifdef CONFIG_ACPI_PROCFS_POWER
332 acpi_unlock_ac_dir(acpi_ac_dir); 367 acpi_unlock_ac_dir(acpi_ac_dir);
368#endif
333 return -ENODEV; 369 return -ENODEV;
334 } 370 }
335 371
@@ -341,7 +377,9 @@ static void __exit acpi_ac_exit(void)
341 377
342 acpi_bus_unregister_driver(&acpi_ac_driver); 378 acpi_bus_unregister_driver(&acpi_ac_driver);
343 379
380#ifdef CONFIG_ACPI_PROCFS_POWER
344 acpi_unlock_ac_dir(acpi_ac_dir); 381 acpi_unlock_ac_dir(acpi_ac_dir);
382#endif
345 383
346 return; 384 return;
347} 385}
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 681e26b56b11..7d6be23eff89 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -31,7 +31,7 @@
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/jiffies.h> 32#include <linux/jiffies.h>
33 33
34#ifdef CONFIG_ACPI_PROCFS 34#ifdef CONFIG_ACPI_PROCFS_POWER
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/seq_file.h> 36#include <linux/seq_file.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
@@ -63,7 +63,7 @@ static unsigned int cache_time = 1000;
63module_param(cache_time, uint, 0644); 63module_param(cache_time, uint, 0644);
64MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 64MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
65 65
66#ifdef CONFIG_ACPI_PROCFS 66#ifdef CONFIG_ACPI_PROCFS_POWER
67extern struct proc_dir_entry *acpi_lock_battery_dir(void); 67extern struct proc_dir_entry *acpi_lock_battery_dir(void);
68extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); 68extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
69 69
@@ -125,19 +125,25 @@ 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_get_state(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)
136{ 140{
137 struct acpi_battery *battery = to_acpi_battery(psy); 141 struct acpi_battery *battery = to_acpi_battery(psy);
138 142
139 if ((!acpi_battery_present(battery)) && 143 if (acpi_battery_present(battery)) {
140 psp != POWER_SUPPLY_PROP_PRESENT) 144 /* run battery update only if it is present */
145 acpi_battery_get_state(battery);
146 } else if (psp != POWER_SUPPLY_PROP_PRESENT)
141 return -ENODEV; 147 return -ENODEV;
142 switch (psp) { 148 switch (psp) {
143 case POWER_SUPPLY_PROP_STATUS: 149 case POWER_SUPPLY_PROP_STATUS:
@@ -147,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
147 val->intval = POWER_SUPPLY_STATUS_CHARGING; 153 val->intval = POWER_SUPPLY_STATUS_CHARGING;
148 else if (battery->state == 0) 154 else if (battery->state == 0)
149 val->intval = POWER_SUPPLY_STATUS_FULL; 155 val->intval = POWER_SUPPLY_STATUS_FULL;
156 else
157 val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
150 break; 158 break;
151 case POWER_SUPPLY_PROP_PRESENT: 159 case POWER_SUPPLY_PROP_PRESENT:
152 val->intval = acpi_battery_present(battery); 160 val->intval = acpi_battery_present(battery);
@@ -215,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = {
215 POWER_SUPPLY_PROP_MANUFACTURER, 223 POWER_SUPPLY_PROP_MANUFACTURER,
216}; 224};
217 225
218#ifdef CONFIG_ACPI_PROCFS 226#ifdef CONFIG_ACPI_PROCFS_POWER
219inline char *acpi_battery_units(struct acpi_battery *battery) 227inline char *acpi_battery_units(struct acpi_battery *battery)
220{ 228{
221 return (battery->power_unit)?"mA":"mW"; 229 return (battery->power_unit)?"mA":"mW";
@@ -257,7 +265,7 @@ static int extract_package(struct acpi_battery *battery,
257 union acpi_object *package, 265 union acpi_object *package,
258 struct acpi_offsets *offsets, int num) 266 struct acpi_offsets *offsets, int num)
259{ 267{
260 int i, *x; 268 int i;
261 union acpi_object *element; 269 union acpi_object *element;
262 if (package->type != ACPI_TYPE_PACKAGE) 270 if (package->type != ACPI_TYPE_PACKAGE)
263 return -EFAULT; 271 return -EFAULT;
@@ -266,16 +274,21 @@ static int extract_package(struct acpi_battery *battery,
266 return -EFAULT; 274 return -EFAULT;
267 element = &package->package.elements[i]; 275 element = &package->package.elements[i];
268 if (offsets[i].mode) { 276 if (offsets[i].mode) {
269 if (element->type != ACPI_TYPE_STRING && 277 u8 *ptr = (u8 *)battery + offsets[i].offset;
270 element->type != ACPI_TYPE_BUFFER) 278 if (element->type == ACPI_TYPE_STRING ||
271 return -EFAULT; 279 element->type == ACPI_TYPE_BUFFER)
272 strncpy((u8 *)battery + offsets[i].offset, 280 strncpy(ptr, element->string.pointer, 32);
273 element->string.pointer, 32); 281 else if (element->type == ACPI_TYPE_INTEGER) {
282 strncpy(ptr, (u8 *)&element->integer.value,
283 sizeof(acpi_integer));
284 ptr[sizeof(acpi_integer)] = 0;
285 } else return -EFAULT;
274 } else { 286 } else {
275 if (element->type != ACPI_TYPE_INTEGER) 287 if (element->type == ACPI_TYPE_INTEGER) {
276 return -EFAULT; 288 int *x = (int *)((u8 *)battery +
277 x = (int *)((u8 *)battery + offsets[i].offset); 289 offsets[i].offset);
278 *x = element->integer.value; 290 *x = element->integer.value;
291 } else return -EFAULT;
279 } 292 }
280 } 293 }
281 return 0; 294 return 0;
@@ -385,29 +398,82 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
385 return acpi_battery_set_alarm(battery); 398 return acpi_battery_set_alarm(battery);
386} 399}
387 400
401static ssize_t acpi_battery_alarm_show(struct device *dev,
402 struct device_attribute *attr,
403 char *buf)
404{
405 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
406 return sprintf(buf, "%d\n", battery->alarm * 1000);
407}
408
409static ssize_t acpi_battery_alarm_store(struct device *dev,
410 struct device_attribute *attr,
411 const char *buf, size_t count)
412{
413 unsigned long x;
414 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
415 if (sscanf(buf, "%ld\n", &x) == 1)
416 battery->alarm = x/1000;
417 if (acpi_battery_present(battery))
418 acpi_battery_set_alarm(battery);
419 return count;
420}
421
422static struct device_attribute alarm_attr = {
423 .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE},
424 .show = acpi_battery_alarm_show,
425 .store = acpi_battery_alarm_store,
426};
427
428static int sysfs_add_battery(struct acpi_battery *battery)
429{
430 int result;
431
432 battery->update_time = 0;
433 result = acpi_battery_get_info(battery);
434 acpi_battery_init_alarm(battery);
435 if (result)
436 return result;
437 if (battery->power_unit) {
438 battery->bat.properties = charge_battery_props;
439 battery->bat.num_properties =
440 ARRAY_SIZE(charge_battery_props);
441 } else {
442 battery->bat.properties = energy_battery_props;
443 battery->bat.num_properties =
444 ARRAY_SIZE(energy_battery_props);
445 }
446
447 battery->bat.name = acpi_device_bid(battery->device);
448 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
449 battery->bat.get_property = acpi_battery_get_property;
450
451 result = power_supply_register(&battery->device->dev, &battery->bat);
452 if (result)
453 return result;
454 return device_create_file(battery->bat.dev, &alarm_attr);
455}
456
457static void sysfs_remove_battery(struct acpi_battery *battery)
458{
459 if (!battery->bat.dev)
460 return;
461 device_remove_file(battery->bat.dev, &alarm_attr);
462 power_supply_unregister(&battery->bat);
463 battery->bat.dev = NULL;
464}
465
388static int acpi_battery_update(struct acpi_battery *battery) 466static int acpi_battery_update(struct acpi_battery *battery)
389{ 467{
390 int saved_present = acpi_battery_present(battery);
391 int result = acpi_battery_get_status(battery); 468 int result = acpi_battery_get_status(battery);
392 if (result || !acpi_battery_present(battery)) 469 if (result)
393 return result; 470 return result;
394 if (saved_present != acpi_battery_present(battery) || 471 if (!acpi_battery_present(battery)) {
395 !battery->update_time) { 472 sysfs_remove_battery(battery);
396 battery->update_time = 0; 473 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 } 474 }
475 if (!battery->bat.dev)
476 sysfs_add_battery(battery);
411 return acpi_battery_get_state(battery); 477 return acpi_battery_get_state(battery);
412} 478}
413 479
@@ -415,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
415 FS Interface (/proc) 481 FS Interface (/proc)
416 -------------------------------------------------------------------------- */ 482 -------------------------------------------------------------------------- */
417 483
418#ifdef CONFIG_ACPI_PROCFS 484#ifdef CONFIG_ACPI_PROCFS_POWER
419static struct proc_dir_entry *acpi_battery_dir; 485static struct proc_dir_entry *acpi_battery_dir;
420 486
421static int acpi_battery_print_info(struct seq_file *seq, int result) 487static int acpi_battery_print_info(struct seq_file *seq, int result)
@@ -554,10 +620,6 @@ static ssize_t acpi_battery_write_alarm(struct file *file,
554 620
555 if (!battery || (count > sizeof(alarm_string) - 1)) 621 if (!battery || (count > sizeof(alarm_string) - 1))
556 return -EINVAL; 622 return -EINVAL;
557 if (result) {
558 result = -ENODEV;
559 goto end;
560 }
561 if (!acpi_battery_present(battery)) { 623 if (!acpi_battery_present(battery)) {
562 result = -ENODEV; 624 result = -ENODEV;
563 goto end; 625 goto end;
@@ -688,33 +750,6 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
688 750
689#endif 751#endif
690 752
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/* -------------------------------------------------------------------------- 753/* --------------------------------------------------------------------------
719 Driver Interface 754 Driver Interface
720 -------------------------------------------------------------------------- */ 755 -------------------------------------------------------------------------- */
@@ -732,7 +767,9 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
732 acpi_bus_generate_netlink_event(device->pnp.device_class, 767 acpi_bus_generate_netlink_event(device->pnp.device_class,
733 device->dev.bus_id, event, 768 device->dev.bus_id, event,
734 acpi_battery_present(battery)); 769 acpi_battery_present(battery));
735 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); 770 /* acpi_batter_update could remove power_supply object */
771 if (battery->bat.dev)
772 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
736} 773}
737 774
738static int acpi_battery_add(struct acpi_device *device) 775static int acpi_battery_add(struct acpi_device *device)
@@ -751,16 +788,11 @@ static int acpi_battery_add(struct acpi_device *device)
751 acpi_driver_data(device) = battery; 788 acpi_driver_data(device) = battery;
752 mutex_init(&battery->lock); 789 mutex_init(&battery->lock);
753 acpi_battery_update(battery); 790 acpi_battery_update(battery);
754#ifdef CONFIG_ACPI_PROCFS 791#ifdef CONFIG_ACPI_PROCFS_POWER
755 result = acpi_battery_add_fs(device); 792 result = acpi_battery_add_fs(device);
756 if (result) 793 if (result)
757 goto end; 794 goto end;
758#endif 795#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, 796 status = acpi_install_notify_handler(device->handle,
765 ACPI_ALL_NOTIFY, 797 ACPI_ALL_NOTIFY,
766 acpi_battery_notify, battery); 798 acpi_battery_notify, battery);
@@ -774,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device)
774 device->status.battery_present ? "present" : "absent"); 806 device->status.battery_present ? "present" : "absent");
775 end: 807 end:
776 if (result) { 808 if (result) {
777#ifdef CONFIG_ACPI_PROCFS 809#ifdef CONFIG_ACPI_PROCFS_POWER
778 acpi_battery_remove_fs(device); 810 acpi_battery_remove_fs(device);
779#endif 811#endif
780 kfree(battery); 812 kfree(battery);
@@ -793,13 +825,10 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
793 status = acpi_remove_notify_handler(device->handle, 825 status = acpi_remove_notify_handler(device->handle,
794 ACPI_ALL_NOTIFY, 826 ACPI_ALL_NOTIFY,
795 acpi_battery_notify); 827 acpi_battery_notify);
796#ifdef CONFIG_ACPI_PROCFS 828#ifdef CONFIG_ACPI_PROCFS_POWER
797 acpi_battery_remove_fs(device); 829 acpi_battery_remove_fs(device);
798#endif 830#endif
799 if (battery->bat.dev) { 831 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); 832 mutex_destroy(&battery->lock);
804 kfree(battery); 833 kfree(battery);
805 return 0; 834 return 0;
@@ -813,6 +842,7 @@ static int acpi_battery_resume(struct acpi_device *device)
813 return -EINVAL; 842 return -EINVAL;
814 battery = acpi_driver_data(device); 843 battery = acpi_driver_data(device);
815 battery->update_time = 0; 844 battery->update_time = 0;
845 acpi_battery_update(battery);
816 return 0; 846 return 0;
817} 847}
818 848
@@ -831,13 +861,13 @@ static int __init acpi_battery_init(void)
831{ 861{
832 if (acpi_disabled) 862 if (acpi_disabled)
833 return -ENODEV; 863 return -ENODEV;
834#ifdef CONFIG_ACPI_PROCFS 864#ifdef CONFIG_ACPI_PROCFS_POWER
835 acpi_battery_dir = acpi_lock_battery_dir(); 865 acpi_battery_dir = acpi_lock_battery_dir();
836 if (!acpi_battery_dir) 866 if (!acpi_battery_dir)
837 return -ENODEV; 867 return -ENODEV;
838#endif 868#endif
839 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { 869 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
840#ifdef CONFIG_ACPI_PROCFS 870#ifdef CONFIG_ACPI_PROCFS_POWER
841 acpi_unlock_battery_dir(acpi_battery_dir); 871 acpi_unlock_battery_dir(acpi_battery_dir);
842#endif 872#endif
843 return -ENODEV; 873 return -ENODEV;
@@ -848,7 +878,7 @@ static int __init acpi_battery_init(void)
848static void __exit acpi_battery_exit(void) 878static void __exit acpi_battery_exit(void)
849{ 879{
850 acpi_bus_unregister_driver(&acpi_battery_driver); 880 acpi_bus_unregister_driver(&acpi_battery_driver);
851#ifdef CONFIG_ACPI_PROCFS 881#ifdef CONFIG_ACPI_PROCFS_POWER
852 acpi_unlock_battery_dir(acpi_battery_dir); 882 acpi_unlock_battery_dir(acpi_battery_dir);
853#endif 883#endif
854} 884}
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..d411017f8c06 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -47,6 +47,9 @@
47#undef PREFIX 47#undef PREFIX
48#define PREFIX "ACPI: EC: " 48#define PREFIX "ACPI: EC: "
49 49
50/* Uncomment next line to get verbose print outs*/
51/* #define DEBUG */
52
50/* EC status register */ 53/* EC status register */
51#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ 54#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
52#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ 55#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
@@ -65,16 +68,21 @@ enum ec_command {
65/* EC events */ 68/* EC events */
66enum ec_event { 69enum ec_event {
67 ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ 70 ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */
68 ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ 71 ACPI_EC_EVENT_IBF_0, /* Input buffer empty */
69}; 72};
70 73
71#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 74#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 */ 75#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
73 76
74static enum ec_mode { 77enum {
75 EC_INTR = 1, /* Output buffer full */ 78 EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */
76 EC_POLL, /* Input buffer empty */ 79 EC_FLAGS_QUERY_PENDING, /* Query is pending */
77} acpi_ec_mode = EC_INTR; 80 EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */
81 EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */
82 EC_FLAGS_ADDRESS, /* Address is being written */
83 EC_FLAGS_NO_WDATA_GPE, /* Don't expect WDATA GPE event */
84 EC_FLAGS_WDATA, /* Data is being written */
85};
78 86
79static int acpi_ec_remove(struct acpi_device *device, int type); 87static int acpi_ec_remove(struct acpi_device *device, int type);
80static int acpi_ec_start(struct acpi_device *device); 88static int acpi_ec_start(struct acpi_device *device);
@@ -116,9 +124,8 @@ static struct acpi_ec {
116 unsigned long command_addr; 124 unsigned long command_addr;
117 unsigned long data_addr; 125 unsigned long data_addr;
118 unsigned long global_lock; 126 unsigned long global_lock;
127 unsigned long flags;
119 struct mutex lock; 128 struct mutex lock;
120 atomic_t query_pending;
121 atomic_t event_count;
122 wait_queue_head_t wait; 129 wait_queue_head_t wait;
123 struct list_head list; 130 struct list_head list;
124 u8 handlers_installed; 131 u8 handlers_installed;
@@ -130,64 +137,95 @@ static struct acpi_ec {
130 137
131static inline u8 acpi_ec_read_status(struct acpi_ec *ec) 138static inline u8 acpi_ec_read_status(struct acpi_ec *ec)
132{ 139{
133 return inb(ec->command_addr); 140 u8 x = inb(ec->command_addr);
141 pr_debug(PREFIX "---> status = 0x%2x\n", x);
142 return x;
134} 143}
135 144
136static inline u8 acpi_ec_read_data(struct acpi_ec *ec) 145static inline u8 acpi_ec_read_data(struct acpi_ec *ec)
137{ 146{
147 u8 x = inb(ec->data_addr);
148 pr_debug(PREFIX "---> data = 0x%2x\n", x);
138 return inb(ec->data_addr); 149 return inb(ec->data_addr);
139} 150}
140 151
141static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) 152static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command)
142{ 153{
154 pr_debug(PREFIX "<--- command = 0x%2x\n", command);
143 outb(command, ec->command_addr); 155 outb(command, ec->command_addr);
144} 156}
145 157
146static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) 158static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
147{ 159{
160 pr_debug(PREFIX "<--- data = 0x%2x\n", data);
148 outb(data, ec->data_addr); 161 outb(data, ec->data_addr);
149} 162}
150 163
151static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event, 164static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
152 unsigned old_count)
153{ 165{
154 u8 status = acpi_ec_read_status(ec); 166 if (test_bit(EC_FLAGS_WAIT_GPE, &ec->flags))
155 if (old_count == atomic_read(&ec->event_count))
156 return 0; 167 return 0;
157 if (event == ACPI_EC_EVENT_OBF_1) { 168 if (event == ACPI_EC_EVENT_OBF_1) {
158 if (status & ACPI_EC_FLAG_OBF) 169 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF)
159 return 1; 170 return 1;
160 } else if (event == ACPI_EC_EVENT_IBF_0) { 171 } else if (event == ACPI_EC_EVENT_IBF_0) {
161 if (!(status & ACPI_EC_FLAG_IBF)) 172 if (!(acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF))
162 return 1; 173 return 1;
163 } 174 }
164 175
165 return 0; 176 return 0;
166} 177}
167 178
168static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, 179static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
169 unsigned count, int force_poll)
170{ 180{
171 if (unlikely(force_poll) || acpi_ec_mode == EC_POLL) { 181 int ret = 0;
182 if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) &&
183 test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags)))
184 force_poll = 1;
185 if (unlikely(test_bit(EC_FLAGS_WDATA, &ec->flags) &&
186 test_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags)))
187 force_poll = 1;
188 if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) &&
189 likely(!force_poll)) {
190 if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event),
191 msecs_to_jiffies(ACPI_EC_DELAY)))
192 goto end;
193 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
194 if (acpi_ec_check_status(ec, event)) {
195 if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) {
196 /* miss address GPE, don't expect it anymore */
197 pr_info(PREFIX "missing address confirmation, "
198 "don't expect it any longer.\n");
199 set_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags);
200 } else if (test_bit(EC_FLAGS_WDATA, &ec->flags)) {
201 /* miss write data GPE, don't expect it */
202 pr_info(PREFIX "missing write data confirmation, "
203 "don't expect it any longer.\n");
204 set_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags);
205 } else {
206 /* missing GPEs, switch back to poll mode */
207 if (printk_ratelimit())
208 pr_info(PREFIX "missing confirmations, "
209 "switch off interrupt mode.\n");
210 clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
211 }
212 goto end;
213 }
214 } else {
172 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); 215 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
216 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
173 while (time_before(jiffies, delay)) { 217 while (time_before(jiffies, delay)) {
174 if (acpi_ec_check_status(ec, event, 0)) 218 if (acpi_ec_check_status(ec, event))
175 return 0; 219 goto end;
176 } 220 }
177 } else { 221 }
178 if (wait_event_timeout(ec->wait, 222 pr_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", 223 " status = %d, expect_event = %d\n",
186 acpi_ec_read_status(ec), event); 224 acpi_ec_read_status(ec), event);
187 } 225 ret = -ETIME;
188 } 226 end:
189 227 clear_bit(EC_FLAGS_ADDRESS, &ec->flags);
190 return -ETIME; 228 return ret;
191} 229}
192 230
193static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, 231static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
@@ -196,42 +234,47 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
196 int force_poll) 234 int force_poll)
197{ 235{
198 int result = 0; 236 int result = 0;
199 unsigned count = atomic_read(&ec->event_count); 237 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
200 acpi_ec_write_cmd(ec, command); 238 acpi_ec_write_cmd(ec, command);
201 239 pr_debug(PREFIX "transaction start\n");
202 for (; wdata_len > 0; --wdata_len) { 240 for (; wdata_len > 0; --wdata_len) {
203 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); 241 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
204 if (result) { 242 if (result) {
205 printk(KERN_ERR PREFIX 243 pr_err(PREFIX
206 "write_cmd timeout, command = %d\n", command); 244 "write_cmd timeout, command = %d\n", command);
207 goto end; 245 goto end;
208 } 246 }
209 count = atomic_read(&ec->event_count); 247 /* mark the address byte written to EC */
248 if (rdata_len + wdata_len > 1)
249 set_bit(EC_FLAGS_ADDRESS, &ec->flags);
250 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
210 acpi_ec_write_data(ec, *(wdata++)); 251 acpi_ec_write_data(ec, *(wdata++));
211 } 252 }
212 253
213 if (!rdata_len) { 254 if (!rdata_len) {
214 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); 255 set_bit(EC_FLAGS_WDATA, &ec->flags);
256 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
215 if (result) { 257 if (result) {
216 printk(KERN_ERR PREFIX 258 pr_err(PREFIX
217 "finish-write timeout, command = %d\n", command); 259 "finish-write timeout, command = %d\n", command);
218 goto end; 260 goto end;
219 } 261 }
220 } else if (command == ACPI_EC_COMMAND_QUERY) { 262 } else if (command == ACPI_EC_COMMAND_QUERY)
221 atomic_set(&ec->query_pending, 0); 263 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
222 }
223 264
224 for (; rdata_len > 0; --rdata_len) { 265 for (; rdata_len > 0; --rdata_len) {
225 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count, force_poll); 266 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll);
226 if (result) { 267 if (result) {
227 printk(KERN_ERR PREFIX "read timeout, command = %d\n", 268 pr_err(PREFIX "read timeout, command = %d\n", command);
228 command);
229 goto end; 269 goto end;
230 } 270 }
231 count = atomic_read(&ec->event_count); 271 /* Don't expect GPE after last read */
272 if (rdata_len > 1)
273 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
232 *(rdata++) = acpi_ec_read_data(ec); 274 *(rdata++) = acpi_ec_read_data(ec);
233 } 275 }
234 end: 276 end:
277 pr_debug(PREFIX "transaction end\n");
235 return result; 278 return result;
236} 279}
237 280
@@ -258,13 +301,10 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
258 } 301 }
259 } 302 }
260 303
261 /* Make sure GPE is enabled before doing transaction */ 304 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) { 305 if (status) {
266 printk(KERN_ERR PREFIX 306 pr_err(PREFIX "input buffer is not empty, "
267 "input buffer is not empty, aborting transaction\n"); 307 "aborting transaction\n");
268 goto end; 308 goto end;
269 } 309 }
270 310
@@ -435,9 +475,9 @@ EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler);
435 475
436void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) 476void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
437{ 477{
438 struct acpi_ec_query_handler *handler; 478 struct acpi_ec_query_handler *handler, *tmp;
439 mutex_lock(&ec->lock); 479 mutex_lock(&ec->lock);
440 list_for_each_entry(handler, &ec->list, node) { 480 list_for_each_entry_safe(handler, tmp, &ec->list, node) {
441 if (query_bit == handler->query_bit) { 481 if (query_bit == handler->query_bit) {
442 list_del(&handler->node); 482 list_del(&handler->node);
443 kfree(handler); 483 kfree(handler);
@@ -476,23 +516,26 @@ static void acpi_ec_gpe_query(void *ec_cxt)
476static u32 acpi_ec_gpe_handler(void *data) 516static u32 acpi_ec_gpe_handler(void *data)
477{ 517{
478 acpi_status status = AE_OK; 518 acpi_status status = AE_OK;
479 u8 value;
480 struct acpi_ec *ec = data; 519 struct acpi_ec *ec = data;
481 520
482 atomic_inc(&ec->event_count); 521 pr_debug(PREFIX "~~~> interrupt\n");
483 522 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
484 if (acpi_ec_mode == EC_INTR) { 523 if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
485 wake_up(&ec->wait); 524 wake_up(&ec->wait);
486 }
487 525
488 value = acpi_ec_read_status(ec); 526 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) {
489 if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) { 527 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
490 atomic_set(&ec->query_pending, 1); 528 status = acpi_os_execute(OSL_EC_BURST_HANDLER,
491 status = 529 acpi_ec_gpe_query, ec);
492 acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); 530 } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) {
531 /* this is non-query, must be confirmation */
532 if (printk_ratelimit())
533 pr_info(PREFIX "non-query interrupt received,"
534 " switching to interrupt mode\n");
535 set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
493 } 536 }
494 537
495 return status == AE_OK ? 538 return ACPI_SUCCESS(status) ?
496 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; 539 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
497} 540}
498 541
@@ -641,13 +684,10 @@ static struct acpi_ec *make_acpi_ec(void)
641 struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); 684 struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
642 if (!ec) 685 if (!ec)
643 return NULL; 686 return NULL;
644 687 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); 688 mutex_init(&ec->lock);
648 init_waitqueue_head(&ec->wait); 689 init_waitqueue_head(&ec->wait);
649 INIT_LIST_HEAD(&ec->list); 690 INIT_LIST_HEAD(&ec->list);
650
651 return ec; 691 return ec;
652} 692}
653 693
@@ -693,10 +733,10 @@ static void ec_remove_handlers(struct acpi_ec *ec)
693{ 733{
694 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, 734 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
695 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) 735 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
696 printk(KERN_ERR PREFIX "failed to remove space handler\n"); 736 pr_err(PREFIX "failed to remove space handler\n");
697 if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, 737 if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
698 &acpi_ec_gpe_handler))) 738 &acpi_ec_gpe_handler)))
699 printk(KERN_ERR PREFIX "failed to remove gpe handler\n"); 739 pr_err(PREFIX "failed to remove gpe handler\n");
700 ec->handlers_installed = 0; 740 ec->handlers_installed = 0;
701} 741}
702 742
@@ -739,8 +779,10 @@ static int acpi_ec_add(struct acpi_device *device)
739 first_ec = ec; 779 first_ec = ec;
740 acpi_driver_data(device) = ec; 780 acpi_driver_data(device) = ec;
741 acpi_ec_add_fs(device); 781 acpi_ec_add_fs(device);
742 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", 782 pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
743 ec->gpe, ec->command_addr, ec->data_addr); 783 ec->gpe, ec->command_addr, ec->data_addr);
784 pr_info(PREFIX "driver started in %s mode\n",
785 (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll");
744 return 0; 786 return 0;
745} 787}
746 788
@@ -833,7 +875,7 @@ static int acpi_ec_start(struct acpi_device *device)
833 ret = ec_install_handlers(ec); 875 ret = ec_install_handlers(ec);
834 876
835 /* EC is fully operational, allow queries */ 877 /* EC is fully operational, allow queries */
836 atomic_set(&ec->query_pending, 0); 878 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
837 return ret; 879 return ret;
838} 880}
839 881
@@ -865,18 +907,26 @@ int __init acpi_ec_ecdt_probe(void)
865 status = acpi_get_table(ACPI_SIG_ECDT, 1, 907 status = acpi_get_table(ACPI_SIG_ECDT, 1,
866 (struct acpi_table_header **)&ecdt_ptr); 908 (struct acpi_table_header **)&ecdt_ptr);
867 if (ACPI_SUCCESS(status)) { 909 if (ACPI_SUCCESS(status)) {
868 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n"); 910 pr_info(PREFIX "EC description table is found, configuring boot EC\n");
869 boot_ec->command_addr = ecdt_ptr->control.address; 911 boot_ec->command_addr = ecdt_ptr->control.address;
870 boot_ec->data_addr = ecdt_ptr->data.address; 912 boot_ec->data_addr = ecdt_ptr->data.address;
871 boot_ec->gpe = ecdt_ptr->gpe; 913 boot_ec->gpe = ecdt_ptr->gpe;
872 boot_ec->handle = ACPI_ROOT_OBJECT; 914 boot_ec->handle = ACPI_ROOT_OBJECT;
873 } else { 915 } else {
916 /* This workaround is needed only on some broken machines,
917 * which require early EC, but fail to provide ECDT */
918 acpi_handle x;
874 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); 919 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
875 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, 920 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
876 boot_ec, NULL); 921 boot_ec, NULL);
877 /* Check that acpi_get_devices actually find something */ 922 /* Check that acpi_get_devices actually find something */
878 if (ACPI_FAILURE(status) || !boot_ec->handle) 923 if (ACPI_FAILURE(status) || !boot_ec->handle)
879 goto error; 924 goto error;
925 /* We really need to limit this workaround, the only ASUS,
926 * which needs it, has fake EC._INI method, so use it as flag.
927 */
928 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
929 goto error;
880 } 930 }
881 931
882 ret = ec_install_handlers(boot_ec); 932 ret = ec_install_handlers(boot_ec);
@@ -924,20 +974,4 @@ static void __exit acpi_ec_exit(void)
924 974
925 return; 975 return;
926} 976}
927#endif /* 0 */ 977#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/osl.c b/drivers/acpi/osl.c
index aabc6ca4a81c..e3a673a00845 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -387,17 +387,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
387 if (!value) 387 if (!value)
388 value = &dummy; 388 value = &dummy;
389 389
390 switch (width) { 390 *value = 0;
391 case 8: 391 if (width <= 8) {
392 *(u8 *) value = inb(port); 392 *(u8 *) value = inb(port);
393 break; 393 } else if (width <= 16) {
394 case 16:
395 *(u16 *) value = inw(port); 394 *(u16 *) value = inw(port);
396 break; 395 } else if (width <= 32) {
397 case 32:
398 *(u32 *) value = inl(port); 396 *(u32 *) value = inl(port);
399 break; 397 } else {
400 default:
401 BUG(); 398 BUG();
402 } 399 }
403 400
@@ -408,17 +405,13 @@ EXPORT_SYMBOL(acpi_os_read_port);
408 405
409acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) 406acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
410{ 407{
411 switch (width) { 408 if (width <= 8) {
412 case 8:
413 outb(value, port); 409 outb(value, port);
414 break; 410 } else if (width <= 16) {
415 case 16:
416 outw(value, port); 411 outw(value, port);
417 break; 412 } else if (width <= 32) {
418 case 32:
419 outl(value, port); 413 outl(value, port);
420 break; 414 } else {
421 default:
422 BUG(); 415 BUG();
423 } 416 }
424 417
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/processor_core.c b/drivers/acpi/processor_core.c
index 235a51e328c3..015689d295c7 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -612,12 +612,6 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
612 request_region(pr->throttling.address, 6, "ACPI CPU throttle"); 612 request_region(pr->throttling.address, 6, "ACPI CPU throttle");
613 } 613 }
614 614
615#ifdef CONFIG_CPU_FREQ
616 acpi_processor_ppc_has_changed(pr);
617#endif
618 acpi_processor_get_throttling_info(pr);
619 acpi_processor_get_limit_info(pr);
620
621 return 0; 615 return 0;
622} 616}
623 617
@@ -647,7 +641,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
647 */ 641 */
648 if (processor_device_array[pr->id] != NULL && 642 if (processor_device_array[pr->id] != NULL &&
649 processor_device_array[pr->id] != device) { 643 processor_device_array[pr->id] != device) {
650 printk(KERN_WARNING "BIOS reported wrong ACPI id" 644 printk(KERN_WARNING "BIOS reported wrong ACPI id "
651 "for the processor\n"); 645 "for the processor\n");
652 return -ENODEV; 646 return -ENODEV;
653 } 647 }
@@ -665,6 +659,12 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
665 /* _PDC call should be done before doing anything else (if reqd.). */ 659 /* _PDC call should be done before doing anything else (if reqd.). */
666 arch_acpi_processor_init_pdc(pr); 660 arch_acpi_processor_init_pdc(pr);
667 acpi_processor_set_pdc(pr); 661 acpi_processor_set_pdc(pr);
662#ifdef CONFIG_CPU_FREQ
663 acpi_processor_ppc_has_changed(pr);
664#endif
665 acpi_processor_get_throttling_info(pr);
666 acpi_processor_get_limit_info(pr);
667
668 668
669 acpi_processor_power_init(pr, device); 669 acpi_processor_power_init(pr, device);
670 670
@@ -684,7 +684,7 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
684{ 684{
685 struct acpi_processor *pr = data; 685 struct acpi_processor *pr = data;
686 struct acpi_device *device = NULL; 686 struct acpi_device *device = NULL;
687 687 int saved;
688 688
689 if (!pr) 689 if (!pr)
690 return; 690 return;
@@ -694,7 +694,10 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
694 694
695 switch (event) { 695 switch (event) {
696 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: 696 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
697 saved = pr->performance_platform_limit;
697 acpi_processor_ppc_has_changed(pr); 698 acpi_processor_ppc_has_changed(pr);
699 if (saved == pr->performance_platform_limit)
700 break;
698 acpi_bus_generate_proc_event(device, event, 701 acpi_bus_generate_proc_event(device, event,
699 pr->performance_platform_limit); 702 pr->performance_platform_limit);
700 acpi_bus_generate_netlink_event(device->pnp.device_class, 703 acpi_bus_generate_netlink_event(device->pnp.device_class,
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f996d0e37689..b1fbee3f7fe1 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -197,6 +197,19 @@ static inline u32 ticks_elapsed_in_us(u32 t1, u32 t2)
197 return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); 197 return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2);
198} 198}
199 199
200static void acpi_safe_halt(void)
201{
202 current_thread_info()->status &= ~TS_POLLING;
203 /*
204 * TS_POLLING-cleared state must be visible before we
205 * test NEED_RESCHED:
206 */
207 smp_mb();
208 if (!need_resched())
209 safe_halt();
210 current_thread_info()->status |= TS_POLLING;
211}
212
200#ifndef CONFIG_CPU_IDLE 213#ifndef CONFIG_CPU_IDLE
201 214
202static void 215static void
@@ -239,19 +252,6 @@ acpi_processor_power_activate(struct acpi_processor *pr,
239 return; 252 return;
240} 253}
241 254
242static void acpi_safe_halt(void)
243{
244 current_thread_info()->status &= ~TS_POLLING;
245 /*
246 * TS_POLLING-cleared state must be visible before we
247 * test NEED_RESCHED:
248 */
249 smp_mb();
250 if (!need_resched())
251 safe_halt();
252 current_thread_info()->status |= TS_POLLING;
253}
254
255static atomic_t c3_cpu_count; 255static atomic_t c3_cpu_count;
256 256
257/* Common C-state entry for C2, C3, .. */ 257/* Common C-state entry for C2, C3, .. */
@@ -1373,15 +1373,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
1373 if (pr->flags.bm_check) 1373 if (pr->flags.bm_check)
1374 acpi_idle_update_bm_rld(pr, cx); 1374 acpi_idle_update_bm_rld(pr, cx);
1375 1375
1376 current_thread_info()->status &= ~TS_POLLING; 1376 acpi_safe_halt();
1377 /*
1378 * TS_POLLING-cleared state must be visible before we test
1379 * NEED_RESCHED:
1380 */
1381 smp_mb();
1382 if (!need_resched())
1383 safe_halt();
1384 current_thread_info()->status |= TS_POLLING;
1385 1377
1386 cx->usage++; 1378 cx->usage++;
1387 1379
@@ -1399,6 +1391,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1399 struct acpi_processor *pr; 1391 struct acpi_processor *pr;
1400 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 1392 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1401 u32 t1, t2; 1393 u32 t1, t2;
1394 int sleep_ticks = 0;
1395
1402 pr = processors[smp_processor_id()]; 1396 pr = processors[smp_processor_id()];
1403 1397
1404 if (unlikely(!pr)) 1398 if (unlikely(!pr))
@@ -1428,6 +1422,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1428 ACPI_FLUSH_CPU_CACHE(); 1422 ACPI_FLUSH_CPU_CACHE();
1429 1423
1430 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1424 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1425 /* Tell the scheduler that we are going deep-idle: */
1426 sched_clock_idle_sleep_event();
1431 acpi_state_timer_broadcast(pr, cx, 1); 1427 acpi_state_timer_broadcast(pr, cx, 1);
1432 acpi_idle_do_entry(cx); 1428 acpi_idle_do_entry(cx);
1433 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1429 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
@@ -1436,6 +1432,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1436 /* TSC could halt in idle, so notify users */ 1432 /* TSC could halt in idle, so notify users */
1437 mark_tsc_unstable("TSC halts in idle");; 1433 mark_tsc_unstable("TSC halts in idle");;
1438#endif 1434#endif
1435 sleep_ticks = ticks_elapsed(t1, t2);
1436
1437 /* Tell the scheduler how much we idled: */
1438 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
1439 1439
1440 local_irq_enable(); 1440 local_irq_enable();
1441 current_thread_info()->status |= TS_POLLING; 1441 current_thread_info()->status |= TS_POLLING;
@@ -1443,7 +1443,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1443 cx->usage++; 1443 cx->usage++;
1444 1444
1445 acpi_state_timer_broadcast(pr, cx, 0); 1445 acpi_state_timer_broadcast(pr, cx, 0);
1446 cx->time += ticks_elapsed(t1, t2); 1446 cx->time += sleep_ticks;
1447 return ticks_elapsed_in_us(t1, t2); 1447 return ticks_elapsed_in_us(t1, t2);
1448} 1448}
1449 1449
@@ -1463,6 +1463,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1463 struct acpi_processor *pr; 1463 struct acpi_processor *pr;
1464 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 1464 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1465 u32 t1, t2; 1465 u32 t1, t2;
1466 int sleep_ticks = 0;
1467
1466 pr = processors[smp_processor_id()]; 1468 pr = processors[smp_processor_id()];
1467 1469
1468 if (unlikely(!pr)) 1470 if (unlikely(!pr))
@@ -1471,6 +1473,15 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1471 if (acpi_idle_suspend) 1473 if (acpi_idle_suspend)
1472 return(acpi_idle_enter_c1(dev, state)); 1474 return(acpi_idle_enter_c1(dev, state));
1473 1475
1476 if (acpi_idle_bm_check()) {
1477 if (dev->safe_state) {
1478 return dev->safe_state->enter(dev, dev->safe_state);
1479 } else {
1480 acpi_safe_halt();
1481 return 0;
1482 }
1483 }
1484
1474 local_irq_disable(); 1485 local_irq_disable();
1475 current_thread_info()->status &= ~TS_POLLING; 1486 current_thread_info()->status &= ~TS_POLLING;
1476 /* 1487 /*
@@ -1485,38 +1496,45 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1485 return 0; 1496 return 0;
1486 } 1497 }
1487 1498
1499 /* Tell the scheduler that we are going deep-idle: */
1500 sched_clock_idle_sleep_event();
1488 /* 1501 /*
1489 * Must be done before busmaster disable as we might need to 1502 * Must be done before busmaster disable as we might need to
1490 * access HPET ! 1503 * access HPET !
1491 */ 1504 */
1492 acpi_state_timer_broadcast(pr, cx, 1); 1505 acpi_state_timer_broadcast(pr, cx, 1);
1493 1506
1494 if (acpi_idle_bm_check()) { 1507 acpi_idle_update_bm_rld(pr, cx);
1495 cx = pr->power.bm_state;
1496
1497 acpi_idle_update_bm_rld(pr, cx);
1498
1499 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1500 acpi_idle_do_entry(cx);
1501 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1502 } else {
1503 acpi_idle_update_bm_rld(pr, cx);
1504 1508
1509 /*
1510 * disable bus master
1511 * bm_check implies we need ARB_DIS
1512 * !bm_check implies we need cache flush
1513 * bm_control implies whether we can do ARB_DIS
1514 *
1515 * That leaves a case where bm_check is set and bm_control is
1516 * not set. In that case we cannot do much, we enter C3
1517 * without doing anything.
1518 */
1519 if (pr->flags.bm_check && pr->flags.bm_control) {
1505 spin_lock(&c3_lock); 1520 spin_lock(&c3_lock);
1506 c3_cpu_count++; 1521 c3_cpu_count++;
1507 /* Disable bus master arbitration when all CPUs are in C3 */ 1522 /* Disable bus master arbitration when all CPUs are in C3 */
1508 if (c3_cpu_count == num_online_cpus()) 1523 if (c3_cpu_count == num_online_cpus())
1509 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); 1524 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
1510 spin_unlock(&c3_lock); 1525 spin_unlock(&c3_lock);
1526 } else if (!pr->flags.bm_check) {
1527 ACPI_FLUSH_CPU_CACHE();
1528 }
1511 1529
1512 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1530 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1513 acpi_idle_do_entry(cx); 1531 acpi_idle_do_entry(cx);
1514 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1532 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1515 1533
1534 /* Re-enable bus master arbitration */
1535 if (pr->flags.bm_check && pr->flags.bm_control) {
1516 spin_lock(&c3_lock); 1536 spin_lock(&c3_lock);
1517 /* Re-enable bus master arbitration */ 1537 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
1518 if (c3_cpu_count == num_online_cpus())
1519 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
1520 c3_cpu_count--; 1538 c3_cpu_count--;
1521 spin_unlock(&c3_lock); 1539 spin_unlock(&c3_lock);
1522 } 1540 }
@@ -1525,6 +1543,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1525 /* TSC could halt in idle, so notify users */ 1543 /* TSC could halt in idle, so notify users */
1526 mark_tsc_unstable("TSC halts in idle"); 1544 mark_tsc_unstable("TSC halts in idle");
1527#endif 1545#endif
1546 sleep_ticks = ticks_elapsed(t1, t2);
1547 /* Tell the scheduler how much we idled: */
1548 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
1528 1549
1529 local_irq_enable(); 1550 local_irq_enable();
1530 current_thread_info()->status |= TS_POLLING; 1551 current_thread_info()->status |= TS_POLLING;
@@ -1532,7 +1553,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1532 cx->usage++; 1553 cx->usage++;
1533 1554
1534 acpi_state_timer_broadcast(pr, cx, 0); 1555 acpi_state_timer_broadcast(pr, cx, 0);
1535 cx->time += ticks_elapsed(t1, t2); 1556 cx->time += sleep_ticks;
1536 return ticks_elapsed_in_us(t1, t2); 1557 return ticks_elapsed_in_us(t1, t2);
1537} 1558}
1538 1559
@@ -1584,12 +1605,14 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1584 case ACPI_STATE_C1: 1605 case ACPI_STATE_C1:
1585 state->flags |= CPUIDLE_FLAG_SHALLOW; 1606 state->flags |= CPUIDLE_FLAG_SHALLOW;
1586 state->enter = acpi_idle_enter_c1; 1607 state->enter = acpi_idle_enter_c1;
1608 dev->safe_state = state;
1587 break; 1609 break;
1588 1610
1589 case ACPI_STATE_C2: 1611 case ACPI_STATE_C2:
1590 state->flags |= CPUIDLE_FLAG_BALANCED; 1612 state->flags |= CPUIDLE_FLAG_BALANCED;
1591 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1613 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1592 state->enter = acpi_idle_enter_simple; 1614 state->enter = acpi_idle_enter_simple;
1615 dev->safe_state = state;
1593 break; 1616 break;
1594 1617
1595 case ACPI_STATE_C3: 1618 case ACPI_STATE_C3:
@@ -1610,14 +1633,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1610 if (!count) 1633 if (!count)
1611 return -EINVAL; 1634 return -EINVAL;
1612 1635
1613 /* find the deepest state that can handle active BM */
1614 if (pr->flags.bm_check) {
1615 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++)
1616 if (pr->power.states[i].type == ACPI_STATE_C3)
1617 break;
1618 pr->power.bm_state = &pr->power.states[i-1];
1619 }
1620
1621 return 0; 1636 return 0;
1622} 1637}
1623 1638
@@ -1658,6 +1673,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1658 1673
1659 if (!first_run) { 1674 if (!first_run) {
1660 dmi_check_system(processor_power_dmi_table); 1675 dmi_check_system(processor_power_dmi_table);
1676 max_cstate = acpi_processor_cstate_check(max_cstate);
1661 if (max_cstate < ACPI_C_STATES_MAX) 1677 if (max_cstate < ACPI_C_STATES_MAX)
1662 printk(KERN_NOTICE 1678 printk(KERN_NOTICE
1663 "ACPI: processor limited to max C-state %d\n", 1679 "ACPI: processor limited to max C-state %d\n",
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 0b8204e7082a..c26c61fb36c3 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -70,7 +70,55 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
70 70
71int acpi_processor_tstate_has_changed(struct acpi_processor *pr) 71int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
72{ 72{
73 return acpi_processor_get_platform_limit(pr); 73 int result = 0;
74 int throttling_limit;
75 int current_state;
76 struct acpi_processor_limit *limit;
77 int target_state;
78
79 result = acpi_processor_get_platform_limit(pr);
80 if (result) {
81 /* Throttling Limit is unsupported */
82 return result;
83 }
84
85 throttling_limit = pr->throttling_platform_limit;
86 if (throttling_limit >= pr->throttling.state_count) {
87 /* Uncorrect Throttling Limit */
88 return -EINVAL;
89 }
90
91 current_state = pr->throttling.state;
92 if (current_state > throttling_limit) {
93 /*
94 * The current state can meet the requirement of
95 * _TPC limit. But it is reasonable that OSPM changes
96 * t-states from high to low for better performance.
97 * Of course the limit condition of thermal
98 * and user should be considered.
99 */
100 limit = &pr->limit;
101 target_state = throttling_limit;
102 if (limit->thermal.tx > target_state)
103 target_state = limit->thermal.tx;
104 if (limit->user.tx > target_state)
105 target_state = limit->user.tx;
106 } else if (current_state == throttling_limit) {
107 /*
108 * Unnecessary to change the throttling state
109 */
110 return 0;
111 } else {
112 /*
113 * If the current state is lower than the limit of _TPC, it
114 * will be forced to switch to the throttling state defined
115 * by throttling_platfor_limit.
116 * Because the previous state meets with the limit condition
117 * of thermal and user, it is unnecessary to check it again.
118 */
119 target_state = throttling_limit;
120 }
121 return acpi_processor_set_throttling(pr, target_state);
74} 122}
75 123
76/* 124/*
@@ -83,6 +131,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
83 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 131 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
84 union acpi_object *ptc = NULL; 132 union acpi_object *ptc = NULL;
85 union acpi_object obj = { 0 }; 133 union acpi_object obj = { 0 };
134 struct acpi_processor_throttling *throttling;
86 135
87 status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); 136 status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
88 if (ACPI_FAILURE(status)) { 137 if (ACPI_FAILURE(status)) {
@@ -134,6 +183,22 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
134 memcpy(&pr->throttling.status_register, obj.buffer.pointer, 183 memcpy(&pr->throttling.status_register, obj.buffer.pointer,
135 sizeof(struct acpi_ptc_register)); 184 sizeof(struct acpi_ptc_register));
136 185
186 throttling = &pr->throttling;
187
188 if ((throttling->control_register.bit_width +
189 throttling->control_register.bit_offset) > 32) {
190 printk(KERN_ERR PREFIX "Invalid _PTC control register\n");
191 result = -EFAULT;
192 goto end;
193 }
194
195 if ((throttling->status_register.bit_width +
196 throttling->status_register.bit_offset) > 32) {
197 printk(KERN_ERR PREFIX "Invalid _PTC status register\n");
198 result = -EFAULT;
199 goto end;
200 }
201
137 end: 202 end:
138 kfree(buffer.pointer); 203 kfree(buffer.pointer);
139 204
@@ -328,44 +393,132 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
328 return 0; 393 return 0;
329} 394}
330 395
331static int acpi_read_throttling_status(struct acpi_processor_throttling 396#ifdef CONFIG_X86
332 *throttling) 397static int acpi_throttling_rdmsr(struct acpi_processor *pr,
398 acpi_integer * value)
333{ 399{
334 int value = -1; 400 struct cpuinfo_x86 *c;
401 u64 msr_high, msr_low;
402 unsigned int cpu;
403 u64 msr = 0;
404 int ret = -1;
405
406 cpu = pr->id;
407 c = &cpu_data(cpu);
408
409 if ((c->x86_vendor != X86_VENDOR_INTEL) ||
410 !cpu_has(c, X86_FEATURE_ACPI)) {
411 printk(KERN_ERR PREFIX
412 "HARDWARE addr space,NOT supported yet\n");
413 } else {
414 msr_low = 0;
415 msr_high = 0;
416 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
417 (u32 *)&msr_low , (u32 *) &msr_high);
418 msr = (msr_high << 32) | msr_low;
419 *value = (acpi_integer) msr;
420 ret = 0;
421 }
422 return ret;
423}
424
425static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
426{
427 struct cpuinfo_x86 *c;
428 unsigned int cpu;
429 int ret = -1;
430 u64 msr;
431
432 cpu = pr->id;
433 c = &cpu_data(cpu);
434
435 if ((c->x86_vendor != X86_VENDOR_INTEL) ||
436 !cpu_has(c, X86_FEATURE_ACPI)) {
437 printk(KERN_ERR PREFIX
438 "HARDWARE addr space,NOT supported yet\n");
439 } else {
440 msr = value;
441 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
442 msr & 0xffffffff, msr >> 32);
443 ret = 0;
444 }
445 return ret;
446}
447#else
448static int acpi_throttling_rdmsr(struct acpi_processor *pr,
449 acpi_integer * value)
450{
451 printk(KERN_ERR PREFIX
452 "HARDWARE addr space,NOT supported yet\n");
453 return -1;
454}
455
456static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
457{
458 printk(KERN_ERR PREFIX
459 "HARDWARE addr space,NOT supported yet\n");
460 return -1;
461}
462#endif
463
464static int acpi_read_throttling_status(struct acpi_processor *pr,
465 acpi_integer *value)
466{
467 u32 bit_width, bit_offset;
468 u64 ptc_value;
469 u64 ptc_mask;
470 struct acpi_processor_throttling *throttling;
471 int ret = -1;
472
473 throttling = &pr->throttling;
335 switch (throttling->status_register.space_id) { 474 switch (throttling->status_register.space_id) {
336 case ACPI_ADR_SPACE_SYSTEM_IO: 475 case ACPI_ADR_SPACE_SYSTEM_IO:
476 ptc_value = 0;
477 bit_width = throttling->status_register.bit_width;
478 bit_offset = throttling->status_register.bit_offset;
479
337 acpi_os_read_port((acpi_io_address) throttling->status_register. 480 acpi_os_read_port((acpi_io_address) throttling->status_register.
338 address, &value, 481 address, (u32 *) &ptc_value,
339 (u32) throttling->status_register.bit_width * 482 (u32) (bit_width + bit_offset));
340 8); 483 ptc_mask = (1 << bit_width) - 1;
484 *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask);
485 ret = 0;
341 break; 486 break;
342 case ACPI_ADR_SPACE_FIXED_HARDWARE: 487 case ACPI_ADR_SPACE_FIXED_HARDWARE:
343 printk(KERN_ERR PREFIX 488 ret = acpi_throttling_rdmsr(pr, value);
344 "HARDWARE addr space,NOT supported yet\n");
345 break; 489 break;
346 default: 490 default:
347 printk(KERN_ERR PREFIX "Unknown addr space %d\n", 491 printk(KERN_ERR PREFIX "Unknown addr space %d\n",
348 (u32) (throttling->status_register.space_id)); 492 (u32) (throttling->status_register.space_id));
349 } 493 }
350 return value; 494 return ret;
351} 495}
352 496
353static int acpi_write_throttling_state(struct acpi_processor_throttling 497static int acpi_write_throttling_state(struct acpi_processor *pr,
354 *throttling, int value) 498 acpi_integer value)
355{ 499{
500 u32 bit_width, bit_offset;
501 u64 ptc_value;
502 u64 ptc_mask;
503 struct acpi_processor_throttling *throttling;
356 int ret = -1; 504 int ret = -1;
357 505
506 throttling = &pr->throttling;
358 switch (throttling->control_register.space_id) { 507 switch (throttling->control_register.space_id) {
359 case ACPI_ADR_SPACE_SYSTEM_IO: 508 case ACPI_ADR_SPACE_SYSTEM_IO:
509 bit_width = throttling->control_register.bit_width;
510 bit_offset = throttling->control_register.bit_offset;
511 ptc_mask = (1 << bit_width) - 1;
512 ptc_value = value & ptc_mask;
513
360 acpi_os_write_port((acpi_io_address) throttling-> 514 acpi_os_write_port((acpi_io_address) throttling->
361 control_register.address, value, 515 control_register.address,
362 (u32) throttling->control_register. 516 (u32) (ptc_value << bit_offset),
363 bit_width * 8); 517 (u32) (bit_width + bit_offset));
364 ret = 0; 518 ret = 0;
365 break; 519 break;
366 case ACPI_ADR_SPACE_FIXED_HARDWARE: 520 case ACPI_ADR_SPACE_FIXED_HARDWARE:
367 printk(KERN_ERR PREFIX 521 ret = acpi_throttling_wrmsr(pr, value);
368 "HARDWARE addr space,NOT supported yet\n");
369 break; 522 break;
370 default: 523 default:
371 printk(KERN_ERR PREFIX "Unknown addr space %d\n", 524 printk(KERN_ERR PREFIX "Unknown addr space %d\n",
@@ -374,7 +527,8 @@ static int acpi_write_throttling_state(struct acpi_processor_throttling
374 return ret; 527 return ret;
375} 528}
376 529
377static int acpi_get_throttling_state(struct acpi_processor *pr, int value) 530static int acpi_get_throttling_state(struct acpi_processor *pr,
531 acpi_integer value)
378{ 532{
379 int i; 533 int i;
380 534
@@ -390,22 +544,26 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, int value)
390 return i; 544 return i;
391} 545}
392 546
393static int acpi_get_throttling_value(struct acpi_processor *pr, int state) 547static int acpi_get_throttling_value(struct acpi_processor *pr,
548 int state, acpi_integer *value)
394{ 549{
395 int value = -1; 550 int ret = -1;
551
396 if (state >= 0 && state <= pr->throttling.state_count) { 552 if (state >= 0 && state <= pr->throttling.state_count) {
397 struct acpi_processor_tx_tss *tx = 553 struct acpi_processor_tx_tss *tx =
398 (struct acpi_processor_tx_tss *)&(pr->throttling. 554 (struct acpi_processor_tx_tss *)&(pr->throttling.
399 states_tss[state]); 555 states_tss[state]);
400 value = tx->control; 556 *value = tx->control;
557 ret = 0;
401 } 558 }
402 return value; 559 return ret;
403} 560}
404 561
405static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) 562static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
406{ 563{
407 int state = 0; 564 int state = 0;
408 u32 value = 0; 565 int ret;
566 acpi_integer value;
409 567
410 if (!pr) 568 if (!pr)
411 return -EINVAL; 569 return -EINVAL;
@@ -415,8 +573,9 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
415 573
416 pr->throttling.state = 0; 574 pr->throttling.state = 0;
417 local_irq_disable(); 575 local_irq_disable();
418 value = acpi_read_throttling_status(&pr->throttling); 576 value = 0;
419 if (value >= 0) { 577 ret = acpi_read_throttling_status(pr, &value);
578 if (ret >= 0) {
420 state = acpi_get_throttling_state(pr, value); 579 state = acpi_get_throttling_state(pr, value);
421 pr->throttling.state = state; 580 pr->throttling.state = state;
422 } 581 }
@@ -430,6 +589,40 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
430 return pr->throttling.acpi_processor_get_throttling(pr); 589 return pr->throttling.acpi_processor_get_throttling(pr);
431} 590}
432 591
592static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
593{
594 int i, step;
595
596 if (!pr->throttling.address) {
597 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
598 return -EINVAL;
599 } else if (!pr->throttling.duty_width) {
600 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
601 return -EINVAL;
602 }
603 /* TBD: Support duty_cycle values that span bit 4. */
604 else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
605 printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
606 return -EINVAL;
607 }
608
609 pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
610
611 /*
612 * Compute state values. Note that throttling displays a linear power
613 * performance relationship (at 50% performance the CPU will consume
614 * 50% power). Values are in 1/10th of a percent to preserve accuracy.
615 */
616
617 step = (1000 / pr->throttling.state_count);
618
619 for (i = 0; i < pr->throttling.state_count; i++) {
620 pr->throttling.states[i].performance = 1000 - step * i;
621 pr->throttling.states[i].power = 1000 - step * i;
622 }
623 return 0;
624}
625
433static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, 626static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
434 int state) 627 int state)
435{ 628{
@@ -506,7 +699,8 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
506static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, 699static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
507 int state) 700 int state)
508{ 701{
509 u32 value = 0; 702 int ret;
703 acpi_integer value;
510 704
511 if (!pr) 705 if (!pr)
512 return -EINVAL; 706 return -EINVAL;
@@ -524,10 +718,10 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
524 return -EPERM; 718 return -EPERM;
525 719
526 local_irq_disable(); 720 local_irq_disable();
527 721 value = 0;
528 value = acpi_get_throttling_value(pr, state); 722 ret = acpi_get_throttling_value(pr, state, &value);
529 if (value >= 0) { 723 if (ret >= 0) {
530 acpi_write_throttling_state(&pr->throttling, value); 724 acpi_write_throttling_state(pr, value);
531 pr->throttling.state = state; 725 pr->throttling.state = state;
532 } 726 }
533 local_irq_enable(); 727 local_irq_enable();
@@ -543,8 +737,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
543int acpi_processor_get_throttling_info(struct acpi_processor *pr) 737int acpi_processor_get_throttling_info(struct acpi_processor *pr)
544{ 738{
545 int result = 0; 739 int result = 0;
546 int step = 0;
547 int i = 0;
548 740
549 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 741 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
550 "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", 742 "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
@@ -563,6 +755,8 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
563 acpi_processor_get_throttling_states(pr) || 755 acpi_processor_get_throttling_states(pr) ||
564 acpi_processor_get_platform_limit(pr)) 756 acpi_processor_get_platform_limit(pr))
565 { 757 {
758 if (acpi_processor_get_fadt_info(pr))
759 return 0;
566 pr->throttling.acpi_processor_get_throttling = 760 pr->throttling.acpi_processor_get_throttling =
567 &acpi_processor_get_throttling_fadt; 761 &acpi_processor_get_throttling_fadt;
568 pr->throttling.acpi_processor_set_throttling = 762 pr->throttling.acpi_processor_set_throttling =
@@ -576,19 +770,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
576 770
577 acpi_processor_get_tsd(pr); 771 acpi_processor_get_tsd(pr);
578 772
579 if (!pr->throttling.address) {
580 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
581 return 0;
582 } else if (!pr->throttling.duty_width) {
583 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
584 return 0;
585 }
586 /* TBD: Support duty_cycle values that span bit 4. */
587 else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
588 printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
589 return 0;
590 }
591
592 /* 773 /*
593 * PIIX4 Errata: We don't support throttling on the original PIIX4. 774 * PIIX4 Errata: We don't support throttling on the original PIIX4.
594 * This shouldn't be an issue as few (if any) mobile systems ever 775 * This shouldn't be an issue as few (if any) mobile systems ever
@@ -600,21 +781,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
600 return 0; 781 return 0;
601 } 782 }
602 783
603 pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
604
605 /*
606 * Compute state values. Note that throttling displays a linear power/
607 * performance relationship (at 50% performance the CPU will consume
608 * 50% power). Values are in 1/10th of a percent to preserve accuracy.
609 */
610
611 step = (1000 / pr->throttling.state_count);
612
613 for (i = 0; i < pr->throttling.state_count; i++) {
614 pr->throttling.states[i].performance = step * i;
615 pr->throttling.states[i].power = step * i;
616 }
617
618 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", 784 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n",
619 pr->throttling.state_count)); 785 pr->throttling.state_count));
620 786
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 90fd09c65f95..6045cdbe176b 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -29,7 +29,7 @@
29#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31 31
32#ifdef CONFIG_ACPI_PROCFS 32#ifdef CONFIG_ACPI_PROCFS_POWER
33#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -88,7 +88,7 @@ MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
88struct acpi_battery { 88struct acpi_battery {
89 struct power_supply bat; 89 struct power_supply bat;
90 struct acpi_sbs *sbs; 90 struct acpi_sbs *sbs;
91#ifdef CONFIG_ACPI_PROCFS 91#ifdef CONFIG_ACPI_PROCFS_POWER
92 struct proc_dir_entry *proc_entry; 92 struct proc_dir_entry *proc_entry;
93#endif 93#endif
94 unsigned long update_time; 94 unsigned long update_time;
@@ -113,6 +113,7 @@ struct acpi_battery {
113 u16 spec; 113 u16 spec;
114 u8 id; 114 u8 id;
115 u8 present:1; 115 u8 present:1;
116 u8 have_sysfs_alarm:1;
116}; 117};
117 118
118#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 119#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
@@ -122,7 +123,7 @@ struct acpi_sbs {
122 struct acpi_device *device; 123 struct acpi_device *device;
123 struct acpi_smb_hc *hc; 124 struct acpi_smb_hc *hc;
124 struct mutex lock; 125 struct mutex lock;
125#ifdef CONFIG_ACPI_PROCFS 126#ifdef CONFIG_ACPI_PROCFS_POWER
126 struct proc_dir_entry *charger_entry; 127 struct proc_dir_entry *charger_entry;
127#endif 128#endif
128 struct acpi_battery battery[MAX_SBS_BAT]; 129 struct acpi_battery battery[MAX_SBS_BAT];
@@ -468,7 +469,7 @@ static struct device_attribute alarm_attr = {
468 FS Interface (/proc/acpi) 469 FS Interface (/proc/acpi)
469 -------------------------------------------------------------------------- */ 470 -------------------------------------------------------------------------- */
470 471
471#ifdef CONFIG_ACPI_PROCFS 472#ifdef CONFIG_ACPI_PROCFS_POWER
472/* Generic Routines */ 473/* Generic Routines */
473static int 474static int
474acpi_sbs_add_fs(struct proc_dir_entry **dir, 475acpi_sbs_add_fs(struct proc_dir_entry **dir,
@@ -789,7 +790,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
789 return result; 790 return result;
790 791
791 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); 792 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id);
792#ifdef CONFIG_ACPI_PROCFS 793#ifdef CONFIG_ACPI_PROCFS_POWER
793 acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, 794 acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir,
794 battery->name, &acpi_battery_info_fops, 795 battery->name, &acpi_battery_info_fops,
795 &acpi_battery_state_fops, &acpi_battery_alarm_fops, 796 &acpi_battery_state_fops, &acpi_battery_alarm_fops,
@@ -808,7 +809,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
808 } 809 }
809 battery->bat.get_property = acpi_sbs_battery_get_property; 810 battery->bat.get_property = acpi_sbs_battery_get_property;
810 result = power_supply_register(&sbs->device->dev, &battery->bat); 811 result = power_supply_register(&sbs->device->dev, &battery->bat);
811 device_create_file(battery->bat.dev, &alarm_attr); 812 if (result)
813 goto end;
814 result = device_create_file(battery->bat.dev, &alarm_attr);
815 if (result)
816 goto end;
817 battery->have_sysfs_alarm = 1;
818 end:
812 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", 819 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
813 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 820 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
814 battery->name, sbs->battery->present ? "present" : "absent"); 821 battery->name, sbs->battery->present ? "present" : "absent");
@@ -817,14 +824,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
817 824
818static void acpi_battery_remove(struct acpi_sbs *sbs, int id) 825static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
819{ 826{
820 if (sbs->battery[id].bat.dev) 827 struct acpi_battery *battery = &sbs->battery[id];
821 device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); 828
822 power_supply_unregister(&sbs->battery[id].bat); 829 if (battery->bat.dev) {
823#ifdef CONFIG_ACPI_PROCFS 830 if (battery->have_sysfs_alarm)
824 if (sbs->battery[id].proc_entry) { 831 device_remove_file(battery->bat.dev, &alarm_attr);
825 acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), 832 power_supply_unregister(&battery->bat);
826 acpi_battery_dir);
827 } 833 }
834#ifdef CONFIG_ACPI_PROCFS_POWER
835 if (battery->proc_entry)
836 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
828#endif 837#endif
829} 838}
830 839
@@ -835,7 +844,7 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
835 result = acpi_ac_get_present(sbs); 844 result = acpi_ac_get_present(sbs);
836 if (result) 845 if (result)
837 goto end; 846 goto end;
838#ifdef CONFIG_ACPI_PROCFS 847#ifdef CONFIG_ACPI_PROCFS_POWER
839 result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, 848 result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir,
840 ACPI_AC_DIR_NAME, NULL, 849 ACPI_AC_DIR_NAME, NULL,
841 &acpi_ac_state_fops, NULL, sbs); 850 &acpi_ac_state_fops, NULL, sbs);
@@ -859,7 +868,7 @@ static void acpi_charger_remove(struct acpi_sbs *sbs)
859{ 868{
860 if (sbs->charger.dev) 869 if (sbs->charger.dev)
861 power_supply_unregister(&sbs->charger); 870 power_supply_unregister(&sbs->charger);
862#ifdef CONFIG_ACPI_PROCFS 871#ifdef CONFIG_ACPI_PROCFS_POWER
863 if (sbs->charger_entry) 872 if (sbs->charger_entry)
864 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); 873 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
865#endif 874#endif
@@ -965,7 +974,7 @@ static int acpi_sbs_remove(struct acpi_device *device, int type)
965 974
966static void acpi_sbs_rmdirs(void) 975static void acpi_sbs_rmdirs(void)
967{ 976{
968#ifdef CONFIG_ACPI_PROCFS 977#ifdef CONFIG_ACPI_PROCFS_POWER
969 if (acpi_ac_dir) { 978 if (acpi_ac_dir) {
970 acpi_unlock_ac_dir(acpi_ac_dir); 979 acpi_unlock_ac_dir(acpi_ac_dir);
971 acpi_ac_dir = NULL; 980 acpi_ac_dir = NULL;
@@ -1004,7 +1013,7 @@ static int __init acpi_sbs_init(void)
1004 1013
1005 if (acpi_disabled) 1014 if (acpi_disabled)
1006 return -ENODEV; 1015 return -ENODEV;
1007#ifdef CONFIG_ACPI_PROCFS 1016#ifdef CONFIG_ACPI_PROCFS_POWER
1008 acpi_ac_dir = acpi_lock_ac_dir(); 1017 acpi_ac_dir = acpi_lock_ac_dir();
1009 if (!acpi_ac_dir) 1018 if (!acpi_ac_dir)
1010 return -ENODEV; 1019 return -ENODEV;
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/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 5f1d85f2ffe4..010f19652f80 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -449,7 +449,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
449 /* XSDT has NULL entry, RSDT is used */ 449 /* XSDT has NULL entry, RSDT is used */
450 address = rsdt_address; 450 address = rsdt_address;
451 table_entry_size = sizeof(u32); 451 table_entry_size = sizeof(u32);
452 ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry," 452 ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry, "
453 "using RSDT")); 453 "using RSDT"));
454 } 454 }
455 } 455 }
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index a736ef7bdee4..9e8c20c6a0b7 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -591,9 +591,12 @@ static int __init toshiba_acpi_init(void)
591 NULL, 591 NULL,
592 &toshiba_backlight_data); 592 &toshiba_backlight_data);
593 if (IS_ERR(toshiba_backlight_device)) { 593 if (IS_ERR(toshiba_backlight_device)) {
594 int ret = PTR_ERR(toshiba_backlight_device);
595
594 printk(KERN_ERR "Could not register toshiba backlight device\n"); 596 printk(KERN_ERR "Could not register toshiba backlight device\n");
595 toshiba_backlight_device = NULL; 597 toshiba_backlight_device = NULL;
596 toshiba_acpi_exit(); 598 toshiba_acpi_exit();
599 return ret;
597 } 600 }
598 toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; 601 toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;
599 602
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index bac956b30c57..44a0d9ba9bd6 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -29,6 +29,7 @@
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/mutex.h>
32#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
33#include <linux/seq_file.h> 34#include <linux/seq_file.h>
34#include <linux/input.h> 35#include <linux/input.h>
@@ -135,8 +136,8 @@ struct acpi_video_bus {
135 u8 attached_count; 136 u8 attached_count;
136 struct acpi_video_bus_cap cap; 137 struct acpi_video_bus_cap cap;
137 struct acpi_video_bus_flags flags; 138 struct acpi_video_bus_flags flags;
138 struct semaphore sem;
139 struct list_head video_device_list; 139 struct list_head video_device_list;
140 struct mutex device_list_lock; /* protects video_device_list */
140 struct proc_dir_entry *dir; 141 struct proc_dir_entry *dir;
141 struct input_dev *input; 142 struct input_dev *input;
142 char phys[32]; /* for input device */ 143 char phys[32]; /* for input device */
@@ -896,7 +897,7 @@ acpi_video_device_write_brightness(struct file *file,
896{ 897{
897 struct seq_file *m = file->private_data; 898 struct seq_file *m = file->private_data;
898 struct acpi_video_device *dev = m->private; 899 struct acpi_video_device *dev = m->private;
899 char str[4] = { 0 }; 900 char str[5] = { 0 };
900 unsigned int level = 0; 901 unsigned int level = 0;
901 int i; 902 int i;
902 903
@@ -1436,9 +1437,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1436 return -ENODEV; 1437 return -ENODEV;
1437 } 1438 }
1438 1439
1439 down(&video->sem); 1440 mutex_lock(&video->device_list_lock);
1440 list_add_tail(&data->entry, &video->video_device_list); 1441 list_add_tail(&data->entry, &video->video_device_list);
1441 up(&video->sem); 1442 mutex_unlock(&video->device_list_lock);
1442 1443
1443 acpi_video_device_add_fs(device); 1444 acpi_video_device_add_fs(device);
1444 1445
@@ -1462,12 +1463,14 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1462 1463
1463static void acpi_video_device_rebind(struct acpi_video_bus *video) 1464static void acpi_video_device_rebind(struct acpi_video_bus *video)
1464{ 1465{
1465 struct list_head *node, *next; 1466 struct acpi_video_device *dev;
1466 list_for_each_safe(node, next, &video->video_device_list) { 1467
1467 struct acpi_video_device *dev = 1468 mutex_lock(&video->device_list_lock);
1468 container_of(node, struct acpi_video_device, entry); 1469
1470 list_for_each_entry(dev, &video->video_device_list, entry)
1469 acpi_video_device_bind(video, dev); 1471 acpi_video_device_bind(video, dev);
1470 } 1472
1473 mutex_unlock(&video->device_list_lock);
1471} 1474}
1472 1475
1473/* 1476/*
@@ -1592,30 +1595,33 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1592 1595
1593static int acpi_video_switch_output(struct acpi_video_bus *video, int event) 1596static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
1594{ 1597{
1595 struct list_head *node, *next; 1598 struct list_head *node;
1596 struct acpi_video_device *dev = NULL; 1599 struct acpi_video_device *dev = NULL;
1597 struct acpi_video_device *dev_next = NULL; 1600 struct acpi_video_device *dev_next = NULL;
1598 struct acpi_video_device *dev_prev = NULL; 1601 struct acpi_video_device *dev_prev = NULL;
1599 unsigned long state; 1602 unsigned long state;
1600 int status = 0; 1603 int status = 0;
1601 1604
1605 mutex_lock(&video->device_list_lock);
1602 1606
1603 list_for_each_safe(node, next, &video->video_device_list) { 1607 list_for_each(node, &video->video_device_list) {
1604 dev = container_of(node, struct acpi_video_device, entry); 1608 dev = container_of(node, struct acpi_video_device, entry);
1605 status = acpi_video_device_get_state(dev, &state); 1609 status = acpi_video_device_get_state(dev, &state);
1606 if (state & 0x2) { 1610 if (state & 0x2) {
1607 dev_next = 1611 dev_next = container_of(node->next,
1608 container_of(node->next, struct acpi_video_device, 1612 struct acpi_video_device, entry);
1609 entry); 1613 dev_prev = container_of(node->prev,
1610 dev_prev = 1614 struct acpi_video_device, entry);
1611 container_of(node->prev, struct acpi_video_device,
1612 entry);
1613 goto out; 1615 goto out;
1614 } 1616 }
1615 } 1617 }
1618
1616 dev_next = container_of(node->next, struct acpi_video_device, entry); 1619 dev_next = container_of(node->next, struct acpi_video_device, entry);
1617 dev_prev = container_of(node->prev, struct acpi_video_device, entry); 1620 dev_prev = container_of(node->prev, struct acpi_video_device, entry);
1618 out: 1621
1622 out:
1623 mutex_unlock(&video->device_list_lock);
1624
1619 switch (event) { 1625 switch (event) {
1620 case ACPI_VIDEO_NOTIFY_CYCLE: 1626 case ACPI_VIDEO_NOTIFY_CYCLE:
1621 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: 1627 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
@@ -1691,24 +1697,17 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
1691 struct acpi_device *device) 1697 struct acpi_device *device)
1692{ 1698{
1693 int status = 0; 1699 int status = 0;
1694 struct list_head *node, *next; 1700 struct acpi_device *dev;
1695
1696 1701
1697 acpi_video_device_enumerate(video); 1702 acpi_video_device_enumerate(video);
1698 1703
1699 list_for_each_safe(node, next, &device->children) { 1704 list_for_each_entry(dev, &device->children, node) {
1700 struct acpi_device *dev =
1701 list_entry(node, struct acpi_device, node);
1702
1703 if (!dev)
1704 continue;
1705 1705
1706 status = acpi_video_bus_get_one_device(dev, video); 1706 status = acpi_video_bus_get_one_device(dev, video);
1707 if (ACPI_FAILURE(status)) { 1707 if (ACPI_FAILURE(status)) {
1708 ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); 1708 ACPI_EXCEPTION((AE_INFO, status, "Cant attach device"));
1709 continue; 1709 continue;
1710 } 1710 }
1711
1712 } 1711 }
1713 return status; 1712 return status;
1714} 1713}
@@ -1724,9 +1723,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1724 1723
1725 video = device->video; 1724 video = device->video;
1726 1725
1727 down(&video->sem);
1728 list_del(&device->entry);
1729 up(&video->sem);
1730 acpi_video_device_remove_fs(device->dev); 1726 acpi_video_device_remove_fs(device->dev);
1731 1727
1732 status = acpi_remove_notify_handler(device->dev->handle, 1728 status = acpi_remove_notify_handler(device->dev->handle,
@@ -1734,32 +1730,34 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1734 acpi_video_device_notify); 1730 acpi_video_device_notify);
1735 backlight_device_unregister(device->backlight); 1731 backlight_device_unregister(device->backlight);
1736 video_output_unregister(device->output_dev); 1732 video_output_unregister(device->output_dev);
1733
1737 return 0; 1734 return 0;
1738} 1735}
1739 1736
1740static int acpi_video_bus_put_devices(struct acpi_video_bus *video) 1737static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1741{ 1738{
1742 int status; 1739 int status;
1743 struct list_head *node, *next; 1740 struct acpi_video_device *dev, *next;
1744 1741
1742 mutex_lock(&video->device_list_lock);
1745 1743
1746 list_for_each_safe(node, next, &video->video_device_list) { 1744 list_for_each_entry_safe(dev, next, &video->video_device_list, entry) {
1747 struct acpi_video_device *data =
1748 list_entry(node, struct acpi_video_device, entry);
1749 if (!data)
1750 continue;
1751 1745
1752 status = acpi_video_bus_put_one_device(data); 1746 status = acpi_video_bus_put_one_device(dev);
1753 if (ACPI_FAILURE(status)) 1747 if (ACPI_FAILURE(status))
1754 printk(KERN_WARNING PREFIX 1748 printk(KERN_WARNING PREFIX
1755 "hhuuhhuu bug in acpi video driver.\n"); 1749 "hhuuhhuu bug in acpi video driver.\n");
1756 1750
1757 if (data->brightness) 1751 if (dev->brightness) {
1758 kfree(data->brightness->levels); 1752 kfree(dev->brightness->levels);
1759 kfree(data->brightness); 1753 kfree(dev->brightness);
1760 kfree(data); 1754 }
1755 list_del(&dev->entry);
1756 kfree(dev);
1761 } 1757 }
1762 1758
1759 mutex_unlock(&video->device_list_lock);
1760
1763 return 0; 1761 return 0;
1764} 1762}
1765 1763
@@ -1782,9 +1780,6 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1782 struct input_dev *input; 1780 struct input_dev *input;
1783 int keycode; 1781 int keycode;
1784 1782
1785
1786 printk("video bus notify\n");
1787
1788 if (!video) 1783 if (!video)
1789 return; 1784 return;
1790 1785
@@ -1897,14 +1892,10 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1897static int instance; 1892static int instance;
1898static int acpi_video_bus_add(struct acpi_device *device) 1893static int acpi_video_bus_add(struct acpi_device *device)
1899{ 1894{
1900 int result = 0; 1895 acpi_status status;
1901 acpi_status status = 0; 1896 struct acpi_video_bus *video;
1902 struct acpi_video_bus *video = NULL;
1903 struct input_dev *input; 1897 struct input_dev *input;
1904 1898 int error;
1905
1906 if (!device)
1907 return -EINVAL;
1908 1899
1909 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); 1900 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
1910 if (!video) 1901 if (!video)
@@ -1923,15 +1914,15 @@ static int acpi_video_bus_add(struct acpi_device *device)
1923 acpi_driver_data(device) = video; 1914 acpi_driver_data(device) = video;
1924 1915
1925 acpi_video_bus_find_cap(video); 1916 acpi_video_bus_find_cap(video);
1926 result = acpi_video_bus_check(video); 1917 error = acpi_video_bus_check(video);
1927 if (result) 1918 if (error)
1928 goto end; 1919 goto err_free_video;
1929 1920
1930 result = acpi_video_bus_add_fs(device); 1921 error = acpi_video_bus_add_fs(device);
1931 if (result) 1922 if (error)
1932 goto end; 1923 goto err_free_video;
1933 1924
1934 init_MUTEX(&video->sem); 1925 mutex_init(&video->device_list_lock);
1935 INIT_LIST_HEAD(&video->video_device_list); 1926 INIT_LIST_HEAD(&video->video_device_list);
1936 1927
1937 acpi_video_bus_get_devices(video, device); 1928 acpi_video_bus_get_devices(video, device);
@@ -1943,16 +1934,15 @@ static int acpi_video_bus_add(struct acpi_device *device)
1943 if (ACPI_FAILURE(status)) { 1934 if (ACPI_FAILURE(status)) {
1944 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1935 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1945 "Error installing notify handler\n")); 1936 "Error installing notify handler\n"));
1946 acpi_video_bus_stop_devices(video); 1937 error = -ENODEV;
1947 acpi_video_bus_put_devices(video); 1938 goto err_stop_video;
1948 kfree(video->attached_array);
1949 acpi_video_bus_remove_fs(device);
1950 result = -ENODEV;
1951 goto end;
1952 } 1939 }
1953 1940
1954
1955 video->input = input = input_allocate_device(); 1941 video->input = input = input_allocate_device();
1942 if (!input) {
1943 error = -ENOMEM;
1944 goto err_uninstall_notify;
1945 }
1956 1946
1957 snprintf(video->phys, sizeof(video->phys), 1947 snprintf(video->phys, sizeof(video->phys),
1958 "%s/video/input0", acpi_device_hid(video->device)); 1948 "%s/video/input0", acpi_device_hid(video->device));
@@ -1961,6 +1951,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
1961 input->phys = video->phys; 1951 input->phys = video->phys;
1962 input->id.bustype = BUS_HOST; 1952 input->id.bustype = BUS_HOST;
1963 input->id.product = 0x06; 1953 input->id.product = 0x06;
1954 input->dev.parent = &device->dev;
1964 input->evbit[0] = BIT(EV_KEY); 1955 input->evbit[0] = BIT(EV_KEY);
1965 set_bit(KEY_SWITCHVIDEOMODE, input->keybit); 1956 set_bit(KEY_SWITCHVIDEOMODE, input->keybit);
1966 set_bit(KEY_VIDEO_NEXT, input->keybit); 1957 set_bit(KEY_VIDEO_NEXT, input->keybit);
@@ -1971,18 +1962,10 @@ static int acpi_video_bus_add(struct acpi_device *device)
1971 set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); 1962 set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
1972 set_bit(KEY_DISPLAY_OFF, input->keybit); 1963 set_bit(KEY_DISPLAY_OFF, input->keybit);
1973 set_bit(KEY_UNKNOWN, input->keybit); 1964 set_bit(KEY_UNKNOWN, input->keybit);
1974 result = input_register_device(input);
1975 if (result) {
1976 acpi_remove_notify_handler(video->device->handle,
1977 ACPI_DEVICE_NOTIFY,
1978 acpi_video_bus_notify);
1979 acpi_video_bus_stop_devices(video);
1980 acpi_video_bus_put_devices(video);
1981 kfree(video->attached_array);
1982 acpi_video_bus_remove_fs(device);
1983 goto end;
1984 }
1985 1965
1966 error = input_register_device(input);
1967 if (error)
1968 goto err_free_input_dev;
1986 1969
1987 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", 1970 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n",
1988 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), 1971 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
@@ -1990,11 +1973,23 @@ static int acpi_video_bus_add(struct acpi_device *device)
1990 video->flags.rom ? "yes" : "no", 1973 video->flags.rom ? "yes" : "no",
1991 video->flags.post ? "yes" : "no"); 1974 video->flags.post ? "yes" : "no");
1992 1975
1993 end: 1976 return 0;
1994 if (result) 1977
1995 kfree(video); 1978 err_free_input_dev:
1979 input_free_device(input);
1980 err_uninstall_notify:
1981 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
1982 acpi_video_bus_notify);
1983 err_stop_video:
1984 acpi_video_bus_stop_devices(video);
1985 acpi_video_bus_put_devices(video);
1986 kfree(video->attached_array);
1987 acpi_video_bus_remove_fs(device);
1988 err_free_video:
1989 kfree(video);
1990 acpi_driver_data(device) = NULL;
1996 1991
1997 return result; 1992 return error;
1998} 1993}
1999 1994
2000static int acpi_video_bus_remove(struct acpi_device *device, int type) 1995static int acpi_video_bus_remove(struct acpi_device *device, int type)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 49cf4cf1a5a2..ed9b407e42d4 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -49,6 +49,9 @@
49#define DRV_NAME "ahci" 49#define DRV_NAME "ahci"
50#define DRV_VERSION "3.0" 50#define DRV_VERSION "3.0"
51 51
52static int ahci_enable_alpm(struct ata_port *ap,
53 enum link_pm policy);
54static void ahci_disable_alpm(struct ata_port *ap);
52 55
53enum { 56enum {
54 AHCI_PCI_BAR = 5, 57 AHCI_PCI_BAR = 5,
@@ -99,6 +102,7 @@ enum {
99 HOST_CAP_SSC = (1 << 14), /* Slumber capable */ 102 HOST_CAP_SSC = (1 << 14), /* Slumber capable */
100 HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */ 103 HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */
101 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 */
102 HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ 106 HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */
103 HOST_CAP_SNTF = (1 << 29), /* SNotification register */ 107 HOST_CAP_SNTF = (1 << 29), /* SNotification register */
104 HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ 108 HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */
@@ -155,6 +159,8 @@ enum {
155 PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS, 159 PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS,
156 160
157 /* 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 */
158 PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ 164 PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */
159 PORT_CMD_PMP = (1 << 17), /* PMP attached */ 165 PORT_CMD_PMP = (1 << 17), /* PMP attached */
160 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ 166 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */
@@ -178,13 +184,14 @@ enum {
178 AHCI_HFLAG_MV_PATA = (1 << 4), /* PATA port */ 184 AHCI_HFLAG_MV_PATA = (1 << 4), /* PATA port */
179 AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */ 185 AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */
180 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 */
181 188
182 /* ap->flags bits */ 189 /* ap->flags bits */
183 AHCI_FLAG_NO_HOTPLUG = (1 << 24), /* ignore PxSERR.DIAG.N */
184 190
185 AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 191 AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
186 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 192 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
187 ATA_FLAG_ACPI_SATA | ATA_FLAG_AN, 193 ATA_FLAG_ACPI_SATA | ATA_FLAG_AN |
194 ATA_FLAG_IPM,
188 AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, 195 AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY,
189}; 196};
190 197
@@ -254,6 +261,11 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
254static int ahci_pci_device_resume(struct pci_dev *pdev); 261static int ahci_pci_device_resume(struct pci_dev *pdev);
255#endif 262#endif
256 263
264static struct class_device_attribute *ahci_shost_attrs[] = {
265 &class_device_attr_link_power_management_policy,
266 NULL
267};
268
257static struct scsi_host_template ahci_sht = { 269static struct scsi_host_template ahci_sht = {
258 .module = THIS_MODULE, 270 .module = THIS_MODULE,
259 .name = DRV_NAME, 271 .name = DRV_NAME,
@@ -271,6 +283,7 @@ static struct scsi_host_template ahci_sht = {
271 .slave_configure = ata_scsi_slave_config, 283 .slave_configure = ata_scsi_slave_config,
272 .slave_destroy = ata_scsi_slave_destroy, 284 .slave_destroy = ata_scsi_slave_destroy,
273 .bios_param = ata_std_bios_param, 285 .bios_param = ata_std_bios_param,
286 .shost_attrs = ahci_shost_attrs,
274}; 287};
275 288
276static const struct ata_port_operations ahci_ops = { 289static const struct ata_port_operations ahci_ops = {
@@ -302,6 +315,8 @@ static const struct ata_port_operations ahci_ops = {
302 .port_suspend = ahci_port_suspend, 315 .port_suspend = ahci_port_suspend,
303 .port_resume = ahci_port_resume, 316 .port_resume = ahci_port_resume,
304#endif 317#endif
318 .enable_pm = ahci_enable_alpm,
319 .disable_pm = ahci_disable_alpm,
305 320
306 .port_start = ahci_port_start, 321 .port_start = ahci_port_start,
307 .port_stop = ahci_port_stop, 322 .port_stop = ahci_port_stop,
@@ -836,6 +851,130 @@ static void ahci_power_up(struct ata_port *ap)
836 writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD); 851 writel(cmd | PORT_CMD_ICC_ACTIVE, port_mmio + PORT_CMD);
837} 852}
838 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
839#ifdef CONFIG_PM 978#ifdef CONFIG_PM
840static void ahci_power_down(struct ata_port *ap) 979static void ahci_power_down(struct ata_port *ap)
841{ 980{
@@ -898,8 +1037,10 @@ static int ahci_reset_controller(struct ata_host *host)
898 * AHCI-specific, such as HOST_RESET. 1037 * AHCI-specific, such as HOST_RESET.
899 */ 1038 */
900 tmp = readl(mmio + HOST_CTL); 1039 tmp = readl(mmio + HOST_CTL);
901 if (!(tmp & HOST_AHCI_EN)) 1040 if (!(tmp & HOST_AHCI_EN)) {
902 writel(tmp | HOST_AHCI_EN, mmio + HOST_CTL); 1041 tmp |= HOST_AHCI_EN;
1042 writel(tmp, mmio + HOST_CTL);
1043 }
903 1044
904 /* global controller reset */ 1045 /* global controller reset */
905 if ((tmp & HOST_RESET) == 0) { 1046 if ((tmp & HOST_RESET) == 0) {
@@ -1153,15 +1294,8 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1153 tf.ctl &= ~ATA_SRST; 1294 tf.ctl &= ~ATA_SRST;
1154 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); 1295 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0);
1155 1296
1156 /* spec mandates ">= 2ms" before checking status. 1297 /* wait a while before checking status */
1157 * We wait 150ms, because that was the magic delay used for 1298 ata_wait_after_reset(ap, deadline);
1158 * ATAPI devices in Hale Landis's ATADRVR, for the period of time
1159 * between when the ATA command register is written, and then
1160 * status is checked. Because waiting for "a while" before
1161 * checking status is fine, post SRST, we perform this magic
1162 * delay here as well.
1163 */
1164 msleep(150);
1165 1299
1166 rc = ata_wait_ready(ap, deadline); 1300 rc = ata_wait_ready(ap, deadline);
1167 /* link occupied, -ENODEV too is an error */ 1301 /* link occupied, -ENODEV too is an error */
@@ -1509,6 +1643,17 @@ static void ahci_port_intr(struct ata_port *ap)
1509 if (unlikely(resetting)) 1643 if (unlikely(resetting))
1510 status &= ~PORT_IRQ_BAD_PMP; 1644 status &= ~PORT_IRQ_BAD_PMP;
1511 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
1512 if (unlikely(status & PORT_IRQ_ERROR)) { 1657 if (unlikely(status & PORT_IRQ_ERROR)) {
1513 ahci_error_intr(ap, status); 1658 ahci_error_intr(ap, status);
1514 return; 1659 return;
@@ -2156,6 +2301,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2156 ata_port_pbar_desc(ap, AHCI_PCI_BAR, 2301 ata_port_pbar_desc(ap, AHCI_PCI_BAR,
2157 0x100 + ap->port_no * 0x80, "port"); 2302 0x100 + ap->port_no * 0x80, "port");
2158 2303
2304 /* set initial link pm policy */
2305 ap->pm_policy = NOT_AVAILABLE;
2306
2159 /* standard SATA port setup */ 2307 /* standard SATA port setup */
2160 if (hpriv->port_map & (1 << i)) 2308 if (hpriv->port_map & (1 << i))
2161 ap->ioaddr.cmd_addr = port_mmio; 2309 ap->ioaddr.cmd_addr = port_mmio;
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index a4b2cb29f46c..483269db2c7d 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -119,18 +119,19 @@ enum {
119 PIIX_80C_SEC = (1 << 7) | (1 << 6), 119 PIIX_80C_SEC = (1 << 7) | (1 << 6),
120 120
121 /* controller IDs */ 121 /* controller IDs */
122 piix_pata_33 = 0, /* PIIX4 at 33Mhz */ 122 piix_pata_mwdma = 0, /* PIIX3 MWDMA only */
123 ich_pata_33 = 1, /* ICH up to UDMA 33 only */ 123 piix_pata_33, /* PIIX4 at 33Mhz */
124 ich_pata_66 = 2, /* ICH up to 66 Mhz */ 124 ich_pata_33, /* ICH up to UDMA 33 only */
125 ich_pata_100 = 3, /* ICH up to UDMA 100 */ 125 ich_pata_66, /* ICH up to 66 Mhz */
126 ich5_sata = 5, 126 ich_pata_100, /* ICH up to UDMA 100 */
127 ich6_sata = 6, 127 ich5_sata,
128 ich6_sata_ahci = 7, 128 ich6_sata,
129 ich6m_sata_ahci = 8, 129 ich6_sata_ahci,
130 ich8_sata_ahci = 9, 130 ich6m_sata_ahci,
131 piix_pata_mwdma = 10, /* PIIX3 MWDMA only */ 131 ich8_sata_ahci,
132 tolapai_sata_ahci = 11, 132 ich8_2port_sata,
133 ich9_2port_sata = 12, 133 ich8m_apple_sata_ahci, /* locks up on second port enable */
134 tolapai_sata_ahci,
134 135
135 /* constants for mapping table */ 136 /* constants for mapping table */
136 P0 = 0, /* port 0 */ 137 P0 = 0, /* port 0 */
@@ -239,19 +240,21 @@ static const struct pci_device_id piix_pci_tbl[] = {
239 /* SATA Controller 1 IDE (ICH8) */ 240 /* SATA Controller 1 IDE (ICH8) */
240 { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, 241 { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
241 /* SATA Controller 2 IDE (ICH8) */ 242 /* SATA Controller 2 IDE (ICH8) */
242 { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 243 { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
243 /* Mobile SATA Controller IDE (ICH8M) */ 244 /* Mobile SATA Controller IDE (ICH8M) */
244 { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, 245 { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
246 /* Mobile SATA Controller IDE (ICH8M), Apple */
247 { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata_ahci },
245 /* SATA Controller IDE (ICH9) */ 248 /* SATA Controller IDE (ICH9) */
246 { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, 249 { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
247 /* SATA Controller IDE (ICH9) */ 250 /* SATA Controller IDE (ICH9) */
248 { 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 251 { 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
249 /* SATA Controller IDE (ICH9) */ 252 /* SATA Controller IDE (ICH9) */
250 { 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 253 { 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
251 /* SATA Controller IDE (ICH9M) */ 254 /* SATA Controller IDE (ICH9M) */
252 { 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 255 { 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
253 /* SATA Controller IDE (ICH9M) */ 256 /* SATA Controller IDE (ICH9M) */
254 { 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 257 { 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
255 /* SATA Controller IDE (ICH9M) */ 258 /* SATA Controller IDE (ICH9M) */
256 { 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, 259 { 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
257 /* SATA Controller IDE (Tolapai) */ 260 /* SATA Controller IDE (Tolapai) */
@@ -427,7 +430,7 @@ static const struct piix_map_db ich6m_map_db = {
427 430
428static const struct piix_map_db ich8_map_db = { 431static const struct piix_map_db ich8_map_db = {
429 .mask = 0x3, 432 .mask = 0x3,
430 .port_enable = 0x3, 433 .port_enable = 0xf,
431 .map = { 434 .map = {
432 /* PM PS SM SS MAP */ 435 /* PM PS SM SS MAP */
433 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ 436 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */
@@ -437,7 +440,7 @@ static const struct piix_map_db ich8_map_db = {
437 }, 440 },
438}; 441};
439 442
440static const struct piix_map_db tolapai_map_db = { 443static const struct piix_map_db ich8_2port_map_db = {
441 .mask = 0x3, 444 .mask = 0x3,
442 .port_enable = 0x3, 445 .port_enable = 0x3,
443 .map = { 446 .map = {
@@ -449,7 +452,19 @@ static const struct piix_map_db tolapai_map_db = {
449 }, 452 },
450}; 453};
451 454
452static const struct piix_map_db ich9_2port_map_db = { 455static const struct piix_map_db ich8m_apple_map_db = {
456 .mask = 0x3,
457 .port_enable = 0x1,
458 .map = {
459 /* PM PS SM SS MAP */
460 { P0, NA, NA, NA }, /* 00b */
461 { RV, RV, RV, RV },
462 { P0, P2, IDE, IDE }, /* 10b */
463 { RV, RV, RV, RV },
464 },
465};
466
467static const struct piix_map_db tolapai_map_db = {
453 .mask = 0x3, 468 .mask = 0x3,
454 .port_enable = 0x3, 469 .port_enable = 0x3,
455 .map = { 470 .map = {
@@ -467,11 +482,21 @@ static const struct piix_map_db *piix_map_db_table[] = {
467 [ich6_sata_ahci] = &ich6_map_db, 482 [ich6_sata_ahci] = &ich6_map_db,
468 [ich6m_sata_ahci] = &ich6m_map_db, 483 [ich6m_sata_ahci] = &ich6m_map_db,
469 [ich8_sata_ahci] = &ich8_map_db, 484 [ich8_sata_ahci] = &ich8_map_db,
485 [ich8_2port_sata] = &ich8_2port_map_db,
486 [ich8m_apple_sata_ahci] = &ich8m_apple_map_db,
470 [tolapai_sata_ahci] = &tolapai_map_db, 487 [tolapai_sata_ahci] = &tolapai_map_db,
471 [ich9_2port_sata] = &ich9_2port_map_db,
472}; 488};
473 489
474static struct ata_port_info piix_port_info[] = { 490static struct ata_port_info piix_port_info[] = {
491 [piix_pata_mwdma] = /* PIIX3 MWDMA only */
492 {
493 .sht = &piix_sht,
494 .flags = PIIX_PATA_FLAGS,
495 .pio_mask = 0x1f, /* pio0-4 */
496 .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
497 .port_ops = &piix_pata_ops,
498 },
499
475 [piix_pata_33] = /* PIIX4 at 33MHz */ 500 [piix_pata_33] = /* PIIX4 at 33MHz */
476 { 501 {
477 .sht = &piix_sht, 502 .sht = &piix_sht,
@@ -565,13 +590,15 @@ static struct ata_port_info piix_port_info[] = {
565 .port_ops = &piix_sata_ops, 590 .port_ops = &piix_sata_ops,
566 }, 591 },
567 592
568 [piix_pata_mwdma] = /* PIIX3 MWDMA only */ 593 [ich8_2port_sata] =
569 { 594 {
570 .sht = &piix_sht, 595 .sht = &piix_sht,
571 .flags = PIIX_PATA_FLAGS, 596 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR |
597 PIIX_FLAG_AHCI,
572 .pio_mask = 0x1f, /* pio0-4 */ 598 .pio_mask = 0x1f, /* pio0-4 */
573 .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */ 599 .mwdma_mask = 0x07, /* mwdma0-2 */
574 .port_ops = &piix_pata_ops, 600 .udma_mask = ATA_UDMA6,
601 .port_ops = &piix_sata_ops,
575 }, 602 },
576 603
577 [tolapai_sata_ahci] = 604 [tolapai_sata_ahci] =
@@ -585,7 +612,7 @@ static struct ata_port_info piix_port_info[] = {
585 .port_ops = &piix_sata_ops, 612 .port_ops = &piix_sata_ops,
586 }, 613 },
587 614
588 [ich9_2port_sata] = 615 [ich8m_apple_sata_ahci] =
589 { 616 {
590 .sht = &piix_sht, 617 .sht = &piix_sht,
591 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR | 618 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR |
@@ -595,6 +622,7 @@ static struct ata_port_info piix_port_info[] = {
595 .udma_mask = ATA_UDMA6, 622 .udma_mask = ATA_UDMA6,
596 .port_ops = &piix_sata_ops, 623 .port_ops = &piix_sata_ops,
597 }, 624 },
625
598}; 626};
599 627
600static struct pci_bits piix_enable_bits[] = { 628static struct pci_bits piix_enable_bits[] = {
@@ -621,6 +649,7 @@ struct ich_laptop {
621static const struct ich_laptop ich_laptop[] = { 649static const struct ich_laptop ich_laptop[] = {
622 /* devid, subvendor, subdev */ 650 /* devid, subvendor, subdev */
623 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ 651 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */
652 { 0x27DF, 0x1025, 0x0102 }, /* ICH7 on Acer 5602aWLMi */
624 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ 653 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */
625 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 654 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
626 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ 655 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */
@@ -959,6 +988,13 @@ static int piix_broken_suspend(void)
959 }, 988 },
960 }, 989 },
961 { 990 {
991 .ident = "Satellite Pro U200",
992 .matches = {
993 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
994 DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE PRO U200"),
995 },
996 },
997 {
962 .ident = "Satellite U205", 998 .ident = "Satellite U205",
963 .matches = { 999 .matches = {
964 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 1000 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
@@ -966,6 +1002,13 @@ static int piix_broken_suspend(void)
966 }, 1002 },
967 }, 1003 },
968 { 1004 {
1005 .ident = "SATELLITE U205",
1006 .matches = {
1007 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1008 DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE U205"),
1009 },
1010 },
1011 {
969 .ident = "Portege M500", 1012 .ident = "Portege M500",
970 .matches = { 1013 .matches = {
971 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 1014 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
@@ -1078,12 +1121,12 @@ static int piix_disable_ahci(struct pci_dev *pdev)
1078 if (!mmio) 1121 if (!mmio)
1079 return -ENOMEM; 1122 return -ENOMEM;
1080 1123
1081 tmp = readl(mmio + AHCI_GLOBAL_CTL); 1124 tmp = ioread32(mmio + AHCI_GLOBAL_CTL);
1082 if (tmp & AHCI_ENABLE) { 1125 if (tmp & AHCI_ENABLE) {
1083 tmp &= ~AHCI_ENABLE; 1126 tmp &= ~AHCI_ENABLE;
1084 writel(tmp, mmio + AHCI_GLOBAL_CTL); 1127 iowrite32(tmp, mmio + AHCI_GLOBAL_CTL);
1085 1128
1086 tmp = readl(mmio + AHCI_GLOBAL_CTL); 1129 tmp = ioread32(mmio + AHCI_GLOBAL_CTL);
1087 if (tmp & AHCI_ENABLE) 1130 if (tmp & AHCI_ENABLE)
1088 rc = -EIO; 1131 rc = -EIO;
1089 } 1132 }
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 08a52dd45fb6..545ea865ceb5 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -312,7 +312,7 @@ EXPORT_SYMBOL_GPL(ata_acpi_stm);
312 * 312 *
313 * RETURNS: 313 * RETURNS:
314 * Number of taskfiles on success, 0 if _GTF doesn't exist or doesn't 314 * Number of taskfiles on success, 0 if _GTF doesn't exist or doesn't
315 * contain valid data. -errno on other errors. 315 * contain valid data.
316 */ 316 */
317static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, 317static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
318 void **ptr_to_free) 318 void **ptr_to_free)
@@ -339,7 +339,6 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
339 ata_dev_printk(dev, KERN_WARNING, 339 ata_dev_printk(dev, KERN_WARNING,
340 "_GTF evaluation failed (AE 0x%x)\n", 340 "_GTF evaluation failed (AE 0x%x)\n",
341 status); 341 status);
342 rc = -EIO;
343 } 342 }
344 goto out_free; 343 goto out_free;
345 } 344 }
@@ -359,7 +358,6 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
359 ata_dev_printk(dev, KERN_WARNING, 358 ata_dev_printk(dev, KERN_WARNING,
360 "_GTF unexpected object type 0x%x\n", 359 "_GTF unexpected object type 0x%x\n",
361 out_obj->type); 360 out_obj->type);
362 rc = -EINVAL;
363 goto out_free; 361 goto out_free;
364 } 362 }
365 363
@@ -367,7 +365,6 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
367 ata_dev_printk(dev, KERN_WARNING, 365 ata_dev_printk(dev, KERN_WARNING,
368 "unexpected _GTF length (%d)\n", 366 "unexpected _GTF length (%d)\n",
369 out_obj->buffer.length); 367 out_obj->buffer.length);
370 rc = -EINVAL;
371 goto out_free; 368 goto out_free;
372 } 369 }
373 370
@@ -511,10 +508,7 @@ static int ata_acpi_exec_tfs(struct ata_device *dev)
511 int gtf_count, i, rc; 508 int gtf_count, i, rc;
512 509
513 /* get taskfiles */ 510 /* get taskfiles */
514 rc = ata_dev_get_GTF(dev, &gtf, &ptr_to_free); 511 gtf_count = ata_dev_get_GTF(dev, &gtf, &ptr_to_free);
515 if (rc < 0)
516 return rc;
517 gtf_count = rc;
518 512
519 /* execute them */ 513 /* execute them */
520 for (i = 0, rc = 0; i < gtf_count; i++) { 514 for (i = 0, rc = 0; i < gtf_count; i++) {
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 081e3dfb64d4..33f06277b3be 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -30,6 +30,14 @@
30 * Hardware documentation available from http://www.t13.org/ and 30 * Hardware documentation available from http://www.t13.org/ and
31 * http://www.sata-io.org/ 31 * http://www.sata-io.org/
32 * 32 *
33 * Standards documents from:
34 * http://www.t13.org (ATA standards, PCI DMA IDE spec)
35 * http://www.t10.org (SCSI MMC - for ATAPI MMC)
36 * http://www.sata-io.org (SATA)
37 * http://www.compactflash.org (CF)
38 * http://www.qic.org (QIC157 - Tape and DSC)
39 * http://www.ce-ata.org (CE-ATA: not supported)
40 *
33 */ 41 */
34 42
35#include <linux/kernel.h> 43#include <linux/kernel.h>
@@ -620,6 +628,183 @@ void ata_dev_disable(struct ata_device *dev)
620 } 628 }
621} 629}
622 630
631static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
632{
633 struct ata_link *link = dev->link;
634 struct ata_port *ap = link->ap;
635 u32 scontrol;
636 unsigned int err_mask;
637 int rc;
638
639 /*
640 * disallow DIPM for drivers which haven't set
641 * ATA_FLAG_IPM. This is because when DIPM is enabled,
642 * phy ready will be set in the interrupt status on
643 * state changes, which will cause some drivers to
644 * think there are errors - additionally drivers will
645 * need to disable hot plug.
646 */
647 if (!(ap->flags & ATA_FLAG_IPM) || !ata_dev_enabled(dev)) {
648 ap->pm_policy = NOT_AVAILABLE;
649 return -EINVAL;
650 }
651
652 /*
653 * For DIPM, we will only enable it for the
654 * min_power setting.
655 *
656 * Why? Because Disks are too stupid to know that
657 * If the host rejects a request to go to SLUMBER
658 * they should retry at PARTIAL, and instead it
659 * just would give up. So, for medium_power to
660 * work at all, we need to only allow HIPM.
661 */
662 rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
663 if (rc)
664 return rc;
665
666 switch (policy) {
667 case MIN_POWER:
668 /* no restrictions on IPM transitions */
669 scontrol &= ~(0x3 << 8);
670 rc = sata_scr_write(link, SCR_CONTROL, scontrol);
671 if (rc)
672 return rc;
673
674 /* enable DIPM */
675 if (dev->flags & ATA_DFLAG_DIPM)
676 err_mask = ata_dev_set_feature(dev,
677 SETFEATURES_SATA_ENABLE, SATA_DIPM);
678 break;
679 case MEDIUM_POWER:
680 /* allow IPM to PARTIAL */
681 scontrol &= ~(0x1 << 8);
682 scontrol |= (0x2 << 8);
683 rc = sata_scr_write(link, SCR_CONTROL, scontrol);
684 if (rc)
685 return rc;
686
687 /*
688 * we don't have to disable DIPM since IPM flags
689 * disallow transitions to SLUMBER, which effectively
690 * disable DIPM if it does not support PARTIAL
691 */
692 break;
693 case NOT_AVAILABLE:
694 case MAX_PERFORMANCE:
695 /* disable all IPM transitions */
696 scontrol |= (0x3 << 8);
697 rc = sata_scr_write(link, SCR_CONTROL, scontrol);
698 if (rc)
699 return rc;
700
701 /*
702 * we don't have to disable DIPM since IPM flags
703 * disallow all transitions which effectively
704 * disable DIPM anyway.
705 */
706 break;
707 }
708
709 /* FIXME: handle SET FEATURES failure */
710 (void) err_mask;
711
712 return 0;
713}
714
715/**
716 * ata_dev_enable_pm - enable SATA interface power management
717 * @dev: device to enable power management
718 * @policy: the link power management policy
719 *
720 * Enable SATA Interface power management. This will enable
721 * Device Interface Power Management (DIPM) for min_power
722 * policy, and then call driver specific callbacks for
723 * enabling Host Initiated Power management.
724 *
725 * Locking: Caller.
726 * Returns: -EINVAL if IPM is not supported, 0 otherwise.
727 */
728void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy)
729{
730 int rc = 0;
731 struct ata_port *ap = dev->link->ap;
732
733 /* set HIPM first, then DIPM */
734 if (ap->ops->enable_pm)
735 rc = ap->ops->enable_pm(ap, policy);
736 if (rc)
737 goto enable_pm_out;
738 rc = ata_dev_set_dipm(dev, policy);
739
740enable_pm_out:
741 if (rc)
742 ap->pm_policy = MAX_PERFORMANCE;
743 else
744 ap->pm_policy = policy;
745 return /* rc */; /* hopefully we can use 'rc' eventually */
746}
747
748#ifdef CONFIG_PM
749/**
750 * ata_dev_disable_pm - disable SATA interface power management
751 * @dev: device to disable power management
752 *
753 * Disable SATA Interface power management. This will disable
754 * Device Interface Power Management (DIPM) without changing
755 * policy, call driver specific callbacks for disabling Host
756 * Initiated Power management.
757 *
758 * Locking: Caller.
759 * Returns: void
760 */
761static void ata_dev_disable_pm(struct ata_device *dev)
762{
763 struct ata_port *ap = dev->link->ap;
764
765 ata_dev_set_dipm(dev, MAX_PERFORMANCE);
766 if (ap->ops->disable_pm)
767 ap->ops->disable_pm(ap);
768}
769#endif /* CONFIG_PM */
770
771void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
772{
773 ap->pm_policy = policy;
774 ap->link.eh_info.action |= ATA_EHI_LPM;
775 ap->link.eh_info.flags |= ATA_EHI_NO_AUTOPSY;
776 ata_port_schedule_eh(ap);
777}
778
779#ifdef CONFIG_PM
780static void ata_lpm_enable(struct ata_host *host)
781{
782 struct ata_link *link;
783 struct ata_port *ap;
784 struct ata_device *dev;
785 int i;
786
787 for (i = 0; i < host->n_ports; i++) {
788 ap = host->ports[i];
789 ata_port_for_each_link(link, ap) {
790 ata_link_for_each_dev(dev, link)
791 ata_dev_disable_pm(dev);
792 }
793 }
794}
795
796static void ata_lpm_disable(struct ata_host *host)
797{
798 int i;
799
800 for (i = 0; i < host->n_ports; i++) {
801 struct ata_port *ap = host->ports[i];
802 ata_lpm_schedule(ap, ap->pm_policy);
803 }
804}
805#endif /* CONFIG_PM */
806
807
623/** 808/**
624 * ata_devchk - PATA device presence detection 809 * ata_devchk - PATA device presence detection
625 * @ap: ATA channel to examine 810 * @ap: ATA channel to examine
@@ -2101,6 +2286,13 @@ int ata_dev_configure(struct ata_device *dev)
2101 if (dev->flags & ATA_DFLAG_LBA48) 2286 if (dev->flags & ATA_DFLAG_LBA48)
2102 dev->max_sectors = ATA_MAX_SECTORS_LBA48; 2287 dev->max_sectors = ATA_MAX_SECTORS_LBA48;
2103 2288
2289 if (!(dev->horkage & ATA_HORKAGE_IPM)) {
2290 if (ata_id_has_hipm(dev->id))
2291 dev->flags |= ATA_DFLAG_HIPM;
2292 if (ata_id_has_dipm(dev->id))
2293 dev->flags |= ATA_DFLAG_DIPM;
2294 }
2295
2104 if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) { 2296 if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) {
2105 /* Let the user know. We don't want to disallow opens for 2297 /* Let the user know. We don't want to disallow opens for
2106 rescue purposes, or in case the vendor is just a blithering 2298 rescue purposes, or in case the vendor is just a blithering
@@ -2122,10 +2314,23 @@ int ata_dev_configure(struct ata_device *dev)
2122 dev->max_sectors = ATA_MAX_SECTORS; 2314 dev->max_sectors = ATA_MAX_SECTORS;
2123 } 2315 }
2124 2316
2317 if ((dev->class == ATA_DEV_ATAPI) &&
2318 (atapi_command_packet_set(id) == TYPE_TAPE)) {
2319 dev->max_sectors = ATA_MAX_SECTORS_TAPE;
2320 dev->horkage |= ATA_HORKAGE_STUCK_ERR;
2321 }
2322
2125 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) 2323 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
2126 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, 2324 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
2127 dev->max_sectors); 2325 dev->max_sectors);
2128 2326
2327 if (ata_dev_blacklisted(dev) & ATA_HORKAGE_IPM) {
2328 dev->horkage |= ATA_HORKAGE_IPM;
2329
2330 /* reset link pm_policy for this port to no pm */
2331 ap->pm_policy = MAX_PERFORMANCE;
2332 }
2333
2129 if (ap->ops->dev_config) 2334 if (ap->ops->dev_config)
2130 ap->ops->dev_config(dev); 2335 ap->ops->dev_config(dev);
2131 2336
@@ -2219,6 +2424,25 @@ int ata_bus_probe(struct ata_port *ap)
2219 tries[dev->devno] = ATA_PROBE_MAX_TRIES; 2424 tries[dev->devno] = ATA_PROBE_MAX_TRIES;
2220 2425
2221 retry: 2426 retry:
2427 ata_link_for_each_dev(dev, &ap->link) {
2428 /* If we issue an SRST then an ATA drive (not ATAPI)
2429 * may change configuration and be in PIO0 timing. If
2430 * we do a hard reset (or are coming from power on)
2431 * this is true for ATA or ATAPI. Until we've set a
2432 * suitable controller mode we should not touch the
2433 * bus as we may be talking too fast.
2434 */
2435 dev->pio_mode = XFER_PIO_0;
2436
2437 /* If the controller has a pio mode setup function
2438 * then use it to set the chipset to rights. Don't
2439 * touch the DMA setup as that will be dealt with when
2440 * configuring devices.
2441 */
2442 if (ap->ops->set_piomode)
2443 ap->ops->set_piomode(ap, dev);
2444 }
2445
2222 /* reset and determine device classes */ 2446 /* reset and determine device classes */
2223 ap->ops->phy_reset(ap); 2447 ap->ops->phy_reset(ap);
2224 2448
@@ -2234,12 +2458,6 @@ int ata_bus_probe(struct ata_port *ap)
2234 2458
2235 ata_port_probe(ap); 2459 ata_port_probe(ap);
2236 2460
2237 /* after the reset the device state is PIO 0 and the controller
2238 state is undefined. Record the mode */
2239
2240 ata_link_for_each_dev(dev, &ap->link)
2241 dev->pio_mode = XFER_PIO_0;
2242
2243 /* read IDENTIFY page and configure devices. We have to do the identify 2461 /* read IDENTIFY page and configure devices. We have to do the identify
2244 specific sequence bass-ackwards so that PDIAG- is released by 2462 specific sequence bass-ackwards so that PDIAG- is released by
2245 the slave device */ 2463 the slave device */
@@ -2373,81 +2591,6 @@ void sata_print_link_status(struct ata_link *link)
2373} 2591}
2374 2592
2375/** 2593/**
2376 * __sata_phy_reset - Wake/reset a low-level SATA PHY
2377 * @ap: SATA port associated with target SATA PHY.
2378 *
2379 * This function issues commands to standard SATA Sxxx
2380 * PHY registers, to wake up the phy (and device), and
2381 * clear any reset condition.
2382 *
2383 * LOCKING:
2384 * PCI/etc. bus probe sem.
2385 *
2386 */
2387void __sata_phy_reset(struct ata_port *ap)
2388{
2389 struct ata_link *link = &ap->link;
2390 unsigned long timeout = jiffies + (HZ * 5);
2391 u32 sstatus;
2392
2393 if (ap->flags & ATA_FLAG_SATA_RESET) {
2394 /* issue phy wake/reset */
2395 sata_scr_write_flush(link, SCR_CONTROL, 0x301);
2396 /* Couldn't find anything in SATA I/II specs, but
2397 * AHCI-1.1 10.4.2 says at least 1 ms. */
2398 mdelay(1);
2399 }
2400 /* phy wake/clear reset */
2401 sata_scr_write_flush(link, SCR_CONTROL, 0x300);
2402
2403 /* wait for phy to become ready, if necessary */
2404 do {
2405 msleep(200);
2406 sata_scr_read(link, SCR_STATUS, &sstatus);
2407 if ((sstatus & 0xf) != 1)
2408 break;
2409 } while (time_before(jiffies, timeout));
2410
2411 /* print link status */
2412 sata_print_link_status(link);
2413
2414 /* TODO: phy layer with polling, timeouts, etc. */
2415 if (!ata_link_offline(link))
2416 ata_port_probe(ap);
2417 else
2418 ata_port_disable(ap);
2419
2420 if (ap->flags & ATA_FLAG_DISABLED)
2421 return;
2422
2423 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
2424 ata_port_disable(ap);
2425 return;
2426 }
2427
2428 ap->cbl = ATA_CBL_SATA;
2429}
2430
2431/**
2432 * sata_phy_reset - Reset SATA bus.
2433 * @ap: SATA port associated with target SATA PHY.
2434 *
2435 * This function resets the SATA bus, and then probes
2436 * the bus for devices.
2437 *
2438 * LOCKING:
2439 * PCI/etc. bus probe sem.
2440 *
2441 */
2442void sata_phy_reset(struct ata_port *ap)
2443{
2444 __sata_phy_reset(ap);
2445 if (ap->flags & ATA_FLAG_DISABLED)
2446 return;
2447 ata_bus_reset(ap);
2448}
2449
2450/**
2451 * ata_dev_pair - return other device on cable 2594 * ata_dev_pair - return other device on cable
2452 * @adev: device 2595 * @adev: device
2453 * 2596 *
@@ -2545,17 +2688,27 @@ int sata_down_spd_limit(struct ata_link *link)
2545 2688
2546static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol) 2689static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
2547{ 2690{
2548 u32 spd, limit; 2691 struct ata_link *host_link = &link->ap->link;
2692 u32 limit, target, spd;
2693
2694 limit = link->sata_spd_limit;
2695
2696 /* Don't configure downstream link faster than upstream link.
2697 * It doesn't speed up anything and some PMPs choke on such
2698 * configuration.
2699 */
2700 if (!ata_is_host_link(link) && host_link->sata_spd)
2701 limit &= (1 << host_link->sata_spd) - 1;
2549 2702
2550 if (link->sata_spd_limit == UINT_MAX) 2703 if (limit == UINT_MAX)
2551 limit = 0; 2704 target = 0;
2552 else 2705 else
2553 limit = fls(link->sata_spd_limit); 2706 target = fls(limit);
2554 2707
2555 spd = (*scontrol >> 4) & 0xf; 2708 spd = (*scontrol >> 4) & 0xf;
2556 *scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4); 2709 *scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4);
2557 2710
2558 return spd != limit; 2711 return spd != target;
2559} 2712}
2560 2713
2561/** 2714/**
@@ -2578,7 +2731,7 @@ int sata_set_spd_needed(struct ata_link *link)
2578 u32 scontrol; 2731 u32 scontrol;
2579 2732
2580 if (sata_scr_read(link, SCR_CONTROL, &scontrol)) 2733 if (sata_scr_read(link, SCR_CONTROL, &scontrol))
2581 return 0; 2734 return 1;
2582 2735
2583 return __sata_set_spd_needed(link, &scontrol); 2736 return __sata_set_spd_needed(link, &scontrol);
2584} 2737}
@@ -3118,6 +3271,61 @@ int ata_busy_sleep(struct ata_port *ap,
3118} 3271}
3119 3272
3120/** 3273/**
3274 * ata_wait_after_reset - wait before checking status after reset
3275 * @ap: port containing status register to be polled
3276 * @deadline: deadline jiffies for the operation
3277 *
3278 * After reset, we need to pause a while before reading status.
3279 * Also, certain combination of controller and device report 0xff
3280 * for some duration (e.g. until SATA PHY is up and running)
3281 * which is interpreted as empty port in ATA world. This
3282 * function also waits for such devices to get out of 0xff
3283 * status.
3284 *
3285 * LOCKING:
3286 * Kernel thread context (may sleep).
3287 */
3288void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline)
3289{
3290 unsigned long until = jiffies + ATA_TMOUT_FF_WAIT;
3291
3292 if (time_before(until, deadline))
3293 deadline = until;
3294
3295 /* Spec mandates ">= 2ms" before checking status. We wait
3296 * 150ms, because that was the magic delay used for ATAPI
3297 * devices in Hale Landis's ATADRVR, for the period of time
3298 * between when the ATA command register is written, and then
3299 * status is checked. Because waiting for "a while" before
3300 * checking status is fine, post SRST, we perform this magic
3301 * delay here as well.
3302 *
3303 * Old drivers/ide uses the 2mS rule and then waits for ready.
3304 */
3305 msleep(150);
3306
3307 /* Wait for 0xff to clear. Some SATA devices take a long time
3308 * to clear 0xff after reset. For example, HHD424020F7SV00
3309 * iVDR needs >= 800ms while. Quantum GoVault needs even more
3310 * than that.
3311 *
3312 * Note that some PATA controllers (pata_ali) explode if
3313 * status register is read more than once when there's no
3314 * device attached.
3315 */
3316 if (ap->flags & ATA_FLAG_SATA) {
3317 while (1) {
3318 u8 status = ata_chk_status(ap);
3319
3320 if (status != 0xff || time_after(jiffies, deadline))
3321 return;
3322
3323 msleep(50);
3324 }
3325 }
3326}
3327
3328/**
3121 * ata_wait_ready - sleep until BSY clears, or timeout 3329 * ata_wait_ready - sleep until BSY clears, or timeout
3122 * @ap: port containing status register to be polled 3330 * @ap: port containing status register to be polled
3123 * @deadline: deadline jiffies for the operation 3331 * @deadline: deadline jiffies for the operation
@@ -3223,8 +3431,6 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
3223 unsigned long deadline) 3431 unsigned long deadline)
3224{ 3432{
3225 struct ata_ioports *ioaddr = &ap->ioaddr; 3433 struct ata_ioports *ioaddr = &ap->ioaddr;
3226 struct ata_device *dev;
3227 int i = 0;
3228 3434
3229 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id); 3435 DPRINTK("ata%u: bus reset via SRST\n", ap->print_id);
3230 3436
@@ -3235,36 +3441,8 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
3235 udelay(20); /* FIXME: flush */ 3441 udelay(20); /* FIXME: flush */
3236 iowrite8(ap->ctl, ioaddr->ctl_addr); 3442 iowrite8(ap->ctl, ioaddr->ctl_addr);
3237 3443
3238 /* If we issued an SRST then an ATA drive (not ATAPI) 3444 /* wait a while before checking status */
3239 * may have changed configuration and be in PIO0 timing. If 3445 ata_wait_after_reset(ap, deadline);
3240 * we did a hard reset (or are coming from power on) this is
3241 * true for ATA or ATAPI. Until we've set a suitable controller
3242 * mode we should not touch the bus as we may be talking too fast.
3243 */
3244
3245 ata_link_for_each_dev(dev, &ap->link)
3246 dev->pio_mode = XFER_PIO_0;
3247
3248 /* If the controller has a pio mode setup function then use
3249 it to set the chipset to rights. Don't touch the DMA setup
3250 as that will be dealt with when revalidating */
3251 if (ap->ops->set_piomode) {
3252 ata_link_for_each_dev(dev, &ap->link)
3253 if (devmask & (1 << i++))
3254 ap->ops->set_piomode(ap, dev);
3255 }
3256
3257 /* spec mandates ">= 2ms" before checking status.
3258 * We wait 150ms, because that was the magic delay used for
3259 * ATAPI devices in Hale Landis's ATADRVR, for the period of time
3260 * between when the ATA command register is written, and then
3261 * status is checked. Because waiting for "a while" before
3262 * checking status is fine, post SRST, we perform this magic
3263 * delay here as well.
3264 *
3265 * Old drivers/ide uses the 2mS rule and then waits for ready
3266 */
3267 msleep(150);
3268 3446
3269 /* Before we perform post reset processing we want to see if 3447 /* Before we perform post reset processing we want to see if
3270 * the bus shows 0xFF because the odd clown forgets the D7 3448 * the bus shows 0xFF because the odd clown forgets the D7
@@ -3691,8 +3869,8 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class,
3691 return 0; 3869 return 0;
3692 } 3870 }
3693 3871
3694 /* wait a while before checking status, see SRST for more info */ 3872 /* wait a while before checking status */
3695 msleep(150); 3873 ata_wait_after_reset(ap, deadline);
3696 3874
3697 /* If PMP is supported, we have to do follow-up SRST. Note 3875 /* If PMP is supported, we have to do follow-up SRST. Note
3698 * that some PMPs don't send D2H Reg FIS after hardreset at 3876 * that some PMPs don't send D2H Reg FIS after hardreset at
@@ -3992,6 +4170,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3992 { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, }, 4170 { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, },
3993 { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, }, 4171 { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, },
3994 { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, 4172 { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, },
4173 { "Maxtor 7V300F0", "VA111900", ATA_HORKAGE_NONCQ, },
3995 4174
3996 /* devices which puke on READ_NATIVE_MAX */ 4175 /* devices which puke on READ_NATIVE_MAX */
3997 { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, 4176 { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, },
@@ -4003,6 +4182,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4003 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4182 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, },
4004 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4183 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, },
4005 4184
4185 /* Devices which get the IVB wrong */
4186 { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, },
4187 { "TSSTcorp CDDVDW SH-S202J", "SB00", ATA_HORKAGE_IVB, },
4188
4006 /* End Marker */ 4189 /* End Marker */
4007 { } 4190 { }
4008}; 4191};
@@ -4064,6 +4247,21 @@ static int ata_dma_blacklisted(const struct ata_device *dev)
4064} 4247}
4065 4248
4066/** 4249/**
4250 * ata_is_40wire - check drive side detection
4251 * @dev: device
4252 *
4253 * Perform drive side detection decoding, allowing for device vendors
4254 * who can't follow the documentation.
4255 */
4256
4257static int ata_is_40wire(struct ata_device *dev)
4258{
4259 if (dev->horkage & ATA_HORKAGE_IVB)
4260 return ata_drive_40wire_relaxed(dev->id);
4261 return ata_drive_40wire(dev->id);
4262}
4263
4264/**
4067 * ata_dev_xfermask - Compute supported xfermask of the given device 4265 * ata_dev_xfermask - Compute supported xfermask of the given device
4068 * @dev: Device to compute xfermask for 4266 * @dev: Device to compute xfermask for
4069 * 4267 *
@@ -4132,7 +4330,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
4132 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) 4330 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA))
4133 /* UDMA/44 or higher would be available */ 4331 /* UDMA/44 or higher would be available */
4134 if ((ap->cbl == ATA_CBL_PATA40) || 4332 if ((ap->cbl == ATA_CBL_PATA40) ||
4135 (ata_drive_40wire(dev->id) && 4333 (ata_is_40wire(dev) &&
4136 (ap->cbl == ATA_CBL_PATA_UNK || 4334 (ap->cbl == ATA_CBL_PATA_UNK ||
4137 ap->cbl == ATA_CBL_PATA80))) { 4335 ap->cbl == ATA_CBL_PATA80))) {
4138 ata_dev_printk(dev, KERN_WARNING, 4336 ata_dev_printk(dev, KERN_WARNING,
@@ -4689,6 +4887,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
4689 * data in this function or read data in ata_sg_clean. 4887 * data in this function or read data in ata_sg_clean.
4690 */ 4888 */
4691 offset = lsg->offset + lsg->length - qc->pad_len; 4889 offset = lsg->offset + lsg->length - qc->pad_len;
4890 sg_init_table(psg, 1);
4692 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT), 4891 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
4693 qc->pad_len, offset_in_page(offset)); 4892 qc->pad_len, offset_in_page(offset));
4694 4893
@@ -5226,11 +5425,19 @@ fsm_start:
5226 * let the EH abort the command or reset the device. 5425 * let the EH abort the command or reset the device.
5227 */ 5426 */
5228 if (unlikely(status & (ATA_ERR | ATA_DF))) { 5427 if (unlikely(status & (ATA_ERR | ATA_DF))) {
5229 ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device " 5428 /* Some ATAPI tape drives forget to clear the ERR bit
5230 "error, dev_stat 0x%X\n", status); 5429 * when doing the next command (mostly request sense).
5231 qc->err_mask |= AC_ERR_HSM; 5430 * We ignore ERR here to workaround and proceed sending
5232 ap->hsm_task_state = HSM_ST_ERR; 5431 * the CDB.
5233 goto fsm_start; 5432 */
5433 if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) {
5434 ata_port_printk(ap, KERN_WARNING,
5435 "DRQ=1 with device error, "
5436 "dev_stat 0x%X\n", status);
5437 qc->err_mask |= AC_ERR_HSM;
5438 ap->hsm_task_state = HSM_ST_ERR;
5439 goto fsm_start;
5440 }
5234 } 5441 }
5235 5442
5236 /* Send the CDB (atapi) or the first data block (ata pio out). 5443 /* Send the CDB (atapi) or the first data block (ata pio out).
@@ -5594,6 +5801,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5594 * taken care of. 5801 * taken care of.
5595 */ 5802 */
5596 if (ap->ops->error_handler) { 5803 if (ap->ops->error_handler) {
5804 struct ata_device *dev = qc->dev;
5805 struct ata_eh_info *ehi = &dev->link->eh_info;
5806
5597 WARN_ON(ap->pflags & ATA_PFLAG_FROZEN); 5807 WARN_ON(ap->pflags & ATA_PFLAG_FROZEN);
5598 5808
5599 if (unlikely(qc->err_mask)) 5809 if (unlikely(qc->err_mask))
@@ -5612,6 +5822,27 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5612 if (qc->flags & ATA_QCFLAG_RESULT_TF) 5822 if (qc->flags & ATA_QCFLAG_RESULT_TF)
5613 fill_result_tf(qc); 5823 fill_result_tf(qc);
5614 5824
5825 /* Some commands need post-processing after successful
5826 * completion.
5827 */
5828 switch (qc->tf.command) {
5829 case ATA_CMD_SET_FEATURES:
5830 if (qc->tf.feature != SETFEATURES_WC_ON &&
5831 qc->tf.feature != SETFEATURES_WC_OFF)
5832 break;
5833 /* fall through */
5834 case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
5835 case ATA_CMD_SET_MULTI: /* multi_count changed */
5836 /* revalidate device */
5837 ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE;
5838 ata_port_schedule_eh(ap);
5839 break;
5840
5841 case ATA_CMD_SLEEP:
5842 dev->flags |= ATA_DFLAG_SLEEPING;
5843 break;
5844 }
5845
5615 __ata_qc_complete(qc); 5846 __ata_qc_complete(qc);
5616 } else { 5847 } else {
5617 if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) 5848 if (qc->flags & ATA_QCFLAG_EH_SCHEDULED)
@@ -5749,6 +5980,14 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
5749 qc->flags &= ~ATA_QCFLAG_DMAMAP; 5980 qc->flags &= ~ATA_QCFLAG_DMAMAP;
5750 } 5981 }
5751 5982
5983 /* if device is sleeping, schedule softreset and abort the link */
5984 if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
5985 link->eh_info.action |= ATA_EH_SOFTRESET;
5986 ata_ehi_push_desc(&link->eh_info, "waking up from sleep");
5987 ata_link_abort(link);
5988 return;
5989 }
5990
5752 ap->ops->qc_prep(qc); 5991 ap->ops->qc_prep(qc);
5753 5992
5754 qc->err_mask |= ap->ops->qc_issue(qc); 5993 qc->err_mask |= ap->ops->qc_issue(qc);
@@ -6296,6 +6535,12 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg)
6296{ 6535{
6297 int rc; 6536 int rc;
6298 6537
6538 /*
6539 * disable link pm on all ports before requesting
6540 * any pm activity
6541 */
6542 ata_lpm_enable(host);
6543
6299 rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); 6544 rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1);
6300 if (rc == 0) 6545 if (rc == 0)
6301 host->dev->power.power_state = mesg; 6546 host->dev->power.power_state = mesg;
@@ -6318,6 +6563,9 @@ void ata_host_resume(struct ata_host *host)
6318 ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET, 6563 ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET,
6319 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); 6564 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0);
6320 host->dev->power.power_state = PMSG_ON; 6565 host->dev->power.power_state = PMSG_ON;
6566
6567 /* reenable link pm */
6568 ata_lpm_disable(host);
6321} 6569}
6322#endif 6570#endif
6323 6571
@@ -6522,19 +6770,6 @@ static void ata_host_release(struct device *gendev, void *res)
6522 if (!ap) 6770 if (!ap)
6523 continue; 6771 continue;
6524 6772
6525 if ((host->flags & ATA_HOST_STARTED) && ap->ops->port_stop)
6526 ap->ops->port_stop(ap);
6527 }
6528
6529 if ((host->flags & ATA_HOST_STARTED) && host->ops->host_stop)
6530 host->ops->host_stop(host);
6531
6532 for (i = 0; i < host->n_ports; i++) {
6533 struct ata_port *ap = host->ports[i];
6534
6535 if (!ap)
6536 continue;
6537
6538 if (ap->scsi_host) 6773 if (ap->scsi_host)
6539 scsi_host_put(ap->scsi_host); 6774 scsi_host_put(ap->scsi_host);
6540 6775
@@ -6661,6 +6896,24 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev,
6661 return host; 6896 return host;
6662} 6897}
6663 6898
6899static void ata_host_stop(struct device *gendev, void *res)
6900{
6901 struct ata_host *host = dev_get_drvdata(gendev);
6902 int i;
6903
6904 WARN_ON(!(host->flags & ATA_HOST_STARTED));
6905
6906 for (i = 0; i < host->n_ports; i++) {
6907 struct ata_port *ap = host->ports[i];
6908
6909 if (ap->ops->port_stop)
6910 ap->ops->port_stop(ap);
6911 }
6912
6913 if (host->ops->host_stop)
6914 host->ops->host_stop(host);
6915}
6916
6664/** 6917/**
6665 * ata_host_start - start and freeze ports of an ATA host 6918 * ata_host_start - start and freeze ports of an ATA host
6666 * @host: ATA host to start ports for 6919 * @host: ATA host to start ports for
@@ -6679,6 +6932,8 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev,
6679 */ 6932 */
6680int ata_host_start(struct ata_host *host) 6933int ata_host_start(struct ata_host *host)
6681{ 6934{
6935 int have_stop = 0;
6936 void *start_dr = NULL;
6682 int i, rc; 6937 int i, rc;
6683 6938
6684 if (host->flags & ATA_HOST_STARTED) 6939 if (host->flags & ATA_HOST_STARTED)
@@ -6690,6 +6945,22 @@ int ata_host_start(struct ata_host *host)
6690 if (!host->ops && !ata_port_is_dummy(ap)) 6945 if (!host->ops && !ata_port_is_dummy(ap))
6691 host->ops = ap->ops; 6946 host->ops = ap->ops;
6692 6947
6948 if (ap->ops->port_stop)
6949 have_stop = 1;
6950 }
6951
6952 if (host->ops->host_stop)
6953 have_stop = 1;
6954
6955 if (have_stop) {
6956 start_dr = devres_alloc(ata_host_stop, 0, GFP_KERNEL);
6957 if (!start_dr)
6958 return -ENOMEM;
6959 }
6960
6961 for (i = 0; i < host->n_ports; i++) {
6962 struct ata_port *ap = host->ports[i];
6963
6693 if (ap->ops->port_start) { 6964 if (ap->ops->port_start) {
6694 rc = ap->ops->port_start(ap); 6965 rc = ap->ops->port_start(ap);
6695 if (rc) { 6966 if (rc) {
@@ -6702,6 +6973,8 @@ int ata_host_start(struct ata_host *host)
6702 ata_eh_freeze_port(ap); 6973 ata_eh_freeze_port(ap);
6703 } 6974 }
6704 6975
6976 if (start_dr)
6977 devres_add(host->dev, start_dr);
6705 host->flags |= ATA_HOST_STARTED; 6978 host->flags |= ATA_HOST_STARTED;
6706 return 0; 6979 return 0;
6707 6980
@@ -6712,6 +6985,7 @@ int ata_host_start(struct ata_host *host)
6712 if (ap->ops->port_stop) 6985 if (ap->ops->port_stop)
6713 ap->ops->port_stop(ap); 6986 ap->ops->port_stop(ap);
6714 } 6987 }
6988 devres_free(start_dr);
6715 return rc; 6989 return rc;
6716} 6990}
6717 6991
@@ -6860,6 +7134,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6860 struct ata_port *ap = host->ports[i]; 7134 struct ata_port *ap = host->ports[i];
6861 7135
6862 ata_scsi_scan_host(ap, 1); 7136 ata_scsi_scan_host(ap, 1);
7137 ata_lpm_schedule(ap, ap->pm_policy);
6863 } 7138 }
6864 7139
6865 return 0; 7140 return 0;
@@ -6878,6 +7153,10 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6878 * request IRQ and register it. This helper takes necessasry 7153 * request IRQ and register it. This helper takes necessasry
6879 * arguments and performs the three steps in one go. 7154 * arguments and performs the three steps in one go.
6880 * 7155 *
7156 * An invalid IRQ skips the IRQ registration and expects the host to
7157 * have set polling mode on the port. In this case, @irq_handler
7158 * should be NULL.
7159 *
6881 * LOCKING: 7160 * LOCKING:
6882 * Inherited from calling layer (may sleep). 7161 * Inherited from calling layer (may sleep).
6883 * 7162 *
@@ -6894,6 +7173,12 @@ int ata_host_activate(struct ata_host *host, int irq,
6894 if (rc) 7173 if (rc)
6895 return rc; 7174 return rc;
6896 7175
7176 /* Special case for polling mode */
7177 if (!irq) {
7178 WARN_ON(irq_handler);
7179 return ata_host_register(host, sht);
7180 }
7181
6897 rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags, 7182 rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags,
6898 dev_driver_string(host->dev), host); 7183 dev_driver_string(host->dev), host);
6899 if (rc) 7184 if (rc)
@@ -7256,7 +7541,6 @@ const struct ata_port_info ata_dummy_port_info = {
7256 * likely to change as new drivers are added and updated. 7541 * likely to change as new drivers are added and updated.
7257 * Do not depend on ABI/API stability. 7542 * Do not depend on ABI/API stability.
7258 */ 7543 */
7259
7260EXPORT_SYMBOL_GPL(sata_deb_timing_normal); 7544EXPORT_SYMBOL_GPL(sata_deb_timing_normal);
7261EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug); 7545EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug);
7262EXPORT_SYMBOL_GPL(sata_deb_timing_long); 7546EXPORT_SYMBOL_GPL(sata_deb_timing_long);
@@ -7312,8 +7596,6 @@ EXPORT_SYMBOL_GPL(ata_dev_disable);
7312EXPORT_SYMBOL_GPL(sata_set_spd); 7596EXPORT_SYMBOL_GPL(sata_set_spd);
7313EXPORT_SYMBOL_GPL(sata_link_debounce); 7597EXPORT_SYMBOL_GPL(sata_link_debounce);
7314EXPORT_SYMBOL_GPL(sata_link_resume); 7598EXPORT_SYMBOL_GPL(sata_link_resume);
7315EXPORT_SYMBOL_GPL(sata_phy_reset);
7316EXPORT_SYMBOL_GPL(__sata_phy_reset);
7317EXPORT_SYMBOL_GPL(ata_bus_reset); 7599EXPORT_SYMBOL_GPL(ata_bus_reset);
7318EXPORT_SYMBOL_GPL(ata_std_prereset); 7600EXPORT_SYMBOL_GPL(ata_std_prereset);
7319EXPORT_SYMBOL_GPL(ata_std_softreset); 7601EXPORT_SYMBOL_GPL(ata_std_softreset);
@@ -7326,6 +7608,7 @@ EXPORT_SYMBOL_GPL(ata_port_disable);
7326EXPORT_SYMBOL_GPL(ata_ratelimit); 7608EXPORT_SYMBOL_GPL(ata_ratelimit);
7327EXPORT_SYMBOL_GPL(ata_wait_register); 7609EXPORT_SYMBOL_GPL(ata_wait_register);
7328EXPORT_SYMBOL_GPL(ata_busy_sleep); 7610EXPORT_SYMBOL_GPL(ata_busy_sleep);
7611EXPORT_SYMBOL_GPL(ata_wait_after_reset);
7329EXPORT_SYMBOL_GPL(ata_wait_ready); 7612EXPORT_SYMBOL_GPL(ata_wait_ready);
7330EXPORT_SYMBOL_GPL(ata_port_queue_task); 7613EXPORT_SYMBOL_GPL(ata_port_queue_task);
7331EXPORT_SYMBOL_GPL(ata_scsi_ioctl); 7614EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
@@ -7383,7 +7666,6 @@ EXPORT_SYMBOL_GPL(ata_port_desc);
7383#ifdef CONFIG_PCI 7666#ifdef CONFIG_PCI
7384EXPORT_SYMBOL_GPL(ata_port_pbar_desc); 7667EXPORT_SYMBOL_GPL(ata_port_pbar_desc);
7385#endif /* CONFIG_PCI */ 7668#endif /* CONFIG_PCI */
7386EXPORT_SYMBOL_GPL(ata_eng_timeout);
7387EXPORT_SYMBOL_GPL(ata_port_schedule_eh); 7669EXPORT_SYMBOL_GPL(ata_port_schedule_eh);
7388EXPORT_SYMBOL_GPL(ata_link_abort); 7670EXPORT_SYMBOL_GPL(ata_link_abort);
7389EXPORT_SYMBOL_GPL(ata_port_abort); 7671EXPORT_SYMBOL_GPL(ata_port_abort);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 8cb35bb87605..0dac69db1fdf 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -559,101 +559,6 @@ void ata_port_wait_eh(struct ata_port *ap)
559 } 559 }
560} 560}
561 561
562/**
563 * ata_qc_timeout - Handle timeout of queued command
564 * @qc: Command that timed out
565 *
566 * Some part of the kernel (currently, only the SCSI layer)
567 * has noticed that the active command on port @ap has not
568 * completed after a specified length of time. Handle this
569 * condition by disabling DMA (if necessary) and completing
570 * transactions, with error if necessary.
571 *
572 * This also handles the case of the "lost interrupt", where
573 * for some reason (possibly hardware bug, possibly driver bug)
574 * an interrupt was not delivered to the driver, even though the
575 * transaction completed successfully.
576 *
577 * TODO: kill this function once old EH is gone.
578 *
579 * LOCKING:
580 * Inherited from SCSI layer (none, can sleep)
581 */
582static void ata_qc_timeout(struct ata_queued_cmd *qc)
583{
584 struct ata_port *ap = qc->ap;
585 u8 host_stat = 0, drv_stat;
586 unsigned long flags;
587
588 DPRINTK("ENTER\n");
589
590 ap->hsm_task_state = HSM_ST_IDLE;
591
592 spin_lock_irqsave(ap->lock, flags);
593
594 switch (qc->tf.protocol) {
595
596 case ATA_PROT_DMA:
597 case ATA_PROT_ATAPI_DMA:
598 host_stat = ap->ops->bmdma_status(ap);
599
600 /* before we do anything else, clear DMA-Start bit */
601 ap->ops->bmdma_stop(qc);
602
603 /* fall through */
604
605 default:
606 ata_altstatus(ap);
607 drv_stat = ata_chk_status(ap);
608
609 /* ack bmdma irq events */
610 ap->ops->irq_clear(ap);
611
612 ata_dev_printk(qc->dev, KERN_ERR, "command 0x%x timeout, "
613 "stat 0x%x host_stat 0x%x\n",
614 qc->tf.command, drv_stat, host_stat);
615
616 /* complete taskfile transaction */
617 qc->err_mask |= AC_ERR_TIMEOUT;
618 break;
619 }
620
621 spin_unlock_irqrestore(ap->lock, flags);
622
623 ata_eh_qc_complete(qc);
624
625 DPRINTK("EXIT\n");
626}
627
628/**
629 * ata_eng_timeout - Handle timeout of queued command
630 * @ap: Port on which timed-out command is active
631 *
632 * Some part of the kernel (currently, only the SCSI layer)
633 * has noticed that the active command on port @ap has not
634 * completed after a specified length of time. Handle this
635 * condition by disabling DMA (if necessary) and completing
636 * transactions, with error if necessary.
637 *
638 * This also handles the case of the "lost interrupt", where
639 * for some reason (possibly hardware bug, possibly driver bug)
640 * an interrupt was not delivered to the driver, even though the
641 * transaction completed successfully.
642 *
643 * TODO: kill this function once old EH is gone.
644 *
645 * LOCKING:
646 * Inherited from SCSI layer (none, can sleep)
647 */
648void ata_eng_timeout(struct ata_port *ap)
649{
650 DPRINTK("ENTER\n");
651
652 ata_qc_timeout(ata_qc_from_tag(ap, ap->link.active_tag));
653
654 DPRINTK("EXIT\n");
655}
656
657static int ata_eh_nr_in_flight(struct ata_port *ap) 562static int ata_eh_nr_in_flight(struct ata_port *ap)
658{ 563{
659 unsigned int tag; 564 unsigned int tag;
@@ -1747,6 +1652,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1747{ 1652{
1748 struct ata_port *ap = link->ap; 1653 struct ata_port *ap = link->ap;
1749 struct ata_eh_context *ehc = &link->eh_context; 1654 struct ata_eh_context *ehc = &link->eh_context;
1655 struct ata_device *dev;
1750 unsigned int all_err_mask = 0; 1656 unsigned int all_err_mask = 0;
1751 int tag, is_io = 0; 1657 int tag, is_io = 0;
1752 u32 serror; 1658 u32 serror;
@@ -1800,10 +1706,8 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1800 qc->err_mask &= ~AC_ERR_OTHER; 1706 qc->err_mask &= ~AC_ERR_OTHER;
1801 1707
1802 /* SENSE_VALID trumps dev/unknown error and revalidation */ 1708 /* SENSE_VALID trumps dev/unknown error and revalidation */
1803 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { 1709 if (qc->flags & ATA_QCFLAG_SENSE_VALID)
1804 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); 1710 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);
1805 ehc->i.action &= ~ATA_EH_REVALIDATE;
1806 }
1807 1711
1808 /* accumulate error info */ 1712 /* accumulate error info */
1809 ehc->i.dev = qc->dev; 1713 ehc->i.dev = qc->dev;
@@ -1816,21 +1720,28 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1816 if (ap->pflags & ATA_PFLAG_FROZEN || 1720 if (ap->pflags & ATA_PFLAG_FROZEN ||
1817 all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) 1721 all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT))
1818 ehc->i.action |= ATA_EH_SOFTRESET; 1722 ehc->i.action |= ATA_EH_SOFTRESET;
1819 else if (all_err_mask) 1723 else if ((is_io && all_err_mask) ||
1724 (!is_io && (all_err_mask & ~AC_ERR_DEV)))
1820 ehc->i.action |= ATA_EH_REVALIDATE; 1725 ehc->i.action |= ATA_EH_REVALIDATE;
1821 1726
1822 /* if we have offending qcs and the associated failed device */ 1727 /* If we have offending qcs and the associated failed device,
1728 * perform per-dev EH action only on the offending device.
1729 */
1823 if (ehc->i.dev) { 1730 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] |= 1731 ehc->i.dev_action[ehc->i.dev->devno] |=
1830 ehc->i.action & ATA_EH_PERDEV_MASK; 1732 ehc->i.action & ATA_EH_PERDEV_MASK;
1831 ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1733 ehc->i.action &= ~ATA_EH_PERDEV_MASK;
1832 } 1734 }
1833 1735
1736 /* consider speeding down */
1737 dev = ehc->i.dev;
1738 if (!dev && ata_link_max_devices(link) == 1 &&
1739 ata_dev_enabled(link->device))
1740 dev = link->device;
1741
1742 if (dev)
1743 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask);
1744
1834 DPRINTK("EXIT\n"); 1745 DPRINTK("EXIT\n");
1835} 1746}
1836 1747
@@ -1879,7 +1790,9 @@ static void ata_eh_link_report(struct ata_link *link)
1879 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { 1790 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
1880 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); 1791 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
1881 1792
1882 if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) 1793 if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link ||
1794 ((qc->flags & ATA_QCFLAG_QUIET) &&
1795 qc->err_mask == AC_ERR_DEV))
1883 continue; 1796 continue;
1884 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) 1797 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask)
1885 continue; 1798 continue;
@@ -2064,16 +1977,19 @@ int ata_eh_reset(struct ata_link *link, int classify,
2064 ata_prereset_fn_t prereset, ata_reset_fn_t softreset, 1977 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
2065 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 1978 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
2066{ 1979{
1980 const int max_tries = ARRAY_SIZE(ata_eh_reset_timeouts);
2067 struct ata_port *ap = link->ap; 1981 struct ata_port *ap = link->ap;
2068 struct ata_eh_context *ehc = &link->eh_context; 1982 struct ata_eh_context *ehc = &link->eh_context;
2069 unsigned int *classes = ehc->classes; 1983 unsigned int *classes = ehc->classes;
1984 unsigned int lflags = link->flags;
2070 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 1985 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
2071 int try = 0; 1986 int try = 0;
2072 struct ata_device *dev; 1987 struct ata_device *dev;
2073 unsigned long deadline; 1988 unsigned long deadline, now;
2074 unsigned int tmp_action; 1989 unsigned int tmp_action;
2075 ata_reset_fn_t reset; 1990 ata_reset_fn_t reset;
2076 unsigned long flags; 1991 unsigned long flags;
1992 u32 sstatus;
2077 int rc; 1993 int rc;
2078 1994
2079 /* about to reset */ 1995 /* about to reset */
@@ -2083,10 +1999,29 @@ int ata_eh_reset(struct ata_link *link, int classify,
2083 1999
2084 ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); 2000 ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2085 2001
2002 ata_link_for_each_dev(dev, link) {
2003 /* If we issue an SRST then an ATA drive (not ATAPI)
2004 * may change configuration and be in PIO0 timing. If
2005 * we do a hard reset (or are coming from power on)
2006 * this is true for ATA or ATAPI. Until we've set a
2007 * suitable controller mode we should not touch the
2008 * bus as we may be talking too fast.
2009 */
2010 dev->pio_mode = XFER_PIO_0;
2011
2012 /* If the controller has a pio mode setup function
2013 * then use it to set the chipset to rights. Don't
2014 * touch the DMA setup as that will be dealt with when
2015 * configuring devices.
2016 */
2017 if (ap->ops->set_piomode)
2018 ap->ops->set_piomode(ap, dev);
2019 }
2020
2086 /* Determine which reset to use and record in ehc->i.action. 2021 /* Determine which reset to use and record in ehc->i.action.
2087 * prereset() may examine and modify it. 2022 * prereset() may examine and modify it.
2088 */ 2023 */
2089 if (softreset && (!hardreset || (!(link->flags & ATA_LFLAG_NO_SRST) && 2024 if (softreset && (!hardreset || (!(lflags & ATA_LFLAG_NO_SRST) &&
2090 !sata_set_spd_needed(link) && 2025 !sata_set_spd_needed(link) &&
2091 !(ehc->i.action & ATA_EH_HARDRESET)))) 2026 !(ehc->i.action & ATA_EH_HARDRESET))))
2092 tmp_action = ATA_EH_SOFTRESET; 2027 tmp_action = ATA_EH_SOFTRESET;
@@ -2161,80 +2096,64 @@ int ata_eh_reset(struct ata_link *link, int classify,
2161 "follow-up softreset required " 2096 "follow-up softreset required "
2162 "but no softreset avaliable\n"); 2097 "but no softreset avaliable\n");
2163 rc = -EINVAL; 2098 rc = -EINVAL;
2164 goto out; 2099 goto fail;
2165 } 2100 }
2166 2101
2167 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK); 2102 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK);
2168 rc = ata_do_reset(link, reset, classes, deadline); 2103 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 } 2104 }
2178 2105
2179 /* if we skipped follow-up srst, clear rc */ 2106 /* -EAGAIN can happen if we skipped followup SRST */
2180 if (rc == -EAGAIN) 2107 if (rc && rc != -EAGAIN)
2181 rc = 0; 2108 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 2109
2189 ata_link_printk(link, KERN_WARNING, "reset failed " 2110 /* was classification successful? */
2190 "(errno=%d), retrying in %u secs\n", 2111 if (classify && classes[0] == ATA_DEV_UNKNOWN &&
2191 rc, (jiffies_to_msecs(delta) + 999) / 1000); 2112 !(lflags & ATA_LFLAG_ASSUME_CLASS)) {
2192 2113 if (try < max_tries) {
2193 while (delta) 2114 ata_link_printk(link, KERN_WARNING,
2194 delta = schedule_timeout_uninterruptible(delta); 2115 "classification failed\n");
2116 rc = -EINVAL;
2117 goto fail;
2195 } 2118 }
2196 2119
2197 if (rc == -EPIPE || 2120 ata_link_printk(link, KERN_WARNING,
2198 try == ARRAY_SIZE(ata_eh_reset_timeouts) - 1) 2121 "classfication failed, assuming ATA\n");
2199 sata_down_spd_limit(link); 2122 lflags |= ATA_LFLAG_ASSUME_ATA;
2200 if (hardreset)
2201 reset = hardreset;
2202 goto retry;
2203 } 2123 }
2204 2124
2205 if (rc == 0) { 2125 ata_link_for_each_dev(dev, link) {
2206 u32 sstatus; 2126 /* After the reset, the device state is PIO 0 and the
2127 * controller state is undefined. Reset also wakes up
2128 * drives from sleeping mode.
2129 */
2130 dev->pio_mode = XFER_PIO_0;
2131 dev->flags &= ~ATA_DFLAG_SLEEPING;
2207 2132
2208 ata_link_for_each_dev(dev, link) { 2133 if (ata_link_offline(link))
2209 /* After the reset, the device state is PIO 0 2134 continue;
2210 * and the controller state is undefined.
2211 * Record the mode.
2212 */
2213 dev->pio_mode = XFER_PIO_0;
2214 2135
2215 if (ata_link_offline(link)) 2136 /* apply class override and convert UNKNOWN to NONE */
2216 continue; 2137 if (lflags & ATA_LFLAG_ASSUME_ATA)
2138 classes[dev->devno] = ATA_DEV_ATA;
2139 else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2140 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2141 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2142 classes[dev->devno] = ATA_DEV_NONE;
2143 }
2217 2144
2218 /* apply class override and convert UNKNOWN to NONE */ 2145 /* record current link speed */
2219 if (link->flags & ATA_LFLAG_ASSUME_ATA) 2146 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
2220 classes[dev->devno] = ATA_DEV_ATA; 2147 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 2148
2227 /* record current link speed */ 2149 if (postreset)
2228 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) 2150 postreset(link, classes);
2229 link->sata_spd = (sstatus >> 4) & 0xf;
2230 2151
2231 if (postreset) 2152 /* reset successful, schedule revalidation */
2232 postreset(link, classes); 2153 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2154 ehc->i.action |= ATA_EH_REVALIDATE;
2233 2155
2234 /* reset successful, schedule revalidation */ 2156 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: 2157 out:
2239 /* clear hotplug flag */ 2158 /* clear hotplug flag */
2240 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; 2159 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
@@ -2244,6 +2163,28 @@ int ata_eh_reset(struct ata_link *link, int classify,
2244 spin_unlock_irqrestore(ap->lock, flags); 2163 spin_unlock_irqrestore(ap->lock, flags);
2245 2164
2246 return rc; 2165 return rc;
2166
2167 fail:
2168 if (rc == -ERESTART || try >= max_tries)
2169 goto out;
2170
2171 now = jiffies;
2172 if (time_before(now, deadline)) {
2173 unsigned long delta = deadline - now;
2174
2175 ata_link_printk(link, KERN_WARNING, "reset failed "
2176 "(errno=%d), retrying in %u secs\n",
2177 rc, (jiffies_to_msecs(delta) + 999) / 1000);
2178
2179 while (delta)
2180 delta = schedule_timeout_uninterruptible(delta);
2181 }
2182
2183 if (rc == -EPIPE || try == max_tries - 1)
2184 sata_down_spd_limit(link);
2185 if (hardreset)
2186 reset = hardreset;
2187 goto retry;
2247} 2188}
2248 2189
2249static int ata_eh_revalidate_and_attach(struct ata_link *link, 2190static int ata_eh_revalidate_and_attach(struct ata_link *link,
@@ -2416,7 +2357,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2416 /* give it just one more chance */ 2357 /* give it just one more chance */
2417 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); 2358 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
2418 case -EIO: 2359 case -EIO:
2419 if (ehc->tries[dev->devno] == 1) { 2360 if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) {
2420 /* This is the last chance, better to slow 2361 /* This is the last chance, better to slow
2421 * down than lose it. 2362 * down than lose it.
2422 */ 2363 */
@@ -2607,6 +2548,10 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2607 ehc->i.flags &= ~ATA_EHI_SETMODE; 2548 ehc->i.flags &= ~ATA_EHI_SETMODE;
2608 } 2549 }
2609 2550
2551 if (ehc->i.action & ATA_EHI_LPM)
2552 ata_link_for_each_dev(dev, link)
2553 ata_dev_enable_pm(dev, ap->pm_policy);
2554
2610 /* this link is okay now */ 2555 /* this link is okay now */
2611 ehc->i.flags = 0; 2556 ehc->i.flags = 0;
2612 continue; 2557 continue;
@@ -2672,8 +2617,15 @@ void ata_eh_finish(struct ata_port *ap)
2672 /* FIXME: Once EH migration is complete, 2617 /* FIXME: Once EH migration is complete,
2673 * generate sense data in this function, 2618 * generate sense data in this function,
2674 * considering both err_mask and tf. 2619 * considering both err_mask and tf.
2620 *
2621 * There's no point in retrying invalid
2622 * (detected by libata) and non-IO device
2623 * errors (rejected by device). Finish them
2624 * immediately.
2675 */ 2625 */
2676 if (qc->err_mask & AC_ERR_INVALID) 2626 if ((qc->err_mask & AC_ERR_INVALID) ||
2627 (!(qc->flags & ATA_QCFLAG_IO) &&
2628 qc->err_mask == AC_ERR_DEV))
2677 ata_eh_qc_complete(qc); 2629 ata_eh_qc_complete(qc);
2678 else 2630 else
2679 ata_eh_qc_retry(qc); 2631 ata_eh_qc_retry(qc);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f5d5420a1ba2..a883bb03d4c7 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{
@@ -773,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
773 blk_queue_max_hw_segments(q, q->max_hw_segments - 1); 841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
774 } 842 }
775 843
844 if (dev->flags & ATA_DFLAG_AN)
845 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
846
776 if (dev->flags & ATA_DFLAG_NCQ) { 847 if (dev->flags & ATA_DFLAG_NCQ) {
777 int depth; 848 int depth;
778 849
@@ -1040,6 +1111,9 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
1040 else 1111 else
1041 tf->command = ATA_CMD_FLUSH; 1112 tf->command = ATA_CMD_FLUSH;
1042 1113
1114 /* flush is critical for IO integrity, consider it an IO command */
1115 qc->flags |= ATA_QCFLAG_IO;
1116
1043 return 0; 1117 return 0;
1044} 1118}
1045 1119
@@ -1361,33 +1435,10 @@ nothing_to_do:
1361static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) 1435static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1362{ 1436{
1363 struct ata_port *ap = qc->ap; 1437 struct ata_port *ap = qc->ap;
1364 struct ata_eh_info *ehi = &qc->dev->link->eh_info;
1365 struct scsi_cmnd *cmd = qc->scsicmd; 1438 struct scsi_cmnd *cmd = qc->scsicmd;
1366 u8 *cdb = cmd->cmnd; 1439 u8 *cdb = cmd->cmnd;
1367 int need_sense = (qc->err_mask != 0); 1440 int need_sense = (qc->err_mask != 0);
1368 1441
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 1442 /* 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 1443 * user mandated it or if there's an error. Note that if we
1393 * generate because the user forced us to, a check condition 1444 * generate because the user forced us to, a check condition
@@ -2434,11 +2485,40 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2434 if (!using_pio && ata_check_atapi_dma(qc)) 2485 if (!using_pio && ata_check_atapi_dma(qc))
2435 using_pio = 1; 2486 using_pio = 1;
2436 2487
2437 /* Some controller variants snoop this value for Packet transfers 2488 /* Some controller variants snoop this value for Packet
2438 to do state machine and FIFO management. Thus we want to set it 2489 * transfers to do state machine and FIFO management. Thus we
2439 properly, and for DMA where it is effectively meaningless */ 2490 * want to set it properly, and for DMA where it is
2491 * effectively meaningless.
2492 */
2440 nbytes = min(qc->nbytes, (unsigned int)63 * 1024); 2493 nbytes = min(qc->nbytes, (unsigned int)63 * 1024);
2441 2494
2495 /* Most ATAPI devices which honor transfer chunk size don't
2496 * behave according to the spec when odd chunk size which
2497 * matches the transfer length is specified. If the number of
2498 * bytes to transfer is 2n+1. According to the spec, what
2499 * should happen is to indicate that 2n+1 is going to be
2500 * transferred and transfer 2n+2 bytes where the last byte is
2501 * padding.
2502 *
2503 * In practice, this doesn't happen. ATAPI devices first
2504 * indicate and transfer 2n bytes and then indicate and
2505 * transfer 2 bytes where the last byte is padding.
2506 *
2507 * This inconsistency confuses several controllers which
2508 * perform PIO using DMA such as Intel AHCIs and sil3124/32.
2509 * These controllers use actual number of transferred bytes to
2510 * update DMA poitner and transfer of 4n+2 bytes make those
2511 * controller push DMA pointer by 4n+4 bytes because SATA data
2512 * FISes are aligned to 4 bytes. This causes data corruption
2513 * and buffer overrun.
2514 *
2515 * Always setting nbytes to even number solves this problem
2516 * because then ATAPI devices don't have to split data at 2n
2517 * boundaries.
2518 */
2519 if (nbytes & 0x1)
2520 nbytes++;
2521
2442 qc->tf.lbam = (nbytes & 0xFF); 2522 qc->tf.lbam = (nbytes & 0xFF);
2443 qc->tf.lbah = (nbytes >> 8); 2523 qc->tf.lbah = (nbytes >> 8);
2444 2524
@@ -2719,8 +2799,8 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2719 */ 2799 */
2720 qc->nbytes = scsi_bufflen(scmd); 2800 qc->nbytes = scsi_bufflen(scmd);
2721 2801
2722 /* request result TF */ 2802 /* request result TF and be quiet about device error */
2723 qc->flags |= ATA_QCFLAG_RESULT_TF; 2803 qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET;
2724 2804
2725 return 0; 2805 return 0;
2726 2806
@@ -2818,7 +2898,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
2818 xlat_func = NULL; 2898 xlat_func = NULL;
2819 if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { 2899 if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
2820 /* relay SCSI command to ATAPI device */ 2900 /* relay SCSI command to ATAPI device */
2821 if (unlikely(scmd->cmd_len > dev->cdb_len)) 2901 int len = COMMAND_SIZE(scsi_op);
2902 if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
2822 goto bad_cdb_len; 2903 goto bad_cdb_len;
2823 2904
2824 xlat_func = atapi_xlat; 2905 xlat_func = atapi_xlat;
@@ -3248,10 +3329,9 @@ static void ata_scsi_handle_link_detach(struct ata_link *link)
3248 */ 3329 */
3249void ata_scsi_media_change_notify(struct ata_device *dev) 3330void ata_scsi_media_change_notify(struct ata_device *dev)
3250{ 3331{
3251#ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED
3252 if (dev->sdev) 3332 if (dev->sdev)
3253 scsi_device_event_notify(dev->sdev, SDEV_MEDIA_CHANGE); 3333 sdev_evt_send_simple(dev->sdev, SDEV_EVT_MEDIA_CHANGE,
3254#endif 3334 GFP_ATOMIC);
3255} 3335}
3256 3336
3257/** 3337/**
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_ali.c b/drivers/ata/pata_ali.c
index 364534e7aff4..8caf9afc8b90 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -63,6 +63,9 @@ static int ali_cable_override(struct pci_dev *pdev)
63 /* Fujitsu P2000 */ 63 /* Fujitsu P2000 */
64 if (pdev->subsystem_vendor == 0x10CF && pdev->subsystem_device == 0x10AF) 64 if (pdev->subsystem_vendor == 0x10CF && pdev->subsystem_device == 0x10AF)
65 return 1; 65 return 1;
66 /* Mitac 8317 (Winbook-A) and relatives */
67 if (pdev->subsystem_vendor == 0x1071 && pdev->subsystem_device == 0x8317)
68 return 1;
66 /* Systems by DMI */ 69 /* Systems by DMI */
67 if (dmi_check_system(cable_dmi_table)) 70 if (dmi_check_system(cable_dmi_table))
68 return 1; 71 return 1;
@@ -282,6 +285,21 @@ static void ali_lock_sectors(struct ata_device *adev)
282 adev->max_sectors = 255; 285 adev->max_sectors = 255;
283} 286}
284 287
288/**
289 * ali_check_atapi_dma - DMA check for most ALi controllers
290 * @adev: Device
291 *
292 * Called to decide whether commands should be sent by DMA or PIO
293 */
294
295static int ali_check_atapi_dma(struct ata_queued_cmd *qc)
296{
297 /* If its not a media command, its not worth it */
298 if (qc->nbytes < 2048)
299 return -EOPNOTSUPP;
300 return 0;
301}
302
285static struct scsi_host_template ali_sht = { 303static struct scsi_host_template ali_sht = {
286 .module = THIS_MODULE, 304 .module = THIS_MODULE,
287 .name = DRV_NAME, 305 .name = DRV_NAME,
@@ -378,6 +396,7 @@ static struct ata_port_operations ali_c2_port_ops = {
378 .mode_filter = ata_pci_default_filter, 396 .mode_filter = ata_pci_default_filter,
379 .tf_load = ata_tf_load, 397 .tf_load = ata_tf_load,
380 .tf_read = ata_tf_read, 398 .tf_read = ata_tf_read,
399 .check_atapi_dma = ali_check_atapi_dma,
381 .check_status = ata_check_status, 400 .check_status = ata_check_status,
382 .exec_command = ata_exec_command, 401 .exec_command = ata_exec_command,
383 .dev_select = ata_std_dev_select, 402 .dev_select = ata_std_dev_select,
@@ -415,6 +434,7 @@ static struct ata_port_operations ali_c5_port_ops = {
415 .mode_filter = ata_pci_default_filter, 434 .mode_filter = ata_pci_default_filter,
416 .tf_load = ata_tf_load, 435 .tf_load = ata_tf_load,
417 .tf_read = ata_tf_read, 436 .tf_read = ata_tf_read,
437 .check_atapi_dma = ali_check_atapi_dma,
418 .check_status = ata_check_status, 438 .check_status = ata_check_status,
419 .exec_command = ata_exec_command, 439 .exec_command = ata_exec_command,
420 .dev_select = ata_std_dev_select, 440 .dev_select = ata_std_dev_select,
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index b5e38426b815..81db405a5445 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1145,13 +1145,13 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap)
1145 unsigned short int_status = ATAPI_GET_INT_STATUS(base); 1145 unsigned short int_status = ATAPI_GET_INT_STATUS(base);
1146 1146
1147 if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) { 1147 if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) {
1148 host_stat = ATA_DMA_ACTIVE; 1148 host_stat |= ATA_DMA_ACTIVE;
1149 } 1149 }
1150 if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT)) { 1150 if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT)) {
1151 host_stat = ATA_DMA_INTR; 1151 host_stat |= ATA_DMA_INTR;
1152 } 1152 }
1153 if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) { 1153 if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) {
1154 host_stat = ATA_DMA_ERR; 1154 host_stat |= ATA_DMA_ERR;
1155 } 1155 }
1156 1156
1157 return host_stat; 1157 return host_stat;
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index e61cb1fd57b2..46dc70e0dee7 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -295,7 +295,7 @@ static unsigned long hpt370_filter(struct ata_device *adev, unsigned long mask)
295 295
296static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask) 296static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask)
297{ 297{
298 if (adev->class != ATA_DEV_ATA) { 298 if (adev->class == ATA_DEV_ATA) {
299 if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5)) 299 if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
300 mask &= ~ (0x1F << ATA_SHIFT_UDMA); 300 mask &= ~ (0x1F << ATA_SHIFT_UDMA);
301 } 301 }
@@ -329,7 +329,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline)
329 /* Restore state */ 329 /* Restore state */
330 pci_write_config_byte(pdev, 0x5B, scr2); 330 pci_write_config_byte(pdev, 0x5B, scr2);
331 331
332 if (ata66 & (1 << ap->port_no)) 332 if (ata66 & (2 >> ap->port_no))
333 ap->cbl = ATA_CBL_PATA40; 333 ap->cbl = ATA_CBL_PATA40;
334 else 334 else
335 ap->cbl = ATA_CBL_PATA80; 335 ap->cbl = ATA_CBL_PATA80;
@@ -359,28 +359,25 @@ static int hpt374_pre_reset(struct ata_link *link, unsigned long deadline)
359 { 0x50, 1, 0x04, 0x04 }, 359 { 0x50, 1, 0x04, 0x04 },
360 { 0x54, 1, 0x04, 0x04 } 360 { 0x54, 1, 0x04, 0x04 }
361 }; 361 };
362 u16 mcr3, mcr6; 362 u16 mcr3;
363 u8 ata66; 363 u8 ata66;
364 struct ata_port *ap = link->ap; 364 struct ata_port *ap = link->ap;
365 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 365 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
366 unsigned int mcrbase = 0x50 + 4 * ap->port_no;
366 367
367 if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no])) 368 if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no]))
368 return -ENOENT; 369 return -ENOENT;
369 370
370 /* Do the extra channel work */ 371 /* Do the extra channel work */
371 pci_read_config_word(pdev, 0x52, &mcr3); 372 pci_read_config_word(pdev, mcrbase + 2, &mcr3);
372 pci_read_config_word(pdev, 0x56, &mcr6);
373 /* Set bit 15 of 0x52 to enable TCBLID as input 373 /* Set bit 15 of 0x52 to enable TCBLID as input
374 Set bit 15 of 0x56 to enable FCBLID as input
375 */ 374 */
376 pci_write_config_word(pdev, 0x52, mcr3 | 0x8000); 375 pci_write_config_word(pdev, mcrbase + 2, mcr3 | 0x8000);
377 pci_write_config_word(pdev, 0x56, mcr6 | 0x8000);
378 pci_read_config_byte(pdev, 0x5A, &ata66); 376 pci_read_config_byte(pdev, 0x5A, &ata66);
379 /* Reset TCBLID/FCBLID to output */ 377 /* Reset TCBLID/FCBLID to output */
380 pci_write_config_word(pdev, 0x52, mcr3); 378 pci_write_config_word(pdev, 0x52, mcr3);
381 pci_write_config_word(pdev, 0x56, mcr6);
382 379
383 if (ata66 & (1 << ap->port_no)) 380 if (ata66 & (2 >> ap->port_no))
384 ap->cbl = ATA_CBL_PATA40; 381 ap->cbl = ATA_CBL_PATA40;
385 else 382 else
386 ap->cbl = ATA_CBL_PATA80; 383 ap->cbl = ATA_CBL_PATA80;
@@ -844,6 +841,25 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev)
844 /* Never went stable */ 841 /* Never went stable */
845 return 0; 842 return 0;
846} 843}
844
845static u32 hpt374_read_freq(struct pci_dev *pdev)
846{
847 u32 freq;
848 unsigned long io_base = pci_resource_start(pdev, 4);
849 if (PCI_FUNC(pdev->devfn) & 1) {
850 struct pci_dev *pdev_0 = pci_get_slot(pdev->bus, pdev->devfn - 1);
851 /* Someone hot plugged the controller on us ? */
852 if (pdev_0 == NULL)
853 return 0;
854 io_base = pci_resource_start(pdev_0, 4);
855 freq = inl(io_base + 0x90);
856 pci_dev_put(pdev_0);
857 }
858 else
859 freq = inl(io_base + 0x90);
860 return freq;
861}
862
847/** 863/**
848 * hpt37x_init_one - Initialise an HPT37X/302 864 * hpt37x_init_one - Initialise an HPT37X/302
849 * @dev: PCI device 865 * @dev: PCI device
@@ -902,7 +918,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
902 .flags = ATA_FLAG_SLAVE_POSS, 918 .flags = ATA_FLAG_SLAVE_POSS,
903 .pio_mask = 0x1f, 919 .pio_mask = 0x1f,
904 .mwdma_mask = 0x07, 920 .mwdma_mask = 0x07,
905 .udma_mask = 0x0f, 921 .udma_mask = ATA_UDMA5,
906 .port_ops = &hpt370_port_ops 922 .port_ops = &hpt370_port_ops
907 }; 923 };
908 /* HPT370A - UDMA100 */ 924 /* HPT370A - UDMA100 */
@@ -911,7 +927,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
911 .flags = ATA_FLAG_SLAVE_POSS, 927 .flags = ATA_FLAG_SLAVE_POSS,
912 .pio_mask = 0x1f, 928 .pio_mask = 0x1f,
913 .mwdma_mask = 0x07, 929 .mwdma_mask = 0x07,
914 .udma_mask = 0x0f, 930 .udma_mask = ATA_UDMA5,
915 .port_ops = &hpt370a_port_ops 931 .port_ops = &hpt370a_port_ops
916 }; 932 };
917 /* HPT371, 372 and friends - UDMA133 */ 933 /* HPT371, 372 and friends - UDMA133 */
@@ -1047,9 +1063,16 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1047 outb(0x0e, iobase + 0x9c); 1063 outb(0x0e, iobase + 0x9c);
1048 1064
1049 /* Some devices do not let this value be accessed via PCI space 1065 /* Some devices do not let this value be accessed via PCI space
1050 according to the old driver */ 1066 according to the old driver. In addition we must use the value
1067 from FN 0 on the HPT374 */
1068
1069 if (chip_table == &hpt374) {
1070 freq = hpt374_read_freq(dev);
1071 if (freq == 0)
1072 return -ENODEV;
1073 } else
1074 freq = inl(iobase + 0x90);
1051 1075
1052 freq = inl(iobase + 0x90);
1053 if ((freq >> 12) != 0xABCDE) { 1076 if ((freq >> 12) != 0xABCDE) {
1054 int i; 1077 int i;
1055 u8 sr; 1078 u8 sr;
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 88ab0e1d353f..4320e7986321 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -75,13 +75,16 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
75 struct ata_host *host; 75 struct ata_host *host;
76 struct ata_port *ap; 76 struct ata_port *ap;
77 void __iomem *cmd_addr, *ctl_addr; 77 void __iomem *cmd_addr, *ctl_addr;
78 int irq = 0;
79 irq_handler_t handler = NULL;
78 80
79 if (pnp_port_valid(idev, 0) == 0) 81 if (pnp_port_valid(idev, 0) == 0)
80 return -ENODEV; 82 return -ENODEV;
81 83
82 /* FIXME: Should selected polled PIO here not fail */ 84 if (pnp_irq_valid(idev, 0)) {
83 if (pnp_irq_valid(idev, 0) == 0) 85 irq = pnp_irq(idev, 0);
84 return -ENODEV; 86 handler = ata_interrupt;
87 }
85 88
86 /* allocate host */ 89 /* allocate host */
87 host = ata_host_alloc(&idev->dev, 1); 90 host = ata_host_alloc(&idev->dev, 1);
@@ -115,7 +118,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
115 (unsigned long long)pnp_port_start(idev, 1)); 118 (unsigned long long)pnp_port_start(idev, 1));
116 119
117 /* activate */ 120 /* activate */
118 return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0, 121 return ata_host_activate(host, irq, handler, 0,
119 &isapnp_sht); 122 &isapnp_sht);
120} 123}
121 124
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 225a7223a726..5b8174d94067 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -80,11 +80,10 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
80 * actually do our cable checking etc. Thankfully we don't need 80 * actually do our cable checking etc. Thankfully we don't need
81 * to do the plumbing for other cases. 81 * to do the plumbing for other cases.
82 */ 82 */
83 switch (port_map[port]) 83 switch (port_map[port]) {
84 {
85 case PORT_PATA0: 84 case PORT_PATA0:
86 if (control & (1 << 5)) 85 if ((control & (1 << 5)) == 0)
87 return 0; 86 return -ENOENT;
88 if (control & (1 << 3)) /* 40/80 pin primary */ 87 if (control & (1 << 3)) /* 40/80 pin primary */
89 ap->cbl = ATA_CBL_PATA40; 88 ap->cbl = ATA_CBL_PATA40;
90 else 89 else
@@ -93,7 +92,7 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
93 case PORT_PATA1: 92 case PORT_PATA1:
94 /* Bit 21 is set if the port is enabled */ 93 /* Bit 21 is set if the port is enabled */
95 if ((control5 & (1 << 21)) == 0) 94 if ((control5 & (1 << 21)) == 0)
96 return 0; 95 return -ENOENT;
97 if (control5 & (1 << 19)) /* 40/80 pin secondary */ 96 if (control5 & (1 << 19)) /* 40/80 pin secondary */
98 ap->cbl = ATA_CBL_PATA40; 97 ap->cbl = ATA_CBL_PATA40;
99 else 98 else
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_platform.c b/drivers/ata/pata_platform.c
index fc72a965643d..ac03a90a6168 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Generic platform device PATA driver 2 * Generic platform device PATA driver
3 * 3 *
4 * Copyright (C) 2006 Paul Mundt 4 * Copyright (C) 2006 - 2007 Paul Mundt
5 * 5 *
6 * Based on pata_pcmcia: 6 * Based on pata_pcmcia:
7 * 7 *
@@ -22,7 +22,7 @@
22#include <linux/pata_platform.h> 22#include <linux/pata_platform.h>
23 23
24#define DRV_NAME "pata_platform" 24#define DRV_NAME "pata_platform"
25#define DRV_VERSION "1.1" 25#define DRV_VERSION "1.2"
26 26
27static int pio_mask = 1; 27static int pio_mask = 1;
28 28
@@ -120,15 +120,20 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr,
120 * Register a platform bus IDE interface. Such interfaces are PIO and we 120 * Register a platform bus IDE interface. Such interfaces are PIO and we
121 * assume do not support IRQ sharing. 121 * assume do not support IRQ sharing.
122 * 122 *
123 * Platform devices are expected to contain 3 resources per port: 123 * Platform devices are expected to contain at least 2 resources per port:
124 * 124 *
125 * - I/O Base (IORESOURCE_IO or IORESOURCE_MEM) 125 * - I/O Base (IORESOURCE_IO or IORESOURCE_MEM)
126 * - CTL Base (IORESOURCE_IO or IORESOURCE_MEM) 126 * - CTL Base (IORESOURCE_IO or IORESOURCE_MEM)
127 *
128 * and optionally:
129 *
127 * - IRQ (IORESOURCE_IRQ) 130 * - IRQ (IORESOURCE_IRQ)
128 * 131 *
129 * If the base resources are both mem types, the ioremap() is handled 132 * If the base resources are both mem types, the ioremap() is handled
130 * here. For IORESOURCE_IO, it's assumed that there's no remapping 133 * here. For IORESOURCE_IO, it's assumed that there's no remapping
131 * necessary. 134 * necessary.
135 *
136 * If no IRQ resource is present, PIO polling mode is used instead.
132 */ 137 */
133static int __devinit pata_platform_probe(struct platform_device *pdev) 138static int __devinit pata_platform_probe(struct platform_device *pdev)
134{ 139{
@@ -137,11 +142,12 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
137 struct ata_port *ap; 142 struct ata_port *ap;
138 struct pata_platform_info *pp_info; 143 struct pata_platform_info *pp_info;
139 unsigned int mmio; 144 unsigned int mmio;
145 int irq;
140 146
141 /* 147 /*
142 * Simple resource validation .. 148 * Simple resource validation ..
143 */ 149 */
144 if (unlikely(pdev->num_resources != 3)) { 150 if ((pdev->num_resources != 3) && (pdev->num_resources != 2)) {
145 dev_err(&pdev->dev, "invalid number of resources\n"); 151 dev_err(&pdev->dev, "invalid number of resources\n");
146 return -EINVAL; 152 return -EINVAL;
147 } 153 }
@@ -173,6 +179,13 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
173 (ctl_res->flags == IORESOURCE_MEM)); 179 (ctl_res->flags == IORESOURCE_MEM));
174 180
175 /* 181 /*
182 * And the IRQ
183 */
184 irq = platform_get_irq(pdev, 0);
185 if (irq < 0)
186 irq = 0; /* no irq */
187
188 /*
176 * Now that that's out of the way, wire up the port.. 189 * Now that that's out of the way, wire up the port..
177 */ 190 */
178 host = ata_host_alloc(&pdev->dev, 1); 191 host = ata_host_alloc(&pdev->dev, 1);
@@ -185,6 +198,14 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
185 ap->flags |= ATA_FLAG_SLAVE_POSS; 198 ap->flags |= ATA_FLAG_SLAVE_POSS;
186 199
187 /* 200 /*
201 * Use polling mode if there's no IRQ
202 */
203 if (!irq) {
204 ap->flags |= ATA_FLAG_PIO_POLLING;
205 ata_port_desc(ap, "no IRQ, using PIO polling");
206 }
207
208 /*
188 * Handle the MMIO case 209 * Handle the MMIO case
189 */ 210 */
190 if (mmio) { 211 if (mmio) {
@@ -213,9 +234,9 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
213 (unsigned long long)ctl_res->start); 234 (unsigned long long)ctl_res->start);
214 235
215 /* activate */ 236 /* activate */
216 return ata_host_activate(host, platform_get_irq(pdev, 0), 237 return ata_host_activate(host, irq, irq ? ata_interrupt : NULL,
217 ata_interrupt, pp_info ? pp_info->irq_flags 238 pp_info ? pp_info->irq_flags : 0,
218 : 0, &pata_platform_sht); 239 &pata_platform_sht);
219} 240}
220 241
221/** 242/**
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_serverworks.c b/drivers/ata/pata_serverworks.c
index df68806df4be..8bed88873720 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -274,28 +274,27 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev
274{ 274{
275 static const u8 dma_mode[] = { 0x77, 0x21, 0x20 }; 275 static const u8 dma_mode[] = { 0x77, 0x21, 0x20 };
276 int offset = 1 + 2 * ap->port_no - adev->devno; 276 int offset = 1 + 2 * ap->port_no - adev->devno;
277 int devbits = (2 * ap->port_no + adev->devno); 277 int devbits = 2 * ap->port_no + adev->devno;
278 u8 ultra; 278 u8 ultra;
279 u8 ultra_cfg; 279 u8 ultra_cfg;
280 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 280 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
281 281
282 pci_read_config_byte(pdev, 0x54, &ultra_cfg); 282 pci_read_config_byte(pdev, 0x54, &ultra_cfg);
283 pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra);
284 ultra &= ~(0x0F << (adev->devno * 4));
283 285
284 if (adev->dma_mode >= XFER_UDMA_0) { 286 if (adev->dma_mode >= XFER_UDMA_0) {
285 pci_write_config_byte(pdev, 0x44 + offset, 0x20); 287 pci_write_config_byte(pdev, 0x44 + offset, 0x20);
286 288
287 pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra);
288 ultra &= ~(0x0F << (ap->port_no * 4));
289 ultra |= (adev->dma_mode - XFER_UDMA_0) 289 ultra |= (adev->dma_mode - XFER_UDMA_0)
290 << (ap->port_no * 4); 290 << (adev->devno * 4);
291 pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra);
292
293 ultra_cfg |= (1 << devbits); 291 ultra_cfg |= (1 << devbits);
294 } else { 292 } else {
295 pci_write_config_byte(pdev, 0x44 + offset, 293 pci_write_config_byte(pdev, 0x44 + offset,
296 dma_mode[adev->dma_mode - XFER_MW_DMA_0]); 294 dma_mode[adev->dma_mode - XFER_MW_DMA_0]);
297 ultra_cfg &= ~(1 << devbits); 295 ultra_cfg &= ~(1 << devbits);
298 } 296 }
297 pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra);
299 pci_write_config_byte(pdev, 0x54, ultra_cfg); 298 pci_write_config_byte(pdev, 0x54, ultra_cfg);
300} 299}
301 300
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 5c1e9cb59ecb..503245a1eafa 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -33,7 +33,7 @@
33#include <linux/libata.h> 33#include <linux/libata.h>
34 34
35#define DRV_NAME "pata_sil680" 35#define DRV_NAME "pata_sil680"
36#define DRV_VERSION "0.4.7" 36#define DRV_VERSION "0.4.8"
37 37
38#define SIL680_MMIO_BAR 5 38#define SIL680_MMIO_BAR 5
39 39
@@ -94,34 +94,6 @@ static int sil680_cable_detect(struct ata_port *ap) {
94} 94}
95 95
96/** 96/**
97 * sil680_bus_reset - reset the SIL680 bus
98 * @link: ATA link to reset
99 * @deadline: deadline jiffies for the operation
100 *
101 * Perform the SIL680 housekeeping when doing an ATA bus reset
102 */
103
104static int sil680_bus_reset(struct ata_link *link, unsigned int *classes,
105 unsigned long deadline)
106{
107 struct ata_port *ap = link->ap;
108 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
109 unsigned long addr = sil680_selreg(ap, 0);
110 u8 reset;
111
112 pci_read_config_byte(pdev, addr, &reset);
113 pci_write_config_byte(pdev, addr, reset | 0x03);
114 udelay(25);
115 pci_write_config_byte(pdev, addr, reset);
116 return ata_std_softreset(link, classes, deadline);
117}
118
119static void sil680_error_handler(struct ata_port *ap)
120{
121 ata_bmdma_drive_eh(ap, ata_std_prereset, sil680_bus_reset, NULL, ata_std_postreset);
122}
123
124/**
125 * sil680_set_piomode - set initial PIO mode data 97 * sil680_set_piomode - set initial PIO mode data
126 * @ap: ATA interface 98 * @ap: ATA interface
127 * @adev: ATA device 99 * @adev: ATA device
@@ -249,7 +221,7 @@ static struct ata_port_operations sil680_port_ops = {
249 221
250 .freeze = ata_bmdma_freeze, 222 .freeze = ata_bmdma_freeze,
251 .thaw = ata_bmdma_thaw, 223 .thaw = ata_bmdma_thaw,
252 .error_handler = sil680_error_handler, 224 .error_handler = ata_bmdma_error_handler,
253 .post_internal_cmd = ata_bmdma_post_internal_cmd, 225 .post_internal_cmd = ata_bmdma_post_internal_cmd,
254 .cable_detect = sil680_cable_detect, 226 .cable_detect = sil680_cable_detect,
255 227
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 3b5be77e861c..87546d9f1ca0 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -55,6 +55,7 @@ static const struct sis_laptop sis_laptop[] = {
55 /* devid, subvendor, subdev */ 55 /* devid, subvendor, subdev */
56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ 56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
57 { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */ 57 { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */
58 { 0x5513, 0x1071, 0x8640 }, /* EasyNote K5305 */
58 /* end marker */ 59 /* end marker */
59 { 0, } 60 { 0, }
60}; 61};
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 f1b422f7c749..44f9e5d9e362 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
@@ -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}
@@ -1627,7 +1629,7 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class,
1627 1629
1628 /* SATA hardreset fails to retrieve proper device signature on 1630 /* SATA hardreset fails to retrieve proper device signature on
1629 * some controllers. Don't classify on hardreset. For more 1631 * some controllers. Don't classify on hardreset. For more
1630 * info, see http://bugme.osdl.org/show_bug.cgi?id=3352 1632 * info, see http://bugzilla.kernel.org/show_bug.cgi?id=3352
1631 */ 1633 */
1632 return sata_std_hardreset(link, &dummy, deadline); 1634 return sata_std_hardreset(link, &dummy, deadline);
1633} 1635}
@@ -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..2f1de6ec044c 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -103,7 +103,7 @@ enum {
103 QS_DMA_BOUNDARY = ~0UL 103 QS_DMA_BOUNDARY = ~0UL
104}; 104};
105 105
106typedef enum { qs_state_idle, qs_state_pkt, qs_state_mmio } qs_state_t; 106typedef enum { qs_state_mmio, qs_state_pkt } qs_state_t;
107 107
108struct qs_port_priv { 108struct qs_port_priv {
109 u8 *pkt; 109 u8 *pkt;
@@ -113,17 +113,18 @@ 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);
120static void qs_qc_prep(struct ata_queued_cmd *qc); 119static void qs_qc_prep(struct ata_queued_cmd *qc);
121static unsigned int qs_qc_issue(struct ata_queued_cmd *qc); 120static unsigned int qs_qc_issue(struct ata_queued_cmd *qc);
122static int qs_check_atapi_dma(struct ata_queued_cmd *qc); 121static int qs_check_atapi_dma(struct ata_queued_cmd *qc);
123static void qs_bmdma_stop(struct ata_queued_cmd *qc); 122static void qs_bmdma_stop(struct ata_queued_cmd *qc);
124static u8 qs_bmdma_status(struct ata_port *ap); 123static u8 qs_bmdma_status(struct ata_port *ap);
125static void qs_irq_clear(struct ata_port *ap); 124static void qs_irq_clear(struct ata_port *ap);
126static void qs_eng_timeout(struct ata_port *ap); 125static void qs_freeze(struct ata_port *ap);
126static void qs_thaw(struct ata_port *ap);
127static void qs_error_handler(struct ata_port *ap);
127 128
128static struct scsi_host_template qs_ata_sht = { 129static struct scsi_host_template qs_ata_sht = {
129 .module = THIS_MODULE, 130 .module = THIS_MODULE,
@@ -135,7 +136,6 @@ static struct scsi_host_template qs_ata_sht = {
135 .sg_tablesize = QS_MAX_PRD, 136 .sg_tablesize = QS_MAX_PRD,
136 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 137 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
137 .emulated = ATA_SHT_EMULATED, 138 .emulated = ATA_SHT_EMULATED,
138 //FIXME .use_clustering = ATA_SHT_USE_CLUSTERING,
139 .use_clustering = ENABLE_CLUSTERING, 139 .use_clustering = ENABLE_CLUSTERING,
140 .proc_name = DRV_NAME, 140 .proc_name = DRV_NAME,
141 .dma_boundary = QS_DMA_BOUNDARY, 141 .dma_boundary = QS_DMA_BOUNDARY,
@@ -151,11 +151,12 @@ static const struct ata_port_operations qs_ata_ops = {
151 .check_atapi_dma = qs_check_atapi_dma, 151 .check_atapi_dma = qs_check_atapi_dma,
152 .exec_command = ata_exec_command, 152 .exec_command = ata_exec_command,
153 .dev_select = ata_std_dev_select, 153 .dev_select = ata_std_dev_select,
154 .phy_reset = qs_phy_reset,
155 .qc_prep = qs_qc_prep, 154 .qc_prep = qs_qc_prep,
156 .qc_issue = qs_qc_issue, 155 .qc_issue = qs_qc_issue,
157 .data_xfer = ata_data_xfer, 156 .data_xfer = ata_data_xfer,
158 .eng_timeout = qs_eng_timeout, 157 .freeze = qs_freeze,
158 .thaw = qs_thaw,
159 .error_handler = qs_error_handler,
159 .irq_clear = qs_irq_clear, 160 .irq_clear = qs_irq_clear,
160 .irq_on = ata_irq_on, 161 .irq_on = ata_irq_on,
161 .scr_read = qs_scr_read, 162 .scr_read = qs_scr_read,
@@ -170,8 +171,6 @@ static const struct ata_port_info qs_port_info[] = {
170 /* board_2068_idx */ 171 /* board_2068_idx */
171 { 172 {
172 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 173 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
173 ATA_FLAG_SATA_RESET |
174 //FIXME ATA_FLAG_SRST |
175 ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING, 174 ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING,
176 .pio_mask = 0x10, /* pio4 */ 175 .pio_mask = 0x10, /* pio4 */
177 .udma_mask = ATA_UDMA6, 176 .udma_mask = ATA_UDMA6,
@@ -220,7 +219,9 @@ static void qs_irq_clear(struct ata_port *ap)
220static inline void qs_enter_reg_mode(struct ata_port *ap) 219static inline void qs_enter_reg_mode(struct ata_port *ap)
221{ 220{
222 u8 __iomem *chan = qs_mmio_base(ap->host) + (ap->port_no * 0x4000); 221 u8 __iomem *chan = qs_mmio_base(ap->host) + (ap->port_no * 0x4000);
222 struct qs_port_priv *pp = ap->private_data;
223 223
224 pp->state = qs_state_mmio;
224 writeb(QS_CTR0_REG, chan + QS_CCT_CTR0); 225 writeb(QS_CTR0_REG, chan + QS_CCT_CTR0);
225 readb(chan + QS_CCT_CTR0); /* flush */ 226 readb(chan + QS_CCT_CTR0); /* flush */
226} 227}
@@ -234,23 +235,28 @@ static inline void qs_reset_channel_logic(struct ata_port *ap)
234 qs_enter_reg_mode(ap); 235 qs_enter_reg_mode(ap);
235} 236}
236 237
237static void qs_phy_reset(struct ata_port *ap) 238static void qs_freeze(struct ata_port *ap)
238{ 239{
239 struct qs_port_priv *pp = ap->private_data; 240 u8 __iomem *mmio_base = qs_mmio_base(ap->host);
240 241
241 pp->state = qs_state_idle; 242 writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */
242 qs_reset_channel_logic(ap); 243 qs_enter_reg_mode(ap);
243 sata_phy_reset(ap);
244} 244}
245 245
246static void qs_eng_timeout(struct ata_port *ap) 246static void qs_thaw(struct ata_port *ap)
247{ 247{
248 struct qs_port_priv *pp = ap->private_data; 248 u8 __iomem *mmio_base = qs_mmio_base(ap->host);
249
250 qs_enter_reg_mode(ap);
251 writeb(1, mmio_base + QS_HCT_CTRL); /* enable host interrupts */
252}
253
254static int qs_prereset(struct ata_link *link, unsigned long deadline)
255{
256 struct ata_port *ap = link->ap;
249 257
250 if (pp->state != qs_state_idle) /* healthy paranoia */
251 pp->state = qs_state_mmio;
252 qs_reset_channel_logic(ap); 258 qs_reset_channel_logic(ap);
253 ata_eng_timeout(ap); 259 return ata_std_prereset(link, deadline);
254} 260}
255 261
256static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 262static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
@@ -261,6 +267,13 @@ static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
261 return 0; 267 return 0;
262} 268}
263 269
270static void qs_error_handler(struct ata_port *ap)
271{
272 qs_enter_reg_mode(ap);
273 ata_do_eh(ap, qs_prereset, ata_std_softreset, NULL,
274 ata_std_postreset);
275}
276
264static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 277static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
265{ 278{
266 if (sc_reg > SCR_CONTROL) 279 if (sc_reg > SCR_CONTROL)
@@ -359,7 +372,6 @@ static unsigned int qs_qc_issue(struct ata_queued_cmd *qc)
359 372
360 switch (qc->tf.protocol) { 373 switch (qc->tf.protocol) {
361 case ATA_PROT_DMA: 374 case ATA_PROT_DMA:
362
363 pp->state = qs_state_pkt; 375 pp->state = qs_state_pkt;
364 qs_packet_start(qc); 376 qs_packet_start(qc);
365 return 0; 377 return 0;
@@ -376,6 +388,26 @@ static unsigned int qs_qc_issue(struct ata_queued_cmd *qc)
376 return ata_qc_issue_prot(qc); 388 return ata_qc_issue_prot(qc);
377} 389}
378 390
391static void qs_do_or_die(struct ata_queued_cmd *qc, u8 status)
392{
393 qc->err_mask |= ac_err_mask(status);
394
395 if (!qc->err_mask) {
396 ata_qc_complete(qc);
397 } else {
398 struct ata_port *ap = qc->ap;
399 struct ata_eh_info *ehi = &ap->link.eh_info;
400
401 ata_ehi_clear_desc(ehi);
402 ata_ehi_push_desc(ehi, "status 0x%02X", status);
403
404 if (qc->err_mask == AC_ERR_DEV)
405 ata_port_abort(ap);
406 else
407 ata_port_freeze(ap);
408 }
409}
410
379static inline unsigned int qs_intr_pkt(struct ata_host *host) 411static inline unsigned int qs_intr_pkt(struct ata_host *host)
380{ 412{
381 unsigned int handled = 0; 413 unsigned int handled = 0;
@@ -407,10 +439,8 @@ static inline unsigned int qs_intr_pkt(struct ata_host *host)
407 switch (sHST) { 439 switch (sHST) {
408 case 0: /* successful CPB */ 440 case 0: /* successful CPB */
409 case 3: /* device error */ 441 case 3: /* device error */
410 pp->state = qs_state_idle;
411 qs_enter_reg_mode(qc->ap); 442 qs_enter_reg_mode(qc->ap);
412 qc->err_mask |= ac_err_mask(sDST); 443 qs_do_or_die(qc, sDST);
413 ata_qc_complete(qc);
414 break; 444 break;
415 default: 445 default:
416 break; 446 break;
@@ -432,25 +462,27 @@ static inline unsigned int qs_intr_mmio(struct ata_host *host)
432 if (ap && 462 if (ap &&
433 !(ap->flags & ATA_FLAG_DISABLED)) { 463 !(ap->flags & ATA_FLAG_DISABLED)) {
434 struct ata_queued_cmd *qc; 464 struct ata_queued_cmd *qc;
435 struct qs_port_priv *pp = ap->private_data; 465 struct qs_port_priv *pp;
436 if (!pp || pp->state != qs_state_mmio)
437 continue;
438 qc = ata_qc_from_tag(ap, ap->link.active_tag); 466 qc = ata_qc_from_tag(ap, ap->link.active_tag);
439 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { 467 if (!qc || !(qc->flags & ATA_QCFLAG_ACTIVE)) {
440 468 /*
441 /* check main status, clearing INTRQ */ 469 * The qstor hardware generates spurious
442 u8 status = ata_check_status(ap); 470 * interrupts from time to time when switching
443 if ((status & ATA_BUSY)) 471 * in and out of packet mode.
444 continue; 472 * There's no obvious way to know if we're
445 DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", 473 * here now due to that, so just ack the irq
446 ap->print_id, qc->tf.protocol, status); 474 * and pretend we knew it was ours.. (ugh).
447 475 * This does not affect packet mode.
448 /* complete taskfile transaction */ 476 */
449 pp->state = qs_state_idle; 477 ata_check_status(ap);
450 qc->err_mask |= ac_err_mask(status);
451 ata_qc_complete(qc);
452 handled = 1; 478 handled = 1;
479 continue;
453 } 480 }
481 pp = ap->private_data;
482 if (!pp || pp->state != qs_state_mmio)
483 continue;
484 if (!(qc->tf.flags & ATA_TFLAG_POLLING))
485 handled |= ata_host_intr(ap, qc);
454 } 486 }
455 } 487 }
456 return handled; 488 return handled;
@@ -460,12 +492,13 @@ static irqreturn_t qs_intr(int irq, void *dev_instance)
460{ 492{
461 struct ata_host *host = dev_instance; 493 struct ata_host *host = dev_instance;
462 unsigned int handled = 0; 494 unsigned int handled = 0;
495 unsigned long flags;
463 496
464 VPRINTK("ENTER\n"); 497 VPRINTK("ENTER\n");
465 498
466 spin_lock(&host->lock); 499 spin_lock_irqsave(&host->lock, flags);
467 handled = qs_intr_pkt(host) | qs_intr_mmio(host); 500 handled = qs_intr_pkt(host) | qs_intr_mmio(host);
468 spin_unlock(&host->lock); 501 spin_unlock_irqrestore(&host->lock, flags);
469 502
470 VPRINTK("EXIT\n"); 503 VPRINTK("EXIT\n");
471 504
@@ -502,7 +535,6 @@ static int qs_port_start(struct ata_port *ap)
502 rc = ata_port_start(ap); 535 rc = ata_port_start(ap);
503 if (rc) 536 if (rc)
504 return rc; 537 return rc;
505 qs_enter_reg_mode(ap);
506 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); 538 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
507 if (!pp) 539 if (!pp)
508 return -ENOMEM; 540 return -ENOMEM;
@@ -513,6 +545,7 @@ static int qs_port_start(struct ata_port *ap)
513 memset(pp->pkt, 0, QS_PKT_BYTES); 545 memset(pp->pkt, 0, QS_PKT_BYTES);
514 ap->private_data = pp; 546 ap->private_data = pp;
515 547
548 qs_enter_reg_mode(ap);
516 addr = (u64)pp->pkt_dma; 549 addr = (u64)pp->pkt_dma;
517 writel((u32) addr, chan + QS_CCF_CPBA); 550 writel((u32) addr, chan + QS_CCF_CPBA);
518 writel((u32)(addr >> 32), chan + QS_CCF_CPBA + 4); 551 writel((u32)(addr >> 32), chan + QS_CCF_CPBA + 4);
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..96fd5260446d 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -63,6 +63,21 @@ enum {
63 SIL24_HOST_BAR = 0, 63 SIL24_HOST_BAR = 0,
64 SIL24_PORT_BAR = 2, 64 SIL24_PORT_BAR = 2,
65 65
66 /* sil24 fetches in chunks of 64bytes. The first block
67 * contains the PRB and two SGEs. From the second block, it's
68 * consisted of four SGEs and called SGT. Calculate the
69 * number of SGTs that fit into one page.
70 */
71 SIL24_PRB_SZ = sizeof(struct sil24_prb)
72 + 2 * sizeof(struct sil24_sge),
73 SIL24_MAX_SGT = (PAGE_SIZE - SIL24_PRB_SZ)
74 / (4 * sizeof(struct sil24_sge)),
75
76 /* This will give us one unused SGEs for ATA. This extra SGE
77 * will be used to store CDB for ATAPI devices.
78 */
79 SIL24_MAX_SGE = 4 * SIL24_MAX_SGT + 1,
80
66 /* 81 /*
67 * Global controller registers (128 bytes @ BAR0) 82 * Global controller registers (128 bytes @ BAR0)
68 */ 83 */
@@ -247,13 +262,13 @@ enum {
247 262
248struct sil24_ata_block { 263struct sil24_ata_block {
249 struct sil24_prb prb; 264 struct sil24_prb prb;
250 struct sil24_sge sge[LIBATA_MAX_PRD]; 265 struct sil24_sge sge[SIL24_MAX_SGE];
251}; 266};
252 267
253struct sil24_atapi_block { 268struct sil24_atapi_block {
254 struct sil24_prb prb; 269 struct sil24_prb prb;
255 u8 cdb[16]; 270 u8 cdb[16];
256 struct sil24_sge sge[LIBATA_MAX_PRD - 1]; 271 struct sil24_sge sge[SIL24_MAX_SGE];
257}; 272};
258 273
259union sil24_cmd_block { 274union sil24_cmd_block {
@@ -265,11 +280,11 @@ static struct sil24_cerr_info {
265 unsigned int err_mask, action; 280 unsigned int err_mask, action;
266 const char *desc; 281 const char *desc;
267} sil24_cerr_db[] = { 282} sil24_cerr_db[] = {
268 [0] = { AC_ERR_DEV, ATA_EH_REVALIDATE, 283 [0] = { AC_ERR_DEV, 0,
269 "device error" }, 284 "device error" },
270 [PORT_CERR_DEV] = { AC_ERR_DEV, ATA_EH_REVALIDATE, 285 [PORT_CERR_DEV] = { AC_ERR_DEV, 0,
271 "device error via D2H FIS" }, 286 "device error via D2H FIS" },
272 [PORT_CERR_SDB] = { AC_ERR_DEV, ATA_EH_REVALIDATE, 287 [PORT_CERR_SDB] = { AC_ERR_DEV, 0,
273 "device error via SDB FIS" }, 288 "device error via SDB FIS" },
274 [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET, 289 [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET,
275 "error in data FIS" }, 290 "error in data FIS" },
@@ -378,7 +393,7 @@ static struct scsi_host_template sil24_sht = {
378 .change_queue_depth = ata_scsi_change_queue_depth, 393 .change_queue_depth = ata_scsi_change_queue_depth,
379 .can_queue = SIL24_MAX_CMDS, 394 .can_queue = SIL24_MAX_CMDS,
380 .this_id = ATA_SHT_THIS_ID, 395 .this_id = ATA_SHT_THIS_ID,
381 .sg_tablesize = LIBATA_MAX_PRD, 396 .sg_tablesize = SIL24_MAX_SGE,
382 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 397 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
383 .emulated = ATA_SHT_EMULATED, 398 .emulated = ATA_SHT_EMULATED,
384 .use_clustering = ATA_SHT_USE_CLUSTERING, 399 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -674,7 +689,7 @@ static int sil24_do_softreset(struct ata_link *link, unsigned int *class,
674 689
675 /* put the port into known state */ 690 /* put the port into known state */
676 if (sil24_init_port(ap)) { 691 if (sil24_init_port(ap)) {
677 reason ="port not ready"; 692 reason = "port not ready";
678 goto err; 693 goto err;
679 } 694 }
680 695
@@ -756,7 +771,8 @@ static int sil24_hardreset(struct ata_link *link, unsigned int *class,
756 771
757 writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT); 772 writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT);
758 tmp = ata_wait_register(port + PORT_CTRL_STAT, 773 tmp = ata_wait_register(port + PORT_CTRL_STAT,
759 PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10, tout_msec); 774 PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10,
775 tout_msec);
760 776
761 /* SStatus oscillates between zero and valid status after 777 /* SStatus oscillates between zero and valid status after
762 * DEV_RST, debounce it. 778 * DEV_RST, debounce it.
@@ -1270,7 +1286,7 @@ static void sil24_init_controller(struct ata_host *host)
1270 PORT_CS_PORT_RST, 10, 100); 1286 PORT_CS_PORT_RST, 10, 100);
1271 if (tmp & PORT_CS_PORT_RST) 1287 if (tmp & PORT_CS_PORT_RST)
1272 dev_printk(KERN_ERR, host->dev, 1288 dev_printk(KERN_ERR, host->dev,
1273 "failed to clear port RST\n"); 1289 "failed to clear port RST\n");
1274 } 1290 }
1275 1291
1276 /* configure port */ 1292 /* configure port */
@@ -1283,7 +1299,8 @@ static void sil24_init_controller(struct ata_host *host)
1283 1299
1284static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1300static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1285{ 1301{
1286 static int printed_version = 0; 1302 extern int __MARKER__sil24_cmd_block_is_sized_wrongly;
1303 static int printed_version;
1287 struct ata_port_info pi = sil24_port_info[ent->driver_data]; 1304 struct ata_port_info pi = sil24_port_info[ent->driver_data];
1288 const struct ata_port_info *ppi[] = { &pi, NULL }; 1305 const struct ata_port_info *ppi[] = { &pi, NULL };
1289 void __iomem * const *iomap; 1306 void __iomem * const *iomap;
@@ -1291,6 +1308,10 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1291 int i, rc; 1308 int i, rc;
1292 u32 tmp; 1309 u32 tmp;
1293 1310
1311 /* cause link error if sil24_cmd_block is sized wrongly */
1312 if (sizeof(union sil24_cmd_block) != PAGE_SIZE)
1313 __MARKER__sil24_cmd_block_is_sized_wrongly = 1;
1314
1294 if (!printed_version++) 1315 if (!printed_version++)
1295 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 1316 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1296 1317
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/atm/he.c b/drivers/atm/he.c
index d33aba6864c2..3b64a99772ea 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -394,6 +394,11 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
394 he_dev->atm_dev->dev_data = he_dev; 394 he_dev->atm_dev->dev_data = he_dev;
395 atm_dev->dev_data = he_dev; 395 atm_dev->dev_data = he_dev;
396 he_dev->number = atm_dev->number; 396 he_dev->number = atm_dev->number;
397#ifdef USE_TASKLET
398 tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev);
399#endif
400 spin_lock_init(&he_dev->global_lock);
401
397 if (he_start(atm_dev)) { 402 if (he_start(atm_dev)) {
398 he_stop(he_dev); 403 he_stop(he_dev);
399 err = -ENODEV; 404 err = -ENODEV;
@@ -1173,11 +1178,6 @@ he_start(struct atm_dev *dev)
1173 if ((err = he_init_irq(he_dev)) != 0) 1178 if ((err = he_init_irq(he_dev)) != 0)
1174 return err; 1179 return err;
1175 1180
1176#ifdef USE_TASKLET
1177 tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev);
1178#endif
1179 spin_lock_init(&he_dev->global_lock);
1180
1181 /* 4.11 enable pci bus controller state machines */ 1181 /* 4.11 enable pci bus controller state machines */
1182 host_cntl |= (OUTFF_ENB | CMDFF_ENB | 1182 host_cntl |= (OUTFF_ENB | CMDFF_ENB |
1183 QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB); 1183 QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB);
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/base/dmapool.c b/drivers/base/dmapool.c
index 5beddc322e6f..b5034dc72a05 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -2,7 +2,6 @@
2#include <linux/device.h> 2#include <linux/device.h>
3#include <linux/mm.h> 3#include <linux/mm.h>
4#include <asm/io.h> /* Needed for i386 to build */ 4#include <asm/io.h> /* Needed for i386 to build */
5#include <asm/scatterlist.h> /* Needed for i386 to build */
6#include <linux/dma-mapping.h> 5#include <linux/dma-mapping.h>
7#include <linux/dmapool.h> 6#include <linux/dmapool.h>
8#include <linux/slab.h> 7#include <linux/slab.h>
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/nbd.c b/drivers/block/nbd.c
index 6332acad078c..b4c0888aedc3 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -28,6 +28,7 @@
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <net/sock.h> 30#include <net/sock.h>
31#include <linux/net.h>
31 32
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/system.h> 34#include <asm/system.h>
@@ -126,7 +127,7 @@ static void sock_shutdown(struct nbd_device *lo, int lock)
126 if (lo->sock) { 127 if (lo->sock) {
127 printk(KERN_WARNING "%s: shutting down socket\n", 128 printk(KERN_WARNING "%s: shutting down socket\n",
128 lo->disk->disk_name); 129 lo->disk->disk_name);
129 lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN); 130 kernel_sock_shutdown(lo->sock, SHUT_RDWR);
130 lo->sock = NULL; 131 lo->sock = NULL;
131 } 132 }
132 if (lock) 133 if (lock)
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index ceffa6034e20..e7fe6ca97dd8 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -488,13 +488,11 @@ static int pf_atapi(struct pf_unit *pf, char *cmd, int dlen, char *buf, char *fu
488 return r; 488 return r;
489} 489}
490 490
491#define DBMSG(msg) ((verbose>1)?(msg):NULL)
492
493static void pf_lock(struct pf_unit *pf, int func) 491static void pf_lock(struct pf_unit *pf, int func)
494{ 492{
495 char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 }; 493 char lo_cmd[12] = { ATAPI_LOCK, pf->lun << 5, 0, 0, func, 0, 0, 0, 0, 0, 0, 0 };
496 494
497 pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "unlock" : "lock"); 495 pf_atapi(pf, lo_cmd, 0, pf_scratch, func ? "lock" : "unlock");
498} 496}
499 497
500static void pf_eject(struct pf_unit *pf) 498static void pf_eject(struct pf_unit *pf)
@@ -555,7 +553,7 @@ static void pf_mode_sense(struct pf_unit *pf)
555 { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 }; 553 { ATAPI_MODE_SENSE, pf->lun << 5, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0 };
556 char buf[8]; 554 char buf[8];
557 555
558 pf_atapi(pf, ms_cmd, 8, buf, DBMSG("mode sense")); 556 pf_atapi(pf, ms_cmd, 8, buf, "mode sense");
559 pf->media_status = PF_RW; 557 pf->media_status = PF_RW;
560 if (buf[3] & 0x80) 558 if (buf[3] & 0x80)
561 pf->media_status = PF_RO; 559 pf->media_status = PF_RO;
@@ -591,7 +589,7 @@ static void pf_get_capacity(struct pf_unit *pf)
591 char buf[8]; 589 char buf[8];
592 int bs; 590 int bs;
593 591
594 if (pf_atapi(pf, rc_cmd, 8, buf, DBMSG("get capacity"))) { 592 if (pf_atapi(pf, rc_cmd, 8, buf, "get capacity")) {
595 pf->media_status = PF_NM; 593 pf->media_status = PF_NM;
596 return; 594 return;
597 } 595 }
@@ -804,13 +802,18 @@ static int pf_next_buf(void)
804 pf_buf += 512; 802 pf_buf += 512;
805 pf_block++; 803 pf_block++;
806 if (!pf_run) 804 if (!pf_run)
807 return 0;
808 if (!pf_count)
809 return 1; 805 return 1;
810 spin_lock_irqsave(&pf_spin_lock, saved_flags); 806 if (!pf_count) {
811 pf_end_request(1); 807 spin_lock_irqsave(&pf_spin_lock, saved_flags);
812 spin_unlock_irqrestore(&pf_spin_lock, saved_flags); 808 pf_end_request(1);
813 return 1; 809 pf_req = elv_next_request(pf_queue);
810 spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
811 if (!pf_req)
812 return 1;
813 pf_count = pf_req->current_nr_sectors;
814 pf_buf = pf_req->buffer;
815 }
816 return 0;
814} 817}
815 818
816static inline void next_request(int success) 819static inline void next_request(int success)
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 9f4e67ee1eb0..b91accf12656 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -664,7 +664,7 @@ static int pt_open(struct inode *inode, struct file *file)
664 goto out; 664 goto out;
665 665
666 err = -EROFS; 666 err = -EROFS;
667 if ((!tape->flags & PT_WRITE_OK) && (file->f_mode & 2)) 667 if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & 2))
668 goto out; 668 goto out;
669 669
670 if (!(iminor(inode) & 128)) 670 if (!(iminor(inode) & 128))
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a8130a4ad6d4..a5ee21319d37 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -358,10 +358,19 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf,
358 size_t count) 358 size_t count)
359{ 359{
360 unsigned int major, minor; 360 unsigned int major, minor;
361
361 if (sscanf(buf, "%u:%u", &major, &minor) == 2) { 362 if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
363 /* pkt_setup_dev() expects caller to hold reference to self */
364 if (!try_module_get(THIS_MODULE))
365 return -ENODEV;
366
362 pkt_setup_dev(MKDEV(major, minor), NULL); 367 pkt_setup_dev(MKDEV(major, minor), NULL);
368
369 module_put(THIS_MODULE);
370
363 return count; 371 return count;
364 } 372 }
373
365 return -EINVAL; 374 return -EINVAL;
366} 375}
367 376
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 47f8ac6cce57..82f4eecc8699 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -189,6 +189,18 @@ static int ramdisk_set_page_dirty(struct page *page)
189 return 0; 189 return 0;
190} 190}
191 191
192/*
193 * releasepage is called by pagevec_strip/try_to_release_page if
194 * buffers_heads_over_limit is true. Without a releasepage function
195 * try_to_free_buffers is called instead. That can unset the dirty
196 * bit of our ram disk pages, which will be eventually freed, even
197 * if the page is still in use.
198 */
199static int ramdisk_releasepage(struct page *page, gfp_t dummy)
200{
201 return 0;
202}
203
192static const struct address_space_operations ramdisk_aops = { 204static const struct address_space_operations ramdisk_aops = {
193 .readpage = ramdisk_readpage, 205 .readpage = ramdisk_readpage,
194 .prepare_write = ramdisk_prepare_write, 206 .prepare_write = ramdisk_prepare_write,
@@ -196,6 +208,7 @@ static const struct address_space_operations ramdisk_aops = {
196 .writepage = ramdisk_writepage, 208 .writepage = ramdisk_writepage,
197 .set_page_dirty = ramdisk_set_page_dirty, 209 .set_page_dirty = ramdisk_set_page_dirty,
198 .writepages = ramdisk_writepages, 210 .writepages = ramdisk_writepages,
211 .releasepage = ramdisk_releasepage,
199}; 212};
200 213
201static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector, 214static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector,
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 3cf7129d83e6..924ddd8bccd2 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -223,7 +223,7 @@ static int virtblk_probe(struct virtio_device *vdev)
223 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); 223 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap);
224 if (err) { 224 if (err) {
225 dev_err(&vdev->dev, "Bad/missing capacity in config\n"); 225 dev_err(&vdev->dev, "Bad/missing capacity in config\n");
226 goto out_put_disk; 226 goto out_cleanup_queue;
227 } 227 }
228 228
229 /* If capacity is too big, truncate with warning. */ 229 /* If capacity is too big, truncate with warning. */
@@ -239,7 +239,7 @@ static int virtblk_probe(struct virtio_device *vdev)
239 blk_queue_max_segment_size(vblk->disk->queue, v); 239 blk_queue_max_segment_size(vblk->disk->queue, v);
240 else if (err != -ENOENT) { 240 else if (err != -ENOENT) {
241 dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); 241 dev_err(&vdev->dev, "Bad SIZE_MAX in config\n");
242 goto out_put_disk; 242 goto out_cleanup_queue;
243 } 243 }
244 244
245 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); 245 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v);
@@ -247,12 +247,14 @@ static int virtblk_probe(struct virtio_device *vdev)
247 blk_queue_max_hw_segments(vblk->disk->queue, v); 247 blk_queue_max_hw_segments(vblk->disk->queue, v);
248 else if (err != -ENOENT) { 248 else if (err != -ENOENT) {
249 dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); 249 dev_err(&vdev->dev, "Bad SEG_MAX in config\n");
250 goto out_put_disk; 250 goto out_cleanup_queue;
251 } 251 }
252 252
253 add_disk(vblk->disk); 253 add_disk(vblk->disk);
254 return 0; 254 return 0;
255 255
256out_cleanup_queue:
257 blk_cleanup_queue(vblk->disk->queue);
256out_put_disk: 258out_put_disk:
257 put_disk(vblk->disk); 259 put_disk(vblk->disk);
258out_unregister_blkdev: 260out_unregister_blkdev:
@@ -277,6 +279,8 @@ static void virtblk_remove(struct virtio_device *vdev)
277 put_disk(vblk->disk); 279 put_disk(vblk->disk);
278 unregister_blkdev(major, "virtblk"); 280 unregister_blkdev(major, "virtblk");
279 mempool_destroy(vblk->pool); 281 mempool_destroy(vblk->pool);
282 /* There should be nothing in the queue now, so no need to shutdown */
283 vdev->config->del_vq(vblk->vq);
280 kfree(vblk); 284 kfree(vblk);
281} 285}
282 286
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/drm/drmP.h b/drivers/char/drm/drmP.h
index 9dd0760dd87a..dde02a15fa59 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -559,8 +559,6 @@ struct drm_mm {
559 * a family of cards. There will one drm_device for each card present 559 * a family of cards. There will one drm_device for each card present
560 * in this family 560 * in this family
561 */ 561 */
562struct drm_device;
563
564struct drm_driver { 562struct drm_driver {
565 int (*load) (struct drm_device *, unsigned long flags); 563 int (*load) (struct drm_device *, unsigned long flags);
566 int (*firstopen) (struct drm_device *); 564 int (*firstopen) (struct drm_device *);
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index d9be14624526..3cbebf868e68 100644
--- a/drivers/char/drm/drm_ioctl.c
+++ b/drivers/char/drm/drm_ioctl.c
@@ -272,7 +272,7 @@ int drm_getstats(struct drm_device *dev, void *data,
272 struct drm_stats *stats = data; 272 struct drm_stats *stats = data;
273 int i; 273 int i;
274 274
275 memset(stats, 0, sizeof(stats)); 275 memset(stats, 0, sizeof(*stats));
276 276
277 mutex_lock(&dev->struct_mutex); 277 mutex_lock(&dev->struct_mutex);
278 278
diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h
index 76e44ac94fb5..daa69c9d8977 100644
--- a/drivers/char/drm/drm_os_linux.h
+++ b/drivers/char/drm/drm_os_linux.h
@@ -62,14 +62,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
62 62
63#endif 63#endif
64 64
65/** For data going into the kernel through the ioctl argument */
66#define DRM_COPY_FROM_USER_IOCTL(arg1, arg2, arg3) \
67 if ( copy_from_user(&arg1, arg2, arg3) ) \
68 return -EFAULT
69/** For data going from the kernel through the ioctl argument */
70#define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \
71 if ( copy_to_user(arg1, &arg2, arg3) ) \
72 return -EFAULT
73/** Other copying of data to kernel space */ 65/** Other copying of data to kernel space */
74#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ 66#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \
75 copy_from_user(arg1, arg2, arg3) 67 copy_from_user(arg1, arg2, arg3)
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 335423c5c186..24fca8ec1379 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1679,7 +1679,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1679 dev_priv->gart_info.bus_addr = 1679 dev_priv->gart_info.bus_addr =
1680 dev_priv->pcigart_offset + dev_priv->fb_location; 1680 dev_priv->pcigart_offset + dev_priv->fb_location;
1681 dev_priv->gart_info.mapping.offset = 1681 dev_priv->gart_info.mapping.offset =
1682 dev_priv->gart_info.bus_addr; 1682 dev_priv->pcigart_offset + dev_priv->fb_aper_offset;
1683 dev_priv->gart_info.mapping.size = 1683 dev_priv->gart_info.mapping.size =
1684 dev_priv->gart_info.table_size; 1684 dev_priv->gart_info.table_size;
1685 1685
@@ -2275,7 +2275,8 @@ int radeon_driver_firstopen(struct drm_device *dev)
2275 if (ret != 0) 2275 if (ret != 0)
2276 return ret; 2276 return ret;
2277 2277
2278 ret = drm_addmap(dev, drm_get_resource_start(dev, 0), 2278 dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0);
2279 ret = drm_addmap(dev, dev_priv->fb_aper_offset,
2279 drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER, 2280 drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER,
2280 _DRM_WRITE_COMBINING, &map); 2281 _DRM_WRITE_COMBINING, &map);
2281 if (ret != 0) 2282 if (ret != 0)
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index e4077bc212b3..bfbb60a9298c 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -293,6 +293,7 @@ typedef struct drm_radeon_private {
293 293
294 /* starting from here on, data is preserved accross an open */ 294 /* starting from here on, data is preserved accross an open */
295 uint32_t flags; /* see radeon_chip_flags */ 295 uint32_t flags; /* see radeon_chip_flags */
296 unsigned long fb_aper_offset;
296} drm_radeon_private_t; 297} drm_radeon_private_t;
297 298
298typedef struct drm_radeon_buf_priv { 299typedef struct drm_radeon_buf_priv {
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c
index 59484d56b333..d465b2f9c1cd 100644
--- a/drivers/char/drm/savage_bci.c
+++ b/drivers/char/drm/savage_bci.c
@@ -968,9 +968,6 @@ static int savage_bci_event_wait(struct drm_device *dev, void *data, struct drm_
968 968
969 DRM_DEBUG("\n"); 969 DRM_DEBUG("\n");
970 970
971 DRM_COPY_FROM_USER_IOCTL(event, (drm_savage_event_wait_t __user *) data,
972 sizeof(event));
973
974 UPDATE_EVENT_COUNTER(); 971 UPDATE_EVENT_COUNTER();
975 if (dev_priv->status_ptr) 972 if (dev_priv->status_ptr)
976 hw_e = dev_priv->status_ptr[1] & 0xffff; 973 hw_e = dev_priv->status_ptr[1] & 0xffff;
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c
index 6be1c5757580..a6b7ccdaf73d 100644
--- a/drivers/char/drm/sis_mm.c
+++ b/drivers/char/drm/sis_mm.c
@@ -134,6 +134,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file_priv,
134 dev_priv->agp_initialized)) { 134 dev_priv->agp_initialized)) {
135 DRM_ERROR 135 DRM_ERROR
136 ("Attempt to allocate from uninitialized memory manager.\n"); 136 ("Attempt to allocate from uninitialized memory manager.\n");
137 mutex_unlock(&dev->struct_mutex);
137 return -EINVAL; 138 return -EINVAL;
138 } 139 }
139 140
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/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index cc5d77797def..02518da6a386 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -47,7 +47,7 @@
47/* #define ATR_CSUM */ 47/* #define ATR_CSUM */
48 48
49#ifdef PCMCIA_DEBUG 49#ifdef PCMCIA_DEBUG
50#define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) 50#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
51static int pc_debug = PCMCIA_DEBUG; 51static int pc_debug = PCMCIA_DEBUG;
52module_param(pc_debug, int, 0600); 52module_param(pc_debug, int, 0600);
53#define DEBUGP(n, rdr, x, args...) do { \ 53#define DEBUGP(n, rdr, x, args...) do { \
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index a0b9c8728d56..5f291bf739a6 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -41,7 +41,7 @@
41 41
42 42
43#ifdef PCMCIA_DEBUG 43#ifdef PCMCIA_DEBUG
44#define reader_to_dev(x) (&handle_to_dev(x->p_dev->handle)) 44#define reader_to_dev(x) (&handle_to_dev(x->p_dev))
45static int pc_debug = PCMCIA_DEBUG; 45static int pc_debug = PCMCIA_DEBUG;
46module_param(pc_debug, int, 0600); 46module_param(pc_debug, int, 0600);
47#define DEBUGP(n, rdr, x, args...) do { \ 47#define DEBUGP(n, rdr, x, args...) do { \
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 1756b1f7cb72..5fee05661823 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1494,7 +1494,7 @@ __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
1494 seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; 1494 seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK;
1495 seq += keyptr->count; 1495 seq += keyptr->count;
1496 1496
1497 seq += ktime_get_real().tv64; 1497 seq += ktime_to_ns(ktime_get_real());
1498 1498
1499 return seq; 1499 return seq;
1500} 1500}
@@ -1556,7 +1556,7 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
1556 * overlaps less than one time per MSL (2 minutes). 1556 * overlaps less than one time per MSL (2 minutes).
1557 * Choosing a clock of 64 ns period is OK. (period of 274 s) 1557 * Choosing a clock of 64 ns period is OK. (period of 274 s)
1558 */ 1558 */
1559 seq += ktime_get_real().tv64 >> 6; 1559 seq += ktime_to_ns(ktime_get_real()) >> 6;
1560#if 0 1560#if 0
1561 printk("init_seq(%lx, %lx, %d, %d) = %d\n", 1561 printk("init_seq(%lx, %lx, %d, %d) = %d\n",
1562 saddr, daddr, sport, dport, seq); 1562 saddr, daddr, sport, dport, seq);
@@ -1616,7 +1616,7 @@ u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
1616 seq = half_md4_transform(hash, keyptr->secret); 1616 seq = half_md4_transform(hash, keyptr->secret);
1617 seq |= ((u64)keyptr->count) << (32 - HASH_BITS); 1617 seq |= ((u64)keyptr->count) << (32 - HASH_BITS);
1618 1618
1619 seq += ktime_get_real().tv64; 1619 seq += ktime_to_ns(ktime_get_real());
1620 seq &= (1ull << 48) - 1; 1620 seq &= (1ull << 48) - 1;
1621#if 0 1621#if 0
1622 printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", 1622 printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n",
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index ec6b65ec69ea..0c66b802736a 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -918,6 +918,31 @@ static const struct file_operations rtc_proc_fops = {
918}; 918};
919#endif 919#endif
920 920
921static resource_size_t rtc_size;
922
923static struct resource * __init rtc_request_region(resource_size_t size)
924{
925 struct resource *r;
926
927 if (RTC_IOMAPPED)
928 r = request_region(RTC_PORT(0), size, "rtc");
929 else
930 r = request_mem_region(RTC_PORT(0), size, "rtc");
931
932 if (r)
933 rtc_size = size;
934
935 return r;
936}
937
938static void rtc_release_region(void)
939{
940 if (RTC_IOMAPPED)
941 release_region(RTC_PORT(0), rtc_size);
942 else
943 release_mem_region(RTC_PORT(0), rtc_size);
944}
945
921static int __init rtc_init(void) 946static int __init rtc_init(void)
922{ 947{
923#ifdef CONFIG_PROC_FS 948#ifdef CONFIG_PROC_FS
@@ -968,10 +993,17 @@ found:
968 } 993 }
969no_irq: 994no_irq:
970#else 995#else
971 if (RTC_IOMAPPED) 996 r = rtc_request_region(RTC_IO_EXTENT);
972 r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); 997
973 else 998 /*
974 r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); 999 * If we've already requested a smaller range (for example, because
1000 * PNPBIOS or ACPI told us how the device is configured), the request
1001 * above might fail because it's too big.
1002 *
1003 * If so, request just the range we actually use.
1004 */
1005 if (!r)
1006 r = rtc_request_region(RTC_IO_EXTENT_USED);
975 if (!r) { 1007 if (!r) {
976#ifdef RTC_IRQ 1008#ifdef RTC_IRQ
977 rtc_has_irq = 0; 1009 rtc_has_irq = 0;
@@ -992,10 +1024,7 @@ no_irq:
992 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ 1024 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */
993 rtc_has_irq = 0; 1025 rtc_has_irq = 0;
994 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); 1026 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
995 if (RTC_IOMAPPED) 1027 rtc_release_region();
996 release_region(RTC_PORT(0), RTC_IO_EXTENT);
997 else
998 release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
999 return -EIO; 1028 return -EIO;
1000 } 1029 }
1001 hpet_rtc_timer_init(); 1030 hpet_rtc_timer_init();
@@ -1009,7 +1038,7 @@ no_irq:
1009 free_irq(RTC_IRQ, NULL); 1038 free_irq(RTC_IRQ, NULL);
1010 rtc_has_irq = 0; 1039 rtc_has_irq = 0;
1011#endif 1040#endif
1012 release_region(RTC_PORT(0), RTC_IO_EXTENT); 1041 rtc_release_region();
1013 return -ENODEV; 1042 return -ENODEV;
1014 } 1043 }
1015 1044
@@ -1091,10 +1120,7 @@ static void __exit rtc_exit (void)
1091 if (rtc_has_irq) 1120 if (rtc_has_irq)
1092 free_irq (rtc_irq, &rtc_port); 1121 free_irq (rtc_irq, &rtc_port);
1093#else 1122#else
1094 if (RTC_IOMAPPED) 1123 rtc_release_region();
1095 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1096 else
1097 release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
1098#ifdef RTC_IRQ 1124#ifdef RTC_IRQ
1099 if (rtc_has_irq) 1125 if (rtc_has_irq)
1100 free_irq (RTC_IRQ, NULL); 1126 free_irq (RTC_IRQ, NULL);
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 7a003504c265..1bdd2bf4f37d 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -730,13 +730,23 @@ static int send_prio_char(struct tty_struct *tty, char ch)
730 return 0; 730 return 0;
731} 731}
732 732
733int n_tty_ioctl(struct tty_struct * tty, struct file * file, 733/**
734 unsigned int cmd, unsigned long arg) 734 * tty_mode_ioctl - mode related ioctls
735 * @tty: tty for the ioctl
736 * @file: file pointer for the tty
737 * @cmd: command
738 * @arg: ioctl argument
739 *
740 * Perform non line discipline specific mode control ioctls. This
741 * is designed to be called by line disciplines to ensure they provide
742 * consistent mode setting.
743 */
744
745int tty_mode_ioctl(struct tty_struct * tty, struct file *file,
746 unsigned int cmd, unsigned long arg)
735{ 747{
736 struct tty_struct * real_tty; 748 struct tty_struct * real_tty;
737 void __user *p = (void __user *)arg; 749 void __user *p = (void __user *)arg;
738 int retval;
739 struct tty_ldisc *ld;
740 750
741 if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 751 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
742 tty->driver->subtype == PTY_TYPE_MASTER) 752 tty->driver->subtype == PTY_TYPE_MASTER)
@@ -799,6 +809,93 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
799 return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); 809 return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO);
800 case TCSETA: 810 case TCSETA:
801 return set_termios(real_tty, p, TERMIOS_TERMIO); 811 return set_termios(real_tty, p, TERMIOS_TERMIO);
812#ifndef TCGETS2
813 case TIOCGLCKTRMIOS:
814 if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked))
815 return -EFAULT;
816 return 0;
817
818 case TIOCSLCKTRMIOS:
819 if (!capable(CAP_SYS_ADMIN))
820 return -EPERM;
821 if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg))
822 return -EFAULT;
823 return 0;
824#else
825 case TIOCGLCKTRMIOS:
826 if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked))
827 return -EFAULT;
828 return 0;
829
830 case TIOCSLCKTRMIOS:
831 if (!capable(CAP_SYS_ADMIN))
832 return -EPERM;
833 if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg))
834 return -EFAULT;
835 return 0;
836#endif
837 case TIOCGSOFTCAR:
838 return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg);
839 case TIOCSSOFTCAR:
840 if (get_user(arg, (unsigned int __user *) arg))
841 return -EFAULT;
842 mutex_lock(&tty->termios_mutex);
843 tty->termios->c_cflag =
844 ((tty->termios->c_cflag & ~CLOCAL) |
845 (arg ? CLOCAL : 0));
846 mutex_unlock(&tty->termios_mutex);
847 return 0;
848 default:
849 return -ENOIOCTLCMD;
850 }
851}
852
853EXPORT_SYMBOL_GPL(tty_mode_ioctl);
854
855int tty_perform_flush(struct tty_struct *tty, unsigned long arg)
856{
857 struct tty_ldisc *ld;
858 int retval = tty_check_change(tty);
859 if (retval)
860 return retval;
861
862 ld = tty_ldisc_ref(tty);
863 switch (arg) {
864 case TCIFLUSH:
865 if (ld && ld->flush_buffer)
866 ld->flush_buffer(tty);
867 break;
868 case TCIOFLUSH:
869 if (ld && ld->flush_buffer)
870 ld->flush_buffer(tty);
871 /* fall through */
872 case TCOFLUSH:
873 if (tty->driver->flush_buffer)
874 tty->driver->flush_buffer(tty);
875 break;
876 default:
877 tty_ldisc_deref(ld);
878 return -EINVAL;
879 }
880 tty_ldisc_deref(ld);
881 return 0;
882}
883
884EXPORT_SYMBOL_GPL(tty_perform_flush);
885
886int n_tty_ioctl(struct tty_struct * tty, struct file * file,
887 unsigned int cmd, unsigned long arg)
888{
889 struct tty_struct * real_tty;
890 int retval;
891
892 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
893 tty->driver->subtype == PTY_TYPE_MASTER)
894 real_tty = tty->link;
895 else
896 real_tty = tty;
897
898 switch (cmd) {
802 case TCXONC: 899 case TCXONC:
803 retval = tty_check_change(tty); 900 retval = tty_check_change(tty);
804 if (retval) 901 if (retval)
@@ -829,30 +926,7 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
829 } 926 }
830 return 0; 927 return 0;
831 case TCFLSH: 928 case TCFLSH:
832 retval = tty_check_change(tty); 929 return tty_perform_flush(tty, arg);
833 if (retval)
834 return retval;
835
836 ld = tty_ldisc_ref(tty);
837 switch (arg) {
838 case TCIFLUSH:
839 if (ld && ld->flush_buffer)
840 ld->flush_buffer(tty);
841 break;
842 case TCIOFLUSH:
843 if (ld && ld->flush_buffer)
844 ld->flush_buffer(tty);
845 /* fall through */
846 case TCOFLUSH:
847 if (tty->driver->flush_buffer)
848 tty->driver->flush_buffer(tty);
849 break;
850 default:
851 tty_ldisc_deref(ld);
852 return -EINVAL;
853 }
854 tty_ldisc_deref(ld);
855 return 0;
856 case TIOCOUTQ: 930 case TIOCOUTQ:
857 return put_user(tty->driver->chars_in_buffer ? 931 return put_user(tty->driver->chars_in_buffer ?
858 tty->driver->chars_in_buffer(tty) : 0, 932 tty->driver->chars_in_buffer(tty) : 0,
@@ -862,32 +936,6 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
862 if (L_ICANON(tty)) 936 if (L_ICANON(tty))
863 retval = inq_canon(tty); 937 retval = inq_canon(tty);
864 return put_user(retval, (unsigned int __user *) arg); 938 return put_user(retval, (unsigned int __user *) arg);
865#ifndef TCGETS2
866 case TIOCGLCKTRMIOS:
867 if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked))
868 return -EFAULT;
869 return 0;
870
871 case TIOCSLCKTRMIOS:
872 if (!capable(CAP_SYS_ADMIN))
873 return -EPERM;
874 if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg))
875 return -EFAULT;
876 return 0;
877#else
878 case TIOCGLCKTRMIOS:
879 if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked))
880 return -EFAULT;
881 return 0;
882
883 case TIOCSLCKTRMIOS:
884 if (!capable(CAP_SYS_ADMIN))
885 return -EPERM;
886 if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg))
887 return -EFAULT;
888 return 0;
889#endif
890
891 case TIOCPKT: 939 case TIOCPKT:
892 { 940 {
893 int pktmode; 941 int pktmode;
@@ -906,19 +954,9 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
906 tty->packet = 0; 954 tty->packet = 0;
907 return 0; 955 return 0;
908 } 956 }
909 case TIOCGSOFTCAR:
910 return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg);
911 case TIOCSSOFTCAR:
912 if (get_user(arg, (unsigned int __user *) arg))
913 return -EFAULT;
914 mutex_lock(&tty->termios_mutex);
915 tty->termios->c_cflag =
916 ((tty->termios->c_cflag & ~CLOCAL) |
917 (arg ? CLOCAL : 0));
918 mutex_unlock(&tty->termios_mutex);
919 return 0;
920 default: 957 default:
921 return -ENOIOCTLCMD; 958 /* Try the mode commands */
959 return tty_mode_ioctl(tty, file, cmd, arg);
922 } 960 }
923} 961}
924 962
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 100e8a201e3a..e34da5c97196 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -141,7 +141,7 @@ int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int))
141 * never remove the console device we never need this pointer again. 141 * never remove the console device we never need this pointer again.
142 * 142 *
143 * Finally we put our input buffer in the input queue, ready to receive. */ 143 * Finally we put our input buffer in the input queue, ready to receive. */
144static int virtcons_probe(struct virtio_device *dev) 144static int __devinit virtcons_probe(struct virtio_device *dev)
145{ 145{
146 int err; 146 int err;
147 struct hvc_struct *hvc; 147 struct hvc_struct *hvc;
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/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 4bd33ce8a6f3..1bba99747f5b 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -37,17 +37,17 @@
37#define DEF_FREQUENCY_UP_THRESHOLD (80) 37#define DEF_FREQUENCY_UP_THRESHOLD (80)
38#define DEF_FREQUENCY_DOWN_THRESHOLD (20) 38#define DEF_FREQUENCY_DOWN_THRESHOLD (20)
39 39
40/* 40/*
41 * The polling frequency of this governor depends on the capability of 41 * The polling frequency of this governor depends on the capability of
42 * the processor. Default polling frequency is 1000 times the transition 42 * the processor. Default polling frequency is 1000 times the transition
43 * latency of the processor. The governor will work on any processor with 43 * latency of the processor. The governor will work on any processor with
44 * transition latency <= 10mS, using appropriate sampling 44 * transition latency <= 10mS, using appropriate sampling
45 * rate. 45 * rate.
46 * For CPUs with transition latency > 10mS (mostly drivers 46 * For CPUs with transition latency > 10mS (mostly drivers
47 * with CPUFREQ_ETERNAL), this governor will not work. 47 * with CPUFREQ_ETERNAL), this governor will not work.
48 * All times here are in uS. 48 * All times here are in uS.
49 */ 49 */
50static unsigned int def_sampling_rate; 50static unsigned int def_sampling_rate;
51#define MIN_SAMPLING_RATE_RATIO (2) 51#define MIN_SAMPLING_RATE_RATIO (2)
52/* for correct statistics, we need at least 10 ticks between each measure */ 52/* for correct statistics, we need at least 10 ticks between each measure */
53#define MIN_STAT_SAMPLING_RATE \ 53#define MIN_STAT_SAMPLING_RATE \
@@ -63,12 +63,12 @@ static unsigned int def_sampling_rate;
63static void do_dbs_timer(struct work_struct *work); 63static void do_dbs_timer(struct work_struct *work);
64 64
65struct cpu_dbs_info_s { 65struct cpu_dbs_info_s {
66 struct cpufreq_policy *cur_policy; 66 struct cpufreq_policy *cur_policy;
67 unsigned int prev_cpu_idle_up; 67 unsigned int prev_cpu_idle_up;
68 unsigned int prev_cpu_idle_down; 68 unsigned int prev_cpu_idle_down;
69 unsigned int enable; 69 unsigned int enable;
70 unsigned int down_skip; 70 unsigned int down_skip;
71 unsigned int requested_freq; 71 unsigned int requested_freq;
72}; 72};
73static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); 73static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info);
74 74
@@ -82,24 +82,24 @@ static unsigned int dbs_enable; /* number of CPUs using this policy */
82 * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock 82 * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock
83 * is recursive for the same process. -Venki 83 * is recursive for the same process. -Venki
84 */ 84 */
85static DEFINE_MUTEX (dbs_mutex); 85static DEFINE_MUTEX (dbs_mutex);
86static DECLARE_DELAYED_WORK(dbs_work, do_dbs_timer); 86static DECLARE_DELAYED_WORK(dbs_work, do_dbs_timer);
87 87
88struct dbs_tuners { 88struct dbs_tuners {
89 unsigned int sampling_rate; 89 unsigned int sampling_rate;
90 unsigned int sampling_down_factor; 90 unsigned int sampling_down_factor;
91 unsigned int up_threshold; 91 unsigned int up_threshold;
92 unsigned int down_threshold; 92 unsigned int down_threshold;
93 unsigned int ignore_nice; 93 unsigned int ignore_nice;
94 unsigned int freq_step; 94 unsigned int freq_step;
95}; 95};
96 96
97static struct dbs_tuners dbs_tuners_ins = { 97static struct dbs_tuners dbs_tuners_ins = {
98 .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, 98 .up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
99 .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD, 99 .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD,
100 .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, 100 .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR,
101 .ignore_nice = 0, 101 .ignore_nice = 0,
102 .freq_step = 5, 102 .freq_step = 5,
103}; 103};
104 104
105static inline unsigned int get_cpu_idle_time(unsigned int cpu) 105static inline unsigned int get_cpu_idle_time(unsigned int cpu)
@@ -109,13 +109,34 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu)
109 if (dbs_tuners_ins.ignore_nice) 109 if (dbs_tuners_ins.ignore_nice)
110 add_nice = kstat_cpu(cpu).cpustat.nice; 110 add_nice = kstat_cpu(cpu).cpustat.nice;
111 111
112 ret = kstat_cpu(cpu).cpustat.idle + 112 ret = kstat_cpu(cpu).cpustat.idle +
113 kstat_cpu(cpu).cpustat.iowait + 113 kstat_cpu(cpu).cpustat.iowait +
114 add_nice; 114 add_nice;
115 115
116 return ret; 116 return ret;
117} 117}
118 118
119/* keep track of frequency transitions */
120static int
121dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
122 void *data)
123{
124 struct cpufreq_freqs *freq = data;
125 struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info,
126 freq->cpu);
127
128 if (!this_dbs_info->enable)
129 return 0;
130
131 this_dbs_info->requested_freq = freq->new;
132
133 return 0;
134}
135
136static struct notifier_block dbs_cpufreq_notifier_block = {
137 .notifier_call = dbs_cpufreq_notifier
138};
139
119/************************** sysfs interface ************************/ 140/************************** sysfs interface ************************/
120static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) 141static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf)
121{ 142{
@@ -127,8 +148,8 @@ static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
127 return sprintf (buf, "%u\n", MIN_SAMPLING_RATE); 148 return sprintf (buf, "%u\n", MIN_SAMPLING_RATE);
128} 149}
129 150
130#define define_one_ro(_name) \ 151#define define_one_ro(_name) \
131static struct freq_attr _name = \ 152static struct freq_attr _name = \
132__ATTR(_name, 0444, show_##_name, NULL) 153__ATTR(_name, 0444, show_##_name, NULL)
133 154
134define_one_ro(sampling_rate_max); 155define_one_ro(sampling_rate_max);
@@ -148,7 +169,7 @@ show_one(down_threshold, down_threshold);
148show_one(ignore_nice_load, ignore_nice); 169show_one(ignore_nice_load, ignore_nice);
149show_one(freq_step, freq_step); 170show_one(freq_step, freq_step);
150 171
151static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, 172static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
152 const char *buf, size_t count) 173 const char *buf, size_t count)
153{ 174{
154 unsigned int input; 175 unsigned int input;
@@ -164,7 +185,7 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
164 return count; 185 return count;
165} 186}
166 187
167static ssize_t store_sampling_rate(struct cpufreq_policy *unused, 188static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
168 const char *buf, size_t count) 189 const char *buf, size_t count)
169{ 190{
170 unsigned int input; 191 unsigned int input;
@@ -183,7 +204,7 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
183 return count; 204 return count;
184} 205}
185 206
186static ssize_t store_up_threshold(struct cpufreq_policy *unused, 207static ssize_t store_up_threshold(struct cpufreq_policy *unused,
187 const char *buf, size_t count) 208 const char *buf, size_t count)
188{ 209{
189 unsigned int input; 210 unsigned int input;
@@ -202,7 +223,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
202 return count; 223 return count;
203} 224}
204 225
205static ssize_t store_down_threshold(struct cpufreq_policy *unused, 226static ssize_t store_down_threshold(struct cpufreq_policy *unused,
206 const char *buf, size_t count) 227 const char *buf, size_t count)
207{ 228{
208 unsigned int input; 229 unsigned int input;
@@ -228,16 +249,16 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
228 int ret; 249 int ret;
229 250
230 unsigned int j; 251 unsigned int j;
231 252
232 ret = sscanf (buf, "%u", &input); 253 ret = sscanf(buf, "%u", &input);
233 if ( ret != 1 ) 254 if (ret != 1)
234 return -EINVAL; 255 return -EINVAL;
235 256
236 if ( input > 1 ) 257 if (input > 1)
237 input = 1; 258 input = 1;
238 259
239 mutex_lock(&dbs_mutex); 260 mutex_lock(&dbs_mutex);
240 if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ 261 if (input == dbs_tuners_ins.ignore_nice) { /* nothing to do */
241 mutex_unlock(&dbs_mutex); 262 mutex_unlock(&dbs_mutex);
242 return count; 263 return count;
243 } 264 }
@@ -261,14 +282,14 @@ static ssize_t store_freq_step(struct cpufreq_policy *policy,
261 unsigned int input; 282 unsigned int input;
262 int ret; 283 int ret;
263 284
264 ret = sscanf (buf, "%u", &input); 285 ret = sscanf(buf, "%u", &input);
265 286
266 if ( ret != 1 ) 287 if (ret != 1)
267 return -EINVAL; 288 return -EINVAL;
268 289
269 if ( input > 100 ) 290 if (input > 100)
270 input = 100; 291 input = 100;
271 292
272 /* no need to test here if freq_step is zero as the user might actually 293 /* no need to test here if freq_step is zero as the user might actually
273 * want this, they would be crazy though :) */ 294 * want this, they would be crazy though :) */
274 mutex_lock(&dbs_mutex); 295 mutex_lock(&dbs_mutex);
@@ -322,18 +343,18 @@ static void dbs_check_cpu(int cpu)
322 343
323 policy = this_dbs_info->cur_policy; 344 policy = this_dbs_info->cur_policy;
324 345
325 /* 346 /*
326 * The default safe range is 20% to 80% 347 * The default safe range is 20% to 80%
327 * Every sampling_rate, we check 348 * Every sampling_rate, we check
328 * - If current idle time is less than 20%, then we try to 349 * - If current idle time is less than 20%, then we try to
329 * increase frequency 350 * increase frequency
330 * Every sampling_rate*sampling_down_factor, we check 351 * Every sampling_rate*sampling_down_factor, we check
331 * - If current idle time is more than 80%, then we try to 352 * - If current idle time is more than 80%, then we try to
332 * decrease frequency 353 * decrease frequency
333 * 354 *
334 * Any frequency increase takes it to the maximum frequency. 355 * Any frequency increase takes it to the maximum frequency.
335 * Frequency reduction happens at minimum steps of 356 * Frequency reduction happens at minimum steps of
336 * 5% (default) of max_frequency 357 * 5% (default) of max_frequency
337 */ 358 */
338 359
339 /* Check for frequency increase */ 360 /* Check for frequency increase */
@@ -361,13 +382,13 @@ static void dbs_check_cpu(int cpu)
361 /* if we are already at full speed then break out early */ 382 /* if we are already at full speed then break out early */
362 if (this_dbs_info->requested_freq == policy->max) 383 if (this_dbs_info->requested_freq == policy->max)
363 return; 384 return;
364 385
365 freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; 386 freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100;
366 387
367 /* max freq cannot be less than 100. But who knows.... */ 388 /* max freq cannot be less than 100. But who knows.... */
368 if (unlikely(freq_step == 0)) 389 if (unlikely(freq_step == 0))
369 freq_step = 5; 390 freq_step = 5;
370 391
371 this_dbs_info->requested_freq += freq_step; 392 this_dbs_info->requested_freq += freq_step;
372 if (this_dbs_info->requested_freq > policy->max) 393 if (this_dbs_info->requested_freq > policy->max)
373 this_dbs_info->requested_freq = policy->max; 394 this_dbs_info->requested_freq = policy->max;
@@ -427,15 +448,15 @@ static void dbs_check_cpu(int cpu)
427} 448}
428 449
429static void do_dbs_timer(struct work_struct *work) 450static void do_dbs_timer(struct work_struct *work)
430{ 451{
431 int i; 452 int i;
432 mutex_lock(&dbs_mutex); 453 mutex_lock(&dbs_mutex);
433 for_each_online_cpu(i) 454 for_each_online_cpu(i)
434 dbs_check_cpu(i); 455 dbs_check_cpu(i);
435 schedule_delayed_work(&dbs_work, 456 schedule_delayed_work(&dbs_work,
436 usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); 457 usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
437 mutex_unlock(&dbs_mutex); 458 mutex_unlock(&dbs_mutex);
438} 459}
439 460
440static inline void dbs_timer_init(void) 461static inline void dbs_timer_init(void)
441{ 462{
@@ -462,13 +483,12 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
462 483
463 switch (event) { 484 switch (event) {
464 case CPUFREQ_GOV_START: 485 case CPUFREQ_GOV_START:
465 if ((!cpu_online(cpu)) || 486 if ((!cpu_online(cpu)) || (!policy->cur))
466 (!policy->cur))
467 return -EINVAL; 487 return -EINVAL;
468 488
469 if (this_dbs_info->enable) /* Already enabled */ 489 if (this_dbs_info->enable) /* Already enabled */
470 break; 490 break;
471 491
472 mutex_lock(&dbs_mutex); 492 mutex_lock(&dbs_mutex);
473 493
474 rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); 494 rc = sysfs_create_group(&policy->kobj, &dbs_attr_group);
@@ -481,7 +501,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
481 struct cpu_dbs_info_s *j_dbs_info; 501 struct cpu_dbs_info_s *j_dbs_info;
482 j_dbs_info = &per_cpu(cpu_dbs_info, j); 502 j_dbs_info = &per_cpu(cpu_dbs_info, j);
483 j_dbs_info->cur_policy = policy; 503 j_dbs_info->cur_policy = policy;
484 504
485 j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(cpu); 505 j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(cpu);
486 j_dbs_info->prev_cpu_idle_down 506 j_dbs_info->prev_cpu_idle_down
487 = j_dbs_info->prev_cpu_idle_up; 507 = j_dbs_info->prev_cpu_idle_up;
@@ -511,8 +531,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
511 dbs_tuners_ins.sampling_rate = def_sampling_rate; 531 dbs_tuners_ins.sampling_rate = def_sampling_rate;
512 532
513 dbs_timer_init(); 533 dbs_timer_init();
534 cpufreq_register_notifier(
535 &dbs_cpufreq_notifier_block,
536 CPUFREQ_TRANSITION_NOTIFIER);
514 } 537 }
515 538
516 mutex_unlock(&dbs_mutex); 539 mutex_unlock(&dbs_mutex);
517 break; 540 break;
518 541
@@ -525,9 +548,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
525 * Stop the timerschedule work, when this governor 548 * Stop the timerschedule work, when this governor
526 * is used for first time 549 * is used for first time
527 */ 550 */
528 if (dbs_enable == 0) 551 if (dbs_enable == 0) {
529 dbs_timer_exit(); 552 dbs_timer_exit();
530 553 cpufreq_unregister_notifier(
554 &dbs_cpufreq_notifier_block,
555 CPUFREQ_TRANSITION_NOTIFIER);
556 }
557
531 mutex_unlock(&dbs_mutex); 558 mutex_unlock(&dbs_mutex);
532 559
533 break; 560 break;
@@ -537,11 +564,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
537 if (policy->max < this_dbs_info->cur_policy->cur) 564 if (policy->max < this_dbs_info->cur_policy->cur)
538 __cpufreq_driver_target( 565 __cpufreq_driver_target(
539 this_dbs_info->cur_policy, 566 this_dbs_info->cur_policy,
540 policy->max, CPUFREQ_RELATION_H); 567 policy->max, CPUFREQ_RELATION_H);
541 else if (policy->min > this_dbs_info->cur_policy->cur) 568 else if (policy->min > this_dbs_info->cur_policy->cur)
542 __cpufreq_driver_target( 569 __cpufreq_driver_target(
543 this_dbs_info->cur_policy, 570 this_dbs_info->cur_policy,
544 policy->min, CPUFREQ_RELATION_L); 571 policy->min, CPUFREQ_RELATION_L);
545 mutex_unlock(&dbs_mutex); 572 mutex_unlock(&dbs_mutex);
546 break; 573 break;
547 } 574 }
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/geode-aes.c b/drivers/crypto/geode-aes.c
index f9a34abbf4fa..711e246e1ef0 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -110,8 +110,7 @@ geode_aes_crypt(struct geode_aes_op *op)
110 * we don't need to worry 110 * we don't need to worry
111 */ 111 */
112 112
113 if (op->src == op->dst) 113 flags |= (AES_CTRL_DCA | AES_CTRL_SCA);
114 flags |= (AES_CTRL_DCA | AES_CTRL_SCA);
115 114
116 if (op->dir == AES_DIR_ENCRYPT) 115 if (op->dir == AES_DIR_ENCRYPT)
117 flags |= AES_CTRL_ENCRYPT; 116 flags |= AES_CTRL_ENCRYPT;
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/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 82489923af09..d59b2f417306 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -182,10 +182,9 @@ static void dma_client_chan_alloc(struct dma_client *client)
182 /* we are done once this client rejects 182 /* we are done once this client rejects
183 * an available resource 183 * an available resource
184 */ 184 */
185 if (ack == DMA_ACK) { 185 if (ack == DMA_ACK)
186 dma_chan_get(chan); 186 dma_chan_get(chan);
187 kref_get(&device->refcount); 187 else if (ack == DMA_NAK)
188 } else if (ack == DMA_NAK)
189 return; 188 return;
190 } 189 }
191 } 190 }
@@ -272,11 +271,8 @@ static void dma_clients_notify_removed(struct dma_chan *chan)
272 /* client was holding resources for this channel so 271 /* client was holding resources for this channel so
273 * free it 272 * free it
274 */ 273 */
275 if (ack == DMA_ACK) { 274 if (ack == DMA_ACK)
276 dma_chan_put(chan); 275 dma_chan_put(chan);
277 kref_put(&chan->device->refcount,
278 dma_async_device_cleanup);
279 }
280 } 276 }
281 277
282 mutex_unlock(&dma_list_mutex); 278 mutex_unlock(&dma_list_mutex);
@@ -316,11 +312,8 @@ void dma_async_client_unregister(struct dma_client *client)
316 ack = client->event_callback(client, chan, 312 ack = client->event_callback(client, chan,
317 DMA_RESOURCE_REMOVED); 313 DMA_RESOURCE_REMOVED);
318 314
319 if (ack == DMA_ACK) { 315 if (ack == DMA_ACK)
320 dma_chan_put(chan); 316 dma_chan_put(chan);
321 kref_put(&chan->device->refcount,
322 dma_async_device_cleanup);
323 }
324 } 317 }
325 318
326 list_del(&client->global_node); 319 list_del(&client->global_node);
@@ -397,6 +390,8 @@ int dma_async_device_register(struct dma_device *device)
397 goto err_out; 390 goto err_out;
398 } 391 }
399 392
393 /* One for the channel, one of the class device */
394 kref_get(&device->refcount);
400 kref_get(&device->refcount); 395 kref_get(&device->refcount);
401 kref_init(&chan->refcount); 396 kref_init(&chan->refcount);
402 chan->slow_ref = 0; 397 chan->slow_ref = 0;
diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c
index f204c39fb412..16e0fd8facfb 100644
--- a/drivers/dma/ioat.c
+++ b/drivers/dma/ioat.c
@@ -39,10 +39,14 @@ MODULE_LICENSE("GPL");
39MODULE_AUTHOR("Intel Corporation"); 39MODULE_AUTHOR("Intel Corporation");
40 40
41static struct pci_device_id ioat_pci_tbl[] = { 41static struct pci_device_id ioat_pci_tbl[] = {
42 /* I/OAT v1 platforms */
42 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT) }, 43 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT) },
43 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB) }, 44 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB) },
44 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SCNB) }, 45 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SCNB) },
45 { PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR) }, 46 { PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR) },
47
48 /* I/OAT v2 platforms */
49 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB) },
46 { 0, } 50 { 0, }
47}; 51};
48 52
@@ -74,10 +78,17 @@ static int ioat_setup_functionality(struct pci_dev *pdev, void __iomem *iobase)
74 if (device->dma && ioat_dca_enabled) 78 if (device->dma && ioat_dca_enabled)
75 device->dca = ioat_dca_init(pdev, iobase); 79 device->dca = ioat_dca_init(pdev, iobase);
76 break; 80 break;
81 case IOAT_VER_2_0:
82 device->dma = ioat_dma_probe(pdev, iobase);
83 if (device->dma && ioat_dca_enabled)
84 device->dca = ioat2_dca_init(pdev, iobase);
85 break;
77 default: 86 default:
78 err = -ENODEV; 87 err = -ENODEV;
79 break; 88 break;
80 } 89 }
90 if (!device->dma)
91 err = -ENODEV;
81 return err; 92 return err;
82} 93}
83 94
diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c
index ba985715b803..0fa8a98051a8 100644
--- a/drivers/dma/ioat_dca.c
+++ b/drivers/dma/ioat_dca.c
@@ -261,3 +261,167 @@ struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase)
261 return dca; 261 return dca;
262} 262}
263 263
264
265static int ioat2_dca_add_requester(struct dca_provider *dca, struct device *dev)
266{
267 struct ioat_dca_priv *ioatdca = dca_priv(dca);
268 struct pci_dev *pdev;
269 int i;
270 u16 id;
271 u16 global_req_table;
272
273 /* This implementation only supports PCI-Express */
274 if (dev->bus != &pci_bus_type)
275 return -ENODEV;
276 pdev = to_pci_dev(dev);
277 id = dcaid_from_pcidev(pdev);
278
279 if (ioatdca->requester_count == ioatdca->max_requesters)
280 return -ENODEV;
281
282 for (i = 0; i < ioatdca->max_requesters; i++) {
283 if (ioatdca->req_slots[i].pdev == NULL) {
284 /* found an empty slot */
285 ioatdca->requester_count++;
286 ioatdca->req_slots[i].pdev = pdev;
287 ioatdca->req_slots[i].rid = id;
288 global_req_table =
289 readw(ioatdca->dca_base + IOAT_DCA_GREQID_OFFSET);
290 writel(id | IOAT_DCA_GREQID_VALID,
291 ioatdca->iobase + global_req_table + (i * 4));
292 return i;
293 }
294 }
295 /* Error, ioatdma->requester_count is out of whack */
296 return -EFAULT;
297}
298
299static int ioat2_dca_remove_requester(struct dca_provider *dca,
300 struct device *dev)
301{
302 struct ioat_dca_priv *ioatdca = dca_priv(dca);
303 struct pci_dev *pdev;
304 int i;
305 u16 global_req_table;
306
307 /* This implementation only supports PCI-Express */
308 if (dev->bus != &pci_bus_type)
309 return -ENODEV;
310 pdev = to_pci_dev(dev);
311
312 for (i = 0; i < ioatdca->max_requesters; i++) {
313 if (ioatdca->req_slots[i].pdev == pdev) {
314 global_req_table =
315 readw(ioatdca->dca_base + IOAT_DCA_GREQID_OFFSET);
316 writel(0, ioatdca->iobase + global_req_table + (i * 4));
317 ioatdca->req_slots[i].pdev = NULL;
318 ioatdca->req_slots[i].rid = 0;
319 ioatdca->requester_count--;
320 return i;
321 }
322 }
323 return -ENODEV;
324}
325
326static u8 ioat2_dca_get_tag(struct dca_provider *dca, int cpu)
327{
328 u8 tag;
329
330 tag = ioat_dca_get_tag(dca, cpu);
331 tag = (~tag) & 0x1F;
332 return tag;
333}
334
335static struct dca_ops ioat2_dca_ops = {
336 .add_requester = ioat2_dca_add_requester,
337 .remove_requester = ioat2_dca_remove_requester,
338 .get_tag = ioat2_dca_get_tag,
339};
340
341static int ioat2_dca_count_dca_slots(void *iobase, u16 dca_offset)
342{
343 int slots = 0;
344 u32 req;
345 u16 global_req_table;
346
347 global_req_table = readw(iobase + dca_offset + IOAT_DCA_GREQID_OFFSET);
348 if (global_req_table == 0)
349 return 0;
350 do {
351 req = readl(iobase + global_req_table + (slots * sizeof(u32)));
352 slots++;
353 } while ((req & IOAT_DCA_GREQID_LASTID) == 0);
354
355 return slots;
356}
357
358struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase)
359{
360 struct dca_provider *dca;
361 struct ioat_dca_priv *ioatdca;
362 int slots;
363 int i;
364 int err;
365 u32 tag_map;
366 u16 dca_offset;
367 u16 csi_fsb_control;
368 u16 pcie_control;
369 u8 bit;
370
371 if (!system_has_dca_enabled(pdev))
372 return NULL;
373
374 dca_offset = readw(iobase + IOAT_DCAOFFSET_OFFSET);
375 if (dca_offset == 0)
376 return NULL;
377
378 slots = ioat2_dca_count_dca_slots(iobase, dca_offset);
379 if (slots == 0)
380 return NULL;
381
382 dca = alloc_dca_provider(&ioat2_dca_ops,
383 sizeof(*ioatdca)
384 + (sizeof(struct ioat_dca_slot) * slots));
385 if (!dca)
386 return NULL;
387
388 ioatdca = dca_priv(dca);
389 ioatdca->iobase = iobase;
390 ioatdca->dca_base = iobase + dca_offset;
391 ioatdca->max_requesters = slots;
392
393 /* some bios might not know to turn these on */
394 csi_fsb_control = readw(ioatdca->dca_base + IOAT_FSB_CAP_ENABLE_OFFSET);
395 if ((csi_fsb_control & IOAT_FSB_CAP_ENABLE_PREFETCH) == 0) {
396 csi_fsb_control |= IOAT_FSB_CAP_ENABLE_PREFETCH;
397 writew(csi_fsb_control,
398 ioatdca->dca_base + IOAT_FSB_CAP_ENABLE_OFFSET);
399 }
400 pcie_control = readw(ioatdca->dca_base + IOAT_PCI_CAP_ENABLE_OFFSET);
401 if ((pcie_control & IOAT_PCI_CAP_ENABLE_MEMWR) == 0) {
402 pcie_control |= IOAT_PCI_CAP_ENABLE_MEMWR;
403 writew(pcie_control,
404 ioatdca->dca_base + IOAT_PCI_CAP_ENABLE_OFFSET);
405 }
406
407
408 /* TODO version, compatibility and configuration checks */
409
410 /* copy out the APIC to DCA tag map */
411 tag_map = readl(ioatdca->dca_base + IOAT_APICID_TAG_MAP_OFFSET);
412 for (i = 0; i < 5; i++) {
413 bit = (tag_map >> (4 * i)) & 0x0f;
414 if (bit < 8)
415 ioatdca->tag_map[i] = bit | DCA_TAG_MAP_VALID;
416 else
417 ioatdca->tag_map[i] = 0;
418 }
419
420 err = register_dca_provider(dca, &pdev->dev);
421 if (err) {
422 free_dca_provider(dca);
423 return NULL;
424 }
425
426 return dca;
427}
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 7e4a785c2dff..c1c2dcc6fc2e 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -36,18 +36,24 @@
36#include "ioatdma_registers.h" 36#include "ioatdma_registers.h"
37#include "ioatdma_hw.h" 37#include "ioatdma_hw.h"
38 38
39#define INITIAL_IOAT_DESC_COUNT 128
40
41#define to_ioat_chan(chan) container_of(chan, struct ioat_dma_chan, common) 39#define to_ioat_chan(chan) container_of(chan, struct ioat_dma_chan, common)
42#define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, common) 40#define to_ioatdma_device(dev) container_of(dev, struct ioatdma_device, common)
43#define to_ioat_desc(lh) container_of(lh, struct ioat_desc_sw, node) 41#define to_ioat_desc(lh) container_of(lh, struct ioat_desc_sw, node)
44#define tx_to_ioat_desc(tx) container_of(tx, struct ioat_desc_sw, async_tx) 42#define tx_to_ioat_desc(tx) container_of(tx, struct ioat_desc_sw, async_tx)
45 43
44static int ioat_pending_level = 4;
45module_param(ioat_pending_level, int, 0644);
46MODULE_PARM_DESC(ioat_pending_level,
47 "high-water mark for pushing ioat descriptors (default: 4)");
48
46/* internal functions */ 49/* internal functions */
47static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan); 50static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan);
48static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan); 51static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan);
52
53static struct ioat_desc_sw *
54ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan);
49static struct ioat_desc_sw * 55static struct ioat_desc_sw *
50ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan); 56ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan);
51 57
52static inline struct ioat_dma_chan *ioat_lookup_chan_by_index( 58static inline struct ioat_dma_chan *ioat_lookup_chan_by_index(
53 struct ioatdma_device *device, 59 struct ioatdma_device *device,
@@ -130,6 +136,12 @@ static int ioat_dma_enumerate_channels(struct ioatdma_device *device)
130 ioat_chan->device = device; 136 ioat_chan->device = device;
131 ioat_chan->reg_base = device->reg_base + (0x80 * (i + 1)); 137 ioat_chan->reg_base = device->reg_base + (0x80 * (i + 1));
132 ioat_chan->xfercap = xfercap; 138 ioat_chan->xfercap = xfercap;
139 ioat_chan->desccount = 0;
140 if (ioat_chan->device->version != IOAT_VER_1_2) {
141 writel(IOAT_DCACTRL_CMPL_WRITE_ENABLE
142 | IOAT_DMA_DCA_ANY_CPU,
143 ioat_chan->reg_base + IOAT_DCACTRL_OFFSET);
144 }
133 spin_lock_init(&ioat_chan->cleanup_lock); 145 spin_lock_init(&ioat_chan->cleanup_lock);
134 spin_lock_init(&ioat_chan->desc_lock); 146 spin_lock_init(&ioat_chan->desc_lock);
135 INIT_LIST_HEAD(&ioat_chan->free_desc); 147 INIT_LIST_HEAD(&ioat_chan->free_desc);
@@ -161,13 +173,17 @@ static void ioat_set_dest(dma_addr_t addr,
161 tx_to_ioat_desc(tx)->dst = addr; 173 tx_to_ioat_desc(tx)->dst = addr;
162} 174}
163 175
164static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) 176static inline void __ioat1_dma_memcpy_issue_pending(
177 struct ioat_dma_chan *ioat_chan);
178static inline void __ioat2_dma_memcpy_issue_pending(
179 struct ioat_dma_chan *ioat_chan);
180
181static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
165{ 182{
166 struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); 183 struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan);
167 struct ioat_desc_sw *first = tx_to_ioat_desc(tx); 184 struct ioat_desc_sw *first = tx_to_ioat_desc(tx);
168 struct ioat_desc_sw *prev, *new; 185 struct ioat_desc_sw *prev, *new;
169 struct ioat_dma_descriptor *hw; 186 struct ioat_dma_descriptor *hw;
170 int append = 0;
171 dma_cookie_t cookie; 187 dma_cookie_t cookie;
172 LIST_HEAD(new_chain); 188 LIST_HEAD(new_chain);
173 u32 copy; 189 u32 copy;
@@ -209,7 +225,7 @@ static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx)
209 list_add_tail(&new->node, &new_chain); 225 list_add_tail(&new->node, &new_chain);
210 desc_count++; 226 desc_count++;
211 prev = new; 227 prev = new;
212 } while (len && (new = ioat_dma_get_next_descriptor(ioat_chan))); 228 } while (len && (new = ioat1_dma_get_next_descriptor(ioat_chan)));
213 229
214 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; 230 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
215 if (new->async_tx.callback) { 231 if (new->async_tx.callback) {
@@ -246,20 +262,98 @@ static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx)
246 first->async_tx.phys; 262 first->async_tx.phys;
247 __list_splice(&new_chain, ioat_chan->used_desc.prev); 263 __list_splice(&new_chain, ioat_chan->used_desc.prev);
248 264
265 ioat_chan->dmacount += desc_count;
249 ioat_chan->pending += desc_count; 266 ioat_chan->pending += desc_count;
250 if (ioat_chan->pending >= 4) { 267 if (ioat_chan->pending >= ioat_pending_level)
251 append = 1; 268 __ioat1_dma_memcpy_issue_pending(ioat_chan);
252 ioat_chan->pending = 0;
253 }
254 spin_unlock_bh(&ioat_chan->desc_lock); 269 spin_unlock_bh(&ioat_chan->desc_lock);
255 270
256 if (append) 271 return cookie;
257 writeb(IOAT_CHANCMD_APPEND, 272}
258 ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); 273
274static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx)
275{
276 struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan);
277 struct ioat_desc_sw *first = tx_to_ioat_desc(tx);
278 struct ioat_desc_sw *new;
279 struct ioat_dma_descriptor *hw;
280 dma_cookie_t cookie;
281 u32 copy;
282 size_t len;
283 dma_addr_t src, dst;
284 int orig_ack;
285 unsigned int desc_count = 0;
286
287 /* src and dest and len are stored in the initial descriptor */
288 len = first->len;
289 src = first->src;
290 dst = first->dst;
291 orig_ack = first->async_tx.ack;
292 new = first;
293
294 /* ioat_chan->desc_lock is still in force in version 2 path */
295
296 do {
297 copy = min((u32) len, ioat_chan->xfercap);
298
299 new->async_tx.ack = 1;
300
301 hw = new->hw;
302 hw->size = copy;
303 hw->ctl = 0;
304 hw->src_addr = src;
305 hw->dst_addr = dst;
306
307 len -= copy;
308 dst += copy;
309 src += copy;
310 desc_count++;
311 } while (len && (new = ioat2_dma_get_next_descriptor(ioat_chan)));
312
313 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
314 if (new->async_tx.callback) {
315 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
316 if (first != new) {
317 /* move callback into to last desc */
318 new->async_tx.callback = first->async_tx.callback;
319 new->async_tx.callback_param
320 = first->async_tx.callback_param;
321 first->async_tx.callback = NULL;
322 first->async_tx.callback_param = NULL;
323 }
324 }
325
326 new->tx_cnt = desc_count;
327 new->async_tx.ack = orig_ack; /* client is in control of this ack */
328
329 /* store the original values for use in later cleanup */
330 if (new != first) {
331 new->src = first->src;
332 new->dst = first->dst;
333 new->len = first->len;
334 }
335
336 /* cookie incr and addition to used_list must be atomic */
337 cookie = ioat_chan->common.cookie;
338 cookie++;
339 if (cookie < 0)
340 cookie = 1;
341 ioat_chan->common.cookie = new->async_tx.cookie = cookie;
342
343 ioat_chan->dmacount += desc_count;
344 ioat_chan->pending += desc_count;
345 if (ioat_chan->pending >= ioat_pending_level)
346 __ioat2_dma_memcpy_issue_pending(ioat_chan);
347 spin_unlock_bh(&ioat_chan->desc_lock);
259 348
260 return cookie; 349 return cookie;
261} 350}
262 351
352/**
353 * ioat_dma_alloc_descriptor - allocate and return a sw and hw descriptor pair
354 * @ioat_chan: the channel supplying the memory pool for the descriptors
355 * @flags: allocation flags
356 */
263static struct ioat_desc_sw *ioat_dma_alloc_descriptor( 357static struct ioat_desc_sw *ioat_dma_alloc_descriptor(
264 struct ioat_dma_chan *ioat_chan, 358 struct ioat_dma_chan *ioat_chan,
265 gfp_t flags) 359 gfp_t flags)
@@ -284,15 +378,57 @@ static struct ioat_desc_sw *ioat_dma_alloc_descriptor(
284 dma_async_tx_descriptor_init(&desc_sw->async_tx, &ioat_chan->common); 378 dma_async_tx_descriptor_init(&desc_sw->async_tx, &ioat_chan->common);
285 desc_sw->async_tx.tx_set_src = ioat_set_src; 379 desc_sw->async_tx.tx_set_src = ioat_set_src;
286 desc_sw->async_tx.tx_set_dest = ioat_set_dest; 380 desc_sw->async_tx.tx_set_dest = ioat_set_dest;
287 desc_sw->async_tx.tx_submit = ioat_tx_submit; 381 switch (ioat_chan->device->version) {
382 case IOAT_VER_1_2:
383 desc_sw->async_tx.tx_submit = ioat1_tx_submit;
384 break;
385 case IOAT_VER_2_0:
386 desc_sw->async_tx.tx_submit = ioat2_tx_submit;
387 break;
388 }
288 INIT_LIST_HEAD(&desc_sw->async_tx.tx_list); 389 INIT_LIST_HEAD(&desc_sw->async_tx.tx_list);
390
289 desc_sw->hw = desc; 391 desc_sw->hw = desc;
290 desc_sw->async_tx.phys = phys; 392 desc_sw->async_tx.phys = phys;
291 393
292 return desc_sw; 394 return desc_sw;
293} 395}
294 396
295/* returns the actual number of allocated descriptors */ 397static int ioat_initial_desc_count = 256;
398module_param(ioat_initial_desc_count, int, 0644);
399MODULE_PARM_DESC(ioat_initial_desc_count,
400 "initial descriptors per channel (default: 256)");
401
402/**
403 * ioat2_dma_massage_chan_desc - link the descriptors into a circle
404 * @ioat_chan: the channel to be massaged
405 */
406static void ioat2_dma_massage_chan_desc(struct ioat_dma_chan *ioat_chan)
407{
408 struct ioat_desc_sw *desc, *_desc;
409
410 /* setup used_desc */
411 ioat_chan->used_desc.next = ioat_chan->free_desc.next;
412 ioat_chan->used_desc.prev = NULL;
413
414 /* pull free_desc out of the circle so that every node is a hw
415 * descriptor, but leave it pointing to the list
416 */
417 ioat_chan->free_desc.prev->next = ioat_chan->free_desc.next;
418 ioat_chan->free_desc.next->prev = ioat_chan->free_desc.prev;
419
420 /* circle link the hw descriptors */
421 desc = to_ioat_desc(ioat_chan->free_desc.next);
422 desc->hw->next = to_ioat_desc(desc->node.next)->async_tx.phys;
423 list_for_each_entry_safe(desc, _desc, ioat_chan->free_desc.next, node) {
424 desc->hw->next = to_ioat_desc(desc->node.next)->async_tx.phys;
425 }
426}
427
428/**
429 * ioat_dma_alloc_chan_resources - returns the number of allocated descriptors
430 * @chan: the channel to be filled out
431 */
296static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) 432static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
297{ 433{
298 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); 434 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
@@ -304,7 +440,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
304 440
305 /* have we already been set up? */ 441 /* have we already been set up? */
306 if (!list_empty(&ioat_chan->free_desc)) 442 if (!list_empty(&ioat_chan->free_desc))
307 return INITIAL_IOAT_DESC_COUNT; 443 return ioat_chan->desccount;
308 444
309 /* Setup register to interrupt and write completion status on error */ 445 /* Setup register to interrupt and write completion status on error */
310 chanctrl = IOAT_CHANCTRL_ERR_INT_EN | 446 chanctrl = IOAT_CHANCTRL_ERR_INT_EN |
@@ -320,7 +456,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
320 } 456 }
321 457
322 /* Allocate descriptors */ 458 /* Allocate descriptors */
323 for (i = 0; i < INITIAL_IOAT_DESC_COUNT; i++) { 459 for (i = 0; i < ioat_initial_desc_count; i++) {
324 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL); 460 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL);
325 if (!desc) { 461 if (!desc) {
326 dev_err(&ioat_chan->device->pdev->dev, 462 dev_err(&ioat_chan->device->pdev->dev,
@@ -330,7 +466,10 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
330 list_add_tail(&desc->node, &tmp_list); 466 list_add_tail(&desc->node, &tmp_list);
331 } 467 }
332 spin_lock_bh(&ioat_chan->desc_lock); 468 spin_lock_bh(&ioat_chan->desc_lock);
469 ioat_chan->desccount = i;
333 list_splice(&tmp_list, &ioat_chan->free_desc); 470 list_splice(&tmp_list, &ioat_chan->free_desc);
471 if (ioat_chan->device->version != IOAT_VER_1_2)
472 ioat2_dma_massage_chan_desc(ioat_chan);
334 spin_unlock_bh(&ioat_chan->desc_lock); 473 spin_unlock_bh(&ioat_chan->desc_lock);
335 474
336 /* allocate a completion writeback area */ 475 /* allocate a completion writeback area */
@@ -347,10 +486,14 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
347 ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); 486 ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH);
348 487
349 tasklet_enable(&ioat_chan->cleanup_task); 488 tasklet_enable(&ioat_chan->cleanup_task);
350 ioat_dma_start_null_desc(ioat_chan); 489 ioat_dma_start_null_desc(ioat_chan); /* give chain to dma device */
351 return i; 490 return ioat_chan->desccount;
352} 491}
353 492
493/**
494 * ioat_dma_free_chan_resources - release all the descriptors
495 * @chan: the channel to be cleaned
496 */
354static void ioat_dma_free_chan_resources(struct dma_chan *chan) 497static void ioat_dma_free_chan_resources(struct dma_chan *chan)
355{ 498{
356 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); 499 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
@@ -364,22 +507,45 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
364 /* Delay 100ms after reset to allow internal DMA logic to quiesce 507 /* Delay 100ms after reset to allow internal DMA logic to quiesce
365 * before removing DMA descriptor resources. 508 * before removing DMA descriptor resources.
366 */ 509 */
367 writeb(IOAT_CHANCMD_RESET, ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); 510 writeb(IOAT_CHANCMD_RESET,
511 ioat_chan->reg_base
512 + IOAT_CHANCMD_OFFSET(ioat_chan->device->version));
368 mdelay(100); 513 mdelay(100);
369 514
370 spin_lock_bh(&ioat_chan->desc_lock); 515 spin_lock_bh(&ioat_chan->desc_lock);
371 list_for_each_entry_safe(desc, _desc, &ioat_chan->used_desc, node) { 516 switch (ioat_chan->device->version) {
372 in_use_descs++; 517 case IOAT_VER_1_2:
373 list_del(&desc->node); 518 list_for_each_entry_safe(desc, _desc,
374 pci_pool_free(ioatdma_device->dma_pool, desc->hw, 519 &ioat_chan->used_desc, node) {
375 desc->async_tx.phys); 520 in_use_descs++;
376 kfree(desc); 521 list_del(&desc->node);
377 } 522 pci_pool_free(ioatdma_device->dma_pool, desc->hw,
378 list_for_each_entry_safe(desc, _desc, &ioat_chan->free_desc, node) { 523 desc->async_tx.phys);
379 list_del(&desc->node); 524 kfree(desc);
525 }
526 list_for_each_entry_safe(desc, _desc,
527 &ioat_chan->free_desc, node) {
528 list_del(&desc->node);
529 pci_pool_free(ioatdma_device->dma_pool, desc->hw,
530 desc->async_tx.phys);
531 kfree(desc);
532 }
533 break;
534 case IOAT_VER_2_0:
535 list_for_each_entry_safe(desc, _desc,
536 ioat_chan->free_desc.next, node) {
537 list_del(&desc->node);
538 pci_pool_free(ioatdma_device->dma_pool, desc->hw,
539 desc->async_tx.phys);
540 kfree(desc);
541 }
542 desc = to_ioat_desc(ioat_chan->free_desc.next);
380 pci_pool_free(ioatdma_device->dma_pool, desc->hw, 543 pci_pool_free(ioatdma_device->dma_pool, desc->hw,
381 desc->async_tx.phys); 544 desc->async_tx.phys);
382 kfree(desc); 545 kfree(desc);
546 INIT_LIST_HEAD(&ioat_chan->free_desc);
547 INIT_LIST_HEAD(&ioat_chan->used_desc);
548 break;
383 } 549 }
384 spin_unlock_bh(&ioat_chan->desc_lock); 550 spin_unlock_bh(&ioat_chan->desc_lock);
385 551
@@ -395,6 +561,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
395 561
396 ioat_chan->last_completion = ioat_chan->completion_addr = 0; 562 ioat_chan->last_completion = ioat_chan->completion_addr = 0;
397 ioat_chan->pending = 0; 563 ioat_chan->pending = 0;
564 ioat_chan->dmacount = 0;
398} 565}
399 566
400/** 567/**
@@ -406,7 +573,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
406 * has run out. 573 * has run out.
407 */ 574 */
408static struct ioat_desc_sw * 575static struct ioat_desc_sw *
409ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) 576ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
410{ 577{
411 struct ioat_desc_sw *new = NULL; 578 struct ioat_desc_sw *new = NULL;
412 579
@@ -425,7 +592,82 @@ ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
425 return new; 592 return new;
426} 593}
427 594
428static struct dma_async_tx_descriptor *ioat_dma_prep_memcpy( 595static struct ioat_desc_sw *
596ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
597{
598 struct ioat_desc_sw *new = NULL;
599
600 /*
601 * used.prev points to where to start processing
602 * used.next points to next free descriptor
603 * if used.prev == NULL, there are none waiting to be processed
604 * if used.next == used.prev.prev, there is only one free descriptor,
605 * and we need to use it to as a noop descriptor before
606 * linking in a new set of descriptors, since the device
607 * has probably already read the pointer to it
608 */
609 if (ioat_chan->used_desc.prev &&
610 ioat_chan->used_desc.next == ioat_chan->used_desc.prev->prev) {
611
612 struct ioat_desc_sw *desc = NULL;
613 struct ioat_desc_sw *noop_desc = NULL;
614 int i;
615
616 /* set up the noop descriptor */
617 noop_desc = to_ioat_desc(ioat_chan->used_desc.next);
618 noop_desc->hw->size = 0;
619 noop_desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL;
620 noop_desc->hw->src_addr = 0;
621 noop_desc->hw->dst_addr = 0;
622
623 ioat_chan->used_desc.next = ioat_chan->used_desc.next->next;
624 ioat_chan->pending++;
625 ioat_chan->dmacount++;
626
627 /* get a few more descriptors */
628 for (i = 16; i; i--) {
629 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC);
630 BUG_ON(!desc);
631 list_add_tail(&desc->node, ioat_chan->used_desc.next);
632
633 desc->hw->next
634 = to_ioat_desc(desc->node.next)->async_tx.phys;
635 to_ioat_desc(desc->node.prev)->hw->next
636 = desc->async_tx.phys;
637 ioat_chan->desccount++;
638 }
639
640 ioat_chan->used_desc.next = noop_desc->node.next;
641 }
642 new = to_ioat_desc(ioat_chan->used_desc.next);
643 prefetch(new);
644 ioat_chan->used_desc.next = new->node.next;
645
646 if (ioat_chan->used_desc.prev == NULL)
647 ioat_chan->used_desc.prev = &new->node;
648
649 prefetch(new->hw);
650 return new;
651}
652
653static struct ioat_desc_sw *ioat_dma_get_next_descriptor(
654 struct ioat_dma_chan *ioat_chan)
655{
656 if (!ioat_chan)
657 return NULL;
658
659 switch (ioat_chan->device->version) {
660 case IOAT_VER_1_2:
661 return ioat1_dma_get_next_descriptor(ioat_chan);
662 break;
663 case IOAT_VER_2_0:
664 return ioat2_dma_get_next_descriptor(ioat_chan);
665 break;
666 }
667 return NULL;
668}
669
670static struct dma_async_tx_descriptor *ioat1_dma_prep_memcpy(
429 struct dma_chan *chan, 671 struct dma_chan *chan,
430 size_t len, 672 size_t len,
431 int int_en) 673 int int_en)
@@ -441,19 +683,62 @@ static struct dma_async_tx_descriptor *ioat_dma_prep_memcpy(
441 return new ? &new->async_tx : NULL; 683 return new ? &new->async_tx : NULL;
442} 684}
443 685
686static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy(
687 struct dma_chan *chan,
688 size_t len,
689 int int_en)
690{
691 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
692 struct ioat_desc_sw *new;
693
694 spin_lock_bh(&ioat_chan->desc_lock);
695 new = ioat2_dma_get_next_descriptor(ioat_chan);
696 new->len = len;
697
698 /* leave ioat_chan->desc_lock set in version 2 path */
699 return new ? &new->async_tx : NULL;
700}
701
702
444/** 703/**
445 * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended 704 * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended
446 * descriptors to hw 705 * descriptors to hw
447 * @chan: DMA channel handle 706 * @chan: DMA channel handle
448 */ 707 */
449static void ioat_dma_memcpy_issue_pending(struct dma_chan *chan) 708static inline void __ioat1_dma_memcpy_issue_pending(
709 struct ioat_dma_chan *ioat_chan)
710{
711 ioat_chan->pending = 0;
712 writeb(IOAT_CHANCMD_APPEND, ioat_chan->reg_base + IOAT1_CHANCMD_OFFSET);
713}
714
715static void ioat1_dma_memcpy_issue_pending(struct dma_chan *chan)
450{ 716{
451 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); 717 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
452 718
453 if (ioat_chan->pending != 0) { 719 if (ioat_chan->pending != 0) {
454 ioat_chan->pending = 0; 720 spin_lock_bh(&ioat_chan->desc_lock);
455 writeb(IOAT_CHANCMD_APPEND, 721 __ioat1_dma_memcpy_issue_pending(ioat_chan);
456 ioat_chan->reg_base + IOAT_CHANCMD_OFFSET); 722 spin_unlock_bh(&ioat_chan->desc_lock);
723 }
724}
725
726static inline void __ioat2_dma_memcpy_issue_pending(
727 struct ioat_dma_chan *ioat_chan)
728{
729 ioat_chan->pending = 0;
730 writew(ioat_chan->dmacount,
731 ioat_chan->reg_base + IOAT_CHAN_DMACOUNT_OFFSET);
732}
733
734static void ioat2_dma_memcpy_issue_pending(struct dma_chan *chan)
735{
736 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
737
738 if (ioat_chan->pending != 0) {
739 spin_lock_bh(&ioat_chan->desc_lock);
740 __ioat2_dma_memcpy_issue_pending(ioat_chan);
741 spin_unlock_bh(&ioat_chan->desc_lock);
457 } 742 }
458} 743}
459 744
@@ -465,11 +750,17 @@ static void ioat_dma_cleanup_tasklet(unsigned long data)
465 chan->reg_base + IOAT_CHANCTRL_OFFSET); 750 chan->reg_base + IOAT_CHANCTRL_OFFSET);
466} 751}
467 752
753/**
754 * ioat_dma_memcpy_cleanup - cleanup up finished descriptors
755 * @chan: ioat channel to be cleaned up
756 */
468static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) 757static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
469{ 758{
470 unsigned long phys_complete; 759 unsigned long phys_complete;
471 struct ioat_desc_sw *desc, *_desc; 760 struct ioat_desc_sw *desc, *_desc;
472 dma_cookie_t cookie = 0; 761 dma_cookie_t cookie = 0;
762 unsigned long desc_phys;
763 struct ioat_desc_sw *latest_desc;
473 764
474 prefetch(ioat_chan->completion_virt); 765 prefetch(ioat_chan->completion_virt);
475 766
@@ -507,56 +798,115 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
507 798
508 cookie = 0; 799 cookie = 0;
509 spin_lock_bh(&ioat_chan->desc_lock); 800 spin_lock_bh(&ioat_chan->desc_lock);
510 list_for_each_entry_safe(desc, _desc, &ioat_chan->used_desc, node) { 801 switch (ioat_chan->device->version) {
511 802 case IOAT_VER_1_2:
512 /* 803 list_for_each_entry_safe(desc, _desc,
513 * Incoming DMA requests may use multiple descriptors, due to 804 &ioat_chan->used_desc, node) {
514 * exceeding xfercap, perhaps. If so, only the last one will
515 * have a cookie, and require unmapping.
516 */
517 if (desc->async_tx.cookie) {
518 cookie = desc->async_tx.cookie;
519 805
520 /* 806 /*
521 * yes we are unmapping both _page and _single alloc'd 807 * Incoming DMA requests may use multiple descriptors,
522 * regions with unmap_page. Is this *really* that bad? 808 * due to exceeding xfercap, perhaps. If so, only the
809 * last one will have a cookie, and require unmapping.
523 */ 810 */
524 pci_unmap_page(ioat_chan->device->pdev, 811 if (desc->async_tx.cookie) {
525 pci_unmap_addr(desc, dst), 812 cookie = desc->async_tx.cookie;
526 pci_unmap_len(desc, len), 813
527 PCI_DMA_FROMDEVICE); 814 /*
528 pci_unmap_page(ioat_chan->device->pdev, 815 * yes we are unmapping both _page and _single
529 pci_unmap_addr(desc, src), 816 * alloc'd regions with unmap_page. Is this
530 pci_unmap_len(desc, len), 817 * *really* that bad?
531 PCI_DMA_TODEVICE); 818 */
532 if (desc->async_tx.callback) { 819 pci_unmap_page(ioat_chan->device->pdev,
533 desc->async_tx.callback( 820 pci_unmap_addr(desc, dst),
534 desc->async_tx.callback_param); 821 pci_unmap_len(desc, len),
535 desc->async_tx.callback = NULL; 822 PCI_DMA_FROMDEVICE);
823 pci_unmap_page(ioat_chan->device->pdev,
824 pci_unmap_addr(desc, src),
825 pci_unmap_len(desc, len),
826 PCI_DMA_TODEVICE);
827
828 if (desc->async_tx.callback) {
829 desc->async_tx.callback(desc->async_tx.callback_param);
830 desc->async_tx.callback = NULL;
831 }
536 } 832 }
537 }
538 833
539 if (desc->async_tx.phys != phys_complete) { 834 if (desc->async_tx.phys != phys_complete) {
540 /* 835 /*
541 * a completed entry, but not the last, so cleanup 836 * a completed entry, but not the last, so clean
542 * if the client is done with the descriptor 837 * up if the client is done with the descriptor
543 */ 838 */
544 if (desc->async_tx.ack) { 839 if (desc->async_tx.ack) {
545 list_del(&desc->node); 840 list_del(&desc->node);
546 list_add_tail(&desc->node, 841 list_add_tail(&desc->node,
547 &ioat_chan->free_desc); 842 &ioat_chan->free_desc);
548 } else 843 } else
844 desc->async_tx.cookie = 0;
845 } else {
846 /*
847 * last used desc. Do not remove, so we can
848 * append from it, but don't look at it next
849 * time, either
850 */
549 desc->async_tx.cookie = 0; 851 desc->async_tx.cookie = 0;
550 } else {
551 /*
552 * last used desc. Do not remove, so we can append from
553 * it, but don't look at it next time, either
554 */
555 desc->async_tx.cookie = 0;
556 852
557 /* TODO check status bits? */ 853 /* TODO check status bits? */
854 break;
855 }
856 }
857 break;
858 case IOAT_VER_2_0:
859 /* has some other thread has already cleaned up? */
860 if (ioat_chan->used_desc.prev == NULL)
558 break; 861 break;
862
863 /* work backwards to find latest finished desc */
864 desc = to_ioat_desc(ioat_chan->used_desc.next);
865 latest_desc = NULL;
866 do {
867 desc = to_ioat_desc(desc->node.prev);
868 desc_phys = (unsigned long)desc->async_tx.phys
869 & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR;
870 if (desc_phys == phys_complete) {
871 latest_desc = desc;
872 break;
873 }
874 } while (&desc->node != ioat_chan->used_desc.prev);
875
876 if (latest_desc != NULL) {
877
878 /* work forwards to clear finished descriptors */
879 for (desc = to_ioat_desc(ioat_chan->used_desc.prev);
880 &desc->node != latest_desc->node.next &&
881 &desc->node != ioat_chan->used_desc.next;
882 desc = to_ioat_desc(desc->node.next)) {
883 if (desc->async_tx.cookie) {
884 cookie = desc->async_tx.cookie;
885 desc->async_tx.cookie = 0;
886
887 pci_unmap_page(ioat_chan->device->pdev,
888 pci_unmap_addr(desc, dst),
889 pci_unmap_len(desc, len),
890 PCI_DMA_FROMDEVICE);
891 pci_unmap_page(ioat_chan->device->pdev,
892 pci_unmap_addr(desc, src),
893 pci_unmap_len(desc, len),
894 PCI_DMA_TODEVICE);
895
896 if (desc->async_tx.callback) {
897 desc->async_tx.callback(desc->async_tx.callback_param);
898 desc->async_tx.callback = NULL;
899 }
900 }
901 }
902
903 /* move used.prev up beyond those that are finished */
904 if (&desc->node == ioat_chan->used_desc.next)
905 ioat_chan->used_desc.prev = NULL;
906 else
907 ioat_chan->used_desc.prev = &desc->node;
559 } 908 }
909 break;
560 } 910 }
561 911
562 spin_unlock_bh(&ioat_chan->desc_lock); 912 spin_unlock_bh(&ioat_chan->desc_lock);
@@ -621,8 +971,6 @@ static enum dma_status ioat_dma_is_complete(struct dma_chan *chan,
621 return dma_async_is_complete(cookie, last_complete, last_used); 971 return dma_async_is_complete(cookie, last_complete, last_used);
622} 972}
623 973
624/* PCI API */
625
626static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) 974static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
627{ 975{
628 struct ioat_desc_sw *desc; 976 struct ioat_desc_sw *desc;
@@ -633,21 +981,34 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
633 desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL 981 desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL
634 | IOAT_DMA_DESCRIPTOR_CTL_INT_GN 982 | IOAT_DMA_DESCRIPTOR_CTL_INT_GN
635 | IOAT_DMA_DESCRIPTOR_CTL_CP_STS; 983 | IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
636 desc->hw->next = 0;
637 desc->hw->size = 0; 984 desc->hw->size = 0;
638 desc->hw->src_addr = 0; 985 desc->hw->src_addr = 0;
639 desc->hw->dst_addr = 0; 986 desc->hw->dst_addr = 0;
640 desc->async_tx.ack = 1; 987 desc->async_tx.ack = 1;
641 988 switch (ioat_chan->device->version) {
642 list_add_tail(&desc->node, &ioat_chan->used_desc); 989 case IOAT_VER_1_2:
990 desc->hw->next = 0;
991 list_add_tail(&desc->node, &ioat_chan->used_desc);
992
993 writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF,
994 ioat_chan->reg_base + IOAT1_CHAINADDR_OFFSET_LOW);
995 writel(((u64) desc->async_tx.phys) >> 32,
996 ioat_chan->reg_base + IOAT1_CHAINADDR_OFFSET_HIGH);
997
998 writeb(IOAT_CHANCMD_START, ioat_chan->reg_base
999 + IOAT_CHANCMD_OFFSET(ioat_chan->device->version));
1000 break;
1001 case IOAT_VER_2_0:
1002 writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF,
1003 ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_LOW);
1004 writel(((u64) desc->async_tx.phys) >> 32,
1005 ioat_chan->reg_base + IOAT2_CHAINADDR_OFFSET_HIGH);
1006
1007 ioat_chan->dmacount++;
1008 __ioat2_dma_memcpy_issue_pending(ioat_chan);
1009 break;
1010 }
643 spin_unlock_bh(&ioat_chan->desc_lock); 1011 spin_unlock_bh(&ioat_chan->desc_lock);
644
645 writel(((u64) desc->async_tx.phys) & 0x00000000FFFFFFFF,
646 ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_LOW);
647 writel(((u64) desc->async_tx.phys) >> 32,
648 ioat_chan->reg_base + IOAT_CHAINADDR_OFFSET_HIGH);
649
650 writeb(IOAT_CHANCMD_START, ioat_chan->reg_base + IOAT_CHANCMD_OFFSET);
651} 1012}
652 1013
653/* 1014/*
@@ -693,14 +1054,14 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
693 dma_chan = container_of(device->common.channels.next, 1054 dma_chan = container_of(device->common.channels.next,
694 struct dma_chan, 1055 struct dma_chan,
695 device_node); 1056 device_node);
696 if (ioat_dma_alloc_chan_resources(dma_chan) < 1) { 1057 if (device->common.device_alloc_chan_resources(dma_chan) < 1) {
697 dev_err(&device->pdev->dev, 1058 dev_err(&device->pdev->dev,
698 "selftest cannot allocate chan resource\n"); 1059 "selftest cannot allocate chan resource\n");
699 err = -ENODEV; 1060 err = -ENODEV;
700 goto out; 1061 goto out;
701 } 1062 }
702 1063
703 tx = ioat_dma_prep_memcpy(dma_chan, IOAT_TEST_SIZE, 0); 1064 tx = device->common.device_prep_dma_memcpy(dma_chan, IOAT_TEST_SIZE, 0);
704 if (!tx) { 1065 if (!tx) {
705 dev_err(&device->pdev->dev, 1066 dev_err(&device->pdev->dev,
706 "Self-test prep failed, disabling\n"); 1067 "Self-test prep failed, disabling\n");
@@ -710,24 +1071,25 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
710 1071
711 async_tx_ack(tx); 1072 async_tx_ack(tx);
712 addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE, 1073 addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE,
713 DMA_TO_DEVICE); 1074 DMA_TO_DEVICE);
714 ioat_set_src(addr, tx, 0); 1075 tx->tx_set_src(addr, tx, 0);
715 addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, 1076 addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE,
716 DMA_FROM_DEVICE); 1077 DMA_FROM_DEVICE);
717 ioat_set_dest(addr, tx, 0); 1078 tx->tx_set_dest(addr, tx, 0);
718 tx->callback = ioat_dma_test_callback; 1079 tx->callback = ioat_dma_test_callback;
719 tx->callback_param = (void *)0x8086; 1080 tx->callback_param = (void *)0x8086;
720 cookie = ioat_tx_submit(tx); 1081 cookie = tx->tx_submit(tx);
721 if (cookie < 0) { 1082 if (cookie < 0) {
722 dev_err(&device->pdev->dev, 1083 dev_err(&device->pdev->dev,
723 "Self-test setup failed, disabling\n"); 1084 "Self-test setup failed, disabling\n");
724 err = -ENODEV; 1085 err = -ENODEV;
725 goto free_resources; 1086 goto free_resources;
726 } 1087 }
727 ioat_dma_memcpy_issue_pending(dma_chan); 1088 device->common.device_issue_pending(dma_chan);
728 msleep(1); 1089 msleep(1);
729 1090
730 if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { 1091 if (device->common.device_is_tx_complete(dma_chan, cookie, NULL, NULL)
1092 != DMA_SUCCESS) {
731 dev_err(&device->pdev->dev, 1093 dev_err(&device->pdev->dev,
732 "Self-test copy timed out, disabling\n"); 1094 "Self-test copy timed out, disabling\n");
733 err = -ENODEV; 1095 err = -ENODEV;
@@ -741,7 +1103,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
741 } 1103 }
742 1104
743free_resources: 1105free_resources:
744 ioat_dma_free_chan_resources(dma_chan); 1106 device->common.device_free_chan_resources(dma_chan);
745out: 1107out:
746 kfree(src); 1108 kfree(src);
747 kfree(dest); 1109 kfree(dest);
@@ -941,16 +1303,28 @@ struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev,
941 INIT_LIST_HEAD(&device->common.channels); 1303 INIT_LIST_HEAD(&device->common.channels);
942 ioat_dma_enumerate_channels(device); 1304 ioat_dma_enumerate_channels(device);
943 1305
944 dma_cap_set(DMA_MEMCPY, device->common.cap_mask);
945 device->common.device_alloc_chan_resources = 1306 device->common.device_alloc_chan_resources =
946 ioat_dma_alloc_chan_resources; 1307 ioat_dma_alloc_chan_resources;
947 device->common.device_free_chan_resources = 1308 device->common.device_free_chan_resources =
948 ioat_dma_free_chan_resources; 1309 ioat_dma_free_chan_resources;
949 device->common.device_prep_dma_memcpy = ioat_dma_prep_memcpy; 1310 device->common.dev = &pdev->dev;
1311
1312 dma_cap_set(DMA_MEMCPY, device->common.cap_mask);
950 device->common.device_is_tx_complete = ioat_dma_is_complete; 1313 device->common.device_is_tx_complete = ioat_dma_is_complete;
951 device->common.device_issue_pending = ioat_dma_memcpy_issue_pending;
952 device->common.device_dependency_added = ioat_dma_dependency_added; 1314 device->common.device_dependency_added = ioat_dma_dependency_added;
953 device->common.dev = &pdev->dev; 1315 switch (device->version) {
1316 case IOAT_VER_1_2:
1317 device->common.device_prep_dma_memcpy = ioat1_dma_prep_memcpy;
1318 device->common.device_issue_pending =
1319 ioat1_dma_memcpy_issue_pending;
1320 break;
1321 case IOAT_VER_2_0:
1322 device->common.device_prep_dma_memcpy = ioat2_dma_prep_memcpy;
1323 device->common.device_issue_pending =
1324 ioat2_dma_memcpy_issue_pending;
1325 break;
1326 }
1327
954 dev_err(&device->pdev->dev, 1328 dev_err(&device->pdev->dev,
955 "Intel(R) I/OAT DMA Engine found," 1329 "Intel(R) I/OAT DMA Engine found,"
956 " %d channels, device version 0x%02x, driver version %s\n", 1330 " %d channels, device version 0x%02x, driver version %s\n",
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h
index 5f9881e7b0ed..b668234ef654 100644
--- a/drivers/dma/ioatdma.h
+++ b/drivers/dma/ioatdma.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved. 2 * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free 5 * under the terms of the GNU General Public License as published by the Free
@@ -28,7 +28,7 @@
28#include <linux/cache.h> 28#include <linux/cache.h>
29#include <linux/pci_ids.h> 29#include <linux/pci_ids.h>
30 30
31#define IOAT_DMA_VERSION "1.26" 31#define IOAT_DMA_VERSION "2.04"
32 32
33enum ioat_interrupt { 33enum ioat_interrupt {
34 none = 0, 34 none = 0,
@@ -39,6 +39,8 @@ enum ioat_interrupt {
39}; 39};
40 40
41#define IOAT_LOW_COMPLETION_MASK 0xffffffc0 41#define IOAT_LOW_COMPLETION_MASK 0xffffffc0
42#define IOAT_DMA_DCA_ANY_CPU ~0
43
42 44
43/** 45/**
44 * struct ioatdma_device - internal representation of a IOAT device 46 * struct ioatdma_device - internal representation of a IOAT device
@@ -47,6 +49,9 @@ enum ioat_interrupt {
47 * @dma_pool: for allocating DMA descriptors 49 * @dma_pool: for allocating DMA descriptors
48 * @common: embedded struct dma_device 50 * @common: embedded struct dma_device
49 * @version: version of ioatdma device 51 * @version: version of ioatdma device
52 * @irq_mode: which style irq to use
53 * @msix_entries: irq handlers
54 * @idx: per channel data
50 */ 55 */
51 56
52struct ioatdma_device { 57struct ioatdma_device {
@@ -63,23 +68,7 @@ struct ioatdma_device {
63 68
64/** 69/**
65 * struct ioat_dma_chan - internal representation of a DMA channel 70 * struct ioat_dma_chan - internal representation of a DMA channel
66 * @device:
67 * @reg_base:
68 * @sw_in_use:
69 * @completion:
70 * @completion_low:
71 * @completion_high:
72 * @completed_cookie: last cookie seen completed on cleanup
73 * @cookie: value of last cookie given to client
74 * @last_completion:
75 * @xfercap:
76 * @desc_lock:
77 * @free_desc:
78 * @used_desc:
79 * @resource:
80 * @device_node:
81 */ 71 */
82
83struct ioat_dma_chan { 72struct ioat_dma_chan {
84 73
85 void __iomem *reg_base; 74 void __iomem *reg_base;
@@ -95,6 +84,8 @@ struct ioat_dma_chan {
95 struct list_head used_desc; 84 struct list_head used_desc;
96 85
97 int pending; 86 int pending;
87 int dmacount;
88 int desccount;
98 89
99 struct ioatdma_device *device; 90 struct ioatdma_device *device;
100 struct dma_chan common; 91 struct dma_chan common;
@@ -134,12 +125,13 @@ struct ioat_desc_sw {
134struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev, 125struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev,
135 void __iomem *iobase); 126 void __iomem *iobase);
136void ioat_dma_remove(struct ioatdma_device *device); 127void ioat_dma_remove(struct ioatdma_device *device);
137struct dca_provider *ioat_dca_init(struct pci_dev *pdev, 128struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase);
138 void __iomem *iobase); 129struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase);
139#else 130#else
140#define ioat_dma_probe(pdev, iobase) NULL 131#define ioat_dma_probe(pdev, iobase) NULL
141#define ioat_dma_remove(device) do { } while (0) 132#define ioat_dma_remove(device) do { } while (0)
142#define ioat_dca_init(pdev, iobase) NULL 133#define ioat_dca_init(pdev, iobase) NULL
134#define ioat2_dca_init(pdev, iobase) NULL
143#endif 135#endif
144 136
145#endif /* IOATDMA_H */ 137#endif /* IOATDMA_H */
diff --git a/drivers/dma/ioatdma_hw.h b/drivers/dma/ioatdma_hw.h
index 9e7434e1551f..dd470fa91d86 100644
--- a/drivers/dma/ioatdma_hw.h
+++ b/drivers/dma/ioatdma_hw.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved. 2 * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free 5 * under the terms of the GNU General Public License as published by the Free
@@ -22,12 +22,19 @@
22#define _IOAT_HW_H_ 22#define _IOAT_HW_H_
23 23
24/* PCI Configuration Space Values */ 24/* PCI Configuration Space Values */
25#define IOAT_PCI_VID 0x8086 25#define IOAT_PCI_VID 0x8086
26#define IOAT_PCI_DID 0x1A38 26
27#define IOAT_PCI_RID 0x00 27/* CB device ID's */
28#define IOAT_PCI_SVID 0x8086 28#define IOAT_PCI_DID_5000 0x1A38
29#define IOAT_PCI_SID 0x8086 29#define IOAT_PCI_DID_CNB 0x360B
30#define IOAT_VER_1_2 0x12 /* Version 1.2 */ 30#define IOAT_PCI_DID_SCNB 0x65FF
31#define IOAT_PCI_DID_SNB 0x402F
32
33#define IOAT_PCI_RID 0x00
34#define IOAT_PCI_SVID 0x8086
35#define IOAT_PCI_SID 0x8086
36#define IOAT_VER_1_2 0x12 /* Version 1.2 */
37#define IOAT_VER_2_0 0x20 /* Version 2.0 */
31 38
32struct ioat_dma_descriptor { 39struct ioat_dma_descriptor {
33 uint32_t size; 40 uint32_t size;
@@ -47,6 +54,16 @@ struct ioat_dma_descriptor {
47#define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008 54#define IOAT_DMA_DESCRIPTOR_CTL_CP_STS 0x00000008
48#define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010 55#define IOAT_DMA_DESCRIPTOR_CTL_FRAME 0x00000010
49#define IOAT_DMA_DESCRIPTOR_NUL 0x00000020 56#define IOAT_DMA_DESCRIPTOR_NUL 0x00000020
50#define IOAT_DMA_DESCRIPTOR_OPCODE 0xFF000000 57#define IOAT_DMA_DESCRIPTOR_CTL_SP_BRK 0x00000040
58#define IOAT_DMA_DESCRIPTOR_CTL_DP_BRK 0x00000080
59#define IOAT_DMA_DESCRIPTOR_CTL_BNDL 0x00000100
60#define IOAT_DMA_DESCRIPTOR_CTL_DCA 0x00000200
61#define IOAT_DMA_DESCRIPTOR_CTL_BUFHINT 0x00000400
62
63#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_CONTEXT 0xFF000000
64#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_DMA 0x00000000
65
66#define IOAT_DMA_DESCRIPTOR_CTL_CONTEXT_DCA 0x00000001
67#define IOAT_DMA_DESCRIPTOR_CTL_OPCODE_MASK 0xFF000000
51 68
52#endif 69#endif
diff --git a/drivers/dma/ioatdma_registers.h b/drivers/dma/ioatdma_registers.h
index baaab5ea146a..9832d7ebd931 100644
--- a/drivers/dma/ioatdma_registers.h
+++ b/drivers/dma/ioatdma_registers.h
@@ -42,26 +42,25 @@
42#define IOAT_INTRCTRL_MASTER_INT_EN 0x01 /* Master Interrupt Enable */ 42#define IOAT_INTRCTRL_MASTER_INT_EN 0x01 /* Master Interrupt Enable */
43#define IOAT_INTRCTRL_INT_STATUS 0x02 /* ATTNSTATUS -or- Channel Int */ 43#define IOAT_INTRCTRL_INT_STATUS 0x02 /* ATTNSTATUS -or- Channel Int */
44#define IOAT_INTRCTRL_INT 0x04 /* INT_STATUS -and- MASTER_INT_EN */ 44#define IOAT_INTRCTRL_INT 0x04 /* INT_STATUS -and- MASTER_INT_EN */
45#define IOAT_INTRCTRL_MSIX_VECTOR_CONTROL 0x08 /* Enable all MSI-X vectors */ 45#define IOAT_INTRCTRL_MSIX_VECTOR_CONTROL 0x08 /* Enable all MSI-X vectors */
46 46
47#define IOAT_ATTNSTATUS_OFFSET 0x04 /* Each bit is a channel */ 47#define IOAT_ATTNSTATUS_OFFSET 0x04 /* Each bit is a channel */
48 48
49#define IOAT_VER_OFFSET 0x08 /* 8-bit */ 49#define IOAT_VER_OFFSET 0x08 /* 8-bit */
50#define IOAT_VER_MAJOR_MASK 0xF0 50#define IOAT_VER_MAJOR_MASK 0xF0
51#define IOAT_VER_MINOR_MASK 0x0F 51#define IOAT_VER_MINOR_MASK 0x0F
52#define GET_IOAT_VER_MAJOR(x) ((x) & IOAT_VER_MAJOR_MASK) 52#define GET_IOAT_VER_MAJOR(x) (((x) & IOAT_VER_MAJOR_MASK) >> 4)
53#define GET_IOAT_VER_MINOR(x) ((x) & IOAT_VER_MINOR_MASK) 53#define GET_IOAT_VER_MINOR(x) ((x) & IOAT_VER_MINOR_MASK)
54 54
55#define IOAT_PERPORTOFFSET_OFFSET 0x0A /* 16-bit */ 55#define IOAT_PERPORTOFFSET_OFFSET 0x0A /* 16-bit */
56 56
57#define IOAT_INTRDELAY_OFFSET 0x0C /* 16-bit */ 57#define IOAT_INTRDELAY_OFFSET 0x0C /* 16-bit */
58#define IOAT_INTRDELAY_INT_DELAY_MASK 0x3FFF /* Interrupt Delay Time */ 58#define IOAT_INTRDELAY_INT_DELAY_MASK 0x3FFF /* Interrupt Delay Time */
59#define IOAT_INTRDELAY_COALESE_SUPPORT 0x8000 /* Interrupt Coalesing Supported */ 59#define IOAT_INTRDELAY_COALESE_SUPPORT 0x8000 /* Interrupt Coalescing Supported */
60 60
61#define IOAT_DEVICE_STATUS_OFFSET 0x0E /* 16-bit */ 61#define IOAT_DEVICE_STATUS_OFFSET 0x0E /* 16-bit */
62#define IOAT_DEVICE_STATUS_DEGRADED_MODE 0x0001 62#define IOAT_DEVICE_STATUS_DEGRADED_MODE 0x0001
63 63
64
65#define IOAT_CHANNEL_MMIO_SIZE 0x80 /* Each Channel MMIO space is this size */ 64#define IOAT_CHANNEL_MMIO_SIZE 0x80 /* Each Channel MMIO space is this size */
66 65
67/* DMA Channel Registers */ 66/* DMA Channel Registers */
@@ -74,25 +73,101 @@
74#define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 73#define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004
75#define IOAT_CHANCTRL_INT_DISABLE 0x0001 74#define IOAT_CHANCTRL_INT_DISABLE 0x0001
76 75
77#define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatability */ 76#define IOAT_DMA_COMP_OFFSET 0x02 /* 16-bit DMA channel compatibility */
78#define IOAT_DMA_COMP_V1 0x0001 /* Compatability with DMA version 1 */ 77#define IOAT_DMA_COMP_V1 0x0001 /* Compatibility with DMA version 1 */
79 78#define IOAT_DMA_COMP_V2 0x0002 /* Compatibility with DMA version 2 */
80#define IOAT_CHANSTS_OFFSET 0x04 /* 64-bit Channel Status Register */ 79
81#define IOAT_CHANSTS_OFFSET_LOW 0x04 80
82#define IOAT_CHANSTS_OFFSET_HIGH 0x08 81#define IOAT1_CHANSTS_OFFSET 0x04 /* 64-bit Channel Status Register */
83#define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR 0xFFFFFFFFFFFFFFC0UL 82#define IOAT2_CHANSTS_OFFSET 0x08 /* 64-bit Channel Status Register */
83#define IOAT_CHANSTS_OFFSET(ver) ((ver) < IOAT_VER_2_0 \
84 ? IOAT1_CHANSTS_OFFSET : IOAT2_CHANSTS_OFFSET)
85#define IOAT1_CHANSTS_OFFSET_LOW 0x04
86#define IOAT2_CHANSTS_OFFSET_LOW 0x08
87#define IOAT_CHANSTS_OFFSET_LOW(ver) ((ver) < IOAT_VER_2_0 \
88 ? IOAT1_CHANSTS_OFFSET_LOW : IOAT2_CHANSTS_OFFSET_LOW)
89#define IOAT1_CHANSTS_OFFSET_HIGH 0x08
90#define IOAT2_CHANSTS_OFFSET_HIGH 0x0C
91#define IOAT_CHANSTS_OFFSET_HIGH(ver) ((ver) < IOAT_VER_2_0 \
92 ? IOAT1_CHANSTS_OFFSET_HIGH : IOAT2_CHANSTS_OFFSET_HIGH)
93#define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR ~0x3F
84#define IOAT_CHANSTS_SOFT_ERR 0x0000000000000010 94#define IOAT_CHANSTS_SOFT_ERR 0x0000000000000010
95#define IOAT_CHANSTS_UNAFFILIATED_ERR 0x0000000000000008
85#define IOAT_CHANSTS_DMA_TRANSFER_STATUS 0x0000000000000007 96#define IOAT_CHANSTS_DMA_TRANSFER_STATUS 0x0000000000000007
86#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE 0x0 97#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_ACTIVE 0x0
87#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_DONE 0x1 98#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_DONE 0x1
88#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_SUSPENDED 0x2 99#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_SUSPENDED 0x2
89#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED 0x3 100#define IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED 0x3
90 101
91#define IOAT_CHAINADDR_OFFSET 0x0C /* 64-bit Descriptor Chain Address Register */
92#define IOAT_CHAINADDR_OFFSET_LOW 0x0C
93#define IOAT_CHAINADDR_OFFSET_HIGH 0x10
94 102
95#define IOAT_CHANCMD_OFFSET 0x14 /* 8-bit DMA Channel Command Register */ 103
104#define IOAT_CHAN_DMACOUNT_OFFSET 0x06 /* 16-bit DMA Count register */
105
106#define IOAT_DCACTRL_OFFSET 0x30 /* 32 bit Direct Cache Access Control Register */
107#define IOAT_DCACTRL_CMPL_WRITE_ENABLE 0x10000
108#define IOAT_DCACTRL_TARGET_CPU_MASK 0xFFFF /* APIC ID */
109
110/* CB DCA Memory Space Registers */
111#define IOAT_DCAOFFSET_OFFSET 0x14
112/* CB_BAR + IOAT_DCAOFFSET value */
113#define IOAT_DCA_VER_OFFSET 0x00
114#define IOAT_DCA_VER_MAJOR_MASK 0xF0
115#define IOAT_DCA_VER_MINOR_MASK 0x0F
116
117#define IOAT_DCA_COMP_OFFSET 0x02
118#define IOAT_DCA_COMP_V1 0x1
119
120#define IOAT_FSB_CAPABILITY_OFFSET 0x04
121#define IOAT_FSB_CAPABILITY_PREFETCH 0x1
122
123#define IOAT_PCI_CAPABILITY_OFFSET 0x06
124#define IOAT_PCI_CAPABILITY_MEMWR 0x1
125
126#define IOAT_FSB_CAP_ENABLE_OFFSET 0x08
127#define IOAT_FSB_CAP_ENABLE_PREFETCH 0x1
128
129#define IOAT_PCI_CAP_ENABLE_OFFSET 0x0A
130#define IOAT_PCI_CAP_ENABLE_MEMWR 0x1
131
132#define IOAT_APICID_TAG_MAP_OFFSET 0x0C
133#define IOAT_APICID_TAG_MAP_TAG0 0x0000000F
134#define IOAT_APICID_TAG_MAP_TAG0_SHIFT 0
135#define IOAT_APICID_TAG_MAP_TAG1 0x000000F0
136#define IOAT_APICID_TAG_MAP_TAG1_SHIFT 4
137#define IOAT_APICID_TAG_MAP_TAG2 0x00000F00
138#define IOAT_APICID_TAG_MAP_TAG2_SHIFT 8
139#define IOAT_APICID_TAG_MAP_TAG3 0x0000F000
140#define IOAT_APICID_TAG_MAP_TAG3_SHIFT 12
141#define IOAT_APICID_TAG_MAP_TAG4 0x000F0000
142#define IOAT_APICID_TAG_MAP_TAG4_SHIFT 16
143#define IOAT_APICID_TAG_CB2_VALID 0x8080808080
144
145#define IOAT_DCA_GREQID_OFFSET 0x10
146#define IOAT_DCA_GREQID_SIZE 0x04
147#define IOAT_DCA_GREQID_MASK 0xFFFF
148#define IOAT_DCA_GREQID_IGNOREFUN 0x10000000
149#define IOAT_DCA_GREQID_VALID 0x20000000
150#define IOAT_DCA_GREQID_LASTID 0x80000000
151
152
153
154#define IOAT1_CHAINADDR_OFFSET 0x0C /* 64-bit Descriptor Chain Address Register */
155#define IOAT2_CHAINADDR_OFFSET 0x10 /* 64-bit Descriptor Chain Address Register */
156#define IOAT_CHAINADDR_OFFSET(ver) ((ver) < IOAT_VER_2_0 \
157 ? IOAT1_CHAINADDR_OFFSET : IOAT2_CHAINADDR_OFFSET)
158#define IOAT1_CHAINADDR_OFFSET_LOW 0x0C
159#define IOAT2_CHAINADDR_OFFSET_LOW 0x10
160#define IOAT_CHAINADDR_OFFSET_LOW(ver) ((ver) < IOAT_VER_2_0 \
161 ? IOAT1_CHAINADDR_OFFSET_LOW : IOAT2_CHAINADDR_OFFSET_LOW)
162#define IOAT1_CHAINADDR_OFFSET_HIGH 0x10
163#define IOAT2_CHAINADDR_OFFSET_HIGH 0x14
164#define IOAT_CHAINADDR_OFFSET_HIGH(ver) ((ver) < IOAT_VER_2_0 \
165 ? IOAT1_CHAINADDR_OFFSET_HIGH : IOAT2_CHAINADDR_OFFSET_HIGH)
166
167#define IOAT1_CHANCMD_OFFSET 0x14 /* 8-bit DMA Channel Command Register */
168#define IOAT2_CHANCMD_OFFSET 0x04 /* 8-bit DMA Channel Command Register */
169#define IOAT_CHANCMD_OFFSET(ver) ((ver) < IOAT_VER_2_0 \
170 ? IOAT1_CHANCMD_OFFSET : IOAT2_CHANCMD_OFFSET)
96#define IOAT_CHANCMD_RESET 0x20 171#define IOAT_CHANCMD_RESET 0x20
97#define IOAT_CHANCMD_RESUME 0x10 172#define IOAT_CHANCMD_RESUME 0x10
98#define IOAT_CHANCMD_ABORT 0x08 173#define IOAT_CHANCMD_ABORT 0x08
@@ -124,6 +199,7 @@
124#define IOAT_CHANERR_COMPLETION_ADDR_ERR 0x1000 199#define IOAT_CHANERR_COMPLETION_ADDR_ERR 0x1000
125#define IOAT_CHANERR_INT_CONFIGURATION_ERR 0x2000 200#define IOAT_CHANERR_INT_CONFIGURATION_ERR 0x2000
126#define IOAT_CHANERR_SOFT_ERR 0x4000 201#define IOAT_CHANERR_SOFT_ERR 0x4000
202#define IOAT_CHANERR_UNAFFILIATED_ERR 0x8000
127 203
128#define IOAT_CHANERR_MASK_OFFSET 0x2C /* 32-bit Channel Error Register */ 204#define IOAT_CHANERR_MASK_OFFSET 0x2C /* 32-bit Channel Error Register */
129 205
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index 96f7e63e3996..a1f24c42d5ff 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1462,7 +1462,7 @@ MODULE_DEVICE_TABLE(pci, i5000_pci_tbl);
1462 * 1462 *
1463 */ 1463 */
1464static struct pci_driver i5000_driver = { 1464static struct pci_driver i5000_driver = {
1465 .name = __stringify(KBUILD_BASENAME), 1465 .name = KBUILD_BASENAME,
1466 .probe = i5000_init_one, 1466 .probe = i5000_init_one,
1467 .remove = __devexit_p(i5000_remove_one), 1467 .remove = __devexit_p(i5000_remove_one),
1468 .id_table = i5000_pci_tbl, 1468 .id_table = i5000_pci_tbl,
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/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 5596df65c8ed..624ff3e082f6 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -650,13 +650,14 @@ static void sbp2_login(struct work_struct *work)
650 if (sbp2_send_management_orb(lu, node_id, generation, 650 if (sbp2_send_management_orb(lu, node_id, generation,
651 SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) { 651 SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
652 if (lu->retries++ < 5) { 652 if (lu->retries++ < 5) {
653 queue_delayed_work(sbp2_wq, &lu->work, 653 if (queue_delayed_work(sbp2_wq, &lu->work,
654 DIV_ROUND_UP(HZ, 5)); 654 DIV_ROUND_UP(HZ, 5)))
655 kref_get(&lu->tgt->kref);
655 } else { 656 } else {
656 fw_error("failed to login to %s LUN %04x\n", 657 fw_error("failed to login to %s LUN %04x\n",
657 unit->device.bus_id, lu->lun); 658 unit->device.bus_id, lu->lun);
658 kref_put(&lu->tgt->kref, sbp2_release_target);
659 } 659 }
660 kref_put(&lu->tgt->kref, sbp2_release_target);
660 return; 661 return;
661 } 662 }
662 663
@@ -914,7 +915,9 @@ static void sbp2_reconnect(struct work_struct *work)
914 lu->retries = 0; 915 lu->retries = 0;
915 PREPARE_DELAYED_WORK(&lu->work, sbp2_login); 916 PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
916 } 917 }
917 queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5)); 918 if (queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5)))
919 kref_get(&lu->tgt->kref);
920 kref_put(&lu->tgt->kref, sbp2_release_target);
918 return; 921 return;
919 } 922 }
920 923
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/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 700a1657554f..a0445bea9f75 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -216,6 +216,16 @@ config SENSORS_DS1621
216 This driver can also be built as a module. If so, the module 216 This driver can also be built as a module. If so, the module
217 will be called ds1621. 217 will be called ds1621.
218 218
219config SENSORS_I5K_AMB
220 tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets"
221 depends on PCI && EXPERIMENTAL
222 help
223 If you say yes here you get support for FB-DIMM AMB temperature
224 monitoring chips on systems with the Intel 5000 series chipset.
225
226 This driver can also be built as a module. If so, the module
227 will be called i5k_amb.
228
219config SENSORS_F71805F 229config SENSORS_F71805F
220 tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG" 230 tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG"
221 depends on EXPERIMENTAL 231 depends on EXPERIMENTAL
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 6da3eef94306..55595f6e1aa6 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o
38obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o 38obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
39obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o 39obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o
40obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o 40obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o
41obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
41obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o 42obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o
42obj-$(CONFIG_SENSORS_IT87) += it87.o 43obj-$(CONFIG_SENSORS_IT87) += it87.o
43obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o 44obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index cb2331bfd9d5..d9f04ce90327 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -503,7 +503,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
503 { "AUX3 FAN", 36, 2, 60, 1, 0 }, 503 { "AUX3 FAN", 36, 2, 60, 1, 0 },
504 { NULL, 0, 0, 0, 0, 0 } } 504 { NULL, 0, 0, 0, 0, 0 } }
505 }, 505 },
506 { 0x001A, "unknown", { 506 { 0x001A, "Abit IP35 Pro", {
507 { "CPU Core", 0, 0, 10, 1, 0 }, 507 { "CPU Core", 0, 0, 10, 1, 0 },
508 { "DDR2", 1, 0, 20, 1, 0 }, 508 { "DDR2", 1, 0, 20, 1, 0 },
509 { "DDR2 VTT", 2, 0, 10, 1, 0 }, 509 { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -530,6 +530,60 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
530 { "AUX3 Fan", 36, 2, 60, 1, 0 }, 530 { "AUX3 Fan", 36, 2, 60, 1, 0 },
531 { NULL, 0, 0, 0, 0, 0 } } 531 { NULL, 0, 0, 0, 0, 0 } }
532 }, 532 },
533 { 0x001B, "unknown", {
534 { "CPU Core", 0, 0, 10, 1, 0 },
535 { "DDR3", 1, 0, 20, 1, 0 },
536 { "DDR3 VTT", 2, 0, 10, 1, 0 },
537 { "CPU VTT", 3, 0, 10, 1, 0 },
538 { "MCH 1.25V", 4, 0, 10, 1, 0 },
539 { "ICHIO 1.5V", 5, 0, 10, 1, 0 },
540 { "ICH 1.05V", 6, 0, 10, 1, 0 },
541 { "ATX +12V (24-Pin)", 7, 0, 60, 1, 0 },
542 { "ATX +12V (8-pin)", 8, 0, 60, 1, 0 },
543 { "ATX +5V", 9, 0, 30, 1, 0 },
544 { "+3.3V", 10, 0, 20, 1, 0 },
545 { "5VSB", 11, 0, 30, 1, 0 },
546 { "CPU", 24, 1, 1, 1, 0 },
547 { "System", 25, 1, 1, 1, 0 },
548 { "PWM Phase1", 26, 1, 1, 1, 0 },
549 { "PWM Phase2", 27, 1, 1, 1, 0 },
550 { "PWM Phase3", 28, 1, 1, 1, 0 },
551 { "PWM Phase4", 29, 1, 1, 1, 0 },
552 { "PWM Phase5", 30, 1, 1, 1, 0 },
553 { "CPU Fan", 32, 2, 60, 1, 0 },
554 { "SYS Fan", 34, 2, 60, 1, 0 },
555 { "AUX1 Fan", 33, 2, 60, 1, 0 },
556 { "AUX2 Fan", 35, 2, 60, 1, 0 },
557 { "AUX3 Fan", 36, 2, 60, 1, 0 },
558 { NULL, 0, 0, 0, 0, 0 } }
559 },
560 { 0x001C, "unknown", {
561 { "CPU Core", 0, 0, 10, 1, 0 },
562 { "DDR2", 1, 0, 20, 1, 0 },
563 { "DDR2 VTT", 2, 0, 10, 1, 0 },
564 { "CPU VTT", 3, 0, 10, 1, 0 },
565 { "MCH 1.25V", 4, 0, 10, 1, 0 },
566 { "ICHIO 1.5V", 5, 0, 10, 1, 0 },
567 { "ICH 1.05V", 6, 0, 10, 1, 0 },
568 { "ATX +12V (24-Pin)", 7, 0, 60, 1, 0 },
569 { "ATX +12V (8-pin)", 8, 0, 60, 1, 0 },
570 { "ATX +5V", 9, 0, 30, 1, 0 },
571 { "+3.3V", 10, 0, 20, 1, 0 },
572 { "5VSB", 11, 0, 30, 1, 0 },
573 { "CPU", 24, 1, 1, 1, 0 },
574 { "System", 25, 1, 1, 1, 0 },
575 { "PWM Phase1", 26, 1, 1, 1, 0 },
576 { "PWM Phase2", 27, 1, 1, 1, 0 },
577 { "PWM Phase3", 28, 1, 1, 1, 0 },
578 { "PWM Phase4", 29, 1, 1, 1, 0 },
579 { "PWM Phase5", 30, 1, 1, 1, 0 },
580 { "CPU Fan", 32, 2, 60, 1, 0 },
581 { "SYS Fan", 34, 2, 60, 1, 0 },
582 { "AUX1 Fan", 33, 2, 60, 1, 0 },
583 { "AUX2 Fan", 35, 2, 60, 1, 0 },
584 { "AUX3 Fan", 36, 2, 60, 1, 0 },
585 { NULL, 0, 0, 0, 0, 0 } }
586 },
533 { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } 587 { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } }
534}; 588};
535 589
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 1001d2e122a2..86c66c345f8b 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -80,7 +80,7 @@
80/* 80/*
81 * Temperature sensors keys (sp78 - 2 bytes). 81 * Temperature sensors keys (sp78 - 2 bytes).
82 */ 82 */
83static const char* temperature_sensors_sets[][13] = { 83static const char* temperature_sensors_sets[][36] = {
84/* Set 0: Macbook Pro */ 84/* Set 0: Macbook Pro */
85 { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", 85 { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
86 "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, 86 "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
@@ -88,7 +88,13 @@ static const char* temperature_sensors_sets[][13] = {
88 { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", 88 { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
89 "Th1H", "Ts0P", NULL }, 89 "Th1H", "Ts0P", NULL },
90/* Set 2: Macmini set */ 90/* Set 2: Macmini set */
91 { "TC0D", "TC0P", NULL } 91 { "TC0D", "TC0P", NULL },
92/* Set 3: Mac Pro (2 x Quad-Core) */
93 { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P",
94 "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P",
95 "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S",
96 "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P",
97 "TM9S", "TN0H", "TS0C", NULL },
92}; 98};
93 99
94/* List of keys used to read/write fan speeds */ 100/* List of keys used to read/write fan speeds */
@@ -990,14 +996,18 @@ static struct attribute *fan##offset##_attributes[] = { \
990 996
991/* 997/*
992 * Create the needed functions for each fan using the macro defined above 998 * Create the needed functions for each fan using the macro defined above
993 * (2 fans are supported) 999 * (4 fans are supported)
994 */ 1000 */
995sysfs_fan_speeds_offset(1); 1001sysfs_fan_speeds_offset(1);
996sysfs_fan_speeds_offset(2); 1002sysfs_fan_speeds_offset(2);
1003sysfs_fan_speeds_offset(3);
1004sysfs_fan_speeds_offset(4);
997 1005
998static const struct attribute_group fan_attribute_groups[] = { 1006static const struct attribute_group fan_attribute_groups[] = {
999 { .attrs = fan1_attributes }, 1007 { .attrs = fan1_attributes },
1000 { .attrs = fan2_attributes } 1008 { .attrs = fan2_attributes },
1009 { .attrs = fan3_attributes },
1010 { .attrs = fan4_attributes },
1001}; 1011};
1002 1012
1003/* 1013/*
@@ -1027,6 +1037,52 @@ static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO,
1027 applesmc_show_temperature, NULL, 10); 1037 applesmc_show_temperature, NULL, 10);
1028static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, 1038static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO,
1029 applesmc_show_temperature, NULL, 11); 1039 applesmc_show_temperature, NULL, 11);
1040static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO,
1041 applesmc_show_temperature, NULL, 12);
1042static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO,
1043 applesmc_show_temperature, NULL, 13);
1044static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO,
1045 applesmc_show_temperature, NULL, 14);
1046static SENSOR_DEVICE_ATTR(temp16_input, S_IRUGO,
1047 applesmc_show_temperature, NULL, 15);
1048static SENSOR_DEVICE_ATTR(temp17_input, S_IRUGO,
1049 applesmc_show_temperature, NULL, 16);
1050static SENSOR_DEVICE_ATTR(temp18_input, S_IRUGO,
1051 applesmc_show_temperature, NULL, 17);
1052static SENSOR_DEVICE_ATTR(temp19_input, S_IRUGO,
1053 applesmc_show_temperature, NULL, 18);
1054static SENSOR_DEVICE_ATTR(temp20_input, S_IRUGO,
1055 applesmc_show_temperature, NULL, 19);
1056static SENSOR_DEVICE_ATTR(temp21_input, S_IRUGO,
1057 applesmc_show_temperature, NULL, 20);
1058static SENSOR_DEVICE_ATTR(temp22_input, S_IRUGO,
1059 applesmc_show_temperature, NULL, 21);
1060static SENSOR_DEVICE_ATTR(temp23_input, S_IRUGO,
1061 applesmc_show_temperature, NULL, 22);
1062static SENSOR_DEVICE_ATTR(temp24_input, S_IRUGO,
1063 applesmc_show_temperature, NULL, 23);
1064static SENSOR_DEVICE_ATTR(temp25_input, S_IRUGO,
1065 applesmc_show_temperature, NULL, 24);
1066static SENSOR_DEVICE_ATTR(temp26_input, S_IRUGO,
1067 applesmc_show_temperature, NULL, 25);
1068static SENSOR_DEVICE_ATTR(temp27_input, S_IRUGO,
1069 applesmc_show_temperature, NULL, 26);
1070static SENSOR_DEVICE_ATTR(temp28_input, S_IRUGO,
1071 applesmc_show_temperature, NULL, 27);
1072static SENSOR_DEVICE_ATTR(temp29_input, S_IRUGO,
1073 applesmc_show_temperature, NULL, 28);
1074static SENSOR_DEVICE_ATTR(temp30_input, S_IRUGO,
1075 applesmc_show_temperature, NULL, 29);
1076static SENSOR_DEVICE_ATTR(temp31_input, S_IRUGO,
1077 applesmc_show_temperature, NULL, 30);
1078static SENSOR_DEVICE_ATTR(temp32_input, S_IRUGO,
1079 applesmc_show_temperature, NULL, 31);
1080static SENSOR_DEVICE_ATTR(temp33_input, S_IRUGO,
1081 applesmc_show_temperature, NULL, 32);
1082static SENSOR_DEVICE_ATTR(temp34_input, S_IRUGO,
1083 applesmc_show_temperature, NULL, 33);
1084static SENSOR_DEVICE_ATTR(temp35_input, S_IRUGO,
1085 applesmc_show_temperature, NULL, 34);
1030 1086
1031static struct attribute *temperature_attributes[] = { 1087static struct attribute *temperature_attributes[] = {
1032 &sensor_dev_attr_temp1_input.dev_attr.attr, 1088 &sensor_dev_attr_temp1_input.dev_attr.attr,
@@ -1041,6 +1097,29 @@ static struct attribute *temperature_attributes[] = {
1041 &sensor_dev_attr_temp10_input.dev_attr.attr, 1097 &sensor_dev_attr_temp10_input.dev_attr.attr,
1042 &sensor_dev_attr_temp11_input.dev_attr.attr, 1098 &sensor_dev_attr_temp11_input.dev_attr.attr,
1043 &sensor_dev_attr_temp12_input.dev_attr.attr, 1099 &sensor_dev_attr_temp12_input.dev_attr.attr,
1100 &sensor_dev_attr_temp13_input.dev_attr.attr,
1101 &sensor_dev_attr_temp14_input.dev_attr.attr,
1102 &sensor_dev_attr_temp15_input.dev_attr.attr,
1103 &sensor_dev_attr_temp16_input.dev_attr.attr,
1104 &sensor_dev_attr_temp17_input.dev_attr.attr,
1105 &sensor_dev_attr_temp18_input.dev_attr.attr,
1106 &sensor_dev_attr_temp19_input.dev_attr.attr,
1107 &sensor_dev_attr_temp20_input.dev_attr.attr,
1108 &sensor_dev_attr_temp21_input.dev_attr.attr,
1109 &sensor_dev_attr_temp22_input.dev_attr.attr,
1110 &sensor_dev_attr_temp23_input.dev_attr.attr,
1111 &sensor_dev_attr_temp24_input.dev_attr.attr,
1112 &sensor_dev_attr_temp25_input.dev_attr.attr,
1113 &sensor_dev_attr_temp26_input.dev_attr.attr,
1114 &sensor_dev_attr_temp27_input.dev_attr.attr,
1115 &sensor_dev_attr_temp28_input.dev_attr.attr,
1116 &sensor_dev_attr_temp29_input.dev_attr.attr,
1117 &sensor_dev_attr_temp30_input.dev_attr.attr,
1118 &sensor_dev_attr_temp31_input.dev_attr.attr,
1119 &sensor_dev_attr_temp32_input.dev_attr.attr,
1120 &sensor_dev_attr_temp33_input.dev_attr.attr,
1121 &sensor_dev_attr_temp34_input.dev_attr.attr,
1122 &sensor_dev_attr_temp35_input.dev_attr.attr,
1044 NULL 1123 NULL
1045}; 1124};
1046 1125
@@ -1137,6 +1216,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
1137 { .accelerometer = 1, .light = 0, .temperature_set = 1 }, 1216 { .accelerometer = 1, .light = 0, .temperature_set = 1 },
1138/* MacMini: temperature set 2 */ 1217/* MacMini: temperature set 2 */
1139 { .accelerometer = 0, .light = 0, .temperature_set = 2 }, 1218 { .accelerometer = 0, .light = 0, .temperature_set = 2 },
1219/* MacPro: temperature set 3 */
1220 { .accelerometer = 0, .light = 0, .temperature_set = 3 },
1140}; 1221};
1141 1222
1142/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". 1223/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
@@ -1154,6 +1235,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
1154 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1235 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1155 DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, 1236 DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") },
1156 (void*)&applesmc_dmi_data[2]}, 1237 (void*)&applesmc_dmi_data[2]},
1238 { applesmc_dmi_match, "Apple MacPro2", {
1239 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1240 DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
1241 (void*)&applesmc_dmi_data[3]},
1157 { .ident = NULL } 1242 { .ident = NULL }
1158}; 1243};
1159 1244
@@ -1204,9 +1289,19 @@ static int __init applesmc_init(void)
1204 1289
1205 switch (count) { 1290 switch (count) {
1206 default: 1291 default:
1207 printk(KERN_WARNING "applesmc: More than 2 fans found," 1292 printk(KERN_WARNING "applesmc: More than 4 fans found,"
1208 " but at most 2 fans are supported" 1293 " but at most 4 fans are supported"
1209 " by the driver.\n"); 1294 " by the driver.\n");
1295 case 4:
1296 ret = sysfs_create_group(&pdev->dev.kobj,
1297 &fan_attribute_groups[3]);
1298 if (ret)
1299 goto out_key_enumeration;
1300 case 3:
1301 ret = sysfs_create_group(&pdev->dev.kobj,
1302 &fan_attribute_groups[2]);
1303 if (ret)
1304 goto out_key_enumeration;
1210 case 2: 1305 case 2:
1211 ret = sysfs_create_group(&pdev->dev.kobj, 1306 ret = sysfs_create_group(&pdev->dev.kobj,
1212 &fan_attribute_groups[1]); 1307 &fan_attribute_groups[1]);
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 13a041326a04..6892f76fc18a 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -34,6 +34,7 @@
34#include <linux/i2c.h> 34#include <linux/i2c.h>
35#include <linux/err.h> 35#include <linux/err.h>
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/f75375s.h>
37 38
38/* Addresses to scan */ 39/* Addresses to scan */
39static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; 40static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END };
@@ -86,7 +87,7 @@ I2C_CLIENT_INSMOD_2(f75373, f75375);
86 87
87struct f75375_data { 88struct f75375_data {
88 unsigned short addr; 89 unsigned short addr;
89 struct i2c_client client; 90 struct i2c_client *client;
90 struct device *hwmon_dev; 91 struct device *hwmon_dev;
91 92
92 const char *name; 93 const char *name;
@@ -116,15 +117,25 @@ struct f75375_data {
116static int f75375_attach_adapter(struct i2c_adapter *adapter); 117static int f75375_attach_adapter(struct i2c_adapter *adapter);
117static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); 118static int f75375_detect(struct i2c_adapter *adapter, int address, int kind);
118static int f75375_detach_client(struct i2c_client *client); 119static int f75375_detach_client(struct i2c_client *client);
120static int f75375_probe(struct i2c_client *client);
121static int f75375_remove(struct i2c_client *client);
119 122
120static struct i2c_driver f75375_driver = { 123static struct i2c_driver f75375_legacy_driver = {
121 .driver = { 124 .driver = {
122 .name = "f75375", 125 .name = "f75375_legacy",
123 }, 126 },
124 .attach_adapter = f75375_attach_adapter, 127 .attach_adapter = f75375_attach_adapter,
125 .detach_client = f75375_detach_client, 128 .detach_client = f75375_detach_client,
126}; 129};
127 130
131static struct i2c_driver f75375_driver = {
132 .driver = {
133 .name = "f75375",
134 },
135 .probe = f75375_probe,
136 .remove = f75375_remove,
137};
138
128static inline int f75375_read8(struct i2c_client *client, u8 reg) 139static inline int f75375_read8(struct i2c_client *client, u8 reg)
129{ 140{
130 return i2c_smbus_read_byte_data(client, reg); 141 return i2c_smbus_read_byte_data(client, reg);
@@ -276,19 +287,14 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute
276 return sprintf(buf, "%d\n", data->pwm_enable[nr]); 287 return sprintf(buf, "%d\n", data->pwm_enable[nr]);
277} 288}
278 289
279static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, 290static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
280 const char *buf, size_t count)
281{ 291{
282 int nr = to_sensor_dev_attr(attr)->index;
283 struct i2c_client *client = to_i2c_client(dev);
284 struct f75375_data *data = i2c_get_clientdata(client); 292 struct f75375_data *data = i2c_get_clientdata(client);
285 int val = simple_strtoul(buf, NULL, 10);
286 u8 fanmode; 293 u8 fanmode;
287 294
288 if (val < 0 || val > 4) 295 if (val < 0 || val > 4)
289 return -EINVAL; 296 return -EINVAL;
290 297
291 mutex_lock(&data->update_lock);
292 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); 298 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER);
293 fanmode = ~(3 << FAN_CTRL_MODE(nr)); 299 fanmode = ~(3 << FAN_CTRL_MODE(nr));
294 300
@@ -310,8 +316,22 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
310 } 316 }
311 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); 317 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode);
312 data->pwm_enable[nr] = val; 318 data->pwm_enable[nr] = val;
319 return 0;
320}
321
322static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
323 const char *buf, size_t count)
324{
325 int nr = to_sensor_dev_attr(attr)->index;
326 struct i2c_client *client = to_i2c_client(dev);
327 struct f75375_data *data = i2c_get_clientdata(client);
328 int val = simple_strtoul(buf, NULL, 10);
329 int err = 0;
330
331 mutex_lock(&data->update_lock);
332 err = set_pwm_enable_direct(client, nr, val);
313 mutex_unlock(&data->update_lock); 333 mutex_unlock(&data->update_lock);
314 return count; 334 return err ? err : count;
315} 335}
316 336
317static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, 337static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
@@ -323,7 +343,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
323 int val = simple_strtoul(buf, NULL, 10); 343 int val = simple_strtoul(buf, NULL, 10);
324 u8 conf = 0; 344 u8 conf = 0;
325 345
326 if (val != 0 || val != 1 || data->kind == f75373) 346 if (!(val == 0 || val == 1))
327 return -EINVAL; 347 return -EINVAL;
328 348
329 mutex_lock(&data->update_lock); 349 mutex_lock(&data->update_lock);
@@ -529,13 +549,13 @@ static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO|S_IWUSR,
529 show_pwm, set_pwm, 0); 549 show_pwm, set_pwm, 0);
530static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR, 550static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR,
531 show_pwm_enable, set_pwm_enable, 0); 551 show_pwm_enable, set_pwm_enable, 0);
532static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO|S_IWUSR, 552static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO,
533 show_pwm_mode, set_pwm_mode, 0); 553 show_pwm_mode, set_pwm_mode, 0);
534static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, 554static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR,
535 show_pwm, set_pwm, 1); 555 show_pwm, set_pwm, 1);
536static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR, 556static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR,
537 show_pwm_enable, set_pwm_enable, 1); 557 show_pwm_enable, set_pwm_enable, 1);
538static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO|S_IWUSR, 558static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO,
539 show_pwm_mode, set_pwm_mode, 1); 559 show_pwm_mode, set_pwm_mode, 1);
540 560
541static struct attribute *f75375_attributes[] = { 561static struct attribute *f75375_attributes[] = {
@@ -580,12 +600,9 @@ static const struct attribute_group f75375_group = {
580 600
581static int f75375_detach_client(struct i2c_client *client) 601static int f75375_detach_client(struct i2c_client *client)
582{ 602{
583 struct f75375_data *data = i2c_get_clientdata(client);
584 int err; 603 int err;
585 604
586 hwmon_device_unregister(data->hwmon_dev); 605 f75375_remove(client);
587 sysfs_remove_group(&client->dev.kobj, &f75375_group);
588
589 err = i2c_detach_client(client); 606 err = i2c_detach_client(client);
590 if (err) { 607 if (err) {
591 dev_err(&client->dev, 608 dev_err(&client->dev,
@@ -593,7 +610,91 @@ static int f75375_detach_client(struct i2c_client *client)
593 "client not detached.\n"); 610 "client not detached.\n");
594 return err; 611 return err;
595 } 612 }
613 kfree(client);
614 return 0;
615}
616
617static void f75375_init(struct i2c_client *client, struct f75375_data *data,
618 struct f75375s_platform_data *f75375s_pdata)
619{
620 int nr;
621 set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]);
622 set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]);
623 for (nr = 0; nr < 2; nr++) {
624 data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255);
625 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
626 data->pwm[nr]);
627 }
628
629}
630
631static int f75375_probe(struct i2c_client *client)
632{
633 struct f75375_data *data = i2c_get_clientdata(client);
634 struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data;
635 int err;
636
637 if (!i2c_check_functionality(client->adapter,
638 I2C_FUNC_SMBUS_BYTE_DATA))
639 return -EIO;
640 if (!(data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL)))
641 return -ENOMEM;
642
643 i2c_set_clientdata(client, data);
644 data->client = client;
645 mutex_init(&data->update_lock);
646
647 if (strcmp(client->name, "f75375") == 0)
648 data->kind = f75375;
649 else if (strcmp(client->name, "f75373") == 0)
650 data->kind = f75373;
651 else {
652 dev_err(&client->dev, "Unsupported device: %s\n", client->name);
653 return -ENODEV;
654 }
655
656 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group)))
657 goto exit_free;
658
659 if (data->kind == f75375) {
660 err = sysfs_chmod_file(&client->dev.kobj,
661 &sensor_dev_attr_pwm1_mode.dev_attr.attr,
662 S_IRUGO | S_IWUSR);
663 if (err)
664 goto exit_remove;
665 err = sysfs_chmod_file(&client->dev.kobj,
666 &sensor_dev_attr_pwm2_mode.dev_attr.attr,
667 S_IRUGO | S_IWUSR);
668 if (err)
669 goto exit_remove;
670 }
671
672 data->hwmon_dev = hwmon_device_register(&client->dev);
673 if (IS_ERR(data->hwmon_dev)) {
674 err = PTR_ERR(data->hwmon_dev);
675 goto exit_remove;
676 }
677
678 if (f75375s_pdata != NULL)
679 f75375_init(client, data, f75375s_pdata);
680
681 return 0;
682
683exit_remove:
684 sysfs_remove_group(&client->dev.kobj, &f75375_group);
685exit_free:
596 kfree(data); 686 kfree(data);
687 i2c_set_clientdata(client, NULL);
688 return err;
689}
690
691static int f75375_remove(struct i2c_client *client)
692{
693 struct f75375_data *data = i2c_get_clientdata(client);
694 hwmon_device_unregister(data->hwmon_dev);
695 sysfs_remove_group(&client->dev.kobj, &f75375_group);
696 kfree(data);
697 i2c_set_clientdata(client, NULL);
597 return 0; 698 return 0;
598} 699}
599 700
@@ -608,20 +709,17 @@ static int f75375_attach_adapter(struct i2c_adapter *adapter)
608static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) 709static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
609{ 710{
610 struct i2c_client *client; 711 struct i2c_client *client;
611 struct f75375_data *data;
612 u8 version = 0; 712 u8 version = 0;
613 int err = 0; 713 int err = 0;
614 const char *name = ""; 714 const char *name = "";
615 715
616 if (!(data = kzalloc(sizeof(struct f75375_data), GFP_KERNEL))) { 716 if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) {
617 err = -ENOMEM; 717 err = -ENOMEM;
618 goto exit; 718 goto exit;
619 } 719 }
620 client = &data->client;
621 i2c_set_clientdata(client, data);
622 client->addr = address; 720 client->addr = address;
623 client->adapter = adapter; 721 client->adapter = adapter;
624 client->driver = &f75375_driver; 722 client->driver = &f75375_legacy_driver;
625 723
626 if (kind < 0) { 724 if (kind < 0) {
627 u16 vendid = f75375_read16(client, F75375_REG_VENDOR); 725 u16 vendid = f75375_read16(client, F75375_REG_VENDOR);
@@ -644,42 +742,42 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
644 } else if (kind == f75373) { 742 } else if (kind == f75373) {
645 name = "f75373"; 743 name = "f75373";
646 } 744 }
647
648 dev_info(&adapter->dev, "found %s version: %02X\n", name, version); 745 dev_info(&adapter->dev, "found %s version: %02X\n", name, version);
649 strlcpy(client->name, name, I2C_NAME_SIZE); 746 strlcpy(client->name, name, I2C_NAME_SIZE);
650 data->kind = kind; 747
651 mutex_init(&data->update_lock);
652 if ((err = i2c_attach_client(client))) 748 if ((err = i2c_attach_client(client)))
653 goto exit_free; 749 goto exit_free;
654 750
655 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) 751 if ((err = f75375_probe(client)) < 0)
656 goto exit_detach; 752 goto exit_detach;
657 753
658 data->hwmon_dev = hwmon_device_register(&client->dev);
659 if (IS_ERR(data->hwmon_dev)) {
660 err = PTR_ERR(data->hwmon_dev);
661 goto exit_remove;
662 }
663
664 return 0; 754 return 0;
665 755
666exit_remove:
667 sysfs_remove_group(&client->dev.kobj, &f75375_group);
668exit_detach: 756exit_detach:
669 i2c_detach_client(client); 757 i2c_detach_client(client);
670exit_free: 758exit_free:
671 kfree(data); 759 kfree(client);
672exit: 760exit:
673 return err; 761 return err;
674} 762}
675 763
676static int __init sensors_f75375_init(void) 764static int __init sensors_f75375_init(void)
677{ 765{
678 return i2c_add_driver(&f75375_driver); 766 int status;
767 status = i2c_add_driver(&f75375_driver);
768 if (status)
769 return status;
770
771 status = i2c_add_driver(&f75375_legacy_driver);
772 if (status)
773 i2c_del_driver(&f75375_driver);
774
775 return status;
679} 776}
680 777
681static void __exit sensors_f75375_exit(void) 778static void __exit sensors_f75375_exit(void)
682{ 779{
780 i2c_del_driver(&f75375_legacy_driver);
683 i2c_del_driver(&f75375_driver); 781 i2c_del_driver(&f75375_driver);
684} 782}
685 783
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
new file mode 100644
index 000000000000..6ac5c6f53585
--- /dev/null
+++ b/drivers/hwmon/i5k_amb.c
@@ -0,0 +1,552 @@
1/*
2 * A hwmon driver for the Intel 5000 series chipset FB-DIMM AMB
3 * temperature sensors
4 * Copyright (C) 2007 IBM
5 *
6 * Author: Darrick J. Wong <djwong@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/module.h>
24#include <linux/jiffies.h>
25#include <linux/hwmon.h>
26#include <linux/hwmon-sysfs.h>
27#include <linux/err.h>
28#include <linux/mutex.h>
29#include <linux/delay.h>
30#include <linux/log2.h>
31#include <linux/pci.h>
32#include <linux/platform_device.h>
33
34#define DRVNAME "i5k_amb"
35
36#define I5K_REG_AMB_BASE_ADDR 0x48
37#define I5K_REG_AMB_LEN_ADDR 0x50
38#define I5K_REG_CHAN0_PRESENCE_ADDR 0x64
39#define I5K_REG_CHAN1_PRESENCE_ADDR 0x66
40
41#define AMB_REG_TEMP_MIN_ADDR 0x80
42#define AMB_REG_TEMP_MID_ADDR 0x81
43#define AMB_REG_TEMP_MAX_ADDR 0x82
44#define AMB_REG_TEMP_STATUS_ADDR 0x84
45#define AMB_REG_TEMP_ADDR 0x85
46
47#define AMB_CONFIG_SIZE 2048
48#define AMB_FUNC_3_OFFSET 768
49
50static unsigned long amb_reg_temp_status(unsigned int amb)
51{
52 return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_STATUS_ADDR +
53 AMB_CONFIG_SIZE * amb;
54}
55
56static unsigned long amb_reg_temp_min(unsigned int amb)
57{
58 return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MIN_ADDR +
59 AMB_CONFIG_SIZE * amb;
60}
61
62static unsigned long amb_reg_temp_mid(unsigned int amb)
63{
64 return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MID_ADDR +
65 AMB_CONFIG_SIZE * amb;
66}
67
68static unsigned long amb_reg_temp_max(unsigned int amb)
69{
70 return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MAX_ADDR +
71 AMB_CONFIG_SIZE * amb;
72}
73
74static unsigned long amb_reg_temp(unsigned int amb)
75{
76 return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_ADDR +
77 AMB_CONFIG_SIZE * amb;
78}
79
80#define MAX_MEM_CHANNELS 4
81#define MAX_AMBS_PER_CHANNEL 16
82#define MAX_AMBS (MAX_MEM_CHANNELS * \
83 MAX_AMBS_PER_CHANNEL)
84/*
85 * Ugly hack: For some reason the highest bit is set if there
86 * are _any_ DIMMs in the channel. Attempting to read from
87 * this "high-order" AMB results in a memory bus error, so
88 * for now we'll just ignore that top bit, even though that
89 * might prevent us from seeing the 16th DIMM in the channel.
90 */
91#define REAL_MAX_AMBS_PER_CHANNEL 15
92#define KNOBS_PER_AMB 5
93
94static unsigned long amb_num_from_reg(unsigned int byte_num, unsigned int bit)
95{
96 return byte_num * MAX_AMBS_PER_CHANNEL + bit;
97}
98
99#define AMB_SYSFS_NAME_LEN 16
100struct i5k_device_attribute {
101 struct sensor_device_attribute s_attr;
102 char name[AMB_SYSFS_NAME_LEN];
103};
104
105struct i5k_amb_data {
106 struct device *hwmon_dev;
107
108 unsigned long amb_base;
109 unsigned long amb_len;
110 u16 amb_present[MAX_MEM_CHANNELS];
111 void __iomem *amb_mmio;
112 struct i5k_device_attribute *attrs;
113 unsigned int num_attrs;
114};
115
116static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
117 char *buf)
118{
119 return sprintf(buf, "%s\n", DRVNAME);
120}
121
122
123static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
124
125static struct platform_device *amb_pdev;
126
127static u8 amb_read_byte(struct i5k_amb_data *data, unsigned long offset)
128{
129 return ioread8(data->amb_mmio + offset);
130}
131
132static void amb_write_byte(struct i5k_amb_data *data, unsigned long offset,
133 u8 val)
134{
135 iowrite8(val, data->amb_mmio + offset);
136}
137
138static ssize_t show_amb_alarm(struct device *dev,
139 struct device_attribute *devattr,
140 char *buf)
141{
142 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
143 struct i5k_amb_data *data = dev_get_drvdata(dev);
144
145 if (!(amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x20) &&
146 (amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x8))
147 return sprintf(buf, "1\n");
148 else
149 return sprintf(buf, "0\n");
150}
151
152static ssize_t store_amb_min(struct device *dev,
153 struct device_attribute *devattr,
154 const char *buf,
155 size_t count)
156{
157 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
158 struct i5k_amb_data *data = dev_get_drvdata(dev);
159 unsigned long temp = simple_strtoul(buf, NULL, 10) / 500;
160
161 if (temp > 255)
162 temp = 255;
163
164 amb_write_byte(data, amb_reg_temp_min(attr->index), temp);
165 return count;
166}
167
168static ssize_t store_amb_mid(struct device *dev,
169 struct device_attribute *devattr,
170 const char *buf,
171 size_t count)
172{
173 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
174 struct i5k_amb_data *data = dev_get_drvdata(dev);
175 unsigned long temp = simple_strtoul(buf, NULL, 10) / 500;
176
177 if (temp > 255)
178 temp = 255;
179
180 amb_write_byte(data, amb_reg_temp_mid(attr->index), temp);
181 return count;
182}
183
184static ssize_t store_amb_max(struct device *dev,
185 struct device_attribute *devattr,
186 const char *buf,
187 size_t count)
188{
189 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
190 struct i5k_amb_data *data = dev_get_drvdata(dev);
191 unsigned long temp = simple_strtoul(buf, NULL, 10) / 500;
192
193 if (temp > 255)
194 temp = 255;
195
196 amb_write_byte(data, amb_reg_temp_max(attr->index), temp);
197 return count;
198}
199
200static ssize_t show_amb_min(struct device *dev,
201 struct device_attribute *devattr,
202 char *buf)
203{
204 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
205 struct i5k_amb_data *data = dev_get_drvdata(dev);
206 return sprintf(buf, "%d\n",
207 500 * amb_read_byte(data, amb_reg_temp_min(attr->index)));
208}
209
210static ssize_t show_amb_mid(struct device *dev,
211 struct device_attribute *devattr,
212 char *buf)
213{
214 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
215 struct i5k_amb_data *data = dev_get_drvdata(dev);
216 return sprintf(buf, "%d\n",
217 500 * amb_read_byte(data, amb_reg_temp_mid(attr->index)));
218}
219
220static ssize_t show_amb_max(struct device *dev,
221 struct device_attribute *devattr,
222 char *buf)
223{
224 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
225 struct i5k_amb_data *data = dev_get_drvdata(dev);
226 return sprintf(buf, "%d\n",
227 500 * amb_read_byte(data, amb_reg_temp_max(attr->index)));
228}
229
230static ssize_t show_amb_temp(struct device *dev,
231 struct device_attribute *devattr,
232 char *buf)
233{
234 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
235 struct i5k_amb_data *data = dev_get_drvdata(dev);
236 return sprintf(buf, "%d\n",
237 500 * amb_read_byte(data, amb_reg_temp(attr->index)));
238}
239
240static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
241{
242 int i, j, k, d = 0;
243 u16 c;
244 int res = 0;
245 int num_ambs = 0;
246 struct i5k_amb_data *data = platform_get_drvdata(pdev);
247
248 /* Count the number of AMBs found */
249 /* ignore the high-order bit, see "Ugly hack" comment above */
250 for (i = 0; i < MAX_MEM_CHANNELS; i++)
251 num_ambs += hweight16(data->amb_present[i] & 0x7fff);
252
253 /* Set up sysfs stuff */
254 data->attrs = kzalloc(sizeof(*data->attrs) * num_ambs * KNOBS_PER_AMB,
255 GFP_KERNEL);
256 if (!data->attrs)
257 return -ENOMEM;
258 data->num_attrs = 0;
259
260 for (i = 0; i < MAX_MEM_CHANNELS; i++) {
261 c = data->amb_present[i];
262 for (j = 0; j < REAL_MAX_AMBS_PER_CHANNEL; j++, c >>= 1) {
263 struct i5k_device_attribute *iattr;
264
265 k = amb_num_from_reg(i, j);
266 if (!(c & 0x1))
267 continue;
268 d++;
269
270 /* Temperature sysfs knob */
271 iattr = data->attrs + data->num_attrs;
272 snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
273 "temp%d_input", d);
274 iattr->s_attr.dev_attr.attr.name = iattr->name;
275 iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
276 iattr->s_attr.dev_attr.show = show_amb_temp;
277 iattr->s_attr.index = k;
278 res = device_create_file(&pdev->dev,
279 &iattr->s_attr.dev_attr);
280 if (res)
281 goto exit_remove;
282 data->num_attrs++;
283
284 /* Temperature min sysfs knob */
285 iattr = data->attrs + data->num_attrs;
286 snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
287 "temp%d_min", d);
288 iattr->s_attr.dev_attr.attr.name = iattr->name;
289 iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
290 iattr->s_attr.dev_attr.show = show_amb_min;
291 iattr->s_attr.dev_attr.store = store_amb_min;
292 iattr->s_attr.index = k;
293 res = device_create_file(&pdev->dev,
294 &iattr->s_attr.dev_attr);
295 if (res)
296 goto exit_remove;
297 data->num_attrs++;
298
299 /* Temperature mid sysfs knob */
300 iattr = data->attrs + data->num_attrs;
301 snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
302 "temp%d_mid", d);
303 iattr->s_attr.dev_attr.attr.name = iattr->name;
304 iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
305 iattr->s_attr.dev_attr.show = show_amb_mid;
306 iattr->s_attr.dev_attr.store = store_amb_mid;
307 iattr->s_attr.index = k;
308 res = device_create_file(&pdev->dev,
309 &iattr->s_attr.dev_attr);
310 if (res)
311 goto exit_remove;
312 data->num_attrs++;
313
314 /* Temperature max sysfs knob */
315 iattr = data->attrs + data->num_attrs;
316 snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
317 "temp%d_max", d);
318 iattr->s_attr.dev_attr.attr.name = iattr->name;
319 iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
320 iattr->s_attr.dev_attr.show = show_amb_max;
321 iattr->s_attr.dev_attr.store = store_amb_max;
322 iattr->s_attr.index = k;
323 res = device_create_file(&pdev->dev,
324 &iattr->s_attr.dev_attr);
325 if (res)
326 goto exit_remove;
327 data->num_attrs++;
328
329 /* Temperature alarm sysfs knob */
330 iattr = data->attrs + data->num_attrs;
331 snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
332 "temp%d_alarm", d);
333 iattr->s_attr.dev_attr.attr.name = iattr->name;
334 iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
335 iattr->s_attr.dev_attr.show = show_amb_alarm;
336 iattr->s_attr.index = k;
337 res = device_create_file(&pdev->dev,
338 &iattr->s_attr.dev_attr);
339 if (res)
340 goto exit_remove;
341 data->num_attrs++;
342 }
343 }
344
345 res = device_create_file(&pdev->dev, &dev_attr_name);
346 if (res)
347 goto exit_remove;
348
349 data->hwmon_dev = hwmon_device_register(&pdev->dev);
350 if (IS_ERR(data->hwmon_dev)) {
351 res = PTR_ERR(data->hwmon_dev);
352 goto exit_remove;
353 }
354
355 return res;
356
357exit_remove:
358 device_remove_file(&pdev->dev, &dev_attr_name);
359 for (i = 0; i < data->num_attrs; i++)
360 device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr);
361 kfree(data->attrs);
362
363 return res;
364}
365
366static int __devinit i5k_amb_add(void)
367{
368 int res = -ENODEV;
369
370 /* only ever going to be one of these */
371 amb_pdev = platform_device_alloc(DRVNAME, 0);
372 if (!amb_pdev)
373 return -ENOMEM;
374
375 res = platform_device_add(amb_pdev);
376 if (res)
377 goto err;
378 return 0;
379
380err:
381 platform_device_put(amb_pdev);
382 return res;
383}
384
385static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data)
386{
387 struct pci_dev *pcidev;
388 u32 val32;
389 int res = -ENODEV;
390
391 /* Find AMB register memory space */
392 pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
393 PCI_DEVICE_ID_INTEL_5000_ERR,
394 NULL);
395 if (!pcidev)
396 return -ENODEV;
397
398 if (pci_read_config_dword(pcidev, I5K_REG_AMB_BASE_ADDR, &val32))
399 goto out;
400 data->amb_base = val32;
401
402 if (pci_read_config_dword(pcidev, I5K_REG_AMB_LEN_ADDR, &val32))
403 goto out;
404 data->amb_len = val32;
405
406 /* Is it big enough? */
407 if (data->amb_len < AMB_CONFIG_SIZE * MAX_AMBS) {
408 dev_err(&pcidev->dev, "AMB region too small!\n");
409 goto out;
410 }
411
412 res = 0;
413out:
414 pci_dev_put(pcidev);
415 return res;
416}
417
418static int __devinit i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
419{
420 struct pci_dev *pcidev;
421 u16 val16;
422 int res = -ENODEV;
423
424 /* Copy the DIMM presence map for these two channels */
425 pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL);
426 if (!pcidev)
427 return -ENODEV;
428
429 if (pci_read_config_word(pcidev, I5K_REG_CHAN0_PRESENCE_ADDR, &val16))
430 goto out;
431 amb_present[0] = val16;
432
433 if (pci_read_config_word(pcidev, I5K_REG_CHAN1_PRESENCE_ADDR, &val16))
434 goto out;
435 amb_present[1] = val16;
436
437 res = 0;
438
439out:
440 pci_dev_put(pcidev);
441 return res;
442}
443
444static int __devinit i5k_amb_probe(struct platform_device *pdev)
445{
446 struct i5k_amb_data *data;
447 struct resource *reso;
448 int res = -ENODEV;
449
450 data = kzalloc(sizeof(*data), GFP_KERNEL);
451 if (!data)
452 return -ENOMEM;
453
454 /* Figure out where the AMB registers live */
455 res = i5k_find_amb_registers(data);
456 if (res)
457 goto err;
458
459 /* Copy the DIMM presence map for the first two channels */
460 res = i5k_channel_probe(&data->amb_present[0],
461 PCI_DEVICE_ID_INTEL_5000_FBD0);
462 if (res)
463 goto err;
464
465 /* Copy the DIMM presence map for the optional second two channels */
466 i5k_channel_probe(&data->amb_present[2],
467 PCI_DEVICE_ID_INTEL_5000_FBD1);
468
469 /* Set up resource regions */
470 reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);
471 if (!reso) {
472 res = -EBUSY;
473 goto err;
474 }
475
476 data->amb_mmio = ioremap_nocache(data->amb_base, data->amb_len);
477 if (!data->amb_mmio) {
478 res = -EBUSY;
479 goto err_map_failed;
480 }
481
482 platform_set_drvdata(pdev, data);
483
484 res = i5k_amb_hwmon_init(pdev);
485 if (res)
486 goto err_init_failed;
487
488 return res;
489
490err_init_failed:
491 iounmap(data->amb_mmio);
492 platform_set_drvdata(pdev, NULL);
493err_map_failed:
494 release_mem_region(data->amb_base, data->amb_len);
495err:
496 kfree(data);
497 return res;
498}
499
500static int __devexit i5k_amb_remove(struct platform_device *pdev)
501{
502 int i;
503 struct i5k_amb_data *data = platform_get_drvdata(pdev);
504
505 hwmon_device_unregister(data->hwmon_dev);
506 device_remove_file(&pdev->dev, &dev_attr_name);
507 for (i = 0; i < data->num_attrs; i++)
508 device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr);
509 kfree(data->attrs);
510 iounmap(data->amb_mmio);
511 release_mem_region(data->amb_base, data->amb_len);
512 platform_set_drvdata(pdev, NULL);
513 kfree(data);
514 return 0;
515}
516
517static struct platform_driver i5k_amb_driver = {
518 .driver = {
519 .owner = THIS_MODULE,
520 .name = DRVNAME,
521 },
522 .probe = i5k_amb_probe,
523 .remove = __devexit_p(i5k_amb_remove),
524};
525
526static int __init i5k_amb_init(void)
527{
528 int res;
529
530 res = platform_driver_register(&i5k_amb_driver);
531 if (res)
532 return res;
533
534 res = i5k_amb_add();
535 if (res)
536 platform_driver_unregister(&i5k_amb_driver);
537
538 return res;
539}
540
541static void __exit i5k_amb_exit(void)
542{
543 platform_device_unregister(amb_pdev);
544 platform_driver_unregister(&i5k_amb_driver);
545}
546
547MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
548MODULE_DESCRIPTION("Intel 5000 chipset FB-DIMM AMB temperature sensor");
549MODULE_LICENSE("GPL");
550
551module_init(i5k_amb_init);
552module_exit(i5k_amb_exit);
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c
index c462824ffccf..9c9cdb0685e4 100644
--- a/drivers/hwmon/ibmpex.c
+++ b/drivers/hwmon/ibmpex.c
@@ -140,10 +140,10 @@ static int ibmpex_send_message(struct ibmpex_bmc_data *data)
140 140
141 return 0; 141 return 0;
142out1: 142out1:
143 printk(KERN_ERR "%s: request_settime=%x\n", __FUNCTION__, err); 143 dev_err(data->bmc_device, "request_settime=%x\n", err);
144 return err; 144 return err;
145out: 145out:
146 printk(KERN_ERR "%s: validate_addr=%x\n", __FUNCTION__, err); 146 dev_err(data->bmc_device, "validate_addr=%x\n", err);
147 return err; 147 return err;
148} 148}
149 149
@@ -161,14 +161,14 @@ static int ibmpex_ver_check(struct ibmpex_bmc_data *data)
161 data->sensor_major = data->rx_msg_data[0]; 161 data->sensor_major = data->rx_msg_data[0];
162 data->sensor_minor = data->rx_msg_data[1]; 162 data->sensor_minor = data->rx_msg_data[1];
163 163
164 printk(KERN_INFO DRVNAME ": Found BMC with sensor interface " 164 dev_info(data->bmc_device, "Found BMC with sensor interface "
165 "v%d.%d %d-%02d-%02d on interface %d\n", 165 "v%d.%d %d-%02d-%02d on interface %d\n",
166 data->sensor_major, 166 data->sensor_major,
167 data->sensor_minor, 167 data->sensor_minor,
168 extract_value(data->rx_msg_data, 2), 168 extract_value(data->rx_msg_data, 2),
169 data->rx_msg_data[4], 169 data->rx_msg_data[4],
170 data->rx_msg_data[5], 170 data->rx_msg_data[5],
171 data->interface); 171 data->interface);
172 172
173 return 0; 173 return 0;
174} 174}
@@ -212,8 +212,8 @@ static int ibmpex_query_sensor_data(struct ibmpex_bmc_data *data, int sensor)
212 wait_for_completion(&data->read_complete); 212 wait_for_completion(&data->read_complete);
213 213
214 if (data->rx_result || data->rx_msg_len < 26) { 214 if (data->rx_result || data->rx_msg_len < 26) {
215 printk(KERN_ERR "Error reading sensor %d, please check.\n", 215 dev_err(data->bmc_device, "Error reading sensor %d.\n",
216 sensor); 216 sensor);
217 return -ENOENT; 217 return -ENOENT;
218 } 218 }
219 219
@@ -456,8 +456,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev)
456 456
457 data = kzalloc(sizeof(*data), GFP_KERNEL); 457 data = kzalloc(sizeof(*data), GFP_KERNEL);
458 if (!data) { 458 if (!data) {
459 printk(KERN_ERR DRVNAME ": Insufficient memory for BMC " 459 dev_err(dev, "Insufficient memory for BMC interface.\n");
460 "interface %d.\n", data->interface);
461 return; 460 return;
462 } 461 }
463 462
@@ -471,9 +470,8 @@ static void ibmpex_register_bmc(int iface, struct device *dev)
471 err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs, 470 err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs,
472 data, &data->user); 471 data, &data->user);
473 if (err < 0) { 472 if (err < 0) {
474 printk(KERN_ERR DRVNAME ": Error, unable to register user with " 473 dev_err(dev, "Unable to register user with IPMI "
475 "ipmi interface %d\n", 474 "interface %d\n", data->interface);
476 data->interface);
477 goto out; 475 goto out;
478 } 476 }
479 477
@@ -495,9 +493,9 @@ static void ibmpex_register_bmc(int iface, struct device *dev)
495 data->hwmon_dev = hwmon_device_register(data->bmc_device); 493 data->hwmon_dev = hwmon_device_register(data->bmc_device);
496 494
497 if (IS_ERR(data->hwmon_dev)) { 495 if (IS_ERR(data->hwmon_dev)) {
498 printk(KERN_ERR DRVNAME ": Error, unable to register hwmon " 496 dev_err(data->bmc_device, "Unable to register hwmon "
499 "class device for interface %d\n", 497 "device for IPMI interface %d\n",
500 data->interface); 498 data->interface);
501 goto out_user; 499 goto out_user;
502 } 500 }
503 501
@@ -508,7 +506,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev)
508 /* Now go find all the sensors */ 506 /* Now go find all the sensors */
509 err = ibmpex_find_sensors(data); 507 err = ibmpex_find_sensors(data);
510 if (err) { 508 if (err) {
511 printk(KERN_ERR "Error %d allocating memory\n", err); 509 dev_err(data->bmc_device, "Error %d finding sensors\n", err);
512 goto out_register; 510 goto out_register;
513 } 511 }
514 512
@@ -561,10 +559,10 @@ static void ibmpex_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data)
561 struct ibmpex_bmc_data *data = (struct ibmpex_bmc_data *)user_msg_data; 559 struct ibmpex_bmc_data *data = (struct ibmpex_bmc_data *)user_msg_data;
562 560
563 if (msg->msgid != data->tx_msgid) { 561 if (msg->msgid != data->tx_msgid) {
564 printk(KERN_ERR "Received msgid (%02x) and transmitted " 562 dev_err(data->bmc_device, "Mismatch between received msgid "
565 "msgid (%02x) mismatch!\n", 563 "(%02x) and transmitted msgid (%02x)!\n",
566 (int)msg->msgid, 564 (int)msg->msgid,
567 (int)data->tx_msgid); 565 (int)data->tx_msgid);
568 ipmi_free_recv_msg(msg); 566 ipmi_free_recv_msg(msg);
569 return; 567 return;
570 } 568 }
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index dd366889ce9b..d435f003292d 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -31,14 +31,15 @@
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/sysfs.h> 32#include <linux/sysfs.h>
33#include <linux/hwmon.h> 33#include <linux/hwmon.h>
34#include <linux/mutex.h>
34#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
35#include <asm/semaphore.h> 36
36 37
37#define DRVNAME "lm70" 38#define DRVNAME "lm70"
38 39
39struct lm70 { 40struct lm70 {
40 struct device *hwmon_dev; 41 struct device *hwmon_dev;
41 struct semaphore sem; 42 struct mutex lock;
42}; 43};
43 44
44/* sysfs hook function */ 45/* sysfs hook function */
@@ -51,7 +52,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
51 s16 raw=0; 52 s16 raw=0;
52 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); 53 struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
53 54
54 if (down_interruptible(&p_lm70->sem)) 55 if (mutex_lock_interruptible(&p_lm70->lock))
55 return -ERESTARTSYS; 56 return -ERESTARTSYS;
56 57
57 /* 58 /*
@@ -83,7 +84,7 @@ static ssize_t lm70_sense_temp(struct device *dev,
83 val = ((int)raw/32) * 250; 84 val = ((int)raw/32) * 250;
84 status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ 85 status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */
85out: 86out:
86 up(&p_lm70->sem); 87 mutex_unlock(&p_lm70->lock);
87 return status; 88 return status;
88} 89}
89 90
@@ -112,7 +113,7 @@ static int __devinit lm70_probe(struct spi_device *spi)
112 if (!p_lm70) 113 if (!p_lm70)
113 return -ENOMEM; 114 return -ENOMEM;
114 115
115 init_MUTEX(&p_lm70->sem); 116 mutex_init(&p_lm70->lock);
116 117
117 /* sysfs hook */ 118 /* sysfs hook */
118 p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); 119 p_lm70->hwmon_dev = hwmon_device_register(&spi->dev);
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 7e2d9787babc..a276806f3d53 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -435,6 +435,22 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
435} 435}
436static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 436static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
437 437
438static ssize_t show_alarm(struct device *dev, struct device_attribute *da,
439 char *buf)
440{
441 struct sis5595_data *data = sis5595_update_device(dev);
442 int nr = to_sensor_dev_attr(da)->index;
443 return sprintf(buf, "%u\n", (data->alarms >> nr) & 1);
444}
445static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0);
446static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1);
447static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2);
448static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3);
449static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 15);
450static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6);
451static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7);
452static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 15);
453
438static ssize_t show_name(struct device *dev, struct device_attribute *attr, 454static ssize_t show_name(struct device *dev, struct device_attribute *attr,
439 char *buf) 455 char *buf)
440{ 456{
@@ -447,22 +463,28 @@ static struct attribute *sis5595_attributes[] = {
447 &sensor_dev_attr_in0_input.dev_attr.attr, 463 &sensor_dev_attr_in0_input.dev_attr.attr,
448 &sensor_dev_attr_in0_min.dev_attr.attr, 464 &sensor_dev_attr_in0_min.dev_attr.attr,
449 &sensor_dev_attr_in0_max.dev_attr.attr, 465 &sensor_dev_attr_in0_max.dev_attr.attr,
466 &sensor_dev_attr_in0_alarm.dev_attr.attr,
450 &sensor_dev_attr_in1_input.dev_attr.attr, 467 &sensor_dev_attr_in1_input.dev_attr.attr,
451 &sensor_dev_attr_in1_min.dev_attr.attr, 468 &sensor_dev_attr_in1_min.dev_attr.attr,
452 &sensor_dev_attr_in1_max.dev_attr.attr, 469 &sensor_dev_attr_in1_max.dev_attr.attr,
470 &sensor_dev_attr_in1_alarm.dev_attr.attr,
453 &sensor_dev_attr_in2_input.dev_attr.attr, 471 &sensor_dev_attr_in2_input.dev_attr.attr,
454 &sensor_dev_attr_in2_min.dev_attr.attr, 472 &sensor_dev_attr_in2_min.dev_attr.attr,
455 &sensor_dev_attr_in2_max.dev_attr.attr, 473 &sensor_dev_attr_in2_max.dev_attr.attr,
474 &sensor_dev_attr_in2_alarm.dev_attr.attr,
456 &sensor_dev_attr_in3_input.dev_attr.attr, 475 &sensor_dev_attr_in3_input.dev_attr.attr,
457 &sensor_dev_attr_in3_min.dev_attr.attr, 476 &sensor_dev_attr_in3_min.dev_attr.attr,
458 &sensor_dev_attr_in3_max.dev_attr.attr, 477 &sensor_dev_attr_in3_max.dev_attr.attr,
478 &sensor_dev_attr_in3_alarm.dev_attr.attr,
459 479
460 &sensor_dev_attr_fan1_input.dev_attr.attr, 480 &sensor_dev_attr_fan1_input.dev_attr.attr,
461 &sensor_dev_attr_fan1_min.dev_attr.attr, 481 &sensor_dev_attr_fan1_min.dev_attr.attr,
462 &sensor_dev_attr_fan1_div.dev_attr.attr, 482 &sensor_dev_attr_fan1_div.dev_attr.attr,
483 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
463 &sensor_dev_attr_fan2_input.dev_attr.attr, 484 &sensor_dev_attr_fan2_input.dev_attr.attr,
464 &sensor_dev_attr_fan2_min.dev_attr.attr, 485 &sensor_dev_attr_fan2_min.dev_attr.attr,
465 &sensor_dev_attr_fan2_div.dev_attr.attr, 486 &sensor_dev_attr_fan2_div.dev_attr.attr,
487 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
466 488
467 &dev_attr_alarms.attr, 489 &dev_attr_alarms.attr,
468 &dev_attr_name.attr, 490 &dev_attr_name.attr,
@@ -473,19 +495,28 @@ static const struct attribute_group sis5595_group = {
473 .attrs = sis5595_attributes, 495 .attrs = sis5595_attributes,
474}; 496};
475 497
476static struct attribute *sis5595_attributes_opt[] = { 498static struct attribute *sis5595_attributes_in4[] = {
477 &sensor_dev_attr_in4_input.dev_attr.attr, 499 &sensor_dev_attr_in4_input.dev_attr.attr,
478 &sensor_dev_attr_in4_min.dev_attr.attr, 500 &sensor_dev_attr_in4_min.dev_attr.attr,
479 &sensor_dev_attr_in4_max.dev_attr.attr, 501 &sensor_dev_attr_in4_max.dev_attr.attr,
502 &sensor_dev_attr_in4_alarm.dev_attr.attr,
503 NULL
504};
505
506static const struct attribute_group sis5595_group_in4 = {
507 .attrs = sis5595_attributes_in4,
508};
480 509
510static struct attribute *sis5595_attributes_temp1[] = {
481 &dev_attr_temp1_input.attr, 511 &dev_attr_temp1_input.attr,
482 &dev_attr_temp1_max.attr, 512 &dev_attr_temp1_max.attr,
483 &dev_attr_temp1_max_hyst.attr, 513 &dev_attr_temp1_max_hyst.attr,
514 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
484 NULL 515 NULL
485}; 516};
486 517
487static const struct attribute_group sis5595_group_opt = { 518static const struct attribute_group sis5595_group_temp1 = {
488 .attrs = sis5595_attributes_opt, 519 .attrs = sis5595_attributes_temp1,
489}; 520};
490 521
491/* This is called when the module is loaded */ 522/* This is called when the module is loaded */
@@ -540,20 +571,12 @@ static int __devinit sis5595_probe(struct platform_device *pdev)
540 if ((err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group))) 571 if ((err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group)))
541 goto exit_free; 572 goto exit_free;
542 if (data->maxins == 4) { 573 if (data->maxins == 4) {
543 if ((err = device_create_file(&pdev->dev, 574 if ((err = sysfs_create_group(&pdev->dev.kobj,
544 &sensor_dev_attr_in4_input.dev_attr)) 575 &sis5595_group_in4)))
545 || (err = device_create_file(&pdev->dev,
546 &sensor_dev_attr_in4_min.dev_attr))
547 || (err = device_create_file(&pdev->dev,
548 &sensor_dev_attr_in4_max.dev_attr)))
549 goto exit_remove_files; 576 goto exit_remove_files;
550 } else { 577 } else {
551 if ((err = device_create_file(&pdev->dev, 578 if ((err = sysfs_create_group(&pdev->dev.kobj,
552 &dev_attr_temp1_input)) 579 &sis5595_group_temp1)))
553 || (err = device_create_file(&pdev->dev,
554 &dev_attr_temp1_max))
555 || (err = device_create_file(&pdev->dev,
556 &dev_attr_temp1_max_hyst)))
557 goto exit_remove_files; 580 goto exit_remove_files;
558 } 581 }
559 582
@@ -567,7 +590,8 @@ static int __devinit sis5595_probe(struct platform_device *pdev)
567 590
568exit_remove_files: 591exit_remove_files:
569 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); 592 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group);
570 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_opt); 593 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4);
594 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1);
571exit_free: 595exit_free:
572 kfree(data); 596 kfree(data);
573exit_release: 597exit_release:
@@ -582,7 +606,8 @@ static int __devexit sis5595_remove(struct platform_device *pdev)
582 606
583 hwmon_device_unregister(data->hwmon_dev); 607 hwmon_device_unregister(data->hwmon_dev);
584 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); 608 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group);
585 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_opt); 609 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4);
610 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1);
586 611
587 release_region(data->addr, SIS5595_EXTENT); 612 release_region(data->addr, SIS5595_EXTENT);
588 platform_set_drvdata(pdev, NULL); 613 platform_set_drvdata(pdev, NULL);
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index 20ae425a1980..879d0a6544cc 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -170,20 +170,16 @@ superio_exit(void)
170#define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \ 170#define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \
171 (0x550 + (nr) - 7)) 171 (0x550 + (nr) - 7))
172 172
173#define W83781D_REG_FAN_MIN(nr) (0x3a + (nr)) 173/* nr:0-2 for fans:1-3 */
174#define W83781D_REG_FAN(nr) (0x27 + (nr)) 174#define W83627HF_REG_FAN_MIN(nr) (0x3b + (nr))
175 175#define W83627HF_REG_FAN(nr) (0x28 + (nr))
176#define W83781D_REG_TEMP2_CONFIG 0x152 176
177#define W83781D_REG_TEMP3_CONFIG 0x252 177#define W83627HF_REG_TEMP2_CONFIG 0x152
178#define W83781D_REG_TEMP(nr) ((nr == 3) ? (0x0250) : \ 178#define W83627HF_REG_TEMP3_CONFIG 0x252
179 ((nr == 2) ? (0x0150) : \ 179/* these are zero-based, unlike config constants above */
180 (0x27))) 180static const u16 w83627hf_reg_temp[] = { 0x27, 0x150, 0x250 };
181#define W83781D_REG_TEMP_HYST(nr) ((nr == 3) ? (0x253) : \ 181static const u16 w83627hf_reg_temp_hyst[] = { 0x3A, 0x153, 0x253 };
182 ((nr == 2) ? (0x153) : \ 182static const u16 w83627hf_reg_temp_over[] = { 0x39, 0x155, 0x255 };
183 (0x3A)))
184#define W83781D_REG_TEMP_OVER(nr) ((nr == 3) ? (0x255) : \
185 ((nr == 2) ? (0x155) : \
186 (0x39)))
187 183
188#define W83781D_REG_BANK 0x4E 184#define W83781D_REG_BANK 0x4E
189 185
@@ -360,12 +356,9 @@ struct w83627hf_data {
360 u8 in_min[9]; /* Register value */ 356 u8 in_min[9]; /* Register value */
361 u8 fan[3]; /* Register value */ 357 u8 fan[3]; /* Register value */
362 u8 fan_min[3]; /* Register value */ 358 u8 fan_min[3]; /* Register value */
363 u8 temp; 359 u16 temp[3]; /* Register value */
364 u8 temp_max; /* Register value */ 360 u16 temp_max[3]; /* Register value */
365 u8 temp_max_hyst; /* Register value */ 361 u16 temp_max_hyst[3]; /* Register value */
366 u16 temp_add[2]; /* Register value */
367 u16 temp_max_add[2]; /* Register value */
368 u16 temp_max_hyst_add[2]; /* Register value */
369 u8 fan_div[3]; /* Register encoding, shifted right */ 362 u8 fan_div[3]; /* Register encoding, shifted right */
370 u8 vid; /* Register encoding, combined */ 363 u8 vid; /* Register encoding, combined */
371 u32 alarms; /* Register encoding, combined */ 364 u32 alarms; /* Register encoding, combined */
@@ -590,7 +583,7 @@ store_fan_min(struct device *dev, struct device_attribute *devattr,
590 583
591 mutex_lock(&data->update_lock); 584 mutex_lock(&data->update_lock);
592 data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); 585 data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
593 w83627hf_write_value(data, W83781D_REG_FAN_MIN(nr+1), 586 w83627hf_write_value(data, W83627HF_REG_FAN_MIN(nr),
594 data->fan_min[nr]); 587 data->fan_min[nr]);
595 588
596 mutex_unlock(&data->update_lock); 589 mutex_unlock(&data->update_lock);
@@ -611,12 +604,10 @@ show_temp(struct device *dev, struct device_attribute *devattr, char *buf)
611{ 604{
612 int nr = to_sensor_dev_attr(devattr)->index; 605 int nr = to_sensor_dev_attr(devattr)->index;
613 struct w83627hf_data *data = w83627hf_update_device(dev); 606 struct w83627hf_data *data = w83627hf_update_device(dev);
614 if (nr >= 2) { /* TEMP2 and TEMP3 */ 607
615 return sprintf(buf, "%ld\n", 608 u16 tmp = data->temp[nr];
616 (long)LM75_TEMP_FROM_REG(data->temp_add[nr-2])); 609 return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp)
617 } else { /* TEMP1 */ 610 : (long) TEMP_FROM_REG(tmp));
618 return sprintf(buf, "%ld\n", (long)TEMP_FROM_REG(data->temp));
619 }
620} 611}
621 612
622static ssize_t 613static ssize_t
@@ -625,13 +616,10 @@ show_temp_max(struct device *dev, struct device_attribute *devattr,
625{ 616{
626 int nr = to_sensor_dev_attr(devattr)->index; 617 int nr = to_sensor_dev_attr(devattr)->index;
627 struct w83627hf_data *data = w83627hf_update_device(dev); 618 struct w83627hf_data *data = w83627hf_update_device(dev);
628 if (nr >= 2) { /* TEMP2 and TEMP3 */ 619
629 return sprintf(buf, "%ld\n", 620 u16 tmp = data->temp_max[nr];
630 (long)LM75_TEMP_FROM_REG(data->temp_max_add[nr-2])); 621 return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp)
631 } else { /* TEMP1 */ 622 : (long) TEMP_FROM_REG(tmp));
632 return sprintf(buf, "%ld\n",
633 (long)TEMP_FROM_REG(data->temp_max));
634 }
635} 623}
636 624
637static ssize_t 625static ssize_t
@@ -640,13 +628,10 @@ show_temp_max_hyst(struct device *dev, struct device_attribute *devattr,
640{ 628{
641 int nr = to_sensor_dev_attr(devattr)->index; 629 int nr = to_sensor_dev_attr(devattr)->index;
642 struct w83627hf_data *data = w83627hf_update_device(dev); 630 struct w83627hf_data *data = w83627hf_update_device(dev);
643 if (nr >= 2) { /* TEMP2 and TEMP3 */ 631
644 return sprintf(buf, "%ld\n", 632 u16 tmp = data->temp_max_hyst[nr];
645 (long)LM75_TEMP_FROM_REG(data->temp_max_hyst_add[nr-2])); 633 return sprintf(buf, "%ld\n", (nr) ? (long) LM75_TEMP_FROM_REG(tmp)
646 } else { /* TEMP1 */ 634 : (long) TEMP_FROM_REG(tmp));
647 return sprintf(buf, "%ld\n",
648 (long)TEMP_FROM_REG(data->temp_max_hyst));
649 }
650} 635}
651 636
652static ssize_t 637static ssize_t
@@ -656,18 +641,11 @@ store_temp_max(struct device *dev, struct device_attribute *devattr,
656 int nr = to_sensor_dev_attr(devattr)->index; 641 int nr = to_sensor_dev_attr(devattr)->index;
657 struct w83627hf_data *data = dev_get_drvdata(dev); 642 struct w83627hf_data *data = dev_get_drvdata(dev);
658 long val = simple_strtol(buf, NULL, 10); 643 long val = simple_strtol(buf, NULL, 10);
644 u16 tmp = (nr) ? LM75_TEMP_TO_REG(val) : TEMP_TO_REG(val);
659 645
660 mutex_lock(&data->update_lock); 646 mutex_lock(&data->update_lock);
661 647 data->temp_max[nr] = tmp;
662 if (nr >= 2) { /* TEMP2 and TEMP3 */ 648 w83627hf_write_value(data, w83627hf_reg_temp_over[nr], tmp);
663 data->temp_max_add[nr-2] = LM75_TEMP_TO_REG(val);
664 w83627hf_write_value(data, W83781D_REG_TEMP_OVER(nr),
665 data->temp_max_add[nr-2]);
666 } else { /* TEMP1 */
667 data->temp_max = TEMP_TO_REG(val);
668 w83627hf_write_value(data, W83781D_REG_TEMP_OVER(nr),
669 data->temp_max);
670 }
671 mutex_unlock(&data->update_lock); 649 mutex_unlock(&data->update_lock);
672 return count; 650 return count;
673} 651}
@@ -679,29 +657,22 @@ store_temp_max_hyst(struct device *dev, struct device_attribute *devattr,
679 int nr = to_sensor_dev_attr(devattr)->index; 657 int nr = to_sensor_dev_attr(devattr)->index;
680 struct w83627hf_data *data = dev_get_drvdata(dev); 658 struct w83627hf_data *data = dev_get_drvdata(dev);
681 long val = simple_strtol(buf, NULL, 10); 659 long val = simple_strtol(buf, NULL, 10);
660 u16 tmp = (nr) ? LM75_TEMP_TO_REG(val) : TEMP_TO_REG(val);
682 661
683 mutex_lock(&data->update_lock); 662 mutex_lock(&data->update_lock);
684 663 data->temp_max_hyst[nr] = tmp;
685 if (nr >= 2) { /* TEMP2 and TEMP3 */ 664 w83627hf_write_value(data, w83627hf_reg_temp_hyst[nr], tmp);
686 data->temp_max_hyst_add[nr-2] = LM75_TEMP_TO_REG(val);
687 w83627hf_write_value(data, W83781D_REG_TEMP_HYST(nr),
688 data->temp_max_hyst_add[nr-2]);
689 } else { /* TEMP1 */
690 data->temp_max_hyst = TEMP_TO_REG(val);
691 w83627hf_write_value(data, W83781D_REG_TEMP_HYST(nr),
692 data->temp_max_hyst);
693 }
694 mutex_unlock(&data->update_lock); 665 mutex_unlock(&data->update_lock);
695 return count; 666 return count;
696} 667}
697 668
698#define sysfs_temp_decl(offset) \ 669#define sysfs_temp_decl(offset) \
699static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ 670static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
700 show_temp, NULL, offset); \ 671 show_temp, NULL, offset - 1); \
701static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO|S_IWUSR, \ 672static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO|S_IWUSR, \
702 show_temp_max, store_temp_max, offset); \ 673 show_temp_max, store_temp_max, offset - 1); \
703static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO|S_IWUSR, \ 674static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO|S_IWUSR, \
704 show_temp_max_hyst, store_temp_max_hyst, offset); 675 show_temp_max_hyst, store_temp_max_hyst, offset - 1);
705 676
706sysfs_temp_decl(1); 677sysfs_temp_decl(1);
707sysfs_temp_decl(2); 678sysfs_temp_decl(2);
@@ -844,7 +815,7 @@ store_fan_div(struct device *dev, struct device_attribute *devattr,
844 815
845 /* Restore fan_min */ 816 /* Restore fan_min */
846 data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); 817 data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
847 w83627hf_write_value(data, W83781D_REG_FAN_MIN(nr+1), data->fan_min[nr]); 818 w83627hf_write_value(data, W83627HF_REG_FAN_MIN(nr), data->fan_min[nr]);
848 819
849 mutex_unlock(&data->update_lock); 820 mutex_unlock(&data->update_lock);
850 return count; 821 return count;
@@ -1170,7 +1141,7 @@ static int __devinit w83627hf_probe(struct platform_device *pdev)
1170 struct w83627hf_sio_data *sio_data = dev->platform_data; 1141 struct w83627hf_sio_data *sio_data = dev->platform_data;
1171 struct w83627hf_data *data; 1142 struct w83627hf_data *data;
1172 struct resource *res; 1143 struct resource *res;
1173 int err; 1144 int err, i;
1174 1145
1175 static const char *names[] = { 1146 static const char *names[] = {
1176 "w83627hf", 1147 "w83627hf",
@@ -1204,9 +1175,9 @@ static int __devinit w83627hf_probe(struct platform_device *pdev)
1204 w83627hf_init_device(pdev); 1175 w83627hf_init_device(pdev);
1205 1176
1206 /* A few vars need to be filled upon startup */ 1177 /* A few vars need to be filled upon startup */
1207 data->fan_min[0] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(1)); 1178 for (i = 0; i <= 2; i++)
1208 data->fan_min[1] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(2)); 1179 data->fan_min[i] = w83627hf_read_value(
1209 data->fan_min[2] = w83627hf_read_value(data, W83781D_REG_FAN_MIN(3)); 1180 data, W83627HF_REG_FAN_MIN(i));
1210 w83627hf_update_fan_div(data); 1181 w83627hf_update_fan_div(data);
1211 1182
1212 /* Register common device attributes */ 1183 /* Register common device attributes */
@@ -1514,23 +1485,23 @@ static void __devinit w83627hf_init_device(struct platform_device *pdev)
1514 1485
1515 if(init) { 1486 if(init) {
1516 /* Enable temp2 */ 1487 /* Enable temp2 */
1517 tmp = w83627hf_read_value(data, W83781D_REG_TEMP2_CONFIG); 1488 tmp = w83627hf_read_value(data, W83627HF_REG_TEMP2_CONFIG);
1518 if (tmp & 0x01) { 1489 if (tmp & 0x01) {
1519 dev_warn(&pdev->dev, "Enabling temp2, readings " 1490 dev_warn(&pdev->dev, "Enabling temp2, readings "
1520 "might not make sense\n"); 1491 "might not make sense\n");
1521 w83627hf_write_value(data, W83781D_REG_TEMP2_CONFIG, 1492 w83627hf_write_value(data, W83627HF_REG_TEMP2_CONFIG,
1522 tmp & 0xfe); 1493 tmp & 0xfe);
1523 } 1494 }
1524 1495
1525 /* Enable temp3 */ 1496 /* Enable temp3 */
1526 if (type != w83697hf) { 1497 if (type != w83697hf) {
1527 tmp = w83627hf_read_value(data, 1498 tmp = w83627hf_read_value(data,
1528 W83781D_REG_TEMP3_CONFIG); 1499 W83627HF_REG_TEMP3_CONFIG);
1529 if (tmp & 0x01) { 1500 if (tmp & 0x01) {
1530 dev_warn(&pdev->dev, "Enabling temp3, " 1501 dev_warn(&pdev->dev, "Enabling temp3, "
1531 "readings might not make sense\n"); 1502 "readings might not make sense\n");
1532 w83627hf_write_value(data, 1503 w83627hf_write_value(data,
1533 W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); 1504 W83627HF_REG_TEMP3_CONFIG, tmp & 0xfe);
1534 } 1505 }
1535 } 1506 }
1536 } 1507 }
@@ -1563,7 +1534,7 @@ static void w83627hf_update_fan_div(struct w83627hf_data *data)
1563static struct w83627hf_data *w83627hf_update_device(struct device *dev) 1534static struct w83627hf_data *w83627hf_update_device(struct device *dev)
1564{ 1535{
1565 struct w83627hf_data *data = dev_get_drvdata(dev); 1536 struct w83627hf_data *data = dev_get_drvdata(dev);
1566 int i; 1537 int i, num_temps = (data->type == w83697hf) ? 2 : 3;
1567 1538
1568 mutex_lock(&data->update_lock); 1539 mutex_lock(&data->update_lock);
1569 1540
@@ -1584,12 +1555,12 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)
1584 w83627hf_read_value(data, 1555 w83627hf_read_value(data,
1585 W83781D_REG_IN_MAX(i)); 1556 W83781D_REG_IN_MAX(i));
1586 } 1557 }
1587 for (i = 1; i <= 3; i++) { 1558 for (i = 0; i <= 2; i++) {
1588 data->fan[i - 1] = 1559 data->fan[i] =
1589 w83627hf_read_value(data, W83781D_REG_FAN(i)); 1560 w83627hf_read_value(data, W83627HF_REG_FAN(i));
1590 data->fan_min[i - 1] = 1561 data->fan_min[i] =
1591 w83627hf_read_value(data, 1562 w83627hf_read_value(data,
1592 W83781D_REG_FAN_MIN(i)); 1563 W83627HF_REG_FAN_MIN(i));
1593 } 1564 }
1594 for (i = 0; i <= 2; i++) { 1565 for (i = 0; i <= 2; i++) {
1595 u8 tmp = w83627hf_read_value(data, 1566 u8 tmp = w83627hf_read_value(data,
@@ -1616,25 +1587,13 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)
1616 break; 1587 break;
1617 } 1588 }
1618 } 1589 }
1619 1590 for (i = 0; i < num_temps; i++) {
1620 data->temp = w83627hf_read_value(data, W83781D_REG_TEMP(1)); 1591 data->temp[i] = w83627hf_read_value(
1621 data->temp_max = 1592 data, w83627hf_reg_temp[i]);
1622 w83627hf_read_value(data, W83781D_REG_TEMP_OVER(1)); 1593 data->temp_max[i] = w83627hf_read_value(
1623 data->temp_max_hyst = 1594 data, w83627hf_reg_temp_over[i]);
1624 w83627hf_read_value(data, W83781D_REG_TEMP_HYST(1)); 1595 data->temp_max_hyst[i] = w83627hf_read_value(
1625 data->temp_add[0] = 1596 data, w83627hf_reg_temp_hyst[i]);
1626 w83627hf_read_value(data, W83781D_REG_TEMP(2));
1627 data->temp_max_add[0] =
1628 w83627hf_read_value(data, W83781D_REG_TEMP_OVER(2));
1629 data->temp_max_hyst_add[0] =
1630 w83627hf_read_value(data, W83781D_REG_TEMP_HYST(2));
1631 if (data->type != w83697hf) {
1632 data->temp_add[1] =
1633 w83627hf_read_value(data, W83781D_REG_TEMP(3));
1634 data->temp_max_add[1] =
1635 w83627hf_read_value(data, W83781D_REG_TEMP_OVER(3));
1636 data->temp_max_hyst_add[1] =
1637 w83627hf_read_value(data, W83781D_REG_TEMP_HYST(3));
1638 } 1597 }
1639 1598
1640 w83627hf_update_fan_div(data); 1599 w83627hf_update_fan_div(data);
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index a6a1edfe7614..e0fa7520400d 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1122,12 +1122,13 @@ w83781d_create_files(struct device *dev, int kind, int is_isa)
1122 &sensor_dev_attr_temp3_beep.dev_attr))) 1122 &sensor_dev_attr_temp3_beep.dev_attr)))
1123 return err; 1123 return err;
1124 1124
1125 if (kind != w83781d) 1125 if (kind != w83781d) {
1126 err = sysfs_chmod_file(&dev->kobj, 1126 err = sysfs_chmod_file(&dev->kobj,
1127 &sensor_dev_attr_temp3_alarm.dev_attr.attr, 1127 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
1128 S_IRUGO | S_IWUSR); 1128 S_IRUGO | S_IWUSR);
1129 if (err) 1129 if (err)
1130 return err; 1130 return err;
1131 }
1131 } 1132 }
1132 1133
1133 if (kind != w83781d && kind != as99127f) { 1134 if (kind != w83781d && kind != as99127f) {
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index 58e32714afb5..ca18e0be4901 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -51,6 +51,7 @@ struct pasemi_smbus {
51#define MRXFIFO_DATA_M 0x000000ff 51#define MRXFIFO_DATA_M 0x000000ff
52 52
53#define SMSTA_XEN 0x08000000 53#define SMSTA_XEN 0x08000000
54#define SMSTA_MTN 0x00200000
54 55
55#define CTL_MRR 0x00000400 56#define CTL_MRR 0x00000400
56#define CTL_MTR 0x00000200 57#define CTL_MTR 0x00000200
@@ -98,6 +99,10 @@ static unsigned int pasemi_smb_waitready(struct pasemi_smbus *smbus)
98 status = reg_read(smbus, REG_SMSTA); 99 status = reg_read(smbus, REG_SMSTA);
99 } 100 }
100 101
102 /* Got NACK? */
103 if (status & SMSTA_MTN)
104 return -ENXIO;
105
101 if (timeout < 0) { 106 if (timeout < 0) {
102 dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status); 107 dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status);
103 reg_write(smbus, REG_SMSTA, status); 108 reg_write(smbus, REG_SMSTA, status);
@@ -364,7 +369,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev,
364 smbus->adapter.algo = &smbus_algorithm; 369 smbus->adapter.algo = &smbus_algorithm;
365 smbus->adapter.algo_data = smbus; 370 smbus->adapter.algo_data = smbus;
366 371
367 /* set up the driverfs linkage to our parent device */ 372 /* set up the sysfs linkage to our parent device */
368 smbus->adapter.dev.parent = &dev->dev; 373 smbus->adapter.dev.parent = &dev->dev;
369 374
370 reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | 375 reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
index d3da1fb05b9b..1a7eeebac506 100644
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -128,13 +128,20 @@ static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr,
128 for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++) 128 for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++)
129 eeprom_update_client(client, slice); 129 eeprom_update_client(client, slice);
130 130
131 /* Hide Vaio security settings to regular users (16 first bytes) */ 131 /* Hide Vaio private settings to regular users:
132 if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) { 132 - BIOS passwords: bytes 0x00 to 0x0f
133 size_t in_row1 = 16 - off; 133 - UUID: bytes 0x10 to 0x1f
134 in_row1 = min(in_row1, count); 134 - Serial number: 0xc0 to 0xdf */
135 memset(buf, 0, in_row1); 135 if (data->nature == VAIO && !capable(CAP_SYS_ADMIN)) {
136 if (count - in_row1 > 0) 136 int i;
137 memcpy(buf + in_row1, &data->data[16], count - in_row1); 137
138 for (i = 0; i < count; i++) {
139 if ((off + i <= 0x1f) ||
140 (off + i >= 0xc0 && off + i <= 0xdf))
141 buf[i] = 0;
142 else
143 buf[i] = data->data[off + i];
144 }
138 } else { 145 } else {
139 memcpy(buf, &data->data[off], count); 146 memcpy(buf, &data->data[off], count);
140 } 147 }
@@ -197,14 +204,18 @@ static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
197 goto exit_kfree; 204 goto exit_kfree;
198 205
199 /* Detect the Vaio nature of EEPROMs. 206 /* Detect the Vaio nature of EEPROMs.
200 We use the "PCG-" prefix as the signature. */ 207 We use the "PCG-" or "VGN-" prefix as the signature. */
201 if (address == 0x57) { 208 if (address == 0x57) {
202 if (i2c_smbus_read_byte_data(new_client, 0x80) == 'P' 209 char name[4];
203 && i2c_smbus_read_byte(new_client) == 'C' 210
204 && i2c_smbus_read_byte(new_client) == 'G' 211 name[0] = i2c_smbus_read_byte_data(new_client, 0x80);
205 && i2c_smbus_read_byte(new_client) == '-') { 212 name[1] = i2c_smbus_read_byte(new_client);
213 name[2] = i2c_smbus_read_byte(new_client);
214 name[3] = i2c_smbus_read_byte(new_client);
215
216 if (!memcmp(name, "PCG-", 4) || !memcmp(name, "VGN-", 4)) {
206 dev_info(&new_client->dev, "Vaio EEPROM detected, " 217 dev_info(&new_client->dev, "Vaio EEPROM detected, "
207 "enabling password protection\n"); 218 "enabling privacy protection\n");
208 data->nature = VAIO; 219 data->nature = VAIO;
209 } 220 }
210 } 221 }
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 1a4e8dc03b36..b5e13e405e72 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -673,7 +673,7 @@ static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr)
673 return 0; 673 return 0;
674} 674}
675 675
676int i2c_check_addr(struct i2c_adapter *adapter, int addr) 676static int i2c_check_addr(struct i2c_adapter *adapter, int addr)
677{ 677{
678 int rval; 678 int rval;
679 679
@@ -683,7 +683,6 @@ int i2c_check_addr(struct i2c_adapter *adapter, int addr)
683 683
684 return rval; 684 return rval;
685} 685}
686EXPORT_SYMBOL(i2c_check_addr);
687 686
688int i2c_attach_client(struct i2c_client *client) 687int i2c_attach_client(struct i2c_client *client)
689{ 688{
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 5a15e50748de..c21ae20ae362 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -38,6 +38,15 @@
38 38
39static struct i2c_driver i2cdev_driver; 39static struct i2c_driver i2cdev_driver;
40 40
41/*
42 * An i2c_dev represents an i2c_adapter ... an I2C or SMBus master, not a
43 * slave (i2c_client) with which messages will be exchanged. It's coupled
44 * with a character special file which is accessed by user mode drivers.
45 *
46 * The list of i2c_dev structures is parallel to the i2c_adapter lists
47 * maintained by the driver model, and is updated using notifications
48 * delivered to the i2cdev_driver.
49 */
41struct i2c_dev { 50struct i2c_dev {
42 struct list_head list; 51 struct list_head list;
43 struct i2c_adapter *adap; 52 struct i2c_adapter *adap;
@@ -103,6 +112,25 @@ static ssize_t show_adapter_name(struct device *dev,
103} 112}
104static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); 113static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
105 114
115/* ------------------------------------------------------------------------- */
116
117/*
118 * After opening an instance of this character special file, a file
119 * descriptor starts out associated only with an i2c_adapter (and bus).
120 *
121 * Using the I2C_RDWR ioctl(), you can then *immediately* issue i2c_msg
122 * traffic to any devices on the bus used by that adapter. That's because
123 * the i2c_msg vectors embed all the addressing information they need, and
124 * are submitted directly to an i2c_adapter. However, SMBus-only adapters
125 * don't support that interface.
126 *
127 * To use read()/write() system calls on that file descriptor, or to use
128 * SMBus interfaces (and work with SMBus-only hosts!), you must first issue
129 * an I2C_SLAVE (or I2C_SLAVE_FORCE) ioctl. That configures an anonymous
130 * (never registered) i2c_client so it holds the addressing information
131 * needed by those system calls and by this SMBus interface.
132 */
133
106static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count, 134static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count,
107 loff_t *offset) 135 loff_t *offset)
108{ 136{
@@ -154,6 +182,29 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c
154 return ret; 182 return ret;
155} 183}
156 184
185/* This address checking function differs from the one in i2c-core
186 in that it considers an address with a registered device, but no
187 bounded driver, as NOT busy. */
188static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr)
189{
190 struct list_head *item;
191 struct i2c_client *client;
192 int res = 0;
193
194 mutex_lock(&adapter->clist_lock);
195 list_for_each(item, &adapter->clients) {
196 client = list_entry(item, struct i2c_client, list);
197 if (client->addr == addr) {
198 if (client->driver)
199 res = -EBUSY;
200 break;
201 }
202 }
203 mutex_unlock(&adapter->clist_lock);
204
205 return res;
206}
207
157static int i2cdev_ioctl(struct inode *inode, struct file *file, 208static int i2cdev_ioctl(struct inode *inode, struct file *file,
158 unsigned int cmd, unsigned long arg) 209 unsigned int cmd, unsigned long arg)
159{ 210{
@@ -172,11 +223,22 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
172 switch ( cmd ) { 223 switch ( cmd ) {
173 case I2C_SLAVE: 224 case I2C_SLAVE:
174 case I2C_SLAVE_FORCE: 225 case I2C_SLAVE_FORCE:
226 /* NOTE: devices set up to work with "new style" drivers
227 * can't use I2C_SLAVE, even when the device node is not
228 * bound to a driver. Only I2C_SLAVE_FORCE will work.
229 *
230 * Setting the PEC flag here won't affect kernel drivers,
231 * which will be using the i2c_client node registered with
232 * the driver model core. Likewise, when that client has
233 * the PEC flag already set, the i2c-dev driver won't see
234 * (or use) this setting.
235 */
175 if ((arg > 0x3ff) || 236 if ((arg > 0x3ff) ||
176 (((client->flags & I2C_M_TEN) == 0) && arg > 0x7f)) 237 (((client->flags & I2C_M_TEN) == 0) && arg > 0x7f))
177 return -EINVAL; 238 return -EINVAL;
178 if ((cmd == I2C_SLAVE) && i2c_check_addr(client->adapter,arg)) 239 if (cmd == I2C_SLAVE && i2cdev_check_addr(client->adapter, arg))
179 return -EBUSY; 240 return -EBUSY;
241 /* REVISIT: address could become busy later */
180 client->addr = arg; 242 client->addr = arg;
181 return 0; 243 return 0;
182 case I2C_TENBIT: 244 case I2C_TENBIT:
@@ -386,6 +448,13 @@ static int i2cdev_open(struct inode *inode, struct file *file)
386 if (!adap) 448 if (!adap)
387 return -ENODEV; 449 return -ENODEV;
388 450
451 /* This creates an anonymous i2c_client, which may later be
452 * pointed to some address using I2C_SLAVE or I2C_SLAVE_FORCE.
453 *
454 * This client is ** NEVER REGISTERED ** with the driver model
455 * or I2C core code!! It just holds private copies of addressing
456 * information and maybe a PEC flag.
457 */
389 client = kzalloc(sizeof(*client), GFP_KERNEL); 458 client = kzalloc(sizeof(*client), GFP_KERNEL);
390 if (!client) { 459 if (!client) {
391 i2c_put_adapter(adap); 460 i2c_put_adapter(adap);
@@ -394,7 +463,6 @@ static int i2cdev_open(struct inode *inode, struct file *file)
394 snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr); 463 snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr);
395 client->driver = &i2cdev_driver; 464 client->driver = &i2cdev_driver;
396 465
397 /* registered with adapter, passed as client to user */
398 client->adapter = adap; 466 client->adapter = adap;
399 file->private_data = client; 467 file->private_data = client;
400 468
@@ -422,6 +490,14 @@ static const struct file_operations i2cdev_fops = {
422 .release = i2cdev_release, 490 .release = i2cdev_release,
423}; 491};
424 492
493/* ------------------------------------------------------------------------- */
494
495/*
496 * The legacy "i2cdev_driver" is used primarily to get notifications when
497 * I2C adapters are added or removed, so that each one gets an i2c_dev
498 * and is thus made available to userspace driver code.
499 */
500
425static struct class *i2c_dev_class; 501static struct class *i2c_dev_class;
426 502
427static int i2cdev_attach_adapter(struct i2c_adapter *adap) 503static int i2cdev_attach_adapter(struct i2c_adapter *adap)
@@ -486,6 +562,12 @@ static struct i2c_driver i2cdev_driver = {
486 .detach_client = i2cdev_detach_client, 562 .detach_client = i2cdev_detach_client,
487}; 563};
488 564
565/* ------------------------------------------------------------------------- */
566
567/*
568 * module load/unload record keeping
569 */
570
489static int __init i2c_dev_init(void) 571static int __init i2c_dev_init(void)
490{ 572{
491 int res; 573 int res;
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 6eaece96524e..e445fe6e4ba9 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -152,9 +152,22 @@ config BLK_DEV_IDEDISK
152 If unsure, say Y. 152 If unsure, say Y.
153 153
154config IDEDISK_MULTI_MODE 154config IDEDISK_MULTI_MODE
155 bool "Use multi-mode by default" 155 bool "Use multiple sector mode for Programmed Input/Output by default"
156 help 156 help
157 If you get this error, try to say Y here: 157 This setting is irrelevant for most IDE disks, with direct memory
158 access, to which multiple sector mode does not apply. Multiple sector
159 mode is a feature of most modern IDE hard drives, permitting the
160 transfer of multiple sectors per Programmed Input/Output interrupt,
161 rather than the usual one sector per interrupt. When this feature is
162 enabled, it can reduce operating system overhead for disk Programmed
163 Input/Output. On some systems, it also can increase the data
164 throughput of Programmed Input/Output. Some drives, however, seemed
165 to run slower with multiple sector mode enabled. Some drives claimed
166 to support multiple sector mode, but lost data at some settings.
167 Under rare circumstances, such failures could result in massive
168 filesystem corruption.
169
170 If you get the following error, try to say Y here:
158 171
159 hda: set_multmode: status=0x51 { DriveReady SeekComplete Error } 172 hda: set_multmode: status=0x51 { DriveReady SeekComplete Error }
160 hda: set_multmode: error=0x04 { DriveStatusError } 173 hda: set_multmode: error=0x04 { DriveStatusError }
@@ -190,10 +203,6 @@ config BLK_DEV_IDECD
190 CD-ROM drive, you can say N to all other CD-ROM options, but be sure 203 CD-ROM drive, you can say N to all other CD-ROM options, but be sure
191 to say Y or M to "ISO 9660 CD-ROM file system support". 204 to say Y or M to "ISO 9660 CD-ROM file system support".
192 205
193 Note that older versions of LILO (LInux LOader) cannot properly deal
194 with IDE/ATAPI CD-ROMs, so install LILO 16 or higher, available from
195 <http://lilo.go.dyndns.org/>.
196
197 To compile this driver as a module, choose M here: the 206 To compile this driver as a module, choose M here: the
198 module will be called ide-cd. 207 module will be called ide-cd.
199 208
@@ -380,9 +389,10 @@ config IDEPCI_SHARE_IRQ
380config IDEPCI_PCIBUS_ORDER 389config IDEPCI_PCIBUS_ORDER
381 def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI 390 def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI
382 391
392# TODO: split it on per host driver config options (or module parameters)
383config BLK_DEV_OFFBOARD 393config BLK_DEV_OFFBOARD
384 bool "Boot off-board chipsets first support" 394 bool "Boot off-board chipsets first support"
385 depends on BLK_DEV_IDEPCI 395 depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001)
386 help 396 help
387 Normally, IDE controllers built into the motherboard (on-board 397 Normally, IDE controllers built into the motherboard (on-board
388 controllers) are assigned to ide0 and ide1 while those on add-in PCI 398 controllers) are assigned to ide0 and ide1 while those on add-in PCI
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/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index e196aefa2070..7f5bc2ee6c7e 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -748,8 +748,7 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
748 hold = ATA_DMA2_HOLD; 748 hold = ATA_DMA2_HOLD;
749 break; 749 break;
750 default: 750 default:
751 BUG(); 751 return;
752 break;
753 } 752 }
754 753
755 if (speed >= XFER_UDMA_0) 754 if (speed >= XFER_UDMA_0)
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 428f7a8a00b6..e3add70b9cd8 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -340,7 +340,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
340 340
341 if (drive->media != ide_disk) { 341 if (drive->media != ide_disk) {
342 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) 342 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
343 return -1; 343 return 0;
344 } 344 }
345 345
346 /* 346 /*
@@ -752,7 +752,8 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
752 mode = XFER_MW_DMA_1; 752 mode = XFER_MW_DMA_1;
753 } 753 }
754 754
755 printk(KERN_DEBUG "%s: selected mode 0x%x\n", drive->name, mode); 755 printk(KERN_DEBUG "%s: %s mode selected\n", drive->name,
756 mode ? ide_xfer_verbose(mode) : "no DMA");
756 757
757 return min(mode, req_mode); 758 return min(mode, req_mode);
758} 759}
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c89f0d3058e9..db22d1ff4e55 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -340,6 +340,8 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
340 if (args) { 340 if (args) {
341 args[0] = stat; 341 args[0] = stat;
342 args[1] = err; 342 args[1] = err;
343 /* be sure we're looking at the low order bits */
344 hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG);
343 args[2] = hwif->INB(IDE_NSECTOR_REG); 345 args[2] = hwif->INB(IDE_NSECTOR_REG);
344 args[3] = hwif->INB(IDE_SECTOR_REG); 346 args[3] = hwif->INB(IDE_SECTOR_REG);
345 args[4] = hwif->INB(IDE_LCYL_REG); 347 args[4] = hwif->INB(IDE_LCYL_REG);
@@ -654,7 +656,8 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
654 int retries = 10; 656 int retries = 10;
655 657
656 local_irq_enable_in_hardirq(); 658 local_irq_enable_in_hardirq();
657 if ((stat & DRQ_STAT) && args && args[3]) { 659 if (rq->cmd_type == REQ_TYPE_ATA_CMD &&
660 (stat & DRQ_STAT) && args && args[3]) {
658 u8 io_32bit = drive->io_32bit; 661 u8 io_32bit = drive->io_32bit;
659 drive->io_32bit = 0; 662 drive->io_32bit = 0;
660 hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS); 663 hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS);
@@ -882,7 +885,6 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
882 return do_rw_taskfile(drive, args); 885 return do_rw_taskfile(drive, args);
883 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) { 886 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) {
884 u8 *args = rq->buffer; 887 u8 *args = rq->buffer;
885 u8 sel;
886 888
887 if (!args) 889 if (!args)
888 goto done; 890 goto done;
@@ -900,10 +902,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
900 hwif->OUTB(args[3], IDE_SECTOR_REG); 902 hwif->OUTB(args[3], IDE_SECTOR_REG);
901 hwif->OUTB(args[4], IDE_LCYL_REG); 903 hwif->OUTB(args[4], IDE_LCYL_REG);
902 hwif->OUTB(args[5], IDE_HCYL_REG); 904 hwif->OUTB(args[5], IDE_HCYL_REG);
903 sel = (args[6] & ~0x10); 905 hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG);
904 if (drive->select.b.unit)
905 sel |= 0x10;
906 hwif->OUTB(sel, IDE_SELECT_REG);
907 ide_cmd(drive, args[0], args[2], &drive_cmd_intr); 906 ide_cmd(drive, args[0], args[2], &drive_cmd_intr);
908 return ide_started; 907 return ide_started;
909 } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) { 908 } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 95168833d069..e17a9ee120ea 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -403,8 +403,12 @@ void ide_fix_driveid (struct hd_driveid *id)
403#endif 403#endif
404} 404}
405 405
406/* FIXME: exported for use by the USB storage (isd200.c) code only */ 406/*
407EXPORT_SYMBOL(ide_fix_driveid); 407 * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
408 * removing leading/trailing blanks and compressing internal blanks.
409 * It is primarily used to tidy up the model name/number fields as
410 * returned by the WIN_[P]IDENTIFY commands.
411 */
408 412
409void ide_fixstring (u8 *s, const int bytecount, const int byteswap) 413void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
410{ 414{
@@ -582,9 +586,12 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list);
582/* 586/*
583 * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. 587 * 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. 588 * We list them here and depend on the device side cable detection for them.
589 *
590 * Some optical devices with the buggy firmwares have the same problem.
585 */ 591 */
586static const struct drive_list_entry ivb_list[] = { 592static const struct drive_list_entry ivb_list[] = {
587 { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, 593 { "QUANTUM FIREBALLlct10 05" , "A03.0900" },
594 { "TSSTcorp CDDVDW SH-S202J" , "SB00" },
588 { NULL , NULL } 595 { NULL , NULL }
589}; 596};
590 597
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index af86433baede..1609b8604f56 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -514,6 +514,7 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
514 if (drive->addressing == 1) { 514 if (drive->addressing == 1) {
515 __u64 sectors = 0; 515 __u64 sectors = 0;
516 u32 low = 0, high = 0; 516 u32 low = 0, high = 0;
517 hwif->OUTB(drive->ctl&~0x80, IDE_CONTROL_REG);
517 low = ide_read_24(drive); 518 low = ide_read_24(drive);
518 hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); 519 hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
519 high = ide_read_24(drive); 520 high = ide_read_24(drive);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 6a6f2e066b46..56fb0b843429 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -172,11 +172,12 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
172 ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); 172 ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap);
173 ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); 173 ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap);
174 174
175 /* we depend on this a lot! */
176 id->model[sizeof(id->model)-1] = '\0';
177
175 if (strstr(id->model, "E X A B Y T E N E S T")) 178 if (strstr(id->model, "E X A B Y T E N E S T"))
176 goto err_misc; 179 goto err_misc;
177 180
178 /* we depend on this a lot! */
179 id->model[sizeof(id->model)-1] = '\0';
180 printk("%s: %s, ", drive->name, id->model); 181 printk("%s: %s, ", drive->name, id->model);
181 drive->present = 1; 182 drive->present = 1;
182 drive->dead = 0; 183 drive->dead = 0;
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index d066546f2831..2b60f1b0437e 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -471,6 +471,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long
471 struct request rq; 471 struct request rq;
472 472
473 memset(&rq, 0, sizeof(rq)); 473 memset(&rq, 0, sizeof(rq));
474 rq.ref_count = 1;
474 rq.cmd_type = REQ_TYPE_ATA_TASKFILE; 475 rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
475 rq.buffer = buf; 476 rq.buffer = buf;
476 477
@@ -511,6 +512,7 @@ int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf)
511 512
512EXPORT_SYMBOL(ide_raw_taskfile); 513EXPORT_SYMBOL(ide_raw_taskfile);
513 514
515#ifdef CONFIG_IDE_TASK_IOCTL
514int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) 516int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
515{ 517{
516 ide_task_request_t *req_task; 518 ide_task_request_t *req_task;
@@ -660,6 +662,7 @@ abort:
660 662
661 return err; 663 return err;
662} 664}
665#endif
663 666
664int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) 667int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf)
665{ 668{
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index ea0143ef5fe5..51fca441c294 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cmd64x.c Version 1.50 May 10, 2007 2 * linux/drivers/ide/pci/cmd64x.c Version 1.51 Nov 8, 2007
3 * 3 *
4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. 4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
5 * Due to massive hardware bugs, UltraDMA is only supported 5 * Due to massive hardware bugs, UltraDMA is only supported
@@ -339,7 +339,8 @@ static int cmd648_ide_dma_end (ide_drive_t *drive)
339 u8 mrdmode = inb(hwif->dma_master + 0x01); 339 u8 mrdmode = inb(hwif->dma_master + 0x01);
340 340
341 /* clear the interrupt bit */ 341 /* clear the interrupt bit */
342 outb(mrdmode | irq_mask, hwif->dma_master + 0x01); 342 outb((mrdmode & ~(MRDMODE_INTR_CH0 | MRDMODE_INTR_CH1)) | irq_mask,
343 hwif->dma_master + 0x01);
343 344
344 return err; 345 return err;
345} 346}
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 599408952bd4..547690395eee 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -117,8 +117,7 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
117 case XFER_MW_DMA_1: timings = 0x00012121; break; 117 case XFER_MW_DMA_1: timings = 0x00012121; break;
118 case XFER_MW_DMA_2: timings = 0x00002020; break; 118 case XFER_MW_DMA_2: timings = 0x00002020; break;
119 default: 119 default:
120 BUG(); 120 return;
121 break;
122 } 121 }
123 basereg = CS5530_BASEREG(drive->hwif); 122 basereg = CS5530_BASEREG(drive->hwif);
124 reg = inl(basereg + 4); /* get drive0 config register */ 123 reg = inl(basereg + 4); /* get drive0 config register */
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/it821x.c b/drivers/ide/pci/it821x.c
index 5c9975435319..99b7d763b6c7 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -653,8 +653,7 @@ static const struct ide_port_info it821x_chipsets[] __devinitdata = {
653 653
654static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 654static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
655{ 655{
656 ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); 656 return ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]);
657 return 0;
658} 657}
659 658
660static const struct pci_device_id it821x_pci_tbl[] = { 659static const struct pci_device_id it821x_pci_tbl[] = {
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index bdf64d997708..0083eaf89c77 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -139,8 +139,7 @@ static const struct ide_port_info jmicron_chipset __devinitdata = {
139 139
140static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) 140static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id)
141{ 141{
142 ide_setup_pci_device(dev, &jmicron_chipset); 142 return ide_setup_pci_device(dev, &jmicron_chipset);
143 return 0;
144} 143}
145 144
146/* All JMB PATA controllers have and will continue to have the same 145/* All JMB PATA controllers have and will continue to have the same
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 9329d4a810e5..63625a0be712 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -302,6 +302,7 @@ struct ich_laptop {
302 302
303static const struct ich_laptop ich_laptop[] = { 303static const struct ich_laptop ich_laptop[] = {
304 /* devid, subvendor, subdev */ 304 /* devid, subvendor, subdev */
305 { 0x27DF, 0x1025, 0x0102 }, /* ICH7 on Acer 5602aWLMi */
305 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ 306 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */
306 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ 307 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */
307 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 308 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index d2c8b5524f28..707d5ff66b03 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -186,8 +186,7 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode)
186 } 186 }
187 break; 187 break;
188 default: 188 default:
189 BUG(); 189 return;
190 break;
191 } 190 }
192 191
193 if (unit == 0) { /* are we configuring drive0? */ 192 if (unit == 0) { /* are we configuring drive0? */
@@ -324,17 +323,18 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
324 323
325 pci_disable_device(dev); 324 pci_disable_device(dev);
326 pci_set_power_state(dev, pci_choose_state(dev, state)); 325 pci_set_power_state(dev, pci_choose_state(dev, state));
327 dev->current_state = state.event;
328 return 0; 326 return 0;
329} 327}
330 328
331static int sc1200_resume (struct pci_dev *dev) 329static int sc1200_resume (struct pci_dev *dev)
332{ 330{
333 ide_hwif_t *hwif = NULL; 331 ide_hwif_t *hwif = NULL;
332 int i;
333
334 i = pci_enable_device(dev);
335 if (i)
336 return i;
334 337
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 // 338 //
339 // loop over all interfaces that are part of this pci device: 339 // loop over all interfaces that are part of this pci device:
340 // 340 //
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 6b7bb53acefd..f6e2ab3dd166 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -356,7 +356,6 @@ static void sis_set_dma_mode(ide_drive_t *drive, const u8 speed)
356 sis_program_timings(drive, speed); 356 sis_program_timings(drive, speed);
357 break; 357 break;
358 default: 358 default:
359 BUG();
360 break; 359 break;
361 } 360 }
362} 361}
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 816b5311dad6..5afdfef7264c 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1138,6 +1138,7 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1138 hwif->drives[0].autotune = IDE_TUNE_AUTO; 1138 hwif->drives[0].autotune = IDE_TUNE_AUTO;
1139 hwif->drives[1].autotune = IDE_TUNE_AUTO; 1139 hwif->drives[1].autotune = IDE_TUNE_AUTO;
1140 hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | 1140 hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA |
1141 IDE_HFLAG_PIO_NO_DOWNGRADE |
1141 IDE_HFLAG_POST_SET_MODE; 1142 IDE_HFLAG_POST_SET_MODE;
1142 hwif->pio_mask = ATA_PIO4; 1143 hwif->pio_mask = ATA_PIO4;
1143 hwif->set_pio_mode = pmac_ide_set_pio_mode; 1144 hwif->set_pio_mode = pmac_ide_set_pio_mode;
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 02d14bf85ab2..25fd09053220 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -7,11 +7,6 @@
7 * May be copied or modified under the terms of the GNU General Public License 7 * May be copied or modified under the terms of the GNU General Public License
8 */ 8 */
9 9
10/*
11 * This module provides support for automatic detection and
12 * configuration of all PCI IDE interfaces present in a system.
13 */
14
15#include <linux/module.h> 10#include <linux/module.h>
16#include <linux/types.h> 11#include <linux/types.h>
17#include <linux/kernel.h> 12#include <linux/kernel.h>
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c
index f5f4983dfbf3..7c4eb39b7024 100644
--- a/drivers/ieee1394/dma.c
+++ b/drivers/ieee1394/dma.c
@@ -103,8 +103,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,
103 goto err; 103 goto err;
104 } 104 }
105 105
106 /* just to be safe - this will become unnecessary once sglist->address goes away */ 106 sg_init_table(dma->sglist, dma->n_pages);
107 memset(dma->sglist, 0, dma->n_pages * sizeof(*dma->sglist));
108 107
109 /* fill scatter/gather list with pages */ 108 /* fill scatter/gather list with pages */
110 for (i = 0; i < dma->n_pages; i++) { 109 for (i = 0; i < dma->n_pages; i++) {
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/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index d5dfe11aa5c6..b83d254bc86e 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -71,11 +71,11 @@
71#include <linux/types.h> 71#include <linux/types.h>
72#include <linux/wait.h> 72#include <linux/wait.h>
73#include <linux/workqueue.h> 73#include <linux/workqueue.h>
74#include <linux/scatterlist.h>
74 75
75#include <asm/byteorder.h> 76#include <asm/byteorder.h>
76#include <asm/errno.h> 77#include <asm/errno.h>
77#include <asm/param.h> 78#include <asm/param.h>
78#include <asm/scatterlist.h>
79#include <asm/system.h> 79#include <asm/system.h>
80#include <asm/types.h> 80#include <asm/types.h>
81 81
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/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index f0c777589374..b5436ca92e68 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -1000,6 +1000,7 @@ static int iwch_query_device(struct ib_device *ibdev,
1000 props->max_sge = dev->attr.max_sge_per_wr; 1000 props->max_sge = dev->attr.max_sge_per_wr;
1001 props->max_sge_rd = 1; 1001 props->max_sge_rd = 1;
1002 props->max_qp_rd_atom = dev->attr.max_rdma_reads_per_qp; 1002 props->max_qp_rd_atom = dev->attr.max_rdma_reads_per_qp;
1003 props->max_qp_init_rd_atom = dev->attr.max_rdma_reads_per_qp;
1003 props->max_cq = dev->attr.max_cqs; 1004 props->max_cq = dev->attr.max_cqs;
1004 props->max_cqe = dev->attr.max_cqes_per_cq; 1005 props->max_cqe = dev->attr.max_cqes_per_cq;
1005 props->max_mr = dev->attr.max_mem_regs; 1006 props->max_mr = dev->attr.max_mem_regs;
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c
index 97d108634c58..453eb995c1d4 100644
--- a/drivers/infiniband/hw/ehca/ehca_av.c
+++ b/drivers/infiniband/hw/ehca/ehca_av.c
@@ -50,6 +50,38 @@
50 50
51static struct kmem_cache *av_cache; 51static struct kmem_cache *av_cache;
52 52
53int ehca_calc_ipd(struct ehca_shca *shca, int port,
54 enum ib_rate path_rate, u32 *ipd)
55{
56 int path = ib_rate_to_mult(path_rate);
57 int link, ret;
58 struct ib_port_attr pa;
59
60 if (path_rate == IB_RATE_PORT_CURRENT) {
61 *ipd = 0;
62 return 0;
63 }
64
65 if (unlikely(path < 0)) {
66 ehca_err(&shca->ib_device, "Invalid static rate! path_rate=%x",
67 path_rate);
68 return -EINVAL;
69 }
70
71 ret = ehca_query_port(&shca->ib_device, port, &pa);
72 if (unlikely(ret < 0)) {
73 ehca_err(&shca->ib_device, "Failed to query port ret=%i", ret);
74 return ret;
75 }
76
77 link = ib_width_enum_to_int(pa.active_width) * pa.active_speed;
78
79 /* IPD = round((link / path) - 1) */
80 *ipd = ((link + (path >> 1)) / path) - 1;
81
82 return 0;
83}
84
53struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) 85struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
54{ 86{
55 int ret; 87 int ret;
@@ -69,15 +101,13 @@ struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
69 av->av.slid_path_bits = ah_attr->src_path_bits; 101 av->av.slid_path_bits = ah_attr->src_path_bits;
70 102
71 if (ehca_static_rate < 0) { 103 if (ehca_static_rate < 0) {
72 int ah_mult = ib_rate_to_mult(ah_attr->static_rate); 104 u32 ipd;
73 int ehca_mult = 105 if (ehca_calc_ipd(shca, ah_attr->port_num,
74 ib_rate_to_mult(shca->sport[ah_attr->port_num].rate ); 106 ah_attr->static_rate, &ipd)) {
75 107 ret = -EINVAL;
76 if (ah_mult >= ehca_mult) 108 goto create_ah_exit1;
77 av->av.ipd = 0; 109 }
78 else 110 av->av.ipd = ipd;
79 av->av.ipd = (ah_mult > 0) ?
80 ((ehca_mult - 1) / ah_mult) : 0;
81 } else 111 } else
82 av->av.ipd = ehca_static_rate; 112 av->av.ipd = ehca_static_rate;
83 113
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index 2d660ae189e5..87f12d4312a7 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -95,7 +95,6 @@ struct ehca_sma_attr {
95struct ehca_sport { 95struct ehca_sport {
96 struct ib_cq *ibcq_aqp1; 96 struct ib_cq *ibcq_aqp1;
97 struct ib_qp *ibqp_aqp1; 97 struct ib_qp *ibqp_aqp1;
98 enum ib_rate rate;
99 enum ib_port_state port_state; 98 enum ib_port_state port_state;
100 struct ehca_sma_attr saved_attr; 99 struct ehca_sma_attr saved_attr;
101}; 100};
diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c
index 15806d140461..5bd7b591987e 100644
--- a/drivers/infiniband/hw/ehca/ehca_hca.c
+++ b/drivers/infiniband/hw/ehca/ehca_hca.c
@@ -151,7 +151,6 @@ int ehca_query_port(struct ib_device *ibdev,
151 } 151 }
152 152
153 memset(props, 0, sizeof(struct ib_port_attr)); 153 memset(props, 0, sizeof(struct ib_port_attr));
154 props->state = rblock->state;
155 154
156 switch (rblock->max_mtu) { 155 switch (rblock->max_mtu) {
157 case 0x1: 156 case 0x1:
@@ -188,11 +187,20 @@ int ehca_query_port(struct ib_device *ibdev,
188 props->subnet_timeout = rblock->subnet_timeout; 187 props->subnet_timeout = rblock->subnet_timeout;
189 props->init_type_reply = rblock->init_type_reply; 188 props->init_type_reply = rblock->init_type_reply;
190 189
191 props->active_width = IB_WIDTH_12X; 190 if (rblock->state && rblock->phys_width) {
192 props->active_speed = 0x1; 191 props->phys_state = rblock->phys_pstate;
193 192 props->state = rblock->phys_state;
194 /* at the moment (logical) link state is always LINK_UP */ 193 props->active_width = rblock->phys_width;
195 props->phys_state = 0x5; 194 props->active_speed = rblock->phys_speed;
195 } else {
196 /* old firmware releases don't report physical
197 * port info, so use default values
198 */
199 props->phys_state = 5;
200 props->state = rblock->state;
201 props->active_width = IB_WIDTH_12X;
202 props->active_speed = 0x1;
203 }
196 204
197query_port1: 205query_port1:
198 ehca_free_fw_ctrlblock(rblock); 206 ehca_free_fw_ctrlblock(rblock);
diff --git a/drivers/infiniband/hw/ehca/ehca_iverbs.h b/drivers/infiniband/hw/ehca/ehca_iverbs.h
index dce503bb7d6b..5485799cdc8d 100644
--- a/drivers/infiniband/hw/ehca/ehca_iverbs.h
+++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h
@@ -189,6 +189,9 @@ int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
189 189
190void ehca_poll_eqs(unsigned long data); 190void ehca_poll_eqs(unsigned long data);
191 191
192int ehca_calc_ipd(struct ehca_shca *shca, int port,
193 enum ib_rate path_rate, u32 *ipd);
194
192#ifdef CONFIG_PPC_64K_PAGES 195#ifdef CONFIG_PPC_64K_PAGES
193void *ehca_alloc_fw_ctrlblock(gfp_t flags); 196void *ehca_alloc_fw_ctrlblock(gfp_t flags);
194void ehca_free_fw_ctrlblock(void *ptr); 197void ehca_free_fw_ctrlblock(void *ptr);
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index c6cd38c5321f..90d4334179bf 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -327,9 +327,6 @@ static int ehca_sense_attributes(struct ehca_shca *shca)
327 shca->hw_level = ehca_hw_level; 327 shca->hw_level = ehca_hw_level;
328 ehca_gen_dbg(" ... hardware level=%x", shca->hw_level); 328 ehca_gen_dbg(" ... hardware level=%x", shca->hw_level);
329 329
330 shca->sport[0].rate = IB_RATE_30_GBPS;
331 shca->sport[1].rate = IB_RATE_30_GBPS;
332
333 shca->hca_cap = rblock->hca_cap_indicators; 330 shca->hca_cap = rblock->hca_cap_indicators;
334 ehca_gen_dbg(" ... HCA capabilities:"); 331 ehca_gen_dbg(" ... HCA capabilities:");
335 for (i = 0; i < ARRAY_SIZE(hca_cap_descr); i++) 332 for (i = 0; i < ARRAY_SIZE(hca_cap_descr); i++)
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index de182648b282..2e3e6547cb78 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -1196,10 +1196,6 @@ static int internal_modify_qp(struct ib_qp *ibqp,
1196 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_QKEY, 1); 1196 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_QKEY, 1);
1197 } 1197 }
1198 if (attr_mask & IB_QP_AV) { 1198 if (attr_mask & IB_QP_AV) {
1199 int ah_mult = ib_rate_to_mult(attr->ah_attr.static_rate);
1200 int ehca_mult = ib_rate_to_mult(shca->sport[my_qp->
1201 init_attr.port_num].rate);
1202
1203 mqpcb->dlid = attr->ah_attr.dlid; 1199 mqpcb->dlid = attr->ah_attr.dlid;
1204 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_DLID, 1); 1200 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_DLID, 1);
1205 mqpcb->source_path_bits = attr->ah_attr.src_path_bits; 1201 mqpcb->source_path_bits = attr->ah_attr.src_path_bits;
@@ -1207,11 +1203,12 @@ static int internal_modify_qp(struct ib_qp *ibqp,
1207 mqpcb->service_level = attr->ah_attr.sl; 1203 mqpcb->service_level = attr->ah_attr.sl;
1208 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); 1204 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1);
1209 1205
1210 if (ah_mult < ehca_mult) 1206 if (ehca_calc_ipd(shca, my_qp->init_attr.port_num,
1211 mqpcb->max_static_rate = (ah_mult > 0) ? 1207 attr->ah_attr.static_rate,
1212 ((ehca_mult - 1) / ah_mult) : 0; 1208 &mqpcb->max_static_rate)) {
1213 else 1209 ret = -EINVAL;
1214 mqpcb->max_static_rate = 0; 1210 goto modify_qp_exit2;
1211 }
1215 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE, 1); 1212 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_MAX_STATIC_RATE, 1);
1216 1213
1217 /* 1214 /*
@@ -1280,10 +1277,6 @@ static int internal_modify_qp(struct ib_qp *ibqp,
1280 (MQPCB_MASK_RDMA_ATOMIC_OUTST_DEST_QP, 1); 1277 (MQPCB_MASK_RDMA_ATOMIC_OUTST_DEST_QP, 1);
1281 } 1278 }
1282 if (attr_mask & IB_QP_ALT_PATH) { 1279 if (attr_mask & IB_QP_ALT_PATH) {
1283 int ah_mult = ib_rate_to_mult(attr->alt_ah_attr.static_rate);
1284 int ehca_mult = ib_rate_to_mult(
1285 shca->sport[my_qp->init_attr.port_num].rate);
1286
1287 if (attr->alt_port_num < 1 1280 if (attr->alt_port_num < 1
1288 || attr->alt_port_num > shca->num_ports) { 1281 || attr->alt_port_num > shca->num_ports) {
1289 ret = -EINVAL; 1282 ret = -EINVAL;
@@ -1309,10 +1302,12 @@ static int internal_modify_qp(struct ib_qp *ibqp,
1309 mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; 1302 mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits;
1310 mqpcb->service_level_al = attr->alt_ah_attr.sl; 1303 mqpcb->service_level_al = attr->alt_ah_attr.sl;
1311 1304
1312 if (ah_mult > 0 && ah_mult < ehca_mult) 1305 if (ehca_calc_ipd(shca, my_qp->init_attr.port_num,
1313 mqpcb->max_static_rate_al = (ehca_mult - 1) / ah_mult; 1306 attr->alt_ah_attr.static_rate,
1314 else 1307 &mqpcb->max_static_rate_al)) {
1315 mqpcb->max_static_rate_al = 0; 1308 ret = -EINVAL;
1309 goto modify_qp_exit2;
1310 }
1316 1311
1317 /* OpenIB doesn't support alternate retry counts - copy them */ 1312 /* OpenIB doesn't support alternate retry counts - copy them */
1318 mqpcb->retry_count_al = mqpcb->retry_count; 1313 mqpcb->retry_count_al = mqpcb->retry_count;
diff --git a/drivers/infiniband/hw/ehca/hipz_hw.h b/drivers/infiniband/hw/ehca/hipz_hw.h
index d9739e554515..485b8400359e 100644
--- a/drivers/infiniband/hw/ehca/hipz_hw.h
+++ b/drivers/infiniband/hw/ehca/hipz_hw.h
@@ -402,7 +402,11 @@ struct hipz_query_port {
402 u64 max_msg_sz; 402 u64 max_msg_sz;
403 u32 max_mtu; 403 u32 max_mtu;
404 u32 vl_cap; 404 u32 vl_cap;
405 u8 reserved2[1900]; 405 u32 phys_pstate;
406 u32 phys_state;
407 u32 phys_speed;
408 u32 phys_width;
409 u8 reserved2[1884];
406 u64 guid_entries[255]; 410 u64 guid_entries[255];
407} __attribute__ ((packed)); 411} __attribute__ ((packed));
408 412
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c
index 645ed71fd797..08d8ae148cd0 100644
--- a/drivers/infiniband/hw/ipath/ipath_cq.c
+++ b/drivers/infiniband/hw/ipath/ipath_cq.c
@@ -404,7 +404,7 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
404 404
405 ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); 405 ret = ib_copy_to_udata(udata, &offset, sizeof(offset));
406 if (ret) 406 if (ret)
407 goto bail; 407 goto bail_free;
408 } 408 }
409 409
410 spin_lock_irq(&cq->lock); 410 spin_lock_irq(&cq->lock);
@@ -424,10 +424,8 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
424 else 424 else
425 n = head - tail; 425 n = head - tail;
426 if (unlikely((u32)cqe < n)) { 426 if (unlikely((u32)cqe < n)) {
427 spin_unlock_irq(&cq->lock);
428 vfree(wc);
429 ret = -EOVERFLOW; 427 ret = -EOVERFLOW;
430 goto bail; 428 goto bail_unlock;
431 } 429 }
432 for (n = 0; tail != head; n++) { 430 for (n = 0; tail != head; n++) {
433 if (cq->ip) 431 if (cq->ip)
@@ -459,7 +457,12 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
459 } 457 }
460 458
461 ret = 0; 459 ret = 0;
460 goto bail;
462 461
462bail_unlock:
463 spin_unlock_irq(&cq->lock);
464bail_free:
465 vfree(wc);
463bail: 466bail:
464 return ret; 467 return ret;
465} 468}
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_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index 5c29b2bfea17..120a61b03bc4 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
+++ b/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -959,8 +959,9 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode,
959 /* If this is a partial ACK, reset the retransmit timer. */ 959 /* If this is a partial ACK, reset the retransmit timer. */
960 if (qp->s_last != qp->s_tail) { 960 if (qp->s_last != qp->s_tail) {
961 spin_lock(&dev->pending_lock); 961 spin_lock(&dev->pending_lock);
962 list_add_tail(&qp->timerwait, 962 if (list_empty(&qp->timerwait))
963 &dev->pending[dev->pending_index]); 963 list_add_tail(&qp->timerwait,
964 &dev->pending[dev->pending_index]);
964 spin_unlock(&dev->pending_lock); 965 spin_unlock(&dev->pending_lock);
965 /* 966 /*
966 * If we get a partial ACK for a resent operation, 967 * If we get a partial ACK for a resent operation,
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/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/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/serio/Kconfig b/drivers/input/serio/Kconfig
index 5ce632ca6815..b88569e21d60 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -21,7 +21,7 @@ if SERIO
21config SERIO_I8042 21config SERIO_I8042
22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86
23 default y 23 default y
24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BFIN 24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BLACKFIN
25 ---help--- 25 ---help---
26 i8042 is the chip over which the standard AT keyboard and PS/2 26 i8042 is the chip over which the standard AT keyboard and PS/2
27 mouse are connected to the computer. If you use these devices, 27 mouse are connected to the computer. If you use these devices,
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/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index a3b945ac3256..7832d8ba8e44 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -109,7 +109,7 @@ config HISAX_16_3
109 109
110config HISAX_TELESPCI 110config HISAX_TELESPCI
111 bool "Teles PCI" 111 bool "Teles PCI"
112 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 112 depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
113 help 113 help
114 This enables HiSax support for the Teles PCI. 114 This enables HiSax support for the Teles PCI.
115 See <file:Documentation/isdn/README.HiSax> on how to configure it. 115 See <file:Documentation/isdn/README.HiSax> on how to configure it.
@@ -237,7 +237,7 @@ config HISAX_MIC
237 237
238config HISAX_NETJET 238config HISAX_NETJET
239 bool "NETjet card" 239 bool "NETjet card"
240 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 240 depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
241 help 241 help
242 This enables HiSax support for the NetJet from Traverse 242 This enables HiSax support for the NetJet from Traverse
243 Technologies. 243 Technologies.
@@ -248,7 +248,7 @@ config HISAX_NETJET
248 248
249config HISAX_NETJET_U 249config HISAX_NETJET_U
250 bool "NETspider U card" 250 bool "NETspider U card"
251 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 251 depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
252 help 252 help
253 This enables HiSax support for the Netspider U interface ISDN card 253 This enables HiSax support for the Netspider U interface ISDN card
254 from Traverse Technologies. 254 from Traverse Technologies.
@@ -287,7 +287,7 @@ config HISAX_HSTSAPHIR
287 287
288config HISAX_BKM_A4T 288config HISAX_BKM_A4T
289 bool "Telekom A4T card" 289 bool "Telekom A4T card"
290 depends on PCI 290 depends on PCI && PCI_LEGACY
291 help 291 help
292 This enables HiSax support for the Telekom A4T card. 292 This enables HiSax support for the Telekom A4T card.
293 293
@@ -297,7 +297,7 @@ config HISAX_BKM_A4T
297 297
298config HISAX_SCT_QUADRO 298config HISAX_SCT_QUADRO
299 bool "Scitel Quadro card" 299 bool "Scitel Quadro card"
300 depends on PCI 300 depends on PCI && PCI_LEGACY
301 help 301 help
302 This enables HiSax support for the Scitel Quadro card. 302 This enables HiSax support for the Scitel Quadro card.
303 303
@@ -316,7 +316,7 @@ config HISAX_GAZEL
316 316
317config HISAX_HFC_PCI 317config HISAX_HFC_PCI
318 bool "HFC PCI-Bus cards" 318 bool "HFC PCI-Bus cards"
319 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 319 depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
320 help 320 help
321 This enables HiSax support for the HFC-S PCI 2BDS0 based cards. 321 This enables HiSax support for the HFC-S PCI 2BDS0 based cards.
322 322
@@ -325,7 +325,7 @@ config HISAX_HFC_PCI
325 325
326config HISAX_W6692 326config HISAX_W6692
327 bool "Winbond W6692 based cards" 327 bool "Winbond W6692 based cards"
328 depends on PCI 328 depends on PCI && PCI_LEGACY
329 help 329 help
330 This enables HiSax support for Winbond W6692 based PCI ISDN cards. 330 This enables HiSax support for Winbond W6692 based PCI ISDN cards.
331 331
@@ -341,7 +341,7 @@ config HISAX_HFC_SX
341 341
342config HISAX_ENTERNOW_PCI 342config HISAX_ENTERNOW_PCI
343 bool "Formula-n enter:now PCI card" 343 bool "Formula-n enter:now PCI card"
344 depends on HISAX_NETJET && PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 344 depends on HISAX_NETJET && PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
345 help 345 help
346 This enables HiSax support for the Formula-n enter:now PCI 346 This enables HiSax support for the Formula-n enter:now PCI
347 ISDN card. 347 ISDN card.
@@ -411,7 +411,7 @@ config HISAX_HFC4S8S
411 411
412config HISAX_FRITZ_PCIPNP 412config HISAX_FRITZ_PCIPNP
413 tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)" 413 tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)"
414 depends on PCI && EXPERIMENTAL 414 depends on PCI && PCI_LEGACY && EXPERIMENTAL
415 help 415 help
416 This enables the driver for the AVM Fritz!Card PCI, 416 This enables the driver for the AVM Fritz!Card PCI,
417 Fritz!Card PCI v2 and Fritz!Card PnP. 417 Fritz!Card PCI v2 and Fritz!Card PnP.
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index f8b79783c8b3..035d158779df 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -830,7 +830,7 @@ static int __devinit avm_pnp_setup(struct IsdnCardState *cs)
830 830
831#endif /* __ISAPNP__ */ 831#endif /* __ISAPNP__ */
832 832
833#ifndef CONFIG_PCI 833#ifndef CONFIG_PCI_LEGACY
834 834
835static int __devinit avm_pci_setup(struct IsdnCardState *cs) 835static int __devinit avm_pci_setup(struct IsdnCardState *cs)
836{ 836{
@@ -872,7 +872,7 @@ static int __devinit avm_pci_setup(struct IsdnCardState *cs)
872 return (1); 872 return (1);
873} 873}
874 874
875#endif /* CONFIG_PCI */ 875#endif /* CONFIG_PCI_LEGACY */
876 876
877int __devinit 877int __devinit
878setup_avm_pcipnp(struct IsdnCard *card) 878setup_avm_pcipnp(struct IsdnCard *card)
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 826745078746..2d670856d141 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -1148,7 +1148,7 @@ static int __devinit setup_diva_isapnp(struct IsdnCard *card)
1148 1148
1149#endif /* ISAPNP */ 1149#endif /* ISAPNP */
1150 1150
1151#ifdef CONFIG_PCI 1151#ifdef CONFIG_PCI_LEGACY
1152static struct pci_dev *dev_diva __devinitdata = NULL; 1152static struct pci_dev *dev_diva __devinitdata = NULL;
1153static struct pci_dev *dev_diva_u __devinitdata = NULL; 1153static struct pci_dev *dev_diva_u __devinitdata = NULL;
1154static struct pci_dev *dev_diva201 __devinitdata = NULL; 1154static struct pci_dev *dev_diva201 __devinitdata = NULL;
@@ -1229,14 +1229,14 @@ static int __devinit setup_diva_pci(struct IsdnCard *card)
1229 return (1); /* card found */ 1229 return (1); /* card found */
1230} 1230}
1231 1231
1232#else /* if !CONFIG_PCI */ 1232#else /* if !CONFIG_PCI_LEGACY */
1233 1233
1234static int __devinit setup_diva_pci(struct IsdnCard *card) 1234static int __devinit setup_diva_pci(struct IsdnCard *card)
1235{ 1235{
1236 return (-1); /* card not found; continue search */ 1236 return (-1); /* card not found; continue search */
1237} 1237}
1238 1238
1239#endif /* CONFIG_PCI */ 1239#endif /* CONFIG_PCI_LEGACY */
1240 1240
1241int __devinit 1241int __devinit
1242setup_diva(struct IsdnCard *card) 1242setup_diva(struct IsdnCard *card)
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index 948a9b290fd1..d272d8ce6537 100644
--- a/drivers/isdn/hisax/elsa.c
+++ b/drivers/isdn/hisax/elsa.c
@@ -883,7 +883,7 @@ setup_elsa_isa(struct IsdnCard *card)
883 val += 'A' - 3; 883 val += 'A' - 3;
884 if (val == 'B' || val == 'C') 884 if (val == 'B' || val == 'C')
885 val ^= 1; 885 val ^= 1;
886 if ((cs->subtyp == ELSA_PCFPRO) && (val = 'G')) 886 if ((cs->subtyp == ELSA_PCFPRO) && (val == 'G'))
887 val = 'C'; 887 val = 'C';
888 printk(KERN_INFO 888 printk(KERN_INFO
889 "Elsa: %s found at %#lx Rev.:%c IRQ %d\n", 889 "Elsa: %s found at %#lx Rev.:%c IRQ %d\n",
@@ -1025,7 +1025,7 @@ setup_elsa_pcmcia(struct IsdnCard *card)
1025 cs->irq); 1025 cs->irq);
1026} 1026}
1027 1027
1028#ifdef CONFIG_PCI 1028#ifdef CONFIG_PCI_LEGACY
1029static struct pci_dev *dev_qs1000 __devinitdata = NULL; 1029static struct pci_dev *dev_qs1000 __devinitdata = NULL;
1030static struct pci_dev *dev_qs3000 __devinitdata = NULL; 1030static struct pci_dev *dev_qs3000 __devinitdata = NULL;
1031 1031
@@ -1093,7 +1093,7 @@ setup_elsa_pci(struct IsdnCard *card)
1093{ 1093{
1094 return (1); 1094 return (1);
1095} 1095}
1096#endif /* CONFIG_PCI */ 1096#endif /* CONFIG_PCI_LEGACY */
1097 1097
1098static int __devinit 1098static int __devinit
1099setup_elsa_common(struct IsdnCard *card) 1099setup_elsa_common(struct IsdnCard *card)
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c
index 3efa719b6d29..f66620ad8e7c 100644
--- a/drivers/isdn/hisax/gazel.c
+++ b/drivers/isdn/hisax/gazel.c
@@ -532,6 +532,7 @@ setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
532 return (0); 532 return (0);
533} 533}
534 534
535#ifdef CONFIG_PCI_LEGACY
535static struct pci_dev *dev_tel __devinitdata = NULL; 536static struct pci_dev *dev_tel __devinitdata = NULL;
536 537
537static int __devinit 538static int __devinit
@@ -620,6 +621,7 @@ setup_gazelpci(struct IsdnCardState *cs)
620 621
621 return (0); 622 return (0);
622} 623}
624#endif /* CONFIG_PCI_LEGACY */
623 625
624int __devinit 626int __devinit
625setup_gazel(struct IsdnCard *card) 627setup_gazel(struct IsdnCard *card)
@@ -639,7 +641,7 @@ setup_gazel(struct IsdnCard *card)
639 return (0); 641 return (0);
640 } else { 642 } else {
641 643
642#ifdef CONFIG_PCI 644#ifdef CONFIG_PCI_LEGACY
643 if (setup_gazelpci(cs)) 645 if (setup_gazelpci(cs))
644 return (0); 646 return (0);
645#else 647#else
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c
index e5918c6fe73d..bd9921128aa8 100644
--- a/drivers/isdn/hisax/niccy.c
+++ b/drivers/isdn/hisax/niccy.c
@@ -223,7 +223,6 @@ static int niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
223 return 0; 223 return 0;
224} 224}
225 225
226static struct pci_dev *niccy_dev __devinitdata = NULL;
227#ifdef __ISAPNP__ 226#ifdef __ISAPNP__
228static struct pnp_card *pnp_c __devinitdata = NULL; 227static struct pnp_card *pnp_c __devinitdata = NULL;
229#endif 228#endif
@@ -299,7 +298,9 @@ int __devinit setup_niccy(struct IsdnCard *card)
299 return 0; 298 return 0;
300 } 299 }
301 } else { 300 } else {
302#ifdef CONFIG_PCI 301#ifdef CONFIG_PCI_LEGACY
302 static struct pci_dev *niccy_dev __devinitdata;
303
303 u_int pci_ioaddr; 304 u_int pci_ioaddr;
304 cs->subtyp = 0; 305 cs->subtyp = 0;
305 if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM, 306 if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM,
@@ -356,7 +357,7 @@ int __devinit setup_niccy(struct IsdnCard *card)
356 printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n"); 357 printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
357 printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n"); 358 printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n");
358 return 0; 359 return 0;
359#endif /* CONFIG_PCI */ 360#endif /* CONFIG_PCI_LEGACY */
360 } 361 }
361 printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n", 362 printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
362 CardType[cs->typ], (cs->subtyp == 1) ? "PnP" : "PCI", 363 CardType[cs->typ], (cs->subtyp == 1) ? "PnP" : "PCI",
diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c
index 03dfc32166a0..95425f3d2220 100644
--- a/drivers/isdn/hisax/sedlbauer.c
+++ b/drivers/isdn/hisax/sedlbauer.c
@@ -600,7 +600,7 @@ setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
600} 600}
601#endif /* __ISAPNP__ */ 601#endif /* __ISAPNP__ */
602 602
603#ifdef CONFIG_PCI 603#ifdef CONFIG_PCI_LEGACY
604static struct pci_dev *dev_sedl __devinitdata = NULL; 604static struct pci_dev *dev_sedl __devinitdata = NULL;
605 605
606static int __devinit 606static int __devinit
@@ -675,7 +675,7 @@ setup_sedlbauer_pci(struct IsdnCard *card)
675 return (1); 675 return (1);
676} 676}
677 677
678#endif /* CONFIG_PCI */ 678#endif /* CONFIG_PCI_LEGACY */
679 679
680int __devinit 680int __devinit
681setup_sedlbauer(struct IsdnCard *card) 681setup_sedlbauer(struct IsdnCard *card)
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index b39d1f5b378e..ced83c202cac 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -2104,7 +2104,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2104 u_long flags; 2104 u_long flags;
2105 isdn_net_dev *p; 2105 isdn_net_dev *p;
2106 isdn_net_phone *n; 2106 isdn_net_phone *n;
2107 char nr[32]; 2107 char nr[ISDN_MSNLEN];
2108 char *my_eaz; 2108 char *my_eaz;
2109 2109
2110 /* Search name in netdev-chain */ 2110 /* Search name in netdev-chain */
@@ -2113,7 +2113,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2113 nr[1] = '\0'; 2113 nr[1] = '\0';
2114 printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n"); 2114 printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n");
2115 } else 2115 } else
2116 strcpy(nr, setup->phone); 2116 strlcpy(nr, setup->phone, ISDN_MSNLEN);
2117 si1 = (int) setup->si1; 2117 si1 = (int) setup->si1;
2118 si2 = (int) setup->si2; 2118 si2 = (int) setup->si2;
2119 if (!setup->eazmsn[0]) { 2119 if (!setup->eazmsn[0]) {
@@ -2789,7 +2789,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
2789 chidx = -1; 2789 chidx = -1;
2790 } 2790 }
2791 } 2791 }
2792 strcpy(lp->msn, cfg->eaz); 2792 strlcpy(lp->msn, cfg->eaz, sizeof(lp->msn));
2793 lp->pre_device = drvidx; 2793 lp->pre_device = drvidx;
2794 lp->pre_channel = chidx; 2794 lp->pre_channel = chidx;
2795 lp->onhtime = cfg->onhtime; 2795 lp->onhtime = cfg->onhtime;
@@ -2936,7 +2936,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone)
2936 if (p) { 2936 if (p) {
2937 if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) 2937 if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL)))
2938 return -ENOMEM; 2938 return -ENOMEM;
2939 strcpy(n->num, phone->phone); 2939 strlcpy(n->num, phone->phone, sizeof(n->num));
2940 n->next = p->local->phone[phone->outgoing & 1]; 2940 n->next = p->local->phone[phone->outgoing & 1];
2941 p->local->phone[phone->outgoing & 1] = n; 2941 p->local->phone[phone->outgoing & 1] = n;
2942 return 0; 2942 return 0;
diff --git a/drivers/isdn/sc/card.h b/drivers/isdn/sc/card.h
index 5992f63c383e..0120bcf88311 100644
--- a/drivers/isdn/sc/card.h
+++ b/drivers/isdn/sc/card.h
@@ -109,7 +109,7 @@ void memcpy_fromshmem(int card, void *dest, const void *src, size_t n);
109int get_card_from_id(int driver); 109int get_card_from_id(int driver);
110int indicate_status(int card, int event, ulong Channel, char *Data); 110int indicate_status(int card, int event, ulong Channel, char *Data);
111irqreturn_t interrupt_handler(int interrupt, void *cardptr); 111irqreturn_t interrupt_handler(int interrupt, void *cardptr);
112int sndpkt(int devId, int channel, struct sk_buff *data); 112int sndpkt(int devId, int channel, int ack, struct sk_buff *data);
113void rcvpkt(int card, RspMessage *rcvmsg); 113void rcvpkt(int card, RspMessage *rcvmsg);
114int command(isdn_ctrl *cmd); 114int command(isdn_ctrl *cmd);
115int reset(int card); 115int reset(int card);
diff --git a/drivers/isdn/sc/packet.c b/drivers/isdn/sc/packet.c
index 92016a2608e9..5ff6ae868440 100644
--- a/drivers/isdn/sc/packet.c
+++ b/drivers/isdn/sc/packet.c
@@ -20,7 +20,7 @@
20#include "message.h" 20#include "message.h"
21#include "card.h" 21#include "card.h"
22 22
23int sndpkt(int devId, int channel, struct sk_buff *data) 23int sndpkt(int devId, int channel, int ack, struct sk_buff *data)
24{ 24{
25 LLData ReqLnkWrite; 25 LLData ReqLnkWrite;
26 int status; 26 int status;
diff --git a/drivers/isdn/sc/shmem.c b/drivers/isdn/sc/shmem.c
index e0331e0094f1..712220cef139 100644
--- a/drivers/isdn/sc/shmem.c
+++ b/drivers/isdn/sc/shmem.c
@@ -50,7 +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 + dest_rem, src, n); 53 memcpy_toio((void __iomem *)(sc_adapter[card]->rambase + dest_rem), src, n);
54 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); 54 spin_unlock_irqrestore(&sc_adapter[card]->lock, flags);
55 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,
56 ((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/kvm/svm.c b/drivers/kvm/svm.c
index 729f1cd93606..7a6eead63a6b 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -494,6 +494,7 @@ static void init_vmcb(struct vmcb *vmcb)
494 */ 494 */
495 /* (1ULL << INTERCEPT_SELECTIVE_CR0) | */ 495 /* (1ULL << INTERCEPT_SELECTIVE_CR0) | */
496 (1ULL << INTERCEPT_CPUID) | 496 (1ULL << INTERCEPT_CPUID) |
497 (1ULL << INTERCEPT_INVD) |
497 (1ULL << INTERCEPT_HLT) | 498 (1ULL << INTERCEPT_HLT) |
498 (1ULL << INTERCEPT_INVLPGA) | 499 (1ULL << INTERCEPT_INVLPGA) |
499 (1ULL << INTERCEPT_IOIO_PROT) | 500 (1ULL << INTERCEPT_IOIO_PROT) |
@@ -507,6 +508,7 @@ static void init_vmcb(struct vmcb *vmcb)
507 (1ULL << INTERCEPT_STGI) | 508 (1ULL << INTERCEPT_STGI) |
508 (1ULL << INTERCEPT_CLGI) | 509 (1ULL << INTERCEPT_CLGI) |
509 (1ULL << INTERCEPT_SKINIT) | 510 (1ULL << INTERCEPT_SKINIT) |
511 (1ULL << INTERCEPT_WBINVD) |
510 (1ULL << INTERCEPT_MONITOR) | 512 (1ULL << INTERCEPT_MONITOR) |
511 (1ULL << INTERCEPT_MWAIT); 513 (1ULL << INTERCEPT_MWAIT);
512 514
@@ -561,6 +563,12 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu)
561 struct vcpu_svm *svm = to_svm(vcpu); 563 struct vcpu_svm *svm = to_svm(vcpu);
562 564
563 init_vmcb(svm->vmcb); 565 init_vmcb(svm->vmcb);
566
567 if (vcpu->vcpu_id != 0) {
568 svm->vmcb->save.rip = 0;
569 svm->vmcb->save.cs.base = svm->vcpu.sipi_vector << 12;
570 svm->vmcb->save.cs.selector = svm->vcpu.sipi_vector << 8;
571 }
564} 572}
565 573
566static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) 574static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
@@ -1241,6 +1249,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm,
1241 [SVM_EXIT_VINTR] = interrupt_window_interception, 1249 [SVM_EXIT_VINTR] = interrupt_window_interception,
1242 /* [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, */ 1250 /* [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, */
1243 [SVM_EXIT_CPUID] = cpuid_interception, 1251 [SVM_EXIT_CPUID] = cpuid_interception,
1252 [SVM_EXIT_INVD] = emulate_on_interception,
1244 [SVM_EXIT_HLT] = halt_interception, 1253 [SVM_EXIT_HLT] = halt_interception,
1245 [SVM_EXIT_INVLPG] = emulate_on_interception, 1254 [SVM_EXIT_INVLPG] = emulate_on_interception,
1246 [SVM_EXIT_INVLPGA] = invalid_op_interception, 1255 [SVM_EXIT_INVLPGA] = invalid_op_interception,
@@ -1255,6 +1264,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm,
1255 [SVM_EXIT_STGI] = invalid_op_interception, 1264 [SVM_EXIT_STGI] = invalid_op_interception,
1256 [SVM_EXIT_CLGI] = invalid_op_interception, 1265 [SVM_EXIT_CLGI] = invalid_op_interception,
1257 [SVM_EXIT_SKINIT] = invalid_op_interception, 1266 [SVM_EXIT_SKINIT] = invalid_op_interception,
1267 [SVM_EXIT_WBINVD] = emulate_on_interception,
1258 [SVM_EXIT_MONITOR] = invalid_op_interception, 1268 [SVM_EXIT_MONITOR] = invalid_op_interception,
1259 [SVM_EXIT_MWAIT] = invalid_op_interception, 1269 [SVM_EXIT_MWAIT] = invalid_op_interception,
1260}; 1270};
@@ -1579,10 +1589,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1579#endif 1589#endif
1580 : "cc", "memory" ); 1590 : "cc", "memory" );
1581 1591
1582 local_irq_disable();
1583
1584 stgi();
1585
1586 if ((svm->vmcb->save.dr7 & 0xff)) 1592 if ((svm->vmcb->save.dr7 & 0xff))
1587 load_db_regs(svm->host_db_regs); 1593 load_db_regs(svm->host_db_regs);
1588 1594
@@ -1599,6 +1605,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1599 1605
1600 reload_tss(vcpu); 1606 reload_tss(vcpu);
1601 1607
1608 local_irq_disable();
1609
1610 stgi();
1611
1602 svm->next_rip = 0; 1612 svm->next_rip = 0;
1603} 1613}
1604 1614
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index a6ace302e0cd..33b181451557 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -167,7 +167,7 @@ static u8 opcode_table[256] = {
167static u16 twobyte_table[256] = { 167static u16 twobyte_table[256] = {
168 /* 0x00 - 0x0F */ 168 /* 0x00 - 0x0F */
169 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0, 169 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0,
170 0, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 170 ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0,
171 /* 0x10 - 0x1F */ 171 /* 0x10 - 0x1F */
172 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, 172 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0,
173 /* 0x20 - 0x2F */ 173 /* 0x20 - 0x2F */
@@ -980,17 +980,6 @@ done_prefixes:
980 goto cannot_emulate; 980 goto cannot_emulate;
981 dst.val = (s32) src.val; 981 dst.val = (s32) src.val;
982 break; 982 break;
983 case 0x6a: /* push imm8 */
984 src.val = 0L;
985 src.val = insn_fetch(s8, 1, _eip);
986push:
987 dst.type = OP_MEM;
988 dst.bytes = op_bytes;
989 dst.val = src.val;
990 register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes);
991 dst.ptr = (void *) register_address(ctxt->ss_base,
992 _regs[VCPU_REGS_RSP]);
993 break;
994 case 0x80 ... 0x83: /* Grp1 */ 983 case 0x80 ... 0x83: /* Grp1 */
995 switch (modrm_reg) { 984 switch (modrm_reg) {
996 case 0: 985 case 0:
@@ -1243,6 +1232,17 @@ special_insn:
1243 register_address_increment(_regs[VCPU_REGS_RSP], op_bytes); 1232 register_address_increment(_regs[VCPU_REGS_RSP], op_bytes);
1244 no_wb = 1; /* Disable writeback. */ 1233 no_wb = 1; /* Disable writeback. */
1245 break; 1234 break;
1235 case 0x6a: /* push imm8 */
1236 src.val = 0L;
1237 src.val = insn_fetch(s8, 1, _eip);
1238 push:
1239 dst.type = OP_MEM;
1240 dst.bytes = op_bytes;
1241 dst.val = src.val;
1242 register_address_increment(_regs[VCPU_REGS_RSP], -op_bytes);
1243 dst.ptr = (void *) register_address(ctxt->ss_base,
1244 _regs[VCPU_REGS_RSP]);
1245 break;
1246 case 0x6c: /* insb */ 1246 case 0x6c: /* insb */
1247 case 0x6d: /* insw/insd */ 1247 case 0x6d: /* insw/insd */
1248 if (kvm_emulate_pio_string(ctxt->vcpu, NULL, 1248 if (kvm_emulate_pio_string(ctxt->vcpu, NULL,
@@ -1532,6 +1532,8 @@ twobyte_special_insn:
1532 case 0x06: 1532 case 0x06:
1533 emulate_clts(ctxt->vcpu); 1533 emulate_clts(ctxt->vcpu);
1534 break; 1534 break;
1535 case 0x08: /* invd */
1536 break;
1535 case 0x09: /* wbinvd */ 1537 case 0x09: /* wbinvd */
1536 break; 1538 break;
1537 case 0x0d: /* GrpP (prefetch) */ 1539 case 0x0d: /* GrpP (prefetch) */
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 47d90db280ce..99bc50059d35 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -60,7 +60,7 @@ static void gpio_led_set(struct led_classdev *led_cdev,
60 gpio_set_value(led_dat->gpio, level); 60 gpio_set_value(led_dat->gpio, level);
61} 61}
62 62
63static int __init gpio_led_probe(struct platform_device *pdev) 63static int gpio_led_probe(struct platform_device *pdev)
64{ 64{
65 struct gpio_led_platform_data *pdata = pdev->dev.platform_data; 65 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
66 struct gpio_led *cur_led; 66 struct gpio_led *cur_led;
@@ -93,13 +93,13 @@ static int __init gpio_led_probe(struct platform_device *pdev)
93 93
94 gpio_direction_output(led_dat->gpio, led_dat->active_low); 94 gpio_direction_output(led_dat->gpio, led_dat->active_low);
95 95
96 INIT_WORK(&led_dat->work, gpio_led_work);
97
96 ret = led_classdev_register(&pdev->dev, &led_dat->cdev); 98 ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
97 if (ret < 0) { 99 if (ret < 0) {
98 gpio_free(led_dat->gpio); 100 gpio_free(led_dat->gpio);
99 goto err; 101 goto err;
100 } 102 }
101
102 INIT_WORK(&led_dat->work, gpio_led_work);
103 } 103 }
104 104
105 platform_set_drvdata(pdev, leds_data); 105 platform_set_drvdata(pdev, leds_data);
@@ -110,17 +110,17 @@ err:
110 if (i > 0) { 110 if (i > 0) {
111 for (i = i - 1; i >= 0; i--) { 111 for (i = i - 1; i >= 0; i--) {
112 led_classdev_unregister(&leds_data[i].cdev); 112 led_classdev_unregister(&leds_data[i].cdev);
113 cancel_work_sync(&leds_data[i].work);
113 gpio_free(leds_data[i].gpio); 114 gpio_free(leds_data[i].gpio);
114 } 115 }
115 } 116 }
116 117
117 flush_scheduled_work();
118 kfree(leds_data); 118 kfree(leds_data);
119 119
120 return ret; 120 return ret;
121} 121}
122 122
123static int __exit gpio_led_remove(struct platform_device *pdev) 123static int __devexit gpio_led_remove(struct platform_device *pdev)
124{ 124{
125 int i; 125 int i;
126 struct gpio_led_platform_data *pdata = pdev->dev.platform_data; 126 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
@@ -130,9 +130,10 @@ static int __exit gpio_led_remove(struct platform_device *pdev)
130 130
131 for (i = 0; i < pdata->num_leds; i++) { 131 for (i = 0; i < pdata->num_leds; i++) {
132 led_classdev_unregister(&leds_data[i].cdev); 132 led_classdev_unregister(&leds_data[i].cdev);
133 cancel_work_sync(&leds_data[i].work);
133 gpio_free(leds_data[i].gpio); 134 gpio_free(leds_data[i].gpio);
134 } 135 }
135 136
136 kfree(leds_data); 137 kfree(leds_data);
137 138
138 return 0; 139 return 0;
@@ -144,7 +145,7 @@ static int gpio_led_suspend(struct platform_device *pdev, pm_message_t state)
144 struct gpio_led_platform_data *pdata = pdev->dev.platform_data; 145 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
145 struct gpio_led_data *leds_data; 146 struct gpio_led_data *leds_data;
146 int i; 147 int i;
147 148
148 leds_data = platform_get_drvdata(pdev); 149 leds_data = platform_get_drvdata(pdev);
149 150
150 for (i = 0; i < pdata->num_leds; i++) 151 for (i = 0; i < pdata->num_leds; i++)
@@ -172,7 +173,8 @@ static int gpio_led_resume(struct platform_device *pdev)
172#endif 173#endif
173 174
174static struct platform_driver gpio_led_driver = { 175static struct platform_driver gpio_led_driver = {
175 .remove = __exit_p(gpio_led_remove), 176 .probe = gpio_led_probe,
177 .remove = __devexit_p(gpio_led_remove),
176 .suspend = gpio_led_suspend, 178 .suspend = gpio_led_suspend,
177 .resume = gpio_led_resume, 179 .resume = gpio_led_resume,
178 .driver = { 180 .driver = {
@@ -183,7 +185,7 @@ static struct platform_driver gpio_led_driver = {
183 185
184static int __init gpio_led_init(void) 186static int __init gpio_led_init(void)
185{ 187{
186 return platform_driver_probe(&gpio_led_driver, gpio_led_probe); 188 return platform_driver_register(&gpio_led_driver);
187} 189}
188 190
189static void __exit gpio_led_exit(void) 191static void __exit gpio_led_exit(void)
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 8904f72f97c6..e2eec38c83c2 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -200,7 +200,8 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev,
200 200
201 /* Figure out how many pages the ring will take, and map that memory */ 201 /* Figure out how many pages the ring will take, and map that memory */
202 lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT, 202 lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT,
203 DIV_ROUND_UP(vring_size(lvq->config.num), 203 DIV_ROUND_UP(vring_size(lvq->config.num,
204 PAGE_SIZE),
204 PAGE_SIZE)); 205 PAGE_SIZE));
205 if (!lvq->pages) { 206 if (!lvq->pages) {
206 err = -ENOMEM; 207 err = -ENOMEM;
@@ -246,6 +247,8 @@ static void lg_del_vq(struct virtqueue *vq)
246{ 247{
247 struct lguest_vq_info *lvq = vq->priv; 248 struct lguest_vq_info *lvq = vq->priv;
248 249
250 /* Release the interrupt */
251 free_irq(lvq->config.irq, vq);
249 /* Tell virtio_ring.c to free the virtqueue. */ 252 /* Tell virtio_ring.c to free the virtqueue. */
250 vring_del_virtqueue(vq); 253 vring_del_virtqueue(vq);
251 /* Unmap the pages containing the ring. */ 254 /* Unmap the pages containing the ring. */
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 9d716fa42cad..3b92a61ba8d2 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -184,7 +184,7 @@ static int initialize(struct file *file, const unsigned long __user *input)
184free_regs: 184free_regs:
185 free_page(lg->regs_page); 185 free_page(lg->regs_page);
186release_guest: 186release_guest:
187 memset(lg, 0, sizeof(*lg)); 187 kfree(lg);
188unlock: 188unlock:
189 mutex_unlock(&lguest_lock); 189 mutex_unlock(&lguest_lock);
190 return err; 190 return err;
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 516d943227e2..075b4d99e354 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -94,7 +94,9 @@ static int wf_thread_func(void *data)
94 DBG("wf: thread started\n"); 94 DBG("wf: thread started\n");
95 95
96 set_freezable(); 96 set_freezable();
97 while(!kthread_should_stop()) { 97 while (!kthread_should_stop()) {
98 try_to_freeze();
99
98 if (time_after_eq(jiffies, next)) { 100 if (time_after_eq(jiffies, next)) {
99 wf_notify(WF_EVENT_TICK, NULL); 101 wf_notify(WF_EVENT_TICK, NULL);
100 if (wf_overtemp) { 102 if (wf_overtemp) {
@@ -116,12 +118,6 @@ static int wf_thread_func(void *data)
116 delay = next - jiffies; 118 delay = next - jiffies;
117 if (delay <= HZ) 119 if (delay <= HZ)
118 schedule_timeout_interruptible(delay); 120 schedule_timeout_interruptible(delay);
119
120 /* there should be no non-suspend signal, but oh well */
121 if (signal_pending(current) && !try_to_freeze()) {
122 printk(KERN_WARNING "windfarm: thread got sigl !\n");
123 break;
124 }
125 } 121 }
126 122
127 DBG("wf: thread stopped\n"); 123 DBG("wf: thread stopped\n");
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 7c426d07a555..1b1ef3130e6e 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1207,8 +1207,7 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
1207 prepare_to_wait(&bitmap->overflow_wait, &__wait, 1207 prepare_to_wait(&bitmap->overflow_wait, &__wait,
1208 TASK_UNINTERRUPTIBLE); 1208 TASK_UNINTERRUPTIBLE);
1209 spin_unlock_irq(&bitmap->lock); 1209 spin_unlock_irq(&bitmap->lock);
1210 bitmap->mddev->queue 1210 blk_unplug(bitmap->mddev->queue);
1211 ->unplug_fn(bitmap->mddev->queue);
1212 schedule(); 1211 schedule();
1213 finish_wait(&bitmap->overflow_wait, &__wait); 1212 finish_wait(&bitmap->overflow_wait, &__wait);
1214 continue; 1213 continue;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 8939e6105088..e298d8d11f24 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -102,6 +102,8 @@ static void combine_restrictions_low(struct io_restrictions *lhs,
102 lhs->seg_boundary_mask = 102 lhs->seg_boundary_mask =
103 min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask); 103 min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask);
104 104
105 lhs->bounce_pfn = min_not_zero(lhs->bounce_pfn, rhs->bounce_pfn);
106
105 lhs->no_cluster |= rhs->no_cluster; 107 lhs->no_cluster |= rhs->no_cluster;
106} 108}
107 109
@@ -566,6 +568,8 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
566 min_not_zero(rs->seg_boundary_mask, 568 min_not_zero(rs->seg_boundary_mask,
567 q->seg_boundary_mask); 569 q->seg_boundary_mask);
568 570
571 rs->bounce_pfn = min_not_zero(rs->bounce_pfn, q->bounce_pfn);
572
569 rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); 573 rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
570} 574}
571EXPORT_SYMBOL_GPL(dm_set_device_limits); 575EXPORT_SYMBOL_GPL(dm_set_device_limits);
@@ -707,6 +711,8 @@ static void check_for_valid_limits(struct io_restrictions *rs)
707 rs->max_segment_size = MAX_SEGMENT_SIZE; 711 rs->max_segment_size = MAX_SEGMENT_SIZE;
708 if (!rs->seg_boundary_mask) 712 if (!rs->seg_boundary_mask)
709 rs->seg_boundary_mask = -1; 713 rs->seg_boundary_mask = -1;
714 if (!rs->bounce_pfn)
715 rs->bounce_pfn = -1;
710} 716}
711 717
712int dm_table_add_target(struct dm_table *t, const char *type, 718int dm_table_add_target(struct dm_table *t, const char *type,
@@ -891,6 +897,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
891 q->hardsect_size = t->limits.hardsect_size; 897 q->hardsect_size = t->limits.hardsect_size;
892 q->max_segment_size = t->limits.max_segment_size; 898 q->max_segment_size = t->limits.max_segment_size;
893 q->seg_boundary_mask = t->limits.seg_boundary_mask; 899 q->seg_boundary_mask = t->limits.seg_boundary_mask;
900 q->bounce_pfn = t->limits.bounce_pfn;
894 if (t->limits.no_cluster) 901 if (t->limits.no_cluster)
895 q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER); 902 q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER);
896 else 903 else
@@ -993,8 +1000,7 @@ void dm_table_unplug_all(struct dm_table *t)
993 struct dm_dev *dd = list_entry(d, struct dm_dev, list); 1000 struct dm_dev *dd = list_entry(d, struct dm_dev, list);
994 struct request_queue *q = bdev_get_queue(dd->bdev); 1001 struct request_queue *q = bdev_get_queue(dd->bdev);
995 1002
996 if (q->unplug_fn) 1003 blk_unplug(q);
997 q->unplug_fn(q);
998 } 1004 }
999} 1005}
1000 1006
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 56a11f6c127b..3dac1cfb8189 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -87,8 +87,7 @@ static void linear_unplug(struct request_queue *q)
87 87
88 for (i=0; i < mddev->raid_disks; i++) { 88 for (i=0; i < mddev->raid_disks; i++) {
89 struct request_queue *r_queue = bdev_get_queue(conf->disks[i].rdev->bdev); 89 struct request_queue *r_queue = bdev_get_queue(conf->disks[i].rdev->bdev);
90 if (r_queue->unplug_fn) 90 blk_unplug(r_queue);
91 r_queue->unplug_fn(r_queue);
92 } 91 }
93} 92}
94 93
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 808cd9549456..cef9ebd5a046 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5445,7 +5445,7 @@ void md_do_sync(mddev_t *mddev)
5445 * about not overloading the IO subsystem. (things like an 5445 * about not overloading the IO subsystem. (things like an
5446 * e2fsck being done on the RAID array should execute fast) 5446 * e2fsck being done on the RAID array should execute fast)
5447 */ 5447 */
5448 mddev->queue->unplug_fn(mddev->queue); 5448 blk_unplug(mddev->queue);
5449 cond_resched(); 5449 cond_resched();
5450 5450
5451 currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2 5451 currspeed = ((unsigned long)(io_sectors-mddev->resync_mark_cnt))/2
@@ -5464,7 +5464,7 @@ void md_do_sync(mddev_t *mddev)
5464 * this also signals 'finished resyncing' to md_stop 5464 * this also signals 'finished resyncing' to md_stop
5465 */ 5465 */
5466 out: 5466 out:
5467 mddev->queue->unplug_fn(mddev->queue); 5467 blk_unplug(mddev->queue);
5468 5468
5469 wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); 5469 wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active));
5470 5470
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index b35731cceac6..eb631ebed686 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -125,8 +125,7 @@ static void unplug_slaves(mddev_t *mddev)
125 atomic_inc(&rdev->nr_pending); 125 atomic_inc(&rdev->nr_pending);
126 rcu_read_unlock(); 126 rcu_read_unlock();
127 127
128 if (r_queue->unplug_fn) 128 blk_unplug(r_queue);
129 r_queue->unplug_fn(r_queue);
130 129
131 rdev_dec_pending(rdev, mddev); 130 rdev_dec_pending(rdev, mddev);
132 rcu_read_lock(); 131 rcu_read_lock();
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index c111105fc2dc..f8e591708d1f 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -35,8 +35,7 @@ static void raid0_unplug(struct request_queue *q)
35 for (i=0; i<mddev->raid_disks; i++) { 35 for (i=0; i<mddev->raid_disks; i++) {
36 struct request_queue *r_queue = bdev_get_queue(devlist[i]->bdev); 36 struct request_queue *r_queue = bdev_get_queue(devlist[i]->bdev);
37 37
38 if (r_queue->unplug_fn) 38 blk_unplug(r_queue);
39 r_queue->unplug_fn(r_queue);
40 } 39 }
41} 40}
42 41
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 85478d6a9c1a..4a69c416e045 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -549,8 +549,7 @@ static void unplug_slaves(mddev_t *mddev)
549 atomic_inc(&rdev->nr_pending); 549 atomic_inc(&rdev->nr_pending);
550 rcu_read_unlock(); 550 rcu_read_unlock();
551 551
552 if (r_queue->unplug_fn) 552 blk_unplug(r_queue);
553 r_queue->unplug_fn(r_queue);
554 553
555 rdev_dec_pending(rdev, mddev); 554 rdev_dec_pending(rdev, mddev);
556 rcu_read_lock(); 555 rcu_read_lock();
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index fc6607acb6e4..5cdcc9386200 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -593,8 +593,7 @@ static void unplug_slaves(mddev_t *mddev)
593 atomic_inc(&rdev->nr_pending); 593 atomic_inc(&rdev->nr_pending);
594 rcu_read_unlock(); 594 rcu_read_unlock();
595 595
596 if (r_queue->unplug_fn) 596 blk_unplug(r_queue);
597 r_queue->unplug_fn(r_queue);
598 597
599 rdev_dec_pending(rdev, mddev); 598 rdev_dec_pending(rdev, mddev);
600 rcu_read_lock(); 599 rcu_read_lock();
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 80a67d789b72..a5aad8cad843 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -688,7 +688,8 @@ ops_run_prexor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx)
688} 688}
689 689
690static struct dma_async_tx_descriptor * 690static struct dma_async_tx_descriptor *
691ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) 691ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx,
692 unsigned long pending)
692{ 693{
693 int disks = sh->disks; 694 int disks = sh->disks;
694 int pd_idx = sh->pd_idx, i; 695 int pd_idx = sh->pd_idx, i;
@@ -696,7 +697,7 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx)
696 /* check if prexor is active which means only process blocks 697 /* check if prexor is active which means only process blocks
697 * that are part of a read-modify-write (Wantprexor) 698 * that are part of a read-modify-write (Wantprexor)
698 */ 699 */
699 int prexor = test_bit(STRIPE_OP_PREXOR, &sh->ops.pending); 700 int prexor = test_bit(STRIPE_OP_PREXOR, &pending);
700 701
701 pr_debug("%s: stripe %llu\n", __FUNCTION__, 702 pr_debug("%s: stripe %llu\n", __FUNCTION__,
702 (unsigned long long)sh->sector); 703 (unsigned long long)sh->sector);
@@ -773,7 +774,8 @@ static void ops_complete_write(void *stripe_head_ref)
773} 774}
774 775
775static void 776static void
776ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) 777ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx,
778 unsigned long pending)
777{ 779{
778 /* kernel stack size limits the total number of disks */ 780 /* kernel stack size limits the total number of disks */
779 int disks = sh->disks; 781 int disks = sh->disks;
@@ -781,7 +783,7 @@ ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx)
781 783
782 int count = 0, pd_idx = sh->pd_idx, i; 784 int count = 0, pd_idx = sh->pd_idx, i;
783 struct page *xor_dest; 785 struct page *xor_dest;
784 int prexor = test_bit(STRIPE_OP_PREXOR, &sh->ops.pending); 786 int prexor = test_bit(STRIPE_OP_PREXOR, &pending);
785 unsigned long flags; 787 unsigned long flags;
786 dma_async_tx_callback callback; 788 dma_async_tx_callback callback;
787 789
@@ -808,7 +810,7 @@ ops_run_postxor(struct stripe_head *sh, struct dma_async_tx_descriptor *tx)
808 } 810 }
809 811
810 /* check whether this postxor is part of a write */ 812 /* check whether this postxor is part of a write */
811 callback = test_bit(STRIPE_OP_BIODRAIN, &sh->ops.pending) ? 813 callback = test_bit(STRIPE_OP_BIODRAIN, &pending) ?
812 ops_complete_write : ops_complete_postxor; 814 ops_complete_write : ops_complete_postxor;
813 815
814 /* 1/ if we prexor'd then the dest is reused as a source 816 /* 1/ if we prexor'd then the dest is reused as a source
@@ -896,12 +898,12 @@ static void raid5_run_ops(struct stripe_head *sh, unsigned long pending)
896 tx = ops_run_prexor(sh, tx); 898 tx = ops_run_prexor(sh, tx);
897 899
898 if (test_bit(STRIPE_OP_BIODRAIN, &pending)) { 900 if (test_bit(STRIPE_OP_BIODRAIN, &pending)) {
899 tx = ops_run_biodrain(sh, tx); 901 tx = ops_run_biodrain(sh, tx, pending);
900 overlap_clear++; 902 overlap_clear++;
901 } 903 }
902 904
903 if (test_bit(STRIPE_OP_POSTXOR, &pending)) 905 if (test_bit(STRIPE_OP_POSTXOR, &pending))
904 ops_run_postxor(sh, tx); 906 ops_run_postxor(sh, tx, pending);
905 907
906 if (test_bit(STRIPE_OP_CHECK, &pending)) 908 if (test_bit(STRIPE_OP_CHECK, &pending))
907 ops_run_check(sh); 909 ops_run_check(sh);
@@ -2624,6 +2626,13 @@ static void handle_stripe5(struct stripe_head *sh)
2624 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state); 2626 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state);
2625 /* Now to look around and see what can be done */ 2627 /* Now to look around and see what can be done */
2626 2628
2629 /* clean-up completed biofill operations */
2630 if (test_bit(STRIPE_OP_BIOFILL, &sh->ops.complete)) {
2631 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending);
2632 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack);
2633 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.complete);
2634 }
2635
2627 rcu_read_lock(); 2636 rcu_read_lock();
2628 for (i=disks; i--; ) { 2637 for (i=disks; i--; ) {
2629 mdk_rdev_t *rdev; 2638 mdk_rdev_t *rdev;
@@ -2897,13 +2906,6 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
2897 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state); 2906 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state);
2898 /* Now to look around and see what can be done */ 2907 /* Now to look around and see what can be done */
2899 2908
2900 /* clean-up completed biofill operations */
2901 if (test_bit(STRIPE_OP_BIOFILL, &sh->ops.complete)) {
2902 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending);
2903 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack);
2904 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.complete);
2905 }
2906
2907 rcu_read_lock(); 2909 rcu_read_lock();
2908 for (i=disks; i--; ) { 2910 for (i=disks; i--; ) {
2909 mdk_rdev_t *rdev; 2911 mdk_rdev_t *rdev;
@@ -3186,8 +3188,7 @@ static void unplug_slaves(mddev_t *mddev)
3186 atomic_inc(&rdev->nr_pending); 3188 atomic_inc(&rdev->nr_pending);
3187 rcu_read_unlock(); 3189 rcu_read_unlock();
3188 3190
3189 if (r_queue->unplug_fn) 3191 blk_unplug(r_queue);
3190 r_queue->unplug_fn(r_queue);
3191 3192
3192 rdev_dec_pending(rdev, mddev); 3193 rdev_dec_pending(rdev, mddev);
3193 rcu_read_lock(); 3194 rcu_read_lock();
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/Kconfig b/drivers/media/Kconfig
index dd9bd4310c84..1604f0490404 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -151,6 +151,7 @@ config VIDEO_IR_I2C
151 151
152config VIDEO_IR 152config VIDEO_IR
153 tristate 153 tristate
154 depends on INPUT
154 select VIDEO_IR_I2C if I2C 155 select VIDEO_IR_I2C if I2C
155 156
156config VIDEO_TVEEPROM 157config VIDEO_TVEEPROM
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index cb034ead95ab..7d04a6fd1acb 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -59,43 +59,89 @@ void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data)
59} 59}
60 60
61/* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */ 61/* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */
62int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop) 62static inline int saa7146_wait_for_debi_done_sleep(struct saa7146_dev *dev,
63 unsigned long us1, unsigned long us2)
63{ 64{
64 unsigned long start; 65 unsigned long timeout;
65 int err; 66 int err;
66 67
67 /* wait for registers to be programmed */ 68 /* wait for registers to be programmed */
68 start = jiffies; 69 timeout = jiffies + usecs_to_jiffies(us1);
69 while (1) { 70 while (1) {
70 err = time_after(jiffies, start + HZ/20); 71 err = time_after(jiffies, timeout);
71 if (saa7146_read(dev, MC2) & 2) 72 if (saa7146_read(dev, MC2) & 2)
72 break; 73 break;
73 if (err) { 74 if (err) {
74 DEB_S(("timed out while waiting for registers getting programmed\n")); 75 printk(KERN_ERR "%s: %s timed out while waiting for "
76 "registers getting programmed\n",
77 dev->name, __FUNCTION__);
75 return -ETIMEDOUT; 78 return -ETIMEDOUT;
76 } 79 }
77 if (nobusyloop) 80 msleep(1);
78 msleep(1);
79 } 81 }
80 82
81 /* wait for transfer to complete */ 83 /* wait for transfer to complete */
82 start = jiffies; 84 timeout = jiffies + usecs_to_jiffies(us2);
83 while (1) { 85 while (1) {
84 err = time_after(jiffies, start + HZ/4); 86 err = time_after(jiffies, timeout);
85 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) 87 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
86 break; 88 break;
87 saa7146_read(dev, MC2); 89 saa7146_read(dev, MC2);
88 if (err) { 90 if (err) {
89 DEB_S(("timed out while waiting for transfer completion\n")); 91 DEB_S(("%s: %s timed out while waiting for transfer "
92 "completion\n", dev->name, __FUNCTION__));
90 return -ETIMEDOUT; 93 return -ETIMEDOUT;
91 } 94 }
92 if (nobusyloop) 95 msleep(1);
93 msleep(1);
94 } 96 }
95 97
96 return 0; 98 return 0;
97} 99}
98 100
101static inline int saa7146_wait_for_debi_done_busyloop(struct saa7146_dev *dev,
102 unsigned long us1, unsigned long us2)
103{
104 unsigned long loops;
105
106 /* wait for registers to be programmed */
107 loops = us1;
108 while (1) {
109 if (saa7146_read(dev, MC2) & 2)
110 break;
111 if (!loops--) {
112 printk(KERN_ERR "%s: %s timed out while waiting for "
113 "registers getting programmed\n",
114 dev->name, __FUNCTION__);
115 return -ETIMEDOUT;
116 }
117 udelay(1);
118 }
119
120 /* wait for transfer to complete */
121 loops = us2 / 5;
122 while (1) {
123 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
124 break;
125 saa7146_read(dev, MC2);
126 if (!loops--) {
127 DEB_S(("%s: %s timed out while waiting for transfer "
128 "completion\n", dev->name, __FUNCTION__));
129 return -ETIMEDOUT;
130 }
131 udelay(5);
132 }
133
134 return 0;
135}
136
137int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop)
138{
139 if (nobusyloop)
140 return saa7146_wait_for_debi_done_sleep(dev, 50000, 250000);
141 else
142 return saa7146_wait_for_debi_done_busyloop(dev, 50000, 250000);
143}
144
99/**************************************************************************** 145/****************************************************************************
100 * general helper functions 146 * general helper functions
101 ****************************************************************************/ 147 ****************************************************************************/
diff --git a/drivers/media/dvb/frontends/mt2131.c b/drivers/media/dvb/frontends/mt2131.c
index 4b93931de4e1..13cf16668171 100644
--- a/drivers/media/dvb/frontends/mt2131.c
+++ b/drivers/media/dvb/frontends/mt2131.c
@@ -116,7 +116,7 @@ static int mt2131_set_params(struct dvb_frontend *fe,
116 f_lo1 = (f_lo1 / 250) * 250; 116 f_lo1 = (f_lo1 / 250) * 250;
117 f_lo2 = f_lo1 - freq - MT2131_IF2; 117 f_lo2 = f_lo1 - freq - MT2131_IF2;
118 118
119 priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000, 119 priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000;
120 120
121 /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */ 121 /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */
122 num1 = f_lo1 * 64 / (MT2131_FREF / 128); 122 num1 = f_lo1 * 64 / (MT2131_FREF / 128);
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c
index 30e8a705fad4..8dee7ec9456a 100644
--- a/drivers/media/dvb/frontends/s5h1409.c
+++ b/drivers/media/dvb/frontends/s5h1409.c
@@ -42,6 +42,9 @@ struct s5h1409_state {
42 fe_modulation_t current_modulation; 42 fe_modulation_t current_modulation;
43 43
44 u32 current_frequency; 44 u32 current_frequency;
45
46 u32 is_qam_locked;
47 u32 qam_state;
45}; 48};
46 49
47static int debug = 0; 50static int debug = 0;
@@ -94,6 +97,7 @@ static struct init_tab {
94 { 0xac, 0x1003, }, 97 { 0xac, 0x1003, },
95 { 0xad, 0x103f, }, 98 { 0xad, 0x103f, },
96 { 0xe2, 0x0100, }, 99 { 0xe2, 0x0100, },
100 { 0xe3, 0x0000, },
97 { 0x28, 0x1010, }, 101 { 0x28, 0x1010, },
98 { 0xb1, 0x000e, }, 102 { 0xb1, 0x000e, },
99}; 103};
@@ -335,6 +339,8 @@ static int s5h1409_softreset(struct dvb_frontend* fe)
335 339
336 s5h1409_writereg(state, 0xf5, 0); 340 s5h1409_writereg(state, 0xf5, 0);
337 s5h1409_writereg(state, 0xf5, 1); 341 s5h1409_writereg(state, 0xf5, 1);
342 state->is_qam_locked = 0;
343 state->qam_state = 0;
338 return 0; 344 return 0;
339} 345}
340 346
@@ -349,6 +355,11 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz)
349 s5h1409_writereg(state, 0x87, 0x01be); 355 s5h1409_writereg(state, 0x87, 0x01be);
350 s5h1409_writereg(state, 0x88, 0x0436); 356 s5h1409_writereg(state, 0x88, 0x0436);
351 s5h1409_writereg(state, 0x89, 0x054d); 357 s5h1409_writereg(state, 0x89, 0x054d);
358 } else
359 if (KHz == 4000) {
360 s5h1409_writereg(state, 0x87, 0x014b);
361 s5h1409_writereg(state, 0x88, 0x0cb5);
362 s5h1409_writereg(state, 0x89, 0x03e2);
352 } else { 363 } else {
353 printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz); 364 printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz);
354 ret = -1; 365 ret = -1;
@@ -361,7 +372,7 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted)
361{ 372{
362 struct s5h1409_state* state = fe->demodulator_priv; 373 struct s5h1409_state* state = fe->demodulator_priv;
363 374
364 dprintk("%s()\n", __FUNCTION__); 375 dprintk("%s(%d)\n", __FUNCTION__, inverted);
365 376
366 if(inverted == 1) 377 if(inverted == 1)
367 return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ 378 return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */
@@ -382,14 +393,10 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe,
382 s5h1409_writereg(state, 0xf4, 0); 393 s5h1409_writereg(state, 0xf4, 0);
383 break; 394 break;
384 case QAM_64: 395 case QAM_64:
385 dprintk("%s() QAM_64\n", __FUNCTION__);
386 s5h1409_writereg(state, 0xf4, 1);
387 s5h1409_writereg(state, 0x85, 0x100);
388 break;
389 case QAM_256: 396 case QAM_256:
390 dprintk("%s() QAM_256\n", __FUNCTION__); 397 dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__);
391 s5h1409_writereg(state, 0xf4, 1); 398 s5h1409_writereg(state, 0xf4, 1);
392 s5h1409_writereg(state, 0x85, 0x101); 399 s5h1409_writereg(state, 0x85, 0x110);
393 break; 400 break;
394 default: 401 default:
395 dprintk("%s() Invalid modulation\n", __FUNCTION__); 402 dprintk("%s() Invalid modulation\n", __FUNCTION__);
@@ -423,7 +430,7 @@ static int s5h1409_set_gpio(struct dvb_frontend* fe, int enable)
423 if (enable) 430 if (enable)
424 return s5h1409_writereg(state, 0xe3, 0x1100); 431 return s5h1409_writereg(state, 0xe3, 0x1100);
425 else 432 else
426 return s5h1409_writereg(state, 0xe3, 0); 433 return s5h1409_writereg(state, 0xe3, 0x1000);
427} 434}
428 435
429static int s5h1409_sleep(struct dvb_frontend* fe, int enable) 436static int s5h1409_sleep(struct dvb_frontend* fe, int enable)
@@ -444,6 +451,66 @@ static int s5h1409_register_reset(struct dvb_frontend* fe)
444 return s5h1409_writereg(state, 0xfa, 0); 451 return s5h1409_writereg(state, 0xfa, 0);
445} 452}
446 453
454static void s5h1409_set_qam_amhum_mode(struct dvb_frontend *fe)
455{
456 struct s5h1409_state *state = fe->demodulator_priv;
457 u16 reg;
458
459 if (state->is_qam_locked)
460 return;
461
462 /* QAM EQ lock check */
463 reg = s5h1409_readreg(state, 0xf0);
464
465 if ((reg >> 13) & 0x1) {
466
467 state->is_qam_locked = 1;
468 reg &= 0xff;
469
470 s5h1409_writereg(state, 0x96, 0x00c);
471 if ((reg < 0x38) || (reg > 0x68) ) {
472 s5h1409_writereg(state, 0x93, 0x3332);
473 s5h1409_writereg(state, 0x9e, 0x2c37);
474 } else {
475 s5h1409_writereg(state, 0x93, 0x3130);
476 s5h1409_writereg(state, 0x9e, 0x2836);
477 }
478
479 } else {
480 s5h1409_writereg(state, 0x96, 0x0008);
481 s5h1409_writereg(state, 0x93, 0x3332);
482 s5h1409_writereg(state, 0x9e, 0x2c37);
483 }
484}
485
486static void s5h1409_set_qam_interleave_mode(struct dvb_frontend *fe)
487{
488 struct s5h1409_state *state = fe->demodulator_priv;
489 u16 reg, reg1, reg2;
490
491 reg = s5h1409_readreg(state, 0xf1);
492
493 /* Master lock */
494 if ((reg >> 15) & 0x1) {
495 if (state->qam_state != 2) {
496 state->qam_state = 2;
497 reg1 = s5h1409_readreg(state, 0xb2);
498 reg2 = s5h1409_readreg(state, 0xad);
499
500 s5h1409_writereg(state, 0x96, 0x20);
501 s5h1409_writereg(state, 0xad,
502 ( ((reg1 & 0xf000) >> 4) | (reg2 & 0xf0ff)) );
503 s5h1409_writereg(state, 0xab, 0x1100);
504 }
505 } else {
506 if (state->qam_state != 1) {
507 state->qam_state = 1;
508 s5h1409_writereg(state, 0x96, 0x08);
509 s5h1409_writereg(state, 0xab, 0x1101);
510 }
511 }
512}
513
447/* Talk to the demod, set the FEC, GUARD, QAM settings etc */ 514/* Talk to the demod, set the FEC, GUARD, QAM settings etc */
448static int s5h1409_set_frontend (struct dvb_frontend* fe, 515static int s5h1409_set_frontend (struct dvb_frontend* fe,
449 struct dvb_frontend_parameters *p) 516 struct dvb_frontend_parameters *p)
@@ -458,12 +525,21 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe,
458 525
459 s5h1409_enable_modulation(fe, p->u.vsb.modulation); 526 s5h1409_enable_modulation(fe, p->u.vsb.modulation);
460 527
528 /* Allow the demod to settle */
529 msleep(100);
530
461 if (fe->ops.tuner_ops.set_params) { 531 if (fe->ops.tuner_ops.set_params) {
462 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); 532 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1);
463 fe->ops.tuner_ops.set_params(fe, p); 533 fe->ops.tuner_ops.set_params(fe, p);
464 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); 534 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
465 } 535 }
466 536
537 /* Optimize the demod for QAM */
538 if (p->u.vsb.modulation != VSB_8) {
539 s5h1409_set_qam_amhum_mode(fe);
540 s5h1409_set_qam_interleave_mode(fe);
541 }
542
467 return 0; 543 return 0;
468} 544}
469 545
@@ -495,8 +571,8 @@ static int s5h1409_init (struct dvb_frontend* fe)
495 s5h1409_set_gpio(fe, state->config->gpio); 571 s5h1409_set_gpio(fe, state->config->gpio);
496 s5h1409_softreset(fe); 572 s5h1409_softreset(fe);
497 573
498 /* Note: Leaving the I2C gate open here. */ 574 /* Note: Leaving the I2C gate closed. */
499 s5h1409_i2c_gate_ctrl(fe, 1); 575 s5h1409_i2c_gate_ctrl(fe, 0);
500 576
501 return 0; 577 return 0;
502} 578}
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c
index 17e5cb561cd8..7c23775f77db 100644
--- a/drivers/media/dvb/frontends/stv0297.c
+++ b/drivers/media/dvb/frontends/stv0297.c
@@ -358,11 +358,23 @@ static int stv0297_read_ber(struct dvb_frontend *fe, u32 * ber)
358static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) 358static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength)
359{ 359{
360 struct stv0297_state *state = fe->demodulator_priv; 360 struct stv0297_state *state = fe->demodulator_priv;
361 u8 STRENGTH[2]; 361 u8 STRENGTH[3];
362 362 u16 tmp;
363 stv0297_readregs(state, 0x41, STRENGTH, 2); 363
364 *strength = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0]; 364 stv0297_readregs(state, 0x41, STRENGTH, 3);
365 365 tmp = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0];
366 if (STRENGTH[2] & 0x20) {
367 if (tmp < 0x200)
368 tmp = 0;
369 else
370 tmp = tmp - 0x200;
371 } else {
372 if (tmp > 0x1ff)
373 tmp = 0;
374 else
375 tmp = 0x1ff - tmp;
376 }
377 *strength = (tmp << 7) | (tmp >> 2);
366 return 0; 378 return 0;
367} 379}
368 380
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c
index 4cd9e82c4669..45137d2ebfb9 100644
--- a/drivers/media/dvb/frontends/tda10021.c
+++ b/drivers/media/dvb/frontends/tda10021.c
@@ -301,6 +301,8 @@ static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber)
301 u32 _ber = tda10021_readreg(state, 0x14) | 301 u32 _ber = tda10021_readreg(state, 0x14) |
302 (tda10021_readreg(state, 0x15) << 8) | 302 (tda10021_readreg(state, 0x15) << 8) |
303 ((tda10021_readreg(state, 0x16) & 0x0f) << 16); 303 ((tda10021_readreg(state, 0x16) & 0x0f) << 16);
304 _tda10021_writereg(state, 0x10, (tda10021_readreg(state, 0x10) & ~0xc0)
305 | (tda10021_inittab[0x10] & 0xc0));
304 *ber = 10 * _ber; 306 *ber = 10 * _ber;
305 307
306 return 0; 308 return 0;
@@ -310,7 +312,11 @@ static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength)
310{ 312{
311 struct tda10021_state* state = fe->demodulator_priv; 313 struct tda10021_state* state = fe->demodulator_priv;
312 314
315 u8 config = tda10021_readreg(state, 0x02);
313 u8 gain = tda10021_readreg(state, 0x17); 316 u8 gain = tda10021_readreg(state, 0x17);
317 if (config & 0x02)
318 /* the agc value is inverted */
319 gain = ~gain;
314 *strength = (gain << 8) | gain; 320 *strength = (gain << 8) | gain;
315 321
316 return 0; 322 return 0;
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c
index 066b73b75698..60433b5011fd 100644
--- a/drivers/media/dvb/frontends/ves1820.c
+++ b/drivers/media/dvb/frontends/ves1820.c
@@ -47,7 +47,7 @@ struct ves1820_state {
47static int verbose; 47static int verbose;
48 48
49static u8 ves1820_inittab[] = { 49static u8 ves1820_inittab[] = {
50 0x69, 0x6A, 0x93, 0x12, 0x12, 0x46, 0x26, 0x1A, 50 0x69, 0x6A, 0x93, 0x1A, 0x12, 0x46, 0x26, 0x1A,
51 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20, 51 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20,
52 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 52 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 53 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index 6d53289b3276..54b91f26ca63 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -84,7 +84,7 @@ config DVB_BUDGET
84 84
85config DVB_BUDGET_CI 85config DVB_BUDGET_CI
86 tristate "Budget cards with onboard CI connector" 86 tristate "Budget cards with onboard CI connector"
87 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 87 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 && INPUT
88 select VIDEO_SAA7146 88 select VIDEO_SAA7146
89 select DVB_STV0297 if !DVB_FE_CUSTOMISE 89 select DVB_STV0297 if !DVB_FE_CUSTOMISE
90 select DVB_STV0299 if !DVB_FE_CUSTOMISE 90 select DVB_STV0299 if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 2e571eb9313a..c9f14bfc8544 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -363,7 +363,7 @@ endmenu # encoder / decoder chips
363 363
364config VIDEO_VIVI 364config VIDEO_VIVI
365 tristate "Virtual Video Driver" 365 tristate "Virtual Video Driver"
366 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI 366 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64
367 select VIDEOBUF_VMALLOC 367 select VIDEOBUF_VMALLOC
368 default n 368 default n
369 ---help--- 369 ---help---
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 9feeb636ff9b..a88b56e6ca05 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2881,10 +2881,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2881 if (NULL == fmt) 2881 if (NULL == fmt)
2882 return -EINVAL; 2882 return -EINVAL;
2883 mutex_lock(&fh->cap.lock); 2883 mutex_lock(&fh->cap.lock);
2884 if (fmt->depth != pic->depth) {
2885 retval = -EINVAL;
2886 goto fh_unlock_and_return;
2887 }
2888 if (fmt->flags & FORMAT_FLAGS_RAW) { 2884 if (fmt->flags & FORMAT_FLAGS_RAW) {
2889 /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL * 2885 /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL *
2890 RAW_LINES * 2. F1 is stored at offset 0, F2 2886 RAW_LINES * 2. F1 is stored at offset 0, F2
@@ -3117,6 +3113,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
3117 vm->width,vm->height,field); 3113 vm->width,vm->height,field);
3118 if (0 != retval) 3114 if (0 != retval)
3119 goto fh_unlock_and_return; 3115 goto fh_unlock_and_return;
3116 btv->init.width = vm->width;
3117 btv->init.height = vm->height;
3120 spin_lock_irqsave(&btv->s_lock,flags); 3118 spin_lock_irqsave(&btv->s_lock,flags);
3121 buffer_queue(&fh->cap,&buf->vb); 3119 buffer_queue(&fh->cap,&buf->vb);
3122 spin_unlock_irqrestore(&btv->s_lock,flags); 3120 spin_unlock_irqrestore(&btv->s_lock,flags);
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index 0b92c35a8435..d4ac4c4b49b4 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -36,7 +36,7 @@
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/input.h> 37#include <linux/input.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <asm/scatterlist.h> 39#include <linux/scatterlist.h>
40#include <asm/io.h> 40#include <asm/io.h>
41#include <media/v4l2-common.h> 41#include <media/v4l2-common.h>
42 42
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index b63cab336920..7ae499c9c54c 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -3,6 +3,9 @@
3 * multifunction chip. Currently works with the Omnivision OV7670 3 * multifunction chip. Currently works with the Omnivision OV7670
4 * sensor. 4 * sensor.
5 * 5 *
6 * The data sheet for this device can be found at:
7 * http://www.marvell.com/products/pcconn/88ALP01.jsp
8 *
6 * Copyright 2006 One Laptop Per Child Association, Inc. 9 * Copyright 2006 One Laptop Per Child Association, Inc.
7 * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net> 10 * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net>
8 * 11 *
@@ -2232,13 +2235,16 @@ static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state)
2232{ 2235{
2233 struct cafe_camera *cam = cafe_find_by_pdev(pdev); 2236 struct cafe_camera *cam = cafe_find_by_pdev(pdev);
2234 int ret; 2237 int ret;
2238 enum cafe_state cstate;
2235 2239
2236 ret = pci_save_state(pdev); 2240 ret = pci_save_state(pdev);
2237 if (ret) 2241 if (ret)
2238 return ret; 2242 return ret;
2243 cstate = cam->state; /* HACK - stop_dma sets to idle */
2239 cafe_ctlr_stop_dma(cam); 2244 cafe_ctlr_stop_dma(cam);
2240 cafe_ctlr_power_down(cam); 2245 cafe_ctlr_power_down(cam);
2241 pci_disable_device(pdev); 2246 pci_disable_device(pdev);
2247 cam->state = cstate;
2242 return 0; 2248 return 0;
2243} 2249}
2244 2250
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig
index 72004a07b2d5..d8b1ccb44913 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_CX23885 1config VIDEO_CX23885
2 tristate "Conexant cx23885 (2388x successor) support" 2 tristate "Conexant cx23885 (2388x successor) support"
3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C 3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER 5 select FW_LOADER
6 select VIDEO_BTCX 6 select VIDEO_BTCX
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index eeb5224ca101..ceb31d4a2512 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_CX88 1config VIDEO_CX88
2 tristate "Conexant 2388x (bt878 successor) support" 2 tristate "Conexant 2388x (bt878 successor) support"
3 depends on VIDEO_DEV && PCI && I2C 3 depends on VIDEO_DEV && PCI && I2C && INPUT
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER 5 select FW_LOADER
6 select VIDEO_BTCX 6 select VIDEO_BTCX
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig
index 5b6a40371602..c1127802ad9c 100644
--- a/drivers/media/video/em28xx/Kconfig
+++ b/drivers/media/video/em28xx/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_EM28XX 1config VIDEO_EM28XX
2 tristate "Empia EM2800/2820/2840 USB video capture support" 2 tristate "Empia EM2800/2820/2840 USB video capture support"
3 depends on VIDEO_V4L1 && I2C 3 depends on VIDEO_V4L1 && I2C && INPUT
4 select VIDEO_TUNER 4 select VIDEO_TUNER
5 select VIDEO_TVEEPROM 5 select VIDEO_TVEEPROM
6 select VIDEO_IR 6 select VIDEO_IR
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 997d067e32e0..e3a4aa7a9df4 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -416,8 +416,10 @@ static int attach_inform(struct i2c_client *client)
416 struct em28xx *dev = client->adapter->algo_data; 416 struct em28xx *dev = client->adapter->algo_data;
417 417
418 switch (client->addr << 1) { 418 switch (client->addr << 1) {
419 case 0x43: 419 case 0x86:
420 case 0x4b: 420 case 0x84:
421 case 0x96:
422 case 0x94:
421 { 423 {
422 struct tuner_setup tun_setup; 424 struct tuner_setup tun_setup;
423 425
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index a4c2a907124a..2529c298b862 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -32,6 +32,7 @@
32#include <linux/usb.h> 32#include <linux/usb.h>
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/version.h> 34#include <linux/version.h>
35#include <linux/mm.h>
35#include <linux/video_decoder.h> 36#include <linux/video_decoder.h>
36#include <linux/mutex.h> 37#include <linux/mutex.h>
37 38
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/planb.c b/drivers/media/video/planb.c
index ce4b2f9791ee..36047d4e70f6 100644
--- a/drivers/media/video/planb.c
+++ b/drivers/media/video/planb.c
@@ -91,7 +91,6 @@ static void planb_close(struct video_device *);
91static int planb_ioctl(struct video_device *, unsigned int, void *); 91static int planb_ioctl(struct video_device *, unsigned int, void *);
92static int planb_init_done(struct video_device *); 92static int planb_init_done(struct video_device *);
93static int planb_mmap(struct video_device *, const char *, unsigned long); 93static int planb_mmap(struct video_device *, const char *, unsigned long);
94static void planb_irq(int, void *);
95static void release_planb(void); 94static void release_planb(void);
96int init_planbs(struct video_init *); 95int init_planbs(struct video_init *);
97 96
@@ -1315,7 +1314,7 @@ cmd_tab_data_end:
1315 return c1; 1314 return c1;
1316} 1315}
1317 1316
1318static void planb_irq(int irq, void *dev_id) 1317static irqreturn_t planb_irq(int irq, void *dev_id)
1319{ 1318{
1320 unsigned int stat, astat; 1319 unsigned int stat, astat;
1321 struct planb *pb = (struct planb *)dev_id; 1320 struct planb *pb = (struct planb *)dev_id;
@@ -1358,13 +1357,14 @@ static void planb_irq(int irq, void *dev_id)
1358 pb->frame_stat[fr] = GBUFFER_DONE; 1357 pb->frame_stat[fr] = GBUFFER_DONE;
1359 pb->grabbing--; 1358 pb->grabbing--;
1360 wake_up_interruptible(&pb->capq); 1359 wake_up_interruptible(&pb->capq);
1361 return; 1360 return IRQ_HANDLED;
1362 } 1361 }
1363 /* incorrect interrupts? */ 1362 /* incorrect interrupts? */
1364 pb->intr_mask = PLANB_CLR_IRQ; 1363 pb->intr_mask = PLANB_CLR_IRQ;
1365 out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ); 1364 out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ);
1366 printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts" 1365 printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts"
1367 " unconditionally\n"); 1366 " unconditionally\n");
1367 return IRQ_HANDLED;
1368} 1368}
1369 1369
1370/******************************* 1370/*******************************
@@ -2090,7 +2090,7 @@ static int init_planb(struct planb *pb)
2090 /* clear interrupt mask */ 2090 /* clear interrupt mask */
2091 pb->intr_mask = PLANB_CLR_IRQ; 2091 pb->intr_mask = PLANB_CLR_IRQ;
2092 2092
2093 result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); 2093 result = request_irq(pb->irq, planb_irq, 0, "PlanB", pb);
2094 if (result < 0) { 2094 if (result < 0) {
2095 if (result==-EINVAL) 2095 if (result==-EINVAL)
2096 printk(KERN_ERR "PlanB: Bad irq number (%d) " 2096 printk(KERN_ERR "PlanB: Bad irq number (%d) "
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index f569b00201dd..46f156fb108c 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -410,7 +410,7 @@ static int parse_mtoken(const char *ptr,unsigned int len,
410 int msk; 410 int msk;
411 *valptr = 0; 411 *valptr = 0;
412 for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) { 412 for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) {
413 if (!msk & valid_bits) continue; 413 if (!(msk & valid_bits)) continue;
414 valid_bits &= ~msk; 414 valid_bits &= ~msk;
415 if (!names[idx]) continue; 415 if (!names[idx]) continue;
416 slen = strlen(names[idx]); 416 slen = strlen(names[idx]);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c
index ca9e2789c8ca..11b3b2e84b90 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-main.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-main.c
@@ -136,14 +136,13 @@ static int __init pvr_init(void)
136 136
137static void __exit pvr_exit(void) 137static void __exit pvr_exit(void)
138{ 138{
139
140 pvr2_trace(PVR2_TRACE_INIT,"pvr_exit"); 139 pvr2_trace(PVR2_TRACE_INIT,"pvr_exit");
141 140
141 usb_deregister(&pvr_driver);
142
142#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS 143#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
143 pvr2_sysfs_class_destroy(class_ptr); 144 pvr2_sysfs_class_destroy(class_ptr);
144#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ 145#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
145
146 usb_deregister(&pvr_driver);
147} 146}
148 147
149module_init(pvr_init); 148module_init(pvr_init);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 2ee3c3049e8f..3c57a7d8200b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -905,13 +905,6 @@ struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *mp,
905} 905}
906 906
907 907
908static int pvr2_sysfs_hotplug(struct device *d,
909 struct kobj_uevent_env *env)
910{
911 /* Even though we don't do anything here, we still need this function
912 because sysfs will still try to call it. */
913 return 0;
914}
915 908
916struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) 909struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
917{ 910{
@@ -922,7 +915,6 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
922 clp->class.name = "pvrusb2"; 915 clp->class.name = "pvrusb2";
923 clp->class.class_release = pvr2_sysfs_class_release; 916 clp->class.class_release = pvr2_sysfs_class_release;
924 clp->class.dev_release = pvr2_sysfs_release; 917 clp->class.dev_release = pvr2_sysfs_release;
925 clp->class.dev_uevent = pvr2_sysfs_hotplug;
926 if (class_register(&clp->class)) { 918 if (class_register(&clp->class)) {
927 pvr2_sysfs_trace( 919 pvr2_sysfs_trace(
928 "Registration failed for pvr2_sysfs_class id=%p",clp); 920 "Registration failed for pvr2_sysfs_class id=%p",clp);
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index d6d8d660196d..3aa8cb2b860a 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_SAA7134 1config VIDEO_SAA7134
2 tristate "Philips SAA7134 support" 2 tristate "Philips SAA7134 support"
3 depends on VIDEO_DEV && PCI && I2C 3 depends on VIDEO_DEV && PCI && I2C && INPUT
4 select VIDEOBUF_DMA_SG 4 select VIDEOBUF_DMA_SG
5 select VIDEO_IR 5 select VIDEO_IR
6 select VIDEO_TUNER 6 select VIDEO_TUNER
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index c6f7279669c1..b9c5cf7dc849 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -543,8 +543,10 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
543 V4L functions, and force ALSA to use that as the DMA area */ 543 V4L functions, and force ALSA to use that as the DMA area */
544 544
545 substream->runtime->dma_area = dev->dmasound.dma.vmalloc; 545 substream->runtime->dma_area = dev->dmasound.dma.vmalloc;
546 substream->runtime->dma_bytes = dev->dmasound.bufsize;
547 substream->runtime->dma_addr = 0;
546 548
547 return 1; 549 return 0;
548 550
549} 551}
550 552
@@ -652,6 +654,17 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
652} 654}
653 655
654/* 656/*
657 * page callback (needed for mmap)
658 */
659
660static struct page *snd_card_saa7134_page(struct snd_pcm_substream *substream,
661 unsigned long offset)
662{
663 void *pageptr = substream->runtime->dma_area + offset;
664 return vmalloc_to_page(pageptr);
665}
666
667/*
655 * ALSA capture callbacks definition 668 * ALSA capture callbacks definition
656 */ 669 */
657 670
@@ -664,6 +677,7 @@ static struct snd_pcm_ops snd_card_saa7134_capture_ops = {
664 .prepare = snd_card_saa7134_capture_prepare, 677 .prepare = snd_card_saa7134_capture_prepare,
665 .trigger = snd_card_saa7134_capture_trigger, 678 .trigger = snd_card_saa7134_capture_trigger,
666 .pointer = snd_card_saa7134_capture_pointer, 679 .pointer = snd_card_saa7134_capture_pointer,
680 .page = snd_card_saa7134_page,
667}; 681};
668 682
669/* 683/*
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index a4c192fb4e41..4f3dad9ae6d6 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2996,11 +2996,11 @@ struct saa7134_board saa7134_boards[] = {
2996 },{ 2996 },{
2997 .name = name_comp1, 2997 .name = name_comp1,
2998 .vmux = 0, 2998 .vmux = 0,
2999 .amux = LINE2, 2999 .amux = LINE1,
3000 },{ 3000 },{
3001 .name = name_svideo, 3001 .name = name_svideo,
3002 .vmux = 8, 3002 .vmux = 8,
3003 .amux = LINE2, 3003 .amux = LINE1,
3004 }}, 3004 }},
3005 }, 3005 },
3006 [SAA7134_BOARD_FLYDVBS_LR300] = { 3006 [SAA7134_BOARD_FLYDVBS_LR300] = {
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 6a777604f070..9e99f3636d3d 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -30,7 +30,7 @@
30 30
31/* standard i2c insmod options */ 31/* standard i2c insmod options */
32static unsigned short normal_i2c[] = { 32static unsigned short normal_i2c[] = {
33#ifdef CONFIG_TUNER_TEA5761 33#if defined(CONFIG_TUNER_TEA5761) || (defined(CONFIG_TUNER_TEA5761_MODULE) && defined(MODULE))
34 0x10, 34 0x10,
35#endif 35#endif
36 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ 36 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */
@@ -292,7 +292,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
292 } 292 }
293 t->mode_mask = T_RADIO; 293 t->mode_mask = T_RADIO;
294 break; 294 break;
295#ifdef CONFIG_TUNER_TEA5761
296 case TUNER_TEA5761: 295 case TUNER_TEA5761:
297 if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) { 296 if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) {
298 t->type = TUNER_ABSENT; 297 t->type = TUNER_ABSENT;
@@ -301,7 +300,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
301 } 300 }
302 t->mode_mask = T_RADIO; 301 t->mode_mask = T_RADIO;
303 break; 302 break;
304#endif
305 case TUNER_PHILIPS_FMD1216ME_MK3: 303 case TUNER_PHILIPS_FMD1216ME_MK3:
306 buffer[0] = 0x0b; 304 buffer[0] = 0x0b;
307 buffer[1] = 0xdc; 305 buffer[1] = 0xdc;
@@ -594,7 +592,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
594 /* autodetection code based on the i2c addr */ 592 /* autodetection code based on the i2c addr */
595 if (!no_autodetect) { 593 if (!no_autodetect) {
596 switch (addr) { 594 switch (addr) {
597#ifdef CONFIG_TUNER_TEA5761
598 case 0x10: 595 case 0x10:
599 if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) { 596 if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) {
600 t->type = TUNER_TEA5761; 597 t->type = TUNER_TEA5761;
@@ -606,7 +603,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
606 goto register_client; 603 goto register_client;
607 } 604 }
608 break; 605 break;
609#endif
610 case 0x42: 606 case 0x42:
611 case 0x43: 607 case 0x43:
612 case 0x4a: 608 case 0x4a:
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index e2f1c972754b..25d0aef88ef5 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -799,10 +799,10 @@ static inline void tvp5150_reset(struct i2c_client *c)
799 tvp5150_write_inittab(c, tvp5150_init_enable); 799 tvp5150_write_inittab(c, tvp5150_init_enable);
800 800
801 /* Initialize image preferences */ 801 /* Initialize image preferences */
802 tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright >> 8); 802 tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright);
803 tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast >> 8); 803 tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast);
804 tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast >> 8); 804 tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast);
805 tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); 805 tvp5150_write(c, TVP5150_HUE_CTL, decoder->hue);
806 806
807 tvp5150_set_std(c, decoder->norm); 807 tvp5150_set_std(c, decoder->norm);
808}; 808};
@@ -1077,10 +1077,10 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
1077 core->norm = V4L2_STD_ALL; /* Default is autodetect */ 1077 core->norm = V4L2_STD_ALL; /* Default is autodetect */
1078 core->route.input = TVP5150_COMPOSITE1; 1078 core->route.input = TVP5150_COMPOSITE1;
1079 core->enable = 1; 1079 core->enable = 1;
1080 core->bright = 32768; 1080 core->bright = 128;
1081 core->contrast = 32768; 1081 core->contrast = 128;
1082 core->hue = 32768; 1082 core->hue = 0;
1083 core->sat = 32768; 1083 core->sat = 128;
1084 1084
1085 if (rv) { 1085 if (rv) {
1086 kfree(c); 1086 kfree(c);
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 682406168de9..e4ad7a1c4fbd 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -1077,8 +1077,8 @@ static int i2o_block_probe(struct device *dev)
1077 blk_queue_max_sectors(queue, max_sectors); 1077 blk_queue_max_sectors(queue, max_sectors);
1078 blk_queue_max_hw_segments(queue, i2o_sg_tablesize(c, body_size)); 1078 blk_queue_max_hw_segments(queue, i2o_sg_tablesize(c, body_size));
1079 1079
1080 osm_debug("max sectors = %d\n", queue->max_phys_segments); 1080 osm_debug("max sectors = %d\n", queue->max_sectors);
1081 osm_debug("phys segments = %d\n", queue->max_sectors); 1081 osm_debug("phys segments = %d\n", queue->max_phys_segments);
1082 osm_debug("max hw segments = %d\n", queue->max_hw_segments); 1082 osm_debug("max hw segments = %d\n", queue->max_hw_segments);
1083 1083
1084 /* 1084 /*
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/misc/ioc4.c b/drivers/misc/ioc4.c
index 6a5a05d1f392..05172d2613d6 100644
--- a/drivers/misc/ioc4.c
+++ b/drivers/misc/ioc4.c
@@ -244,10 +244,11 @@ ioc4_variant(struct ioc4_driver_data *idd)
244 idd->idd_pdev->bus->number == pdev->bus->number && 244 idd->idd_pdev->bus->number == pdev->bus->number &&
245 3 == PCI_SLOT(pdev->devfn)) 245 3 == PCI_SLOT(pdev->devfn))
246 found = 1; 246 found = 1;
247 pci_dev_put(pdev);
248 } while (pdev && !found); 247 } while (pdev && !found);
249 if (NULL != pdev) 248 if (NULL != pdev) {
249 pci_dev_put(pdev);
250 return IOC4_VARIANT_IO9; 250 return IOC4_VARIANT_IO9;
251 }
251 252
252 /* IO10: Look for a Vitesse VSC 7174 at the same bus and slot 3. */ 253 /* IO10: Look for a Vitesse VSC 7174 at the same bus and slot 3. */
253 pdev = NULL; 254 pdev = NULL;
@@ -258,10 +259,11 @@ ioc4_variant(struct ioc4_driver_data *idd)
258 idd->idd_pdev->bus->number == pdev->bus->number && 259 idd->idd_pdev->bus->number == pdev->bus->number &&
259 3 == PCI_SLOT(pdev->devfn)) 260 3 == PCI_SLOT(pdev->devfn))
260 found = 1; 261 found = 1;
261 pci_dev_put(pdev);
262 } while (pdev && !found); 262 } while (pdev && !found);
263 if (NULL != pdev) 263 if (NULL != pdev) {
264 pci_dev_put(pdev);
264 return IOC4_VARIANT_IO10; 265 return IOC4_VARIANT_IO10;
266 }
265 267
266 /* PCI-RT: No SCSI/SATA controller will be present */ 268 /* PCI-RT: No SCSI/SATA controller will be present */
267 return IOC4_VARIANT_PCI_RT; 269 return IOC4_VARIANT_PCI_RT;
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index e953276664a0..ab23a3221585 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -21,7 +21,7 @@
21 * 02110-1301, USA. 21 * 02110-1301, USA.
22 */ 22 */
23 23
24#define IBM_VERSION "0.16" 24#define IBM_VERSION "0.17"
25#define TPACPI_SYSFS_VERSION 0x020000 25#define TPACPI_SYSFS_VERSION 0x020000
26 26
27/* 27/*
@@ -964,15 +964,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
964 KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ 964 KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */
965 KEY_UNKNOWN, /* 0x0D: FN+INSERT */ 965 KEY_UNKNOWN, /* 0x0D: FN+INSERT */
966 KEY_UNKNOWN, /* 0x0E: FN+DELETE */ 966 KEY_UNKNOWN, /* 0x0E: FN+DELETE */
967 KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */ 967 KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */
968 /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ 968 /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */
969 KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */ 969 KEY_RESERVED, /* 0x10: FN+END (brightness down) */
970 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 970 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
971 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ 971 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */
972 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ 972 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */
973 KEY_VOLUMEUP, /* 0x14: VOLUME UP */ 973 KEY_RESERVED, /* 0x14: VOLUME UP */
974 KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ 974 KEY_RESERVED, /* 0x15: VOLUME DOWN */
975 KEY_MUTE, /* 0x16: MUTE */ 975 KEY_RESERVED, /* 0x16: MUTE */
976 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ 976 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */
977 /* (assignments unknown, please report if found) */ 977 /* (assignments unknown, please report if found) */
978 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 978 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
@@ -993,9 +993,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
993 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 993 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
994 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ 994 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */
995 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ 995 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */
996 KEY_VOLUMEUP, /* 0x14: VOLUME UP */ 996 KEY_RESERVED, /* 0x14: VOLUME UP */
997 KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ 997 KEY_RESERVED, /* 0x15: VOLUME DOWN */
998 KEY_MUTE, /* 0x16: MUTE */ 998 KEY_RESERVED, /* 0x16: MUTE */
999 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ 999 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */
1000 /* (assignments unknown, please report if found) */ 1000 /* (assignments unknown, please report if found) */
1001 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 1001 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
@@ -1342,9 +1342,8 @@ static int hotkey_read(char *p)
1342 return len; 1342 return len;
1343 } 1343 }
1344 1344
1345 res = mutex_lock_interruptible(&hotkey_mutex); 1345 if (mutex_lock_interruptible(&hotkey_mutex))
1346 if (res < 0) 1346 return -ERESTARTSYS;
1347 return res;
1348 res = hotkey_get(&status, &mask); 1347 res = hotkey_get(&status, &mask);
1349 mutex_unlock(&hotkey_mutex); 1348 mutex_unlock(&hotkey_mutex);
1350 if (res) 1349 if (res)
@@ -1373,9 +1372,8 @@ static int hotkey_write(char *buf)
1373 if (!tp_features.hotkey) 1372 if (!tp_features.hotkey)
1374 return -ENODEV; 1373 return -ENODEV;
1375 1374
1376 res = mutex_lock_interruptible(&hotkey_mutex); 1375 if (mutex_lock_interruptible(&hotkey_mutex))
1377 if (res < 0) 1376 return -ERESTARTSYS;
1378 return res;
1379 1377
1380 res = hotkey_get(&status, &mask); 1378 res = hotkey_get(&status, &mask);
1381 if (res) 1379 if (res)
@@ -3114,6 +3112,99 @@ static struct backlight_ops ibm_backlight_data = {
3114 3112
3115static struct mutex brightness_mutex; 3113static struct mutex brightness_mutex;
3116 3114
3115static int __init tpacpi_query_bcll_levels(acpi_handle handle)
3116{
3117 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
3118 union acpi_object *obj;
3119 int rc;
3120
3121 if (ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buffer))) {
3122 obj = (union acpi_object *)buffer.pointer;
3123 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
3124 printk(IBM_ERR "Unknown BCLL data, "
3125 "please report this to %s\n", IBM_MAIL);
3126 rc = 0;
3127 } else {
3128 rc = obj->package.count;
3129 }
3130 } else {
3131 return 0;
3132 }
3133
3134 kfree(buffer.pointer);
3135 return rc;
3136}
3137
3138static acpi_status __init brightness_find_bcll(acpi_handle handle, u32 lvl,
3139 void *context, void **rv)
3140{
3141 char name[ACPI_PATH_SEGMENT_LENGTH];
3142 struct acpi_buffer buffer = { sizeof(name), &name };
3143
3144 if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) &&
3145 !strncmp("BCLL", name, sizeof(name) - 1)) {
3146 if (tpacpi_query_bcll_levels(handle) == 16) {
3147 *rv = handle;
3148 return AE_CTRL_TERMINATE;
3149 } else {
3150 return AE_OK;
3151 }
3152 } else {
3153 return AE_OK;
3154 }
3155}
3156
3157static int __init brightness_check_levels(void)
3158{
3159 int status;
3160 void *found_node = NULL;
3161
3162 if (!vid_handle) {
3163 IBM_ACPIHANDLE_INIT(vid);
3164 }
3165 if (!vid_handle)
3166 return 0;
3167
3168 /* Search for a BCLL package with 16 levels */
3169 status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3,
3170 brightness_find_bcll, NULL, &found_node);
3171
3172 return (ACPI_SUCCESS(status) && found_node != NULL);
3173}
3174
3175static acpi_status __init brightness_find_bcl(acpi_handle handle, u32 lvl,
3176 void *context, void **rv)
3177{
3178 char name[ACPI_PATH_SEGMENT_LENGTH];
3179 struct acpi_buffer buffer = { sizeof(name), &name };
3180
3181 if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) &&
3182 !strncmp("_BCL", name, sizeof(name) - 1)) {
3183 *rv = handle;
3184 return AE_CTRL_TERMINATE;
3185 } else {
3186 return AE_OK;
3187 }
3188}
3189
3190static int __init brightness_check_std_acpi_support(void)
3191{
3192 int status;
3193 void *found_node = NULL;
3194
3195 if (!vid_handle) {
3196 IBM_ACPIHANDLE_INIT(vid);
3197 }
3198 if (!vid_handle)
3199 return 0;
3200
3201 /* Search for a _BCL method, but don't execute it */
3202 status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3,
3203 brightness_find_bcl, NULL, &found_node);
3204
3205 return (ACPI_SUCCESS(status) && found_node != NULL);
3206}
3207
3117static int __init brightness_init(struct ibm_init_struct *iibm) 3208static int __init brightness_init(struct ibm_init_struct *iibm)
3118{ 3209{
3119 int b; 3210 int b;
@@ -3122,6 +3213,18 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
3122 3213
3123 mutex_init(&brightness_mutex); 3214 mutex_init(&brightness_mutex);
3124 3215
3216 if (!brightness_enable) {
3217 dbg_printk(TPACPI_DBG_INIT,
3218 "brightness support disabled by module parameter\n");
3219 return 1;
3220 } else if (brightness_enable > 1) {
3221 if (brightness_check_std_acpi_support()) {
3222 printk(IBM_NOTICE
3223 "standard ACPI backlight interface available, not loading native one...\n");
3224 return 1;
3225 }
3226 }
3227
3125 if (!brightness_mode) { 3228 if (!brightness_mode) {
3126 if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) 3229 if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO)
3127 brightness_mode = 2; 3230 brightness_mode = 2;
@@ -3135,10 +3238,17 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
3135 if (brightness_mode > 3) 3238 if (brightness_mode > 3)
3136 return -EINVAL; 3239 return -EINVAL;
3137 3240
3241 tp_features.bright_16levels =
3242 thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO &&
3243 brightness_check_levels();
3244
3138 b = brightness_get(NULL); 3245 b = brightness_get(NULL);
3139 if (b < 0) 3246 if (b < 0)
3140 return 1; 3247 return 1;
3141 3248
3249 if (tp_features.bright_16levels)
3250 printk(IBM_INFO "detected a 16-level brightness capable ThinkPad\n");
3251
3142 ibm_backlight_device = backlight_device_register( 3252 ibm_backlight_device = backlight_device_register(
3143 TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, 3253 TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
3144 &ibm_backlight_data); 3254 &ibm_backlight_data);
@@ -3148,7 +3258,8 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
3148 } 3258 }
3149 vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n"); 3259 vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n");
3150 3260
3151 ibm_backlight_device->props.max_brightness = 7; 3261 ibm_backlight_device->props.max_brightness =
3262 (tp_features.bright_16levels)? 15 : 7;
3152 ibm_backlight_device->props.brightness = b; 3263 ibm_backlight_device->props.brightness = b;
3153 backlight_update_status(ibm_backlight_device); 3264 backlight_update_status(ibm_backlight_device);
3154 3265
@@ -3167,6 +3278,8 @@ static void brightness_exit(void)
3167 3278
3168static int brightness_update_status(struct backlight_device *bd) 3279static int brightness_update_status(struct backlight_device *bd)
3169{ 3280{
3281 /* it is the backlight class's job (caller) to handle
3282 * EINTR and other errors properly */
3170 return brightness_set( 3283 return brightness_set(
3171 (bd->props.fb_blank == FB_BLANK_UNBLANK && 3284 (bd->props.fb_blank == FB_BLANK_UNBLANK &&
3172 bd->props.power == FB_BLANK_UNBLANK) ? 3285 bd->props.power == FB_BLANK_UNBLANK) ?
@@ -3184,13 +3297,14 @@ static int brightness_get(struct backlight_device *bd)
3184 if (brightness_mode & 1) { 3297 if (brightness_mode & 1) {
3185 if (!acpi_ec_read(brightness_offset, &lec)) 3298 if (!acpi_ec_read(brightness_offset, &lec))
3186 return -EIO; 3299 return -EIO;
3187 lec &= 7; 3300 lec &= (tp_features.bright_16levels)? 0x0f : 0x07;
3188 level = lec; 3301 level = lec;
3189 }; 3302 };
3190 if (brightness_mode & 2) { 3303 if (brightness_mode & 2) {
3191 lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) 3304 lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS)
3192 & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) 3305 & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
3193 >> TP_NVRAM_POS_LEVEL_BRIGHTNESS; 3306 >> TP_NVRAM_POS_LEVEL_BRIGHTNESS;
3307 lcmos &= (tp_features.bright_16levels)? 0x0f : 0x07;
3194 level = lcmos; 3308 level = lcmos;
3195 } 3309 }
3196 3310
@@ -3206,12 +3320,13 @@ static int brightness_get(struct backlight_device *bd)
3206 return level; 3320 return level;
3207} 3321}
3208 3322
3323/* May return EINTR which can always be mapped to ERESTARTSYS */
3209static int brightness_set(int value) 3324static int brightness_set(int value)
3210{ 3325{
3211 int cmos_cmd, inc, i, res; 3326 int cmos_cmd, inc, i, res;
3212 int current_value; 3327 int current_value;
3213 3328
3214 if (value > 7) 3329 if (value > ((tp_features.bright_16levels)? 15 : 7))
3215 return -EINVAL; 3330 return -EINVAL;
3216 3331
3217 res = mutex_lock_interruptible(&brightness_mutex); 3332 res = mutex_lock_interruptible(&brightness_mutex);
@@ -3227,7 +3342,7 @@ static int brightness_set(int value)
3227 cmos_cmd = value > current_value ? 3342 cmos_cmd = value > current_value ?
3228 TP_CMOS_BRIGHTNESS_UP : 3343 TP_CMOS_BRIGHTNESS_UP :
3229 TP_CMOS_BRIGHTNESS_DOWN; 3344 TP_CMOS_BRIGHTNESS_DOWN;
3230 inc = value > current_value ? 1 : -1; 3345 inc = (value > current_value)? 1 : -1;
3231 3346
3232 res = 0; 3347 res = 0;
3233 for (i = current_value; i != value; i += inc) { 3348 for (i = current_value; i != value; i += inc) {
@@ -3256,10 +3371,11 @@ static int brightness_read(char *p)
3256 if ((level = brightness_get(NULL)) < 0) { 3371 if ((level = brightness_get(NULL)) < 0) {
3257 len += sprintf(p + len, "level:\t\tunreadable\n"); 3372 len += sprintf(p + len, "level:\t\tunreadable\n");
3258 } else { 3373 } else {
3259 len += sprintf(p + len, "level:\t\t%d\n", level & 0x7); 3374 len += sprintf(p + len, "level:\t\t%d\n", level);
3260 len += sprintf(p + len, "commands:\tup, down\n"); 3375 len += sprintf(p + len, "commands:\tup, down\n");
3261 len += sprintf(p + len, "commands:\tlevel <level>" 3376 len += sprintf(p + len, "commands:\tlevel <level>"
3262 " (<level> is 0-7)\n"); 3377 " (<level> is 0-%d)\n",
3378 (tp_features.bright_16levels) ? 15 : 7);
3263 } 3379 }
3264 3380
3265 return len; 3381 return len;
@@ -3268,28 +3384,34 @@ static int brightness_read(char *p)
3268static int brightness_write(char *buf) 3384static int brightness_write(char *buf)
3269{ 3385{
3270 int level; 3386 int level;
3271 int new_level; 3387 int rc;
3272 char *cmd; 3388 char *cmd;
3389 int max_level = (tp_features.bright_16levels) ? 15 : 7;
3273 3390
3274 while ((cmd = next_cmd(&buf))) { 3391 level = brightness_get(NULL);
3275 if ((level = brightness_get(NULL)) < 0) 3392 if (level < 0)
3276 return level; 3393 return level;
3277 level &= 7;
3278 3394
3395 while ((cmd = next_cmd(&buf))) {
3279 if (strlencmp(cmd, "up") == 0) { 3396 if (strlencmp(cmd, "up") == 0) {
3280 new_level = level == 7 ? 7 : level + 1; 3397 if (level < max_level)
3398 level++;
3281 } else if (strlencmp(cmd, "down") == 0) { 3399 } else if (strlencmp(cmd, "down") == 0) {
3282 new_level = level == 0 ? 0 : level - 1; 3400 if (level > 0)
3283 } else if (sscanf(cmd, "level %d", &new_level) == 1 && 3401 level--;
3284 new_level >= 0 && new_level <= 7) { 3402 } else if (sscanf(cmd, "level %d", &level) == 1 &&
3285 /* new_level set */ 3403 level >= 0 && level <= max_level) {
3404 /* new level set */
3286 } else 3405 } else
3287 return -EINVAL; 3406 return -EINVAL;
3288
3289 brightness_set(new_level);
3290 } 3407 }
3291 3408
3292 return 0; 3409 /*
3410 * Now we know what the final level should be, so we try to set it.
3411 * Doing it this way makes the syscall restartable in case of EINTR
3412 */
3413 rc = brightness_set(level);
3414 return (rc == -EINTR)? ERESTARTSYS : rc;
3293} 3415}
3294 3416
3295static struct ibm_struct brightness_driver_data = { 3417static struct ibm_struct brightness_driver_data = {
@@ -3652,9 +3774,8 @@ static ssize_t fan_pwm1_store(struct device *dev,
3652 /* scale down from 0-255 to 0-7 */ 3774 /* scale down from 0-255 to 0-7 */
3653 newlevel = (s >> 5) & 0x07; 3775 newlevel = (s >> 5) & 0x07;
3654 3776
3655 rc = mutex_lock_interruptible(&fan_mutex); 3777 if (mutex_lock_interruptible(&fan_mutex))
3656 if (rc < 0) 3778 return -ERESTARTSYS;
3657 return rc;
3658 3779
3659 rc = fan_get_status(&status); 3780 rc = fan_get_status(&status);
3660 if (!rc && (status & 3781 if (!rc && (status &
@@ -3904,9 +4025,8 @@ static int fan_get_status_safe(u8 *status)
3904 int rc; 4025 int rc;
3905 u8 s; 4026 u8 s;
3906 4027
3907 rc = mutex_lock_interruptible(&fan_mutex); 4028 if (mutex_lock_interruptible(&fan_mutex))
3908 if (rc < 0) 4029 return -ERESTARTSYS;
3909 return rc;
3910 rc = fan_get_status(&s); 4030 rc = fan_get_status(&s);
3911 if (!rc) 4031 if (!rc)
3912 fan_update_desired_level(s); 4032 fan_update_desired_level(s);
@@ -4040,9 +4160,8 @@ static int fan_set_level_safe(int level)
4040 if (!fan_control_allowed) 4160 if (!fan_control_allowed)
4041 return -EPERM; 4161 return -EPERM;
4042 4162
4043 rc = mutex_lock_interruptible(&fan_mutex); 4163 if (mutex_lock_interruptible(&fan_mutex))
4044 if (rc < 0) 4164 return -ERESTARTSYS;
4045 return rc;
4046 4165
4047 if (level == TPACPI_FAN_LAST_LEVEL) 4166 if (level == TPACPI_FAN_LAST_LEVEL)
4048 level = fan_control_desired_level; 4167 level = fan_control_desired_level;
@@ -4063,9 +4182,8 @@ static int fan_set_enable(void)
4063 if (!fan_control_allowed) 4182 if (!fan_control_allowed)
4064 return -EPERM; 4183 return -EPERM;
4065 4184
4066 rc = mutex_lock_interruptible(&fan_mutex); 4185 if (mutex_lock_interruptible(&fan_mutex))
4067 if (rc < 0) 4186 return -ERESTARTSYS;
4068 return rc;
4069 4187
4070 switch (fan_control_access_mode) { 4188 switch (fan_control_access_mode) {
4071 case TPACPI_FAN_WR_ACPI_FANS: 4189 case TPACPI_FAN_WR_ACPI_FANS:
@@ -4119,9 +4237,8 @@ static int fan_set_disable(void)
4119 if (!fan_control_allowed) 4237 if (!fan_control_allowed)
4120 return -EPERM; 4238 return -EPERM;
4121 4239
4122 rc = mutex_lock_interruptible(&fan_mutex); 4240 if (mutex_lock_interruptible(&fan_mutex))
4123 if (rc < 0) 4241 return -ERESTARTSYS;
4124 return rc;
4125 4242
4126 rc = 0; 4243 rc = 0;
4127 switch (fan_control_access_mode) { 4244 switch (fan_control_access_mode) {
@@ -4158,9 +4275,8 @@ static int fan_set_speed(int speed)
4158 if (!fan_control_allowed) 4275 if (!fan_control_allowed)
4159 return -EPERM; 4276 return -EPERM;
4160 4277
4161 rc = mutex_lock_interruptible(&fan_mutex); 4278 if (mutex_lock_interruptible(&fan_mutex))
4162 if (rc < 0) 4279 return -ERESTARTSYS;
4163 return rc;
4164 4280
4165 rc = 0; 4281 rc = 0;
4166 switch (fan_control_access_mode) { 4282 switch (fan_control_access_mode) {
@@ -4701,9 +4817,15 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp)
4701 unsigned int i; 4817 unsigned int i;
4702 struct ibm_struct *ibm; 4818 struct ibm_struct *ibm;
4703 4819
4820 if (!kp || !kp->name || !val)
4821 return -EINVAL;
4822
4704 for (i = 0; i < ARRAY_SIZE(ibms_init); i++) { 4823 for (i = 0; i < ARRAY_SIZE(ibms_init); i++) {
4705 ibm = ibms_init[i].data; 4824 ibm = ibms_init[i].data;
4706 BUG_ON(ibm == NULL); 4825 WARN_ON(ibm == NULL);
4826
4827 if (!ibm || !ibm->name)
4828 continue;
4707 4829
4708 if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { 4830 if (strcmp(ibm->name, kp->name) == 0 && ibm->write) {
4709 if (strlen(val) > sizeof(ibms_init[i].param) - 2) 4831 if (strlen(val) > sizeof(ibms_init[i].param) - 2)
@@ -4732,6 +4854,9 @@ module_param_named(fan_control, fan_control_allowed, bool, 0);
4732static int brightness_mode; 4854static int brightness_mode;
4733module_param_named(brightness_mode, brightness_mode, int, 0); 4855module_param_named(brightness_mode, brightness_mode, int, 0);
4734 4856
4857static unsigned int brightness_enable = 2; /* 2 = auto, 0 = no, 1 = yes */
4858module_param(brightness_enable, uint, 0);
4859
4735static unsigned int hotkey_report_mode; 4860static unsigned int hotkey_report_mode;
4736module_param(hotkey_report_mode, uint, 0); 4861module_param(hotkey_report_mode, uint, 0);
4737 4862
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 3abcc8120634..8fba2bbe345e 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -84,7 +84,7 @@
84 84
85/* ThinkPad CMOS NVRAM constants */ 85/* ThinkPad CMOS NVRAM constants */
86#define TP_NVRAM_ADDR_BRIGHTNESS 0x5e 86#define TP_NVRAM_ADDR_BRIGHTNESS 0x5e
87#define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x07 87#define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x0f
88#define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 88#define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0
89 89
90#define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") 90#define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off")
@@ -246,6 +246,7 @@ static struct {
246 u32 hotkey_wlsw:1; 246 u32 hotkey_wlsw:1;
247 u32 light:1; 247 u32 light:1;
248 u32 light_status:1; 248 u32 light_status:1;
249 u32 bright_16levels:1;
249 u32 wan:1; 250 u32 wan:1;
250 u32 fan_ctrl_status_undef:1; 251 u32 fan_ctrl_status_undef:1;
251 u32 input_device_registered:1; 252 u32 input_device_registered:1;
@@ -338,6 +339,7 @@ static int bluetooth_write(char *buf);
338static struct backlight_device *ibm_backlight_device; 339static struct backlight_device *ibm_backlight_device;
339static int brightness_offset = 0x31; 340static int brightness_offset = 0x31;
340static int brightness_mode; 341static int brightness_mode;
342static unsigned int brightness_enable; /* 0 = no, 1 = yes, 2 = auto */
341 343
342static int brightness_init(struct ibm_init_struct *iibm); 344static int brightness_init(struct ibm_init_struct *iibm);
343static void brightness_exit(void); 345static void brightness_exit(void);
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index e38d5a3b2a89..aeb32a93f6a0 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -44,6 +44,9 @@
44 * max 8 partitions per card 44 * max 8 partitions per card
45 */ 45 */
46#define MMC_SHIFT 3 46#define MMC_SHIFT 3
47#define MMC_NUM_MINORS (256 >> MMC_SHIFT)
48
49static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))];
47 50
48/* 51/*
49 * There is one mmc_blk_data per slot. 52 * There is one mmc_blk_data per slot.
@@ -80,6 +83,9 @@ static void mmc_blk_put(struct mmc_blk_data *md)
80 mutex_lock(&open_lock); 83 mutex_lock(&open_lock);
81 md->usage--; 84 md->usage--;
82 if (md->usage == 0) { 85 if (md->usage == 0) {
86 int devidx = md->disk->first_minor >> MMC_SHIFT;
87 __clear_bit(devidx, dev_use);
88
83 put_disk(md->disk); 89 put_disk(md->disk);
84 kfree(md); 90 kfree(md);
85 } 91 }
@@ -321,7 +327,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
321 req->rq_disk->disk_name, err); 327 req->rq_disk->disk_name, err);
322 goto cmd_err; 328 goto cmd_err;
323 } 329 }
324 } while (!(cmd.resp[0] & R1_READY_FOR_DATA)); 330 /*
331 * Some cards mishandle the status bits,
332 * so make sure to check both the busy
333 * indication and the card state.
334 */
335 } while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
336 (R1_CURRENT_STATE(cmd.resp[0]) == 7));
325 337
326#if 0 338#if 0
327 if (cmd.resp[0] & ~0x00000900) 339 if (cmd.resp[0] & ~0x00000900)
@@ -400,9 +412,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
400 return 0; 412 return 0;
401} 413}
402 414
403#define MMC_NUM_MINORS (256 >> MMC_SHIFT)
404
405static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))];
406 415
407static inline int mmc_blk_readonly(struct mmc_card *card) 416static inline int mmc_blk_readonly(struct mmc_card *card)
408{ 417{
@@ -568,17 +577,12 @@ static void mmc_blk_remove(struct mmc_card *card)
568 struct mmc_blk_data *md = mmc_get_drvdata(card); 577 struct mmc_blk_data *md = mmc_get_drvdata(card);
569 578
570 if (md) { 579 if (md) {
571 int devidx;
572
573 /* Stop new requests from getting into the queue */ 580 /* Stop new requests from getting into the queue */
574 del_gendisk(md->disk); 581 del_gendisk(md->disk);
575 582
576 /* Then flush out any already in there */ 583 /* Then flush out any already in there */
577 mmc_cleanup_queue(&md->queue); 584 mmc_cleanup_queue(&md->queue);
578 585
579 devidx = md->disk->first_minor >> MMC_SHIFT;
580 __clear_bit(devidx, dev_use);
581
582 mmc_blk_put(md); 586 mmc_blk_put(md);
583 } 587 }
584 mmc_set_drvdata(card, NULL); 588 mmc_set_drvdata(card, NULL);
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 9203a0b221b3..1b9c9b6da5b7 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -310,7 +310,7 @@ static void copy_sg(struct scatterlist *dst, unsigned int dst_len,
310 } 310 }
311 311
312 if (src_size == 0) { 312 if (src_size == 0) {
313 src_buf = sg_virt(dst); 313 src_buf = sg_virt(src);
314 src_size = src->length; 314 src_size = src->length;
315 } 315 }
316 316
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 09435e0ec680..b96667448eb5 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -19,7 +19,6 @@
19#include <linux/pagemap.h> 19#include <linux/pagemap.h>
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/leds.h> 21#include <linux/leds.h>
22#include <asm/scatterlist.h>
23#include <linux/scatterlist.h> 22#include <linux/scatterlist.h>
24 23
25#include <linux/mmc/card.h> 24#include <linux/mmc/card.h>
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 7471d49909b2..64b05c6270f2 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/scatterlist.h>
14#include <linux/scatterlist.h> 13#include <linux/scatterlist.h>
15 14
16#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index a6dafe62b992..0d96080d44b0 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/scatterlist.h>
14#include <linux/scatterlist.h> 13#include <linux/scatterlist.h>
15 14
16#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
index 4d289b275031..e1fca588e385 100644
--- a/drivers/mmc/core/sdio_ops.c
+++ b/drivers/mmc/core/sdio_ops.c
@@ -9,7 +9,6 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#include <asm/scatterlist.h>
13#include <linux/scatterlist.h> 12#include <linux/scatterlist.h>
14 13
15#include <linux/mmc/host.h> 14#include <linux/mmc/host.h>
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index b2104d4f87af..c3926eb3bf43 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -40,7 +40,7 @@
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 <scatterlist/scatterlist.h> 43#include <linux/scatterlist.h>
44 44
45#include <linux/mmc/host.h> 45#include <linux/mmc/host.h>
46#include <asm/io.h> 46#include <asm/io.h>
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/pxamci.c b/drivers/mmc/host/pxamci.c
index a25ee71998a9..1654a3330340 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -39,6 +39,7 @@
39#define DRIVER_NAME "pxa2xx-mci" 39#define DRIVER_NAME "pxa2xx-mci"
40 40
41#define NR_SG 1 41#define NR_SG 1
42#define CLKRT_OFF (~0)
42 43
43struct pxamci_host { 44struct pxamci_host {
44 struct mmc_host *mmc; 45 struct mmc_host *mmc;
@@ -371,6 +372,9 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
371 unsigned long rate = host->clkrate; 372 unsigned long rate = host->clkrate;
372 unsigned int clk = rate / ios->clock; 373 unsigned int clk = rate / ios->clock;
373 374
375 if (host->clkrt == CLKRT_OFF)
376 clk_enable(host->clk);
377
374 /* 378 /*
375 * clk might result in a lower divisor than we 379 * clk might result in a lower divisor than we
376 * desire. check for that condition and adjust 380 * desire. check for that condition and adjust
@@ -379,14 +383,16 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
379 if (rate / clk > ios->clock) 383 if (rate / clk > ios->clock)
380 clk <<= 1; 384 clk <<= 1;
381 host->clkrt = fls(clk) - 1; 385 host->clkrt = fls(clk) - 1;
382 clk_enable(host->clk);
383 386
384 /* 387 /*
385 * we write clkrt on the next command 388 * we write clkrt on the next command
386 */ 389 */
387 } else { 390 } else {
388 pxamci_stop_clock(host); 391 pxamci_stop_clock(host);
389 clk_disable(host->clk); 392 if (host->clkrt != CLKRT_OFF) {
393 host->clkrt = CLKRT_OFF;
394 clk_disable(host->clk);
395 }
390 } 396 }
391 397
392 if (host->power_mode != ios->power_mode) { 398 if (host->power_mode != ios->power_mode) {
@@ -498,6 +504,7 @@ static int pxamci_probe(struct platform_device *pdev)
498 host->mmc = mmc; 504 host->mmc = mmc;
499 host->dma = -1; 505 host->dma = -1;
500 host->pdata = pdev->dev.platform_data; 506 host->pdata = pdev->dev.platform_data;
507 host->clkrt = CLKRT_OFF;
501 508
502 host->clk = clk_get(&pdev->dev, "MMCCLK"); 509 host->clk = clk_get(&pdev->dev, "MMCCLK");
503 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 6b80bf77a4ef..ff59d2e0475b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1301,7 +1301,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1301 1301
1302 if ((chip->quirks & SDHCI_QUIRK_BROKEN_DMA) && 1302 if ((chip->quirks & SDHCI_QUIRK_BROKEN_DMA) &&
1303 (host->flags & SDHCI_USE_DMA)) { 1303 (host->flags & SDHCI_USE_DMA)) {
1304 DBG("Disabling DMA as it is marked broken"); 1304 DBG("Disabling DMA as it is marked broken\n");
1305 host->flags &= ~SDHCI_USE_DMA; 1305 host->flags &= ~SDHCI_USE_DMA;
1306 } 1306 }
1307 1307
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index c11a3d256051..20d5c7bd940a 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -16,7 +16,6 @@
16#include <linux/mmc/host.h> 16#include <linux/mmc/host.h>
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/scatterlist.h> 18#include <linux/scatterlist.h>
19#include <linux/log2.h>
20#include <asm/io.h> 19#include <asm/io.h>
21 20
22#define DRIVER_NAME "tifm_sd" 21#define DRIVER_NAME "tifm_sd"
@@ -638,17 +637,15 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
638 goto err_out; 637 goto err_out;
639 } 638 }
640 639
641 if (mrq->data && !is_power_of_2(mrq->data->blksz)) {
642 printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n",
643 sock->dev.bus_id, mrq->data->blksz);
644 mrq->cmd->error = -EINVAL;
645 goto err_out;
646 }
647
648 host->cmd_flags = 0; 640 host->cmd_flags = 0;
649 host->block_pos = 0; 641 host->block_pos = 0;
650 host->sg_pos = 0; 642 host->sg_pos = 0;
651 643
644 if (mrq->data && !is_power_of_2(mrq->data->blksz))
645 host->no_dma = 1;
646 else
647 host->no_dma = no_dma ? 1 : 0;
648
652 if (r_data) { 649 if (r_data) {
653 tifm_sd_set_data_timeout(host, r_data); 650 tifm_sd_set_data_timeout(host, r_data);
654 651
@@ -676,7 +673,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
676 : PCI_DMA_FROMDEVICE)) { 673 : PCI_DMA_FROMDEVICE)) {
677 printk(KERN_ERR "%s : scatterlist map failed\n", 674 printk(KERN_ERR "%s : scatterlist map failed\n",
678 sock->dev.bus_id); 675 sock->dev.bus_id);
679 spin_unlock_irqrestore(&sock->lock, flags); 676 mrq->cmd->error = -ENOMEM;
680 goto err_out; 677 goto err_out;
681 } 678 }
682 host->sg_len = tifm_map_sg(sock, r_data->sg, 679 host->sg_len = tifm_map_sg(sock, r_data->sg,
@@ -692,7 +689,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
692 r_data->flags & MMC_DATA_WRITE 689 r_data->flags & MMC_DATA_WRITE
693 ? PCI_DMA_TODEVICE 690 ? PCI_DMA_TODEVICE
694 : PCI_DMA_FROMDEVICE); 691 : PCI_DMA_FROMDEVICE);
695 spin_unlock_irqrestore(&sock->lock, flags); 692 mrq->cmd->error = -ENOMEM;
696 goto err_out; 693 goto err_out;
697 } 694 }
698 695
@@ -966,7 +963,6 @@ static int tifm_sd_probe(struct tifm_dev *sock)
966 return -ENOMEM; 963 return -ENOMEM;
967 964
968 host = mmc_priv(mmc); 965 host = mmc_priv(mmc);
969 host->no_dma = no_dma;
970 tifm_set_drvdata(sock, mmc); 966 tifm_set_drvdata(sock, mmc);
971 host->dev = sock; 967 host->dev = sock;
972 host->timeout_jiffies = msecs_to_jiffies(1000); 968 host->timeout_jiffies = msecs_to_jiffies(1000);
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index bb30d5be7824..2797da7eeee6 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1192,6 +1192,8 @@ struct net_device * __init i82596_probe(int unit)
1192 goto out; 1192 goto out;
1193 } 1193 }
1194 1194
1195 dev->base_addr = ioaddr;
1196
1195 for (i = 0; i < 8; i++) { 1197 for (i = 0; i < 8; i++) {
1196 eth_addr[i] = inb(ioaddr + 8 + i); 1198 eth_addr[i] = inb(ioaddr + 8 + i);
1197 checksum += eth_addr[i]; 1199 checksum += eth_addr[i];
@@ -1209,7 +1211,6 @@ struct net_device * __init i82596_probe(int unit)
1209 goto out1; 1211 goto out1;
1210 } 1212 }
1211 1213
1212 dev->base_addr = ioaddr;
1213 dev->irq = 10; 1214 dev->irq = 10;
1214 } 1215 }
1215#endif 1216#endif
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 86b8641b4664..e8d69b0adf90 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -136,10 +136,11 @@ config TUN
136 If you don't know what to use this for, you don't need it. 136 If you don't know what to use this for, you don't need it.
137 137
138config VETH 138config VETH
139 tristate "Virtual ethernet device" 139 tristate "Virtual ethernet pair device"
140 ---help--- 140 ---help---
141 The device is an ethernet tunnel. Devices are created in pairs. When 141 This device is a local ethernet tunnel. Devices are created in pairs.
142 one end receives the packet it appears on its pair and vice versa. 142 When one end receives the packet it appears on its pair and vice
143 versa.
143 144
144config NET_SB1000 145config NET_SB1000
145 tristate "General Instruments Surfboard 1000" 146 tristate "General Instruments Surfboard 1000"
@@ -166,13 +167,14 @@ config NET_SB1000
166 If you don't have this card, of course say N. 167 If you don't have this card, of course say N.
167 168
168config IP1000 169config IP1000
169 tristate "IP1000 Gigabit Ethernet support" 170 tristate "IP1000 Gigabit Ethernet support"
170 depends on PCI && EXPERIMENTAL 171 depends on PCI && EXPERIMENTAL
171 ---help--- 172 select MII
172 This driver supports IP1000 gigabit Ethernet cards. 173 ---help---
174 This driver supports IP1000 gigabit Ethernet cards.
173 175
174 To compile this driver as a module, choose M here: the module 176 To compile this driver as a module, choose M here: the module
175 will be called ipg. This is recommended. 177 will be called ipg. This is recommended.
176 178
177source "drivers/net/arcnet/Kconfig" 179source "drivers/net/arcnet/Kconfig"
178 180
@@ -233,7 +235,7 @@ source "drivers/net/arm/Kconfig"
233 235
234config AX88796 236config AX88796
235 tristate "ASIX AX88796 NE2000 clone support" 237 tristate "ASIX AX88796 NE2000 clone support"
236 depends on ARM || MIPS 238 depends on ARM || MIPS || SUPERH
237 select CRC32 239 select CRC32
238 select MII 240 select MII
239 help 241 help
@@ -364,8 +366,7 @@ config MAC89x0
364 read the Ethernet-HOWTO, available from 366 read the Ethernet-HOWTO, available from
365 <http://www.tldp.org/docs.html#howto>. 367 <http://www.tldp.org/docs.html#howto>.
366 368
367 To compile this driver as a module, choose M here and read 369 To compile this driver as a module, choose M here. This module will
368 <file:Documentation/networking/net-modules.txt>. This module will
369 be called mac89x0. 370 be called mac89x0.
370 371
371config MACSONIC 372config MACSONIC
@@ -378,8 +379,7 @@ config MACSONIC
378 one of these say Y and read the Ethernet-HOWTO, available from 379 one of these say Y and read the Ethernet-HOWTO, available from
379 <http://www.tldp.org/docs.html#howto>. 380 <http://www.tldp.org/docs.html#howto>.
380 381
381 To compile this driver as a module, choose M here and read 382 To compile this driver as a module, choose M here. This module will
382 <file:Documentation/networking/net-modules.txt>. This module will
383 be called macsonic. 383 be called macsonic.
384 384
385config MACMACE 385config MACMACE
@@ -617,8 +617,7 @@ config EL1
617 have problems. Some people suggest to ping ("man ping") a nearby 617 have problems. Some people suggest to ping ("man ping") a nearby
618 machine every minute ("man cron") when using this card. 618 machine every minute ("man cron") when using this card.
619 619
620 To compile this driver as a module, choose M here and read 620 To compile this driver as a module, choose M here. The module
621 <file:Documentation/networking/net-modules.txt>. The module
622 will be called 3c501. 621 will be called 3c501.
623 622
624config EL2 623config EL2
@@ -630,8 +629,7 @@ config EL2
630 the Ethernet-HOWTO, available from 629 the Ethernet-HOWTO, available from
631 <http://www.tldp.org/docs.html#howto>. 630 <http://www.tldp.org/docs.html#howto>.
632 631
633 To compile this driver as a module, choose M here and read 632 To compile this driver as a module, choose M here. The module
634 <file:Documentation/networking/net-modules.txt>. The module
635 will be called 3c503. 633 will be called 3c503.
636 634
637config ELPLUS 635config ELPLUS
@@ -643,8 +641,7 @@ config ELPLUS
643 this type, say Y and read the Ethernet-HOWTO, available from 641 this type, say Y and read the Ethernet-HOWTO, available from
644 <http://www.tldp.org/docs.html#howto>. 642 <http://www.tldp.org/docs.html#howto>.
645 643
646 To compile this driver as a module, choose M here and read 644 To compile this driver as a module, choose M here. The module
647 <file:Documentation/networking/net-modules.txt>. The module
648 will be called 3c505. 645 will be called 3c505.
649 646
650config EL16 647config EL16
@@ -655,8 +652,7 @@ config EL16
655 the Ethernet-HOWTO, available from 652 the Ethernet-HOWTO, available from
656 <http://www.tldp.org/docs.html#howto>. 653 <http://www.tldp.org/docs.html#howto>.
657 654
658 To compile this driver as a module, choose M here and read 655 To compile this driver as a module, choose M here. The module
659 <file:Documentation/networking/net-modules.txt>. The module
660 will be called 3c507. 656 will be called 3c507.
661 657
662config EL3 658config EL3
@@ -671,8 +667,7 @@ config EL3
671 setup disk to disable Plug & Play mode, and to select the default 667 setup disk to disable Plug & Play mode, and to select the default
672 media type. 668 media type.
673 669
674 To compile this driver as a module, choose M here and read 670 To compile this driver as a module, choose M here. The module
675 <file:Documentation/networking/net-modules.txt>. The module
676 will be called 3c509. 671 will be called 3c509.
677 672
678config 3C515 673config 3C515
@@ -683,8 +678,7 @@ config 3C515
683 network card, say Y and read the Ethernet-HOWTO, available from 678 network card, say Y and read the Ethernet-HOWTO, available from
684 <http://www.tldp.org/docs.html#howto>. 679 <http://www.tldp.org/docs.html#howto>.
685 680
686 To compile this driver as a module, choose M here and read 681 To compile this driver as a module, choose M here. The module
687 <file:Documentation/networking/net-modules.txt>. The module
688 will be called 3c515. 682 will be called 3c515.
689 683
690config ELMC 684config ELMC
@@ -695,8 +689,7 @@ config ELMC
695 the Ethernet-HOWTO, available from 689 the Ethernet-HOWTO, available from
696 <http://www.tldp.org/docs.html#howto>. 690 <http://www.tldp.org/docs.html#howto>.
697 691
698 To compile this driver as a module, choose M here and read 692 To compile this driver as a module, choose M here. The module
699 <file:Documentation/networking/net-modules.txt>. The module
700 will be called 3c523. 693 will be called 3c523.
701 694
702config ELMC_II 695config ELMC_II
@@ -707,8 +700,7 @@ config ELMC_II
707 the Ethernet-HOWTO, available from 700 the Ethernet-HOWTO, available from
708 <http://www.tldp.org/docs.html#howto>. 701 <http://www.tldp.org/docs.html#howto>.
709 702
710 To compile this driver as a module, choose M here and read 703 To compile this driver as a module, choose M here. The module
711 <file:Documentation/networking/net-modules.txt>. The module
712 will be called 3c527. 704 will be called 3c527.
713 705
714config VORTEX 706config VORTEX
@@ -731,8 +723,7 @@ config VORTEX
731 <file:Documentation/networking/vortex.txt> and in the comments at 723 <file:Documentation/networking/vortex.txt> and in the comments at
732 the beginning of <file:drivers/net/3c59x.c>. 724 the beginning of <file:drivers/net/3c59x.c>.
733 725
734 To compile this support as a module, choose M here and read 726 To compile this support as a module, choose M here.
735 <file:Documentation/networking/net-modules.txt>.
736 727
737config TYPHOON 728config TYPHOON
738 tristate "3cr990 series \"Typhoon\" support" 729 tristate "3cr990 series \"Typhoon\" support"
@@ -749,8 +740,7 @@ config TYPHOON
749 the Ethernet-HOWTO, available from 740 the Ethernet-HOWTO, available from
750 <http://www.tldp.org/docs.html#howto>. 741 <http://www.tldp.org/docs.html#howto>.
751 742
752 To compile this driver as a module, choose M here and read 743 To compile this driver as a module, choose M here. The module
753 <file:Documentation/networking/net-modules.txt>. The module
754 will be called typhoon. 744 will be called typhoon.
755 745
756config LANCE 746config LANCE
@@ -787,8 +777,7 @@ config WD80x3
787 the Ethernet-HOWTO, available from 777 the Ethernet-HOWTO, available from
788 <http://www.tldp.org/docs.html#howto>. 778 <http://www.tldp.org/docs.html#howto>.
789 779
790 To compile this driver as a module, choose M here and read 780 To compile this driver as a module, choose M here. The module
791 <file:Documentation/networking/net-modules.txt>. The module
792 will be called wd. 781 will be called wd.
793 782
794config ULTRAMCA 783config ULTRAMCA
@@ -800,8 +789,7 @@ config ULTRAMCA
800 an MCA based system (PS/2), say Y and read the Ethernet-HOWTO, 789 an MCA based system (PS/2), say Y and read the Ethernet-HOWTO,
801 available from <http://www.tldp.org/docs.html#howto>. 790 available from <http://www.tldp.org/docs.html#howto>.
802 791
803 To compile this driver as a module, choose M here and read 792 To compile this driver as a module, choose M here. The module
804 <file:Documentation/networking/net-modules.txt>. The module
805 will be called smc-mca. 793 will be called smc-mca.
806 794
807config ULTRA 795config ULTRA
@@ -820,8 +808,7 @@ config ULTRA
820 this but keep it in mind if you have such a SCSI card and have 808 this but keep it in mind if you have such a SCSI card and have
821 problems. 809 problems.
822 810
823 To compile this driver as a module, choose M here and read 811 To compile this driver as a module, choose M here. The module
824 <file:Documentation/networking/net-modules.txt>. The module
825 will be called smc-ultra. 812 will be called smc-ultra.
826 813
827config ULTRA32 814config ULTRA32
@@ -833,8 +820,7 @@ config ULTRA32
833 the Ethernet-HOWTO, available from 820 the Ethernet-HOWTO, available from
834 <http://www.tldp.org/docs.html#howto>. 821 <http://www.tldp.org/docs.html#howto>.
835 822
836 To compile this driver as a module, choose M here and read 823 To compile this driver as a module, choose M here. The module
837 <file:Documentation/networking/net-modules.txt>. The module
838 will be called smc-ultra32. 824 will be called smc-ultra32.
839 825
840config BFIN_MAC 826config BFIN_MAC
@@ -895,8 +881,7 @@ config SMC9194
895 <file:Documentation/networking/smc9.txt> and the Ethernet-HOWTO, 881 <file:Documentation/networking/smc9.txt> and the Ethernet-HOWTO,
896 available from <http://www.tldp.org/docs.html#howto>. 882 available from <http://www.tldp.org/docs.html#howto>.
897 883
898 To compile this driver as a module, choose M here and read 884 To compile this driver as a module, choose M here. The module
899 <file:Documentation/networking/net-modules.txt>. The module
900 will be called smc9194. 885 will be called smc9194.
901 886
902config SMC91X 887config SMC91X
@@ -914,8 +899,7 @@ config SMC91X
914 This driver is also available as a module ( = code which can be 899 This driver is also available as a module ( = code which can be
915 inserted in and removed from the running kernel whenever you want). 900 inserted in and removed from the running kernel whenever you want).
916 The module will be called smc91x. If you want to compile it as a 901 The module will be called smc91x. If you want to compile it as a
917 module, say M here and read <file:Documentation/kbuild/modules.txt> 902 module, say M here and read <file:Documentation/kbuild/modules.txt>.
918 as well as <file:Documentation/networking/net-modules.txt>.
919 903
920config NET_NETX 904config NET_NETX
921 tristate "NetX Ethernet support" 905 tristate "NetX Ethernet support"
@@ -924,8 +908,7 @@ config NET_NETX
924 help 908 help
925 This is support for the Hilscher netX builtin Ethernet ports 909 This is support for the Hilscher netX builtin Ethernet ports
926 910
927 To compile this driver as a module, choose M here and read 911 To compile this driver as a module, choose M here. The module
928 <file:Documentation/networking/net-modules.txt>. The module
929 will be called netx-eth. 912 will be called netx-eth.
930 913
931config DM9000 914config DM9000
@@ -936,9 +919,8 @@ config DM9000
936 ---help--- 919 ---help---
937 Support for DM9000 chipset. 920 Support for DM9000 chipset.
938 921
939 To compile this driver as a module, choose M here and read 922 To compile this driver as a module, choose M here. The module
940 <file:Documentation/networking/net-modules.txt>. The module will be 923 will be called dm9000.
941 called dm9000.
942 924
943config SMC911X 925config SMC911X
944 tristate "SMSC LAN911[5678] support" 926 tristate "SMSC LAN911[5678] support"
@@ -978,8 +960,7 @@ config NI5010
978 <http://www.tldp.org/docs.html#howto>. Note that this is still 960 <http://www.tldp.org/docs.html#howto>. Note that this is still
979 experimental code. 961 experimental code.
980 962
981 To compile this driver as a module, choose M here and read 963 To compile this driver as a module, choose M here. The module
982 <file:Documentation/networking/net-modules.txt>. The module
983 will be called ni5010. 964 will be called ni5010.
984 965
985config NI52 966config NI52
@@ -990,8 +971,7 @@ config NI52
990 the Ethernet-HOWTO, available from 971 the Ethernet-HOWTO, available from
991 <http://www.tldp.org/docs.html#howto>. 972 <http://www.tldp.org/docs.html#howto>.
992 973
993 To compile this driver as a module, choose M here and read 974 To compile this driver as a module, choose M here. The module
994 <file:Documentation/networking/net-modules.txt>. The module
995 will be called ni52. 975 will be called ni52.
996 976
997config NI65 977config NI65
@@ -1002,8 +982,7 @@ config NI65
1002 the Ethernet-HOWTO, available from 982 the Ethernet-HOWTO, available from
1003 <http://www.tldp.org/docs.html#howto>. 983 <http://www.tldp.org/docs.html#howto>.
1004 984
1005 To compile this driver as a module, choose M here and read 985 To compile this driver as a module, choose M here. The module
1006 <file:Documentation/networking/net-modules.txt>. The module
1007 will be called ni65. 986 will be called ni65.
1008 987
1009source "drivers/net/tulip/Kconfig" 988source "drivers/net/tulip/Kconfig"
@@ -1017,8 +996,7 @@ config AT1700
1017 the Ethernet-HOWTO, available from 996 the Ethernet-HOWTO, available from
1018 <http://www.tldp.org/docs.html#howto>. 997 <http://www.tldp.org/docs.html#howto>.
1019 998
1020 To compile this driver as a module, choose M here and read 999 To compile this driver as a module, choose M here. The module
1021 <file:Documentation/networking/net-modules.txt>. The module
1022 will be called at1700. 1000 will be called at1700.
1023 1001
1024config DEPCA 1002config DEPCA
@@ -1031,8 +1009,7 @@ config DEPCA
1031 <http://www.tldp.org/docs.html#howto> as well as 1009 <http://www.tldp.org/docs.html#howto> as well as
1032 <file:drivers/net/depca.c>. 1010 <file:drivers/net/depca.c>.
1033 1011
1034 To compile this driver as a module, choose M here and read 1012 To compile this driver as a module, choose M here. The module
1035 <file:Documentation/networking/net-modules.txt>. The module
1036 will be called depca. 1013 will be called depca.
1037 1014
1038config HP100 1015config HP100
@@ -1043,8 +1020,7 @@ config HP100
1043 the Ethernet-HOWTO, available from 1020 the Ethernet-HOWTO, available from
1044 <http://www.tldp.org/docs.html#howto>. 1021 <http://www.tldp.org/docs.html#howto>.
1045 1022
1046 To compile this driver as a module, choose M here and read 1023 To compile this driver as a module, choose M here. The module
1047 <file:Documentation/networking/net-modules.txt>. The module
1048 will be called hp100. 1024 will be called hp100.
1049 1025
1050config NET_ISA 1026config NET_ISA
@@ -1073,8 +1049,7 @@ config E2100
1073 the Ethernet-HOWTO, available from 1049 the Ethernet-HOWTO, available from
1074 <http://www.tldp.org/docs.html#howto>. 1050 <http://www.tldp.org/docs.html#howto>.
1075 1051
1076 To compile this driver as a module, choose M here and read 1052 To compile this driver as a module, choose M here. The module
1077 <file:Documentation/networking/net-modules.txt>. The module
1078 will be called e2100. 1053 will be called e2100.
1079 1054
1080config EWRK3 1055config EWRK3
@@ -1088,8 +1063,7 @@ config EWRK3
1088 well as the Ethernet-HOWTO, available from 1063 well as the Ethernet-HOWTO, available from
1089 <http://www.tldp.org/docs.html#howto>. 1064 <http://www.tldp.org/docs.html#howto>.
1090 1065
1091 To compile this driver as a module, choose M here and read 1066 To compile this driver as a module, choose M here. The module
1092 <file:Documentation/networking/net-modules.txt>. The module
1093 will be called ewrk3. 1067 will be called ewrk3.
1094 1068
1095config EEXPRESS 1069config EEXPRESS
@@ -1103,8 +1077,7 @@ config EEXPRESS
1103 because the driver was very unreliable. We now have a new driver 1077 because the driver was very unreliable. We now have a new driver
1104 that should do better. 1078 that should do better.
1105 1079
1106 To compile this driver as a module, choose M here and read 1080 To compile this driver as a module, choose M here. The module
1107 <file:Documentation/networking/net-modules.txt>. The module
1108 will be called eexpress. 1081 will be called eexpress.
1109 1082
1110config EEXPRESS_PRO 1083config EEXPRESS_PRO
@@ -1117,8 +1090,7 @@ config EEXPRESS_PRO
1117 driver. Please read the Ethernet-HOWTO, available from 1090 driver. Please read the Ethernet-HOWTO, available from
1118 <http://www.tldp.org/docs.html#howto>. 1091 <http://www.tldp.org/docs.html#howto>.
1119 1092
1120 To compile this driver as a module, choose M here and read 1093 To compile this driver as a module, choose M here. The module
1121 <file:Documentation/networking/net-modules.txt>. The module
1122 will be called eepro. 1094 will be called eepro.
1123 1095
1124config HPLAN_PLUS 1096config HPLAN_PLUS
@@ -1130,8 +1102,7 @@ config HPLAN_PLUS
1130 the Ethernet-HOWTO, available from 1102 the Ethernet-HOWTO, available from
1131 <http://www.tldp.org/docs.html#howto>. 1103 <http://www.tldp.org/docs.html#howto>.
1132 1104
1133 To compile this driver as a module, choose M here and read 1105 To compile this driver as a module, choose M here. The module
1134 <file:Documentation/networking/net-modules.txt>. The module
1135 will be called hp-plus. 1106 will be called hp-plus.
1136 1107
1137config HPLAN 1108config HPLAN
@@ -1143,8 +1114,7 @@ config HPLAN
1143 the Ethernet-HOWTO, available from 1114 the Ethernet-HOWTO, available from
1144 <http://www.tldp.org/docs.html#howto>. 1115 <http://www.tldp.org/docs.html#howto>.
1145 1116
1146 To compile this driver as a module, choose M here and read 1117 To compile this driver as a module, choose M here. The module
1147 <file:Documentation/networking/net-modules.txt>. The module
1148 will be called hp. 1118 will be called hp.
1149 1119
1150config LP486E 1120config LP486E
@@ -1163,8 +1133,7 @@ config ETH16I
1163 the Ethernet-HOWTO, available from 1133 the Ethernet-HOWTO, available from
1164 <http://www.tldp.org/docs.html#howto>. 1134 <http://www.tldp.org/docs.html#howto>.
1165 1135
1166 To compile this driver as a module, choose M here and read 1136 To compile this driver as a module, choose M here. The module
1167 <file:Documentation/networking/net-modules.txt>. The module
1168 will be called eth16i. 1137 will be called eth16i.
1169 1138
1170config NE2000 1139config NE2000
@@ -1184,8 +1153,7 @@ config NE2000
1184 laptops), say N here and Y to "NE/2 (ne2000 MCA version) support", 1153 laptops), say N here and Y to "NE/2 (ne2000 MCA version) support",
1185 below. 1154 below.
1186 1155
1187 To compile this driver as a module, choose M here and read 1156 To compile this driver as a module, choose M here. The module
1188 <file:Documentation/networking/net-modules.txt>. The module
1189 will be called ne. 1157 will be called ne.
1190 1158
1191config ZNET 1159config ZNET
@@ -1206,8 +1174,7 @@ config SEEQ8005
1206 is for you, read the Ethernet-HOWTO, available from 1174 is for you, read the Ethernet-HOWTO, available from
1207 <http://www.tldp.org/docs.html#howto>. 1175 <http://www.tldp.org/docs.html#howto>.
1208 1176
1209 To compile this driver as a module, choose M here and read 1177 To compile this driver as a module, choose M here. The module
1210 <file:Documentation/networking/net-modules.txt>. The module
1211 will be called seeq8005. 1178 will be called seeq8005.
1212 1179
1213config NE2_MCA 1180config NE2_MCA
@@ -1219,8 +1186,7 @@ config NE2_MCA
1219 the Ethernet-HOWTO, available from 1186 the Ethernet-HOWTO, available from
1220 <http://www.tldp.org/docs.html#howto>. 1187 <http://www.tldp.org/docs.html#howto>.
1221 1188
1222 To compile this driver as a module, choose M here and read 1189 To compile this driver as a module, choose M here. The module
1223 <file:Documentation/networking/net-modules.txt>. The module
1224 will be called ne2. 1190 will be called ne2.
1225 1191
1226config IBMLANA 1192config IBMLANA
@@ -1231,8 +1197,7 @@ config IBMLANA
1231 CONFIG_MCA to use this driver. It is both available as an in-kernel 1197 CONFIG_MCA to use this driver. It is both available as an in-kernel
1232 driver and as a module. 1198 driver and as a module.
1233 1199
1234 To compile this driver as a module, choose M here and read 1200 To compile this driver as a module, choose M here. The only
1235 <file:Documentation/networking/net-modules.txt>. The only
1236 currently supported card is the IBM LAN Adapter/A for Ethernet. It 1201 currently supported card is the IBM LAN Adapter/A for Ethernet. It
1237 will both support 16K and 32K memory windows, however a 32K window 1202 will both support 16K and 32K memory windows, however a 32K window
1238 gives a better security against packet losses. Usage of multiple 1203 gives a better security against packet losses. Usage of multiple
@@ -1246,8 +1211,7 @@ config IBMVETH
1246 This driver supports virtual ethernet adapters on newer IBM iSeries 1211 This driver supports virtual ethernet adapters on newer IBM iSeries
1247 and pSeries systems. 1212 and pSeries systems.
1248 1213
1249 To compile this driver as a module, choose M here and read 1214 To compile this driver as a module, choose M here. The module will
1250 <file:Documentation/networking/net-modules.txt>. The module will
1251 be called ibmveth. 1215 be called ibmveth.
1252 1216
1253source "drivers/net/ibm_emac/Kconfig" 1217source "drivers/net/ibm_emac/Kconfig"
@@ -1277,8 +1241,7 @@ config PCNET32
1277 answer Y here and read the Ethernet-HOWTO, available from 1241 answer Y here and read the Ethernet-HOWTO, available from
1278 <http://www.tldp.org/docs.html#howto>. 1242 <http://www.tldp.org/docs.html#howto>.
1279 1243
1280 To compile this driver as a module, choose M here and read 1244 To compile this driver as a module, choose M here. The module
1281 <file:Documentation/networking/net-modules.txt>. The module
1282 will be called pcnet32. 1245 will be called pcnet32.
1283 1246
1284config PCNET32_NAPI 1247config PCNET32_NAPI
@@ -1305,8 +1268,7 @@ config AMD8111_ETH
1305 answer Y here and read the Ethernet-HOWTO, available from 1268 answer Y here and read the Ethernet-HOWTO, available from
1306 <http://www.tldp.org/docs.html#howto>. 1269 <http://www.tldp.org/docs.html#howto>.
1307 1270
1308 To compile this driver as a module, choose M here and read 1271 To compile this driver as a module, choose M here. The module
1309 <file:Documentation/networking/net-modules.txt>. The module
1310 will be called amd8111e. 1272 will be called amd8111e.
1311 1273
1312config AMD8111E_NAPI 1274config AMD8111E_NAPI
@@ -1360,8 +1322,7 @@ config AC3200
1360 the Ethernet-HOWTO, available from 1322 the Ethernet-HOWTO, available from
1361 <http://www.tldp.org/docs.html#howto>. 1323 <http://www.tldp.org/docs.html#howto>.
1362 1324
1363 To compile this driver as a module, choose M here and read 1325 To compile this driver as a module, choose M here. The module
1364 <file:Documentation/networking/net-modules.txt>. The module
1365 will be called ac3200. 1326 will be called ac3200.
1366 1327
1367config APRICOT 1328config APRICOT
@@ -1372,9 +1333,8 @@ config APRICOT
1372 read the Ethernet-HOWTO, available from 1333 read the Ethernet-HOWTO, available from
1373 <http://www.tldp.org/docs.html#howto>. 1334 <http://www.tldp.org/docs.html#howto>.
1374 1335
1375 To compile this driver as a module, choose M here and read 1336 To compile this driver as a module, choose M here. The module
1376 <file:Documentation/networking/net-modules.txt>. The module will be 1337 will be called apricot.
1377 called apricot.
1378 1338
1379config B44 1339config B44
1380 tristate "Broadcom 440x/47xx ethernet support" 1340 tristate "Broadcom 440x/47xx ethernet support"
@@ -1386,9 +1346,8 @@ config B44
1386 or M and read the Ethernet-HOWTO, available from 1346 or M and read the Ethernet-HOWTO, available from
1387 <http://www.tldp.org/docs.html#howto>. 1347 <http://www.tldp.org/docs.html#howto>.
1388 1348
1389 To compile this driver as a module, choose M here and read 1349 To compile this driver as a module, choose M here. The module
1390 <file:Documentation/networking/net-modules.txt>. The module will be 1350 will be called b44.
1391 called b44.
1392 1351
1393# Auto-select SSB PCI-HOST support, if possible 1352# Auto-select SSB PCI-HOST support, if possible
1394config B44_PCI_AUTOSELECT 1353config B44_PCI_AUTOSELECT
@@ -1417,9 +1376,8 @@ config FORCEDETH
1417 read the Ethernet-HOWTO, available from 1376 read the Ethernet-HOWTO, available from
1418 <http://www.tldp.org/docs.html#howto>. 1377 <http://www.tldp.org/docs.html#howto>.
1419 1378
1420 To compile this driver as a module, choose M here and read 1379 To compile this driver as a module, choose M here. The module
1421 <file:Documentation/networking/net-modules.txt>. The module will be 1380 will be called forcedeth.
1422 called forcedeth.
1423 1381
1424config FORCEDETH_NAPI 1382config FORCEDETH_NAPI
1425 bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" 1383 bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
@@ -1445,9 +1403,8 @@ config CS89x0
1445 <http://www.tldp.org/docs.html#howto> as well as 1403 <http://www.tldp.org/docs.html#howto> as well as
1446 <file:Documentation/networking/cs89x0.txt>. 1404 <file:Documentation/networking/cs89x0.txt>.
1447 1405
1448 To compile this driver as a module, choose M here and read 1406 To compile this driver as a module, choose M here. The module
1449 <file:Documentation/networking/net-modules.txt>. The module will be 1407 will be called cs89x0.
1450 called cs89x0.
1451 1408
1452config TC35815 1409config TC35815
1453 tristate "TOSHIBA TC35815 Ethernet support" 1410 tristate "TOSHIBA TC35815 Ethernet support"
@@ -1463,8 +1420,7 @@ config EEPRO100
1463 card, say Y and read the Ethernet-HOWTO, available from 1420 card, say Y and read the Ethernet-HOWTO, available from
1464 <http://www.tldp.org/docs.html#howto>. 1421 <http://www.tldp.org/docs.html#howto>.
1465 1422
1466 To compile this driver as a module, choose M here and read 1423 To compile this driver as a module, choose M here. The module
1467 <file:Documentation/networking/net-modules.txt>. The module
1468 will be called eepro100. 1424 will be called eepro100.
1469 1425
1470 1426
@@ -1491,8 +1447,7 @@ config E100
1491 More specific information on configuring the driver is in 1447 More specific information on configuring the driver is in
1492 <file:Documentation/networking/e100.txt>. 1448 <file:Documentation/networking/e100.txt>.
1493 1449
1494 To compile this driver as a module, choose M here and read 1450 To compile this driver as a module, choose M here. The module
1495 <file:Documentation/networking/net-modules.txt>. The module
1496 will be called e100. 1451 will be called e100.
1497 1452
1498config LNE390 1453config LNE390
@@ -1504,8 +1459,7 @@ config LNE390
1504 the Ethernet-HOWTO, available from 1459 the Ethernet-HOWTO, available from
1505 <http://www.tldp.org/docs.html#howto>. 1460 <http://www.tldp.org/docs.html#howto>.
1506 1461
1507 To compile this driver as a module, choose M here and read 1462 To compile this driver as a module, choose M here. The module
1508 <file:Documentation/networking/net-modules.txt>. The module
1509 will be called lne390. 1463 will be called lne390.
1510 1464
1511config FEALNX 1465config FEALNX
@@ -1545,8 +1499,7 @@ config NE2K_PCI
1545 NetVin NV5000SC Via 86C926 SureCom NE34 Winbond 1499 NetVin NV5000SC Via 86C926 SureCom NE34 Winbond
1546 Holtek HT80232 Holtek HT80229 1500 Holtek HT80232 Holtek HT80229
1547 1501
1548 To compile this driver as a module, choose M here and read 1502 To compile this driver as a module, choose M here. The module
1549 <file:Documentation/networking/net-modules.txt>. The module
1550 will be called ne2k-pci. 1503 will be called ne2k-pci.
1551 1504
1552config NE3210 1505config NE3210
@@ -1559,8 +1512,7 @@ config NE3210
1559 <http://www.tldp.org/docs.html#howto>. Note that this driver 1512 <http://www.tldp.org/docs.html#howto>. Note that this driver
1560 will NOT WORK for NE3200 cards as they are completely different. 1513 will NOT WORK for NE3200 cards as they are completely different.
1561 1514
1562 To compile this driver as a module, choose M here and read 1515 To compile this driver as a module, choose M here. The module
1563 <file:Documentation/networking/net-modules.txt>. The module
1564 will be called ne3210. 1516 will be called ne3210.
1565 1517
1566config ES3210 1518config ES3210
@@ -1572,8 +1524,7 @@ config ES3210
1572 the Ethernet-HOWTO, available from 1524 the Ethernet-HOWTO, available from
1573 <http://www.tldp.org/docs.html#howto>. 1525 <http://www.tldp.org/docs.html#howto>.
1574 1526
1575 To compile this driver as a module, choose M here and read 1527 To compile this driver as a module, choose M here. The module
1576 <file:Documentation/networking/net-modules.txt>. The module
1577 will be called es3210. 1528 will be called es3210.
1578 1529
1579config 8139CP 1530config 8139CP
@@ -1703,8 +1654,7 @@ config TLAN
1703 Compaq NetFlex and Olicom cards. Please read the file 1654 Compaq NetFlex and Olicom cards. Please read the file
1704 <file:Documentation/networking/tlan.txt> for more details. 1655 <file:Documentation/networking/tlan.txt> for more details.
1705 1656
1706 To compile this driver as a module, choose M here and read 1657 To compile this driver as a module, choose M here. The module
1707 <file:Documentation/networking/net-modules.txt>. The module
1708 will be called tlan. 1658 will be called tlan.
1709 1659
1710 Please email feedback to <torben.mathiasen@compaq.com>. 1660 Please email feedback to <torben.mathiasen@compaq.com>.
@@ -1880,6 +1830,28 @@ config FEC2
1880 Say Y here if you want to use the second built-in 10/100 Fast 1830 Say Y here if you want to use the second built-in 10/100 Fast
1881 ethernet controller on some Motorola ColdFire processors. 1831 ethernet controller on some Motorola ColdFire processors.
1882 1832
1833config FEC_MPC52xx
1834 tristate "MPC52xx FEC driver"
1835 depends on PPC_MERGE && PPC_MPC52xx && PPC_BESTCOMM_FEC
1836 select CRC32
1837 select PHYLIB
1838 ---help---
1839 This option enables support for the MPC5200's on-chip
1840 Fast Ethernet Controller
1841 If compiled as module, it will be called 'fec_mpc52xx.ko'.
1842
1843config FEC_MPC52xx_MDIO
1844 bool "MPC52xx FEC MDIO bus driver"
1845 depends on FEC_MPC52xx
1846 default y
1847 ---help---
1848 The MPC5200's FEC can connect to the Ethernet either with
1849 an external MII PHY chip or 10 Mbps 7-wire interface
1850 (Motorola? industry standard).
1851 If your board uses an external PHY connected to FEC, enable this.
1852 If not sure, enable.
1853 If compiled as module, it will be called 'fec_mpc52xx_phy.ko'.
1854
1883config NE_H8300 1855config NE_H8300
1884 tristate "NE2000 compatible support for H8/300" 1856 tristate "NE2000 compatible support for H8/300"
1885 depends on H8300 1857 depends on H8300
@@ -1972,8 +1944,7 @@ config E1000
1972 More specific information on configuring the driver is in 1944 More specific information on configuring the driver is in
1973 <file:Documentation/networking/e1000.txt>. 1945 <file:Documentation/networking/e1000.txt>.
1974 1946
1975 To compile this driver as a module, choose M here and read 1947 To compile this driver as a module, choose M here. The module
1976 <file:Documentation/networking/net-modules.txt>. The module
1977 will be called e1000. 1948 will be called e1000.
1978 1949
1979config E1000_NAPI 1950config E1000_NAPI
@@ -2018,8 +1989,7 @@ config E1000E
2018 More specific information on configuring the driver is in 1989 More specific information on configuring the driver is in
2019 <file:Documentation/networking/e1000e.txt>. 1990 <file:Documentation/networking/e1000e.txt>.
2020 1991
2021 To compile this driver as a module, choose M here and read 1992 To compile this driver as a module, choose M here. The module
2022 <file:Documentation/networking/net-modules.txt>. The module
2023 will be called e1000e. 1993 will be called e1000e.
2024 1994
2025source "drivers/net/ixp2000/Kconfig" 1995source "drivers/net/ixp2000/Kconfig"
@@ -2052,8 +2022,7 @@ config HAMACHI
2052 the Ethernet-HOWTO, available from 2022 the Ethernet-HOWTO, available from
2053 <http://www.tldp.org/docs.html#howto>. 2023 <http://www.tldp.org/docs.html#howto>.
2054 2024
2055 To compile this driver as a module, choose M here and read 2025 To compile this driver as a module, choose M here. The module will be
2056 <file:Documentation/networking/net-modules.txt>. The module will be
2057 called hamachi. 2026 called hamachi.
2058 2027
2059config YELLOWFIN 2028config YELLOWFIN
@@ -2502,8 +2471,7 @@ config IXGBE
2502 More specific information on configuring the driver is in 2471 More specific information on configuring the driver is in
2503 <file:Documentation/networking/ixgbe.txt>. 2472 <file:Documentation/networking/ixgbe.txt>.
2504 2473
2505 To compile this driver as a module, choose M here and read 2474 To compile this driver as a module, choose M here. The module
2506 <file:Documentation/networking/net-modules.txt>. The module
2507 will be called ixgbe. 2475 will be called ixgbe.
2508 2476
2509config IXGB 2477config IXGB
@@ -2525,8 +2493,7 @@ config IXGB
2525 More specific information on configuring the driver is in 2493 More specific information on configuring the driver is in
2526 <file:Documentation/networking/ixgb.txt>. 2494 <file:Documentation/networking/ixgb.txt>.
2527 2495
2528 To compile this driver as a module, choose M here and read 2496 To compile this driver as a module, choose M here. The module
2529 <file:Documentation/networking/net-modules.txt>. The module
2530 will be called ixgb. 2497 will be called ixgb.
2531 2498
2532config IXGB_NAPI 2499config IXGB_NAPI
@@ -2579,8 +2546,7 @@ config MYRI10GE
2579 2546
2580 <http://www.myri.com/scs/download-Myri10GE.html> 2547 <http://www.myri.com/scs/download-Myri10GE.html>
2581 2548
2582 To compile this driver as a module, choose M here and read 2549 To compile this driver as a module, choose M here. The module
2583 <file:Documentation/networking/net-modules.txt>. The module
2584 will be called myri10ge. 2550 will be called myri10ge.
2585 2551
2586config NETXEN_NIC 2552config NETXEN_NIC
@@ -2804,10 +2770,9 @@ config PLIP
2804 with the PLIP support in Linux versions 1.0.x. This option enlarges 2770 with the PLIP support in Linux versions 1.0.x. This option enlarges
2805 your kernel by about 8 KB. 2771 your kernel by about 8 KB.
2806 2772
2807 To compile this driver as a module, choose M here and read 2773 To compile this driver as a module, choose M here. The module
2808 <file:Documentation/networking/net-modules.txt>. The module will be 2774 will be called plip. If unsure, say Y or M, in case you buy
2809 called plip. If unsure, say Y or M, in case you buy a laptop 2775 a laptop later.
2810 later.
2811 2776
2812config PPP 2777config PPP
2813 tristate "PPP (point-to-point protocol) support" 2778 tristate "PPP (point-to-point protocol) support"
@@ -2837,8 +2802,7 @@ config PPP
2837 If you said Y to "Version information on all symbols" above, then 2802 If you said Y to "Version information on all symbols" above, then
2838 you cannot compile the PPP driver into the kernel; you can then only 2803 you cannot compile the PPP driver into the kernel; you can then only
2839 compile it as a module. To compile this driver as a module, choose M 2804 compile it as a module. To compile this driver as a module, choose M
2840 here and read <file:Documentation/networking/net-modules.txt>. 2805 here. The module will be called ppp_generic.
2841 The module will be called ppp_generic.
2842 2806
2843config PPP_MULTILINK 2807config PPP_MULTILINK
2844 bool "PPP multilink support (EXPERIMENTAL)" 2808 bool "PPP multilink support (EXPERIMENTAL)"
@@ -2999,9 +2963,8 @@ config SLIP
2999 <http://www.bart.nl/~patrickr/term-howto/Term-HOWTO.html>). SLIP 2963 <http://www.bart.nl/~patrickr/term-howto/Term-HOWTO.html>). SLIP
3000 support will enlarge your kernel by about 4 KB. If unsure, say N. 2964 support will enlarge your kernel by about 4 KB. If unsure, say N.
3001 2965
3002 To compile this driver as a module, choose M here and read 2966 To compile this driver as a module, choose M here. The module
3003 <file:Documentation/networking/net-modules.txt>. The module will be 2967 will be called slip.
3004 called slip.
3005 2968
3006config SLIP_COMPRESSED 2969config SLIP_COMPRESSED
3007 bool "CSLIP compressed headers" 2970 bool "CSLIP compressed headers"
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/arcnet/Kconfig b/drivers/net/arcnet/Kconfig
index 4030274fe788..3b2f7f115464 100644
--- a/drivers/net/arcnet/Kconfig
+++ b/drivers/net/arcnet/Kconfig
@@ -19,8 +19,7 @@ menuconfig ARCNET
19 from <http://www.tldp.org/docs.html#howto>(even though ARCnet 19 from <http://www.tldp.org/docs.html#howto>(even though ARCnet
20 is not really Ethernet). 20 is not really Ethernet).
21 21
22 To compile this driver as a module, choose M here and read 22 To compile this driver as a module, choose M here. The module will
23 <file:Documentation/networking/net-modules.txt>. The module will
24 be called arcnet. 23 be called arcnet.
25 24
26if ARCNET 25if ARCNET
@@ -81,8 +80,7 @@ config ARCNET_COM90xx
81 have always used the old ARCnet driver without knowing what type of 80 have always used the old ARCnet driver without knowing what type of
82 card you had, this is probably the one for you. 81 card you had, this is probably the one for you.
83 82
84 To compile this driver as a module, choose M here and read 83 To compile this driver as a module, choose M here. The module will
85 <file:Documentation/networking/net-modules.txt>. The module will
86 be called com90xx. 84 be called com90xx.
87 85
88config ARCNET_COM90xxIO 86config ARCNET_COM90xxIO
@@ -93,8 +91,7 @@ config ARCNET_COM90xxIO
93 the normal driver. Only use it if your card doesn't support shared 91 the normal driver. Only use it if your card doesn't support shared
94 memory. 92 memory.
95 93
96 To compile this driver as a module, choose M here and read 94 To compile this driver as a module, choose M here. The module will
97 <file:Documentation/networking/net-modules.txt>. The module will
98 be called com90io. 95 be called com90io.
99 96
100config ARCNET_RIM_I 97config ARCNET_RIM_I
@@ -105,8 +102,7 @@ config ARCNET_RIM_I
105 driver is completely untested, so if you have one of these cards, 102 driver is completely untested, so if you have one of these cards,
106 please mail <dwmw2@infradead.org>, especially if it works! 103 please mail <dwmw2@infradead.org>, especially if it works!
107 104
108 To compile this driver as a module, choose M here and read 105 To compile this driver as a module, choose M here. The module will
109 <file:Documentation/networking/net-modules.txt>. The module will
110 be called arc-rimi. 106 be called arc-rimi.
111 107
112config ARCNET_COM20020 108config ARCNET_COM20020
@@ -116,8 +112,7 @@ config ARCNET_COM20020
116 things as promiscuous mode, so packet sniffing is possible, and 112 things as promiscuous mode, so packet sniffing is possible, and
117 extra diagnostic information. 113 extra diagnostic information.
118 114
119 To compile this driver as a module, choose M here and read 115 To compile this driver as a module, choose M here. The module will
120 <file:Documentation/networking/net-modules.txt>. The module will
121 be called com20020. 116 be called com20020.
122 117
123config ARCNET_COM20020_ISA 118config ARCNET_COM20020_ISA
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c
index 7f016f3d5bf0..91a6590d107b 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -417,7 +417,7 @@ static irqreturn_t ep93xx_irq(int irq, void *dev_id)
417 417
418 if (status & REG_INTSTS_RX) { 418 if (status & REG_INTSTS_RX) {
419 spin_lock(&ep->rx_lock); 419 spin_lock(&ep->rx_lock);
420 if (likely(__netif_rx_schedule_prep(dev, &ep->napi))) { 420 if (likely(netif_rx_schedule_prep(dev, &ep->napi))) {
421 wrl(ep, REG_INTEN, REG_INTEN_TX); 421 wrl(ep, REG_INTEN, REG_INTEN_TX);
422 __netif_rx_schedule(dev, &ep->napi); 422 __netif_rx_schedule(dev, &ep->napi);
423 } 423 }
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 53fe7ded5d50..0b99b5549295 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;
@@ -926,7 +924,7 @@ static int __init bf537mac_probe(struct net_device *dev)
926 if (!is_valid_ether_addr(dev->dev_addr)) { 924 if (!is_valid_ether_addr(dev->dev_addr)) {
927 /* Grab the MAC from the board somehow - this is done in the 925 /* Grab the MAC from the board somehow - this is done in the
928 arch/blackfin/mach-bf537/boards/eth_mac.c */ 926 arch/blackfin/mach-bf537/boards/eth_mac.c */
929 get_bf537_ether_addr(dev->dev_addr); 927 bfin_get_ether_addr(dev->dev_addr);
930 } 928 }
931 929
932 /* If still not valid, get a random one */ 930 /* If still not valid, get a random one */
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h
index 3a107ad75381..5970ea7142cd 100644
--- a/drivers/net/bfin_mac.h
+++ b/drivers/net/bfin_mac.h
@@ -92,4 +92,4 @@ struct bf537mac_local {
92 struct mii_bus mii_bus; 92 struct mii_bus mii_bus;
93}; 93};
94 94
95extern void get_bf537_ether_addr(char *addr); 95extern void bfin_get_ether_addr(char *addr);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6937ef0e7275..423298c84a1d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1847,9 +1847,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1847*/ 1847*/
1848void bond_destroy(struct bonding *bond) 1848void bond_destroy(struct bonding *bond)
1849{ 1849{
1850 unregister_netdevice(bond->dev);
1851 bond_deinit(bond->dev); 1850 bond_deinit(bond->dev);
1852 bond_destroy_sysfs_entry(bond); 1851 bond_destroy_sysfs_entry(bond);
1852 unregister_netdevice(bond->dev);
1853} 1853}
1854 1854
1855/* 1855/*
@@ -4405,6 +4405,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4405 bond_dev->set_multicast_list = bond_set_multicast_list; 4405 bond_dev->set_multicast_list = bond_set_multicast_list;
4406 bond_dev->change_mtu = bond_change_mtu; 4406 bond_dev->change_mtu = bond_change_mtu;
4407 bond_dev->set_mac_address = bond_set_mac_address; 4407 bond_dev->set_mac_address = bond_set_mac_address;
4408 bond_dev->validate_addr = NULL;
4408 4409
4409 bond_set_mode_ops(bond, bond->params.mode); 4410 bond_set_mode_ops(bond, bond->params.mode);
4410 4411
@@ -4474,8 +4475,8 @@ static void bond_free_all(void)
4474 bond_mc_list_destroy(bond); 4475 bond_mc_list_destroy(bond);
4475 /* Release the bonded slaves */ 4476 /* Release the bonded slaves */
4476 bond_release_all(bond_dev); 4477 bond_release_all(bond_dev);
4477 unregister_netdevice(bond_dev);
4478 bond_deinit(bond_dev); 4478 bond_deinit(bond_dev);
4479 unregister_netdevice(bond_dev);
4479 } 4480 }
4480 4481
4481#ifdef CONFIG_PROC_FS 4482#ifdef CONFIG_PROC_FS
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 7a06ade85b02..b29330d8e309 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1193,8 +1193,6 @@ static ssize_t bonding_show_active_slave(struct device *d,
1193 struct bonding *bond = to_bond(d); 1193 struct bonding *bond = to_bond(d);
1194 int count; 1194 int count;
1195 1195
1196 rtnl_lock();
1197
1198 read_lock(&bond->curr_slave_lock); 1196 read_lock(&bond->curr_slave_lock);
1199 curr = bond->curr_active_slave; 1197 curr = bond->curr_active_slave;
1200 read_unlock(&bond->curr_slave_lock); 1198 read_unlock(&bond->curr_slave_lock);
@@ -1216,7 +1214,9 @@ static ssize_t bonding_store_active_slave(struct device *d,
1216 struct slave *new_active = NULL; 1214 struct slave *new_active = NULL;
1217 struct bonding *bond = to_bond(d); 1215 struct bonding *bond = to_bond(d);
1218 1216
1217 rtnl_lock();
1219 write_lock_bh(&bond->lock); 1218 write_lock_bh(&bond->lock);
1219
1220 if (!USES_PRIMARY(bond->params.mode)) { 1220 if (!USES_PRIMARY(bond->params.mode)) {
1221 printk(KERN_INFO DRV_NAME 1221 printk(KERN_INFO DRV_NAME
1222 ": %s: Unable to change active slave; %s is in mode %d\n", 1222 ": %s: Unable to change active slave; %s is in mode %d\n",
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index ffa7e649a6ef..443666292a5c 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -1379,11 +1379,11 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
1379 } 1379 }
1380 __skb_pull(skb, sizeof(*p)); 1380 __skb_pull(skb, sizeof(*p));
1381 1381
1382 skb->dev->last_rx = jiffies;
1383 st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); 1382 st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id());
1384 st->rx_packets++; 1383 st->rx_packets++;
1385 1384
1386 skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); 1385 skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev);
1386 skb->dev->last_rx = jiffies;
1387 if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff && 1387 if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff &&
1388 skb->protocol == htons(ETH_P_IP) && 1388 skb->protocol == htons(ETH_P_IP) &&
1389 (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) { 1389 (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) {
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index edd6828f0a78..917b7b46f1a7 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -250,6 +250,7 @@
250#include <asm/system.h> 250#include <asm/system.h>
251#include <asm/ethernet.h> 251#include <asm/ethernet.h>
252#include <asm/cache.h> 252#include <asm/cache.h>
253#include <asm/arch/io_interface_mux.h>
253 254
254//#define ETHDEBUG 255//#define ETHDEBUG
255#define D(x) 256#define D(x)
@@ -279,6 +280,9 @@ struct net_local {
279 * by this lock as well. 280 * by this lock as well.
280 */ 281 */
281 spinlock_t lock; 282 spinlock_t lock;
283
284 spinlock_t led_lock; /* Protect LED state */
285 spinlock_t transceiver_lock; /* Protect transceiver state. */
282}; 286};
283 287
284typedef struct etrax_eth_descr 288typedef struct etrax_eth_descr
@@ -295,8 +299,6 @@ struct transceiver_ops
295 void (*check_duplex)(struct net_device* dev); 299 void (*check_duplex)(struct net_device* dev);
296}; 300};
297 301
298struct transceiver_ops* transceiver;
299
300/* Duplex settings */ 302/* Duplex settings */
301enum duplex 303enum duplex
302{ 304{
@@ -307,7 +309,7 @@ enum duplex
307 309
308/* Dma descriptors etc. */ 310/* Dma descriptors etc. */
309 311
310#define MAX_MEDIA_DATA_SIZE 1518 312#define MAX_MEDIA_DATA_SIZE 1522
311 313
312#define MIN_PACKET_LEN 46 314#define MIN_PACKET_LEN 46
313#define ETHER_HEAD_LEN 14 315#define ETHER_HEAD_LEN 14
@@ -332,8 +334,8 @@ enum duplex
332 334
333/*Intel LXT972A specific*/ 335/*Intel LXT972A specific*/
334#define MDIO_INT_STATUS_REG_2 0x0011 336#define MDIO_INT_STATUS_REG_2 0x0011
335#define MDIO_INT_FULL_DUPLEX_IND ( 1 << 9 ) 337#define MDIO_INT_FULL_DUPLEX_IND (1 << 9)
336#define MDIO_INT_SPEED ( 1 << 14 ) 338#define MDIO_INT_SPEED (1 << 14)
337 339
338/* Network flash constants */ 340/* Network flash constants */
339#define NET_FLASH_TIME (HZ/50) /* 20 ms */ 341#define NET_FLASH_TIME (HZ/50) /* 20 ms */
@@ -344,8 +346,8 @@ enum duplex
344#define NO_NETWORK_ACTIVITY 0 346#define NO_NETWORK_ACTIVITY 0
345#define NETWORK_ACTIVITY 1 347#define NETWORK_ACTIVITY 1
346 348
347#define NBR_OF_RX_DESC 64 349#define NBR_OF_RX_DESC 32
348#define NBR_OF_TX_DESC 256 350#define NBR_OF_TX_DESC 16
349 351
350/* Large packets are sent directly to upper layers while small packets are */ 352/* Large packets are sent directly to upper layers while small packets are */
351/* copied (to reduce memory waste). The following constant decides the breakpoint */ 353/* copied (to reduce memory waste). The following constant decides the breakpoint */
@@ -367,7 +369,6 @@ enum duplex
367static etrax_eth_descr *myNextRxDesc; /* Points to the next descriptor to 369static etrax_eth_descr *myNextRxDesc; /* Points to the next descriptor to
368 to be processed */ 370 to be processed */
369static etrax_eth_descr *myLastRxDesc; /* The last processed descriptor */ 371static etrax_eth_descr *myLastRxDesc; /* The last processed descriptor */
370static etrax_eth_descr *myPrevRxDesc; /* The descriptor right before myNextRxDesc */
371 372
372static etrax_eth_descr RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned(32))); 373static etrax_eth_descr RxDescList[NBR_OF_RX_DESC] __attribute__ ((aligned(32)));
373 374
@@ -377,7 +378,6 @@ static etrax_eth_descr* myNextTxDesc; /* Next descriptor to use */
377static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32))); 378static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32)));
378 379
379static unsigned int network_rec_config_shadow = 0; 380static unsigned int network_rec_config_shadow = 0;
380static unsigned int mdio_phy_addr; /* Transciever address */
381 381
382static unsigned int network_tr_ctrl_shadow = 0; 382static unsigned int network_tr_ctrl_shadow = 0;
383 383
@@ -411,7 +411,7 @@ static int e100_set_config(struct net_device* dev, struct ifmap* map);
411static void e100_tx_timeout(struct net_device *dev); 411static void e100_tx_timeout(struct net_device *dev);
412static struct net_device_stats *e100_get_stats(struct net_device *dev); 412static struct net_device_stats *e100_get_stats(struct net_device *dev);
413static void set_multicast_list(struct net_device *dev); 413static void set_multicast_list(struct net_device *dev);
414static void e100_hardware_send_packet(char *buf, int length); 414static void e100_hardware_send_packet(struct net_local* np, char *buf, int length);
415static void update_rx_stats(struct net_device_stats *); 415static void update_rx_stats(struct net_device_stats *);
416static void update_tx_stats(struct net_device_stats *); 416static void update_tx_stats(struct net_device_stats *);
417static int e100_probe_transceiver(struct net_device* dev); 417static int e100_probe_transceiver(struct net_device* dev);
@@ -434,7 +434,10 @@ static void e100_clear_network_leds(unsigned long dummy);
434static void e100_set_network_leds(int active); 434static void e100_set_network_leds(int active);
435 435
436static const struct ethtool_ops e100_ethtool_ops; 436static const struct ethtool_ops e100_ethtool_ops;
437 437#if defined(CONFIG_ETRAX_NO_PHY)
438static void dummy_check_speed(struct net_device* dev);
439static void dummy_check_duplex(struct net_device* dev);
440#else
438static void broadcom_check_speed(struct net_device* dev); 441static void broadcom_check_speed(struct net_device* dev);
439static void broadcom_check_duplex(struct net_device* dev); 442static void broadcom_check_duplex(struct net_device* dev);
440static void tdk_check_speed(struct net_device* dev); 443static void tdk_check_speed(struct net_device* dev);
@@ -443,16 +446,28 @@ static void intel_check_speed(struct net_device* dev);
443static void intel_check_duplex(struct net_device* dev); 446static void intel_check_duplex(struct net_device* dev);
444static void generic_check_speed(struct net_device* dev); 447static void generic_check_speed(struct net_device* dev);
445static void generic_check_duplex(struct net_device* dev); 448static void generic_check_duplex(struct net_device* dev);
449#endif
450#ifdef CONFIG_NET_POLL_CONTROLLER
451static void e100_netpoll(struct net_device* dev);
452#endif
453
454static int autoneg_normal = 1;
446 455
447struct transceiver_ops transceivers[] = 456struct transceiver_ops transceivers[] =
448{ 457{
458#if defined(CONFIG_ETRAX_NO_PHY)
459 {0x0000, dummy_check_speed, dummy_check_duplex} /* Dummy */
460#else
449 {0x1018, broadcom_check_speed, broadcom_check_duplex}, /* Broadcom */ 461 {0x1018, broadcom_check_speed, broadcom_check_duplex}, /* Broadcom */
450 {0xC039, tdk_check_speed, tdk_check_duplex}, /* TDK 2120 */ 462 {0xC039, tdk_check_speed, tdk_check_duplex}, /* TDK 2120 */
451 {0x039C, tdk_check_speed, tdk_check_duplex}, /* TDK 2120C */ 463 {0x039C, tdk_check_speed, tdk_check_duplex}, /* TDK 2120C */
452 {0x04de, intel_check_speed, intel_check_duplex}, /* Intel LXT972A*/ 464 {0x04de, intel_check_speed, intel_check_duplex}, /* Intel LXT972A*/
453 {0x0000, generic_check_speed, generic_check_duplex} /* Generic, must be last */ 465 {0x0000, generic_check_speed, generic_check_duplex} /* Generic, must be last */
466#endif
454}; 467};
455 468
469struct transceiver_ops* transceiver = &transceivers[0];
470
456#define tx_done(dev) (*R_DMA_CH0_CMD == 0) 471#define tx_done(dev) (*R_DMA_CH0_CMD == 0)
457 472
458/* 473/*
@@ -471,14 +486,22 @@ etrax_ethernet_init(void)
471 int i, err; 486 int i, err;
472 487
473 printk(KERN_INFO 488 printk(KERN_INFO
474 "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n"); 489 "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 1998-2007 Axis Communications AB\n");
475 490
476 dev = alloc_etherdev(sizeof(struct net_local)); 491 if (cris_request_io_interface(if_eth, cardname)) {
477 np = dev->priv; 492 printk(KERN_CRIT "etrax_ethernet_init failed to get IO interface\n");
493 return -EBUSY;
494 }
478 495
496 dev = alloc_etherdev(sizeof(struct net_local));
479 if (!dev) 497 if (!dev)
480 return -ENOMEM; 498 return -ENOMEM;
481 499
500 np = netdev_priv(dev);
501
502 /* we do our own locking */
503 dev->features |= NETIF_F_LLTX;
504
482 dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */ 505 dev->base_addr = (unsigned int)R_NETWORK_SA_0; /* just to have something to show */
483 506
484 /* now setup our etrax specific stuff */ 507 /* now setup our etrax specific stuff */
@@ -498,14 +521,22 @@ etrax_ethernet_init(void)
498 dev->do_ioctl = e100_ioctl; 521 dev->do_ioctl = e100_ioctl;
499 dev->set_config = e100_set_config; 522 dev->set_config = e100_set_config;
500 dev->tx_timeout = e100_tx_timeout; 523 dev->tx_timeout = e100_tx_timeout;
524#ifdef CONFIG_NET_POLL_CONTROLLER
525 dev->poll_controller = e100_netpoll;
526#endif
527
528 spin_lock_init(&np->lock);
529 spin_lock_init(&np->led_lock);
530 spin_lock_init(&np->transceiver_lock);
501 531
502 /* Initialise the list of Etrax DMA-descriptors */ 532 /* Initialise the list of Etrax DMA-descriptors */
503 533
504 /* Initialise receive descriptors */ 534 /* Initialise receive descriptors */
505 535
506 for (i = 0; i < NBR_OF_RX_DESC; i++) { 536 for (i = 0; i < NBR_OF_RX_DESC; i++) {
507 /* Allocate two extra cachelines to make sure that buffer used by DMA 537 /* Allocate two extra cachelines to make sure that buffer used
508 * does not share cacheline with any other data (to avoid cache bug) 538 * by DMA does not share cacheline with any other data (to
539 * avoid cache bug)
509 */ 540 */
510 RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); 541 RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES);
511 if (!RxDescList[i].skb) 542 if (!RxDescList[i].skb)
@@ -541,7 +572,6 @@ etrax_ethernet_init(void)
541 572
542 myNextRxDesc = &RxDescList[0]; 573 myNextRxDesc = &RxDescList[0];
543 myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1]; 574 myLastRxDesc = &RxDescList[NBR_OF_RX_DESC - 1];
544 myPrevRxDesc = &RxDescList[NBR_OF_RX_DESC - 1];
545 myFirstTxDesc = &TxDescList[0]; 575 myFirstTxDesc = &TxDescList[0];
546 myNextTxDesc = &TxDescList[0]; 576 myNextTxDesc = &TxDescList[0];
547 myLastTxDesc = &TxDescList[NBR_OF_TX_DESC - 1]; 577 myLastTxDesc = &TxDescList[NBR_OF_TX_DESC - 1];
@@ -562,10 +592,11 @@ etrax_ethernet_init(void)
562 current_speed = 10; 592 current_speed = 10;
563 current_speed_selection = 0; /* Auto */ 593 current_speed_selection = 0; /* Auto */
564 speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; 594 speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL;
565 duplex_timer.data = (unsigned long)dev; 595 speed_timer.data = (unsigned long)dev;
566 speed_timer.function = e100_check_speed; 596 speed_timer.function = e100_check_speed;
567 597
568 clear_led_timer.function = e100_clear_network_leds; 598 clear_led_timer.function = e100_clear_network_leds;
599 clear_led_timer.data = (unsigned long)dev;
569 600
570 full_duplex = 0; 601 full_duplex = 0;
571 current_duplex = autoneg; 602 current_duplex = autoneg;
@@ -574,7 +605,6 @@ etrax_ethernet_init(void)
574 duplex_timer.function = e100_check_duplex; 605 duplex_timer.function = e100_check_duplex;
575 606
576 /* Initialize mii interface */ 607 /* Initialize mii interface */
577 np->mii_if.phy_id = mdio_phy_addr;
578 np->mii_if.phy_id_mask = 0x1f; 608 np->mii_if.phy_id_mask = 0x1f;
579 np->mii_if.reg_num_mask = 0x1f; 609 np->mii_if.reg_num_mask = 0x1f;
580 np->mii_if.dev = dev; 610 np->mii_if.dev = dev;
@@ -585,6 +615,9 @@ etrax_ethernet_init(void)
585 /* unwanted addresses are matched */ 615 /* unwanted addresses are matched */
586 *R_NETWORK_GA_0 = 0x00000000; 616 *R_NETWORK_GA_0 = 0x00000000;
587 *R_NETWORK_GA_1 = 0x00000000; 617 *R_NETWORK_GA_1 = 0x00000000;
618
619 /* Initialize next time the led can flash */
620 led_next_time = jiffies;
588 return 0; 621 return 0;
589} 622}
590 623
@@ -595,9 +628,9 @@ etrax_ethernet_init(void)
595static int 628static int
596e100_set_mac_address(struct net_device *dev, void *p) 629e100_set_mac_address(struct net_device *dev, void *p)
597{ 630{
598 struct net_local *np = (struct net_local *)dev->priv; 631 struct net_local *np = netdev_priv(dev);
599 struct sockaddr *addr = p; 632 struct sockaddr *addr = p;
600 int i; 633 DECLARE_MAC_BUF(mac);
601 634
602 spin_lock(&np->lock); /* preemption protection */ 635 spin_lock(&np->lock); /* preemption protection */
603 636
@@ -686,6 +719,25 @@ e100_open(struct net_device *dev)
686 goto grace_exit2; 719 goto grace_exit2;
687 } 720 }
688 721
722 /*
723 * Always allocate the DMA channels after the IRQ,
724 * and clean up on failure.
725 */
726
727 if (cris_request_dma(NETWORK_TX_DMA_NBR,
728 cardname,
729 DMA_VERBOSE_ON_ERROR,
730 dma_eth)) {
731 goto grace_exit3;
732 }
733
734 if (cris_request_dma(NETWORK_RX_DMA_NBR,
735 cardname,
736 DMA_VERBOSE_ON_ERROR,
737 dma_eth)) {
738 goto grace_exit4;
739 }
740
689 /* give the HW an idea of what MAC address we want */ 741 /* give the HW an idea of what MAC address we want */
690 742
691 *R_NETWORK_SA_0 = dev->dev_addr[0] | (dev->dev_addr[1] << 8) | 743 *R_NETWORK_SA_0 = dev->dev_addr[0] | (dev->dev_addr[1] << 8) |
@@ -700,6 +752,7 @@ e100_open(struct net_device *dev)
700 752
701 *R_NETWORK_REC_CONFIG = 0xd; /* broadcast rec, individ. rec, ma0 enabled */ 753 *R_NETWORK_REC_CONFIG = 0xd; /* broadcast rec, individ. rec, ma0 enabled */
702#else 754#else
755 SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, max_size, size1522);
703 SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, broadcast, receive); 756 SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, broadcast, receive);
704 SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, ma0, enable); 757 SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, ma0, enable);
705 SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex); 758 SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex);
@@ -719,8 +772,7 @@ e100_open(struct net_device *dev)
719 SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable); 772 SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable);
720 *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; 773 *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
721 774
722 save_flags(flags); 775 local_irq_save(flags);
723 cli();
724 776
725 /* enable the irq's for ethernet DMA */ 777 /* enable the irq's for ethernet DMA */
726 778
@@ -752,12 +804,13 @@ e100_open(struct net_device *dev)
752 804
753 *R_DMA_CH0_FIRST = 0; 805 *R_DMA_CH0_FIRST = 0;
754 *R_DMA_CH0_DESCR = virt_to_phys(myLastTxDesc); 806 *R_DMA_CH0_DESCR = virt_to_phys(myLastTxDesc);
807 netif_start_queue(dev);
755 808
756 restore_flags(flags); 809 local_irq_restore(flags);
757 810
758 /* Probe for transceiver */ 811 /* Probe for transceiver */
759 if (e100_probe_transceiver(dev)) 812 if (e100_probe_transceiver(dev))
760 goto grace_exit3; 813 goto grace_exit5;
761 814
762 /* Start duplex/speed timers */ 815 /* Start duplex/speed timers */
763 add_timer(&speed_timer); 816 add_timer(&speed_timer);
@@ -766,10 +819,14 @@ e100_open(struct net_device *dev)
766 /* We are now ready to accept transmit requeusts from 819 /* We are now ready to accept transmit requeusts from
767 * the queueing layer of the networking. 820 * the queueing layer of the networking.
768 */ 821 */
769 netif_start_queue(dev); 822 netif_carrier_on(dev);
770 823
771 return 0; 824 return 0;
772 825
826grace_exit5:
827 cris_free_dma(NETWORK_RX_DMA_NBR, cardname);
828grace_exit4:
829 cris_free_dma(NETWORK_TX_DMA_NBR, cardname);
773grace_exit3: 830grace_exit3:
774 free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); 831 free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev);
775grace_exit2: 832grace_exit2:
@@ -780,12 +837,20 @@ grace_exit0:
780 return -EAGAIN; 837 return -EAGAIN;
781} 838}
782 839
783 840#if defined(CONFIG_ETRAX_NO_PHY)
841static void
842dummy_check_speed(struct net_device* dev)
843{
844 current_speed = 100;
845}
846#else
784static void 847static void
785generic_check_speed(struct net_device* dev) 848generic_check_speed(struct net_device* dev)
786{ 849{
787 unsigned long data; 850 unsigned long data;
788 data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); 851 struct net_local *np = netdev_priv(dev);
852
853 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE);
789 if ((data & ADVERTISE_100FULL) || 854 if ((data & ADVERTISE_100FULL) ||
790 (data & ADVERTISE_100HALF)) 855 (data & ADVERTISE_100HALF))
791 current_speed = 100; 856 current_speed = 100;
@@ -797,7 +862,10 @@ static void
797tdk_check_speed(struct net_device* dev) 862tdk_check_speed(struct net_device* dev)
798{ 863{
799 unsigned long data; 864 unsigned long data;
800 data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_TDK_DIAGNOSTIC_REG); 865 struct net_local *np = netdev_priv(dev);
866
867 data = e100_get_mdio_reg(dev, np->mii_if.phy_id,
868 MDIO_TDK_DIAGNOSTIC_REG);
801 current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10); 869 current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10);
802} 870}
803 871
@@ -805,7 +873,10 @@ static void
805broadcom_check_speed(struct net_device* dev) 873broadcom_check_speed(struct net_device* dev)
806{ 874{
807 unsigned long data; 875 unsigned long data;
808 data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_AUX_CTRL_STATUS_REG); 876 struct net_local *np = netdev_priv(dev);
877
878 data = e100_get_mdio_reg(dev, np->mii_if.phy_id,
879 MDIO_AUX_CTRL_STATUS_REG);
809 current_speed = (data & MDIO_BC_SPEED ? 100 : 10); 880 current_speed = (data & MDIO_BC_SPEED ? 100 : 10);
810} 881}
811 882
@@ -813,46 +884,62 @@ static void
813intel_check_speed(struct net_device* dev) 884intel_check_speed(struct net_device* dev)
814{ 885{
815 unsigned long data; 886 unsigned long data;
816 data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_INT_STATUS_REG_2); 887 struct net_local *np = netdev_priv(dev);
888
889 data = e100_get_mdio_reg(dev, np->mii_if.phy_id,
890 MDIO_INT_STATUS_REG_2);
817 current_speed = (data & MDIO_INT_SPEED ? 100 : 10); 891 current_speed = (data & MDIO_INT_SPEED ? 100 : 10);
818} 892}
819 893#endif
820static void 894static void
821e100_check_speed(unsigned long priv) 895e100_check_speed(unsigned long priv)
822{ 896{
823 struct net_device* dev = (struct net_device*)priv; 897 struct net_device* dev = (struct net_device*)priv;
898 struct net_local *np = netdev_priv(dev);
824 static int led_initiated = 0; 899 static int led_initiated = 0;
825 unsigned long data; 900 unsigned long data;
826 int old_speed = current_speed; 901 int old_speed = current_speed;
827 902
828 data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR); 903 spin_lock(&np->transceiver_lock);
904
905 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMSR);
829 if (!(data & BMSR_LSTATUS)) { 906 if (!(data & BMSR_LSTATUS)) {
830 current_speed = 0; 907 current_speed = 0;
831 } else { 908 } else {
832 transceiver->check_speed(dev); 909 transceiver->check_speed(dev);
833 } 910 }
834 911
912 spin_lock(&np->led_lock);
835 if ((old_speed != current_speed) || !led_initiated) { 913 if ((old_speed != current_speed) || !led_initiated) {
836 led_initiated = 1; 914 led_initiated = 1;
837 e100_set_network_leds(NO_NETWORK_ACTIVITY); 915 e100_set_network_leds(NO_NETWORK_ACTIVITY);
916 if (current_speed)
917 netif_carrier_on(dev);
918 else
919 netif_carrier_off(dev);
838 } 920 }
921 spin_unlock(&np->led_lock);
839 922
840 /* Reinitialize the timer. */ 923 /* Reinitialize the timer. */
841 speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL; 924 speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL;
842 add_timer(&speed_timer); 925 add_timer(&speed_timer);
926
927 spin_unlock(&np->transceiver_lock);
843} 928}
844 929
845static void 930static void
846e100_negotiate(struct net_device* dev) 931e100_negotiate(struct net_device* dev)
847{ 932{
848 unsigned short data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); 933 struct net_local *np = netdev_priv(dev);
934 unsigned short data = e100_get_mdio_reg(dev, np->mii_if.phy_id,
935 MII_ADVERTISE);
849 936
850 /* Discard old speed and duplex settings */ 937 /* Discard old speed and duplex settings */
851 data &= ~(ADVERTISE_100HALF | ADVERTISE_100FULL | 938 data &= ~(ADVERTISE_100HALF | ADVERTISE_100FULL |
852 ADVERTISE_10HALF | ADVERTISE_10FULL); 939 ADVERTISE_10HALF | ADVERTISE_10FULL);
853 940
854 switch (current_speed_selection) { 941 switch (current_speed_selection) {
855 case 10 : 942 case 10:
856 if (current_duplex == full) 943 if (current_duplex == full)
857 data |= ADVERTISE_10FULL; 944 data |= ADVERTISE_10FULL;
858 else if (current_duplex == half) 945 else if (current_duplex == half)
@@ -861,7 +948,7 @@ e100_negotiate(struct net_device* dev)
861 data |= ADVERTISE_10HALF | ADVERTISE_10FULL; 948 data |= ADVERTISE_10HALF | ADVERTISE_10FULL;
862 break; 949 break;
863 950
864 case 100 : 951 case 100:
865 if (current_duplex == full) 952 if (current_duplex == full)
866 data |= ADVERTISE_100FULL; 953 data |= ADVERTISE_100FULL;
867 else if (current_duplex == half) 954 else if (current_duplex == half)
@@ -870,7 +957,7 @@ e100_negotiate(struct net_device* dev)
870 data |= ADVERTISE_100HALF | ADVERTISE_100FULL; 957 data |= ADVERTISE_100HALF | ADVERTISE_100FULL;
871 break; 958 break;
872 959
873 case 0 : /* Auto */ 960 case 0: /* Auto */
874 if (current_duplex == full) 961 if (current_duplex == full)
875 data |= ADVERTISE_100FULL | ADVERTISE_10FULL; 962 data |= ADVERTISE_100FULL | ADVERTISE_10FULL;
876 else if (current_duplex == half) 963 else if (current_duplex == half)
@@ -880,35 +967,44 @@ e100_negotiate(struct net_device* dev)
880 ADVERTISE_100HALF | ADVERTISE_100FULL; 967 ADVERTISE_100HALF | ADVERTISE_100FULL;
881 break; 968 break;
882 969
883 default : /* assume autoneg speed and duplex */ 970 default: /* assume autoneg speed and duplex */
884 data |= ADVERTISE_10HALF | ADVERTISE_10FULL | 971 data |= ADVERTISE_10HALF | ADVERTISE_10FULL |
885 ADVERTISE_100HALF | ADVERTISE_100FULL; 972 ADVERTISE_100HALF | ADVERTISE_100FULL;
973 break;
886 } 974 }
887 975
888 e100_set_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE, data); 976 e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE, data);
889 977
890 /* Renegotiate with link partner */ 978 /* Renegotiate with link partner */
891 data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMCR); 979 if (autoneg_normal) {
980 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR);
892 data |= BMCR_ANENABLE | BMCR_ANRESTART; 981 data |= BMCR_ANENABLE | BMCR_ANRESTART;
893 982 }
894 e100_set_mdio_reg(dev, mdio_phy_addr, MII_BMCR, data); 983 e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR, data);
895} 984}
896 985
897static void 986static void
898e100_set_speed(struct net_device* dev, unsigned long speed) 987e100_set_speed(struct net_device* dev, unsigned long speed)
899{ 988{
989 struct net_local *np = netdev_priv(dev);
990
991 spin_lock(&np->transceiver_lock);
900 if (speed != current_speed_selection) { 992 if (speed != current_speed_selection) {
901 current_speed_selection = speed; 993 current_speed_selection = speed;
902 e100_negotiate(dev); 994 e100_negotiate(dev);
903 } 995 }
996 spin_unlock(&np->transceiver_lock);
904} 997}
905 998
906static void 999static void
907e100_check_duplex(unsigned long priv) 1000e100_check_duplex(unsigned long priv)
908{ 1001{
909 struct net_device *dev = (struct net_device *)priv; 1002 struct net_device *dev = (struct net_device *)priv;
910 struct net_local *np = (struct net_local *)dev->priv; 1003 struct net_local *np = netdev_priv(dev);
911 int old_duplex = full_duplex; 1004 int old_duplex;
1005
1006 spin_lock(&np->transceiver_lock);
1007 old_duplex = full_duplex;
912 transceiver->check_duplex(dev); 1008 transceiver->check_duplex(dev);
913 if (old_duplex != full_duplex) { 1009 if (old_duplex != full_duplex) {
914 /* Duplex changed */ 1010 /* Duplex changed */
@@ -920,13 +1016,22 @@ e100_check_duplex(unsigned long priv)
920 duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL; 1016 duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL;
921 add_timer(&duplex_timer); 1017 add_timer(&duplex_timer);
922 np->mii_if.full_duplex = full_duplex; 1018 np->mii_if.full_duplex = full_duplex;
1019 spin_unlock(&np->transceiver_lock);
923} 1020}
924 1021#if defined(CONFIG_ETRAX_NO_PHY)
1022static void
1023dummy_check_duplex(struct net_device* dev)
1024{
1025 full_duplex = 1;
1026}
1027#else
925static void 1028static void
926generic_check_duplex(struct net_device* dev) 1029generic_check_duplex(struct net_device* dev)
927{ 1030{
928 unsigned long data; 1031 unsigned long data;
929 data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_ADVERTISE); 1032 struct net_local *np = netdev_priv(dev);
1033
1034 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE);
930 if ((data & ADVERTISE_10FULL) || 1035 if ((data & ADVERTISE_10FULL) ||
931 (data & ADVERTISE_100FULL)) 1036 (data & ADVERTISE_100FULL))
932 full_duplex = 1; 1037 full_duplex = 1;
@@ -938,7 +1043,10 @@ static void
938tdk_check_duplex(struct net_device* dev) 1043tdk_check_duplex(struct net_device* dev)
939{ 1044{
940 unsigned long data; 1045 unsigned long data;
941 data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_TDK_DIAGNOSTIC_REG); 1046 struct net_local *np = netdev_priv(dev);
1047
1048 data = e100_get_mdio_reg(dev, np->mii_if.phy_id,
1049 MDIO_TDK_DIAGNOSTIC_REG);
942 full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0; 1050 full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0;
943} 1051}
944 1052
@@ -946,7 +1054,10 @@ static void
946broadcom_check_duplex(struct net_device* dev) 1054broadcom_check_duplex(struct net_device* dev)
947{ 1055{
948 unsigned long data; 1056 unsigned long data;
949 data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_AUX_CTRL_STATUS_REG); 1057 struct net_local *np = netdev_priv(dev);
1058
1059 data = e100_get_mdio_reg(dev, np->mii_if.phy_id,
1060 MDIO_AUX_CTRL_STATUS_REG);
950 full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0; 1061 full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0;
951} 1062}
952 1063
@@ -954,38 +1065,55 @@ static void
954intel_check_duplex(struct net_device* dev) 1065intel_check_duplex(struct net_device* dev)
955{ 1066{
956 unsigned long data; 1067 unsigned long data;
957 data = e100_get_mdio_reg(dev, mdio_phy_addr, MDIO_INT_STATUS_REG_2); 1068 struct net_local *np = netdev_priv(dev);
1069
1070 data = e100_get_mdio_reg(dev, np->mii_if.phy_id,
1071 MDIO_INT_STATUS_REG_2);
958 full_duplex = (data & MDIO_INT_FULL_DUPLEX_IND) ? 1 : 0; 1072 full_duplex = (data & MDIO_INT_FULL_DUPLEX_IND) ? 1 : 0;
959} 1073}
960 1074#endif
961static void 1075static void
962e100_set_duplex(struct net_device* dev, enum duplex new_duplex) 1076e100_set_duplex(struct net_device* dev, enum duplex new_duplex)
963{ 1077{
1078 struct net_local *np = netdev_priv(dev);
1079
1080 spin_lock(&np->transceiver_lock);
964 if (new_duplex != current_duplex) { 1081 if (new_duplex != current_duplex) {
965 current_duplex = new_duplex; 1082 current_duplex = new_duplex;
966 e100_negotiate(dev); 1083 e100_negotiate(dev);
967 } 1084 }
1085 spin_unlock(&np->transceiver_lock);
968} 1086}
969 1087
970static int 1088static int
971e100_probe_transceiver(struct net_device* dev) 1089e100_probe_transceiver(struct net_device* dev)
972{ 1090{
1091 int ret = 0;
1092
1093#if !defined(CONFIG_ETRAX_NO_PHY)
973 unsigned int phyid_high; 1094 unsigned int phyid_high;
974 unsigned int phyid_low; 1095 unsigned int phyid_low;
975 unsigned int oui; 1096 unsigned int oui;
976 struct transceiver_ops* ops = NULL; 1097 struct transceiver_ops* ops = NULL;
1098 struct net_local *np = netdev_priv(dev);
1099
1100 spin_lock(&np->transceiver_lock);
977 1101
978 /* Probe MDIO physical address */ 1102 /* Probe MDIO physical address */
979 for (mdio_phy_addr = 0; mdio_phy_addr <= 31; mdio_phy_addr++) { 1103 for (np->mii_if.phy_id = 0; np->mii_if.phy_id <= 31;
980 if (e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR) != 0xffff) 1104 np->mii_if.phy_id++) {
1105 if (e100_get_mdio_reg(dev,
1106 np->mii_if.phy_id, MII_BMSR) != 0xffff)
981 break; 1107 break;
982 } 1108 }
983 if (mdio_phy_addr == 32) 1109 if (np->mii_if.phy_id == 32) {
984 return -ENODEV; 1110 ret = -ENODEV;
1111 goto out;
1112 }
985 1113
986 /* Get manufacturer */ 1114 /* Get manufacturer */
987 phyid_high = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID1); 1115 phyid_high = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID1);
988 phyid_low = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID2); 1116 phyid_low = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_PHYSID2);
989 oui = (phyid_high << 6) | (phyid_low >> 10); 1117 oui = (phyid_high << 6) | (phyid_low >> 10);
990 1118
991 for (ops = &transceivers[0]; ops->oui; ops++) { 1119 for (ops = &transceivers[0]; ops->oui; ops++) {
@@ -993,8 +1121,10 @@ e100_probe_transceiver(struct net_device* dev)
993 break; 1121 break;
994 } 1122 }
995 transceiver = ops; 1123 transceiver = ops;
996 1124out:
997 return 0; 1125 spin_unlock(&np->transceiver_lock);
1126#endif
1127 return ret;
998} 1128}
999 1129
1000static int 1130static int
@@ -1088,13 +1218,14 @@ e100_receive_mdio_bit()
1088static void 1218static void
1089e100_reset_transceiver(struct net_device* dev) 1219e100_reset_transceiver(struct net_device* dev)
1090{ 1220{
1221 struct net_local *np = netdev_priv(dev);
1091 unsigned short cmd; 1222 unsigned short cmd;
1092 unsigned short data; 1223 unsigned short data;
1093 int bitCounter; 1224 int bitCounter;
1094 1225
1095 data = e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMCR); 1226 data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR);
1096 1227
1097 cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) | (MII_BMCR << 2); 1228 cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (np->mii_if.phy_id << 7) | (MII_BMCR << 2);
1098 1229
1099 e100_send_mdio_cmd(cmd, 1); 1230 e100_send_mdio_cmd(cmd, 1);
1100 1231
@@ -1112,7 +1243,7 @@ e100_reset_transceiver(struct net_device* dev)
1112static void 1243static void
1113e100_tx_timeout(struct net_device *dev) 1244e100_tx_timeout(struct net_device *dev)
1114{ 1245{
1115 struct net_local *np = (struct net_local *)dev->priv; 1246 struct net_local *np = netdev_priv(dev);
1116 unsigned long flags; 1247 unsigned long flags;
1117 1248
1118 spin_lock_irqsave(&np->lock, flags); 1249 spin_lock_irqsave(&np->lock, flags);
@@ -1134,8 +1265,7 @@ e100_tx_timeout(struct net_device *dev)
1134 e100_reset_transceiver(dev); 1265 e100_reset_transceiver(dev);
1135 1266
1136 /* and get rid of the packets that never got an interrupt */ 1267 /* and get rid of the packets that never got an interrupt */
1137 while (myFirstTxDesc != myNextTxDesc) 1268 while (myFirstTxDesc != myNextTxDesc) {
1138 {
1139 dev_kfree_skb(myFirstTxDesc->skb); 1269 dev_kfree_skb(myFirstTxDesc->skb);
1140 myFirstTxDesc->skb = 0; 1270 myFirstTxDesc->skb = 0;
1141 myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); 1271 myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next);
@@ -1161,7 +1291,7 @@ e100_tx_timeout(struct net_device *dev)
1161static int 1291static int
1162e100_send_packet(struct sk_buff *skb, struct net_device *dev) 1292e100_send_packet(struct sk_buff *skb, struct net_device *dev)
1163{ 1293{
1164 struct net_local *np = (struct net_local *)dev->priv; 1294 struct net_local *np = netdev_priv(dev);
1165 unsigned char *buf = skb->data; 1295 unsigned char *buf = skb->data;
1166 unsigned long flags; 1296 unsigned long flags;
1167 1297
@@ -1174,7 +1304,7 @@ e100_send_packet(struct sk_buff *skb, struct net_device *dev)
1174 1304
1175 dev->trans_start = jiffies; 1305 dev->trans_start = jiffies;
1176 1306
1177 e100_hardware_send_packet(buf, skb->len); 1307 e100_hardware_send_packet(np, buf, skb->len);
1178 1308
1179 myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next); 1309 myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next);
1180 1310
@@ -1197,13 +1327,15 @@ static irqreturn_t
1197e100rxtx_interrupt(int irq, void *dev_id) 1327e100rxtx_interrupt(int irq, void *dev_id)
1198{ 1328{
1199 struct net_device *dev = (struct net_device *)dev_id; 1329 struct net_device *dev = (struct net_device *)dev_id;
1200 struct net_local *np = (struct net_local *)dev->priv; 1330 struct net_local *np = netdev_priv(dev);
1201 unsigned long irqbits = *R_IRQ_MASK2_RD; 1331 unsigned long irqbits;
1202 1332
1203 /* Disable RX/TX IRQs to avoid reentrancy */ 1333 /*
1204 *R_IRQ_MASK2_CLR = 1334 * Note that both rx and tx interrupts are blocked at this point,
1205 IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr) | 1335 * regardless of which got us here.
1206 IO_STATE(R_IRQ_MASK2_CLR, dma1_eop, clr); 1336 */
1337
1338 irqbits = *R_IRQ_MASK2_RD;
1207 1339
1208 /* Handle received packets */ 1340 /* Handle received packets */
1209 if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) { 1341 if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) {
@@ -1219,7 +1351,7 @@ e100rxtx_interrupt(int irq, void *dev_id)
1219 * allocate a new buffer to put a packet in. 1351 * allocate a new buffer to put a packet in.
1220 */ 1352 */
1221 e100_rx(dev); 1353 e100_rx(dev);
1222 ((struct net_local *)dev->priv)->stats.rx_packets++; 1354 np->stats.rx_packets++;
1223 /* restart/continue on the channel, for safety */ 1355 /* restart/continue on the channel, for safety */
1224 *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, restart); 1356 *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, restart);
1225 /* clear dma channel 1 eop/descr irq bits */ 1357 /* clear dma channel 1 eop/descr irq bits */
@@ -1233,9 +1365,8 @@ e100rxtx_interrupt(int irq, void *dev_id)
1233 } 1365 }
1234 1366
1235 /* Report any packets that have been sent */ 1367 /* Report any packets that have been sent */
1236 while (myFirstTxDesc != phys_to_virt(*R_DMA_CH0_FIRST) && 1368 while (virt_to_phys(myFirstTxDesc) != *R_DMA_CH0_FIRST &&
1237 myFirstTxDesc != myNextTxDesc) 1369 (netif_queue_stopped(dev) || myFirstTxDesc != myNextTxDesc)) {
1238 {
1239 np->stats.tx_bytes += myFirstTxDesc->skb->len; 1370 np->stats.tx_bytes += myFirstTxDesc->skb->len;
1240 np->stats.tx_packets++; 1371 np->stats.tx_packets++;
1241 1372
@@ -1244,19 +1375,15 @@ e100rxtx_interrupt(int irq, void *dev_id)
1244 dev_kfree_skb_irq(myFirstTxDesc->skb); 1375 dev_kfree_skb_irq(myFirstTxDesc->skb);
1245 myFirstTxDesc->skb = 0; 1376 myFirstTxDesc->skb = 0;
1246 myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next); 1377 myFirstTxDesc = phys_to_virt(myFirstTxDesc->descr.next);
1378 /* Wake up queue. */
1379 netif_wake_queue(dev);
1247 } 1380 }
1248 1381
1249 if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) { 1382 if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) {
1250 /* acknowledge the eop interrupt and wake up queue */ 1383 /* acknowledge the eop interrupt. */
1251 *R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do); 1384 *R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do);
1252 netif_wake_queue(dev);
1253 } 1385 }
1254 1386
1255 /* Enable RX/TX IRQs again */
1256 *R_IRQ_MASK2_SET =
1257 IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) |
1258 IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set);
1259
1260 return IRQ_HANDLED; 1387 return IRQ_HANDLED;
1261} 1388}
1262 1389
@@ -1264,7 +1391,7 @@ static irqreturn_t
1264e100nw_interrupt(int irq, void *dev_id) 1391e100nw_interrupt(int irq, void *dev_id)
1265{ 1392{
1266 struct net_device *dev = (struct net_device *)dev_id; 1393 struct net_device *dev = (struct net_device *)dev_id;
1267 struct net_local *np = (struct net_local *)dev->priv; 1394 struct net_local *np = netdev_priv(dev);
1268 unsigned long irqbits = *R_IRQ_MASK0_RD; 1395 unsigned long irqbits = *R_IRQ_MASK0_RD;
1269 1396
1270 /* check for underrun irq */ 1397 /* check for underrun irq */
@@ -1286,7 +1413,6 @@ e100nw_interrupt(int irq, void *dev_id)
1286 SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr); 1413 SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
1287 *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow; 1414 *R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
1288 SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop); 1415 SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop);
1289 *R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr);
1290 np->stats.tx_errors++; 1416 np->stats.tx_errors++;
1291 D(printk("ethernet excessive collisions!\n")); 1417 D(printk("ethernet excessive collisions!\n"));
1292 } 1418 }
@@ -1299,12 +1425,13 @@ e100_rx(struct net_device *dev)
1299{ 1425{
1300 struct sk_buff *skb; 1426 struct sk_buff *skb;
1301 int length = 0; 1427 int length = 0;
1302 struct net_local *np = (struct net_local *)dev->priv; 1428 struct net_local *np = netdev_priv(dev);
1303 unsigned char *skb_data_ptr; 1429 unsigned char *skb_data_ptr;
1304#ifdef ETHDEBUG 1430#ifdef ETHDEBUG
1305 int i; 1431 int i;
1306#endif 1432#endif
1307 1433 etrax_eth_descr *prevRxDesc; /* The descriptor right before myNextRxDesc */
1434 spin_lock(&np->led_lock);
1308 if (!led_active && time_after(jiffies, led_next_time)) { 1435 if (!led_active && time_after(jiffies, led_next_time)) {
1309 /* light the network leds depending on the current speed. */ 1436 /* light the network leds depending on the current speed. */
1310 e100_set_network_leds(NETWORK_ACTIVITY); 1437 e100_set_network_leds(NETWORK_ACTIVITY);
@@ -1314,9 +1441,10 @@ e100_rx(struct net_device *dev)
1314 led_active = 1; 1441 led_active = 1;
1315 mod_timer(&clear_led_timer, jiffies + HZ/10); 1442 mod_timer(&clear_led_timer, jiffies + HZ/10);
1316 } 1443 }
1444 spin_unlock(&np->led_lock);
1317 1445
1318 length = myNextRxDesc->descr.hw_len - 4; 1446 length = myNextRxDesc->descr.hw_len - 4;
1319 ((struct net_local *)dev->priv)->stats.rx_bytes += length; 1447 np->stats.rx_bytes += length;
1320 1448
1321#ifdef ETHDEBUG 1449#ifdef ETHDEBUG
1322 printk("Got a packet of length %d:\n", length); 1450 printk("Got a packet of length %d:\n", length);
@@ -1336,7 +1464,7 @@ e100_rx(struct net_device *dev)
1336 if (!skb) { 1464 if (!skb) {
1337 np->stats.rx_errors++; 1465 np->stats.rx_errors++;
1338 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); 1466 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
1339 return; 1467 goto update_nextrxdesc;
1340 } 1468 }
1341 1469
1342 skb_put(skb, length - ETHER_HEAD_LEN); /* allocate room for the packet body */ 1470 skb_put(skb, length - ETHER_HEAD_LEN); /* allocate room for the packet body */
@@ -1354,15 +1482,15 @@ e100_rx(struct net_device *dev)
1354 else { 1482 else {
1355 /* Large packet, send directly to upper layers and allocate new 1483 /* Large packet, send directly to upper layers and allocate new
1356 * memory (aligned to cache line boundary to avoid bug). 1484 * memory (aligned to cache line boundary to avoid bug).
1357 * Before sending the skb to upper layers we must make sure that 1485 * Before sending the skb to upper layers we must make sure
1358 * skb->data points to the aligned start of the packet. 1486 * that skb->data points to the aligned start of the packet.
1359 */ 1487 */
1360 int align; 1488 int align;
1361 struct sk_buff *new_skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES); 1489 struct sk_buff *new_skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES);
1362 if (!new_skb) { 1490 if (!new_skb) {
1363 np->stats.rx_errors++; 1491 np->stats.rx_errors++;
1364 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); 1492 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
1365 return; 1493 goto update_nextrxdesc;
1366 } 1494 }
1367 skb = myNextRxDesc->skb; 1495 skb = myNextRxDesc->skb;
1368 align = (int)phys_to_virt(myNextRxDesc->descr.buf) - (int)skb->data; 1496 align = (int)phys_to_virt(myNextRxDesc->descr.buf) - (int)skb->data;
@@ -1377,9 +1505,10 @@ e100_rx(struct net_device *dev)
1377 /* Send the packet to the upper layers */ 1505 /* Send the packet to the upper layers */
1378 netif_rx(skb); 1506 netif_rx(skb);
1379 1507
1508 update_nextrxdesc:
1380 /* Prepare for next packet */ 1509 /* Prepare for next packet */
1381 myNextRxDesc->descr.status = 0; 1510 myNextRxDesc->descr.status = 0;
1382 myPrevRxDesc = myNextRxDesc; 1511 prevRxDesc = myNextRxDesc;
1383 myNextRxDesc = phys_to_virt(myNextRxDesc->descr.next); 1512 myNextRxDesc = phys_to_virt(myNextRxDesc->descr.next);
1384 1513
1385 rx_queue_len++; 1514 rx_queue_len++;
@@ -1387,9 +1516,9 @@ e100_rx(struct net_device *dev)
1387 /* Check if descriptors should be returned */ 1516 /* Check if descriptors should be returned */
1388 if (rx_queue_len == RX_QUEUE_THRESHOLD) { 1517 if (rx_queue_len == RX_QUEUE_THRESHOLD) {
1389 flush_etrax_cache(); 1518 flush_etrax_cache();
1390 myPrevRxDesc->descr.ctrl |= d_eol; 1519 prevRxDesc->descr.ctrl |= d_eol;
1391 myLastRxDesc->descr.ctrl &= ~d_eol; 1520 myLastRxDesc->descr.ctrl &= ~d_eol;
1392 myLastRxDesc = myPrevRxDesc; 1521 myLastRxDesc = prevRxDesc;
1393 rx_queue_len = 0; 1522 rx_queue_len = 0;
1394 } 1523 }
1395} 1524}
@@ -1398,7 +1527,7 @@ e100_rx(struct net_device *dev)
1398static int 1527static int
1399e100_close(struct net_device *dev) 1528e100_close(struct net_device *dev)
1400{ 1529{
1401 struct net_local *np = (struct net_local *)dev->priv; 1530 struct net_local *np = netdev_priv(dev);
1402 1531
1403 printk(KERN_INFO "Closing %s.\n", dev->name); 1532 printk(KERN_INFO "Closing %s.\n", dev->name);
1404 1533
@@ -1426,6 +1555,9 @@ e100_close(struct net_device *dev)
1426 free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev); 1555 free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev);
1427 free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev); 1556 free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev);
1428 1557
1558 cris_free_dma(NETWORK_TX_DMA_NBR, cardname);
1559 cris_free_dma(NETWORK_RX_DMA_NBR, cardname);
1560
1429 /* Update the statistics here. */ 1561 /* Update the statistics here. */
1430 1562
1431 update_rx_stats(&np->stats); 1563 update_rx_stats(&np->stats);
@@ -1443,18 +1575,11 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1443{ 1575{
1444 struct mii_ioctl_data *data = if_mii(ifr); 1576 struct mii_ioctl_data *data = if_mii(ifr);
1445 struct net_local *np = netdev_priv(dev); 1577 struct net_local *np = netdev_priv(dev);
1578 int rc = 0;
1579 int old_autoneg;
1446 1580
1447 spin_lock(&np->lock); /* Preempt protection */ 1581 spin_lock(&np->lock); /* Preempt protection */
1448 switch (cmd) { 1582 switch (cmd) {
1449 case SIOCGMIIPHY: /* Get PHY address */
1450 data->phy_id = mdio_phy_addr;
1451 break;
1452 case SIOCGMIIREG: /* Read MII register */
1453 data->val_out = e100_get_mdio_reg(dev, mdio_phy_addr, data->reg_num);
1454 break;
1455 case SIOCSMIIREG: /* Write MII register */
1456 e100_set_mdio_reg(dev, mdio_phy_addr, data->reg_num, data->val_in);
1457 break;
1458 /* The ioctls below should be considered obsolete but are */ 1583 /* The ioctls below should be considered obsolete but are */
1459 /* still present for compatability with old scripts/apps */ 1584 /* still present for compatability with old scripts/apps */
1460 case SET_ETH_SPEED_10: /* 10 Mbps */ 1585 case SET_ETH_SPEED_10: /* 10 Mbps */
@@ -1463,60 +1588,47 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1463 case SET_ETH_SPEED_100: /* 100 Mbps */ 1588 case SET_ETH_SPEED_100: /* 100 Mbps */
1464 e100_set_speed(dev, 100); 1589 e100_set_speed(dev, 100);
1465 break; 1590 break;
1466 case SET_ETH_SPEED_AUTO: /* Auto negotiate speed */ 1591 case SET_ETH_SPEED_AUTO: /* Auto-negotiate speed */
1467 e100_set_speed(dev, 0); 1592 e100_set_speed(dev, 0);
1468 break; 1593 break;
1469 case SET_ETH_DUPLEX_HALF: /* Half duplex. */ 1594 case SET_ETH_DUPLEX_HALF: /* Half duplex */
1470 e100_set_duplex(dev, half); 1595 e100_set_duplex(dev, half);
1471 break; 1596 break;
1472 case SET_ETH_DUPLEX_FULL: /* Full duplex. */ 1597 case SET_ETH_DUPLEX_FULL: /* Full duplex */
1473 e100_set_duplex(dev, full); 1598 e100_set_duplex(dev, full);
1474 break; 1599 break;
1475 case SET_ETH_DUPLEX_AUTO: /* Autonegotiate duplex*/ 1600 case SET_ETH_DUPLEX_AUTO: /* Auto-negotiate duplex */
1476 e100_set_duplex(dev, autoneg); 1601 e100_set_duplex(dev, autoneg);
1477 break; 1602 break;
1603 case SET_ETH_AUTONEG:
1604 old_autoneg = autoneg_normal;
1605 autoneg_normal = *(int*)data;
1606 if (autoneg_normal != old_autoneg)
1607 e100_negotiate(dev);
1608 break;
1478 default: 1609 default:
1479 return -EINVAL; 1610 rc = generic_mii_ioctl(&np->mii_if, if_mii(ifr),
1611 cmd, NULL);
1612 break;
1480 } 1613 }
1481 spin_unlock(&np->lock); 1614 spin_unlock(&np->lock);
1482 return 0; 1615 return rc;
1483} 1616}
1484 1617
1485static int e100_set_settings(struct net_device *dev, 1618static int e100_get_settings(struct net_device *dev,
1486 struct ethtool_cmd *ecmd) 1619 struct ethtool_cmd *cmd)
1487{ 1620{
1488 ecmd->supported = SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII | 1621 struct net_local *np = netdev_priv(dev);
1489 SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | 1622 int err;
1490 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full;
1491 ecmd->port = PORT_TP;
1492 ecmd->transceiver = XCVR_EXTERNAL;
1493 ecmd->phy_address = mdio_phy_addr;
1494 ecmd->speed = current_speed;
1495 ecmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
1496 ecmd->advertising = ADVERTISED_TP;
1497 1623
1498 if (current_duplex == autoneg && current_speed_selection == 0) 1624 spin_lock_irq(&np->lock);
1499 ecmd->advertising |= ADVERTISED_Autoneg; 1625 err = mii_ethtool_gset(&np->mii_if, cmd);
1500 else { 1626 spin_unlock_irq(&np->lock);
1501 ecmd->advertising |=
1502 ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
1503 ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full;
1504 if (current_speed_selection == 10)
1505 ecmd->advertising &= ~(ADVERTISED_100baseT_Half |
1506 ADVERTISED_100baseT_Full);
1507 else if (current_speed_selection == 100)
1508 ecmd->advertising &= ~(ADVERTISED_10baseT_Half |
1509 ADVERTISED_10baseT_Full);
1510 if (current_duplex == half)
1511 ecmd->advertising &= ~(ADVERTISED_10baseT_Full |
1512 ADVERTISED_100baseT_Full);
1513 else if (current_duplex == full)
1514 ecmd->advertising &= ~(ADVERTISED_10baseT_Half |
1515 ADVERTISED_100baseT_Half);
1516 }
1517 1627
1518 ecmd->autoneg = AUTONEG_ENABLE; 1628 /* The PHY may support 1000baseT, but the Etrax100 does not. */
1519 return 0; 1629 cmd->supported &= ~(SUPPORTED_1000baseT_Half
1630 | SUPPORTED_1000baseT_Full);
1631 return err;
1520} 1632}
1521 1633
1522static int e100_set_settings(struct net_device *dev, 1634static int e100_set_settings(struct net_device *dev,
@@ -1560,7 +1672,8 @@ static const struct ethtool_ops e100_ethtool_ops = {
1560static int 1672static int
1561e100_set_config(struct net_device *dev, struct ifmap *map) 1673e100_set_config(struct net_device *dev, struct ifmap *map)
1562{ 1674{
1563 struct net_local *np = (struct net_local *)dev->priv; 1675 struct net_local *np = netdev_priv(dev);
1676
1564 spin_lock(&np->lock); /* Preempt protection */ 1677 spin_lock(&np->lock); /* Preempt protection */
1565 1678
1566 switch(map->port) { 1679 switch(map->port) {
@@ -1612,7 +1725,6 @@ update_tx_stats(struct net_device_stats *es)
1612 es->collisions += 1725 es->collisions +=
1613 IO_EXTRACT(R_TR_COUNTERS, single_col, r) + 1726 IO_EXTRACT(R_TR_COUNTERS, single_col, r) +
1614 IO_EXTRACT(R_TR_COUNTERS, multiple_col, r); 1727 IO_EXTRACT(R_TR_COUNTERS, multiple_col, r);
1615 es->tx_errors += IO_EXTRACT(R_TR_COUNTERS, deferred, r);
1616} 1728}
1617 1729
1618/* 1730/*
@@ -1622,8 +1734,9 @@ update_tx_stats(struct net_device_stats *es)
1622static struct net_device_stats * 1734static struct net_device_stats *
1623e100_get_stats(struct net_device *dev) 1735e100_get_stats(struct net_device *dev)
1624{ 1736{
1625 struct net_local *lp = (struct net_local *)dev->priv; 1737 struct net_local *lp = netdev_priv(dev);
1626 unsigned long flags; 1738 unsigned long flags;
1739
1627 spin_lock_irqsave(&lp->lock, flags); 1740 spin_lock_irqsave(&lp->lock, flags);
1628 1741
1629 update_rx_stats(&lp->stats); 1742 update_rx_stats(&lp->stats);
@@ -1643,13 +1756,13 @@ e100_get_stats(struct net_device *dev)
1643static void 1756static void
1644set_multicast_list(struct net_device *dev) 1757set_multicast_list(struct net_device *dev)
1645{ 1758{
1646 struct net_local *lp = (struct net_local *)dev->priv; 1759 struct net_local *lp = netdev_priv(dev);
1647 int num_addr = dev->mc_count; 1760 int num_addr = dev->mc_count;
1648 unsigned long int lo_bits; 1761 unsigned long int lo_bits;
1649 unsigned long int hi_bits; 1762 unsigned long int hi_bits;
1763
1650 spin_lock(&lp->lock); 1764 spin_lock(&lp->lock);
1651 if (dev->flags & IFF_PROMISC) 1765 if (dev->flags & IFF_PROMISC) {
1652 {
1653 /* promiscuous mode */ 1766 /* promiscuous mode */
1654 lo_bits = 0xfffffffful; 1767 lo_bits = 0xfffffffful;
1655 hi_bits = 0xfffffffful; 1768 hi_bits = 0xfffffffful;
@@ -1679,9 +1792,10 @@ set_multicast_list(struct net_device *dev)
1679 struct dev_mc_list *dmi = dev->mc_list; 1792 struct dev_mc_list *dmi = dev->mc_list;
1680 int i; 1793 int i;
1681 char *baddr; 1794 char *baddr;
1795
1682 lo_bits = 0x00000000ul; 1796 lo_bits = 0x00000000ul;
1683 hi_bits = 0x00000000ul; 1797 hi_bits = 0x00000000ul;
1684 for (i=0; i<num_addr; i++) { 1798 for (i = 0; i < num_addr; i++) {
1685 /* Calculate the hash index for the GA registers */ 1799 /* Calculate the hash index for the GA registers */
1686 1800
1687 hash_ix = 0; 1801 hash_ix = 0;
@@ -1708,8 +1822,7 @@ set_multicast_list(struct net_device *dev)
1708 1822
1709 if (hash_ix >= 32) { 1823 if (hash_ix >= 32) {
1710 hi_bits |= (1 << (hash_ix-32)); 1824 hi_bits |= (1 << (hash_ix-32));
1711 } 1825 } else {
1712 else {
1713 lo_bits |= (1 << hash_ix); 1826 lo_bits |= (1 << hash_ix);
1714 } 1827 }
1715 dmi = dmi->next; 1828 dmi = dmi->next;
@@ -1724,10 +1837,11 @@ set_multicast_list(struct net_device *dev)
1724} 1837}
1725 1838
1726void 1839void
1727e100_hardware_send_packet(char *buf, int length) 1840e100_hardware_send_packet(struct net_local *np, char *buf, int length)
1728{ 1841{
1729 D(printk("e100 send pack, buf 0x%x len %d\n", buf, length)); 1842 D(printk("e100 send pack, buf 0x%x len %d\n", buf, length));
1730 1843
1844 spin_lock(&np->led_lock);
1731 if (!led_active && time_after(jiffies, led_next_time)) { 1845 if (!led_active && time_after(jiffies, led_next_time)) {
1732 /* light the network leds depending on the current speed. */ 1846 /* light the network leds depending on the current speed. */
1733 e100_set_network_leds(NETWORK_ACTIVITY); 1847 e100_set_network_leds(NETWORK_ACTIVITY);
@@ -1737,6 +1851,7 @@ e100_hardware_send_packet(char *buf, int length)
1737 led_active = 1; 1851 led_active = 1;
1738 mod_timer(&clear_led_timer, jiffies + HZ/10); 1852 mod_timer(&clear_led_timer, jiffies + HZ/10);
1739 } 1853 }
1854 spin_unlock(&np->led_lock);
1740 1855
1741 /* configure the tx dma descriptor */ 1856 /* configure the tx dma descriptor */
1742 myNextTxDesc->descr.sw_len = length; 1857 myNextTxDesc->descr.sw_len = length;
@@ -1754,6 +1869,11 @@ e100_hardware_send_packet(char *buf, int length)
1754static void 1869static void
1755e100_clear_network_leds(unsigned long dummy) 1870e100_clear_network_leds(unsigned long dummy)
1756{ 1871{
1872 struct net_device *dev = (struct net_device *)dummy;
1873 struct net_local *np = netdev_priv(dev);
1874
1875 spin_lock(&np->led_lock);
1876
1757 if (led_active && time_after(jiffies, led_next_time)) { 1877 if (led_active && time_after(jiffies, led_next_time)) {
1758 e100_set_network_leds(NO_NETWORK_ACTIVITY); 1878 e100_set_network_leds(NO_NETWORK_ACTIVITY);
1759 1879
@@ -1761,6 +1881,8 @@ e100_clear_network_leds(unsigned long dummy)
1761 led_next_time = jiffies + NET_FLASH_PAUSE; 1881 led_next_time = jiffies + NET_FLASH_PAUSE;
1762 led_active = 0; 1882 led_active = 0;
1763 } 1883 }
1884
1885 spin_unlock(&np->led_lock);
1764} 1886}
1765 1887
1766static void 1888static void
@@ -1781,19 +1903,25 @@ e100_set_network_leds(int active)
1781#else 1903#else
1782 LED_NETWORK_SET(LED_OFF); 1904 LED_NETWORK_SET(LED_OFF);
1783#endif 1905#endif
1784 } 1906 } else if (light_leds) {
1785 else if (light_leds) {
1786 if (current_speed == 10) { 1907 if (current_speed == 10) {
1787 LED_NETWORK_SET(LED_ORANGE); 1908 LED_NETWORK_SET(LED_ORANGE);
1788 } else { 1909 } else {
1789 LED_NETWORK_SET(LED_GREEN); 1910 LED_NETWORK_SET(LED_GREEN);
1790 } 1911 }
1791 } 1912 } else {
1792 else {
1793 LED_NETWORK_SET(LED_OFF); 1913 LED_NETWORK_SET(LED_OFF);
1794 } 1914 }
1795} 1915}
1796 1916
1917#ifdef CONFIG_NET_POLL_CONTROLLER
1918static void
1919e100_netpoll(struct net_device* netdev)
1920{
1921 e100rxtx_interrupt(NETWORK_DMA_TX_IRQ_NBR, netdev, NULL);
1922}
1923#endif
1924
1797static int 1925static int
1798etrax_init_module(void) 1926etrax_init_module(void)
1799{ 1927{
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..cf39473ef90a 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);
@@ -4807,6 +4804,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4807 spin_unlock_irqrestore(&adapter->stats_lock, flags); 4804 spin_unlock_irqrestore(&adapter->stats_lock, flags);
4808 return -EIO; 4805 return -EIO;
4809 } 4806 }
4807 spin_unlock_irqrestore(&adapter->stats_lock, flags);
4810 if (adapter->hw.media_type == e1000_media_type_copper) { 4808 if (adapter->hw.media_type == e1000_media_type_copper) {
4811 switch (data->reg_num) { 4809 switch (data->reg_num) {
4812 case PHY_CTRL: 4810 case PHY_CTRL:
@@ -4827,12 +4825,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4827 DUPLEX_HALF; 4825 DUPLEX_HALF;
4828 retval = e1000_set_spd_dplx(adapter, 4826 retval = e1000_set_spd_dplx(adapter,
4829 spddplx); 4827 spddplx);
4830 if (retval) { 4828 if (retval)
4831 spin_unlock_irqrestore(
4832 &adapter->stats_lock,
4833 flags);
4834 return retval; 4829 return retval;
4835 }
4836 } 4830 }
4837 if (netif_running(adapter->netdev)) 4831 if (netif_running(adapter->netdev))
4838 e1000_reinit_locked(adapter); 4832 e1000_reinit_locked(adapter);
@@ -4841,11 +4835,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4841 break; 4835 break;
4842 case M88E1000_PHY_SPEC_CTRL: 4836 case M88E1000_PHY_SPEC_CTRL:
4843 case M88E1000_EXT_PHY_SPEC_CTRL: 4837 case M88E1000_EXT_PHY_SPEC_CTRL:
4844 if (e1000_phy_reset(&adapter->hw)) { 4838 if (e1000_phy_reset(&adapter->hw))
4845 spin_unlock_irqrestore(
4846 &adapter->stats_lock, flags);
4847 return -EIO; 4839 return -EIO;
4848 }
4849 break; 4840 break;
4850 } 4841 }
4851 } else { 4842 } else {
@@ -4860,7 +4851,6 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
4860 break; 4851 break;
4861 } 4852 }
4862 } 4853 }
4863 spin_unlock_irqrestore(&adapter->stats_lock, flags);
4864 break; 4854 break;
4865 default: 4855 default:
4866 return -EOPNOTSUPP; 4856 return -EOPNOTSUPP;
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 4b4b74e47a67..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_0079" 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 0a7e78925540..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"
@@ -3295,6 +3298,20 @@ static int __devexit ehea_remove(struct of_device *dev)
3295 return 0; 3298 return 0;
3296} 3299}
3297 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
3298static int check_module_parm(void) 3315static int check_module_parm(void)
3299{ 3316{
3300 int ret = 0; 3317 int ret = 0;
@@ -3351,6 +3368,8 @@ int __init ehea_module_init(void)
3351 if (ret) 3368 if (ret)
3352 goto out; 3369 goto out;
3353 3370
3371 register_reboot_notifier(&ehea_reboot_nb);
3372
3354 ret = ibmebus_register_driver(&ehea_driver); 3373 ret = ibmebus_register_driver(&ehea_driver);
3355 if (ret) { 3374 if (ret) {
3356 ehea_error("failed registering eHEA device driver on ebus"); 3375 ehea_error("failed registering eHEA device driver on ebus");
@@ -3362,6 +3381,7 @@ int __init ehea_module_init(void)
3362 if (ret) { 3381 if (ret) {
3363 ehea_error("failed to register capabilities attribute, ret=%d", 3382 ehea_error("failed to register capabilities attribute, ret=%d",
3364 ret); 3383 ret);
3384 unregister_reboot_notifier(&ehea_reboot_nb);
3365 ibmebus_unregister_driver(&ehea_driver); 3385 ibmebus_unregister_driver(&ehea_driver);
3366 goto out; 3386 goto out;
3367 } 3387 }
@@ -3375,6 +3395,7 @@ static void __exit ehea_module_exit(void)
3375 flush_scheduled_work(); 3395 flush_scheduled_work();
3376 driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); 3396 driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
3377 ibmebus_unregister_driver(&ehea_driver); 3397 ibmebus_unregister_driver(&ehea_driver);
3398 unregister_reboot_notifier(&ehea_reboot_nb);
3378 ehea_destroy_busmap(); 3399 ehea_destroy_busmap();
3379} 3400}
3380 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/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig
index 2765e49e07df..562ea68ed99b 100644
--- a/drivers/net/fs_enet/Kconfig
+++ b/drivers/net/fs_enet/Kconfig
@@ -2,6 +2,7 @@ config FS_ENET
2 tristate "Freescale Ethernet Driver" 2 tristate "Freescale Ethernet Driver"
3 depends on CPM1 || CPM2 3 depends on CPM1 || CPM2
4 select MII 4 select MII
5 select PHYLIB
5 6
6config FS_ENET_HAS_SCC 7config FS_ENET_HAS_SCC
7 bool "Chip has an SCC usable for ethernet" 8 bool "Chip has an SCC usable for ethernet"
@@ -11,11 +12,19 @@ config FS_ENET_HAS_SCC
11config FS_ENET_HAS_FCC 12config FS_ENET_HAS_FCC
12 bool "Chip has an FCC usable for ethernet" 13 bool "Chip has an FCC usable for ethernet"
13 depends on FS_ENET && CPM2 14 depends on FS_ENET && CPM2
14 select MDIO_BITBANG
15 default y 15 default y
16 16
17config FS_ENET_HAS_FEC 17config FS_ENET_HAS_FEC
18 bool "Chip has an FEC usable for ethernet" 18 bool "Chip has an FEC usable for ethernet"
19 depends on FS_ENET && CPM1 19 depends on FS_ENET && CPM1
20 select FS_ENET_MDIO_FEC
20 default y 21 default y
21 22
23config FS_ENET_MDIO_FEC
24 tristate "MDIO driver for FEC"
25 depends on FS_ENET && CPM1
26
27config FS_ENET_MDIO_FCC
28 tristate "MDIO driver for FCC"
29 depends on FS_ENET && CPM2
30 select MDIO_BITBANG
diff --git a/drivers/net/fs_enet/Makefile b/drivers/net/fs_enet/Makefile
index 02d4dc18ba69..1ffbe0756a0c 100644
--- a/drivers/net/fs_enet/Makefile
+++ b/drivers/net/fs_enet/Makefile
@@ -4,7 +4,16 @@
4 4
5obj-$(CONFIG_FS_ENET) += fs_enet.o 5obj-$(CONFIG_FS_ENET) += fs_enet.o
6 6
7obj-$(CONFIG_8xx) += mac-fec.o mac-scc.o mii-fec.o 7fs_enet-$(CONFIG_FS_ENET_HAS_SCC) += mac-scc.o
8obj-$(CONFIG_CPM2) += mac-fcc.o mii-bitbang.o 8fs_enet-$(CONFIG_FS_ENET_HAS_FEC) += mac-fec.o
9fs_enet-$(CONFIG_FS_ENET_HAS_FCC) += mac-fcc.o
9 10
10fs_enet-objs := fs_enet-main.o 11ifeq ($(CONFIG_PPC_CPM_NEW_BINDING),y)
12obj-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o
13obj-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o
14else
15fs_enet-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o
16fs_enet-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o
17endif
18
19fs_enet-objs := fs_enet-main.o $(fs_enet-m)
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index e0119f6a3319..580cb4ab2af1 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -762,26 +762,20 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
762 762
763 if (copy_from_user(&addr, 763 if (copy_from_user(&addr,
764 (void __user *) arg, AX25_ADDR_LEN)) { 764 (void __user *) arg, AX25_ADDR_LEN)) {
765 err = -EFAULT; 765 err = -EFAULT;
766 break; 766 break;
767 } 767 }
768 768
769 netif_tx_lock_bh(dev); 769 netif_tx_lock_bh(dev);
770 memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); 770 memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN);
771 netif_tx_unlock_bh(dev); 771 netif_tx_unlock_bh(dev);
772 772
773 err = 0; 773 err = 0;
774 break; 774 break;
775 } 775 }
776
777 /* Allow stty to read, but not set, the serial port */
778 case TCGETS:
779 case TCGETA:
780 err = n_tty_ioctl(tty, (struct file *) file, cmd, arg);
781 break;
782 776
783 default: 777 default:
784 err = -ENOIOCTLCMD; 778 err = tty_mode_ioctl(tty, file, cmd, arg);
785 } 779 }
786 780
787 sp_put(sp); 781 sp_put(sp);
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/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 2c6f7be36e8a..fc753d7f674e 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -434,11 +434,6 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c
434 IRDA_ASSERT(dev != NULL, return -1;); 434 IRDA_ASSERT(dev != NULL, return -1;);
435 435
436 switch (cmd) { 436 switch (cmd) {
437 case TCGETS:
438 case TCGETA:
439 err = n_tty_ioctl(tty, file, cmd, arg);
440 break;
441
442 case IRTTY_IOCTDONGLE: 437 case IRTTY_IOCTDONGLE:
443 /* this call blocks for completion */ 438 /* this call blocks for completion */
444 err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg); 439 err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg);
@@ -454,7 +449,7 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c
454 err = -EFAULT; 449 err = -EFAULT;
455 break; 450 break;
456 default: 451 default:
457 err = -ENOIOCTLCMD; 452 err = tty_mode_ioctl(tty, file, cmd, arg);
458 break; 453 break;
459 } 454 }
460 return err; 455 return err;
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 45f30a2974b8..662b8d16803c 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 loopback_net_ops = { 287static struct pernet_operations __net_initdata 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/meth.c b/drivers/net/meth.c
index e25dbab67363..0c89b028a80c 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -33,7 +33,6 @@
33#include <asm/ip32/ip32_ints.h> 33#include <asm/ip32/ip32_ints.h>
34 34
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/scatterlist.h>
37 36
38#include "meth.h" 37#include "meth.h"
39 38
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c
index f8d63d39f592..b226e019bc8b 100644
--- a/drivers/net/mlx4/alloc.c
+++ b/drivers/net/mlx4/alloc.c
@@ -171,9 +171,10 @@ void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf)
171 buf->u.direct.map); 171 buf->u.direct.map);
172 else { 172 else {
173 for (i = 0; i < buf->nbufs; ++i) 173 for (i = 0; i < buf->nbufs; ++i)
174 dma_free_coherent(&dev->pdev->dev, PAGE_SIZE, 174 if (buf->u.page_list[i].buf)
175 buf->u.page_list[i].buf, 175 dma_free_coherent(&dev->pdev->dev, PAGE_SIZE,
176 buf->u.page_list[i].map); 176 buf->u.page_list[i].buf,
177 buf->u.page_list[i].map);
177 kfree(buf->u.page_list); 178 kfree(buf->u.page_list);
178 } 179 }
179} 180}
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c
index cc4b1be18219..42b47639c81c 100644
--- a/drivers/net/mlx4/qp.c
+++ b/drivers/net/mlx4/qp.c
@@ -240,7 +240,7 @@ void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp)
240 mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn); 240 mlx4_table_put(dev, &qp_table->auxc_table, qp->qpn);
241 mlx4_table_put(dev, &qp_table->qp_table, qp->qpn); 241 mlx4_table_put(dev, &qp_table->qp_table, qp->qpn);
242 242
243 if (qp->qpn < dev->caps.sqp_start + 8) 243 if (qp->qpn >= dev->caps.sqp_start + 8)
244 mlx4_bitmap_free(&qp_table->bitmap, qp->qpn); 244 mlx4_bitmap_free(&qp_table->bitmap, qp->qpn);
245} 245}
246EXPORT_SYMBOL_GPL(mlx4_qp_free); 246EXPORT_SYMBOL_GPL(mlx4_qp_free);
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/myri_sbus.c b/drivers/net/myri_sbus.c
index 8d29319cc5cb..656a260fc956 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -134,7 +134,7 @@ static int myri_do_handshake(struct myri_eth *mp)
134 134
135 myri_disable_irq(mp->lregs, cregs); 135 myri_disable_irq(mp->lregs, cregs);
136 136
137 while (tick++ <= 25) { 137 while (tick++ < 25) {
138 u32 softstate; 138 u32 softstate;
139 139
140 /* Wake it up. */ 140 /* Wake it up. */
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c
index eb0aff787dfd..5267e031daa0 100644
--- a/drivers/net/netx-eth.c
+++ b/drivers/net/netx-eth.c
@@ -128,8 +128,8 @@ netx_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
128 FIFO_PTR_FRAMELEN(len)); 128 FIFO_PTR_FRAMELEN(len));
129 129
130 ndev->trans_start = jiffies; 130 ndev->trans_start = jiffies;
131 dev->stats.tx_packets++; 131 ndev->stats.tx_packets++;
132 dev->stats.tx_bytes += skb->len; 132 ndev->stats.tx_bytes += skb->len;
133 133
134 netif_stop_queue(ndev); 134 netif_stop_queue(ndev);
135 spin_unlock_irq(&priv->lock); 135 spin_unlock_irq(&priv->lock);
@@ -155,7 +155,7 @@ static void netx_eth_receive(struct net_device *ndev)
155 if (unlikely(skb == NULL)) { 155 if (unlikely(skb == NULL)) {
156 printk(KERN_NOTICE "%s: Low memory, packet dropped.\n", 156 printk(KERN_NOTICE "%s: Low memory, packet dropped.\n",
157 ndev->name); 157 ndev->name);
158 dev->stats.rx_dropped++; 158 ndev->stats.rx_dropped++;
159 return; 159 return;
160 } 160 }
161 161
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index ab4d309a858f..09b4fde8d924 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -580,6 +580,16 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
580 580
581 len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; 581 len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S;
582 582
583 pci_unmap_single(mac->dma_pdev, dma, len, PCI_DMA_FROMDEVICE);
584
585 if (macrx & XCT_MACRX_CRC) {
586 /* CRC error flagged */
587 mac->netdev->stats.rx_errors++;
588 mac->netdev->stats.rx_crc_errors++;
589 dev_kfree_skb_irq(skb);
590 goto next;
591 }
592
583 if (len < 256) { 593 if (len < 256) {
584 struct sk_buff *new_skb; 594 struct sk_buff *new_skb;
585 595
@@ -595,11 +605,10 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
595 } else 605 } else
596 info->skb = NULL; 606 info->skb = NULL;
597 607
598 pci_unmap_single(mac->dma_pdev, dma, len, PCI_DMA_FROMDEVICE);
599
600 info->dma = 0; 608 info->dma = 0;
601 609
602 skb_put(skb, len); 610 /* Don't include CRC */
611 skb_put(skb, len-4);
603 612
604 if (likely((macrx & XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK)) { 613 if (likely((macrx & XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK)) {
605 skb->ip_summed = CHECKSUM_UNNECESSARY; 614 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -614,6 +623,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
614 skb->protocol = eth_type_trans(skb, mac->netdev); 623 skb->protocol = eth_type_trans(skb, mac->netdev);
615 netif_receive_skb(skb); 624 netif_receive_skb(skb);
616 625
626next:
617 RX_RING(mac, n) = 0; 627 RX_RING(mac, n) = 0;
618 RX_RING(mac, n+1) = 0; 628 RX_RING(mac, n+1) = 0;
619 629
@@ -1126,7 +1136,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
1126 unsigned long flags; 1136 unsigned long flags;
1127 int i, nfrags; 1137 int i, nfrags;
1128 1138
1129 dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_SS | XCT_MACTX_CRC_PAD; 1139 dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_CRC_PAD;
1130 1140
1131 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1141 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1132 const unsigned char *nh = skb_network_header(skb); 1142 const unsigned char *nh = skb_network_header(skb);
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/phy/marvell.c b/drivers/net/phy/marvell.c
index d2ede5ff9fff..035fd41fb61f 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -265,7 +265,7 @@ static struct phy_driver marvell_drivers[] = {
265 .read_status = &genphy_read_status, 265 .read_status = &genphy_read_status,
266 .ack_interrupt = &marvell_ack_interrupt, 266 .ack_interrupt = &marvell_ack_interrupt,
267 .config_intr = &marvell_config_intr, 267 .config_intr = &marvell_config_intr,
268 .driver = {.owner = THIS_MODULE,}, 268 .driver = { .owner = THIS_MODULE },
269 }, 269 },
270 { 270 {
271 .phy_id = 0x01410c90, 271 .phy_id = 0x01410c90,
@@ -278,7 +278,7 @@ static struct phy_driver marvell_drivers[] = {
278 .read_status = &genphy_read_status, 278 .read_status = &genphy_read_status,
279 .ack_interrupt = &marvell_ack_interrupt, 279 .ack_interrupt = &marvell_ack_interrupt,
280 .config_intr = &marvell_config_intr, 280 .config_intr = &marvell_config_intr,
281 .driver = {.owner = THIS_MODULE,}, 281 .driver = { .owner = THIS_MODULE },
282 }, 282 },
283 { 283 {
284 .phy_id = 0x01410cc0, 284 .phy_id = 0x01410cc0,
@@ -291,7 +291,7 @@ static struct phy_driver marvell_drivers[] = {
291 .read_status = &genphy_read_status, 291 .read_status = &genphy_read_status,
292 .ack_interrupt = &marvell_ack_interrupt, 292 .ack_interrupt = &marvell_ack_interrupt,
293 .config_intr = &marvell_config_intr, 293 .config_intr = &marvell_config_intr,
294 .driver = {.owner = THIS_MODULE,}, 294 .driver = { .owner = THIS_MODULE },
295 }, 295 },
296 { 296 {
297 .phy_id = 0x01410cd0, 297 .phy_id = 0x01410cd0,
@@ -304,8 +304,21 @@ static struct phy_driver marvell_drivers[] = {
304 .read_status = &genphy_read_status, 304 .read_status = &genphy_read_status,
305 .ack_interrupt = &marvell_ack_interrupt, 305 .ack_interrupt = &marvell_ack_interrupt,
306 .config_intr = &marvell_config_intr, 306 .config_intr = &marvell_config_intr,
307 .driver = {.owner = THIS_MODULE,}, 307 .driver = { .owner = THIS_MODULE },
308 } 308 },
309 {
310 .phy_id = 0x01410e30,
311 .phy_id_mask = 0xfffffff0,
312 .name = "Marvell 88E1240",
313 .features = PHY_GBIT_FEATURES,
314 .flags = PHY_HAS_INTERRUPT,
315 .config_init = &m88e1111_config_init,
316 .config_aneg = &marvell_config_aneg,
317 .read_status = &genphy_read_status,
318 .ack_interrupt = &marvell_ack_interrupt,
319 .config_intr = &marvell_config_intr,
320 .driver = { .owner = THIS_MODULE },
321 },
309}; 322};
310 323
311static int __init marvell_init(void) 324static int __init marvell_init(void)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index c0461217b108..f6e484812a98 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -706,7 +706,7 @@ int phy_driver_register(struct phy_driver *new_driver)
706 return retval; 706 return retval;
707 } 707 }
708 708
709 pr_info("%s: Registered new driver\n", new_driver->name); 709 pr_debug("%s: Registered new driver\n", new_driver->name);
710 710
711 return 0; 711 return 0;
712} 712}
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index 5071fcd8a0bd..57c98669984d 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -663,7 +663,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
663 case PLIP_PK_DONE: 663 case PLIP_PK_DONE:
664 /* Inform the upper layer for the arrival of a packet. */ 664 /* Inform the upper layer for the arrival of a packet. */
665 rcv->skb->protocol=plip_type_trans(rcv->skb, dev); 665 rcv->skb->protocol=plip_type_trans(rcv->skb, dev);
666 netif_rx(rcv->skb); 666 netif_rx_ni(rcv->skb);
667 dev->last_rx = jiffies; 667 dev->last_rx = jiffies;
668 dev->stats.rx_bytes += rcv->length.h; 668 dev->stats.rx_bytes += rcv->length.h;
669 dev->stats.rx_packets++; 669 dev->stats.rx_packets++;
@@ -1269,7 +1269,7 @@ static void plip_attach (struct parport *port)
1269 1269
1270 nl = netdev_priv(dev); 1270 nl = netdev_priv(dev);
1271 nl->dev = dev; 1271 nl->dev = dev;
1272 nl->pardev = parport_register_device(port, name, plip_preempt, 1272 nl->pardev = parport_register_device(port, dev->name, plip_preempt,
1273 plip_wakeup, plip_interrupt, 1273 plip_wakeup, plip_interrupt,
1274 0, dev); 1274 0, dev);
1275 1275
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 27f5b904f48e..f023d5b67e6e 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -160,7 +160,7 @@ ppp_asynctty_open(struct tty_struct *tty)
160 160
161 err = -ENOMEM; 161 err = -ENOMEM;
162 ap = kzalloc(sizeof(*ap), GFP_KERNEL); 162 ap = kzalloc(sizeof(*ap), GFP_KERNEL);
163 if (ap == 0) 163 if (!ap)
164 goto out; 164 goto out;
165 165
166 /* initialize the asyncppp structure */ 166 /* initialize the asyncppp structure */
@@ -215,7 +215,7 @@ ppp_asynctty_close(struct tty_struct *tty)
215 ap = tty->disc_data; 215 ap = tty->disc_data;
216 tty->disc_data = NULL; 216 tty->disc_data = NULL;
217 write_unlock_irq(&disc_data_lock); 217 write_unlock_irq(&disc_data_lock);
218 if (ap == 0) 218 if (!ap)
219 return; 219 return;
220 220
221 /* 221 /*
@@ -230,10 +230,10 @@ ppp_asynctty_close(struct tty_struct *tty)
230 tasklet_kill(&ap->tsk); 230 tasklet_kill(&ap->tsk);
231 231
232 ppp_unregister_channel(&ap->chan); 232 ppp_unregister_channel(&ap->chan);
233 if (ap->rpkt != 0) 233 if (ap->rpkt)
234 kfree_skb(ap->rpkt); 234 kfree_skb(ap->rpkt);
235 skb_queue_purge(&ap->rqueue); 235 skb_queue_purge(&ap->rqueue);
236 if (ap->tpkt != 0) 236 if (ap->tpkt)
237 kfree_skb(ap->tpkt); 237 kfree_skb(ap->tpkt);
238 kfree(ap); 238 kfree(ap);
239} 239}
@@ -285,13 +285,13 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
285 int err, val; 285 int err, val;
286 int __user *p = (int __user *)arg; 286 int __user *p = (int __user *)arg;
287 287
288 if (ap == 0) 288 if (!ap)
289 return -ENXIO; 289 return -ENXIO;
290 err = -EFAULT; 290 err = -EFAULT;
291 switch (cmd) { 291 switch (cmd) {
292 case PPPIOCGCHAN: 292 case PPPIOCGCHAN:
293 err = -ENXIO; 293 err = -ENXIO;
294 if (ap == 0) 294 if (!ap)
295 break; 295 break;
296 err = -EFAULT; 296 err = -EFAULT;
297 if (put_user(ppp_channel_index(&ap->chan), p)) 297 if (put_user(ppp_channel_index(&ap->chan), p))
@@ -301,7 +301,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
301 301
302 case PPPIOCGUNIT: 302 case PPPIOCGUNIT:
303 err = -ENXIO; 303 err = -ENXIO;
304 if (ap == 0) 304 if (!ap)
305 break; 305 break;
306 err = -EFAULT; 306 err = -EFAULT;
307 if (put_user(ppp_unit_number(&ap->chan), p)) 307 if (put_user(ppp_unit_number(&ap->chan), p))
@@ -309,16 +309,11 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
309 err = 0; 309 err = 0;
310 break; 310 break;
311 311
312 case TCGETS:
313 case TCGETA:
314 err = n_tty_ioctl(tty, file, cmd, arg);
315 break;
316
317 case TCFLSH: 312 case TCFLSH:
318 /* flush our buffers and the serial port's buffer */ 313 /* flush our buffers and the serial port's buffer */
319 if (arg == TCIOFLUSH || arg == TCOFLUSH) 314 if (arg == TCIOFLUSH || arg == TCOFLUSH)
320 ppp_async_flush_output(ap); 315 ppp_async_flush_output(ap);
321 err = n_tty_ioctl(tty, file, cmd, arg); 316 err = tty_perform_flush(tty, arg);
322 break; 317 break;
323 318
324 case FIONREAD: 319 case FIONREAD:
@@ -329,7 +324,8 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
329 break; 324 break;
330 325
331 default: 326 default:
332 err = -ENOIOCTLCMD; 327 /* Try the various mode ioctls */
328 err = tty_mode_ioctl(tty, file, cmd, arg);
333 } 329 }
334 330
335 ap_put(ap); 331 ap_put(ap);
@@ -354,7 +350,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,
354 struct asyncppp *ap = ap_get(tty); 350 struct asyncppp *ap = ap_get(tty);
355 unsigned long flags; 351 unsigned long flags;
356 352
357 if (ap == 0) 353 if (!ap)
358 return; 354 return;
359 spin_lock_irqsave(&ap->recv_lock, flags); 355 spin_lock_irqsave(&ap->recv_lock, flags);
360 ppp_async_input(ap, buf, cflags, count); 356 ppp_async_input(ap, buf, cflags, count);
@@ -373,7 +369,7 @@ ppp_asynctty_wakeup(struct tty_struct *tty)
373 struct asyncppp *ap = ap_get(tty); 369 struct asyncppp *ap = ap_get(tty);
374 370
375 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 371 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
376 if (ap == 0) 372 if (!ap)
377 return; 373 return;
378 set_bit(XMIT_WAKEUP, &ap->xmit_flags); 374 set_bit(XMIT_WAKEUP, &ap->xmit_flags);
379 tasklet_schedule(&ap->tsk); 375 tasklet_schedule(&ap->tsk);
@@ -688,7 +684,7 @@ ppp_async_push(struct asyncppp *ap)
688 tty_stuffed = 1; 684 tty_stuffed = 1;
689 continue; 685 continue;
690 } 686 }
691 if (ap->optr >= ap->olim && ap->tpkt != 0) { 687 if (ap->optr >= ap->olim && ap->tpkt) {
692 if (ppp_async_encode(ap)) { 688 if (ppp_async_encode(ap)) {
693 /* finished processing ap->tpkt */ 689 /* finished processing ap->tpkt */
694 clear_bit(XMIT_FULL, &ap->xmit_flags); 690 clear_bit(XMIT_FULL, &ap->xmit_flags);
@@ -708,7 +704,7 @@ ppp_async_push(struct asyncppp *ap)
708 clear_bit(XMIT_BUSY, &ap->xmit_flags); 704 clear_bit(XMIT_BUSY, &ap->xmit_flags);
709 /* any more work to do? if not, exit the loop */ 705 /* any more work to do? if not, exit the loop */
710 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) 706 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags)
711 || (!tty_stuffed && ap->tpkt != 0))) 707 || (!tty_stuffed && ap->tpkt)))
712 break; 708 break;
713 /* more work to do, see if we can do it now */ 709 /* more work to do, see if we can do it now */
714 if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags)) 710 if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags))
@@ -719,7 +715,7 @@ ppp_async_push(struct asyncppp *ap)
719 715
720flush: 716flush:
721 clear_bit(XMIT_BUSY, &ap->xmit_flags); 717 clear_bit(XMIT_BUSY, &ap->xmit_flags);
722 if (ap->tpkt != 0) { 718 if (ap->tpkt) {
723 kfree_skb(ap->tpkt); 719 kfree_skb(ap->tpkt);
724 ap->tpkt = NULL; 720 ap->tpkt = NULL;
725 clear_bit(XMIT_FULL, &ap->xmit_flags); 721 clear_bit(XMIT_FULL, &ap->xmit_flags);
@@ -852,7 +848,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
852 s = 0; 848 s = 0;
853 for (i = 0; i < count; ++i) { 849 for (i = 0; i < count; ++i) {
854 c = buf[i]; 850 c = buf[i];
855 if (flags != 0 && flags[i] != 0) 851 if (flags && flags[i] != 0)
856 continue; 852 continue;
857 s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0; 853 s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0;
858 c = ((c >> 4) ^ c) & 0xf; 854 c = ((c >> 4) ^ c) & 0xf;
@@ -869,7 +865,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
869 n = scan_ordinary(ap, buf, count); 865 n = scan_ordinary(ap, buf, count);
870 866
871 f = 0; 867 f = 0;
872 if (flags != 0 && (ap->state & SC_TOSS) == 0) { 868 if (flags && (ap->state & SC_TOSS) == 0) {
873 /* check the flags to see if any char had an error */ 869 /* check the flags to see if any char had an error */
874 for (j = 0; j < n; ++j) 870 for (j = 0; j < n; ++j)
875 if ((f = flags[j]) != 0) 871 if ((f = flags[j]) != 0)
@@ -882,9 +878,9 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
882 } else if (n > 0 && (ap->state & SC_TOSS) == 0) { 878 } else if (n > 0 && (ap->state & SC_TOSS) == 0) {
883 /* stuff the chars in the skb */ 879 /* stuff the chars in the skb */
884 skb = ap->rpkt; 880 skb = ap->rpkt;
885 if (skb == 0) { 881 if (!skb) {
886 skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); 882 skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2);
887 if (skb == 0) 883 if (!skb)
888 goto nomem; 884 goto nomem;
889 ap->rpkt = skb; 885 ap->rpkt = skb;
890 } 886 }
@@ -931,7 +927,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
931 ++n; 927 ++n;
932 928
933 buf += n; 929 buf += n;
934 if (flags != 0) 930 if (flags)
935 flags += n; 931 flags += n;
936 count -= n; 932 count -= n;
937 } 933 }
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4b49d0e8c7eb..4f690378bb77 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -367,7 +367,7 @@ static int ppp_release(struct inode *inode, struct file *file)
367 struct ppp_file *pf = file->private_data; 367 struct ppp_file *pf = file->private_data;
368 struct ppp *ppp; 368 struct ppp *ppp;
369 369
370 if (pf != 0) { 370 if (pf) {
371 file->private_data = NULL; 371 file->private_data = NULL;
372 if (pf->kind == INTERFACE) { 372 if (pf->kind == INTERFACE) {
373 ppp = PF_TO_PPP(pf); 373 ppp = PF_TO_PPP(pf);
@@ -398,7 +398,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
398 398
399 ret = count; 399 ret = count;
400 400
401 if (pf == 0) 401 if (!pf)
402 return -ENXIO; 402 return -ENXIO;
403 add_wait_queue(&pf->rwait, &wait); 403 add_wait_queue(&pf->rwait, &wait);
404 for (;;) { 404 for (;;) {
@@ -431,7 +431,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
431 set_current_state(TASK_RUNNING); 431 set_current_state(TASK_RUNNING);
432 remove_wait_queue(&pf->rwait, &wait); 432 remove_wait_queue(&pf->rwait, &wait);
433 433
434 if (skb == 0) 434 if (!skb)
435 goto out; 435 goto out;
436 436
437 ret = -EOVERFLOW; 437 ret = -EOVERFLOW;
@@ -455,11 +455,11 @@ static ssize_t ppp_write(struct file *file, const char __user *buf,
455 struct sk_buff *skb; 455 struct sk_buff *skb;
456 ssize_t ret; 456 ssize_t ret;
457 457
458 if (pf == 0) 458 if (!pf)
459 return -ENXIO; 459 return -ENXIO;
460 ret = -ENOMEM; 460 ret = -ENOMEM;
461 skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); 461 skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL);
462 if (skb == 0) 462 if (!skb)
463 goto out; 463 goto out;
464 skb_reserve(skb, pf->hdrlen); 464 skb_reserve(skb, pf->hdrlen);
465 ret = -EFAULT; 465 ret = -EFAULT;
@@ -491,11 +491,11 @@ static unsigned int ppp_poll(struct file *file, poll_table *wait)
491 struct ppp_file *pf = file->private_data; 491 struct ppp_file *pf = file->private_data;
492 unsigned int mask; 492 unsigned int mask;
493 493
494 if (pf == 0) 494 if (!pf)
495 return 0; 495 return 0;
496 poll_wait(file, &pf->rwait, wait); 496 poll_wait(file, &pf->rwait, wait);
497 mask = POLLOUT | POLLWRNORM; 497 mask = POLLOUT | POLLWRNORM;
498 if (skb_peek(&pf->rq) != 0) 498 if (skb_peek(&pf->rq))
499 mask |= POLLIN | POLLRDNORM; 499 mask |= POLLIN | POLLRDNORM;
500 if (pf->dead) 500 if (pf->dead)
501 mask |= POLLHUP; 501 mask |= POLLHUP;
@@ -559,7 +559,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file,
559 void __user *argp = (void __user *)arg; 559 void __user *argp = (void __user *)arg;
560 int __user *p = argp; 560 int __user *p = argp;
561 561
562 if (pf == 0) 562 if (!pf)
563 return ppp_unattached_ioctl(pf, file, cmd, arg); 563 return ppp_unattached_ioctl(pf, file, cmd, arg);
564 564
565 if (cmd == PPPIOCDETACH) { 565 if (cmd == PPPIOCDETACH) {
@@ -689,13 +689,13 @@ static int ppp_ioctl(struct inode *inode, struct file *file,
689 val &= 0xffff; 689 val &= 0xffff;
690 } 690 }
691 vj = slhc_init(val2+1, val+1); 691 vj = slhc_init(val2+1, val+1);
692 if (vj == 0) { 692 if (!vj) {
693 printk(KERN_ERR "PPP: no memory (VJ compressor)\n"); 693 printk(KERN_ERR "PPP: no memory (VJ compressor)\n");
694 err = -ENOMEM; 694 err = -ENOMEM;
695 break; 695 break;
696 } 696 }
697 ppp_lock(ppp); 697 ppp_lock(ppp);
698 if (ppp->vj != 0) 698 if (ppp->vj)
699 slhc_free(ppp->vj); 699 slhc_free(ppp->vj);
700 ppp->vj = vj; 700 ppp->vj = vj;
701 ppp_unlock(ppp); 701 ppp_unlock(ppp);
@@ -786,7 +786,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
786 if (get_user(unit, p)) 786 if (get_user(unit, p))
787 break; 787 break;
788 ppp = ppp_create_interface(unit, &err); 788 ppp = ppp_create_interface(unit, &err);
789 if (ppp == 0) 789 if (!ppp)
790 break; 790 break;
791 file->private_data = &ppp->file; 791 file->private_data = &ppp->file;
792 ppp->owner = file; 792 ppp->owner = file;
@@ -803,7 +803,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
803 mutex_lock(&all_ppp_mutex); 803 mutex_lock(&all_ppp_mutex);
804 err = -ENXIO; 804 err = -ENXIO;
805 ppp = ppp_find_unit(unit); 805 ppp = ppp_find_unit(unit);
806 if (ppp != 0) { 806 if (ppp) {
807 atomic_inc(&ppp->file.refcnt); 807 atomic_inc(&ppp->file.refcnt);
808 file->private_data = &ppp->file; 808 file->private_data = &ppp->file;
809 err = 0; 809 err = 0;
@@ -817,7 +817,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
817 spin_lock_bh(&all_channels_lock); 817 spin_lock_bh(&all_channels_lock);
818 err = -ENXIO; 818 err = -ENXIO;
819 chan = ppp_find_channel(unit); 819 chan = ppp_find_channel(unit);
820 if (chan != 0) { 820 if (chan) {
821 atomic_inc(&chan->file.refcnt); 821 atomic_inc(&chan->file.refcnt);
822 file->private_data = &chan->file; 822 file->private_data = &chan->file;
823 err = 0; 823 err = 0;
@@ -946,9 +946,9 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
946 946
947 case SIOCGPPPCSTATS: 947 case SIOCGPPPCSTATS:
948 memset(&cstats, 0, sizeof(cstats)); 948 memset(&cstats, 0, sizeof(cstats));
949 if (ppp->xc_state != 0) 949 if (ppp->xc_state)
950 ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c); 950 ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c);
951 if (ppp->rc_state != 0) 951 if (ppp->rc_state)
952 ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d); 952 ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d);
953 if (copy_to_user(addr, &cstats, sizeof(cstats))) 953 if (copy_to_user(addr, &cstats, sizeof(cstats)))
954 break; 954 break;
@@ -993,14 +993,14 @@ ppp_xmit_process(struct ppp *ppp)
993 struct sk_buff *skb; 993 struct sk_buff *skb;
994 994
995 ppp_xmit_lock(ppp); 995 ppp_xmit_lock(ppp);
996 if (ppp->dev != 0) { 996 if (ppp->dev) {
997 ppp_push(ppp); 997 ppp_push(ppp);
998 while (ppp->xmit_pending == 0 998 while (!ppp->xmit_pending
999 && (skb = skb_dequeue(&ppp->file.xq)) != 0) 999 && (skb = skb_dequeue(&ppp->file.xq)))
1000 ppp_send_frame(ppp, skb); 1000 ppp_send_frame(ppp, skb);
1001 /* If there's no work left to do, tell the core net 1001 /* If there's no work left to do, tell the core net
1002 code that we can accept some more. */ 1002 code that we can accept some more. */
1003 if (ppp->xmit_pending == 0 && skb_peek(&ppp->file.xq) == 0) 1003 if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq))
1004 netif_wake_queue(ppp->dev); 1004 netif_wake_queue(ppp->dev);
1005 } 1005 }
1006 ppp_xmit_unlock(ppp); 1006 ppp_xmit_unlock(ppp);
@@ -1100,12 +1100,12 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
1100 1100
1101 switch (proto) { 1101 switch (proto) {
1102 case PPP_IP: 1102 case PPP_IP:
1103 if (ppp->vj == 0 || (ppp->flags & SC_COMP_TCP) == 0) 1103 if (!ppp->vj || (ppp->flags & SC_COMP_TCP) == 0)
1104 break; 1104 break;
1105 /* try to do VJ TCP header compression */ 1105 /* try to do VJ TCP header compression */
1106 new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, 1106 new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2,
1107 GFP_ATOMIC); 1107 GFP_ATOMIC);
1108 if (new_skb == 0) { 1108 if (!new_skb) {
1109 printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n"); 1109 printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n");
1110 goto drop; 1110 goto drop;
1111 } 1111 }
@@ -1140,7 +1140,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
1140 } 1140 }
1141 1141
1142 /* try to do packet compression */ 1142 /* try to do packet compression */
1143 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 1143 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state
1144 && proto != PPP_LCP && proto != PPP_CCP) { 1144 && proto != PPP_LCP && proto != PPP_CCP) {
1145 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { 1145 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) {
1146 if (net_ratelimit()) 1146 if (net_ratelimit())
@@ -1185,7 +1185,7 @@ ppp_push(struct ppp *ppp)
1185 struct channel *pch; 1185 struct channel *pch;
1186 struct sk_buff *skb = ppp->xmit_pending; 1186 struct sk_buff *skb = ppp->xmit_pending;
1187 1187
1188 if (skb == 0) 1188 if (!skb)
1189 return; 1189 return;
1190 1190
1191 list = &ppp->channels; 1191 list = &ppp->channels;
@@ -1355,7 +1355,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1355 if (flen == len && nfree == 0) 1355 if (flen == len && nfree == 0)
1356 bits |= E; 1356 bits |= E;
1357 frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC); 1357 frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC);
1358 if (frag == 0) 1358 if (!frag)
1359 goto noskb; 1359 goto noskb;
1360 q = skb_put(frag, flen + hdrlen); 1360 q = skb_put(frag, flen + hdrlen);
1361 1361
@@ -1425,7 +1425,7 @@ ppp_channel_push(struct channel *pch)
1425 struct ppp *ppp; 1425 struct ppp *ppp;
1426 1426
1427 spin_lock_bh(&pch->downl); 1427 spin_lock_bh(&pch->downl);
1428 if (pch->chan != 0) { 1428 if (pch->chan) {
1429 while (!skb_queue_empty(&pch->file.xq)) { 1429 while (!skb_queue_empty(&pch->file.xq)) {
1430 skb = skb_dequeue(&pch->file.xq); 1430 skb = skb_dequeue(&pch->file.xq);
1431 if (!pch->chan->ops->start_xmit(pch->chan, skb)) { 1431 if (!pch->chan->ops->start_xmit(pch->chan, skb)) {
@@ -1443,7 +1443,7 @@ ppp_channel_push(struct channel *pch)
1443 if (skb_queue_empty(&pch->file.xq)) { 1443 if (skb_queue_empty(&pch->file.xq)) {
1444 read_lock_bh(&pch->upl); 1444 read_lock_bh(&pch->upl);
1445 ppp = pch->ppp; 1445 ppp = pch->ppp;
1446 if (ppp != 0) 1446 if (ppp)
1447 ppp_xmit_process(ppp); 1447 ppp_xmit_process(ppp);
1448 read_unlock_bh(&pch->upl); 1448 read_unlock_bh(&pch->upl);
1449 } 1449 }
@@ -1462,7 +1462,7 @@ ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
1462{ 1462{
1463 ppp_recv_lock(ppp); 1463 ppp_recv_lock(ppp);
1464 /* ppp->dev == 0 means interface is closing down */ 1464 /* ppp->dev == 0 means interface is closing down */
1465 if (ppp->dev != 0) 1465 if (ppp->dev)
1466 ppp_receive_frame(ppp, skb, pch); 1466 ppp_receive_frame(ppp, skb, pch);
1467 else 1467 else
1468 kfree_skb(skb); 1468 kfree_skb(skb);
@@ -1475,19 +1475,19 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb)
1475 struct channel *pch = chan->ppp; 1475 struct channel *pch = chan->ppp;
1476 int proto; 1476 int proto;
1477 1477
1478 if (pch == 0 || skb->len == 0) { 1478 if (!pch || skb->len == 0) {
1479 kfree_skb(skb); 1479 kfree_skb(skb);
1480 return; 1480 return;
1481 } 1481 }
1482 1482
1483 proto = PPP_PROTO(skb); 1483 proto = PPP_PROTO(skb);
1484 read_lock_bh(&pch->upl); 1484 read_lock_bh(&pch->upl);
1485 if (pch->ppp == 0 || proto >= 0xc000 || proto == PPP_CCPFRAG) { 1485 if (!pch->ppp || proto >= 0xc000 || proto == PPP_CCPFRAG) {
1486 /* put it on the channel queue */ 1486 /* put it on the channel queue */
1487 skb_queue_tail(&pch->file.rq, skb); 1487 skb_queue_tail(&pch->file.rq, skb);
1488 /* drop old frames if queue too long */ 1488 /* drop old frames if queue too long */
1489 while (pch->file.rq.qlen > PPP_MAX_RQLEN 1489 while (pch->file.rq.qlen > PPP_MAX_RQLEN
1490 && (skb = skb_dequeue(&pch->file.rq)) != 0) 1490 && (skb = skb_dequeue(&pch->file.rq)))
1491 kfree_skb(skb); 1491 kfree_skb(skb);
1492 wake_up_interruptible(&pch->file.rwait); 1492 wake_up_interruptible(&pch->file.rwait);
1493 } else { 1493 } else {
@@ -1503,13 +1503,13 @@ ppp_input_error(struct ppp_channel *chan, int code)
1503 struct channel *pch = chan->ppp; 1503 struct channel *pch = chan->ppp;
1504 struct sk_buff *skb; 1504 struct sk_buff *skb;
1505 1505
1506 if (pch == 0) 1506 if (!pch)
1507 return; 1507 return;
1508 1508
1509 read_lock_bh(&pch->upl); 1509 read_lock_bh(&pch->upl);
1510 if (pch->ppp != 0) { 1510 if (pch->ppp) {
1511 skb = alloc_skb(0, GFP_ATOMIC); 1511 skb = alloc_skb(0, GFP_ATOMIC);
1512 if (skb != 0) { 1512 if (skb) {
1513 skb->len = 0; /* probably unnecessary */ 1513 skb->len = 0; /* probably unnecessary */
1514 skb->cb[0] = code; 1514 skb->cb[0] = code;
1515 ppp_do_recv(pch->ppp, skb, pch); 1515 ppp_do_recv(pch->ppp, skb, pch);
@@ -1548,7 +1548,7 @@ static void
1548ppp_receive_error(struct ppp *ppp) 1548ppp_receive_error(struct ppp *ppp)
1549{ 1549{
1550 ++ppp->stats.rx_errors; 1550 ++ppp->stats.rx_errors;
1551 if (ppp->vj != 0) 1551 if (ppp->vj)
1552 slhc_toss(ppp->vj); 1552 slhc_toss(ppp->vj);
1553} 1553}
1554 1554
@@ -1563,7 +1563,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1563 * Note that some decompressors need to see uncompressed frames 1563 * Note that some decompressors need to see uncompressed frames
1564 * that come in as well as compressed frames. 1564 * that come in as well as compressed frames.
1565 */ 1565 */
1566 if (ppp->rc_state != 0 && (ppp->rstate & SC_DECOMP_RUN) 1566 if (ppp->rc_state && (ppp->rstate & SC_DECOMP_RUN)
1567 && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) 1567 && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0)
1568 skb = ppp_decompress_frame(ppp, skb); 1568 skb = ppp_decompress_frame(ppp, skb);
1569 1569
@@ -1574,13 +1574,13 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1574 switch (proto) { 1574 switch (proto) {
1575 case PPP_VJC_COMP: 1575 case PPP_VJC_COMP:
1576 /* decompress VJ compressed packets */ 1576 /* decompress VJ compressed packets */
1577 if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) 1577 if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP))
1578 goto err; 1578 goto err;
1579 1579
1580 if (skb_tailroom(skb) < 124 || skb_cloned(skb)) { 1580 if (skb_tailroom(skb) < 124 || skb_cloned(skb)) {
1581 /* copy to a new sk_buff with more tailroom */ 1581 /* copy to a new sk_buff with more tailroom */
1582 ns = dev_alloc_skb(skb->len + 128); 1582 ns = dev_alloc_skb(skb->len + 128);
1583 if (ns == 0) { 1583 if (!ns) {
1584 printk(KERN_ERR"PPP: no memory (VJ decomp)\n"); 1584 printk(KERN_ERR"PPP: no memory (VJ decomp)\n");
1585 goto err; 1585 goto err;
1586 } 1586 }
@@ -1606,7 +1606,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1606 break; 1606 break;
1607 1607
1608 case PPP_VJC_UNCOMP: 1608 case PPP_VJC_UNCOMP:
1609 if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) 1609 if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP))
1610 goto err; 1610 goto err;
1611 1611
1612 /* Until we fix the decompressor need to make sure 1612 /* Until we fix the decompressor need to make sure
@@ -1636,7 +1636,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1636 skb_queue_tail(&ppp->file.rq, skb); 1636 skb_queue_tail(&ppp->file.rq, skb);
1637 /* limit queue length by dropping old frames */ 1637 /* limit queue length by dropping old frames */
1638 while (ppp->file.rq.qlen > PPP_MAX_RQLEN 1638 while (ppp->file.rq.qlen > PPP_MAX_RQLEN
1639 && (skb = skb_dequeue(&ppp->file.rq)) != 0) 1639 && (skb = skb_dequeue(&ppp->file.rq)))
1640 kfree_skb(skb); 1640 kfree_skb(skb);
1641 /* wake up any process polling or blocking on read */ 1641 /* wake up any process polling or blocking on read */
1642 wake_up_interruptible(&ppp->file.rwait); 1642 wake_up_interruptible(&ppp->file.rwait);
@@ -1718,7 +1718,7 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb)
1718 } 1718 }
1719 1719
1720 ns = dev_alloc_skb(obuff_size); 1720 ns = dev_alloc_skb(obuff_size);
1721 if (ns == 0) { 1721 if (!ns) {
1722 printk(KERN_ERR "ppp_decompress_frame: no memory\n"); 1722 printk(KERN_ERR "ppp_decompress_frame: no memory\n");
1723 goto err; 1723 goto err;
1724 } 1724 }
@@ -1836,7 +1836,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
1836 ppp->minseq = ppp->mrq.next->sequence; 1836 ppp->minseq = ppp->mrq.next->sequence;
1837 1837
1838 /* Pull completed packets off the queue and receive them. */ 1838 /* Pull completed packets off the queue and receive them. */
1839 while ((skb = ppp_mp_reconstruct(ppp)) != 0) 1839 while ((skb = ppp_mp_reconstruct(ppp)))
1840 ppp_receive_nonmp_frame(ppp, skb); 1840 ppp_receive_nonmp_frame(ppp, skb);
1841 1841
1842 return; 1842 return;
@@ -2002,7 +2002,7 @@ ppp_register_channel(struct ppp_channel *chan)
2002 struct channel *pch; 2002 struct channel *pch;
2003 2003
2004 pch = kzalloc(sizeof(struct channel), GFP_KERNEL); 2004 pch = kzalloc(sizeof(struct channel), GFP_KERNEL);
2005 if (pch == 0) 2005 if (!pch)
2006 return -ENOMEM; 2006 return -ENOMEM;
2007 pch->ppp = NULL; 2007 pch->ppp = NULL;
2008 pch->chan = chan; 2008 pch->chan = chan;
@@ -2030,7 +2030,7 @@ int ppp_channel_index(struct ppp_channel *chan)
2030{ 2030{
2031 struct channel *pch = chan->ppp; 2031 struct channel *pch = chan->ppp;
2032 2032
2033 if (pch != 0) 2033 if (pch)
2034 return pch->file.index; 2034 return pch->file.index;
2035 return -1; 2035 return -1;
2036} 2036}
@@ -2043,9 +2043,9 @@ int ppp_unit_number(struct ppp_channel *chan)
2043 struct channel *pch = chan->ppp; 2043 struct channel *pch = chan->ppp;
2044 int unit = -1; 2044 int unit = -1;
2045 2045
2046 if (pch != 0) { 2046 if (pch) {
2047 read_lock_bh(&pch->upl); 2047 read_lock_bh(&pch->upl);
2048 if (pch->ppp != 0) 2048 if (pch->ppp)
2049 unit = pch->ppp->file.index; 2049 unit = pch->ppp->file.index;
2050 read_unlock_bh(&pch->upl); 2050 read_unlock_bh(&pch->upl);
2051 } 2051 }
@@ -2061,7 +2061,7 @@ ppp_unregister_channel(struct ppp_channel *chan)
2061{ 2061{
2062 struct channel *pch = chan->ppp; 2062 struct channel *pch = chan->ppp;
2063 2063
2064 if (pch == 0) 2064 if (!pch)
2065 return; /* should never happen */ 2065 return; /* should never happen */
2066 chan->ppp = NULL; 2066 chan->ppp = NULL;
2067 2067
@@ -2093,7 +2093,7 @@ ppp_output_wakeup(struct ppp_channel *chan)
2093{ 2093{
2094 struct channel *pch = chan->ppp; 2094 struct channel *pch = chan->ppp;
2095 2095
2096 if (pch == 0) 2096 if (!pch)
2097 return; 2097 return;
2098 ppp_channel_push(pch); 2098 ppp_channel_push(pch);
2099} 2099}
@@ -2124,18 +2124,18 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2124 2124
2125 cp = find_compressor(ccp_option[0]); 2125 cp = find_compressor(ccp_option[0]);
2126#ifdef CONFIG_KMOD 2126#ifdef CONFIG_KMOD
2127 if (cp == 0) { 2127 if (!cp) {
2128 request_module("ppp-compress-%d", ccp_option[0]); 2128 request_module("ppp-compress-%d", ccp_option[0]);
2129 cp = find_compressor(ccp_option[0]); 2129 cp = find_compressor(ccp_option[0]);
2130 } 2130 }
2131#endif /* CONFIG_KMOD */ 2131#endif /* CONFIG_KMOD */
2132 if (cp == 0) 2132 if (!cp)
2133 goto out; 2133 goto out;
2134 2134
2135 err = -ENOBUFS; 2135 err = -ENOBUFS;
2136 if (data.transmit) { 2136 if (data.transmit) {
2137 state = cp->comp_alloc(ccp_option, data.length); 2137 state = cp->comp_alloc(ccp_option, data.length);
2138 if (state != 0) { 2138 if (state) {
2139 ppp_xmit_lock(ppp); 2139 ppp_xmit_lock(ppp);
2140 ppp->xstate &= ~SC_COMP_RUN; 2140 ppp->xstate &= ~SC_COMP_RUN;
2141 ocomp = ppp->xcomp; 2141 ocomp = ppp->xcomp;
@@ -2143,7 +2143,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2143 ppp->xcomp = cp; 2143 ppp->xcomp = cp;
2144 ppp->xc_state = state; 2144 ppp->xc_state = state;
2145 ppp_xmit_unlock(ppp); 2145 ppp_xmit_unlock(ppp);
2146 if (ostate != 0) { 2146 if (ostate) {
2147 ocomp->comp_free(ostate); 2147 ocomp->comp_free(ostate);
2148 module_put(ocomp->owner); 2148 module_put(ocomp->owner);
2149 } 2149 }
@@ -2153,7 +2153,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2153 2153
2154 } else { 2154 } else {
2155 state = cp->decomp_alloc(ccp_option, data.length); 2155 state = cp->decomp_alloc(ccp_option, data.length);
2156 if (state != 0) { 2156 if (state) {
2157 ppp_recv_lock(ppp); 2157 ppp_recv_lock(ppp);
2158 ppp->rstate &= ~SC_DECOMP_RUN; 2158 ppp->rstate &= ~SC_DECOMP_RUN;
2159 ocomp = ppp->rcomp; 2159 ocomp = ppp->rcomp;
@@ -2161,7 +2161,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2161 ppp->rcomp = cp; 2161 ppp->rcomp = cp;
2162 ppp->rc_state = state; 2162 ppp->rc_state = state;
2163 ppp_recv_unlock(ppp); 2163 ppp_recv_unlock(ppp);
2164 if (ostate != 0) { 2164 if (ostate) {
2165 ocomp->decomp_free(ostate); 2165 ocomp->decomp_free(ostate);
2166 module_put(ocomp->owner); 2166 module_put(ocomp->owner);
2167 } 2167 }
@@ -2228,7 +2228,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound)
2228 break; 2228 break;
2229 if (inbound) { 2229 if (inbound) {
2230 /* we will start receiving compressed packets */ 2230 /* we will start receiving compressed packets */
2231 if (ppp->rc_state == 0) 2231 if (!ppp->rc_state)
2232 break; 2232 break;
2233 if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len, 2233 if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len,
2234 ppp->file.index, 0, ppp->mru, ppp->debug)) { 2234 ppp->file.index, 0, ppp->mru, ppp->debug)) {
@@ -2237,7 +2237,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound)
2237 } 2237 }
2238 } else { 2238 } else {
2239 /* we will soon start sending compressed packets */ 2239 /* we will soon start sending compressed packets */
2240 if (ppp->xc_state == 0) 2240 if (!ppp->xc_state)
2241 break; 2241 break;
2242 if (ppp->xcomp->comp_init(ppp->xc_state, dp, len, 2242 if (ppp->xcomp->comp_init(ppp->xc_state, dp, len,
2243 ppp->file.index, 0, ppp->debug)) 2243 ppp->file.index, 0, ppp->debug))
@@ -2320,11 +2320,11 @@ ppp_register_compressor(struct compressor *cp)
2320 int ret; 2320 int ret;
2321 spin_lock(&compressor_list_lock); 2321 spin_lock(&compressor_list_lock);
2322 ret = -EEXIST; 2322 ret = -EEXIST;
2323 if (find_comp_entry(cp->compress_proto) != 0) 2323 if (find_comp_entry(cp->compress_proto))
2324 goto out; 2324 goto out;
2325 ret = -ENOMEM; 2325 ret = -ENOMEM;
2326 ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC); 2326 ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC);
2327 if (ce == 0) 2327 if (!ce)
2328 goto out; 2328 goto out;
2329 ret = 0; 2329 ret = 0;
2330 ce->comp = cp; 2330 ce->comp = cp;
@@ -2342,7 +2342,7 @@ ppp_unregister_compressor(struct compressor *cp)
2342 2342
2343 spin_lock(&compressor_list_lock); 2343 spin_lock(&compressor_list_lock);
2344 ce = find_comp_entry(cp->compress_proto); 2344 ce = find_comp_entry(cp->compress_proto);
2345 if (ce != 0 && ce->comp == cp) { 2345 if (ce && ce->comp == cp) {
2346 list_del(&ce->list); 2346 list_del(&ce->list);
2347 kfree(ce); 2347 kfree(ce);
2348 } 2348 }
@@ -2358,7 +2358,7 @@ find_compressor(int type)
2358 2358
2359 spin_lock(&compressor_list_lock); 2359 spin_lock(&compressor_list_lock);
2360 ce = find_comp_entry(type); 2360 ce = find_comp_entry(type);
2361 if (ce != 0) { 2361 if (ce) {
2362 cp = ce->comp; 2362 cp = ce->comp;
2363 if (!try_module_get(cp->owner)) 2363 if (!try_module_get(cp->owner))
2364 cp = NULL; 2364 cp = NULL;
@@ -2383,7 +2383,7 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st)
2383 st->p.ppp_opackets = ppp->stats.tx_packets; 2383 st->p.ppp_opackets = ppp->stats.tx_packets;
2384 st->p.ppp_oerrors = ppp->stats.tx_errors; 2384 st->p.ppp_oerrors = ppp->stats.tx_errors;
2385 st->p.ppp_obytes = ppp->stats.tx_bytes; 2385 st->p.ppp_obytes = ppp->stats.tx_bytes;
2386 if (vj == 0) 2386 if (!vj)
2387 return; 2387 return;
2388 st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; 2388 st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed;
2389 st->vj.vjs_compressed = vj->sls_o_compressed; 2389 st->vj.vjs_compressed = vj->sls_o_compressed;
@@ -2604,11 +2604,11 @@ ppp_connect_channel(struct channel *pch, int unit)
2604 2604
2605 mutex_lock(&all_ppp_mutex); 2605 mutex_lock(&all_ppp_mutex);
2606 ppp = ppp_find_unit(unit); 2606 ppp = ppp_find_unit(unit);
2607 if (ppp == 0) 2607 if (!ppp)
2608 goto out; 2608 goto out;
2609 write_lock_bh(&pch->upl); 2609 write_lock_bh(&pch->upl);
2610 ret = -EINVAL; 2610 ret = -EINVAL;
2611 if (pch->ppp != 0) 2611 if (pch->ppp)
2612 goto outl; 2612 goto outl;
2613 2613
2614 ppp_lock(ppp); 2614 ppp_lock(ppp);
@@ -2644,7 +2644,7 @@ ppp_disconnect_channel(struct channel *pch)
2644 ppp = pch->ppp; 2644 ppp = pch->ppp;
2645 pch->ppp = NULL; 2645 pch->ppp = NULL;
2646 write_unlock_bh(&pch->upl); 2646 write_unlock_bh(&pch->upl);
2647 if (ppp != 0) { 2647 if (ppp) {
2648 /* remove it from the ppp unit's list */ 2648 /* remove it from the ppp unit's list */
2649 ppp_lock(ppp); 2649 ppp_lock(ppp);
2650 list_del(&pch->clist); 2650 list_del(&pch->clist);
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
index ce64032a465a..f0c6a1926a02 100644
--- a/drivers/net/ppp_synctty.c
+++ b/drivers/net/ppp_synctty.c
@@ -209,7 +209,7 @@ ppp_sync_open(struct tty_struct *tty)
209 209
210 ap = kzalloc(sizeof(*ap), GFP_KERNEL); 210 ap = kzalloc(sizeof(*ap), GFP_KERNEL);
211 err = -ENOMEM; 211 err = -ENOMEM;
212 if (ap == 0) 212 if (!ap)
213 goto out; 213 goto out;
214 214
215 /* initialize the syncppp structure */ 215 /* initialize the syncppp structure */
@@ -262,7 +262,7 @@ ppp_sync_close(struct tty_struct *tty)
262 ap = tty->disc_data; 262 ap = tty->disc_data;
263 tty->disc_data = NULL; 263 tty->disc_data = NULL;
264 write_unlock_irq(&disc_data_lock); 264 write_unlock_irq(&disc_data_lock);
265 if (ap == 0) 265 if (!ap)
266 return; 266 return;
267 267
268 /* 268 /*
@@ -278,7 +278,7 @@ ppp_sync_close(struct tty_struct *tty)
278 278
279 ppp_unregister_channel(&ap->chan); 279 ppp_unregister_channel(&ap->chan);
280 skb_queue_purge(&ap->rqueue); 280 skb_queue_purge(&ap->rqueue);
281 if (ap->tpkt != 0) 281 if (ap->tpkt)
282 kfree_skb(ap->tpkt); 282 kfree_skb(ap->tpkt);
283 kfree(ap); 283 kfree(ap);
284} 284}
@@ -325,13 +325,13 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
325 int __user *p = (int __user *)arg; 325 int __user *p = (int __user *)arg;
326 int err, val; 326 int err, val;
327 327
328 if (ap == 0) 328 if (!ap)
329 return -ENXIO; 329 return -ENXIO;
330 err = -EFAULT; 330 err = -EFAULT;
331 switch (cmd) { 331 switch (cmd) {
332 case PPPIOCGCHAN: 332 case PPPIOCGCHAN:
333 err = -ENXIO; 333 err = -ENXIO;
334 if (ap == 0) 334 if (!ap)
335 break; 335 break;
336 err = -EFAULT; 336 err = -EFAULT;
337 if (put_user(ppp_channel_index(&ap->chan), p)) 337 if (put_user(ppp_channel_index(&ap->chan), p))
@@ -341,7 +341,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
341 341
342 case PPPIOCGUNIT: 342 case PPPIOCGUNIT:
343 err = -ENXIO; 343 err = -ENXIO;
344 if (ap == 0) 344 if (!ap)
345 break; 345 break;
346 err = -EFAULT; 346 err = -EFAULT;
347 if (put_user(ppp_unit_number(&ap->chan), p)) 347 if (put_user(ppp_unit_number(&ap->chan), p))
@@ -349,16 +349,11 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
349 err = 0; 349 err = 0;
350 break; 350 break;
351 351
352 case TCGETS:
353 case TCGETA:
354 err = n_tty_ioctl(tty, file, cmd, arg);
355 break;
356
357 case TCFLSH: 352 case TCFLSH:
358 /* flush our buffers and the serial port's buffer */ 353 /* flush our buffers and the serial port's buffer */
359 if (arg == TCIOFLUSH || arg == TCOFLUSH) 354 if (arg == TCIOFLUSH || arg == TCOFLUSH)
360 ppp_sync_flush_output(ap); 355 ppp_sync_flush_output(ap);
361 err = n_tty_ioctl(tty, file, cmd, arg); 356 err = tty_perform_flush(tty, arg);
362 break; 357 break;
363 358
364 case FIONREAD: 359 case FIONREAD:
@@ -369,7 +364,8 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
369 break; 364 break;
370 365
371 default: 366 default:
372 err = -ENOIOCTLCMD; 367 err = tty_mode_ioctl(tty, file, cmd, arg);
368 break;
373 } 369 }
374 370
375 sp_put(ap); 371 sp_put(ap);
@@ -394,7 +390,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
394 struct syncppp *ap = sp_get(tty); 390 struct syncppp *ap = sp_get(tty);
395 unsigned long flags; 391 unsigned long flags;
396 392
397 if (ap == 0) 393 if (!ap)
398 return; 394 return;
399 spin_lock_irqsave(&ap->recv_lock, flags); 395 spin_lock_irqsave(&ap->recv_lock, flags);
400 ppp_sync_input(ap, buf, cflags, count); 396 ppp_sync_input(ap, buf, cflags, count);
@@ -413,7 +409,7 @@ ppp_sync_wakeup(struct tty_struct *tty)
413 struct syncppp *ap = sp_get(tty); 409 struct syncppp *ap = sp_get(tty);
414 410
415 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 411 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
416 if (ap == 0) 412 if (!ap)
417 return; 413 return;
418 set_bit(XMIT_WAKEUP, &ap->xmit_flags); 414 set_bit(XMIT_WAKEUP, &ap->xmit_flags);
419 tasklet_schedule(&ap->tsk); 415 tasklet_schedule(&ap->tsk);
@@ -655,7 +651,7 @@ ppp_sync_push(struct syncppp *ap)
655 for (;;) { 651 for (;;) {
656 if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) 652 if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags))
657 tty_stuffed = 0; 653 tty_stuffed = 0;
658 if (!tty_stuffed && ap->tpkt != 0) { 654 if (!tty_stuffed && ap->tpkt) {
659 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 655 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
660 sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); 656 sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len);
661 if (sent < 0) 657 if (sent < 0)
@@ -673,7 +669,7 @@ ppp_sync_push(struct syncppp *ap)
673 /* haven't made any progress */ 669 /* haven't made any progress */
674 spin_unlock_bh(&ap->xmit_lock); 670 spin_unlock_bh(&ap->xmit_lock);
675 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) 671 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags)
676 || (!tty_stuffed && ap->tpkt != 0))) 672 || (!tty_stuffed && ap->tpkt)))
677 break; 673 break;
678 if (!spin_trylock_bh(&ap->xmit_lock)) 674 if (!spin_trylock_bh(&ap->xmit_lock))
679 break; 675 break;
@@ -681,7 +677,7 @@ ppp_sync_push(struct syncppp *ap)
681 return done; 677 return done;
682 678
683flush: 679flush:
684 if (ap->tpkt != 0) { 680 if (ap->tpkt) {
685 kfree_skb(ap->tpkt); 681 kfree_skb(ap->tpkt);
686 ap->tpkt = NULL; 682 ap->tpkt = NULL;
687 clear_bit(XMIT_FULL, &ap->xmit_flags); 683 clear_bit(XMIT_FULL, &ap->xmit_flags);
@@ -736,7 +732,8 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
736 ppp_print_buffer ("receive buffer", buf, count); 732 ppp_print_buffer ("receive buffer", buf, count);
737 733
738 /* stuff the chars in the skb */ 734 /* stuff the chars in the skb */
739 if ((skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2)) == 0) { 735 skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2);
736 if (!skb) {
740 printk(KERN_ERR "PPPsync: no memory (input pkt)\n"); 737 printk(KERN_ERR "PPPsync: no memory (input pkt)\n");
741 goto err; 738 goto err;
742 } 739 }
@@ -744,7 +741,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
744 if (buf[0] != PPP_ALLSTATIONS) 741 if (buf[0] != PPP_ALLSTATIONS)
745 skb_reserve(skb, 2 + (buf[0] & 1)); 742 skb_reserve(skb, 2 + (buf[0] & 1));
746 743
747 if (flags != 0 && *flags) { 744 if (flags && *flags) {
748 /* error flag set, ignore frame */ 745 /* error flag set, ignore frame */
749 goto err; 746 goto err;
750 } else if (count > skb_tailroom(skb)) { 747 } else if (count > skb_tailroom(skb)) {
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..a7556cd2df79 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -488,7 +488,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
488{ 488{
489 struct pppol2tp_session *session = NULL; 489 struct pppol2tp_session *session = NULL;
490 struct pppol2tp_tunnel *tunnel; 490 struct pppol2tp_tunnel *tunnel;
491 unsigned char *ptr; 491 unsigned char *ptr, *optr;
492 u16 hdrflags; 492 u16 hdrflags;
493 u16 tunnel_id, session_id; 493 u16 tunnel_id, session_id;
494 int length; 494 int length;
@@ -496,7 +496,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
496 496
497 tunnel = pppol2tp_sock_to_tunnel(sock); 497 tunnel = pppol2tp_sock_to_tunnel(sock);
498 if (tunnel == NULL) 498 if (tunnel == NULL)
499 goto error; 499 goto no_tunnel;
500 500
501 /* UDP always verifies the packet length. */ 501 /* UDP always verifies the packet length. */
502 __skb_pull(skb, sizeof(struct udphdr)); 502 __skb_pull(skb, sizeof(struct udphdr));
@@ -509,7 +509,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
509 } 509 }
510 510
511 /* Point to L2TP header */ 511 /* Point to L2TP header */
512 ptr = skb->data; 512 optr = ptr = skb->data;
513 513
514 /* Get L2TP header flags */ 514 /* Get L2TP header flags */
515 hdrflags = ntohs(*(__be16*)ptr); 515 hdrflags = ntohs(*(__be16*)ptr);
@@ -637,12 +637,14 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
637 /* If offset bit set, skip it. */ 637 /* If offset bit set, skip it. */
638 if (hdrflags & L2TP_HDRFLAG_O) { 638 if (hdrflags & L2TP_HDRFLAG_O) {
639 offset = ntohs(*(__be16 *)ptr); 639 offset = ntohs(*(__be16 *)ptr);
640 skb->transport_header += 2 + offset; 640 ptr += 2 + offset;
641 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 2))
642 goto discard;
643 } 641 }
644 642
645 __skb_pull(skb, skb_transport_offset(skb)); 643 offset = ptr - optr;
644 if (!pskb_may_pull(skb, offset))
645 goto discard;
646
647 __skb_pull(skb, offset);
646 648
647 /* Skip PPP header, if present. In testing, Microsoft L2TP clients 649 /* Skip PPP header, if present. In testing, Microsoft L2TP clients
648 * don't send the PPP header (PPP header compression enabled), but 650 * don't send the PPP header (PPP header compression enabled), but
@@ -652,6 +654,9 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
652 * Note that skb->data[] isn't dereferenced from a u16 ptr here since 654 * Note that skb->data[] isn't dereferenced from a u16 ptr here since
653 * the field may be unaligned. 655 * the field may be unaligned.
654 */ 656 */
657 if (!pskb_may_pull(skb, 2))
658 goto discard;
659
655 if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03)) 660 if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03))
656 skb_pull(skb, 2); 661 skb_pull(skb, 2);
657 662
@@ -709,6 +714,10 @@ discard:
709 return 0; 714 return 0;
710 715
711error: 716error:
717 /* Put UDP header back */
718 __skb_push(skb, sizeof(struct udphdr));
719
720no_tunnel:
712 return 1; 721 return 1;
713} 722}
714 723
@@ -1050,6 +1059,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1050 /* Get routing info from the tunnel socket */ 1059 /* Get routing info from the tunnel socket */
1051 dst_release(skb->dst); 1060 dst_release(skb->dst);
1052 skb->dst = sk_dst_get(sk_tun); 1061 skb->dst = sk_dst_get(sk_tun);
1062 skb_orphan(skb);
1063 skb->sk = sk_tun;
1053 1064
1054 /* Queue the packet to IP for output */ 1065 /* Queue the packet to IP for output */
1055 len = skb->len; 1066 len = skb->len;
@@ -1416,7 +1427,7 @@ static int pppol2tp_create(struct net *net, struct socket *sock)
1416 int error = -ENOMEM; 1427 int error = -ENOMEM;
1417 struct sock *sk; 1428 struct sock *sk;
1418 1429
1419 sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto, 1); 1430 sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto);
1420 if (!sk) 1431 if (!sk)
1421 goto out; 1432 goto out;
1422 1433
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 30adf726743c..a5791114b7bd 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1456,16 +1456,11 @@ static void ql_phy_start_neg_ex(struct ql3_adapter *qdev)
1456 PHYAddr[qdev->mac_index]); 1456 PHYAddr[qdev->mac_index]);
1457 reg &= ~PHY_GIG_ALL_PARAMS; 1457 reg &= ~PHY_GIG_ALL_PARAMS;
1458 1458
1459 if(portConfiguration & 1459 if(portConfiguration & PORT_CONFIG_1000MB_SPEED) {
1460 PORT_CONFIG_FULL_DUPLEX_ENABLED & 1460 if(portConfiguration & PORT_CONFIG_FULL_DUPLEX_ENABLED)
1461 PORT_CONFIG_1000MB_SPEED) { 1461 reg |= PHY_GIG_ADV_1000F;
1462 reg |= PHY_GIG_ADV_1000F; 1462 else
1463 } 1463 reg |= PHY_GIG_ADV_1000H;
1464
1465 if(portConfiguration &
1466 PORT_CONFIG_HALF_DUPLEX_ENABLED &
1467 PORT_CONFIG_1000MB_SPEED) {
1468 reg |= PHY_GIG_ADV_1000H;
1469 } 1464 }
1470 1465
1471 ql_mii_write_reg_ex(qdev, PHY_GIG_CONTROL, reg, 1466 ql_mii_write_reg_ex(qdev, PHY_GIG_CONTROL, reg,
@@ -1645,8 +1640,11 @@ static int ql_finish_auto_neg(struct ql3_adapter *qdev)
1645 return 0; 1640 return 0;
1646} 1641}
1647 1642
1648static void ql_link_state_machine(struct ql3_adapter *qdev) 1643static void ql_link_state_machine_work(struct work_struct *work)
1649{ 1644{
1645 struct ql3_adapter *qdev =
1646 container_of(work, struct ql3_adapter, link_state_work.work);
1647
1650 u32 curr_link_state; 1648 u32 curr_link_state;
1651 unsigned long hw_flags; 1649 unsigned long hw_flags;
1652 1650
@@ -1661,6 +1659,10 @@ static void ql_link_state_machine(struct ql3_adapter *qdev)
1661 "state.\n", qdev->ndev->name); 1659 "state.\n", qdev->ndev->name);
1662 1660
1663 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); 1661 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
1662
1663 /* Restart timer on 2 second interval. */
1664 mod_timer(&qdev->adapter_timer, jiffies + HZ * 1);\
1665
1664 return; 1666 return;
1665 } 1667 }
1666 1668
@@ -1705,6 +1707,9 @@ static void ql_link_state_machine(struct ql3_adapter *qdev)
1705 break; 1707 break;
1706 } 1708 }
1707 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); 1709 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
1710
1711 /* Restart timer on 2 second interval. */
1712 mod_timer(&qdev->adapter_timer, jiffies + HZ * 1);
1708} 1713}
1709 1714
1710/* 1715/*
@@ -3941,19 +3946,7 @@ static void ql_get_board_info(struct ql3_adapter *qdev)
3941static void ql3xxx_timer(unsigned long ptr) 3946static void ql3xxx_timer(unsigned long ptr)
3942{ 3947{
3943 struct ql3_adapter *qdev = (struct ql3_adapter *)ptr; 3948 struct ql3_adapter *qdev = (struct ql3_adapter *)ptr;
3944 3949 queue_delayed_work(qdev->workqueue, &qdev->link_state_work, 0);
3945 if (test_bit(QL_RESET_ACTIVE,&qdev->flags)) {
3946 printk(KERN_DEBUG PFX
3947 "%s: Reset in progress.\n",
3948 qdev->ndev->name);
3949 goto end;
3950 }
3951
3952 ql_link_state_machine(qdev);
3953
3954 /* Restart timer on 2 second interval. */
3955end:
3956 mod_timer(&qdev->adapter_timer, jiffies + HZ * 1);
3957} 3950}
3958 3951
3959static int __devinit ql3xxx_probe(struct pci_dev *pdev, 3952static int __devinit ql3xxx_probe(struct pci_dev *pdev,
@@ -4103,6 +4096,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
4103 qdev->workqueue = create_singlethread_workqueue(ndev->name); 4096 qdev->workqueue = create_singlethread_workqueue(ndev->name);
4104 INIT_DELAYED_WORK(&qdev->reset_work, ql_reset_work); 4097 INIT_DELAYED_WORK(&qdev->reset_work, ql_reset_work);
4105 INIT_DELAYED_WORK(&qdev->tx_timeout_work, ql_tx_timeout_work); 4098 INIT_DELAYED_WORK(&qdev->tx_timeout_work, ql_tx_timeout_work);
4099 INIT_DELAYED_WORK(&qdev->link_state_work, ql_link_state_machine_work);
4106 4100
4107 init_timer(&qdev->adapter_timer); 4101 init_timer(&qdev->adapter_timer);
4108 qdev->adapter_timer.function = ql3xxx_timer; 4102 qdev->adapter_timer.function = ql3xxx_timer;
diff --git a/drivers/net/qla3xxx.h b/drivers/net/qla3xxx.h
index fbcb0b949639..d0ffb30ef371 100644
--- a/drivers/net/qla3xxx.h
+++ b/drivers/net/qla3xxx.h
@@ -1286,6 +1286,7 @@ struct ql3_adapter {
1286 struct workqueue_struct *workqueue; 1286 struct workqueue_struct *workqueue;
1287 struct delayed_work reset_work; 1287 struct delayed_work reset_work;
1288 struct delayed_work tx_timeout_work; 1288 struct delayed_work tx_timeout_work;
1289 struct delayed_work link_state_work;
1289 u32 max_frame_size; 1290 u32 max_frame_size;
1290 u32 device_id; 1291 u32 device_id;
1291 u16 phyType; 1292 u16 phyType;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index e8960f294a6e..1f647b9ce352 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -171,6 +171,8 @@ static struct pci_device_id rtl8169_pci_tbl[] = {
171 { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 }, 171 { PCI_DEVICE(0x16ec, 0x0116), 0, 0, RTL_CFG_0 },
172 { PCI_VENDOR_ID_LINKSYS, 0x1032, 172 { PCI_VENDOR_ID_LINKSYS, 0x1032,
173 PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 }, 173 PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 },
174 { 0x0001, 0x8168,
175 PCI_ANY_ID, 0x2410, 0, 0, RTL_CFG_2 },
174 {0,}, 176 {0,},
175}; 177};
176 178
@@ -392,7 +394,9 @@ struct rtl8169_private {
392 void __iomem *mmio_addr; /* memory map physical address */ 394 void __iomem *mmio_addr; /* memory map physical address */
393 struct pci_dev *pci_dev; /* Index of PCI device */ 395 struct pci_dev *pci_dev; /* Index of PCI device */
394 struct net_device *dev; 396 struct net_device *dev;
397#ifdef CONFIG_R8169_NAPI
395 struct napi_struct napi; 398 struct napi_struct napi;
399#endif
396 spinlock_t lock; /* spin lock flag */ 400 spinlock_t lock; /* spin lock flag */
397 u32 msg_enable; 401 u32 msg_enable;
398 int chipset; 402 int chipset;
@@ -466,7 +470,7 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value)
466{ 470{
467 int i; 471 int i;
468 472
469 RTL_W32(PHYAR, 0x80000000 | (reg_addr & 0xFF) << 16 | value); 473 RTL_W32(PHYAR, 0x80000000 | (reg_addr & 0x1f) << 16 | (value & 0xffff));
470 474
471 for (i = 20; i > 0; i--) { 475 for (i = 20; i > 0; i--) {
472 /* 476 /*
@@ -483,7 +487,7 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr)
483{ 487{
484 int i, value = -1; 488 int i, value = -1;
485 489
486 RTL_W32(PHYAR, 0x0 | (reg_addr & 0xFF) << 16); 490 RTL_W32(PHYAR, 0x0 | (reg_addr & 0x1f) << 16);
487 491
488 for (i = 20; i > 0; i--) { 492 for (i = 20; i > 0; i--) {
489 /* 493 /*
@@ -491,7 +495,7 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr)
491 * the specified MII register. 495 * the specified MII register.
492 */ 496 */
493 if (RTL_R32(PHYAR) & 0x80000000) { 497 if (RTL_R32(PHYAR) & 0x80000000) {
494 value = (int) (RTL_R32(PHYAR) & 0xFFFF); 498 value = RTL_R32(PHYAR) & 0xffff;
495 break; 499 break;
496 } 500 }
497 udelay(25); 501 udelay(25);
@@ -1243,16 +1247,6 @@ static void rtl8169sb_hw_phy_config(void __iomem *ioaddr)
1243 1247
1244 rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); 1248 rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
1245} 1249}
1246static void rtl8168b_hw_phy_config(void __iomem *ioaddr)
1247{
1248 struct phy_reg phy_reg_init[] = {
1249 { 0x1f, 0x0000 },
1250 { 0x10, 0xf41b },
1251 { 0x1f, 0x0000 }
1252 };
1253
1254 rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init));
1255}
1256 1250
1257static void rtl8168cp_hw_phy_config(void __iomem *ioaddr) 1251static void rtl8168cp_hw_phy_config(void __iomem *ioaddr)
1258{ 1252{
@@ -1322,11 +1316,6 @@ static void rtl_hw_phy_config(struct net_device *dev)
1322 case RTL_GIGA_MAC_VER_04: 1316 case RTL_GIGA_MAC_VER_04:
1323 rtl8169sb_hw_phy_config(ioaddr); 1317 rtl8169sb_hw_phy_config(ioaddr);
1324 break; 1318 break;
1325 case RTL_GIGA_MAC_VER_11:
1326 case RTL_GIGA_MAC_VER_12:
1327 case RTL_GIGA_MAC_VER_17:
1328 rtl8168b_hw_phy_config(ioaddr);
1329 break;
1330 case RTL_GIGA_MAC_VER_18: 1319 case RTL_GIGA_MAC_VER_18:
1331 rtl8168cp_hw_phy_config(ioaddr); 1320 rtl8168cp_hw_phy_config(ioaddr);
1332 break; 1321 break;
@@ -1737,7 +1726,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1737 tp->features |= rtl_try_msi(pdev, ioaddr, cfg); 1726 tp->features |= rtl_try_msi(pdev, ioaddr, cfg);
1738 RTL_W8(Cfg9346, Cfg9346_Lock); 1727 RTL_W8(Cfg9346, Cfg9346_Lock);
1739 1728
1740 if (RTL_R8(PHYstatus) & TBI_Enable) { 1729 if ((tp->mac_version <= RTL_GIGA_MAC_VER_06) &&
1730 (RTL_R8(PHYstatus) & TBI_Enable)) {
1741 tp->set_speed = rtl8169_set_speed_tbi; 1731 tp->set_speed = rtl8169_set_speed_tbi;
1742 tp->get_settings = rtl8169_gset_tbi; 1732 tp->get_settings = rtl8169_gset_tbi;
1743 tp->phy_reset_enable = rtl8169_tbi_reset_enable; 1733 tp->phy_reset_enable = rtl8169_tbi_reset_enable;
@@ -2989,13 +2979,16 @@ static void rtl8169_down(struct net_device *dev)
2989{ 2979{
2990 struct rtl8169_private *tp = netdev_priv(dev); 2980 struct rtl8169_private *tp = netdev_priv(dev);
2991 void __iomem *ioaddr = tp->mmio_addr; 2981 void __iomem *ioaddr = tp->mmio_addr;
2992 unsigned int poll_locked = 0;
2993 unsigned int intrmask; 2982 unsigned int intrmask;
2994 2983
2995 rtl8169_delete_timer(dev); 2984 rtl8169_delete_timer(dev);
2996 2985
2997 netif_stop_queue(dev); 2986 netif_stop_queue(dev);
2998 2987
2988#ifdef CONFIG_R8169_NAPI
2989 napi_disable(&tp->napi);
2990#endif
2991
2999core_down: 2992core_down:
3000 spin_lock_irq(&tp->lock); 2993 spin_lock_irq(&tp->lock);
3001 2994
@@ -3009,11 +3002,6 @@ core_down:
3009 3002
3010 synchronize_irq(dev->irq); 3003 synchronize_irq(dev->irq);
3011 3004
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. */ 3005 /* Give a racing hard_start_xmit a few cycles to complete. */
3018 synchronize_sched(); /* FIXME: should this be synchronize_irq()? */ 3006 synchronize_sched(); /* FIXME: should this be synchronize_irq()? */
3019 3007
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index b822859c8de3..73a7e6529ee0 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -78,12 +78,6 @@ static char version[] __devinitdata = "rrunner.c: v0.50 11/11/2002 Jes Sorensen
78 * stack will need to know about I/O vectors or something similar. 78 * stack will need to know about I/O vectors or something similar.
79 */ 79 */
80 80
81/*
82 * sysctl_[wr]mem_max are checked at init time to see if they are at
83 * least 256KB and increased to 256KB if they are not. This is done to
84 * avoid ending up with socket buffers smaller than the MTU size,
85 */
86
87static int __devinit rr_init_one(struct pci_dev *pdev, 81static int __devinit rr_init_one(struct pci_dev *pdev,
88 const struct pci_device_id *ent) 82 const struct pci_device_id *ent)
89{ 83{
@@ -561,18 +555,6 @@ static int __devinit rr_init(struct net_device *dev)
561 sram_size = rr_read_eeprom_word(rrpriv, (void *)8); 555 sram_size = rr_read_eeprom_word(rrpriv, (void *)8);
562 printk(" SRAM size 0x%06x\n", sram_size); 556 printk(" SRAM size 0x%06x\n", sram_size);
563 557
564 if (sysctl_rmem_max < 262144){
565 printk(" Receive socket buffer limit too low (%i), "
566 "setting to 262144\n", sysctl_rmem_max);
567 sysctl_rmem_max = 262144;
568 }
569
570 if (sysctl_wmem_max < 262144){
571 printk(" Transmit socket buffer limit too low (%i), "
572 "setting to 262144\n", sysctl_wmem_max);
573 sysctl_wmem_max = 262144;
574 }
575
576 return 0; 558 return 0;
577} 559}
578 560
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index b8c0e7b4ca1c..632666706247 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -84,7 +84,7 @@
84#include "s2io.h" 84#include "s2io.h"
85#include "s2io-regs.h" 85#include "s2io-regs.h"
86 86
87#define DRV_VERSION "2.0.26.5" 87#define DRV_VERSION "2.0.26.6"
88 88
89/* S2io Driver name & version. */ 89/* S2io Driver name & version. */
90static char s2io_driver_name[] = "Neterion"; 90static char s2io_driver_name[] = "Neterion";
@@ -3775,6 +3775,40 @@ static int __devinit s2io_test_msi(struct s2io_nic *sp)
3775 3775
3776 return err; 3776 return err;
3777} 3777}
3778
3779static void remove_msix_isr(struct s2io_nic *sp)
3780{
3781 int i;
3782 u16 msi_control;
3783
3784 for (i = 0; i < MAX_REQUESTED_MSI_X; i++) {
3785 if (sp->s2io_entries[i].in_use ==
3786 MSIX_REGISTERED_SUCCESS) {
3787 int vector = sp->entries[i].vector;
3788 void *arg = sp->s2io_entries[i].arg;
3789 free_irq(vector, arg);
3790 }
3791 }
3792
3793 kfree(sp->entries);
3794 kfree(sp->s2io_entries);
3795 sp->entries = NULL;
3796 sp->s2io_entries = NULL;
3797
3798 pci_read_config_word(sp->pdev, 0x42, &msi_control);
3799 msi_control &= 0xFFFE; /* Disable MSI */
3800 pci_write_config_word(sp->pdev, 0x42, msi_control);
3801
3802 pci_disable_msix(sp->pdev);
3803}
3804
3805static void remove_inta_isr(struct s2io_nic *sp)
3806{
3807 struct net_device *dev = sp->dev;
3808
3809 free_irq(sp->pdev->irq, dev);
3810}
3811
3778/* ********************************************************* * 3812/* ********************************************************* *
3779 * Functions defined below concern the OS part of the driver * 3813 * Functions defined below concern the OS part of the driver *
3780 * ********************************************************* */ 3814 * ********************************************************* */
@@ -3809,28 +3843,9 @@ static int s2io_open(struct net_device *dev)
3809 int ret = s2io_enable_msi_x(sp); 3843 int ret = s2io_enable_msi_x(sp);
3810 3844
3811 if (!ret) { 3845 if (!ret) {
3812 u16 msi_control;
3813
3814 ret = s2io_test_msi(sp); 3846 ret = s2io_test_msi(sp);
3815
3816 /* rollback MSI-X, will re-enable during add_isr() */ 3847 /* rollback MSI-X, will re-enable during add_isr() */
3817 kfree(sp->entries); 3848 remove_msix_isr(sp);
3818 sp->mac_control.stats_info->sw_stat.mem_freed +=
3819 (MAX_REQUESTED_MSI_X *
3820 sizeof(struct msix_entry));
3821 kfree(sp->s2io_entries);
3822 sp->mac_control.stats_info->sw_stat.mem_freed +=
3823 (MAX_REQUESTED_MSI_X *
3824 sizeof(struct s2io_msix_entry));
3825 sp->entries = NULL;
3826 sp->s2io_entries = NULL;
3827
3828 pci_read_config_word(sp->pdev, 0x42, &msi_control);
3829 msi_control &= 0xFFFE; /* Disable MSI */
3830 pci_write_config_word(sp->pdev, 0x42, msi_control);
3831
3832 pci_disable_msix(sp->pdev);
3833
3834 } 3849 }
3835 if (ret) { 3850 if (ret) {
3836 3851
@@ -6719,15 +6734,22 @@ static int s2io_add_isr(struct s2io_nic * sp)
6719 } 6734 }
6720 } 6735 }
6721 if (err) { 6736 if (err) {
6737 remove_msix_isr(sp);
6722 DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " 6738 DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration "
6723 "failed\n", dev->name, i); 6739 "failed\n", dev->name, i);
6724 DBG_PRINT(ERR_DBG, "Returned: %d\n", err); 6740 DBG_PRINT(ERR_DBG, "%s: defaulting to INTA\n",
6725 return -1; 6741 dev->name);
6742 sp->config.intr_type = INTA;
6743 break;
6726 } 6744 }
6727 sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; 6745 sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS;
6728 } 6746 }
6729 printk("MSI-X-TX %d entries enabled\n",msix_tx_cnt); 6747 if (!err) {
6730 printk("MSI-X-RX %d entries enabled\n",msix_rx_cnt); 6748 printk(KERN_INFO "MSI-X-TX %d entries enabled\n",
6749 msix_tx_cnt);
6750 printk(KERN_INFO "MSI-X-RX %d entries enabled\n",
6751 msix_rx_cnt);
6752 }
6731 } 6753 }
6732 if (sp->config.intr_type == INTA) { 6754 if (sp->config.intr_type == INTA) {
6733 err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, 6755 err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED,
@@ -6742,40 +6764,10 @@ static int s2io_add_isr(struct s2io_nic * sp)
6742} 6764}
6743static void s2io_rem_isr(struct s2io_nic * sp) 6765static void s2io_rem_isr(struct s2io_nic * sp)
6744{ 6766{
6745 struct net_device *dev = sp->dev; 6767 if (sp->config.intr_type == MSI_X)
6746 struct swStat *stats = &sp->mac_control.stats_info->sw_stat; 6768 remove_msix_isr(sp);
6747 6769 else
6748 if (sp->config.intr_type == MSI_X) { 6770 remove_inta_isr(sp);
6749 int i;
6750 u16 msi_control;
6751
6752 for (i=1; (sp->s2io_entries[i].in_use ==
6753 MSIX_REGISTERED_SUCCESS); i++) {
6754 int vector = sp->entries[i].vector;
6755 void *arg = sp->s2io_entries[i].arg;
6756
6757 synchronize_irq(vector);
6758 free_irq(vector, arg);
6759 }
6760
6761 kfree(sp->entries);
6762 stats->mem_freed +=
6763 (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry));
6764 kfree(sp->s2io_entries);
6765 stats->mem_freed +=
6766 (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry));
6767 sp->entries = NULL;
6768 sp->s2io_entries = NULL;
6769
6770 pci_read_config_word(sp->pdev, 0x42, &msi_control);
6771 msi_control &= 0xFFFE; /* Disable MSI */
6772 pci_write_config_word(sp->pdev, 0x42, msi_control);
6773
6774 pci_disable_msix(sp->pdev);
6775 } else {
6776 synchronize_irq(sp->pdev->irq);
6777 free_irq(sp->pdev->irq, dev);
6778 }
6779} 6771}
6780 6772
6781static void do_s2io_card_down(struct s2io_nic * sp, int do_io) 6773static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index b9961dc47606..6d62250fba07 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2512,31 +2512,32 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2512 return err; 2512 return err;
2513} 2513}
2514 2514
2515/* Assign Ram Buffer allocation to queue */ 2515static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, size_t len)
2516static void skge_ramset(struct skge_hw *hw, u16 q, u32 start, u32 space)
2517{ 2516{
2518 u32 end; 2517 u32 end;
2519 2518
2520 /* convert from K bytes to qwords used for hw register */ 2519 start /= 8;
2521 start *= 1024/8; 2520 len /= 8;
2522 space *= 1024/8; 2521 end = start + len - 1;
2523 end = start + space - 1;
2524 2522
2525 skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR); 2523 skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_RST_CLR);
2526 skge_write32(hw, RB_ADDR(q, RB_START), start); 2524 skge_write32(hw, RB_ADDR(q, RB_START), start);
2527 skge_write32(hw, RB_ADDR(q, RB_END), end);
2528 skge_write32(hw, RB_ADDR(q, RB_WP), start); 2525 skge_write32(hw, RB_ADDR(q, RB_WP), start);
2529 skge_write32(hw, RB_ADDR(q, RB_RP), start); 2526 skge_write32(hw, RB_ADDR(q, RB_RP), start);
2527 skge_write32(hw, RB_ADDR(q, RB_END), end);
2530 2528
2531 if (q == Q_R1 || q == Q_R2) { 2529 if (q == Q_R1 || q == Q_R2) {
2532 u32 tp = space - space/4;
2533
2534 /* Set thresholds on receive queue's */ 2530 /* Set thresholds on receive queue's */
2535 skge_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); 2531 skge_write32(hw, RB_ADDR(q, RB_RX_UTPP),
2536 skge_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); 2532 start + (2*len)/3);
2537 } else if (hw->chip_id != CHIP_ID_GENESIS) 2533 skge_write32(hw, RB_ADDR(q, RB_RX_LTPP),
2538 /* Genesis Tx Fifo is too small for normal store/forward */ 2534 start + (len/3));
2535 } else {
2536 /* Enable store & forward on Tx queue's because
2537 * Tx FIFO is only 4K on Genesis and 1K on Yukon
2538 */
2539 skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_STFWD); 2539 skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_STFWD);
2540 }
2540 2541
2541 skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_OP_MD); 2542 skge_write8(hw, RB_ADDR(q, RB_CTRL), RB_ENA_OP_MD);
2542} 2543}
@@ -2564,7 +2565,7 @@ static int skge_up(struct net_device *dev)
2564 struct skge_port *skge = netdev_priv(dev); 2565 struct skge_port *skge = netdev_priv(dev);
2565 struct skge_hw *hw = skge->hw; 2566 struct skge_hw *hw = skge->hw;
2566 int port = skge->port; 2567 int port = skge->port;
2567 u32 ramaddr, ramsize, rxspace; 2568 u32 chunk, ram_addr;
2568 size_t rx_size, tx_size; 2569 size_t rx_size, tx_size;
2569 int err; 2570 int err;
2570 2571
@@ -2619,15 +2620,14 @@ static int skge_up(struct net_device *dev)
2619 spin_unlock_bh(&hw->phy_lock); 2620 spin_unlock_bh(&hw->phy_lock);
2620 2621
2621 /* Configure RAMbuffers */ 2622 /* Configure RAMbuffers */
2622 ramsize = (hw->ram_size - hw->ram_offset) / hw->ports; 2623 chunk = hw->ram_size / ((hw->ports + 1)*2);
2623 ramaddr = hw->ram_offset + port * ramsize; 2624 ram_addr = hw->ram_offset + 2 * chunk * port;
2624 rxspace = 8 + (2*(ramsize - 16))/3;
2625
2626 skge_ramset(hw, rxqaddr[port], ramaddr, rxspace);
2627 skge_ramset(hw, txqaddr[port], ramaddr + rxspace, ramsize - rxspace);
2628 2625
2626 skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
2629 skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean); 2627 skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean);
2628
2630 BUG_ON(skge->tx_ring.to_use != skge->tx_ring.to_clean); 2629 BUG_ON(skge->tx_ring.to_use != skge->tx_ring.to_clean);
2630 skge_ramset(hw, txqaddr[port], ram_addr+chunk, chunk);
2631 skge_qset(skge, txqaddr[port], skge->tx_ring.to_use); 2631 skge_qset(skge, txqaddr[port], skge->tx_ring.to_use);
2632 2632
2633 /* Start receiver BMU */ 2633 /* Start receiver BMU */
@@ -3591,12 +3591,15 @@ static int skge_reset(struct skge_hw *hw)
3591 if (hw->chip_id == CHIP_ID_GENESIS) { 3591 if (hw->chip_id == CHIP_ID_GENESIS) {
3592 if (t8 == 3) { 3592 if (t8 == 3) {
3593 /* special case: 4 x 64k x 36, offset = 0x80000 */ 3593 /* special case: 4 x 64k x 36, offset = 0x80000 */
3594 hw->ram_size = 1024; 3594 hw->ram_size = 0x100000;
3595 hw->ram_offset = 512; 3595 hw->ram_offset = 0x80000;
3596 } else 3596 } else
3597 hw->ram_size = t8 * 512; 3597 hw->ram_size = t8 * 512;
3598 } else /* Yukon */ 3598 }
3599 hw->ram_size = t8 ? t8 * 4 : 128; 3599 else if (t8 == 0)
3600 hw->ram_size = 0x20000;
3601 else
3602 hw->ram_size = t8 * 4096;
3600 3603
3601 hw->intr_mask = IS_HW_ERR; 3604 hw->intr_mask = IS_HW_ERR;
3602 3605
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index c27c7d63b6a5..a2070db725c9 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -52,7 +52,7 @@
52#include "sky2.h" 52#include "sky2.h"
53 53
54#define DRV_NAME "sky2" 54#define DRV_NAME "sky2"
55#define DRV_VERSION "1.19" 55#define DRV_VERSION "1.20"
56#define PFX DRV_NAME " " 56#define PFX DRV_NAME " "
57 57
58/* 58/*
@@ -121,6 +121,7 @@ static const struct pci_device_id sky2_id_table[] = {
121 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */ 121 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */
122 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */ 122 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */
123 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */ 123 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */
124 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4357) }, /* 88E8042 */
124 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */ 125 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */
125 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */ 126 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */
126 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ 127 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */
@@ -134,6 +135,7 @@ static const struct pci_device_id sky2_id_table[] = {
134 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4369) }, /* 88EC042 */ 135 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4369) }, /* 88EC042 */
135 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436A) }, /* 88E8058 */ 136 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436A) }, /* 88E8058 */
136 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436B) }, /* 88E8071 */ 137 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436B) }, /* 88E8071 */
138 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436C) }, /* 88E8072 */
137 { 0 } 139 { 0 }
138}; 140};
139 141
@@ -156,7 +158,7 @@ static const char *yukon2_name[] = {
156 158
157static void sky2_set_multicast(struct net_device *dev); 159static void sky2_set_multicast(struct net_device *dev);
158 160
159/* Access to external PHY */ 161/* Access to PHY via serial interconnect */
160static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val) 162static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val)
161{ 163{
162 int i; 164 int i;
@@ -166,13 +168,22 @@ static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val)
166 GM_SMI_CT_PHY_AD(PHY_ADDR_MARV) | GM_SMI_CT_REG_AD(reg)); 168 GM_SMI_CT_PHY_AD(PHY_ADDR_MARV) | GM_SMI_CT_REG_AD(reg));
167 169
168 for (i = 0; i < PHY_RETRIES; i++) { 170 for (i = 0; i < PHY_RETRIES; i++) {
169 if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY)) 171 u16 ctrl = gma_read16(hw, port, GM_SMI_CTRL);
172 if (ctrl == 0xffff)
173 goto io_error;
174
175 if (!(ctrl & GM_SMI_CT_BUSY))
170 return 0; 176 return 0;
171 udelay(1); 177
178 udelay(10);
172 } 179 }
173 180
174 printk(KERN_WARNING PFX "%s: phy write timeout\n", hw->dev[port]->name); 181 dev_warn(&hw->pdev->dev,"%s: phy write timeout\n", hw->dev[port]->name);
175 return -ETIMEDOUT; 182 return -ETIMEDOUT;
183
184io_error:
185 dev_err(&hw->pdev->dev, "%s: phy I/O error\n", hw->dev[port]->name);
186 return -EIO;
176} 187}
177 188
178static int __gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg, u16 *val) 189static int __gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg, u16 *val)
@@ -183,23 +194,29 @@ static int __gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg, u16 *val)
183 | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD); 194 | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD);
184 195
185 for (i = 0; i < PHY_RETRIES; i++) { 196 for (i = 0; i < PHY_RETRIES; i++) {
186 if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) { 197 u16 ctrl = gma_read16(hw, port, GM_SMI_CTRL);
198 if (ctrl == 0xffff)
199 goto io_error;
200
201 if (ctrl & GM_SMI_CT_RD_VAL) {
187 *val = gma_read16(hw, port, GM_SMI_DATA); 202 *val = gma_read16(hw, port, GM_SMI_DATA);
188 return 0; 203 return 0;
189 } 204 }
190 205
191 udelay(1); 206 udelay(10);
192 } 207 }
193 208
209 dev_warn(&hw->pdev->dev, "%s: phy read timeout\n", hw->dev[port]->name);
194 return -ETIMEDOUT; 210 return -ETIMEDOUT;
211io_error:
212 dev_err(&hw->pdev->dev, "%s: phy I/O error\n", hw->dev[port]->name);
213 return -EIO;
195} 214}
196 215
197static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) 216static inline u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
198{ 217{
199 u16 v; 218 u16 v;
200 219 __gm_phy_read(hw, port, reg, &v);
201 if (__gm_phy_read(hw, port, reg, &v) != 0)
202 printk(KERN_WARNING PFX "%s: phy read timeout\n", hw->dev[port]->name);
203 return v; 220 return v;
204} 221}
205 222
@@ -273,8 +290,6 @@ static void sky2_gmac_reset(struct sky2_hw *hw, unsigned port)
273 290
274 /* disable all GMAC IRQ's */ 291 /* disable all GMAC IRQ's */
275 sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); 292 sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);
276 /* disable PHY IRQs */
277 gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);
278 293
279 gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */ 294 gma_write16(hw, port, GM_MC_ADDR_H1, 0); /* clear MC hash */
280 gma_write16(hw, port, GM_MC_ADDR_H2, 0); 295 gma_write16(hw, port, GM_MC_ADDR_H2, 0);
@@ -1805,29 +1820,6 @@ static void sky2_link_up(struct sky2_port *sky2)
1805 sky2_write8(hw, SK_REG(port, LNK_LED_REG), 1820 sky2_write8(hw, SK_REG(port, LNK_LED_REG),
1806 LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF); 1821 LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF);
1807 1822
1808 if (hw->flags & SKY2_HW_NEWER_PHY) {
1809 u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
1810 u16 led = PHY_M_LEDC_LOS_CTRL(1); /* link active */
1811
1812 switch(sky2->speed) {
1813 case SPEED_10:
1814 led |= PHY_M_LEDC_INIT_CTRL(7);
1815 break;
1816
1817 case SPEED_100:
1818 led |= PHY_M_LEDC_STA1_CTRL(7);
1819 break;
1820
1821 case SPEED_1000:
1822 led |= PHY_M_LEDC_STA0_CTRL(7);
1823 break;
1824 }
1825
1826 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
1827 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, led);
1828 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
1829 }
1830
1831 if (netif_msg_link(sky2)) 1823 if (netif_msg_link(sky2))
1832 printk(KERN_INFO PFX 1824 printk(KERN_INFO PFX
1833 "%s: Link is up at %d Mbps, %s duplex, flow control %s\n", 1825 "%s: Link is up at %d Mbps, %s duplex, flow control %s\n",
@@ -2247,20 +2239,26 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2247 do { 2239 do {
2248 struct sky2_port *sky2; 2240 struct sky2_port *sky2;
2249 struct sky2_status_le *le = hw->st_le + hw->st_idx; 2241 struct sky2_status_le *le = hw->st_le + hw->st_idx;
2250 unsigned port = le->css & CSS_LINK_BIT; 2242 unsigned port;
2251 struct net_device *dev; 2243 struct net_device *dev;
2252 struct sk_buff *skb; 2244 struct sk_buff *skb;
2253 u32 status; 2245 u32 status;
2254 u16 length; 2246 u16 length;
2247 u8 opcode = le->opcode;
2248
2249 if (!(opcode & HW_OWNER))
2250 break;
2255 2251
2256 hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE); 2252 hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE);
2257 2253
2254 port = le->css & CSS_LINK_BIT;
2258 dev = hw->dev[port]; 2255 dev = hw->dev[port];
2259 sky2 = netdev_priv(dev); 2256 sky2 = netdev_priv(dev);
2260 length = le16_to_cpu(le->length); 2257 length = le16_to_cpu(le->length);
2261 status = le32_to_cpu(le->status); 2258 status = le32_to_cpu(le->status);
2262 2259
2263 switch (le->opcode & ~HW_OWNER) { 2260 le->opcode = 0;
2261 switch (opcode & ~HW_OWNER) {
2264 case OP_RXSTAT: 2262 case OP_RXSTAT:
2265 ++rx[port]; 2263 ++rx[port];
2266 skb = sky2_receive(dev, length, status); 2264 skb = sky2_receive(dev, length, status);
@@ -2353,7 +2351,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2353 default: 2351 default:
2354 if (net_ratelimit()) 2352 if (net_ratelimit())
2355 printk(KERN_WARNING PFX 2353 printk(KERN_WARNING PFX
2356 "unknown status opcode 0x%x\n", le->opcode); 2354 "unknown status opcode 0x%x\n", opcode);
2357 } 2355 }
2358 } while (hw->st_idx != idx); 2356 } while (hw->st_idx != idx);
2359 2357
@@ -2439,13 +2437,26 @@ static void sky2_hw_intr(struct sky2_hw *hw)
2439 2437
2440 if (status & Y2_IS_PCI_EXP) { 2438 if (status & Y2_IS_PCI_EXP) {
2441 /* PCI-Express uncorrectable Error occurred */ 2439 /* PCI-Express uncorrectable Error occurred */
2442 int pos = pci_find_aer_capability(hw->pdev); 2440 int aer = pci_find_aer_capability(hw->pdev);
2443 u32 err; 2441 u32 err;
2444 2442
2445 pci_read_config_dword(pdev, pos + PCI_ERR_UNCOR_STATUS, &err); 2443 if (aer) {
2444 pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS,
2445 &err);
2446 pci_cleanup_aer_uncorrect_error_status(pdev);
2447 } else {
2448 /* Either AER not configured, or not working
2449 * because of bad MMCONFIG, so just do recover
2450 * manually.
2451 */
2452 err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
2453 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2454 0xfffffffful);
2455 }
2456
2446 if (net_ratelimit()) 2457 if (net_ratelimit())
2447 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); 2458 dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err);
2448 pci_cleanup_aer_uncorrect_error_status(pdev); 2459
2449 } 2460 }
2450 2461
2451 if (status & Y2_HWE_L1_MASK) 2462 if (status & Y2_HWE_L1_MASK)
@@ -2791,6 +2802,9 @@ static void sky2_reset(struct sky2_hw *hw)
2791 sky2_write8(hw, B0_CTST, CS_RST_SET); 2802 sky2_write8(hw, B0_CTST, CS_RST_SET);
2792 sky2_write8(hw, B0_CTST, CS_RST_CLR); 2803 sky2_write8(hw, B0_CTST, CS_RST_CLR);
2793 2804
2805 /* allow writes to PCI config */
2806 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
2807
2794 /* clear PCI errors, if any */ 2808 /* clear PCI errors, if any */
2795 pci_read_config_word(pdev, PCI_STATUS, &status); 2809 pci_read_config_word(pdev, PCI_STATUS, &status);
2796 status |= PCI_STATUS_ERROR_BITS; 2810 status |= PCI_STATUS_ERROR_BITS;
@@ -2800,9 +2814,18 @@ static void sky2_reset(struct sky2_hw *hw)
2800 2814
2801 cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); 2815 cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
2802 if (cap) { 2816 if (cap) {
2803 /* Check for advanced error reporting */ 2817 if (pci_find_aer_capability(pdev)) {
2804 pci_cleanup_aer_uncorrect_error_status(pdev); 2818 /* Check for advanced error reporting */
2805 pci_cleanup_aer_correct_error_status(pdev); 2819 pci_cleanup_aer_uncorrect_error_status(pdev);
2820 pci_cleanup_aer_correct_error_status(pdev);
2821 } else {
2822 dev_warn(&pdev->dev,
2823 "PCI Express Advanced Error Reporting"
2824 " not configured or MMCONFIG problem?\n");
2825
2826 sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
2827 0xfffffffful);
2828 }
2806 2829
2807 /* If error bit is stuck on ignore it */ 2830 /* If error bit is stuck on ignore it */
2808 if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP) 2831 if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP)
@@ -3974,7 +3997,8 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3974 dev->tx_timeout = sky2_tx_timeout; 3997 dev->tx_timeout = sky2_tx_timeout;
3975 dev->watchdog_timeo = TX_WATCHDOG; 3998 dev->watchdog_timeo = TX_WATCHDOG;
3976#ifdef CONFIG_NET_POLL_CONTROLLER 3999#ifdef CONFIG_NET_POLL_CONTROLLER
3977 dev->poll_controller = sky2_netpoll; 4000 if (port == 0)
4001 dev->poll_controller = sky2_netpoll;
3978#endif 4002#endif
3979 4003
3980 sky2 = netdev_priv(dev); 4004 sky2 = netdev_priv(dev);
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 49ee264064ab..69525fd7908d 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -247,7 +247,8 @@ enum csr_regs {
247 B3_PA_CTRL = 0x01f0, 247 B3_PA_CTRL = 0x01f0,
248 B3_PA_TEST = 0x01f2, 248 B3_PA_TEST = 0x01f2,
249 249
250 Y2_CFG_SPC = 0x1c00, 250 Y2_CFG_SPC = 0x1c00, /* PCI config space region */
251 Y2_CFG_AER = 0x1d00, /* PCI Advanced Error Report region */
251}; 252};
252 253
253/* B0_CTST 16 bit Control/Status register */ 254/* B0_CTST 16 bit Control/Status register */
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 335b7cc80eba..251a3ce376ac 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -1218,14 +1218,8 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1218 return 0; 1218 return 0;
1219 /* VSV changes end */ 1219 /* VSV changes end */
1220#endif 1220#endif
1221
1222 /* Allow stty to read, but not set, the serial port */
1223 case TCGETS:
1224 case TCGETA:
1225 return n_tty_ioctl(tty, file, cmd, arg);
1226
1227 default: 1221 default:
1228 return -ENOIOCTLCMD; 1222 return tty_mode_ioctl(tty, file, cmd, arg);
1229 } 1223 }
1230} 1224}
1231 1225
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 729fd28c08b5..db34e1eb67e9 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -224,6 +224,21 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
224 } 224 }
225} 225}
226 226
227#elif defined(CONFIG_MACH_ZYLONITE)
228
229#define SMC_CAN_USE_8BIT 1
230#define SMC_CAN_USE_16BIT 1
231#define SMC_CAN_USE_32BIT 0
232#define SMC_IO_SHIFT 0
233#define SMC_NOWAIT 1
234#define SMC_USE_PXA_DMA 1
235#define SMC_inb(a, r) readb((a) + (r))
236#define SMC_inw(a, r) readw((a) + (r))
237#define SMC_insw(a, r, p, l) insw((a) + (r), p, l)
238#define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l)
239#define SMC_outb(v, a, r) writeb(v, (a) + (r))
240#define SMC_outw(v, a, r) writew(v, (a) + (r))
241
227#elif defined(CONFIG_ARCH_OMAP) 242#elif defined(CONFIG_ARCH_OMAP)
228 243
229/* We can only do 16-bit reads and writes in the static memory space. */ 244/* We can only do 16-bit reads and writes in the static memory space. */
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 53b8344a68ef..f6fedcc32de1 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2333,10 +2333,10 @@ static int gem_close(struct net_device *dev)
2333{ 2333{
2334 struct gem *gp = dev->priv; 2334 struct gem *gp = dev->priv;
2335 2335
2336 napi_disable(&gp->napi);
2337
2338 mutex_lock(&gp->pm_mutex); 2336 mutex_lock(&gp->pm_mutex);
2339 2337
2338 napi_disable(&gp->napi);
2339
2340 gp->opened = 0; 2340 gp->opened = 0;
2341 if (!gp->asleep) 2341 if (!gp->asleep)
2342 gem_do_stop(dev, 0); 2342 gem_do_stop(dev, 0);
@@ -2355,8 +2355,6 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2355 2355
2356 mutex_lock(&gp->pm_mutex); 2356 mutex_lock(&gp->pm_mutex);
2357 2357
2358 napi_disable(&gp->napi);
2359
2360 printk(KERN_INFO "%s: suspending, WakeOnLan %s\n", 2358 printk(KERN_INFO "%s: suspending, WakeOnLan %s\n",
2361 dev->name, 2359 dev->name,
2362 (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled"); 2360 (gp->wake_on_lan && gp->opened) ? "enabled" : "disabled");
@@ -2370,6 +2368,8 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2370 2368
2371 /* If the driver is opened, we stop the MAC */ 2369 /* If the driver is opened, we stop the MAC */
2372 if (gp->opened) { 2370 if (gp->opened) {
2371 napi_disable(&gp->napi);
2372
2373 /* Stop traffic, mark us closed */ 2373 /* Stop traffic, mark us closed */
2374 netif_device_detach(dev); 2374 netif_device_detach(dev);
2375 2375
@@ -2460,6 +2460,7 @@ static int gem_resume(struct pci_dev *pdev)
2460 /* Re-attach net device */ 2460 /* Re-attach net device */
2461 netif_device_attach(dev); 2461 netif_device_attach(dev);
2462 2462
2463 napi_enable(&gp->napi);
2463 } 2464 }
2464 2465
2465 spin_lock_irqsave(&gp->lock, flags); 2466 spin_lock_irqsave(&gp->lock, flags);
@@ -2479,8 +2480,6 @@ static int gem_resume(struct pci_dev *pdev)
2479 spin_unlock(&gp->tx_lock); 2480 spin_unlock(&gp->tx_lock);
2480 spin_unlock_irqrestore(&gp->lock, flags); 2481 spin_unlock_irqrestore(&gp->lock, flags);
2481 2482
2482 napi_enable(&gp->napi);
2483
2484 mutex_unlock(&gp->pm_mutex); 2483 mutex_unlock(&gp->pm_mutex);
2485 2484
2486 return 0; 2485 return 0;
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 120c8affe83d..9cc13dd8a821 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -1281,7 +1281,7 @@ static void happy_meal_init_rings(struct happy_meal *hp)
1281 skb->dev = dev; 1281 skb->dev = dev;
1282 1282
1283 /* Because we reserve afterwards. */ 1283 /* Because we reserve afterwards. */
1284 skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET)); 1284 skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET + 4));
1285 hme_write_rxd(hp, &hb->happy_meal_rxd[i], 1285 hme_write_rxd(hp, &hb->happy_meal_rxd[i],
1286 (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), 1286 (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)),
1287 hme_dma_map(hp, skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE)); 1287 hme_dma_map(hp, skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE));
@@ -1700,6 +1700,11 @@ static int happy_meal_init(struct happy_meal *hp)
1700 HMD(("tx old[%08x] and rx [%08x] ON!\n", 1700 HMD(("tx old[%08x] and rx [%08x] ON!\n",
1701 hme_read32(hp, bregs + BMAC_TXCFG), 1701 hme_read32(hp, bregs + BMAC_TXCFG),
1702 hme_read32(hp, bregs + BMAC_RXCFG))); 1702 hme_read32(hp, bregs + BMAC_RXCFG)));
1703
1704 /* Set larger TX/RX size to allow for 802.1q */
1705 hme_write32(hp, bregs + BMAC_TXMAX, ETH_FRAME_LEN + 8);
1706 hme_write32(hp, bregs + BMAC_RXMAX, ETH_FRAME_LEN + 8);
1707
1703 hme_write32(hp, bregs + BMAC_TXCFG, 1708 hme_write32(hp, bregs + BMAC_TXCFG,
1704 hme_read32(hp, bregs + BMAC_TXCFG) | BIGMAC_TXCFG_ENABLE); 1709 hme_read32(hp, bregs + BMAC_TXCFG) | BIGMAC_TXCFG_ENABLE);
1705 hme_write32(hp, bregs + BMAC_RXCFG, 1710 hme_write32(hp, bregs + BMAC_RXCFG,
@@ -2039,7 +2044,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev)
2039 hme_dma_unmap(hp, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE); 2044 hme_dma_unmap(hp, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE);
2040 hp->rx_skbs[elem] = new_skb; 2045 hp->rx_skbs[elem] = new_skb;
2041 new_skb->dev = dev; 2046 new_skb->dev = dev;
2042 skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET)); 2047 skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4));
2043 hme_write_rxd(hp, this, 2048 hme_write_rxd(hp, this,
2044 (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), 2049 (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)),
2045 hme_dma_map(hp, new_skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE)); 2050 hme_dma_map(hp, new_skb->data, RX_BUF_ALLOC_SIZE, DMA_FROMDEVICE));
@@ -2809,8 +2814,8 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe
2809 dev->watchdog_timeo = 5*HZ; 2814 dev->watchdog_timeo = 5*HZ;
2810 dev->ethtool_ops = &hme_ethtool_ops; 2815 dev->ethtool_ops = &hme_ethtool_ops;
2811 2816
2812 /* Happy Meal can do it all... except VLAN. */ 2817 /* Happy Meal can do it all... */
2813 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_VLAN_CHALLENGED; 2818 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM;
2814 2819
2815 dev->irq = sdev->irqs[0]; 2820 dev->irq = sdev->irqs[0];
2816 2821
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 4e1b84e6d66a..21230c97b2a0 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -2168,10 +2168,10 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
2168{ 2168{
2169 struct bdx_priv *priv = netdev->priv; 2169 struct bdx_priv *priv = netdev->priv;
2170 2170
2171 strncat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); 2171 strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver));
2172 strncat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); 2172 strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version));
2173 strncat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); 2173 strlcat(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
2174 strncat(drvinfo->bus_info, pci_name(priv->pdev), 2174 strlcat(drvinfo->bus_info, pci_name(priv->pdev),
2175 sizeof(drvinfo->bus_info)); 2175 sizeof(drvinfo->bus_info));
2176 2176
2177 drvinfo->n_stats = ((priv->stats_flag) ? 2177 drvinfo->n_stats = ((priv->stats_flag) ?
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 09440d783e65..4942f7d18937 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.85" 67#define DRV_MODULE_VERSION "3.86"
68#define DRV_MODULE_RELDATE "October 18, 2007" 68#define DRV_MODULE_RELDATE "November 9, 2007"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -1106,6 +1106,24 @@ static int tg3_phy_reset(struct tg3 *tp)
1106 if (err) 1106 if (err)
1107 return err; 1107 return err;
1108 1108
1109 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
1110 u32 val;
1111
1112 val = tr32(TG3_CPMU_LSPD_1000MB_CLK);
1113 if ((val & CPMU_LSPD_1000MB_MACCLK_MASK) ==
1114 CPMU_LSPD_1000MB_MACCLK_12_5) {
1115 val &= ~CPMU_LSPD_1000MB_MACCLK_MASK;
1116 udelay(40);
1117 tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val);
1118 }
1119
1120 /* Disable GPHY autopowerdown. */
1121 tg3_writephy(tp, MII_TG3_MISC_SHDW,
1122 MII_TG3_MISC_SHDW_WREN |
1123 MII_TG3_MISC_SHDW_APD_SEL |
1124 MII_TG3_MISC_SHDW_APD_WKTM_84MS);
1125 }
1126
1109out: 1127out:
1110 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) { 1128 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) {
1111 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 1129 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
@@ -1297,6 +1315,8 @@ static void tg3_nvram_unlock(struct tg3 *);
1297 1315
1298static void tg3_power_down_phy(struct tg3 *tp) 1316static void tg3_power_down_phy(struct tg3 *tp)
1299{ 1317{
1318 u32 val;
1319
1300 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 1320 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {
1301 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { 1321 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
1302 u32 sg_dig_ctrl = tr32(SG_DIG_CTRL); 1322 u32 sg_dig_ctrl = tr32(SG_DIG_CTRL);
@@ -1311,8 +1331,6 @@ static void tg3_power_down_phy(struct tg3 *tp)
1311 } 1331 }
1312 1332
1313 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 1333 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
1314 u32 val;
1315
1316 tg3_bmcr_reset(tp); 1334 tg3_bmcr_reset(tp);
1317 val = tr32(GRC_MISC_CFG); 1335 val = tr32(GRC_MISC_CFG);
1318 tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ); 1336 tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ);
@@ -1332,6 +1350,14 @@ static void tg3_power_down_phy(struct tg3 *tp)
1332 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && 1350 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 &&
1333 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES))) 1351 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)))
1334 return; 1352 return;
1353
1354 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
1355 val = tr32(TG3_CPMU_LSPD_1000MB_CLK);
1356 val &= ~CPMU_LSPD_1000MB_MACCLK_MASK;
1357 val |= CPMU_LSPD_1000MB_MACCLK_12_5;
1358 tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val);
1359 }
1360
1335 tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); 1361 tg3_writephy(tp, MII_BMCR, BMCR_PDOWN);
1336} 1362}
1337 1363
@@ -3126,6 +3152,23 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
3126 err = tg3_setup_copper_phy(tp, force_reset); 3152 err = tg3_setup_copper_phy(tp, force_reset);
3127 } 3153 }
3128 3154
3155 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
3156 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) {
3157 u32 val, scale;
3158
3159 val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK;
3160 if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5)
3161 scale = 65;
3162 else if (val == CPMU_CLCK_STAT_MAC_CLCK_6_25)
3163 scale = 6;
3164 else
3165 scale = 12;
3166
3167 val = tr32(GRC_MISC_CFG) & ~GRC_MISC_CFG_PRESCALAR_MASK;
3168 val |= (scale << GRC_MISC_CFG_PRESCALAR_SHIFT);
3169 tw32(GRC_MISC_CFG, val);
3170 }
3171
3129 if (tp->link_config.active_speed == SPEED_1000 && 3172 if (tp->link_config.active_speed == SPEED_1000 &&
3130 tp->link_config.active_duplex == DUPLEX_HALF) 3173 tp->link_config.active_duplex == DUPLEX_HALF)
3131 tw32(MAC_TX_LENGTHS, 3174 tw32(MAC_TX_LENGTHS,
@@ -5054,12 +5097,15 @@ static void tg3_restore_pci_state(struct tg3 *tp)
5054 5097
5055 pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd); 5098 pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd);
5056 5099
5057 if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) { 5100 if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)
5101 pcie_set_readrq(tp->pdev, 4096);
5102 else {
5058 pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE, 5103 pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE,
5059 tp->pci_cacheline_sz); 5104 tp->pci_cacheline_sz);
5060 pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER, 5105 pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER,
5061 tp->pci_lat_timer); 5106 tp->pci_lat_timer);
5062 } 5107 }
5108
5063 /* Make sure PCI-X relaxed ordering bit is clear. */ 5109 /* Make sure PCI-X relaxed ordering bit is clear. */
5064 if (tp->pcix_cap) { 5110 if (tp->pcix_cap) {
5065 u16 pcix_cmd; 5111 u16 pcix_cmd;
@@ -6343,10 +6389,26 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6343 6389
6344 tg3_write_sig_legacy(tp, RESET_KIND_INIT); 6390 tg3_write_sig_legacy(tp, RESET_KIND_INIT);
6345 6391
6346 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0) { 6392 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
6393 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) {
6347 val = tr32(TG3_CPMU_CTRL); 6394 val = tr32(TG3_CPMU_CTRL);
6348 val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE); 6395 val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE);
6349 tw32(TG3_CPMU_CTRL, val); 6396 tw32(TG3_CPMU_CTRL, val);
6397
6398 val = tr32(TG3_CPMU_LSPD_10MB_CLK);
6399 val &= ~CPMU_LSPD_10MB_MACCLK_MASK;
6400 val |= CPMU_LSPD_10MB_MACCLK_6_25;
6401 tw32(TG3_CPMU_LSPD_10MB_CLK, val);
6402
6403 val = tr32(TG3_CPMU_LNK_AWARE_PWRMD);
6404 val &= ~CPMU_LNK_AWARE_MACCLK_MASK;
6405 val |= CPMU_LNK_AWARE_MACCLK_6_25;
6406 tw32(TG3_CPMU_LNK_AWARE_PWRMD, val);
6407
6408 val = tr32(TG3_CPMU_HST_ACC);
6409 val &= ~CPMU_HST_ACC_MACCLK_MASK;
6410 val |= CPMU_HST_ACC_MACCLK_6_25;
6411 tw32(TG3_CPMU_HST_ACC, val);
6350 } 6412 }
6351 6413
6352 /* This works around an issue with Athlon chipsets on 6414 /* This works around an issue with Athlon chipsets on
@@ -7365,10 +7427,6 @@ static int tg3_open(struct net_device *dev)
7365 } else if (pci_enable_msi(tp->pdev) == 0) { 7427 } else if (pci_enable_msi(tp->pdev) == 0) {
7366 u32 msi_mode; 7428 u32 msi_mode;
7367 7429
7368 /* Hardware bug - MSI won't work if INTX disabled. */
7369 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)
7370 pci_intx(tp->pdev, 1);
7371
7372 msi_mode = tr32(MSGINT_MODE); 7430 msi_mode = tr32(MSGINT_MODE);
7373 tw32(MSGINT_MODE, msi_mode | MSGINT_MODE_ENABLE); 7431 tw32(MSGINT_MODE, msi_mode | MSGINT_MODE_ENABLE);
7374 tp->tg3_flags2 |= TG3_FLG2_USING_MSI; 7432 tp->tg3_flags2 |= TG3_FLG2_USING_MSI;
@@ -8271,7 +8329,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
8271 SUPPORTED_100baseT_Full | 8329 SUPPORTED_100baseT_Full |
8272 SUPPORTED_10baseT_Half | 8330 SUPPORTED_10baseT_Half |
8273 SUPPORTED_10baseT_Full | 8331 SUPPORTED_10baseT_Full |
8274 SUPPORTED_MII); 8332 SUPPORTED_TP);
8275 cmd->port = PORT_TP; 8333 cmd->port = PORT_TP;
8276 } else { 8334 } else {
8277 cmd->supported |= SUPPORTED_FIBRE; 8335 cmd->supported |= SUPPORTED_FIBRE;
@@ -8668,7 +8726,9 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
8668} 8726}
8669 8727
8670#define NVRAM_TEST_SIZE 0x100 8728#define NVRAM_TEST_SIZE 0x100
8671#define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14 8729#define NVRAM_SELFBOOT_FORMAT1_0_SIZE 0x14
8730#define NVRAM_SELFBOOT_FORMAT1_2_SIZE 0x18
8731#define NVRAM_SELFBOOT_FORMAT1_3_SIZE 0x1c
8672#define NVRAM_SELFBOOT_HW_SIZE 0x20 8732#define NVRAM_SELFBOOT_HW_SIZE 0x20
8673#define NVRAM_SELFBOOT_DATA_SIZE 0x1c 8733#define NVRAM_SELFBOOT_DATA_SIZE 0x1c
8674 8734
@@ -8683,9 +8743,22 @@ static int tg3_test_nvram(struct tg3 *tp)
8683 if (magic == TG3_EEPROM_MAGIC) 8743 if (magic == TG3_EEPROM_MAGIC)
8684 size = NVRAM_TEST_SIZE; 8744 size = NVRAM_TEST_SIZE;
8685 else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) { 8745 else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) {
8686 if ((magic & 0xe00000) == 0x200000) 8746 if ((magic & TG3_EEPROM_SB_FORMAT_MASK) ==
8687 size = NVRAM_SELFBOOT_FORMAT1_SIZE; 8747 TG3_EEPROM_SB_FORMAT_1) {
8688 else 8748 switch (magic & TG3_EEPROM_SB_REVISION_MASK) {
8749 case TG3_EEPROM_SB_REVISION_0:
8750 size = NVRAM_SELFBOOT_FORMAT1_0_SIZE;
8751 break;
8752 case TG3_EEPROM_SB_REVISION_2:
8753 size = NVRAM_SELFBOOT_FORMAT1_2_SIZE;
8754 break;
8755 case TG3_EEPROM_SB_REVISION_3:
8756 size = NVRAM_SELFBOOT_FORMAT1_3_SIZE;
8757 break;
8758 default:
8759 return 0;
8760 }
8761 } else
8689 return 0; 8762 return 0;
8690 } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW) 8763 } else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW)
8691 size = NVRAM_SELFBOOT_HW_SIZE; 8764 size = NVRAM_SELFBOOT_HW_SIZE;
@@ -8712,8 +8785,17 @@ static int tg3_test_nvram(struct tg3 *tp)
8712 TG3_EEPROM_MAGIC_FW) { 8785 TG3_EEPROM_MAGIC_FW) {
8713 u8 *buf8 = (u8 *) buf, csum8 = 0; 8786 u8 *buf8 = (u8 *) buf, csum8 = 0;
8714 8787
8715 for (i = 0; i < size; i++) 8788 if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) ==
8716 csum8 += buf8[i]; 8789 TG3_EEPROM_SB_REVISION_2) {
8790 /* For rev 2, the csum doesn't include the MBA. */
8791 for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++)
8792 csum8 += buf8[i];
8793 for (i = TG3_EEPROM_SB_F1R2_MBA_OFF + 4; i < size; i++)
8794 csum8 += buf8[i];
8795 } else {
8796 for (i = 0; i < size; i++)
8797 csum8 += buf8[i];
8798 }
8717 8799
8718 if (csum8 == 0) { 8800 if (csum8 == 0) {
8719 err = 0; 8801 err = 0;
@@ -9297,7 +9379,7 @@ static int tg3_test_loopback(struct tg3 *tp)
9297 if (err) 9379 if (err)
9298 return TG3_LOOPBACK_FAILED; 9380 return TG3_LOOPBACK_FAILED;
9299 9381
9300 if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { 9382 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
9301 int i; 9383 int i;
9302 u32 status; 9384 u32 status;
9303 9385
@@ -9314,17 +9396,17 @@ static int tg3_test_loopback(struct tg3 *tp)
9314 if (status != CPMU_MUTEX_GNT_DRIVER) 9396 if (status != CPMU_MUTEX_GNT_DRIVER)
9315 return TG3_LOOPBACK_FAILED; 9397 return TG3_LOOPBACK_FAILED;
9316 9398
9317 cpmuctrl = tr32(TG3_CPMU_CTRL);
9318
9319 /* Turn off power management based on link speed. */ 9399 /* Turn off power management based on link speed. */
9400 cpmuctrl = tr32(TG3_CPMU_CTRL);
9320 tw32(TG3_CPMU_CTRL, 9401 tw32(TG3_CPMU_CTRL,
9321 cpmuctrl & ~CPMU_CTRL_LINK_SPEED_MODE); 9402 cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE |
9403 CPMU_CTRL_LINK_AWARE_MODE));
9322 } 9404 }
9323 9405
9324 if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK)) 9406 if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK))
9325 err |= TG3_MAC_LOOPBACK_FAILED; 9407 err |= TG3_MAC_LOOPBACK_FAILED;
9326 9408
9327 if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) { 9409 if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
9328 tw32(TG3_CPMU_CTRL, cpmuctrl); 9410 tw32(TG3_CPMU_CTRL, cpmuctrl);
9329 9411
9330 /* Release the mutex */ 9412 /* Release the mutex */
@@ -10545,6 +10627,10 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
10545 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) 10627 tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
10546 tp->led_ctrl = LED_CTRL_MODE_PHY_2; 10628 tp->led_ctrl = LED_CTRL_MODE_PHY_2;
10547 10629
10630 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
10631 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1)
10632 tp->led_ctrl = LED_CTRL_MODE_MAC;
10633
10548 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) { 10634 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) {
10549 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT; 10635 tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
10550 if ((tp->pdev->subsystem_vendor == 10636 if ((tp->pdev->subsystem_vendor ==
@@ -10863,7 +10949,7 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
10863 } 10949 }
10864 10950
10865 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || 10951 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) ||
10866 (tp->tg3_flags & TG3_FLG3_ENABLE_APE)) 10952 (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE))
10867 return; 10953 return;
10868 10954
10869 for (offset = TG3_NVM_DIR_START; 10955 for (offset = TG3_NVM_DIR_START;
@@ -11131,6 +11217,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11131 pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP); 11217 pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP);
11132 if (pcie_cap != 0) { 11218 if (pcie_cap != 0) {
11133 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; 11219 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS;
11220
11221 pcie_set_readrq(tp->pdev, 4096);
11222
11134 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { 11223 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
11135 u16 lnkctl; 11224 u16 lnkctl;
11136 11225
@@ -11311,9 +11400,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
11311 } 11400 }
11312 11401
11313 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 || 11402 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
11314 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) 11403 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
11315 tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT; 11404 tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT;
11316 11405
11406 if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
11407 tp->pci_chip_rev_id == CHIPREV_ID_5784_A1 ||
11408 tp->pci_chip_rev_id == CHIPREV_ID_5761_A0 ||
11409 tp->pci_chip_rev_id == CHIPREV_ID_5761_A1)
11410 tp->tg3_flags3 |= TG3_FLG3_5761_5784_AX_FIXES;
11411 }
11412
11317 /* Set up tp->grc_local_ctrl before calling tg3_set_power_state(). 11413 /* Set up tp->grc_local_ctrl before calling tg3_set_power_state().
11318 * GPIO1 driven high will bring 5700's external PHY out of reset. 11414 * GPIO1 driven high will bring 5700's external PHY out of reset.
11319 * It is also used as eeprom write protect on LOMs. 11415 * It is also used as eeprom write protect on LOMs.
@@ -12468,6 +12564,28 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12468 goto err_out_iounmap; 12564 goto err_out_iounmap;
12469 } 12565 }
12470 12566
12567 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
12568 if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
12569 printk(KERN_ERR PFX "Cannot find proper PCI device "
12570 "base address for APE, aborting.\n");
12571 err = -ENODEV;
12572 goto err_out_iounmap;
12573 }
12574
12575 tg3reg_base = pci_resource_start(pdev, 2);
12576 tg3reg_len = pci_resource_len(pdev, 2);
12577
12578 tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len);
12579 if (tp->aperegs == 0UL) {
12580 printk(KERN_ERR PFX "Cannot map APE registers, "
12581 "aborting.\n");
12582 err = -ENOMEM;
12583 goto err_out_iounmap;
12584 }
12585
12586 tg3_ape_lock_init(tp);
12587 }
12588
12471 /* 12589 /*
12472 * Reset chip in case UNDI or EFI driver did not shutdown 12590 * Reset chip in case UNDI or EFI driver did not shutdown
12473 * DMA self test will enable WDMAC and we'll see (spurious) 12591 * DMA self test will enable WDMAC and we'll see (spurious)
@@ -12482,7 +12600,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12482 err = tg3_test_dma(tp); 12600 err = tg3_test_dma(tp);
12483 if (err) { 12601 if (err) {
12484 printk(KERN_ERR PFX "DMA engine test failed, aborting.\n"); 12602 printk(KERN_ERR PFX "DMA engine test failed, aborting.\n");
12485 goto err_out_iounmap; 12603 goto err_out_apeunmap;
12486 } 12604 }
12487 12605
12488 /* Tigon3 can do ipv4 only... and some chips have buggy 12606 /* Tigon3 can do ipv4 only... and some chips have buggy
@@ -12505,28 +12623,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12505 12623
12506 tg3_init_coal(tp); 12624 tg3_init_coal(tp);
12507 12625
12508 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
12509 if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
12510 printk(KERN_ERR PFX "Cannot find proper PCI device "
12511 "base address for APE, aborting.\n");
12512 err = -ENODEV;
12513 goto err_out_iounmap;
12514 }
12515
12516 tg3reg_base = pci_resource_start(pdev, 2);
12517 tg3reg_len = pci_resource_len(pdev, 2);
12518
12519 tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len);
12520 if (tp->aperegs == 0UL) {
12521 printk(KERN_ERR PFX "Cannot map APE registers, "
12522 "aborting.\n");
12523 err = -ENOMEM;
12524 goto err_out_iounmap;
12525 }
12526
12527 tg3_ape_lock_init(tp);
12528 }
12529
12530 pci_set_drvdata(pdev, dev); 12626 pci_set_drvdata(pdev, dev);
12531 12627
12532 err = register_netdev(dev); 12628 err = register_netdev(dev);
@@ -12681,11 +12777,6 @@ static int tg3_resume(struct pci_dev *pdev)
12681 if (err) 12777 if (err)
12682 return err; 12778 return err;
12683 12779
12684 /* Hardware bug - MSI won't work if INTX disabled. */
12685 if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) &&
12686 (tp->tg3_flags2 & TG3_FLG2_USING_MSI))
12687 pci_intx(tp->pdev, 1);
12688
12689 netif_device_attach(dev); 12780 netif_device_attach(dev);
12690 12781
12691 tg3_full_lock(tp, 0); 12782 tg3_full_lock(tp, 0);
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 1d5b2a3dd29d..da18fb220712 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -109,6 +109,9 @@
109#define CHIPREV_ID_5714_A2 0x9002 109#define CHIPREV_ID_5714_A2 0x9002
110#define CHIPREV_ID_5906_A1 0xc001 110#define CHIPREV_ID_5906_A1 0xc001
111#define CHIPREV_ID_5784_A0 0x5784000 111#define CHIPREV_ID_5784_A0 0x5784000
112#define CHIPREV_ID_5784_A1 0x5784001
113#define CHIPREV_ID_5761_A0 0x5761000
114#define CHIPREV_ID_5761_A1 0x5761001
112#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) 115#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12)
113#define ASIC_REV_5700 0x07 116#define ASIC_REV_5700 0x07
114#define ASIC_REV_5701 0x00 117#define ASIC_REV_5701 0x00
@@ -856,7 +859,31 @@
856#define CPMU_CTRL_LINK_IDLE_MODE 0x00000200 859#define CPMU_CTRL_LINK_IDLE_MODE 0x00000200
857#define CPMU_CTRL_LINK_AWARE_MODE 0x00000400 860#define CPMU_CTRL_LINK_AWARE_MODE 0x00000400
858#define CPMU_CTRL_LINK_SPEED_MODE 0x00004000 861#define CPMU_CTRL_LINK_SPEED_MODE 0x00004000
859/* 0x3604 --> 0x365c unused */ 862#define TG3_CPMU_LSPD_10MB_CLK 0x00003604
863#define CPMU_LSPD_10MB_MACCLK_MASK 0x001f0000
864#define CPMU_LSPD_10MB_MACCLK_6_25 0x00130000
865/* 0x3608 --> 0x360c unused */
866
867#define TG3_CPMU_LSPD_1000MB_CLK 0x0000360c
868#define CPMU_LSPD_1000MB_MACCLK_62_5 0x00000000
869#define CPMU_LSPD_1000MB_MACCLK_12_5 0x00110000
870#define CPMU_LSPD_1000MB_MACCLK_MASK 0x001f0000
871#define TG3_CPMU_LNK_AWARE_PWRMD 0x00003610
872#define CPMU_LNK_AWARE_MACCLK_MASK 0x001f0000
873#define CPMU_LNK_AWARE_MACCLK_6_25 0x00130000
874/* 0x3614 --> 0x361c unused */
875
876#define TG3_CPMU_HST_ACC 0x0000361c
877#define CPMU_HST_ACC_MACCLK_MASK 0x001f0000
878#define CPMU_HST_ACC_MACCLK_6_25 0x00130000
879/* 0x3620 --> 0x3630 unused */
880
881#define TG3_CPMU_CLCK_STAT 0x00003630
882#define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000
883#define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000
884#define CPMU_CLCK_STAT_MAC_CLCK_12_5 0x00110000
885#define CPMU_CLCK_STAT_MAC_CLCK_6_25 0x00130000
886/* 0x3634 --> 0x365c unused */
860 887
861#define TG3_CPMU_MUTEX_REQ 0x0000365c 888#define TG3_CPMU_MUTEX_REQ 0x0000365c
862#define CPMU_MUTEX_REQ_DRIVER 0x00001000 889#define CPMU_MUTEX_REQ_DRIVER 0x00001000
@@ -1537,6 +1564,12 @@
1537#define TG3_EEPROM_MAGIC 0x669955aa 1564#define TG3_EEPROM_MAGIC 0x669955aa
1538#define TG3_EEPROM_MAGIC_FW 0xa5000000 1565#define TG3_EEPROM_MAGIC_FW 0xa5000000
1539#define TG3_EEPROM_MAGIC_FW_MSK 0xff000000 1566#define TG3_EEPROM_MAGIC_FW_MSK 0xff000000
1567#define TG3_EEPROM_SB_FORMAT_MASK 0x00e00000
1568#define TG3_EEPROM_SB_FORMAT_1 0x00200000
1569#define TG3_EEPROM_SB_REVISION_MASK 0x001f0000
1570#define TG3_EEPROM_SB_REVISION_0 0x00000000
1571#define TG3_EEPROM_SB_REVISION_2 0x00020000
1572#define TG3_EEPROM_SB_REVISION_3 0x00030000
1540#define TG3_EEPROM_MAGIC_HW 0xabcd 1573#define TG3_EEPROM_MAGIC_HW 0xabcd
1541#define TG3_EEPROM_MAGIC_HW_MSK 0xffff 1574#define TG3_EEPROM_MAGIC_HW_MSK 0xffff
1542 1575
@@ -1691,6 +1724,12 @@
1691#define MII_TG3_ISTAT 0x1a /* IRQ status register */ 1724#define MII_TG3_ISTAT 0x1a /* IRQ status register */
1692#define MII_TG3_IMASK 0x1b /* IRQ mask register */ 1725#define MII_TG3_IMASK 0x1b /* IRQ mask register */
1693 1726
1727#define MII_TG3_MISC_SHDW 0x1c
1728#define MII_TG3_MISC_SHDW_WREN 0x8000
1729#define MII_TG3_MISC_SHDW_APD_SEL 0x2800
1730
1731#define MII_TG3_MISC_SHDW_APD_WKTM_84MS 0x0001
1732
1694/* ISTAT/IMASK event bits */ 1733/* ISTAT/IMASK event bits */
1695#define MII_TG3_INT_LINKCHG 0x0002 1734#define MII_TG3_INT_LINKCHG 0x0002
1696#define MII_TG3_INT_SPEEDCHG 0x0004 1735#define MII_TG3_INT_SPEEDCHG 0x0004
@@ -1747,6 +1786,8 @@
1747/* APE convenience enumerations. */ 1786/* APE convenience enumerations. */
1748#define TG3_APE_LOCK_MEM 4 1787#define TG3_APE_LOCK_MEM 4
1749 1788
1789#define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10
1790
1750 1791
1751/* There are two ways to manage the TX descriptors on the tigon3. 1792/* There are two ways to manage the TX descriptors on the tigon3.
1752 * Either the descriptors are in host DMA'able memory, or they 1793 * Either the descriptors are in host DMA'able memory, or they
@@ -2352,6 +2393,7 @@ struct tg3 {
2352 u32 tg3_flags3; 2393 u32 tg3_flags3;
2353#define TG3_FLG3_NO_NVRAM_ADDR_TRANS 0x00000001 2394#define TG3_FLG3_NO_NVRAM_ADDR_TRANS 0x00000001
2354#define TG3_FLG3_ENABLE_APE 0x00000002 2395#define TG3_FLG3_ENABLE_APE 0x00000002
2396#define TG3_FLG3_5761_5784_AX_FIXES 0x00000004
2355 2397
2356 struct timer_list timer; 2398 struct timer_list timer;
2357 u16 timer_counter; 2399 u16 timer_counter;
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig
index 49d7a290dbbc..20ac1503021e 100644
--- a/drivers/net/tulip/Kconfig
+++ b/drivers/net/tulip/Kconfig
@@ -24,8 +24,7 @@ config DE2104X
24 will say Y here.) Do read the Ethernet-HOWTO, available from 24 will say Y here.) Do read the Ethernet-HOWTO, available from
25 <http://www.tldp.org/docs.html#howto>. 25 <http://www.tldp.org/docs.html#howto>.
26 26
27 To compile this driver as a module, choose M here and read 27 To compile this driver as a module, choose M here. The module will
28 <file:Documentation/networking/net-modules.txt>. The module will
29 be called de2104x. 28 be called de2104x.
30 29
31config TULIP 30config TULIP
@@ -42,8 +41,7 @@ config TULIP
42 will say Y here.) Do read the Ethernet-HOWTO, available from 41 will say Y here.) Do read the Ethernet-HOWTO, available from
43 <http://www.tldp.org/docs.html#howto>. 42 <http://www.tldp.org/docs.html#howto>.
44 43
45 To compile this driver as a module, choose M here and read 44 To compile this driver as a module, choose M here. The module will
46 <file:Documentation/networking/net-modules.txt>. The module will
47 be called tulip. 45 be called tulip.
48 46
49config TULIP_MWI 47config TULIP_MWI
@@ -104,8 +102,7 @@ config DE4X5
104 information is contained in 102 information is contained in
105 <file:Documentation/networking/de4x5.txt>. 103 <file:Documentation/networking/de4x5.txt>.
106 104
107 To compile this driver as a module, choose M here and read 105 To compile this driver as a module, choose M here. The module will
108 <file:Documentation/networking/net-modules.txt>. The module will
109 be called de4x5. 106 be called de4x5.
110 107
111config WINBOND_840 108config WINBOND_840
@@ -129,8 +126,7 @@ config DM9102
129 (Ethernet) card, say Y. Some information is contained in the file 126 (Ethernet) card, say Y. Some information is contained in the file
130 <file:Documentation/networking/dmfe.txt>. 127 <file:Documentation/networking/dmfe.txt>.
131 128
132 To compile this driver as a module, choose M here and read 129 To compile this driver as a module, choose M here. The module will
133 <file:Documentation/networking/net-modules.txt>. The module will
134 be called dmfe. 130 be called dmfe.
135 131
136config ULI526X 132config ULI526X
@@ -141,8 +137,7 @@ config ULI526X
141 This driver is for ULi M5261/M5263 10/100M Ethernet Controller 137 This driver is for ULi M5261/M5263 10/100M Ethernet Controller
142 (<http://www.uli.com.tw/>). 138 (<http://www.uli.com.tw/>).
143 139
144 To compile this driver as a module, choose M here and read 140 To compile this driver as a module, choose M here. The module will
145 <file:Documentation/networking/net-modules.txt>. The module will
146 be called uli526x. 141 be called uli526x.
147 142
148config PCMCIA_XIRCOM 143config PCMCIA_XIRCOM
@@ -154,8 +149,7 @@ config PCMCIA_XIRCOM
154 as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and 149 as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and
155 ASIX. 150 ASIX.
156 151
157 To compile this driver as a module, choose M here and read 152 To compile this driver as a module, choose M here. The module will
158 <file:Documentation/networking/net-modules.txt>. The module will
159 be called xircom_cb. If unsure, say N. 153 be called xircom_cb. If unsure, say N.
160 154
161config PCMCIA_XIRTULIP 155config PCMCIA_XIRTULIP
@@ -168,8 +162,7 @@ config PCMCIA_XIRTULIP
168 as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and 162 as with work-alike chips from Lite-On (PNIC) and Macronix (MXIC) and
169 ASIX. 163 ASIX.
170 164
171 To compile this driver as a module, choose M here and read 165 To compile this driver as a module, choose M here. The module will
172 <file:Documentation/networking/net-modules.txt>. The module will
173 be called xircom_tulip_cb. If unsure, say N. 166 be called xircom_tulip_cb. If unsure, say N.
174 167
175endif # NET_TULIP 168endif # NET_TULIP
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/Kconfig b/drivers/net/usb/Kconfig
index 5a96d74e4ce8..a12c9c41b217 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -93,13 +93,9 @@ config USB_RTL8150
93 To compile this driver as a module, choose M here: the 93 To compile this driver as a module, choose M here: the
94 module will be called rtl8150. 94 module will be called rtl8150.
95 95
96config USB_USBNET_MII
97 tristate
98 default n
99
100config USB_USBNET 96config USB_USBNET
101 tristate "Multi-purpose USB Networking Framework" 97 tristate "Multi-purpose USB Networking Framework"
102 select MII if USB_USBNET_MII != n 98 select MII
103 ---help--- 99 ---help---
104 This driver supports several kinds of network links over USB, 100 This driver supports several kinds of network links over USB,
105 with "minidrivers" built around a common network driver core 101 with "minidrivers" built around a common network driver core
@@ -135,7 +131,6 @@ config USB_NET_AX8817X
135 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" 131 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters"
136 depends on USB_USBNET && NET_ETHERNET 132 depends on USB_USBNET && NET_ETHERNET
137 select CRC32 133 select CRC32
138 select USB_USBNET_MII
139 default y 134 default y
140 help 135 help
141 This option adds support for ASIX AX88xxx based USB 2.0 136 This option adds support for ASIX AX88xxx based USB 2.0
@@ -190,7 +185,6 @@ config USB_NET_DM9601
190 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" 185 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
191 depends on USB_USBNET 186 depends on USB_USBNET
192 select CRC32 187 select CRC32
193 select USB_USBNET_MII
194 help 188 help
195 This option adds support for Davicom DM9601 based USB 1.1 189 This option adds support for Davicom DM9601 based USB 1.1
196 10/100 Ethernet adapters. 190 10/100 Ethernet adapters.
@@ -225,7 +219,6 @@ config USB_NET_PLUSB
225config USB_NET_MCS7830 219config USB_NET_MCS7830
226 tristate "MosChip MCS7830 based Ethernet adapters" 220 tristate "MosChip MCS7830 based Ethernet adapters"
227 depends on USB_USBNET 221 depends on USB_USBNET
228 select USB_USBNET_MII
229 help 222 help
230 Choose this option if you're using a 10/100 Ethernet USB2 223 Choose this option if you're using a 10/100 Ethernet USB2
231 adapter based on the MosChip 7830 controller. This includes 224 adapter based on the MosChip 7830 controller. This includes
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/usbnet.c b/drivers/net/usb/usbnet.c
index acd5f1c0e63a..8ed1fc5cbc70 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -683,9 +683,6 @@ done_nopm:
683 * they'll probably want to use this base set. 683 * they'll probably want to use this base set.
684 */ 684 */
685 685
686#if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE)
687#define HAVE_MII
688
689int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) 686int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
690{ 687{
691 struct usbnet *dev = netdev_priv(net); 688 struct usbnet *dev = netdev_priv(net);
@@ -744,8 +741,6 @@ int usbnet_nway_reset(struct net_device *net)
744} 741}
745EXPORT_SYMBOL_GPL(usbnet_nway_reset); 742EXPORT_SYMBOL_GPL(usbnet_nway_reset);
746 743
747#endif /* HAVE_MII */
748
749void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) 744void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
750{ 745{
751 struct usbnet *dev = netdev_priv(net); 746 struct usbnet *dev = netdev_priv(net);
@@ -776,12 +771,10 @@ EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
776 771
777/* drivers may override default ethtool_ops in their bind() routine */ 772/* drivers may override default ethtool_ops in their bind() routine */
778static struct ethtool_ops usbnet_ethtool_ops = { 773static struct ethtool_ops usbnet_ethtool_ops = {
779#ifdef HAVE_MII
780 .get_settings = usbnet_get_settings, 774 .get_settings = usbnet_get_settings,
781 .set_settings = usbnet_set_settings, 775 .set_settings = usbnet_set_settings,
782 .get_link = usbnet_get_link, 776 .get_link = usbnet_get_link,
783 .nway_reset = usbnet_nway_reset, 777 .nway_reset = usbnet_nway_reset,
784#endif
785 .get_drvinfo = usbnet_get_drvinfo, 778 .get_drvinfo = usbnet_get_drvinfo,
786 .get_msglevel = usbnet_get_msglevel, 779 .get_msglevel = usbnet_get_msglevel,
787 .set_msglevel = usbnet_set_msglevel, 780 .set_msglevel = usbnet_set_msglevel,
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 5c4a92de9a07..450e29d7a9f3 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1963,6 +1963,11 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
1963 return -EINVAL; 1963 return -EINVAL;
1964 } 1964 }
1965 1965
1966 if (!netif_running(dev)) {
1967 dev->mtu = new_mtu;
1968 return 0;
1969 }
1970
1966 if (new_mtu != oldmtu) { 1971 if (new_mtu != oldmtu) {
1967 spin_lock_irqsave(&vptr->lock, flags); 1972 spin_lock_irqsave(&vptr->lock, flags);
1968 1973
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index e396c9d2af8d..5413dbf3d4ac 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -146,6 +146,7 @@ static void try_fill_recv(struct virtnet_info *vi)
146 struct scatterlist sg[1+MAX_SKB_FRAGS]; 146 struct scatterlist sg[1+MAX_SKB_FRAGS];
147 int num, err; 147 int num, err;
148 148
149 sg_init_table(sg, 1+MAX_SKB_FRAGS);
149 for (;;) { 150 for (;;) {
150 skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); 151 skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN);
151 if (unlikely(!skb)) 152 if (unlikely(!skb))
@@ -197,8 +198,8 @@ again:
197 if (vi->num < vi->max / 2) 198 if (vi->num < vi->max / 2)
198 try_fill_recv(vi); 199 try_fill_recv(vi);
199 200
200 /* All done? */ 201 /* Out of packets? */
201 if (!skb) { 202 if (received < budget) {
202 netif_rx_complete(vi->dev, napi); 203 netif_rx_complete(vi->dev, napi);
203 if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) 204 if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq))
204 && netif_rx_reschedule(vi->dev, napi)) 205 && netif_rx_reschedule(vi->dev, napi))
@@ -231,6 +232,8 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
231 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; 232 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
232 DECLARE_MAC_BUF(mac); 233 DECLARE_MAC_BUF(mac);
233 234
235 sg_init_table(sg, 1+MAX_SKB_FRAGS);
236
234 pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); 237 pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest));
235 238
236 free_old_xmit_skbs(vi); 239 free_old_xmit_skbs(vi);
@@ -401,8 +404,12 @@ free:
401 404
402static void virtnet_remove(struct virtio_device *vdev) 405static void virtnet_remove(struct virtio_device *vdev)
403{ 406{
404 unregister_netdev(vdev->priv); 407 struct virtnet_info *vi = vdev->priv;
405 free_netdev(vdev->priv); 408
409 vdev->config->del_vq(vi->svq);
410 vdev->config->del_vq(vi->rvq);
411 unregister_netdev(vi->dev);
412 free_netdev(vi->dev);
406} 413}
407 414
408static struct virtio_device_id id_table[] = { 415static struct virtio_device_id id_table[] = {
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/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index c48b1cc63fd5..1e89d4de1bb7 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -719,12 +719,8 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file,
719 return 0; 719 return 0;
720 case SIOCSIFHWADDR: 720 case SIOCSIFHWADDR:
721 return -EINVAL; 721 return -EINVAL;
722 /* Allow stty to read, but not set, the serial port */
723 case TCGETS:
724 case TCGETA:
725 return n_tty_ioctl(tty, file, cmd, arg);
726 default: 722 default:
727 return -ENOIOCTLCMD; 723 return tty_mode_ioctl(tty, file, cmd, arg);
728 } 724 }
729} 725}
730 726
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index dae5c8d5a318..2b733c582915 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -325,7 +325,7 @@ config HERMES
325 Cabletron/EnteraSys Roamabout, ELSA AirLancer, MELCO Buffalo, Avaya, 325 Cabletron/EnteraSys Roamabout, ELSA AirLancer, MELCO Buffalo, Avaya,
326 IBM High Rate Wireless, Farralon Syyline, Samsung MagicLAN, Netgear 326 IBM High Rate Wireless, Farralon Syyline, Samsung MagicLAN, Netgear
327 MA401, LinkSys WPC-11, D-Link DWL-650, 3Com AirConnect, Intel 327 MA401, LinkSys WPC-11, D-Link DWL-650, 3Com AirConnect, Intel
328 PRO/Wireless, and Symbol Spectrum24 High Rate amongst others. 328 IPW2011, and Symbol Spectrum24 High Rate amongst others.
329 329
330 This option includes the guts of the driver, but in order to 330 This option includes the guts of the driver, but in order to
331 actually use a card you will also need to enable support for PCMCIA 331 actually use a card you will also need to enable support for PCMCIA
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index e3c573e56b63..fdbc351ac333 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -61,16 +61,18 @@ config B43_PCMCIA
61 61
62 If unsure, say N. 62 If unsure, say N.
63 63
64# LED support 64# This config option automatically enables b43 LEDS support,
65# if it's possible.
65config B43_LEDS 66config B43_LEDS
66 bool 67 bool
67 depends on B43 && MAC80211_LEDS 68 depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43)
68 default y 69 default y
69 70
70# RFKILL support 71# This config option automatically enables b43 RFKILL support,
72# if it's possible.
71config B43_RFKILL 73config B43_RFKILL
72 bool 74 bool
73 depends on B43 && RFKILL && RFKILL_INPUT && INPUT_POLLDEV 75 depends on B43 && (RFKILL = y || RFKILL = B43) && RFKILL_INPUT && (INPUT_POLLDEV = y || INPUT_POLLDEV = B43)
74 default y 76 default y
75 77
76config B43_DEBUG 78config B43_DEBUG
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index 734e70e1a06d..ef0075d9f9cb 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -128,7 +128,7 @@ static ssize_t shm_read_file(struct b43_wldev *dev,
128 __le16 *le16buf = (__le16 *)buf; 128 __le16 *le16buf = (__le16 *)buf;
129 129
130 for (i = 0; i < 0x1000; i++) { 130 for (i = 0; i < 0x1000; i++) {
131 if (bufsize <= 0) 131 if (bufsize < sizeof(tmp))
132 break; 132 break;
133 tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i); 133 tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i);
134 le16buf[i] = cpu_to_le16(tmp); 134 le16buf[i] = cpu_to_le16(tmp);
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 9d9ff76a9bc6..2b17c1dc46f1 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);
@@ -2985,6 +2985,16 @@ static void b43_wireless_core_stop(struct b43_wldev *dev)
2985 2985
2986 if (b43_status(dev) < B43_STAT_STARTED) 2986 if (b43_status(dev) < B43_STAT_STARTED)
2987 return; 2987 return;
2988
2989 /* Disable and sync interrupts. We must do this before than
2990 * setting the status to INITIALIZED, as the interrupt handler
2991 * won't care about IRQs then. */
2992 spin_lock_irqsave(&wl->irq_lock, flags);
2993 dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL);
2994 b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* flush */
2995 spin_unlock_irqrestore(&wl->irq_lock, flags);
2996 b43_synchronize_irq(dev);
2997
2988 b43_set_status(dev, B43_STAT_INITIALIZED); 2998 b43_set_status(dev, B43_STAT_INITIALIZED);
2989 2999
2990 mutex_unlock(&wl->mutex); 3000 mutex_unlock(&wl->mutex);
@@ -2995,13 +3005,6 @@ static void b43_wireless_core_stop(struct b43_wldev *dev)
2995 3005
2996 ieee80211_stop_queues(wl->hw); //FIXME this could cause a deadlock, as mac80211 seems buggy. 3006 ieee80211_stop_queues(wl->hw); //FIXME this could cause a deadlock, as mac80211 seems buggy.
2997 3007
2998 /* Disable and sync interrupts. */
2999 spin_lock_irqsave(&wl->irq_lock, flags);
3000 dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL);
3001 b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* flush */
3002 spin_unlock_irqrestore(&wl->irq_lock, flags);
3003 b43_synchronize_irq(dev);
3004
3005 b43_mac_suspend(dev); 3008 b43_mac_suspend(dev);
3006 free_irq(dev->dev->irq, dev); 3009 free_irq(dev->dev->irq, dev);
3007 b43dbg(wl, "Wireless interface stopped\n"); 3010 b43dbg(wl, "Wireless interface stopped\n");
@@ -3661,7 +3664,6 @@ static int b43_setup_modes(struct b43_wldev *dev,
3661 3664
3662static void b43_wireless_core_detach(struct b43_wldev *dev) 3665static void b43_wireless_core_detach(struct b43_wldev *dev)
3663{ 3666{
3664 b43_rfkill_free(dev);
3665 /* We release firmware that late to not be required to re-request 3667 /* We release firmware that late to not be required to re-request
3666 * is all the time when we reinit the core. */ 3668 * is all the time when we reinit the core. */
3667 b43_release_firmware(dev); 3669 b43_release_firmware(dev);
@@ -3747,7 +3749,6 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
3747 if (!wl->current_dev) 3749 if (!wl->current_dev)
3748 wl->current_dev = dev; 3750 wl->current_dev = dev;
3749 INIT_WORK(&dev->restart_work, b43_chip_reset); 3751 INIT_WORK(&dev->restart_work, b43_chip_reset);
3750 b43_rfkill_alloc(dev);
3751 3752
3752 b43_radio_turn_off(dev, 1); 3753 b43_radio_turn_off(dev, 1);
3753 b43_switch_analog(dev, 0); 3754 b43_switch_analog(dev, 0);
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c
index b242a9a90dd2..b79a6bd5396d 100644
--- a/drivers/net/wireless/b43/pcmcia.c
+++ b/drivers/net/wireless/b43/pcmcia.c
@@ -65,12 +65,12 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
65 tuple_t tuple; 65 tuple_t tuple;
66 cisparse_t parse; 66 cisparse_t parse;
67 int err = -ENOMEM; 67 int err = -ENOMEM;
68 int res; 68 int res = 0;
69 unsigned char buf[64]; 69 unsigned char buf[64];
70 70
71 ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); 71 ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
72 if (!ssb) 72 if (!ssb)
73 goto out; 73 goto out_error;
74 74
75 err = -ENODEV; 75 err = -ENODEV;
76 tuple.DesiredTuple = CISTPL_CONFIG; 76 tuple.DesiredTuple = CISTPL_CONFIG;
@@ -96,10 +96,12 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
96 dev->io.NumPorts2 = 0; 96 dev->io.NumPorts2 = 0;
97 dev->io.Attributes2 = 0; 97 dev->io.Attributes2 = 0;
98 98
99 win.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 99 win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM |
100 WIN_ENABLE | WIN_DATA_WIDTH_16 |
101 WIN_USE_WAIT;
100 win.Base = 0; 102 win.Base = 0;
101 win.Size = SSB_CORE_SIZE; 103 win.Size = SSB_CORE_SIZE;
102 win.AccessSpeed = 1000; 104 win.AccessSpeed = 250;
103 res = pcmcia_request_window(&dev, &win, &dev->win); 105 res = pcmcia_request_window(&dev, &win, &dev->win);
104 if (res != CS_SUCCESS) 106 if (res != CS_SUCCESS)
105 goto err_kfree_ssb; 107 goto err_kfree_ssb;
@@ -108,21 +110,34 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
108 mem.Page = 0; 110 mem.Page = 0;
109 res = pcmcia_map_mem_page(dev->win, &mem); 111 res = pcmcia_map_mem_page(dev->win, &mem);
110 if (res != CS_SUCCESS) 112 if (res != CS_SUCCESS)
111 goto err_kfree_ssb; 113 goto err_disable;
114
115 dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FIRST_SHARED;
116 dev->irq.IRQInfo1 = IRQ_LEVEL_ID | IRQ_SHARE_ID;
117 dev->irq.Handler = NULL; /* The handler is registered later. */
118 dev->irq.Instance = NULL;
119 res = pcmcia_request_irq(dev, &dev->irq);
120 if (res != CS_SUCCESS)
121 goto err_disable;
112 122
113 res = pcmcia_request_configuration(dev, &dev->conf); 123 res = pcmcia_request_configuration(dev, &dev->conf);
114 if (res != CS_SUCCESS) 124 if (res != CS_SUCCESS)
115 goto err_disable; 125 goto err_disable;
116 126
117 err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); 127 err = ssb_bus_pcmciabus_register(ssb, dev, win.Base);
128 if (err)
129 goto err_disable;
118 dev->priv = ssb; 130 dev->priv = ssb;
119 131
120 out: 132 return 0;
121 return err; 133
122 err_disable: 134err_disable:
123 pcmcia_disable_device(dev); 135 pcmcia_disable_device(dev);
124 err_kfree_ssb: 136err_kfree_ssb:
125 kfree(ssb); 137 kfree(ssb);
138out_error:
139 printk(KERN_ERR "b43-pcmcia: Initialization failed (%d, %d)\n",
140 res, err);
126 return err; 141 return err;
127} 142}
128 143
@@ -131,22 +146,21 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev)
131 struct ssb_bus *ssb = dev->priv; 146 struct ssb_bus *ssb = dev->priv;
132 147
133 ssb_bus_unregister(ssb); 148 ssb_bus_unregister(ssb);
134 pcmcia_release_window(dev->win);
135 pcmcia_disable_device(dev); 149 pcmcia_disable_device(dev);
136 kfree(ssb); 150 kfree(ssb);
137 dev->priv = NULL; 151 dev->priv = NULL;
138} 152}
139 153
140static struct pcmcia_driver b43_pcmcia_driver = { 154static struct pcmcia_driver b43_pcmcia_driver = {
141 .owner = THIS_MODULE, 155 .owner = THIS_MODULE,
142 .drv = { 156 .drv = {
143 .name = "b43-pcmcia", 157 .name = "b43-pcmcia",
144 }, 158 },
145 .id_table = b43_pcmcia_tbl, 159 .id_table = b43_pcmcia_tbl,
146 .probe = b43_pcmcia_probe, 160 .probe = b43_pcmcia_probe,
147 .remove = b43_pcmcia_remove, 161 .remove = __devexit_p(b43_pcmcia_remove),
148 .suspend = b43_pcmcia_suspend, 162 .suspend = b43_pcmcia_suspend,
149 .resume = b43_pcmcia_resume, 163 .resume = b43_pcmcia_resume,
150}; 164};
151 165
152int b43_pcmcia_init(void) 166int b43_pcmcia_init(void)
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 800e0a61a7f5..9b1f905ffbf4 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -47,32 +47,35 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
47 struct b43_wldev *dev = poll_dev->private; 47 struct b43_wldev *dev = poll_dev->private;
48 struct b43_wl *wl = dev->wl; 48 struct b43_wl *wl = dev->wl;
49 bool enabled; 49 bool enabled;
50 bool report_change = 0;
50 51
51 mutex_lock(&wl->mutex); 52 mutex_lock(&wl->mutex);
52 B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); 53 B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED);
53 enabled = b43_is_hw_radio_enabled(dev); 54 enabled = b43_is_hw_radio_enabled(dev);
54 if (unlikely(enabled != dev->radio_hw_enable)) { 55 if (unlikely(enabled != dev->radio_hw_enable)) {
55 dev->radio_hw_enable = enabled; 56 dev->radio_hw_enable = enabled;
57 report_change = 1;
56 b43info(wl, "Radio hardware status changed to %s\n", 58 b43info(wl, "Radio hardware status changed to %s\n",
57 enabled ? "ENABLED" : "DISABLED"); 59 enabled ? "ENABLED" : "DISABLED");
58 mutex_unlock(&wl->mutex); 60 }
61 mutex_unlock(&wl->mutex);
62
63 if (unlikely(report_change))
59 input_report_key(poll_dev->input, KEY_WLAN, enabled); 64 input_report_key(poll_dev->input, KEY_WLAN, enabled);
60 } else
61 mutex_unlock(&wl->mutex);
62} 65}
63 66
64/* Called when the RFKILL toggled in software. 67/* Called when the RFKILL toggled in software. */
65 * This is called without locking. */
66static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) 68static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state)
67{ 69{
68 struct b43_wldev *dev = data; 70 struct b43_wldev *dev = data;
69 struct b43_wl *wl = dev->wl; 71 struct b43_wl *wl = dev->wl;
70 int err = 0; 72 int err = 0;
71 73
72 mutex_lock(&wl->mutex); 74 if (!wl->rfkill.registered)
73 if (b43_status(dev) < B43_STAT_INITIALIZED) 75 return 0;
74 goto out_unlock;
75 76
77 mutex_lock(&wl->mutex);
78 B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED);
76 switch (state) { 79 switch (state) {
77 case RFKILL_STATE_ON: 80 case RFKILL_STATE_ON:
78 if (!dev->radio_hw_enable) { 81 if (!dev->radio_hw_enable) {
@@ -89,7 +92,6 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state)
89 b43_radio_turn_off(dev, 0); 92 b43_radio_turn_off(dev, 0);
90 break; 93 break;
91 } 94 }
92
93out_unlock: 95out_unlock:
94 mutex_unlock(&wl->mutex); 96 mutex_unlock(&wl->mutex);
95 97
@@ -98,11 +100,11 @@ out_unlock:
98 100
99char * b43_rfkill_led_name(struct b43_wldev *dev) 101char * b43_rfkill_led_name(struct b43_wldev *dev)
100{ 102{
101 struct b43_wl *wl = dev->wl; 103 struct b43_rfkill *rfk = &(dev->wl->rfkill);
102 104
103 if (!wl->rfkill.rfkill) 105 if (!rfk->registered)
104 return NULL; 106 return NULL;
105 return rfkill_get_led_name(wl->rfkill.rfkill); 107 return rfkill_get_led_name(rfk->rfkill);
106} 108}
107 109
108void b43_rfkill_init(struct b43_wldev *dev) 110void b43_rfkill_init(struct b43_wldev *dev)
@@ -111,53 +113,13 @@ void b43_rfkill_init(struct b43_wldev *dev)
111 struct b43_rfkill *rfk = &(wl->rfkill); 113 struct b43_rfkill *rfk = &(wl->rfkill);
112 int err; 114 int err;
113 115
114 if (rfk->rfkill) { 116 rfk->registered = 0;
115 err = rfkill_register(rfk->rfkill);
116 if (err) {
117 b43warn(wl, "Failed to register RF-kill button\n");
118 goto err_free_rfk;
119 }
120 }
121 if (rfk->poll_dev) {
122 err = input_register_polled_device(rfk->poll_dev);
123 if (err) {
124 b43warn(wl, "Failed to register RF-kill polldev\n");
125 goto err_free_polldev;
126 }
127 }
128
129 return;
130err_free_rfk:
131 rfkill_free(rfk->rfkill);
132 rfk->rfkill = NULL;
133err_free_polldev:
134 input_free_polled_device(rfk->poll_dev);
135 rfk->poll_dev = NULL;
136}
137
138void b43_rfkill_exit(struct b43_wldev *dev)
139{
140 struct b43_rfkill *rfk = &(dev->wl->rfkill);
141
142 if (rfk->poll_dev)
143 input_unregister_polled_device(rfk->poll_dev);
144 if (rfk->rfkill)
145 rfkill_unregister(rfk->rfkill);
146}
147
148void b43_rfkill_alloc(struct b43_wldev *dev)
149{
150 struct b43_wl *wl = dev->wl;
151 struct b43_rfkill *rfk = &(wl->rfkill);
152 117
118 rfk->rfkill = rfkill_allocate(dev->dev->dev, RFKILL_TYPE_WLAN);
119 if (!rfk->rfkill)
120 goto out_error;
153 snprintf(rfk->name, sizeof(rfk->name), 121 snprintf(rfk->name, sizeof(rfk->name),
154 "b43-%s", wiphy_name(wl->hw->wiphy)); 122 "b43-%s", wiphy_name(wl->hw->wiphy));
155
156 rfk->rfkill = rfkill_allocate(dev->dev->dev, RFKILL_TYPE_WLAN);
157 if (!rfk->rfkill) {
158 b43warn(wl, "Failed to allocate RF-kill button\n");
159 return;
160 }
161 rfk->rfkill->name = rfk->name; 123 rfk->rfkill->name = rfk->name;
162 rfk->rfkill->state = RFKILL_STATE_ON; 124 rfk->rfkill->state = RFKILL_STATE_ON;
163 rfk->rfkill->data = dev; 125 rfk->rfkill->data = dev;
@@ -165,18 +127,45 @@ void b43_rfkill_alloc(struct b43_wldev *dev)
165 rfk->rfkill->user_claim_unsupported = 1; 127 rfk->rfkill->user_claim_unsupported = 1;
166 128
167 rfk->poll_dev = input_allocate_polled_device(); 129 rfk->poll_dev = input_allocate_polled_device();
168 if (rfk->poll_dev) { 130 if (!rfk->poll_dev)
169 rfk->poll_dev->private = dev; 131 goto err_free_rfk;
170 rfk->poll_dev->poll = b43_rfkill_poll; 132 rfk->poll_dev->private = dev;
171 rfk->poll_dev->poll_interval = 1000; /* msecs */ 133 rfk->poll_dev->poll = b43_rfkill_poll;
172 } else 134 rfk->poll_dev->poll_interval = 1000; /* msecs */
173 b43warn(wl, "Failed to allocate RF-kill polldev\n"); 135
136 err = rfkill_register(rfk->rfkill);
137 if (err)
138 goto err_free_polldev;
139 err = input_register_polled_device(rfk->poll_dev);
140 if (err)
141 goto err_unreg_rfk;
142
143 rfk->registered = 1;
144
145 return;
146err_unreg_rfk:
147 rfkill_unregister(rfk->rfkill);
148err_free_polldev:
149 input_free_polled_device(rfk->poll_dev);
150 rfk->poll_dev = NULL;
151err_free_rfk:
152 rfkill_free(rfk->rfkill);
153 rfk->rfkill = NULL;
154out_error:
155 rfk->registered = 0;
156 b43warn(wl, "RF-kill button init failed\n");
174} 157}
175 158
176void b43_rfkill_free(struct b43_wldev *dev) 159void b43_rfkill_exit(struct b43_wldev *dev)
177{ 160{
178 struct b43_rfkill *rfk = &(dev->wl->rfkill); 161 struct b43_rfkill *rfk = &(dev->wl->rfkill);
179 162
163 if (!rfk->registered)
164 return;
165 rfk->registered = 0;
166
167 input_unregister_polled_device(rfk->poll_dev);
168 rfkill_unregister(rfk->rfkill);
180 input_free_polled_device(rfk->poll_dev); 169 input_free_polled_device(rfk->poll_dev);
181 rfk->poll_dev = NULL; 170 rfk->poll_dev = NULL;
182 rfkill_free(rfk->rfkill); 171 rfkill_free(rfk->rfkill);
diff --git a/drivers/net/wireless/b43/rfkill.h b/drivers/net/wireless/b43/rfkill.h
index 29544e8c9e5f..adacf936d815 100644
--- a/drivers/net/wireless/b43/rfkill.h
+++ b/drivers/net/wireless/b43/rfkill.h
@@ -15,14 +15,14 @@ struct b43_rfkill {
15 struct rfkill *rfkill; 15 struct rfkill *rfkill;
16 /* The poll device for the RFKILL input button */ 16 /* The poll device for the RFKILL input button */
17 struct input_polled_dev *poll_dev; 17 struct input_polled_dev *poll_dev;
18 /* Did initialization succeed? Used for freeing. */
19 bool registered;
18 /* The unique name of this rfkill switch */ 20 /* The unique name of this rfkill switch */
19 char name[32]; 21 char name[sizeof("b43-phy4294967295")];
20}; 22};
21 23
22/* All the init functions return void, because we are not interested 24/* The init function returns void, because we are not interested
23 * in failing the b43 init process when rfkill init failed. */ 25 * in failing the b43 init process when rfkill init failed. */
24void b43_rfkill_alloc(struct b43_wldev *dev);
25void b43_rfkill_free(struct b43_wldev *dev);
26void b43_rfkill_init(struct b43_wldev *dev); 26void b43_rfkill_init(struct b43_wldev *dev);
27void b43_rfkill_exit(struct b43_wldev *dev); 27void b43_rfkill_exit(struct b43_wldev *dev);
28 28
@@ -36,12 +36,6 @@ struct b43_rfkill {
36 /* empty */ 36 /* empty */
37}; 37};
38 38
39static inline void b43_rfkill_alloc(struct b43_wldev *dev)
40{
41}
42static inline void b43_rfkill_free(struct b43_wldev *dev)
43{
44}
45static inline void b43_rfkill_init(struct b43_wldev *dev) 39static inline void b43_rfkill_init(struct b43_wldev *dev)
46{ 40{
47} 41}
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c
index eefa6fb79685..619b4534ef09 100644
--- a/drivers/net/wireless/b43legacy/debugfs.c
+++ b/drivers/net/wireless/b43legacy/debugfs.c
@@ -124,7 +124,7 @@ static ssize_t shm_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufs
124 __le16 *le16buf = (__le16 *)buf; 124 __le16 *le16buf = (__le16 *)buf;
125 125
126 for (i = 0; i < 0x1000; i++) { 126 for (i = 0; i < 0x1000; i++) {
127 if (bufsize <= 0) 127 if (bufsize < sizeof(tmp))
128 break; 128 break;
129 tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 2 * i); 129 tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 2 * i);
130 le16buf[i] = cpu_to_le16(tmp); 130 le16buf[i] = cpu_to_le16(tmp);
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index d09479e816cd..3bde1e9ab428 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:
@@ -2781,6 +2781,17 @@ static void b43legacy_wireless_core_stop(struct b43legacy_wldev *dev)
2781 2781
2782 if (b43legacy_status(dev) < B43legacy_STAT_STARTED) 2782 if (b43legacy_status(dev) < B43legacy_STAT_STARTED)
2783 return; 2783 return;
2784
2785 /* Disable and sync interrupts. We must do this before than
2786 * setting the status to INITIALIZED, as the interrupt handler
2787 * won't care about IRQs then. */
2788 spin_lock_irqsave(&wl->irq_lock, flags);
2789 dev->irq_savedstate = b43legacy_interrupt_disable(dev,
2790 B43legacy_IRQ_ALL);
2791 b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_MASK); /* flush */
2792 spin_unlock_irqrestore(&wl->irq_lock, flags);
2793 b43legacy_synchronize_irq(dev);
2794
2784 b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED); 2795 b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED);
2785 2796
2786 mutex_unlock(&wl->mutex); 2797 mutex_unlock(&wl->mutex);
@@ -2791,14 +2802,6 @@ static void b43legacy_wireless_core_stop(struct b43legacy_wldev *dev)
2791 2802
2792 ieee80211_stop_queues(wl->hw); /* FIXME this could cause a deadlock */ 2803 ieee80211_stop_queues(wl->hw); /* FIXME this could cause a deadlock */
2793 2804
2794 /* Disable and sync interrupts. */
2795 spin_lock_irqsave(&wl->irq_lock, flags);
2796 dev->irq_savedstate = b43legacy_interrupt_disable(dev,
2797 B43legacy_IRQ_ALL);
2798 b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_MASK); /* flush */
2799 spin_unlock_irqrestore(&wl->irq_lock, flags);
2800 b43legacy_synchronize_irq(dev);
2801
2802 b43legacy_mac_suspend(dev); 2805 b43legacy_mac_suspend(dev);
2803 free_irq(dev->dev->irq, dev); 2806 free_irq(dev->dev->irq, dev);
2804 b43legacydbg(wl, "Wireless interface stopped\n"); 2807 b43legacydbg(wl, "Wireless interface stopped\n");
@@ -3332,7 +3335,7 @@ out_mutex_unlock:
3332 return err; 3335 return err;
3333} 3336}
3334 3337
3335void b43legacy_stop(struct ieee80211_hw *hw) 3338static void b43legacy_stop(struct ieee80211_hw *hw)
3336{ 3339{
3337 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); 3340 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3338 struct b43legacy_wldev *dev = wl->current_dev; 3341 struct b43legacy_wldev *dev = wl->current_dev;
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
index 7da3664b8515..fc876ba18572 100644
--- a/drivers/net/wireless/hostap/hostap_pci.c
+++ b/drivers/net/wireless/hostap/hostap_pci.c
@@ -444,7 +444,7 @@ static int prism2_pci_resume(struct pci_dev *pdev)
444 444
445MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); 445MODULE_DEVICE_TABLE(pci, prism2_pci_id_table);
446 446
447static struct pci_driver prism2_pci_drv_id = { 447static struct pci_driver prism2_pci_driver = {
448 .name = "hostap_pci", 448 .name = "hostap_pci",
449 .id_table = prism2_pci_id_table, 449 .id_table = prism2_pci_id_table,
450 .probe = prism2_pci_probe, 450 .probe = prism2_pci_probe,
@@ -458,13 +458,13 @@ static struct pci_driver prism2_pci_drv_id = {
458 458
459static int __init init_prism2_pci(void) 459static int __init init_prism2_pci(void)
460{ 460{
461 return pci_register_driver(&prism2_pci_drv_id); 461 return pci_register_driver(&prism2_pci_driver);
462} 462}
463 463
464 464
465static void __exit exit_prism2_pci(void) 465static void __exit exit_prism2_pci(void)
466{ 466{
467 pci_unregister_driver(&prism2_pci_drv_id); 467 pci_unregister_driver(&prism2_pci_driver);
468} 468}
469 469
470 470
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index a6c7904de282..fc6cdd8086c1 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -1267,7 +1267,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
1267 IPW2100_INTA_FATAL_ERROR | 1267 IPW2100_INTA_FATAL_ERROR |
1268 IPW2100_INTA_PARITY_ERROR); 1268 IPW2100_INTA_PARITY_ERROR);
1269 } 1269 }
1270 } while (i--); 1270 } while (--i);
1271 1271
1272 /* Clear out any pending INTAs since we aren't supposed to have 1272 /* Clear out any pending INTAs since we aren't supposed to have
1273 * interrupts enabled at this point... */ 1273 * interrupts enabled at this point... */
@@ -1339,7 +1339,7 @@ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv)
1339 1339
1340 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) 1340 if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED)
1341 break; 1341 break;
1342 } while (i--); 1342 } while (--i);
1343 1343
1344 priv->status &= ~STATUS_RESET_PENDING; 1344 priv->status &= ~STATUS_RESET_PENDING;
1345 1345
@@ -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-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 262ab0b55824..c48b1b537d2b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -71,19 +71,19 @@ struct iwl_rate_scale_priv {
71}; 71};
72 72
73static s32 iwl_expected_tpt_g[IWL_RATE_COUNT] = { 73static s32 iwl_expected_tpt_g[IWL_RATE_COUNT] = {
74 0, 0, 76, 104, 130, 168, 191, 202, 7, 13, 35, 58 74 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202
75}; 75};
76 76
77static s32 iwl_expected_tpt_g_prot[IWL_RATE_COUNT] = { 77static s32 iwl_expected_tpt_g_prot[IWL_RATE_COUNT] = {
78 0, 0, 0, 80, 93, 113, 123, 125, 7, 13, 35, 58 78 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125
79}; 79};
80 80
81static s32 iwl_expected_tpt_a[IWL_RATE_COUNT] = { 81static s32 iwl_expected_tpt_a[IWL_RATE_COUNT] = {
82 40, 57, 72, 98, 121, 154, 177, 186, 0, 0, 0, 0 82 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186
83}; 83};
84 84
85static s32 iwl_expected_tpt_b[IWL_RATE_COUNT] = { 85static s32 iwl_expected_tpt_b[IWL_RATE_COUNT] = {
86 0, 0, 0, 0, 0, 0, 0, 0, 7, 13, 35, 58 86 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0
87}; 87};
88 88
89struct iwl_tpt_entry { 89struct iwl_tpt_entry {
@@ -350,6 +350,10 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
350 350
351 sta->last_txrate = sta->txrate; 351 sta->last_txrate = sta->txrate;
352 352
353 /* For MODE_IEEE80211A mode it start at IWL_FIRST_OFDM_RATE */
354 if (local->hw.conf.phymode == MODE_IEEE80211A)
355 sta->last_txrate += IWL_FIRST_OFDM_RATE;
356
353 IWL_DEBUG_RATE("leave\n"); 357 IWL_DEBUG_RATE("leave\n");
354} 358}
355 359
@@ -417,6 +421,33 @@ static void rs_free_sta(void *priv, void *priv_sta)
417 IWL_DEBUG_RATE("leave\n"); 421 IWL_DEBUG_RATE("leave\n");
418} 422}
419 423
424
425/*
426 * get ieee prev rate from rate scale table.
427 * for A and B mode we need to overright prev
428 * value
429 */
430static int rs_adjust_next_rate(struct iwl_priv *priv, int rate)
431{
432 int next_rate = iwl_get_prev_ieee_rate(rate);
433
434 switch (priv->phymode) {
435 case MODE_IEEE80211A:
436 if (rate == IWL_RATE_12M_INDEX)
437 next_rate = IWL_RATE_9M_INDEX;
438 else if (rate == IWL_RATE_6M_INDEX)
439 next_rate = IWL_RATE_6M_INDEX;
440 break;
441 case MODE_IEEE80211B:
442 if (rate == IWL_RATE_11M_INDEX_TABLE)
443 next_rate = IWL_RATE_5M_INDEX_TABLE;
444 break;
445 default:
446 break;
447 }
448
449 return next_rate;
450}
420/** 451/**
421 * rs_tx_status - Update rate control values based on Tx results 452 * rs_tx_status - Update rate control values based on Tx results
422 * 453 *
@@ -479,7 +510,8 @@ static void rs_tx_status(void *priv_rate,
479 last_index = scale_rate_index; 510 last_index = scale_rate_index;
480 } else { 511 } else {
481 current_count = priv->retry_rate; 512 current_count = priv->retry_rate;
482 last_index = iwl_get_prev_ieee_rate(scale_rate_index); 513 last_index = rs_adjust_next_rate(priv,
514 scale_rate_index);
483 } 515 }
484 516
485 /* Update this rate accounting for as many retries 517 /* Update this rate accounting for as many retries
@@ -494,9 +526,10 @@ static void rs_tx_status(void *priv_rate,
494 526
495 if (retries) 527 if (retries)
496 scale_rate_index = 528 scale_rate_index =
497 iwl_get_prev_ieee_rate(scale_rate_index); 529 rs_adjust_next_rate(priv, scale_rate_index);
498 } 530 }
499 531
532
500 /* Update the last index window with success/failure based on ACK */ 533 /* Update the last index window with success/failure based on ACK */
501 IWL_DEBUG_RATE("Update rate %d with %s.\n", 534 IWL_DEBUG_RATE("Update rate %d with %s.\n",
502 last_index, 535 last_index,
@@ -672,7 +705,10 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,
672 } 705 }
673 706
674 rate_mask = sta->supp_rates; 707 rate_mask = sta->supp_rates;
675 index = min(sta->txrate & 0xffff, IWL_RATE_COUNT - 1); 708 index = min(sta->last_txrate & 0xffff, IWL_RATE_COUNT - 1);
709
710 if (priv->phymode == (u8) MODE_IEEE80211A)
711 rate_mask = rate_mask << IWL_FIRST_OFDM_RATE;
676 712
677 rs_priv = (void *)sta->rate_ctrl_priv; 713 rs_priv = (void *)sta->rate_ctrl_priv;
678 714
@@ -801,7 +837,11 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,
801 out: 837 out:
802 838
803 sta->last_txrate = index; 839 sta->last_txrate = index;
804 sta->txrate = sta->last_txrate; 840 if (priv->phymode == (u8) MODE_IEEE80211A)
841 sta->txrate = sta->last_txrate - IWL_FIRST_OFDM_RATE;
842 else
843 sta->txrate = sta->last_txrate;
844
805 sta_info_put(sta); 845 sta_info_put(sta);
806 846
807 IWL_DEBUG_RATE("leave: %d\n", index); 847 IWL_DEBUG_RATE("leave: %d\n", index);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
index b926738e0ea1..bec4d3ffca1d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
@@ -36,10 +36,17 @@ struct iwl_rate_info {
36 u8 next_rs; /* next rate used in rs algo */ 36 u8 next_rs; /* next rate used in rs algo */
37 u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ 37 u8 prev_rs_tgg; /* previous rate used in TGG rs algo */
38 u8 next_rs_tgg; /* next rate used in TGG rs algo */ 38 u8 next_rs_tgg; /* next rate used in TGG rs algo */
39 u8 table_rs_index; /* index in rate scale table cmd */
40 u8 prev_table_rs; /* prev in rate table cmd */
41
39}; 42};
40 43
41enum { 44enum {
42 IWL_RATE_6M_INDEX = 0, 45 IWL_RATE_1M_INDEX = 0,
46 IWL_RATE_2M_INDEX,
47 IWL_RATE_5M_INDEX,
48 IWL_RATE_11M_INDEX,
49 IWL_RATE_6M_INDEX,
43 IWL_RATE_9M_INDEX, 50 IWL_RATE_9M_INDEX,
44 IWL_RATE_12M_INDEX, 51 IWL_RATE_12M_INDEX,
45 IWL_RATE_18M_INDEX, 52 IWL_RATE_18M_INDEX,
@@ -47,16 +54,28 @@ enum {
47 IWL_RATE_36M_INDEX, 54 IWL_RATE_36M_INDEX,
48 IWL_RATE_48M_INDEX, 55 IWL_RATE_48M_INDEX,
49 IWL_RATE_54M_INDEX, 56 IWL_RATE_54M_INDEX,
50 IWL_RATE_1M_INDEX,
51 IWL_RATE_2M_INDEX,
52 IWL_RATE_5M_INDEX,
53 IWL_RATE_11M_INDEX,
54 IWL_RATE_COUNT, 57 IWL_RATE_COUNT,
55 IWL_RATE_INVM_INDEX, 58 IWL_RATE_INVM_INDEX,
56 IWL_RATE_INVALID = IWL_RATE_INVM_INDEX 59 IWL_RATE_INVALID = IWL_RATE_INVM_INDEX
57}; 60};
58 61
59enum { 62enum {
63 IWL_RATE_6M_INDEX_TABLE = 0,
64 IWL_RATE_9M_INDEX_TABLE,
65 IWL_RATE_12M_INDEX_TABLE,
66 IWL_RATE_18M_INDEX_TABLE,
67 IWL_RATE_24M_INDEX_TABLE,
68 IWL_RATE_36M_INDEX_TABLE,
69 IWL_RATE_48M_INDEX_TABLE,
70 IWL_RATE_54M_INDEX_TABLE,
71 IWL_RATE_1M_INDEX_TABLE,
72 IWL_RATE_2M_INDEX_TABLE,
73 IWL_RATE_5M_INDEX_TABLE,
74 IWL_RATE_11M_INDEX_TABLE,
75 IWL_RATE_INVM_INDEX_TABLE = IWL_RATE_INVM_INDEX,
76};
77
78enum {
60 IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX, 79 IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX,
61 IWL_LAST_OFDM_RATE = IWL_RATE_54M_INDEX, 80 IWL_LAST_OFDM_RATE = IWL_RATE_54M_INDEX,
62 IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX, 81 IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX,
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 19bcb01e2784..3a45fe99a83e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -54,7 +54,9 @@
54 IWL_RATE_##rp##M_INDEX, \ 54 IWL_RATE_##rp##M_INDEX, \
55 IWL_RATE_##rn##M_INDEX, \ 55 IWL_RATE_##rn##M_INDEX, \
56 IWL_RATE_##pp##M_INDEX, \ 56 IWL_RATE_##pp##M_INDEX, \
57 IWL_RATE_##np##M_INDEX } 57 IWL_RATE_##np##M_INDEX, \
58 IWL_RATE_##r##M_INDEX_TABLE, \
59 IWL_RATE_##ip##M_INDEX_TABLE }
58 60
59/* 61/*
60 * Parameter order: 62 * Parameter order:
@@ -65,6 +67,10 @@
65 * 67 *
66 */ 68 */
67const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { 69const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
70 IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */
71 IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */
72 IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */
73 IWL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */
68 IWL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */ 74 IWL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */
69 IWL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */ 75 IWL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */
70 IWL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */ 76 IWL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */
@@ -73,10 +79,6 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
73 IWL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */ 79 IWL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */
74 IWL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */ 80 IWL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */
75 IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ 81 IWL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */
76 IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */
77 IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */
78 IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */
79 IWL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */
80}; 82};
81 83
82/* 1 = enable the iwl_disable_events() function */ 84/* 1 = enable the iwl_disable_events() function */
@@ -662,10 +664,11 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
662 cmd->cmd.tx.tx_flags = tx_flags; 664 cmd->cmd.tx.tx_flags = tx_flags;
663 665
664 /* OFDM */ 666 /* OFDM */
665 cmd->cmd.tx.supp_rates[0] = rate_mask & IWL_OFDM_RATES_MASK; 667 cmd->cmd.tx.supp_rates[0] =
668 ((rate_mask & IWL_OFDM_RATES_MASK) >> IWL_FIRST_OFDM_RATE) & 0xFF;
666 669
667 /* CCK */ 670 /* CCK */
668 cmd->cmd.tx.supp_rates[1] = (rate_mask >> 8) & 0xF; 671 cmd->cmd.tx.supp_rates[1] = (rate_mask & 0xF);
669 672
670 IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " 673 IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X "
671 "cck/ofdm mask: 0x%x/0x%x\n", sta_id, 674 "cck/ofdm mask: 0x%x/0x%x\n", sta_id,
@@ -1432,7 +1435,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
1432 /* use this channel group's 6Mbit clipping/saturation pwr, 1435 /* use this channel group's 6Mbit clipping/saturation pwr,
1433 * but cap at regulatory scan power restriction (set during init 1436 * but cap at regulatory scan power restriction (set during init
1434 * based on eeprom channel data) for this channel. */ 1437 * based on eeprom channel data) for this channel. */
1435 power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX]); 1438 power = min(ch_info->scan_power, clip_pwrs[IWL_RATE_6M_INDEX_TABLE]);
1436 1439
1437 /* further limit to user's max power preference. 1440 /* further limit to user's max power preference.
1438 * FIXME: Other spectrum management power limitations do not 1441 * FIXME: Other spectrum management power limitations do not
@@ -1447,7 +1450,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
1447 * *index*. */ 1450 * *index*. */
1448 power_index = ch_info->power_info[rate_index].power_table_index 1451 power_index = ch_info->power_info[rate_index].power_table_index
1449 - (power - ch_info->power_info 1452 - (power - ch_info->power_info
1450 [IWL_RATE_6M_INDEX].requested_power) * 2; 1453 [IWL_RATE_6M_INDEX_TABLE].requested_power) * 2;
1451 1454
1452 /* store reference index that we use when adjusting *all* scan 1455 /* store reference index that we use when adjusting *all* scan
1453 * powers. So we can accommodate user (all channel) or spectrum 1456 * powers. So we can accommodate user (all channel) or spectrum
@@ -1476,7 +1479,7 @@ static void iwl_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
1476 */ 1479 */
1477int iwl_hw_reg_send_txpower(struct iwl_priv *priv) 1480int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
1478{ 1481{
1479 int rate_idx; 1482 int rate_idx, i;
1480 const struct iwl_channel_info *ch_info = NULL; 1483 const struct iwl_channel_info *ch_info = NULL;
1481 struct iwl_txpowertable_cmd txpower = { 1484 struct iwl_txpowertable_cmd txpower = {
1482 .channel = priv->active_rxon.channel, 1485 .channel = priv->active_rxon.channel,
@@ -1500,20 +1503,36 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)
1500 } 1503 }
1501 1504
1502 /* fill cmd with power settings for all rates for current channel */ 1505 /* fill cmd with power settings for all rates for current channel */
1503 for (rate_idx = 0; rate_idx < IWL_RATE_COUNT; rate_idx++) { 1506 /* Fill OFDM rate */
1504 txpower.power[rate_idx].tpc = ch_info->power_info[rate_idx].tpc; 1507 for (rate_idx = IWL_FIRST_OFDM_RATE, i = 0;
1505 txpower.power[rate_idx].rate = iwl_rates[rate_idx].plcp; 1508 rate_idx <= IWL_LAST_OFDM_RATE; rate_idx++, i++) {
1509
1510 txpower.power[i].tpc = ch_info->power_info[i].tpc;
1511 txpower.power[i].rate = iwl_rates[rate_idx].plcp;
1506 1512
1507 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", 1513 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
1508 le16_to_cpu(txpower.channel), 1514 le16_to_cpu(txpower.channel),
1509 txpower.band, 1515 txpower.band,
1510 txpower.power[rate_idx].tpc.tx_gain, 1516 txpower.power[i].tpc.tx_gain,
1511 txpower.power[rate_idx].tpc.dsp_atten, 1517 txpower.power[i].tpc.dsp_atten,
1512 txpower.power[rate_idx].rate); 1518 txpower.power[i].rate);
1519 }
1520 /* Fill CCK rates */
1521 for (rate_idx = IWL_FIRST_CCK_RATE;
1522 rate_idx <= IWL_LAST_CCK_RATE; rate_idx++, i++) {
1523 txpower.power[i].tpc = ch_info->power_info[i].tpc;
1524 txpower.power[i].rate = iwl_rates[rate_idx].plcp;
1525
1526 IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
1527 le16_to_cpu(txpower.channel),
1528 txpower.band,
1529 txpower.power[i].tpc.tx_gain,
1530 txpower.power[i].tpc.dsp_atten,
1531 txpower.power[i].rate);
1513 } 1532 }
1514 1533
1515 return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, 1534 return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
1516 sizeof(struct iwl_txpowertable_cmd), &txpower); 1535 sizeof(struct iwl_txpowertable_cmd), &txpower);
1517 1536
1518} 1537}
1519 1538
@@ -1549,7 +1568,7 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
1549 power_info = ch_info->power_info; 1568 power_info = ch_info->power_info;
1550 1569
1551 /* update OFDM Txpower settings */ 1570 /* update OFDM Txpower settings */
1552 for (i = IWL_FIRST_OFDM_RATE; i <= IWL_LAST_OFDM_RATE; 1571 for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE;
1553 i++, ++power_info) { 1572 i++, ++power_info) {
1554 int delta_idx; 1573 int delta_idx;
1555 1574
@@ -1573,14 +1592,14 @@ static int iwl_hw_reg_set_new_power(struct iwl_priv *priv,
1573 * ... all CCK power settings for a given channel are the *same*. */ 1592 * ... all CCK power settings for a given channel are the *same*. */
1574 if (power_changed) { 1593 if (power_changed) {
1575 power = 1594 power =
1576 ch_info->power_info[IWL_RATE_12M_INDEX]. 1595 ch_info->power_info[IWL_RATE_12M_INDEX_TABLE].
1577 requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF; 1596 requested_power + IWL_CCK_FROM_OFDM_POWER_DIFF;
1578 1597
1579 /* do all CCK rates' iwl_channel_power_info structures */ 1598 /* do all CCK rates' iwl_channel_power_info structures */
1580 for (i = IWL_FIRST_CCK_RATE; i <= IWL_LAST_CCK_RATE; i++) { 1599 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++) {
1581 power_info->requested_power = power; 1600 power_info->requested_power = power;
1582 power_info->base_power_index = 1601 power_info->base_power_index =
1583 ch_info->power_info[IWL_RATE_12M_INDEX]. 1602 ch_info->power_info[IWL_RATE_12M_INDEX_TABLE].
1584 base_power_index + IWL_CCK_FROM_OFDM_INDEX_DIFF; 1603 base_power_index + IWL_CCK_FROM_OFDM_INDEX_DIFF;
1585 ++power_info; 1604 ++power_info;
1586 } 1605 }
@@ -1674,7 +1693,7 @@ static int iwl_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
1674 for (scan_tbl_index = 0; 1693 for (scan_tbl_index = 0;
1675 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { 1694 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) {
1676 s32 actual_index = (scan_tbl_index == 0) ? 1695 s32 actual_index = (scan_tbl_index == 0) ?
1677 IWL_RATE_1M_INDEX : IWL_RATE_6M_INDEX; 1696 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE;
1678 iwl_hw_reg_set_scan_power(priv, scan_tbl_index, 1697 iwl_hw_reg_set_scan_power(priv, scan_tbl_index,
1679 actual_index, clip_pwrs, 1698 actual_index, clip_pwrs,
1680 ch_info, a_band); 1699 ch_info, a_band);
@@ -1905,19 +1924,19 @@ static void iwl_hw_reg_init_channel_groups(struct iwl_priv *priv)
1905 for (rate_index = 0; 1924 for (rate_index = 0;
1906 rate_index < IWL_RATE_COUNT; rate_index++, clip_pwrs++) { 1925 rate_index < IWL_RATE_COUNT; rate_index++, clip_pwrs++) {
1907 switch (rate_index) { 1926 switch (rate_index) {
1908 case IWL_RATE_36M_INDEX: 1927 case IWL_RATE_36M_INDEX_TABLE:
1909 if (i == 0) /* B/G */ 1928 if (i == 0) /* B/G */
1910 *clip_pwrs = satur_pwr; 1929 *clip_pwrs = satur_pwr;
1911 else /* A */ 1930 else /* A */
1912 *clip_pwrs = satur_pwr - 5; 1931 *clip_pwrs = satur_pwr - 5;
1913 break; 1932 break;
1914 case IWL_RATE_48M_INDEX: 1933 case IWL_RATE_48M_INDEX_TABLE:
1915 if (i == 0) 1934 if (i == 0)
1916 *clip_pwrs = satur_pwr - 7; 1935 *clip_pwrs = satur_pwr - 7;
1917 else 1936 else
1918 *clip_pwrs = satur_pwr - 10; 1937 *clip_pwrs = satur_pwr - 10;
1919 break; 1938 break;
1920 case IWL_RATE_54M_INDEX: 1939 case IWL_RATE_54M_INDEX_TABLE:
1921 if (i == 0) 1940 if (i == 0)
1922 *clip_pwrs = satur_pwr - 9; 1941 *clip_pwrs = satur_pwr - 9;
1923 else 1942 else
@@ -2031,7 +2050,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2031 } 2050 }
2032 2051
2033 /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ 2052 /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/
2034 pwr_info = &ch_info->power_info[IWL_RATE_12M_INDEX]; 2053 pwr_info = &ch_info->power_info[IWL_RATE_12M_INDEX_TABLE];
2035 power = pwr_info->requested_power + 2054 power = pwr_info->requested_power +
2036 IWL_CCK_FROM_OFDM_POWER_DIFF; 2055 IWL_CCK_FROM_OFDM_POWER_DIFF;
2037 pwr_index = pwr_info->power_table_index + 2056 pwr_index = pwr_info->power_table_index +
@@ -2047,9 +2066,9 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2047 /* fill each CCK rate's iwl_channel_power_info structure 2066 /* fill each CCK rate's iwl_channel_power_info structure
2048 * NOTE: All CCK-rate Txpwrs are the same for a given chnl! 2067 * NOTE: All CCK-rate Txpwrs are the same for a given chnl!
2049 * NOTE: CCK rates start at end of OFDM rates! */ 2068 * NOTE: CCK rates start at end of OFDM rates! */
2050 for (rate_index = IWL_OFDM_RATES; 2069 for (rate_index = 0;
2051 rate_index < IWL_RATE_COUNT; rate_index++) { 2070 rate_index < IWL_CCK_RATES; rate_index++) {
2052 pwr_info = &ch_info->power_info[rate_index]; 2071 pwr_info = &ch_info->power_info[rate_index+IWL_OFDM_RATES];
2053 pwr_info->requested_power = power; 2072 pwr_info->requested_power = power;
2054 pwr_info->power_table_index = pwr_index; 2073 pwr_info->power_table_index = pwr_index;
2055 pwr_info->base_power_index = base_pwr_index; 2074 pwr_info->base_power_index = base_pwr_index;
@@ -2061,7 +2080,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
2061 for (scan_tbl_index = 0; 2080 for (scan_tbl_index = 0;
2062 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) { 2081 scan_tbl_index < IWL_NUM_SCAN_RATES; scan_tbl_index++) {
2063 s32 actual_index = (scan_tbl_index == 0) ? 2082 s32 actual_index = (scan_tbl_index == 0) ?
2064 IWL_RATE_1M_INDEX : IWL_RATE_6M_INDEX; 2083 IWL_RATE_1M_INDEX_TABLE : IWL_RATE_6M_INDEX_TABLE;
2065 iwl_hw_reg_set_scan_power(priv, scan_tbl_index, 2084 iwl_hw_reg_set_scan_power(priv, scan_tbl_index,
2066 actual_index, clip_pwrs, ch_info, a_band); 2085 actual_index, clip_pwrs, ch_info, a_band);
2067 } 2086 }
@@ -2139,17 +2158,20 @@ int iwl_hw_get_rx_read(struct iwl_priv *priv)
2139 */ 2158 */
2140int iwl3945_init_hw_rate_table(struct iwl_priv *priv) 2159int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2141{ 2160{
2142 int rc, i; 2161 int rc, i, index, prev_index;
2143 struct iwl_rate_scaling_cmd rate_cmd = { 2162 struct iwl_rate_scaling_cmd rate_cmd = {
2144 .reserved = {0, 0, 0}, 2163 .reserved = {0, 0, 0},
2145 }; 2164 };
2146 struct iwl_rate_scaling_info *table = rate_cmd.table; 2165 struct iwl_rate_scaling_info *table = rate_cmd.table;
2147 2166
2148 for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) { 2167 for (i = 0; i < ARRAY_SIZE(iwl_rates); i++) {
2149 table[i].rate_n_flags = 2168 index = iwl_rates[i].table_rs_index;
2169
2170 table[index].rate_n_flags =
2150 iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0); 2171 iwl_hw_set_rate_n_flags(iwl_rates[i].plcp, 0);
2151 table[i].try_cnt = priv->retry_rate; 2172 table[index].try_cnt = priv->retry_rate;
2152 table[i].next_rate_index = iwl_get_prev_ieee_rate(i); 2173 prev_index = iwl_get_prev_ieee_rate(i);
2174 table[index].next_rate_index = iwl_rates[prev_index].table_rs_index;
2153 } 2175 }
2154 2176
2155 switch (priv->phymode) { 2177 switch (priv->phymode) {
@@ -2157,26 +2179,26 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
2157 IWL_DEBUG_RATE("Select A mode rate scale\n"); 2179 IWL_DEBUG_RATE("Select A mode rate scale\n");
2158 /* If one of the following CCK rates is used, 2180 /* If one of the following CCK rates is used,
2159 * have it fall back to the 6M OFDM rate */ 2181 * have it fall back to the 6M OFDM rate */
2160 for (i = IWL_FIRST_CCK_RATE; i <= IWL_LAST_CCK_RATE; i++) 2182 for (i = IWL_RATE_1M_INDEX_TABLE; i <= IWL_RATE_11M_INDEX_TABLE; i++)
2161 table[i].next_rate_index = IWL_FIRST_OFDM_RATE; 2183 table[i].next_rate_index = iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
2162 2184
2163 /* Don't fall back to CCK rates */ 2185 /* Don't fall back to CCK rates */
2164 table[IWL_RATE_12M_INDEX].next_rate_index = IWL_RATE_9M_INDEX; 2186 table[IWL_RATE_12M_INDEX_TABLE].next_rate_index = IWL_RATE_9M_INDEX_TABLE;
2165 2187
2166 /* Don't drop out of OFDM rates */ 2188 /* Don't drop out of OFDM rates */
2167 table[IWL_FIRST_OFDM_RATE].next_rate_index = 2189 table[IWL_RATE_6M_INDEX_TABLE].next_rate_index =
2168 IWL_FIRST_OFDM_RATE; 2190 iwl_rates[IWL_FIRST_OFDM_RATE].table_rs_index;
2169 break; 2191 break;
2170 2192
2171 case MODE_IEEE80211B: 2193 case MODE_IEEE80211B:
2172 IWL_DEBUG_RATE("Select B mode rate scale\n"); 2194 IWL_DEBUG_RATE("Select B mode rate scale\n");
2173 /* If an OFDM rate is used, have it fall back to the 2195 /* If an OFDM rate is used, have it fall back to the
2174 * 1M CCK rates */ 2196 * 1M CCK rates */
2175 for (i = IWL_FIRST_OFDM_RATE; i <= IWL_LAST_OFDM_RATE; i++) 2197 for (i = IWL_RATE_6M_INDEX_TABLE; i <= IWL_RATE_54M_INDEX_TABLE; i++)
2176 table[i].next_rate_index = IWL_FIRST_CCK_RATE; 2198 table[i].next_rate_index = iwl_rates[IWL_FIRST_CCK_RATE].table_rs_index;
2177 2199
2178 /* CCK shouldn't fall back to OFDM... */ 2200 /* CCK shouldn't fall back to OFDM... */
2179 table[IWL_RATE_11M_INDEX].next_rate_index = IWL_RATE_5M_INDEX; 2201 table[IWL_RATE_11M_INDEX_TABLE].next_rate_index = IWL_RATE_5M_INDEX_TABLE;
2180 break; 2202 break;
2181 2203
2182 default: 2204 default:
@@ -2248,22 +2270,12 @@ unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
2248 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | 2270 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
2249 TX_CMD_FLG_TSF_MSK); 2271 TX_CMD_FLG_TSF_MSK);
2250 2272
2251 /* supp_rates[0] == OFDM */ 2273 /* supp_rates[0] == OFDM start at IWL_FIRST_OFDM_RATE*/
2252 tx_beacon_cmd->tx.supp_rates[0] = IWL_OFDM_BASIC_RATES_MASK; 2274 tx_beacon_cmd->tx.supp_rates[0] =
2253 2275 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
2254 /* supp_rates[1] == CCK 2276
2255 *
2256 * NOTE: IWL_*_RATES_MASK are not in the order that supp_rates
2257 * expects so we have to shift them around.
2258 *
2259 * supp_rates expects:
2260 * CCK rates are bit0..3
2261 *
2262 * However IWL_*_RATES_MASK has:
2263 * CCK rates are bit8..11
2264 */
2265 tx_beacon_cmd->tx.supp_rates[1] = 2277 tx_beacon_cmd->tx.supp_rates[1] =
2266 (IWL_CCK_BASIC_RATES_MASK >> 8) & 0xF; 2278 (IWL_CCK_BASIC_RATES_MASK & 0xF);
2267 2279
2268 return (sizeof(struct iwl_tx_beacon_cmd) + frame_size); 2280 return (sizeof(struct iwl_tx_beacon_cmd) + frame_size);
2269} 2281}
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..465da4f67ce7 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4850,7 +4850,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
4850 if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { 4850 if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
4851 /* Hardware disappeared */ 4851 /* Hardware disappeared */
4852 IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); 4852 IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta);
4853 goto none; 4853 goto unplugged;
4854 } 4854 }
4855 4855
4856 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 4856 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
@@ -4858,6 +4858,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
4858 4858
4859 /* iwl_irq_tasklet() will service interrupts and re-enable them */ 4859 /* iwl_irq_tasklet() will service interrupts and re-enable them */
4860 tasklet_schedule(&priv->irq_tasklet); 4860 tasklet_schedule(&priv->irq_tasklet);
4861unplugged:
4861 spin_unlock(&priv->lock); 4862 spin_unlock(&priv->lock);
4862 4863
4863 return IRQ_HANDLED; 4864 return IRQ_HANDLED;
@@ -5331,13 +5332,13 @@ static int iwl_init_geos(struct iwl_priv *priv)
5331 /* 5.2GHz channels start after the 2.4GHz channels */ 5332 /* 5.2GHz channels start after the 2.4GHz channels */
5332 modes[A].mode = MODE_IEEE80211A; 5333 modes[A].mode = MODE_IEEE80211A;
5333 modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; 5334 modes[A].channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)];
5334 modes[A].rates = rates; 5335 modes[A].rates = &rates[4];
5335 modes[A].num_rates = 8; /* just OFDM */ 5336 modes[A].num_rates = 8; /* just OFDM */
5336 modes[A].num_channels = 0; 5337 modes[A].num_channels = 0;
5337 5338
5338 modes[B].mode = MODE_IEEE80211B; 5339 modes[B].mode = MODE_IEEE80211B;
5339 modes[B].channels = channels; 5340 modes[B].channels = channels;
5340 modes[B].rates = &rates[8]; 5341 modes[B].rates = rates;
5341 modes[B].num_rates = 4; /* just CCK */ 5342 modes[B].num_rates = 4; /* just CCK */
5342 modes[B].num_channels = 0; 5343 modes[B].num_channels = 0;
5343 5344
@@ -6478,8 +6479,9 @@ static void iwl_bg_scan_check(struct work_struct *data)
6478 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, 6479 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN,
6479 "Scan completion watchdog resetting adapter (%dms)\n", 6480 "Scan completion watchdog resetting adapter (%dms)\n",
6480 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); 6481 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
6482
6481 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 6483 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
6482 queue_work(priv->workqueue, &priv->restart); 6484 iwl_send_scan_abort(priv);
6483 } 6485 }
6484 mutex_unlock(&priv->mutex); 6486 mutex_unlock(&priv->mutex);
6485} 6487}
@@ -6575,7 +6577,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6575 spin_unlock_irqrestore(&priv->lock, flags); 6577 spin_unlock_irqrestore(&priv->lock, flags);
6576 6578
6577 scan->suspend_time = 0; 6579 scan->suspend_time = 0;
6578 scan->max_out_time = cpu_to_le32(600 * 1024); 6580 scan->max_out_time = cpu_to_le32(200 * 1024);
6579 if (!interval) 6581 if (!interval)
6580 interval = suspend_time; 6582 interval = suspend_time;
6581 /* 6583 /*
@@ -6605,7 +6607,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6605 memcpy(scan->direct_scan[0].ssid, 6607 memcpy(scan->direct_scan[0].ssid,
6606 priv->direct_ssid, priv->direct_ssid_len); 6608 priv->direct_ssid, priv->direct_ssid_len);
6607 direct_mask = 1; 6609 direct_mask = 1;
6608 } else if (!iwl_is_associated(priv)) { 6610 } else if (!iwl_is_associated(priv) && priv->essid_len) {
6609 scan->direct_scan[0].id = WLAN_EID_SSID; 6611 scan->direct_scan[0].id = WLAN_EID_SSID;
6610 scan->direct_scan[0].len = priv->essid_len; 6612 scan->direct_scan[0].len = priv->essid_len;
6611 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6613 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -6744,6 +6746,12 @@ static void iwl_bg_post_associate(struct work_struct *data)
6744 6746
6745 mutex_lock(&priv->mutex); 6747 mutex_lock(&priv->mutex);
6746 6748
6749 if (!priv->interface_id || !priv->is_open) {
6750 mutex_unlock(&priv->mutex);
6751 return;
6752 }
6753 iwl_scan_cancel_timeout(priv, 200);
6754
6747 conf = ieee80211_get_hw_conf(priv->hw); 6755 conf = ieee80211_get_hw_conf(priv->hw);
6748 6756
6749 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 6757 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
@@ -6882,9 +6890,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
6882 struct iwl_priv *priv = hw->priv; 6890 struct iwl_priv *priv = hw->priv;
6883 6891
6884 IWL_DEBUG_MAC80211("enter\n"); 6892 IWL_DEBUG_MAC80211("enter\n");
6893
6894
6895 mutex_lock(&priv->mutex);
6896 /* stop mac, cancel any scan request and clear
6897 * RXON_FILTER_ASSOC_MSK BIT
6898 */
6885 priv->is_open = 0; 6899 priv->is_open = 0;
6886 /*netif_stop_queue(dev); */ 6900 iwl_scan_cancel_timeout(priv, 100);
6887 flush_workqueue(priv->workqueue); 6901 cancel_delayed_work(&priv->post_associate);
6902 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
6903 iwl_commit_rxon(priv);
6904 mutex_unlock(&priv->mutex);
6905
6888 IWL_DEBUG_MAC80211("leave\n"); 6906 IWL_DEBUG_MAC80211("leave\n");
6889} 6907}
6890 6908
@@ -7169,8 +7187,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7169 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7187 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7170 iwl_config_ap(priv); 7188 iwl_config_ap(priv);
7171 else { 7189 else {
7172 priv->staging_rxon.filter_flags |=
7173 RXON_FILTER_ASSOC_MSK;
7174 rc = iwl_commit_rxon(priv); 7190 rc = iwl_commit_rxon(priv);
7175 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) 7191 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc)
7176 iwl_add_station(priv, 7192 iwl_add_station(priv,
@@ -7178,6 +7194,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7178 } 7194 }
7179 7195
7180 } else { 7196 } else {
7197 iwl_scan_cancel_timeout(priv, 100);
7181 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7198 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7182 iwl_commit_rxon(priv); 7199 iwl_commit_rxon(priv);
7183 } 7200 }
@@ -7217,6 +7234,12 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
7217 IWL_DEBUG_MAC80211("enter\n"); 7234 IWL_DEBUG_MAC80211("enter\n");
7218 7235
7219 mutex_lock(&priv->mutex); 7236 mutex_lock(&priv->mutex);
7237
7238 iwl_scan_cancel_timeout(priv, 100);
7239 cancel_delayed_work(&priv->post_associate);
7240 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7241 iwl_commit_rxon(priv);
7242
7220 if (priv->interface_id == conf->if_id) { 7243 if (priv->interface_id == conf->if_id) {
7221 priv->interface_id = 0; 7244 priv->interface_id = 0;
7222 memset(priv->bssid, 0, ETH_ALEN); 7245 memset(priv->bssid, 0, ETH_ALEN);
@@ -7238,6 +7261,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7238 7261
7239 IWL_DEBUG_MAC80211("enter\n"); 7262 IWL_DEBUG_MAC80211("enter\n");
7240 7263
7264 mutex_lock(&priv->mutex);
7241 spin_lock_irqsave(&priv->lock, flags); 7265 spin_lock_irqsave(&priv->lock, flags);
7242 7266
7243 if (!iwl_is_ready_rf(priv)) { 7267 if (!iwl_is_ready_rf(priv)) {
@@ -7268,7 +7292,8 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7268 priv->direct_ssid_len = (u8) 7292 priv->direct_ssid_len = (u8)
7269 min((u8) len, (u8) IW_ESSID_MAX_SIZE); 7293 min((u8) len, (u8) IW_ESSID_MAX_SIZE);
7270 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); 7294 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
7271 } 7295 } else
7296 priv->one_direct_scan = 0;
7272 7297
7273 rc = iwl_scan_initiate(priv); 7298 rc = iwl_scan_initiate(priv);
7274 7299
@@ -7276,6 +7301,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7276 7301
7277out_unlock: 7302out_unlock:
7278 spin_unlock_irqrestore(&priv->lock, flags); 7303 spin_unlock_irqrestore(&priv->lock, flags);
7304 mutex_unlock(&priv->mutex);
7279 7305
7280 return rc; 7306 return rc;
7281} 7307}
@@ -7310,6 +7336,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7310 7336
7311 mutex_lock(&priv->mutex); 7337 mutex_lock(&priv->mutex);
7312 7338
7339 iwl_scan_cancel_timeout(priv, 100);
7340
7313 switch (cmd) { 7341 switch (cmd) {
7314 case SET_KEY: 7342 case SET_KEY:
7315 rc = iwl_update_sta_key_info(priv, key, sta_id); 7343 rc = iwl_update_sta_key_info(priv, key, sta_id);
@@ -7479,8 +7507,18 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7479 7507
7480 spin_unlock_irqrestore(&priv->lock, flags); 7508 spin_unlock_irqrestore(&priv->lock, flags);
7481 7509
7510 /* we are restarting association process
7511 * clear RXON_FILTER_ASSOC_MSK bit
7512 */
7513 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
7514 iwl_scan_cancel_timeout(priv, 100);
7515 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7516 iwl_commit_rxon(priv);
7517 }
7518
7482 /* Per mac80211.h: This is only used in IBSS mode... */ 7519 /* Per mac80211.h: This is only used in IBSS mode... */
7483 if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { 7520 if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) {
7521
7484 IWL_DEBUG_MAC80211("leave - not in IBSS\n"); 7522 IWL_DEBUG_MAC80211("leave - not in IBSS\n");
7485 mutex_unlock(&priv->mutex); 7523 mutex_unlock(&priv->mutex);
7486 return; 7524 return;
@@ -8317,6 +8355,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8317 } 8355 }
8318 SET_IEEE80211_DEV(hw, &pdev->dev); 8356 SET_IEEE80211_DEV(hw, &pdev->dev);
8319 8357
8358 hw->rate_control_algorithm = "iwl-3945-rs";
8359
8320 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); 8360 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
8321 priv = hw->priv; 8361 priv = hw->priv;
8322 priv->hw = hw; 8362 priv->hw = hw;
@@ -8558,6 +8598,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8558 iwl_rate_control_unregister(priv->hw); 8598 iwl_rate_control_unregister(priv->hw);
8559 } 8599 }
8560 8600
8601 /*netif_stop_queue(dev); */
8602 flush_workqueue(priv->workqueue);
8603
8561 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes 8604 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes
8562 * priv->workqueue... so we can't take down the workqueue 8605 * priv->workqueue... so we can't take down the workqueue
8563 * until now... */ 8606 * until now... */
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 5e1279263b22..9918780f5e86 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -5156,9 +5156,10 @@ static irqreturn_t iwl_isr(int irq, void *data)
5156 } 5156 }
5157 5157
5158 if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { 5158 if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
5159 /* Hardware disappeared */ 5159 /* Hardware disappeared. It might have already raised
5160 * an interrupt */
5160 IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta); 5161 IWL_WARNING("HARDWARE GONE?? INTA == 0x%080x\n", inta);
5161 goto none; 5162 goto unplugged;
5162 } 5163 }
5163 5164
5164 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 5165 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
@@ -5166,8 +5167,9 @@ static irqreturn_t iwl_isr(int irq, void *data)
5166 5167
5167 /* iwl_irq_tasklet() will service interrupts and re-enable them */ 5168 /* iwl_irq_tasklet() will service interrupts and re-enable them */
5168 tasklet_schedule(&priv->irq_tasklet); 5169 tasklet_schedule(&priv->irq_tasklet);
5169 spin_unlock(&priv->lock);
5170 5170
5171 unplugged:
5172 spin_unlock(&priv->lock);
5171 return IRQ_HANDLED; 5173 return IRQ_HANDLED;
5172 5174
5173 none: 5175 none:
@@ -6845,8 +6847,9 @@ static void iwl_bg_scan_check(struct work_struct *data)
6845 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, 6847 IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN,
6846 "Scan completion watchdog resetting adapter (%dms)\n", 6848 "Scan completion watchdog resetting adapter (%dms)\n",
6847 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG)); 6849 jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
6850
6848 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) 6851 if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
6849 queue_work(priv->workqueue, &priv->restart); 6852 iwl_send_scan_abort(priv);
6850 } 6853 }
6851 mutex_unlock(&priv->mutex); 6854 mutex_unlock(&priv->mutex);
6852} 6855}
@@ -6942,7 +6945,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6942 spin_unlock_irqrestore(&priv->lock, flags); 6945 spin_unlock_irqrestore(&priv->lock, flags);
6943 6946
6944 scan->suspend_time = 0; 6947 scan->suspend_time = 0;
6945 scan->max_out_time = cpu_to_le32(600 * 1024); 6948 scan->max_out_time = cpu_to_le32(200 * 1024);
6946 if (!interval) 6949 if (!interval)
6947 interval = suspend_time; 6950 interval = suspend_time;
6948 6951
@@ -6965,7 +6968,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
6965 memcpy(scan->direct_scan[0].ssid, 6968 memcpy(scan->direct_scan[0].ssid,
6966 priv->direct_ssid, priv->direct_ssid_len); 6969 priv->direct_ssid, priv->direct_ssid_len);
6967 direct_mask = 1; 6970 direct_mask = 1;
6968 } else if (!iwl_is_associated(priv)) { 6971 } else if (!iwl_is_associated(priv) && priv->essid_len) {
6969 scan->direct_scan[0].id = WLAN_EID_SSID; 6972 scan->direct_scan[0].id = WLAN_EID_SSID;
6970 scan->direct_scan[0].len = priv->essid_len; 6973 scan->direct_scan[0].len = priv->essid_len;
6971 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6974 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -7118,6 +7121,12 @@ static void iwl_bg_post_associate(struct work_struct *data)
7118 7121
7119 mutex_lock(&priv->mutex); 7122 mutex_lock(&priv->mutex);
7120 7123
7124 if (!priv->interface_id || !priv->is_open) {
7125 mutex_unlock(&priv->mutex);
7126 return;
7127 }
7128 iwl_scan_cancel_timeout(priv, 200);
7129
7121 conf = ieee80211_get_hw_conf(priv->hw); 7130 conf = ieee80211_get_hw_conf(priv->hw);
7122 7131
7123 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7132 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
@@ -7271,9 +7280,19 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
7271 struct iwl_priv *priv = hw->priv; 7280 struct iwl_priv *priv = hw->priv;
7272 7281
7273 IWL_DEBUG_MAC80211("enter\n"); 7282 IWL_DEBUG_MAC80211("enter\n");
7283
7284
7285 mutex_lock(&priv->mutex);
7286 /* stop mac, cancel any scan request and clear
7287 * RXON_FILTER_ASSOC_MSK BIT
7288 */
7274 priv->is_open = 0; 7289 priv->is_open = 0;
7275 /*netif_stop_queue(dev); */ 7290 iwl_scan_cancel_timeout(priv, 100);
7276 flush_workqueue(priv->workqueue); 7291 cancel_delayed_work(&priv->post_associate);
7292 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7293 iwl_commit_rxon(priv);
7294 mutex_unlock(&priv->mutex);
7295
7277 IWL_DEBUG_MAC80211("leave\n"); 7296 IWL_DEBUG_MAC80211("leave\n");
7278} 7297}
7279 7298
@@ -7573,8 +7592,6 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7573 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) 7592 if (priv->iw_mode == IEEE80211_IF_TYPE_AP)
7574 iwl_config_ap(priv); 7593 iwl_config_ap(priv);
7575 else { 7594 else {
7576 priv->staging_rxon.filter_flags |=
7577 RXON_FILTER_ASSOC_MSK;
7578 rc = iwl_commit_rxon(priv); 7595 rc = iwl_commit_rxon(priv);
7579 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc) 7596 if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc)
7580 iwl_rxon_add_station( 7597 iwl_rxon_add_station(
@@ -7582,6 +7599,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,
7582 } 7599 }
7583 7600
7584 } else { 7601 } else {
7602 iwl_scan_cancel_timeout(priv, 100);
7585 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 7603 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7586 iwl_commit_rxon(priv); 7604 iwl_commit_rxon(priv);
7587 } 7605 }
@@ -7621,6 +7639,12 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
7621 IWL_DEBUG_MAC80211("enter\n"); 7639 IWL_DEBUG_MAC80211("enter\n");
7622 7640
7623 mutex_lock(&priv->mutex); 7641 mutex_lock(&priv->mutex);
7642
7643 iwl_scan_cancel_timeout(priv, 100);
7644 cancel_delayed_work(&priv->post_associate);
7645 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7646 iwl_commit_rxon(priv);
7647
7624 if (priv->interface_id == conf->if_id) { 7648 if (priv->interface_id == conf->if_id) {
7625 priv->interface_id = 0; 7649 priv->interface_id = 0;
7626 memset(priv->bssid, 0, ETH_ALEN); 7650 memset(priv->bssid, 0, ETH_ALEN);
@@ -7642,6 +7666,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7642 7666
7643 IWL_DEBUG_MAC80211("enter\n"); 7667 IWL_DEBUG_MAC80211("enter\n");
7644 7668
7669 mutex_lock(&priv->mutex);
7645 spin_lock_irqsave(&priv->lock, flags); 7670 spin_lock_irqsave(&priv->lock, flags);
7646 7671
7647 if (!iwl_is_ready_rf(priv)) { 7672 if (!iwl_is_ready_rf(priv)) {
@@ -7672,7 +7697,8 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7672 priv->direct_ssid_len = (u8) 7697 priv->direct_ssid_len = (u8)
7673 min((u8) len, (u8) IW_ESSID_MAX_SIZE); 7698 min((u8) len, (u8) IW_ESSID_MAX_SIZE);
7674 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); 7699 memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
7675 } 7700 } else
7701 priv->one_direct_scan = 0;
7676 7702
7677 rc = iwl_scan_initiate(priv); 7703 rc = iwl_scan_initiate(priv);
7678 7704
@@ -7680,6 +7706,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7680 7706
7681out_unlock: 7707out_unlock:
7682 spin_unlock_irqrestore(&priv->lock, flags); 7708 spin_unlock_irqrestore(&priv->lock, flags);
7709 mutex_unlock(&priv->mutex);
7683 7710
7684 return rc; 7711 return rc;
7685} 7712}
@@ -7713,6 +7740,8 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
7713 7740
7714 mutex_lock(&priv->mutex); 7741 mutex_lock(&priv->mutex);
7715 7742
7743 iwl_scan_cancel_timeout(priv, 100);
7744
7716 switch (cmd) { 7745 switch (cmd) {
7717 case SET_KEY: 7746 case SET_KEY:
7718 rc = iwl_update_sta_key_info(priv, key, sta_id); 7747 rc = iwl_update_sta_key_info(priv, key, sta_id);
@@ -7903,8 +7932,18 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
7903 7932
7904 spin_unlock_irqrestore(&priv->lock, flags); 7933 spin_unlock_irqrestore(&priv->lock, flags);
7905 7934
7935 /* we are restarting association process
7936 * clear RXON_FILTER_ASSOC_MSK bit
7937 */
7938 if (priv->iw_mode != IEEE80211_IF_TYPE_AP) {
7939 iwl_scan_cancel_timeout(priv, 100);
7940 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
7941 iwl_commit_rxon(priv);
7942 }
7943
7906 /* Per mac80211.h: This is only used in IBSS mode... */ 7944 /* Per mac80211.h: This is only used in IBSS mode... */
7907 if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) { 7945 if (priv->iw_mode != IEEE80211_IF_TYPE_IBSS) {
7946
7908 IWL_DEBUG_MAC80211("leave - not in IBSS\n"); 7947 IWL_DEBUG_MAC80211("leave - not in IBSS\n");
7909 mutex_unlock(&priv->mutex); 7948 mutex_unlock(&priv->mutex);
7910 return; 7949 return;
@@ -8918,6 +8957,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8918 } 8957 }
8919 SET_IEEE80211_DEV(hw, &pdev->dev); 8958 SET_IEEE80211_DEV(hw, &pdev->dev);
8920 8959
8960 hw->rate_control_algorithm = "iwl-4965-rs";
8961
8921 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); 8962 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
8922 priv = hw->priv; 8963 priv = hw->priv;
8923 priv->hw = hw; 8964 priv->hw = hw;
@@ -9152,6 +9193,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
9152 iwl_rate_control_unregister(priv->hw); 9193 iwl_rate_control_unregister(priv->hw);
9153 } 9194 }
9154 9195
9196 /*netif_stop_queue(dev); */
9197 flush_workqueue(priv->workqueue);
9198
9155 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes 9199 /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes
9156 * priv->workqueue... so we can't take down the workqueue 9200 * priv->workqueue... so we can't take down the workqueue
9157 * until now... */ 9201 * until now... */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 1cbbd96fdbde..be5cfd8402c7 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -912,6 +912,10 @@ static int wlan_cmd_set_boot2_ver(wlan_private * priv,
912 return 0; 912 return 0;
913} 913}
914 914
915/*
916 * Note: NEVER use libertas_queue_cmd() with addtail==0 other than for
917 * the command timer, because it does not account for queued commands.
918 */
915void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail) 919void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail)
916{ 920{
917 unsigned long flags; 921 unsigned long flags;
@@ -941,10 +945,11 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
941 945
942 spin_lock_irqsave(&adapter->driver_lock, flags); 946 spin_lock_irqsave(&adapter->driver_lock, flags);
943 947
944 if (addtail) 948 if (addtail) {
945 list_add_tail((struct list_head *)cmdnode, 949 list_add_tail((struct list_head *)cmdnode,
946 &adapter->cmdpendingq); 950 &adapter->cmdpendingq);
947 else 951 adapter->nr_cmd_pending++;
952 } else
948 list_add((struct list_head *)cmdnode, &adapter->cmdpendingq); 953 list_add((struct list_head *)cmdnode, &adapter->cmdpendingq);
949 954
950 spin_unlock_irqrestore(&adapter->driver_lock, flags); 955 spin_unlock_irqrestore(&adapter->driver_lock, flags);
@@ -1412,7 +1417,6 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1412 cmdnode->cmdwaitqwoken = 0; 1417 cmdnode->cmdwaitqwoken = 0;
1413 1418
1414 libertas_queue_cmd(adapter, cmdnode, 1); 1419 libertas_queue_cmd(adapter, cmdnode, 1);
1415 adapter->nr_cmd_pending++;
1416 wake_up_interruptible(&priv->waitq); 1420 wake_up_interruptible(&priv->waitq);
1417 1421
1418 if (wait_option & CMD_OPTION_WAITFORRSP) { 1422 if (wait_option & CMD_OPTION_WAITFORRSP) {
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 0360cad363a8..ec89dabc412c 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -148,11 +148,11 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r
148{ 148{
149 int i; 149 int i;
150 150
151 for (i = 0; i < 500; i++) { 151 for (i = 0; i < 1000; i++) {
152 u8 val = if_cs_read8(card, addr); 152 u8 val = if_cs_read8(card, addr);
153 if (val == reg) 153 if (val == reg)
154 return i; 154 return i;
155 udelay(100); 155 udelay(500);
156 } 156 }
157 return -ETIME; 157 return -ETIME;
158} 158}
@@ -878,6 +878,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
878 goto out3; 878 goto out3;
879 } 879 }
880 880
881 /* Clear any interrupt cause that happend while sending
882 * firmware/initializing card */
883 if_cs_write16(card, IF_CS_C_INT_CAUSE, IF_CS_C_IC_MASK);
881 if_cs_enable_ints(card); 884 if_cs_enable_ints(card);
882 885
883 /* And finally bring the card up */ 886 /* And finally bring the card up */
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index a8e17076e7de..b24425f74883 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -182,12 +182,14 @@ static int if_sdio_handle_data(struct if_sdio_card *card,
182 goto out; 182 goto out;
183 } 183 }
184 184
185 skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); 185 skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + NET_IP_ALIGN);
186 if (!skb) { 186 if (!skb) {
187 ret = -ENOMEM; 187 ret = -ENOMEM;
188 goto out; 188 goto out;
189 } 189 }
190 190
191 skb_reserve(skb, NET_IP_ALIGN);
192
191 data = skb_put(skb, size); 193 data = skb_put(skb, size);
192 194
193 memcpy(data, buffer, size); 195 memcpy(data, buffer, size);
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index ff2d63267b19..702321c30164 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -620,7 +620,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)
620 * up to version C the link tuning should halt after 20 620 * up to version C the link tuning should halt after 20
621 * seconds. 621 * seconds.
622 */ 622 */
623 if (rt2x00_get_rev(&rt2x00dev->chip) < RT2560_VERSION_D && 623 if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D &&
624 rt2x00dev->link.count > 20) 624 rt2x00dev->link.count > 20)
625 return; 625 return;
626 626
@@ -630,7 +630,7 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)
630 * Chipset versions C and lower should directly continue 630 * Chipset versions C and lower should directly continue
631 * to the dynamic CCA tuning. 631 * to the dynamic CCA tuning.
632 */ 632 */
633 if (rt2x00_get_rev(&rt2x00dev->chip) < RT2560_VERSION_D) 633 if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D)
634 goto dynamic_cca_tune; 634 goto dynamic_cca_tune;
635 635
636 /* 636 /*
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 7cdc80a122bb..50775f9234cc 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -753,7 +753,7 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev)
753 rt2x00_set_field16(&reg, MAC_CSR1_HOST_READY, 1); 753 rt2x00_set_field16(&reg, MAC_CSR1_HOST_READY, 1);
754 rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); 754 rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg);
755 755
756 if (rt2x00_get_rev(&rt2x00dev->chip) >= RT2570_VERSION_C) { 756 if (rt2x00_rev(&rt2x00dev->chip) >= RT2570_VERSION_C) {
757 rt2500usb_register_read(rt2x00dev, PHY_CSR2, &reg); 757 rt2500usb_register_read(rt2x00dev, PHY_CSR2, &reg);
758 reg &= ~0x0002; 758 reg &= ~0x0002;
759 } else { 759 } else {
@@ -1032,7 +1032,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1032} 1032}
1033 1033
1034static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, 1034static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1035 int maxpacket, struct sk_buff *skb) 1035 struct sk_buff *skb)
1036{ 1036{
1037 int length; 1037 int length;
1038 1038
@@ -1041,7 +1041,7 @@ static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1041 * but it must _not_ be a multiple of the USB packet size. 1041 * but it must _not_ be a multiple of the USB packet size.
1042 */ 1042 */
1043 length = roundup(skb->len, 2); 1043 length = roundup(skb->len, 2);
1044 length += (2 * !(length % maxpacket)); 1044 length += (2 * !(length % rt2x00dev->usb_maxpacket));
1045 1045
1046 return length; 1046 return length;
1047} 1047}
@@ -1257,7 +1257,7 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1257 rt2500usb_register_read(rt2x00dev, MAC_CSR0, &reg); 1257 rt2500usb_register_read(rt2x00dev, MAC_CSR0, &reg);
1258 rt2x00_set_chip(rt2x00dev, RT2570, value, reg); 1258 rt2x00_set_chip(rt2x00dev, RT2570, value, reg);
1259 1259
1260 if (rt2x00_rev(&rt2x00dev->chip, 0xffff0)) { 1260 if (!rt2x00_check_rev(&rt2x00dev->chip, 0)) {
1261 ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 1261 ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
1262 return -ENODEV; 1262 return -ENODEV;
1263 } 1263 }
@@ -1643,7 +1643,6 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1643 struct data_entry *beacon; 1643 struct data_entry *beacon;
1644 struct data_entry *guardian; 1644 struct data_entry *guardian;
1645 int pipe = usb_sndbulkpipe(usb_dev, 1); 1645 int pipe = usb_sndbulkpipe(usb_dev, 1);
1646 int max_packet = usb_maxpacket(usb_dev, pipe, 1);
1647 int length; 1646 int length;
1648 1647
1649 /* 1648 /*
@@ -1672,7 +1671,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1672 ring->desc_size), 1671 ring->desc_size),
1673 skb->len - ring->desc_size, control); 1672 skb->len - ring->desc_size, control);
1674 1673
1675 length = rt2500usb_get_tx_data_len(rt2x00dev, max_packet, skb); 1674 length = rt2500usb_get_tx_data_len(rt2x00dev, skb);
1676 1675
1677 usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, 1676 usb_fill_bulk_urb(beacon->priv, usb_dev, pipe,
1678 skb->data, length, rt2500usb_beacondone, beacon); 1677 skb->data, length, rt2500usb_beacondone, beacon);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 9845e584b731..c8f16f161c28 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -418,7 +418,7 @@ struct rt2x00lib_ops {
418 int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, 418 int (*write_tx_data) (struct rt2x00_dev *rt2x00dev,
419 struct data_ring *ring, struct sk_buff *skb, 419 struct data_ring *ring, struct sk_buff *skb,
420 struct ieee80211_tx_control *control); 420 struct ieee80211_tx_control *control);
421 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, int maxpacket, 421 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev,
422 struct sk_buff *skb); 422 struct sk_buff *skb);
423 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, 423 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
424 unsigned int queue); 424 unsigned int queue);
@@ -599,6 +599,11 @@ struct rt2x00_dev {
599 u32 *rf; 599 u32 *rf;
600 600
601 /* 601 /*
602 * USB Max frame size (for rt2500usb & rt73usb).
603 */
604 u16 usb_maxpacket;
605
606 /*
602 * Current TX power value. 607 * Current TX power value.
603 */ 608 */
604 u16 tx_power; 609 u16 tx_power;
@@ -751,14 +756,16 @@ static inline char rt2x00_rf(const struct rt2x00_chip *chipset, const u16 chip)
751 return (chipset->rf == chip); 756 return (chipset->rf == chip);
752} 757}
753 758
754static inline u16 rt2x00_get_rev(const struct rt2x00_chip *chipset) 759static inline u16 rt2x00_rev(const struct rt2x00_chip *chipset)
755{ 760{
756 return chipset->rev; 761 return chipset->rev;
757} 762}
758 763
759static inline u16 rt2x00_rev(const struct rt2x00_chip *chipset, const u32 mask) 764static inline u16 rt2x00_check_rev(const struct rt2x00_chip *chipset,
765 const u32 rev)
760{ 766{
761 return chipset->rev & mask; 767 return (((chipset->rev & 0xffff0) == rev) &&
768 !!(chipset->rev & 0x0000f));
762} 769}
763 770
764/* 771/*
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/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 4a6a0bd01ff1..85ea8a8e658e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -196,6 +196,14 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
196 struct rt2x00_dev *rt2x00dev = hw->priv; 196 struct rt2x00_dev *rt2x00dev = hw->priv;
197 struct interface *intf = &rt2x00dev->interface; 197 struct interface *intf = &rt2x00dev->interface;
198 198
199 /* FIXME: Beaconing is broken in rt2x00. */
200 if (conf->type == IEEE80211_IF_TYPE_IBSS ||
201 conf->type == IEEE80211_IF_TYPE_AP) {
202 ERROR(rt2x00dev,
203 "rt2x00 does not support Adhoc or Master mode");
204 return -EOPNOTSUPP;
205 }
206
199 /* 207 /*
200 * Don't allow interfaces to be added while 208 * Don't allow interfaces to be added while
201 * either the device has disappeared or when 209 * either the device has disappeared or when
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 73cc726c4046..1f5675dd329f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -159,7 +159,6 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
159 interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); 159 interface_to_usbdev(rt2x00dev_usb(rt2x00dev));
160 struct data_entry *entry = rt2x00_get_data_entry(ring); 160 struct data_entry *entry = rt2x00_get_data_entry(ring);
161 int pipe = usb_sndbulkpipe(usb_dev, 1); 161 int pipe = usb_sndbulkpipe(usb_dev, 1);
162 int max_packet = usb_maxpacket(usb_dev, pipe, 1);
163 u32 length; 162 u32 length;
164 163
165 if (rt2x00_ring_full(ring)) { 164 if (rt2x00_ring_full(ring)) {
@@ -194,8 +193,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
194 * length of the data to usb_fill_bulk_urb. Pass the skb 193 * length of the data to usb_fill_bulk_urb. Pass the skb
195 * to the driver to determine what the length should be. 194 * to the driver to determine what the length should be.
196 */ 195 */
197 length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, 196 length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, skb);
198 max_packet, skb);
199 197
200 /* 198 /*
201 * Initialize URB and send the frame to the device. 199 * Initialize URB and send the frame to the device.
@@ -490,6 +488,11 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
490 rt2x00dev->ops = ops; 488 rt2x00dev->ops = ops;
491 rt2x00dev->hw = hw; 489 rt2x00dev->hw = hw;
492 490
491 rt2x00dev->usb_maxpacket =
492 usb_maxpacket(usb_dev, usb_sndbulkpipe(usb_dev, 1), 1);
493 if (!rt2x00dev->usb_maxpacket)
494 rt2x00dev->usb_maxpacket = 1;
495
493 retval = rt2x00usb_alloc_reg(rt2x00dev); 496 retval = rt2x00usb_alloc_reg(rt2x00dev);
494 if (retval) 497 if (retval)
495 goto exit_free_device; 498 goto exit_free_device;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 46c8c0840a65..c0671c2e6e73 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1251,7 +1251,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1251} 1251}
1252 1252
1253static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, 1253static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1254 int maxpacket, struct sk_buff *skb) 1254 struct sk_buff *skb)
1255{ 1255{
1256 int length; 1256 int length;
1257 1257
@@ -1260,7 +1260,7 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1260 * but it must _not_ be a multiple of the USB packet size. 1260 * but it must _not_ be a multiple of the USB packet size.
1261 */ 1261 */
1262 length = roundup(skb->len, 4); 1262 length = roundup(skb->len, 4);
1263 length += (4 * !(length % maxpacket)); 1263 length += (4 * !(length % rt2x00dev->usb_maxpacket));
1264 1264
1265 return length; 1265 return length;
1266} 1266}
@@ -1486,7 +1486,7 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1486 rt73usb_register_read(rt2x00dev, MAC_CSR0, &reg); 1486 rt73usb_register_read(rt2x00dev, MAC_CSR0, &reg);
1487 rt2x00_set_chip(rt2x00dev, RT2571, value, reg); 1487 rt2x00_set_chip(rt2x00dev, RT2571, value, reg);
1488 1488
1489 if (!rt2x00_rev(&rt2x00dev->chip, 0x25730)) { 1489 if (!rt2x00_check_rev(&rt2x00dev->chip, 0x25730)) {
1490 ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 1490 ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
1491 return -ENODEV; 1491 return -ENODEV;
1492 } 1492 }
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/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 4bd14b331862..88efe1bae58f 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -2735,16 +2735,8 @@ static int strip_ioctl(struct tty_struct *tty, struct file *file,
2735 return -EFAULT; 2735 return -EFAULT;
2736 return set_mac_address(strip_info, &addr); 2736 return set_mac_address(strip_info, &addr);
2737 } 2737 }
2738 /*
2739 * Allow stty to read, but not set, the serial port
2740 */
2741
2742 case TCGETS:
2743 case TCGETA:
2744 return n_tty_ioctl(tty, file, cmd, arg);
2745 break;
2746 default: 2738 default:
2747 return -ENOIOCTLCMD; 2739 return tty_mode_ioctl(tty, file, cmd, arg);
2748 break; 2740 break;
2749 } 2741 }
2750 return 0; 2742 return 0;
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index a83c3db7d18f..c93d3d2640ab 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -64,6 +64,8 @@ int alloc_cpu_buffers(void)
64 b->head_pos = 0; 64 b->head_pos = 0;
65 b->sample_received = 0; 65 b->sample_received = 0;
66 b->sample_lost_overflow = 0; 66 b->sample_lost_overflow = 0;
67 b->backtrace_aborted = 0;
68 b->sample_invalid_eip = 0;
67 b->cpu = i; 69 b->cpu = i;
68 INIT_DELAYED_WORK(&b->work, wq_sync_buffer); 70 INIT_DELAYED_WORK(&b->work, wq_sync_buffer);
69 } 71 }
@@ -175,6 +177,11 @@ static int log_sample(struct oprofile_cpu_buffer * cpu_buf, unsigned long pc,
175 177
176 cpu_buf->sample_received++; 178 cpu_buf->sample_received++;
177 179
180 if (pc == ESCAPE_CODE) {
181 cpu_buf->sample_invalid_eip++;
182 return 0;
183 }
184
178 if (nr_available_slots(cpu_buf) < 3) { 185 if (nr_available_slots(cpu_buf) < 3) {
179 cpu_buf->sample_lost_overflow++; 186 cpu_buf->sample_lost_overflow++;
180 return 0; 187 return 0;
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h
index 49900d9e3235..c66c025abe75 100644
--- a/drivers/oprofile/cpu_buffer.h
+++ b/drivers/oprofile/cpu_buffer.h
@@ -42,6 +42,7 @@ struct oprofile_cpu_buffer {
42 unsigned long sample_received; 42 unsigned long sample_received;
43 unsigned long sample_lost_overflow; 43 unsigned long sample_lost_overflow;
44 unsigned long backtrace_aborted; 44 unsigned long backtrace_aborted;
45 unsigned long sample_invalid_eip;
45 int cpu; 46 int cpu;
46 struct delayed_work work; 47 struct delayed_work work;
47} ____cacheline_aligned; 48} ____cacheline_aligned;
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c
index f0acb661c253..d1f6d776e9e4 100644
--- a/drivers/oprofile/oprofile_stats.c
+++ b/drivers/oprofile/oprofile_stats.c
@@ -26,6 +26,8 @@ void oprofile_reset_stats(void)
26 cpu_buf = &cpu_buffer[i]; 26 cpu_buf = &cpu_buffer[i];
27 cpu_buf->sample_received = 0; 27 cpu_buf->sample_received = 0;
28 cpu_buf->sample_lost_overflow = 0; 28 cpu_buf->sample_lost_overflow = 0;
29 cpu_buf->backtrace_aborted = 0;
30 cpu_buf->sample_invalid_eip = 0;
29 } 31 }
30 32
31 atomic_set(&oprofile_stats.sample_lost_no_mm, 0); 33 atomic_set(&oprofile_stats.sample_lost_no_mm, 0);
@@ -61,6 +63,8 @@ void oprofile_create_stats_files(struct super_block * sb, struct dentry * root)
61 &cpu_buf->sample_lost_overflow); 63 &cpu_buf->sample_lost_overflow);
62 oprofilefs_create_ro_ulong(sb, cpudir, "backtrace_aborted", 64 oprofilefs_create_ro_ulong(sb, cpudir, "backtrace_aborted",
63 &cpu_buf->backtrace_aborted); 65 &cpu_buf->backtrace_aborted);
66 oprofilefs_create_ro_ulong(sb, cpudir, "sample_invalid_eip",
67 &cpu_buf->sample_invalid_eip);
64 } 68 }
65 69
66 oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mm", 70 oprofilefs_create_ro_atomic(sb, dir, "sample_lost_no_mm",
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 7a1d6d512837..e1ca42591ac4 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -21,6 +21,17 @@ config PCI_MSI
21 21
22 If you don't know what to do here, say N. 22 If you don't know what to do here, say N.
23 23
24config PCI_LEGACY
25 bool "Enable deprecated pci_find_* API"
26 depends on PCI
27 default y
28 help
29 Say Y here if you want to include support for the deprecated
30 pci_find_slot() and pci_find_device() APIs. Most drivers have
31 been converted over to using the proper hotplug APIs, so this
32 option serves to include/exclude only a few drivers that are
33 still using this API.
34
24config PCI_DEBUG 35config PCI_DEBUG
25 bool "PCI Debugging" 36 bool "PCI Debugging"
26 depends on PCI && DEBUG_KERNEL 37 depends on PCI && DEBUG_KERNEL
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index 63d62752fb91..a64449d489d6 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -41,7 +41,7 @@ config HOTPLUG_PCI_FAKE
41 41
42config HOTPLUG_PCI_COMPAQ 42config HOTPLUG_PCI_COMPAQ
43 tristate "Compaq PCI Hotplug driver" 43 tristate "Compaq PCI Hotplug driver"
44 depends on X86 && PCI_BIOS 44 depends on X86 && PCI_BIOS && PCI_LEGACY
45 help 45 help
46 Say Y here if you have a motherboard with a Compaq PCI Hotplug 46 Say Y here if you have a motherboard with a Compaq PCI Hotplug
47 controller. 47 controller.
@@ -63,7 +63,7 @@ config HOTPLUG_PCI_COMPAQ_NVRAM
63 63
64config HOTPLUG_PCI_IBM 64config HOTPLUG_PCI_IBM
65 tristate "IBM PCI Hotplug driver" 65 tristate "IBM PCI Hotplug driver"
66 depends on X86_IO_APIC && X86 && PCI_BIOS 66 depends on X86_IO_APIC && X86 && PCI_BIOS && PCI_LEGACY
67 help 67 help
68 Say Y here if you have a motherboard with a IBM PCI Hotplug 68 Say Y here if you have a motherboard with a IBM PCI Hotplug
69 controller. 69 controller.
@@ -119,7 +119,7 @@ config HOTPLUG_PCI_CPCI_ZT5550
119 119
120config HOTPLUG_PCI_CPCI_GENERIC 120config HOTPLUG_PCI_CPCI_GENERIC
121 tristate "Generic port I/O CompactPCI Hotplug driver" 121 tristate "Generic port I/O CompactPCI Hotplug driver"
122 depends on HOTPLUG_PCI_CPCI && X86 122 depends on HOTPLUG_PCI_CPCI && X86 && PCI_LEGACY
123 help 123 help
124 Say Y here if you have a CompactPCI system card that exposes the #ENUM 124 Say Y here if you have a CompactPCI system card that exposes the #ENUM
125 hotswap signal as a bit in a system register that can be read through 125 hotswap signal as a bit in a system register that can be read through
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 3ef0a4875a62..856d57b4d604 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -1931,16 +1931,14 @@ void cpqhp_pushbutton_thread(unsigned long slot)
1931 return ; 1931 return ;
1932 } 1932 }
1933 1933
1934 if (func != NULL && ctrl != NULL) { 1934 if (cpqhp_process_SS(ctrl, func) != 0) {
1935 if (cpqhp_process_SS(ctrl, func) != 0) { 1935 amber_LED_on(ctrl, hp_slot);
1936 amber_LED_on (ctrl, hp_slot); 1936 green_LED_on(ctrl, hp_slot);
1937 green_LED_on (ctrl, hp_slot);
1938
1939 set_SOGO(ctrl);
1940 1937
1941 /* Wait for SOBS to be unset */ 1938 set_SOGO(ctrl);
1942 wait_for_ctrl_irq (ctrl); 1939
1943 } 1940 /* Wait for SOBS to be unset */
1941 wait_for_ctrl_irq(ctrl);
1944 } 1942 }
1945 1943
1946 p_slot->state = STATIC_STATE; 1944 p_slot->state = STATIC_STATE;
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/pci/msi.c b/drivers/pci/msi.c
index 87e01615053d..07c9f09c856d 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -224,6 +224,12 @@ static struct msi_desc* alloc_msi_entry(void)
224 return entry; 224 return entry;
225} 225}
226 226
227static void pci_intx_for_msi(struct pci_dev *dev, int enable)
228{
229 if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
230 pci_intx(dev, enable);
231}
232
227#ifdef CONFIG_PM 233#ifdef CONFIG_PM
228static void __pci_restore_msi_state(struct pci_dev *dev) 234static void __pci_restore_msi_state(struct pci_dev *dev)
229{ 235{
@@ -237,7 +243,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
237 entry = get_irq_msi(dev->irq); 243 entry = get_irq_msi(dev->irq);
238 pos = entry->msi_attrib.pos; 244 pos = entry->msi_attrib.pos;
239 245
240 pci_intx(dev, 0); /* disable intx */ 246 pci_intx_for_msi(dev, 0);
241 msi_set_enable(dev, 0); 247 msi_set_enable(dev, 0);
242 write_msi_msg(dev->irq, &entry->msg); 248 write_msi_msg(dev->irq, &entry->msg);
243 if (entry->msi_attrib.maskbit) 249 if (entry->msi_attrib.maskbit)
@@ -260,7 +266,7 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
260 return; 266 return;
261 267
262 /* route the table */ 268 /* route the table */
263 pci_intx(dev, 0); /* disable intx */ 269 pci_intx_for_msi(dev, 0);
264 msix_set_enable(dev, 0); 270 msix_set_enable(dev, 0);
265 271
266 list_for_each_entry(entry, &dev->msi_list, list) { 272 list_for_each_entry(entry, &dev->msi_list, list) {
@@ -343,7 +349,7 @@ static int msi_capability_init(struct pci_dev *dev)
343 } 349 }
344 350
345 /* Set MSI enabled bits */ 351 /* Set MSI enabled bits */
346 pci_intx(dev, 0); /* disable intx */ 352 pci_intx_for_msi(dev, 0);
347 msi_set_enable(dev, 1); 353 msi_set_enable(dev, 1);
348 dev->msi_enabled = 1; 354 dev->msi_enabled = 1;
349 355
@@ -433,7 +439,7 @@ static int msix_capability_init(struct pci_dev *dev,
433 i++; 439 i++;
434 } 440 }
435 /* Set MSI-X enabled bits */ 441 /* Set MSI-X enabled bits */
436 pci_intx(dev, 0); /* disable intx */ 442 pci_intx_for_msi(dev, 0);
437 msix_set_enable(dev, 1); 443 msix_set_enable(dev, 1);
438 dev->msix_enabled = 1; 444 dev->msix_enabled = 1;
439 445
@@ -528,7 +534,7 @@ void pci_disable_msi(struct pci_dev* dev)
528 return; 534 return;
529 535
530 msi_set_enable(dev, 0); 536 msi_set_enable(dev, 0);
531 pci_intx(dev, 1); /* enable intx */ 537 pci_intx_for_msi(dev, 1);
532 dev->msi_enabled = 0; 538 dev->msi_enabled = 0;
533 539
534 BUG_ON(list_empty(&dev->msi_list)); 540 BUG_ON(list_empty(&dev->msi_list));
@@ -640,7 +646,7 @@ void pci_disable_msix(struct pci_dev* dev)
640 return; 646 return;
641 647
642 msix_set_enable(dev, 0); 648 msix_set_enable(dev, 0);
643 pci_intx(dev, 1); /* enable intx */ 649 pci_intx_for_msi(dev, 1);
644 dev->msix_enabled = 0; 650 dev->msix_enabled = 0;
645 651
646 msix_free_all_irqs(dev); 652 msix_free_all_irqs(dev);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 6e2760b6c20a..6d1a21611818 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -143,8 +143,8 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
143 * system is in its list of supported devices. Returns the matching 143 * system is in its list of supported devices. Returns the matching
144 * pci_device_id structure or %NULL if there is no match. 144 * pci_device_id structure or %NULL if there is no match.
145 */ 145 */
146const struct pci_device_id *pci_match_device(struct pci_driver *drv, 146static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
147 struct pci_dev *dev) 147 struct pci_dev *dev)
148{ 148{
149 struct pci_dynid *dynid; 149 struct pci_dynid *dynid;
150 150
@@ -559,7 +559,6 @@ static int __init pci_driver_init(void)
559postcore_initcall(pci_driver_init); 559postcore_initcall(pci_driver_init);
560 560
561EXPORT_SYMBOL(pci_match_id); 561EXPORT_SYMBOL(pci_match_id);
562EXPORT_SYMBOL(pci_match_device);
563EXPORT_SYMBOL(__pci_register_driver); 562EXPORT_SYMBOL(__pci_register_driver);
564EXPORT_SYMBOL(pci_unregister_driver); 563EXPORT_SYMBOL(pci_unregister_driver);
565EXPORT_SYMBOL(pci_dev_driver); 564EXPORT_SYMBOL(pci_dev_driver);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index d0bb5b9d2120..26cc4dcf4f0e 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1621,12 +1621,8 @@ static void __init quirk_disable_all_msi(struct pci_dev *dev)
1621 printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); 1621 printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n");
1622} 1622}
1623DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi); 1623DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
1624DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi);
1625DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi); 1624DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
1626DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi); 1625DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
1627DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RD580, quirk_disable_all_msi);
1628DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RX790, quirk_disable_all_msi);
1629DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS690, quirk_disable_all_msi);
1630DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi); 1626DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
1631 1627
1632/* Disable MSI on chipsets that are known to not support it */ 1628/* Disable MSI on chipsets that are known to not support it */
@@ -1678,6 +1674,9 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev)
1678} 1674}
1679DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, 1675DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
1680 quirk_msi_ht_cap); 1676 quirk_msi_ht_cap);
1677DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
1678 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
1679 quirk_msi_ht_cap);
1681 1680
1682/* The nVidia CK804 chipset may have 2 HT MSI mappings. 1681/* The nVidia CK804 chipset may have 2 HT MSI mappings.
1683 * MSI are supported if the MSI capability set in any of these mappings. 1682 * MSI are supported if the MSI capability set in any of these mappings.
@@ -1705,4 +1704,48 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1705} 1704}
1706DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, 1705DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1707 quirk_nvidia_ck804_msi_ht_cap); 1706 quirk_nvidia_ck804_msi_ht_cap);
1707
1708static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
1709{
1710 dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
1711}
1712DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1713 PCI_DEVICE_ID_TIGON3_5780,
1714 quirk_msi_intx_disable_bug);
1715DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1716 PCI_DEVICE_ID_TIGON3_5780S,
1717 quirk_msi_intx_disable_bug);
1718DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1719 PCI_DEVICE_ID_TIGON3_5714,
1720 quirk_msi_intx_disable_bug);
1721DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1722 PCI_DEVICE_ID_TIGON3_5714S,
1723 quirk_msi_intx_disable_bug);
1724DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1725 PCI_DEVICE_ID_TIGON3_5715,
1726 quirk_msi_intx_disable_bug);
1727DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1728 PCI_DEVICE_ID_TIGON3_5715S,
1729 quirk_msi_intx_disable_bug);
1730
1731DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4390,
1732 quirk_msi_intx_disable_bug);
1733DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4391,
1734 quirk_msi_intx_disable_bug);
1735DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4392,
1736 quirk_msi_intx_disable_bug);
1737DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4393,
1738 quirk_msi_intx_disable_bug);
1739DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4394,
1740 quirk_msi_intx_disable_bug);
1741DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4395,
1742 quirk_msi_intx_disable_bug);
1743
1744DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4373,
1745 quirk_msi_intx_disable_bug);
1746DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4374,
1747 quirk_msi_intx_disable_bug);
1748DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375,
1749 quirk_msi_intx_disable_bug);
1750
1708#endif /* CONFIG_PCI_MSI */ 1751#endif /* CONFIG_PCI_MSI */
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index b001b5922e33..8541034021f0 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -113,6 +113,8 @@ pci_find_next_bus(const struct pci_bus *from)
113 return b; 113 return b;
114} 114}
115 115
116#ifdef CONFIG_PCI_LEGACY
117
116/** 118/**
117 * pci_find_slot - locate PCI device from a given PCI slot 119 * pci_find_slot - locate PCI device from a given PCI slot
118 * @bus: number of PCI bus on which desired PCI device resides 120 * @bus: number of PCI bus on which desired PCI device resides
@@ -137,6 +139,8 @@ pci_find_slot(unsigned int bus, unsigned int devfn)
137 return NULL; 139 return NULL;
138} 140}
139 141
142#endif /* CONFIG_PCI_LEGACY */
143
140/** 144/**
141 * pci_get_slot - locate PCI device for a given PCI slot 145 * pci_get_slot - locate PCI device for a given PCI slot
142 * @bus: PCI bus on which desired PCI device resides 146 * @bus: PCI bus on which desired PCI device resides
@@ -200,6 +204,7 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
200 return NULL; 204 return NULL;
201} 205}
202 206
207#ifdef CONFIG_PCI_LEGACY
203/** 208/**
204 * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id 209 * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id
205 * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids 210 * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
@@ -278,6 +283,7 @@ pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *
278{ 283{
279 return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); 284 return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
280} 285}
286#endif /* CONFIG_PCI_LEGACY */
281 287
282/** 288/**
283 * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id 289 * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id
@@ -468,8 +474,11 @@ int pci_dev_present(const struct pci_device_id *ids)
468EXPORT_SYMBOL(pci_dev_present); 474EXPORT_SYMBOL(pci_dev_present);
469EXPORT_SYMBOL(pci_find_present); 475EXPORT_SYMBOL(pci_find_present);
470 476
477#ifdef CONFIG_PCI_LEGACY
471EXPORT_SYMBOL(pci_find_device); 478EXPORT_SYMBOL(pci_find_device);
472EXPORT_SYMBOL(pci_find_slot); 479EXPORT_SYMBOL(pci_find_slot);
480#endif /* CONFIG_PCI_LEGACY */
481
473/* For boot time work */ 482/* For boot time work */
474EXPORT_SYMBOL(pci_find_bus); 483EXPORT_SYMBOL(pci_find_bus);
475EXPORT_SYMBOL(pci_find_next_bus); 484EXPORT_SYMBOL(pci_find_next_bus);
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index cd0a204d96d1..11adab13f2b7 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -75,6 +75,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
75{ 75{
76 int i = 0; 76 int i = 0;
77 int irq; 77 int irq;
78 int p, t;
78 79
79 if (!valid_IRQ(gsi)) 80 if (!valid_IRQ(gsi))
80 return; 81 return;
@@ -85,15 +86,22 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
85 if (i >= PNP_MAX_IRQ) 86 if (i >= PNP_MAX_IRQ)
86 return; 87 return;
87 88
88#ifdef CONFIG_X86 89 /*
89 if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE || 90 * in IO-APIC mode, use overrided attribute. Two reasons:
90 polarity != ACPI_ACTIVE_HIGH)) { 91 * 1. BIOS bug in DSDT
91 pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, " 92 * 2. BIOS uses IO-APIC mode Interrupt Source Override
92 "active high", gsi); 93 */
93 triggering = ACPI_EDGE_SENSITIVE; 94 if (!acpi_get_override_irq(gsi, &t, &p)) {
94 polarity = ACPI_ACTIVE_HIGH; 95 t = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
96 p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
97
98 if (triggering != t || polarity != p) {
99 pnp_warn("IRQ %d override to %s, %s",
100 gsi, t ? "edge":"level", p ? "low":"high");
101 triggering = t;
102 polarity = p;
103 }
95 } 104 }
96#endif
97 105
98 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag 106 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
99 res->irq_resource[i].flags |= irq_flags(triggering, polarity); 107 res->irq_resource[i].flags |= irq_flags(triggering, polarity);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index cbde770eb121..1e6715ec51ef 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -36,7 +36,9 @@ config RTC_HCTOSYS_DEVICE
36 help 36 help
37 The RTC device that will be used to (re)initialize the system 37 The RTC device that will be used to (re)initialize the system
38 clock, usually rtc0. Initialization is done when the system 38 clock, usually rtc0. Initialization is done when the system
39 starts up, and when it resumes from a low power state. 39 starts up, and when it resumes from a low power state. This
40 device should record time in UTC, since the kernel won't do
41 timezone correction.
40 42
41 The driver for this RTC device must be loaded before late_initcall 43 The driver for this RTC device must be loaded before late_initcall
42 functions run, so it must usually be statically linked. 44 functions run, so it must usually be statically linked.
@@ -133,8 +135,8 @@ config RTC_DRV_DS1307
133 135
134 The first seven registers on these chips hold an RTC, and other 136 The first seven registers on these chips hold an RTC, and other
135 registers may add features such as NVRAM, a trickle charger for 137 registers may add features such as NVRAM, a trickle charger for
136 the RTC/NVRAM backup power, and alarms. This driver may not 138 the RTC/NVRAM backup power, and alarms. NVRAM is visible in
137 expose all those available chip features. 139 sysfs, but other chip features may not be available.
138 140
139 This driver can also be built as a module. If so, the module 141 This driver can also be built as a module. If so, the module
140 will be called rtc-ds1307. 142 will be called rtc-ds1307.
@@ -445,7 +447,7 @@ config RTC_DRV_AT91RM9200
445 447
446config RTC_DRV_BFIN 448config RTC_DRV_BFIN
447 tristate "Blackfin On-Chip RTC" 449 tristate "Blackfin On-Chip RTC"
448 depends on BFIN 450 depends on BLACKFIN
449 help 451 help
450 If you say yes here you will get support for the 452 If you say yes here you will get support for the
451 Blackfin On-Chip Real Time Clock. 453 Blackfin On-Chip Real Time Clock.
diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c
index 178527252c6a..33c0e98243ee 100644
--- a/drivers/rtc/hctosys.c
+++ b/drivers/rtc/hctosys.c
@@ -47,8 +47,8 @@ static int __init rtc_hctosys(void)
47 do_settimeofday(&tv); 47 do_settimeofday(&tv);
48 48
49 dev_info(rtc->dev.parent, 49 dev_info(rtc->dev.parent,
50 "setting the system clock to " 50 "setting system clock to "
51 "%d-%02d-%02d %02d:%02d:%02d (%u)\n", 51 "%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n",
52 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 52 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
53 tm.tm_hour, tm.tm_min, tm.tm_sec, 53 tm.tm_hour, tm.tm_min, tm.tm_sec,
54 (unsigned int) tv.tv_sec); 54 (unsigned int) tv.tv_sec);
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index e3fe83a23cf7..29cf1457ca10 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -120,7 +120,8 @@ static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t)
120 t->time.tm_hour = CMOS_READ(RTC_HOURS_ALARM); 120 t->time.tm_hour = CMOS_READ(RTC_HOURS_ALARM);
121 121
122 if (cmos->day_alrm) { 122 if (cmos->day_alrm) {
123 t->time.tm_mday = CMOS_READ(cmos->day_alrm); 123 /* ignore upper bits on readback per ACPI spec */
124 t->time.tm_mday = CMOS_READ(cmos->day_alrm) & 0x3f;
124 if (!t->time.tm_mday) 125 if (!t->time.tm_mday)
125 t->time.tm_mday = -1; 126 t->time.tm_mday = -1;
126 127
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index db6f3f0d8982..bc1c7fe94ad3 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -89,6 +89,7 @@ enum ds_type {
89 89
90struct ds1307 { 90struct ds1307 {
91 u8 reg_addr; 91 u8 reg_addr;
92 bool has_nvram;
92 u8 regs[8]; 93 u8 regs[8];
93 enum ds_type type; 94 enum ds_type type;
94 struct i2c_msg msg[2]; 95 struct i2c_msg msg[2];
@@ -242,6 +243,87 @@ static const struct rtc_class_ops ds13xx_rtc_ops = {
242 .set_time = ds1307_set_time, 243 .set_time = ds1307_set_time,
243}; 244};
244 245
246/*----------------------------------------------------------------------*/
247
248#define NVRAM_SIZE 56
249
250static ssize_t
251ds1307_nvram_read(struct kobject *kobj, struct bin_attribute *attr,
252 char *buf, loff_t off, size_t count)
253{
254 struct i2c_client *client;
255 struct ds1307 *ds1307;
256 struct i2c_msg msg[2];
257 int result;
258
259 client = to_i2c_client(container_of(kobj, struct device, kobj));
260 ds1307 = i2c_get_clientdata(client);
261
262 if (unlikely(off >= NVRAM_SIZE))
263 return 0;
264 if ((off + count) > NVRAM_SIZE)
265 count = NVRAM_SIZE - off;
266 if (unlikely(!count))
267 return count;
268
269 msg[0].addr = client->addr;
270 msg[0].flags = 0;
271 msg[0].len = 1;
272 msg[0].buf = buf;
273
274 buf[0] = 8 + off;
275
276 msg[1].addr = client->addr;
277 msg[1].flags = I2C_M_RD;
278 msg[1].len = count;
279 msg[1].buf = buf;
280
281 result = i2c_transfer(to_i2c_adapter(client->dev.parent), msg, 2);
282 if (result != 2) {
283 dev_err(&client->dev, "%s error %d\n", "nvram read", result);
284 return -EIO;
285 }
286 return count;
287}
288
289static ssize_t
290ds1307_nvram_write(struct kobject *kobj, struct bin_attribute *attr,
291 char *buf, loff_t off, size_t count)
292{
293 struct i2c_client *client;
294 u8 buffer[NVRAM_SIZE + 1];
295 int ret;
296
297 client = to_i2c_client(container_of(kobj, struct device, kobj));
298
299 if (unlikely(off >= NVRAM_SIZE))
300 return -EFBIG;
301 if ((off + count) > NVRAM_SIZE)
302 count = NVRAM_SIZE - off;
303 if (unlikely(!count))
304 return count;
305
306 buffer[0] = 8 + off;
307 memcpy(buffer + 1, buf, count);
308
309 ret = i2c_master_send(client, buffer, count + 1);
310 return (ret < 0) ? ret : (ret - 1);
311}
312
313static struct bin_attribute nvram = {
314 .attr = {
315 .name = "nvram",
316 .mode = S_IRUGO | S_IWUSR,
317 .owner = THIS_MODULE,
318 },
319
320 .read = ds1307_nvram_read,
321 .write = ds1307_nvram_write,
322 .size = NVRAM_SIZE,
323};
324
325/*----------------------------------------------------------------------*/
326
245static struct i2c_driver ds1307_driver; 327static struct i2c_driver ds1307_driver;
246 328
247static int __devinit ds1307_probe(struct i2c_client *client) 329static int __devinit ds1307_probe(struct i2c_client *client)
@@ -413,6 +495,14 @@ read_rtc:
413 goto exit_free; 495 goto exit_free;
414 } 496 }
415 497
498 if (chip->nvram56) {
499 err = sysfs_create_bin_file(&client->dev.kobj, &nvram);
500 if (err == 0) {
501 ds1307->has_nvram = true;
502 dev_info(&client->dev, "56 bytes nvram\n");
503 }
504 }
505
416 return 0; 506 return 0;
417 507
418exit_bad: 508exit_bad:
@@ -432,6 +522,9 @@ static int __devexit ds1307_remove(struct i2c_client *client)
432{ 522{
433 struct ds1307 *ds1307 = i2c_get_clientdata(client); 523 struct ds1307 *ds1307 = i2c_get_clientdata(client);
434 524
525 if (ds1307->has_nvram)
526 sysfs_remove_bin_file(&client->dev.kobj, &nvram);
527
435 rtc_device_unregister(ds1307->rtc); 528 rtc_device_unregister(ds1307->rtc);
436 kfree(ds1307); 529 kfree(ds1307);
437 return 0; 530 return 0;
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index bb53c09bad16..d9e848dcd450 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -291,7 +291,7 @@ static ssize_t ds1553_nvram_write(struct kobject *kobj,
291static struct bin_attribute ds1553_nvram_attr = { 291static struct bin_attribute ds1553_nvram_attr = {
292 .attr = { 292 .attr = {
293 .name = "nvram", 293 .name = "nvram",
294 .mode = S_IRUGO | S_IWUGO, 294 .mode = S_IRUGO | S_IWUSR,
295 }, 295 },
296 .size = RTC_OFFSET, 296 .size = RTC_OFFSET,
297 .read = ds1553_nvram_read, 297 .read = ds1553_nvram_read,
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index c535b78698e2..2e73f0b183b2 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -160,10 +160,13 @@ static ssize_t ds1742_nvram_write(struct kobject *kobj,
160static struct bin_attribute ds1742_nvram_attr = { 160static struct bin_attribute ds1742_nvram_attr = {
161 .attr = { 161 .attr = {
162 .name = "nvram", 162 .name = "nvram",
163 .mode = S_IRUGO | S_IWUGO, 163 .mode = S_IRUGO | S_IWUSR,
164 }, 164 },
165 .read = ds1742_nvram_read, 165 .read = ds1742_nvram_read,
166 .write = ds1742_nvram_write, 166 .write = ds1742_nvram_write,
167 /* REVISIT: size in sysfs won't match actual size... if it's
168 * not a constant, each RTC should have its own attribute.
169 */
167}; 170};
168 171
169static int __devinit ds1742_rtc_probe(struct platform_device *pdev) 172static int __devinit ds1742_rtc_probe(struct platform_device *pdev)
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index bf60d35f580b..cd0bbc0e8038 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -353,11 +353,12 @@ static ssize_t m48t59_nvram_write(struct kobject *kobj,
353static struct bin_attribute m48t59_nvram_attr = { 353static struct bin_attribute m48t59_nvram_attr = {
354 .attr = { 354 .attr = {
355 .name = "nvram", 355 .name = "nvram",
356 .mode = S_IRUGO | S_IWUGO, 356 .mode = S_IRUGO | S_IWUSR,
357 .owner = THIS_MODULE, 357 .owner = THIS_MODULE,
358 }, 358 },
359 .read = m48t59_nvram_read, 359 .read = m48t59_nvram_read,
360 .write = m48t59_nvram_write, 360 .write = m48t59_nvram_write,
361 .size = M48T59_NVRAM_SIZE,
361}; 362};
362 363
363static int __devinit m48t59_rtc_probe(struct platform_device *pdev) 364static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
@@ -464,7 +465,7 @@ static int __devexit m48t59_rtc_remove(struct platform_device *pdev)
464 return 0; 465 return 0;
465} 466}
466 467
467static struct platform_driver m48t59_rtc_platdrv = { 468static struct platform_driver m48t59_rtc_driver = {
468 .driver = { 469 .driver = {
469 .name = "rtc-m48t59", 470 .name = "rtc-m48t59",
470 .owner = THIS_MODULE, 471 .owner = THIS_MODULE,
@@ -475,12 +476,12 @@ static struct platform_driver m48t59_rtc_platdrv = {
475 476
476static int __init m48t59_rtc_init(void) 477static int __init m48t59_rtc_init(void)
477{ 478{
478 return platform_driver_register(&m48t59_rtc_platdrv); 479 return platform_driver_register(&m48t59_rtc_driver);
479} 480}
480 481
481static void __exit m48t59_rtc_exit(void) 482static void __exit m48t59_rtc_exit(void)
482{ 483{
483 platform_driver_unregister(&m48t59_rtc_platdrv); 484 platform_driver_unregister(&m48t59_rtc_driver);
484} 485}
485 486
486module_init(m48t59_rtc_init); 487module_init(m48t59_rtc_init);
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/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index 78277a118b67..8e8c8b8e81ee 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -351,8 +351,10 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
351 tm->tm_sec, tm->tm_min, tm->tm_hour, 351 tm->tm_sec, tm->tm_min, tm->tm_hour,
352 tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday); 352 tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday);
353 353
354 if (rtc_valid_tm(tm) < 0) 354 if (rtc_valid_tm(tm) < 0) {
355 dev_err(dev, "invalid date\n"); 355 dev_err(dev, "invalid date\n");
356 rtc_time_to_tm(0, tm);
357 }
356 358
357 return 0; 359 return 0;
358} 360}
@@ -588,7 +590,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
588 590
589 rtc->rtc_dev = rtc_device_register("sh", &pdev->dev, 591 rtc->rtc_dev = rtc_device_register("sh", &pdev->dev,
590 &sh_rtc_ops, THIS_MODULE); 592 &sh_rtc_ops, THIS_MODULE);
591 if (IS_ERR(rtc)) { 593 if (IS_ERR(rtc->rtc_dev)) {
592 ret = PTR_ERR(rtc->rtc_dev); 594 ret = PTR_ERR(rtc->rtc_dev);
593 goto err_badmap; 595 goto err_badmap;
594 } 596 }
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index 8288b6b2bf2b..a265da7c6ff8 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -291,7 +291,7 @@ static ssize_t stk17ta8_nvram_write(struct kobject *kobj,
291static struct bin_attribute stk17ta8_nvram_attr = { 291static struct bin_attribute stk17ta8_nvram_attr = {
292 .attr = { 292 .attr = {
293 .name = "nvram", 293 .name = "nvram",
294 .mode = S_IRUGO | S_IWUGO, 294 .mode = S_IRUGO | S_IWUSR,
295 .owner = THIS_MODULE, 295 .owner = THIS_MODULE,
296 }, 296 },
297 .size = RTC_OFFSET, 297 .size = RTC_OFFSET,
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 859f870552e3..5e083d1f57e7 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -193,6 +193,12 @@ dcssblk_segment_warn(int rc, char* seg_name)
193 } 193 }
194} 194}
195 195
196static void dcssblk_unregister_callback(struct device *dev)
197{
198 device_unregister(dev);
199 put_device(dev);
200}
201
196/* 202/*
197 * device attribute for switching shared/nonshared (exclusive) 203 * device attribute for switching shared/nonshared (exclusive)
198 * operation (show + store) 204 * operation (show + store)
@@ -276,8 +282,7 @@ removeseg:
276 blk_cleanup_queue(dev_info->dcssblk_queue); 282 blk_cleanup_queue(dev_info->dcssblk_queue);
277 dev_info->gd->queue = NULL; 283 dev_info->gd->queue = NULL;
278 put_disk(dev_info->gd); 284 put_disk(dev_info->gd);
279 device_unregister(dev); 285 rc = device_schedule_callback(dev, dcssblk_unregister_callback);
280 put_device(dev);
281out: 286out:
282 up_write(&dcssblk_devices_sem); 287 up_write(&dcssblk_devices_sem);
283 return rc; 288 return rc;
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 725b0dd14269..f4c132ab39ed 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -343,10 +343,10 @@ static int cmf_copy_block(struct ccw_device *cdev)
343 343
344 if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) { 344 if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) {
345 /* Don't copy if a start function is in progress. */ 345 /* Don't copy if a start function is in progress. */
346 if ((!sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED) && 346 if ((!(sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED)) &&
347 (sch->schib.scsw.actl & 347 (sch->schib.scsw.actl &
348 (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) && 348 (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) &&
349 (!sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) 349 (!(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)))
350 return -EBUSY; 350 return -EBUSY;
351 } 351 }
352 cmb_data = cdev->private->cmb; 352 cmb_data = cdev->private->cmb;
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 838f7ac0dc32..6db31089d2d7 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -483,7 +483,7 @@ static DECLARE_WORK(css_reprobe_work, reprobe_all);
483void css_schedule_reprobe(void) 483void css_schedule_reprobe(void)
484{ 484{
485 need_reprobe = 1; 485 need_reprobe = 1;
486 queue_work(ccw_device_work, &css_reprobe_work); 486 queue_work(slow_path_wq, &css_reprobe_work);
487} 487}
488 488
489EXPORT_SYMBOL_GPL(css_schedule_reprobe); 489EXPORT_SYMBOL_GPL(css_schedule_reprobe);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 7ee57f084a89..74f6b539974a 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -738,7 +738,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch,
738 atomic_set(&cdev->private->onoff, 0); 738 atomic_set(&cdev->private->onoff, 0);
739 cdev->dev.parent = &sch->dev; 739 cdev->dev.parent = &sch->dev;
740 cdev->dev.release = ccw_device_release; 740 cdev->dev.release = ccw_device_release;
741 INIT_LIST_HEAD(&cdev->private->kick_work.entry); 741 INIT_WORK(&cdev->private->kick_work, NULL);
742 cdev->dev.groups = ccwdev_attr_groups; 742 cdev->dev.groups = ccwdev_attr_groups;
743 /* Do first half of device_register. */ 743 /* Do first half of device_register. */
744 device_initialize(&cdev->dev); 744 device_initialize(&cdev->dev);
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 8867443b8060..bfad421cda66 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -1034,7 +1034,7 @@ device_trigger_reprobe(struct subchannel *sch)
1034 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { 1034 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) {
1035 PREPARE_WORK(&cdev->private->kick_work, 1035 PREPARE_WORK(&cdev->private->kick_work,
1036 ccw_device_move_to_orphanage); 1036 ccw_device_move_to_orphanage);
1037 queue_work(ccw_device_work, &cdev->private->kick_work); 1037 queue_work(slow_path_wq, &cdev->private->kick_work);
1038 } else 1038 } else
1039 ccw_device_start_id(cdev, 0); 1039 ccw_device_start_id(cdev, 0);
1040} 1040}
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c
index f232832f2b22..2f6bf462425e 100644
--- a/drivers/s390/cio/device_id.c
+++ b/drivers/s390/cio/device_id.c
@@ -113,19 +113,10 @@ __ccw_device_sense_id_start(struct ccw_device *cdev)
113{ 113{
114 struct subchannel *sch; 114 struct subchannel *sch;
115 struct ccw1 *ccw; 115 struct ccw1 *ccw;
116 int ret;
117 116
118 sch = to_subchannel(cdev->dev.parent); 117 sch = to_subchannel(cdev->dev.parent);
119 /* Setup sense channel program. */ 118 /* Setup sense channel program. */
120 ccw = cdev->private->iccws; 119 ccw = cdev->private->iccws;
121 if (sch->schib.pmcw.pim != 0x80) {
122 /* more than one path installed. */
123 ccw->cmd_code = CCW_CMD_SUSPEND_RECONN;
124 ccw->cda = 0;
125 ccw->count = 0;
126 ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC;
127 ccw++;
128 }
129 ccw->cmd_code = CCW_CMD_SENSE_ID; 120 ccw->cmd_code = CCW_CMD_SENSE_ID;
130 ccw->cda = (__u32) __pa (&cdev->private->senseid); 121 ccw->cda = (__u32) __pa (&cdev->private->senseid);
131 ccw->count = sizeof (struct senseid); 122 ccw->count = sizeof (struct senseid);
@@ -133,25 +124,9 @@ __ccw_device_sense_id_start(struct ccw_device *cdev)
133 124
134 /* Reset device status. */ 125 /* Reset device status. */
135 memset(&cdev->private->irb, 0, sizeof(struct irb)); 126 memset(&cdev->private->irb, 0, sizeof(struct irb));
127 cdev->private->flags.intretry = 0;
136 128
137 /* Try on every path. */ 129 return cio_start(sch, ccw, LPM_ANYPATH);
138 ret = -ENODEV;
139 while (cdev->private->imask != 0) {
140 if ((sch->opm & cdev->private->imask) != 0 &&
141 cdev->private->iretry > 0) {
142 cdev->private->iretry--;
143 /* Reset internal retry indication. */
144 cdev->private->flags.intretry = 0;
145 ret = cio_start (sch, cdev->private->iccws,
146 cdev->private->imask);
147 /* ret is 0, -EBUSY, -EACCES or -ENODEV */
148 if (ret != -EACCES)
149 return ret;
150 }
151 cdev->private->imask >>= 1;
152 cdev->private->iretry = 5;
153 }
154 return ret;
155} 130}
156 131
157void 132void
@@ -161,8 +136,7 @@ ccw_device_sense_id_start(struct ccw_device *cdev)
161 136
162 memset (&cdev->private->senseid, 0, sizeof (struct senseid)); 137 memset (&cdev->private->senseid, 0, sizeof (struct senseid));
163 cdev->private->senseid.cu_type = 0xFFFF; 138 cdev->private->senseid.cu_type = 0xFFFF;
164 cdev->private->imask = 0x80; 139 cdev->private->iretry = 3;
165 cdev->private->iretry = 5;
166 ret = __ccw_device_sense_id_start(cdev); 140 ret = __ccw_device_sense_id_start(cdev);
167 if (ret && ret != -EBUSY) 141 if (ret && ret != -EBUSY)
168 ccw_device_sense_id_done(cdev, ret); 142 ccw_device_sense_id_done(cdev, ret);
@@ -278,14 +252,13 @@ ccw_device_sense_id_irq(struct ccw_device *cdev, enum dev_event dev_event)
278 ccw_device_sense_id_done(cdev, ret); 252 ccw_device_sense_id_done(cdev, ret);
279 break; 253 break;
280 case -EACCES: /* channel is not operational. */ 254 case -EACCES: /* channel is not operational. */
281 sch->lpm &= ~cdev->private->imask;
282 cdev->private->imask >>= 1;
283 cdev->private->iretry = 5;
284 /* fall through. */
285 case -EAGAIN: /* try again. */ 255 case -EAGAIN: /* try again. */
286 ret = __ccw_device_sense_id_start(cdev); 256 cdev->private->iretry--;
287 if (ret == 0 || ret == -EBUSY) 257 if (cdev->private->iretry > 0) {
288 break; 258 ret = __ccw_device_sense_id_start(cdev);
259 if (ret == 0 || ret == -EBUSY)
260 break;
261 }
289 /* fall through. */ 262 /* fall through. */
290 default: /* Sense ID failed. Try asking VM. */ 263 default: /* Sense ID failed. Try asking VM. */
291 if (MACHINE_IS_VM) { 264 if (MACHINE_IS_VM) {
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c
index 3ccca5871fdf..47bb47b48581 100644
--- a/drivers/s390/net/smsgiucv.c
+++ b/drivers/s390/net/smsgiucv.c
@@ -148,6 +148,10 @@ static int __init smsg_init(void)
148{ 148{
149 int rc; 149 int rc;
150 150
151 if (!MACHINE_IS_VM) {
152 rc = -EPROTONOSUPPORT;
153 goto out;
154 }
151 rc = driver_register(&smsg_driver); 155 rc = driver_register(&smsg_driver);
152 if (rc != 0) 156 if (rc != 0)
153 goto out; 157 goto out;
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 0754542978b6..e268f79bdbd2 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -70,11 +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_buf(list, address, 0); 78 sg_set_buf(list, address, size);
78} 79}
79 80
80#define REQUEST_LIST_SIZE 128 81#define REQUEST_LIST_SIZE 128
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a5763c6e9362..a6676be87843 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
@@ -725,7 +725,7 @@ config SCSI_FD_MCS
725 725
726config SCSI_GDTH 726config SCSI_GDTH
727 tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" 727 tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support"
728 depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API 728 depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API && PCI_LEGACY
729 ---help--- 729 ---help---
730 Formerly called GDT SCSI Disk Array Controller Support. 730 Formerly called GDT SCSI Disk Array Controller Support.
731 731
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/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c
index 5b0932f61473..06509bff71f7 100644
--- a/drivers/scsi/aic94xx/aic94xx_sds.c
+++ b/drivers/scsi/aic94xx/aic94xx_sds.c
@@ -377,7 +377,7 @@ out:
377 377
378#define FLASH_RESET 0xF0 378#define FLASH_RESET 0xF0
379 379
380#define FLASH_SIZE 0x200000 380#define ASD_FLASH_SIZE 0x200000
381#define FLASH_DIR_COOKIE "*** ADAPTEC FLASH DIRECTORY *** " 381#define FLASH_DIR_COOKIE "*** ADAPTEC FLASH DIRECTORY *** "
382#define FLASH_NEXT_ENTRY_OFFS 0x2000 382#define FLASH_NEXT_ENTRY_OFFS 0x2000
383#define FLASH_MAX_DIR_ENTRIES 32 383#define FLASH_MAX_DIR_ENTRIES 32
@@ -609,7 +609,7 @@ static int asd_find_flash_dir(struct asd_ha_struct *asd_ha,
609 struct asd_flash_dir *flash_dir) 609 struct asd_flash_dir *flash_dir)
610{ 610{
611 u32 v; 611 u32 v;
612 for (v = 0; v < FLASH_SIZE; v += FLASH_NEXT_ENTRY_OFFS) { 612 for (v = 0; v < ASD_FLASH_SIZE; v += FLASH_NEXT_ENTRY_OFFS) {
613 asd_read_flash_seg(asd_ha, flash_dir, v, 613 asd_read_flash_seg(asd_ha, flash_dir, v,
614 sizeof(FLASH_DIR_COOKIE)-1); 614 sizeof(FLASH_DIR_COOKIE)-1);
615 if (memcmp(flash_dir->cookie, FLASH_DIR_COOKIE, 615 if (memcmp(flash_dir->cookie, FLASH_DIR_COOKIE,
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/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 22d91ee173c5..5f2396c03958 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -556,7 +556,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
556 unsigned long timeout) 556 unsigned long timeout)
557{ 557{
558 u64 *crq_as_u64 = (u64 *) &evt_struct->crq; 558 u64 *crq_as_u64 = (u64 *) &evt_struct->crq;
559 int request_status; 559 int request_status = 0;
560 int rc; 560 int rc;
561 561
562 /* If we have exhausted our request limit, just fail this request, 562 /* If we have exhausted our request limit, just fail this request,
@@ -574,6 +574,13 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
574 if (request_status < -1) 574 if (request_status < -1)
575 goto send_error; 575 goto send_error;
576 /* Otherwise, we may have run out of requests. */ 576 /* Otherwise, we may have run out of requests. */
577 /* If request limit was 0 when we started the adapter is in the
578 * process of performing a login with the server adapter, or
579 * we may have run out of requests.
580 */
581 else if (request_status == -1 &&
582 evt_struct->iu.srp.login_req.opcode != SRP_LOGIN_REQ)
583 goto send_busy;
577 /* Abort and reset calls should make it through. 584 /* Abort and reset calls should make it through.
578 * Nothing except abort and reset should use the last two 585 * Nothing except abort and reset should use the last two
579 * slots unless we had two or less to begin with. 586 * slots unless we had two or less to begin with.
@@ -633,7 +640,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
633 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); 640 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev);
634 641
635 free_event_struct(&hostdata->pool, evt_struct); 642 free_event_struct(&hostdata->pool, evt_struct);
636 atomic_inc(&hostdata->request_limit); 643 if (request_status != -1)
644 atomic_inc(&hostdata->request_limit);
637 return SCSI_MLQUEUE_HOST_BUSY; 645 return SCSI_MLQUEUE_HOST_BUSY;
638 646
639 send_error: 647 send_error:
@@ -927,10 +935,11 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata)
927 login->req_buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT; 935 login->req_buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT;
928 936
929 spin_lock_irqsave(hostdata->host->host_lock, flags); 937 spin_lock_irqsave(hostdata->host->host_lock, flags);
930 /* Start out with a request limit of 1, since this is negotiated in 938 /* Start out with a request limit of 0, since this is negotiated in
931 * the login request we are just sending 939 * the login request we are just sending and login requests always
940 * get sent by the driver regardless of request_limit.
932 */ 941 */
933 atomic_set(&hostdata->request_limit, 1); 942 atomic_set(&hostdata->request_limit, 0);
934 943
935 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2); 944 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2);
936 spin_unlock_irqrestore(hostdata->host->host_lock, flags); 945 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index c0755565fae9..4e46045dea6d 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -682,6 +682,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
682 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb; 682 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb;
683 struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq); 683 struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq);
684 int datadir = scsi_cmnd->sc_data_direction; 684 int datadir = scsi_cmnd->sc_data_direction;
685 char tag[2];
685 686
686 lpfc_cmd->fcp_rsp->rspSnsLen = 0; 687 lpfc_cmd->fcp_rsp->rspSnsLen = 0;
687 /* clear task management bits */ 688 /* clear task management bits */
@@ -692,8 +693,8 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
692 693
693 memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16); 694 memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16);
694 695
695 if (scsi_cmnd->device->tagged_supported) { 696 if (scsi_populate_tag_msg(scsi_cmnd, tag)) {
696 switch (scsi_cmnd->tag) { 697 switch (tag[0]) {
697 case HEAD_OF_QUEUE_TAG: 698 case HEAD_OF_QUEUE_TAG:
698 fcp_cmnd->fcpCntl1 = HEAD_OF_Q; 699 fcp_cmnd->fcpCntl1 = HEAD_OF_Q;
699 break; 700 break;
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 4652ad22516b..abef7048f25b 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -593,10 +593,11 @@ static int osst_verify_frame(struct osst_tape * STp, int frame_seq_number, int q
593 if (aux->frame_type != OS_FRAME_TYPE_DATA && 593 if (aux->frame_type != OS_FRAME_TYPE_DATA &&
594 aux->frame_type != OS_FRAME_TYPE_EOD && 594 aux->frame_type != OS_FRAME_TYPE_EOD &&
595 aux->frame_type != OS_FRAME_TYPE_MARKER) { 595 aux->frame_type != OS_FRAME_TYPE_MARKER) {
596 if (!quiet) 596 if (!quiet) {
597#if DEBUG 597#if DEBUG
598 printk(OSST_DEB_MSG "%s:D: Skipping frame, frame type %x\n", name, aux->frame_type); 598 printk(OSST_DEB_MSG "%s:D: Skipping frame, frame type %x\n", name, aux->frame_type);
599#endif 599#endif
600 }
600 goto err_out; 601 goto err_out;
601 } 602 }
602 if (aux->frame_type == OS_FRAME_TYPE_EOD && 603 if (aux->frame_type == OS_FRAME_TYPE_EOD &&
@@ -606,11 +607,12 @@ static int osst_verify_frame(struct osst_tape * STp, int frame_seq_number, int q
606 goto err_out; 607 goto err_out;
607 } 608 }
608 if (frame_seq_number != -1 && ntohl(aux->frame_seq_num) != frame_seq_number) { 609 if (frame_seq_number != -1 && ntohl(aux->frame_seq_num) != frame_seq_number) {
609 if (!quiet) 610 if (!quiet) {
610#if DEBUG 611#if DEBUG
611 printk(OSST_DEB_MSG "%s:D: Skipping frame, sequence number %u (expected %d)\n", 612 printk(OSST_DEB_MSG "%s:D: Skipping frame, sequence number %u (expected %d)\n",
612 name, ntohl(aux->frame_seq_num), frame_seq_number); 613 name, ntohl(aux->frame_seq_num), frame_seq_number);
613#endif 614#endif
615 }
614 goto err_out; 616 goto err_out;
615 } 617 }
616 if (aux->frame_type == OS_FRAME_TYPE_MARKER) { 618 if (aux->frame_type == OS_FRAME_TYPE_MARKER) {
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 61fdaf02f251..0e81e4cf8876 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -785,7 +785,7 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
785 * end-of-list 785 * end-of-list
786 */ 786 */
787 if (!left) 787 if (!left)
788 sg_mark_end(sgl, this); 788 sg_mark_end(&sgl[this - 1]);
789 789
790 /* 790 /*
791 * don't allow subsequent mempool allocs to sleep, it would 791 * don't allow subsequent mempool allocs to sleep, it would
@@ -2115,6 +2115,142 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2115EXPORT_SYMBOL(scsi_device_set_state); 2115EXPORT_SYMBOL(scsi_device_set_state);
2116 2116
2117/** 2117/**
2118 * sdev_evt_emit - emit a single SCSI device uevent
2119 * @sdev: associated SCSI device
2120 * @evt: event to emit
2121 *
2122 * Send a single uevent (scsi_event) to the associated scsi_device.
2123 */
2124static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
2125{
2126 int idx = 0;
2127 char *envp[3];
2128
2129 switch (evt->evt_type) {
2130 case SDEV_EVT_MEDIA_CHANGE:
2131 envp[idx++] = "SDEV_MEDIA_CHANGE=1";
2132 break;
2133
2134 default:
2135 /* do nothing */
2136 break;
2137 }
2138
2139 envp[idx++] = NULL;
2140
2141 kobject_uevent_env(&sdev->sdev_gendev.kobj, KOBJ_CHANGE, envp);
2142}
2143
2144/**
2145 * sdev_evt_thread - send a uevent for each scsi event
2146 * @work: work struct for scsi_device
2147 *
2148 * Dispatch queued events to their associated scsi_device kobjects
2149 * as uevents.
2150 */
2151void scsi_evt_thread(struct work_struct *work)
2152{
2153 struct scsi_device *sdev;
2154 LIST_HEAD(event_list);
2155
2156 sdev = container_of(work, struct scsi_device, event_work);
2157
2158 while (1) {
2159 struct scsi_event *evt;
2160 struct list_head *this, *tmp;
2161 unsigned long flags;
2162
2163 spin_lock_irqsave(&sdev->list_lock, flags);
2164 list_splice_init(&sdev->event_list, &event_list);
2165 spin_unlock_irqrestore(&sdev->list_lock, flags);
2166
2167 if (list_empty(&event_list))
2168 break;
2169
2170 list_for_each_safe(this, tmp, &event_list) {
2171 evt = list_entry(this, struct scsi_event, node);
2172 list_del(&evt->node);
2173 scsi_evt_emit(sdev, evt);
2174 kfree(evt);
2175 }
2176 }
2177}
2178
2179/**
2180 * sdev_evt_send - send asserted event to uevent thread
2181 * @sdev: scsi_device event occurred on
2182 * @evt: event to send
2183 *
2184 * Assert scsi device event asynchronously.
2185 */
2186void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt)
2187{
2188 unsigned long flags;
2189
2190 if (!test_bit(evt->evt_type, sdev->supported_events)) {
2191 kfree(evt);
2192 return;
2193 }
2194
2195 spin_lock_irqsave(&sdev->list_lock, flags);
2196 list_add_tail(&evt->node, &sdev->event_list);
2197 schedule_work(&sdev->event_work);
2198 spin_unlock_irqrestore(&sdev->list_lock, flags);
2199}
2200EXPORT_SYMBOL_GPL(sdev_evt_send);
2201
2202/**
2203 * sdev_evt_alloc - allocate a new scsi event
2204 * @evt_type: type of event to allocate
2205 * @gfpflags: GFP flags for allocation
2206 *
2207 * Allocates and returns a new scsi_event.
2208 */
2209struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
2210 gfp_t gfpflags)
2211{
2212 struct scsi_event *evt = kzalloc(sizeof(struct scsi_event), gfpflags);
2213 if (!evt)
2214 return NULL;
2215
2216 evt->evt_type = evt_type;
2217 INIT_LIST_HEAD(&evt->node);
2218
2219 /* evt_type-specific initialization, if any */
2220 switch (evt_type) {
2221 case SDEV_EVT_MEDIA_CHANGE:
2222 default:
2223 /* do nothing */
2224 break;
2225 }
2226
2227 return evt;
2228}
2229EXPORT_SYMBOL_GPL(sdev_evt_alloc);
2230
2231/**
2232 * sdev_evt_send_simple - send asserted event to uevent thread
2233 * @sdev: scsi_device event occurred on
2234 * @evt_type: type of event to send
2235 * @gfpflags: GFP flags for allocation
2236 *
2237 * Assert scsi device event asynchronously, given an event type.
2238 */
2239void sdev_evt_send_simple(struct scsi_device *sdev,
2240 enum scsi_device_event evt_type, gfp_t gfpflags)
2241{
2242 struct scsi_event *evt = sdev_evt_alloc(evt_type, gfpflags);
2243 if (!evt) {
2244 sdev_printk(KERN_ERR, sdev, "event %d eaten due to OOM\n",
2245 evt_type);
2246 return;
2247 }
2248
2249 sdev_evt_send(sdev, evt);
2250}
2251EXPORT_SYMBOL_GPL(sdev_evt_send_simple);
2252
2253/**
2118 * scsi_device_quiesce - Block user issued commands. 2254 * scsi_device_quiesce - Block user issued commands.
2119 * @sdev: scsi device to quiesce. 2255 * @sdev: scsi device to quiesce.
2120 * 2256 *
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index b53c5f67e372..40ea71cd2ca6 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -236,6 +236,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
236 struct scsi_device *sdev; 236 struct scsi_device *sdev;
237 int display_failure_msg = 1, ret; 237 int display_failure_msg = 1, ret;
238 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 238 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
239 extern void scsi_evt_thread(struct work_struct *work);
239 240
240 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, 241 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size,
241 GFP_ATOMIC); 242 GFP_ATOMIC);
@@ -254,7 +255,9 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
254 INIT_LIST_HEAD(&sdev->same_target_siblings); 255 INIT_LIST_HEAD(&sdev->same_target_siblings);
255 INIT_LIST_HEAD(&sdev->cmd_list); 256 INIT_LIST_HEAD(&sdev->cmd_list);
256 INIT_LIST_HEAD(&sdev->starved_entry); 257 INIT_LIST_HEAD(&sdev->starved_entry);
258 INIT_LIST_HEAD(&sdev->event_list);
257 spin_lock_init(&sdev->list_lock); 259 spin_lock_init(&sdev->list_lock);
260 INIT_WORK(&sdev->event_work, scsi_evt_thread);
258 261
259 sdev->sdev_gendev.parent = get_device(&starget->dev); 262 sdev->sdev_gendev.parent = get_device(&starget->dev);
260 sdev->sdev_target = starget; 263 sdev->sdev_target = starget;
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index d531ceeb0d8c..f374fdcb6815 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -268,6 +268,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
268 struct scsi_device *sdev; 268 struct scsi_device *sdev;
269 struct device *parent; 269 struct device *parent;
270 struct scsi_target *starget; 270 struct scsi_target *starget;
271 struct list_head *this, *tmp;
271 unsigned long flags; 272 unsigned long flags;
272 273
273 sdev = container_of(work, struct scsi_device, ew.work); 274 sdev = container_of(work, struct scsi_device, ew.work);
@@ -282,6 +283,16 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
282 list_del(&sdev->starved_entry); 283 list_del(&sdev->starved_entry);
283 spin_unlock_irqrestore(sdev->host->host_lock, flags); 284 spin_unlock_irqrestore(sdev->host->host_lock, flags);
284 285
286 cancel_work_sync(&sdev->event_work);
287
288 list_for_each_safe(this, tmp, &sdev->event_list) {
289 struct scsi_event *evt;
290
291 evt = list_entry(this, struct scsi_event, node);
292 list_del(&evt->node);
293 kfree(evt);
294 }
295
285 if (sdev->request_queue) { 296 if (sdev->request_queue) {
286 sdev->request_queue->queuedata = NULL; 297 sdev->request_queue->queuedata = NULL;
287 /* user context needed to free queue */ 298 /* user context needed to free queue */
@@ -614,6 +625,41 @@ sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
614} 625}
615static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL); 626static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL);
616 627
628#define DECLARE_EVT_SHOW(name, Cap_name) \
629static ssize_t \
630sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \
631 char *buf) \
632{ \
633 struct scsi_device *sdev = to_scsi_device(dev); \
634 int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\
635 return snprintf(buf, 20, "%d\n", val); \
636}
637
638#define DECLARE_EVT_STORE(name, Cap_name) \
639static ssize_t \
640sdev_store_evt_##name(struct device *dev, struct device_attribute *attr, \
641 const char *buf, size_t count) \
642{ \
643 struct scsi_device *sdev = to_scsi_device(dev); \
644 int val = simple_strtoul(buf, NULL, 0); \
645 if (val == 0) \
646 clear_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \
647 else if (val == 1) \
648 set_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \
649 else \
650 return -EINVAL; \
651 return count; \
652}
653
654#define DECLARE_EVT(name, Cap_name) \
655 DECLARE_EVT_SHOW(name, Cap_name) \
656 DECLARE_EVT_STORE(name, Cap_name) \
657 static DEVICE_ATTR(evt_##name, S_IRUGO, sdev_show_evt_##name, \
658 sdev_store_evt_##name);
659#define REF_EVT(name) &dev_attr_evt_##name.attr
660
661DECLARE_EVT(media_change, MEDIA_CHANGE)
662
617/* Default template for device attributes. May NOT be modified */ 663/* Default template for device attributes. May NOT be modified */
618static struct attribute *scsi_sdev_attrs[] = { 664static struct attribute *scsi_sdev_attrs[] = {
619 &dev_attr_device_blocked.attr, 665 &dev_attr_device_blocked.attr,
@@ -631,6 +677,7 @@ static struct attribute *scsi_sdev_attrs[] = {
631 &dev_attr_iodone_cnt.attr, 677 &dev_attr_iodone_cnt.attr,
632 &dev_attr_ioerr_cnt.attr, 678 &dev_attr_ioerr_cnt.attr,
633 &dev_attr_modalias.attr, 679 &dev_attr_modalias.attr,
680 REF_EVT(media_change),
634 NULL 681 NULL
635}; 682};
636 683
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index b5fa4f091387..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}
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c
index 4d4c9f01be8d..1f16de719962 100644
--- a/drivers/serial/8250_early.c
+++ b/drivers/serial/8250_early.c
@@ -76,7 +76,7 @@ static void __init wait_for_xmitr(struct uart_port *port)
76 } 76 }
77} 77}
78 78
79static void __init putc(struct uart_port *port, int c) 79static void __init serial_putc(struct uart_port *port, int c)
80{ 80{
81 wait_for_xmitr(port); 81 wait_for_xmitr(port);
82 serial_out(port, UART_TX, c); 82 serial_out(port, UART_TX, c);
@@ -91,7 +91,7 @@ static void __init early_serial8250_write(struct console *console, const char *s
91 ier = serial_in(port, UART_IER); 91 ier = serial_in(port, UART_IER);
92 serial_out(port, UART_IER, 0); 92 serial_out(port, UART_IER, 0);
93 93
94 uart_console_write(port, s, count, putc); 94 uart_console_write(port, s, count, serial_putc);
95 95
96 /* Wait for transmitter to become empty and restore the IER */ 96 /* Wait for transmitter to become empty and restore the IER */
97 wait_for_xmitr(port); 97 wait_for_xmitr(port);
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 0e357562ce9e..ceb03c9e749f 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -1986,6 +1986,7 @@ static int pciserial_suspend_one(struct pci_dev *dev, pm_message_t state)
1986 1986
1987static int pciserial_resume_one(struct pci_dev *dev) 1987static int pciserial_resume_one(struct pci_dev *dev)
1988{ 1988{
1989 int err;
1989 struct serial_private *priv = pci_get_drvdata(dev); 1990 struct serial_private *priv = pci_get_drvdata(dev);
1990 1991
1991 pci_set_power_state(dev, PCI_D0); 1992 pci_set_power_state(dev, PCI_D0);
@@ -1995,7 +1996,9 @@ static int pciserial_resume_one(struct pci_dev *dev)
1995 /* 1996 /*
1996 * The device may have been disabled. Re-enable it. 1997 * The device may have been disabled. Re-enable it.
1997 */ 1998 */
1998 pci_enable_device(dev); 1999 err = pci_enable_device(dev);
2000 if (err)
2001 return err;
1999 2002
2000 pciserial_resume_ports(priv); 2003 pciserial_resume_ports(priv);
2001 } 2004 }
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 926f58a674a1..1de098e75497 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -69,6 +69,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
69 { "CTL3001", 0 }, 69 { "CTL3001", 0 },
70 /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */ 70 /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */
71 { "CTL3011", 0 }, 71 { "CTL3011", 0 },
72 /* Davicom ISA 33.6K Modem */
73 { "DAV0336", 0 },
72 /* Creative */ 74 /* Creative */
73 /* Creative Modem Blaster Flash56 DI5601-1 */ 75 /* Creative Modem Blaster Flash56 DI5601-1 */
74 { "DMB1032", 0 }, 76 { "DMB1032", 0 },
@@ -345,6 +347,11 @@ static const struct pnp_device_id pnp_dev_table[] = {
345 /* Fujitsu Wacom Tablet PC devices */ 347 /* Fujitsu Wacom Tablet PC devices */
346 { "FUJ02E5", 0 }, 348 { "FUJ02E5", 0 },
347 { "FUJ02E6", 0 }, 349 { "FUJ02E6", 0 },
350 /*
351 * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in
352 * disguise)
353 */
354 { "LTS0001", 0 },
348 /* Rockwell's (PORALiNK) 33600 INT PNP */ 355 /* Rockwell's (PORALiNK) 33600 INT PNP */
349 { "WCI0003", 0 }, 356 { "WCI0003", 0 },
350 /* Unkown PnP modems */ 357 /* Unkown PnP modems */
@@ -432,7 +439,8 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
432 } 439 }
433 440
434 memset(&port, 0, sizeof(struct uart_port)); 441 memset(&port, 0, sizeof(struct uart_port));
435 port.irq = pnp_irq(dev, 0); 442 if (pnp_irq_valid(dev, 0))
443 port.irq = pnp_irq(dev, 0);
436 if (pnp_port_valid(dev, 0)) { 444 if (pnp_port_valid(dev, 0)) {
437 port.iobase = pnp_port_start(dev, 0); 445 port.iobase = pnp_port_start(dev, 0);
438 port.iotype = UPIO_PORT; 446 port.iotype = UPIO_PORT;
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index ed438bc7e98d..d7e1996e2fec 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -600,7 +600,7 @@ config SERIAL_SA1100_CONSOLE
600 600
601config SERIAL_BFIN 601config SERIAL_BFIN
602 tristate "Blackfin serial port support" 602 tristate "Blackfin serial port support"
603 depends on BFIN 603 depends on BLACKFIN
604 select SERIAL_CORE 604 select SERIAL_CORE
605 select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561) 605 select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561)
606 help 606 help
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 4d6b3c56d20e..111da57f5334 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -204,8 +204,6 @@ static u_int atmel_get_mctrl(struct uart_port *port)
204 */ 204 */
205static void atmel_stop_tx(struct uart_port *port) 205static void atmel_stop_tx(struct uart_port *port)
206{ 206{
207 struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
208
209 UART_PUT_IDR(port, ATMEL_US_TXRDY); 207 UART_PUT_IDR(port, ATMEL_US_TXRDY);
210} 208}
211 209
@@ -214,8 +212,6 @@ static void atmel_stop_tx(struct uart_port *port)
214 */ 212 */
215static void atmel_start_tx(struct uart_port *port) 213static void atmel_start_tx(struct uart_port *port)
216{ 214{
217 struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
218
219 UART_PUT_IER(port, ATMEL_US_TXRDY); 215 UART_PUT_IER(port, ATMEL_US_TXRDY);
220} 216}
221 217
@@ -224,8 +220,6 @@ static void atmel_start_tx(struct uart_port *port)
224 */ 220 */
225static void atmel_stop_rx(struct uart_port *port) 221static void atmel_stop_rx(struct uart_port *port)
226{ 222{
227 struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
228
229 UART_PUT_IDR(port, ATMEL_US_RXRDY); 223 UART_PUT_IDR(port, ATMEL_US_RXRDY);
230} 224}
231 225
@@ -409,7 +403,6 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id)
409 */ 403 */
410static int atmel_startup(struct uart_port *port) 404static int atmel_startup(struct uart_port *port)
411{ 405{
412 struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
413 int retval; 406 int retval;
414 407
415 /* 408 /*
@@ -456,8 +449,6 @@ static int atmel_startup(struct uart_port *port)
456 */ 449 */
457static void atmel_shutdown(struct uart_port *port) 450static void atmel_shutdown(struct uart_port *port)
458{ 451{
459 struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
460
461 /* 452 /*
462 * Disable all interrupts, port and break condition. 453 * Disable all interrupts, port and break condition.
463 */ 454 */
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index f523cdf4b02b..a4e23cf47906 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -1,426 +1,10 @@
1/* $Id: serial.c,v 1.25 2004/09/29 10:33:49 starvik Exp $ 1/*
2 *
3 * Serial port driver for the ETRAX 100LX chip 2 * Serial port driver for the ETRAX 100LX chip
4 * 3 *
5 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Axis Communications AB 4 * Copyright (C) 1998-2007 Axis Communications AB
6 * 5 *
7 * Many, many authors. Based once upon a time on serial.c for 16x50. 6 * Many, many authors. Based once upon a time on serial.c for 16x50.
8 * 7 *
9 * $Log: serial.c,v $
10 * Revision 1.25 2004/09/29 10:33:49 starvik
11 * Resolved a dealock when printing debug from kernel.
12 *
13 * Revision 1.24 2004/08/27 23:25:59 johana
14 * rs_set_termios() must call change_speed() if c_iflag has changed or
15 * automatic XOFF handling will be enabled and transmitter will stop
16 * if 0x13 is received.
17 *
18 * Revision 1.23 2004/08/24 06:57:13 starvik
19 * More whitespace cleanup
20 *
21 * Revision 1.22 2004/08/24 06:12:20 starvik
22 * Whitespace cleanup
23 *
24 * Revision 1.20 2004/05/24 12:00:20 starvik
25 * Big merge of stuff from Linux 2.4 (e.g. manual mode for the serial port).
26 *
27 * Revision 1.19 2004/05/17 13:12:15 starvik
28 * Kernel console hook
29 * Big merge from Linux 2.4 still pending.
30 *
31 * Revision 1.18 2003/10/28 07:18:30 starvik
32 * Compiles with debug info
33 *
34 * Revision 1.17 2003/07/04 08:27:37 starvik
35 * Merge of Linux 2.5.74
36 *
37 * Revision 1.16 2003/06/13 10:05:19 johana
38 * Help the user to avoid trouble by:
39 * Forcing mixed mode for status/control lines if not all pins are used.
40 *
41 * Revision 1.15 2003/06/13 09:43:01 johana
42 * Merged in the following changes from os/linux/arch/cris/drivers/serial.c
43 * + some minor changes to reduce diff.
44 *
45 * Revision 1.49 2003/05/30 11:31:54 johana
46 * Merged in change-branch--serial9bit that adds CMSPAR support for sticky
47 * parity (mark/space)
48 *
49 * Revision 1.48 2003/05/30 11:03:57 johana
50 * Implemented rs_send_xchar() by disabling the DMA and writing manually.
51 * Added e100_disable_txdma_channel() and e100_enable_txdma_channel().
52 * Fixed rs_throttle() and rs_unthrottle() to properly call rs_send_xchar
53 * instead of setting info->x_char and check the CRTSCTS flag before
54 * controlling the rts pin.
55 *
56 * Revision 1.14 2003/04/09 08:12:44 pkj
57 * Corrected typo changes made upstream.
58 *
59 * Revision 1.13 2003/04/09 05:20:47 starvik
60 * Merge of Linux 2.5.67
61 *
62 * Revision 1.11 2003/01/22 06:48:37 starvik
63 * Fixed warnings issued by GCC 3.2.1
64 *
65 * Revision 1.9 2002/12/13 09:07:47 starvik
66 * Alert user that RX_TIMEOUT_TICKS==0 doesn't work
67 *
68 * Revision 1.8 2002/12/11 13:13:57 starvik
69 * Added arch/ to v10 specific includes
70 * Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
71 *
72 * Revision 1.7 2002/12/06 07:13:57 starvik
73 * Corrected work queue stuff
74 * Removed CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST
75 *
76 * Revision 1.6 2002/11/21 07:17:46 starvik
77 * Change static inline to extern inline where otherwise outlined with gcc-3.2
78 *
79 * Revision 1.5 2002/11/14 15:59:49 starvik
80 * Linux 2.5 port of the latest serial driver from 2.4. The work queue stuff
81 * probably doesn't work yet.
82 *
83 * Revision 1.42 2002/11/05 09:08:47 johana
84 * Better implementation of rs_stop() and rs_start() that uses the XOFF
85 * register to start/stop transmission.
86 * change_speed() also initilises XOFF register correctly so that
87 * auto_xoff is enabled when IXON flag is set by user.
88 * This gives fast XOFF response times.
89 *
90 * Revision 1.41 2002/11/04 18:40:57 johana
91 * Implemented rs_stop() and rs_start().
92 * Simple tests using hwtestserial indicates that this should be enough
93 * to make it work.
94 *
95 * Revision 1.40 2002/10/14 05:33:18 starvik
96 * RS-485 uses fast timers even if SERIAL_FAST_TIMER is disabled
97 *
98 * Revision 1.39 2002/09/30 21:00:57 johana
99 * Support for CONFIG_ETRAX_SERx_DTR_RI_DSR_CD_MIXED where the status and
100 * control pins can be mixed between PA and PB.
101 * If no serial port uses MIXED old solution is used
102 * (saves a few bytes and cycles).
103 * control_pins struct uses masks instead of bit numbers.
104 * Corrected dummy values and polarity in line_info() so
105 * /proc/tty/driver/serial is now correct.
106 * (the E100_xxx_GET() macros is really active low - perhaps not obvious)
107 *
108 * Revision 1.38 2002/08/23 11:01:36 starvik
109 * Check that serial port is enabled in all interrupt handlers to avoid
110 * restarts of DMA channels not assigned to serial ports
111 *
112 * Revision 1.37 2002/08/13 13:02:37 bjornw
113 * Removed some warnings because of unused code
114 *
115 * Revision 1.36 2002/08/08 12:50:01 starvik
116 * Serial interrupt is shared with synchronous serial port driver
117 *
118 * Revision 1.35 2002/06/03 10:40:49 starvik
119 * Increased RS-485 RTS toggle timer to 2 characters
120 *
121 * Revision 1.34 2002/05/28 18:59:36 johana
122 * Whitespace and comment fixing to be more like etrax100ser.c 1.71.
123 *
124 * Revision 1.33 2002/05/28 17:55:43 johana
125 * RS-485 uses FAST_TIMER if enabled, and starts a short (one char time)
126 * timer from tranismit_chars (interrupt context).
127 * The timer toggles RTS in interrupt context when expired giving minimum
128 * latencies.
129 *
130 * Revision 1.32 2002/05/22 13:58:00 johana
131 * Renamed rs_write() to raw_write() and made it inline.
132 * New rs_write() handles RS-485 if configured and enabled
133 * (moved code from e100_write_rs485()).
134 * RS-485 ioctl's uses copy_from_user() instead of verify_area().
135 *
136 * Revision 1.31 2002/04/22 11:20:03 johana
137 * Updated copyright years.
138 *
139 * Revision 1.30 2002/04/22 09:39:12 johana
140 * RS-485 support compiles.
141 *
142 * Revision 1.29 2002/01/14 16:10:01 pkj
143 * Allocate the receive buffers dynamically. The static 4kB buffer was
144 * too small for the peaks. This means that we can get rid of the extra
145 * buffer and the copying to it. It also means we require less memory
146 * under normal operations, but can use more when needed (there is a
147 * cap at 64kB for safety reasons). If there is no memory available
148 * we panic(), and die a horrible death...
149 *
150 * Revision 1.28 2001/12/18 15:04:53 johana
151 * Cleaned up write_rs485() - now it works correctly without padding extra
152 * char.
153 * Added sane default initialisation of rs485.
154 * Added #ifdef around dummy variables.
155 *
156 * Revision 1.27 2001/11/29 17:00:41 pkj
157 * 2kB seems to be too small a buffer when using 921600 bps,
158 * so increase it to 4kB (this was already done for the elinux
159 * version of the serial driver).
160 *
161 * Revision 1.26 2001/11/19 14:20:41 pkj
162 * Minor changes to comments and unused code.
163 *
164 * Revision 1.25 2001/11/12 20:03:43 pkj
165 * Fixed compiler warnings.
166 *
167 * Revision 1.24 2001/11/12 15:10:05 pkj
168 * Total redesign of the receiving part of the serial driver.
169 * Uses eight chained descriptors to write to a 4kB buffer.
170 * This data is then serialised into a 2kB buffer. From there it
171 * is copied into the TTY's flip buffers when they become available.
172 * A lot of copying, and the sizes of the buffers might need to be
173 * tweaked, but all in all it should work better than the previous
174 * version, without the need to modify the TTY code in any way.
175 * Also note that erroneous bytes are now correctly marked in the
176 * flag buffers (instead of always marking the first byte).
177 *
178 * Revision 1.23 2001/10/30 17:53:26 pkj
179 * * Set info->uses_dma to 0 when a port is closed.
180 * * Mark the timer1 interrupt as a fast one (SA_INTERRUPT).
181 * * Call start_flush_timer() in start_receive() if
182 * CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST is defined.
183 *
184 * Revision 1.22 2001/10/30 17:44:03 pkj
185 * Use %lu for received and transmitted counters in line_info().
186 *
187 * Revision 1.21 2001/10/30 17:40:34 pkj
188 * Clean-up. The only change to functionality is that
189 * CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS(=5) is used instead of
190 * MAX_FLUSH_TIME(=8).
191 *
192 * Revision 1.20 2001/10/30 15:24:49 johana
193 * Added char_time stuff from 2.0 driver.
194 *
195 * Revision 1.19 2001/10/30 15:23:03 johana
196 * Merged with 1.13.2 branch + fixed indentation
197 * and changed CONFIG_ETRAX100_XYS to CONFIG_ETRAX_XYZ
198 *
199 * Revision 1.18 2001/09/24 09:27:22 pkj
200 * Completed ext_baud_table[] in cflag_to_baud() and cflag_to_etrax_baud().
201 *
202 * Revision 1.17 2001/08/24 11:32:49 ronny
203 * More fixes for the CONFIG_ETRAX_SERIAL_PORT0 define.
204 *
205 * Revision 1.16 2001/08/24 07:56:22 ronny
206 * Added config ifdefs around ser0 irq requests.
207 *
208 * Revision 1.15 2001/08/16 09:10:31 bjarne
209 * serial.c - corrected the initialization of rs_table, the wrong defines
210 * where used.
211 * Corrected a test in timed_flush_handler.
212 * Changed configured to enabled.
213 * serial.h - Changed configured to enabled.
214 *
215 * Revision 1.14 2001/08/15 07:31:23 bjarne
216 * Introduced two new members to the e100_serial struct.
217 * configured - Will be set to 1 if the port has been configured in .config
218 * uses_dma - Should be set to 1 if the port uses DMA. Currently it is set
219 * to 1
220 * when a port is opened. This is used to limit the DMA interrupt
221 * routines to only manipulate DMA channels actually used by the
222 * serial driver.
223 *
224 * Revision 1.13.2.2 2001/10/17 13:57:13 starvik
225 * Receiver was broken by the break fixes
226 *
227 * Revision 1.13.2.1 2001/07/20 13:57:39 ronny
228 * Merge with new stuff from etrax100ser.c. Works but haven't checked stuff
229 * like break handling.
230 *
231 * Revision 1.13 2001/05/09 12:40:31 johana
232 * Use DMA_NBR and IRQ_NBR defines from dma.h and irq.h
233 *
234 * Revision 1.12 2001/04/19 12:23:07 bjornw
235 * CONFIG_RS485 -> CONFIG_ETRAX_RS485
236 *
237 * Revision 1.11 2001/04/05 14:29:48 markusl
238 * Updated according to review remarks i.e.
239 * -Use correct types in port structure to avoid compiler warnings
240 * -Try to use IO_* macros whenever possible
241 * -Open should never return -EBUSY
242 *
243 * Revision 1.10 2001/03/05 13:14:07 bjornw
244 * Another spelling fix
245 *
246 * Revision 1.9 2001/02/23 13:46:38 bjornw
247 * Spellling check
248 *
249 * Revision 1.8 2001/01/23 14:56:35 markusl
250 * Made use of ser1 optional
251 * Needed by USB
252 *
253 * Revision 1.7 2001/01/19 16:14:48 perf
254 * Added kernel options for serial ports 234.
255 * Changed option names from CONFIG_ETRAX100_XYZ to CONFIG_ETRAX_XYZ.
256 *
257 * Revision 1.6 2000/11/22 16:36:09 bjornw
258 * Please marketing by using the correct case when spelling Etrax.
259 *
260 * Revision 1.5 2000/11/21 16:43:37 bjornw
261 * Fixed so it compiles under CONFIG_SVINTO_SIM
262 *
263 * Revision 1.4 2000/11/15 17:34:12 bjornw
264 * Added a timeout timer for flushing input channels. The interrupt-based
265 * fast flush system should be easy to merge with this later (works the same
266 * way, only with an irq instead of a system timer_list)
267 *
268 * Revision 1.3 2000/11/13 17:19:57 bjornw
269 * * Incredibly, this almost complete rewrite of serial.c worked (at least
270 * for output) the first time.
271 *
272 * Items worth noticing:
273 *
274 * No Etrax100 port 1 workarounds (does only compile on 2.4 anyway now)
275 * RS485 is not ported (why can't it be done in userspace as on x86 ?)
276 * Statistics done through async_icount - if any more stats are needed,
277 * that's the place to put them or in an arch-dep version of it.
278 * timeout_interrupt and the other fast timeout stuff not ported yet
279 * There be dragons in this 3k+ line driver
280 *
281 * Revision 1.2 2000/11/10 16:50:28 bjornw
282 * First shot at a 2.4 port, does not compile totally yet
283 *
284 * Revision 1.1 2000/11/10 16:47:32 bjornw
285 * Added verbatim copy of rev 1.49 etrax100ser.c from elinux
286 *
287 * Revision 1.49 2000/10/30 15:47:14 tobiasa
288 * Changed version number.
289 *
290 * Revision 1.48 2000/10/25 11:02:43 johana
291 * Changed %ul to %lu in printf's
292 *
293 * Revision 1.47 2000/10/18 15:06:53 pkj
294 * Compile correctly with CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST and
295 * CONFIG_ETRAX_SERIAL_PROC_ENTRY together.
296 * Some clean-up of the /proc/serial file.
297 *
298 * Revision 1.46 2000/10/16 12:59:40 johana
299 * Added CONFIG_ETRAX_SERIAL_PROC_ENTRY for statistics and debug info.
300 *
301 * Revision 1.45 2000/10/13 17:10:59 pkj
302 * Do not flush DMAs while flipping TTY buffers.
303 *
304 * Revision 1.44 2000/10/13 16:34:29 pkj
305 * Added a delay in ser_interrupt() for 2.3ms when an error is detected.
306 * We do not know why this delay is required yet, but without it the
307 * irmaflash program does not work (this was the program that needed
308 * the ser_interrupt() to be needed in the first place). This should not
309 * affect normal use of the serial ports.
310 *
311 * Revision 1.43 2000/10/13 16:30:44 pkj
312 * New version of the fast flush of serial buffers code. This time
313 * it is localized to the serial driver and uses a fast timer to
314 * do the work.
315 *
316 * Revision 1.42 2000/10/13 14:54:26 bennyo
317 * Fix for switching RTS when using rs485
318 *
319 * Revision 1.41 2000/10/12 11:43:44 pkj
320 * Cleaned up a number of comments.
321 *
322 * Revision 1.40 2000/10/10 11:58:39 johana
323 * Made RS485 support generic for all ports.
324 * Toggle rts in interrupt if no delay wanted.
325 * WARNING: No true transmitter empty check??
326 * Set d_wait bit when sending data so interrupt is delayed until
327 * fifo flushed. (Fix tcdrain() problem)
328 *
329 * Revision 1.39 2000/10/04 16:08:02 bjornw
330 * * Use virt_to_phys etc. for DMA addresses
331 * * Removed CONFIG_FLUSH_DMA_FAST hacks
332 * * Indentation fix
333 *
334 * Revision 1.38 2000/10/02 12:27:10 mattias
335 * * added variable used when using fast flush on serial dma.
336 * (CONFIG_FLUSH_DMA_FAST)
337 *
338 * Revision 1.37 2000/09/27 09:44:24 pkj
339 * Uncomment definition of SERIAL_HANDLE_EARLY_ERRORS.
340 *
341 * Revision 1.36 2000/09/20 13:12:52 johana
342 * Support for CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS:
343 * Number of timer ticks between flush of receive fifo (1 tick = 10ms).
344 * Try 0-3 for low latency applications. Approx 5 for high load
345 * applications (e.g. PPP). Maybe this should be more adaptive some day...
346 *
347 * Revision 1.35 2000/09/20 10:36:08 johana
348 * Typo in get_lsr_info()
349 *
350 * Revision 1.34 2000/09/20 10:29:59 johana
351 * Let rs_chars_in_buffer() check fifo content as well.
352 * get_lsr_info() might work now (not tested).
353 * Easier to change the port to debug.
354 *
355 * Revision 1.33 2000/09/13 07:52:11 torbjore
356 * Support RS485
357 *
358 * Revision 1.32 2000/08/31 14:45:37 bjornw
359 * After sending a break we need to reset the transmit DMA channel
360 *
361 * Revision 1.31 2000/06/21 12:13:29 johana
362 * Fixed wait for all chars sent when closing port.
363 * (Used to always take 1 second!)
364 * Added shadows for directions of status/ctrl signals.
365 *
366 * Revision 1.30 2000/05/29 16:27:55 bjornw
367 * Simulator ifdef moved a bit
368 *
369 * Revision 1.29 2000/05/09 09:40:30 mattias
370 * * Added description of dma registers used in timeout_interrupt
371 * * Removed old code
372 *
373 * Revision 1.28 2000/05/08 16:38:58 mattias
374 * * Bugfix for flushing fifo in timeout_interrupt
375 * Problem occurs when bluetooth stack waits for a small number of bytes
376 * containing an event acknowledging free buffers in bluetooth HW
377 * As before, data was stuck in fifo until more data came on uart and
378 * flushed it up to the stack.
379 *
380 * Revision 1.27 2000/05/02 09:52:28 jonasd
381 * Added fix for peculiar etrax behaviour when eop is forced on an empty
382 * fifo. This is used when flashing the IRMA chip. Disabled by default.
383 *
384 * Revision 1.26 2000/03/29 15:32:02 bjornw
385 * 2.0.34 updates
386 *
387 * Revision 1.25 2000/02/16 16:59:36 bjornw
388 * * Receive DMA directly into the flip-buffer, eliminating an intermediary
389 * receive buffer and a memcpy. Will avoid some overruns.
390 * * Error message on debug port if an overrun or flip buffer overrun occurs.
391 * * Just use the first byte in the flag flip buffer for errors.
392 * * Check for timeout on the serial ports only each 5/100 s, not 1/100.
393 *
394 * Revision 1.24 2000/02/09 18:02:28 bjornw
395 * * Clear serial errors (overrun, framing, parity) correctly. Before, the
396 * receiver would get stuck if an error occurred and we did not restart
397 * the input DMA.
398 * * Cosmetics (indentation, some code made into inlines)
399 * * Some more debug options
400 * * Actually shut down the serial port (DMA irq, DMA reset, receiver stop)
401 * when the last open is closed. Corresponding fixes in startup().
402 * * rs_close() "tx FIFO wait" code moved into right place, bug & -> && fixed
403 * and make a special case out of port 1 (R_DMA_CHx_STATUS is broken for that)
404 * * e100_disable_rx/enable_rx just disables/enables the receiver, not RTS
405 *
406 * Revision 1.23 2000/01/24 17:46:19 johana
407 * Wait for flush of DMA/FIFO when closing port.
408 *
409 * Revision 1.22 2000/01/20 18:10:23 johana
410 * Added TIOCMGET ioctl to return modem status.
411 * Implemented modem status/control that works with the extra signals
412 * (DTR, DSR, RI,CD) as well.
413 * 3 different modes supported:
414 * ser0 on PB (Bundy), ser1 on PB (Lisa) and ser2 on PA (Bundy)
415 * Fixed DEF_TX value that caused the serial transmitter pin (txd) to go to 0 when
416 * closing the last filehandle, NASTY!.
417 * Added break generation, not tested though!
418 * Use IRQF_SHARED when request_irq() for ser2 and ser3 (shared with) par0 and par1.
419 * You can't use them at the same time (yet..), but you can hopefully switch
420 * between ser2/par0, ser3/par1 with the same kernel config.
421 * Replaced some magic constants with defines
422 *
423 *
424 */ 8 */
425 9
426static char *serial_version = "$Revision: 1.25 $"; 10static char *serial_version = "$Revision: 1.25 $";
@@ -446,6 +30,7 @@ static char *serial_version = "$Revision: 1.25 $";
446 30
447#include <asm/io.h> 31#include <asm/io.h>
448#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/dma.h>
449#include <asm/system.h> 34#include <asm/system.h>
450#include <linux/delay.h> 35#include <linux/delay.h>
451 36
@@ -454,8 +39,9 @@ static char *serial_version = "$Revision: 1.25 $";
454/* non-arch dependent serial structures are in linux/serial.h */ 39/* non-arch dependent serial structures are in linux/serial.h */
455#include <linux/serial.h> 40#include <linux/serial.h>
456/* while we keep our own stuff (struct e100_serial) in a local .h file */ 41/* while we keep our own stuff (struct e100_serial) in a local .h file */
457#include "serial.h" 42#include "crisv10.h"
458#include <asm/fasttimer.h> 43#include <asm/fasttimer.h>
44#include <asm/arch/io_interface_mux.h>
459 45
460#ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER 46#ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
461#ifndef CONFIG_ETRAX_FAST_TIMER 47#ifndef CONFIG_ETRAX_FAST_TIMER
@@ -504,18 +90,6 @@ struct tty_driver *serial_driver;
504 from eLinux */ 90 from eLinux */
505#define SERIAL_HANDLE_EARLY_ERRORS 91#define SERIAL_HANDLE_EARLY_ERRORS
506 92
507/* Defined and used in n_tty.c, but we need it here as well */
508#define TTY_THRESHOLD_THROTTLE 128
509
510/* Due to buffersizes and threshold values, our SERIAL_DESCR_BUF_SIZE
511 * must not be to high or flow control won't work if we leave it to the tty
512 * layer so we have our own throttling in flush_to_flip
513 * TTY_FLIPBUF_SIZE=512,
514 * TTY_THRESHOLD_THROTTLE/UNTHROTTLE=128
515 * BUF_SIZE can't be > 128
516 */
517#define CRIS_BUF_SIZE 512
518
519/* Currently 16 descriptors x 128 bytes = 2048 bytes */ 93/* Currently 16 descriptors x 128 bytes = 2048 bytes */
520#define SERIAL_DESCR_BUF_SIZE 256 94#define SERIAL_DESCR_BUF_SIZE 256
521 95
@@ -588,13 +162,13 @@ unsigned long timer_data_to_ns(unsigned long timer_data);
588static void change_speed(struct e100_serial *info); 162static void change_speed(struct e100_serial *info);
589static void rs_throttle(struct tty_struct * tty); 163static void rs_throttle(struct tty_struct * tty);
590static void rs_wait_until_sent(struct tty_struct *tty, int timeout); 164static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
591static int rs_write(struct tty_struct * tty, int from_user, 165static int rs_write(struct tty_struct *tty,
592 const unsigned char *buf, int count); 166 const unsigned char *buf, int count);
593#ifdef CONFIG_ETRAX_RS485 167#ifdef CONFIG_ETRAX_RS485
594static int e100_write_rs485(struct tty_struct * tty, int from_user, 168static int e100_write_rs485(struct tty_struct *tty,
595 const unsigned char *buf, int count); 169 const unsigned char *buf, int count);
596#endif 170#endif
597static int get_lsr_info(struct e100_serial * info, unsigned int *value); 171static int get_lsr_info(struct e100_serial *info, unsigned int *value);
598 172
599 173
600#define DEF_BAUD 115200 /* 115.2 kbit/s */ 174#define DEF_BAUD 115200 /* 115.2 kbit/s */
@@ -679,20 +253,39 @@ static struct e100_serial rs_table[] = {
679 .rx_ctrl = DEF_RX, 253 .rx_ctrl = DEF_RX,
680 .tx_ctrl = DEF_TX, 254 .tx_ctrl = DEF_TX,
681 .iseteop = 2, 255 .iseteop = 2,
256 .dma_owner = dma_ser0,
257 .io_if = if_serial_0,
682#ifdef CONFIG_ETRAX_SERIAL_PORT0 258#ifdef CONFIG_ETRAX_SERIAL_PORT0
683 .enabled = 1, 259 .enabled = 1,
684#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT 260#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
685 .dma_out_enabled = 1, 261 .dma_out_enabled = 1,
262 .dma_out_nbr = SER0_TX_DMA_NBR,
263 .dma_out_irq_nbr = SER0_DMA_TX_IRQ_NBR,
264 .dma_out_irq_flags = IRQF_DISABLED,
265 .dma_out_irq_description = "serial 0 dma tr",
686#else 266#else
687 .dma_out_enabled = 0, 267 .dma_out_enabled = 0,
268 .dma_out_nbr = UINT_MAX,
269 .dma_out_irq_nbr = 0,
270 .dma_out_irq_flags = 0,
271 .dma_out_irq_description = NULL,
688#endif 272#endif
689#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN 273#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
690 .dma_in_enabled = 1, 274 .dma_in_enabled = 1,
275 .dma_in_nbr = SER0_RX_DMA_NBR,
276 .dma_in_irq_nbr = SER0_DMA_RX_IRQ_NBR,
277 .dma_in_irq_flags = IRQF_DISABLED,
278 .dma_in_irq_description = "serial 0 dma rec",
691#else 279#else
692 .dma_in_enabled = 0 280 .dma_in_enabled = 0,
281 .dma_in_nbr = UINT_MAX,
282 .dma_in_irq_nbr = 0,
283 .dma_in_irq_flags = 0,
284 .dma_in_irq_description = NULL,
693#endif 285#endif
694#else 286#else
695 .enabled = 0, 287 .enabled = 0,
288 .io_if_description = NULL,
696 .dma_out_enabled = 0, 289 .dma_out_enabled = 0,
697 .dma_in_enabled = 0 290 .dma_in_enabled = 0
698#endif 291#endif
@@ -714,20 +307,42 @@ static struct e100_serial rs_table[] = {
714 .rx_ctrl = DEF_RX, 307 .rx_ctrl = DEF_RX,
715 .tx_ctrl = DEF_TX, 308 .tx_ctrl = DEF_TX,
716 .iseteop = 3, 309 .iseteop = 3,
310 .dma_owner = dma_ser1,
311 .io_if = if_serial_1,
717#ifdef CONFIG_ETRAX_SERIAL_PORT1 312#ifdef CONFIG_ETRAX_SERIAL_PORT1
718 .enabled = 1, 313 .enabled = 1,
314 .io_if_description = "ser1",
719#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT 315#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
720 .dma_out_enabled = 1, 316 .dma_out_enabled = 1,
317 .dma_out_nbr = SER1_TX_DMA_NBR,
318 .dma_out_irq_nbr = SER1_DMA_TX_IRQ_NBR,
319 .dma_out_irq_flags = IRQF_DISABLED,
320 .dma_out_irq_description = "serial 1 dma tr",
721#else 321#else
722 .dma_out_enabled = 0, 322 .dma_out_enabled = 0,
323 .dma_out_nbr = UINT_MAX,
324 .dma_out_irq_nbr = 0,
325 .dma_out_irq_flags = 0,
326 .dma_out_irq_description = NULL,
723#endif 327#endif
724#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN 328#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
725 .dma_in_enabled = 1, 329 .dma_in_enabled = 1,
330 .dma_in_nbr = SER1_RX_DMA_NBR,
331 .dma_in_irq_nbr = SER1_DMA_RX_IRQ_NBR,
332 .dma_in_irq_flags = IRQF_DISABLED,
333 .dma_in_irq_description = "serial 1 dma rec",
726#else 334#else
727 .dma_in_enabled = 0 335 .dma_in_enabled = 0,
336 .dma_in_enabled = 0,
337 .dma_in_nbr = UINT_MAX,
338 .dma_in_irq_nbr = 0,
339 .dma_in_irq_flags = 0,
340 .dma_in_irq_description = NULL,
728#endif 341#endif
729#else 342#else
730 .enabled = 0, 343 .enabled = 0,
344 .io_if_description = NULL,
345 .dma_in_irq_nbr = 0,
731 .dma_out_enabled = 0, 346 .dma_out_enabled = 0,
732 .dma_in_enabled = 0 347 .dma_in_enabled = 0
733#endif 348#endif
@@ -748,20 +363,40 @@ static struct e100_serial rs_table[] = {
748 .rx_ctrl = DEF_RX, 363 .rx_ctrl = DEF_RX,
749 .tx_ctrl = DEF_TX, 364 .tx_ctrl = DEF_TX,
750 .iseteop = 0, 365 .iseteop = 0,
366 .dma_owner = dma_ser2,
367 .io_if = if_serial_2,
751#ifdef CONFIG_ETRAX_SERIAL_PORT2 368#ifdef CONFIG_ETRAX_SERIAL_PORT2
752 .enabled = 1, 369 .enabled = 1,
370 .io_if_description = "ser2",
753#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT 371#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
754 .dma_out_enabled = 1, 372 .dma_out_enabled = 1,
373 .dma_out_nbr = SER2_TX_DMA_NBR,
374 .dma_out_irq_nbr = SER2_DMA_TX_IRQ_NBR,
375 .dma_out_irq_flags = IRQF_DISABLED,
376 .dma_out_irq_description = "serial 2 dma tr",
755#else 377#else
756 .dma_out_enabled = 0, 378 .dma_out_enabled = 0,
379 .dma_out_nbr = UINT_MAX,
380 .dma_out_irq_nbr = 0,
381 .dma_out_irq_flags = 0,
382 .dma_out_irq_description = NULL,
757#endif 383#endif
758#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN 384#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
759 .dma_in_enabled = 1, 385 .dma_in_enabled = 1,
386 .dma_in_nbr = SER2_RX_DMA_NBR,
387 .dma_in_irq_nbr = SER2_DMA_RX_IRQ_NBR,
388 .dma_in_irq_flags = IRQF_DISABLED,
389 .dma_in_irq_description = "serial 2 dma rec",
760#else 390#else
761 .dma_in_enabled = 0 391 .dma_in_enabled = 0,
392 .dma_in_nbr = UINT_MAX,
393 .dma_in_irq_nbr = 0,
394 .dma_in_irq_flags = 0,
395 .dma_in_irq_description = NULL,
762#endif 396#endif
763#else 397#else
764 .enabled = 0, 398 .enabled = 0,
399 .io_if_description = NULL,
765 .dma_out_enabled = 0, 400 .dma_out_enabled = 0,
766 .dma_in_enabled = 0 401 .dma_in_enabled = 0
767#endif 402#endif
@@ -782,20 +417,40 @@ static struct e100_serial rs_table[] = {
782 .rx_ctrl = DEF_RX, 417 .rx_ctrl = DEF_RX,
783 .tx_ctrl = DEF_TX, 418 .tx_ctrl = DEF_TX,
784 .iseteop = 1, 419 .iseteop = 1,
420 .dma_owner = dma_ser3,
421 .io_if = if_serial_3,
785#ifdef CONFIG_ETRAX_SERIAL_PORT3 422#ifdef CONFIG_ETRAX_SERIAL_PORT3
786 .enabled = 1, 423 .enabled = 1,
424 .io_if_description = "ser3",
787#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT 425#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
788 .dma_out_enabled = 1, 426 .dma_out_enabled = 1,
427 .dma_out_nbr = SER3_TX_DMA_NBR,
428 .dma_out_irq_nbr = SER3_DMA_TX_IRQ_NBR,
429 .dma_out_irq_flags = IRQF_DISABLED,
430 .dma_out_irq_description = "serial 3 dma tr",
789#else 431#else
790 .dma_out_enabled = 0, 432 .dma_out_enabled = 0,
433 .dma_out_nbr = UINT_MAX,
434 .dma_out_irq_nbr = 0,
435 .dma_out_irq_flags = 0,
436 .dma_out_irq_description = NULL,
791#endif 437#endif
792#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN 438#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
793 .dma_in_enabled = 1, 439 .dma_in_enabled = 1,
440 .dma_in_nbr = SER3_RX_DMA_NBR,
441 .dma_in_irq_nbr = SER3_DMA_RX_IRQ_NBR,
442 .dma_in_irq_flags = IRQF_DISABLED,
443 .dma_in_irq_description = "serial 3 dma rec",
794#else 444#else
795 .dma_in_enabled = 0 445 .dma_in_enabled = 0,
446 .dma_in_nbr = UINT_MAX,
447 .dma_in_irq_nbr = 0,
448 .dma_in_irq_flags = 0,
449 .dma_in_irq_description = NULL
796#endif 450#endif
797#else 451#else
798 .enabled = 0, 452 .enabled = 0,
453 .io_if_description = NULL,
799 .dma_out_enabled = 0, 454 .dma_out_enabled = 0,
800 .dma_in_enabled = 0 455 .dma_in_enabled = 0
801#endif 456#endif
@@ -1416,12 +1071,11 @@ e100_dtr(struct e100_serial *info, int set)
1416 { 1071 {
1417 unsigned long flags; 1072 unsigned long flags;
1418 1073
1419 save_flags(flags); 1074 local_irq_save(flags);
1420 cli();
1421 *e100_modem_pins[info->line].dtr_shadow &= ~mask; 1075 *e100_modem_pins[info->line].dtr_shadow &= ~mask;
1422 *e100_modem_pins[info->line].dtr_shadow |= (set ? 0 : mask); 1076 *e100_modem_pins[info->line].dtr_shadow |= (set ? 0 : mask);
1423 *e100_modem_pins[info->line].dtr_port = *e100_modem_pins[info->line].dtr_shadow; 1077 *e100_modem_pins[info->line].dtr_port = *e100_modem_pins[info->line].dtr_shadow;
1424 restore_flags(flags); 1078 local_irq_restore(flags);
1425 } 1079 }
1426 1080
1427#ifdef SERIAL_DEBUG_IO 1081#ifdef SERIAL_DEBUG_IO
@@ -1440,12 +1094,11 @@ e100_rts(struct e100_serial *info, int set)
1440{ 1094{
1441#ifndef CONFIG_SVINTO_SIM 1095#ifndef CONFIG_SVINTO_SIM
1442 unsigned long flags; 1096 unsigned long flags;
1443 save_flags(flags); 1097 local_irq_save(flags);
1444 cli();
1445 info->rx_ctrl &= ~E100_RTS_MASK; 1098 info->rx_ctrl &= ~E100_RTS_MASK;
1446 info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ 1099 info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */
1447 info->port[REG_REC_CTRL] = info->rx_ctrl; 1100 info->port[REG_REC_CTRL] = info->rx_ctrl;
1448 restore_flags(flags); 1101 local_irq_restore(flags);
1449#ifdef SERIAL_DEBUG_IO 1102#ifdef SERIAL_DEBUG_IO
1450 printk("ser%i rts %i\n", info->line, set); 1103 printk("ser%i rts %i\n", info->line, set);
1451#endif 1104#endif
@@ -1463,12 +1116,11 @@ e100_ri_out(struct e100_serial *info, int set)
1463 unsigned char mask = e100_modem_pins[info->line].ri_mask; 1116 unsigned char mask = e100_modem_pins[info->line].ri_mask;
1464 unsigned long flags; 1117 unsigned long flags;
1465 1118
1466 save_flags(flags); 1119 local_irq_save(flags);
1467 cli();
1468 *e100_modem_pins[info->line].ri_shadow &= ~mask; 1120 *e100_modem_pins[info->line].ri_shadow &= ~mask;
1469 *e100_modem_pins[info->line].ri_shadow |= (set ? 0 : mask); 1121 *e100_modem_pins[info->line].ri_shadow |= (set ? 0 : mask);
1470 *e100_modem_pins[info->line].ri_port = *e100_modem_pins[info->line].ri_shadow; 1122 *e100_modem_pins[info->line].ri_port = *e100_modem_pins[info->line].ri_shadow;
1471 restore_flags(flags); 1123 local_irq_restore(flags);
1472 } 1124 }
1473#endif 1125#endif
1474} 1126}
@@ -1481,12 +1133,11 @@ e100_cd_out(struct e100_serial *info, int set)
1481 unsigned char mask = e100_modem_pins[info->line].cd_mask; 1133 unsigned char mask = e100_modem_pins[info->line].cd_mask;
1482 unsigned long flags; 1134 unsigned long flags;
1483 1135
1484 save_flags(flags); 1136 local_irq_save(flags);
1485 cli();
1486 *e100_modem_pins[info->line].cd_shadow &= ~mask; 1137 *e100_modem_pins[info->line].cd_shadow &= ~mask;
1487 *e100_modem_pins[info->line].cd_shadow |= (set ? 0 : mask); 1138 *e100_modem_pins[info->line].cd_shadow |= (set ? 0 : mask);
1488 *e100_modem_pins[info->line].cd_port = *e100_modem_pins[info->line].cd_shadow; 1139 *e100_modem_pins[info->line].cd_port = *e100_modem_pins[info->line].cd_shadow;
1489 restore_flags(flags); 1140 local_irq_restore(flags);
1490 } 1141 }
1491#endif 1142#endif
1492} 1143}
@@ -1560,8 +1211,7 @@ static void e100_disable_txdma_channel(struct e100_serial *info)
1560 /* Disable output DMA channel for the serial port in question 1211 /* Disable output DMA channel for the serial port in question
1561 * ( set to something other then serialX) 1212 * ( set to something other then serialX)
1562 */ 1213 */
1563 save_flags(flags); 1214 local_irq_save(flags);
1564 cli();
1565 DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); 1215 DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line));
1566 if (info->line == 0) { 1216 if (info->line == 0) {
1567 if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) == 1217 if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) ==
@@ -1589,7 +1239,7 @@ static void e100_disable_txdma_channel(struct e100_serial *info)
1589 } 1239 }
1590 } 1240 }
1591 *R_GEN_CONFIG = genconfig_shadow; 1241 *R_GEN_CONFIG = genconfig_shadow;
1592 restore_flags(flags); 1242 local_irq_restore(flags);
1593} 1243}
1594 1244
1595 1245
@@ -1597,8 +1247,7 @@ static void e100_enable_txdma_channel(struct e100_serial *info)
1597{ 1247{
1598 unsigned long flags; 1248 unsigned long flags;
1599 1249
1600 save_flags(flags); 1250 local_irq_save(flags);
1601 cli();
1602 DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line)); 1251 DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line));
1603 /* Enable output DMA channel for the serial port in question */ 1252 /* Enable output DMA channel for the serial port in question */
1604 if (info->line == 0) { 1253 if (info->line == 0) {
@@ -1615,7 +1264,7 @@ static void e100_enable_txdma_channel(struct e100_serial *info)
1615 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, serial3); 1264 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, serial3);
1616 } 1265 }
1617 *R_GEN_CONFIG = genconfig_shadow; 1266 *R_GEN_CONFIG = genconfig_shadow;
1618 restore_flags(flags); 1267 local_irq_restore(flags);
1619} 1268}
1620 1269
1621static void e100_disable_rxdma_channel(struct e100_serial *info) 1270static void e100_disable_rxdma_channel(struct e100_serial *info)
@@ -1625,8 +1274,7 @@ static void e100_disable_rxdma_channel(struct e100_serial *info)
1625 /* Disable input DMA channel for the serial port in question 1274 /* Disable input DMA channel for the serial port in question
1626 * ( set to something other then serialX) 1275 * ( set to something other then serialX)
1627 */ 1276 */
1628 save_flags(flags); 1277 local_irq_save(flags);
1629 cli();
1630 if (info->line == 0) { 1278 if (info->line == 0) {
1631 if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) == 1279 if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) ==
1632 IO_STATE(R_GEN_CONFIG, dma7, serial0)) { 1280 IO_STATE(R_GEN_CONFIG, dma7, serial0)) {
@@ -1653,7 +1301,7 @@ static void e100_disable_rxdma_channel(struct e100_serial *info)
1653 } 1301 }
1654 } 1302 }
1655 *R_GEN_CONFIG = genconfig_shadow; 1303 *R_GEN_CONFIG = genconfig_shadow;
1656 restore_flags(flags); 1304 local_irq_restore(flags);
1657} 1305}
1658 1306
1659 1307
@@ -1661,8 +1309,7 @@ static void e100_enable_rxdma_channel(struct e100_serial *info)
1661{ 1309{
1662 unsigned long flags; 1310 unsigned long flags;
1663 1311
1664 save_flags(flags); 1312 local_irq_save(flags);
1665 cli();
1666 /* Enable input DMA channel for the serial port in question */ 1313 /* Enable input DMA channel for the serial port in question */
1667 if (info->line == 0) { 1314 if (info->line == 0) {
1668 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma7); 1315 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma7);
@@ -1678,7 +1325,7 @@ static void e100_enable_rxdma_channel(struct e100_serial *info)
1678 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3); 1325 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3);
1679 } 1326 }
1680 *R_GEN_CONFIG = genconfig_shadow; 1327 *R_GEN_CONFIG = genconfig_shadow;
1681 restore_flags(flags); 1328 local_irq_restore(flags);
1682} 1329}
1683 1330
1684#ifdef SERIAL_HANDLE_EARLY_ERRORS 1331#ifdef SERIAL_HANDLE_EARLY_ERRORS
@@ -1785,7 +1432,7 @@ e100_enable_rs485(struct tty_struct *tty,struct rs485_control *r)
1785} 1432}
1786 1433
1787static int 1434static int
1788e100_write_rs485(struct tty_struct *tty, int from_user, 1435e100_write_rs485(struct tty_struct *tty,
1789 const unsigned char *buf, int count) 1436 const unsigned char *buf, int count)
1790{ 1437{
1791 struct e100_serial * info = (struct e100_serial *)tty->driver_data; 1438 struct e100_serial * info = (struct e100_serial *)tty->driver_data;
@@ -1798,7 +1445,7 @@ e100_write_rs485(struct tty_struct *tty, int from_user,
1798 */ 1445 */
1799 info->rs485.enabled = 1; 1446 info->rs485.enabled = 1;
1800 /* rs_write now deals with RS485 if enabled */ 1447 /* rs_write now deals with RS485 if enabled */
1801 count = rs_write(tty, from_user, buf, count); 1448 count = rs_write(tty, buf, count);
1802 info->rs485.enabled = old_enabled; 1449 info->rs485.enabled = old_enabled;
1803 return count; 1450 return count;
1804} 1451}
@@ -1836,7 +1483,7 @@ rs_stop(struct tty_struct *tty)
1836 unsigned long flags; 1483 unsigned long flags;
1837 unsigned long xoff; 1484 unsigned long xoff;
1838 1485
1839 save_flags(flags); cli(); 1486 local_irq_save(flags);
1840 DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n", 1487 DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n",
1841 CIRC_CNT(info->xmit.head, 1488 CIRC_CNT(info->xmit.head,
1842 info->xmit.tail,SERIAL_XMIT_SIZE))); 1489 info->xmit.tail,SERIAL_XMIT_SIZE)));
@@ -1848,7 +1495,7 @@ rs_stop(struct tty_struct *tty)
1848 } 1495 }
1849 1496
1850 *((unsigned long *)&info->port[REG_XOFF]) = xoff; 1497 *((unsigned long *)&info->port[REG_XOFF]) = xoff;
1851 restore_flags(flags); 1498 local_irq_restore(flags);
1852 } 1499 }
1853} 1500}
1854 1501
@@ -1860,7 +1507,7 @@ rs_start(struct tty_struct *tty)
1860 unsigned long flags; 1507 unsigned long flags;
1861 unsigned long xoff; 1508 unsigned long xoff;
1862 1509
1863 save_flags(flags); cli(); 1510 local_irq_save(flags);
1864 DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n", 1511 DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n",
1865 CIRC_CNT(info->xmit.head, 1512 CIRC_CNT(info->xmit.head,
1866 info->xmit.tail,SERIAL_XMIT_SIZE))); 1513 info->xmit.tail,SERIAL_XMIT_SIZE)));
@@ -1875,7 +1522,7 @@ rs_start(struct tty_struct *tty)
1875 info->xmit.head != info->xmit.tail && info->xmit.buf) 1522 info->xmit.head != info->xmit.tail && info->xmit.buf)
1876 e100_enable_serial_tx_ready_irq(info); 1523 e100_enable_serial_tx_ready_irq(info);
1877 1524
1878 restore_flags(flags); 1525 local_irq_restore(flags);
1879 } 1526 }
1880} 1527}
1881 1528
@@ -2055,8 +1702,7 @@ static int serial_fast_timer_expired = 0;
2055static void flush_timeout_function(unsigned long data); 1702static void flush_timeout_function(unsigned long data);
2056#define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\ 1703#define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\
2057 unsigned long timer_flags; \ 1704 unsigned long timer_flags; \
2058 save_flags(timer_flags); \ 1705 local_irq_save(timer_flags); \
2059 cli(); \
2060 if (fast_timers[info->line].function == NULL) { \ 1706 if (fast_timers[info->line].function == NULL) { \
2061 serial_fast_timer_started++; \ 1707 serial_fast_timer_started++; \
2062 TIMERD(DEBUG_LOG(info->line, "start_timer %i ", info->line)); \ 1708 TIMERD(DEBUG_LOG(info->line, "start_timer %i ", info->line)); \
@@ -2070,7 +1716,7 @@ static void flush_timeout_function(unsigned long data);
2070 else { \ 1716 else { \
2071 TIMERD(DEBUG_LOG(info->line, "timer %i already running\n", info->line)); \ 1717 TIMERD(DEBUG_LOG(info->line, "timer %i already running\n", info->line)); \
2072 } \ 1718 } \
2073 restore_flags(timer_flags); \ 1719 local_irq_restore(timer_flags); \
2074} 1720}
2075#define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec) 1721#define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec)
2076 1722
@@ -2099,8 +1745,7 @@ append_recv_buffer(struct e100_serial *info, struct etrax_recv_buffer *buffer)
2099{ 1745{
2100 unsigned long flags; 1746 unsigned long flags;
2101 1747
2102 save_flags(flags); 1748 local_irq_save(flags);
2103 cli();
2104 1749
2105 if (!info->first_recv_buffer) 1750 if (!info->first_recv_buffer)
2106 info->first_recv_buffer = buffer; 1751 info->first_recv_buffer = buffer;
@@ -2113,7 +1758,7 @@ append_recv_buffer(struct e100_serial *info, struct etrax_recv_buffer *buffer)
2113 if (info->recv_cnt > info->max_recv_cnt) 1758 if (info->recv_cnt > info->max_recv_cnt)
2114 info->max_recv_cnt = info->recv_cnt; 1759 info->max_recv_cnt = info->recv_cnt;
2115 1760
2116 restore_flags(flags); 1761 local_irq_restore(flags);
2117} 1762}
2118 1763
2119static int 1764static int
@@ -2133,11 +1778,7 @@ add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char fl
2133 info->icount.rx++; 1778 info->icount.rx++;
2134 } else { 1779 } else {
2135 struct tty_struct *tty = info->tty; 1780 struct tty_struct *tty = info->tty;
2136 *tty->flip.char_buf_ptr = data; 1781 tty_insert_flip_char(tty, data, flag);
2137 *tty->flip.flag_buf_ptr = flag;
2138 tty->flip.flag_buf_ptr++;
2139 tty->flip.char_buf_ptr++;
2140 tty->flip.count++;
2141 info->icount.rx++; 1782 info->icount.rx++;
2142 } 1783 }
2143 1784
@@ -2322,7 +1963,6 @@ start_receive(struct e100_serial *info)
2322 */ 1963 */
2323 return; 1964 return;
2324#endif 1965#endif
2325 info->tty->flip.count = 0;
2326 if (info->uses_dma_in) { 1966 if (info->uses_dma_in) {
2327 /* reset the input dma channel to be sure it works */ 1967 /* reset the input dma channel to be sure it works */
2328 1968
@@ -2484,32 +2124,20 @@ static void flush_to_flip_buffer(struct e100_serial *info)
2484{ 2124{
2485 struct tty_struct *tty; 2125 struct tty_struct *tty;
2486 struct etrax_recv_buffer *buffer; 2126 struct etrax_recv_buffer *buffer;
2487 unsigned int length;
2488 unsigned long flags; 2127 unsigned long flags;
2489 int max_flip_size;
2490
2491 if (!info->first_recv_buffer)
2492 return;
2493 2128
2494 save_flags(flags); 2129 local_irq_save(flags);
2495 cli(); 2130 tty = info->tty;
2496 2131
2497 if (!(tty = info->tty)) { 2132 if (!tty) {
2498 restore_flags(flags); 2133 local_irq_restore(flags);
2499 return; 2134 return;
2500 } 2135 }
2501 2136
2502 while ((buffer = info->first_recv_buffer) != NULL) { 2137 while ((buffer = info->first_recv_buffer) != NULL) {
2503 unsigned int count = buffer->length; 2138 unsigned int count = buffer->length;
2504 2139
2505 count = tty_buffer_request_room(tty, count); 2140 tty_insert_flip_string(tty, buffer->buffer, count);
2506 if (count == 0) /* Throttle ?? */
2507 break;
2508
2509 if (count > 1)
2510 tty_insert_flip_strings(tty, buffer->buffer, count - 1);
2511 tty_insert_flip_char(tty, buffer->buffer[count-1], buffer->error);
2512
2513 info->recv_cnt -= count; 2141 info->recv_cnt -= count;
2514 2142
2515 if (count == buffer->length) { 2143 if (count == buffer->length) {
@@ -2525,18 +2153,9 @@ static void flush_to_flip_buffer(struct e100_serial *info)
2525 if (!info->first_recv_buffer) 2153 if (!info->first_recv_buffer)
2526 info->last_recv_buffer = NULL; 2154 info->last_recv_buffer = NULL;
2527 2155
2528 restore_flags(flags); 2156 local_irq_restore(flags);
2529
2530 DFLIP(
2531 if (1) {
2532 DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx);
2533 DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty));
2534 DEBUG_LOG(info->line, "room %lu\n", tty->ldisc.receive_room(tty));
2535 }
2536 2157
2537 ); 2158 /* This includes a check for low-latency */
2538
2539 /* this includes a check for low-latency */
2540 tty_flip_buffer_push(tty); 2159 tty_flip_buffer_push(tty);
2541} 2160}
2542 2161
@@ -2679,21 +2298,7 @@ struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info)
2679 printk("!NO TTY!\n"); 2298 printk("!NO TTY!\n");
2680 return info; 2299 return info;
2681 } 2300 }
2682 if (tty->flip.count >= CRIS_BUF_SIZE - TTY_THRESHOLD_THROTTLE) { 2301
2683 /* check TTY_THROTTLED first so it indicates our state */
2684 if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) {
2685 DFLOW(DEBUG_LOG(info->line, "rs_throttle flip.count: %i\n", tty->flip.count));
2686 rs_throttle(tty);
2687 }
2688 }
2689 if (tty->flip.count >= CRIS_BUF_SIZE) {
2690 DEBUG_LOG(info->line, "force FLIP! %i\n", tty->flip.count);
2691 tty->flip.work.func((void *) tty);
2692 if (tty->flip.count >= CRIS_BUF_SIZE) {
2693 DEBUG_LOG(info->line, "FLIP FULL! %i\n", tty->flip.count);
2694 return info; /* if TTY_DONT_FLIP is set */
2695 }
2696 }
2697 /* Read data and status at the same time */ 2302 /* Read data and status at the same time */
2698 data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); 2303 data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]);
2699more_data: 2304more_data:
@@ -2746,27 +2351,26 @@ more_data:
2746 DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); 2351 DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt);
2747 info->errorcode = ERRCODE_INSERT_BREAK; 2352 info->errorcode = ERRCODE_INSERT_BREAK;
2748 } else { 2353 } else {
2354 unsigned char data = IO_EXTRACT(R_SERIAL0_READ,
2355 data_in, data_read);
2356 char flag = TTY_NORMAL;
2749 if (info->errorcode == ERRCODE_INSERT_BREAK) { 2357 if (info->errorcode == ERRCODE_INSERT_BREAK) {
2750 info->icount.brk++; 2358 struct tty_struct *tty = info->tty;
2751 *tty->flip.char_buf_ptr = 0; 2359 tty_insert_flip_char(tty, 0, flag);
2752 *tty->flip.flag_buf_ptr = TTY_BREAK;
2753 tty->flip.flag_buf_ptr++;
2754 tty->flip.char_buf_ptr++;
2755 tty->flip.count++;
2756 info->icount.rx++; 2360 info->icount.rx++;
2757 } 2361 }
2758 *tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read);
2759 2362
2760 if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) { 2363 if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) {
2761 info->icount.parity++; 2364 info->icount.parity++;
2762 *tty->flip.flag_buf_ptr = TTY_PARITY; 2365 flag = TTY_PARITY;
2763 } else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) { 2366 } else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) {
2764 info->icount.overrun++; 2367 info->icount.overrun++;
2765 *tty->flip.flag_buf_ptr = TTY_OVERRUN; 2368 flag = TTY_OVERRUN;
2766 } else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) { 2369 } else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) {
2767 info->icount.frame++; 2370 info->icount.frame++;
2768 *tty->flip.flag_buf_ptr = TTY_FRAME; 2371 flag = TTY_FRAME;
2769 } 2372 }
2373 tty_insert_flip_char(tty, data, flag);
2770 info->errorcode = 0; 2374 info->errorcode = 0;
2771 } 2375 }
2772 info->break_detected_cnt = 0; 2376 info->break_detected_cnt = 0;
@@ -2782,16 +2386,14 @@ more_data:
2782 log_int(rdpc(), 0, 0); 2386 log_int(rdpc(), 0, 0);
2783 } 2387 }
2784 ); 2388 );
2785 *tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read); 2389 tty_insert_flip_char(tty,
2786 *tty->flip.flag_buf_ptr = 0; 2390 IO_EXTRACT(R_SERIAL0_READ, data_in, data_read),
2391 TTY_NORMAL);
2787 } else { 2392 } else {
2788 DEBUG_LOG(info->line, "ser_rx int but no data_avail %08lX\n", data_read); 2393 DEBUG_LOG(info->line, "ser_rx int but no data_avail %08lX\n", data_read);
2789 } 2394 }
2790 2395
2791 2396
2792 tty->flip.flag_buf_ptr++;
2793 tty->flip.char_buf_ptr++;
2794 tty->flip.count++;
2795 info->icount.rx++; 2397 info->icount.rx++;
2796 data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); 2398 data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]);
2797 if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { 2399 if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) {
@@ -2929,7 +2531,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
2929 if (info->x_char) { 2531 if (info->x_char) {
2930 unsigned char rstat; 2532 unsigned char rstat;
2931 DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); 2533 DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char));
2932 save_flags(flags); cli(); 2534 local_irq_save(flags);
2933 rstat = info->port[REG_STATUS]; 2535 rstat = info->port[REG_STATUS];
2934 DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); 2536 DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
2935 2537
@@ -2938,7 +2540,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
2938 info->x_char = 0; 2540 info->x_char = 0;
2939 /* We must enable since it is disabled in ser_interrupt */ 2541 /* We must enable since it is disabled in ser_interrupt */
2940 e100_enable_serial_tx_ready_irq(info); 2542 e100_enable_serial_tx_ready_irq(info);
2941 restore_flags(flags); 2543 local_irq_restore(flags);
2942 return; 2544 return;
2943 } 2545 }
2944 if (info->uses_dma_out) { 2546 if (info->uses_dma_out) {
@@ -2946,7 +2548,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
2946 int i; 2548 int i;
2947 /* We only use normal tx interrupt when sending x_char */ 2549 /* We only use normal tx interrupt when sending x_char */
2948 DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); 2550 DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0));
2949 save_flags(flags); cli(); 2551 local_irq_save(flags);
2950 rstat = info->port[REG_STATUS]; 2552 rstat = info->port[REG_STATUS];
2951 DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); 2553 DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
2952 e100_disable_serial_tx_ready_irq(info); 2554 e100_disable_serial_tx_ready_irq(info);
@@ -2959,7 +2561,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
2959 nop(); 2561 nop();
2960 2562
2961 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue); 2563 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue);
2962 restore_flags(flags); 2564 local_irq_restore(flags);
2963 return; 2565 return;
2964 } 2566 }
2965 /* Normal char-by-char interrupt */ 2567 /* Normal char-by-char interrupt */
@@ -2973,7 +2575,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
2973 } 2575 }
2974 DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); 2576 DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail]));
2975 /* Send a byte, rs485 timing is critical so turn of ints */ 2577 /* Send a byte, rs485 timing is critical so turn of ints */
2976 save_flags(flags); cli(); 2578 local_irq_save(flags);
2977 info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; 2579 info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail];
2978 info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); 2580 info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1);
2979 info->icount.tx++; 2581 info->icount.tx++;
@@ -2997,7 +2599,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
2997 /* We must enable since it is disabled in ser_interrupt */ 2599 /* We must enable since it is disabled in ser_interrupt */
2998 e100_enable_serial_tx_ready_irq(info); 2600 e100_enable_serial_tx_ready_irq(info);
2999 } 2601 }
3000 restore_flags(flags); 2602 local_irq_restore(flags);
3001 2603
3002 if (CIRC_CNT(info->xmit.head, 2604 if (CIRC_CNT(info->xmit.head,
3003 info->xmit.tail, 2605 info->xmit.tail,
@@ -3022,7 +2624,7 @@ ser_interrupt(int irq, void *dev_id)
3022 int handled = 0; 2624 int handled = 0;
3023 static volatile unsigned long reentered_ready_mask = 0; 2625 static volatile unsigned long reentered_ready_mask = 0;
3024 2626
3025 save_flags(flags); cli(); 2627 local_irq_save(flags);
3026 irq_mask1_rd = *R_IRQ_MASK1_RD; 2628 irq_mask1_rd = *R_IRQ_MASK1_RD;
3027 /* First handle all rx interrupts with ints disabled */ 2629 /* First handle all rx interrupts with ints disabled */
3028 info = rs_table; 2630 info = rs_table;
@@ -3067,7 +2669,7 @@ ser_interrupt(int irq, void *dev_id)
3067 /* Unblock the serial interrupt */ 2669 /* Unblock the serial interrupt */
3068 *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set); 2670 *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);
3069 2671
3070 sti(); 2672 local_irq_enable();
3071 ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */ 2673 ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */
3072 info = rs_table; 2674 info = rs_table;
3073 for (i = 0; i < NR_PORTS; i++) { 2675 for (i = 0; i < NR_PORTS; i++) {
@@ -3080,11 +2682,11 @@ ser_interrupt(int irq, void *dev_id)
3080 ready_mask <<= 2; 2682 ready_mask <<= 2;
3081 } 2683 }
3082 /* handle_ser_tx_interrupt enables tr_ready interrupts */ 2684 /* handle_ser_tx_interrupt enables tr_ready interrupts */
3083 cli(); 2685 local_irq_disable();
3084 /* Handle reentered TX interrupt */ 2686 /* Handle reentered TX interrupt */
3085 irq_mask1_rd = reentered_ready_mask; 2687 irq_mask1_rd = reentered_ready_mask;
3086 } 2688 }
3087 cli(); 2689 local_irq_disable();
3088 tx_started = 0; 2690 tx_started = 0;
3089 } else { 2691 } else {
3090 unsigned long ready_mask; 2692 unsigned long ready_mask;
@@ -3100,7 +2702,7 @@ ser_interrupt(int irq, void *dev_id)
3100 } 2702 }
3101 } 2703 }
3102 2704
3103 restore_flags(flags); 2705 local_irq_restore(flags);
3104 return IRQ_RETVAL(handled); 2706 return IRQ_RETVAL(handled);
3105} /* ser_interrupt */ 2707} /* ser_interrupt */
3106#endif 2708#endif
@@ -3121,11 +2723,13 @@ ser_interrupt(int irq, void *dev_id)
3121 * them using rs_sched_event(), and they get done here. 2723 * them using rs_sched_event(), and they get done here.
3122 */ 2724 */
3123static void 2725static void
3124do_softint(void *private_) 2726do_softint(struct work_struct *work)
3125{ 2727{
3126 struct e100_serial *info = (struct e100_serial *) private_; 2728 struct e100_serial *info;
3127 struct tty_struct *tty; 2729 struct tty_struct *tty;
3128 2730
2731 info = container_of(work, struct e100_serial, work);
2732
3129 tty = info->tty; 2733 tty = info->tty;
3130 if (!tty) 2734 if (!tty)
3131 return; 2735 return;
@@ -3145,13 +2749,12 @@ startup(struct e100_serial * info)
3145 if (!xmit_page) 2749 if (!xmit_page)
3146 return -ENOMEM; 2750 return -ENOMEM;
3147 2751
3148 save_flags(flags); 2752 local_irq_save(flags);
3149 cli();
3150 2753
3151 /* if it was already initialized, skip this */ 2754 /* if it was already initialized, skip this */
3152 2755
3153 if (info->flags & ASYNC_INITIALIZED) { 2756 if (info->flags & ASYNC_INITIALIZED) {
3154 restore_flags(flags); 2757 local_irq_restore(flags);
3155 free_page(xmit_page); 2758 free_page(xmit_page);
3156 return 0; 2759 return 0;
3157 } 2760 }
@@ -3277,7 +2880,7 @@ startup(struct e100_serial * info)
3277 2880
3278 info->flags |= ASYNC_INITIALIZED; 2881 info->flags |= ASYNC_INITIALIZED;
3279 2882
3280 restore_flags(flags); 2883 local_irq_restore(flags);
3281 return 0; 2884 return 0;
3282} 2885}
3283 2886
@@ -3328,8 +2931,7 @@ shutdown(struct e100_serial * info)
3328 info->irq); 2931 info->irq);
3329#endif 2932#endif
3330 2933
3331 save_flags(flags); 2934 local_irq_save(flags);
3332 cli(); /* Disable interrupts */
3333 2935
3334 if (info->xmit.buf) { 2936 if (info->xmit.buf) {
3335 free_page((unsigned long)info->xmit.buf); 2937 free_page((unsigned long)info->xmit.buf);
@@ -3353,7 +2955,7 @@ shutdown(struct e100_serial * info)
3353 set_bit(TTY_IO_ERROR, &info->tty->flags); 2955 set_bit(TTY_IO_ERROR, &info->tty->flags);
3354 2956
3355 info->flags &= ~ASYNC_INITIALIZED; 2957 info->flags &= ~ASYNC_INITIALIZED;
3356 restore_flags(flags); 2958 local_irq_restore(flags);
3357} 2959}
3358 2960
3359 2961
@@ -3411,7 +3013,6 @@ change_speed(struct e100_serial *info)
3411 DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8)); 3013 DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8));
3412 info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8; 3014 info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8;
3413 } 3015 }
3414 }
3415#endif 3016#endif
3416 else 3017 else
3417 { 3018 {
@@ -3445,8 +3046,7 @@ change_speed(struct e100_serial *info)
3445 3046
3446#ifndef CONFIG_SVINTO_SIM 3047#ifndef CONFIG_SVINTO_SIM
3447 /* start with default settings and then fill in changes */ 3048 /* start with default settings and then fill in changes */
3448 save_flags(flags); 3049 local_irq_save(flags);
3449 cli();
3450 /* 8 bit, no/even parity */ 3050 /* 8 bit, no/even parity */
3451 info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) | 3051 info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) |
3452 IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) | 3052 IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) |
@@ -3510,7 +3110,7 @@ change_speed(struct e100_serial *info)
3510 } 3110 }
3511 3111
3512 *((unsigned long *)&info->port[REG_XOFF]) = xoff; 3112 *((unsigned long *)&info->port[REG_XOFF]) = xoff;
3513 restore_flags(flags); 3113 local_irq_restore(flags);
3514#endif /* !CONFIG_SVINTO_SIM */ 3114#endif /* !CONFIG_SVINTO_SIM */
3515 3115
3516 update_char_time(info); 3116 update_char_time(info);
@@ -3538,13 +3138,12 @@ rs_flush_chars(struct tty_struct *tty)
3538 3138
3539 /* this protection might not exactly be necessary here */ 3139 /* this protection might not exactly be necessary here */
3540 3140
3541 save_flags(flags); 3141 local_irq_save(flags);
3542 cli();
3543 start_transmit(info); 3142 start_transmit(info);
3544 restore_flags(flags); 3143 local_irq_restore(flags);
3545} 3144}
3546 3145
3547static int rs_raw_write(struct tty_struct * tty, int from_user, 3146static int rs_raw_write(struct tty_struct *tty,
3548 const unsigned char *buf, int count) 3147 const unsigned char *buf, int count)
3549{ 3148{
3550 int c, ret = 0; 3149 int c, ret = 0;
@@ -3567,53 +3166,19 @@ static int rs_raw_write(struct tty_struct * tty, int from_user,
3567 SIMCOUT(buf, count); 3166 SIMCOUT(buf, count);
3568 return count; 3167 return count;
3569#endif 3168#endif
3570 save_flags(flags); 3169 local_save_flags(flags);
3571 DFLOW(DEBUG_LOG(info->line, "write count %i ", count)); 3170 DFLOW(DEBUG_LOG(info->line, "write count %i ", count));
3572 DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty))); 3171 DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty)));
3573 3172
3574 3173
3575 /* the cli/restore_flags pairs below are needed because the 3174 /* The local_irq_disable/restore_flags pairs below are needed
3576 * DMA interrupt handler moves the info->xmit values. the memcpy 3175 * because the DMA interrupt handler moves the info->xmit values.
3577 * needs to be in the critical region unfortunately, because we 3176 * the memcpy needs to be in the critical region unfortunately,
3578 * need to read xmit values, memcpy, write xmit values in one 3177 * because we need to read xmit values, memcpy, write xmit values
3579 * atomic operation... this could perhaps be avoided by more clever 3178 * in one atomic operation... this could perhaps be avoided by
3580 * design. 3179 * more clever design.
3581 */ 3180 */
3582 if (from_user) { 3181 local_irq_disable();
3583 mutex_lock(&tmp_buf_mutex);
3584 while (1) {
3585 int c1;
3586 c = CIRC_SPACE_TO_END(info->xmit.head,
3587 info->xmit.tail,
3588 SERIAL_XMIT_SIZE);
3589 if (count < c)
3590 c = count;
3591 if (c <= 0)
3592 break;
3593
3594 c -= copy_from_user(tmp_buf, buf, c);
3595 if (!c) {
3596 if (!ret)
3597 ret = -EFAULT;
3598 break;
3599 }
3600 cli();
3601 c1 = CIRC_SPACE_TO_END(info->xmit.head,
3602 info->xmit.tail,
3603 SERIAL_XMIT_SIZE);
3604 if (c1 < c)
3605 c = c1;
3606 memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c);
3607 info->xmit.head = ((info->xmit.head + c) &
3608 (SERIAL_XMIT_SIZE-1));
3609 restore_flags(flags);
3610 buf += c;
3611 count -= c;
3612 ret += c;
3613 }
3614 mutex_unlock(&tmp_buf_mutex);
3615 } else {
3616 cli();
3617 while (count) { 3182 while (count) {
3618 c = CIRC_SPACE_TO_END(info->xmit.head, 3183 c = CIRC_SPACE_TO_END(info->xmit.head,
3619 info->xmit.tail, 3184 info->xmit.tail,
@@ -3631,8 +3196,7 @@ static int rs_raw_write(struct tty_struct * tty, int from_user,
3631 count -= c; 3196 count -= c;
3632 ret += c; 3197 ret += c;
3633 } 3198 }
3634 restore_flags(flags); 3199 local_irq_restore(flags);
3635 }
3636 3200
3637 /* enable transmitter if not running, unless the tty is stopped 3201 /* enable transmitter if not running, unless the tty is stopped
3638 * this does not need IRQ protection since if tr_running == 0 3202 * this does not need IRQ protection since if tr_running == 0
@@ -3651,7 +3215,7 @@ static int rs_raw_write(struct tty_struct * tty, int from_user,
3651} /* raw_raw_write() */ 3215} /* raw_raw_write() */
3652 3216
3653static int 3217static int
3654rs_write(struct tty_struct * tty, int from_user, 3218rs_write(struct tty_struct *tty,
3655 const unsigned char *buf, int count) 3219 const unsigned char *buf, int count)
3656{ 3220{
3657#if defined(CONFIG_ETRAX_RS485) 3221#if defined(CONFIG_ETRAX_RS485)
@@ -3678,7 +3242,7 @@ rs_write(struct tty_struct * tty, int from_user,
3678 } 3242 }
3679#endif /* CONFIG_ETRAX_RS485 */ 3243#endif /* CONFIG_ETRAX_RS485 */
3680 3244
3681 count = rs_raw_write(tty, from_user, buf, count); 3245 count = rs_raw_write(tty, buf, count);
3682 3246
3683#if defined(CONFIG_ETRAX_RS485) 3247#if defined(CONFIG_ETRAX_RS485)
3684 if (info->rs485.enabled) 3248 if (info->rs485.enabled)
@@ -3746,10 +3310,9 @@ rs_flush_buffer(struct tty_struct *tty)
3746 struct e100_serial *info = (struct e100_serial *)tty->driver_data; 3310 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
3747 unsigned long flags; 3311 unsigned long flags;
3748 3312
3749 save_flags(flags); 3313 local_irq_save(flags);
3750 cli();
3751 info->xmit.head = info->xmit.tail = 0; 3314 info->xmit.head = info->xmit.tail = 0;
3752 restore_flags(flags); 3315 local_irq_restore(flags);
3753 3316
3754 tty_wakeup(tty); 3317 tty_wakeup(tty);
3755} 3318}
@@ -3767,7 +3330,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
3767{ 3330{
3768 struct e100_serial *info = (struct e100_serial *)tty->driver_data; 3331 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
3769 unsigned long flags; 3332 unsigned long flags;
3770 save_flags(flags); cli(); 3333 local_irq_save(flags);
3771 if (info->uses_dma_out) { 3334 if (info->uses_dma_out) {
3772 /* Put the DMA on hold and disable the channel */ 3335 /* Put the DMA on hold and disable the channel */
3773 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold); 3336 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold);
@@ -3784,7 +3347,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
3784 DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch)); 3347 DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch));
3785 info->x_char = ch; 3348 info->x_char = ch;
3786 e100_enable_serial_tx_ready_irq(info); 3349 e100_enable_serial_tx_ready_irq(info);
3787 restore_flags(flags); 3350 local_irq_restore(flags);
3788} 3351}
3789 3352
3790/* 3353/*
@@ -3996,21 +3559,61 @@ char *get_control_state_str(int MLines, char *s)
3996} 3559}
3997#endif 3560#endif
3998 3561
3562static void
3563rs_break(struct tty_struct *tty, int break_state)
3564{
3565 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
3566 unsigned long flags;
3567
3568 if (!info->port)
3569 return;
3570
3571 local_irq_save(flags);
3572 if (break_state == -1) {
3573 /* Go to manual mode and set the txd pin to 0 */
3574 /* Clear bit 7 (txd) and 6 (tr_enable) */
3575 info->tx_ctrl &= 0x3F;
3576 } else {
3577 /* Set bit 7 (txd) and 6 (tr_enable) */
3578 info->tx_ctrl |= (0x80 | 0x40);
3579 }
3580 info->port[REG_TR_CTRL] = info->tx_ctrl;
3581 local_irq_restore(flags);
3582}
3583
3999static int 3584static int
4000get_modem_info(struct e100_serial * info, unsigned int *value) 3585rs_tiocmset(struct tty_struct *tty, struct file *file,
3586 unsigned int set, unsigned int clear)
4001{ 3587{
4002 unsigned int result; 3588 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
4003 /* Polarity isn't verified */
4004#if 0 /*def SERIAL_DEBUG_IO */
4005 3589
4006 printk("get_modem_info: RTS: %i DTR: %i CD: %i RI: %i DSR: %i CTS: %i\n", 3590 if (clear & TIOCM_RTS)
4007 E100_RTS_GET(info), 3591 e100_rts(info, 0);
4008 E100_DTR_GET(info), 3592 if (clear & TIOCM_DTR)
4009 E100_CD_GET(info), 3593 e100_dtr(info, 0);
4010 E100_RI_GET(info), 3594 /* Handle FEMALE behaviour */
4011 E100_DSR_GET(info), 3595 if (clear & TIOCM_RI)
4012 E100_CTS_GET(info)); 3596 e100_ri_out(info, 0);
4013#endif 3597 if (clear & TIOCM_CD)
3598 e100_cd_out(info, 0);
3599
3600 if (set & TIOCM_RTS)
3601 e100_rts(info, 1);
3602 if (set & TIOCM_DTR)
3603 e100_dtr(info, 1);
3604 /* Handle FEMALE behaviour */
3605 if (set & TIOCM_RI)
3606 e100_ri_out(info, 1);
3607 if (set & TIOCM_CD)
3608 e100_cd_out(info, 1);
3609 return 0;
3610}
3611
3612static int
3613rs_tiocmget(struct tty_struct *tty, struct file *file)
3614{
3615 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
3616 unsigned int result;
4014 3617
4015 result = 3618 result =
4016 (!E100_RTS_GET(info) ? TIOCM_RTS : 0) 3619 (!E100_RTS_GET(info) ? TIOCM_RTS : 0)
@@ -4021,95 +3624,20 @@ get_modem_info(struct e100_serial * info, unsigned int *value)
4021 | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); 3624 | (!E100_CTS_GET(info) ? TIOCM_CTS : 0);
4022 3625
4023#ifdef SERIAL_DEBUG_IO 3626#ifdef SERIAL_DEBUG_IO
4024 printk("e100ser: modem state: %i 0x%08X\n", result, result); 3627 printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n",
3628 info->line, result, result);
4025 { 3629 {
4026 char s[100]; 3630 char s[100];
4027 3631
4028 get_control_state_str(result, s); 3632 get_control_state_str(result, s);
4029 printk("state: %s\n", s); 3633 printk(KERN_DEBUG "state: %s\n", s);
4030 } 3634 }
4031#endif 3635#endif
4032 if (copy_to_user(value, &result, sizeof(int))) 3636 return result;
4033 return -EFAULT;
4034 return 0;
4035}
4036 3637
4037
4038static int
4039set_modem_info(struct e100_serial * info, unsigned int cmd,
4040 unsigned int *value)
4041{
4042 unsigned int arg;
4043
4044 if (copy_from_user(&arg, value, sizeof(int)))
4045 return -EFAULT;
4046
4047 switch (cmd) {
4048 case TIOCMBIS:
4049 if (arg & TIOCM_RTS) {
4050 e100_rts(info, 1);
4051 }
4052 if (arg & TIOCM_DTR) {
4053 e100_dtr(info, 1);
4054 }
4055 /* Handle FEMALE behaviour */
4056 if (arg & TIOCM_RI) {
4057 e100_ri_out(info, 1);
4058 }
4059 if (arg & TIOCM_CD) {
4060 e100_cd_out(info, 1);
4061 }
4062 break;
4063 case TIOCMBIC:
4064 if (arg & TIOCM_RTS) {
4065 e100_rts(info, 0);
4066 }
4067 if (arg & TIOCM_DTR) {
4068 e100_dtr(info, 0);
4069 }
4070 /* Handle FEMALE behaviour */
4071 if (arg & TIOCM_RI) {
4072 e100_ri_out(info, 0);
4073 }
4074 if (arg & TIOCM_CD) {
4075 e100_cd_out(info, 0);
4076 }
4077 break;
4078 case TIOCMSET:
4079 e100_rts(info, arg & TIOCM_RTS);
4080 e100_dtr(info, arg & TIOCM_DTR);
4081 /* Handle FEMALE behaviour */
4082 e100_ri_out(info, arg & TIOCM_RI);
4083 e100_cd_out(info, arg & TIOCM_CD);
4084 break;
4085 default:
4086 return -EINVAL;
4087 }
4088 return 0;
4089} 3638}
4090 3639
4091 3640
4092static void
4093rs_break(struct tty_struct *tty, int break_state)
4094{
4095 struct e100_serial * info = (struct e100_serial *)tty->driver_data;
4096 unsigned long flags;
4097
4098 if (!info->port)
4099 return;
4100
4101 save_flags(flags);
4102 cli();
4103 if (break_state == -1) {
4104 /* Go to manual mode and set the txd pin to 0 */
4105 info->tx_ctrl &= 0x3F; /* Clear bit 7 (txd) and 6 (tr_enable) */
4106 } else {
4107 info->tx_ctrl |= (0x80 | 0x40); /* Set bit 7 (txd) and 6 (tr_enable) */
4108 }
4109 info->port[REG_TR_CTRL] = info->tx_ctrl;
4110 restore_flags(flags);
4111}
4112
4113static int 3641static int
4114rs_ioctl(struct tty_struct *tty, struct file * file, 3642rs_ioctl(struct tty_struct *tty, struct file * file,
4115 unsigned int cmd, unsigned long arg) 3643 unsigned int cmd, unsigned long arg)
@@ -4124,49 +3652,45 @@ rs_ioctl(struct tty_struct *tty, struct file * file,
4124 } 3652 }
4125 3653
4126 switch (cmd) { 3654 switch (cmd) {
4127 case TIOCMGET: 3655 case TIOCGSERIAL:
4128 return get_modem_info(info, (unsigned int *) arg); 3656 return get_serial_info(info,
4129 case TIOCMBIS: 3657 (struct serial_struct *) arg);
4130 case TIOCMBIC: 3658 case TIOCSSERIAL:
4131 case TIOCMSET: 3659 return set_serial_info(info,
4132 return set_modem_info(info, cmd, (unsigned int *) arg); 3660 (struct serial_struct *) arg);
4133 case TIOCGSERIAL: 3661 case TIOCSERGETLSR: /* Get line status register */
4134 return get_serial_info(info, 3662 return get_lsr_info(info, (unsigned int *) arg);
4135 (struct serial_struct *) arg); 3663
4136 case TIOCSSERIAL: 3664 case TIOCSERGSTRUCT:
4137 return set_serial_info(info, 3665 if (copy_to_user((struct e100_serial *) arg,
4138 (struct serial_struct *) arg); 3666 info, sizeof(struct e100_serial)))
4139 case TIOCSERGETLSR: /* Get line status register */ 3667 return -EFAULT;
4140 return get_lsr_info(info, (unsigned int *) arg); 3668 return 0;
4141
4142 case TIOCSERGSTRUCT:
4143 if (copy_to_user((struct e100_serial *) arg,
4144 info, sizeof(struct e100_serial)))
4145 return -EFAULT;
4146 return 0;
4147 3669
4148#if defined(CONFIG_ETRAX_RS485) 3670#if defined(CONFIG_ETRAX_RS485)
4149 case TIOCSERSETRS485: 3671 case TIOCSERSETRS485:
4150 { 3672 {
4151 struct rs485_control rs485ctrl; 3673 struct rs485_control rs485ctrl;
4152 if (copy_from_user(&rs485ctrl, (struct rs485_control*)arg, sizeof(rs485ctrl))) 3674 if (copy_from_user(&rs485ctrl, (struct rs485_control *)arg,
4153 return -EFAULT; 3675 sizeof(rs485ctrl)))
3676 return -EFAULT;
4154 3677
4155 return e100_enable_rs485(tty, &rs485ctrl); 3678 return e100_enable_rs485(tty, &rs485ctrl);
4156 } 3679 }
4157 3680
4158 case TIOCSERWRRS485: 3681 case TIOCSERWRRS485:
4159 { 3682 {
4160 struct rs485_write rs485wr; 3683 struct rs485_write rs485wr;
4161 if (copy_from_user(&rs485wr, (struct rs485_write*)arg, sizeof(rs485wr))) 3684 if (copy_from_user(&rs485wr, (struct rs485_write *)arg,
4162 return -EFAULT; 3685 sizeof(rs485wr)))
3686 return -EFAULT;
4163 3687
4164 return e100_write_rs485(tty, 1, rs485wr.outc, rs485wr.outc_size); 3688 return e100_write_rs485(tty, rs485wr.outc, rs485wr.outc_size);
4165 } 3689 }
4166#endif 3690#endif
4167 3691
4168 default: 3692 default:
4169 return -ENOIOCTLCMD; 3693 return -ENOIOCTLCMD;
4170 } 3694 }
4171 return 0; 3695 return 0;
4172} 3696}
@@ -4191,46 +3715,6 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
4191 3715
4192} 3716}
4193 3717
4194/* In debugport.c - register a console write function that uses the normal
4195 * serial driver
4196 */
4197typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len);
4198
4199extern debugport_write_function debug_write_function;
4200
4201static int rs_debug_write_function(int i, const char *buf, unsigned int len)
4202{
4203 int cnt;
4204 int written = 0;
4205 struct tty_struct *tty;
4206 static int recurse_cnt = 0;
4207
4208 tty = rs_table[i].tty;
4209 if (tty) {
4210 unsigned long flags;
4211 if (recurse_cnt > 5) /* We skip this debug output */
4212 return 1;
4213
4214 local_irq_save(flags);
4215 recurse_cnt++;
4216 local_irq_restore(flags);
4217 do {
4218 cnt = rs_write(tty, 0, buf + written, len);
4219 if (cnt >= 0) {
4220 written += cnt;
4221 buf += cnt;
4222 len -= cnt;
4223 } else
4224 len = cnt;
4225 } while(len > 0);
4226 local_irq_save(flags);
4227 recurse_cnt--;
4228 local_irq_restore(flags);
4229 return 1;
4230 }
4231 return 0;
4232}
4233
4234/* 3718/*
4235 * ------------------------------------------------------------ 3719 * ------------------------------------------------------------
4236 * rs_close() 3720 * rs_close()
@@ -4252,11 +3736,10 @@ rs_close(struct tty_struct *tty, struct file * filp)
4252 3736
4253 /* interrupts are disabled for this entire function */ 3737 /* interrupts are disabled for this entire function */
4254 3738
4255 save_flags(flags); 3739 local_irq_save(flags);
4256 cli();
4257 3740
4258 if (tty_hung_up_p(filp)) { 3741 if (tty_hung_up_p(filp)) {
4259 restore_flags(flags); 3742 local_irq_restore(flags);
4260 return; 3743 return;
4261 } 3744 }
4262 3745
@@ -4283,7 +3766,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
4283 info->count = 0; 3766 info->count = 0;
4284 } 3767 }
4285 if (info->count) { 3768 if (info->count) {
4286 restore_flags(flags); 3769 local_irq_restore(flags);
4287 return; 3770 return;
4288 } 3771 }
4289 info->flags |= ASYNC_CLOSING; 3772 info->flags |= ASYNC_CLOSING;
@@ -4337,7 +3820,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
4337 } 3820 }
4338 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 3821 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
4339 wake_up_interruptible(&info->close_wait); 3822 wake_up_interruptible(&info->close_wait);
4340 restore_flags(flags); 3823 local_irq_restore(flags);
4341 3824
4342 /* port closed */ 3825 /* port closed */
4343 3826
@@ -4359,6 +3842,28 @@ rs_close(struct tty_struct *tty, struct file * filp)
4359#endif 3842#endif
4360 } 3843 }
4361#endif 3844#endif
3845
3846 /*
3847 * Release any allocated DMA irq's.
3848 */
3849 if (info->dma_in_enabled) {
3850 free_irq(info->dma_in_irq_nbr, info);
3851 cris_free_dma(info->dma_in_nbr, info->dma_in_irq_description);
3852 info->uses_dma_in = 0;
3853#ifdef SERIAL_DEBUG_OPEN
3854 printk(KERN_DEBUG "DMA irq '%s' freed\n",
3855 info->dma_in_irq_description);
3856#endif
3857 }
3858 if (info->dma_out_enabled) {
3859 free_irq(info->dma_out_irq_nbr, info);
3860 cris_free_dma(info->dma_out_nbr, info->dma_out_irq_description);
3861 info->uses_dma_out = 0;
3862#ifdef SERIAL_DEBUG_OPEN
3863 printk(KERN_DEBUG "DMA irq '%s' freed\n",
3864 info->dma_out_irq_description);
3865#endif
3866 }
4362} 3867}
4363 3868
4364/* 3869/*
@@ -4433,8 +3938,8 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
4433 */ 3938 */
4434 if (tty_hung_up_p(filp) || 3939 if (tty_hung_up_p(filp) ||
4435 (info->flags & ASYNC_CLOSING)) { 3940 (info->flags & ASYNC_CLOSING)) {
4436 if (info->flags & ASYNC_CLOSING) 3941 wait_event_interruptible(info->close_wait,
4437 interruptible_sleep_on(&info->close_wait); 3942 !(info->flags & ASYNC_CLOSING));
4438#ifdef SERIAL_DO_RESTART 3943#ifdef SERIAL_DO_RESTART
4439 if (info->flags & ASYNC_HUP_NOTIFY) 3944 if (info->flags & ASYNC_HUP_NOTIFY)
4440 return -EAGAIN; 3945 return -EAGAIN;
@@ -4472,21 +3977,19 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
4472 printk("block_til_ready before block: ttyS%d, count = %d\n", 3977 printk("block_til_ready before block: ttyS%d, count = %d\n",
4473 info->line, info->count); 3978 info->line, info->count);
4474#endif 3979#endif
4475 save_flags(flags); 3980 local_irq_save(flags);
4476 cli();
4477 if (!tty_hung_up_p(filp)) { 3981 if (!tty_hung_up_p(filp)) {
4478 extra_count++; 3982 extra_count++;
4479 info->count--; 3983 info->count--;
4480 } 3984 }
4481 restore_flags(flags); 3985 local_irq_restore(flags);
4482 info->blocked_open++; 3986 info->blocked_open++;
4483 while (1) { 3987 while (1) {
4484 save_flags(flags); 3988 local_irq_save(flags);
4485 cli();
4486 /* assert RTS and DTR */ 3989 /* assert RTS and DTR */
4487 e100_rts(info, 1); 3990 e100_rts(info, 1);
4488 e100_dtr(info, 1); 3991 e100_dtr(info, 1);
4489 restore_flags(flags); 3992 local_irq_restore(flags);
4490 set_current_state(TASK_INTERRUPTIBLE); 3993 set_current_state(TASK_INTERRUPTIBLE);
4491 if (tty_hung_up_p(filp) || 3994 if (tty_hung_up_p(filp) ||
4492 !(info->flags & ASYNC_INITIALIZED)) { 3995 !(info->flags & ASYNC_INITIALIZED)) {
@@ -4528,6 +4031,19 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
4528 return 0; 4031 return 0;
4529} 4032}
4530 4033
4034static void
4035deinit_port(struct e100_serial *info)
4036{
4037 if (info->dma_out_enabled) {
4038 cris_free_dma(info->dma_out_nbr, info->dma_out_irq_description);
4039 free_irq(info->dma_out_irq_nbr, info);
4040 }
4041 if (info->dma_in_enabled) {
4042 cris_free_dma(info->dma_in_nbr, info->dma_in_irq_description);
4043 free_irq(info->dma_in_irq_nbr, info);
4044 }
4045}
4046
4531/* 4047/*
4532 * This routine is called whenever a serial port is opened. 4048 * This routine is called whenever a serial port is opened.
4533 * It performs the serial-specific initialization for the tty structure. 4049 * It performs the serial-specific initialization for the tty structure.
@@ -4538,9 +4054,9 @@ rs_open(struct tty_struct *tty, struct file * filp)
4538 struct e100_serial *info; 4054 struct e100_serial *info;
4539 int retval, line; 4055 int retval, line;
4540 unsigned long page; 4056 unsigned long page;
4057 int allocated_resources = 0;
4541 4058
4542 /* find which port we want to open */ 4059 /* find which port we want to open */
4543
4544 line = tty->index; 4060 line = tty->index;
4545 4061
4546 if (line < 0 || line >= NR_PORTS) 4062 if (line < 0 || line >= NR_PORTS)
@@ -4580,8 +4096,8 @@ rs_open(struct tty_struct *tty, struct file * filp)
4580 */ 4096 */
4581 if (tty_hung_up_p(filp) || 4097 if (tty_hung_up_p(filp) ||
4582 (info->flags & ASYNC_CLOSING)) { 4098 (info->flags & ASYNC_CLOSING)) {
4583 if (info->flags & ASYNC_CLOSING) 4099 wait_event_interruptible(info->close_wait,
4584 interruptible_sleep_on(&info->close_wait); 4100 !(info->flags & ASYNC_CLOSING));
4585#ifdef SERIAL_DO_RESTART 4101#ifdef SERIAL_DO_RESTART
4586 return ((info->flags & ASYNC_HUP_NOTIFY) ? 4102 return ((info->flags & ASYNC_HUP_NOTIFY) ?
4587 -EAGAIN : -ERESTARTSYS); 4103 -EAGAIN : -ERESTARTSYS);
@@ -4591,12 +4107,85 @@ rs_open(struct tty_struct *tty, struct file * filp)
4591 } 4107 }
4592 4108
4593 /* 4109 /*
4110 * If DMA is enabled try to allocate the irq's.
4111 */
4112 if (info->count == 1) {
4113 allocated_resources = 1;
4114 if (info->dma_in_enabled) {
4115 if (request_irq(info->dma_in_irq_nbr,
4116 rec_interrupt,
4117 info->dma_in_irq_flags,
4118 info->dma_in_irq_description,
4119 info)) {
4120 printk(KERN_WARNING "DMA irq '%s' busy; "
4121 "falling back to non-DMA mode\n",
4122 info->dma_in_irq_description);
4123 /* Make sure we never try to use DMA in */
4124 /* for the port again. */
4125 info->dma_in_enabled = 0;
4126 } else if (cris_request_dma(info->dma_in_nbr,
4127 info->dma_in_irq_description,
4128 DMA_VERBOSE_ON_ERROR,
4129 info->dma_owner)) {
4130 free_irq(info->dma_in_irq_nbr, info);
4131 printk(KERN_WARNING "DMA '%s' busy; "
4132 "falling back to non-DMA mode\n",
4133 info->dma_in_irq_description);
4134 /* Make sure we never try to use DMA in */
4135 /* for the port again. */
4136 info->dma_in_enabled = 0;
4137 }
4138#ifdef SERIAL_DEBUG_OPEN
4139 else
4140 printk(KERN_DEBUG "DMA irq '%s' allocated\n",
4141 info->dma_in_irq_description);
4142#endif
4143 }
4144 if (info->dma_out_enabled) {
4145 if (request_irq(info->dma_out_irq_nbr,
4146 tr_interrupt,
4147 info->dma_out_irq_flags,
4148 info->dma_out_irq_description,
4149 info)) {
4150 printk(KERN_WARNING "DMA irq '%s' busy; "
4151 "falling back to non-DMA mode\n",
4152 info->dma_out_irq_description);
4153 /* Make sure we never try to use DMA out */
4154 /* for the port again. */
4155 info->dma_out_enabled = 0;
4156 } else if (cris_request_dma(info->dma_out_nbr,
4157 info->dma_out_irq_description,
4158 DMA_VERBOSE_ON_ERROR,
4159 info->dma_owner)) {
4160 free_irq(info->dma_out_irq_nbr, info);
4161 printk(KERN_WARNING "DMA '%s' busy; "
4162 "falling back to non-DMA mode\n",
4163 info->dma_out_irq_description);
4164 /* Make sure we never try to use DMA out */
4165 /* for the port again. */
4166 info->dma_out_enabled = 0;
4167 }
4168#ifdef SERIAL_DEBUG_OPEN
4169 else
4170 printk(KERN_DEBUG "DMA irq '%s' allocated\n",
4171 info->dma_out_irq_description);
4172#endif
4173 }
4174 }
4175
4176 /*
4594 * Start up the serial port 4177 * Start up the serial port
4595 */ 4178 */
4596 4179
4597 retval = startup(info); 4180 retval = startup(info);
4598 if (retval) 4181 if (retval) {
4182 if (allocated_resources)
4183 deinit_port(info);
4184
4185 /* FIXME Decrease count info->count here too? */
4599 return retval; 4186 return retval;
4187 }
4188
4600 4189
4601 retval = block_til_ready(tty, filp, info); 4190 retval = block_til_ready(tty, filp, info);
4602 if (retval) { 4191 if (retval) {
@@ -4604,6 +4193,9 @@ rs_open(struct tty_struct *tty, struct file * filp)
4604 printk("rs_open returning after block_til_ready with %d\n", 4193 printk("rs_open returning after block_til_ready with %d\n",
4605 retval); 4194 retval);
4606#endif 4195#endif
4196 if (allocated_resources)
4197 deinit_port(info);
4198
4607 return retval; 4199 return retval;
4608 } 4200 }
4609 4201
@@ -4793,6 +4385,8 @@ static const struct tty_operations rs_ops = {
4793 .send_xchar = rs_send_xchar, 4385 .send_xchar = rs_send_xchar,
4794 .wait_until_sent = rs_wait_until_sent, 4386 .wait_until_sent = rs_wait_until_sent,
4795 .read_proc = rs_read_proc, 4387 .read_proc = rs_read_proc,
4388 .tiocmget = rs_tiocmget,
4389 .tiocmset = rs_tiocmset
4796}; 4390};
4797 4391
4798static int __init 4392static int __init
@@ -4810,9 +4404,27 @@ rs_init(void)
4810 /* Setup the timed flush handler system */ 4404 /* Setup the timed flush handler system */
4811 4405
4812#if !defined(CONFIG_ETRAX_SERIAL_FAST_TIMER) 4406#if !defined(CONFIG_ETRAX_SERIAL_FAST_TIMER)
4813 init_timer(&flush_timer); 4407 setup_timer(&flush_timer, timed_flush_handler, 0);
4814 flush_timer.function = timed_flush_handler; 4408 mod_timer(&flush_timer, jiffies + 5);
4815 mod_timer(&flush_timer, jiffies + CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS); 4409#endif
4410
4411#if defined(CONFIG_ETRAX_RS485)
4412#if defined(CONFIG_ETRAX_RS485_ON_PA)
4413 if (cris_io_interface_allocate_pins(if_ser0, 'a', rs485_pa_bit,
4414 rs485_pa_bit)) {
4415 printk(KERN_CRIT "ETRAX100LX serial: Could not allocate "
4416 "RS485 pin\n");
4417 return -EBUSY;
4418 }
4419#endif
4420#if defined(CONFIG_ETRAX_RS485_ON_PORT_G)
4421 if (cris_io_interface_allocate_pins(if_ser0, 'g', rs485_pa_bit,
4422 rs485_port_g_bit)) {
4423 printk(KERN_CRIT "ETRAX100LX serial: Could not allocate "
4424 "RS485 pin\n");
4425 return -EBUSY;
4426 }
4427#endif
4816#endif 4428#endif
4817 4429
4818 /* Initialize the tty_driver structure */ 4430 /* Initialize the tty_driver structure */
@@ -4839,6 +4451,16 @@ rs_init(void)
4839 /* do some initializing for the separate ports */ 4451 /* do some initializing for the separate ports */
4840 4452
4841 for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) { 4453 for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
4454 if (info->enabled) {
4455 if (cris_request_io_interface(info->io_if,
4456 info->io_if_description)) {
4457 printk(KERN_CRIT "ETRAX100LX async serial: "
4458 "Could not allocate IO pins for "
4459 "%s, port %d\n",
4460 info->io_if_description, i);
4461 info->enabled = 0;
4462 }
4463 }
4842 info->uses_dma_in = 0; 4464 info->uses_dma_in = 0;
4843 info->uses_dma_out = 0; 4465 info->uses_dma_out = 0;
4844 info->line = i; 4466 info->line = i;
@@ -4872,7 +4494,7 @@ rs_init(void)
4872 info->rs485.delay_rts_before_send = 0; 4494 info->rs485.delay_rts_before_send = 0;
4873 info->rs485.enabled = 0; 4495 info->rs485.enabled = 0;
4874#endif 4496#endif
4875 INIT_WORK(&info->work, do_softint, info); 4497 INIT_WORK(&info->work, do_softint);
4876 4498
4877 if (info->enabled) { 4499 if (info->enabled) {
4878 printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n", 4500 printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n",
@@ -4890,64 +4512,17 @@ rs_init(void)
4890#endif 4512#endif
4891 4513
4892#ifndef CONFIG_SVINTO_SIM 4514#ifndef CONFIG_SVINTO_SIM
4515#ifndef CONFIG_ETRAX_KGDB
4893 /* Not needed in simulator. May only complicate stuff. */ 4516 /* Not needed in simulator. May only complicate stuff. */
4894 /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */ 4517 /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */
4895 4518
4896 if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial ", NULL)) 4519 if (request_irq(SERIAL_IRQ_NBR, ser_interrupt,
4897 panic("irq8"); 4520 IRQF_SHARED | IRQF_DISABLED, "serial ", driver))
4898 4521 panic("%s: Failed to request irq8", __FUNCTION__);
4899#ifdef CONFIG_ETRAX_SERIAL_PORT0
4900#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
4901 if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 0 dma tr", NULL))
4902 panic("irq22");
4903#endif
4904#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
4905 if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 0 dma rec", NULL))
4906 panic("irq23");
4907#endif
4908#endif
4909
4910#ifdef CONFIG_ETRAX_SERIAL_PORT1
4911#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
4912 if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 1 dma tr", NULL))
4913 panic("irq24");
4914#endif
4915#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
4916 if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 1 dma rec", NULL))
4917 panic("irq25");
4918#endif
4919#endif
4920#ifdef CONFIG_ETRAX_SERIAL_PORT2
4921 /* DMA Shared with par0 (and SCSI0 and ATA) */
4922#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
4923 if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma tr", NULL))
4924 panic("irq18");
4925#endif
4926#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
4927 if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma rec", NULL))
4928 panic("irq19");
4929#endif
4930#endif
4931#ifdef CONFIG_ETRAX_SERIAL_PORT3
4932 /* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */
4933#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
4934 if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma tr", NULL))
4935 panic("irq20");
4936#endif
4937#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
4938 if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma rec", NULL))
4939 panic("irq21");
4940#endif
4941#endif
4942 4522
4943#ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST
4944 if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, IRQF_SHARED | IRQF_DISABLED,
4945 "fast serial dma timeout", NULL)) {
4946 printk(KERN_CRIT "err: timer1 irq\n");
4947 }
4948#endif 4523#endif
4949#endif /* CONFIG_SVINTO_SIM */ 4524#endif /* CONFIG_SVINTO_SIM */
4950 debug_write_function = rs_debug_write_function; 4525
4951 return 0; 4526 return 0;
4952} 4527}
4953 4528
diff --git a/drivers/serial/crisv10.h b/drivers/serial/crisv10.h
new file mode 100644
index 000000000000..ccd0f32b7372
--- /dev/null
+++ b/drivers/serial/crisv10.h
@@ -0,0 +1,146 @@
1/*
2 * serial.h: Arch-dep definitions for the Etrax100 serial driver.
3 *
4 * Copyright (C) 1998-2007 Axis Communications AB
5 */
6
7#ifndef _ETRAX_SERIAL_H
8#define _ETRAX_SERIAL_H
9
10#include <linux/circ_buf.h>
11#include <asm/termios.h>
12#include <asm/dma.h>
13#include <asm/arch/io_interface_mux.h>
14
15/* Software state per channel */
16
17#ifdef __KERNEL__
18/*
19 * This is our internal structure for each serial port's state.
20 *
21 * Many fields are paralleled by the structure used by the serial_struct
22 * structure.
23 *
24 * For definitions of the flags field, see tty.h
25 */
26
27#define SERIAL_RECV_DESCRIPTORS 8
28
29struct etrax_recv_buffer {
30 struct etrax_recv_buffer *next;
31 unsigned short length;
32 unsigned char error;
33 unsigned char pad;
34
35 unsigned char buffer[0];
36};
37
38struct e100_serial {
39 int baud;
40 volatile u8 *port; /* R_SERIALx_CTRL */
41 u32 irq; /* bitnr in R_IRQ_MASK2 for dmaX_descr */
42
43 /* Output registers */
44 volatile u8 *oclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
45 volatile u32 *ofirstadr; /* adr to R_DMA_CHx_FIRST */
46 volatile u8 *ocmdadr; /* adr to R_DMA_CHx_CMD */
47 const volatile u8 *ostatusadr; /* adr to R_DMA_CHx_STATUS */
48
49 /* Input registers */
50 volatile u8 *iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
51 volatile u32 *ifirstadr; /* adr to R_DMA_CHx_FIRST */
52 volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */
53 volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */
54
55 int flags; /* defined in tty.h */
56
57 u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
58 u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
59 u8 iseteop; /* bit number for R_SET_EOP for the input dma */
60 int enabled; /* Set to 1 if the port is enabled in HW config */
61
62 u8 dma_out_enabled; /* Set to 1 if DMA should be used */
63 u8 dma_in_enabled; /* Set to 1 if DMA should be used */
64
65 /* end of fields defined in rs_table[] in .c-file */
66 int dma_owner;
67 unsigned int dma_in_nbr;
68 unsigned int dma_out_nbr;
69 unsigned int dma_in_irq_nbr;
70 unsigned int dma_out_irq_nbr;
71 unsigned long dma_in_irq_flags;
72 unsigned long dma_out_irq_flags;
73 char *dma_in_irq_description;
74 char *dma_out_irq_description;
75
76 enum cris_io_interface io_if;
77 char *io_if_description;
78
79 u8 uses_dma_in; /* Set to 1 if DMA is used */
80 u8 uses_dma_out; /* Set to 1 if DMA is used */
81 u8 forced_eop; /* a fifo eop has been forced */
82 int baud_base; /* For special baudrates */
83 int custom_divisor; /* For special baudrates */
84 struct etrax_dma_descr tr_descr;
85 struct etrax_dma_descr rec_descr[SERIAL_RECV_DESCRIPTORS];
86 int cur_rec_descr;
87
88 volatile int tr_running; /* 1 if output is running */
89
90 struct tty_struct *tty;
91 int read_status_mask;
92 int ignore_status_mask;
93 int x_char; /* xon/xoff character */
94 int close_delay;
95 unsigned short closing_wait;
96 unsigned short closing_wait2;
97 unsigned long event;
98 unsigned long last_active;
99 int line;
100 int type; /* PORT_ETRAX */
101 int count; /* # of fd on device */
102 int blocked_open; /* # of blocked opens */
103 struct circ_buf xmit;
104 struct etrax_recv_buffer *first_recv_buffer;
105 struct etrax_recv_buffer *last_recv_buffer;
106 unsigned int recv_cnt;
107 unsigned int max_recv_cnt;
108
109 struct work_struct work;
110 struct async_icount icount; /* error-statistics etc.*/
111 struct ktermios normal_termios;
112 struct ktermios callout_termios;
113 wait_queue_head_t open_wait;
114 wait_queue_head_t close_wait;
115
116 unsigned long char_time_usec; /* The time for 1 char, in usecs */
117 unsigned long flush_time_usec; /* How often we should flush */
118 unsigned long last_tx_active_usec; /* Last tx usec in the jiffies */
119 unsigned long last_tx_active; /* Last tx time in jiffies */
120 unsigned long last_rx_active_usec; /* Last rx usec in the jiffies */
121 unsigned long last_rx_active; /* Last rx time in jiffies */
122
123 int break_detected_cnt;
124 int errorcode;
125
126#ifdef CONFIG_ETRAX_RS485
127 struct rs485_control rs485; /* RS-485 support */
128#endif
129};
130
131/* this PORT is not in the standard serial.h. it's not actually used for
132 * anything since we only have one type of async serial-port anyway in this
133 * system.
134 */
135
136#define PORT_ETRAX 1
137
138/*
139 * Events are used to schedule things to happen at timer-interrupt
140 * time, instead of at rs interrupt time.
141 */
142#define RS_EVENT_WRITE_WAKEUP 0
143
144#endif /* __KERNEL__ */
145
146#endif /* !_ETRAX_SERIAL_H */
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/serial/sh-sci.h b/drivers/serial/sh-sci.h
index e89ae29645d6..d24621ce799a 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -77,7 +77,6 @@
77# define SCIF_ONLY 77# define SCIF_ONLY
78#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) 78#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
79# define SCSPTR0 0xA4400000 /* 16 bit SCIF */ 79# define SCSPTR0 0xA4400000 /* 16 bit SCIF */
80# define SCI_NPORTS 2
81# define SCIF_ORER 0x0001 /* overrun error bit */ 80# define SCIF_ORER 0x0001 /* overrun error bit */
82# define PACR 0xa4050100 81# define PACR 0xa4050100
83# define PBCR 0xa4050102 82# define PBCR 0xa4050102
@@ -102,12 +101,6 @@
102# define SCIF_ORER 0x0001 /* overrun error bit */ 101# define SCIF_ORER 0x0001 /* overrun error bit */
103# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 102# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
104# define SCIF_ONLY 103# define SCIF_ONLY
105#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
106# define SCSPTR1 0xffe00020 /* 16 bit SCIF */
107# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
108# define SCIF_ORER 0x0001 /* overrun error bit */
109# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
110# define SCIF_ONLY
111#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) 104#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
112# include <asm/hardware.h> 105# include <asm/hardware.h>
113# define SCIF_BASE_ADDR 0x01030000 106# define SCIF_BASE_ADDR 0x01030000
@@ -116,8 +109,7 @@
116# define SCIF_LSR2_OFFS 0x0000024 109# define SCIF_LSR2_OFFS 0x0000024
117# define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */ 110# define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */
118# define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */ 111# define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */
119# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, 112# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, TE=1,RE=1,REIE=1 */
120 TE=1,RE=1,REIE=1 */
121# define SCIF_ONLY 113# define SCIF_ONLY
122#elif defined(CONFIG_H83007) || defined(CONFIG_H83068) 114#elif defined(CONFIG_H83007) || defined(CONFIG_H83068)
123# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ 115# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
@@ -577,15 +569,6 @@ static inline int sci_rxd_in(struct uart_port *port)
577 return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ 569 return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */
578 return 1; 570 return 1;
579} 571}
580#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
581static inline int sci_rxd_in(struct uart_port *port)
582{
583 if (port->mapbase == 0xffe00000)
584 return ctrl_inw(SCSPTR1)&0x0001 ? 1 : 0; /* SCIF */
585 else
586 return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
587
588}
589#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) 572#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
590static inline int sci_rxd_in(struct uart_port *port) 573static inline int sci_rxd_in(struct uart_port *port)
591{ 574{
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index dfef83f14960..a85f2d31a686 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -329,12 +329,14 @@ static struct uart_ops ulite_ops = {
329static void ulite_console_wait_tx(struct uart_port *port) 329static void ulite_console_wait_tx(struct uart_port *port)
330{ 330{
331 int i; 331 int i;
332 u8 val;
332 333
333 /* wait up to 10ms for the character(s) to be sent */ 334 /* Spin waiting for TX fifo to have space available */
334 for (i = 0; i < 10000; i++) { 335 for (i = 0; i < 100000; i++) {
335 if (readb(port->membase + ULITE_STATUS) & ULITE_STATUS_TXEMPTY) 336 val = readb(port->membase + ULITE_STATUS);
337 if ((val & ULITE_STATUS_TXFULL) == 0)
336 break; 338 break;
337 udelay(1); 339 cpu_relax();
338 } 340 }
339} 341}
340 342
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/sh/superhyway/superhyway.c b/drivers/sh/superhyway/superhyway.c
index 7d873b3b0513..4d0282b821b5 100644
--- a/drivers/sh/superhyway/superhyway.c
+++ b/drivers/sh/superhyway/superhyway.c
@@ -107,16 +107,17 @@ int superhyway_add_devices(struct superhyway_bus *bus,
107static int __init superhyway_init(void) 107static int __init superhyway_init(void)
108{ 108{
109 struct superhyway_bus *bus; 109 struct superhyway_bus *bus;
110 int ret = 0; 110 int ret;
111 111
112 device_register(&superhyway_bus_device); 112 ret = device_register(&superhyway_bus_device);
113 if (unlikely(ret))
114 return ret;
113 115
114 for (bus = superhyway_channels; bus->ops; bus++) 116 for (bus = superhyway_channels; bus->ops; bus++)
115 ret |= superhyway_scan_bus(bus); 117 ret |= superhyway_scan_bus(bus);
116 118
117 return ret; 119 return ret;
118} 120}
119
120postcore_initcall(superhyway_init); 121postcore_initcall(superhyway_init);
121 122
122static const struct superhyway_device_id * 123static const struct superhyway_device_id *
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index a77ede598d34..abf05048c638 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -61,7 +61,7 @@ config SPI_ATMEL
61 61
62config SPI_BFIN 62config SPI_BFIN
63 tristate "SPI controller driver for ADI Blackfin5xx" 63 tristate "SPI controller driver for ADI Blackfin5xx"
64 depends on SPI_MASTER && BFIN 64 depends on SPI_MASTER && BLACKFIN
65 help 65 help
66 This is the SPI controller master driver for Blackfin 5xx processor. 66 This is the SPI controller master driver for Blackfin 5xx processor.
67 67
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 89769ce16f88..b31f4431849b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -457,10 +457,11 @@ done:
457EXPORT_SYMBOL_GPL(spi_register_master); 457EXPORT_SYMBOL_GPL(spi_register_master);
458 458
459 459
460static int __unregister(struct device *dev, void *unused) 460static int __unregister(struct device *dev, void *master_dev)
461{ 461{
462 /* note: before about 2.6.14-rc1 this would corrupt memory: */ 462 /* note: before about 2.6.14-rc1 this would corrupt memory: */
463 spi_unregister_device(to_spi_device(dev)); 463 if (dev != master_dev)
464 spi_unregister_device(to_spi_device(dev));
464 return 0; 465 return 0;
465} 466}
466 467
@@ -478,7 +479,8 @@ void spi_unregister_master(struct spi_master *master)
478{ 479{
479 int dummy; 480 int dummy;
480 481
481 dummy = device_for_each_child(master->dev.parent, NULL, __unregister); 482 dummy = device_for_each_child(master->dev.parent, &master->dev,
483 __unregister);
482 device_unregister(&master->dev); 484 device_unregister(&master->dev);
483} 485}
484EXPORT_SYMBOL_GPL(spi_unregister_master); 486EXPORT_SYMBOL_GPL(spi_unregister_master);
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c
index cc5094f37dd3..363ac8e68821 100644
--- a/drivers/spi/spi_txx9.c
+++ b/drivers/spi/spi_txx9.c
@@ -24,6 +24,7 @@
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/io.h>
27#include <asm/gpio.h> 28#include <asm/gpio.h>
28 29
29 30
@@ -74,7 +75,6 @@ struct txx9spi {
74 struct list_head queue; 75 struct list_head queue;
75 wait_queue_head_t waitq; 76 wait_queue_head_t waitq;
76 void __iomem *membase; 77 void __iomem *membase;
77 int irq;
78 int baseclk; 78 int baseclk;
79 struct clk *clk; 79 struct clk *clk;
80 u32 max_speed_hz, min_speed_hz; 80 u32 max_speed_hz, min_speed_hz;
@@ -350,12 +350,12 @@ static int __init txx9spi_probe(struct platform_device *dev)
350 struct resource *res; 350 struct resource *res;
351 int ret = -ENODEV; 351 int ret = -ENODEV;
352 u32 mcr; 352 u32 mcr;
353 int irq;
353 354
354 master = spi_alloc_master(&dev->dev, sizeof(*c)); 355 master = spi_alloc_master(&dev->dev, sizeof(*c));
355 if (!master) 356 if (!master)
356 return ret; 357 return ret;
357 c = spi_master_get_devdata(master); 358 c = spi_master_get_devdata(master);
358 c->irq = -1;
359 platform_set_drvdata(dev, master); 359 platform_set_drvdata(dev, master);
360 360
361 INIT_WORK(&c->work, txx9spi_work); 361 INIT_WORK(&c->work, txx9spi_work);
@@ -381,32 +381,36 @@ static int __init txx9spi_probe(struct platform_device *dev)
381 381
382 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 382 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
383 if (!res) 383 if (!res)
384 goto exit; 384 goto exit_busy;
385 c->membase = ioremap(res->start, res->end - res->start + 1); 385 if (!devm_request_mem_region(&dev->dev,
386 res->start, res->end - res->start + 1,
387 "spi_txx9"))
388 goto exit_busy;
389 c->membase = devm_ioremap(&dev->dev,
390 res->start, res->end - res->start + 1);
386 if (!c->membase) 391 if (!c->membase)
387 goto exit; 392 goto exit_busy;
388 393
389 /* enter config mode */ 394 /* enter config mode */
390 mcr = txx9spi_rd(c, TXx9_SPMCR); 395 mcr = txx9spi_rd(c, TXx9_SPMCR);
391 mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR); 396 mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR);
392 txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); 397 txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR);
393 398
394 c->irq = platform_get_irq(dev, 0); 399 irq = platform_get_irq(dev, 0);
395 if (c->irq < 0) 400 if (irq < 0)
396 goto exit; 401 goto exit_busy;
397 ret = request_irq(c->irq, txx9spi_interrupt, 0, dev->name, c); 402 ret = devm_request_irq(&dev->dev, irq, txx9spi_interrupt, 0,
398 if (ret) { 403 "spi_txx9", c);
399 c->irq = -1; 404 if (ret)
400 goto exit; 405 goto exit;
401 }
402 406
403 c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); 407 c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id);
404 if (!c->workqueue) 408 if (!c->workqueue)
405 goto exit; 409 goto exit_busy;
406 c->last_chipselect = -1; 410 c->last_chipselect = -1;
407 411
408 dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n", 412 dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n",
409 (unsigned long long)res->start, c->irq, 413 (unsigned long long)res->start, irq,
410 (c->baseclk + 500000) / 1000000); 414 (c->baseclk + 500000) / 1000000);
411 415
412 master->bus_num = dev->id; 416 master->bus_num = dev->id;
@@ -418,13 +422,11 @@ static int __init txx9spi_probe(struct platform_device *dev)
418 if (ret) 422 if (ret)
419 goto exit; 423 goto exit;
420 return 0; 424 return 0;
425exit_busy:
426 ret = -EBUSY;
421exit: 427exit:
422 if (c->workqueue) 428 if (c->workqueue)
423 destroy_workqueue(c->workqueue); 429 destroy_workqueue(c->workqueue);
424 if (c->irq >= 0)
425 free_irq(c->irq, c);
426 if (c->membase)
427 iounmap(c->membase);
428 if (c->clk) { 430 if (c->clk) {
429 clk_disable(c->clk); 431 clk_disable(c->clk);
430 clk_put(c->clk); 432 clk_put(c->clk);
@@ -442,8 +444,6 @@ static int __exit txx9spi_remove(struct platform_device *dev)
442 spi_unregister_master(master); 444 spi_unregister_master(master);
443 platform_set_drvdata(dev, NULL); 445 platform_set_drvdata(dev, NULL);
444 destroy_workqueue(c->workqueue); 446 destroy_workqueue(c->workqueue);
445 free_irq(c->irq, c);
446 iounmap(c->membase);
447 clk_disable(c->clk); 447 clk_disable(c->clk);
448 clk_put(c->clk); 448 clk_put(c->clk);
449 spi_master_put(master); 449 spi_master_put(master);
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/spi/tle62x0.c b/drivers/spi/tle62x0.c
index 6da58ca48b33..455991fbe28f 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -107,8 +107,11 @@ static ssize_t tle62x0_status_show(struct device *dev,
107 107
108 mutex_lock(&st->lock); 108 mutex_lock(&st->lock);
109 ret = tle62x0_read(st); 109 ret = tle62x0_read(st);
110
111 dev_dbg(dev, "tle62x0_read() returned %d\n", ret); 110 dev_dbg(dev, "tle62x0_read() returned %d\n", ret);
111 if (ret < 0) {
112 mutex_unlock(&st->lock);
113 return ret;
114 }
112 115
113 for (ptr = 0; ptr < (st->nr_gpio * 2)/8; ptr += 1) { 116 for (ptr = 0; ptr < (st->nr_gpio * 2)/8; ptr += 1) {
114 fault <<= 8; 117 fault <<= 8;
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index c12a741b5574..85a20546e827 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -440,6 +440,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
440 break; 440 break;
441 case SSB_BUSTYPE_PCMCIA: 441 case SSB_BUSTYPE_PCMCIA:
442#ifdef CONFIG_SSB_PCMCIAHOST 442#ifdef CONFIG_SSB_PCMCIAHOST
443 sdev->irq = bus->host_pcmcia->irq.AssignedIRQ;
443 dev->parent = &bus->host_pcmcia->dev; 444 dev->parent = &bus->host_pcmcia->dev;
444#endif 445#endif
445 break; 446 break;
@@ -1147,7 +1148,10 @@ static int __init ssb_modinit(void)
1147 1148
1148 return err; 1149 return err;
1149} 1150}
1150subsys_initcall(ssb_modinit); 1151/* ssb must be initialized after PCI but before the ssb drivers.
1152 * That means we must use some initcall between subsys_initcall
1153 * and device_initcall. */
1154fs_initcall(ssb_modinit);
1151 1155
1152static void __exit ssb_modexit(void) 1156static void __exit ssb_modexit(void)
1153{ 1157{
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c
index b6abee846f02..bb44a76b3eb5 100644
--- a/drivers/ssb/pcmcia.c
+++ b/drivers/ssb/pcmcia.c
@@ -63,17 +63,17 @@ int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
63 err = pcmcia_access_configuration_register(pdev, &reg); 63 err = pcmcia_access_configuration_register(pdev, &reg);
64 if (err != CS_SUCCESS) 64 if (err != CS_SUCCESS)
65 goto error; 65 goto error;
66 read_addr |= (reg.Value & 0xF) << 12; 66 read_addr |= ((u32)(reg.Value & 0x0F)) << 12;
67 reg.Offset = 0x30; 67 reg.Offset = 0x30;
68 err = pcmcia_access_configuration_register(pdev, &reg); 68 err = pcmcia_access_configuration_register(pdev, &reg);
69 if (err != CS_SUCCESS) 69 if (err != CS_SUCCESS)
70 goto error; 70 goto error;
71 read_addr |= reg.Value << 16; 71 read_addr |= ((u32)reg.Value) << 16;
72 reg.Offset = 0x32; 72 reg.Offset = 0x32;
73 err = pcmcia_access_configuration_register(pdev, &reg); 73 err = pcmcia_access_configuration_register(pdev, &reg);
74 if (err != CS_SUCCESS) 74 if (err != CS_SUCCESS)
75 goto error; 75 goto error;
76 read_addr |= reg.Value << 24; 76 read_addr |= ((u32)reg.Value) << 24;
77 77
78 cur_core = (read_addr - SSB_ENUM_BASE) / SSB_CORE_SIZE; 78 cur_core = (read_addr - SSB_ENUM_BASE) / SSB_CORE_SIZE;
79 if (cur_core == coreidx) 79 if (cur_core == coreidx)
@@ -152,28 +152,29 @@ error:
152 goto out_unlock; 152 goto out_unlock;
153} 153}
154 154
155/* These are the main device register access functions. 155static int select_core_and_segment(struct ssb_device *dev,
156 * do_select_core is inline to have the likely hotpath inline. 156 u16 *offset)
157 * All unlikely codepaths are out-of-line. */
158static inline int do_select_core(struct ssb_bus *bus,
159 struct ssb_device *dev,
160 u16 *offset)
161{ 157{
158 struct ssb_bus *bus = dev->bus;
162 int err; 159 int err;
163 u8 need_seg = (*offset >= 0x800) ? 1 : 0; 160 u8 need_segment;
161
162 if (*offset >= 0x800) {
163 *offset -= 0x800;
164 need_segment = 1;
165 } else
166 need_segment = 0;
164 167
165 if (unlikely(dev != bus->mapped_device)) { 168 if (unlikely(dev != bus->mapped_device)) {
166 err = ssb_pcmcia_switch_core(bus, dev); 169 err = ssb_pcmcia_switch_core(bus, dev);
167 if (unlikely(err)) 170 if (unlikely(err))
168 return err; 171 return err;
169 } 172 }
170 if (unlikely(need_seg != bus->mapped_pcmcia_seg)) { 173 if (unlikely(need_segment != bus->mapped_pcmcia_seg)) {
171 err = ssb_pcmcia_switch_segment(bus, need_seg); 174 err = ssb_pcmcia_switch_segment(bus, need_segment);
172 if (unlikely(err)) 175 if (unlikely(err))
173 return err; 176 return err;
174 } 177 }
175 if (need_seg == 1)
176 *offset -= 0x800;
177 178
178 return 0; 179 return 0;
179} 180}
@@ -181,32 +182,31 @@ static inline int do_select_core(struct ssb_bus *bus,
181static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset) 182static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset)
182{ 183{
183 struct ssb_bus *bus = dev->bus; 184 struct ssb_bus *bus = dev->bus;
184 u16 x;
185 185
186 if (unlikely(do_select_core(bus, dev, &offset))) 186 if (unlikely(select_core_and_segment(dev, &offset)))
187 return 0xFFFF; 187 return 0xFFFF;
188 x = readw(bus->mmio + offset);
189 188
190 return x; 189 return readw(bus->mmio + offset);
191} 190}
192 191
193static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset) 192static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset)
194{ 193{
195 struct ssb_bus *bus = dev->bus; 194 struct ssb_bus *bus = dev->bus;
196 u32 x; 195 u32 lo, hi;
197 196
198 if (unlikely(do_select_core(bus, dev, &offset))) 197 if (unlikely(select_core_and_segment(dev, &offset)))
199 return 0xFFFFFFFF; 198 return 0xFFFFFFFF;
200 x = readl(bus->mmio + offset); 199 lo = readw(bus->mmio + offset);
200 hi = readw(bus->mmio + offset + 2);
201 201
202 return x; 202 return (lo | (hi << 16));
203} 203}
204 204
205static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value) 205static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value)
206{ 206{
207 struct ssb_bus *bus = dev->bus; 207 struct ssb_bus *bus = dev->bus;
208 208
209 if (unlikely(do_select_core(bus, dev, &offset))) 209 if (unlikely(select_core_and_segment(dev, &offset)))
210 return; 210 return;
211 writew(value, bus->mmio + offset); 211 writew(value, bus->mmio + offset);
212} 212}
@@ -215,12 +215,12 @@ static void ssb_pcmcia_write32(struct ssb_device *dev, u16 offset, u32 value)
215{ 215{
216 struct ssb_bus *bus = dev->bus; 216 struct ssb_bus *bus = dev->bus;
217 217
218 if (unlikely(do_select_core(bus, dev, &offset))) 218 if (unlikely(select_core_and_segment(dev, &offset)))
219 return; 219 return;
220 readw(bus->mmio + offset); 220 writeb((value & 0xFF000000) >> 24, bus->mmio + offset + 3);
221 writew(value >> 16, bus->mmio + offset + 2); 221 writeb((value & 0x00FF0000) >> 16, bus->mmio + offset + 2);
222 readw(bus->mmio + offset); 222 writeb((value & 0x0000FF00) >> 8, bus->mmio + offset + 1);
223 writew(value, bus->mmio + offset); 223 writeb((value & 0x000000FF) >> 0, bus->mmio + offset + 0);
224} 224}
225 225
226/* Not "static", as it's used in main.c */ 226/* Not "static", as it's used in main.c */
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
index 4d8c2a5b3297..bcea8d9b718c 100644
--- a/drivers/telephony/phonedev.c
+++ b/drivers/telephony/phonedev.c
@@ -120,9 +120,8 @@ int phone_register_device(struct phone_device *p, int unit)
120void phone_unregister_device(struct phone_device *pfd) 120void phone_unregister_device(struct phone_device *pfd)
121{ 121{
122 mutex_lock(&phone_lock); 122 mutex_lock(&phone_lock);
123 if (phone_device[pfd->minor] != pfd) 123 if (likely(phone_device[pfd->minor] == pfd))
124 panic("phone: bad unregister"); 124 phone_device[pfd->minor] = NULL;
125 phone_device[pfd->minor] = NULL;
126 mutex_unlock(&phone_lock); 125 mutex_unlock(&phone_lock);
127} 126}
128 127
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index ead2475406b8..28d4972f7ad5 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -11,7 +11,6 @@
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/scatterlist.h>
15#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
16#include <linux/dmapool.h> 15#include <linux/dmapool.h>
17#include <linux/usb.h> 16#include <linux/usb.h>
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 3dd997df8505..fea8256a18d6 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -30,7 +30,6 @@
30#include <linux/utsname.h> 30#include <linux/utsname.h>
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/scatterlist.h>
34#include <linux/device.h> 33#include <linux/device.h>
35#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
36#include <linux/mutex.h> 35#include <linux/mutex.h>
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index eb4ac47612a5..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]);
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 69aa68287d3f..c4a6f1095b8b 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -36,7 +36,7 @@
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37 37
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/scatterlist.h> 39#include <linux/scatterlist.h>
40#include <linux/mm.h> 40#include <linux/mm.h>
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42 42
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 6bfdba6a213f..1f7ab15df36d 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1215,20 +1215,18 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port)
1215 1215
1216static int keyspan_open (struct usb_serial_port *port, struct file *filp) 1216static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1217{ 1217{
1218 struct keyspan_port_private *p_priv; 1218 struct keyspan_port_private *p_priv;
1219 struct keyspan_serial_private *s_priv; 1219 struct keyspan_serial_private *s_priv;
1220 struct usb_serial *serial = port->serial; 1220 struct usb_serial *serial = port->serial;
1221 const struct keyspan_device_details *d_details; 1221 const struct keyspan_device_details *d_details;
1222 int i, err; 1222 int i, err;
1223 int baud_rate, device_port;
1224 struct urb *urb; 1223 struct urb *urb;
1225 unsigned int cflag;
1226 1224
1227 s_priv = usb_get_serial_data(serial); 1225 s_priv = usb_get_serial_data(serial);
1228 p_priv = usb_get_serial_port_data(port); 1226 p_priv = usb_get_serial_port_data(port);
1229 d_details = p_priv->device_details; 1227 d_details = p_priv->device_details;
1230 1228
1231 dbg("%s - port%d.", __FUNCTION__, port->number); 1229 dbg("%s - port%d.", __FUNCTION__, port->number);
1232 1230
1233 /* Set some sane defaults */ 1231 /* Set some sane defaults */
1234 p_priv->rts_state = 1; 1232 p_priv->rts_state = 1;
@@ -1249,7 +1247,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1249 urb->dev = serial->dev; 1247 urb->dev = serial->dev;
1250 1248
1251 /* make sure endpoint data toggle is synchronized with the device */ 1249 /* make sure endpoint data toggle is synchronized with the device */
1252 1250
1253 usb_clear_halt(urb->dev, urb->pipe); 1251 usb_clear_halt(urb->dev, urb->pipe);
1254 1252
1255 if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { 1253 if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
@@ -1265,30 +1263,6 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1265 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ 1263 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */
1266 } 1264 }
1267 1265
1268 /* get the terminal config for the setup message now so we don't
1269 * need to send 2 of them */
1270
1271 cflag = port->tty->termios->c_cflag;
1272 device_port = port->number - port->serial->minor;
1273
1274 /* Baud rate calculation takes baud rate as an integer
1275 so other rates can be generated if desired. */
1276 baud_rate = tty_get_baud_rate(port->tty);
1277 /* If no match or invalid, leave as default */
1278 if (baud_rate >= 0
1279 && d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
1280 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
1281 p_priv->baud = baud_rate;
1282 }
1283
1284 /* set CTS/RTS handshake etc. */
1285 p_priv->cflag = cflag;
1286 p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none;
1287
1288 keyspan_send_setup(port, 1);
1289 //mdelay(100);
1290 //keyspan_set_termios(port, NULL);
1291
1292 return (0); 1266 return (0);
1293} 1267}
1294 1268
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index fb9d8d0b2c04..7d86e9eae915 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -503,7 +503,7 @@ config FB_VALKYRIE
503 503
504config FB_CT65550 504config FB_CT65550
505 bool "Chips 65550 display support" 505 bool "Chips 65550 display support"
506 depends on (FB = y) && PPC32 506 depends on (FB = y) && PPC32 && PCI
507 select FB_CFB_FILLRECT 507 select FB_CFB_FILLRECT
508 select FB_CFB_COPYAREA 508 select FB_CFB_COPYAREA
509 select FB_CFB_IMAGEBLIT 509 select FB_CFB_IMAGEBLIT
@@ -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_base.c b/drivers/video/aty/radeon_base.c
index 1e32b3d13f2e..62867cb63fef 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -202,6 +202,7 @@ static struct pci_device_id radeonfb_pci_table[] = {
202 CHIP_DEF(PCI_CHIP_RV380_3154, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), 202 CHIP_DEF(PCI_CHIP_RV380_3154, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
203 CHIP_DEF(PCI_CHIP_RV370_5B60, RV380, CHIP_HAS_CRTC2), 203 CHIP_DEF(PCI_CHIP_RV370_5B60, RV380, CHIP_HAS_CRTC2),
204 CHIP_DEF(PCI_CHIP_RV370_5B62, RV380, CHIP_HAS_CRTC2), 204 CHIP_DEF(PCI_CHIP_RV370_5B62, RV380, CHIP_HAS_CRTC2),
205 CHIP_DEF(PCI_CHIP_RV370_5B63, RV380, CHIP_HAS_CRTC2),
205 CHIP_DEF(PCI_CHIP_RV370_5B64, RV380, CHIP_HAS_CRTC2), 206 CHIP_DEF(PCI_CHIP_RV370_5B64, RV380, CHIP_HAS_CRTC2),
206 CHIP_DEF(PCI_CHIP_RV370_5B65, RV380, CHIP_HAS_CRTC2), 207 CHIP_DEF(PCI_CHIP_RV370_5B65, RV380, CHIP_HAS_CRTC2),
207 CHIP_DEF(PCI_CHIP_RV370_5460, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), 208 CHIP_DEF(PCI_CHIP_RV370_5460, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
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/console/Kconfig b/drivers/video/console/Kconfig
index 267422f66255..b87ed37ac0c1 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -6,7 +6,7 @@ menu "Console display driver support"
6 6
7config VGA_CONSOLE 7config VGA_CONSOLE
8 bool "VGA text console" if EMBEDDED || !X86 8 bool "VGA text console" if EMBEDDED || !X86
9 depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BFIN 9 depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BLACKFIN
10 default y 10 default y
11 help 11 help
12 Saying Y here will allow you to use Linux in text mode through a 12 Saying Y here will allow you to use Linux in text mode through a
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index 5fb8675e0d6b..d0e4cb618269 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -874,6 +874,8 @@ static int cyber2000fb_set_par(struct fb_info *info)
874 default: 874 default:
875 BUG(); 875 BUG();
876 } 876 }
877 break;
878
877 case 24:/* TRUECOLOUR, 16m */ 879 case 24:/* TRUECOLOUR, 16m */
878 hw.co_pixfmt = CO_PIXFMT_24BPP; 880 hw.co_pixfmt = CO_PIXFMT_24BPP;
879 hw.width *= 3; 881 hw.width *= 3;
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index b9b572b293d4..2e552d5bbb5d 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -183,8 +183,8 @@ static struct fb_videomode default_mode_LCD __initdata = {
183 .vmode = FB_VMODE_NONINTERLACED, 183 .vmode = FB_VMODE_NONINTERLACED,
184}; 184};
185 185
186struct fb_videomode *default_mode = &default_mode_CRT; 186struct fb_videomode *default_mode __initdata = &default_mode_CRT;
187struct fb_var_screeninfo *default_var = &default_var_CRT; 187struct fb_var_screeninfo *default_var __initdata = &default_var_CRT;
188 188
189static int flat_panel_enabled = 0; 189static int flat_panel_enabled = 0;
190 190
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h
index 6c227f9592a5..ca13c48d19b0 100644
--- a/drivers/video/geode/lxfb.h
+++ b/drivers/video/geode/lxfb.h
@@ -33,7 +33,7 @@ void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int,
33 33
34#define MSR_LX_GLD_CONFIG 0x48002001 34#define MSR_LX_GLD_CONFIG 0x48002001
35#define MSR_LX_GLCP_DOTPLL 0x4c000015 35#define MSR_LX_GLCP_DOTPLL 0x4c000015
36#define MSR_LX_DF_PADSEL 0x48000011 36#define MSR_LX_DF_PADSEL 0x48002011
37#define MSR_LX_DC_SPARE 0x80000011 37#define MSR_LX_DC_SPARE 0x80000011
38#define MSR_LX_DF_GLCONFIG 0x48002001 38#define MSR_LX_DF_GLCONFIG 0x48002001
39 39
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/video/ps3fb.c b/drivers/video/ps3fb.c
index b3463ddcfd60..75836aa83191 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -727,7 +727,7 @@ static int ps3fb_blank(int blank, struct fb_info *info)
727 727
728static int ps3fb_get_vblank(struct fb_vblank *vblank) 728static int ps3fb_get_vblank(struct fb_vblank *vblank)
729{ 729{
730 memset(vblank, 0, sizeof(&vblank)); 730 memset(vblank, 0, sizeof(*vblank));
731 vblank->flags = FB_VBLANK_HAVE_VSYNC; 731 vblank->flags = FB_VBLANK_HAVE_VSYNC;
732 return 0; 732 return 0;
733} 733}
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c
index a5333c190789..b829dc7c5edf 100644
--- a/drivers/video/s1d13xxxfb.c
+++ b/drivers/video/s1d13xxxfb.c
@@ -540,7 +540,7 @@ s1d13xxxfb_probe(struct platform_device *pdev)
540 int ret = 0; 540 int ret = 0;
541 u8 revision; 541 u8 revision;
542 542
543 dbg("probe called: device is %p\n", dev); 543 dbg("probe called: device is %p\n", pdev);
544 544
545 printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); 545 printk(KERN_INFO "Epson S1D13XXX FB Driver\n");
546 546
@@ -753,8 +753,11 @@ static struct platform_driver s1d13xxxfb_driver = {
753static int __init 753static int __init
754s1d13xxxfb_init(void) 754s1d13xxxfb_init(void)
755{ 755{
756
757#ifndef MODULE
756 if (fb_get_options("s1d13xxxfb", NULL)) 758 if (fb_get_options("s1d13xxxfb", NULL))
757 return -ENODEV; 759 return -ENODEV;
760#endif
758 761
759 return platform_driver_register(&s1d13xxxfb_driver); 762 return platform_driver_register(&s1d13xxxfb_driver);
760} 763}
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index bc7d23683735..37bd24b8d83b 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -1248,7 +1248,6 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, struct fb_info *in
1248 if(found_mode) { 1248 if(found_mode) {
1249 ivideo->sisfb_mode_idx = sisfb_validate_mode(ivideo, 1249 ivideo->sisfb_mode_idx = sisfb_validate_mode(ivideo,
1250 ivideo->sisfb_mode_idx, ivideo->currentvbflags); 1250 ivideo->sisfb_mode_idx, ivideo->currentvbflags);
1251 ivideo->mode_no = sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni];
1252 } else { 1251 } else {
1253 ivideo->sisfb_mode_idx = -1; 1252 ivideo->sisfb_mode_idx = -1;
1254 } 1253 }
@@ -1260,6 +1259,8 @@ sisfb_do_set_var(struct fb_var_screeninfo *var, int isactive, struct fb_info *in
1260 return -EINVAL; 1259 return -EINVAL;
1261 } 1260 }
1262 1261
1262 ivideo->mode_no = sisbios_mode[ivideo->sisfb_mode_idx].mode_no[ivideo->mni];
1263
1263 if(sisfb_search_refresh_rate(ivideo, ivideo->refresh_rate, ivideo->sisfb_mode_idx) == 0) { 1264 if(sisfb_search_refresh_rate(ivideo, ivideo->refresh_rate, ivideo->sisfb_mode_idx) == 0) {
1264 ivideo->rate_idx = sisbios_mode[ivideo->sisfb_mode_idx].rate_idx; 1265 ivideo->rate_idx = sisbios_mode[ivideo->sisfb_mode_idx].rate_idx;
1265 ivideo->refresh_rate = 60; 1266 ivideo->refresh_rate = 60;
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index b983d262ab78..d1d6c0facd54 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -926,8 +926,10 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry *entries, int count,
926 int start, struct fb_info *info) 926 int start, struct fb_info *info)
927{ 927{
928 struct uvesafb_ktask *task; 928 struct uvesafb_ktask *task;
929#ifdef CONFIG_X86
929 struct uvesafb_par *par = info->par; 930 struct uvesafb_par *par = info->par;
930 int i = par->mode_idx; 931 int i = par->mode_idx;
932#endif
931 int err = 0; 933 int err = 0;
932 934
933 /* 935 /*
@@ -1103,11 +1105,11 @@ static int uvesafb_pan_display(struct fb_var_screeninfo *var,
1103 1105
1104static int uvesafb_blank(int blank, struct fb_info *info) 1106static int uvesafb_blank(int blank, struct fb_info *info)
1105{ 1107{
1106 struct uvesafb_par *par = info->par;
1107 struct uvesafb_ktask *task; 1108 struct uvesafb_ktask *task;
1108 int err = 1; 1109 int err = 1;
1109
1110#ifdef CONFIG_X86 1110#ifdef CONFIG_X86
1111 struct uvesafb_par *par = info->par;
1112
1111 if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) { 1113 if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) {
1112 int loop = 10000; 1114 int loop = 10000;
1113 u8 seq = 0, crtc17 = 0; 1115 u8 seq = 0, crtc17 = 0;
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 15d7787dea87..69d7ea02cd48 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -96,10 +96,23 @@ static int virtio_dev_probe(struct device *_d)
96 return err; 96 return err;
97} 97}
98 98
99static int virtio_dev_remove(struct device *_d)
100{
101 struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
102 struct virtio_driver *drv = container_of(dev->dev.driver,
103 struct virtio_driver, driver);
104
105 dev->config->set_status(dev, dev->config->get_status(dev)
106 & ~VIRTIO_CONFIG_S_DRIVER);
107 drv->remove(dev);
108 return 0;
109}
110
99int register_virtio_driver(struct virtio_driver *driver) 111int register_virtio_driver(struct virtio_driver *driver)
100{ 112{
101 driver->driver.bus = &virtio_bus; 113 driver->driver.bus = &virtio_bus;
102 driver->driver.probe = virtio_dev_probe; 114 driver->driver.probe = virtio_dev_probe;
115 driver->driver.remove = virtio_dev_remove;
103 return driver_register(&driver->driver); 116 return driver_register(&driver->driver);
104} 117}
105EXPORT_SYMBOL_GPL(register_virtio_driver); 118EXPORT_SYMBOL_GPL(register_virtio_driver);
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 0e4baca21b8f..1dc04b6684e6 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -53,7 +53,7 @@ struct vring_virtqueue
53 unsigned int num_added; 53 unsigned int num_added;
54 54
55 /* Last used index we've seen. */ 55 /* Last used index we've seen. */
56 unsigned int last_used_idx; 56 u16 last_used_idx;
57 57
58 /* How to notify other side. FIXME: commonalize hcalls! */ 58 /* How to notify other side. FIXME: commonalize hcalls! */
59 void (*notify)(struct virtqueue *vq); 59 void (*notify)(struct virtqueue *vq);
@@ -277,11 +277,17 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
277 struct vring_virtqueue *vq; 277 struct vring_virtqueue *vq;
278 unsigned int i; 278 unsigned int i;
279 279
280 /* We assume num is a power of 2. */
281 if (num & (num - 1)) {
282 dev_warn(&vdev->dev, "Bad virtqueue length %u\n", num);
283 return NULL;
284 }
285
280 vq = kmalloc(sizeof(*vq) + sizeof(void *)*num, GFP_KERNEL); 286 vq = kmalloc(sizeof(*vq) + sizeof(void *)*num, GFP_KERNEL);
281 if (!vq) 287 if (!vq)
282 return NULL; 288 return NULL;
283 289
284 vring_init(&vq->vring, num, pages); 290 vring_init(&vq->vring, num, pages, PAGE_SIZE);
285 vq->vq.callback = callback; 291 vq->vq.callback = callback;
286 vq->vq.vdev = vdev; 292 vq->vq.vdev = vdev;
287 vq->vq.vq_ops = &vring_vq_ops; 293 vq->vq.vq_ops = &vring_vq_ops;
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/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 299e274d241a..b63b5e044a4c 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -233,7 +233,7 @@ static int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st,
233{ 233{
234 int count, err; 234 int count, err;
235 235
236 memset(st, 0, sizeof(st)); 236 memset(st, 0, sizeof(*st));
237 237
238 count = 0; 238 count = 0;
239 err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_STATUS]), buf, size, &count, 100); 239 err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_STATUS]), buf, size, &count, 100);
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/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c
index 067c07be928c..e6c4390d8bd6 100644
--- a/drivers/zorro/zorro-driver.c
+++ b/drivers/zorro/zorro-driver.c
@@ -60,6 +60,20 @@ static int zorro_device_probe(struct device *dev)
60} 60}
61 61
62 62
63static int zorro_device_remove(struct device *dev)
64{
65 struct zorro_dev *z = to_zorro_dev(dev);
66 struct zorro_driver *drv = to_zorro_driver(dev->driver);
67
68 if (drv) {
69 if (drv->remove)
70 drv->remove(z);
71 z->driver = NULL;
72 }
73 return 0;
74}
75
76
63 /** 77 /**
64 * zorro_register_driver - register a new Zorro driver 78 * zorro_register_driver - register a new Zorro driver
65 * @drv: the driver structure to register 79 * @drv: the driver structure to register
@@ -128,6 +142,7 @@ struct bus_type zorro_bus_type = {
128 .name = "zorro", 142 .name = "zorro",
129 .match = zorro_bus_match, 143 .match = zorro_bus_match,
130 .probe = zorro_device_probe, 144 .probe = zorro_device_probe,
145 .remove = zorro_device_remove,
131}; 146};
132 147
133 148
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 756f7e9beb2e..fbb12dadba83 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -82,7 +82,7 @@ static match_table_t tokens = {
82 82
83static void v9fs_parse_options(struct v9fs_session_info *v9ses) 83static void v9fs_parse_options(struct v9fs_session_info *v9ses)
84{ 84{
85 char *options = v9ses->options; 85 char *options;
86 substring_t args[MAX_OPT_ARGS]; 86 substring_t args[MAX_OPT_ARGS];
87 char *p; 87 char *p;
88 int option; 88 int option;
@@ -96,9 +96,10 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
96 v9ses->cache = 0; 96 v9ses->cache = 0;
97 v9ses->trans = v9fs_default_trans(); 97 v9ses->trans = v9fs_default_trans();
98 98
99 if (!options) 99 if (!v9ses->options)
100 return; 100 return;
101 101
102 options = kstrdup(v9ses->options, GFP_KERNEL);
102 while ((p = strsep(&options, ",")) != NULL) { 103 while ((p = strsep(&options, ",")) != NULL) {
103 int token; 104 int token;
104 if (!*p) 105 if (!*p)
@@ -169,6 +170,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
169 continue; 170 continue;
170 } 171 }
171 } 172 }
173 kfree(options);
172} 174}
173 175
174/** 176/**
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index bb0cef9a6b8a..678c02f1ae23 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -119,6 +119,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
119 119
120 P9_DPRINTK(P9_DEBUG_VFS, " \n"); 120 P9_DPRINTK(P9_DEBUG_VFS, " \n");
121 121
122 st = NULL;
122 v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); 123 v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
123 if (!v9ses) 124 if (!v9ses)
124 return -ENOMEM; 125 return -ENOMEM;
@@ -164,10 +165,12 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
164 root->d_inode->i_ino = v9fs_qid2ino(&st->qid); 165 root->d_inode->i_ino = v9fs_qid2ino(&st->qid);
165 v9fs_stat2inode(st, root->d_inode, sb); 166 v9fs_stat2inode(st, root->d_inode, sb);
166 v9fs_fid_add(root, fid); 167 v9fs_fid_add(root, fid);
168 kfree(st);
167 169
168 return simple_set_mnt(mnt, sb); 170 return simple_set_mnt(mnt, sb);
169 171
170error: 172error:
173 kfree(st);
171 if (fid) 174 if (fid)
172 p9_client_clunk(fid); 175 p9_client_clunk(fid);
173 176
diff --git a/fs/Kconfig b/fs/Kconfig
index cc28a69246a7..429a00228507 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
@@ -2007,7 +2007,7 @@ config CIFS_EXPERIMENTAL
2007config CIFS_UPCALL 2007config CIFS_UPCALL
2008 bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)" 2008 bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)"
2009 depends on CIFS_EXPERIMENTAL 2009 depends on CIFS_EXPERIMENTAL
2010 depends on CONNECTOR 2010 depends on KEYS
2011 help 2011 help
2012 Enables an upcall mechanism for CIFS which will be used to contact 2012 Enables an upcall mechanism for CIFS which will be used to contact
2013 userspace helper utilities to provide SPNEGO packaged Kerberos 2013 userspace helper utilities to provide SPNEGO packaged Kerberos
diff --git a/fs/afs/vlocation.c b/fs/afs/vlocation.c
index 7b4bbe48112d..849fc3160cb5 100644
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -382,7 +382,7 @@ struct afs_vlocation *afs_vlocation_lookup(struct afs_cell *cell,
382 cell->name, key_serial(key), 382 cell->name, key_serial(key),
383 (int) namesz, (int) namesz, name, namesz); 383 (int) namesz, (int) namesz, name, namesz);
384 384
385 if (namesz > sizeof(vl->vldb.name)) { 385 if (namesz >= sizeof(vl->vldb.name)) {
386 _leave(" = -ENAMETOOLONG"); 386 _leave(" = -ENAMETOOLONG");
387 return ERR_PTR(-ENAMETOOLONG); 387 return ERR_PTR(-ENAMETOOLONG);
388 } 388 }
diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index 130f6c66c5ba..ac7a8b1d6c3a 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -14,8 +14,6 @@ struct bfs_sb_info {
14 unsigned long si_blocks; 14 unsigned long si_blocks;
15 unsigned long si_freeb; 15 unsigned long si_freeb;
16 unsigned long si_freei; 16 unsigned long si_freei;
17 unsigned long si_lf_ioff;
18 unsigned long si_lf_sblk;
19 unsigned long si_lf_eblk; 17 unsigned long si_lf_eblk;
20 unsigned long si_lasti; 18 unsigned long si_lasti;
21 unsigned long * si_imap; 19 unsigned long * si_imap;
@@ -39,7 +37,7 @@ static inline struct bfs_sb_info *BFS_SB(struct super_block *sb)
39 37
40static inline struct bfs_inode_info *BFS_I(struct inode *inode) 38static inline struct bfs_inode_info *BFS_I(struct inode *inode)
41{ 39{
42 return list_entry(inode, struct bfs_inode_info, vfs_inode); 40 return container_of(inode, struct bfs_inode_info, vfs_inode);
43} 41}
44 42
45 43
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 097f1497f743..1fd056d0fc3d 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -21,29 +21,32 @@
21#define dprintf(x...) 21#define dprintf(x...)
22#endif 22#endif
23 23
24static int bfs_add_entry(struct inode * dir, const unsigned char * name, int namelen, int ino); 24static int bfs_add_entry(struct inode *dir, const unsigned char *name,
25static struct buffer_head * bfs_find_entry(struct inode * dir, 25 int namelen, int ino);
26 const unsigned char * name, int namelen, struct bfs_dirent ** res_dir); 26static struct buffer_head *bfs_find_entry(struct inode *dir,
27 const unsigned char *name, int namelen,
28 struct bfs_dirent **res_dir);
27 29
28static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) 30static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir)
29{ 31{
30 struct inode * dir = f->f_path.dentry->d_inode; 32 struct inode *dir = f->f_path.dentry->d_inode;
31 struct buffer_head * bh; 33 struct buffer_head *bh;
32 struct bfs_dirent * de; 34 struct bfs_dirent *de;
33 unsigned int offset; 35 unsigned int offset;
34 int block; 36 int block;
35 37
36 lock_kernel(); 38 lock_kernel();
37 39
38 if (f->f_pos & (BFS_DIRENT_SIZE-1)) { 40 if (f->f_pos & (BFS_DIRENT_SIZE - 1)) {
39 printf("Bad f_pos=%08lx for %s:%08lx\n", (unsigned long)f->f_pos, 41 printf("Bad f_pos=%08lx for %s:%08lx\n",
40 dir->i_sb->s_id, dir->i_ino); 42 (unsigned long)f->f_pos,
43 dir->i_sb->s_id, dir->i_ino);
41 unlock_kernel(); 44 unlock_kernel();
42 return -EBADF; 45 return -EBADF;
43 } 46 }
44 47
45 while (f->f_pos < dir->i_size) { 48 while (f->f_pos < dir->i_size) {
46 offset = f->f_pos & (BFS_BSIZE-1); 49 offset = f->f_pos & (BFS_BSIZE - 1);
47 block = BFS_I(dir)->i_sblock + (f->f_pos >> BFS_BSIZE_BITS); 50 block = BFS_I(dir)->i_sblock + (f->f_pos >> BFS_BSIZE_BITS);
48 bh = sb_bread(dir->i_sb, block); 51 bh = sb_bread(dir->i_sb, block);
49 if (!bh) { 52 if (!bh) {
@@ -54,7 +57,9 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir)
54 de = (struct bfs_dirent *)(bh->b_data + offset); 57 de = (struct bfs_dirent *)(bh->b_data + offset);
55 if (de->ino) { 58 if (de->ino) {
56 int size = strnlen(de->name, BFS_NAMELEN); 59 int size = strnlen(de->name, BFS_NAMELEN);
57 if (filldir(dirent, de->name, size, f->f_pos, le16_to_cpu(de->ino), DT_UNKNOWN) < 0) { 60 if (filldir(dirent, de->name, size, f->f_pos,
61 le16_to_cpu(de->ino),
62 DT_UNKNOWN) < 0) {
58 brelse(bh); 63 brelse(bh);
59 unlock_kernel(); 64 unlock_kernel();
60 return 0; 65 return 0;
@@ -62,7 +67,7 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir)
62 } 67 }
63 offset += BFS_DIRENT_SIZE; 68 offset += BFS_DIRENT_SIZE;
64 f->f_pos += BFS_DIRENT_SIZE; 69 f->f_pos += BFS_DIRENT_SIZE;
65 } while (offset < BFS_BSIZE && f->f_pos < dir->i_size); 70 } while ((offset < BFS_BSIZE) && (f->f_pos < dir->i_size));
66 brelse(bh); 71 brelse(bh);
67 } 72 }
68 73
@@ -78,13 +83,13 @@ const struct file_operations bfs_dir_operations = {
78 83
79extern void dump_imap(const char *, struct super_block *); 84extern void dump_imap(const char *, struct super_block *);
80 85
81static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, 86static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
82 struct nameidata *nd) 87 struct nameidata *nd)
83{ 88{
84 int err; 89 int err;
85 struct inode * inode; 90 struct inode *inode;
86 struct super_block * s = dir->i_sb; 91 struct super_block *s = dir->i_sb;
87 struct bfs_sb_info * info = BFS_SB(s); 92 struct bfs_sb_info *info = BFS_SB(s);
88 unsigned long ino; 93 unsigned long ino;
89 94
90 inode = new_inode(s); 95 inode = new_inode(s);
@@ -97,7 +102,7 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode,
97 iput(inode); 102 iput(inode);
98 return -ENOSPC; 103 return -ENOSPC;
99 } 104 }
100 set_bit(ino, info->si_imap); 105 set_bit(ino, info->si_imap);
101 info->si_freei--; 106 info->si_freei--;
102 inode->i_uid = current->fsuid; 107 inode->i_uid = current->fsuid;
103 inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid; 108 inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
@@ -113,9 +118,10 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode,
113 BFS_I(inode)->i_eblock = 0; 118 BFS_I(inode)->i_eblock = 0;
114 insert_inode_hash(inode); 119 insert_inode_hash(inode);
115 mark_inode_dirty(inode); 120 mark_inode_dirty(inode);
116 dump_imap("create",s); 121 dump_imap("create", s);
117 122
118 err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len, inode->i_ino); 123 err = bfs_add_entry(dir, dentry->d_name.name, dentry->d_name.len,
124 inode->i_ino);
119 if (err) { 125 if (err) {
120 inode_dec_link_count(inode); 126 inode_dec_link_count(inode);
121 iput(inode); 127 iput(inode);
@@ -127,11 +133,12 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode,
127 return 0; 133 return 0;
128} 134}
129 135
130static struct dentry * bfs_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd) 136static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry,
137 struct nameidata *nd)
131{ 138{
132 struct inode * inode = NULL; 139 struct inode *inode = NULL;
133 struct buffer_head * bh; 140 struct buffer_head *bh;
134 struct bfs_dirent * de; 141 struct bfs_dirent *de;
135 142
136 if (dentry->d_name.len > BFS_NAMELEN) 143 if (dentry->d_name.len > BFS_NAMELEN)
137 return ERR_PTR(-ENAMETOOLONG); 144 return ERR_PTR(-ENAMETOOLONG);
@@ -152,13 +159,15 @@ static struct dentry * bfs_lookup(struct inode * dir, struct dentry * dentry, st
152 return NULL; 159 return NULL;
153} 160}
154 161
155static int bfs_link(struct dentry * old, struct inode * dir, struct dentry * new) 162static int bfs_link(struct dentry *old, struct inode *dir,
163 struct dentry *new)
156{ 164{
157 struct inode * inode = old->d_inode; 165 struct inode *inode = old->d_inode;
158 int err; 166 int err;
159 167
160 lock_kernel(); 168 lock_kernel();
161 err = bfs_add_entry(dir, new->d_name.name, new->d_name.len, inode->i_ino); 169 err = bfs_add_entry(dir, new->d_name.name, new->d_name.len,
170 inode->i_ino);
162 if (err) { 171 if (err) {
163 unlock_kernel(); 172 unlock_kernel();
164 return err; 173 return err;
@@ -172,23 +181,23 @@ static int bfs_link(struct dentry * old, struct inode * dir, struct dentry * new
172 return 0; 181 return 0;
173} 182}
174 183
175 184static int bfs_unlink(struct inode *dir, struct dentry *dentry)
176static int bfs_unlink(struct inode * dir, struct dentry * dentry)
177{ 185{
178 int error = -ENOENT; 186 int error = -ENOENT;
179 struct inode * inode; 187 struct inode *inode;
180 struct buffer_head * bh; 188 struct buffer_head *bh;
181 struct bfs_dirent * de; 189 struct bfs_dirent *de;
182 190
183 inode = dentry->d_inode; 191 inode = dentry->d_inode;
184 lock_kernel(); 192 lock_kernel();
185 bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); 193 bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de);
186 if (!bh || le16_to_cpu(de->ino) != inode->i_ino) 194 if (!bh || (le16_to_cpu(de->ino) != inode->i_ino))
187 goto out_brelse; 195 goto out_brelse;
188 196
189 if (!inode->i_nlink) { 197 if (!inode->i_nlink) {
190 printf("unlinking non-existent file %s:%lu (nlink=%d)\n", inode->i_sb->s_id, 198 printf("unlinking non-existent file %s:%lu (nlink=%d)\n",
191 inode->i_ino, inode->i_nlink); 199 inode->i_sb->s_id, inode->i_ino,
200 inode->i_nlink);
192 inode->i_nlink = 1; 201 inode->i_nlink = 1;
193 } 202 }
194 de->ino = 0; 203 de->ino = 0;
@@ -205,12 +214,12 @@ out_brelse:
205 return error; 214 return error;
206} 215}
207 216
208static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry, 217static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
209 struct inode * new_dir, struct dentry * new_dentry) 218 struct inode *new_dir, struct dentry *new_dentry)
210{ 219{
211 struct inode * old_inode, * new_inode; 220 struct inode *old_inode, *new_inode;
212 struct buffer_head * old_bh, * new_bh; 221 struct buffer_head *old_bh, *new_bh;
213 struct bfs_dirent * old_de, * new_de; 222 struct bfs_dirent *old_de, *new_de;
214 int error = -ENOENT; 223 int error = -ENOENT;
215 224
216 old_bh = new_bh = NULL; 225 old_bh = new_bh = NULL;
@@ -223,7 +232,7 @@ static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry,
223 old_dentry->d_name.name, 232 old_dentry->d_name.name,
224 old_dentry->d_name.len, &old_de); 233 old_dentry->d_name.len, &old_de);
225 234
226 if (!old_bh || le16_to_cpu(old_de->ino) != old_inode->i_ino) 235 if (!old_bh || (le16_to_cpu(old_de->ino) != old_inode->i_ino))
227 goto end_rename; 236 goto end_rename;
228 237
229 error = -EPERM; 238 error = -EPERM;
@@ -239,7 +248,8 @@ static int bfs_rename(struct inode * old_dir, struct dentry * old_dentry,
239 if (!new_bh) { 248 if (!new_bh) {
240 error = bfs_add_entry(new_dir, 249 error = bfs_add_entry(new_dir,
241 new_dentry->d_name.name, 250 new_dentry->d_name.name,
242 new_dentry->d_name.len, old_inode->i_ino); 251 new_dentry->d_name.len,
252 old_inode->i_ino);
243 if (error) 253 if (error)
244 goto end_rename; 254 goto end_rename;
245 } 255 }
@@ -268,11 +278,12 @@ const struct inode_operations bfs_dir_inops = {
268 .rename = bfs_rename, 278 .rename = bfs_rename,
269}; 279};
270 280
271static int bfs_add_entry(struct inode * dir, const unsigned char * name, int namelen, int ino) 281static int bfs_add_entry(struct inode *dir, const unsigned char *name,
282 int namelen, int ino)
272{ 283{
273 struct buffer_head * bh; 284 struct buffer_head *bh;
274 struct bfs_dirent * de; 285 struct bfs_dirent *de;
275 int block, sblock, eblock, off, eoff; 286 int block, sblock, eblock, off, pos;
276 int i; 287 int i;
277 288
278 dprintf("name=%s, namelen=%d\n", name, namelen); 289 dprintf("name=%s, namelen=%d\n", name, namelen);
@@ -284,27 +295,24 @@ static int bfs_add_entry(struct inode * dir, const unsigned char * name, int nam
284 295
285 sblock = BFS_I(dir)->i_sblock; 296 sblock = BFS_I(dir)->i_sblock;
286 eblock = BFS_I(dir)->i_eblock; 297 eblock = BFS_I(dir)->i_eblock;
287 eoff = dir->i_size % BFS_BSIZE; 298 for (block = sblock; block <= eblock; block++) {
288 for (block=sblock; block<=eblock; block++) {
289 bh = sb_bread(dir->i_sb, block); 299 bh = sb_bread(dir->i_sb, block);
290 if(!bh) 300 if (!bh)
291 return -ENOSPC; 301 return -ENOSPC;
292 for (off=0; off<BFS_BSIZE; off+=BFS_DIRENT_SIZE) { 302 for (off = 0; off < BFS_BSIZE; off += BFS_DIRENT_SIZE) {
293 de = (struct bfs_dirent *)(bh->b_data + off); 303 de = (struct bfs_dirent *)(bh->b_data + off);
294 if (block==eblock && off>=eoff) {
295 /* Do not read/interpret the garbage in the end of eblock. */
296 de->ino = 0;
297 }
298 if (!de->ino) { 304 if (!de->ino) {
299 if ((block-sblock)*BFS_BSIZE + off >= dir->i_size) { 305 pos = (block - sblock) * BFS_BSIZE + off;
306 if (pos >= dir->i_size) {
300 dir->i_size += BFS_DIRENT_SIZE; 307 dir->i_size += BFS_DIRENT_SIZE;
301 dir->i_ctime = CURRENT_TIME_SEC; 308 dir->i_ctime = CURRENT_TIME_SEC;
302 } 309 }
303 dir->i_mtime = CURRENT_TIME_SEC; 310 dir->i_mtime = CURRENT_TIME_SEC;
304 mark_inode_dirty(dir); 311 mark_inode_dirty(dir);
305 de->ino = cpu_to_le16((u16)ino); 312 de->ino = cpu_to_le16((u16)ino);
306 for (i=0; i<BFS_NAMELEN; i++) 313 for (i = 0; i < BFS_NAMELEN; i++)
307 de->name[i] = (i < namelen) ? name[i] : 0; 314 de->name[i] =
315 (i < namelen) ? name[i] : 0;
308 mark_buffer_dirty(bh); 316 mark_buffer_dirty(bh);
309 brelse(bh); 317 brelse(bh);
310 return 0; 318 return 0;
@@ -315,25 +323,26 @@ static int bfs_add_entry(struct inode * dir, const unsigned char * name, int nam
315 return -ENOSPC; 323 return -ENOSPC;
316} 324}
317 325
318static inline int bfs_namecmp(int len, const unsigned char * name, const char * buffer) 326static inline int bfs_namecmp(int len, const unsigned char *name,
327 const char *buffer)
319{ 328{
320 if (len < BFS_NAMELEN && buffer[len]) 329 if ((len < BFS_NAMELEN) && buffer[len])
321 return 0; 330 return 0;
322 return !memcmp(name, buffer, len); 331 return !memcmp(name, buffer, len);
323} 332}
324 333
325static struct buffer_head * bfs_find_entry(struct inode * dir, 334static struct buffer_head *bfs_find_entry(struct inode *dir,
326 const unsigned char * name, int namelen, struct bfs_dirent ** res_dir) 335 const unsigned char *name, int namelen,
336 struct bfs_dirent **res_dir)
327{ 337{
328 unsigned long block, offset; 338 unsigned long block = 0, offset = 0;
329 struct buffer_head * bh; 339 struct buffer_head *bh = NULL;
330 struct bfs_dirent * de; 340 struct bfs_dirent *de;
331 341
332 *res_dir = NULL; 342 *res_dir = NULL;
333 if (namelen > BFS_NAMELEN) 343 if (namelen > BFS_NAMELEN)
334 return NULL; 344 return NULL;
335 bh = NULL; 345
336 block = offset = 0;
337 while (block * BFS_BSIZE + offset < dir->i_size) { 346 while (block * BFS_BSIZE + offset < dir->i_size) {
338 if (!bh) { 347 if (!bh) {
339 bh = sb_bread(dir->i_sb, BFS_I(dir)->i_sblock + block); 348 bh = sb_bread(dir->i_sb, BFS_I(dir)->i_sblock + block);
@@ -344,7 +353,8 @@ static struct buffer_head * bfs_find_entry(struct inode * dir,
344 } 353 }
345 de = (struct bfs_dirent *)(bh->b_data + offset); 354 de = (struct bfs_dirent *)(bh->b_data + offset);
346 offset += BFS_DIRENT_SIZE; 355 offset += BFS_DIRENT_SIZE;
347 if (le16_to_cpu(de->ino) && bfs_namecmp(namelen, name, de->name)) { 356 if (le16_to_cpu(de->ino) &&
357 bfs_namecmp(namelen, name, de->name)) {
348 *res_dir = de; 358 *res_dir = de;
349 return bh; 359 return bh;
350 } 360 }
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index 911b4ccf470f..b11e63e8fbcd 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -2,6 +2,11 @@
2 * fs/bfs/file.c 2 * fs/bfs/file.c
3 * BFS file operations. 3 * BFS file operations.
4 * Copyright (C) 1999,2000 Tigran Aivazian <tigran@veritas.com> 4 * Copyright (C) 1999,2000 Tigran Aivazian <tigran@veritas.com>
5 *
6 * Make the file block allocation algorithm understand the size
7 * of the underlying block device.
8 * Copyright (C) 2007 Dmitri Vorobiev <dmitri.vorobiev@gmail.com>
9 *
5 */ 10 */
6 11
7#include <linux/fs.h> 12#include <linux/fs.h>
@@ -27,7 +32,8 @@ const struct file_operations bfs_file_operations = {
27 .splice_read = generic_file_splice_read, 32 .splice_read = generic_file_splice_read,
28}; 33};
29 34
30static int bfs_move_block(unsigned long from, unsigned long to, struct super_block *sb) 35static int bfs_move_block(unsigned long from, unsigned long to,
36 struct super_block *sb)
31{ 37{
32 struct buffer_head *bh, *new; 38 struct buffer_head *bh, *new;
33 39
@@ -43,21 +49,22 @@ static int bfs_move_block(unsigned long from, unsigned long to, struct super_blo
43} 49}
44 50
45static int bfs_move_blocks(struct super_block *sb, unsigned long start, 51static int bfs_move_blocks(struct super_block *sb, unsigned long start,
46 unsigned long end, unsigned long where) 52 unsigned long end, unsigned long where)
47{ 53{
48 unsigned long i; 54 unsigned long i;
49 55
50 dprintf("%08lx-%08lx->%08lx\n", start, end, where); 56 dprintf("%08lx-%08lx->%08lx\n", start, end, where);
51 for (i = start; i <= end; i++) 57 for (i = start; i <= end; i++)
52 if(bfs_move_block(i, where + i, sb)) { 58 if(bfs_move_block(i, where + i, sb)) {
53 dprintf("failed to move block %08lx -> %08lx\n", i, where + i); 59 dprintf("failed to move block %08lx -> %08lx\n", i,
60 where + i);
54 return -EIO; 61 return -EIO;
55 } 62 }
56 return 0; 63 return 0;
57} 64}
58 65
59static int bfs_get_block(struct inode * inode, sector_t block, 66static int bfs_get_block(struct inode *inode, sector_t block,
60 struct buffer_head * bh_result, int create) 67 struct buffer_head *bh_result, int create)
61{ 68{
62 unsigned long phys; 69 unsigned long phys;
63 int err; 70 int err;
@@ -66,9 +73,6 @@ static int bfs_get_block(struct inode * inode, sector_t block,
66 struct bfs_inode_info *bi = BFS_I(inode); 73 struct bfs_inode_info *bi = BFS_I(inode);
67 struct buffer_head *sbh = info->si_sbh; 74 struct buffer_head *sbh = info->si_sbh;
68 75
69 if (block > info->si_blocks)
70 return -EIO;
71
72 phys = bi->i_sblock + block; 76 phys = bi->i_sblock + block;
73 if (!create) { 77 if (!create) {
74 if (phys <= bi->i_eblock) { 78 if (phys <= bi->i_eblock) {
@@ -79,21 +83,29 @@ static int bfs_get_block(struct inode * inode, sector_t block,
79 return 0; 83 return 0;
80 } 84 }
81 85
82 /* if the file is not empty and the requested block is within the range 86 /*
83 of blocks allocated for this file, we can grant it */ 87 * If the file is not empty and the requested block is within the
84 if (inode->i_size && phys <= bi->i_eblock) { 88 * range of blocks allocated for this file, we can grant it.
89 */
90 if (bi->i_sblock && (phys <= bi->i_eblock)) {
85 dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n", 91 dprintf("c=%d, b=%08lx, phys=%08lx (interim block granted)\n",
86 create, (unsigned long)block, phys); 92 create, (unsigned long)block, phys);
87 map_bh(bh_result, sb, phys); 93 map_bh(bh_result, sb, phys);
88 return 0; 94 return 0;
89 } 95 }
90 96
91 /* the rest has to be protected against itself */ 97 /* The file will be extended, so let's see if there is enough space. */
98 if (phys >= info->si_blocks)
99 return -ENOSPC;
100
101 /* The rest has to be protected against itself. */
92 lock_kernel(); 102 lock_kernel();
93 103
94 /* if the last data block for this file is the last allocated 104 /*
95 block, we can extend the file trivially, without moving it 105 * If the last data block for this file is the last allocated
96 anywhere */ 106 * block, we can extend the file trivially, without moving it
107 * anywhere.
108 */
97 if (bi->i_eblock == info->si_lf_eblk) { 109 if (bi->i_eblock == info->si_lf_eblk) {
98 dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n", 110 dprintf("c=%d, b=%08lx, phys=%08lx (simple extension)\n",
99 create, (unsigned long)block, phys); 111 create, (unsigned long)block, phys);
@@ -106,13 +118,19 @@ static int bfs_get_block(struct inode * inode, sector_t block,
106 goto out; 118 goto out;
107 } 119 }
108 120
109 /* Ok, we have to move this entire file to the next free block */ 121 /* Ok, we have to move this entire file to the next free block. */
110 phys = info->si_lf_eblk + 1; 122 phys = info->si_lf_eblk + 1;
111 if (bi->i_sblock) { /* if data starts on block 0 then there is no data */ 123 if (phys + block >= info->si_blocks) {
124 err = -ENOSPC;
125 goto out;
126 }
127
128 if (bi->i_sblock) {
112 err = bfs_move_blocks(inode->i_sb, bi->i_sblock, 129 err = bfs_move_blocks(inode->i_sb, bi->i_sblock,
113 bi->i_eblock, phys); 130 bi->i_eblock, phys);
114 if (err) { 131 if (err) {
115 dprintf("failed to move ino=%08lx -> fs corruption\n", inode->i_ino); 132 dprintf("failed to move ino=%08lx -> fs corruption\n",
133 inode->i_ino);
116 goto out; 134 goto out;
117 } 135 }
118 } else 136 } else
@@ -124,8 +142,10 @@ static int bfs_get_block(struct inode * inode, sector_t block,
124 phys += block; 142 phys += block;
125 info->si_lf_eblk = bi->i_eblock = phys; 143 info->si_lf_eblk = bi->i_eblock = phys;
126 144
127 /* this assumes nothing can write the inode back while we are here 145 /*
128 * and thus update inode->i_blocks! (XXX)*/ 146 * This assumes nothing can write the inode back while we are here
147 * and thus update inode->i_blocks! (XXX)
148 */
129 info->si_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks; 149 info->si_freeb -= bi->i_eblock - bi->i_sblock + 1 - inode->i_blocks;
130 mark_inode_dirty(inode); 150 mark_inode_dirty(inode);
131 mark_buffer_dirty(sbh); 151 mark_buffer_dirty(sbh);
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 7bd9c2bbe6ee..294c41baef6e 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -30,25 +30,26 @@ MODULE_LICENSE("GPL");
30#define dprintf(x...) 30#define dprintf(x...)
31#endif 31#endif
32 32
33void dump_imap(const char *prefix, struct super_block * s); 33void dump_imap(const char *prefix, struct super_block *s);
34 34
35static void bfs_read_inode(struct inode * inode) 35static void bfs_read_inode(struct inode *inode)
36{ 36{
37 unsigned long ino = inode->i_ino; 37 unsigned long ino = inode->i_ino;
38 struct bfs_inode * di; 38 struct bfs_inode *di;
39 struct buffer_head * bh; 39 struct buffer_head *bh;
40 int block, off; 40 int block, off;
41 41
42 if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) { 42 if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) {
43 printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino); 43 printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino);
44 make_bad_inode(inode); 44 make_bad_inode(inode);
45 return; 45 return;
46 } 46 }
47 47
48 block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; 48 block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
49 bh = sb_bread(inode->i_sb, block); 49 bh = sb_bread(inode->i_sb, block);
50 if (!bh) { 50 if (!bh) {
51 printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino); 51 printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id,
52 ino);
52 make_bad_inode(inode); 53 make_bad_inode(inode);
53 return; 54 return;
54 } 55 }
@@ -56,7 +57,7 @@ static void bfs_read_inode(struct inode * inode)
56 off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; 57 off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
57 di = (struct bfs_inode *)bh->b_data + off; 58 di = (struct bfs_inode *)bh->b_data + off;
58 59
59 inode->i_mode = 0x0000FFFF & le32_to_cpu(di->i_mode); 60 inode->i_mode = 0x0000FFFF & le32_to_cpu(di->i_mode);
60 if (le32_to_cpu(di->i_vtype) == BFS_VDIR) { 61 if (le32_to_cpu(di->i_vtype) == BFS_VDIR) {
61 inode->i_mode |= S_IFDIR; 62 inode->i_mode |= S_IFDIR;
62 inode->i_op = &bfs_dir_inops; 63 inode->i_op = &bfs_dir_inops;
@@ -70,48 +71,48 @@ static void bfs_read_inode(struct inode * inode)
70 71
71 BFS_I(inode)->i_sblock = le32_to_cpu(di->i_sblock); 72 BFS_I(inode)->i_sblock = le32_to_cpu(di->i_sblock);
72 BFS_I(inode)->i_eblock = le32_to_cpu(di->i_eblock); 73 BFS_I(inode)->i_eblock = le32_to_cpu(di->i_eblock);
74 BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino);
73 inode->i_uid = le32_to_cpu(di->i_uid); 75 inode->i_uid = le32_to_cpu(di->i_uid);
74 inode->i_gid = le32_to_cpu(di->i_gid); 76 inode->i_gid = le32_to_cpu(di->i_gid);
75 inode->i_nlink = le32_to_cpu(di->i_nlink); 77 inode->i_nlink = le32_to_cpu(di->i_nlink);
76 inode->i_size = BFS_FILESIZE(di); 78 inode->i_size = BFS_FILESIZE(di);
77 inode->i_blocks = BFS_FILEBLOCKS(di); 79 inode->i_blocks = BFS_FILEBLOCKS(di);
78 if (inode->i_size || inode->i_blocks) dprintf("Registered inode with %lld size, %ld blocks\n", inode->i_size, inode->i_blocks);
79 inode->i_atime.tv_sec = le32_to_cpu(di->i_atime); 80 inode->i_atime.tv_sec = le32_to_cpu(di->i_atime);
80 inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime); 81 inode->i_mtime.tv_sec = le32_to_cpu(di->i_mtime);
81 inode->i_ctime.tv_sec = le32_to_cpu(di->i_ctime); 82 inode->i_ctime.tv_sec = le32_to_cpu(di->i_ctime);
82 inode->i_atime.tv_nsec = 0; 83 inode->i_atime.tv_nsec = 0;
83 inode->i_mtime.tv_nsec = 0; 84 inode->i_mtime.tv_nsec = 0;
84 inode->i_ctime.tv_nsec = 0; 85 inode->i_ctime.tv_nsec = 0;
85 BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino); /* can be 0 so we store a copy */
86 86
87 brelse(bh); 87 brelse(bh);
88} 88}
89 89
90static int bfs_write_inode(struct inode * inode, int unused) 90static int bfs_write_inode(struct inode *inode, int unused)
91{ 91{
92 unsigned int ino = (u16)inode->i_ino; 92 unsigned int ino = (u16)inode->i_ino;
93 unsigned long i_sblock; 93 unsigned long i_sblock;
94 struct bfs_inode * di; 94 struct bfs_inode *di;
95 struct buffer_head * bh; 95 struct buffer_head *bh;
96 int block, off; 96 int block, off;
97 97
98 dprintf("ino=%08x\n", ino); 98 dprintf("ino=%08x\n", ino);
99 99
100 if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) { 100 if ((ino < BFS_ROOT_INO) || (ino > BFS_SB(inode->i_sb)->si_lasti)) {
101 printf("Bad inode number %s:%08x\n", inode->i_sb->s_id, ino); 101 printf("Bad inode number %s:%08x\n", inode->i_sb->s_id, ino);
102 return -EIO; 102 return -EIO;
103 } 103 }
104 104
105 lock_kernel(); 105 lock_kernel();
106 block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; 106 block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
107 bh = sb_bread(inode->i_sb, block); 107 bh = sb_bread(inode->i_sb, block);
108 if (!bh) { 108 if (!bh) {
109 printf("Unable to read inode %s:%08x\n", inode->i_sb->s_id, ino); 109 printf("Unable to read inode %s:%08x\n",
110 inode->i_sb->s_id, ino);
110 unlock_kernel(); 111 unlock_kernel();
111 return -EIO; 112 return -EIO;
112 } 113 }
113 114
114 off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; 115 off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
115 di = (struct bfs_inode *)bh->b_data + off; 116 di = (struct bfs_inode *)bh->b_data + off;
116 117
117 if (ino == BFS_ROOT_INO) 118 if (ino == BFS_ROOT_INO)
@@ -133,27 +134,26 @@ static int bfs_write_inode(struct inode * inode, int unused)
133 di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1); 134 di->i_eoffset = cpu_to_le32(i_sblock * BFS_BSIZE + inode->i_size - 1);
134 135
135 mark_buffer_dirty(bh); 136 mark_buffer_dirty(bh);
136 dprintf("Written ino=%d into %d:%d\n",le16_to_cpu(di->i_ino),block,off);
137 brelse(bh); 137 brelse(bh);
138 unlock_kernel(); 138 unlock_kernel();
139 return 0; 139 return 0;
140} 140}
141 141
142static void bfs_delete_inode(struct inode * inode) 142static void bfs_delete_inode(struct inode *inode)
143{ 143{
144 unsigned long ino = inode->i_ino; 144 unsigned long ino = inode->i_ino;
145 struct bfs_inode * di; 145 struct bfs_inode *di;
146 struct buffer_head * bh; 146 struct buffer_head *bh;
147 int block, off; 147 int block, off;
148 struct super_block * s = inode->i_sb; 148 struct super_block *s = inode->i_sb;
149 struct bfs_sb_info * info = BFS_SB(s); 149 struct bfs_sb_info *info = BFS_SB(s);
150 struct bfs_inode_info * bi = BFS_I(inode); 150 struct bfs_inode_info *bi = BFS_I(inode);
151 151
152 dprintf("ino=%08lx\n", ino); 152 dprintf("ino=%08lx\n", ino);
153 153
154 truncate_inode_pages(&inode->i_data, 0); 154 truncate_inode_pages(&inode->i_data, 0);
155 155
156 if (ino < BFS_ROOT_INO || ino > info->si_lasti) { 156 if ((ino < BFS_ROOT_INO) || (ino > info->si_lasti)) {
157 printf("invalid ino=%08lx\n", ino); 157 printf("invalid ino=%08lx\n", ino);
158 return; 158 return;
159 } 159 }
@@ -162,31 +162,35 @@ static void bfs_delete_inode(struct inode * inode)
162 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 162 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
163 lock_kernel(); 163 lock_kernel();
164 mark_inode_dirty(inode); 164 mark_inode_dirty(inode);
165 block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; 165
166 block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
166 bh = sb_bread(s, block); 167 bh = sb_bread(s, block);
167 if (!bh) { 168 if (!bh) {
168 printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino); 169 printf("Unable to read inode %s:%08lx\n",
170 inode->i_sb->s_id, ino);
169 unlock_kernel(); 171 unlock_kernel();
170 return; 172 return;
171 } 173 }
172 off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK; 174 off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
173 di = (struct bfs_inode *) bh->b_data + off; 175 di = (struct bfs_inode *)bh->b_data + off;
176 memset((void *)di, 0, sizeof(struct bfs_inode));
177 mark_buffer_dirty(bh);
178 brelse(bh);
179
174 if (bi->i_dsk_ino) { 180 if (bi->i_dsk_ino) {
175 info->si_freeb += 1 + bi->i_eblock - bi->i_sblock; 181 info->si_freeb += BFS_FILEBLOCKS(bi);
176 info->si_freei++; 182 info->si_freei++;
177 clear_bit(ino, info->si_imap); 183 clear_bit(ino, info->si_imap);
178 dump_imap("delete_inode", s); 184 dump_imap("delete_inode", s);
179 } 185 }
180 di->i_ino = 0;
181 di->i_sblock = 0;
182 mark_buffer_dirty(bh);
183 brelse(bh);
184 186
185 /* if this was the last file, make the previous 187 /*
186 block "last files last block" even if there is no real file there, 188 * If this was the last file, make the previous block
187 saves us 1 gap */ 189 * "last block of the last file" even if there is no
188 if (info->si_lf_eblk == BFS_I(inode)->i_eblock) { 190 * real file there, saves us 1 gap.
189 info->si_lf_eblk = BFS_I(inode)->i_sblock - 1; 191 */
192 if (info->si_lf_eblk == bi->i_eblock) {
193 info->si_lf_eblk = bi->i_sblock - 1;
190 mark_buffer_dirty(info->si_sbh); 194 mark_buffer_dirty(info->si_sbh);
191 } 195 }
192 unlock_kernel(); 196 unlock_kernel();
@@ -228,7 +232,7 @@ static void bfs_write_super(struct super_block *s)
228 unlock_kernel(); 232 unlock_kernel();
229} 233}
230 234
231static struct kmem_cache * bfs_inode_cachep; 235static struct kmem_cache *bfs_inode_cachep;
232 236
233static struct inode *bfs_alloc_inode(struct super_block *sb) 237static struct inode *bfs_alloc_inode(struct super_block *sb)
234{ 238{
@@ -279,7 +283,7 @@ static const struct super_operations bfs_sops = {
279 .statfs = bfs_statfs, 283 .statfs = bfs_statfs,
280}; 284};
281 285
282void dump_imap(const char *prefix, struct super_block * s) 286void dump_imap(const char *prefix, struct super_block *s)
283{ 287{
284#ifdef DEBUG 288#ifdef DEBUG
285 int i; 289 int i;
@@ -287,25 +291,26 @@ void dump_imap(const char *prefix, struct super_block * s)
287 291
288 if (!tmpbuf) 292 if (!tmpbuf)
289 return; 293 return;
290 for (i=BFS_SB(s)->si_lasti; i>=0; i--) { 294 for (i = BFS_SB(s)->si_lasti; i >= 0; i--) {
291 if (i > PAGE_SIZE-100) break; 295 if (i > PAGE_SIZE - 100) break;
292 if (test_bit(i, BFS_SB(s)->si_imap)) 296 if (test_bit(i, BFS_SB(s)->si_imap))
293 strcat(tmpbuf, "1"); 297 strcat(tmpbuf, "1");
294 else 298 else
295 strcat(tmpbuf, "0"); 299 strcat(tmpbuf, "0");
296 } 300 }
297 printk(KERN_ERR "BFS-fs: %s: lasti=%08lx <%s>\n", prefix, BFS_SB(s)->si_lasti, tmpbuf); 301 printf("BFS-fs: %s: lasti=%08lx <%s>\n",
302 prefix, BFS_SB(s)->si_lasti, tmpbuf);
298 free_page((unsigned long)tmpbuf); 303 free_page((unsigned long)tmpbuf);
299#endif 304#endif
300} 305}
301 306
302static int bfs_fill_super(struct super_block *s, void *data, int silent) 307static int bfs_fill_super(struct super_block *s, void *data, int silent)
303{ 308{
304 struct buffer_head * bh; 309 struct buffer_head *bh;
305 struct bfs_super_block * bfs_sb; 310 struct bfs_super_block *bfs_sb;
306 struct inode * inode; 311 struct inode *inode;
307 unsigned i, imap_len; 312 unsigned i, imap_len;
308 struct bfs_sb_info * info; 313 struct bfs_sb_info *info;
309 314
310 info = kzalloc(sizeof(*info), GFP_KERNEL); 315 info = kzalloc(sizeof(*info), GFP_KERNEL);
311 if (!info) 316 if (!info)
@@ -329,14 +334,14 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
329 334
330 s->s_magic = BFS_MAGIC; 335 s->s_magic = BFS_MAGIC;
331 info->si_sbh = bh; 336 info->si_sbh = bh;
332 info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE)/sizeof(struct bfs_inode) 337 info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) /
333 + BFS_ROOT_INO - 1; 338 sizeof(struct bfs_inode)
334 339 + BFS_ROOT_INO - 1;
335 imap_len = info->si_lasti/8 + 1; 340 imap_len = (info->si_lasti / 8) + 1;
336 info->si_imap = kzalloc(imap_len, GFP_KERNEL); 341 info->si_imap = kzalloc(imap_len, GFP_KERNEL);
337 if (!info->si_imap) 342 if (!info->si_imap)
338 goto out; 343 goto out;
339 for (i=0; i<BFS_ROOT_INO; i++) 344 for (i = 0; i < BFS_ROOT_INO; i++)
340 set_bit(i, info->si_imap); 345 set_bit(i, info->si_imap);
341 346
342 s->s_op = &bfs_sops; 347 s->s_op = &bfs_sops;
@@ -352,16 +357,15 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
352 goto out; 357 goto out;
353 } 358 }
354 359
355 info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1)>>BFS_BSIZE_BITS; /* for statfs(2) */ 360 info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1) >> BFS_BSIZE_BITS;
356 info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - le32_to_cpu(bfs_sb->s_start))>>BFS_BSIZE_BITS; 361 info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1
362 - le32_to_cpu(bfs_sb->s_start)) >> BFS_BSIZE_BITS;
357 info->si_freei = 0; 363 info->si_freei = 0;
358 info->si_lf_eblk = 0; 364 info->si_lf_eblk = 0;
359 info->si_lf_sblk = 0;
360 info->si_lf_ioff = 0;
361 bh = NULL; 365 bh = NULL;
362 for (i=BFS_ROOT_INO; i<=info->si_lasti; i++) { 366 for (i = BFS_ROOT_INO; i <= info->si_lasti; i++) {
363 struct bfs_inode *di; 367 struct bfs_inode *di;
364 int block = (i - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; 368 int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
365 int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; 369 int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
366 unsigned long sblock, eblock; 370 unsigned long sblock, eblock;
367 371
@@ -384,11 +388,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
384 388
385 sblock = le32_to_cpu(di->i_sblock); 389 sblock = le32_to_cpu(di->i_sblock);
386 eblock = le32_to_cpu(di->i_eblock); 390 eblock = le32_to_cpu(di->i_eblock);
387 if (eblock > info->si_lf_eblk) { 391 if (eblock > info->si_lf_eblk)
388 info->si_lf_eblk = eblock; 392 info->si_lf_eblk = eblock;
389 info->si_lf_sblk = sblock;
390 info->si_lf_ioff = BFS_INO2OFF(i);
391 }
392 } 393 }
393 brelse(bh); 394 brelse(bh);
394 if (!(s->s_flags & MS_RDONLY)) { 395 if (!(s->s_flags & MS_RDONLY)) {
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 3d419163c3d3..a609599287aa 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,3 +1,10 @@
1Version 1.52
2------------
3Fix oops on second mount to server when null auth is used.
4Enable experimental Kerberos support. Return writebehind errors on flush
5and sync so that events like out of disk space get reported properly on
6cached files.
7
1Version 1.51 8Version 1.51
2------------ 9------------
3Fix memory leak in statfs when mounted to very old servers (e.g. 10Fix memory leak in statfs when mounted to very old servers (e.g.
@@ -12,7 +19,12 @@ leak that causes cifsd not to stop and rmmod to fail to cleanup
12cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on 19cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on
13bigendian architectures. Fix possible memory corruption when 20bigendian architectures. Fix possible memory corruption when
14EAGAIN returned on kern_recvmsg. Return better error if server 21EAGAIN returned on kern_recvmsg. Return better error if server
15requires packet signing but client has disabled it. 22requires packet signing but client has disabled it. When mounted
23with cifsacl mount option - mode bits are approximated based
24on the contents of the ACL of the file or directory. When cifs
25mount helper is missing convert make sure that UNC name
26has backslash (not forward slash) between ip address of server
27and the share name.
16 28
17Version 1.50 29Version 1.50
18------------ 30------------
diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile
index ff6ba8d823f0..45e42fb97c19 100644
--- a/fs/cifs/Makefile
+++ b/fs/cifs/Makefile
@@ -3,4 +3,9 @@
3# 3#
4obj-$(CONFIG_CIFS) += cifs.o 4obj-$(CONFIG_CIFS) += cifs.o
5 5
6cifs-objs := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o md4.o md5.o cifs_unicode.o nterr.o xattr.o cifsencrypt.o fcntl.o readdir.o ioctl.o sess.o export.o cifsacl.o 6cifs-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o \
7 link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o \
8 md4.o md5.o cifs_unicode.o nterr.o xattr.o cifsencrypt.o fcntl.o \
9 readdir.o ioctl.o sess.o export.o cifsacl.o
10
11cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o
diff --git a/fs/cifs/README b/fs/cifs/README
index b806b11b5560..bf11329ac784 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -225,12 +225,9 @@ If no password is provided, mount.cifs will prompt for password entry
225 225
226Restrictions 226Restrictions
227============ 227============
228Servers must support the NTLM SMB dialect (which is the most recent, supported
229by Samba and Windows NT version 4, 2000 and XP and many other SMB/CIFS servers)
230Servers must support either "pure-TCP" (port 445 TCP/IP CIFS connections) or RFC 228Servers must support either "pure-TCP" (port 445 TCP/IP CIFS connections) or RFC
2311001/1002 support for "Netbios-Over-TCP/IP." Neither of these is likely to be a 2291001/1002 support for "Netbios-Over-TCP/IP." This is not likely to be a
232problem as most servers support this. IPv6 support is planned for the future, 230problem as most servers support this.
233and is almost complete.
234 231
235Valid filenames differ between Windows and Linux. Windows typically restricts 232Valid filenames differ between Windows and Linux. Windows typically restricts
236filenames which contain certain reserved characters (e.g.the character : 233filenames which contain certain reserved characters (e.g.the character :
@@ -458,6 +455,8 @@ A partial list of the supported mount options follows:
458 byte range locks). 455 byte range locks).
459 remount remount the share (often used to change from ro to rw mounts 456 remount remount the share (often used to change from ro to rw mounts
460 or vice versa) 457 or vice versa)
458 cifsacl Report mode bits (e.g. on stat) based on the Windows ACL for
459 the file. (EXPERIMENTAL)
461 servern Specify the server 's netbios name (RFC1001 name) to use 460 servern Specify the server 's netbios name (RFC1001 name) to use
462 when attempting to setup a session to the server. This is 461 when attempting to setup a session to the server. This is
463 This is needed for mounting to some older servers (such 462 This is needed for mounting to some older servers (such
@@ -584,8 +583,8 @@ Experimental When set to 1 used to enable certain experimental
584 performance enhancement was disabled when 583 performance enhancement was disabled when
585 signing turned on in case buffer was modified 584 signing turned on in case buffer was modified
586 just before it was sent, also this flag will 585 just before it was sent, also this flag will
587 be used to use the new experimental sessionsetup 586 be used to use the new experimental directory change
588 code). 587 notification code).
589 588
590These experimental features and tracing can be enabled by changing flags in 589These experimental features and tracing can be enabled by changing flags in
591/proc/fs/cifs (after the cifs module has been installed or built into the 590/proc/fs/cifs (after the cifs module has been installed or built into the
@@ -608,7 +607,8 @@ the start of smb requests and responses can be enabled via:
608Two other experimental features are under development. To test these 607Two other experimental features are under development. To test these
609requires enabling CONFIG_CIFS_EXPERIMENTAL 608requires enabling CONFIG_CIFS_EXPERIMENTAL
610 609
611 ipv6 enablement 610 cifsacl support needed to retrieve approximated mode bits based on
611 the contents on the CIFS ACL.
612 612
613 DNOTIFY fcntl: needed for support of directory change 613 DNOTIFY fcntl: needed for support of directory change
614 notification and perhaps later for file leases) 614 notification and perhaps later for file leases)
@@ -625,10 +625,7 @@ that they represent all for that share, not just those for which the server
625returned success. 625returned success.
626 626
627Also note that "cat /proc/fs/cifs/DebugData" will display information about 627Also note that "cat /proc/fs/cifs/DebugData" will display information about
628the active sessions and the shares that are mounted. Note: NTLMv2 enablement 628the active sessions and the shares that are mounted.
629will not work since its implementation is not quite complete yet. Do not alter 629Enabling Kerberos (extended security) works when CONFIG_CIFS_EXPERIMENTAL is enabled
630the ExtendedSecurity configuration value unless you are doing specific testing. 630but requires a user space helper (from the Samba project). NTLM and NTLMv2 and
631Enabling extended security works to Windows 2000 Workstations and XP but not to 631LANMAN support do not require this helpr.
632Windows 2000 server or Samba since it does not usually send "raw NTLMSSP"
633(instead it sends NTLMSSP encapsulated in SPNEGO/GSSAPI, which support is not
634complete in the CIFS VFS yet).
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index 29d4b2715254..a8852c200728 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -16,7 +16,7 @@ SecurityDescriptors
16c) Better pam/winbind integration (e.g. to handle uid mapping 16c) Better pam/winbind integration (e.g. to handle uid mapping
17better) 17better)
18 18
19d) Kerberos/SPNEGO session setup support - (started) 19d) Verify that Kerberos signing works
20 20
21e) Cleanup now unneeded SessSetup code in 21e) Cleanup now unneeded SessSetup code in
22fs/cifs/connect.c and add back in NTLMSSP code if any servers 22fs/cifs/connect.c and add back in NTLMSSP code if any servers
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index 2a01f3ef96a0..bcda2c6b6a04 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -77,8 +77,12 @@
77 77
78#define SPNEGO_OID_LEN 7 78#define SPNEGO_OID_LEN 7
79#define NTLMSSP_OID_LEN 10 79#define NTLMSSP_OID_LEN 10
80#define KRB5_OID_LEN 7
81#define MSKRB5_OID_LEN 7
80static unsigned long SPNEGO_OID[7] = { 1, 3, 6, 1, 5, 5, 2 }; 82static unsigned long SPNEGO_OID[7] = { 1, 3, 6, 1, 5, 5, 2 };
81static unsigned long NTLMSSP_OID[10] = { 1, 3, 6, 1, 4, 1, 311, 2, 2, 10 }; 83static unsigned long NTLMSSP_OID[10] = { 1, 3, 6, 1, 4, 1, 311, 2, 2, 10 };
84static unsigned long KRB5_OID[7] = { 1, 2, 840, 113554, 1, 2, 2 };
85static unsigned long MSKRB5_OID[7] = { 1, 2, 840, 48018, 1, 2, 2 };
82 86
83/* 87/*
84 * ASN.1 context. 88 * ASN.1 context.
@@ -457,6 +461,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
457 unsigned long *oid = NULL; 461 unsigned long *oid = NULL;
458 unsigned int cls, con, tag, oidlen, rc; 462 unsigned int cls, con, tag, oidlen, rc;
459 int use_ntlmssp = FALSE; 463 int use_ntlmssp = FALSE;
464 int use_kerberos = FALSE;
460 465
461 *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/ 466 *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/
462 467
@@ -545,18 +550,28 @@ decode_negTokenInit(unsigned char *security_blob, int length,
545 return 0; 550 return 0;
546 } 551 }
547 if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { 552 if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
548 rc = asn1_oid_decode(&ctx, end, &oid, &oidlen); 553 if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) {
549 if (rc) { 554
550 cFYI(1, 555 cFYI(1,
551 ("OID len = %d oid = 0x%lx 0x%lx " 556 ("OID len = %d oid = 0x%lx 0x%lx "
552 "0x%lx 0x%lx", 557 "0x%lx 0x%lx",
553 oidlen, *oid, *(oid + 1), 558 oidlen, *oid, *(oid + 1),
554 *(oid + 2), *(oid + 3))); 559 *(oid + 2), *(oid + 3)));
555 rc = compare_oid(oid, oidlen, 560
556 NTLMSSP_OID, NTLMSSP_OID_LEN); 561 if (compare_oid(oid, oidlen,
557 kfree(oid); 562 MSKRB5_OID,
558 if (rc) 563 MSKRB5_OID_LEN))
564 use_kerberos = TRUE;
565 else if (compare_oid(oid, oidlen,
566 KRB5_OID,
567 KRB5_OID_LEN))
568 use_kerberos = TRUE;
569 else if (compare_oid(oid, oidlen,
570 NTLMSSP_OID,
571 NTLMSSP_OID_LEN))
559 use_ntlmssp = TRUE; 572 use_ntlmssp = TRUE;
573
574 kfree(oid);
560 } 575 }
561 } else { 576 } else {
562 cFYI(1, ("Should be an oid what is going on?")); 577 cFYI(1, ("Should be an oid what is going on?"));
@@ -609,12 +624,10 @@ decode_negTokenInit(unsigned char *security_blob, int length,
609 ctx.pointer)); /* is this UTF-8 or ASCII? */ 624 ctx.pointer)); /* is this UTF-8 or ASCII? */
610 } 625 }
611 626
612 /* if (use_kerberos) 627 if (use_kerberos)
613 *secType = Kerberos 628 *secType = Kerberos;
614 else */ 629 else if (use_ntlmssp)
615 if (use_ntlmssp) {
616 *secType = NTLMSSP; 630 *secType = NTLMSSP;
617 }
618 631
619 return 1; 632 return 1;
620} 633}
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
new file mode 100644
index 000000000000..1529d2b12e9c
--- /dev/null
+++ b/fs/cifs/cifs_spnego.c
@@ -0,0 +1,134 @@
1/*
2 * fs/cifs/cifs_spnego.c -- SPNEGO upcall management for CIFS
3 *
4 * Copyright (c) 2007 Red Hat, Inc.
5 * Author(s): Jeff Layton (jlayton@redhat.com)
6 *
7 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 * the GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/list.h>
23#include <linux/string.h>
24#include <keys/user-type.h>
25#include <linux/key-type.h>
26#include "cifsglob.h"
27#include "cifs_spnego.h"
28#include "cifs_debug.h"
29
30/* create a new cifs key */
31static int
32cifs_spnego_key_instantiate(struct key *key, const void *data, size_t datalen)
33{
34 char *payload;
35 int ret;
36
37 ret = -ENOMEM;
38 payload = kmalloc(datalen, GFP_KERNEL);
39 if (!payload)
40 goto error;
41
42 /* attach the data */
43 memcpy(payload, data, datalen);
44 rcu_assign_pointer(key->payload.data, payload);
45 ret = 0;
46
47error:
48 return ret;
49}
50
51static void
52cifs_spnego_key_destroy(struct key *key)
53{
54 kfree(key->payload.data);
55}
56
57
58/*
59 * keytype for CIFS spnego keys
60 */
61struct key_type cifs_spnego_key_type = {
62 .name = "cifs.spnego",
63 .instantiate = cifs_spnego_key_instantiate,
64 .match = user_match,
65 .destroy = cifs_spnego_key_destroy,
66 .describe = user_describe,
67};
68
69#define MAX_VER_STR_LEN 9 /* length of longest version string e.g.
70 strlen(";ver=0xFF") */
71#define MAX_MECH_STR_LEN 13 /* length of longest security mechanism name, eg
72 in future could have strlen(";sec=ntlmsspi") */
73#define MAX_IPV6_ADDR_LEN 42 /* eg FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/60 */
74/* get a key struct with a SPNEGO security blob, suitable for session setup */
75struct key *
76cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
77{
78 struct TCP_Server_Info *server = sesInfo->server;
79 char *description, *dp;
80 size_t desc_len;
81 struct key *spnego_key;
82 const char *hostname = server->hostname;
83
84 /* BB: come up with better scheme for determining length */
85 /* length of fields (with semicolons): ver=0xyz ipv4= ipaddress host=
86 hostname sec=mechanism uid=0x uid */
87 desc_len = MAX_VER_STR_LEN + 5 + MAX_IPV6_ADDR_LEN + 1 + 6 +
88 strlen(hostname) + MAX_MECH_STR_LEN + 8 + (sizeof(uid_t) * 2);
89 spnego_key = ERR_PTR(-ENOMEM);
90 description = kzalloc(desc_len, GFP_KERNEL);
91 if (description == NULL)
92 goto out;
93
94 dp = description;
95 /* start with version and hostname portion of UNC string */
96 spnego_key = ERR_PTR(-EINVAL);
97 sprintf(dp, "ver=0x%x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
98 hostname);
99 dp = description + strlen(description);
100
101 /* add the server address */
102 if (server->addr.sockAddr.sin_family == AF_INET)
103 sprintf(dp, "ip4=" NIPQUAD_FMT,
104 NIPQUAD(server->addr.sockAddr.sin_addr));
105 else if (server->addr.sockAddr.sin_family == AF_INET6)
106 sprintf(dp, "ip6=" NIP6_SEQFMT,
107 NIP6(server->addr.sockAddr6.sin6_addr));
108 else
109 goto out;
110
111 dp = description + strlen(description);
112
113 /* for now, only sec=krb5 is valid */
114 if (server->secType == Kerberos)
115 sprintf(dp, ";sec=krb5");
116 else
117 goto out;
118
119 dp = description + strlen(description);
120 sprintf(dp, ";uid=0x%x", sesInfo->linux_uid);
121
122 cFYI(1, ("key description = %s", description));
123 spnego_key = request_key(&cifs_spnego_key_type, description, "");
124
125 if (cifsFYI && !IS_ERR(spnego_key)) {
126 struct cifs_spnego_msg *msg = spnego_key->payload.data;
127 cifs_dump_mem("SPNEGO reply blob:", msg->data,
128 msg->secblob_len + msg->sesskey_len);
129 }
130
131out:
132 kfree(description);
133 return spnego_key;
134}
diff --git a/fs/cifs/cifs_spnego.h b/fs/cifs/cifs_spnego.h
new file mode 100644
index 000000000000..05a34b17a1ab
--- /dev/null
+++ b/fs/cifs/cifs_spnego.h
@@ -0,0 +1,47 @@
1/*
2 * fs/cifs/cifs_spnego.h -- SPNEGO upcall management for CIFS
3 *
4 * Copyright (c) 2007 Red Hat, Inc.
5 * Author(s): Jeff Layton (jlayton@redhat.com)
6 * Steve French (sfrench@us.ibm.com)
7 *
8 * This library is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published
10 * by the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
16 * the GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef _CIFS_SPNEGO_H
24#define _CIFS_SPNEGO_H
25
26#define CIFS_SPNEGO_UPCALL_VERSION 1
27
28/*
29 * The version field should always be set to CIFS_SPNEGO_UPCALL_VERSION.
30 * The flags field is for future use. The request-key callout should set
31 * sesskey_len and secblob_len, and then concatenate the SessKey+SecBlob
32 * and stuff it in the data field.
33 */
34struct cifs_spnego_msg {
35 uint32_t version;
36 uint32_t flags;
37 uint32_t sesskey_len;
38 uint32_t secblob_len;
39 uint8_t data[1];
40};
41
42#ifdef __KERNEL__
43extern struct key_type cifs_spnego_key_type;
44extern struct key *cifs_get_spnego_key(struct cifsSesInfo *sesInfo);
45#endif /* KERNEL */
46
47#endif /* _CIFS_SPNEGO_H */
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index e8e56353f5a1..f02fdef463a7 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -38,13 +38,13 @@ static struct cifs_wksid wksidarr[NUM_WK_SIDS] = {
38 {{1, 1, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(18), 0, 0, 0, 0} }, "sys"}, 38 {{1, 1, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(18), 0, 0, 0, 0} }, "sys"},
39 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(544), 0, 0, 0} }, "root"}, 39 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(544), 0, 0, 0} }, "root"},
40 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(545), 0, 0, 0} }, "users"}, 40 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(545), 0, 0, 0} }, "users"},
41 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(546), 0, 0, 0} }, "guest"} 41 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(546), 0, 0, 0} }, "guest"} }
42}; 42;
43 43
44 44
45/* security id for everyone */ 45/* security id for everyone */
46static const struct cifs_sid sid_everyone = 46static const struct cifs_sid sid_everyone = {
47 {1, 1, {0, 0, 0, 0, 0, 0}, {} }; 47 1, 1, {0, 0, 0, 0, 0, 1}, {0} };
48/* group users */ 48/* group users */
49static const struct cifs_sid sid_user = 49static const struct cifs_sid sid_user =
50 {1, 2 , {0, 0, 0, 0, 0, 5}, {} }; 50 {1, 2 , {0, 0, 0, 0, 0, 5}, {} };
@@ -97,7 +97,7 @@ int match_sid(struct cifs_sid *ctsid)
97 97
98/* if the two SIDs (roughly equivalent to a UUID for a user or group) are 98/* if the two SIDs (roughly equivalent to a UUID for a user or group) are
99 the same returns 1, if they do not match returns 0 */ 99 the same returns 1, if they do not match returns 0 */
100int compare_sids(struct cifs_sid *ctsid, struct cifs_sid *cwsid) 100int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
101{ 101{
102 int i; 102 int i;
103 int num_subauth, num_sat, num_saw; 103 int num_subauth, num_sat, num_saw;
@@ -129,70 +129,153 @@ int compare_sids(struct cifs_sid *ctsid, struct cifs_sid *cwsid)
129 return (1); /* sids compare/match */ 129 return (1); /* sids compare/match */
130} 130}
131 131
132/*
133 change posix mode to reflect permissions
134 pmode is the existing mode (we only want to overwrite part of this
135 bits to set can be: S_IRWXU, S_IRWXG or S_IRWXO ie 00700 or 00070 or 00007
136*/
137static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode,
138 umode_t *pbits_to_set)
139{
140 /* the order of ACEs is important. The canonical order is to begin with
141 DENY entries followed by ALLOW, otherwise an allow entry could be
142 encountered first, making the subsequent deny entry like "dead code"
143 which would be superflous since Windows stops when a match is made
144 for the operation you are trying to perform for your user */
145
146 /* For deny ACEs we change the mask so that subsequent allow access
147 control entries do not turn on the bits we are denying */
148 if (type == ACCESS_DENIED) {
149 if (ace_flags & GENERIC_ALL) {
150 *pbits_to_set &= ~S_IRWXUGO;
151 }
152 if ((ace_flags & GENERIC_WRITE) ||
153 ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS))
154 *pbits_to_set &= ~S_IWUGO;
155 if ((ace_flags & GENERIC_READ) ||
156 ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS))
157 *pbits_to_set &= ~S_IRUGO;
158 if ((ace_flags & GENERIC_EXECUTE) ||
159 ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
160 *pbits_to_set &= ~S_IXUGO;
161 return;
162 } else if (type != ACCESS_ALLOWED) {
163 cERROR(1, ("unknown access control type %d", type));
164 return;
165 }
166 /* else ACCESS_ALLOWED type */
167
168 if (ace_flags & GENERIC_ALL) {
169 *pmode |= (S_IRWXUGO & (*pbits_to_set));
170#ifdef CONFIG_CIFS_DEBUG2
171 cFYI(1, ("all perms"));
172#endif
173 return;
174 }
175 if ((ace_flags & GENERIC_WRITE) ||
176 ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS))
177 *pmode |= (S_IWUGO & (*pbits_to_set));
178 if ((ace_flags & GENERIC_READ) ||
179 ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS))
180 *pmode |= (S_IRUGO & (*pbits_to_set));
181 if ((ace_flags & GENERIC_EXECUTE) ||
182 ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
183 *pmode |= (S_IXUGO & (*pbits_to_set));
132 184
133static void parse_ace(struct cifs_ace *pace, char *end_of_acl) 185#ifdef CONFIG_CIFS_DEBUG2
186 cFYI(1, ("access flags 0x%x mode now 0x%x", ace_flags, *pmode));
187#endif
188 return;
189}
190
191/*
192 Generate access flags to reflect permissions mode is the existing mode.
193 This function is called for every ACE in the DACL whose SID matches
194 with either owner or group or everyone.
195*/
196
197static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
198 __u32 *pace_flags)
199{
200 /* reset access mask */
201 *pace_flags = 0x0;
202
203 /* bits to use are either S_IRWXU or S_IRWXG or S_IRWXO */
204 mode &= bits_to_use;
205
206 /* check for R/W/X UGO since we do not know whose flags
207 is this but we have cleared all the bits sans RWX for
208 either user or group or other as per bits_to_use */
209 if (mode & S_IRUGO)
210 *pace_flags |= SET_FILE_READ_RIGHTS;
211 if (mode & S_IWUGO)
212 *pace_flags |= SET_FILE_WRITE_RIGHTS;
213 if (mode & S_IXUGO)
214 *pace_flags |= SET_FILE_EXEC_RIGHTS;
215
216#ifdef CONFIG_CIFS_DEBUG2
217 cFYI(1, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags));
218#endif
219 return;
220}
221
222
223#ifdef CONFIG_CIFS_DEBUG2
224static void dump_ace(struct cifs_ace *pace, char *end_of_acl)
134{ 225{
135 int num_subauth; 226 int num_subauth;
136 227
137 /* validate that we do not go past end of acl */ 228 /* validate that we do not go past end of acl */
138 229
139 /* XXX this if statement can be removed 230 if (le16_to_cpu(pace->size) < 16) {
140 if (end_of_acl < (char *)pace + sizeof(struct cifs_ace)) { 231 cERROR(1, ("ACE too small, %d", le16_to_cpu(pace->size)));
232 return;
233 }
234
235 if (end_of_acl < (char *)pace + le16_to_cpu(pace->size)) {
141 cERROR(1, ("ACL too small to parse ACE")); 236 cERROR(1, ("ACL too small to parse ACE"));
142 return; 237 return;
143 } */ 238 }
144 239
145 num_subauth = pace->num_subauth; 240 num_subauth = pace->sid.num_subauth;
146 if (num_subauth) { 241 if (num_subauth) {
147#ifdef CONFIG_CIFS_DEBUG2
148 int i; 242 int i;
149 cFYI(1, ("ACE revision %d num_subauth %d", 243 cFYI(1, ("ACE revision %d num_auth %d type %d flags %d size %d",
150 pace->revision, pace->num_subauth)); 244 pace->sid.revision, pace->sid.num_subauth, pace->type,
245 pace->flags, pace->size));
151 for (i = 0; i < num_subauth; ++i) { 246 for (i = 0; i < num_subauth; ++i) {
152 cFYI(1, ("ACE sub_auth[%d]: 0x%x", i, 247 cFYI(1, ("ACE sub_auth[%d]: 0x%x", i,
153 le32_to_cpu(pace->sub_auth[i]))); 248 le32_to_cpu(pace->sid.sub_auth[i])));
154 } 249 }
155 250
156 /* BB add length check to make sure that we do not have huge 251 /* BB add length check to make sure that we do not have huge
157 num auths and therefore go off the end */ 252 num auths and therefore go off the end */
158
159 cFYI(1, ("RID %d", le32_to_cpu(pace->sub_auth[num_subauth-1])));
160#endif
161 } 253 }
162 254
163 return; 255 return;
164} 256}
165
166static void parse_ntace(struct cifs_ntace *pntace, char *end_of_acl)
167{
168 /* validate that we do not go past end of acl */
169 if (end_of_acl < (char *)pntace + sizeof(struct cifs_ntace)) {
170 cERROR(1, ("ACL too small to parse NT ACE"));
171 return;
172 }
173
174#ifdef CONFIG_CIFS_DEBUG2
175 cFYI(1, ("NTACE type %d flags 0x%x size %d, access Req 0x%x",
176 pntace->type, pntace->flags, pntace->size,
177 pntace->access_req));
178#endif 257#endif
179 return;
180}
181
182 258
183 259
184static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, 260static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
185 struct cifs_sid *pownersid, struct cifs_sid *pgrpsid) 261 struct cifs_sid *pownersid, struct cifs_sid *pgrpsid,
262 struct inode *inode)
186{ 263{
187 int i; 264 int i;
188 int num_aces = 0; 265 int num_aces = 0;
189 int acl_size; 266 int acl_size;
190 char *acl_base; 267 char *acl_base;
191 struct cifs_ntace **ppntace;
192 struct cifs_ace **ppace; 268 struct cifs_ace **ppace;
193 269
194 /* BB need to add parm so we can store the SID BB */ 270 /* BB need to add parm so we can store the SID BB */
195 271
272 if (!pdacl) {
273 /* no DACL in the security descriptor, set
274 all the permissions for user/group/other */
275 inode->i_mode |= S_IRWXUGO;
276 return;
277 }
278
196 /* validate that we do not go past end of acl */ 279 /* validate that we do not go past end of acl */
197 if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) { 280 if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) {
198 cERROR(1, ("ACL too small to parse DACL")); 281 cERROR(1, ("ACL too small to parse DACL"));
@@ -205,50 +288,57 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
205 le32_to_cpu(pdacl->num_aces))); 288 le32_to_cpu(pdacl->num_aces)));
206#endif 289#endif
207 290
291 /* reset rwx permissions for user/group/other.
292 Also, if num_aces is 0 i.e. DACL has no ACEs,
293 user/group/other have no permissions */
294 inode->i_mode &= ~(S_IRWXUGO);
295
208 acl_base = (char *)pdacl; 296 acl_base = (char *)pdacl;
209 acl_size = sizeof(struct cifs_acl); 297 acl_size = sizeof(struct cifs_acl);
210 298
211 num_aces = le32_to_cpu(pdacl->num_aces); 299 num_aces = le32_to_cpu(pdacl->num_aces);
212 if (num_aces > 0) { 300 if (num_aces > 0) {
213 ppntace = kmalloc(num_aces * sizeof(struct cifs_ntace *), 301 umode_t user_mask = S_IRWXU;
214 GFP_KERNEL); 302 umode_t group_mask = S_IRWXG;
303 umode_t other_mask = S_IRWXO;
304
215 ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), 305 ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
216 GFP_KERNEL); 306 GFP_KERNEL);
217 307
218/* cifscred->cecount = pdacl->num_aces; 308/* cifscred->cecount = pdacl->num_aces;
219 cifscred->ntaces = kmalloc(num_aces *
220 sizeof(struct cifs_ntace *), GFP_KERNEL);
221 cifscred->aces = kmalloc(num_aces * 309 cifscred->aces = kmalloc(num_aces *
222 sizeof(struct cifs_ace *), GFP_KERNEL);*/ 310 sizeof(struct cifs_ace *), GFP_KERNEL);*/
223 311
224 for (i = 0; i < num_aces; ++i) { 312 for (i = 0; i < num_aces; ++i) {
225 ppntace[i] = (struct cifs_ntace *) 313 ppace[i] = (struct cifs_ace *) (acl_base + acl_size);
226 (acl_base + acl_size); 314#ifdef CONFIG_CIFS_DEBUG2
227 ppace[i] = (struct cifs_ace *) ((char *)ppntace[i] + 315 dump_ace(ppace[i], end_of_acl);
228 sizeof(struct cifs_ntace)); 316#endif
229 317 if (compare_sids(&(ppace[i]->sid), pownersid))
230 parse_ntace(ppntace[i], end_of_acl); 318 access_flags_to_mode(ppace[i]->access_req,
231 if (end_of_acl < ((char *)ppace[i] + 319 ppace[i]->type,
232 (le16_to_cpu(ppntace[i]->size) - 320 &(inode->i_mode),
233 sizeof(struct cifs_ntace)))) { 321 &user_mask);
234 cERROR(1, ("ACL too small to parse ACE")); 322 if (compare_sids(&(ppace[i]->sid), pgrpsid))
235 break; 323 access_flags_to_mode(ppace[i]->access_req,
236 } else 324 ppace[i]->type,
237 parse_ace(ppace[i], end_of_acl); 325 &(inode->i_mode),
238 326 &group_mask);
239/* memcpy((void *)(&(cifscred->ntaces[i])), 327 if (compare_sids(&(ppace[i]->sid), &sid_everyone))
240 (void *)ppntace[i], 328 access_flags_to_mode(ppace[i]->access_req,
241 sizeof(struct cifs_ntace)); 329 ppace[i]->type,
242 memcpy((void *)(&(cifscred->aces[i])), 330 &(inode->i_mode),
331 &other_mask);
332
333/* memcpy((void *)(&(cifscred->aces[i])),
243 (void *)ppace[i], 334 (void *)ppace[i],
244 sizeof(struct cifs_ace)); */ 335 sizeof(struct cifs_ace)); */
245 336
246 acl_base = (char *)ppntace[i]; 337 acl_base = (char *)ppace[i];
247 acl_size = le16_to_cpu(ppntace[i]->size); 338 acl_size = le16_to_cpu(ppace[i]->size);
248 } 339 }
249 340
250 kfree(ppace); 341 kfree(ppace);
251 kfree(ppntace);
252 } 342 }
253 343
254 return; 344 return;
@@ -257,20 +347,20 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
257 347
258static int parse_sid(struct cifs_sid *psid, char *end_of_acl) 348static int parse_sid(struct cifs_sid *psid, char *end_of_acl)
259{ 349{
260
261 /* BB need to add parm so we can store the SID BB */ 350 /* BB need to add parm so we can store the SID BB */
262 351
263 /* validate that we do not go past end of acl */ 352 /* validate that we do not go past end of ACL - sid must be at least 8
264 if (end_of_acl < (char *)psid + sizeof(struct cifs_sid)) { 353 bytes long (assuming no sub-auths - e.g. the null SID */
265 cERROR(1, ("ACL too small to parse SID")); 354 if (end_of_acl < (char *)psid + 8) {
355 cERROR(1, ("ACL too small to parse SID %p", psid));
266 return -EINVAL; 356 return -EINVAL;
267 } 357 }
268 358
269 if (psid->num_subauth) { 359 if (psid->num_subauth) {
270#ifdef CONFIG_CIFS_DEBUG2 360#ifdef CONFIG_CIFS_DEBUG2
271 int i; 361 int i;
272 cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x", 362 cFYI(1, ("SID revision %d num_auth %d",
273 psid->revision, psid->num_subauth, psid->sub_auth[0])); 363 psid->revision, psid->num_subauth));
274 364
275 for (i = 0; i < psid->num_subauth; i++) { 365 for (i = 0; i < psid->num_subauth; i++) {
276 cFYI(1, ("SID sub_auth[%d]: 0x%x ", i, 366 cFYI(1, ("SID sub_auth[%d]: 0x%x ", i,
@@ -289,27 +379,32 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl)
289 379
290 380
291/* Convert CIFS ACL to POSIX form */ 381/* Convert CIFS ACL to POSIX form */
292int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len) 382static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len,
383 struct inode *inode)
293{ 384{
294 int rc; 385 int rc;
295 struct cifs_sid *owner_sid_ptr, *group_sid_ptr; 386 struct cifs_sid *owner_sid_ptr, *group_sid_ptr;
296 struct cifs_acl *dacl_ptr; /* no need for SACL ptr */ 387 struct cifs_acl *dacl_ptr; /* no need for SACL ptr */
297 char *end_of_acl = ((char *)pntsd) + acl_len; 388 char *end_of_acl = ((char *)pntsd) + acl_len;
389 __u32 dacloffset;
390
391 if ((inode == NULL) || (pntsd == NULL))
392 return -EIO;
298 393
299 owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + 394 owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
300 le32_to_cpu(pntsd->osidoffset)); 395 le32_to_cpu(pntsd->osidoffset));
301 group_sid_ptr = (struct cifs_sid *)((char *)pntsd + 396 group_sid_ptr = (struct cifs_sid *)((char *)pntsd +
302 le32_to_cpu(pntsd->gsidoffset)); 397 le32_to_cpu(pntsd->gsidoffset));
303 dacl_ptr = (struct cifs_acl *)((char *)pntsd + 398 dacloffset = le32_to_cpu(pntsd->dacloffset);
304 le32_to_cpu(pntsd->dacloffset)); 399 dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset);
305#ifdef CONFIG_CIFS_DEBUG2 400#ifdef CONFIG_CIFS_DEBUG2
306 cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " 401 cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x "
307 "sacloffset 0x%x dacloffset 0x%x", 402 "sacloffset 0x%x dacloffset 0x%x",
308 pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), 403 pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset),
309 le32_to_cpu(pntsd->gsidoffset), 404 le32_to_cpu(pntsd->gsidoffset),
310 le32_to_cpu(pntsd->sacloffset), 405 le32_to_cpu(pntsd->sacloffset), dacloffset));
311 le32_to_cpu(pntsd->dacloffset)));
312#endif 406#endif
407/* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */
313 rc = parse_sid(owner_sid_ptr, end_of_acl); 408 rc = parse_sid(owner_sid_ptr, end_of_acl);
314 if (rc) 409 if (rc)
315 return rc; 410 return rc;
@@ -318,16 +413,120 @@ int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len)
318 if (rc) 413 if (rc)
319 return rc; 414 return rc;
320 415
321 parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, group_sid_ptr); 416 if (dacloffset)
417 parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr,
418 group_sid_ptr, inode);
419 else
420 cFYI(1, ("no ACL")); /* BB grant all or default perms? */
322 421
323/* cifscred->uid = owner_sid_ptr->rid; 422/* cifscred->uid = owner_sid_ptr->rid;
324 cifscred->gid = group_sid_ptr->rid; 423 cifscred->gid = group_sid_ptr->rid;
325 memcpy((void *)(&(cifscred->osid)), (void *)owner_sid_ptr, 424 memcpy((void *)(&(cifscred->osid)), (void *)owner_sid_ptr,
326 sizeof (struct cifs_sid)); 425 sizeof(struct cifs_sid));
327 memcpy((void *)(&(cifscred->gsid)), (void *)group_sid_ptr, 426 memcpy((void *)(&(cifscred->gsid)), (void *)group_sid_ptr,
328 sizeof (struct cifs_sid)); */ 427 sizeof(struct cifs_sid)); */
329 428
330 429
331 return (0); 430 return (0);
332} 431}
432
433
434/* Retrieve an ACL from the server */
435static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode,
436 const char *path)
437{
438 struct cifsFileInfo *open_file;
439 int unlock_file = FALSE;
440 int xid;
441 int rc = -EIO;
442 __u16 fid;
443 struct super_block *sb;
444 struct cifs_sb_info *cifs_sb;
445 struct cifs_ntsd *pntsd = NULL;
446
447 cFYI(1, ("get mode from ACL for %s", path));
448
449 if (inode == NULL)
450 return NULL;
451
452 xid = GetXid();
453 open_file = find_readable_file(CIFS_I(inode));
454 sb = inode->i_sb;
455 if (sb == NULL) {
456 FreeXid(xid);
457 return NULL;
458 }
459 cifs_sb = CIFS_SB(sb);
460
461 if (open_file) {
462 unlock_file = TRUE;
463 fid = open_file->netfid;
464 } else {
465 int oplock = FALSE;
466 /* open file */
467 rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN,
468 READ_CONTROL, 0, &fid, &oplock, NULL,
469 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
470 CIFS_MOUNT_MAP_SPECIAL_CHR);
471 if (rc != 0) {
472 cERROR(1, ("Unable to open file to get ACL"));
473 FreeXid(xid);
474 return NULL;
475 }
476 }
477
478 rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen);
479 cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen));
480 if (unlock_file == TRUE)
481 atomic_dec(&open_file->wrtPending);
482 else
483 CIFSSMBClose(xid, cifs_sb->tcon, fid);
484
485 FreeXid(xid);
486 return pntsd;
487}
488
489/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
490void acl_to_uid_mode(struct inode *inode, const char *path)
491{
492 struct cifs_ntsd *pntsd = NULL;
493 u32 acllen = 0;
494 int rc = 0;
495
496#ifdef CONFIG_CIFS_DEBUG2
497 cFYI(1, ("converting ACL to mode for %s", path));
498#endif
499 pntsd = get_cifs_acl(&acllen, inode, path);
500
501 /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
502 if (pntsd)
503 rc = parse_sec_desc(pntsd, acllen, inode);
504 if (rc)
505 cFYI(1, ("parse sec desc failed rc = %d", rc));
506
507 kfree(pntsd);
508 return;
509}
510
511/* Convert mode bits to an ACL so we can update the ACL on the server */
512int mode_to_acl(struct inode *inode, const char *path)
513{
514 int rc = 0;
515 __u32 acllen = 0;
516 struct cifs_ntsd *pntsd = NULL;
517
518 cFYI(1, ("set ACL from mode for %s", path));
519
520 /* Get the security descriptor */
521 pntsd = get_cifs_acl(&acllen, inode, path);
522
523 /* Add/Modify the three ACEs for owner, group, everyone
524 while retaining the other ACEs */
525
526 /* Set the security descriptor */
527
528
529 kfree(pntsd);
530 return rc;
531}
333#endif /* CONFIG_CIFS_EXPERIMENTAL */ 532#endif /* CONFIG_CIFS_EXPERIMENTAL */
diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h
index 420f87813647..93a7c3462ea2 100644
--- a/fs/cifs/cifsacl.h
+++ b/fs/cifs/cifsacl.h
@@ -35,6 +35,9 @@
35#define UBITSHIFT 6 35#define UBITSHIFT 6
36#define GBITSHIFT 3 36#define GBITSHIFT 3
37 37
38#define ACCESS_ALLOWED 0
39#define ACCESS_DENIED 1
40
38struct cifs_ntsd { 41struct cifs_ntsd {
39 __le16 revision; /* revision level */ 42 __le16 revision; /* revision level */
40 __le16 type; 43 __le16 type;
@@ -48,7 +51,7 @@ struct cifs_sid {
48 __u8 revision; /* revision level */ 51 __u8 revision; /* revision level */
49 __u8 num_subauth; 52 __u8 num_subauth;
50 __u8 authority[6]; 53 __u8 authority[6];
51 __le32 sub_auth[5]; /* sub_auth[num_subauth] */ /* BB FIXME endianness BB */ 54 __le32 sub_auth[5]; /* sub_auth[num_subauth] */
52} __attribute__((packed)); 55} __attribute__((packed));
53 56
54struct cifs_acl { 57struct cifs_acl {
@@ -57,18 +60,12 @@ struct cifs_acl {
57 __le32 num_aces; 60 __le32 num_aces;
58} __attribute__((packed)); 61} __attribute__((packed));
59 62
60struct cifs_ntace { /* first part of ACE which contains perms */ 63struct cifs_ace {
61 __u8 type; 64 __u8 type;
62 __u8 flags; 65 __u8 flags;
63 __le16 size; 66 __le16 size;
64 __le32 access_req; 67 __le32 access_req;
65} __attribute__((packed)); 68 struct cifs_sid sid; /* ie UUID of user or group who gets these perms */
66
67struct cifs_ace { /* last part of ACE which includes user info */
68 __u8 revision; /* revision level */
69 __u8 num_subauth;
70 __u8 authority[6];
71 __le32 sub_auth[5];
72} __attribute__((packed)); 69} __attribute__((packed));
73 70
74struct cifs_wksid { 71struct cifs_wksid {
@@ -79,7 +76,7 @@ struct cifs_wksid {
79#ifdef CONFIG_CIFS_EXPERIMENTAL 76#ifdef CONFIG_CIFS_EXPERIMENTAL
80 77
81extern int match_sid(struct cifs_sid *); 78extern int match_sid(struct cifs_sid *);
82extern int compare_sids(struct cifs_sid *, struct cifs_sid *); 79extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *);
83 80
84#endif /* CONFIG_CIFS_EXPERIMENTAL */ 81#endif /* CONFIG_CIFS_EXPERIMENTAL */
85 82
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 632070b4275d..4ff8939c6cc7 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -99,15 +99,16 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
99 MD5Init(&context); 99 MD5Init(&context);
100 MD5Update(&context, (char *)&key->data, key->len); 100 MD5Update(&context, (char *)&key->data, key->len);
101 for (i = 0; i < n_vec; i++) { 101 for (i = 0; i < n_vec; i++) {
102 if (iov[i].iov_len == 0)
103 continue;
102 if (iov[i].iov_base == NULL) { 104 if (iov[i].iov_base == NULL) {
103 cERROR(1, ("null iovec entry")); 105 cERROR(1, ("null iovec entry"));
104 return -EIO; 106 return -EIO;
105 } else if (iov[i].iov_len == 0) 107 }
106 break; /* bail out if we are sent nothing to sign */
107 /* The first entry includes a length field (which does not get 108 /* The first entry includes a length field (which does not get
108 signed that occupies the first 4 bytes before the header */ 109 signed that occupies the first 4 bytes before the header */
109 if (i == 0) { 110 if (i == 0) {
110 if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */ 111 if (iov[0].iov_len <= 8) /* cmd field at offset 9 */
111 break; /* nothing to sign or corrupt header */ 112 break; /* nothing to sign or corrupt header */
112 MD5Update(&context, iov[0].iov_base+4, 113 MD5Update(&context, iov[0].iov_base+4,
113 iov[0].iov_len-4); 114 iov[0].iov_len-4);
@@ -122,7 +123,7 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
122 123
123 124
124int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, 125int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server,
125 __u32 * pexpected_response_sequence_number) 126 __u32 *pexpected_response_sequence_number)
126{ 127{
127 int rc = 0; 128 int rc = 0;
128 char smb_signature[20]; 129 char smb_signature[20];
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index a6fbea57c4b1..093beaa3900d 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -43,6 +43,8 @@
43#include "cifs_debug.h" 43#include "cifs_debug.h"
44#include "cifs_fs_sb.h" 44#include "cifs_fs_sb.h"
45#include <linux/mm.h> 45#include <linux/mm.h>
46#include <linux/key-type.h>
47#include "cifs_spnego.h"
46#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ 48#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */
47 49
48#ifdef CONFIG_CIFS_QUOTA 50#ifdef CONFIG_CIFS_QUOTA
@@ -264,6 +266,7 @@ cifs_alloc_inode(struct super_block *sb)
264 cifs_inode->cifsAttrs = 0x20; /* default */ 266 cifs_inode->cifsAttrs = 0x20; /* default */
265 atomic_set(&cifs_inode->inUse, 0); 267 atomic_set(&cifs_inode->inUse, 0);
266 cifs_inode->time = 0; 268 cifs_inode->time = 0;
269 cifs_inode->write_behind_rc = 0;
267 /* Until the file is open and we have gotten oplock 270 /* Until the file is open and we have gotten oplock
268 info back from the server, can not assume caching of 271 info back from the server, can not assume caching of
269 file data or metadata */ 272 file data or metadata */
@@ -850,7 +853,7 @@ static int cifs_oplock_thread(void *dummyarg)
850 struct cifsTconInfo *pTcon; 853 struct cifsTconInfo *pTcon;
851 struct inode *inode; 854 struct inode *inode;
852 __u16 netfid; 855 __u16 netfid;
853 int rc; 856 int rc, waitrc = 0;
854 857
855 set_freezable(); 858 set_freezable();
856 do { 859 do {
@@ -882,9 +885,11 @@ static int cifs_oplock_thread(void *dummyarg)
882 filemap_fdatawrite(inode->i_mapping); 885 filemap_fdatawrite(inode->i_mapping);
883 if (CIFS_I(inode)->clientCanCacheRead 886 if (CIFS_I(inode)->clientCanCacheRead
884 == 0) { 887 == 0) {
885 filemap_fdatawait(inode->i_mapping); 888 waitrc = filemap_fdatawait(inode->i_mapping);
886 invalidate_remote_inode(inode); 889 invalidate_remote_inode(inode);
887 } 890 }
891 if (rc == 0)
892 rc = waitrc;
888 } else 893 } else
889 rc = 0; 894 rc = 0;
890 /* mutex_unlock(&inode->i_mutex);*/ 895 /* mutex_unlock(&inode->i_mutex);*/
@@ -1005,12 +1010,16 @@ init_cifs(void)
1005 rc = register_filesystem(&cifs_fs_type); 1010 rc = register_filesystem(&cifs_fs_type);
1006 if (rc) 1011 if (rc)
1007 goto out_destroy_request_bufs; 1012 goto out_destroy_request_bufs;
1008 1013#ifdef CONFIG_CIFS_UPCALL
1014 rc = register_key_type(&cifs_spnego_key_type);
1015 if (rc)
1016 goto out_unregister_filesystem;
1017#endif
1009 oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd"); 1018 oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd");
1010 if (IS_ERR(oplockThread)) { 1019 if (IS_ERR(oplockThread)) {
1011 rc = PTR_ERR(oplockThread); 1020 rc = PTR_ERR(oplockThread);
1012 cERROR(1, ("error %d create oplock thread", rc)); 1021 cERROR(1, ("error %d create oplock thread", rc));
1013 goto out_unregister_filesystem; 1022 goto out_unregister_key_type;
1014 } 1023 }
1015 1024
1016 dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd"); 1025 dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd");
@@ -1024,7 +1033,11 @@ init_cifs(void)
1024 1033
1025 out_stop_oplock_thread: 1034 out_stop_oplock_thread:
1026 kthread_stop(oplockThread); 1035 kthread_stop(oplockThread);
1036 out_unregister_key_type:
1037#ifdef CONFIG_CIFS_UPCALL
1038 unregister_key_type(&cifs_spnego_key_type);
1027 out_unregister_filesystem: 1039 out_unregister_filesystem:
1040#endif
1028 unregister_filesystem(&cifs_fs_type); 1041 unregister_filesystem(&cifs_fs_type);
1029 out_destroy_request_bufs: 1042 out_destroy_request_bufs:
1030 cifs_destroy_request_bufs(); 1043 cifs_destroy_request_bufs();
@@ -1046,6 +1059,9 @@ exit_cifs(void)
1046#ifdef CONFIG_PROC_FS 1059#ifdef CONFIG_PROC_FS
1047 cifs_proc_clean(); 1060 cifs_proc_clean();
1048#endif 1061#endif
1062#ifdef CONFIG_CIFS_UPCALL
1063 unregister_key_type(&cifs_spnego_key_type);
1064#endif
1049 unregister_filesystem(&cifs_fs_type); 1065 unregister_filesystem(&cifs_fs_type);
1050 cifs_destroy_inodecache(); 1066 cifs_destroy_inodecache();
1051 cifs_destroy_mids(); 1067 cifs_destroy_mids();
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 5574ba3ab1f9..2a21dc66f0de 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -106,5 +106,5 @@ extern int cifs_ioctl(struct inode *inode, struct file *filep,
106extern const struct export_operations cifs_export_ops; 106extern const struct export_operations cifs_export_ops;
107#endif /* EXPERIMENTAL */ 107#endif /* EXPERIMENTAL */
108 108
109#define CIFS_VERSION "1.51" 109#define CIFS_VERSION "1.52"
110#endif /* _CIFSFS_H */ 110#endif /* _CIFSFS_H */
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 87f51f23276f..1fde2197ad76 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -110,6 +110,7 @@ struct mac_key {
110 unsigned int len; 110 unsigned int len;
111 union { 111 union {
112 char ntlm[CIFS_SESS_KEY_SIZE + 16]; 112 char ntlm[CIFS_SESS_KEY_SIZE + 16];
113 char krb5[CIFS_SESS_KEY_SIZE + 16]; /* BB: length correct? */
113 struct { 114 struct {
114 char key[16]; 115 char key[16];
115 struct ntlmv2_resp resp; 116 struct ntlmv2_resp resp;
@@ -139,6 +140,7 @@ struct TCP_Server_Info {
139 /* 15 character server name + 0x20 16th byte indicating type = srv */ 140 /* 15 character server name + 0x20 16th byte indicating type = srv */
140 char server_RFC1001_name[SERVER_NAME_LEN_WITH_NULL]; 141 char server_RFC1001_name[SERVER_NAME_LEN_WITH_NULL];
141 char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2]; 142 char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2];
143 char *hostname; /* hostname portion of UNC string */
142 struct socket *ssocket; 144 struct socket *ssocket;
143 union { 145 union {
144 struct sockaddr_in sockAddr; 146 struct sockaddr_in sockAddr;
@@ -471,6 +473,17 @@ struct dir_notify_req {
471#define CIFS_LARGE_BUFFER 2 473#define CIFS_LARGE_BUFFER 2
472#define CIFS_IOVEC 4 /* array of response buffers */ 474#define CIFS_IOVEC 4 /* array of response buffers */
473 475
476/* Type of Request to SendReceive2 */
477#define CIFS_STD_OP 0 /* normal request timeout */
478#define CIFS_LONG_OP 1 /* long op (up to 45 sec, oplock time) */
479#define CIFS_VLONG_OP 2 /* sloow op - can take up to 180 seconds */
480#define CIFS_BLOCKING_OP 4 /* operation can block */
481#define CIFS_ASYNC_OP 8 /* do not wait for response */
482#define CIFS_TIMEOUT_MASK 0x00F /* only one of 5 above set in req */
483#define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */
484#define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */
485#define CIFS_NO_RESP 0x040 /* no response buffer required */
486
474/* Security Flags: indicate type of session setup needed */ 487/* Security Flags: indicate type of session setup needed */
475#define CIFSSEC_MAY_SIGN 0x00001 488#define CIFSSEC_MAY_SIGN 0x00001
476#define CIFSSEC_MAY_NTLM 0x00002 489#define CIFSSEC_MAY_NTLM 0x00002
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index c41ff74e9128..dbe6b846f37f 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -220,6 +220,23 @@
220 | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES) 220 | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES)
221#define FILE_EXEC_RIGHTS (FILE_EXECUTE) 221#define FILE_EXEC_RIGHTS (FILE_EXECUTE)
222 222
223#define SET_FILE_READ_RIGHTS (FILE_READ_DATA | FILE_READ_EA | FILE_WRITE_EA \
224 | FILE_READ_ATTRIBUTES \
225 | FILE_WRITE_ATTRIBUTES \
226 | DELETE | READ_CONTROL | WRITE_DAC \
227 | WRITE_OWNER | SYNCHRONIZE)
228#define SET_FILE_WRITE_RIGHTS (FILE_WRITE_DATA | FILE_APPEND_DATA \
229 | FILE_READ_EA | FILE_WRITE_EA \
230 | FILE_DELETE_CHILD | FILE_READ_ATTRIBUTES \
231 | FILE_WRITE_ATTRIBUTES \
232 | DELETE | READ_CONTROL | WRITE_DAC \
233 | WRITE_OWNER | SYNCHRONIZE)
234#define SET_FILE_EXEC_RIGHTS (FILE_READ_EA | FILE_WRITE_EA | FILE_EXECUTE \
235 | FILE_READ_ATTRIBUTES \
236 | FILE_WRITE_ATTRIBUTES \
237 | DELETE | READ_CONTROL | WRITE_DAC \
238 | WRITE_OWNER | SYNCHRONIZE)
239
223 240
224/* 241/*
225 * Invalid readdir handle 242 * Invalid readdir handle
@@ -1211,6 +1228,29 @@ typedef struct smb_com_transaction_qsec_req {
1211 __le32 AclFlags; 1228 __le32 AclFlags;
1212} __attribute__((packed)) QUERY_SEC_DESC_REQ; 1229} __attribute__((packed)) QUERY_SEC_DESC_REQ;
1213 1230
1231
1232typedef struct smb_com_transaction_ssec_req {
1233 struct smb_hdr hdr; /* wct = 19 */
1234 __u8 MaxSetupCount;
1235 __u16 Reserved;
1236 __le32 TotalParameterCount;
1237 __le32 TotalDataCount;
1238 __le32 MaxParameterCount;
1239 __le32 MaxDataCount;
1240 __le32 ParameterCount;
1241 __le32 ParameterOffset;
1242 __le32 DataCount;
1243 __le32 DataOffset;
1244 __u8 SetupCount; /* no setup words follow subcommand */
1245 /* SNIA spec incorrectly included spurious pad here */
1246 __le16 SubCommand; /* 3 = SET_SECURITY_DESC */
1247 __le16 ByteCount; /* bcc = 3 + 8 */
1248 __u8 Pad[3];
1249 __u16 Fid;
1250 __u16 Reserved2;
1251 __le32 AclFlags;
1252} __attribute__((packed)) SET_SEC_DESC_REQ;
1253
1214typedef struct smb_com_transaction_change_notify_req { 1254typedef struct smb_com_transaction_change_notify_req {
1215 struct smb_hdr hdr; /* wct = 23 */ 1255 struct smb_hdr hdr; /* wct = 23 */
1216 __u8 MaxSetupCount; 1256 __u8 MaxSetupCount;
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 1a883663b22d..8350eec49663 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -48,10 +48,11 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
48 struct smb_hdr * /* input */ , 48 struct smb_hdr * /* input */ ,
49 struct smb_hdr * /* out */ , 49 struct smb_hdr * /* out */ ,
50 int * /* bytes returned */ , const int long_op); 50 int * /* bytes returned */ , const int long_op);
51extern int SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
52 struct smb_hdr *in_buf, int flags);
51extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, 53extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *,
52 struct kvec *, int /* nvec to send */, 54 struct kvec *, int /* nvec to send */,
53 int * /* type of buf returned */ , const int long_op, 55 int * /* type of buf returned */ , const int flags);
54 const int logError /* whether to log status code*/ );
55extern int SendReceiveBlockingLock(const unsigned int /* xid */ , 56extern int SendReceiveBlockingLock(const unsigned int /* xid */ ,
56 struct cifsTconInfo *, 57 struct cifsTconInfo *,
57 struct smb_hdr * /* input */ , 58 struct smb_hdr * /* input */ ,
@@ -61,6 +62,9 @@ extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length);
61extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); 62extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *);
62extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); 63extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
63extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); 64extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *);
65#ifdef CONFIG_CIFS_EXPERIMENTAL
66extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *);
67#endif
64extern unsigned int smbCalcSize(struct smb_hdr *ptr); 68extern unsigned int smbCalcSize(struct smb_hdr *ptr);
65extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); 69extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);
66extern int decode_negTokenInit(unsigned char *security_blob, int length, 70extern int decode_negTokenInit(unsigned char *security_blob, int length,
@@ -92,6 +96,8 @@ extern int cifs_get_inode_info(struct inode **pinode,
92extern int cifs_get_inode_info_unix(struct inode **pinode, 96extern int cifs_get_inode_info_unix(struct inode **pinode,
93 const unsigned char *search_path, 97 const unsigned char *search_path,
94 struct super_block *sb, int xid); 98 struct super_block *sb, int xid);
99extern void acl_to_uid_mode(struct inode *inode, const char *search_path);
100extern int mode_to_acl(struct inode *inode, const char *path);
95 101
96extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, 102extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *,
97 const char *); 103 const char *);
@@ -241,15 +247,15 @@ extern int CIFSSMBQueryReparseLinkInfo(const int xid,
241extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, 247extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
242 const char *fileName, const int disposition, 248 const char *fileName, const int disposition,
243 const int access_flags, const int omode, 249 const int access_flags, const int omode,
244 __u16 * netfid, int *pOplock, FILE_ALL_INFO *, 250 __u16 *netfid, int *pOplock, FILE_ALL_INFO *,
245 const struct nls_table *nls_codepage, int remap); 251 const struct nls_table *nls_codepage, int remap);
246extern int SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, 252extern int SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon,
247 const char *fileName, const int disposition, 253 const char *fileName, const int disposition,
248 const int access_flags, const int omode, 254 const int access_flags, const int omode,
249 __u16 * netfid, int *pOplock, FILE_ALL_INFO *, 255 __u16 *netfid, int *pOplock, FILE_ALL_INFO *,
250 const struct nls_table *nls_codepage, int remap); 256 const struct nls_table *nls_codepage, int remap);
251extern int CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, 257extern int CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon,
252 u32 posix_flags, __u64 mode, __u16 * netfid, 258 u32 posix_flags, __u64 mode, __u16 *netfid,
253 FILE_UNIX_BASIC_INFO *pRetData, 259 FILE_UNIX_BASIC_INFO *pRetData,
254 __u32 *pOplock, const char *name, 260 __u32 *pOplock, const char *name,
255 const struct nls_table *nls_codepage, int remap); 261 const struct nls_table *nls_codepage, int remap);
@@ -270,7 +276,7 @@ extern int CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
270 const __u64 offset, unsigned int *nbytes, 276 const __u64 offset, unsigned int *nbytes,
271 struct kvec *iov, const int nvec, const int long_op); 277 struct kvec *iov, const int nvec, const int long_op);
272extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, 278extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
273 const unsigned char *searchName, __u64 * inode_number, 279 const unsigned char *searchName, __u64 *inode_number,
274 const struct nls_table *nls_codepage, 280 const struct nls_table *nls_codepage,
275 int remap_special_chars); 281 int remap_special_chars);
276extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen, 282extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen,
@@ -311,7 +317,6 @@ extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *,
311#ifdef CONFIG_CIFS_WEAK_PW_HASH 317#ifdef CONFIG_CIFS_WEAK_PW_HASH
312extern void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key); 318extern void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key);
313#endif /* CIFS_WEAK_PW_HASH */ 319#endif /* CIFS_WEAK_PW_HASH */
314extern int parse_sec_desc(struct cifs_ntsd *, int);
315extern int CIFSSMBCopy(int xid, 320extern int CIFSSMBCopy(int xid,
316 struct cifsTconInfo *source_tcon, 321 struct cifsTconInfo *source_tcon,
317 const char *fromName, 322 const char *fromName,
@@ -336,8 +341,7 @@ extern int CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon,
336 const void *ea_value, const __u16 ea_value_len, 341 const void *ea_value, const __u16 ea_value_len,
337 const struct nls_table *nls_codepage, int remap_special_chars); 342 const struct nls_table *nls_codepage, int remap_special_chars);
338extern int CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, 343extern int CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon,
339 __u16 fid, char *acl_inf, const int buflen, 344 __u16 fid, struct cifs_ntsd **acl_inf, __u32 *buflen);
340 const int acl_type /* ACCESS vs. DEFAULT */);
341extern int CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, 345extern int CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon,
342 const unsigned char *searchName, 346 const unsigned char *searchName,
343 char *acl_inf, const int buflen, const int acl_type, 347 char *acl_inf, const int buflen, const int acl_type,
@@ -347,5 +351,5 @@ extern int CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon,
347 const char *local_acl, const int buflen, const int acl_type, 351 const char *local_acl, const int buflen, const int acl_type,
348 const struct nls_table *nls_codepage, int remap_special_chars); 352 const struct nls_table *nls_codepage, int remap_special_chars);
349extern int CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon, 353extern int CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon,
350 const int netfid, __u64 * pExtAttrBits, __u64 *pMask); 354 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
351#endif /* _CIFSPROTO_H */ 355#endif /* _CIFSPROTO_H */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index f0d9a485d095..9e8a6bef029a 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -647,8 +647,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
647 count - 16, 647 count - 16,
648 &server->secType); 648 &server->secType);
649 if (rc == 1) { 649 if (rc == 1) {
650 /* BB Need to fill struct for sessetup here */ 650 rc = 0;
651 rc = -EOPNOTSUPP;
652 } else { 651 } else {
653 rc = -EINVAL; 652 rc = -EINVAL;
654 } 653 }
@@ -699,9 +698,7 @@ int
699CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon) 698CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
700{ 699{
701 struct smb_hdr *smb_buffer; 700 struct smb_hdr *smb_buffer;
702 struct smb_hdr *smb_buffer_response; /* BB removeme BB */
703 int rc = 0; 701 int rc = 0;
704 int length;
705 702
706 cFYI(1, ("In tree disconnect")); 703 cFYI(1, ("In tree disconnect"));
707 /* 704 /*
@@ -738,16 +735,12 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
738 if (rc) { 735 if (rc) {
739 up(&tcon->tconSem); 736 up(&tcon->tconSem);
740 return rc; 737 return rc;
741 } else {
742 smb_buffer_response = smb_buffer; /* BB removeme BB */
743 } 738 }
744 rc = SendReceive(xid, tcon->ses, smb_buffer, smb_buffer_response, 739
745 &length, 0); 740 rc = SendReceiveNoRsp(xid, tcon->ses, smb_buffer, 0);
746 if (rc) 741 if (rc)
747 cFYI(1, ("Tree disconnect failed %d", rc)); 742 cFYI(1, ("Tree disconnect failed %d", rc));
748 743
749 if (smb_buffer)
750 cifs_small_buf_release(smb_buffer);
751 up(&tcon->tconSem); 744 up(&tcon->tconSem);
752 745
753 /* No need to return error on this operation if tid invalidated and 746 /* No need to return error on this operation if tid invalidated and
@@ -761,10 +754,8 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
761int 754int
762CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses) 755CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
763{ 756{
764 struct smb_hdr *smb_buffer_response;
765 LOGOFF_ANDX_REQ *pSMB; 757 LOGOFF_ANDX_REQ *pSMB;
766 int rc = 0; 758 int rc = 0;
767 int length;
768 759
769 cFYI(1, ("In SMBLogoff for session disconnect")); 760 cFYI(1, ("In SMBLogoff for session disconnect"));
770 if (ses) 761 if (ses)
@@ -783,8 +774,6 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
783 return rc; 774 return rc;
784 } 775 }
785 776
786 smb_buffer_response = (struct smb_hdr *)pSMB; /* BB removeme BB */
787
788 if (ses->server) { 777 if (ses->server) {
789 pSMB->hdr.Mid = GetNextMid(ses->server); 778 pSMB->hdr.Mid = GetNextMid(ses->server);
790 779
@@ -796,8 +785,7 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
796 pSMB->hdr.Uid = ses->Suid; 785 pSMB->hdr.Uid = ses->Suid;
797 786
798 pSMB->AndXCommand = 0xFF; 787 pSMB->AndXCommand = 0xFF;
799 rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, 788 rc = SendReceiveNoRsp(xid, ses, (struct smb_hdr *) pSMB, 0);
800 smb_buffer_response, &length, 0);
801 if (ses->server) { 789 if (ses->server) {
802 atomic_dec(&ses->server->socketUseCount); 790 atomic_dec(&ses->server->socketUseCount);
803 if (atomic_read(&ses->server->socketUseCount) == 0) { 791 if (atomic_read(&ses->server->socketUseCount) == 0) {
@@ -808,7 +796,6 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
808 } 796 }
809 } 797 }
810 up(&ses->sesSem); 798 up(&ses->sesSem);
811 cifs_small_buf_release(pSMB);
812 799
813 /* if session dead then we do not need to do ulogoff, 800 /* if session dead then we do not need to do ulogoff,
814 since server closed smb session, no sense reporting 801 since server closed smb session, no sense reporting
@@ -1256,7 +1243,7 @@ OldOpenRetry:
1256 pSMB->ByteCount = cpu_to_le16(count); 1243 pSMB->ByteCount = cpu_to_le16(count);
1257 /* long_op set to 1 to allow for oplock break timeouts */ 1244 /* long_op set to 1 to allow for oplock break timeouts */
1258 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1245 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1259 (struct smb_hdr *) pSMBr, &bytes_returned, 1); 1246 (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP);
1260 cifs_stats_inc(&tcon->num_opens); 1247 cifs_stats_inc(&tcon->num_opens);
1261 if (rc) { 1248 if (rc) {
1262 cFYI(1, ("Error in Open = %d", rc)); 1249 cFYI(1, ("Error in Open = %d", rc));
@@ -1369,7 +1356,7 @@ openRetry:
1369 pSMB->ByteCount = cpu_to_le16(count); 1356 pSMB->ByteCount = cpu_to_le16(count);
1370 /* long_op set to 1 to allow for oplock break timeouts */ 1357 /* long_op set to 1 to allow for oplock break timeouts */
1371 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1358 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1372 (struct smb_hdr *) pSMBr, &bytes_returned, 1); 1359 (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP);
1373 cifs_stats_inc(&tcon->num_opens); 1360 cifs_stats_inc(&tcon->num_opens);
1374 if (rc) { 1361 if (rc) {
1375 cFYI(1, ("Error in Open = %d", rc)); 1362 cFYI(1, ("Error in Open = %d", rc));
@@ -1447,7 +1434,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
1447 iov[0].iov_base = (char *)pSMB; 1434 iov[0].iov_base = (char *)pSMB;
1448 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 1435 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
1449 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, 1436 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */,
1450 &resp_buf_type, 0 /* not long op */, 1 /* log err */ ); 1437 &resp_buf_type, CIFS_STD_OP | CIFS_LOG_ERROR);
1451 cifs_stats_inc(&tcon->num_reads); 1438 cifs_stats_inc(&tcon->num_reads);
1452 pSMBr = (READ_RSP *)iov[0].iov_base; 1439 pSMBr = (READ_RSP *)iov[0].iov_base;
1453 if (rc) { 1440 if (rc) {
@@ -1666,7 +1653,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
1666 1653
1667 1654
1668 rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type, 1655 rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type,
1669 long_op, 0 /* do not log STATUS code */ ); 1656 long_op);
1670 cifs_stats_inc(&tcon->num_writes); 1657 cifs_stats_inc(&tcon->num_writes);
1671 if (rc) { 1658 if (rc) {
1672 cFYI(1, ("Send error Write2 = %d", rc)); 1659 cFYI(1, ("Send error Write2 = %d", rc));
@@ -1708,7 +1695,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1708 int timeout = 0; 1695 int timeout = 0;
1709 __u16 count; 1696 __u16 count;
1710 1697
1711 cFYI(1, ("In CIFSSMBLock - timeout %d numLock %d", waitFlag, numLock)); 1698 cFYI(1, ("CIFSSMBLock timeout %d numLock %d", waitFlag, numLock));
1712 rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB); 1699 rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
1713 1700
1714 if (rc) 1701 if (rc)
@@ -1717,10 +1704,10 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1717 pSMBr = (LOCK_RSP *)pSMB; /* BB removeme BB */ 1704 pSMBr = (LOCK_RSP *)pSMB; /* BB removeme BB */
1718 1705
1719 if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { 1706 if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) {
1720 timeout = -1; /* no response expected */ 1707 timeout = CIFS_ASYNC_OP; /* no response expected */
1721 pSMB->Timeout = 0; 1708 pSMB->Timeout = 0;
1722 } else if (waitFlag == TRUE) { 1709 } else if (waitFlag == TRUE) {
1723 timeout = 3; /* blocking operation, no timeout */ 1710 timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */
1724 pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ 1711 pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */
1725 } else { 1712 } else {
1726 pSMB->Timeout = 0; 1713 pSMB->Timeout = 0;
@@ -1750,15 +1737,16 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1750 if (waitFlag) { 1737 if (waitFlag) {
1751 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB, 1738 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
1752 (struct smb_hdr *) pSMBr, &bytes_returned); 1739 (struct smb_hdr *) pSMBr, &bytes_returned);
1740 cifs_small_buf_release(pSMB);
1753 } else { 1741 } else {
1754 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1742 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *)pSMB,
1755 (struct smb_hdr *) pSMBr, &bytes_returned, timeout); 1743 timeout);
1744 /* SMB buffer freed by function above */
1756 } 1745 }
1757 cifs_stats_inc(&tcon->num_locks); 1746 cifs_stats_inc(&tcon->num_locks);
1758 if (rc) { 1747 if (rc) {
1759 cFYI(1, ("Send error in Lock = %d", rc)); 1748 cFYI(1, ("Send error in Lock = %d", rc));
1760 } 1749 }
1761 cifs_small_buf_release(pSMB);
1762 1750
1763 /* Note: On -EAGAIN error only caller can retry on handle based calls 1751 /* Note: On -EAGAIN error only caller can retry on handle based calls
1764 since file handle passed in no longer valid */ 1752 since file handle passed in no longer valid */
@@ -1777,7 +1765,9 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
1777 int rc = 0; 1765 int rc = 0;
1778 int timeout = 0; 1766 int timeout = 0;
1779 int bytes_returned = 0; 1767 int bytes_returned = 0;
1768 int resp_buf_type = 0;
1780 __u16 params, param_offset, offset, byte_count, count; 1769 __u16 params, param_offset, offset, byte_count, count;
1770 struct kvec iov[1];
1781 1771
1782 cFYI(1, ("Posix Lock")); 1772 cFYI(1, ("Posix Lock"));
1783 1773
@@ -1819,7 +1809,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
1819 1809
1820 parm_data->lock_type = cpu_to_le16(lock_type); 1810 parm_data->lock_type = cpu_to_le16(lock_type);
1821 if (waitFlag) { 1811 if (waitFlag) {
1822 timeout = 3; /* blocking operation, no timeout */ 1812 timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */
1823 parm_data->lock_flags = cpu_to_le16(1); 1813 parm_data->lock_flags = cpu_to_le16(1);
1824 pSMB->Timeout = cpu_to_le32(-1); 1814 pSMB->Timeout = cpu_to_le32(-1);
1825 } else 1815 } else
@@ -1839,8 +1829,13 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
1839 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB, 1829 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
1840 (struct smb_hdr *) pSMBr, &bytes_returned); 1830 (struct smb_hdr *) pSMBr, &bytes_returned);
1841 } else { 1831 } else {
1842 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1832 iov[0].iov_base = (char *)pSMB;
1843 (struct smb_hdr *) pSMBr, &bytes_returned, timeout); 1833 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
1834 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */,
1835 &resp_buf_type, timeout);
1836 pSMB = NULL; /* request buf already freed by SendReceive2. Do
1837 not try to free it twice below on exit */
1838 pSMBr = (struct smb_com_transaction2_sfi_rsp *)iov[0].iov_base;
1844 } 1839 }
1845 1840
1846 if (rc) { 1841 if (rc) {
@@ -1875,6 +1870,11 @@ plk_err_exit:
1875 if (pSMB) 1870 if (pSMB)
1876 cifs_small_buf_release(pSMB); 1871 cifs_small_buf_release(pSMB);
1877 1872
1873 if (resp_buf_type == CIFS_SMALL_BUFFER)
1874 cifs_small_buf_release(iov[0].iov_base);
1875 else if (resp_buf_type == CIFS_LARGE_BUFFER)
1876 cifs_buf_release(iov[0].iov_base);
1877
1878 /* Note: On -EAGAIN error only caller can retry on handle based calls 1878 /* Note: On -EAGAIN error only caller can retry on handle based calls
1879 since file handle passed in no longer valid */ 1879 since file handle passed in no longer valid */
1880 1880
@@ -1887,8 +1887,6 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1887{ 1887{
1888 int rc = 0; 1888 int rc = 0;
1889 CLOSE_REQ *pSMB = NULL; 1889 CLOSE_REQ *pSMB = NULL;
1890 CLOSE_RSP *pSMBr = NULL;
1891 int bytes_returned;
1892 cFYI(1, ("In CIFSSMBClose")); 1890 cFYI(1, ("In CIFSSMBClose"));
1893 1891
1894/* do not retry on dead session on close */ 1892/* do not retry on dead session on close */
@@ -1898,13 +1896,10 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1898 if (rc) 1896 if (rc)
1899 return rc; 1897 return rc;
1900 1898
1901 pSMBr = (CLOSE_RSP *)pSMB; /* BB removeme BB */
1902
1903 pSMB->FileID = (__u16) smb_file_id; 1899 pSMB->FileID = (__u16) smb_file_id;
1904 pSMB->LastWriteTime = 0xFFFFFFFF; 1900 pSMB->LastWriteTime = 0xFFFFFFFF;
1905 pSMB->ByteCount = 0; 1901 pSMB->ByteCount = 0;
1906 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1902 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
1907 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
1908 cifs_stats_inc(&tcon->num_closes); 1903 cifs_stats_inc(&tcon->num_closes);
1909 if (rc) { 1904 if (rc) {
1910 if (rc != -EINTR) { 1905 if (rc != -EINTR) {
@@ -1913,8 +1908,6 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1913 } 1908 }
1914 } 1909 }
1915 1910
1916 cifs_small_buf_release(pSMB);
1917
1918 /* Since session is dead, file will be closed on server already */ 1911 /* Since session is dead, file will be closed on server already */
1919 if (rc == -EAGAIN) 1912 if (rc == -EAGAIN)
1920 rc = 0; 1913 rc = 0;
@@ -2486,6 +2479,7 @@ querySymLinkRetry:
2486 return rc; 2479 return rc;
2487} 2480}
2488 2481
2482#ifdef CONFIG_CIFS_EXPERIMENTAL
2489/* Initialize NT TRANSACT SMB into small smb request buffer. 2483/* Initialize NT TRANSACT SMB into small smb request buffer.
2490 This assumes that all NT TRANSACTS that we init here have 2484 This assumes that all NT TRANSACTS that we init here have
2491 total parm and data under about 400 bytes (to fit in small cifs 2485 total parm and data under about 400 bytes (to fit in small cifs
@@ -2494,7 +2488,7 @@ querySymLinkRetry:
2494 MaxSetupCount (size of returned setup area) and 2488 MaxSetupCount (size of returned setup area) and
2495 MaxParameterCount (returned parms size) must be set by caller */ 2489 MaxParameterCount (returned parms size) must be set by caller */
2496static int 2490static int
2497smb_init_ntransact(const __u16 sub_command, const int setup_count, 2491smb_init_nttransact(const __u16 sub_command, const int setup_count,
2498 const int parm_len, struct cifsTconInfo *tcon, 2492 const int parm_len, struct cifsTconInfo *tcon,
2499 void **ret_buf) 2493 void **ret_buf)
2500{ 2494{
@@ -2525,12 +2519,15 @@ smb_init_ntransact(const __u16 sub_command, const int setup_count,
2525 2519
2526static int 2520static int
2527validate_ntransact(char *buf, char **ppparm, char **ppdata, 2521validate_ntransact(char *buf, char **ppparm, char **ppdata,
2528 int *pdatalen, int *pparmlen) 2522 __u32 *pparmlen, __u32 *pdatalen)
2529{ 2523{
2530 char *end_of_smb; 2524 char *end_of_smb;
2531 __u32 data_count, data_offset, parm_count, parm_offset; 2525 __u32 data_count, data_offset, parm_count, parm_offset;
2532 struct smb_com_ntransact_rsp *pSMBr; 2526 struct smb_com_ntransact_rsp *pSMBr;
2533 2527
2528 *pdatalen = 0;
2529 *pparmlen = 0;
2530
2534 if (buf == NULL) 2531 if (buf == NULL)
2535 return -EINVAL; 2532 return -EINVAL;
2536 2533
@@ -2567,8 +2564,11 @@ validate_ntransact(char *buf, char **ppparm, char **ppdata,
2567 cFYI(1, ("parm count and data count larger than SMB")); 2564 cFYI(1, ("parm count and data count larger than SMB"));
2568 return -EINVAL; 2565 return -EINVAL;
2569 } 2566 }
2567 *pdatalen = data_count;
2568 *pparmlen = parm_count;
2570 return 0; 2569 return 0;
2571} 2570}
2571#endif /* CIFS_EXPERIMENTAL */
2572 2572
2573int 2573int
2574CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon, 2574CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
@@ -3067,8 +3067,7 @@ GetExtAttrOut:
3067/* Get Security Descriptor (by handle) from remote server for a file or dir */ 3067/* Get Security Descriptor (by handle) from remote server for a file or dir */
3068int 3068int
3069CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, 3069CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3070 /* BB fix up return info */ char *acl_inf, const int buflen, 3070 struct cifs_ntsd **acl_inf, __u32 *pbuflen)
3071 const int acl_type)
3072{ 3071{
3073 int rc = 0; 3072 int rc = 0;
3074 int buf_type = 0; 3073 int buf_type = 0;
@@ -3077,7 +3076,10 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3077 3076
3078 cFYI(1, ("GetCifsACL")); 3077 cFYI(1, ("GetCifsACL"));
3079 3078
3080 rc = smb_init_ntransact(NT_TRANSACT_QUERY_SECURITY_DESC, 0, 3079 *pbuflen = 0;
3080 *acl_inf = NULL;
3081
3082 rc = smb_init_nttransact(NT_TRANSACT_QUERY_SECURITY_DESC, 0,
3081 8 /* parm len */, tcon, (void **) &pSMB); 3083 8 /* parm len */, tcon, (void **) &pSMB);
3082 if (rc) 3084 if (rc)
3083 return rc; 3085 return rc;
@@ -3094,39 +3096,57 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3094 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 3096 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
3095 3097
3096 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, 3098 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type,
3097 0 /* not long op */, 0 /* do not log STATUS codes */ ); 3099 CIFS_STD_OP);
3098 cifs_stats_inc(&tcon->num_acl_get); 3100 cifs_stats_inc(&tcon->num_acl_get);
3099 if (rc) { 3101 if (rc) {
3100 cFYI(1, ("Send error in QuerySecDesc = %d", rc)); 3102 cFYI(1, ("Send error in QuerySecDesc = %d", rc));
3101 } else { /* decode response */ 3103 } else { /* decode response */
3102 struct cifs_ntsd *psec_desc;
3103 __le32 * parm; 3104 __le32 * parm;
3104 int parm_len; 3105 __u32 parm_len;
3105 int data_len; 3106 __u32 acl_len;
3106 int acl_len;
3107 struct smb_com_ntransact_rsp *pSMBr; 3107 struct smb_com_ntransact_rsp *pSMBr;
3108 char *pdata;
3108 3109
3109/* validate_nttransact */ 3110/* validate_nttransact */
3110 rc = validate_ntransact(iov[0].iov_base, (char **)&parm, 3111 rc = validate_ntransact(iov[0].iov_base, (char **)&parm,
3111 (char **)&psec_desc, 3112 &pdata, &parm_len, pbuflen);
3112 &parm_len, &data_len);
3113 if (rc) 3113 if (rc)
3114 goto qsec_out; 3114 goto qsec_out;
3115 pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base; 3115 pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base;
3116 3116
3117 cFYI(1, ("smb %p parm %p data %p", pSMBr, parm, psec_desc)); 3117 cFYI(1, ("smb %p parm %p data %p", pSMBr, parm, *acl_inf));
3118 3118
3119 if (le32_to_cpu(pSMBr->ParameterCount) != 4) { 3119 if (le32_to_cpu(pSMBr->ParameterCount) != 4) {
3120 rc = -EIO; /* bad smb */ 3120 rc = -EIO; /* bad smb */
3121 *pbuflen = 0;
3121 goto qsec_out; 3122 goto qsec_out;
3122 } 3123 }
3123 3124
3124/* BB check that data area is minimum length and as big as acl_len */ 3125/* BB check that data area is minimum length and as big as acl_len */
3125 3126
3126 acl_len = le32_to_cpu(*parm); 3127 acl_len = le32_to_cpu(*parm);
3127 /* BB check if (acl_len > bufsize) */ 3128 if (acl_len != *pbuflen) {
3129 cERROR(1, ("acl length %d does not match %d",
3130 acl_len, *pbuflen));
3131 if (*pbuflen > acl_len)
3132 *pbuflen = acl_len;
3133 }
3128 3134
3129 parse_sec_desc(psec_desc, acl_len); 3135 /* check if buffer is big enough for the acl
3136 header followed by the smallest SID */
3137 if ((*pbuflen < sizeof(struct cifs_ntsd) + 8) ||
3138 (*pbuflen >= 64 * 1024)) {
3139 cERROR(1, ("bad acl length %d", *pbuflen));
3140 rc = -EINVAL;
3141 *pbuflen = 0;
3142 } else {
3143 *acl_inf = kmalloc(*pbuflen, GFP_KERNEL);
3144 if (*acl_inf == NULL) {
3145 *pbuflen = 0;
3146 rc = -ENOMEM;
3147 }
3148 memcpy(*acl_inf, pdata, *pbuflen);
3149 }
3130 } 3150 }
3131qsec_out: 3151qsec_out:
3132 if (buf_type == CIFS_SMALL_BUFFER) 3152 if (buf_type == CIFS_SMALL_BUFFER)
@@ -3381,7 +3401,7 @@ UnixQPathInfoRetry:
3381 memcpy((char *) pFindData, 3401 memcpy((char *) pFindData,
3382 (char *) &pSMBr->hdr.Protocol + 3402 (char *) &pSMBr->hdr.Protocol +
3383 data_offset, 3403 data_offset,
3384 sizeof (FILE_UNIX_BASIC_INFO)); 3404 sizeof(FILE_UNIX_BASIC_INFO));
3385 } 3405 }
3386 } 3406 }
3387 cifs_buf_release(pSMB); 3407 cifs_buf_release(pSMB);
@@ -3649,7 +3669,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
3649 pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_NEXT); 3669 pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_NEXT);
3650 pSMB->SearchHandle = searchHandle; /* always kept as le */ 3670 pSMB->SearchHandle = searchHandle; /* always kept as le */
3651 pSMB->SearchCount = 3671 pSMB->SearchCount =
3652 cpu_to_le16(CIFSMaxBufSize / sizeof (FILE_UNIX_INFO)); 3672 cpu_to_le16(CIFSMaxBufSize / sizeof(FILE_UNIX_INFO));
3653 pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level); 3673 pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
3654 pSMB->ResumeKey = psrch_inf->resume_key; 3674 pSMB->ResumeKey = psrch_inf->resume_key;
3655 pSMB->SearchFlags = 3675 pSMB->SearchFlags =
@@ -3737,8 +3757,6 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon,
3737{ 3757{
3738 int rc = 0; 3758 int rc = 0;
3739 FINDCLOSE_REQ *pSMB = NULL; 3759 FINDCLOSE_REQ *pSMB = NULL;
3740 CLOSE_RSP *pSMBr = NULL; /* BB removeme BB */
3741 int bytes_returned;
3742 3760
3743 cFYI(1, ("In CIFSSMBFindClose")); 3761 cFYI(1, ("In CIFSSMBFindClose"));
3744 rc = small_smb_init(SMB_COM_FIND_CLOSE2, 1, tcon, (void **)&pSMB); 3762 rc = small_smb_init(SMB_COM_FIND_CLOSE2, 1, tcon, (void **)&pSMB);
@@ -3750,16 +3768,13 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon,
3750 if (rc) 3768 if (rc)
3751 return rc; 3769 return rc;
3752 3770
3753 pSMBr = (CLOSE_RSP *)pSMB; /* BB removeme BB */
3754 pSMB->FileID = searchHandle; 3771 pSMB->FileID = searchHandle;
3755 pSMB->ByteCount = 0; 3772 pSMB->ByteCount = 0;
3756 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 3773 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
3757 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
3758 if (rc) { 3774 if (rc) {
3759 cERROR(1, ("Send error in FindClose = %d", rc)); 3775 cERROR(1, ("Send error in FindClose = %d", rc));
3760 } 3776 }
3761 cifs_stats_inc(&tcon->num_fclose); 3777 cifs_stats_inc(&tcon->num_fclose);
3762 cifs_small_buf_release(pSMB);
3763 3778
3764 /* Since session is dead, search handle closed on server already */ 3779 /* Since session is dead, search handle closed on server already */
3765 if (rc == -EAGAIN) 3780 if (rc == -EAGAIN)
@@ -4331,7 +4346,7 @@ QFSDeviceRetry:
4331 } else { /* decode response */ 4346 } else { /* decode response */
4332 rc = validate_t2((struct smb_t2_rsp *)pSMBr); 4347 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
4333 4348
4334 if (rc || (pSMBr->ByteCount < sizeof (FILE_SYSTEM_DEVICE_INFO))) 4349 if (rc || (pSMBr->ByteCount < sizeof(FILE_SYSTEM_DEVICE_INFO)))
4335 rc = -EIO; /* bad smb */ 4350 rc = -EIO; /* bad smb */
4336 else { 4351 else {
4337 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); 4352 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
@@ -4681,11 +4696,9 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
4681 __u16 fid, __u32 pid_of_opener, int SetAllocation) 4696 __u16 fid, __u32 pid_of_opener, int SetAllocation)
4682{ 4697{
4683 struct smb_com_transaction2_sfi_req *pSMB = NULL; 4698 struct smb_com_transaction2_sfi_req *pSMB = NULL;
4684 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
4685 char *data_offset; 4699 char *data_offset;
4686 struct file_end_of_file_info *parm_data; 4700 struct file_end_of_file_info *parm_data;
4687 int rc = 0; 4701 int rc = 0;
4688 int bytes_returned = 0;
4689 __u16 params, param_offset, offset, byte_count, count; 4702 __u16 params, param_offset, offset, byte_count, count;
4690 4703
4691 cFYI(1, ("SetFileSize (via SetFileInfo) %lld", 4704 cFYI(1, ("SetFileSize (via SetFileInfo) %lld",
@@ -4695,8 +4708,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
4695 if (rc) 4708 if (rc)
4696 return rc; 4709 return rc;
4697 4710
4698 pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
4699
4700 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener); 4711 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
4701 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16)); 4712 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
4702 4713
@@ -4747,17 +4758,13 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
4747 pSMB->Reserved4 = 0; 4758 pSMB->Reserved4 = 0;
4748 pSMB->hdr.smb_buf_length += byte_count; 4759 pSMB->hdr.smb_buf_length += byte_count;
4749 pSMB->ByteCount = cpu_to_le16(byte_count); 4760 pSMB->ByteCount = cpu_to_le16(byte_count);
4750 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 4761 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
4751 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
4752 if (rc) { 4762 if (rc) {
4753 cFYI(1, 4763 cFYI(1,
4754 ("Send error in SetFileInfo (SetFileSize) = %d", 4764 ("Send error in SetFileInfo (SetFileSize) = %d",
4755 rc)); 4765 rc));
4756 } 4766 }
4757 4767
4758 if (pSMB)
4759 cifs_small_buf_release(pSMB);
4760
4761 /* Note: On -EAGAIN error only caller can retry on handle based calls 4768 /* Note: On -EAGAIN error only caller can retry on handle based calls
4762 since file handle passed in no longer valid */ 4769 since file handle passed in no longer valid */
4763 4770
@@ -4775,10 +4782,8 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4775 const FILE_BASIC_INFO *data, __u16 fid) 4782 const FILE_BASIC_INFO *data, __u16 fid)
4776{ 4783{
4777 struct smb_com_transaction2_sfi_req *pSMB = NULL; 4784 struct smb_com_transaction2_sfi_req *pSMB = NULL;
4778 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
4779 char *data_offset; 4785 char *data_offset;
4780 int rc = 0; 4786 int rc = 0;
4781 int bytes_returned = 0;
4782 __u16 params, param_offset, offset, byte_count, count; 4787 __u16 params, param_offset, offset, byte_count, count;
4783 4788
4784 cFYI(1, ("Set Times (via SetFileInfo)")); 4789 cFYI(1, ("Set Times (via SetFileInfo)"));
@@ -4787,8 +4792,6 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4787 if (rc) 4792 if (rc)
4788 return rc; 4793 return rc;
4789 4794
4790 pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
4791
4792 /* At this point there is no need to override the current pid 4795 /* At this point there is no need to override the current pid
4793 with the pid of the opener, but that could change if we someday 4796 with the pid of the opener, but that could change if we someday
4794 use an existing handle (rather than opening one on the fly) */ 4797 use an existing handle (rather than opening one on the fly) */
@@ -4828,14 +4831,11 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4828 pSMB->hdr.smb_buf_length += byte_count; 4831 pSMB->hdr.smb_buf_length += byte_count;
4829 pSMB->ByteCount = cpu_to_le16(byte_count); 4832 pSMB->ByteCount = cpu_to_le16(byte_count);
4830 memcpy(data_offset, data, sizeof(FILE_BASIC_INFO)); 4833 memcpy(data_offset, data, sizeof(FILE_BASIC_INFO));
4831 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 4834 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
4832 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
4833 if (rc) { 4835 if (rc) {
4834 cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc)); 4836 cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc));
4835 } 4837 }
4836 4838
4837 cifs_small_buf_release(pSMB);
4838
4839 /* Note: On -EAGAIN error only caller can retry on handle based calls 4839 /* Note: On -EAGAIN error only caller can retry on handle based calls
4840 since file handle passed in no longer valid */ 4840 since file handle passed in no longer valid */
4841 4841
@@ -5126,7 +5126,8 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
5126 pSMB->ByteCount = 0; 5126 pSMB->ByteCount = 0;
5127 5127
5128 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 5128 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5129 (struct smb_hdr *) pSMBr, &bytes_returned, -1); 5129 (struct smb_hdr *)pSMBr, &bytes_returned,
5130 CIFS_ASYNC_OP);
5130 if (rc) { 5131 if (rc) {
5131 cFYI(1, ("Error in Notify = %d", rc)); 5132 cFYI(1, ("Error in Notify = %d", rc));
5132 } else { 5133 } else {
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 19ee11f7f35a..fd9147cdb5a9 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -160,7 +160,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
160 if (server->ssocket) { 160 if (server->ssocket) {
161 cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state, 161 cFYI(1, ("State: 0x%x Flags: 0x%lx", server->ssocket->state,
162 server->ssocket->flags)); 162 server->ssocket->flags));
163 server->ssocket->ops->shutdown(server->ssocket, SEND_SHUTDOWN); 163 kernel_sock_shutdown(server->ssocket, SHUT_WR);
164 cFYI(1, ("Post shutdown state: 0x%x Flags: 0x%lx", 164 cFYI(1, ("Post shutdown state: 0x%x Flags: 0x%lx",
165 server->ssocket->state, 165 server->ssocket->state,
166 server->ssocket->flags)); 166 server->ssocket->flags));
@@ -438,9 +438,9 @@ incomplete_rcv:
438 csocket = server->ssocket; 438 csocket = server->ssocket;
439 wake_up(&server->response_q); 439 wake_up(&server->response_q);
440 continue; 440 continue;
441 } else if (length < 4) { 441 } else if (length < pdu_length) {
442 cFYI(1, ("less than four bytes received (%d bytes)", 442 cFYI(1, ("requested %d bytes but only got %d bytes",
443 length)); 443 pdu_length, length));
444 pdu_length -= length; 444 pdu_length -= length;
445 msleep(1); 445 msleep(1);
446 goto incomplete_rcv; 446 goto incomplete_rcv;
@@ -752,6 +752,7 @@ multi_t2_fnd:
752 } 752 }
753 write_unlock(&GlobalSMBSeslock); 753 write_unlock(&GlobalSMBSeslock);
754 754
755 kfree(server->hostname);
755 kfree(server); 756 kfree(server);
756 if (length > 0) 757 if (length > 0)
757 mempool_resize(cifs_req_poolp, length + cifs_min_rcv, 758 mempool_resize(cifs_req_poolp, length + cifs_min_rcv,
@@ -760,6 +761,34 @@ multi_t2_fnd:
760 return 0; 761 return 0;
761} 762}
762 763
764/* extract the host portion of the UNC string */
765static char *
766extract_hostname(const char *unc)
767{
768 const char *src;
769 char *dst, *delim;
770 unsigned int len;
771
772 /* skip double chars at beginning of string */
773 /* BB: check validity of these bytes? */
774 src = unc + 2;
775
776 /* delimiter between hostname and sharename is always '\\' now */
777 delim = strchr(src, '\\');
778 if (!delim)
779 return ERR_PTR(-EINVAL);
780
781 len = delim - src;
782 dst = kmalloc((len + 1), GFP_KERNEL);
783 if (dst == NULL)
784 return ERR_PTR(-ENOMEM);
785
786 memcpy(dst, src, len);
787 dst[len] = '\0';
788
789 return dst;
790}
791
763static int 792static int
764cifs_parse_mount_options(char *options, const char *devname, 793cifs_parse_mount_options(char *options, const char *devname,
765 struct smb_vol *vol) 794 struct smb_vol *vol)
@@ -793,7 +822,7 @@ cifs_parse_mount_options(char *options, const char *devname,
793 vol->linux_gid = current->gid; 822 vol->linux_gid = current->gid;
794 vol->dir_mode = S_IRWXUGO; 823 vol->dir_mode = S_IRWXUGO;
795 /* 2767 perms indicate mandatory locking support */ 824 /* 2767 perms indicate mandatory locking support */
796 vol->file_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); 825 vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP);
797 826
798 /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ 827 /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */
799 vol->rw = TRUE; 828 vol->rw = TRUE;
@@ -1781,16 +1810,13 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1781 1810
1782 memset(&volume_info, 0, sizeof(struct smb_vol)); 1811 memset(&volume_info, 0, sizeof(struct smb_vol));
1783 if (cifs_parse_mount_options(mount_data, devname, &volume_info)) { 1812 if (cifs_parse_mount_options(mount_data, devname, &volume_info)) {
1784 kfree(volume_info.UNC); 1813 rc = -EINVAL;
1785 kfree(volume_info.password); 1814 goto out;
1786 kfree(volume_info.prepath);
1787 FreeXid(xid);
1788 return -EINVAL;
1789 } 1815 }
1790 1816
1791 if (volume_info.nullauth) { 1817 if (volume_info.nullauth) {
1792 cFYI(1, ("null user")); 1818 cFYI(1, ("null user"));
1793 volume_info.username = NULL; 1819 volume_info.username = "";
1794 } else if (volume_info.username) { 1820 } else if (volume_info.username) {
1795 /* BB fixme parse for domain name here */ 1821 /* BB fixme parse for domain name here */
1796 cFYI(1, ("Username: %s", volume_info.username)); 1822 cFYI(1, ("Username: %s", volume_info.username));
@@ -1798,11 +1824,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1798 cifserror("No username specified"); 1824 cifserror("No username specified");
1799 /* In userspace mount helper we can get user name from alternate 1825 /* In userspace mount helper we can get user name from alternate
1800 locations such as env variables and files on disk */ 1826 locations such as env variables and files on disk */
1801 kfree(volume_info.UNC); 1827 rc = -EINVAL;
1802 kfree(volume_info.password); 1828 goto out;
1803 kfree(volume_info.prepath);
1804 FreeXid(xid);
1805 return -EINVAL;
1806 } 1829 }
1807 1830
1808 if (volume_info.UNCip && volume_info.UNC) { 1831 if (volume_info.UNCip && volume_info.UNC) {
@@ -1821,11 +1844,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1821 1844
1822 if (rc <= 0) { 1845 if (rc <= 0) {
1823 /* we failed translating address */ 1846 /* we failed translating address */
1824 kfree(volume_info.UNC); 1847 rc = -EINVAL;
1825 kfree(volume_info.password); 1848 goto out;
1826 kfree(volume_info.prepath);
1827 FreeXid(xid);
1828 return -EINVAL;
1829 } 1849 }
1830 1850
1831 cFYI(1, ("UNC: %s ip: %s", volume_info.UNC, volume_info.UNCip)); 1851 cFYI(1, ("UNC: %s ip: %s", volume_info.UNC, volume_info.UNCip));
@@ -1835,20 +1855,14 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1835 /* BB using ip addr as server name to connect to the 1855 /* BB using ip addr as server name to connect to the
1836 DFS root below */ 1856 DFS root below */
1837 cERROR(1, ("Connecting to DFS root not implemented yet")); 1857 cERROR(1, ("Connecting to DFS root not implemented yet"));
1838 kfree(volume_info.UNC); 1858 rc = -EINVAL;
1839 kfree(volume_info.password); 1859 goto out;
1840 kfree(volume_info.prepath);
1841 FreeXid(xid);
1842 return -EINVAL;
1843 } else /* which servers DFS root would we conect to */ { 1860 } else /* which servers DFS root would we conect to */ {
1844 cERROR(1, 1861 cERROR(1,
1845 ("CIFS mount error: No UNC path (e.g. -o " 1862 ("CIFS mount error: No UNC path (e.g. -o "
1846 "unc=//192.168.1.100/public) specified")); 1863 "unc=//192.168.1.100/public) specified"));
1847 kfree(volume_info.UNC); 1864 rc = -EINVAL;
1848 kfree(volume_info.password); 1865 goto out;
1849 kfree(volume_info.prepath);
1850 FreeXid(xid);
1851 return -EINVAL;
1852 } 1866 }
1853 1867
1854 /* this is needed for ASCII cp to Unicode converts */ 1868 /* this is needed for ASCII cp to Unicode converts */
@@ -1860,11 +1874,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1860 if (cifs_sb->local_nls == NULL) { 1874 if (cifs_sb->local_nls == NULL) {
1861 cERROR(1, ("CIFS mount error: iocharset %s not found", 1875 cERROR(1, ("CIFS mount error: iocharset %s not found",
1862 volume_info.iocharset)); 1876 volume_info.iocharset));
1863 kfree(volume_info.UNC); 1877 rc = -ELIBACC;
1864 kfree(volume_info.password); 1878 goto out;
1865 kfree(volume_info.prepath);
1866 FreeXid(xid);
1867 return -ELIBACC;
1868 } 1879 }
1869 } 1880 }
1870 1881
@@ -1878,11 +1889,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1878 &sin_server6.sin6_addr, 1889 &sin_server6.sin6_addr,
1879 volume_info.username, &srvTcp); 1890 volume_info.username, &srvTcp);
1880 } else { 1891 } else {
1881 kfree(volume_info.UNC); 1892 rc = -EINVAL;
1882 kfree(volume_info.password); 1893 goto out;
1883 kfree(volume_info.prepath);
1884 FreeXid(xid);
1885 return -EINVAL;
1886 } 1894 }
1887 1895
1888 if (srvTcp) { 1896 if (srvTcp) {
@@ -1906,22 +1914,14 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1906 "Aborting operation")); 1914 "Aborting operation"));
1907 if (csocket != NULL) 1915 if (csocket != NULL)
1908 sock_release(csocket); 1916 sock_release(csocket);
1909 kfree(volume_info.UNC); 1917 goto out;
1910 kfree(volume_info.password);
1911 kfree(volume_info.prepath);
1912 FreeXid(xid);
1913 return rc;
1914 } 1918 }
1915 1919
1916 srvTcp = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL); 1920 srvTcp = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL);
1917 if (!srvTcp) { 1921 if (!srvTcp) {
1918 rc = -ENOMEM; 1922 rc = -ENOMEM;
1919 sock_release(csocket); 1923 sock_release(csocket);
1920 kfree(volume_info.UNC); 1924 goto out;
1921 kfree(volume_info.password);
1922 kfree(volume_info.prepath);
1923 FreeXid(xid);
1924 return rc;
1925 } else { 1925 } else {
1926 memcpy(&srvTcp->addr.sockAddr, &sin_server, 1926 memcpy(&srvTcp->addr.sockAddr, &sin_server,
1927 sizeof(struct sockaddr_in)); 1927 sizeof(struct sockaddr_in));
@@ -1929,6 +1929,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1929 /* BB Add code for ipv6 case too */ 1929 /* BB Add code for ipv6 case too */
1930 srvTcp->ssocket = csocket; 1930 srvTcp->ssocket = csocket;
1931 srvTcp->protocolType = IPV4; 1931 srvTcp->protocolType = IPV4;
1932 srvTcp->hostname = extract_hostname(volume_info.UNC);
1933 if (IS_ERR(srvTcp->hostname)) {
1934 rc = PTR_ERR(srvTcp->hostname);
1935 sock_release(csocket);
1936 goto out;
1937 }
1932 init_waitqueue_head(&srvTcp->response_q); 1938 init_waitqueue_head(&srvTcp->response_q);
1933 init_waitqueue_head(&srvTcp->request_q); 1939 init_waitqueue_head(&srvTcp->request_q);
1934 INIT_LIST_HEAD(&srvTcp->pending_mid_q); 1940 INIT_LIST_HEAD(&srvTcp->pending_mid_q);
@@ -1938,16 +1944,13 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1938 srvTcp->tcpStatus = CifsNew; 1944 srvTcp->tcpStatus = CifsNew;
1939 init_MUTEX(&srvTcp->tcpSem); 1945 init_MUTEX(&srvTcp->tcpSem);
1940 srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd"); 1946 srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd");
1941 if ( IS_ERR(srvTcp->tsk) ) { 1947 if (IS_ERR(srvTcp->tsk)) {
1942 rc = PTR_ERR(srvTcp->tsk); 1948 rc = PTR_ERR(srvTcp->tsk);
1943 cERROR(1, ("error %d create cifsd thread", rc)); 1949 cERROR(1, ("error %d create cifsd thread", rc));
1944 srvTcp->tsk = NULL; 1950 srvTcp->tsk = NULL;
1945 sock_release(csocket); 1951 sock_release(csocket);
1946 kfree(volume_info.UNC); 1952 kfree(srvTcp->hostname);
1947 kfree(volume_info.password); 1953 goto out;
1948 kfree(volume_info.prepath);
1949 FreeXid(xid);
1950 return rc;
1951 } 1954 }
1952 wait_for_completion(&cifsd_complete); 1955 wait_for_completion(&cifsd_complete);
1953 rc = 0; 1956 rc = 0;
@@ -1962,8 +1965,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1962 if (existingCifsSes) { 1965 if (existingCifsSes) {
1963 pSesInfo = existingCifsSes; 1966 pSesInfo = existingCifsSes;
1964 cFYI(1, ("Existing smb sess found")); 1967 cFYI(1, ("Existing smb sess found"));
1965 kfree(volume_info.password);
1966 /* volume_info.UNC freed at end of function */
1967 } else if (!rc) { 1968 } else if (!rc) {
1968 cFYI(1, ("Existing smb sess not found")); 1969 cFYI(1, ("Existing smb sess not found"));
1969 pSesInfo = sesInfoAlloc(); 1970 pSesInfo = sesInfoAlloc();
@@ -1977,8 +1978,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1977 1978
1978 if (!rc) { 1979 if (!rc) {
1979 /* volume_info.password freed at unmount */ 1980 /* volume_info.password freed at unmount */
1980 if (volume_info.password) 1981 if (volume_info.password) {
1981 pSesInfo->password = volume_info.password; 1982 pSesInfo->password = volume_info.password;
1983 /* set to NULL to prevent freeing on exit */
1984 volume_info.password = NULL;
1985 }
1982 if (volume_info.username) 1986 if (volume_info.username)
1983 strncpy(pSesInfo->userName, 1987 strncpy(pSesInfo->userName,
1984 volume_info.username, 1988 volume_info.username,
@@ -2000,8 +2004,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2000 up(&pSesInfo->sesSem); 2004 up(&pSesInfo->sesSem);
2001 if (!rc) 2005 if (!rc)
2002 atomic_inc(&srvTcp->socketUseCount); 2006 atomic_inc(&srvTcp->socketUseCount);
2003 } else 2007 }
2004 kfree(volume_info.password);
2005 } 2008 }
2006 2009
2007 /* search for existing tcon to this server share */ 2010 /* search for existing tcon to this server share */
@@ -2106,9 +2109,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2106 "", cifs_sb->local_nls, 2109 "", cifs_sb->local_nls,
2107 cifs_sb->mnt_cifs_flags & 2110 cifs_sb->mnt_cifs_flags &
2108 CIFS_MOUNT_MAP_SPECIAL_CHR); 2111 CIFS_MOUNT_MAP_SPECIAL_CHR);
2109 kfree(volume_info.UNC); 2112 rc = -ENODEV;
2110 FreeXid(xid); 2113 goto out;
2111 return -ENODEV;
2112 } else { 2114 } else {
2113 /* BB Do we need to wrap sesSem around 2115 /* BB Do we need to wrap sesSem around
2114 * this TCon call and Unix SetFS as 2116 * this TCon call and Unix SetFS as
@@ -2231,6 +2233,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2231 (in which case it is not needed anymore) but when new sesion is created 2233 (in which case it is not needed anymore) but when new sesion is created
2232 the password ptr is put in the new session structure (in which case the 2234 the password ptr is put in the new session structure (in which case the
2233 password will be freed at unmount time) */ 2235 password will be freed at unmount time) */
2236out:
2237 /* zero out password before freeing */
2238 if (volume_info.password != NULL) {
2239 memset(volume_info.password, 0, strlen(volume_info.password));
2240 kfree(volume_info.password);
2241 }
2234 kfree(volume_info.UNC); 2242 kfree(volume_info.UNC);
2235 kfree(volume_info.prepath); 2243 kfree(volume_info.prepath);
2236 FreeXid(xid); 2244 FreeXid(xid);
@@ -2374,7 +2382,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2374 pSMB->req_no_secext.ByteCount = cpu_to_le16(count); 2382 pSMB->req_no_secext.ByteCount = cpu_to_le16(count);
2375 2383
2376 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, 2384 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
2377 &bytes_returned, 1); 2385 &bytes_returned, CIFS_LONG_OP);
2378 if (rc) { 2386 if (rc) {
2379/* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */ 2387/* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */
2380 } else if ((smb_buffer_response->WordCount == 3) 2388 } else if ((smb_buffer_response->WordCount == 3)
@@ -2678,7 +2686,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2678 pSMB->req.ByteCount = cpu_to_le16(count); 2686 pSMB->req.ByteCount = cpu_to_le16(count);
2679 2687
2680 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, 2688 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
2681 &bytes_returned, 1); 2689 &bytes_returned, CIFS_LONG_OP);
2682 2690
2683 if (smb_buffer_response->Status.CifsError == 2691 if (smb_buffer_response->Status.CifsError ==
2684 cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED)) 2692 cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))
@@ -3105,7 +3113,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3105 pSMB->req.ByteCount = cpu_to_le16(count); 3113 pSMB->req.ByteCount = cpu_to_le16(count);
3106 3114
3107 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, 3115 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
3108 &bytes_returned, 1); 3116 &bytes_returned, CIFS_LONG_OP);
3109 if (rc) { 3117 if (rc) {
3110/* rc = map_smb_to_linux_error(smb_buffer_response) done in SendReceive now */ 3118/* rc = map_smb_to_linux_error(smb_buffer_response) done in SendReceive now */
3111 } else if ((smb_buffer_response->WordCount == 3) || 3119 } else if ((smb_buffer_response->WordCount == 3) ||
@@ -3381,7 +3389,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3381 pSMB->hdr.smb_buf_length += count; 3389 pSMB->hdr.smb_buf_length += count;
3382 pSMB->ByteCount = cpu_to_le16(count); 3390 pSMB->ByteCount = cpu_to_le16(count);
3383 3391
3384 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 0); 3392 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length,
3393 CIFS_STD_OP);
3385 3394
3386 /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */ 3395 /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */
3387 /* above now done in SendReceive */ 3396 /* above now done in SendReceive */
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 793404b10925..37dc97af1487 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -593,7 +593,7 @@ static int cifs_ci_compare(struct dentry *dentry, struct qstr *a,
593 * case take precedence. If a is not a negative dentry, this 593 * case take precedence. If a is not a negative dentry, this
594 * should have no side effects 594 * should have no side effects
595 */ 595 */
596 memcpy((unsigned char *)a->name, b->name, a->len); 596 memcpy(a->name, b->name, a->len);
597 return 0; 597 return 0;
598 } 598 }
599 return 1; 599 return 1;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 1e7e4c06d9e3..dd26e2759b17 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -130,7 +130,9 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
130 if (file->f_path.dentry->d_inode->i_mapping) { 130 if (file->f_path.dentry->d_inode->i_mapping) {
131 /* BB no need to lock inode until after invalidate 131 /* BB no need to lock inode until after invalidate
132 since namei code should already have it locked? */ 132 since namei code should already have it locked? */
133 filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); 133 rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping);
134 if (rc != 0)
135 CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc;
134 } 136 }
135 cFYI(1, ("invalidating remote inode since open detected it " 137 cFYI(1, ("invalidating remote inode since open detected it "
136 "changed")); 138 "changed"));
@@ -425,7 +427,9 @@ reopen_error_exit:
425 pCifsInode = CIFS_I(inode); 427 pCifsInode = CIFS_I(inode);
426 if (pCifsInode) { 428 if (pCifsInode) {
427 if (can_flush) { 429 if (can_flush) {
428 filemap_write_and_wait(inode->i_mapping); 430 rc = filemap_write_and_wait(inode->i_mapping);
431 if (rc != 0)
432 CIFS_I(inode)->write_behind_rc = rc;
429 /* temporarily disable caching while we 433 /* temporarily disable caching while we
430 go to server to get inode info */ 434 go to server to get inode info */
431 pCifsInode->clientCanCacheAll = FALSE; 435 pCifsInode->clientCanCacheAll = FALSE;
@@ -835,9 +839,9 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
835 xid = GetXid(); 839 xid = GetXid();
836 840
837 if (*poffset > file->f_path.dentry->d_inode->i_size) 841 if (*poffset > file->f_path.dentry->d_inode->i_size)
838 long_op = 2; /* writes past end of file can take a long time */ 842 long_op = CIFS_VLONG_OP; /* writes past EOF take long time */
839 else 843 else
840 long_op = 1; 844 long_op = CIFS_LONG_OP;
841 845
842 for (total_written = 0; write_size > total_written; 846 for (total_written = 0; write_size > total_written;
843 total_written += bytes_written) { 847 total_written += bytes_written) {
@@ -884,7 +888,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
884 } 888 }
885 } else 889 } else
886 *poffset += bytes_written; 890 *poffset += bytes_written;
887 long_op = FALSE; /* subsequent writes fast - 891 long_op = CIFS_STD_OP; /* subsequent writes fast -
888 15 seconds is plenty */ 892 15 seconds is plenty */
889 } 893 }
890 894
@@ -934,9 +938,9 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
934 xid = GetXid(); 938 xid = GetXid();
935 939
936 if (*poffset > file->f_path.dentry->d_inode->i_size) 940 if (*poffset > file->f_path.dentry->d_inode->i_size)
937 long_op = 2; /* writes past end of file can take a long time */ 941 long_op = CIFS_VLONG_OP; /* writes past EOF can be slow */
938 else 942 else
939 long_op = 1; 943 long_op = CIFS_LONG_OP;
940 944
941 for (total_written = 0; write_size > total_written; 945 for (total_written = 0; write_size > total_written;
942 total_written += bytes_written) { 946 total_written += bytes_written) {
@@ -1002,7 +1006,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
1002 } 1006 }
1003 } else 1007 } else
1004 *poffset += bytes_written; 1008 *poffset += bytes_written;
1005 long_op = FALSE; /* subsequent writes fast - 1009 long_op = CIFS_STD_OP; /* subsequent writes fast -
1006 15 seconds is plenty */ 1010 15 seconds is plenty */
1007 } 1011 }
1008 1012
@@ -1026,6 +1030,37 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
1026 return total_written; 1030 return total_written;
1027} 1031}
1028 1032
1033#ifdef CONFIG_CIFS_EXPERIMENTAL
1034struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode)
1035{
1036 struct cifsFileInfo *open_file = NULL;
1037
1038 read_lock(&GlobalSMBSeslock);
1039 /* we could simply get the first_list_entry since write-only entries
1040 are always at the end of the list but since the first entry might
1041 have a close pending, we go through the whole list */
1042 list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
1043 if (open_file->closePend)
1044 continue;
1045 if (open_file->pfile && ((open_file->pfile->f_flags & O_RDWR) ||
1046 (open_file->pfile->f_flags & O_RDONLY))) {
1047 if (!open_file->invalidHandle) {
1048 /* found a good file */
1049 /* lock it so it will not be closed on us */
1050 atomic_inc(&open_file->wrtPending);
1051 read_unlock(&GlobalSMBSeslock);
1052 return open_file;
1053 } /* else might as well continue, and look for
1054 another, or simply have the caller reopen it
1055 again rather than trying to fix this handle */
1056 } else /* write only file */
1057 break; /* write only files are last so must be done */
1058 }
1059 read_unlock(&GlobalSMBSeslock);
1060 return NULL;
1061}
1062#endif
1063
1029struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode) 1064struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
1030{ 1065{
1031 struct cifsFileInfo *open_file; 1066 struct cifsFileInfo *open_file;
@@ -1056,11 +1091,11 @@ refind_writable:
1056 read_unlock(&GlobalSMBSeslock); 1091 read_unlock(&GlobalSMBSeslock);
1057 return open_file; 1092 return open_file;
1058 } 1093 }
1059 1094
1060 read_unlock(&GlobalSMBSeslock); 1095 read_unlock(&GlobalSMBSeslock);
1061 /* Had to unlock since following call can block */ 1096 /* Had to unlock since following call can block */
1062 rc = cifs_reopen_file(open_file->pfile, FALSE); 1097 rc = cifs_reopen_file(open_file->pfile, FALSE);
1063 if (!rc) { 1098 if (!rc) {
1064 if (!open_file->closePend) 1099 if (!open_file->closePend)
1065 return open_file; 1100 return open_file;
1066 else { /* start over in case this was deleted */ 1101 else { /* start over in case this was deleted */
@@ -1083,7 +1118,7 @@ refind_writable:
1083 /* can not use this handle, no write 1118 /* can not use this handle, no write
1084 pending on this one after all */ 1119 pending on this one after all */
1085 atomic_dec(&open_file->wrtPending); 1120 atomic_dec(&open_file->wrtPending);
1086 1121
1087 if (open_file->closePend) /* list could have changed */ 1122 if (open_file->closePend) /* list could have changed */
1088 goto refind_writable; 1123 goto refind_writable;
1089 /* else we simply continue to the next entry. Thus 1124 /* else we simply continue to the next entry. Thus
@@ -1329,14 +1364,17 @@ retry:
1329 open_file->netfid, 1364 open_file->netfid,
1330 bytes_to_write, offset, 1365 bytes_to_write, offset,
1331 &bytes_written, iov, n_iov, 1366 &bytes_written, iov, n_iov,
1332 1); 1367 CIFS_LONG_OP);
1333 atomic_dec(&open_file->wrtPending); 1368 atomic_dec(&open_file->wrtPending);
1334 if (rc || bytes_written < bytes_to_write) { 1369 if (rc || bytes_written < bytes_to_write) {
1335 cERROR(1, ("Write2 ret %d, wrote %d", 1370 cERROR(1, ("Write2 ret %d, wrote %d",
1336 rc, bytes_written)); 1371 rc, bytes_written));
1337 /* BB what if continued retry is 1372 /* BB what if continued retry is
1338 requested via mount flags? */ 1373 requested via mount flags? */
1339 set_bit(AS_EIO, &mapping->flags); 1374 if (rc == -ENOSPC)
1375 set_bit(AS_ENOSPC, &mapping->flags);
1376 else
1377 set_bit(AS_EIO, &mapping->flags);
1340 } else { 1378 } else {
1341 cifs_stats_bytes_written(cifs_sb->tcon, 1379 cifs_stats_bytes_written(cifs_sb->tcon,
1342 bytes_written); 1380 bytes_written);
@@ -1468,9 +1506,11 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1468 cFYI(1, ("Sync file - name: %s datasync: 0x%x", 1506 cFYI(1, ("Sync file - name: %s datasync: 0x%x",
1469 dentry->d_name.name, datasync)); 1507 dentry->d_name.name, datasync));
1470 1508
1471 rc = filemap_fdatawrite(inode->i_mapping); 1509 rc = filemap_write_and_wait(inode->i_mapping);
1472 if (rc == 0) 1510 if (rc == 0) {
1511 rc = CIFS_I(inode)->write_behind_rc;
1473 CIFS_I(inode)->write_behind_rc = 0; 1512 CIFS_I(inode)->write_behind_rc = 0;
1513 }
1474 FreeXid(xid); 1514 FreeXid(xid);
1475 return rc; 1515 return rc;
1476} 1516}
@@ -1522,8 +1562,11 @@ int cifs_flush(struct file *file, fl_owner_t id)
1522 filemapfdatawrite appears easier for the time being */ 1562 filemapfdatawrite appears easier for the time being */
1523 1563
1524 rc = filemap_fdatawrite(inode->i_mapping); 1564 rc = filemap_fdatawrite(inode->i_mapping);
1525 if (!rc) /* reset wb rc if we were able to write out dirty pages */ 1565 /* reset wb rc if we were able to write out dirty pages */
1566 if (!rc) {
1567 rc = CIFS_I(inode)->write_behind_rc;
1526 CIFS_I(inode)->write_behind_rc = 0; 1568 CIFS_I(inode)->write_behind_rc = 0;
1569 }
1527 1570
1528 cFYI(1, ("Flush inode %p file %p rc %d", inode, file, rc)); 1571 cFYI(1, ("Flush inode %p file %p rc %d", inode, file, rc));
1529 1572
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 5e8b388be3b6..e915eb1d2e66 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -289,7 +289,7 @@ static int decode_sfu_inode(struct inode *inode, __u64 size,
289 289
290#define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */ 290#define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */
291 291
292static int get_sfu_uid_mode(struct inode *inode, 292static int get_sfu_mode(struct inode *inode,
293 const unsigned char *path, 293 const unsigned char *path,
294 struct cifs_sb_info *cifs_sb, int xid) 294 struct cifs_sb_info *cifs_sb, int xid)
295{ 295{
@@ -527,11 +527,16 @@ int cifs_get_inode_info(struct inode **pinode,
527 527
528 /* BB fill in uid and gid here? with help from winbind? 528 /* BB fill in uid and gid here? with help from winbind?
529 or retrieve from NTFS stream extended attribute */ 529 or retrieve from NTFS stream extended attribute */
530#ifdef CONFIG_CIFS_EXPERIMENTAL
531 /* fill in 0777 bits from ACL */
532 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
533 cFYI(1, ("Getting mode bits from ACL"));
534 acl_to_uid_mode(inode, search_path);
535 }
536#endif
530 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { 537 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
531 /* fill in uid, gid, mode from server ACL */ 538 /* fill in remaining high mode bits e.g. SUID, VTX */
532 /* BB FIXME this should also take into account the 539 get_sfu_mode(inode, search_path, cifs_sb, xid);
533 * default uid specified on mount if present */
534 get_sfu_uid_mode(inode, search_path, cifs_sb, xid);
535 } else if (atomic_read(&cifsInfo->inUse) == 0) { 540 } else if (atomic_read(&cifsInfo->inUse) == 0) {
536 inode->i_uid = cifs_sb->mnt_uid; 541 inode->i_uid = cifs_sb->mnt_uid;
537 inode->i_gid = cifs_sb->mnt_gid; 542 inode->i_gid = cifs_sb->mnt_gid;
@@ -1228,7 +1233,7 @@ cifs_rename_exit:
1228int cifs_revalidate(struct dentry *direntry) 1233int cifs_revalidate(struct dentry *direntry)
1229{ 1234{
1230 int xid; 1235 int xid;
1231 int rc = 0; 1236 int rc = 0, wbrc = 0;
1232 char *full_path; 1237 char *full_path;
1233 struct cifs_sb_info *cifs_sb; 1238 struct cifs_sb_info *cifs_sb;
1234 struct cifsInodeInfo *cifsInode; 1239 struct cifsInodeInfo *cifsInode;
@@ -1328,7 +1333,9 @@ int cifs_revalidate(struct dentry *direntry)
1328 if (direntry->d_inode->i_mapping) { 1333 if (direntry->d_inode->i_mapping) {
1329 /* do we need to lock inode until after invalidate completes 1334 /* do we need to lock inode until after invalidate completes
1330 below? */ 1335 below? */
1331 filemap_fdatawrite(direntry->d_inode->i_mapping); 1336 wbrc = filemap_fdatawrite(direntry->d_inode->i_mapping);
1337 if (wbrc)
1338 CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
1332 } 1339 }
1333 if (invalidate_inode) { 1340 if (invalidate_inode) {
1334 /* shrink_dcache not necessary now that cifs dentry ops 1341 /* shrink_dcache not necessary now that cifs dentry ops
@@ -1337,7 +1344,9 @@ int cifs_revalidate(struct dentry *direntry)
1337 shrink_dcache_parent(direntry); */ 1344 shrink_dcache_parent(direntry); */
1338 if (S_ISREG(direntry->d_inode->i_mode)) { 1345 if (S_ISREG(direntry->d_inode->i_mode)) {
1339 if (direntry->d_inode->i_mapping) 1346 if (direntry->d_inode->i_mapping)
1340 filemap_fdatawait(direntry->d_inode->i_mapping); 1347 wbrc = filemap_fdatawait(direntry->d_inode->i_mapping);
1348 if (wbrc)
1349 CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
1341 /* may eventually have to do this for open files too */ 1350 /* may eventually have to do this for open files too */
1342 if (list_empty(&(cifsInode->openFileList))) { 1351 if (list_empty(&(cifsInode->openFileList))) {
1343 /* changed on server - flush read ahead pages */ 1352 /* changed on server - flush read ahead pages */
@@ -1480,10 +1489,20 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1480 1489
1481 /* BB check if we need to refresh inode from server now ? BB */ 1490 /* BB check if we need to refresh inode from server now ? BB */
1482 1491
1483 /* need to flush data before changing file size on server */
1484 filemap_write_and_wait(direntry->d_inode->i_mapping);
1485
1486 if (attrs->ia_valid & ATTR_SIZE) { 1492 if (attrs->ia_valid & ATTR_SIZE) {
1493 /*
1494 Flush data before changing file size on server. If the
1495 flush returns error, store it to report later and continue.
1496 BB: This should be smarter. Why bother flushing pages that
1497 will be truncated anyway? Also, should we error out here if
1498 the flush returns error?
1499 */
1500 rc = filemap_write_and_wait(direntry->d_inode->i_mapping);
1501 if (rc != 0) {
1502 CIFS_I(direntry->d_inode)->write_behind_rc = rc;
1503 rc = 0;
1504 }
1505
1487 /* To avoid spurious oplock breaks from server, in the case of 1506 /* To avoid spurious oplock breaks from server, in the case of
1488 inodes that we already have open, avoid doing path based 1507 inodes that we already have open, avoid doing path based
1489 setting of file size if we can do it by handle. 1508 setting of file size if we can do it by handle.
diff --git a/fs/cifs/md5.c b/fs/cifs/md5.c
index e5c3e1212697..f13f96d42fcf 100644
--- a/fs/cifs/md5.c
+++ b/fs/cifs/md5.c
@@ -276,8 +276,8 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len,
276 } 276 }
277 277
278 /* start out by storing key in pads */ 278 /* start out by storing key in pads */
279 memset(ctx->k_ipad, 0, sizeof (ctx->k_ipad)); 279 memset(ctx->k_ipad, 0, sizeof(ctx->k_ipad));
280 memset(ctx->k_opad, 0, sizeof (ctx->k_opad)); 280 memset(ctx->k_opad, 0, sizeof(ctx->k_opad));
281 memcpy(ctx->k_ipad, key, key_len); 281 memcpy(ctx->k_ipad, key, key_len);
282 memcpy(ctx->k_opad, key, key_len); 282 memcpy(ctx->k_opad, key, key_len);
283 283
@@ -307,8 +307,8 @@ hmac_md5_init_limK_to_64(const unsigned char *key, int key_len,
307 } 307 }
308 308
309 /* start out by storing key in pads */ 309 /* start out by storing key in pads */
310 memset(ctx->k_ipad, 0, sizeof (ctx->k_ipad)); 310 memset(ctx->k_ipad, 0, sizeof(ctx->k_ipad));
311 memset(ctx->k_opad, 0, sizeof (ctx->k_opad)); 311 memset(ctx->k_opad, 0, sizeof(ctx->k_opad));
312 memcpy(ctx->k_ipad, key, key_len); 312 memcpy(ctx->k_ipad, key, key_len);
313 memcpy(ctx->k_opad, key, key_len); 313 memcpy(ctx->k_opad, key, key_len);
314 314
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 51ec681fe74a..15546c2354c5 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -73,7 +73,7 @@ sesInfoAlloc(void)
73{ 73{
74 struct cifsSesInfo *ret_buf; 74 struct cifsSesInfo *ret_buf;
75 75
76 ret_buf = kzalloc(sizeof (struct cifsSesInfo), GFP_KERNEL); 76 ret_buf = kzalloc(sizeof(struct cifsSesInfo), GFP_KERNEL);
77 if (ret_buf) { 77 if (ret_buf) {
78 write_lock(&GlobalSMBSeslock); 78 write_lock(&GlobalSMBSeslock);
79 atomic_inc(&sesInfoAllocCount); 79 atomic_inc(&sesInfoAllocCount);
@@ -109,7 +109,7 @@ struct cifsTconInfo *
109tconInfoAlloc(void) 109tconInfoAlloc(void)
110{ 110{
111 struct cifsTconInfo *ret_buf; 111 struct cifsTconInfo *ret_buf;
112 ret_buf = kzalloc(sizeof (struct cifsTconInfo), GFP_KERNEL); 112 ret_buf = kzalloc(sizeof(struct cifsTconInfo), GFP_KERNEL);
113 if (ret_buf) { 113 if (ret_buf) {
114 write_lock(&GlobalSMBSeslock); 114 write_lock(&GlobalSMBSeslock);
115 atomic_inc(&tconInfoAllocCount); 115 atomic_inc(&tconInfoAllocCount);
@@ -298,7 +298,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
298 memset(temp, 0, 256); /* bigger than MAX_CIFS_HDR_SIZE */ 298 memset(temp, 0, 256); /* bigger than MAX_CIFS_HDR_SIZE */
299 299
300 buffer->smb_buf_length = 300 buffer->smb_buf_length =
301 (2 * word_count) + sizeof (struct smb_hdr) - 301 (2 * word_count) + sizeof(struct smb_hdr) -
302 4 /* RFC 1001 length field does not count */ + 302 4 /* RFC 1001 length field does not count */ +
303 2 /* for bcc field itself */ ; 303 2 /* for bcc field itself */ ;
304 /* Note that this is the only network field that has to be converted 304 /* Note that this is the only network field that has to be converted
@@ -422,8 +422,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
422 __u32 clc_len; /* calculated length */ 422 __u32 clc_len; /* calculated length */
423 cFYI(0, ("checkSMB Length: 0x%x, smb_buf_length: 0x%x", length, len)); 423 cFYI(0, ("checkSMB Length: 0x%x, smb_buf_length: 0x%x", length, len));
424 424
425 if (length < 2 + sizeof (struct smb_hdr)) { 425 if (length < 2 + sizeof(struct smb_hdr)) {
426 if ((length >= sizeof (struct smb_hdr) - 1) 426 if ((length >= sizeof(struct smb_hdr) - 1)
427 && (smb->Status.CifsError != 0)) { 427 && (smb->Status.CifsError != 0)) {
428 smb->WordCount = 0; 428 smb->WordCount = 0;
429 /* some error cases do not return wct and bcc */ 429 /* some error cases do not return wct and bcc */
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index f06359cb22ee..646e1f06941b 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -132,6 +132,34 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
132 {0, 0} 132 {0, 0}
133}; 133};
134 134
135
136/* if the mount helper is missing we need to reverse the 1st slash
137 from '/' to backslash in order to format the UNC properly for
138 ip address parsing and for tree connect (unless the user
139 remembered to put the UNC name in properly). Fortunately we do
140 not have to call this twice (we check for IPv4 addresses
141 first, so it is already converted by the time we
142 try IPv6 addresses */
143static int canonicalize_unc(char *cp)
144{
145 int i;
146
147 for (i = 0; i <= 46 /* INET6_ADDRSTRLEN */ ; i++) {
148 if (cp[i] == 0)
149 break;
150 if (cp[i] == '\\')
151 break;
152 if (cp[i] == '/') {
153#ifdef CONFIG_CIFS_DEBUG2
154 cFYI(1, ("change slash to backslash in malformed UNC"));
155#endif
156 cp[i] = '\\';
157 return 1;
158 }
159 }
160 return 0;
161}
162
135/* Convert string containing dotted ip address to binary form */ 163/* Convert string containing dotted ip address to binary form */
136/* returns 0 if invalid address */ 164/* returns 0 if invalid address */
137 165
@@ -141,11 +169,13 @@ cifs_inet_pton(int address_family, char *cp, void *dst)
141 int ret = 0; 169 int ret = 0;
142 170
143 /* calculate length by finding first slash or NULL */ 171 /* calculate length by finding first slash or NULL */
144 /* BB Should we convert '/' slash to '\' here since it seems already 172 if (address_family == AF_INET) {
145 * done before this */ 173 ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL);
146 if ( address_family == AF_INET ) { 174 if (ret == 0) {
147 ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL); 175 if (canonicalize_unc(cp))
148 } else if ( address_family == AF_INET6 ) { 176 ret = in4_pton(cp, -1, dst, '\\', NULL);
177 }
178 } else if (address_family == AF_INET6) {
149 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); 179 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
150 } 180 }
151#ifdef CONFIG_CIFS_DEBUG2 181#ifdef CONFIG_CIFS_DEBUG2
@@ -740,7 +770,7 @@ cifs_print_status(__u32 status_code)
740 770
741 771
742static void 772static void
743ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode) 773ntstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode)
744{ 774{
745 int i; 775 int i;
746 if (ntstatus == 0) { 776 if (ntstatus == 0) {
@@ -793,8 +823,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
793 if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */ 823 if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */
794 for (i = 0; 824 for (i = 0;
795 i < 825 i <
796 sizeof (mapping_table_ERRDOS) / 826 sizeof(mapping_table_ERRDOS) /
797 sizeof (struct smb_to_posix_error); i++) { 827 sizeof(struct smb_to_posix_error); i++) {
798 if (mapping_table_ERRDOS[i].smb_err == 0) 828 if (mapping_table_ERRDOS[i].smb_err == 0)
799 break; 829 break;
800 else if (mapping_table_ERRDOS[i].smb_err == 830 else if (mapping_table_ERRDOS[i].smb_err ==
@@ -807,8 +837,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
807 } else if (smberrclass == ERRSRV) { /* server class of error codes */ 837 } else if (smberrclass == ERRSRV) { /* server class of error codes */
808 for (i = 0; 838 for (i = 0;
809 i < 839 i <
810 sizeof (mapping_table_ERRSRV) / 840 sizeof(mapping_table_ERRSRV) /
811 sizeof (struct smb_to_posix_error); i++) { 841 sizeof(struct smb_to_posix_error); i++) {
812 if (mapping_table_ERRSRV[i].smb_err == 0) 842 if (mapping_table_ERRSRV[i].smb_err == 0)
813 break; 843 break;
814 else if (mapping_table_ERRSRV[i].smb_err == 844 else if (mapping_table_ERRSRV[i].smb_err ==
@@ -837,14 +867,14 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
837unsigned int 867unsigned int
838smbCalcSize(struct smb_hdr *ptr) 868smbCalcSize(struct smb_hdr *ptr)
839{ 869{
840 return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) + 870 return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
841 2 /* size of the bcc field */ + BCC(ptr)); 871 2 /* size of the bcc field */ + BCC(ptr));
842} 872}
843 873
844unsigned int 874unsigned int
845smbCalcSize_LE(struct smb_hdr *ptr) 875smbCalcSize_LE(struct smb_hdr *ptr)
846{ 876{
847 return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) + 877 return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
848 2 /* size of the bcc field */ + le16_to_cpu(BCC_LE(ptr))); 878 2 /* size of the bcc field */ + le16_to_cpu(BCC_LE(ptr)));
849} 879}
850 880
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 3746580e9701..0f22def4bdff 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -171,7 +171,13 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
171 /* Linux can not store file creation time unfortunately so ignore it */ 171 /* Linux can not store file creation time unfortunately so ignore it */
172 172
173 cifsInfo->cifsAttrs = attr; 173 cifsInfo->cifsAttrs = attr;
174 cifsInfo->time = jiffies; 174#ifdef CONFIG_CIFS_EXPERIMENTAL
175 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
176 /* get more accurate mode via ACL - so force inode refresh */
177 cifsInfo->time = 0;
178 } else
179#endif /* CONFIG_CIFS_EXPERIMENTAL */
180 cifsInfo->time = jiffies;
175 181
176 /* treat dos attribute of read-only as read-only mode bit e.g. 555? */ 182 /* treat dos attribute of read-only as read-only mode bit e.g. 555? */
177 /* 2767 perms - indicate mandatory locking */ 183 /* 2767 perms - indicate mandatory locking */
@@ -495,7 +501,7 @@ ffirst_retry:
495static int cifs_unicode_bytelen(char *str) 501static int cifs_unicode_bytelen(char *str)
496{ 502{
497 int len; 503 int len;
498 __le16 * ustr = (__le16 *)str; 504 __le16 *ustr = (__le16 *)str;
499 505
500 for (len = 0; len <= PATH_MAX; len++) { 506 for (len = 0; len <= PATH_MAX; len++) {
501 if (ustr[len] == 0) 507 if (ustr[len] == 0)
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 899dc6078d9a..d0cb469daab7 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -29,6 +29,7 @@
29#include "ntlmssp.h" 29#include "ntlmssp.h"
30#include "nterr.h" 30#include "nterr.h"
31#include <linux/utsname.h> 31#include <linux/utsname.h>
32#include "cifs_spnego.h"
32 33
33extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, 34extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
34 unsigned char *p24); 35 unsigned char *p24);
@@ -340,11 +341,12 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
340 SESSION_SETUP_ANDX *pSMB; 341 SESSION_SETUP_ANDX *pSMB;
341 __u32 capabilities; 342 __u32 capabilities;
342 int count; 343 int count;
343 int resp_buf_type = 0; 344 int resp_buf_type;
344 struct kvec iov[2]; 345 struct kvec iov[3];
345 enum securityEnum type; 346 enum securityEnum type;
346 __u16 action; 347 __u16 action;
347 int bytes_remaining; 348 int bytes_remaining;
349 struct key *spnego_key = NULL;
348 350
349 if (ses == NULL) 351 if (ses == NULL)
350 return -EINVAL; 352 return -EINVAL;
@@ -377,24 +379,32 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
377 379
378 capabilities = cifs_ssetup_hdr(ses, pSMB); 380 capabilities = cifs_ssetup_hdr(ses, pSMB);
379 381
380 /* we will send the SMB in two pieces, 382 /* we will send the SMB in three pieces:
381 a fixed length beginning part, and a 383 a fixed length beginning part, an optional
382 second part which will include the strings 384 SPNEGO blob (which can be zero length), and a
383 and rest of bcc area, in order to avoid having 385 last part which will include the strings
384 to do a large buffer 17K allocation */ 386 and rest of bcc area. This allows us to avoid
387 a large buffer 17K allocation */
385 iov[0].iov_base = (char *)pSMB; 388 iov[0].iov_base = (char *)pSMB;
386 iov[0].iov_len = smb_buf->smb_buf_length + 4; 389 iov[0].iov_len = smb_buf->smb_buf_length + 4;
387 390
391 /* setting this here allows the code at the end of the function
392 to free the request buffer if there's an error */
393 resp_buf_type = CIFS_SMALL_BUFFER;
394
388 /* 2000 big enough to fit max user, domain, NOS name etc. */ 395 /* 2000 big enough to fit max user, domain, NOS name etc. */
389 str_area = kmalloc(2000, GFP_KERNEL); 396 str_area = kmalloc(2000, GFP_KERNEL);
390 if (str_area == NULL) { 397 if (str_area == NULL) {
391 cifs_small_buf_release(smb_buf); 398 rc = -ENOMEM;
392 return -ENOMEM; 399 goto ssetup_exit;
393 } 400 }
394 bcc_ptr = str_area; 401 bcc_ptr = str_area;
395 402
396 ses->flags &= ~CIFS_SES_LANMAN; 403 ses->flags &= ~CIFS_SES_LANMAN;
397 404
405 iov[1].iov_base = NULL;
406 iov[1].iov_len = 0;
407
398 if (type == LANMAN) { 408 if (type == LANMAN) {
399#ifdef CONFIG_CIFS_WEAK_PW_HASH 409#ifdef CONFIG_CIFS_WEAK_PW_HASH
400 char lnm_session_key[CIFS_SESS_KEY_SIZE]; 410 char lnm_session_key[CIFS_SESS_KEY_SIZE];
@@ -463,8 +473,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
463 struct ntlmv2_resp */ 473 struct ntlmv2_resp */
464 474
465 if (v2_sess_key == NULL) { 475 if (v2_sess_key == NULL) {
466 cifs_small_buf_release(smb_buf); 476 rc = -ENOMEM;
467 return -ENOMEM; 477 goto ssetup_exit;
468 } 478 }
469 479
470 pSMB->req_no_secext.Capabilities = cpu_to_le32(capabilities); 480 pSMB->req_no_secext.Capabilities = cpu_to_le32(capabilities);
@@ -499,22 +509,67 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
499 unicode_ssetup_strings(&bcc_ptr, ses, nls_cp); 509 unicode_ssetup_strings(&bcc_ptr, ses, nls_cp);
500 } else 510 } else
501 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); 511 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
502 } else /* NTLMSSP or SPNEGO */ { 512 } else if (type == Kerberos) {
513#ifdef CONFIG_CIFS_UPCALL
514 struct cifs_spnego_msg *msg;
515 spnego_key = cifs_get_spnego_key(ses);
516 if (IS_ERR(spnego_key)) {
517 rc = PTR_ERR(spnego_key);
518 spnego_key = NULL;
519 goto ssetup_exit;
520 }
521
522 msg = spnego_key->payload.data;
523 /* bail out if key is too long */
524 if (msg->sesskey_len >
525 sizeof(ses->server->mac_signing_key.data.krb5)) {
526 cERROR(1, ("Kerberos signing key too long (%u bytes)",
527 msg->sesskey_len));
528 rc = -EOVERFLOW;
529 goto ssetup_exit;
530 }
531 ses->server->mac_signing_key.len = msg->sesskey_len;
532 memcpy(ses->server->mac_signing_key.data.krb5, msg->data,
533 msg->sesskey_len);
503 pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; 534 pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
504 capabilities |= CAP_EXTENDED_SECURITY; 535 capabilities |= CAP_EXTENDED_SECURITY;
505 pSMB->req.Capabilities = cpu_to_le32(capabilities); 536 pSMB->req.Capabilities = cpu_to_le32(capabilities);
506 /* BB set password lengths */ 537 iov[1].iov_base = msg->data + msg->sesskey_len;
538 iov[1].iov_len = msg->secblob_len;
539 pSMB->req.SecurityBlobLength = cpu_to_le16(iov[1].iov_len);
540
541 if (ses->capabilities & CAP_UNICODE) {
542 /* unicode strings must be word aligned */
543 if (iov[0].iov_len % 2) {
544 *bcc_ptr = 0;
545 bcc_ptr++;
546 }
547 unicode_oslm_strings(&bcc_ptr, nls_cp);
548 unicode_domain_string(&bcc_ptr, ses, nls_cp);
549 } else
550 /* BB: is this right? */
551 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
552#else /* ! CONFIG_CIFS_UPCALL */
553 cERROR(1, ("Kerberos negotiated but upcall support disabled!"));
554 rc = -ENOSYS;
555 goto ssetup_exit;
556#endif /* CONFIG_CIFS_UPCALL */
557 } else {
558 cERROR(1, ("secType %d not supported!", type));
559 rc = -ENOSYS;
560 goto ssetup_exit;
507 } 561 }
508 562
509 count = (long) bcc_ptr - (long) str_area; 563 iov[2].iov_base = str_area;
564 iov[2].iov_len = (long) bcc_ptr - (long) str_area;
565
566 count = iov[1].iov_len + iov[2].iov_len;
510 smb_buf->smb_buf_length += count; 567 smb_buf->smb_buf_length += count;
511 568
512 BCC_LE(smb_buf) = cpu_to_le16(count); 569 BCC_LE(smb_buf) = cpu_to_le16(count);
513 570
514 iov[1].iov_base = str_area; 571 rc = SendReceive2(xid, ses, iov, 3 /* num_iovecs */, &resp_buf_type,
515 iov[1].iov_len = count; 572 CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR);
516 rc = SendReceive2(xid, ses, iov, 2 /* num_iovecs */, &resp_buf_type,
517 0 /* not long op */, 1 /* log NT STATUS if any */ );
518 /* SMB request buf freed in SendReceive2 */ 573 /* SMB request buf freed in SendReceive2 */
519 574
520 cFYI(1, ("ssetup rc from sendrecv2 is %d", rc)); 575 cFYI(1, ("ssetup rc from sendrecv2 is %d", rc));
@@ -560,6 +615,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
560 ses, nls_cp); 615 ses, nls_cp);
561 616
562ssetup_exit: 617ssetup_exit:
618 if (spnego_key)
619 key_put(spnego_key);
563 kfree(str_area); 620 kfree(str_area);
564 if (resp_buf_type == CIFS_SMALL_BUFFER) { 621 if (resp_buf_type == CIFS_SMALL_BUFFER) {
565 cFYI(1, ("ssetup freeing small buf %p", iov[0].iov_base)); 622 cFYI(1, ("ssetup freeing small buf %p", iov[0].iov_base));
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
index 90542a39be17..58bbfd992cc0 100644
--- a/fs/cifs/smbencrypt.c
+++ b/fs/cifs/smbencrypt.c
@@ -80,7 +80,7 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
80 80
81/* Routines for Windows NT MD4 Hash functions. */ 81/* Routines for Windows NT MD4 Hash functions. */
82static int 82static int
83_my_wcslen(__u16 * str) 83_my_wcslen(__u16 *str)
84{ 84{
85 int len = 0; 85 int len = 0;
86 while (*str++ != 0) 86 while (*str++ != 0)
@@ -96,7 +96,7 @@ _my_wcslen(__u16 * str)
96 */ 96 */
97 97
98static int 98static int
99_my_mbstowcs(__u16 * dst, const unsigned char *src, int len) 99_my_mbstowcs(__u16 *dst, const unsigned char *src, int len)
100{ /* BB not a very good conversion routine - change/fix */ 100{ /* BB not a very good conversion routine - change/fix */
101 int i; 101 int i;
102 __u16 val; 102 __u16 val;
@@ -125,9 +125,9 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
125 /* Password cannot be longer than 128 characters */ 125 /* Password cannot be longer than 128 characters */
126 if (passwd) { 126 if (passwd) {
127 len = strlen((char *) passwd); 127 len = strlen((char *) passwd);
128 if (len > 128) { 128 if (len > 128)
129 len = 128; 129 len = 128;
130 } 130
131 /* Password must be converted to NT unicode */ 131 /* Password must be converted to NT unicode */
132 _my_mbstowcs(wpwd, passwd, len); 132 _my_mbstowcs(wpwd, passwd, len);
133 } else 133 } else
@@ -135,7 +135,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
135 135
136 wpwd[len] = 0; /* Ensure string is null terminated */ 136 wpwd[len] = 0; /* Ensure string is null terminated */
137 /* Calculate length in bytes */ 137 /* Calculate length in bytes */
138 len = _my_wcslen(wpwd) * sizeof (__u16); 138 len = _my_wcslen(wpwd) * sizeof(__u16);
139 139
140 mdfour(p16, (unsigned char *) wpwd, len); 140 mdfour(p16, (unsigned char *) wpwd, len);
141 memset(wpwd, 0, 129 * 2); 141 memset(wpwd, 0, 129 * 2);
@@ -167,7 +167,7 @@ nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16])
167 E_P16((unsigned char *) passwd, (unsigned char *) p16); 167 E_P16((unsigned char *) passwd, (unsigned char *) p16);
168 168
169 /* clear out local copy of user's password (just being paranoid). */ 169 /* clear out local copy of user's password (just being paranoid). */
170 memset(passwd, '\0', sizeof (passwd)); 170 memset(passwd, '\0', sizeof(passwd));
171} 171}
172#endif 172#endif
173 173
@@ -189,8 +189,10 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
189 return; 189 return;
190 dom_u = user_u + 1024; 190 dom_u = user_u + 1024;
191 191
192 /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); 192 /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2,
193 push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */ 193 STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER);
194 push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2,
195 STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */
194 196
195 /* BB user and domain may need to be uppercased */ 197 /* BB user and domain may need to be uppercased */
196 user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage); 198 user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage);
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 7ed32b3cb781..50b623ad9320 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -308,7 +308,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
308 308
309static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op) 309static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
310{ 310{
311 if (long_op == -1) { 311 if (long_op == CIFS_ASYNC_OP) {
312 /* oplock breaks must not be held up */ 312 /* oplock breaks must not be held up */
313 atomic_inc(&ses->server->inFlight); 313 atomic_inc(&ses->server->inFlight);
314 } else { 314 } else {
@@ -337,7 +337,7 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
337 as they are allowed to block on server */ 337 as they are allowed to block on server */
338 338
339 /* update # of requests on the wire to server */ 339 /* update # of requests on the wire to server */
340 if (long_op < 3) 340 if (long_op != CIFS_BLOCKING_OP)
341 atomic_inc(&ses->server->inFlight); 341 atomic_inc(&ses->server->inFlight);
342 spin_unlock(&GlobalMid_Lock); 342 spin_unlock(&GlobalMid_Lock);
343 break; 343 break;
@@ -415,17 +415,48 @@ static int wait_for_response(struct cifsSesInfo *ses,
415 } 415 }
416} 416}
417 417
418
419/*
420 *
421 * Send an SMB Request. No response info (other than return code)
422 * needs to be parsed.
423 *
424 * flags indicate the type of request buffer and how long to wait
425 * and whether to log NT STATUS code (error) before mapping it to POSIX error
426 *
427 */
428int
429SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
430 struct smb_hdr *in_buf, int flags)
431{
432 int rc;
433 struct kvec iov[1];
434 int resp_buf_type;
435
436 iov[0].iov_base = (char *)in_buf;
437 iov[0].iov_len = in_buf->smb_buf_length + 4;
438 flags |= CIFS_NO_RESP;
439 rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags);
440#ifdef CONFIG_CIFS_DEBUG2
441 cFYI(1, ("SendRcvNoR flags %d rc %d", flags, rc));
442#endif
443 return rc;
444}
445
418int 446int
419SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, 447SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
420 struct kvec *iov, int n_vec, int *pRespBufType /* ret */, 448 struct kvec *iov, int n_vec, int *pRespBufType /* ret */,
421 const int long_op, const int logError) 449 const int flags)
422{ 450{
423 int rc = 0; 451 int rc = 0;
452 int long_op;
424 unsigned int receive_len; 453 unsigned int receive_len;
425 unsigned long timeout; 454 unsigned long timeout;
426 struct mid_q_entry *midQ; 455 struct mid_q_entry *midQ;
427 struct smb_hdr *in_buf = iov[0].iov_base; 456 struct smb_hdr *in_buf = iov[0].iov_base;
428 457
458 long_op = flags & CIFS_TIMEOUT_MASK;
459
429 *pRespBufType = CIFS_NO_BUFFER; /* no response buf yet */ 460 *pRespBufType = CIFS_NO_BUFFER; /* no response buf yet */
430 461
431 if ((ses == NULL) || (ses->server == NULL)) { 462 if ((ses == NULL) || (ses->server == NULL)) {
@@ -483,15 +514,22 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
483 if (rc < 0) 514 if (rc < 0)
484 goto out; 515 goto out;
485 516
486 if (long_op == -1) 517 if (long_op == CIFS_STD_OP)
487 goto out; 518 timeout = 15 * HZ;
488 else if (long_op == 2) /* writes past end of file can take loong time */ 519 else if (long_op == CIFS_VLONG_OP) /* e.g. slow writes past EOF */
489 timeout = 180 * HZ; 520 timeout = 180 * HZ;
490 else if (long_op == 1) 521 else if (long_op == CIFS_LONG_OP)
491 timeout = 45 * HZ; /* should be greater than 522 timeout = 45 * HZ; /* should be greater than
492 servers oplock break timeout (about 43 seconds) */ 523 servers oplock break timeout (about 43 seconds) */
493 else 524 else if (long_op == CIFS_ASYNC_OP)
494 timeout = 15 * HZ; 525 goto out;
526 else if (long_op == CIFS_BLOCKING_OP)
527 timeout = 0x7FFFFFFF; /* large, but not so large as to wrap */
528 else {
529 cERROR(1, ("unknown timeout flag %d", long_op));
530 rc = -EIO;
531 goto out;
532 }
495 533
496 /* wait for 15 seconds or until woken up due to response arriving or 534 /* wait for 15 seconds or until woken up due to response arriving or
497 due to last connection to this server being unmounted */ 535 due to last connection to this server being unmounted */
@@ -566,7 +604,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
566 } 604 }
567 605
568 /* BB special case reconnect tid and uid here? */ 606 /* BB special case reconnect tid and uid here? */
569 rc = map_smb_to_linux_error(midQ->resp_buf, logError); 607 rc = map_smb_to_linux_error(midQ->resp_buf,
608 flags & CIFS_LOG_ERROR);
570 609
571 /* convert ByteCount if necessary */ 610 /* convert ByteCount if necessary */
572 if (receive_len >= sizeof(struct smb_hdr) - 4 611 if (receive_len >= sizeof(struct smb_hdr) - 4
@@ -574,8 +613,10 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
574 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) 613 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ )
575 BCC(midQ->resp_buf) = 614 BCC(midQ->resp_buf) =
576 le16_to_cpu(BCC_LE(midQ->resp_buf)); 615 le16_to_cpu(BCC_LE(midQ->resp_buf));
577 midQ->resp_buf = NULL; /* mark it so will not be freed 616 if ((flags & CIFS_NO_RESP) == 0)
578 by DeleteMidQEntry */ 617 midQ->resp_buf = NULL; /* mark it so buf will
618 not be freed by
619 DeleteMidQEntry */
579 } else { 620 } else {
580 rc = -EIO; 621 rc = -EIO;
581 cFYI(1, ("Bad MID state?")); 622 cFYI(1, ("Bad MID state?"));
@@ -663,17 +704,25 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
663 if (rc < 0) 704 if (rc < 0)
664 goto out; 705 goto out;
665 706
666 if (long_op == -1) 707 if (long_op == CIFS_STD_OP)
708 timeout = 15 * HZ;
709 /* wait for 15 seconds or until woken up due to response arriving or
710 due to last connection to this server being unmounted */
711 else if (long_op == CIFS_ASYNC_OP)
667 goto out; 712 goto out;
668 else if (long_op == 2) /* writes past end of file can take loong time */ 713 else if (long_op == CIFS_VLONG_OP) /* writes past EOF can be slow */
669 timeout = 180 * HZ; 714 timeout = 180 * HZ;
670 else if (long_op == 1) 715 else if (long_op == CIFS_LONG_OP)
671 timeout = 45 * HZ; /* should be greater than 716 timeout = 45 * HZ; /* should be greater than
672 servers oplock break timeout (about 43 seconds) */ 717 servers oplock break timeout (about 43 seconds) */
673 else 718 else if (long_op == CIFS_BLOCKING_OP)
674 timeout = 15 * HZ; 719 timeout = 0x7FFFFFFF; /* large but no so large as to wrap */
675 /* wait for 15 seconds or until woken up due to response arriving or 720 else {
676 due to last connection to this server being unmounted */ 721 cERROR(1, ("unknown timeout flag %d", long_op));
722 rc = -EIO;
723 goto out;
724 }
725
677 if (signal_pending(current)) { 726 if (signal_pending(current)) {
678 /* if signal pending do not hold up user for full smb timeout 727 /* if signal pending do not hold up user for full smb timeout
679 but we still give response a chance to complete */ 728 but we still give response a chance to complete */
@@ -812,7 +861,7 @@ send_lock_cancel(const unsigned int xid, struct cifsTconInfo *tcon,
812 pSMB->hdr.Mid = GetNextMid(ses->server); 861 pSMB->hdr.Mid = GetNextMid(ses->server);
813 862
814 return SendReceive(xid, ses, in_buf, out_buf, 863 return SendReceive(xid, ses, in_buf, out_buf,
815 &bytes_returned, 0); 864 &bytes_returned, CIFS_STD_OP);
816} 865}
817 866
818int 867int
@@ -844,7 +893,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
844 to the same server. We may make this configurable later or 893 to the same server. We may make this configurable later or
845 use ses->maxReq */ 894 use ses->maxReq */
846 895
847 rc = wait_for_free_request(ses, 3); 896 rc = wait_for_free_request(ses, CIFS_BLOCKING_OP);
848 if (rc) 897 if (rc)
849 return rc; 898 return rc;
850 899
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 369e838bebd3..54e8ef96cb79 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -265,7 +265,9 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
265 else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { 265 else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
266 __u16 fid; 266 __u16 fid;
267 int oplock = FALSE; 267 int oplock = FALSE;
268 if (experimEnabled) 268 struct cifs_ntsd *pacl = NULL;
269 __u32 buflen = 0;
270 if (experimEnabled)
269 rc = CIFSSMBOpen(xid, pTcon, full_path, 271 rc = CIFSSMBOpen(xid, pTcon, full_path,
270 FILE_OPEN, GENERIC_READ, 0, &fid, 272 FILE_OPEN, GENERIC_READ, 0, &fid,
271 &oplock, NULL, cifs_sb->local_nls, 273 &oplock, NULL, cifs_sb->local_nls,
@@ -273,10 +275,9 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
273 CIFS_MOUNT_MAP_SPECIAL_CHR); 275 CIFS_MOUNT_MAP_SPECIAL_CHR);
274 /* else rc is EOPNOTSUPP from above */ 276 /* else rc is EOPNOTSUPP from above */
275 277
276 if(rc == 0) { 278 if (rc == 0) {
277 rc = CIFSSMBGetCIFSACL(xid, pTcon, fid, 279 rc = CIFSSMBGetCIFSACL(xid, pTcon, fid, &pacl,
278 ea_value, buf_size, 280 &buflen);
279 ACL_TYPE_ACCESS);
280 CIFSSMBClose(xid, pTcon, fid); 281 CIFSSMBClose(xid, pTcon, fid);
281 } 282 }
282 } 283 }
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/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 58bf3f5cdbe2..e9923ca9c2d9 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1062,7 +1062,7 @@ static int sctp_listen_for_all(void)
1062 subscribe.sctp_shutdown_event = 1; 1062 subscribe.sctp_shutdown_event = 1;
1063 subscribe.sctp_partial_delivery_event = 1; 1063 subscribe.sctp_partial_delivery_event = 1;
1064 1064
1065 result = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF, 1065 result = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE,
1066 (char *)&bufsize, sizeof(bufsize)); 1066 (char *)&bufsize, sizeof(bufsize));
1067 if (result) 1067 if (result)
1068 log_print("Error increasing buffer space on socket %d", result); 1068 log_print("Error increasing buffer space on socket %d", result);
@@ -1454,10 +1454,6 @@ int dlm_lowcomms_start(void)
1454 if (!con_cache) 1454 if (!con_cache)
1455 goto out; 1455 goto out;
1456 1456
1457 /* Set some sysctl minima */
1458 if (sysctl_rmem_max < NEEDED_RMEM)
1459 sysctl_rmem_max = NEEDED_RMEM;
1460
1461 /* Start listening */ 1457 /* Start listening */
1462 if (dlm_config.ci_protocol == 0) 1458 if (dlm_config.ci_protocol == 0)
1463 error = tcp_listen_for_all(); 1459 error = tcp_listen_for_all();
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 9d70289f7df3..bbed2fd40fdc 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -115,11 +115,29 @@ static int ecryptfs_calculate_md5(char *dst,
115 } 115 }
116 crypt_stat->hash_tfm = desc.tfm; 116 crypt_stat->hash_tfm = desc.tfm;
117 } 117 }
118 crypto_hash_init(&desc); 118 rc = crypto_hash_init(&desc);
119 crypto_hash_update(&desc, &sg, len); 119 if (rc) {
120 crypto_hash_final(&desc, dst); 120 printk(KERN_ERR
121 mutex_unlock(&crypt_stat->cs_hash_tfm_mutex); 121 "%s: Error initializing crypto hash; rc = [%d]\n",
122 __FUNCTION__, rc);
123 goto out;
124 }
125 rc = crypto_hash_update(&desc, &sg, len);
126 if (rc) {
127 printk(KERN_ERR
128 "%s: Error updating crypto hash; rc = [%d]\n",
129 __FUNCTION__, rc);
130 goto out;
131 }
132 rc = crypto_hash_final(&desc, dst);
133 if (rc) {
134 printk(KERN_ERR
135 "%s: Error finalizing crypto hash; rc = [%d]\n",
136 __FUNCTION__, rc);
137 goto out;
138 }
122out: 139out:
140 mutex_unlock(&crypt_stat->cs_hash_tfm_mutex);
123 return rc; 141 return rc;
124} 142}
125 143
@@ -504,7 +522,6 @@ int ecryptfs_encrypt_page(struct page *page)
504 "\n", rc); 522 "\n", rc);
505 goto out; 523 goto out;
506 } 524 }
507 extent_offset++;
508 } 525 }
509out: 526out:
510 kfree(enc_extent_virt); 527 kfree(enc_extent_virt);
@@ -640,7 +657,6 @@ int ecryptfs_decrypt_page(struct page *page)
640 "rc = [%d]\n", __FUNCTION__, rc); 657 "rc = [%d]\n", __FUNCTION__, rc);
641 goto out; 658 goto out;
642 } 659 }
643 extent_offset++;
644 } 660 }
645out: 661out:
646 kfree(enc_extent_virt); 662 kfree(enc_extent_virt);
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
index 2150edf9a58e..6b7474a4336a 100644
--- a/fs/ecryptfs/read_write.c
+++ b/fs/ecryptfs/read_write.c
@@ -87,7 +87,7 @@ int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode,
87 loff_t offset; 87 loff_t offset;
88 int rc; 88 int rc;
89 89
90 offset = ((((off_t)page_for_lower->index) << PAGE_CACHE_SHIFT) 90 offset = ((((loff_t)page_for_lower->index) << PAGE_CACHE_SHIFT)
91 + offset_in_page); 91 + offset_in_page);
92 virt = kmap(page_for_lower); 92 virt = kmap(page_for_lower);
93 rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size); 93 rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size);
diff --git a/fs/exec.c b/fs/exec.c
index 2c942e2d14ea..4ccaaa4b13b2 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1692,7 +1692,10 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1692 if (!binfmt || !binfmt->core_dump) 1692 if (!binfmt || !binfmt->core_dump)
1693 goto fail; 1693 goto fail;
1694 down_write(&mm->mmap_sem); 1694 down_write(&mm->mmap_sem);
1695 if (!get_dumpable(mm)) { 1695 /*
1696 * If another thread got here first, or we are not dumpable, bail out.
1697 */
1698 if (mm->core_waiters || !get_dumpable(mm)) {
1696 up_write(&mm->mmap_sem); 1699 up_write(&mm->mmap_sem);
1697 goto fail; 1700 goto fail;
1698 } 1701 }
@@ -1706,7 +1709,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1706 flag = O_EXCL; /* Stop rewrite attacks */ 1709 flag = O_EXCL; /* Stop rewrite attacks */
1707 current->fsuid = 0; /* Dump root private */ 1710 current->fsuid = 0; /* Dump root private */
1708 } 1711 }
1709 set_dumpable(mm, 0);
1710 1712
1711 retval = coredump_wait(exit_code); 1713 retval = coredump_wait(exit_code);
1712 if (retval < 0) 1714 if (retval < 0)
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 18a42de25b55..377ad172d74b 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -69,14 +69,6 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
69 return desc + offset; 69 return desc + offset;
70} 70}
71 71
72static inline int
73block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
74{
75 return ext2_test_bit ((block -
76 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block)) %
77 EXT2_BLOCKS_PER_GROUP(sb), map);
78}
79
80/* 72/*
81 * Read the bitmap for a given block_group, reading into the specified 73 * Read the bitmap for a given block_group, reading into the specified
82 * slot in the superblock's bitmap cache. 74 * slot in the superblock's bitmap cache.
@@ -86,51 +78,20 @@ block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
86static struct buffer_head * 78static struct buffer_head *
87read_block_bitmap(struct super_block *sb, unsigned int block_group) 79read_block_bitmap(struct super_block *sb, unsigned int block_group)
88{ 80{
89 int i;
90 struct ext2_group_desc * desc; 81 struct ext2_group_desc * desc;
91 struct buffer_head * bh = NULL; 82 struct buffer_head * bh = NULL;
92 unsigned int bitmap_blk; 83
93
94 desc = ext2_get_group_desc (sb, block_group, NULL); 84 desc = ext2_get_group_desc (sb, block_group, NULL);
95 if (!desc) 85 if (!desc)
96 return NULL; 86 goto error_out;
97 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); 87 bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap));
98 bh = sb_bread(sb, bitmap_blk);
99 if (!bh) 88 if (!bh)
100 ext2_error (sb, __FUNCTION__, 89 ext2_error (sb, "read_block_bitmap",
101 "Cannot read block bitmap - " 90 "Cannot read block bitmap - "
102 "block_group = %d, block_bitmap = %u", 91 "block_group = %d, block_bitmap = %u",
103 block_group, le32_to_cpu(desc->bg_block_bitmap)); 92 block_group, le32_to_cpu(desc->bg_block_bitmap));
104
105 /* check whether block bitmap block number is set */
106 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
107 /* bad block bitmap */
108 goto error_out;
109 }
110 /* check whether the inode bitmap block number is set */
111 bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
112 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
113 /* bad block bitmap */
114 goto error_out;
115 }
116 /* check whether the inode table block number is set */
117 bitmap_blk = le32_to_cpu(desc->bg_inode_table);
118 for (i = 0; i < EXT2_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
119 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
120 /* bad block bitmap */
121 goto error_out;
122 }
123 }
124
125 return bh;
126
127error_out: 93error_out:
128 brelse(bh); 94 return bh;
129 ext2_error(sb, __FUNCTION__,
130 "Invalid block bitmap - "
131 "block_group = %d, block = %u",
132 block_group, bitmap_blk);
133 return NULL;
134} 95}
135 96
136static void release_blocks(struct super_block *sb, int count) 97static void release_blocks(struct super_block *sb, int count)
@@ -1461,7 +1422,6 @@ unsigned long ext2_count_free_blocks (struct super_block * sb)
1461#endif 1422#endif
1462} 1423}
1463 1424
1464
1465static inline int test_root(int a, int b) 1425static inline int test_root(int a, int b)
1466{ 1426{
1467 int num = b; 1427 int num = b;
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index c2324d5fe4ac..320b2cb3d4d2 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -47,6 +47,11 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
47 flags &= ~EXT2_DIRSYNC_FL; 47 flags &= ~EXT2_DIRSYNC_FL;
48 48
49 mutex_lock(&inode->i_mutex); 49 mutex_lock(&inode->i_mutex);
50 /* Is it quota file? Do not allow user to mess with it */
51 if (IS_NOQUOTA(inode)) {
52 mutex_unlock(&inode->i_mutex);
53 return -EPERM;
54 }
50 oldflags = ei->i_flags; 55 oldflags = ei->i_flags;
51 56
52 /* 57 /*
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index 7a87d15523be..a8ba7e831278 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -80,14 +80,6 @@ struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
80 return desc + offset; 80 return desc + offset;
81} 81}
82 82
83static inline int
84block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map)
85{
86 return ext3_test_bit ((block -
87 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
88 EXT3_BLOCKS_PER_GROUP(sb), map);
89}
90
91/** 83/**
92 * read_block_bitmap() 84 * read_block_bitmap()
93 * @sb: super block 85 * @sb: super block
@@ -101,51 +93,20 @@ block_in_use(ext3_fsblk_t block, struct super_block *sb, unsigned char *map)
101static struct buffer_head * 93static struct buffer_head *
102read_block_bitmap(struct super_block *sb, unsigned int block_group) 94read_block_bitmap(struct super_block *sb, unsigned int block_group)
103{ 95{
104 int i;
105 struct ext3_group_desc * desc; 96 struct ext3_group_desc * desc;
106 struct buffer_head * bh = NULL; 97 struct buffer_head * bh = NULL;
107 ext3_fsblk_t bitmap_blk;
108 98
109 desc = ext3_get_group_desc (sb, block_group, NULL); 99 desc = ext3_get_group_desc (sb, block_group, NULL);
110 if (!desc) 100 if (!desc)
111 return NULL; 101 goto error_out;
112 bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); 102 bh = sb_bread(sb, le32_to_cpu(desc->bg_block_bitmap));
113 bh = sb_bread(sb, bitmap_blk);
114 if (!bh) 103 if (!bh)
115 ext3_error (sb, __FUNCTION__, 104 ext3_error (sb, "read_block_bitmap",
116 "Cannot read block bitmap - " 105 "Cannot read block bitmap - "
117 "block_group = %d, block_bitmap = %u", 106 "block_group = %d, block_bitmap = %u",
118 block_group, le32_to_cpu(desc->bg_block_bitmap)); 107 block_group, le32_to_cpu(desc->bg_block_bitmap));
119
120 /* check whether block bitmap block number is set */
121 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
122 /* bad block bitmap */
123 goto error_out;
124 }
125 /* check whether the inode bitmap block number is set */
126 bitmap_blk = le32_to_cpu(desc->bg_inode_bitmap);
127 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
128 /* bad block bitmap */
129 goto error_out;
130 }
131 /* check whether the inode table block number is set */
132 bitmap_blk = le32_to_cpu(desc->bg_inode_table);
133 for (i = 0; i < EXT3_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
134 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
135 /* bad block bitmap */
136 goto error_out;
137 }
138 }
139
140 return bh;
141
142error_out: 108error_out:
143 brelse(bh); 109 return bh;
144 ext3_error(sb, __FUNCTION__,
145 "Invalid block bitmap - "
146 "block_group = %d, block = %lu",
147 block_group, bitmap_blk);
148 return NULL;
149} 110}
150/* 111/*
151 * The reservation window structure operations 112 * The reservation window structure operations
@@ -1772,7 +1733,6 @@ ext3_fsblk_t ext3_count_free_blocks(struct super_block *sb)
1772#endif 1733#endif
1773} 1734}
1774 1735
1775
1776static inline int test_root(int a, int b) 1736static inline int test_root(int a, int b)
1777{ 1737{
1778 int num = b; 1738 int num = b;
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
index c8e4ee3af1d0..8ca3bfd72427 100644
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -67,7 +67,7 @@ int ext3_check_dir_entry (const char * function, struct inode * dir,
67 unsigned long offset) 67 unsigned long offset)
68{ 68{
69 const char * error_msg = NULL; 69 const char * error_msg = NULL;
70 const int rlen = le16_to_cpu(de->rec_len); 70 const int rlen = ext3_rec_len_from_disk(de->rec_len);
71 71
72 if (rlen < EXT3_DIR_REC_LEN(1)) 72 if (rlen < EXT3_DIR_REC_LEN(1))
73 error_msg = "rec_len is smaller than minimal"; 73 error_msg = "rec_len is smaller than minimal";
@@ -173,10 +173,10 @@ revalidate:
173 * least that it is non-zero. A 173 * least that it is non-zero. A
174 * failure will be detected in the 174 * failure will be detected in the
175 * dirent test below. */ 175 * dirent test below. */
176 if (le16_to_cpu(de->rec_len) < 176 if (ext3_rec_len_from_disk(de->rec_len) <
177 EXT3_DIR_REC_LEN(1)) 177 EXT3_DIR_REC_LEN(1))
178 break; 178 break;
179 i += le16_to_cpu(de->rec_len); 179 i += ext3_rec_len_from_disk(de->rec_len);
180 } 180 }
181 offset = i; 181 offset = i;
182 filp->f_pos = (filp->f_pos & ~(sb->s_blocksize - 1)) 182 filp->f_pos = (filp->f_pos & ~(sb->s_blocksize - 1))
@@ -197,7 +197,7 @@ revalidate:
197 ret = stored; 197 ret = stored;
198 goto out; 198 goto out;
199 } 199 }
200 offset += le16_to_cpu(de->rec_len); 200 offset += ext3_rec_len_from_disk(de->rec_len);
201 if (le32_to_cpu(de->inode)) { 201 if (le32_to_cpu(de->inode)) {
202 /* We might block in the next section 202 /* We might block in the next section
203 * if the data destination is 203 * if the data destination is
@@ -219,7 +219,7 @@ revalidate:
219 goto revalidate; 219 goto revalidate;
220 stored ++; 220 stored ++;
221 } 221 }
222 filp->f_pos += le16_to_cpu(de->rec_len); 222 filp->f_pos += ext3_rec_len_from_disk(de->rec_len);
223 } 223 }
224 offset = 0; 224 offset = 0;
225 brelse (bh); 225 brelse (bh);
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
index 4a2a02c95bf9..023a070f55f1 100644
--- a/fs/ext3/ioctl.c
+++ b/fs/ext3/ioctl.c
@@ -51,6 +51,11 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
51 flags &= ~EXT3_DIRSYNC_FL; 51 flags &= ~EXT3_DIRSYNC_FL;
52 52
53 mutex_lock(&inode->i_mutex); 53 mutex_lock(&inode->i_mutex);
54 /* Is it quota file? Do not allow user to mess with it */
55 if (IS_NOQUOTA(inode)) {
56 mutex_unlock(&inode->i_mutex);
57 return -EPERM;
58 }
54 oldflags = ei->i_flags; 59 oldflags = ei->i_flags;
55 60
56 /* The JOURNAL_DATA flag is modifiable only by root */ 61 /* The JOURNAL_DATA flag is modifiable only by root */
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index ec8170adac53..4ab6f76e63d0 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -177,6 +177,16 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
177 struct inode *inode); 177 struct inode *inode);
178 178
179/* 179/*
180 * p is at least 6 bytes before the end of page
181 */
182static inline struct ext3_dir_entry_2 *
183ext3_next_entry(struct ext3_dir_entry_2 *p)
184{
185 return (struct ext3_dir_entry_2 *)((char *)p +
186 ext3_rec_len_from_disk(p->rec_len));
187}
188
189/*
180 * Future: use high four bits of block for coalesce-on-delete flags 190 * Future: use high four bits of block for coalesce-on-delete flags
181 * Mask them off for now. 191 * Mask them off for now.
182 */ 192 */
@@ -280,7 +290,7 @@ static struct stats dx_show_leaf(struct dx_hash_info *hinfo, struct ext3_dir_ent
280 space += EXT3_DIR_REC_LEN(de->name_len); 290 space += EXT3_DIR_REC_LEN(de->name_len);
281 names++; 291 names++;
282 } 292 }
283 de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); 293 de = ext3_next_entry(de);
284 } 294 }
285 printk("(%i)\n", names); 295 printk("(%i)\n", names);
286 return (struct stats) { names, space, 1 }; 296 return (struct stats) { names, space, 1 };
@@ -547,14 +557,6 @@ static int ext3_htree_next_block(struct inode *dir, __u32 hash,
547 557
548 558
549/* 559/*
550 * p is at least 6 bytes before the end of page
551 */
552static inline struct ext3_dir_entry_2 *ext3_next_entry(struct ext3_dir_entry_2 *p)
553{
554 return (struct ext3_dir_entry_2 *)((char*)p + le16_to_cpu(p->rec_len));
555}
556
557/*
558 * This function fills a red-black tree with information from a 560 * This function fills a red-black tree with information from a
559 * directory block. It returns the number directory entries loaded 561 * directory block. It returns the number directory entries loaded
560 * into the tree. If there is an error it is returned in err. 562 * into the tree. If there is an error it is returned in err.
@@ -720,7 +722,7 @@ static int dx_make_map (struct ext3_dir_entry_2 *de, int size,
720 cond_resched(); 722 cond_resched();
721 } 723 }
722 /* XXX: do we need to check rec_len == 0 case? -Chris */ 724 /* XXX: do we need to check rec_len == 0 case? -Chris */
723 de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); 725 de = ext3_next_entry(de);
724 } 726 }
725 return count; 727 return count;
726} 728}
@@ -822,7 +824,7 @@ static inline int search_dirblock(struct buffer_head * bh,
822 return 1; 824 return 1;
823 } 825 }
824 /* prevent looping on a bad block */ 826 /* prevent looping on a bad block */
825 de_len = le16_to_cpu(de->rec_len); 827 de_len = ext3_rec_len_from_disk(de->rec_len);
826 if (de_len <= 0) 828 if (de_len <= 0)
827 return -1; 829 return -1;
828 offset += de_len; 830 offset += de_len;
@@ -1130,7 +1132,7 @@ dx_move_dirents(char *from, char *to, struct dx_map_entry *map, int count)
1130 rec_len = EXT3_DIR_REC_LEN(de->name_len); 1132 rec_len = EXT3_DIR_REC_LEN(de->name_len);
1131 memcpy (to, de, rec_len); 1133 memcpy (to, de, rec_len);
1132 ((struct ext3_dir_entry_2 *) to)->rec_len = 1134 ((struct ext3_dir_entry_2 *) to)->rec_len =
1133 cpu_to_le16(rec_len); 1135 ext3_rec_len_to_disk(rec_len);
1134 de->inode = 0; 1136 de->inode = 0;
1135 map++; 1137 map++;
1136 to += rec_len; 1138 to += rec_len;
@@ -1149,13 +1151,12 @@ static struct ext3_dir_entry_2* dx_pack_dirents(char *base, int size)
1149 1151
1150 prev = to = de; 1152 prev = to = de;
1151 while ((char*)de < base + size) { 1153 while ((char*)de < base + size) {
1152 next = (struct ext3_dir_entry_2 *) ((char *) de + 1154 next = ext3_next_entry(de);
1153 le16_to_cpu(de->rec_len));
1154 if (de->inode && de->name_len) { 1155 if (de->inode && de->name_len) {
1155 rec_len = EXT3_DIR_REC_LEN(de->name_len); 1156 rec_len = EXT3_DIR_REC_LEN(de->name_len);
1156 if (de > to) 1157 if (de > to)
1157 memmove(to, de, rec_len); 1158 memmove(to, de, rec_len);
1158 to->rec_len = cpu_to_le16(rec_len); 1159 to->rec_len = ext3_rec_len_to_disk(rec_len);
1159 prev = to; 1160 prev = to;
1160 to = (struct ext3_dir_entry_2 *) (((char *) to) + rec_len); 1161 to = (struct ext3_dir_entry_2 *) (((char *) to) + rec_len);
1161 } 1162 }
@@ -1229,8 +1230,8 @@ static struct ext3_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
1229 /* Fancy dance to stay within two buffers */ 1230 /* Fancy dance to stay within two buffers */
1230 de2 = dx_move_dirents(data1, data2, map + split, count - split); 1231 de2 = dx_move_dirents(data1, data2, map + split, count - split);
1231 de = dx_pack_dirents(data1,blocksize); 1232 de = dx_pack_dirents(data1,blocksize);
1232 de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de); 1233 de->rec_len = ext3_rec_len_to_disk(data1 + blocksize - (char *) de);
1233 de2->rec_len = cpu_to_le16(data2 + blocksize - (char *) de2); 1234 de2->rec_len = ext3_rec_len_to_disk(data2 + blocksize - (char *) de2);
1234 dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data1, blocksize, 1)); 1235 dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data1, blocksize, 1));
1235 dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data2, blocksize, 1)); 1236 dxtrace(dx_show_leaf (hinfo, (struct ext3_dir_entry_2 *) data2, blocksize, 1));
1236 1237
@@ -1300,7 +1301,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1300 return -EEXIST; 1301 return -EEXIST;
1301 } 1302 }
1302 nlen = EXT3_DIR_REC_LEN(de->name_len); 1303 nlen = EXT3_DIR_REC_LEN(de->name_len);
1303 rlen = le16_to_cpu(de->rec_len); 1304 rlen = ext3_rec_len_from_disk(de->rec_len);
1304 if ((de->inode? rlen - nlen: rlen) >= reclen) 1305 if ((de->inode? rlen - nlen: rlen) >= reclen)
1305 break; 1306 break;
1306 de = (struct ext3_dir_entry_2 *)((char *)de + rlen); 1307 de = (struct ext3_dir_entry_2 *)((char *)de + rlen);
@@ -1319,11 +1320,11 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1319 1320
1320 /* By now the buffer is marked for journaling */ 1321 /* By now the buffer is marked for journaling */
1321 nlen = EXT3_DIR_REC_LEN(de->name_len); 1322 nlen = EXT3_DIR_REC_LEN(de->name_len);
1322 rlen = le16_to_cpu(de->rec_len); 1323 rlen = ext3_rec_len_from_disk(de->rec_len);
1323 if (de->inode) { 1324 if (de->inode) {
1324 struct ext3_dir_entry_2 *de1 = (struct ext3_dir_entry_2 *)((char *)de + nlen); 1325 struct ext3_dir_entry_2 *de1 = (struct ext3_dir_entry_2 *)((char *)de + nlen);
1325 de1->rec_len = cpu_to_le16(rlen - nlen); 1326 de1->rec_len = ext3_rec_len_to_disk(rlen - nlen);
1326 de->rec_len = cpu_to_le16(nlen); 1327 de->rec_len = ext3_rec_len_to_disk(nlen);
1327 de = de1; 1328 de = de1;
1328 } 1329 }
1329 de->file_type = EXT3_FT_UNKNOWN; 1330 de->file_type = EXT3_FT_UNKNOWN;
@@ -1400,17 +1401,18 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1400 1401
1401 /* The 0th block becomes the root, move the dirents out */ 1402 /* The 0th block becomes the root, move the dirents out */
1402 fde = &root->dotdot; 1403 fde = &root->dotdot;
1403 de = (struct ext3_dir_entry_2 *)((char *)fde + le16_to_cpu(fde->rec_len)); 1404 de = (struct ext3_dir_entry_2 *)((char *)fde +
1405 ext3_rec_len_from_disk(fde->rec_len));
1404 len = ((char *) root) + blocksize - (char *) de; 1406 len = ((char *) root) + blocksize - (char *) de;
1405 memcpy (data1, de, len); 1407 memcpy (data1, de, len);
1406 de = (struct ext3_dir_entry_2 *) data1; 1408 de = (struct ext3_dir_entry_2 *) data1;
1407 top = data1 + len; 1409 top = data1 + len;
1408 while ((char *)(de2=(void*)de+le16_to_cpu(de->rec_len)) < top) 1410 while ((char *)(de2 = ext3_next_entry(de)) < top)
1409 de = de2; 1411 de = de2;
1410 de->rec_len = cpu_to_le16(data1 + blocksize - (char *) de); 1412 de->rec_len = ext3_rec_len_to_disk(data1 + blocksize - (char *) de);
1411 /* Initialize the root; the dot dirents already exist */ 1413 /* Initialize the root; the dot dirents already exist */
1412 de = (struct ext3_dir_entry_2 *) (&root->dotdot); 1414 de = (struct ext3_dir_entry_2 *) (&root->dotdot);
1413 de->rec_len = cpu_to_le16(blocksize - EXT3_DIR_REC_LEN(2)); 1415 de->rec_len = ext3_rec_len_to_disk(blocksize - EXT3_DIR_REC_LEN(2));
1414 memset (&root->info, 0, sizeof(root->info)); 1416 memset (&root->info, 0, sizeof(root->info));
1415 root->info.info_length = sizeof(root->info); 1417 root->info.info_length = sizeof(root->info);
1416 root->info.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; 1418 root->info.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version;
@@ -1490,7 +1492,7 @@ static int ext3_add_entry (handle_t *handle, struct dentry *dentry,
1490 return retval; 1492 return retval;
1491 de = (struct ext3_dir_entry_2 *) bh->b_data; 1493 de = (struct ext3_dir_entry_2 *) bh->b_data;
1492 de->inode = 0; 1494 de->inode = 0;
1493 de->rec_len = cpu_to_le16(blocksize); 1495 de->rec_len = ext3_rec_len_to_disk(blocksize);
1494 return add_dirent_to_buf(handle, dentry, inode, de, bh); 1496 return add_dirent_to_buf(handle, dentry, inode, de, bh);
1495} 1497}
1496 1498
@@ -1553,7 +1555,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
1553 goto cleanup; 1555 goto cleanup;
1554 node2 = (struct dx_node *)(bh2->b_data); 1556 node2 = (struct dx_node *)(bh2->b_data);
1555 entries2 = node2->entries; 1557 entries2 = node2->entries;
1556 node2->fake.rec_len = cpu_to_le16(sb->s_blocksize); 1558 node2->fake.rec_len = ext3_rec_len_to_disk(sb->s_blocksize);
1557 node2->fake.inode = 0; 1559 node2->fake.inode = 0;
1558 BUFFER_TRACE(frame->bh, "get_write_access"); 1560 BUFFER_TRACE(frame->bh, "get_write_access");
1559 err = ext3_journal_get_write_access(handle, frame->bh); 1561 err = ext3_journal_get_write_access(handle, frame->bh);
@@ -1651,9 +1653,9 @@ static int ext3_delete_entry (handle_t *handle,
1651 BUFFER_TRACE(bh, "get_write_access"); 1653 BUFFER_TRACE(bh, "get_write_access");
1652 ext3_journal_get_write_access(handle, bh); 1654 ext3_journal_get_write_access(handle, bh);
1653 if (pde) 1655 if (pde)
1654 pde->rec_len = 1656 pde->rec_len = ext3_rec_len_to_disk(
1655 cpu_to_le16(le16_to_cpu(pde->rec_len) + 1657 ext3_rec_len_from_disk(pde->rec_len) +
1656 le16_to_cpu(de->rec_len)); 1658 ext3_rec_len_from_disk(de->rec_len));
1657 else 1659 else
1658 de->inode = 0; 1660 de->inode = 0;
1659 dir->i_version++; 1661 dir->i_version++;
@@ -1661,10 +1663,9 @@ static int ext3_delete_entry (handle_t *handle,
1661 ext3_journal_dirty_metadata(handle, bh); 1663 ext3_journal_dirty_metadata(handle, bh);
1662 return 0; 1664 return 0;
1663 } 1665 }
1664 i += le16_to_cpu(de->rec_len); 1666 i += ext3_rec_len_from_disk(de->rec_len);
1665 pde = de; 1667 pde = de;
1666 de = (struct ext3_dir_entry_2 *) 1668 de = ext3_next_entry(de);
1667 ((char *) de + le16_to_cpu(de->rec_len));
1668 } 1669 }
1669 return -ENOENT; 1670 return -ENOENT;
1670} 1671}
@@ -1798,13 +1799,13 @@ retry:
1798 de = (struct ext3_dir_entry_2 *) dir_block->b_data; 1799 de = (struct ext3_dir_entry_2 *) dir_block->b_data;
1799 de->inode = cpu_to_le32(inode->i_ino); 1800 de->inode = cpu_to_le32(inode->i_ino);
1800 de->name_len = 1; 1801 de->name_len = 1;
1801 de->rec_len = cpu_to_le16(EXT3_DIR_REC_LEN(de->name_len)); 1802 de->rec_len = ext3_rec_len_to_disk(EXT3_DIR_REC_LEN(de->name_len));
1802 strcpy (de->name, "."); 1803 strcpy (de->name, ".");
1803 ext3_set_de_type(dir->i_sb, de, S_IFDIR); 1804 ext3_set_de_type(dir->i_sb, de, S_IFDIR);
1804 de = (struct ext3_dir_entry_2 *) 1805 de = ext3_next_entry(de);
1805 ((char *) de + le16_to_cpu(de->rec_len));
1806 de->inode = cpu_to_le32(dir->i_ino); 1806 de->inode = cpu_to_le32(dir->i_ino);
1807 de->rec_len = cpu_to_le16(inode->i_sb->s_blocksize-EXT3_DIR_REC_LEN(1)); 1807 de->rec_len = ext3_rec_len_to_disk(inode->i_sb->s_blocksize -
1808 EXT3_DIR_REC_LEN(1));
1808 de->name_len = 2; 1809 de->name_len = 2;
1809 strcpy (de->name, ".."); 1810 strcpy (de->name, "..");
1810 ext3_set_de_type(dir->i_sb, de, S_IFDIR); 1811 ext3_set_de_type(dir->i_sb, de, S_IFDIR);
@@ -1856,8 +1857,7 @@ static int empty_dir (struct inode * inode)
1856 return 1; 1857 return 1;
1857 } 1858 }
1858 de = (struct ext3_dir_entry_2 *) bh->b_data; 1859 de = (struct ext3_dir_entry_2 *) bh->b_data;
1859 de1 = (struct ext3_dir_entry_2 *) 1860 de1 = ext3_next_entry(de);
1860 ((char *) de + le16_to_cpu(de->rec_len));
1861 if (le32_to_cpu(de->inode) != inode->i_ino || 1861 if (le32_to_cpu(de->inode) != inode->i_ino ||
1862 !le32_to_cpu(de1->inode) || 1862 !le32_to_cpu(de1->inode) ||
1863 strcmp (".", de->name) || 1863 strcmp (".", de->name) ||
@@ -1868,9 +1868,9 @@ static int empty_dir (struct inode * inode)
1868 brelse (bh); 1868 brelse (bh);
1869 return 1; 1869 return 1;
1870 } 1870 }
1871 offset = le16_to_cpu(de->rec_len) + le16_to_cpu(de1->rec_len); 1871 offset = ext3_rec_len_from_disk(de->rec_len) +
1872 de = (struct ext3_dir_entry_2 *) 1872 ext3_rec_len_from_disk(de1->rec_len);
1873 ((char *) de1 + le16_to_cpu(de1->rec_len)); 1873 de = ext3_next_entry(de1);
1874 while (offset < inode->i_size ) { 1874 while (offset < inode->i_size ) {
1875 if (!bh || 1875 if (!bh ||
1876 (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { 1876 (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) {
@@ -1899,9 +1899,8 @@ static int empty_dir (struct inode * inode)
1899 brelse (bh); 1899 brelse (bh);
1900 return 0; 1900 return 0;
1901 } 1901 }
1902 offset += le16_to_cpu(de->rec_len); 1902 offset += ext3_rec_len_from_disk(de->rec_len);
1903 de = (struct ext3_dir_entry_2 *) 1903 de = ext3_next_entry(de);
1904 ((char *) de + le16_to_cpu(de->rec_len));
1905 } 1904 }
1906 brelse (bh); 1905 brelse (bh);
1907 return 1; 1906 return 1;
@@ -2255,8 +2254,7 @@ retry:
2255} 2254}
2256 2255
2257#define PARENT_INO(buffer) \ 2256#define PARENT_INO(buffer) \
2258 ((struct ext3_dir_entry_2 *) ((char *) buffer + \ 2257 (ext3_next_entry((struct ext3_dir_entry_2 *)(buffer))->inode)
2259 le16_to_cpu(((struct ext3_dir_entry_2 *) buffer)->rec_len)))->inode
2260 2258
2261/* 2259/*
2262 * Anybody can rename anything with this: the permission checks are left to the 2260 * Anybody can rename anything with this: the permission checks are left to the
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index e906b65448e2..71ee95e534fd 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -189,15 +189,6 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
189 return desc; 189 return desc;
190} 190}
191 191
192static inline int
193block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map)
194{
195 ext4_grpblk_t offset;
196
197 ext4_get_group_no_and_offset(sb, block, NULL, &offset);
198 return ext4_test_bit (offset, map);
199}
200
201/** 192/**
202 * read_block_bitmap() 193 * read_block_bitmap()
203 * @sb: super block 194 * @sb: super block
@@ -211,7 +202,6 @@ block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map)
211struct buffer_head * 202struct buffer_head *
212read_block_bitmap(struct super_block *sb, unsigned int block_group) 203read_block_bitmap(struct super_block *sb, unsigned int block_group)
213{ 204{
214 int i;
215 struct ext4_group_desc * desc; 205 struct ext4_group_desc * desc;
216 struct buffer_head * bh = NULL; 206 struct buffer_head * bh = NULL;
217 ext4_fsblk_t bitmap_blk; 207 ext4_fsblk_t bitmap_blk;
@@ -239,38 +229,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
239 "Cannot read block bitmap - " 229 "Cannot read block bitmap - "
240 "block_group = %d, block_bitmap = %llu", 230 "block_group = %d, block_bitmap = %llu",
241 block_group, bitmap_blk); 231 block_group, bitmap_blk);
242
243 /* check whether block bitmap block number is set */
244 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
245 /* bad block bitmap */
246 goto error_out;
247 }
248
249 /* check whether the inode bitmap block number is set */
250 bitmap_blk = ext4_inode_bitmap(sb, desc);
251 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
252 /* bad block bitmap */
253 goto error_out;
254 }
255 /* check whether the inode table block number is set */
256 bitmap_blk = ext4_inode_table(sb, desc);
257 for (i = 0; i < EXT4_SB(sb)->s_itb_per_group; i++, bitmap_blk++) {
258 if (!block_in_use(bitmap_blk, sb, bh->b_data)) {
259 /* bad block bitmap */
260 goto error_out;
261 }
262 }
263
264 return bh; 232 return bh;
265
266error_out:
267 brelse(bh);
268 ext4_error(sb, __FUNCTION__,
269 "Invalid block bitmap - "
270 "block_group = %d, block = %llu",
271 block_group, bitmap_blk);
272 return NULL;
273
274} 233}
275/* 234/*
276 * The reservation window structure operations 235 * The reservation window structure operations
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index c04c7ccba9e3..e7f894bdb420 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -51,6 +51,11 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
51 flags &= ~EXT4_DIRSYNC_FL; 51 flags &= ~EXT4_DIRSYNC_FL;
52 52
53 mutex_lock(&inode->i_mutex); 53 mutex_lock(&inode->i_mutex);
54 /* Is it quota file? Do not allow user to mess with it */
55 if (IS_NOQUOTA(inode)) {
56 mutex_unlock(&inode->i_mutex);
57 return -EPERM;
58 }
54 oldflags = ei->i_flags; 59 oldflags = ei->i_flags;
55 60
56 /* The JOURNAL_DATA flag is modifiable only by root */ 61 /* The JOURNAL_DATA flag is modifiable only by root */
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 0fcdba9d47c0..535b37399009 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -55,9 +55,10 @@ struct fuse_file *fuse_file_alloc(void)
55 if (!ff->reserved_req) { 55 if (!ff->reserved_req) {
56 kfree(ff); 56 kfree(ff);
57 ff = NULL; 57 ff = NULL;
58 } else {
59 INIT_LIST_HEAD(&ff->write_entry);
60 atomic_set(&ff->count, 0);
58 } 61 }
59 INIT_LIST_HEAD(&ff->write_entry);
60 atomic_set(&ff->count, 0);
61 } 62 }
62 return ff; 63 return ff;
63} 64}
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 12aca8ed605f..09ee07f02663 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -364,7 +364,6 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart)
364 ++next; 364 ++next;
365 truncate_huge_page(page); 365 truncate_huge_page(page);
366 unlock_page(page); 366 unlock_page(page);
367 hugetlb_put_quota(mapping);
368 freed++; 367 freed++;
369 } 368 }
370 huge_pagevec_release(&pvec); 369 huge_pagevec_release(&pvec);
@@ -859,15 +858,15 @@ out_free:
859 return -ENOMEM; 858 return -ENOMEM;
860} 859}
861 860
862int hugetlb_get_quota(struct address_space *mapping) 861int hugetlb_get_quota(struct address_space *mapping, long delta)
863{ 862{
864 int ret = 0; 863 int ret = 0;
865 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); 864 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb);
866 865
867 if (sbinfo->free_blocks > -1) { 866 if (sbinfo->free_blocks > -1) {
868 spin_lock(&sbinfo->stat_lock); 867 spin_lock(&sbinfo->stat_lock);
869 if (sbinfo->free_blocks > 0) 868 if (sbinfo->free_blocks - delta >= 0)
870 sbinfo->free_blocks--; 869 sbinfo->free_blocks -= delta;
871 else 870 else
872 ret = -ENOMEM; 871 ret = -ENOMEM;
873 spin_unlock(&sbinfo->stat_lock); 872 spin_unlock(&sbinfo->stat_lock);
@@ -876,13 +875,13 @@ int hugetlb_get_quota(struct address_space *mapping)
876 return ret; 875 return ret;
877} 876}
878 877
879void hugetlb_put_quota(struct address_space *mapping) 878void hugetlb_put_quota(struct address_space *mapping, long delta)
880{ 879{
881 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); 880 struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb);
882 881
883 if (sbinfo->free_blocks > -1) { 882 if (sbinfo->free_blocks > -1) {
884 spin_lock(&sbinfo->stat_lock); 883 spin_lock(&sbinfo->stat_lock);
885 sbinfo->free_blocks++; 884 sbinfo->free_blocks += delta;
886 spin_unlock(&sbinfo->stat_lock); 885 spin_unlock(&sbinfo->stat_lock);
887 } 886 }
888} 887}
diff --git a/fs/ioprio.c b/fs/ioprio.c
index d6ff77e8e7ec..e4e01bc7f338 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -78,6 +78,10 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
78 if (!capable(CAP_SYS_ADMIN)) 78 if (!capable(CAP_SYS_ADMIN))
79 return -EPERM; 79 return -EPERM;
80 break; 80 break;
81 case IOPRIO_CLASS_NONE:
82 if (data)
83 return -EINVAL;
84 break;
81 default: 85 default:
82 return -EINVAL; 86 return -EINVAL;
83 } 87 }
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c
index 3c8663bea98c..dfda12a073e1 100644
--- a/fs/jfs/ioctl.c
+++ b/fs/jfs/ioctl.c
@@ -79,6 +79,9 @@ int jfs_ioctl(struct inode * inode, struct file * filp, unsigned int cmd,
79 if (!S_ISDIR(inode->i_mode)) 79 if (!S_ISDIR(inode->i_mode))
80 flags &= ~JFS_DIRSYNC_FL; 80 flags &= ~JFS_DIRSYNC_FL;
81 81
82 /* Is it quota file? Do not allow user to mess with it */
83 if (IS_NOQUOTA(inode))
84 return -EPERM;
82 jfs_get_inode_flags(jfs_inode); 85 jfs_get_inode_flags(jfs_inode);
83 oldflags = jfs_inode->mode2; 86 oldflags = jfs_inode->mode2;
84 87
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/nfs/dir.c b/fs/nfs/dir.c
index 35334539d947..f697b5c74b7c 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -38,6 +38,7 @@
38#include "nfs4_fs.h" 38#include "nfs4_fs.h"
39#include "delegation.h" 39#include "delegation.h"
40#include "iostat.h" 40#include "iostat.h"
41#include "internal.h"
41 42
42/* #define NFS_DEBUG_VERBOSE 1 */ 43/* #define NFS_DEBUG_VERBOSE 1 */
43 44
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index afcab007a22b..5e8d82f6666b 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -263,17 +263,19 @@ static const struct rpc_call_ops nfs_read_direct_ops = {
263 * handled automatically by nfs_direct_read_result(). Otherwise, if 263 * handled automatically by nfs_direct_read_result(). Otherwise, if
264 * no requests have been sent, just return an error. 264 * no requests have been sent, just return an error.
265 */ 265 */
266static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned long user_addr, size_t count, loff_t pos) 266static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
267 const struct iovec *iov,
268 loff_t pos)
267{ 269{
268 struct nfs_open_context *ctx = dreq->ctx; 270 struct nfs_open_context *ctx = dreq->ctx;
269 struct inode *inode = ctx->path.dentry->d_inode; 271 struct inode *inode = ctx->path.dentry->d_inode;
272 unsigned long user_addr = (unsigned long)iov->iov_base;
273 size_t count = iov->iov_len;
270 size_t rsize = NFS_SERVER(inode)->rsize; 274 size_t rsize = NFS_SERVER(inode)->rsize;
271 unsigned int pgbase; 275 unsigned int pgbase;
272 int result; 276 int result;
273 ssize_t started = 0; 277 ssize_t started = 0;
274 278
275 get_dreq(dreq);
276
277 do { 279 do {
278 struct nfs_read_data *data; 280 struct nfs_read_data *data;
279 size_t bytes; 281 size_t bytes;
@@ -347,15 +349,46 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo
347 count -= bytes; 349 count -= bytes;
348 } while (count != 0); 350 } while (count != 0);
349 351
352 if (started)
353 return started;
354 return result < 0 ? (ssize_t) result : -EFAULT;
355}
356
357static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
358 const struct iovec *iov,
359 unsigned long nr_segs,
360 loff_t pos)
361{
362 ssize_t result = -EINVAL;
363 size_t requested_bytes = 0;
364 unsigned long seg;
365
366 get_dreq(dreq);
367
368 for (seg = 0; seg < nr_segs; seg++) {
369 const struct iovec *vec = &iov[seg];
370 result = nfs_direct_read_schedule_segment(dreq, vec, pos);
371 if (result < 0)
372 break;
373 requested_bytes += result;
374 if ((size_t)result < vec->iov_len)
375 break;
376 pos += vec->iov_len;
377 }
378
350 if (put_dreq(dreq)) 379 if (put_dreq(dreq))
351 nfs_direct_complete(dreq); 380 nfs_direct_complete(dreq);
352 381
353 if (started) 382 if (requested_bytes != 0)
354 return 0; 383 return 0;
355 return result < 0 ? (ssize_t) result : -EFAULT; 384
385 if (result < 0)
386 return result;
387 return -EIO;
356} 388}
357 389
358static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size_t count, loff_t pos) 390static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
391 unsigned long nr_segs, loff_t pos)
359{ 392{
360 ssize_t result = 0; 393 ssize_t result = 0;
361 sigset_t oldset; 394 sigset_t oldset;
@@ -372,9 +405,8 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size
372 if (!is_sync_kiocb(iocb)) 405 if (!is_sync_kiocb(iocb))
373 dreq->iocb = iocb; 406 dreq->iocb = iocb;
374 407
375 nfs_add_stats(inode, NFSIOS_DIRECTREADBYTES, count);
376 rpc_clnt_sigmask(clnt, &oldset); 408 rpc_clnt_sigmask(clnt, &oldset);
377 result = nfs_direct_read_schedule(dreq, user_addr, count, pos); 409 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos);
378 if (!result) 410 if (!result)
379 result = nfs_direct_wait(dreq); 411 result = nfs_direct_wait(dreq);
380 rpc_clnt_sigunmask(clnt, &oldset); 412 rpc_clnt_sigunmask(clnt, &oldset);
@@ -601,17 +633,19 @@ static const struct rpc_call_ops nfs_write_direct_ops = {
601 * handled automatically by nfs_direct_write_result(). Otherwise, if 633 * handled automatically by nfs_direct_write_result(). Otherwise, if
602 * no requests have been sent, just return an error. 634 * no requests have been sent, just return an error.
603 */ 635 */
604static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned long user_addr, size_t count, loff_t pos, int sync) 636static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
637 const struct iovec *iov,
638 loff_t pos, int sync)
605{ 639{
606 struct nfs_open_context *ctx = dreq->ctx; 640 struct nfs_open_context *ctx = dreq->ctx;
607 struct inode *inode = ctx->path.dentry->d_inode; 641 struct inode *inode = ctx->path.dentry->d_inode;
642 unsigned long user_addr = (unsigned long)iov->iov_base;
643 size_t count = iov->iov_len;
608 size_t wsize = NFS_SERVER(inode)->wsize; 644 size_t wsize = NFS_SERVER(inode)->wsize;
609 unsigned int pgbase; 645 unsigned int pgbase;
610 int result; 646 int result;
611 ssize_t started = 0; 647 ssize_t started = 0;
612 648
613 get_dreq(dreq);
614
615 do { 649 do {
616 struct nfs_write_data *data; 650 struct nfs_write_data *data;
617 size_t bytes; 651 size_t bytes;
@@ -689,15 +723,48 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l
689 count -= bytes; 723 count -= bytes;
690 } while (count != 0); 724 } while (count != 0);
691 725
726 if (started)
727 return started;
728 return result < 0 ? (ssize_t) result : -EFAULT;
729}
730
731static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
732 const struct iovec *iov,
733 unsigned long nr_segs,
734 loff_t pos, int sync)
735{
736 ssize_t result = 0;
737 size_t requested_bytes = 0;
738 unsigned long seg;
739
740 get_dreq(dreq);
741
742 for (seg = 0; seg < nr_segs; seg++) {
743 const struct iovec *vec = &iov[seg];
744 result = nfs_direct_write_schedule_segment(dreq, vec,
745 pos, sync);
746 if (result < 0)
747 break;
748 requested_bytes += result;
749 if ((size_t)result < vec->iov_len)
750 break;
751 pos += vec->iov_len;
752 }
753
692 if (put_dreq(dreq)) 754 if (put_dreq(dreq))
693 nfs_direct_write_complete(dreq, inode); 755 nfs_direct_write_complete(dreq, dreq->inode);
694 756
695 if (started) 757 if (requested_bytes != 0)
696 return 0; 758 return 0;
697 return result < 0 ? (ssize_t) result : -EFAULT; 759
760 if (result < 0)
761 return result;
762 return -EIO;
698} 763}
699 764
700static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, size_t count, loff_t pos) 765static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
766 unsigned long nr_segs, loff_t pos,
767 size_t count)
701{ 768{
702 ssize_t result = 0; 769 ssize_t result = 0;
703 sigset_t oldset; 770 sigset_t oldset;
@@ -720,10 +787,8 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
720 if (!is_sync_kiocb(iocb)) 787 if (!is_sync_kiocb(iocb))
721 dreq->iocb = iocb; 788 dreq->iocb = iocb;
722 789
723 nfs_add_stats(inode, NFSIOS_DIRECTWRITTENBYTES, count);
724
725 rpc_clnt_sigmask(clnt, &oldset); 790 rpc_clnt_sigmask(clnt, &oldset);
726 result = nfs_direct_write_schedule(dreq, user_addr, count, pos, sync); 791 result = nfs_direct_write_schedule_iovec(dreq, iov, nr_segs, pos, sync);
727 if (!result) 792 if (!result)
728 result = nfs_direct_wait(dreq); 793 result = nfs_direct_wait(dreq);
729 rpc_clnt_sigunmask(clnt, &oldset); 794 rpc_clnt_sigunmask(clnt, &oldset);
@@ -759,21 +824,16 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
759 ssize_t retval = -EINVAL; 824 ssize_t retval = -EINVAL;
760 struct file *file = iocb->ki_filp; 825 struct file *file = iocb->ki_filp;
761 struct address_space *mapping = file->f_mapping; 826 struct address_space *mapping = file->f_mapping;
762 /* XXX: temporary */ 827 size_t count;
763 const char __user *buf = iov[0].iov_base; 828
764 size_t count = iov[0].iov_len; 829 count = iov_length(iov, nr_segs);
830 nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count);
765 831
766 dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n", 832 dprintk("nfs: direct read(%s/%s, %zd@%Ld)\n",
767 file->f_path.dentry->d_parent->d_name.name, 833 file->f_path.dentry->d_parent->d_name.name,
768 file->f_path.dentry->d_name.name, 834 file->f_path.dentry->d_name.name,
769 (unsigned long) count, (long long) pos); 835 count, (long long) pos);
770
771 if (nr_segs != 1)
772 goto out;
773 836
774 retval = -EFAULT;
775 if (!access_ok(VERIFY_WRITE, buf, count))
776 goto out;
777 retval = 0; 837 retval = 0;
778 if (!count) 838 if (!count)
779 goto out; 839 goto out;
@@ -782,7 +842,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
782 if (retval) 842 if (retval)
783 goto out; 843 goto out;
784 844
785 retval = nfs_direct_read(iocb, (unsigned long) buf, count, pos); 845 retval = nfs_direct_read(iocb, iov, nr_segs, pos);
786 if (retval > 0) 846 if (retval > 0)
787 iocb->ki_pos = pos + retval; 847 iocb->ki_pos = pos + retval;
788 848
@@ -821,21 +881,21 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
821 ssize_t retval = -EINVAL; 881 ssize_t retval = -EINVAL;
822 struct file *file = iocb->ki_filp; 882 struct file *file = iocb->ki_filp;
823 struct address_space *mapping = file->f_mapping; 883 struct address_space *mapping = file->f_mapping;
824 /* XXX: temporary */ 884 size_t count;
825 const char __user *buf = iov[0].iov_base; 885
826 size_t count = iov[0].iov_len; 886 count = iov_length(iov, nr_segs);
887 nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count);
827 888
828 dprintk("nfs: direct write(%s/%s, %lu@%Ld)\n", 889 dfprintk(VFS, "nfs: direct write(%s/%s, %zd@%Ld)\n",
829 file->f_path.dentry->d_parent->d_name.name, 890 file->f_path.dentry->d_parent->d_name.name,
830 file->f_path.dentry->d_name.name, 891 file->f_path.dentry->d_name.name,
831 (unsigned long) count, (long long) pos); 892 count, (long long) pos);
832
833 if (nr_segs != 1)
834 goto out;
835 893
836 retval = generic_write_checks(file, &pos, &count, 0); 894 retval = generic_write_checks(file, &pos, &count, 0);
837 if (retval) 895 if (retval)
838 goto out; 896 goto out;
897 if (!count)
898 goto out; /* return 0 */
839 899
840 retval = -EINVAL; 900 retval = -EINVAL;
841 if ((ssize_t) count < 0) 901 if ((ssize_t) count < 0)
@@ -844,15 +904,11 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
844 if (!count) 904 if (!count)
845 goto out; 905 goto out;
846 906
847 retval = -EFAULT;
848 if (!access_ok(VERIFY_READ, buf, count))
849 goto out;
850
851 retval = nfs_sync_mapping(mapping); 907 retval = nfs_sync_mapping(mapping);
852 if (retval) 908 if (retval)
853 goto out; 909 goto out;
854 910
855 retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos); 911 retval = nfs_direct_write(iocb, iov, nr_segs, pos, count);
856 912
857 if (retval > 0) 913 if (retval > 0)
858 iocb->ki_pos = pos + retval; 914 iocb->ki_pos = pos + retval;
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 522e5ad4d8ad..0ee43843f4ec 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -43,6 +43,25 @@
43#define NFSDBG_FACILITY NFSDBG_CLIENT 43#define NFSDBG_FACILITY NFSDBG_CLIENT
44 44
45/* 45/*
46 * Set the superblock root dentry.
47 * Note that this function frees the inode in case of error.
48 */
49static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *inode)
50{
51 /* The mntroot acts as the dummy root dentry for this superblock */
52 if (sb->s_root == NULL) {
53 sb->s_root = d_alloc_root(inode);
54 if (sb->s_root == NULL) {
55 iput(inode);
56 return -ENOMEM;
57 }
58 /* Circumvent igrab(): we know the inode is not being freed */
59 atomic_inc(&inode->i_count);
60 }
61 return 0;
62}
63
64/*
46 * get an NFS2/NFS3 root dentry from the root filehandle 65 * get an NFS2/NFS3 root dentry from the root filehandle
47 */ 66 */
48struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh) 67struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
@@ -54,33 +73,6 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
54 struct inode *inode; 73 struct inode *inode;
55 int error; 74 int error;
56 75
57 /* create a dummy root dentry with dummy inode for this superblock */
58 if (!sb->s_root) {
59 struct nfs_fh dummyfh;
60 struct dentry *root;
61 struct inode *iroot;
62
63 memset(&dummyfh, 0, sizeof(dummyfh));
64 memset(&fattr, 0, sizeof(fattr));
65 nfs_fattr_init(&fattr);
66 fattr.valid = NFS_ATTR_FATTR;
67 fattr.type = NFDIR;
68 fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
69 fattr.nlink = 2;
70
71 iroot = nfs_fhget(sb, &dummyfh, &fattr);
72 if (IS_ERR(iroot))
73 return ERR_PTR(PTR_ERR(iroot));
74
75 root = d_alloc_root(iroot);
76 if (!root) {
77 iput(iroot);
78 return ERR_PTR(-ENOMEM);
79 }
80
81 sb->s_root = root;
82 }
83
84 /* get the actual root for this mount */ 76 /* get the actual root for this mount */
85 fsinfo.fattr = &fattr; 77 fsinfo.fattr = &fattr;
86 78
@@ -96,6 +88,10 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
96 return ERR_PTR(PTR_ERR(inode)); 88 return ERR_PTR(PTR_ERR(inode));
97 } 89 }
98 90
91 error = nfs_superblock_set_dummy_root(sb, inode);
92 if (error != 0)
93 return ERR_PTR(error);
94
99 /* root dentries normally start off anonymous and get spliced in later 95 /* root dentries normally start off anonymous and get spliced in later
100 * if the dentry tree reaches them; however if the dentry already 96 * if the dentry tree reaches them; however if the dentry already
101 * exists, we'll pick it up at this point and use it as the root 97 * exists, we'll pick it up at this point and use it as the root
@@ -241,33 +237,6 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
241 237
242 dprintk("--> nfs4_get_root()\n"); 238 dprintk("--> nfs4_get_root()\n");
243 239
244 /* create a dummy root dentry with dummy inode for this superblock */
245 if (!sb->s_root) {
246 struct nfs_fh dummyfh;
247 struct dentry *root;
248 struct inode *iroot;
249
250 memset(&dummyfh, 0, sizeof(dummyfh));
251 memset(&fattr, 0, sizeof(fattr));
252 nfs_fattr_init(&fattr);
253 fattr.valid = NFS_ATTR_FATTR;
254 fattr.type = NFDIR;
255 fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
256 fattr.nlink = 2;
257
258 iroot = nfs_fhget(sb, &dummyfh, &fattr);
259 if (IS_ERR(iroot))
260 return ERR_PTR(PTR_ERR(iroot));
261
262 root = d_alloc_root(iroot);
263 if (!root) {
264 iput(iroot);
265 return ERR_PTR(-ENOMEM);
266 }
267
268 sb->s_root = root;
269 }
270
271 /* get the info about the server and filesystem */ 240 /* get the info about the server and filesystem */
272 error = nfs4_server_capabilities(server, mntfh); 241 error = nfs4_server_capabilities(server, mntfh);
273 if (error < 0) { 242 if (error < 0) {
@@ -289,6 +258,10 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
289 return ERR_PTR(PTR_ERR(inode)); 258 return ERR_PTR(PTR_ERR(inode));
290 } 259 }
291 260
261 error = nfs_superblock_set_dummy_root(sb, inode);
262 if (error != 0)
263 return ERR_PTR(error);
264
292 /* root dentries normally start off anonymous and get spliced in later 265 /* root dentries normally start off anonymous and get spliced in later
293 * if the dentry tree reaches them; however if the dentry already 266 * if the dentry tree reaches them; however if the dentry already
294 * exists, we'll pick it up at this point and use it as the root 267 * exists, we'll pick it up at this point and use it as the root
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index fa517ae9207f..2426e713b77f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1054,10 +1054,11 @@ static int nfs_validate_mount_data(void *options,
1054{ 1054{
1055 struct nfs_mount_data *data = (struct nfs_mount_data *)options; 1055 struct nfs_mount_data *data = (struct nfs_mount_data *)options;
1056 1056
1057 memset(args, 0, sizeof(*args));
1058
1057 if (data == NULL) 1059 if (data == NULL)
1058 goto out_no_data; 1060 goto out_no_data;
1059 1061
1060 memset(args, 0, sizeof(*args));
1061 args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP); 1062 args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP);
1062 args->rsize = NFS_MAX_FILE_IO_SIZE; 1063 args->rsize = NFS_MAX_FILE_IO_SIZE;
1063 args->wsize = NFS_MAX_FILE_IO_SIZE; 1064 args->wsize = NFS_MAX_FILE_IO_SIZE;
@@ -1474,6 +1475,11 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
1474 error = PTR_ERR(mntroot); 1475 error = PTR_ERR(mntroot);
1475 goto error_splat_super; 1476 goto error_splat_super;
1476 } 1477 }
1478 if (mntroot->d_inode->i_op != &nfs_dir_inode_operations) {
1479 dput(mntroot);
1480 error = -ESTALE;
1481 goto error_splat_super;
1482 }
1477 1483
1478 s->s_flags |= MS_ACTIVE; 1484 s->s_flags |= MS_ACTIVE;
1479 mnt->mnt_sb = s; 1485 mnt->mnt_sb = s;
@@ -1531,10 +1537,11 @@ static int nfs4_validate_mount_data(void *options,
1531 struct nfs4_mount_data *data = (struct nfs4_mount_data *)options; 1537 struct nfs4_mount_data *data = (struct nfs4_mount_data *)options;
1532 char *c; 1538 char *c;
1533 1539
1540 memset(args, 0, sizeof(*args));
1541
1534 if (data == NULL) 1542 if (data == NULL)
1535 goto out_no_data; 1543 goto out_no_data;
1536 1544
1537 memset(args, 0, sizeof(*args));
1538 args->rsize = NFS_MAX_FILE_IO_SIZE; 1545 args->rsize = NFS_MAX_FILE_IO_SIZE;
1539 args->wsize = NFS_MAX_FILE_IO_SIZE; 1546 args->wsize = NFS_MAX_FILE_IO_SIZE;
1540 args->timeo = 600; 1547 args->timeo = 600;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 89527a487ed7..51cc1bd6a116 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1436,7 +1436,8 @@ out:
1436 return ret; 1436 return ret;
1437} 1437}
1438 1438
1439int nfs_wb_page_priority(struct inode *inode, struct page *page, int how) 1439static int nfs_wb_page_priority(struct inode *inode, struct page *page,
1440 int how)
1440{ 1441{
1441 loff_t range_start = page_offset(page); 1442 loff_t range_start = page_offset(page);
1442 loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1); 1443 loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
index b61742885011..0e5fa11e6b44 100644
--- a/fs/nfsd/nfs2acl.c
+++ b/fs/nfsd/nfs2acl.c
@@ -41,7 +41,7 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
41 41
42 fh = fh_copy(&resp->fh, &argp->fh); 42 fh = fh_copy(&resp->fh, &argp->fh);
43 if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) 43 if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
44 RETURN_STATUS(nfserr_inval); 44 RETURN_STATUS(nfserr);
45 45
46 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) 46 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
47 RETURN_STATUS(nfserr_inval); 47 RETURN_STATUS(nfserr_inval);
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index 3e3f2de82c36..b647f2f872dc 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -37,7 +37,7 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,
37 37
38 fh = fh_copy(&resp->fh, &argp->fh); 38 fh = fh_copy(&resp->fh, &argp->fh);
39 if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) 39 if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
40 RETURN_STATUS(nfserr_inval); 40 RETURN_STATUS(nfserr);
41 41
42 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) 42 if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
43 RETURN_STATUS(nfserr_inval); 43 RETURN_STATUS(nfserr_inval);
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 6f03918018a3..1602cd00dd45 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -43,7 +43,7 @@
43#include <linux/file.h> 43#include <linux/file.h>
44#include <linux/namei.h> 44#include <linux/namei.h>
45#include <asm/uaccess.h> 45#include <asm/uaccess.h>
46#include <asm/scatterlist.h> 46#include <linux/scatterlist.h>
47#include <linux/crypto.h> 47#include <linux/crypto.h>
48#include <linux/sched.h> 48#include <linux/sched.h>
49 49
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 4f712e970584..468f17a78441 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -95,6 +95,22 @@ nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type)
95 return 0; 95 return 0;
96} 96}
97 97
98static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
99 struct svc_export *exp)
100{
101 /* Check if the request originated from a secure port. */
102 if (!rqstp->rq_secure && EX_SECURE(exp)) {
103 char buf[RPC_MAX_ADDRBUFLEN];
104 dprintk(KERN_WARNING
105 "nfsd: request from insecure port %s!\n",
106 svc_print_addr(rqstp, buf, sizeof(buf)));
107 return nfserr_perm;
108 }
109
110 /* Set user creds for this exportpoint */
111 return nfserrno(nfsd_setuser(rqstp, exp));
112}
113
98/* 114/*
99 * Perform sanity checks on the dentry in a client's file handle. 115 * Perform sanity checks on the dentry in a client's file handle.
100 * 116 *
@@ -167,18 +183,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
167 goto out; 183 goto out;
168 } 184 }
169 185
170 /* Check if the request originated from a secure port. */ 186 error = nfsd_setuser_and_check_port(rqstp, exp);
171 error = nfserr_perm;
172 if (!rqstp->rq_secure && EX_SECURE(exp)) {
173 char buf[RPC_MAX_ADDRBUFLEN];
174 printk(KERN_WARNING
175 "nfsd: request from insecure port %s!\n",
176 svc_print_addr(rqstp, buf, sizeof(buf)));
177 goto out;
178 }
179
180 /* Set user creds for this exportpoint */
181 error = nfserrno(nfsd_setuser(rqstp, exp));
182 if (error) 187 if (error)
183 goto out; 188 goto out;
184 189
@@ -227,18 +232,22 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
227 fhp->fh_export = exp; 232 fhp->fh_export = exp;
228 nfsd_nr_verified++; 233 nfsd_nr_verified++;
229 } else { 234 } else {
230 /* just rechecking permissions 235 /*
231 * (e.g. nfsproc_create calls fh_verify, then nfsd_create does as well) 236 * just rechecking permissions
237 * (e.g. nfsproc_create calls fh_verify, then nfsd_create
238 * does as well)
232 */ 239 */
233 dprintk("nfsd: fh_verify - just checking\n"); 240 dprintk("nfsd: fh_verify - just checking\n");
234 dentry = fhp->fh_dentry; 241 dentry = fhp->fh_dentry;
235 exp = fhp->fh_export; 242 exp = fhp->fh_export;
236 /* Set user creds for this exportpoint; necessary even 243 /*
244 * Set user creds for this exportpoint; necessary even
237 * in the "just checking" case because this may be a 245 * in the "just checking" case because this may be a
238 * filehandle that was created by fh_compose, and that 246 * filehandle that was created by fh_compose, and that
239 * is about to be used in another nfsv4 compound 247 * is about to be used in another nfsv4 compound
240 * operation */ 248 * operation.
241 error = nfserrno(nfsd_setuser(rqstp, exp)); 249 */
250 error = nfsd_setuser_and_check_port(rqstp, exp);
242 if (error) 251 if (error)
243 goto out; 252 goto out;
244 } 253 }
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/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 4ba7f0bdc248..ce62c152823d 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -3946,7 +3946,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
3946 struct ocfs2_merge_ctxt ctxt; 3946 struct ocfs2_merge_ctxt ctxt;
3947 struct ocfs2_extent_list *rightmost_el; 3947 struct ocfs2_extent_list *rightmost_el;
3948 3948
3949 if (!rec->e_flags & OCFS2_EXT_UNWRITTEN) { 3949 if (!(rec->e_flags & OCFS2_EXT_UNWRITTEN)) {
3950 ret = -EIO; 3950 ret = -EIO;
3951 mlog_errno(ret); 3951 mlog_errno(ret);
3952 goto out; 3952 goto out;
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index c69c1b300155..556e34ccb005 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -729,6 +729,27 @@ static void ocfs2_clear_page_regions(struct page *page,
729} 729}
730 730
731/* 731/*
732 * Nonsparse file systems fully allocate before we get to the write
733 * code. This prevents ocfs2_write() from tagging the write as an
734 * allocating one, which means ocfs2_map_page_blocks() might try to
735 * read-in the blocks at the tail of our file. Avoid reading them by
736 * testing i_size against each block offset.
737 */
738static int ocfs2_should_read_blk(struct inode *inode, struct page *page,
739 unsigned int block_start)
740{
741 u64 offset = page_offset(page) + block_start;
742
743 if (ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)))
744 return 1;
745
746 if (i_size_read(inode) > offset)
747 return 1;
748
749 return 0;
750}
751
752/*
732 * Some of this taken from block_prepare_write(). We already have our 753 * Some of this taken from block_prepare_write(). We already have our
733 * mapping by now though, and the entire write will be allocating or 754 * mapping by now though, and the entire write will be allocating or
734 * it won't, so not much need to use BH_New. 755 * it won't, so not much need to use BH_New.
@@ -781,6 +802,7 @@ int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno,
781 set_buffer_uptodate(bh); 802 set_buffer_uptodate(bh);
782 } else if (!buffer_uptodate(bh) && !buffer_delay(bh) && 803 } else if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
783 !buffer_new(bh) && 804 !buffer_new(bh) &&
805 ocfs2_should_read_blk(inode, page, block_start) &&
784 (block_start < from || block_end > to)) { 806 (block_start < from || block_end > to)) {
785 ll_rw_block(READ, 1, &bh); 807 ll_rw_block(READ, 1, &bh);
786 *wait_bh++=bh; 808 *wait_bh++=bh;
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 9cc7c0418b70..f02ccb34604d 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -267,7 +267,7 @@ static struct bio *o2hb_setup_one_bio(struct o2hb_region *reg,
267 current_page = cs / spp; 267 current_page = cs / spp;
268 page = reg->hr_slot_data[current_page]; 268 page = reg->hr_slot_data[current_page];
269 269
270 vec_len = min(PAGE_CACHE_SIZE, 270 vec_len = min(PAGE_CACHE_SIZE - vec_start,
271 (max_slots-cs) * (PAGE_CACHE_SIZE/spp) ); 271 (max_slots-cs) * (PAGE_CACHE_SIZE/spp) );
272 272
273 mlog(ML_HB_BIO, "page %d, vec_len = %u, vec_start = %u\n", 273 mlog(ML_HB_BIO, "page %d, vec_len = %u, vec_start = %u\n",
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 685c18065c82..d84bd155997b 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -58,6 +58,7 @@
58#include <linux/slab.h> 58#include <linux/slab.h>
59#include <linux/idr.h> 59#include <linux/idr.h>
60#include <linux/kref.h> 60#include <linux/kref.h>
61#include <linux/net.h>
61#include <net/tcp.h> 62#include <net/tcp.h>
62 63
63#include <asm/uaccess.h> 64#include <asm/uaccess.h>
@@ -616,8 +617,7 @@ static void o2net_shutdown_sc(struct work_struct *work)
616 del_timer_sync(&sc->sc_idle_timeout); 617 del_timer_sync(&sc->sc_idle_timeout);
617 o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work); 618 o2net_sc_cancel_delayed_work(sc, &sc->sc_keepalive_work);
618 sc_put(sc); 619 sc_put(sc);
619 sc->sc_sock->ops->shutdown(sc->sc_sock, 620 kernel_sock_shutdown(sc->sc_sock, SHUT_RDWR);
620 RCV_SHUTDOWN|SEND_SHUTDOWN);
621 } 621 }
622 622
623 /* not fatal so failed connects before the other guy has our 623 /* not fatal so failed connects before the other guy has our
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index 3094ddb7a254..1957a5ed219e 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -318,9 +318,9 @@ out_attach:
318static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb, 318static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb,
319 struct ocfs2_dentry_lock *dl) 319 struct ocfs2_dentry_lock *dl)
320{ 320{
321 iput(dl->dl_inode);
321 ocfs2_simple_drop_lockres(osb, &dl->dl_lockres); 322 ocfs2_simple_drop_lockres(osb, &dl->dl_lockres);
322 ocfs2_lock_res_free(&dl->dl_lockres); 323 ocfs2_lock_res_free(&dl->dl_lockres);
323 iput(dl->dl_inode);
324 kfree(dl); 324 kfree(dl);
325} 325}
326 326
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 6a2f143e269c..63b28fdceb4a 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -208,9 +208,9 @@ out:
208 return NULL; 208 return NULL;
209} 209}
210 210
211struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen, 211static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
212 struct inode *dir, 212 struct inode *dir,
213 struct ocfs2_dir_entry **res_dir) 213 struct ocfs2_dir_entry **res_dir)
214{ 214{
215 struct super_block *sb; 215 struct super_block *sb;
216 struct buffer_head *bh_use[NAMEI_RA_SIZE]; 216 struct buffer_head *bh_use[NAMEI_RA_SIZE];
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 41c76ff2fcfb..4e97dcceaf8f 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -670,7 +670,7 @@ static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *loc
670{ 670{
671 mlog_entry_void(); 671 mlog_entry_void();
672 672
673 BUG_ON((!lockres->l_flags & OCFS2_LOCK_BUSY)); 673 BUG_ON((!(lockres->l_flags & OCFS2_LOCK_BUSY)));
674 BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED); 674 BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED);
675 675
676 if (lockres->l_requested > LKM_NLMODE && 676 if (lockres->l_requested > LKM_NLMODE &&
@@ -980,18 +980,6 @@ again:
980 goto unlock; 980 goto unlock;
981 } 981 }
982 982
983 if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) {
984 /* lock has not been created yet. */
985 spin_unlock_irqrestore(&lockres->l_lock, flags);
986
987 ret = ocfs2_lock_create(osb, lockres, LKM_NLMODE, 0);
988 if (ret < 0) {
989 mlog_errno(ret);
990 goto out;
991 }
992 goto again;
993 }
994
995 if (lockres->l_flags & OCFS2_LOCK_BLOCKED && 983 if (lockres->l_flags & OCFS2_LOCK_BLOCKED &&
996 !ocfs2_may_continue_on_blocked_lock(lockres, level)) { 984 !ocfs2_may_continue_on_blocked_lock(lockres, level)) {
997 /* is the lock is currently blocked on behalf of 985 /* is the lock is currently blocked on behalf of
@@ -1006,7 +994,14 @@ again:
1006 mlog(ML_ERROR, "lockres %s has action %u pending\n", 994 mlog(ML_ERROR, "lockres %s has action %u pending\n",
1007 lockres->l_name, lockres->l_action); 995 lockres->l_name, lockres->l_action);
1008 996
1009 lockres->l_action = OCFS2_AST_CONVERT; 997 if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) {
998 lockres->l_action = OCFS2_AST_ATTACH;
999 lkm_flags &= ~LKM_CONVERT;
1000 } else {
1001 lockres->l_action = OCFS2_AST_CONVERT;
1002 lkm_flags |= LKM_CONVERT;
1003 }
1004
1010 lockres->l_requested = level; 1005 lockres->l_requested = level;
1011 lockres_or_flags(lockres, OCFS2_LOCK_BUSY); 1006 lockres_or_flags(lockres, OCFS2_LOCK_BUSY);
1012 spin_unlock_irqrestore(&lockres->l_lock, flags); 1007 spin_unlock_irqrestore(&lockres->l_lock, flags);
@@ -1021,7 +1016,7 @@ again:
1021 status = dlmlock(osb->dlm, 1016 status = dlmlock(osb->dlm,
1022 level, 1017 level,
1023 &lockres->l_lksb, 1018 &lockres->l_lksb,
1024 lkm_flags|LKM_CONVERT, 1019 lkm_flags,
1025 lockres->l_name, 1020 lockres->l_name,
1026 OCFS2_LOCK_ID_MAX_LEN - 1, 1021 OCFS2_LOCK_ID_MAX_LEN - 1,
1027 ocfs2_locking_ast, 1022 ocfs2_locking_ast,
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index f92fe91ff260..bbac7cd33e0b 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1891,9 +1891,11 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
1891 ssize_t written = 0; 1891 ssize_t written = 0;
1892 size_t ocount; /* original count */ 1892 size_t ocount; /* original count */
1893 size_t count; /* after file limit checks */ 1893 size_t count; /* after file limit checks */
1894 loff_t *ppos = &iocb->ki_pos; 1894 loff_t old_size, *ppos = &iocb->ki_pos;
1895 u32 old_clusters;
1895 struct file *file = iocb->ki_filp; 1896 struct file *file = iocb->ki_filp;
1896 struct inode *inode = file->f_path.dentry->d_inode; 1897 struct inode *inode = file->f_path.dentry->d_inode;
1898 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1897 1899
1898 mlog_entry("(0x%p, %u, '%.*s')\n", file, 1900 mlog_entry("(0x%p, %u, '%.*s')\n", file,
1899 (unsigned int)nr_segs, 1901 (unsigned int)nr_segs,
@@ -1949,6 +1951,13 @@ relock:
1949 goto relock; 1951 goto relock;
1950 } 1952 }
1951 1953
1954 /*
1955 * To later detect whether a journal commit for sync writes is
1956 * necessary, we sample i_size, and cluster count here.
1957 */
1958 old_size = i_size_read(inode);
1959 old_clusters = OCFS2_I(inode)->ip_clusters;
1960
1952 /* communicate with ocfs2_dio_end_io */ 1961 /* communicate with ocfs2_dio_end_io */
1953 ocfs2_iocb_set_rw_locked(iocb, rw_level); 1962 ocfs2_iocb_set_rw_locked(iocb, rw_level);
1954 1963
@@ -1978,6 +1987,21 @@ out_dio:
1978 /* buffered aio wouldn't have proper lock coverage today */ 1987 /* buffered aio wouldn't have proper lock coverage today */
1979 BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); 1988 BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
1980 1989
1990 if ((file->f_flags & O_SYNC && !direct_io) || IS_SYNC(inode)) {
1991 /*
1992 * The generic write paths have handled getting data
1993 * to disk, but since we don't make use of the dirty
1994 * inode list, a manual journal commit is necessary
1995 * here.
1996 */
1997 if (old_size != i_size_read(inode) ||
1998 old_clusters != OCFS2_I(inode)->ip_clusters) {
1999 ret = journal_force_commit(osb->journal->j_journal);
2000 if (ret < 0)
2001 written = ret;
2002 }
2003 }
2004
1981 /* 2005 /*
1982 * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io 2006 * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
1983 * function pointer which is called when o_direct io completes so that 2007 * function pointer which is called when o_direct io completes so that
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 729259016c18..989ac2718587 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1105,9 +1105,16 @@ static int ocfs2_rename(struct inode *old_dir,
1105 goto bail; 1105 goto bail;
1106 } 1106 }
1107 1107
1108 if (!new_de && new_inode) 1108 if (!new_de && new_inode) {
1109 mlog(ML_ERROR, "inode %lu does not exist in it's parent " 1109 /*
1110 "directory!", new_inode->i_ino); 1110 * Target was unlinked by another node while we were
1111 * waiting to get to ocfs2_rename(). There isn't
1112 * anything we can do here to help the situation, so
1113 * bubble up the appropriate error.
1114 */
1115 status = -ENOENT;
1116 goto bail;
1117 }
1111 1118
1112 /* In case we need to overwrite an existing file, we blow it 1119 /* In case we need to overwrite an existing file, we blow it
1113 * away first */ 1120 * away first */
diff --git a/fs/open.c b/fs/open.c
index 3b69c53e1837..4932b4d1da05 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1061,7 +1061,7 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
1061 prevent_tail_call(ret); 1061 prevent_tail_call(ret);
1062 return ret; 1062 return ret;
1063} 1063}
1064EXPORT_SYMBOL_GPL(sys_open); 1064EXPORT_UNUSED_SYMBOL_GPL(sys_open); /* To be deleted for 2.6.25 */
1065 1065
1066asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 1066asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1067 int mode) 1067 int mode)
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 63c95afb561f..65c62e1bfd6f 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,10 @@ 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 if (stime >= 0)
378 p->prev_stime = max(p->prev_stime, clock_t_to_cputime(stime));
379
380 return p->prev_stime;
377} 381}
378#endif 382#endif
379 383
diff --git a/fs/proc/base.c b/fs/proc/base.c
index aeaf0d0f2f51..a17c26859074 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2328,21 +2328,18 @@ out:
2328 2328
2329void proc_flush_task(struct task_struct *task) 2329void proc_flush_task(struct task_struct *task)
2330{ 2330{
2331 int i, leader; 2331 int i;
2332 struct pid *pid, *tgid; 2332 struct pid *pid, *tgid = NULL;
2333 struct upid *upid; 2333 struct upid *upid;
2334 2334
2335 leader = thread_group_leader(task);
2336 proc_flush_task_mnt(proc_mnt, task->pid, leader ? task->tgid : 0);
2337 pid = task_pid(task); 2335 pid = task_pid(task);
2338 if (pid->level == 0) 2336 if (thread_group_leader(task))
2339 return; 2337 tgid = task_tgid(task);
2340 2338
2341 tgid = task_tgid(task); 2339 for (i = 0; i <= pid->level; i++) {
2342 for (i = 1; i <= pid->level; i++) {
2343 upid = &pid->numbers[i]; 2340 upid = &pid->numbers[i];
2344 proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr, 2341 proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr,
2345 leader ? 0 : tgid->numbers[i].nr); 2342 tgid ? tgid->numbers[i].nr : 0);
2346 } 2343 }
2347 2344
2348 upid = &pid->numbers[pid->level]; 2345 upid = &pid->numbers[pid->level];
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 1bdb62435758..a9806bc21ec3 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -561,28 +561,33 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
561static void proc_kill_inodes(struct proc_dir_entry *de) 561static void proc_kill_inodes(struct proc_dir_entry *de)
562{ 562{
563 struct list_head *p; 563 struct list_head *p;
564 struct super_block *sb = proc_mnt->mnt_sb; 564 struct super_block *sb;
565 565
566 /* 566 /*
567 * Actually it's a partial revoke(). 567 * Actually it's a partial revoke().
568 */ 568 */
569 file_list_lock(); 569 spin_lock(&sb_lock);
570 list_for_each(p, &sb->s_files) { 570 list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) {
571 struct file * filp = list_entry(p, struct file, f_u.fu_list); 571 file_list_lock();
572 struct dentry * dentry = filp->f_path.dentry; 572 list_for_each(p, &sb->s_files) {
573 struct inode * inode; 573 struct file *filp = list_entry(p, struct file,
574 const struct file_operations *fops; 574 f_u.fu_list);
575 575 struct dentry *dentry = filp->f_path.dentry;
576 if (dentry->d_op != &proc_dentry_operations) 576 struct inode *inode;
577 continue; 577 const struct file_operations *fops;
578 inode = dentry->d_inode; 578
579 if (PDE(inode) != de) 579 if (dentry->d_op != &proc_dentry_operations)
580 continue; 580 continue;
581 fops = filp->f_op; 581 inode = dentry->d_inode;
582 filp->f_op = NULL; 582 if (PDE(inode) != de)
583 fops_put(fops); 583 continue;
584 fops = filp->f_op;
585 filp->f_op = NULL;
586 fops_put(fops);
587 }
588 file_list_unlock();
584 } 589 }
585 file_list_unlock(); 590 spin_unlock(&sb_lock);
586} 591}
587 592
588static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, 593static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 1820eb2ef762..1b2b6c6bb475 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -78,3 +78,5 @@ static inline int proc_fd(struct inode *inode)
78{ 78{
79 return PROC_I(inode)->fd; 79 return PROC_I(inode)->fd;
80} 80}
81
82extern struct file_system_type proc_fs_type;
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 749def054a34..131f9c68be5f 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -26,13 +26,6 @@
26#include "internal.h" 26#include "internal.h"
27 27
28 28
29struct proc_dir_entry *proc_net_create(struct net *net,
30 const char *name, mode_t mode, get_info_t *get_info)
31{
32 return create_proc_info_entry(name,mode, net->proc_net, get_info);
33}
34EXPORT_SYMBOL_GPL(proc_net_create);
35
36struct proc_dir_entry *proc_net_fops_create(struct net *net, 29struct proc_dir_entry *proc_net_fops_create(struct net *net,
37 const char *name, mode_t mode, const struct file_operations *fops) 30 const char *name, mode_t mode, const struct file_operations *fops)
38{ 31{
@@ -185,7 +178,7 @@ static __net_exit void proc_net_ns_exit(struct net *net)
185 kfree(net->proc_net_root); 178 kfree(net->proc_net_root);
186} 179}
187 180
188static struct pernet_operations proc_net_ns_ops = { 181static struct pernet_operations __net_initdata proc_net_ns_ops = {
189 .init = proc_net_ns_init, 182 .init = proc_net_ns_init,
190 .exit = proc_net_ns_exit, 183 .exit = proc_net_ns_exit,
191}; 184};
diff --git a/fs/proc/root.c b/fs/proc/root.c
index ec9cb3b6c93b..1f86bb860e04 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb)
98 put_pid_ns(ns); 98 put_pid_ns(ns);
99} 99}
100 100
101static struct file_system_type proc_fs_type = { 101struct file_system_type proc_fs_type = {
102 .name = "proc", 102 .name = "proc",
103 .get_sb = proc_get_sb, 103 .get_sb = proc_get_sb,
104 .kill_sb = proc_kill_sb, 104 .kill_sb = proc_kill_sb,
diff --git a/fs/read_write.c b/fs/read_write.c
index 124693e8d3fa..ea1f94cc722e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -370,7 +370,7 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
370 370
371 return ret; 371 return ret;
372} 372}
373EXPORT_SYMBOL_GPL(sys_read); 373EXPORT_UNUSED_SYMBOL_GPL(sys_read); /* to be deleted for 2.6.25 */
374 374
375asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) 375asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count)
376{ 376{
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index c438a8f83f26..e0f0f098a523 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -57,6 +57,9 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
57 if (get_user(flags, (int __user *)arg)) 57 if (get_user(flags, (int __user *)arg))
58 return -EFAULT; 58 return -EFAULT;
59 59
60 /* Is it quota file? Do not allow user to mess with it. */
61 if (IS_NOQUOTA(inode))
62 return -EPERM;
60 if (((flags ^ REISERFS_I(inode)-> 63 if (((flags ^ REISERFS_I(inode)->
61 i_attrs) & (REISERFS_IMMUTABLE_FL | 64 i_attrs) & (REISERFS_IMMUTABLE_FL |
62 REISERFS_APPEND_FL)) 65 REISERFS_APPEND_FL))
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index ca41567d7890..d2db2417b2bd 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1458,9 +1458,6 @@ static void unmap_buffers(struct page *page, loff_t pos)
1458 } 1458 }
1459 bh = next; 1459 bh = next;
1460 } while (bh != head); 1460 } while (bh != head);
1461 if (PAGE_SIZE == bh->b_size) {
1462 cancel_dirty_page(page, PAGE_CACHE_SIZE);
1463 }
1464 } 1461 }
1465 } 1462 }
1466} 1463}
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index f5d14cebc75a..efbe29af3d7a 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -234,7 +234,7 @@ smb_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
234 234
235 VERBOSE("before read, size=%ld, flags=%x, atime=%ld\n", 235 VERBOSE("before read, size=%ld, flags=%x, atime=%ld\n",
236 (long)dentry->d_inode->i_size, 236 (long)dentry->d_inode->i_size,
237 dentry->d_inode->i_flags, dentry->d_inode->i_atime); 237 dentry->d_inode->i_flags, dentry->d_inode->i_atime.tv_sec);
238 238
239 status = generic_file_aio_read(iocb, iov, nr_segs, pos); 239 status = generic_file_aio_read(iocb, iov, nr_segs, pos);
240out: 240out:
@@ -269,7 +269,7 @@ smb_file_splice_read(struct file *file, loff_t *ppos,
269 struct dentry *dentry = file->f_path.dentry; 269 struct dentry *dentry = file->f_path.dentry;
270 ssize_t status; 270 ssize_t status;
271 271
272 VERBOSE("file %s/%s, pos=%Ld, count=%d\n", 272 VERBOSE("file %s/%s, pos=%Ld, count=%lu\n",
273 DENTRY_PATH(dentry), *ppos, count); 273 DENTRY_PATH(dentry), *ppos, count);
274 274
275 status = smb_revalidate_inode(dentry); 275 status = smb_revalidate_inode(dentry);
@@ -363,7 +363,8 @@ smb_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
363 result = generic_file_aio_write(iocb, iov, nr_segs, pos); 363 result = generic_file_aio_write(iocb, iov, nr_segs, pos);
364 VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n", 364 VERBOSE("pos=%ld, size=%ld, mtime=%ld, atime=%ld\n",
365 (long) file->f_pos, (long) dentry->d_inode->i_size, 365 (long) file->f_pos, (long) dentry->d_inode->i_size,
366 dentry->d_inode->i_mtime, dentry->d_inode->i_atime); 366 dentry->d_inode->i_mtime.tv_sec,
367 dentry->d_inode->i_atime.tv_sec);
367 } 368 }
368out: 369out:
369 return result; 370 return result;
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c
index ab517755ece0..9416ead0c7aa 100644
--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -536,7 +536,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
536 536
537 /* Allocate the global temp buffer and some superblock helper structs */ 537 /* Allocate the global temp buffer and some superblock helper structs */
538 /* FIXME: move these to the smb_sb_info struct */ 538 /* FIXME: move these to the smb_sb_info struct */
539 VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) + 539 VERBOSE("alloc chunk = %lu\n", sizeof(struct smb_ops) +
540 sizeof(struct smb_mount_data_kernel)); 540 sizeof(struct smb_mount_data_kernel));
541 mem = kmalloc(sizeof(struct smb_ops) + 541 mem = kmalloc(sizeof(struct smb_ops) +
542 sizeof(struct smb_mount_data_kernel), GFP_KERNEL); 542 sizeof(struct smb_mount_data_kernel), GFP_KERNEL);
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c
index feac46050619..d517a27b7f4b 100644
--- a/fs/smbfs/proc.c
+++ b/fs/smbfs/proc.c
@@ -2593,7 +2593,7 @@ smb_proc_getattr_ff(struct smb_sb_info *server, struct dentry *dentry,
2593 fattr->f_mtime.tv_sec = date_dos2unix(server, date, time); 2593 fattr->f_mtime.tv_sec = date_dos2unix(server, date, time);
2594 fattr->f_mtime.tv_nsec = 0; 2594 fattr->f_mtime.tv_nsec = 0;
2595 VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n", 2595 VERBOSE("name=%s, date=%x, time=%x, mtime=%ld\n",
2596 mask, date, time, fattr->f_mtime); 2596 mask, date, time, fattr->f_mtime.tv_sec);
2597 fattr->f_size = DVAL(req->rq_data, 12); 2597 fattr->f_size = DVAL(req->rq_data, 12);
2598 /* ULONG allocation size */ 2598 /* ULONG allocation size */
2599 fattr->attr = WVAL(req->rq_data, 20); 2599 fattr->attr = WVAL(req->rq_data, 20);
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c
index 283c5720c9de..fae8e85af0ed 100644
--- a/fs/smbfs/smbiod.c
+++ b/fs/smbfs/smbiod.c
@@ -227,7 +227,7 @@ int smbiod_retry(struct smb_sb_info *server)
227 printk(KERN_ERR "smb_retry: signal failed [%d]\n", result); 227 printk(KERN_ERR "smb_retry: signal failed [%d]\n", result);
228 goto out; 228 goto out;
229 } 229 }
230 VERBOSE("signalled pid %d\n", pid); 230 VERBOSE("signalled pid %d\n", pid_nr(pid));
231 231
232 /* FIXME: The retried requests should perhaps get a "time boost". */ 232 /* FIXME: The retried requests should perhaps get a "time boost". */
233 233
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/acpi/processor.h b/include/acpi/processor.h
index 26d79f6db8a0..76411b1fc4fd 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -78,7 +78,6 @@ struct acpi_processor_cx {
78struct acpi_processor_power { 78struct acpi_processor_power {
79 struct cpuidle_device dev; 79 struct cpuidle_device dev;
80 struct acpi_processor_cx *state; 80 struct acpi_processor_cx *state;
81 struct acpi_processor_cx *bm_state;
82 unsigned long bm_check_timestamp; 81 unsigned long bm_check_timestamp;
83 u32 default_state; 82 u32 default_state;
84 u32 bm_activity; 83 u32 bm_activity;
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/hardware/iop3xx.h b/include/asm-arm/hardware/iop3xx.h
index fb90b421f31c..ede377ec9147 100644
--- a/include/asm-arm/hardware/iop3xx.h
+++ b/include/asm-arm/hardware/iop3xx.h
@@ -231,7 +231,7 @@ extern int init_atu;
231 IOP3XX_PCI_IO_WINDOW_SIZE - 1) 231 IOP3XX_PCI_IO_WINDOW_SIZE - 1)
232#define IOP3XX_PCI_UPPER_IO_VA (IOP3XX_PCI_LOWER_IO_VA +\ 232#define IOP3XX_PCI_UPPER_IO_VA (IOP3XX_PCI_LOWER_IO_VA +\
233 IOP3XX_PCI_IO_WINDOW_SIZE - 1) 233 IOP3XX_PCI_IO_WINDOW_SIZE - 1)
234#define IOP3XX_PCI_IO_PHYS_TO_VIRT(addr) (((u32) addr -\ 234#define IOP3XX_PCI_IO_PHYS_TO_VIRT(addr) (((u32) (addr) -\
235 IOP3XX_PCI_LOWER_IO_PA) +\ 235 IOP3XX_PCI_LOWER_IO_PA) +\
236 IOP3XX_PCI_LOWER_IO_VA) 236 IOP3XX_PCI_LOWER_IO_VA)
237 237
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index d2e8171d1d4e..5e0182485d8c 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -249,7 +249,7 @@ extern struct page *empty_zero_page;
249#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext) 249#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)
250 250
251#define set_pte_at(mm,addr,ptep,pteval) do { \ 251#define set_pte_at(mm,addr,ptep,pteval) do { \
252 set_pte_ext(ptep, pteval, (addr) >= PAGE_OFFSET ? 0 : PTE_EXT_NG); \ 252 set_pte_ext(ptep, pteval, (addr) >= TASK_SIZE ? 0 : PTE_EXT_NG); \
253 } while (0) 253 } while (0)
254 254
255/* 255/*
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-arm26/irq_regs.h b/include/asm-arm26/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/include/asm-arm26/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h
index c02bc8304b13..dd21182b60e0 100644
--- a/include/asm-avr32/sysreg.h
+++ b/include/asm-avr32/sysreg.h
@@ -215,6 +215,8 @@
215#define SYSREG_IRP_SIZE 6 215#define SYSREG_IRP_SIZE 6
216 216
217/* Bitfields in PCCR */ 217/* Bitfields in PCCR */
218#define SYSREG_PCCR_E_OFFSET 0
219#define SYSREG_PCCR_E_SIZE 1
218#define SYSREG_PCCR_R_OFFSET 1 220#define SYSREG_PCCR_R_OFFSET 1
219#define SYSREG_PCCR_R_SIZE 1 221#define SYSREG_PCCR_R_SIZE 1
220#define SYSREG_PCCR_C_OFFSET 2 222#define SYSREG_PCCR_C_OFFSET 2
diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h
index 14cb8d35924e..39bdd86871cf 100644
--- a/include/asm-blackfin/bfin-global.h
+++ b/include/asm-blackfin/bfin-global.h
@@ -50,8 +50,8 @@ extern unsigned long get_sclk(void);
50extern unsigned long sclk_to_usecs(unsigned long sclk); 50extern unsigned long sclk_to_usecs(unsigned long sclk);
51extern unsigned long usecs_to_sclk(unsigned long usecs); 51extern unsigned long usecs_to_sclk(unsigned long usecs);
52 52
53extern void dump_thread(struct pt_regs *regs, struct user *dump); 53extern void dump_bfin_process(struct pt_regs *regs);
54extern void dump_bfin_regs(struct pt_regs *fp, void *retaddr); 54extern void dump_bfin_mem(void *retaddr);
55extern void dump_bfin_trace_buffer(void); 55extern void dump_bfin_trace_buffer(void);
56 56
57extern int init_arch_irq(void); 57extern int init_arch_irq(void);
@@ -63,6 +63,7 @@ extern void bfin_dcache_init(void);
63extern int read_iloc(void); 63extern int read_iloc(void);
64extern int bfin_console_init(void); 64extern int bfin_console_init(void);
65extern asmlinkage void lower_to_irq14(void); 65extern asmlinkage void lower_to_irq14(void);
66extern asmlinkage void bfin_return_from_exception(void);
66extern void init_exception_vectors(void); 67extern void init_exception_vectors(void);
67extern void init_dma(void); 68extern void init_dma(void);
68extern void program_IAR(void); 69extern void program_IAR(void);
@@ -80,6 +81,7 @@ extern int atomic_sub32(void);
80extern int atomic_ior32(void); 81extern int atomic_ior32(void);
81extern int atomic_and32(void); 82extern int atomic_and32(void);
82extern int atomic_xor32(void); 83extern int atomic_xor32(void);
84extern void safe_user_instruction(void);
83extern void sigreturn_stub(void); 85extern void sigreturn_stub(void);
84 86
85extern void *l1_data_A_sram_alloc(size_t); 87extern void *l1_data_A_sram_alloc(size_t);
diff --git a/include/asm-blackfin/cplbinit.h b/include/asm-blackfin/cplbinit.h
index bec6ecdf1bdb..c4d0596e8e9f 100644
--- a/include/asm-blackfin/cplbinit.h
+++ b/include/asm-blackfin/cplbinit.h
@@ -27,6 +27,9 @@
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 28 */
29 29
30#ifndef __ASM_CPLBINIT_H__
31#define __ASM_CPLBINIT_H__
32
30#include <asm/blackfin.h> 33#include <asm/blackfin.h>
31#include <asm/cplb.h> 34#include <asm/cplb.h>
32 35
@@ -57,8 +60,8 @@ struct cplb_tab {
57 u16 size; 60 u16 size;
58}; 61};
59 62
60extern u_long icplb_table[MAX_CPLBS+1]; 63extern u_long icplb_table[];
61extern u_long dcplb_table[MAX_CPLBS+1]; 64extern u_long dcplb_table[];
62 65
63/* Till here we are discussing about the static memory management model. 66/* Till here we are discussing about the static memory management model.
64 * However, the operating envoronments commonly define more CPLB 67 * However, the operating envoronments commonly define more CPLB
@@ -69,28 +72,16 @@ extern u_long dcplb_table[MAX_CPLBS+1];
69 * This is how Page descriptor Table is implemented in uClinux/Blackfin. 72 * This is how Page descriptor Table is implemented in uClinux/Blackfin.
70 */ 73 */
71 74
72#ifdef CONFIG_CPLB_SWITCH_TAB_L1 75extern u_long ipdt_table[];
73extern u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]__attribute__((l1_data)); 76extern u_long dpdt_table[];
74extern u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]__attribute__((l1_data));
75
76#ifdef CONFIG_CPLB_INFO
77extern u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]__attribute__((l1_data));
78extern u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]__attribute__((l1_data));
79#endif /* CONFIG_CPLB_INFO */
80
81#else
82
83extern u_long ipdt_table[MAX_SWITCH_I_CPLBS+1];
84extern u_long dpdt_table[MAX_SWITCH_D_CPLBS+1];
85
86#ifdef CONFIG_CPLB_INFO 77#ifdef CONFIG_CPLB_INFO
87extern u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]; 78extern u_long ipdt_swapcount_table[];
88extern u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]; 79extern u_long dpdt_swapcount_table[];
89#endif /* CONFIG_CPLB_INFO */ 80#endif
90
91#endif /*CONFIG_CPLB_SWITCH_TAB_L1*/
92 81
93extern unsigned long reserved_mem_dcache_on; 82extern unsigned long reserved_mem_dcache_on;
94extern unsigned long reserved_mem_icache_on; 83extern unsigned long reserved_mem_icache_on;
95 84
96extern void generate_cpl_tables(void); 85extern void generate_cpl_tables(void);
86
87#endif
diff --git a/include/asm-blackfin/delay.h b/include/asm-blackfin/delay.h
index 52e7a10d7ff8..473a8113277f 100644
--- a/include/asm-blackfin/delay.h
+++ b/include/asm-blackfin/delay.h
@@ -1,29 +1,47 @@
1#ifndef _BLACKFIN_DELAY_H
2#define _BLACKFIN_DELAY_H
3
4static inline void __delay(unsigned long loops)
5{
6
7/* FIXME: Currently the assembler doesn't recognize Loop Register Clobbers,
8 uncomment this as soon those are implemented */
9/* 1/*
10 __asm__ __volatile__ ( "\t LSETUP (1f,1f) LC0= %0\n\t" 2 * delay.h - delay functions
11 "1:\t NOP;\n\t" 3 *
12 : :"a" (loops) 4 * Copyright (c) 2004-2007 Analog Devices Inc.
13 : "LT0","LB0","LC0"); 5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __ASM_DELAY_H__
10#define __ASM_DELAY_H__
14 11
15*/ 12#include <asm/mach/anomaly.h>
16 13
17 __asm__ __volatile__("[--SP] = LC0;\n\t" 14static inline void __delay(unsigned long loops)
18 "[--SP] = LT0;\n\t" 15{
19 "[--SP] = LB0;\n\t" 16 if (ANOMALY_05000312) {
20 "LSETUP (1f,1f) LC0 = %0;\n\t" 17 /* Interrupted loads to loop registers -> bad */
21 "1:\t NOP;\n\t" 18 unsigned long tmp;
22 "LB0 = [SP++];\n\t" 19 __asm__ __volatile__(
23 "LT0 = [SP++];\n\t" 20 "[--SP] = LC0;"
24 "LC0 = [SP++];\n" 21 "[--SP] = LT0;"
25 : 22 "[--SP] = LB0;"
26 :"a" (loops)); 23 "LSETUP (1f,1f) LC0 = %1;"
24 "1: NOP;"
25 /* We take advantage of the fact that LC0 is 0 at
26 * the end of the loop. Otherwise we'd need some
27 * NOPs after the CLI here.
28 */
29 "CLI %0;"
30 "LB0 = [SP++];"
31 "LT0 = [SP++];"
32 "LC0 = [SP++];"
33 "STI %0;"
34 : "=d" (tmp)
35 : "a" (loops)
36 );
37 } else
38 __asm__ __volatile__ (
39 "LSETUP(1f, 1f) LC0 = %0;"
40 "1: NOP;"
41 :
42 : "a" (loops)
43 : "LT0", "LB0", "LC0"
44 );
27} 45}
28 46
29#include <linux/param.h> /* needed for HZ */ 47#include <linux/param.h> /* needed for HZ */
@@ -41,4 +59,4 @@ static inline void udelay(unsigned long usecs)
41 __delay(usecs * loops_per_jiffy / (1000000 / HZ)); 59 __delay(usecs * loops_per_jiffy / (1000000 / HZ));
42} 60}
43 61
44#endif /* defined(_BLACKFIN_DELAY_H) */ 62#endif
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/io.h b/include/asm-blackfin/io.h
index d1d2e6be3b59..1601d62f39a5 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -122,6 +122,7 @@ extern void outsl(unsigned long port, const void *addr, unsigned long count);
122extern void insb(unsigned long port, void *addr, unsigned long count); 122extern void insb(unsigned long port, void *addr, unsigned long count);
123extern void insw(unsigned long port, void *addr, unsigned long count); 123extern void insw(unsigned long port, void *addr, unsigned long count);
124extern void insl(unsigned long port, void *addr, unsigned long count); 124extern void insl(unsigned long port, void *addr, unsigned long count);
125extern void insl_16(unsigned long port, void *addr, unsigned long count);
125 126
126extern void dma_outsb(unsigned long port, const void *addr, unsigned short count); 127extern void dma_outsb(unsigned long port, const void *addr, unsigned short count);
127extern void dma_outsw(unsigned long port, const void *addr, unsigned short count); 128extern void dma_outsw(unsigned long port, const void *addr, unsigned short count);
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-bf527/irq.h b/include/asm-blackfin/mach-bf527/irq.h
index 304f5bcfebe4..4e2b3f2020e5 100644
--- a/include/asm-blackfin/mach-bf527/irq.h
+++ b/include/asm-blackfin/mach-bf527/irq.h
@@ -176,11 +176,7 @@
176 176
177#define GPIO_IRQ_BASE IRQ_PF0 177#define GPIO_IRQ_BASE IRQ_PF0
178 178
179#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
180#define NR_IRQS (IRQ_PH15+1) 179#define NR_IRQS (IRQ_PH15+1)
181#else
182#define NR_IRQS (SYS_IRQS+1)
183#endif
184 180
185#define IVG7 7 181#define IVG7 7
186#define IVG8 8 182#define IVG8 8
diff --git a/include/asm-blackfin/mach-bf527/mem_map.h b/include/asm-blackfin/mach-bf527/mem_map.h
index c5aa20102b24..193082deaa4e 100644
--- a/include/asm-blackfin/mach-bf527/mem_map.h
+++ b/include/asm-blackfin/mach-bf527/mem_map.h
@@ -47,6 +47,7 @@
47/* Boot ROM Memory */ 47/* Boot ROM Memory */
48 48
49#define BOOT_ROM_START 0xEF000000 49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x8000
50 51
51/* Level 1 Memory */ 52/* Level 1 Memory */
52 53
@@ -90,9 +91,7 @@
90 91
91/* Scratch Pad Memory */ 92/* Scratch Pad Memory */
92 93
93#if defined(CONFIG_BF527) || defined(CONFIG_BF536) || defined(CONFIG_BF534)
94#define L1_SCRATCH_START 0xFFB00000 94#define L1_SCRATCH_START 0xFFB00000
95#define L1_SCRATCH_LENGTH 0x1000 95#define L1_SCRATCH_LENGTH 0x1000
96#endif
97 96
98#endif /* _MEM_MAP_527_H_ */ 97#endif /* _MEM_MAP_527_H_ */
diff --git a/include/asm-blackfin/mach-bf533/irq.h b/include/asm-blackfin/mach-bf533/irq.h
index 452fb825d891..832e6f6122da 100644
--- a/include/asm-blackfin/mach-bf533/irq.h
+++ b/include/asm-blackfin/mach-bf533/irq.h
@@ -130,11 +130,7 @@ Core Emulation **
130 130
131#define GPIO_IRQ_BASE IRQ_PF0 131#define GPIO_IRQ_BASE IRQ_PF0
132 132
133#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
134#define NR_IRQS (IRQ_PF15+1) 133#define NR_IRQS (IRQ_PF15+1)
135#else
136#define NR_IRQS SYS_IRQS
137#endif
138 134
139#define IVG7 7 135#define IVG7 7
140#define IVG8 8 136#define IVG8 8
diff --git a/include/asm-blackfin/mach-bf533/mem_map.h b/include/asm-blackfin/mach-bf533/mem_map.h
index 94d8c4062eb7..bd30b6f3be00 100644
--- a/include/asm-blackfin/mach-bf533/mem_map.h
+++ b/include/asm-blackfin/mach-bf533/mem_map.h
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * File: include/asm-blackfin/mach-bf533/mem_map.h 2 * File: include/asm-blackfin/mach-bf533/mem_map.h
4 * Based on: 3 * Based on:
@@ -48,6 +47,7 @@
48/* Boot ROM Memory */ 47/* Boot ROM Memory */
49 48
50#define BOOT_ROM_START 0xEF000000 49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x400
51 51
52/* Level 1 Memory */ 52/* Level 1 Memory */
53 53
@@ -160,9 +160,7 @@
160 160
161/* Scratch Pad Memory */ 161/* Scratch Pad Memory */
162 162
163#if defined(CONFIG_BF533) || defined(CONFIG_BF532) || defined(CONFIG_BF531)
164#define L1_SCRATCH_START 0xFFB00000 163#define L1_SCRATCH_START 0xFFB00000
165#define L1_SCRATCH_LENGTH 0x1000 164#define L1_SCRATCH_LENGTH 0x1000
166#endif
167 165
168#endif /* _MEM_MAP_533_H_ */ 166#endif /* _MEM_MAP_533_H_ */
diff --git a/include/asm-blackfin/mach-bf537/irq.h b/include/asm-blackfin/mach-bf537/irq.h
index 36c44bc1a917..be6f2ff77f31 100644
--- a/include/asm-blackfin/mach-bf537/irq.h
+++ b/include/asm-blackfin/mach-bf537/irq.h
@@ -162,11 +162,7 @@ Core Emulation **
162 162
163#define GPIO_IRQ_BASE IRQ_PF0 163#define GPIO_IRQ_BASE IRQ_PF0
164 164
165#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
166#define NR_IRQS (IRQ_PH15+1) 165#define NR_IRQS (IRQ_PH15+1)
167#else
168#define NR_IRQS (IRQ_UART1_ERROR+1)
169#endif
170 166
171#define IVG7 7 167#define IVG7 7
172#define IVG8 8 168#define IVG8 8
diff --git a/include/asm-blackfin/mach-bf537/mem_map.h b/include/asm-blackfin/mach-bf537/mem_map.h
index 18759e38eaae..5c6726d6f3b1 100644
--- a/include/asm-blackfin/mach-bf537/mem_map.h
+++ b/include/asm-blackfin/mach-bf537/mem_map.h
@@ -47,6 +47,7 @@
47/* Boot ROM Memory */ 47/* Boot ROM Memory */
48 48
49#define BOOT_ROM_START 0xEF000000 49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x800
50 51
51/* Level 1 Memory */ 52/* Level 1 Memory */
52 53
@@ -167,9 +168,7 @@
167 168
168/* Scratch Pad Memory */ 169/* Scratch Pad Memory */
169 170
170#if defined(CONFIG_BF537) || defined(CONFIG_BF536) || defined(CONFIG_BF534)
171#define L1_SCRATCH_START 0xFFB00000 171#define L1_SCRATCH_START 0xFFB00000
172#define L1_SCRATCH_LENGTH 0x1000 172#define L1_SCRATCH_LENGTH 0x1000
173#endif
174 173
175#endif /* _MEM_MAP_537_H_ */ 174#endif /* _MEM_MAP_537_H_ */
diff --git a/include/asm-blackfin/mach-bf548/bf548.h b/include/asm-blackfin/mach-bf548/bf548.h
index 7e6d349beb08..e748588e8930 100644
--- a/include/asm-blackfin/mach-bf548/bf548.h
+++ b/include/asm-blackfin/mach-bf548/bf548.h
@@ -106,24 +106,22 @@
106 106
107#define AMGCTLVAL (V_AMBEN | V_AMCKEN) 107#define AMGCTLVAL (V_AMBEN | V_AMCKEN)
108 108
109#ifdef CONFIG_BF542 109#if defined(CONFIG_BF542)
110#define CPU "BF542" 110# define CPU "BF542"
111#define CPUID 0x027c8000 111# define CPUID 0x027c8000
112#endif 112#elif defined(CONFIG_BF544)
113#ifdef CONFIG_BF544 113# define CPU "BF544"
114#define CPU "BF544" 114# define CPUID 0x027c8000
115#define CPUID 0x027c8000 115#elif defined(CONFIG_BF547)
116#endif 116# define CPU "BF547"
117#ifdef CONFIG_BF548 117#elif defined(CONFIG_BF548)
118#define CPU "BF548" 118# define CPU "BF548"
119#define CPUID 0x027c6000 119# define CPUID 0x027c6000
120#endif 120#elif defined(CONFIG_BF549)
121#ifdef CONFIG_BF549 121# define CPU "BF549"
122#define CPU "BF549" 122#else
123#endif 123# define CPU "UNKNOWN"
124#ifndef CPU 124# define CPUID 0x0
125#define CPU "UNKNOWN"
126#define CPUID 0x0
127#endif 125#endif
128 126
129#endif /* __MACH_BF48_H__ */ 127#endif /* __MACH_BF48_H__ */
diff --git a/include/asm-blackfin/mach-bf548/defBF544.h b/include/asm-blackfin/mach-bf548/defBF544.h
index 760307e34b9e..b8b9870e2697 100644
--- a/include/asm-blackfin/mach-bf548/defBF544.h
+++ b/include/asm-blackfin/mach-bf548/defBF544.h
@@ -645,7 +645,7 @@
645 645
646/* Bit masks for HOST_STATUS */ 646/* Bit masks for HOST_STATUS */
647 647
648#define READY 0x1 /* DMA Ready */ 648#define DMA_READY 0x1 /* DMA Ready */
649#define FIFOFULL 0x2 /* FIFO Full */ 649#define FIFOFULL 0x2 /* FIFO Full */
650#define FIFOEMPTY 0x4 /* FIFO Empty */ 650#define FIFOEMPTY 0x4 /* FIFO Empty */
651#define COMPLETE 0x8 /* DMA Complete */ 651#define COMPLETE 0x8 /* DMA Complete */
diff --git a/include/asm-blackfin/mach-bf548/defBF548.h b/include/asm-blackfin/mach-bf548/defBF548.h
index 70af33c963b0..ecbca952985c 100644
--- a/include/asm-blackfin/mach-bf548/defBF548.h
+++ b/include/asm-blackfin/mach-bf548/defBF548.h
@@ -1007,7 +1007,7 @@
1007 1007
1008/* Bit masks for HOST_STATUS */ 1008/* Bit masks for HOST_STATUS */
1009 1009
1010#define READY 0x1 /* DMA Ready */ 1010#define DMA_READY 0x1 /* DMA Ready */
1011#define FIFOFULL 0x2 /* FIFO Full */ 1011#define FIFOFULL 0x2 /* FIFO Full */
1012#define FIFOEMPTY 0x4 /* FIFO Empty */ 1012#define FIFOEMPTY 0x4 /* FIFO Empty */
1013#define COMPLETE 0x8 /* DMA Complete */ 1013#define COMPLETE 0x8 /* DMA Complete */
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/irq.h b/include/asm-blackfin/mach-bf548/irq.h
index 3b08cf9bd6f3..9fb7bc5399a8 100644
--- a/include/asm-blackfin/mach-bf548/irq.h
+++ b/include/asm-blackfin/mach-bf548/irq.h
@@ -338,11 +338,7 @@ Events (highest priority) EMU 0
338 338
339#define GPIO_IRQ_BASE IRQ_PA0 339#define GPIO_IRQ_BASE IRQ_PA0
340 340
341#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
342#define NR_IRQS (IRQ_PJ15+1) 341#define NR_IRQS (IRQ_PJ15+1)
343#else
344#define NR_IRQS (SYS_IRQS+1)
345#endif
346 342
347/* For compatibility reasons with existing code */ 343/* For compatibility reasons with existing code */
348 344
diff --git a/include/asm-blackfin/mach-bf548/mem_map.h b/include/asm-blackfin/mach-bf548/mem_map.h
index ec1597e31831..f99f47bc3a07 100644
--- a/include/asm-blackfin/mach-bf548/mem_map.h
+++ b/include/asm-blackfin/mach-bf548/mem_map.h
@@ -47,6 +47,12 @@
47/* Boot ROM Memory */ 47/* Boot ROM Memory */
48 48
49#define BOOT_ROM_START 0xEF000000 49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x1000
51
52/* L1 Instruction ROM */
53
54#define L1_ROM_START 0xFFA14000
55#define L1_ROM_LENGTH 0x10000
50 56
51/* Level 1 Memory */ 57/* Level 1 Memory */
52 58
@@ -87,11 +93,19 @@
87#define BFIN_DSUPBANKS 0 93#define BFIN_DSUPBANKS 0
88#endif /*CONFIG_BFIN_DCACHE*/ 94#endif /*CONFIG_BFIN_DCACHE*/
89 95
96/* Level 2 Memory */
97#if !defined(CONFIG_BF542)
98# define L2_START 0xFEB00000
99# if defined(CONFIG_BF544)
100# define L2_LENGTH 0x10000
101# else
102# define L2_LENGTH 0x20000
103# endif
104#endif
105
90/* Scratch Pad Memory */ 106/* Scratch Pad Memory */
91 107
92#if defined(CONFIG_BF54x)
93#define L1_SCRATCH_START 0xFFB00000 108#define L1_SCRATCH_START 0xFFB00000
94#define L1_SCRATCH_LENGTH 0x1000 109#define L1_SCRATCH_LENGTH 0x1000
95#endif
96 110
97#endif/* _MEM_MAP_548_H_ */ 111#endif/* _MEM_MAP_548_H_ */
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/bf561.h b/include/asm-blackfin/mach-bf561/bf561.h
index 17e1d5dcef02..3ef9e5f36136 100644
--- a/include/asm-blackfin/mach-bf561/bf561.h
+++ b/include/asm-blackfin/mach-bf561/bf561.h
@@ -33,25 +33,6 @@
33#define SUPPORTED_REVID 0x3 33#define SUPPORTED_REVID 0x3
34 34
35#define OFFSET_(x) ((x) & 0x0000FFFF) 35#define OFFSET_(x) ((x) & 0x0000FFFF)
36#define L1_ISRAM 0xFFA00000
37#define L1_ISRAM_END 0xFFA04000
38#define DATA_BANKA_SRAM 0xFF800000
39#define DATA_BANKA_SRAM_END 0xFF804000
40#define DATA_BANKB_SRAM 0xFF900000
41#define DATA_BANKB_SRAM_END 0xFF904000
42#define L1_DSRAMA 0xFF800000
43#define L1_DSRAMA_END 0xFF804000
44#define L1_DSRAMB 0xFF900000
45#define L1_DSRAMB_END 0xFF904000
46#define L2_SRAM 0xFEB00000
47#define L2_SRAM_END 0xFEB20000
48#define AMB_FLASH 0x20000000
49#define AMB_FLASH_END 0x21000000
50#define AMB_FLASH_LENGTH 0x01000000
51#define L1_ISRAM_LENGTH 0x4000
52#define L1_DSRAMA_LENGTH 0x4000
53#define L1_DSRAMB_LENGTH 0x4000
54#define L2_SRAM_LENGTH 0x20000
55 36
56/*some misc defines*/ 37/*some misc defines*/
57#define IMASK_IVG15 0x8000 38#define IMASK_IVG15 0x8000
diff --git a/include/asm-blackfin/mach-bf561/defBF561.h b/include/asm-blackfin/mach-bf561/defBF561.h
index bf7dc4e00065..c3c0eb13c819 100644
--- a/include/asm-blackfin/mach-bf561/defBF561.h
+++ b/include/asm-blackfin/mach-bf561/defBF561.h
@@ -55,6 +55,10 @@
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 DOUBLE_FAULT (DOUBLE_FAULT_B|DOUBLE_FAULT_A)
59#define RESET_DOUBLE (SWRST_DBL_FAULT_B|SWRST_DBL_FAULT_A)
60#define RESET_WDOG (SWRST_WDT_B|SWRST_WDT_A)
61#define RESET_SOFTWARE (SWRST_OCCURRED)
58 62
59/* System Reset and Interrupt Controller registers for core A (0xFFC0 0100-0xFFC0 01FF) */ 63/* System Reset and Interrupt Controller registers for core A (0xFFC0 0100-0xFFC0 01FF) */
60#define SICA_SWRST 0xFFC00100 /* Software Reset register */ 64#define SICA_SWRST 0xFFC00100 /* Software Reset register */
@@ -874,12 +878,14 @@
874#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */ 878#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */
875 879
876/* SWRST Mask */ 880/* SWRST Mask */
877#define SYSTEM_RESET 0x00000007 /* Initiates a system software reset */ 881#define SYSTEM_RESET 0x0007 /* Initiates a system software reset */
878#define SWRST_DBL_FAULT_B 0x00000800 /* SWRST Core B Double Fault */ 882#define DOUBLE_FAULT_A 0x0008 /* Core A Double Fault Causes Reset */
879#define SWRST_DBL_FAULT_A 0x00001000 /* SWRST Core A Double Fault */ 883#define DOUBLE_FAULT_B 0x0010 /* Core B Double Fault Causes Reset */
880#define SWRST_WDT_B 0x00002000 /* SWRST Watchdog B */ 884#define SWRST_DBL_FAULT_A 0x0800 /* SWRST Core A Double Fault */
881#define SWRST_WDT_A 0x00004000 /* SWRST Watchdog A */ 885#define SWRST_DBL_FAULT_B 0x1000 /* SWRST Core B Double Fault */
882#define SWRST_OCCURRED 0x00008000 /* SWRST Status */ 886#define SWRST_WDT_B 0x2000 /* SWRST Watchdog B */
887#define SWRST_WDT_A 0x4000 /* SWRST Watchdog A */
888#define SWRST_OCCURRED 0x8000 /* SWRST Status */
883 889
884/* ************* SYSTEM INTERRUPT CONTROLLER MASKS ***************** */ 890/* ************* SYSTEM INTERRUPT CONTROLLER MASKS ***************** */
885 891
diff --git a/include/asm-blackfin/mach-bf561/irq.h b/include/asm-blackfin/mach-bf561/irq.h
index 12789927db3d..83f0383957d2 100644
--- a/include/asm-blackfin/mach-bf561/irq.h
+++ b/include/asm-blackfin/mach-bf561/irq.h
@@ -291,11 +291,7 @@
291 291
292#define GPIO_IRQ_BASE IRQ_PF0 292#define GPIO_IRQ_BASE IRQ_PF0
293 293
294#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
295#define NR_IRQS (IRQ_PF47 + 1) 294#define NR_IRQS (IRQ_PF47 + 1)
296#else
297#define NR_IRQS SYS_IRQS
298#endif
299 295
300#define IVG7 7 296#define IVG7 7
301#define IVG8 8 297#define IVG8 8
diff --git a/include/asm-blackfin/mach-bf561/mem_map.h b/include/asm-blackfin/mach-bf561/mem_map.h
index f7ac09cf2c3d..c26d8486cc4b 100644
--- a/include/asm-blackfin/mach-bf561/mem_map.h
+++ b/include/asm-blackfin/mach-bf561/mem_map.h
@@ -19,6 +19,11 @@
19#define ASYNC_BANK0_BASE 0x20000000 /* Async Bank 0 */ 19#define ASYNC_BANK0_BASE 0x20000000 /* Async Bank 0 */
20#define ASYNC_BANK0_SIZE 0x04000000 /* 64M */ 20#define ASYNC_BANK0_SIZE 0x04000000 /* 64M */
21 21
22/* Boot ROM Memory */
23
24#define BOOT_ROM_START 0xEF000000
25#define BOOT_ROM_LENGTH 0x800
26
22/* Level 1 Memory */ 27/* Level 1 Memory */
23 28
24#ifdef CONFIG_BFIN_ICACHE 29#ifdef CONFIG_BFIN_ICACHE
@@ -67,9 +72,7 @@
67 72
68/* Scratch Pad Memory */ 73/* Scratch Pad Memory */
69 74
70#if defined(CONFIG_BF561)
71#define L1_SCRATCH_START 0xFFB00000 75#define L1_SCRATCH_START 0xFFB00000
72#define L1_SCRATCH_LENGTH 0x1000 76#define L1_SCRATCH_LENGTH 0x1000
73#endif
74 77
75#endif /* _MEM_MAP_533_H_ */ 78#endif /* _MEM_MAP_533_H_ */
diff --git a/include/asm-blackfin/mach-common/def_LPBlackfin.h b/include/asm-blackfin/mach-common/def_LPBlackfin.h
index c1d8c4a78fcf..e8967f6124f7 100644
--- a/include/asm-blackfin/mach-common/def_LPBlackfin.h
+++ b/include/asm-blackfin/mach-common/def_LPBlackfin.h
@@ -46,7 +46,7 @@
46#endif 46#endif
47 47
48#define bfin_read8(addr) ({ \ 48#define bfin_read8(addr) ({ \
49 uint8_t __v; \ 49 uint32_t __v; \
50 __asm__ __volatile__( \ 50 __asm__ __volatile__( \
51 NOP_PAD_ANOMALY_05000198 \ 51 NOP_PAD_ANOMALY_05000198 \
52 "%0 = b[%1] (z);" \ 52 "%0 = b[%1] (z);" \
@@ -56,7 +56,7 @@
56 __v; }) 56 __v; })
57 57
58#define bfin_read16(addr) ({ \ 58#define bfin_read16(addr) ({ \
59 uint16_t __v; \ 59 uint32_t __v; \
60 __asm__ __volatile__( \ 60 __asm__ __volatile__( \
61 NOP_PAD_ANOMALY_05000198 \ 61 NOP_PAD_ANOMALY_05000198 \
62 "%0 = w[%1] (z);" \ 62 "%0 = w[%1] (z);" \
@@ -80,7 +80,7 @@
80 NOP_PAD_ANOMALY_05000198 \ 80 NOP_PAD_ANOMALY_05000198 \
81 "b[%0] = %1;" \ 81 "b[%0] = %1;" \
82 : \ 82 : \
83 : "a" (addr), "d" (val) \ 83 : "a" (addr), "d" ((uint8_t)(val)) \
84 : "memory" \ 84 : "memory" \
85 ) 85 )
86 86
@@ -89,7 +89,7 @@
89 NOP_PAD_ANOMALY_05000198 \ 89 NOP_PAD_ANOMALY_05000198 \
90 "w[%0] = %1;" \ 90 "w[%0] = %1;" \
91 : \ 91 : \
92 : "a" (addr), "d" (val) \ 92 : "a" (addr), "d" ((uint16_t)(val)) \
93 : "memory" \ 93 : "memory" \
94 ) 94 )
95 95
diff --git a/include/asm-blackfin/page_offset.h b/include/asm-blackfin/page_offset.h
index 3b671d5fd70d..cbaff24b4b25 100644
--- a/include/asm-blackfin/page_offset.h
+++ b/include/asm-blackfin/page_offset.h
@@ -1,6 +1,6 @@
1 1
2/* This handles the memory map.. */ 2/* This handles the memory map.. */
3 3
4#ifdef CONFIG_BFIN 4#ifdef CONFIG_BLACKFIN
5#define PAGE_OFFSET_RAW 0x00000000 5#define PAGE_OFFSET_RAW 0x00000000
6#endif 6#endif
diff --git a/include/asm-blackfin/string.h b/include/asm-blackfin/string.h
index e8ada91ab002..321f4d96e4ae 100644
--- a/include/asm-blackfin/string.h
+++ b/include/asm-blackfin/string.h
@@ -1,6 +1,8 @@
1#ifndef _BLACKFIN_STRING_H_ 1#ifndef _BLACKFIN_STRING_H_
2#define _BLACKFIN_STRING_H_ 2#define _BLACKFIN_STRING_H_
3 3
4#include <linux/types.h>
5
4#ifdef __KERNEL__ /* only set these up for kernel code */ 6#ifdef __KERNEL__ /* only set these up for kernel code */
5 7
6#define __HAVE_ARCH_STRCPY 8#define __HAVE_ARCH_STRCPY
diff --git a/include/asm-blackfin/traps.h b/include/asm-blackfin/traps.h
index fe365b1b7ca8..ee1cbf73a9ab 100644
--- a/include/asm-blackfin/traps.h
+++ b/include/asm-blackfin/traps.h
@@ -48,28 +48,80 @@
48 48
49#ifndef __ASSEMBLY__ 49#ifndef __ASSEMBLY__
50 50
51#define HWC_x2 "System MMR Error\nAn error occurred due to an invalid access to an System MMR location\nPossible reason: a 32-bit register is accessed with a 16-bit instruction,\nor a 16-bit register is accessed with a 32-bit instruction.\n" 51#define HWC_x2(level) \
52#define HWC_x3 "External Memory Addressing Error\n" 52 "System MMR Error\n" \
53#define HWC_x12 "Performance Monitor Overflow\n" 53 level " - An error occurred due to an invalid access to an System MMR location\n" \
54#define HWC_x18 "RAISE 5 instruction\n Software issued a RAISE 5 instruction to invoke the Hardware\n" 54 level " Possible reason: a 32-bit register is accessed with a 16-bit instruction\n" \
55#define HWC_default "Reserved\n" 55 level " or a 16-bit register is accessed with a 32-bit instruction.\n"
56 56#define HWC_x3(level) \
57#define EXC_0x03 "Application stack overflow\n - Please increase the stack size of the application using elf2flt -s option,\n and/or reduce the stack use of the application.\n" 57 "External Memory Addressing Error\n"
58#define EXC_0x10 "Single step\n - When the processor is in single step mode, every instruction\n generates an exception. Primarily used for debugging.\n" 58#define HWC_x12(level) \
59#define EXC_0x11 "Exception caused by a trace buffer full condition\n - The processor takes this exception when the trace\n buffer overflows (only when enabled by the Trace Unit Control register).\n" 59 "Performance Monitor Overflow\n"
60#define EXC_0x21 "Undefined instruction\n - May be used to emulate instructions that are not defined for\n a particular processor implementation.\n" 60#define HWC_x18(level) \
61#define EXC_0x22 "Illegal instruction combination\n - See section for multi-issue rules in the ADSP-BF53x Blackfin\n Processor Instruction Set Reference.\n" 61 "RAISE 5 instruction\n" \
62#define EXC_0x23 "Data access CPLB protection violation\n - Attempted read or write to Supervisor resource,\n or illegal data memory access. \n" 62 level " Software issued a RAISE 5 instruction to invoke the Hardware\n"
63#define EXC_0x24 "Data access misaligned address violation\n - Attempted misaligned data memory or data cache access.\n" 63#define HWC_default(level) \
64#define EXC_0x25 "Unrecoverable event\n - For example, an exception generated while processing a previous exception.\n" 64 "Reserved\n"
65#define EXC_0x26 "Data access CPLB miss\n - Used by the MMU to signal a CPLB miss on a data access.\n" 65#define EXC_0x03(level) \
66#define EXC_0x27 "Data access multiple CPLB hits\n - More than one CPLB entry matches data fetch address.\n" 66 "Application stack overflow\n" \
67#define EXC_0x28 "Program Sequencer Exception caused by an emulation watchpoint match\n - There is a watchpoint match, and one of the EMUSW\n bits in the Watchpoint Instruction Address Control register (WPIACTL) is set.\n" 67 level " - Please increase the stack size of the application using elf2flt -s option,\n" \
68#define EXC_0x2A "Instruction fetch misaligned address violation\n - Attempted misaligned instruction cache fetch. On a misaligned instruction fetch exception,\n the return address provided in RETX is the destination address which is misaligned, rather than the address of the offending instruction.\n" 68 level " and/or reduce the stack use of the application.\n"
69#define EXC_0x2B "CPLB protection violation\n - Illegal instruction fetch access (memory protection violation).\n" 69#define EXC_0x10(level) \
70#define EXC_0x2C "Instruction fetch CPLB miss\n - CPLB miss on an instruction fetch.\n" 70 "Single step\n" \
71#define EXC_0x2D "Instruction fetch multiple CPLB hits\n - More than one CPLB entry matches instruction fetch address.\n" 71 level " - When the processor is in single step mode, every instruction\n" \
72#define EXC_0x2E "Illegal use of supervisor resource\n - Attempted to use a Supervisor register or instruction from User mode.\n Supervisor resources are registers and instructions that are reserved\n for Supervisor use: Supervisor only registers, all MMRs, and Supervisor\n only instructions.\n" 72 level " generates an exception. Primarily used for debugging.\n"
73#define EXC_0x11(level) \
74 "Exception caused by a trace buffer full condition\n" \
75 level " - The processor takes this exception when the trace\n" \
76 level " buffer overflows (only when enabled by the Trace Unit Control register).\n"
77#define EXC_0x21(level) \
78 "Undefined instruction\n" \
79 level " - May be used to emulate instructions that are not defined for\n" \
80 level " a particular processor implementation.\n"
81#define EXC_0x22(level) \
82 "Illegal instruction combination\n" \
83 level " - See section for multi-issue rules in the ADSP-BF53x Blackfin\n" \
84 level " Processor Instruction Set Reference.\n"
85#define EXC_0x23(level) \
86 "Data access CPLB protection violation\n" \
87 level " - Attempted read or write to Supervisor resource,\n" \
88 level " or illegal data memory access. \n"
89#define EXC_0x24(level) \
90 "Data access misaligned address violation\n" \
91 level " - Attempted misaligned data memory or data cache access.\n"
92#define EXC_0x25(level) \
93 "Unrecoverable event\n" \
94 level " - For example, an exception generated while processing a previous exception.\n"
95#define EXC_0x26(level) \
96 "Data access CPLB miss\n" \
97 level " - Used by the MMU to signal a CPLB miss on a data access.\n"
98#define EXC_0x27(level) \
99 "Data access multiple CPLB hits\n" \
100 level " - More than one CPLB entry matches data fetch address.\n"
101#define EXC_0x28(level) \
102 "Program Sequencer Exception caused by an emulation watchpoint match\n" \
103 level " - There is a watchpoint match, and one of the EMUSW\n" \
104 level " bits in the Watchpoint Instruction Address Control register (WPIACTL) is set.\n"
105#define EXC_0x2A(level) \
106 "Instruction fetch misaligned address violation\n" \
107 level " - Attempted misaligned instruction cache fetch. On a misaligned instruction fetch\n" \
108 level " exception, the return address provided in RETX is the destination address which is\n" \
109 level " misaligned, rather than the address of the offending instruction.\n"
110#define EXC_0x2B(level) \
111 "CPLB protection violation\n" \
112 level " - Illegal instruction fetch access (memory protection violation).\n"
113#define EXC_0x2C(level) \
114 "Instruction fetch CPLB miss\n" \
115 level " - CPLB miss on an instruction fetch.\n"
116#define EXC_0x2D(level) \
117 "Instruction fetch multiple CPLB hits\n" \
118 level " - More than one CPLB entry matches instruction fetch address.\n"
119#define EXC_0x2E(level) \
120 "Illegal use of supervisor resource\n" \
121 level " - Attempted to use a Supervisor register or instruction from User mode.\n" \
122 level " Supervisor resources are registers and instructions that are reserved\n" \
123 level " for Supervisor use: Supervisor only registers, all MMRs, and Supervisor\n" \
124 level " only instructions.\n"
73 125
74#endif /* __ASSEMBLY__ */ 126#endif /* __ASSEMBLY__ */
75#endif /* _BFIN_TRAPS_H */ 127#endif /* _BFIN_TRAPS_H */
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h
index 0b51a87e5532..2949a945876a 100644
--- a/include/asm-cris/atomic.h
+++ b/include/asm-cris/atomic.h
@@ -3,6 +3,8 @@
3#ifndef __ASM_CRIS_ATOMIC__ 3#ifndef __ASM_CRIS_ATOMIC__
4#define __ASM_CRIS_ATOMIC__ 4#define __ASM_CRIS_ATOMIC__
5 5
6#include <linux/compiler.h>
7
6#include <asm/system.h> 8#include <asm/system.h>
7#include <asm/arch/atomic.h> 9#include <asm/arch/atomic.h>
8 10
diff --git a/include/asm-cris/checksum.h b/include/asm-cris/checksum.h
index 180dbf2757b0..c6c5be62c698 100644
--- a/include/asm-cris/checksum.h
+++ b/include/asm-cris/checksum.h
@@ -62,7 +62,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
62 * returns a 16-bit checksum, already complemented 62 * returns a 16-bit checksum, already complemented
63 */ 63 */
64 64
65static inline __sum16 int csum_tcpudp_magic(__be32 saddr, __be32 daddr, 65static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
66 unsigned short len, 66 unsigned short len,
67 unsigned short proto, 67 unsigned short proto,
68 __wsum sum) 68 __wsum sum)
diff --git a/include/asm-cris/ethernet.h b/include/asm-cris/ethernet.h
index 30da58a7d00d..4d58652c3a49 100644
--- a/include/asm-cris/ethernet.h
+++ b/include/asm-cris/ethernet.h
@@ -15,4 +15,7 @@
15#define SET_ETH_DUPLEX_AUTO SIOCDEVPRIVATE+3 /* Auto neg duplex */ 15#define SET_ETH_DUPLEX_AUTO SIOCDEVPRIVATE+3 /* Auto neg duplex */
16#define SET_ETH_DUPLEX_HALF SIOCDEVPRIVATE+4 /* Full duplex */ 16#define SET_ETH_DUPLEX_HALF SIOCDEVPRIVATE+4 /* Full duplex */
17#define SET_ETH_DUPLEX_FULL SIOCDEVPRIVATE+5 /* Half duplex */ 17#define SET_ETH_DUPLEX_FULL SIOCDEVPRIVATE+5 /* Half duplex */
18#define SET_ETH_ENABLE_LEDS SIOCDEVPRIVATE+6 /* Enable net LEDs */
19#define SET_ETH_DISABLE_LEDS SIOCDEVPRIVATE+7 /* Disable net LEDs */
20#define SET_ETH_AUTONEG SIOCDEVPRIVATE+8
18#endif /* _CRIS_ETHERNET_H */ 21#endif /* _CRIS_ETHERNET_H */
diff --git a/include/asm-cris/fasttimer.h b/include/asm-cris/fasttimer.h
index a3a77132ce32..8f8a8d6c9653 100644
--- a/include/asm-cris/fasttimer.h
+++ b/include/asm-cris/fasttimer.h
@@ -1,9 +1,8 @@
1/* $Id: fasttimer.h,v 1.3 2004/05/14 10:19:19 starvik Exp $ 1/*
2 * linux/include/asm-cris/fasttimer.h 2 * linux/include/asm-cris/fasttimer.h
3 * 3 *
4 * Fast timers for ETRAX100LX 4 * Fast timers for ETRAX100LX
5 * This may be useful in other OS than Linux so use 2 space indentation... 5 * Copyright (C) 2000-2007 Axis Communications AB
6 * Copyright (C) 2000, 2002 Axis Communications AB
7 */ 6 */
8#include <linux/time.h> /* struct timeval */ 7#include <linux/time.h> /* struct timeval */
9#include <linux/timex.h> 8#include <linux/timex.h>
@@ -12,11 +11,16 @@
12 11
13typedef void fast_timer_function_type(unsigned long); 12typedef void fast_timer_function_type(unsigned long);
14 13
14struct fasttime_t {
15 unsigned long tv_jiff; /* jiffies */
16 unsigned long tv_usec; /* microseconds */
17};
18
15struct fast_timer{ /* Close to timer_list */ 19struct fast_timer{ /* Close to timer_list */
16 struct fast_timer *next; 20 struct fast_timer *next;
17 struct fast_timer *prev; 21 struct fast_timer *prev;
18 struct timeval tv_set; 22 struct fasttime_t tv_set;
19 struct timeval tv_expires; 23 struct fasttime_t tv_expires;
20 unsigned long delay_us; 24 unsigned long delay_us;
21 fast_timer_function_type *function; 25 fast_timer_function_type *function;
22 unsigned long data; 26 unsigned long data;
@@ -38,6 +42,6 @@ int del_fast_timer(struct fast_timer * t);
38void schedule_usleep(unsigned long us); 42void schedule_usleep(unsigned long us);
39 43
40 44
41void fast_timer_init(void); 45int fast_timer_init(void);
42 46
43#endif 47#endif
diff --git a/include/asm-cris/hardirq.h b/include/asm-cris/hardirq.h
index 1c13dd3faac3..74178adeb1cd 100644
--- a/include/asm-cris/hardirq.h
+++ b/include/asm-cris/hardirq.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_HARDIRQ_H 1#ifndef __ASM_HARDIRQ_H
2#define __ASM_HARDIRQ_H 2#define __ASM_HARDIRQ_H
3 3
4#include <asm/irq.h>
4#include <linux/threads.h> 5#include <linux/threads.h>
5#include <linux/cache.h> 6#include <linux/cache.h>
6 7
diff --git a/include/asm-cris/posix_types.h b/include/asm-cris/posix_types.h
index 92000d0c3f97..3a5e4c43eae7 100644
--- a/include/asm-cris/posix_types.h
+++ b/include/asm-cris/posix_types.h
@@ -52,7 +52,6 @@ typedef struct {
52} __kernel_fsid_t; 52} __kernel_fsid_t;
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55#include <linux/bitops.h>
56 55
57#undef __FD_SET 56#undef __FD_SET
58#define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp)) 57#define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp))
diff --git a/include/asm-cris/termbits.h b/include/asm-cris/termbits.h
index 71c1b36269b8..66e1a7492a0c 100644
--- a/include/asm-cris/termbits.h
+++ b/include/asm-cris/termbits.h
@@ -171,6 +171,19 @@ struct ktermios {
171#define B115200 0010002 171#define B115200 0010002
172#define B230400 0010003 172#define B230400 0010003
173#define B460800 0010004 173#define B460800 0010004
174
175/* Unsupported rates, but needed to avoid compile error. */
176#define B500000 0010005
177#define B576000 0010006
178#define B1000000 0010010
179#define B1152000 0010011
180#define B1500000 0010012
181#define B2000000 0010013
182#define B2500000 0010014
183#define B3000000 0010015
184#define B3500000 0010016
185#define B4000000 0010017
186
174/* etrax supports these additional three baud rates */ 187/* etrax supports these additional three baud rates */
175#define B921600 0010005 188#define B921600 0010005
176#define B1843200 0010006 189#define B1843200 0010006
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h
index fde39f6c49c7..784668ab0fa2 100644
--- a/include/asm-cris/thread_info.h
+++ b/include/asm-cris/thread_info.h
@@ -32,6 +32,7 @@ struct thread_info {
32 unsigned long flags; /* low level flags */ 32 unsigned long flags; /* low level flags */
33 __u32 cpu; /* current CPU */ 33 __u32 cpu; /* current CPU */
34 int preempt_count; /* 0 => preemptable, <0 => BUG */ 34 int preempt_count; /* 0 => preemptable, <0 => BUG */
35 __u32 tls; /* TLS for this thread */
35 36
36 mm_segment_t addr_limit; /* thread address space: 37 mm_segment_t addr_limit; /* thread address space:
37 0-0xBFFFFFFF for user-thead 38 0-0xBFFFFFFF for user-thead
@@ -79,14 +80,18 @@ struct thread_info {
79 * - other flags in MSW 80 * - other flags in MSW
80 */ 81 */
81#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 82#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
82#define TIF_SIGPENDING 1 /* signal pending */ 83#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
83#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 84#define TIF_SIGPENDING 2 /* signal pending */
85#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
86#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
84#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 87#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
85#define TIF_MEMDIE 17 88#define TIF_MEMDIE 17
86 89
87#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 90#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
91#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
88#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 92#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
89#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 93#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
94#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
90#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 95#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
91 96
92#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 97#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
diff --git a/include/asm-cris/tlb.h b/include/asm-cris/tlb.h
index 6cc26debe40f..7724246a2601 100644
--- a/include/asm-cris/tlb.h
+++ b/include/asm-cris/tlb.h
@@ -1,6 +1,8 @@
1#ifndef _CRIS_TLB_H 1#ifndef _CRIS_TLB_H
2#define _CRIS_TLB_H 2#define _CRIS_TLB_H
3 3
4#include <linux/pagemap.h>
5
4#include <asm/arch/tlb.h> 6#include <asm/arch/tlb.h>
5 7
6/* 8/*
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index 7c90fa970c38..6f2d924f4fd6 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -255,6 +255,7 @@
255#define __NR_io_submit 248 255#define __NR_io_submit 248
256#define __NR_io_cancel 249 256#define __NR_io_cancel 249
257#define __NR_fadvise64 250 257#define __NR_fadvise64 250
258/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
258#define __NR_exit_group 252 259#define __NR_exit_group 252
259#define __NR_lookup_dcookie 253 260#define __NR_lookup_dcookie 253
260#define __NR_epoll_create 254 261#define __NR_epoll_create 254
@@ -292,10 +293,46 @@
292#define __NR_add_key 286 293#define __NR_add_key 286
293#define __NR_request_key 287 294#define __NR_request_key 287
294#define __NR_keyctl 288 295#define __NR_keyctl 288
296#define __NR_ioprio_set 289
297#define __NR_ioprio_get 290
298#define __NR_inotify_init 291
299#define __NR_inotify_add_watch 292
300#define __NR_inotify_rm_watch 293
301#define __NR_migrate_pages 294
302#define __NR_openat 295
303#define __NR_mkdirat 296
304#define __NR_mknodat 297
305#define __NR_fchownat 298
306#define __NR_futimesat 299
307#define __NR_fstatat64 300
308#define __NR_unlinkat 301
309#define __NR_renameat 302
310#define __NR_linkat 303
311#define __NR_symlinkat 304
312#define __NR_readlinkat 305
313#define __NR_fchmodat 306
314#define __NR_faccessat 307
315#define __NR_pselect6 308
316#define __NR_ppoll 309
317#define __NR_unshare 310
318#define __NR_set_robust_list 311
319#define __NR_get_robust_list 312
320#define __NR_splice 313
321#define __NR_sync_file_range 314
322#define __NR_tee 315
323#define __NR_vmsplice 316
324#define __NR_move_pages 317
325#define __NR_getcpu 318
326#define __NR_epoll_pwait 319
327#define __NR_utimensat 320
328#define __NR_signalfd 321
329#define __NR_timerfd 322
330#define __NR_eventfd 323
331#define __NR_fallocate 324
295 332
296#ifdef __KERNEL__ 333#ifdef __KERNEL__
297 334
298#define NR_syscalls 289 335#define NR_syscalls 325
299 336
300#include <asm/arch/unistd.h> 337#include <asm/arch/unistd.h>
301 338
diff --git a/include/asm-frv/irq.h b/include/asm-frv/irq.h
index 8fefd6b827aa..3a66ebd754bd 100644
--- a/include/asm-frv/irq.h
+++ b/include/asm-frv/irq.h
@@ -12,9 +12,6 @@
12#ifndef _ASM_IRQ_H_ 12#ifndef _ASM_IRQ_H_
13#define _ASM_IRQ_H_ 13#define _ASM_IRQ_H_
14 14
15/* this number is used when no interrupt has been assigned */
16#define NO_IRQ (-1)
17
18#define NR_IRQS 48 15#define NR_IRQS 48
19#define IRQ_BASE_CPU (0 * 16) 16#define IRQ_BASE_CPU (0 * 16)
20#define IRQ_BASE_FPGA (1 * 16) 17#define IRQ_BASE_FPGA (1 * 16)
diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h
index cfe3692b23e5..a4a22cc35898 100644
--- a/include/asm-generic/resource.h
+++ b/include/asm-generic/resource.h
@@ -12,7 +12,7 @@
12 * then it defines them prior including asm-generic/resource.h. ) 12 * then it defines them prior including asm-generic/resource.h. )
13 */ 13 */
14 14
15#define RLIMIT_CPU 0 /* CPU time in ms */ 15#define RLIMIT_CPU 0 /* CPU time in sec */
16#define RLIMIT_FSIZE 1 /* Maximum filesize */ 16#define RLIMIT_FSIZE 1 /* Maximum filesize */
17#define RLIMIT_DATA 2 /* max data size */ 17#define RLIMIT_DATA 2 /* max data size */
18#define RLIMIT_STACK 3 /* max stack size */ 18#define RLIMIT_STACK 3 /* max stack size */
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index 49730ffbbae4..81bcd5e51789 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -94,6 +94,7 @@ ia64_acpi_release_global_lock (unsigned int *lock)
94#define acpi_noirq 0 /* ACPI always enabled on IA64 */ 94#define acpi_noirq 0 /* ACPI always enabled on IA64 */
95#define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */ 95#define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */
96#define acpi_strict 1 /* no ACPI spec workarounds on IA64 */ 96#define acpi_strict 1 /* no ACPI spec workarounds on IA64 */
97#define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */
97static inline void disable_acpi(void) { } 98static inline void disable_acpi(void) { }
98 99
99const char *acpi_get_sysname (void); 100const char *acpi_get_sysname (void);
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index abfcb3a2588f..8a695d3407d2 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -1379,10 +1379,11 @@ struct pal_features_s;
1379static inline s64 1379static inline s64
1380ia64_pal_proc_get_features (u64 *features_avail, 1380ia64_pal_proc_get_features (u64 *features_avail,
1381 u64 *features_status, 1381 u64 *features_status,
1382 u64 *features_control) 1382 u64 *features_control,
1383 u64 features_set)
1383{ 1384{
1384 struct ia64_pal_retval iprv; 1385 struct ia64_pal_retval iprv;
1385 PAL_CALL_PHYS(iprv, PAL_PROC_GET_FEATURES, 0, 0, 0); 1386 PAL_CALL_PHYS(iprv, PAL_PROC_GET_FEATURES, 0, features_set, 0);
1386 if (iprv.status == 0) { 1387 if (iprv.status == 0) {
1387 *features_avail = iprv.v0; 1388 *features_avail = iprv.v0;
1388 *features_status = iprv.v1; 1389 *features_status = iprv.v1;
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-m68knommu/unistd.h b/include/asm-m68knommu/unistd.h
index eb1b566793fe..27c2f9bb4dbd 100644
--- a/include/asm-m68knommu/unistd.h
+++ b/include/asm-m68knommu/unistd.h
@@ -185,8 +185,8 @@
185#define __NR_rt_sigtimedwait 177 185#define __NR_rt_sigtimedwait 177
186#define __NR_rt_sigqueueinfo 178 186#define __NR_rt_sigqueueinfo 178
187#define __NR_rt_sigsuspend 179 187#define __NR_rt_sigsuspend 179
188#define __NR_pread 180 188#define __NR_pread64 180
189#define __NR_pwrite 181 189#define __NR_pwrite64 181
190#define __NR_lchown 182 190#define __NR_lchown 182
191#define __NR_getcwd 183 191#define __NR_getcwd 183
192#define __NR_capget 184 192#define __NR_capget 184
diff --git a/include/asm-mips/8253pit.h b/include/asm-mips/8253pit.h
deleted file mode 100644
index 285f78488ccb..000000000000
--- a/include/asm-mips/8253pit.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/*
2 * 8253/8254 Programmable Interval Timer
3 */
4
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#define PIT_TICK_RATE 1193182UL
9
10#endif
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index 94f1c8172360..ed5c02c6afbb 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -54,6 +54,7 @@ struct cpuinfo_mips {
54 struct cache_desc dcache; /* Primary D or combined I/D cache */ 54 struct cache_desc dcache; /* Primary D or combined I/D cache */
55 struct cache_desc scache; /* Secondary cache */ 55 struct cache_desc scache; /* Secondary cache */
56 struct cache_desc tcache; /* Tertiary/split secondary cache */ 56 struct cache_desc tcache; /* Tertiary/split secondary cache */
57 int srsets; /* Shadow register sets */
57#if defined(CONFIG_MIPS_MT_SMTC) 58#if defined(CONFIG_MIPS_MT_SMTC)
58 /* 59 /*
59 * In the MIPS MT "SMTC" model, each TC is considered 60 * In the MIPS MT "SMTC" model, each TC is considered
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index 833437d31ef1..d6a6c21f16db 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -92,6 +92,7 @@
92#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000) 92#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
93#endif 93#endif
94#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS)) 94#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS))
95#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT))
95 96
96/* 8237 DMA controllers */ 97/* 8237 DMA controllers */
97#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ 98#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index 3e7e30d4f418..17f082cfea85 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -35,7 +35,7 @@
35 " .set mips0 \n" \ 35 " .set mips0 \n" \
36 " .section .fixup,\"ax\" \n" \ 36 " .section .fixup,\"ax\" \n" \
37 "4: li %0, %6 \n" \ 37 "4: li %0, %6 \n" \
38 " j 2b \n" \ 38 " j 3b \n" \
39 " .previous \n" \ 39 " .previous \n" \
40 " .section __ex_table,\"a\" \n" \ 40 " .section __ex_table,\"a\" \n" \
41 " "__UA_ADDR "\t1b, 4b \n" \ 41 " "__UA_ADDR "\t1b, 4b \n" \
@@ -61,7 +61,7 @@
61 " .set mips0 \n" \ 61 " .set mips0 \n" \
62 " .section .fixup,\"ax\" \n" \ 62 " .section .fixup,\"ax\" \n" \
63 "4: li %0, %6 \n" \ 63 "4: li %0, %6 \n" \
64 " j 2b \n" \ 64 " j 3b \n" \
65 " .previous \n" \ 65 " .previous \n" \
66 " .section __ex_table,\"a\" \n" \ 66 " .section __ex_table,\"a\" \n" \
67 " "__UA_ADDR "\t1b, 4b \n" \ 67 " "__UA_ADDR "\t1b, 4b \n" \
@@ -200,4 +200,4 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
200} 200}
201 201
202#endif 202#endif
203#endif 203#endif /* _ASM_FUTEX_H */
diff --git a/include/asm-mips/i8253.h b/include/asm-mips/i8253.h
index affb32ce4af9..5dabc870b322 100644
--- a/include/asm-mips/i8253.h
+++ b/include/asm-mips/i8253.h
@@ -5,25 +5,16 @@
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 */ 15#define PIT_TICK_RATE 1193182UL
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 16
22/* i8259A PIC related value */ 17extern spinlock_t i8253_lock;
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 18
28extern void setup_pit_timer(void); 19extern void setup_pit_timer(void);
29 20
diff --git a/include/asm-mips/ip32/ip32_ints.h b/include/asm-mips/ip32/ip32_ints.h
index 042f821899a8..85bc5302bce0 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 + 8,
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/lasat/lasatint.h b/include/asm-mips/lasat/lasatint.h
index 581dc45685a2..e0d2458b43d0 100644
--- a/include/asm-mips/lasat/lasatint.h
+++ b/include/asm-mips/lasat/lasatint.h
@@ -1,11 +1,6 @@
1#ifndef __ASM_LASAT_LASATINT_H 1#ifndef __ASM_LASAT_LASATINT_H
2#define __ASM_LASAT_LASATINT_H 2#define __ASM_LASAT_LASATINT_H
3 3
4#include <linux/irq.h>
5
6#define LASATINT_BASE MIPS_CPU_IRQ_BASE
7#define LASATINT_END (LASATINT_BASE + 16)
8
9/* lasat 100 */ 4/* lasat 100 */
10#define LASAT_INT_STATUS_REG_100 (KSEG1ADDR(0x1c880000)) 5#define LASAT_INT_STATUS_REG_100 (KSEG1ADDR(0x1c880000))
11#define LASAT_INT_MASK_REG_100 (KSEG1ADDR(0x1c890000)) 6#define LASAT_INT_MASK_REG_100 (KSEG1ADDR(0x1c890000))
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-lasat/irq.h b/include/asm-mips/mach-lasat/irq.h
new file mode 100644
index 000000000000..da75f89f3723
--- /dev/null
+++ b/include/asm-mips/mach-lasat/irq.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_MACH_LASAT_IRQ_H
2#define _ASM_MACH_LASAT_IRQ_H
3
4#define LASAT_CASCADE_IRQ (MIPS_CPU_IRQ_BASE + 0)
5
6#define LASAT_IRQ_BASE 8
7#define LASAT_IRQ_END 23
8
9#define NR_IRQS 24
10
11#include_next <irq.h>
12
13#endif /* _ASM_MACH_LASAT_IRQ_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/system.h b/include/asm-mips/system.h
index 90e4b403f531..1030562d6ea6 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -68,11 +68,15 @@ do { \
68 if (cpu_has_dsp) \ 68 if (cpu_has_dsp) \
69 __save_dsp(prev); \ 69 __save_dsp(prev); \
70 (last) = resume(prev, next, task_thread_info(next)); \ 70 (last) = resume(prev, next, task_thread_info(next)); \
71} while (0)
72
73#define finish_arch_switch(prev) \
74do { \
71 if (cpu_has_dsp) \ 75 if (cpu_has_dsp) \
72 __restore_dsp(current); \ 76 __restore_dsp(current); \
73 if (cpu_has_userlocal) \ 77 if (cpu_has_userlocal) \
74 write_c0_userlocal(task_thread_info(current)->tp_value);\ 78 write_c0_userlocal(current_thread_info()->tp_value); \
75} while(0) 79} while (0)
76 80
77static inline unsigned long __xchg_u32(volatile int * m, unsigned int val) 81static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
78{ 82{
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index bc47af313bcd..7717934f94c3 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
@@ -77,9 +58,22 @@ extern int (*perf_irq)(void);
77 * Initialize the calling CPU's compare interrupt as clockevent device 58 * Initialize the calling CPU's compare interrupt as clockevent device
78 */ 59 */
79#ifdef CONFIG_CEVT_R4K 60#ifdef CONFIG_CEVT_R4K
80extern void mips_clockevent_init(void); 61extern int mips_clockevent_init(void);
62extern unsigned int __weak get_c0_compare_int(void);
63#else
64static inline int mips_clockevent_init(void)
65{
66 return -ENXIO;
67}
68#endif
69
70/*
71 * Initialize the count register as a clocksource
72 */
73#ifdef CONFIG_CEVT_R4K
74extern void init_mips_clocksource(void);
81#else 75#else
82static inline void mips_clockevent_init(void) 76static inline void init_mips_clocksource(void)
83{ 77{
84} 78}
85#endif 79#endif
diff --git a/include/asm-mips/timex.h b/include/asm-mips/timex.h
index 87c68ae76ff8..6529704aa73a 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.
@@ -50,7 +35,7 @@ typedef unsigned int cycles_t;
50 35
51static inline cycles_t get_cycles(void) 36static inline cycles_t get_cycles(void)
52{ 37{
53 return read_c0_count(); 38 return 0;
54} 39}
55 40
56#endif /* __KERNEL__ */ 41#endif /* __KERNEL__ */
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-powerpc/commproc.h b/include/asm-powerpc/commproc.h
index 0307c84a5c1d..a2328b8addd8 100644
--- a/include/asm-powerpc/commproc.h
+++ b/include/asm-powerpc/commproc.h
@@ -91,7 +91,7 @@ extern uint m8xx_cpm_hostalloc(uint size);
91extern int m8xx_cpm_hostfree(uint start); 91extern int m8xx_cpm_hostfree(uint start);
92extern void m8xx_cpm_hostdump(void); 92extern void m8xx_cpm_hostdump(void);
93 93
94extern void cpm_load_patch(volatile immap_t *immr); 94extern void cpm_load_patch(cpm8xx_t *cp);
95 95
96/* Buffer descriptors used by many of the CPM protocols. 96/* Buffer descriptors used by many of the CPM protocols.
97*/ 97*/
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 9d74338e3dec..4525c784dfd0 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -138,6 +138,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
138#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000) 138#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000)
139#define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x0000000001000000) 139#define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x0000000001000000)
140#define CPU_FTR_SPE ASM_CONST(0x0000000002000000) 140#define CPU_FTR_SPE ASM_CONST(0x0000000002000000)
141#define CPU_FTR_NEED_PAIRED_STWCX ASM_CONST(0x0000000004000000)
141 142
142/* 143/*
143 * Add the 64-bit processor unique features in the top half of the word; 144 * Add the 64-bit processor unique features in the top half of the word;
@@ -261,25 +262,25 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
261#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \ 262#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | \
262 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 263 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
263 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 264 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
264 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 265 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
265#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \ 266#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | \
266 CPU_FTR_USE_TB | \ 267 CPU_FTR_USE_TB | \
267 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 268 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
268 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 269 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
269 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ 270 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
270 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 271 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
271#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \ 272#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | \
272 CPU_FTR_USE_TB | \ 273 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
273 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 274 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
274 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 275 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
275 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 276 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
276#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \ 277#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | \
277 CPU_FTR_USE_TB | \ 278 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
278 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \ 279 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \
279 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \ 280 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \
280 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 281 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE)
281#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \ 282#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | \
282 CPU_FTR_USE_TB | \ 283 CPU_FTR_USE_TB | CPU_FTR_NEED_PAIRED_STWCX | \
283 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 284 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
284 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 285 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
285 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \ 286 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
@@ -289,31 +290,32 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
289 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 290 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
290 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 291 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
291 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 292 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
292 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 293 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
293#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \ 294#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | \
294 CPU_FTR_USE_TB | \ 295 CPU_FTR_USE_TB | \
295 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 296 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
296 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 297 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
297 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 298 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
298 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE) 299 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC | CPU_FTR_PPC_LE | \
300 CPU_FTR_NEED_PAIRED_STWCX)
299#define CPU_FTRS_7447 (CPU_FTR_COMMON | \ 301#define CPU_FTRS_7447 (CPU_FTR_COMMON | \
300 CPU_FTR_USE_TB | \ 302 CPU_FTR_USE_TB | \
301 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 303 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
302 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 304 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
303 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 305 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
304 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 306 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
305#define CPU_FTRS_7447A (CPU_FTR_COMMON | \ 307#define CPU_FTRS_7447A (CPU_FTR_COMMON | \
306 CPU_FTR_USE_TB | \ 308 CPU_FTR_USE_TB | \
307 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 309 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
308 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 310 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
309 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 311 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
310 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE) 312 CPU_FTR_NEED_COHERENT | CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
311#define CPU_FTRS_7448 (CPU_FTR_COMMON | \ 313#define CPU_FTRS_7448 (CPU_FTR_COMMON | \
312 CPU_FTR_USE_TB | \ 314 CPU_FTR_USE_TB | \
313 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \ 315 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
314 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \ 316 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
315 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \ 317 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
316 CPU_FTR_PPC_LE) 318 CPU_FTR_PPC_LE | CPU_FTR_NEED_PAIRED_STWCX)
317#define CPU_FTRS_82XX (CPU_FTR_COMMON | \ 319#define CPU_FTRS_82XX (CPU_FTR_COMMON | \
318 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB) 320 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB)
319#define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \ 321#define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h
index 374d0db37e1c..17110aff26e7 100644
--- a/include/asm-powerpc/page_32.h
+++ b/include/asm-powerpc/page_32.h
@@ -6,6 +6,10 @@
6 6
7#define PPC_MEMSTART 0 7#define PPC_MEMSTART 0
8 8
9#ifdef CONFIG_NOT_COHERENT_CACHE
10#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
11#endif
12
9#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
10/* 14/*
11 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit 15 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index dc318458b5fe..d8bdc79db12e 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -246,7 +246,6 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
246 return PCI_DN(busdn)->phb; 246 return PCI_DN(busdn)->phb;
247} 247}
248 248
249extern void pcibios_free_controller(struct pci_controller *phb);
250 249
251extern void isa_bridge_find_early(struct pci_controller *hose); 250extern void isa_bridge_find_early(struct pci_controller *hose);
252 251
@@ -282,9 +281,11 @@ extern void
282pci_process_bridge_OF_ranges(struct pci_controller *hose, 281pci_process_bridge_OF_ranges(struct pci_controller *hose,
283 struct device_node *dev, int primary); 282 struct device_node *dev, int primary);
284 283
285/* Allocate a new PCI host bridge structure */ 284/* Allocate & free a PCI host bridge structure */
286extern struct pci_controller * 285extern struct pci_controller *
287pcibios_alloc_controller(struct device_node *dev); 286pcibios_alloc_controller(struct device_node *dev);
287extern void pcibios_free_controller(struct pci_controller *phb);
288
288#ifdef CONFIG_PCI 289#ifdef CONFIG_PCI
289extern unsigned long pci_address_to_pio(phys_addr_t address); 290extern unsigned long pci_address_to_pio(phys_addr_t address);
290extern int pcibios_vaddr_is_ioport(void __iomem *address); 291extern int pcibios_vaddr_is_ioport(void __iomem *address);
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h
index 86a54a4a8a2a..fea2d8ff1e73 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -11,6 +11,11 @@
11extern unsigned long va_to_phys(unsigned long address); 11extern unsigned long va_to_phys(unsigned long address);
12extern pte_t *va_to_pte(unsigned long address); 12extern pte_t *va_to_pte(unsigned long address);
13extern unsigned long ioremap_bot, ioremap_base; 13extern unsigned long ioremap_bot, ioremap_base;
14
15#ifdef CONFIG_44x
16extern int icache_44x_need_flush;
17#endif
18
14#endif /* __ASSEMBLY__ */ 19#endif /* __ASSEMBLY__ */
15 20
16/* 21/*
@@ -562,6 +567,10 @@ static inline unsigned long pte_update(pte_t *p, unsigned long clr,
562 : "=&r" (old), "=&r" (tmp), "=m" (*p) 567 : "=&r" (old), "=&r" (tmp), "=m" (*p)
563 : "r" (p), "r" (clr), "r" (set), "m" (*p) 568 : "r" (p), "r" (clr), "r" (set), "m" (*p)
564 : "cc" ); 569 : "cc" );
570#ifdef CONFIG_44x
571 if ((old & _PAGE_USER) && (old & _PAGE_HWEXEC))
572 icache_44x_need_flush = 1;
573#endif
565 return old; 574 return old;
566} 575}
567#else 576#else
@@ -582,6 +591,10 @@ static inline unsigned long long pte_update(pte_t *p, unsigned long clr,
582 : "=&r" (old), "=&r" (tmp), "=m" (*p) 591 : "=&r" (old), "=&r" (tmp), "=m" (*p)
583 : "r" (p), "r" ((unsigned long)(p) + 4), "r" (clr), "r" (set), "m" (*p) 592 : "r" (p), "r" ((unsigned long)(p) + 4), "r" (clr), "r" (set), "m" (*p)
584 : "cc" ); 593 : "cc" );
594#ifdef CONFIG_44x
595 if ((old & _PAGE_USER) && (old & _PAGE_HWEXEC))
596 icache_44x_need_flush = 1;
597#endif
585 return old; 598 return old;
586} 599}
587#endif 600#endif
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 8eaa7b28d9d0..87db8728e82d 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -164,7 +164,8 @@ extern int rtas_call(int token, int, int, int *, ...);
164extern void rtas_restart(char *cmd); 164extern void rtas_restart(char *cmd);
165extern void rtas_power_off(void); 165extern void rtas_power_off(void);
166extern void rtas_halt(void); 166extern void rtas_halt(void);
167extern void rtas_os_term(char *str); 167extern void rtas_panic_msg(char *str);
168extern void rtas_os_term(void);
168extern int rtas_get_sensor(int sensor, int index, int *state); 169extern int rtas_get_sensor(int sensor, int index, int *state);
169extern int rtas_get_power_level(int powerdomain, int *level); 170extern int rtas_get_power_level(int powerdomain, int *level);
170extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); 171extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index cc6d87228258..11d5383b2f09 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -308,8 +308,8 @@ COMPAT_SYS_SPU(move_pages)
308SYSCALL_SPU(getcpu) 308SYSCALL_SPU(getcpu)
309COMPAT_SYS(epoll_pwait) 309COMPAT_SYS(epoll_pwait)
310COMPAT_SYS_SPU(utimensat) 310COMPAT_SYS_SPU(utimensat)
311COMPAT_SYS(fallocate)
312COMPAT_SYS_SPU(signalfd) 311COMPAT_SYS_SPU(signalfd)
313COMPAT_SYS_SPU(timerfd) 312COMPAT_SYS_SPU(timerfd)
314SYSCALL_SPU(eventfd) 313SYSCALL_SPU(eventfd)
315COMPAT_SYS_SPU(sync_file_range2) 314COMPAT_SYS_SPU(sync_file_range2)
315COMPAT_SYS(fallocate)
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index f05895522f7f..780f82642756 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -176,25 +176,31 @@ static inline unsigned int get_dec(void)
176#endif 176#endif
177} 177}
178 178
179/*
180 * Note: Book E and 4xx processors differ from other PowerPC processors
181 * in when the decrementer generates its interrupt: on the 1 to 0
182 * transition for Book E/4xx, but on the 0 to -1 transition for others.
183 */
179static inline void set_dec(int val) 184static inline void set_dec(int val)
180{ 185{
181#if defined(CONFIG_40x) 186#if defined(CONFIG_40x)
182 mtspr(SPRN_PIT, val); 187 mtspr(SPRN_PIT, val);
183#elif defined(CONFIG_8xx_CPU6) 188#elif defined(CONFIG_8xx_CPU6)
184 set_dec_cpu6(val); 189 set_dec_cpu6(val - 1);
185#else 190#else
191#ifndef CONFIG_BOOKE
192 --val;
193#endif
186#ifdef CONFIG_PPC_ISERIES 194#ifdef CONFIG_PPC_ISERIES
187 int cur_dec;
188
189 if (firmware_has_feature(FW_FEATURE_ISERIES) && 195 if (firmware_has_feature(FW_FEATURE_ISERIES) &&
190 get_lppaca()->shared_proc) { 196 get_lppaca()->shared_proc) {
191 get_lppaca()->virtual_decr = val; 197 get_lppaca()->virtual_decr = val;
192 cur_dec = get_dec(); 198 if (get_dec() > val)
193 if (cur_dec > val)
194 HvCall_setVirtualDecr(); 199 HvCall_setVirtualDecr();
195 } else 200 return;
201 }
196#endif 202#endif
197 mtspr(SPRN_DEC, val); 203 mtspr(SPRN_DEC, val);
198#endif /* not 40x or 8xx_CPU6 */ 204#endif /* not 40x or 8xx_CPU6 */
199} 205}
200 206
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h
index b6b036ccee34..5c9108147644 100644
--- a/include/asm-powerpc/tlbflush.h
+++ b/include/asm-powerpc/tlbflush.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_TLBFLUSH_H 1#ifndef _ASM_POWERPC_TLBFLUSH_H
2#define _ASM_POWERPC_TLBFLUSH_H 2#define _ASM_POWERPC_TLBFLUSH_H
3
3/* 4/*
4 * TLB flushing: 5 * TLB flushing:
5 * 6 *
@@ -16,9 +17,6 @@
16 */ 17 */
17#ifdef __KERNEL__ 18#ifdef __KERNEL__
18 19
19struct mm_struct;
20struct vm_area_struct;
21
22#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE) 20#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE)
23/* 21/*
24 * TLB flushing for software loaded TLB chips 22 * TLB flushing for software loaded TLB chips
@@ -28,7 +26,9 @@ struct vm_area_struct;
28 * specific tlbie's 26 * specific tlbie's
29 */ 27 */
30 28
31extern void _tlbie(unsigned long address); 29#include <linux/mm.h>
30
31extern void _tlbie(unsigned long address, unsigned int pid);
32 32
33#if defined(CONFIG_40x) || defined(CONFIG_8xx) 33#if defined(CONFIG_40x) || defined(CONFIG_8xx)
34#define _tlbia() asm volatile ("tlbia; sync" : : : "memory") 34#define _tlbia() asm volatile ("tlbia; sync" : : : "memory")
@@ -44,13 +44,13 @@ static inline void flush_tlb_mm(struct mm_struct *mm)
44static inline void flush_tlb_page(struct vm_area_struct *vma, 44static inline void flush_tlb_page(struct vm_area_struct *vma,
45 unsigned long vmaddr) 45 unsigned long vmaddr)
46{ 46{
47 _tlbie(vmaddr); 47 _tlbie(vmaddr, vma ? vma->vm_mm->context.id : 0);
48} 48}
49 49
50static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, 50static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
51 unsigned long vmaddr) 51 unsigned long vmaddr)
52{ 52{
53 _tlbie(vmaddr); 53 _tlbie(vmaddr, vma ? vma->vm_mm->context.id : 0);
54} 54}
55 55
56static inline void flush_tlb_range(struct vm_area_struct *vma, 56static inline void flush_tlb_range(struct vm_area_struct *vma,
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h
index 8a94f0eba5e9..f01393224b52 100644
--- a/include/asm-powerpc/vdso_datapage.h
+++ b/include/asm-powerpc/vdso_datapage.h
@@ -77,6 +77,10 @@ struct vdso_data {
77 /* those additional ones don't have to be located anywhere 77 /* those additional ones don't have to be located anywhere
78 * special as they were not part of the original systemcfg 78 * special as they were not part of the original systemcfg
79 */ 79 */
80 __u32 dcache_block_size; /* L1 d-cache block size */
81 __u32 icache_block_size; /* L1 i-cache block size */
82 __u32 dcache_log_block_size; /* L1 d-cache log block size */
83 __u32 icache_log_block_size; /* L1 i-cache log block size */
80 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 84 __s32 wtom_clock_sec; /* Wall to monotonic clock */
81 __s32 wtom_clock_nsec; 85 __s32 wtom_clock_nsec;
82 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ 86 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */
@@ -99,6 +103,10 @@ struct vdso_data {
99 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 103 __s32 wtom_clock_sec; /* Wall to monotonic clock */
100 __s32 wtom_clock_nsec; 104 __s32 wtom_clock_nsec;
101 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 105 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
106 __u32 dcache_block_size; /* L1 d-cache block size */
107 __u32 icache_block_size; /* L1 i-cache block size */
108 __u32 dcache_log_block_size; /* L1 d-cache log block size */
109 __u32 icache_log_block_size; /* L1 i-cache log block size */
102}; 110};
103 111
104#endif /* CONFIG_PPC64 */ 112#endif /* CONFIG_PPC64 */
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index d866d3385556..44bda786eef7 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -388,6 +388,11 @@ extern void (*_machine_power_off)(void);
388 388
389#define arch_align_stack(x) (x) 389#define arch_align_stack(x) (x)
390 390
391#ifdef CONFIG_TRACE_IRQFLAGS
392extern psw_t sysc_restore_trace_psw;
393extern psw_t io_restore_trace_psw;
394#endif
395
391#endif /* __KERNEL__ */ 396#endif /* __KERNEL__ */
392 397
393#endif 398#endif
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/cacheflush.h b/include/asm-sh/cacheflush.h
index aa558da08471..9d528ada3c14 100644
--- a/include/asm-sh/cacheflush.h
+++ b/include/asm-sh/cacheflush.h
@@ -43,21 +43,31 @@ extern void __flush_purge_region(void *start, int size);
43extern void __flush_invalidate_region(void *start, int size); 43extern void __flush_invalidate_region(void *start, int size);
44#endif 44#endif
45 45
46#define flush_cache_vmap(start, end) flush_cache_all() 46#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
47#define flush_cache_vunmap(start, end) flush_cache_all() 47extern void copy_to_user_page(struct vm_area_struct *vma,
48 struct page *page, unsigned long vaddr, void *dst, const void *src,
49 unsigned long len);
48 50
49#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 51extern void copy_from_user_page(struct vm_area_struct *vma,
52 struct page *page, unsigned long vaddr, void *dst, const void *src,
53 unsigned long len);
54#else
55#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
50 do { \ 56 do { \
51 flush_cache_page(vma, vaddr, page_to_pfn(page));\ 57 flush_cache_page(vma, vaddr, page_to_pfn(page));\
52 memcpy(dst, src, len); \ 58 memcpy(dst, src, len); \
53 flush_icache_user_range(vma, page, vaddr, len); \ 59 flush_icache_user_range(vma, page, vaddr, len); \
54 } while (0) 60 } while (0)
55 61
56#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 62#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
57 do { \ 63 do { \
58 flush_cache_page(vma, vaddr, page_to_pfn(page));\ 64 flush_cache_page(vma, vaddr, page_to_pfn(page));\
59 memcpy(dst, src, len); \ 65 memcpy(dst, src, len); \
60 } while (0) 66 } while (0)
67#endif
68
69#define flush_cache_vmap(start, end) flush_cache_all()
70#define flush_cache_vunmap(start, end) flush_cache_all()
61 71
62#define HAVE_ARCH_UNMAPPED_AREA 72#define HAVE_ARCH_UNMAPPED_AREA
63 73
diff --git a/include/asm-sh/cpu-sh3/timer.h b/include/asm-sh/cpu-sh3/timer.h
index 3880ce047fe0..7b795ac5477c 100644
--- a/include/asm-sh/cpu-sh3/timer.h
+++ b/include/asm-sh/cpu-sh3/timer.h
@@ -23,8 +23,7 @@
23 * --------------------------------------------------------------------------- 23 * ---------------------------------------------------------------------------
24 */ 24 */
25 25
26#if !defined(CONFIG_CPU_SUBTYPE_SH7720) && \ 26#if !defined(CONFIG_CPU_SUBTYPE_SH7720)
27 !defined(CONFIG_CPU_SUBTYPE_SH7727)
28#define TMU_TOCR 0xfffffe90 /* Byte access */ 27#define TMU_TOCR 0xfffffe90 /* Byte access */
29#endif 28#endif
30 29
@@ -58,8 +57,7 @@
58#define TMU2_TCOR 0xfffffeac /* Long access */ 57#define TMU2_TCOR 0xfffffeac /* Long access */
59#define TMU2_TCNT 0xfffffeb0 /* Long access */ 58#define TMU2_TCNT 0xfffffeb0 /* Long access */
60#define TMU2_TCR 0xfffffeb4 /* Word access */ 59#define TMU2_TCR 0xfffffeb4 /* Word access */
61#if !defined(CONFIG_CPU_SUBTYPE_SH7720) && \ 60#if !defined(CONFIG_CPU_SUBTYPE_SH7720)
62 !defined(CONFIG_CPU_SUBTYPE_SH7727)
63#define TMU2_TCPR2 0xfffffeb8 /* Long access */ 61#define TMU2_TCPR2 0xfffffeb8 /* Long access */
64#endif 62#endif
65#endif 63#endif
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..d00a8fde7c7f 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -73,10 +73,13 @@ extern void copy_page_nommu(void *to, void *from);
73#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \ 73#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
74 (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)) 74 (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB))
75struct page; 75struct page;
76extern void clear_user_page(void *to, unsigned long address, struct page *pg); 76struct vm_area_struct;
77extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg); 77extern void clear_user_page(void *to, unsigned long address, struct page *page);
78extern void __clear_user_page(void *to, void *orig_to); 78#ifdef CONFIG_CPU_SH4
79extern void __copy_user_page(void *to, void *from, void *orig_to); 79extern void copy_user_highpage(struct page *to, struct page *from,
80 unsigned long vaddr, struct vm_area_struct *vma);
81#define __HAVE_ARCH_COPY_USER_HIGHPAGE
82#endif
80#else 83#else
81#define clear_user_page(page, vaddr, pg) clear_page(page) 84#define clear_user_page(page, vaddr, pg) clear_page(page)
82#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 85#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
@@ -128,7 +131,6 @@ typedef struct { unsigned long pgd; } pgd_t;
128#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 131#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
129#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 132#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
130 133
131#define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT))
132#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 134#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
133 135
134/* PFN start number, because of __MEMORY_START */ 136/* PFN start number, because of __MEMORY_START */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index cf0dd2b648c2..8f1e8be8d15d 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -322,7 +322,9 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
322#define PAGE_KERNEL __pgprot(0) 322#define PAGE_KERNEL __pgprot(0)
323#define PAGE_KERNEL_NOCACHE __pgprot(0) 323#define PAGE_KERNEL_NOCACHE __pgprot(0)
324#define PAGE_KERNEL_RO __pgprot(0) 324#define PAGE_KERNEL_RO __pgprot(0)
325#define PAGE_KERNEL_PCC __pgprot(0) 325
326#define PAGE_KERNEL_PCC(slot, type) \
327 __pgprot(0)
326#endif 328#endif
327 329
328#endif /* __ASSEMBLY__ */ 330#endif /* __ASSEMBLY__ */
@@ -399,7 +401,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
399#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK) 401#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
400 402
401#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) 403#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
402#define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK) 404#define pte_page(x) pfn_to_page(pte_pfn(x))
403 405
404/* 406/*
405 * The following only work if pte_present() is true. 407 * 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..fda68480f377 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -49,7 +49,7 @@ enum cpu_type {
49 49
50 /* SH-4 types */ 50 /* SH-4 types */
51 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, 51 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
52 CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, 52 CPU_SH7760, CPU_SH4_202, CPU_SH4_501,
53 53
54 /* SH-4A types */ 54 /* SH-4A types */
55 CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SHX3, 55 CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SHX3,
@@ -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/ptrace.h b/include/asm-sh/ptrace.h
index ed358a376e6e..b9789c8b4d15 100644
--- a/include/asm-sh/ptrace.h
+++ b/include/asm-sh/ptrace.h
@@ -42,9 +42,6 @@
42#define REG_FPSCR 55 42#define REG_FPSCR 55
43#define REG_FPUL 56 43#define REG_FPUL 56
44 44
45/* options set using PTRACE_SETOPTIONS */
46#define PTRACE_O_TRACESYSGOOD 0x00000001
47
48/* 45/*
49 * This struct defines the way the registers are stored on the 46 * This struct defines the way the registers are stored on the
50 * kernel stack during a system call or other kernel entry. 47 * kernel stack during a system call or other kernel entry.
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-sh/vga.h b/include/asm-sh/vga.h
new file mode 100644
index 000000000000..06a5de8ace1a
--- /dev/null
+++ b/include/asm-sh/vga.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_SH_VGA_H
2#define __ASM_SH_VGA_H
3
4/* Stupid drivers. */
5
6#endif /* __ASM_SH_VGA_H */
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/ptrace.h b/include/asm-sh64/ptrace.h
index a6d4da519db6..c424f80e3ae0 100644
--- a/include/asm-sh64/ptrace.h
+++ b/include/asm-sh64/ptrace.h
@@ -32,6 +32,4 @@ struct pt_regs {
32extern void show_regs(struct pt_regs *); 32extern void show_regs(struct pt_regs *);
33#endif 33#endif
34 34
35#define PTRACE_O_TRACESYSGOOD 0x00000001
36
37#endif /* __ASM_SH64_PTRACE_H */ 35#endif /* __ASM_SH64_PTRACE_H */
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-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/system.h b/include/asm-sparc64/system.h
index 159e62b51d70..99a669c190c7 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -178,7 +178,9 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
178 "ldx [%%g6 + %9], %%g4\n\t" \ 178 "ldx [%%g6 + %9], %%g4\n\t" \
179 "brz,pt %%o7, 1f\n\t" \ 179 "brz,pt %%o7, 1f\n\t" \
180 " mov %%g7, %0\n\t" \ 180 " mov %%g7, %0\n\t" \
181 "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" \
182 "1:\n\t" \ 184 "1:\n\t" \
183 : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \ 185 : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \
184 "=r" (__local_per_cpu_offset) \ 186 "=r" (__local_per_cpu_offset) \
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/vio.h b/include/asm-sparc64/vio.h
index f7417e91b170..d4de32f0f8af 100644
--- a/include/asm-sparc64/vio.h
+++ b/include/asm-sparc64/vio.h
@@ -8,6 +8,7 @@
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <linux/completion.h> 9#include <linux/completion.h>
10#include <linux/list.h> 10#include <linux/list.h>
11#include <linux/log2.h>
11 12
12#include <asm/ldc.h> 13#include <asm/ldc.h>
13#include <asm/mdesc.h> 14#include <asm/mdesc.h>
@@ -257,8 +258,7 @@ static inline void *vio_dring_entry(struct vio_dring_state *dr,
257static inline u32 vio_dring_avail(struct vio_dring_state *dr, 258static inline u32 vio_dring_avail(struct vio_dring_state *dr,
258 unsigned int ring_size) 259 unsigned int ring_size)
259{ 260{
260 /* Ensure build-time power-of-2. */ 261 BUILD_BUG_ON(!is_power_of_2(ring_size));
261 BUILD_BUG_ON(ring_size & (ring_size - 1));
262 262
263 return (dr->pending - 263 return (dr->pending -
264 ((dr->prod - dr->cons) & (ring_size - 1))); 264 ((dr->prod - dr->cons) & (ring_size - 1)));
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
index aa82b88db805..3ebafbaacb24 100644
--- a/include/asm-um/pgtable-3level.h
+++ b/include/asm-um/pgtable-3level.h
@@ -71,7 +71,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
71 71
72static inline void pud_clear (pud_t *pud) 72static inline void pud_clear (pud_t *pud)
73{ 73{
74 set_pud(pud, __pud(0)); 74 set_pud(pud, __pud(_PAGE_NEWPAGE));
75} 75}
76 76
77#define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) 77#define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK)
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/acpi.h b/include/asm-x86/acpi.h
index 0693689d4146..f8a89793ac8c 100644
--- a/include/asm-x86/acpi.h
+++ b/include/asm-x86/acpi.h
@@ -1,5 +1,32 @@
1#ifndef _ASM_X86_ACPI_H
2#define _ASM_X86_ACPI_H
3
1#ifdef CONFIG_X86_32 4#ifdef CONFIG_X86_32
2# include "acpi_32.h" 5# include "acpi_32.h"
3#else 6#else
4# include "acpi_64.h" 7# include "acpi_64.h"
5#endif 8#endif
9
10#include <asm/processor.h>
11
12/*
13 * Check if the CPU can handle C2 and deeper
14 */
15static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
16{
17 /*
18 * Early models (<=5) of AMD Opterons are not supposed to go into
19 * C2 state.
20 *
21 * Steppings 0x0A and later are good
22 */
23 if (boot_cpu_data.x86 == 0x0F &&
24 boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
25 boot_cpu_data.x86_model <= 0x05 &&
26 boot_cpu_data.x86_mask < 0x0A)
27 return 1;
28 else
29 return max_cstate;
30}
31
32#endif
diff --git a/include/asm-x86/apic_32.h b/include/asm-x86/apic_32.h
index 4091b33dcb10..be158b27d54b 100644
--- a/include/asm-x86/apic_32.h
+++ b/include/asm-x86/apic_32.h
@@ -120,6 +120,7 @@ extern int local_apic_timer_disabled;
120 120
121#else /* !CONFIG_X86_LOCAL_APIC */ 121#else /* !CONFIG_X86_LOCAL_APIC */
122static inline void lapic_shutdown(void) { } 122static inline void lapic_shutdown(void) { }
123#define local_apic_timer_c2_ok 1
123 124
124#endif /* !CONFIG_X86_LOCAL_APIC */ 125#endif /* !CONFIG_X86_LOCAL_APIC */
125 126
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/i387_64.h b/include/asm-x86/i387_64.h
index 0217b74cc9fc..3a4ffba3d6bc 100644
--- a/include/asm-x86/i387_64.h
+++ b/include/asm-x86/i387_64.h
@@ -203,6 +203,11 @@ static inline void save_init_fpu(struct task_struct *tsk)
203 */ 203 */
204static inline int restore_i387(struct _fpstate __user *buf) 204static inline int restore_i387(struct _fpstate __user *buf)
205{ 205{
206 set_used_math();
207 if (!(task_thread_info(current)->status & TS_USEDFPU)) {
208 clts();
209 task_thread_info(current)->status |= TS_USEDFPU;
210 }
206 return restore_fpu_checking((__force struct i387_fxsave_struct *)buf); 211 return restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
207} 212}
208 213
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/irqflags_32.h b/include/asm-x86/irqflags_32.h
index d058b04e0083..4c7720089cb5 100644
--- a/include/asm-x86/irqflags_32.h
+++ b/include/asm-x86/irqflags_32.h
@@ -129,6 +129,27 @@ static inline int raw_irqs_disabled(void)
129 129
130 return raw_irqs_disabled_flags(flags); 130 return raw_irqs_disabled_flags(flags);
131} 131}
132
133/*
134 * makes the traced hardirq state match with the machine state
135 *
136 * should be a rarely used function, only in places where its
137 * otherwise impossible to know the irq state, like in traps.
138 */
139static inline void trace_hardirqs_fixup_flags(unsigned long flags)
140{
141 if (raw_irqs_disabled_flags(flags))
142 trace_hardirqs_off();
143 else
144 trace_hardirqs_on();
145}
146
147static inline void trace_hardirqs_fixup(void)
148{
149 unsigned long flags = __raw_local_save_flags();
150
151 trace_hardirqs_fixup_flags(flags);
152}
132#endif /* __ASSEMBLY__ */ 153#endif /* __ASSEMBLY__ */
133 154
134/* 155/*
diff --git a/include/asm-x86/irqflags_64.h b/include/asm-x86/irqflags_64.h
index 5341ea1f815a..bb9163bb29d1 100644
--- a/include/asm-x86/irqflags_64.h
+++ b/include/asm-x86/irqflags_64.h
@@ -112,6 +112,26 @@ static inline int raw_irqs_disabled(void)
112} 112}
113 113
114/* 114/*
115 * makes the traced hardirq state match with the machine state
116 *
117 * should be a rarely used function, only in places where its
118 * otherwise impossible to know the irq state, like in traps.
119 */
120static inline void trace_hardirqs_fixup_flags(unsigned long flags)
121{
122 if (raw_irqs_disabled_flags(flags))
123 trace_hardirqs_off();
124 else
125 trace_hardirqs_on();
126}
127
128static inline void trace_hardirqs_fixup(void)
129{
130 unsigned long flags = __raw_local_save_flags();
131
132 trace_hardirqs_fixup_flags(flags);
133}
134/*
115 * Used in the idle loop; sti takes one instruction cycle 135 * Used in the idle loop; sti takes one instruction cycle
116 * to complete: 136 * to complete:
117 */ 137 */
diff --git a/include/asm-x86/lguest_hcall.h b/include/asm-x86/lguest_hcall.h
index 9c5092b6aa9f..2091779e91fb 100644
--- a/include/asm-x86/lguest_hcall.h
+++ b/include/asm-x86/lguest_hcall.h
@@ -54,9 +54,6 @@ hcall(unsigned long call,
54} 54}
55/*:*/ 55/*:*/
56 56
57void async_hcall(unsigned long call,
58 unsigned long arg1, unsigned long arg2, unsigned long arg3);
59
60/* Can't use our min() macro here: needs to be a constant */ 57/* Can't use our min() macro here: needs to be a constant */
61#define LGUEST_IRQS (NR_IRQS < 32 ? NR_IRQS: 32) 58#define LGUEST_IRQS (NR_IRQS < 32 ? NR_IRQS: 32)
62 59
diff --git a/include/asm-x86/mach-default/mach_reboot.h b/include/asm-x86/mach-default/mach_reboot.h
index e23fd9fbebb3..6adee6a97dec 100644
--- a/include/asm-x86/mach-default/mach_reboot.h
+++ b/include/asm-x86/mach-default/mach_reboot.h
@@ -49,7 +49,7 @@ static inline void mach_reboot(void)
49 udelay(50); 49 udelay(50);
50 kb_wait(); 50 kb_wait();
51 udelay(50); 51 udelay(50);
52 outb(cmd | 0x04, 0x60); /* set "System flag" */ 52 outb(cmd | 0x14, 0x60); /* set "System flag" and "Keyboard Disabled" */
53 udelay(50); 53 udelay(50);
54 kb_wait(); 54 kb_wait();
55 udelay(50); 55 udelay(50);
diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h b/include/asm-x86/mach-es7000/mach_mpparse.h
index 8aa10547b4b1..52ee75cd0fe1 100644
--- a/include/asm-x86/mach-es7000/mach_mpparse.h
+++ b/include/asm-x86/mach-es7000/mach_mpparse.h
@@ -29,9 +29,9 @@ extern int mps_oem_check(struct mp_config_table *mpc, char *oem,
29static inline int es7000_check_dsdt(void) 29static inline int es7000_check_dsdt(void)
30{ 30{
31 struct acpi_table_header header; 31 struct acpi_table_header header;
32 memcpy(&header, 0, sizeof(struct acpi_table_header)); 32
33 acpi_get_table_header(ACPI_SIG_DSDT, 0, &header); 33 if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
34 if (!strncmp(header.oem_id, "UNISYS", 6)) 34 !strncmp(header.oem_id, "UNISYS", 6))
35 return 1; 35 return 1;
36 return 0; 36 return 0;
37} 37}
diff --git a/include/asm-x86/mach-voyager/setup_arch.h b/include/asm-x86/mach-voyager/setup_arch.h
index 84d01ad33459..71729ca05cd7 100644
--- a/include/asm-x86/mach-voyager/setup_arch.h
+++ b/include/asm-x86/mach-voyager/setup_arch.h
@@ -1,5 +1,7 @@
1#include <asm/voyager.h> 1#include <asm/voyager.h>
2#define VOYAGER_BIOS_INFO ((struct voyager_bios_info *)(PARAM+0x40)) 2#include <asm/setup.h>
3#define VOYAGER_BIOS_INFO ((struct voyager_bios_info *) \
4 (&boot_params.apm_bios_info))
3 5
4/* Hook to call BIOS initialisation function */ 6/* Hook to call BIOS initialisation function */
5 7
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/ptrace.h b/include/asm-x86/ptrace.h
index 213c97300cb3..51ddb2590870 100644
--- a/include/asm-x86/ptrace.h
+++ b/include/asm-x86/ptrace.h
@@ -60,7 +60,7 @@ static inline int v8086_mode(struct pt_regs *regs)
60 60
61#define instruction_pointer(regs) ((regs)->eip) 61#define instruction_pointer(regs) ((regs)->eip)
62#define frame_pointer(regs) ((regs)->ebp) 62#define frame_pointer(regs) ((regs)->ebp)
63#define stack_pointer(regs) ((regs)->esp) 63#define stack_pointer(regs) ((unsigned long)(regs))
64#define regs_return_value(regs) ((regs)->eax) 64#define regs_return_value(regs) ((regs)->eax)
65 65
66extern unsigned long profile_pc(struct pt_regs *regs); 66extern unsigned long profile_pc(struct pt_regs *regs);
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/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/acpi.h b/include/linux/acpi.h
index 8ccedf7a0a5a..e3c16c981e46 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -132,6 +132,11 @@ extern unsigned long acpi_realmode_flags;
132int acpi_register_gsi (u32 gsi, int triggering, int polarity); 132int acpi_register_gsi (u32 gsi, int triggering, int polarity);
133int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 133int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
134 134
135#ifdef CONFIG_X86_IO_APIC
136extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity);
137#else
138#define acpi_get_override_irq(bus, trigger, polarity) (-1)
139#endif
135/* 140/*
136 * This function undoes the effect of one call to acpi_register_gsi(). 141 * This function undoes the effect of one call to acpi_register_gsi().
137 * If this matches the last registration, any IRQ resources for gsi 142 * If this matches the last registration, any IRQ resources for gsi
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 8263a7b74d34..5c4e54a2a8d6 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)
@@ -402,6 +425,8 @@ static inline int ata_id_has_lba48(const u16 *id)
402{ 425{
403 if ((id[83] & 0xC000) != 0x4000) 426 if ((id[83] & 0xC000) != 0x4000)
404 return 0; 427 return 0;
428 if (!ata_id_u64(id, 100))
429 return 0;
405 return id[83] & (1 << 10); 430 return id[83] & (1 << 10);
406} 431}
407 432
@@ -512,6 +537,15 @@ static inline int ata_drive_40wire(const u16 *dev_id)
512 return 1; 537 return 1;
513} 538}
514 539
540static inline int ata_drive_40wire_relaxed(const u16 *dev_id)
541{
542 if (ata_id_is_sata(dev_id))
543 return 0; /* SATA */
544 if ((dev_id[93] & 0x2000) == 0x2000)
545 return 0; /* 80 wire */
546 return 1;
547}
548
515static inline int atapi_cdb_len(const u16 *dev_id) 549static inline int atapi_cdb_len(const u16 *dev_id)
516{ 550{
517 u16 tmp = dev_id[0] & 0x3; 551 u16 tmp = dev_id[0] & 0x3;
@@ -522,6 +556,11 @@ static inline int atapi_cdb_len(const u16 *dev_id)
522 } 556 }
523} 557}
524 558
559static inline int atapi_command_packet_set(const u16 *dev_id)
560{
561 return (dev_id[0] >> 8) & 0x1f;
562}
563
525static inline int is_atapi_taskfile(const struct ata_taskfile *tf) 564static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
526{ 565{
527 return (tf->protocol == ATA_PROT_ATAPI) || 566 return (tf->protocol == ATA_PROT_ATAPI) ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bbf906a0b419..d18ee67b40f8 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;
@@ -697,6 +697,7 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *,
697extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 697extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
698 struct request *, int, rq_end_io_fn *); 698 struct request *, int, rq_end_io_fn *);
699extern int blk_verify_command(unsigned char *, int); 699extern int blk_verify_command(unsigned char *, int);
700extern void blk_unplug(struct request_queue *q);
700 701
701static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 702static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
702{ 703{
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/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 0b9bfbde8168..d62fcee9a08a 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -13,12 +13,6 @@ SUBSYS(cpuset)
13 13
14/* */ 14/* */
15 15
16#ifdef CONFIG_CGROUP_CPUACCT
17SUBSYS(cpuacct)
18#endif
19
20/* */
21
22#ifdef CONFIG_CGROUP_DEBUG 16#ifdef CONFIG_CGROUP_DEBUG
23SUBSYS(debug) 17SUBSYS(debug)
24#endif 18#endif
diff --git a/include/linux/cpu_acct.h b/include/linux/cpu_acct.h
deleted file mode 100644
index 6b5fd8a66c8d..000000000000
--- a/include/linux/cpu_acct.h
+++ /dev/null
@@ -1,14 +0,0 @@
1
2#ifndef _LINUX_CPU_ACCT_H
3#define _LINUX_CPU_ACCT_H
4
5#include <linux/cgroup.h>
6#include <asm/cputime.h>
7
8#ifdef CONFIG_CGROUP_CPUACCT
9extern void cpuacct_charge(struct task_struct *, cputime_t cputime);
10#else
11static void inline cpuacct_charge(struct task_struct *p, cputime_t cputime) {}
12#endif
13
14#endif
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 16a51546db44..c4e00161a247 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -92,6 +92,7 @@ struct cpuidle_device {
92 struct kobject kobj; 92 struct kobject kobj;
93 struct completion kobj_unregister; 93 struct completion kobj_unregister;
94 void *governor_data; 94 void *governor_data;
95 struct cpuidle_state *safe_state;
95}; 96};
96 97
97DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 98DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 37c66d1254b5..b8b7c51389fe 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -116,6 +116,7 @@ struct io_restrictions {
116 unsigned short hardsect_size; 116 unsigned short hardsect_size;
117 unsigned int max_segment_size; 117 unsigned int max_segment_size;
118 unsigned long seg_boundary_mask; 118 unsigned long seg_boundary_mask;
119 unsigned long bounce_pfn;
119 unsigned char no_cluster; /* inverted so that 0 is default */ 120 unsigned char no_cluster; /* inverted so that 0 is default */
120}; 121};
121 122
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/ext3_fs.h b/include/linux/ext3_fs.h
index 64134456ed8c..241c01cb92b2 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -656,6 +656,26 @@ struct ext3_dir_entry_2 {
656#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) 656#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1)
657#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ 657#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \
658 ~EXT3_DIR_ROUND) 658 ~EXT3_DIR_ROUND)
659#define EXT3_MAX_REC_LEN ((1<<16)-1)
660
661static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
662{
663 unsigned len = le16_to_cpu(dlen);
664
665 if (len == EXT3_MAX_REC_LEN)
666 return 1 << 16;
667 return len;
668}
669
670static inline __le16 ext3_rec_len_to_disk(unsigned len)
671{
672 if (len == (1 << 16))
673 return cpu_to_le16(EXT3_MAX_REC_LEN);
674 else if (len > (1 << 16))
675 BUG();
676 return cpu_to_le16(len);
677}
678
659/* 679/*
660 * Hash Tree Directory indexing 680 * Hash Tree Directory indexing
661 * (c) Daniel Phillips, 2001 681 * (c) Daniel Phillips, 2001
diff --git a/include/linux/f75375s.h b/include/linux/f75375s.h
new file mode 100644
index 000000000000..e99e22500668
--- /dev/null
+++ b/include/linux/f75375s.h
@@ -0,0 +1,21 @@
1/*
2 * f75375s.h - platform data structure for f75375s sensor
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2007, Riku Voipio <riku.voipio@iki.fi>
9 */
10
11#ifndef __LINUX_F75375S_H
12#define __LINUX_F75375S_H
13
14/* We want to set fans spinning on systems where there is no
15 * BIOS to do that for us */
16struct f75375s_platform_data {
17 u8 pwm[2];
18 u8 pwm_enable[2];
19};
20
21#endif /* __LINUX_F75375S_H */
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 99650353adfa..92d420fe03f8 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -149,10 +149,6 @@ union futex_key {
149 int offset; 149 int offset;
150 } both; 150 } both;
151}; 151};
152int get_futex_key(u32 __user *uaddr, struct rw_semaphore *shared,
153 union futex_key *key);
154void get_futex_key_refs(union futex_key *key);
155void drop_futex_key_refs(union futex_key *key);
156 152
157#ifdef CONFIG_FUTEX 153#ifdef CONFIG_FUTEX
158extern void exit_robust_list(struct task_struct *curr); 154extern void exit_robust_list(struct task_struct *curr);
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index ea0f50bfbe03..24968790bc3e 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -19,7 +19,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
19int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 19int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
20int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 20int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
21int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 21int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
22int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); 22int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int);
23void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 23void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
24void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 24void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
25int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 25int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
@@ -106,7 +106,7 @@ static inline unsigned long hugetlb_total_pages(void)
106 return 0; 106 return 0;
107} 107}
108 108
109#define follow_hugetlb_page(m,v,p,vs,a,b,i) ({ BUG(); 0; }) 109#define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; })
110#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) 110#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
111#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 111#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
112#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) 112#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
@@ -165,8 +165,10 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
165extern const struct file_operations hugetlbfs_file_operations; 165extern const struct file_operations hugetlbfs_file_operations;
166extern struct vm_operations_struct hugetlb_vm_ops; 166extern struct vm_operations_struct hugetlb_vm_ops;
167struct file *hugetlb_file_setup(const char *name, size_t); 167struct file *hugetlb_file_setup(const char *name, size_t);
168int hugetlb_get_quota(struct address_space *mapping); 168int hugetlb_get_quota(struct address_space *mapping, long delta);
169void hugetlb_put_quota(struct address_space *mapping); 169void hugetlb_put_quota(struct address_space *mapping, long delta);
170
171#define BLOCKS_PER_HUGEPAGE (HPAGE_SIZE / 512)
170 172
171static inline int is_file_hugepages(struct file *file) 173static inline int is_file_hugepages(struct file *file)
172{ 174{
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 8033e6b33271..a100c9f8eb7c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -400,11 +400,6 @@ extern int i2c_release_client(struct i2c_client *);
400extern void i2c_clients_command(struct i2c_adapter *adap, 400extern void i2c_clients_command(struct i2c_adapter *adap,
401 unsigned int cmd, void *arg); 401 unsigned int cmd, void *arg);
402 402
403/* returns -EBUSY if address has been taken, 0 if not. Note that the only
404 other place at which this is called is within i2c_attach_client; so
405 you can cheat by simply not registering. Not recommended, of course! */
406extern int i2c_check_addr (struct i2c_adapter *adapter, int addr);
407
408/* Detect function. It iterates over all possible addresses itself. 403/* Detect function. It iterates over all possible addresses itself.
409 * It will only call found_proc if some client is connected at the 404 * It will only call found_proc if some client is connected at the
410 * specific address (unless a 'force' matched); 405 * specific address (unless a 'force' matched);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 4ed4777bba67..dc75ccbcf991 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1031,14 +1031,7 @@ ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
1031extern ide_startstop_t ide_abort(ide_drive_t *, const char *); 1031extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
1032 1032
1033extern void ide_fix_driveid(struct hd_driveid *); 1033extern void ide_fix_driveid(struct hd_driveid *);
1034/* 1034
1035 * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
1036 * removing leading/trailing blanks and compressing internal blanks.
1037 * It is primarily used to tidy up the model name/number fields as
1038 * returned by the WIN_[P]IDENTIFY commands.
1039 *
1040 * (s, bytecount, byteswap)
1041 */
1042extern void ide_fixstring(u8 *, const int, const int); 1035extern void ide_fixstring(u8 *, const int, const int);
1043 1036
1044int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1037int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
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/kallsyms.h b/include/linux/kallsyms.h
index f73de6fb5c68..82de2fb62cb7 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -6,6 +6,7 @@
6#define _LINUX_KALLSYMS_H 6#define _LINUX_KALLSYMS_H
7 7
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/stddef.h>
9 10
10#define KSYM_NAME_LEN 128 11#define KSYM_NAME_LEN 128
11#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ 12#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6fd24e03622e..ef52a07c43d8 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,9 @@ 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 */
342 ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */
343 ATA_HORKAGE_STUCK_ERR = (1 << 9), /* stuck ERR on next PACKET */
328 344
329 /* DMA mask for user DMA control: User visible values; DO NOT 345 /* DMA mask for user DMA control: User visible values; DO NOT
330 renumber */ 346 renumber */
@@ -370,6 +386,18 @@ typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes,
370 unsigned long deadline); 386 unsigned long deadline);
371typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes); 387typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
372 388
389/*
390 * host pm policy: If you alter this, you also need to alter libata-scsi.c
391 * (for the ascii descriptions)
392 */
393enum link_pm {
394 NOT_AVAILABLE,
395 MIN_POWER,
396 MAX_PERFORMANCE,
397 MEDIUM_POWER,
398};
399extern struct class_device_attribute class_device_attr_link_power_management_policy;
400
373struct ata_ioports { 401struct ata_ioports {
374 void __iomem *cmd_addr; 402 void __iomem *cmd_addr;
375 void __iomem *data_addr; 403 void __iomem *data_addr;
@@ -616,6 +644,7 @@ struct ata_port {
616 644
617 pm_message_t pm_mesg; 645 pm_message_t pm_mesg;
618 int *pm_result; 646 int *pm_result;
647 enum link_pm pm_policy;
619 648
620 struct timer_list fastdrain_timer; 649 struct timer_list fastdrain_timer;
621 unsigned long fastdrain_cnt; 650 unsigned long fastdrain_cnt;
@@ -683,7 +712,8 @@ struct ata_port_operations {
683 712
684 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); 713 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg);
685 int (*port_resume) (struct ata_port *ap); 714 int (*port_resume) (struct ata_port *ap);
686 715 int (*enable_pm) (struct ata_port *ap, enum link_pm policy);
716 void (*disable_pm) (struct ata_port *ap);
687 int (*port_start) (struct ata_port *ap); 717 int (*port_start) (struct ata_port *ap);
688 void (*port_stop) (struct ata_port *ap); 718 void (*port_stop) (struct ata_port *ap);
689 719
@@ -742,8 +772,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
742 772
743extern void sata_print_link_status(struct ata_link *link); 773extern void sata_print_link_status(struct ata_link *link);
744extern void ata_port_probe(struct ata_port *); 774extern void ata_port_probe(struct ata_port *);
745extern void __sata_phy_reset(struct ata_port *ap);
746extern void sata_phy_reset(struct ata_port *ap);
747extern void ata_bus_reset(struct ata_port *ap); 775extern void ata_bus_reset(struct ata_port *ap);
748extern int sata_set_spd(struct ata_link *link); 776extern int sata_set_spd(struct ata_link *link);
749extern int sata_link_debounce(struct ata_link *link, 777extern int sata_link_debounce(struct ata_link *link,
@@ -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);
@@ -964,8 +993,6 @@ extern void sata_pmp_do_eh(struct ata_port *ap,
964/* 993/*
965 * EH 994 * EH
966 */ 995 */
967extern void ata_eng_timeout(struct ata_port *ap);
968
969extern void ata_port_schedule_eh(struct ata_port *ap); 996extern void ata_port_schedule_eh(struct ata_port *ap);
970extern int ata_link_abort(struct ata_link *link); 997extern int ata_link_abort(struct ata_link *link);
971extern int ata_port_abort(struct ata_port *ap); 998extern int ata_port_abort(struct ata_port *ap);
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index 580b3f4956ee..2f4e957af656 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -109,8 +109,11 @@ struct cmos_rtc_board_info {
109#ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */ 109#ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */
110 110
111#define RTC_IO_EXTENT 0x8 111#define RTC_IO_EXTENT 0x8
112#define RTC_IO_EXTENT_USED 0x2
112#define RTC_IOMAPPED 1 /* Default to I/O mapping. */ 113#define RTC_IOMAPPED 1 /* Default to I/O mapping. */
113 114
115#else
116#define RTC_IO_EXTENT_USED RTC_IO_EXTENT
114#endif /* ARCH_RTC_LOCATION */ 117#endif /* ARCH_RTC_LOCATION */
115 118
116#endif /* _MC146818RTC_H */ 119#endif /* _MC146818RTC_H */
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 7da2cee8e132..35a8277ec1bd 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -128,6 +128,18 @@ struct igmpmsg
128#ifdef __KERNEL__ 128#ifdef __KERNEL__
129#include <net/sock.h> 129#include <net/sock.h>
130 130
131#ifdef CONFIG_IP_MROUTE
132static inline int ip_mroute_opt(int opt)
133{
134 return (opt >= MRT_BASE) && (opt <= MRT_BASE + 10);
135}
136#else
137static inline int ip_mroute_opt(int opt)
138{
139 return 0;
140}
141#endif
142
131extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); 143extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int);
132extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 144extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
133extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 145extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
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/net.h b/include/linux/net.h
index dd79cdb8c4cf..596131ea46f4 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -95,6 +95,12 @@ enum sock_type {
95 95
96#endif /* ARCH_HAS_SOCKET_TYPES */ 96#endif /* ARCH_HAS_SOCKET_TYPES */
97 97
98enum sock_shutdown_cmd {
99 SHUT_RD = 0,
100 SHUT_WR = 1,
101 SHUT_RDWR = 2,
102};
103
98/** 104/**
99 * struct socket - general BSD socket 105 * struct socket - general BSD socket
100 * @state: socket state (%SS_CONNECTED, etc) 106 * @state: socket state (%SS_CONNECTED, etc)
@@ -223,6 +229,8 @@ extern int kernel_setsockopt(struct socket *sock, int level, int optname,
223extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 229extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
224 size_t size, int flags); 230 size_t size, int flags);
225extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 231extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
232extern int kernel_sock_shutdown(struct socket *sock,
233 enum sock_shutdown_cmd how);
226 234
227#ifndef CONFIG_SMP 235#ifndef CONFIG_SMP
228#define SOCKOPS_WRAPPED(name) name 236#define SOCKOPS_WRAPPED(name) name
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9b0c8f12373e..1e6af4f174b6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -739,6 +739,16 @@ static inline void *netdev_priv(const struct net_device *dev)
739 */ 739 */
740#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) 740#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
741 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 */
742static inline void netif_napi_add(struct net_device *dev, 752static inline void netif_napi_add(struct net_device *dev,
743 struct napi_struct *napi, 753 struct napi_struct *napi,
744 int (*poll)(struct napi_struct *, int), 754 int (*poll)(struct napi_struct *, int),
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index f2eaea2234ec..b87e83a5e070 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -4,25 +4,28 @@ header-y += nfnetlink_conntrack.h
4header-y += nfnetlink_log.h 4header-y += nfnetlink_log.h
5header-y += nfnetlink_queue.h 5header-y += nfnetlink_queue.h
6header-y += xt_CLASSIFY.h 6header-y += xt_CLASSIFY.h
7header-y += xt_CONNMARK.h
8header-y += xt_CONNSECMARK.h
9header-y += xt_DSCP.h
10header-y += xt_MARK.h
11header-y += xt_NFLOG.h
12header-y += xt_NFQUEUE.h
13header-y += xt_SECMARK.h
14header-y += xt_TCPMSS.h
7header-y += xt_comment.h 15header-y += xt_comment.h
8header-y += xt_connbytes.h 16header-y += xt_connbytes.h
9header-y += xt_connmark.h 17header-y += xt_connmark.h
10header-y += xt_CONNMARK.h
11header-y += xt_conntrack.h 18header-y += xt_conntrack.h
12header-y += xt_dccp.h 19header-y += xt_dccp.h
13header-y += xt_dscp.h 20header-y += xt_dscp.h
14header-y += xt_DSCP.h
15header-y += xt_esp.h 21header-y += xt_esp.h
16header-y += xt_helper.h
17header-y += xt_hashlimit.h 22header-y += xt_hashlimit.h
23header-y += xt_helper.h
18header-y += xt_length.h 24header-y += xt_length.h
19header-y += xt_limit.h 25header-y += xt_limit.h
20header-y += xt_mac.h 26header-y += xt_mac.h
21header-y += xt_mark.h 27header-y += xt_mark.h
22header-y += xt_MARK.h
23header-y += xt_multiport.h 28header-y += xt_multiport.h
24header-y += xt_NFQUEUE.h
25header-y += xt_NFLOG.h
26header-y += xt_pkttype.h 29header-y += xt_pkttype.h
27header-y += xt_policy.h 30header-y += xt_policy.h
28header-y += xt_realm.h 31header-y += xt_realm.h
@@ -32,9 +35,6 @@ header-y += xt_statistic.h
32header-y += xt_string.h 35header-y += xt_string.h
33header-y += xt_tcpmss.h 36header-y += xt_tcpmss.h
34header-y += xt_tcpudp.h 37header-y += xt_tcpudp.h
35header-y += xt_SECMARK.h
36header-y += xt_CONNSECMARK.h
37header-y += xt_TCPMSS.h
38 38
39unifdef-y += nf_conntrack_common.h 39unifdef-y += nf_conntrack_common.h
40unifdef-y += nf_conntrack_ftp.h 40unifdef-y += nf_conntrack_ftp.h
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 7185792b900f..3a7105bb8f33 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,47 +1,47 @@
1header-y += ipt_addrtype.h
2header-y += ipt_ah.h
3header-y += ipt_CLASSIFY.h 1header-y += ipt_CLASSIFY.h
4header-y += ipt_CLUSTERIP.h 2header-y += ipt_CLUSTERIP.h
3header-y += ipt_CONNMARK.h
4header-y += ipt_DSCP.h
5header-y += ipt_ECN.h
6header-y += ipt_LOG.h
7header-y += ipt_MARK.h
8header-y += ipt_NFQUEUE.h
9header-y += ipt_REJECT.h
10header-y += ipt_SAME.h
11header-y += ipt_TCPMSS.h
12header-y += ipt_TOS.h
13header-y += ipt_TTL.h
14header-y += ipt_ULOG.h
15header-y += ipt_addrtype.h
16header-y += ipt_ah.h
5header-y += ipt_comment.h 17header-y += ipt_comment.h
6header-y += ipt_connbytes.h 18header-y += ipt_connbytes.h
7header-y += ipt_connmark.h 19header-y += ipt_connmark.h
8header-y += ipt_CONNMARK.h
9header-y += ipt_conntrack.h 20header-y += ipt_conntrack.h
10header-y += ipt_dccp.h 21header-y += ipt_dccp.h
11header-y += ipt_dscp.h 22header-y += ipt_dscp.h
12header-y += ipt_DSCP.h
13header-y += ipt_ecn.h 23header-y += ipt_ecn.h
14header-y += ipt_ECN.h
15header-y += ipt_esp.h 24header-y += ipt_esp.h
16header-y += ipt_hashlimit.h 25header-y += ipt_hashlimit.h
17header-y += ipt_helper.h 26header-y += ipt_helper.h
18header-y += ipt_iprange.h 27header-y += ipt_iprange.h
19header-y += ipt_length.h 28header-y += ipt_length.h
20header-y += ipt_limit.h 29header-y += ipt_limit.h
21header-y += ipt_LOG.h
22header-y += ipt_mac.h 30header-y += ipt_mac.h
23header-y += ipt_mark.h 31header-y += ipt_mark.h
24header-y += ipt_MARK.h
25header-y += ipt_multiport.h 32header-y += ipt_multiport.h
26header-y += ipt_NFQUEUE.h
27header-y += ipt_owner.h 33header-y += ipt_owner.h
28header-y += ipt_physdev.h 34header-y += ipt_physdev.h
29header-y += ipt_pkttype.h 35header-y += ipt_pkttype.h
30header-y += ipt_policy.h 36header-y += ipt_policy.h
31header-y += ipt_realm.h 37header-y += ipt_realm.h
32header-y += ipt_recent.h 38header-y += ipt_recent.h
33header-y += ipt_REJECT.h
34header-y += ipt_SAME.h
35header-y += ipt_sctp.h 39header-y += ipt_sctp.h
36header-y += ipt_state.h 40header-y += ipt_state.h
37header-y += ipt_string.h 41header-y += ipt_string.h
38header-y += ipt_tcpmss.h 42header-y += ipt_tcpmss.h
39header-y += ipt_TCPMSS.h
40header-y += ipt_tos.h 43header-y += ipt_tos.h
41header-y += ipt_TOS.h
42header-y += ipt_ttl.h 44header-y += ipt_ttl.h
43header-y += ipt_TTL.h
44header-y += ipt_ULOG.h
45 45
46unifdef-y += ip_queue.h 46unifdef-y += ip_queue.h
47unifdef-y += ip_tables.h 47unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index 9dd978d149ff..8887a5fcd1d0 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -14,8 +14,8 @@ header-y += ip6t_mark.h
14header-y += ip6t_multiport.h 14header-y += ip6t_multiport.h
15header-y += ip6t_opts.h 15header-y += ip6t_opts.h
16header-y += ip6t_owner.h 16header-y += ip6t_owner.h
17header-y += ip6t_policy.h
18header-y += ip6t_physdev.h 17header-y += ip6t_physdev.h
18header-y += ip6t_policy.h
19header-y += ip6t_rt.h 19header-y += ip6t_rt.h
20 20
21unifdef-y += ip6_tables.h 21unifdef-y += ip6_tables.h
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 7c1f3b1d2ee5..d5bfaba595c7 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -192,7 +192,7 @@ extern int netlink_unregister_notifier(struct notifier_block *nb);
192/* finegrained unicast helpers: */ 192/* finegrained unicast helpers: */
193struct sock *netlink_getsockbyfilp(struct file *filp); 193struct sock *netlink_getsockbyfilp(struct file *filp);
194int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 194int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
195 long timeo, struct sock *ssk); 195 long *timeo, struct sock *ssk);
196void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 196void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
197int netlink_sendskb(struct sock *sk, struct sk_buff *skb); 197int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
198 198
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e82a6ebc725d..2d15d4aac094 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -422,7 +422,6 @@ extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_contr
422extern int nfs_wb_all(struct inode *inode); 422extern int nfs_wb_all(struct inode *inode);
423extern int nfs_wb_nocommit(struct inode *inode); 423extern int nfs_wb_nocommit(struct inode *inode);
424extern int nfs_wb_page(struct inode *inode, struct page* page); 424extern int nfs_wb_page(struct inode *inode, struct page* page);
425extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
426extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 425extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
427#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 426#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
428extern int nfs_commit_inode(struct inode *, int); 427extern int nfs_commit_inode(struct inode *, int);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5d2281f661f7..0dd93bb62fbe 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -109,6 +109,14 @@ enum pcie_reset_state {
109 pcie_hot_reset = (__force pcie_reset_state_t) 3 109 pcie_hot_reset = (__force pcie_reset_state_t) 3
110}; 110};
111 111
112typedef unsigned short __bitwise pci_dev_flags_t;
113enum pci_dev_flags {
114 /* INTX_DISABLE in PCI_COMMAND register disables MSI
115 * generation too.
116 */
117 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1,
118};
119
112typedef unsigned short __bitwise pci_bus_flags_t; 120typedef unsigned short __bitwise pci_bus_flags_t;
113enum pci_bus_flags { 121enum pci_bus_flags {
114 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, 122 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
@@ -185,6 +193,7 @@ struct pci_dev {
185 unsigned int msix_enabled:1; 193 unsigned int msix_enabled:1;
186 unsigned int is_managed:1; 194 unsigned int is_managed:1;
187 unsigned int is_pcie:1; 195 unsigned int is_pcie:1;
196 pci_dev_flags_t dev_flags;
188 atomic_t enable_cnt; /* pci_enable_device has been called */ 197 atomic_t enable_cnt; /* pci_enable_device has been called */
189 198
190 u32 saved_config_space[16]; /* config space saved at suspend time */ 199 u32 saved_config_space[16]; /* config space saved at suspend time */
@@ -479,8 +488,11 @@ extern void pci_sort_breadthfirst(void);
479 488
480/* Generic PCI functions exported to card drivers */ 489/* Generic PCI functions exported to card drivers */
481 490
491#ifdef CONFIG_PCI_LEGACY
482struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); 492struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from);
483struct pci_dev __deprecated *pci_find_slot (unsigned int bus, unsigned int devfn); 493struct pci_dev __deprecated *pci_find_slot (unsigned int bus, unsigned int devfn);
494#endif /* CONFIG_PCI_LEGACY */
495
484int pci_find_capability (struct pci_dev *dev, int cap); 496int pci_find_capability (struct pci_dev *dev, int cap);
485int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 497int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap);
486int pci_find_ext_capability (struct pci_dev *dev, int cap); 498int pci_find_ext_capability (struct pci_dev *dev, int cap);
@@ -622,7 +634,6 @@ static inline int __must_check pci_register_driver(struct pci_driver *driver)
622void pci_unregister_driver(struct pci_driver *); 634void pci_unregister_driver(struct pci_driver *);
623void pci_remove_behind_bridge(struct pci_dev *); 635void pci_remove_behind_bridge(struct pci_dev *);
624struct pci_driver *pci_dev_driver(const struct pci_dev *); 636struct pci_driver *pci_dev_driver(const struct pci_dev *);
625const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_dev *dev);
626const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); 637const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev);
627int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); 638int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass);
628 639
@@ -751,7 +762,6 @@ static inline void pci_unregister_driver(struct pci_driver *drv) { }
751static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } 762static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; }
752static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; } 763static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; }
753static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; } 764static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; }
754static inline const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev) { return NULL; }
755 765
756/* Power management related routines */ 766/* Power management related routines */
757static inline int pci_save_state(struct pci_dev *dev) { return 0; } 767static inline int pci_save_state(struct pci_dev *dev) { return 0; }
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index e44aac8cf5ff..1ee009e8fec8 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -360,9 +360,6 @@
360#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32 360#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32
361#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33 361#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33
362#define PCI_DEVICE_ID_ATI_RS480 0x5950 362#define PCI_DEVICE_ID_ATI_RS480 0x5950
363#define PCI_DEVICE_ID_ATI_RD580 0x5952
364#define PCI_DEVICE_ID_ATI_RX790 0x5957
365#define PCI_DEVICE_ID_ATI_RS690 0x7910
366/* ATI IXP Chipset */ 363/* ATI IXP Chipset */
367#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349 364#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349
368#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353 365#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353
@@ -1436,8 +1433,8 @@
1436#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 1433#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008
1437#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1434#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1438#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1435#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1436#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB 0x0036
1439#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 1437#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1440#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX 0x0104
1441#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132 1438#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132
1442#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1439#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1443#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1440#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
@@ -2279,6 +2276,9 @@
2279#define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 2276#define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582
2280#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 2277#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590
2281#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 2278#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592
2279#define PCI_DEVICE_ID_INTEL_5000_ERR 0x25F0
2280#define PCI_DEVICE_ID_INTEL_5000_FBD0 0x25F5
2281#define PCI_DEVICE_ID_INTEL_5000_FBD1 0x25F6
2282#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 2282#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770
2283#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 2283#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772
2284#define PCI_DEVICE_ID_INTEL_3000_HB 0x2778 2284#define PCI_DEVICE_ID_INTEL_3000_HB 0x2778
@@ -2332,6 +2332,7 @@
2332#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a 2332#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a
2333#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e 2333#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
2334#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b 2334#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b
2335#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2335#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff 2336#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
2336#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 2337#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031
2337#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 2338#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 0135c76c76c6..1689e28483e4 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -29,6 +29,7 @@ struct pid_namespace {
29 29
30extern struct pid_namespace init_pid_ns; 30extern struct pid_namespace init_pid_ns;
31 31
32#ifdef CONFIG_PID_NS
32static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) 33static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
33{ 34{
34 if (ns != &init_pid_ns) 35 if (ns != &init_pid_ns)
@@ -45,6 +46,28 @@ static inline void put_pid_ns(struct pid_namespace *ns)
45 kref_put(&ns->kref, free_pid_ns); 46 kref_put(&ns->kref, free_pid_ns);
46} 47}
47 48
49#else /* !CONFIG_PID_NS */
50#include <linux/err.h>
51
52static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
53{
54 return ns;
55}
56
57static inline struct pid_namespace *
58copy_pid_ns(unsigned long flags, struct pid_namespace *ns)
59{
60 if (flags & CLONE_NEWPID)
61 ns = ERR_PTR(-EINVAL);
62 return ns;
63}
64
65static inline void put_pid_ns(struct pid_namespace *ns)
66{
67}
68
69#endif /* CONFIG_PID_NS */
70
48static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) 71static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk)
49{ 72{
50 return tsk->nsproxy->pid_ns; 73 return tsk->nsproxy->pid_ns;
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 1ff461672060..1273c6ec535c 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -196,8 +196,6 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
196 return res; 196 return res;
197} 197}
198 198
199extern struct proc_dir_entry *proc_net_create(struct net *net,
200 const char *name, mode_t mode, get_info_t *get_info);
201extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 199extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
202 const char *name, mode_t mode, const struct file_operations *fops); 200 const char *name, mode_t mode, const struct file_operations *fops);
203extern void proc_net_remove(struct net *net, const char *name); 201extern void proc_net_remove(struct net *net, const char *name);
@@ -208,7 +206,6 @@ extern void proc_net_remove(struct net *net, const char *name);
208#define proc_bus NULL 206#define proc_bus NULL
209 207
210#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) 208#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
211#define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; })
212static inline void proc_net_remove(struct net *net, const char *name) {} 209static inline void proc_net_remove(struct net *net, const char *name) {}
213 210
214static inline void proc_flush_task(struct task_struct *task) 211static inline void proc_flush_task(struct task_struct *task)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 5bf618241ab9..4e81836191df 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -491,9 +491,11 @@ struct nduseroptmsg
491 unsigned char nduseropt_family; 491 unsigned char nduseropt_family;
492 unsigned char nduseropt_pad1; 492 unsigned char nduseropt_pad1;
493 unsigned short nduseropt_opts_len; /* Total length of options */ 493 unsigned short nduseropt_opts_len; /* Total length of options */
494 int nduseropt_ifindex;
494 __u8 nduseropt_icmp_type; 495 __u8 nduseropt_icmp_type;
495 __u8 nduseropt_icmp_code; 496 __u8 nduseropt_icmp_code;
496 unsigned short nduseropt_pad2; 497 unsigned short nduseropt_pad2;
498 unsigned int nduseropt_pad3;
497 /* Followed by one or more ND options */ 499 /* Followed by one or more ND options */
498}; 500};
499 501
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 457123171389..259735044148 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -150,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl,
150 struct scatterlist *ret = &sgl[nents - 1]; 150 struct scatterlist *ret = &sgl[nents - 1];
151#else 151#else
152 struct scatterlist *sg, *ret = NULL; 152 struct scatterlist *sg, *ret = NULL;
153 int i; 153 unsigned int i;
154 154
155 for_each_sg(sgl, sg, nents, i) 155 for_each_sg(sgl, sg, nents, i)
156 ret = sg; 156 ret = sg;
@@ -179,48 +179,32 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
179#ifndef ARCH_HAS_SG_CHAIN 179#ifndef ARCH_HAS_SG_CHAIN
180 BUG(); 180 BUG();
181#endif 181#endif
182 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;
183} 187}
184 188
185/** 189/**
186 * sg_mark_end - Mark the end of the scatterlist 190 * sg_mark_end - Mark the end of the scatterlist
187 * @sgl: Scatterlist 191 * @sg: SG entryScatterlist
188 * @nents: Number of entries in sgl
189 * 192 *
190 * Description: 193 * Description:
191 * Marks the last entry as the termination point for sg_next() 194 * Marks the passed in sg entry as the termination point for the sg
192 * 195 * table. A call to sg_next() on this entry will return NULL.
193 **/
194static inline void sg_mark_end(struct scatterlist *sgl, unsigned int nents)
195{
196 sgl[nents - 1].page_link = 0x02;
197}
198
199static inline void __sg_mark_end(struct scatterlist *sg)
200{
201 sg->page_link |= 0x02;
202}
203
204/**
205 * sg_init_one - Initialize a single entry sg list
206 * @sg: SG entry
207 * @buf: Virtual address for IO
208 * @buflen: IO length
209 *
210 * Notes:
211 * This should not be used on a single entry that is part of a larger
212 * table. Use sg_init_table() for that.
213 * 196 *
214 **/ 197 **/
215static inline void sg_init_one(struct scatterlist *sg, const void *buf, 198static inline void sg_mark_end(struct scatterlist *sg)
216 unsigned int buflen)
217{ 199{
218 memset(sg, 0, sizeof(*sg));
219#ifdef CONFIG_DEBUG_SG 200#ifdef CONFIG_DEBUG_SG
220 sg->sg_magic = SG_MAGIC; 201 BUG_ON(sg->sg_magic != SG_MAGIC);
221#endif 202#endif
222 sg_mark_end(sg, 1); 203 /*
223 sg_set_buf(sg, buf, buflen); 204 * Set termination bit, clear potential chain bit
205 */
206 sg->page_link |= 0x02;
207 sg->page_link &= ~0x01;
224} 208}
225 209
226/** 210/**
@@ -236,14 +220,32 @@ static inline void sg_init_one(struct scatterlist *sg, const void *buf,
236static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) 220static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
237{ 221{
238 memset(sgl, 0, sizeof(*sgl) * nents); 222 memset(sgl, 0, sizeof(*sgl) * nents);
239 sg_mark_end(sgl, nents);
240#ifdef CONFIG_DEBUG_SG 223#ifdef CONFIG_DEBUG_SG
241 { 224 {
242 int i; 225 unsigned int i;
243 for (i = 0; i < nents; i++) 226 for (i = 0; i < nents; i++)
244 sgl[i].sg_magic = SG_MAGIC; 227 sgl[i].sg_magic = SG_MAGIC;
245 } 228 }
246#endif 229#endif
230 sg_mark_end(&sgl[nents - 1]);
231}
232
233/**
234 * sg_init_one - Initialize a single entry sg list
235 * @sg: SG entry
236 * @buf: Virtual address for IO
237 * @buflen: IO length
238 *
239 * Notes:
240 * This should not be used on a single entry that is part of a larger
241 * table. Use sg_init_table() for that.
242 *
243 **/
244static inline void sg_init_one(struct scatterlist *sg, const void *buf,
245 unsigned int buflen)
246{
247 sg_init_table(sg, 1);
248 sg_set_buf(sg, buf, buflen);
247} 249}
248 250
249/** 251/**
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3c07d595979f..ee800e7a70de 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -254,6 +254,7 @@ long io_schedule_timeout(long timeout);
254 254
255extern void cpu_init (void); 255extern void cpu_init (void);
256extern void trap_init(void); 256extern void trap_init(void);
257extern void account_process_tick(struct task_struct *task, int user);
257extern void update_process_times(int user); 258extern void update_process_times(int user);
258extern void scheduler_tick(void); 259extern void scheduler_tick(void);
259 260
@@ -862,7 +863,6 @@ struct sched_entity {
862 struct load_weight load; /* for load-balancing */ 863 struct load_weight load; /* for load-balancing */
863 struct rb_node run_node; 864 struct rb_node run_node;
864 unsigned int on_rq; 865 unsigned int on_rq;
865 int peer_preempt;
866 866
867 u64 exec_start; 867 u64 exec_start;
868 u64 sum_exec_runtime; 868 u64 sum_exec_runtime;
@@ -1009,6 +1009,7 @@ struct task_struct {
1009 unsigned int rt_priority; 1009 unsigned int rt_priority;
1010 cputime_t utime, stime, utimescaled, stimescaled; 1010 cputime_t utime, stime, utimescaled, stimescaled;
1011 cputime_t gtime; 1011 cputime_t gtime;
1012 cputime_t prev_utime, prev_stime;
1012 unsigned long nvcsw, nivcsw; /* context switch counts */ 1013 unsigned long nvcsw, nivcsw; /* context switch counts */
1013 struct timespec start_time; /* monotonic time */ 1014 struct timespec start_time; /* monotonic time */
1014 struct timespec real_start_time; /* boot based time */ 1015 struct timespec real_start_time; /* boot based time */
@@ -1459,12 +1460,17 @@ extern void sched_idle_next(void);
1459 1460
1460#ifdef CONFIG_SCHED_DEBUG 1461#ifdef CONFIG_SCHED_DEBUG
1461extern unsigned int sysctl_sched_latency; 1462extern unsigned int sysctl_sched_latency;
1462extern unsigned int sysctl_sched_nr_latency; 1463extern unsigned int sysctl_sched_min_granularity;
1463extern unsigned int sysctl_sched_wakeup_granularity; 1464extern unsigned int sysctl_sched_wakeup_granularity;
1464extern unsigned int sysctl_sched_batch_wakeup_granularity; 1465extern unsigned int sysctl_sched_batch_wakeup_granularity;
1465extern unsigned int sysctl_sched_child_runs_first; 1466extern unsigned int sysctl_sched_child_runs_first;
1466extern unsigned int sysctl_sched_features; 1467extern unsigned int sysctl_sched_features;
1467extern unsigned int sysctl_sched_migration_cost; 1468extern unsigned int sysctl_sched_migration_cost;
1469extern unsigned int sysctl_sched_nr_migrate;
1470
1471int sched_nr_latency_handler(struct ctl_table *table, int write,
1472 struct file *file, void __user *buffer, size_t *length,
1473 loff_t *ppos);
1468#endif 1474#endif
1469 1475
1470extern unsigned int sysctl_sched_compat_yield; 1476extern unsigned int sysctl_sched_compat_yield;
@@ -1982,6 +1988,14 @@ static inline void inc_syscw(struct task_struct *tsk)
1982} 1988}
1983#endif 1989#endif
1984 1990
1991#ifdef CONFIG_SMP
1992void migration_init(void);
1993#else
1994static inline void migration_init(void)
1995{
1996}
1997#endif
1998
1985#endif /* __KERNEL__ */ 1999#endif /* __KERNEL__ */
1986 2000
1987#endif 2001#endif
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index d1b7ca6c1c57..6080f73fc85f 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -136,7 +136,7 @@ static inline int selinux_audit_rule_init(u32 field, u32 op,
136 char *rulestr, 136 char *rulestr,
137 struct selinux_audit_rule **rule) 137 struct selinux_audit_rule **rule)
138{ 138{
139 return -ENOTSUPP; 139 return -EOPNOTSUPP;
140} 140}
141 141
142static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule) 142static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 94e49915a8c0..bddd50bd6878 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -356,7 +356,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
356 return __alloc_skb(size, priority, 1, -1); 356 return __alloc_skb(size, priority, 1, -1);
357} 357}
358 358
359extern void kfree_skbmem(struct sk_buff *skb);
360extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 359extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
361extern struct sk_buff *skb_clone(struct sk_buff *skb, 360extern struct sk_buff *skb_clone(struct sk_buff *skb,
362 gfp_t priority); 361 gfp_t priority);
@@ -387,7 +386,9 @@ extern void skb_truesize_bug(struct sk_buff *skb);
387 386
388static inline void skb_truesize_check(struct sk_buff *skb) 387static inline void skb_truesize_check(struct sk_buff *skb)
389{ 388{
390 if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len)) 389 int len = sizeof(struct sk_buff) + skb->len;
390
391 if (unlikely((int)skb->truesize < len))
391 skb_truesize_bug(skb); 392 skb_truesize_bug(skb);
392} 393}
393 394
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 259a13c3bd98..c25e66bcecf3 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -84,11 +84,12 @@ void smp_prepare_boot_cpu(void);
84 * These macros fold the SMP functionality into a single CPU system 84 * These macros fold the SMP functionality into a single CPU system
85 */ 85 */
86#define raw_smp_processor_id() 0 86#define raw_smp_processor_id() 0
87static inline int up_smp_call_function(void) 87static inline int up_smp_call_function(void (*func)(void *), void *info)
88{ 88{
89 return 0; 89 return 0;
90} 90}
91#define smp_call_function(func,info,retry,wait) (up_smp_call_function()) 91#define smp_call_function(func, info, retry, wait) \
92 (up_smp_call_function(func, info))
92#define on_each_cpu(func,info,retry,wait) \ 93#define on_each_cpu(func,info,retry,wait) \
93 ({ \ 94 ({ \
94 local_irq_disable(); \ 95 local_irq_disable(); \
@@ -107,6 +108,8 @@ static inline void smp_send_reschedule(int cpu) { }
107 local_irq_enable(); \ 108 local_irq_enable(); \
108 0; \ 109 0; \
109}) 110})
111#define smp_call_function_mask(mask, func, info, wait) \
112 (up_smp_call_function(func, info))
110 113
111#endif /* !SMP */ 114#endif /* !SMP */
112 115
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/debug.h b/include/linux/sunrpc/debug.h
index 3347c72b848a..3912cf16361e 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -88,11 +88,6 @@ enum {
88 CTL_SLOTTABLE_TCP, 88 CTL_SLOTTABLE_TCP,
89 CTL_MIN_RESVPORT, 89 CTL_MIN_RESVPORT,
90 CTL_MAX_RESVPORT, 90 CTL_MAX_RESVPORT,
91 CTL_SLOTTABLE_RDMA,
92 CTL_RDMA_MAXINLINEREAD,
93 CTL_RDMA_MAXINLINEWRITE,
94 CTL_RDMA_WRITEPADDING,
95 CTL_RDMA_MEMREG,
96}; 91};
97 92
98#endif /* _LINUX_SUNRPC_DEBUG_H_ */ 93#endif /* _LINUX_SUNRPC_DEBUG_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/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index 2c6c2c2783d8..c2a46c45c8f7 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -9,12 +9,6 @@
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12/*
13 * Socket transport setup operations
14 */
15struct rpc_xprt *xs_setup_udp(struct xprt_create *args);
16struct rpc_xprt *xs_setup_tcp(struct xprt_create *args);
17
18int init_socket_xprt(void); 12int init_socket_xprt(void);
19void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
20 14
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e99171f01b4c..4f5047df8a9e 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -70,7 +70,6 @@ enum
70 CTL_ABI=9, /* Binary emulation */ 70 CTL_ABI=9, /* Binary emulation */
71 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */ 71 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
72 CTL_ARLAN=254, /* arlan wireless driver */ 72 CTL_ARLAN=254, /* arlan wireless driver */
73 CTL_APPLDATA=2120, /* s390 appldata */
74 CTL_S390DBF=5677, /* s390 debug */ 73 CTL_S390DBF=5677, /* s390 debug */
75 CTL_SUNRPC=7249, /* sunrpc debug */ 74 CTL_SUNRPC=7249, /* sunrpc debug */
76 CTL_PM=9899, /* frv power management */ 75 CTL_PM=9899, /* frv power management */
@@ -207,11 +206,6 @@ enum
207 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ 206 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
208 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ 207 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
209 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ 208 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
210
211 /* s390 vm cmm sysctls */
212 VM_CMM_PAGES=1111,
213 VM_CMM_TIMED_PAGES=1112,
214 VM_CMM_TIMEOUT=1113,
215}; 209};
216 210
217 211
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 37ac3ff90faf..24c6a2b59511 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -137,6 +137,7 @@ struct timex {
137#define ADJ_TIMECONST 0x0020 /* pll time constant */ 137#define ADJ_TIMECONST 0x0020 /* pll time constant */
138#define ADJ_TICK 0x4000 /* tick value */ 138#define ADJ_TICK 0x4000 /* tick value */
139#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 139#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
140#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
140 141
141/* xntp 3.4 compatibility names */ 142/* xntp 3.4 compatibility names */
142#define MOD_OFFSET ADJ_OFFSET 143#define MOD_OFFSET ADJ_OFFSET
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 56164d7ba0ad..c555f5442bd7 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -332,7 +332,9 @@ extern void tty_ldisc_flush(struct tty_struct *tty);
332 332
333extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 333extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
334 unsigned long arg); 334 unsigned long arg);
335 335extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
336 unsigned int cmd, unsigned long arg);
337extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
336extern dev_t tty_devnum(struct tty_struct *tty); 338extern dev_t tty_devnum(struct tty_struct *tty);
337extern void proc_clear_tty(struct task_struct *p); 339extern void proc_clear_tty(struct task_struct *p);
338extern struct tty_struct *get_current_tty(void); 340extern struct tty_struct *get_current_tty(void);
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/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ac69e7bb5a14..1a4ed49f6478 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -67,7 +67,7 @@ struct vring {
67}; 67};
68 68
69/* The standard layout for the ring is a continuous chunk of memory which looks 69/* The standard layout for the ring is a continuous chunk of memory which looks
70 * like this. The used fields will be aligned to a "num+1" boundary. 70 * like this. We assume num is a power of 2.
71 * 71 *
72 * struct vring 72 * struct vring
73 * { 73 * {
@@ -79,8 +79,8 @@ struct vring {
79 * __u16 avail_idx; 79 * __u16 avail_idx;
80 * __u16 available[num]; 80 * __u16 available[num];
81 * 81 *
82 * // Padding so a correctly-chosen num value will cache-align used_idx. 82 * // Padding to the next page boundary.
83 * char pad[sizeof(struct vring_desc) - sizeof(avail_flags)]; 83 * char pad[];
84 * 84 *
85 * // A ring of used descriptor heads with free-running index. 85 * // A ring of used descriptor heads with free-running index.
86 * __u16 used_flags; 86 * __u16 used_flags;
@@ -88,18 +88,21 @@ struct vring {
88 * struct vring_used_elem used[num]; 88 * struct vring_used_elem used[num];
89 * }; 89 * };
90 */ 90 */
91static inline void vring_init(struct vring *vr, unsigned int num, void *p) 91static inline void vring_init(struct vring *vr, unsigned int num, void *p,
92 unsigned int pagesize)
92{ 93{
93 vr->num = num; 94 vr->num = num;
94 vr->desc = p; 95 vr->desc = p;
95 vr->avail = p + num*sizeof(struct vring); 96 vr->avail = p + num*sizeof(struct vring_desc);
96 vr->used = p + (num+1)*(sizeof(struct vring) + sizeof(__u16)); 97 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + pagesize-1)
98 & ~(pagesize - 1));
97} 99}
98 100
99static inline unsigned vring_size(unsigned int num) 101static inline unsigned vring_size(unsigned int num, unsigned int pagesize)
100{ 102{
101 return (num + 1) * (sizeof(struct vring_desc) + sizeof(__u16)) 103 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
102 + sizeof(__u32) + num * sizeof(struct vring_used_elem); 104 + pagesize - 1) & ~(pagesize - 1))
105 + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num;
103} 106}
104 107
105#ifdef __KERNEL__ 108#ifdef __KERNEL__
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 0864a775de24..a1c805d7f488 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -12,7 +12,7 @@ extern void unix_gc(void);
12 12
13#define UNIX_HASH_SIZE 256 13#define UNIX_HASH_SIZE 256
14 14
15extern atomic_t unix_tot_inflight; 15extern unsigned int unix_tot_inflight;
16 16
17struct unix_address { 17struct unix_address {
18 atomic_t refcnt; 18 atomic_t refcnt;
diff --git a/include/net/dst.h b/include/net/dst.h
index e9ff4a4caef9..2f65e894b829 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -143,6 +143,13 @@ static inline void dst_hold(struct dst_entry * dst)
143 atomic_inc(&dst->__refcnt); 143 atomic_inc(&dst->__refcnt);
144} 144}
145 145
146static inline void dst_use(struct dst_entry *dst, unsigned long time)
147{
148 dst_hold(dst);
149 dst->__use++;
150 dst->lastuse = time;
151}
152
146static inline 153static inline
147struct dst_entry * dst_clone(struct dst_entry * dst) 154struct dst_entry * dst_clone(struct dst_entry * dst)
148{ 155{
diff --git a/include/net/esp.h b/include/net/esp.h
index c1bc529809da..c05f529bff28 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/crypto.h> 4#include <linux/crypto.h>
5#include <net/xfrm.h> 5#include <net/xfrm.h>
6#include <asm/scatterlist.h> 6#include <linux/scatterlist.h>
7 7
8#define ESP_NUM_FAST_SG 4 8#define ESP_NUM_FAST_SG 4
9 9
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 017aebd90683..41a301e38643 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -107,4 +107,7 @@ extern int fib_rules_unregister(struct fib_rules_ops *);
107extern int fib_rules_lookup(struct fib_rules_ops *, 107extern int fib_rules_lookup(struct fib_rules_ops *,
108 struct flowi *, int flags, 108 struct flowi *, int flags,
109 struct fib_lookup_arg *); 109 struct fib_lookup_arg *);
110extern int fib_default_rule_add(struct fib_rules_ops *,
111 u32 pref, u32 table,
112 u32 flags);
110#endif 113#endif
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 164d13211165..d8ae48439f12 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -115,8 +115,16 @@ extern u32 ieee80211_debug_level;
115do { if (ieee80211_debug_level & (level)) \ 115do { if (ieee80211_debug_level & (level)) \
116 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ 116 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
117 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 117 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
118static inline bool ieee80211_ratelimit_debug(u32 level)
119{
120 return (ieee80211_debug_level & level) && net_ratelimit();
121}
118#else 122#else
119#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) 123#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
124static inline bool ieee80211_ratelimit_debug(u32 level)
125{
126 return false;
127}
120#endif /* CONFIG_IEEE80211_DEBUG */ 128#endif /* CONFIG_IEEE80211_DEBUG */
121 129
122/* escape_essid() is intended to be used in debug (and possibly error) 130/* escape_essid() is intended to be used in debug (and possibly error)
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 227adcbdfec8..38d5a1e9980d 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -13,9 +13,6 @@ struct sock;
13struct sockaddr; 13struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern void inet_remove_sock(struct sock *sk1);
17extern void inet_put_sock(unsigned short num,
18 struct sock *sk);
19extern int inet_release(struct socket *sock); 16extern int inet_release(struct socket *sock);
20extern int inet_stream_connect(struct socket *sock, 17extern int inet_stream_connect(struct socket *sock,
21 struct sockaddr * uaddr, 18 struct sockaddr * uaddr,
@@ -30,7 +27,6 @@ extern int inet_sendmsg(struct kiocb *iocb,
30 struct msghdr *msg, 27 struct msghdr *msg,
31 size_t size); 28 size_t size);
32extern int inet_shutdown(struct socket *sock, int how); 29extern int inet_shutdown(struct socket *sock, int how);
33extern unsigned int inet_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait);
34extern int inet_listen(struct socket *sock, int backlog); 30extern int inet_listen(struct socket *sock, int backlog);
35 31
36extern void inet_sock_destruct(struct sock *sk); 32extern void inet_sock_destruct(struct sock *sk);
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 4427dcd1e53a..37f6cb112127 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -23,6 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/wait.h> 25#include <linux/wait.h>
26#include <linux/vmalloc.h>
26 27
27#include <net/inet_connection_sock.h> 28#include <net/inet_connection_sock.h>
28#include <net/inet_sock.h> 29#include <net/inet_sock.h>
@@ -37,7 +38,6 @@
37 * I'll experiment with dynamic table growth later. 38 * I'll experiment with dynamic table growth later.
38 */ 39 */
39struct inet_ehash_bucket { 40struct inet_ehash_bucket {
40 rwlock_t lock;
41 struct hlist_head chain; 41 struct hlist_head chain;
42 struct hlist_head twchain; 42 struct hlist_head twchain;
43}; 43};
@@ -100,6 +100,9 @@ struct inet_hashinfo {
100 * TIME_WAIT sockets use a separate chain (twchain). 100 * TIME_WAIT sockets use a separate chain (twchain).
101 */ 101 */
102 struct inet_ehash_bucket *ehash; 102 struct inet_ehash_bucket *ehash;
103 rwlock_t *ehash_locks;
104 unsigned int ehash_size;
105 unsigned int ehash_locks_mask;
103 106
104 /* Ok, let's try this, I give up, we do need a local binding 107 /* Ok, let's try this, I give up, we do need a local binding
105 * TCP hash as well as the others for fast bind/connect. 108 * TCP hash as well as the others for fast bind/connect.
@@ -107,7 +110,7 @@ struct inet_hashinfo {
107 struct inet_bind_hashbucket *bhash; 110 struct inet_bind_hashbucket *bhash;
108 111
109 unsigned int bhash_size; 112 unsigned int bhash_size;
110 unsigned int ehash_size; 113 /* Note : 4 bytes padding on 64 bit arches */
111 114
112 /* All sockets in TCP_LISTEN state will be in here. This is the only 115 /* All sockets in TCP_LISTEN state will be in here. This is the only
113 * table where wildcard'd TCP sockets can exist. Hash function here 116 * table where wildcard'd TCP sockets can exist. Hash function here
@@ -134,6 +137,61 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket(
134 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)]; 137 return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)];
135} 138}
136 139
140static inline rwlock_t *inet_ehash_lockp(
141 struct inet_hashinfo *hashinfo,
142 unsigned int hash)
143{
144 return &hashinfo->ehash_locks[hash & hashinfo->ehash_locks_mask];
145}
146
147static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
148{
149 unsigned int i, size = 256;
150#if defined(CONFIG_PROVE_LOCKING)
151 unsigned int nr_pcpus = 2;
152#else
153 unsigned int nr_pcpus = num_possible_cpus();
154#endif
155 if (nr_pcpus >= 4)
156 size = 512;
157 if (nr_pcpus >= 8)
158 size = 1024;
159 if (nr_pcpus >= 16)
160 size = 2048;
161 if (nr_pcpus >= 32)
162 size = 4096;
163 if (sizeof(rwlock_t) != 0) {
164#ifdef CONFIG_NUMA
165 if (size * sizeof(rwlock_t) > PAGE_SIZE)
166 hashinfo->ehash_locks = vmalloc(size * sizeof(rwlock_t));
167 else
168#endif
169 hashinfo->ehash_locks = kmalloc(size * sizeof(rwlock_t),
170 GFP_KERNEL);
171 if (!hashinfo->ehash_locks)
172 return ENOMEM;
173 for (i = 0; i < size; i++)
174 rwlock_init(&hashinfo->ehash_locks[i]);
175 }
176 hashinfo->ehash_locks_mask = size - 1;
177 return 0;
178}
179
180static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
181{
182 if (hashinfo->ehash_locks) {
183#ifdef CONFIG_NUMA
184 unsigned int size = (hashinfo->ehash_locks_mask + 1) *
185 sizeof(rwlock_t);
186 if (size > PAGE_SIZE)
187 vfree(hashinfo->ehash_locks);
188 else
189#endif
190 kfree(hashinfo->ehash_locks);
191 hashinfo->ehash_locks = NULL;
192 }
193}
194
137extern struct inet_bind_bucket * 195extern struct inet_bind_bucket *
138 inet_bind_bucket_create(struct kmem_cache *cachep, 196 inet_bind_bucket_create(struct kmem_cache *cachep,
139 struct inet_bind_hashbucket *head, 197 struct inet_bind_hashbucket *head,
@@ -222,7 +280,7 @@ static inline void __inet_hash(struct inet_hashinfo *hashinfo,
222 sk->sk_hash = inet_sk_ehashfn(sk); 280 sk->sk_hash = inet_sk_ehashfn(sk);
223 head = inet_ehash_bucket(hashinfo, sk->sk_hash); 281 head = inet_ehash_bucket(hashinfo, sk->sk_hash);
224 list = &head->chain; 282 list = &head->chain;
225 lock = &head->lock; 283 lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
226 write_lock(lock); 284 write_lock(lock);
227 } 285 }
228 __sk_add_node(sk, list); 286 __sk_add_node(sk, list);
@@ -253,7 +311,7 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk)
253 inet_listen_wlock(hashinfo); 311 inet_listen_wlock(hashinfo);
254 lock = &hashinfo->lhash_lock; 312 lock = &hashinfo->lhash_lock;
255 } else { 313 } else {
256 lock = &inet_ehash_bucket(hashinfo, sk->sk_hash)->lock; 314 lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
257 write_lock_bh(lock); 315 write_lock_bh(lock);
258 } 316 }
259 317
@@ -354,9 +412,10 @@ static inline struct sock *
354 */ 412 */
355 unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); 413 unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport);
356 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); 414 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
415 rwlock_t *lock = inet_ehash_lockp(hashinfo, hash);
357 416
358 prefetch(head->chain.first); 417 prefetch(head->chain.first);
359 read_lock(&head->lock); 418 read_lock(lock);
360 sk_for_each(sk, node, &head->chain) { 419 sk_for_each(sk, node, &head->chain) {
361 if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) 420 if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
362 goto hit; /* You sunk my battleship! */ 421 goto hit; /* You sunk my battleship! */
@@ -369,7 +428,7 @@ static inline struct sock *
369 } 428 }
370 sk = NULL; 429 sk = NULL;
371out: 430out:
372 read_unlock(&head->lock); 431 read_unlock(lock);
373 return sk; 432 return sk;
374hit: 433hit:
375 sock_hold(sk); 434 sock_hold(sk);
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index aa10a8178e70..ad8404b56113 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -22,7 +22,7 @@ struct inet_peer
22 __be32 v4daddr; /* peer's address */ 22 __be32 v4daddr; /* peer's address */
23 __u16 avl_height; 23 __u16 avl_height;
24 __u16 ip_id_count; /* IP ID for the next packet */ 24 __u16 ip_id_count; /* IP ID for the next packet */
25 struct inet_peer *unused_next, **unused_prevp; 25 struct list_head unused;
26 __u32 dtime; /* the time of last use of not 26 __u32 dtime; /* the time of last use of not
27 * referenced entries */ 27 * referenced entries */
28 atomic_t refcnt; 28 atomic_t refcnt;
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 8cadc77c7df4..ed514bfb61ba 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -185,6 +185,12 @@ static inline void fib_select_default(const struct flowi *flp, struct fib_result
185} 185}
186 186
187#else /* CONFIG_IP_MULTIPLE_TABLES */ 187#else /* CONFIG_IP_MULTIPLE_TABLES */
188extern void __init fib4_rules_init(void);
189
190#ifdef CONFIG_NET_CLS_ROUTE
191extern u32 fib_rules_tclass(struct fib_result *res);
192#endif
193
188#define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) 194#define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL)
189#define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) 195#define ip_fib_main_table fib_get_table(RT_TABLE_MAIN)
190 196
@@ -214,15 +220,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res);
214/* Exported by fib_hash.c */ 220/* Exported by fib_hash.c */
215extern struct fib_table *fib_hash_init(u32 id); 221extern struct fib_table *fib_hash_init(u32 id);
216 222
217#ifdef CONFIG_IP_MULTIPLE_TABLES
218extern void __init fib4_rules_init(void);
219
220#ifdef CONFIG_NET_CLS_ROUTE
221extern u32 fib_rules_tclass(struct fib_result *res);
222#endif
223
224#endif
225
226static inline void fib_combine_itag(u32 *itag, struct fib_result *res) 223static inline void fib_combine_itag(u32 *itag, struct fib_result *res)
227{ 224{
228#ifdef CONFIG_NET_CLS_ROUTE 225#ifdef CONFIG_NET_CLS_ROUTE
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 41870564df8e..8a7d59be8a0d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -328,40 +328,6 @@ extern int ip_vs_get_debug_level(void);
328#define FTPDATA __constant_htons(20) 328#define FTPDATA __constant_htons(20)
329 329
330/* 330/*
331 * IPVS sysctl variables under the /proc/sys/net/ipv4/vs/
332 */
333#define NET_IPV4_VS 21
334
335enum {
336 NET_IPV4_VS_DEBUG_LEVEL=1,
337 NET_IPV4_VS_AMEMTHRESH=2,
338 NET_IPV4_VS_AMDROPRATE=3,
339 NET_IPV4_VS_DROP_ENTRY=4,
340 NET_IPV4_VS_DROP_PACKET=5,
341 NET_IPV4_VS_SECURE_TCP=6,
342 NET_IPV4_VS_TO_ES=7,
343 NET_IPV4_VS_TO_SS=8,
344 NET_IPV4_VS_TO_SR=9,
345 NET_IPV4_VS_TO_FW=10,
346 NET_IPV4_VS_TO_TW=11,
347 NET_IPV4_VS_TO_CL=12,
348 NET_IPV4_VS_TO_CW=13,
349 NET_IPV4_VS_TO_LA=14,
350 NET_IPV4_VS_TO_LI=15,
351 NET_IPV4_VS_TO_SA=16,
352 NET_IPV4_VS_TO_UDP=17,
353 NET_IPV4_VS_TO_ICMP=18,
354 NET_IPV4_VS_LBLC_EXPIRE=19,
355 NET_IPV4_VS_LBLCR_EXPIRE=20,
356 NET_IPV4_VS_CACHE_BYPASS=22,
357 NET_IPV4_VS_EXPIRE_NODEST_CONN=23,
358 NET_IPV4_VS_SYNC_THRESHOLD=24,
359 NET_IPV4_VS_NAT_ICMP_SEND=25,
360 NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE=26,
361 NET_IPV4_VS_LAST
362};
363
364/*
365 * TCP State Values 331 * TCP State Values
366 */ 332 */
367enum { 333enum {
@@ -520,6 +486,10 @@ struct ip_vs_conn {
520 spinlock_t lock; /* lock for state transition */ 486 spinlock_t lock; /* lock for state transition */
521 volatile __u16 flags; /* status flags */ 487 volatile __u16 flags; /* status flags */
522 volatile __u16 state; /* state info */ 488 volatile __u16 state; /* state info */
489 volatile __u16 old_state; /* old state, to be used for
490 * state transition triggerd
491 * synchronization
492 */
523 493
524 /* Control members */ 494 /* Control members */
525 struct ip_vs_conn *control; /* Master control connection */ 495 struct ip_vs_conn *control; /* Master control connection */
@@ -901,6 +871,10 @@ extern int ip_vs_use_count_inc(void);
901extern void ip_vs_use_count_dec(void); 871extern void ip_vs_use_count_dec(void);
902extern int ip_vs_control_init(void); 872extern int ip_vs_control_init(void);
903extern void ip_vs_control_cleanup(void); 873extern void ip_vs_control_cleanup(void);
874extern struct ip_vs_dest *
875ip_vs_find_dest(__be32 daddr, __be16 dport,
876 __be32 vaddr, __be16 vport, __u16 protocol);
877extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
904 878
905 879
906/* 880/*
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5fcc4c104340..17b60391fcd6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -706,11 +706,16 @@ enum ieee80211_hw_flags {
706 * 706 *
707 * @queues: number of available hardware transmit queues for 707 * @queues: number of available hardware transmit queues for
708 * data packets. WMM/QoS requires at least four. 708 * data packets. WMM/QoS requires at least four.
709 *
710 * @rate_control_algorithm: rate control algorithm for this hardware.
711 * If unset (NULL), the default algorithm will be used. Must be
712 * set before calling ieee80211_register_hw().
709 */ 713 */
710struct ieee80211_hw { 714struct ieee80211_hw {
711 struct ieee80211_conf conf; 715 struct ieee80211_conf conf;
712 struct wiphy *wiphy; 716 struct wiphy *wiphy;
713 struct workqueue_struct *workqueue; 717 struct workqueue_struct *workqueue;
718 const char *rate_control_algorithm;
714 void *priv; 719 void *priv;
715 u32 flags; 720 u32 flags;
716 unsigned int extra_tx_headroom; 721 unsigned int extra_tx_headroom;
@@ -936,27 +941,11 @@ enum ieee80211_erp_change_flags {
936 * and remove_interface calls, i.e. while the interface with the 941 * and remove_interface calls, i.e. while the interface with the
937 * given local_address is enabled. 942 * given local_address is enabled.
938 * 943 *
939 * @set_ieee8021x: Enable/disable IEEE 802.1X. This item requests wlan card
940 * to pass unencrypted EAPOL-Key frames even when encryption is
941 * configured. If the wlan card does not require such a configuration,
942 * this function pointer can be set to NULL.
943 *
944 * @set_port_auth: Set port authorization state (IEEE 802.1X PAE) to be
945 * authorized (@authorized=1) or unauthorized (=0). This function can be
946 * used if the wlan hardware or low-level driver implements PAE.
947 * mac80211 will filter frames based on authorization state in any case,
948 * so this function pointer can be NULL if low-level driver does not
949 * require event notification about port state changes.
950 *
951 * @hw_scan: Ask the hardware to service the scan request, no need to start 944 * @hw_scan: Ask the hardware to service the scan request, no need to start
952 * the scan state machine in stack. 945 * the scan state machine in stack.
953 * 946 *
954 * @get_stats: return low-level statistics 947 * @get_stats: return low-level statistics
955 * 948 *
956 * @set_privacy_invoked: For devices that generate their own beacons and probe
957 * response or association responses this updates the state of privacy_invoked
958 * returns 0 for success or an error number.
959 *
960 * @get_sequence_counter: For devices that have internal sequence counters this 949 * @get_sequence_counter: For devices that have internal sequence counters this
961 * callback allows mac80211 to access the current value of a counter. 950 * callback allows mac80211 to access the current value of a counter.
962 * This callback seems not well-defined, tell us if you need it. 951 * This callback seems not well-defined, tell us if you need it.
@@ -1029,14 +1018,9 @@ struct ieee80211_ops {
1029 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1018 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1030 const u8 *local_address, const u8 *address, 1019 const u8 *local_address, const u8 *address,
1031 struct ieee80211_key_conf *key); 1020 struct ieee80211_key_conf *key);
1032 int (*set_ieee8021x)(struct ieee80211_hw *hw, int use_ieee8021x);
1033 int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr,
1034 int authorized);
1035 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); 1021 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
1036 int (*get_stats)(struct ieee80211_hw *hw, 1022 int (*get_stats)(struct ieee80211_hw *hw,
1037 struct ieee80211_low_level_stats *stats); 1023 struct ieee80211_low_level_stats *stats);
1038 int (*set_privacy_invoked)(struct ieee80211_hw *hw,
1039 int privacy_invoked);
1040 int (*get_sequence_counter)(struct ieee80211_hw *hw, 1024 int (*get_sequence_counter)(struct ieee80211_hw *hw,
1041 u8* addr, u8 keyidx, u8 txrx, 1025 u8* addr, u8 keyidx, u8 txrx,
1042 u32* iv32, u16* iv16); 1026 u32* iv32, u16* iv16);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 5279466606d2..5dd6d90b37eb 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,9 +119,11 @@ 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
122#define __net_initdata
105#else 123#else
106#define __net_init __init 124#define __net_init __init
107#define __net_exit __exit_refok 125#define __net_exit __exit_refok
126#define __net_initdata __initdata
108#endif 127#endif
109 128
110struct pernet_operations { 129struct pernet_operations {
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 7aed02ce2b65..cff4608179c1 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -124,23 +124,7 @@ struct request_sock_queue {
124extern int reqsk_queue_alloc(struct request_sock_queue *queue, 124extern int reqsk_queue_alloc(struct request_sock_queue *queue,
125 unsigned int nr_table_entries); 125 unsigned int nr_table_entries);
126 126
127static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock_queue *queue) 127extern void __reqsk_queue_destroy(struct request_sock_queue *queue);
128{
129 struct listen_sock *lopt;
130
131 write_lock_bh(&queue->syn_wait_lock);
132 lopt = queue->listen_opt;
133 queue->listen_opt = NULL;
134 write_unlock_bh(&queue->syn_wait_lock);
135
136 return lopt;
137}
138
139static inline void __reqsk_queue_destroy(struct request_sock_queue *queue)
140{
141 kfree(reqsk_queue_yank_listen_sk(queue));
142}
143
144extern void reqsk_queue_destroy(struct request_sock_queue *queue); 128extern void reqsk_queue_destroy(struct request_sock_queue *queue);
145 129
146static inline struct request_sock * 130static inline struct request_sock *
diff --git a/include/net/sctp/auth.h b/include/net/sctp/auth.h
index 9e8f13b7da5a..5db261a1e85e 100644
--- a/include/net/sctp/auth.h
+++ b/include/net/sctp/auth.h
@@ -103,7 +103,7 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc);
103void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, 103void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc,
104 struct sctp_hmac_algo_param *hmacs); 104 struct sctp_hmac_algo_param *hmacs);
105int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, 105int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc,
106 __u16 hmac_id); 106 __be16 hmac_id);
107int 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);
108int 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);
109void 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/command.h b/include/net/sctp/command.h
index b8733364557f..c1f797673571 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -103,6 +103,7 @@ typedef enum {
103 SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ 103 SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */
104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ 104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */
105 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ 105 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */
106 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
106 SCTP_CMD_LAST 107 SCTP_CMD_LAST
107} sctp_verb_t; 108} sctp_verb_t;
108 109
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index da8354e8e33c..f30b537d6952 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -186,6 +186,8 @@ typedef enum {
186 SCTP_IERROR_AUTH_BAD_HMAC, 186 SCTP_IERROR_AUTH_BAD_HMAC,
187 SCTP_IERROR_AUTH_BAD_KEYID, 187 SCTP_IERROR_AUTH_BAD_KEYID,
188 SCTP_IERROR_PROTO_VIOLATION, 188 SCTP_IERROR_PROTO_VIOLATION,
189 SCTP_IERROR_ERROR,
190 SCTP_IERROR_ABORT,
189} sctp_ierror_t; 191} sctp_ierror_t;
190 192
191 193
@@ -407,6 +409,7 @@ typedef enum {
407 SCTP_RTXR_T3_RTX, 409 SCTP_RTXR_T3_RTX,
408 SCTP_RTXR_FAST_RTX, 410 SCTP_RTXR_FAST_RTX,
409 SCTP_RTXR_PMTUD, 411 SCTP_RTXR_PMTUD,
412 SCTP_RTXR_T1_RTX,
410} sctp_retransmit_reason_t; 413} sctp_retransmit_reason_t;
411 414
412/* Reasons to lower cwnd. */ 415/* Reasons to lower cwnd. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 93eb708609e7..34318a33a94c 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -65,7 +65,6 @@
65 65
66 66
67#ifdef TEST_FRAME 67#ifdef TEST_FRAME
68#undef CONFIG_PROC_FS
69#undef CONFIG_SCTP_DBG_OBJCNT 68#undef CONFIG_SCTP_DBG_OBJCNT
70#undef CONFIG_SYSCTL 69#undef CONFIG_SYSCTL
71#endif /* TEST_FRAME */ 70#endif /* TEST_FRAME */
@@ -267,6 +266,7 @@ enum
267 SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, 266 SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS,
268 SCTP_MIB_DELAY_SACK_EXPIREDS, 267 SCTP_MIB_DELAY_SACK_EXPIREDS,
269 SCTP_MIB_AUTOCLOSE_EXPIREDS, 268 SCTP_MIB_AUTOCLOSE_EXPIREDS,
269 SCTP_MIB_T1_RETRANSMITS,
270 SCTP_MIB_T3_RETRANSMITS, 270 SCTP_MIB_T3_RETRANSMITS,
271 SCTP_MIB_PMTUD_RETRANSMITS, 271 SCTP_MIB_PMTUD_RETRANSMITS,
272 SCTP_MIB_FAST_RETRANSMITS, 272 SCTP_MIB_FAST_RETRANSMITS,
@@ -664,6 +664,9 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag)
664 return (h & (sctp_assoc_hashsize-1)); 664 return (h & (sctp_assoc_hashsize-1));
665} 665}
666 666
667#define sctp_for_each_hentry(epb, node, head) \
668 hlist_for_each_entry(epb, node, head, node)
669
667/* Is a socket of this style? */ 670/* Is a socket of this style? */
668#define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) 671#define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style))
669static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) 672static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index ef892e00c833..eb3113c38a94 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -100,20 +100,19 @@ struct crypto_hash;
100struct sctp_bind_bucket { 100struct sctp_bind_bucket {
101 unsigned short port; 101 unsigned short port;
102 unsigned short fastreuse; 102 unsigned short fastreuse;
103 struct sctp_bind_bucket *next; 103 struct hlist_node node;
104 struct sctp_bind_bucket **pprev;
105 struct hlist_head owner; 104 struct hlist_head owner;
106}; 105};
107 106
108struct sctp_bind_hashbucket { 107struct sctp_bind_hashbucket {
109 spinlock_t lock; 108 spinlock_t lock;
110 struct sctp_bind_bucket *chain; 109 struct hlist_head chain;
111}; 110};
112 111
113/* Used for hashing all associations. */ 112/* Used for hashing all associations. */
114struct sctp_hashbucket { 113struct sctp_hashbucket {
115 rwlock_t lock; 114 rwlock_t lock;
116 struct sctp_ep_common *chain; 115 struct hlist_head chain;
117} __attribute__((__aligned__(8))); 116} __attribute__((__aligned__(8)));
118 117
119 118
@@ -212,6 +211,7 @@ extern struct sctp_globals {
212 211
213 /* Flag to indicate if addip is enabled. */ 212 /* Flag to indicate if addip is enabled. */
214 int addip_enable; 213 int addip_enable;
214 int addip_noauth_enable;
215 215
216 /* Flag to indicate if PR-SCTP is enabled. */ 216 /* Flag to indicate if PR-SCTP is enabled. */
217 int prsctp_enable; 217 int prsctp_enable;
@@ -249,6 +249,7 @@ extern struct sctp_globals {
249#define sctp_local_addr_list (sctp_globals.local_addr_list) 249#define sctp_local_addr_list (sctp_globals.local_addr_list)
250#define sctp_local_addr_lock (sctp_globals.addr_list_lock) 250#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
251#define sctp_addip_enable (sctp_globals.addip_enable) 251#define sctp_addip_enable (sctp_globals.addip_enable)
252#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
252#define sctp_prsctp_enable (sctp_globals.prsctp_enable) 253#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
253#define sctp_auth_enable (sctp_globals.auth_enable) 254#define sctp_auth_enable (sctp_globals.auth_enable)
254 255
@@ -873,10 +874,11 @@ struct sctp_transport {
873 * address list derived from the INIT or INIT ACK chunk, a 874 * address list derived from the INIT or INIT ACK chunk, a
874 * number of data elements needs to be maintained including: 875 * number of data elements needs to be maintained including:
875 */ 876 */
876 __u32 rtt; /* This is the most recent RTT. */
877
878 /* RTO : The current retransmission timeout value. */ 877 /* RTO : The current retransmission timeout value. */
879 unsigned long rto; 878 unsigned long rto;
879 unsigned long last_rto;
880
881 __u32 rtt; /* This is the most recent RTT. */
880 882
881 /* RTTVAR : The current RTT variation. */ 883 /* RTTVAR : The current RTT variation. */
882 __u32 rttvar; 884 __u32 rttvar;
@@ -1184,9 +1186,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest,
1184 int flags); 1186 int flags);
1185int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, 1187int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *,
1186 __u8 use_as_src, gfp_t gfp); 1188 __u8 use_as_src, gfp_t gfp);
1187int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *, 1189int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *);
1188 void fastcall (*rcu_call)(struct rcu_head *,
1189 void (*func)(struct rcu_head *)));
1190int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, 1190int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *,
1191 struct sctp_sock *); 1191 struct sctp_sock *);
1192union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, 1192union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
@@ -1229,8 +1229,7 @@ typedef enum {
1229 1229
1230struct sctp_ep_common { 1230struct sctp_ep_common {
1231 /* Fields to help us manage our entries in the hash tables. */ 1231 /* Fields to help us manage our entries in the hash tables. */
1232 struct sctp_ep_common *next; 1232 struct hlist_node node;
1233 struct sctp_ep_common **pprev;
1234 int hashent; 1233 int hashent;
1235 1234
1236 /* Runtime type information. What kind of endpoint is this? */ 1235 /* Runtime type information. What kind of endpoint is this? */
@@ -1541,7 +1540,6 @@ struct sctp_association {
1541 __u8 asconf_capable; /* Does peer support ADDIP? */ 1540 __u8 asconf_capable; /* Does peer support ADDIP? */
1542 __u8 prsctp_capable; /* Can peer do PR-SCTP? */ 1541 __u8 prsctp_capable; /* Can peer do PR-SCTP? */
1543 __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ 1542 __u8 auth_capable; /* Is peer doing SCTP-AUTH? */
1544 __u8 addip_capable; /* Can peer do ADD-IP */
1545 1543
1546 __u32 adaptation_ind; /* Adaptation Code point. */ 1544 __u32 adaptation_ind; /* Adaptation Code point. */
1547 1545
diff --git a/include/net/sock.h b/include/net/sock.h
index 43fc3fa50d62..67e35c7e230c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -560,6 +560,14 @@ struct proto {
560 void (*unhash)(struct sock *sk); 560 void (*unhash)(struct sock *sk);
561 int (*get_port)(struct sock *sk, unsigned short snum); 561 int (*get_port)(struct sock *sk, unsigned short snum);
562 562
563#ifdef CONFIG_SMP
564 /* Keeping track of sockets in use */
565 void (*inuse_add)(struct proto *prot, int inc);
566 int (*inuse_getval)(const struct proto *prot);
567 int *inuse_ptr;
568#else
569 int inuse;
570#endif
563 /* Memory pressure */ 571 /* Memory pressure */
564 void (*enter_memory_pressure)(void); 572 void (*enter_memory_pressure)(void);
565 atomic_t *memory_allocated; /* Current allocated memory. */ 573 atomic_t *memory_allocated; /* Current allocated memory. */
@@ -592,12 +600,38 @@ struct proto {
592#ifdef SOCK_REFCNT_DEBUG 600#ifdef SOCK_REFCNT_DEBUG
593 atomic_t socks; 601 atomic_t socks;
594#endif 602#endif
595 struct {
596 int inuse;
597 u8 __pad[SMP_CACHE_BYTES - sizeof(int)];
598 } stats[NR_CPUS];
599}; 603};
600 604
605/*
606 * Special macros to let protos use a fast version of inuse{get|add}
607 * using a static percpu variable per proto instead of an allocated one,
608 * saving one dereference.
609 * This might be changed if/when dynamic percpu vars become fast.
610 */
611#ifdef CONFIG_SMP
612# define DEFINE_PROTO_INUSE(NAME) \
613static DEFINE_PER_CPU(int, NAME##_inuse); \
614static void NAME##_inuse_add(struct proto *prot, int inc) \
615{ \
616 __get_cpu_var(NAME##_inuse) += inc; \
617} \
618 \
619static int NAME##_inuse_getval(const struct proto *prot)\
620{ \
621 int res = 0, cpu; \
622 \
623 for_each_possible_cpu(cpu) \
624 res += per_cpu(NAME##_inuse, cpu); \
625 return res; \
626}
627# define REF_PROTO_INUSE(NAME) \
628 .inuse_add = NAME##_inuse_add, \
629 .inuse_getval = NAME##_inuse_getval,
630#else
631# define DEFINE_PROTO_INUSE(NAME)
632# define REF_PROTO_INUSE(NAME)
633#endif
634
601extern int proto_register(struct proto *prot, int alloc_slab); 635extern int proto_register(struct proto *prot, int alloc_slab);
602extern void proto_unregister(struct proto *prot); 636extern void proto_unregister(struct proto *prot);
603 637
@@ -629,12 +663,29 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
629/* Called with local bh disabled */ 663/* Called with local bh disabled */
630static __inline__ void sock_prot_inc_use(struct proto *prot) 664static __inline__ void sock_prot_inc_use(struct proto *prot)
631{ 665{
632 prot->stats[smp_processor_id()].inuse++; 666#ifdef CONFIG_SMP
667 prot->inuse_add(prot, 1);
668#else
669 prot->inuse++;
670#endif
633} 671}
634 672
635static __inline__ void sock_prot_dec_use(struct proto *prot) 673static __inline__ void sock_prot_dec_use(struct proto *prot)
636{ 674{
637 prot->stats[smp_processor_id()].inuse--; 675#ifdef CONFIG_SMP
676 prot->inuse_add(prot, -1);
677#else
678 prot->inuse--;
679#endif
680}
681
682static __inline__ int sock_prot_inuse(struct proto *proto)
683{
684#ifdef CONFIG_SMP
685 return proto->inuse_getval(proto);
686#else
687 return proto->inuse;
688#endif
638} 689}
639 690
640/* With per-bucket locks this operation is not-atomic, so that 691/* With per-bucket locks this operation is not-atomic, so that
@@ -779,7 +830,7 @@ extern void FASTCALL(release_sock(struct sock *sk));
779 830
780extern struct sock *sk_alloc(struct net *net, int family, 831extern struct sock *sk_alloc(struct net *net, int family,
781 gfp_t priority, 832 gfp_t priority,
782 struct proto *prot, int zero_it); 833 struct proto *prot);
783extern void sk_free(struct sock *sk); 834extern void sk_free(struct sock *sk);
784extern struct sock *sk_clone(const struct sock *sk, 835extern struct sock *sk_clone(const struct sock *sk,
785 const gfp_t priority); 836 const gfp_t priority);
@@ -993,20 +1044,6 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
993 write_unlock_bh(&sk->sk_callback_lock); 1044 write_unlock_bh(&sk->sk_callback_lock);
994} 1045}
995 1046
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); 1047extern int sock_i_uid(struct sock *sk);
1011extern unsigned long sock_i_ino(struct sock *sk); 1048extern unsigned long sock_i_ino(struct sock *sk);
1012 1049
@@ -1198,14 +1235,19 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1198 gfp_t gfp) 1235 gfp_t gfp)
1199{ 1236{
1200 struct sk_buff *skb; 1237 struct sk_buff *skb;
1201 int hdr_len;
1202 1238
1203 hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header); 1239 /* The TCP header must be at least 32-bit aligned. */
1204 skb = alloc_skb_fclone(size + hdr_len, gfp); 1240 size = ALIGN(size, 4);
1241
1242 skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp);
1205 if (skb) { 1243 if (skb) {
1206 skb->truesize += mem; 1244 skb->truesize += mem;
1207 if (sk_stream_wmem_schedule(sk, skb->truesize)) { 1245 if (sk_stream_wmem_schedule(sk, skb->truesize)) {
1208 skb_reserve(skb, hdr_len); 1246 /*
1247 * Make sure that we have exactly size bytes
1248 * available to the caller, no more, no less.
1249 */
1250 skb_reserve(skb, skb_tailroom(skb) - size);
1209 return skb; 1251 return skb;
1210 } 1252 }
1211 __kfree_skb(skb); 1253 __kfree_skb(skb);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d695cea7730d..cb5b033e0e59 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1288,6 +1288,9 @@ static inline void tcp_insert_write_queue_before(struct sk_buff *new,
1288 struct sock *sk) 1288 struct sock *sk)
1289{ 1289{
1290 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue); 1290 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue);
1291
1292 if (sk->sk_send_head == skb)
1293 sk->sk_send_head = new;
1291} 1294}
1292 1295
1293static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk) 1296static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h
index c1d1629fcd27..5f388035687d 100644
--- a/include/pcmcia/cs_types.h
+++ b/include/pcmcia/cs_types.h
@@ -21,7 +21,7 @@
21#include <sys/types.h> 21#include <sys/types.h>
22#endif 22#endif
23 23
24#if defined(__arm__) || defined(__mips__) 24#if defined(__arm__) || defined(__mips__) || defined(__avr32__)
25/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */ 25/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
26typedef u_int ioaddr_t; 26typedef u_int ioaddr_t;
27#else 27#else
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 4bea182d7116..11f39606e7d9 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -48,9 +48,9 @@
48#include <linux/kref.h> 48#include <linux/kref.h>
49#include <linux/list.h> 49#include <linux/list.h>
50#include <linux/rwsem.h> 50#include <linux/rwsem.h>
51#include <linux/scatterlist.h>
51 52
52#include <asm/atomic.h> 53#include <asm/atomic.h>
53#include <asm/scatterlist.h>
54#include <asm/uaccess.h> 54#include <asm/uaccess.h>
55 55
56union ib_gid { 56union ib_gid {
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 8dda2d66b5b9..a466c2cb8955 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -36,7 +36,7 @@
36#include <scsi/scsi_device.h> 36#include <scsi/scsi_device.h>
37#include <scsi/scsi_cmnd.h> 37#include <scsi/scsi_cmnd.h>
38#include <scsi/scsi_transport_sas.h> 38#include <scsi/scsi_transport_sas.h>
39#include <asm/scatterlist.h> 39#include <linux/scatterlist.h>
40 40
41struct block_device; 41struct block_device;
42 42
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d5057bc338ff..66e9058357e0 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -46,6 +46,22 @@ enum scsi_device_state {
46 * to the scsi lld. */ 46 * to the scsi lld. */
47}; 47};
48 48
49enum scsi_device_event {
50 SDEV_EVT_MEDIA_CHANGE = 1, /* media has changed */
51
52 SDEV_EVT_LAST = SDEV_EVT_MEDIA_CHANGE,
53 SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1
54};
55
56struct scsi_event {
57 enum scsi_device_event evt_type;
58 struct list_head node;
59
60 /* put union of data structures, for non-simple event types,
61 * here
62 */
63};
64
49struct scsi_device { 65struct scsi_device {
50 struct Scsi_Host *host; 66 struct Scsi_Host *host;
51 struct request_queue *request_queue; 67 struct request_queue *request_queue;
@@ -127,6 +143,10 @@ struct scsi_device {
127 unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ 143 unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */
128 unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ 144 unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */
129 145
146 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
147 struct list_head event_list; /* asserted events */
148 struct work_struct event_work;
149
130 unsigned int device_blocked; /* Device returned QUEUE_FULL. */ 150 unsigned int device_blocked; /* Device returned QUEUE_FULL. */
131 151
132 unsigned int max_device_blocked; /* what device_blocked counts down from */ 152 unsigned int max_device_blocked; /* what device_blocked counts down from */
@@ -275,6 +295,11 @@ extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
275 int retries); 295 int retries);
276extern int scsi_device_set_state(struct scsi_device *sdev, 296extern int scsi_device_set_state(struct scsi_device *sdev,
277 enum scsi_device_state state); 297 enum scsi_device_state state);
298extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
299 gfp_t gfpflags);
300extern void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt);
301extern void sdev_evt_send_simple(struct scsi_device *sdev,
302 enum scsi_device_event evt_type, gfp_t gfpflags);
278extern int scsi_device_quiesce(struct scsi_device *sdev); 303extern int scsi_device_quiesce(struct scsi_device *sdev);
279extern void scsi_device_resume(struct scsi_device *sdev); 304extern void scsi_device_resume(struct scsi_device *sdev);
280extern void scsi_target_quiesce(struct scsi_target *); 305extern void scsi_target_quiesce(struct scsi_target *);
diff --git a/include/sound/version.h b/include/sound/version.h
index a2be8ad8894b..a9781eb0da09 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.15" 2#define CONFIG_SND_VERSION "1.0.15"
3#define CONFIG_SND_DATE " (Tue Oct 23 06:09:18 2007 UTC)" 3#define CONFIG_SND_DATE " (Tue Nov 20 19:16:42 2007 UTC)"
diff --git a/init/Kconfig b/init/Kconfig
index 8b88d0bedcbd..d35e44f4dd6b 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -215,6 +215,18 @@ config USER_NS
215 vservers, to use user namespaces to provide different 215 vservers, to use user namespaces to provide different
216 user info for different servers. If unsure, say N. 216 user info for different servers. If unsure, say N.
217 217
218config PID_NS
219 bool "PID Namespaces (EXPERIMENTAL)"
220 default n
221 depends on EXPERIMENTAL
222 help
223 Suport process id namespaces. This allows having multiple
224 process with the same pid as long as they are in different
225 pid namespaces. This is a building block of containers.
226
227 Unless you want to work with an experimental feature
228 say N here.
229
218config AUDIT 230config AUDIT
219 bool "Auditing support" 231 bool "Auditing support"
220 depends on NET 232 depends on NET
@@ -301,13 +313,6 @@ config CGROUP_NS
301 for instance virtual servers and checkpoint/restart 313 for instance virtual servers and checkpoint/restart
302 jobs. 314 jobs.
303 315
304config CGROUP_CPUACCT
305 bool "Simple CPU accounting cgroup subsystem"
306 depends on CGROUPS
307 help
308 Provides a simple Resource Controller for monitoring the
309 total CPU consumed by the tasks in a cgroup
310
311config CPUSETS 316config CPUSETS
312 bool "Cpuset support" 317 bool "Cpuset support"
313 depends on SMP && CGROUPS 318 depends on SMP && CGROUPS
@@ -433,7 +438,7 @@ menuconfig EMBEDDED
433 438
434config UID16 439config UID16
435 bool "Enable 16-bit UID system calls" if EMBEDDED 440 bool "Enable 16-bit UID system calls" if EMBEDDED
436 depends on ARM || BFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && SPARC32_COMPAT) || UML || (X86_64 && IA32_EMULATION) 441 depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && SPARC32_COMPAT) || UML || (X86_64 && IA32_EMULATION)
437 default y 442 default y
438 help 443 help
439 This enables the legacy 16-bit UID syscall wrappers. 444 This enables the legacy 16-bit UID syscall wrappers.
diff --git a/init/main.c b/init/main.c
index f605a969ea61..80b04b6c5157 100644
--- a/init/main.c
+++ b/init/main.c
@@ -56,6 +56,7 @@
56#include <linux/pid_namespace.h> 56#include <linux/pid_namespace.h>
57#include <linux/device.h> 57#include <linux/device.h>
58#include <linux/kthread.h> 58#include <linux/kthread.h>
59#include <linux/sched.h>
59 60
60#include <asm/io.h> 61#include <asm/io.h>
61#include <asm/bugs.h> 62#include <asm/bugs.h>
@@ -747,11 +748,8 @@ __setup("nosoftlockup", nosoftlockup_setup);
747static void __init do_pre_smp_initcalls(void) 748static void __init do_pre_smp_initcalls(void)
748{ 749{
749 extern int spawn_ksoftirqd(void); 750 extern int spawn_ksoftirqd(void);
750#ifdef CONFIG_SMP
751 extern int migration_init(void);
752 751
753 migration_init(); 752 migration_init();
754#endif
755 spawn_ksoftirqd(); 753 spawn_ksoftirqd();
756 if (!nosoftlockup) 754 if (!nosoftlockup)
757 spawn_softlockup_task(); 755 spawn_softlockup_task();
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index bfa274ba9ed4..1e04cd464af9 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1010,6 +1010,8 @@ asmlinkage long sys_mq_notify(mqd_t mqdes,
1010 return -EINVAL; 1010 return -EINVAL;
1011 } 1011 }
1012 if (notification.sigev_notify == SIGEV_THREAD) { 1012 if (notification.sigev_notify == SIGEV_THREAD) {
1013 long timeo;
1014
1013 /* create the notify skb */ 1015 /* create the notify skb */
1014 nc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL); 1016 nc = alloc_skb(NOTIFY_COOKIE_LEN, GFP_KERNEL);
1015 ret = -ENOMEM; 1017 ret = -ENOMEM;
@@ -1038,8 +1040,8 @@ retry:
1038 goto out; 1040 goto out;
1039 } 1041 }
1040 1042
1041 ret = netlink_attachskb(sock, nc, 0, 1043 timeo = MAX_SCHEDULE_TIMEOUT;
1042 MAX_SCHEDULE_TIMEOUT, NULL); 1044 ret = netlink_attachskb(sock, nc, 0, &timeo, NULL);
1043 if (ret == 1) 1045 if (ret == 1)
1044 goto retry; 1046 goto retry;
1045 if (ret) { 1047 if (ret) {
diff --git a/kernel/Makefile b/kernel/Makefile
index f60afe742599..dfa96956dae0 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -40,7 +40,6 @@ obj-$(CONFIG_COMPAT) += compat.o
40obj-$(CONFIG_CGROUPS) += cgroup.o 40obj-$(CONFIG_CGROUPS) += cgroup.o
41obj-$(CONFIG_CGROUP_DEBUG) += cgroup_debug.o 41obj-$(CONFIG_CGROUP_DEBUG) += cgroup_debug.o
42obj-$(CONFIG_CPUSETS) += cpuset.o 42obj-$(CONFIG_CPUSETS) += cpuset.o
43obj-$(CONFIG_CGROUP_CPUACCT) += cpu_acct.o
44obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o 43obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o
45obj-$(CONFIG_IKCONFIG) += configs.o 44obj-$(CONFIG_IKCONFIG) += configs.o
46obj-$(CONFIG_STOP_MACHINE) += stop_machine.o 45obj-$(CONFIG_STOP_MACHINE) += stop_machine.o
diff --git a/kernel/acct.c b/kernel/acct.c
index fce53d8df8a7..cf19547cc9e4 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -413,7 +413,7 @@ static u32 encode_float(u64 value)
413 * The acct_process() call is the workhorse of the process 413 * The acct_process() call is the workhorse of the process
414 * accounting system. The struct acct is built here and then written 414 * accounting system. The struct acct is built here and then written
415 * into the accounting file. This function should only be called from 415 * into the accounting file. This function should only be called from
416 * do_exit(). 416 * do_exit() or when switching to a different output file.
417 */ 417 */
418 418
419/* 419/*
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 3fe21e19c96e..1a3c23936d43 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * kernel/cgroup.c
3 *
4 * Generic process-grouping system. 2 * Generic process-grouping system.
5 * 3 *
6 * Based originally on the cpuset system, extracted by Paul Menage 4 * Based originally on the cpuset system, extracted by Paul Menage
@@ -2200,7 +2198,8 @@ static void cgroup_init_subsys(struct cgroup_subsys *ss)
2200{ 2198{
2201 struct cgroup_subsys_state *css; 2199 struct cgroup_subsys_state *css;
2202 struct list_head *l; 2200 struct list_head *l;
2203 printk(KERN_ERR "Initializing cgroup subsys %s\n", ss->name); 2201
2202 printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name);
2204 2203
2205 /* Create the top cgroup state for this subsystem */ 2204 /* Create the top cgroup state for this subsystem */
2206 ss->root = &rootnode; 2205 ss->root = &rootnode;
@@ -2273,7 +2272,7 @@ int __init cgroup_init_early(void)
2273 BUG_ON(!ss->create); 2272 BUG_ON(!ss->create);
2274 BUG_ON(!ss->destroy); 2273 BUG_ON(!ss->destroy);
2275 if (ss->subsys_id != i) { 2274 if (ss->subsys_id != i) {
2276 printk(KERN_ERR "Subsys %s id == %d\n", 2275 printk(KERN_ERR "cgroup: Subsys %s id == %d\n",
2277 ss->name, ss->subsys_id); 2276 ss->name, ss->subsys_id);
2278 BUG(); 2277 BUG();
2279 } 2278 }
@@ -2605,7 +2604,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2605 dentry = lookup_one_len(nodename, parent->dentry, strlen(nodename)); 2604 dentry = lookup_one_len(nodename, parent->dentry, strlen(nodename));
2606 if (IS_ERR(dentry)) { 2605 if (IS_ERR(dentry)) {
2607 printk(KERN_INFO 2606 printk(KERN_INFO
2608 "Couldn't allocate dentry for %s: %ld\n", nodename, 2607 "cgroup: Couldn't allocate dentry for %s: %ld\n", nodename,
2609 PTR_ERR(dentry)); 2608 PTR_ERR(dentry));
2610 ret = PTR_ERR(dentry); 2609 ret = PTR_ERR(dentry);
2611 goto out_release; 2610 goto out_release;
diff --git a/kernel/cpu_acct.c b/kernel/cpu_acct.c
deleted file mode 100644
index 731e47e7f164..000000000000
--- a/kernel/cpu_acct.c
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2 * kernel/cpu_acct.c - CPU accounting cgroup subsystem
3 *
4 * Copyright (C) Google Inc, 2006
5 *
6 * Developed by Paul Menage (menage@google.com) and Balbir Singh
7 * (balbir@in.ibm.com)
8 *
9 */
10
11/*
12 * Example cgroup subsystem for reporting total CPU usage of tasks in a
13 * cgroup, along with percentage load over a time interval
14 */
15
16#include <linux/module.h>
17#include <linux/cgroup.h>
18#include <linux/fs.h>
19#include <linux/rcupdate.h>
20
21#include <asm/div64.h>
22
23struct cpuacct {
24 struct cgroup_subsys_state css;
25 spinlock_t lock;
26 /* total time used by this class */
27 cputime64_t time;
28
29 /* time when next load calculation occurs */
30 u64 next_interval_check;
31
32 /* time used in current period */
33 cputime64_t current_interval_time;
34
35 /* time used in last period */
36 cputime64_t last_interval_time;
37};
38
39struct cgroup_subsys cpuacct_subsys;
40
41static inline struct cpuacct *cgroup_ca(struct cgroup *cont)
42{
43 return container_of(cgroup_subsys_state(cont, cpuacct_subsys_id),
44 struct cpuacct, css);
45}
46
47static inline struct cpuacct *task_ca(struct task_struct *task)
48{
49 return container_of(task_subsys_state(task, cpuacct_subsys_id),
50 struct cpuacct, css);
51}
52
53#define INTERVAL (HZ * 10)
54
55static inline u64 next_interval_boundary(u64 now)
56{
57 /* calculate the next interval boundary beyond the
58 * current time */
59 do_div(now, INTERVAL);
60 return (now + 1) * INTERVAL;
61}
62
63static struct cgroup_subsys_state *cpuacct_create(
64 struct cgroup_subsys *ss, struct cgroup *cont)
65{
66 struct cpuacct *ca = kzalloc(sizeof(*ca), GFP_KERNEL);
67
68 if (!ca)
69 return ERR_PTR(-ENOMEM);
70 spin_lock_init(&ca->lock);
71 ca->next_interval_check = next_interval_boundary(get_jiffies_64());
72 return &ca->css;
73}
74
75static void cpuacct_destroy(struct cgroup_subsys *ss,
76 struct cgroup *cont)
77{
78 kfree(cgroup_ca(cont));
79}
80
81/* Lazily update the load calculation if necessary. Called with ca locked */
82static void cpuusage_update(struct cpuacct *ca)
83{
84 u64 now = get_jiffies_64();
85
86 /* If we're not due for an update, return */
87 if (ca->next_interval_check > now)
88 return;
89
90 if (ca->next_interval_check <= (now - INTERVAL)) {
91 /* If it's been more than an interval since the last
92 * check, then catch up - the last interval must have
93 * been zero load */
94 ca->last_interval_time = 0;
95 ca->next_interval_check = next_interval_boundary(now);
96 } else {
97 /* If a steal takes the last interval time negative,
98 * then we just ignore it */
99 if ((s64)ca->current_interval_time > 0)
100 ca->last_interval_time = ca->current_interval_time;
101 else
102 ca->last_interval_time = 0;
103 ca->next_interval_check += INTERVAL;
104 }
105 ca->current_interval_time = 0;
106}
107
108static u64 cpuusage_read(struct cgroup *cont, struct cftype *cft)
109{
110 struct cpuacct *ca = cgroup_ca(cont);
111 u64 time;
112
113 spin_lock_irq(&ca->lock);
114 cpuusage_update(ca);
115 time = cputime64_to_jiffies64(ca->time);
116 spin_unlock_irq(&ca->lock);
117
118 /* Convert 64-bit jiffies to seconds */
119 time *= 1000;
120 do_div(time, HZ);
121 return time;
122}
123
124static u64 load_read(struct cgroup *cont, struct cftype *cft)
125{
126 struct cpuacct *ca = cgroup_ca(cont);
127 u64 time;
128
129 /* Find the time used in the previous interval */
130 spin_lock_irq(&ca->lock);
131 cpuusage_update(ca);
132 time = cputime64_to_jiffies64(ca->last_interval_time);
133 spin_unlock_irq(&ca->lock);
134
135 /* Convert time to a percentage, to give the load in the
136 * previous period */
137 time *= 100;
138 do_div(time, INTERVAL);
139
140 return time;
141}
142
143static struct cftype files[] = {
144 {
145 .name = "usage",
146 .read_uint = cpuusage_read,
147 },
148 {
149 .name = "load",
150 .read_uint = load_read,
151 }
152};
153
154static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cont)
155{
156 return cgroup_add_files(cont, ss, files, ARRAY_SIZE(files));
157}
158
159void cpuacct_charge(struct task_struct *task, cputime_t cputime)
160{
161
162 struct cpuacct *ca;
163 unsigned long flags;
164
165 if (!cpuacct_subsys.active)
166 return;
167 rcu_read_lock();
168 ca = task_ca(task);
169 if (ca) {
170 spin_lock_irqsave(&ca->lock, flags);
171 cpuusage_update(ca);
172 ca->time = cputime64_add(ca->time, cputime);
173 ca->current_interval_time =
174 cputime64_add(ca->current_interval_time, cputime);
175 spin_unlock_irqrestore(&ca->lock, flags);
176 }
177 rcu_read_unlock();
178}
179
180struct cgroup_subsys cpuacct_subsys = {
181 .name = "cpuacct",
182 .create = cpuacct_create,
183 .destroy = cpuacct_destroy,
184 .populate = cpuacct_populate,
185 .subsys_id = cpuacct_subsys_id,
186};
diff --git a/kernel/exit.c b/kernel/exit.c
index f1aec27f1df0..cd0f1d4137a7 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1386,8 +1386,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1386 int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED; 1386 int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED;
1387 1387
1388 exit_code = p->exit_code; 1388 exit_code = p->exit_code;
1389 if (unlikely(!exit_code) || 1389 if (unlikely(!exit_code) || unlikely(p->exit_state))
1390 unlikely(p->state & TASK_TRACED))
1391 goto bail_ref; 1390 goto bail_ref;
1392 return wait_noreap_copyout(p, pid, uid, 1391 return wait_noreap_copyout(p, pid, uid,
1393 why, (exit_code << 8) | 0x7f, 1392 why, (exit_code << 8) | 0x7f,
diff --git a/kernel/fork.c b/kernel/fork.c
index ddafdfac9456..8ca1a14cdc8c 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 */
@@ -1121,6 +1123,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1121 p->blocked_on = NULL; /* not blocked yet */ 1123 p->blocked_on = NULL; /* not blocked yet */
1122#endif 1124#endif
1123 1125
1126 /* Perform scheduler related setup. Assign this task to a CPU. */
1127 sched_fork(p, clone_flags);
1128
1124 if ((retval = security_task_alloc(p))) 1129 if ((retval = security_task_alloc(p)))
1125 goto bad_fork_cleanup_policy; 1130 goto bad_fork_cleanup_policy;
1126 if ((retval = audit_alloc(p))) 1131 if ((retval = audit_alloc(p)))
@@ -1210,9 +1215,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1210 INIT_LIST_HEAD(&p->ptrace_children); 1215 INIT_LIST_HEAD(&p->ptrace_children);
1211 INIT_LIST_HEAD(&p->ptrace_list); 1216 INIT_LIST_HEAD(&p->ptrace_list);
1212 1217
1213 /* Perform scheduler related setup. Assign this task to a CPU. */
1214 sched_fork(p, clone_flags);
1215
1216 /* Now that the task is set up, run cgroup callbacks if 1218 /* Now that the task is set up, run cgroup callbacks if
1217 * necessary. We need to run them before the task is visible 1219 * necessary. We need to run them before the task is visible
1218 * on the tasklist. */ 1220 * on the tasklist. */
diff --git a/kernel/futex.c b/kernel/futex.c
index 32710451dc20..9dc591ab681a 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -181,8 +181,8 @@ static inline int match_futex(union futex_key *key1, union futex_key *key2)
181 * For other futexes, it points to &current->mm->mmap_sem and 181 * For other futexes, it points to &current->mm->mmap_sem and
182 * caller must have taken the reader lock. but NOT any spinlocks. 182 * caller must have taken the reader lock. but NOT any spinlocks.
183 */ 183 */
184int get_futex_key(u32 __user *uaddr, struct rw_semaphore *fshared, 184static int get_futex_key(u32 __user *uaddr, struct rw_semaphore *fshared,
185 union futex_key *key) 185 union futex_key *key)
186{ 186{
187 unsigned long address = (unsigned long)uaddr; 187 unsigned long address = (unsigned long)uaddr;
188 struct mm_struct *mm = current->mm; 188 struct mm_struct *mm = current->mm;
@@ -268,14 +268,13 @@ int get_futex_key(u32 __user *uaddr, struct rw_semaphore *fshared,
268 } 268 }
269 return err; 269 return err;
270} 270}
271EXPORT_SYMBOL_GPL(get_futex_key);
272 271
273/* 272/*
274 * Take a reference to the resource addressed by a key. 273 * Take a reference to the resource addressed by a key.
275 * Can be called while holding spinlocks. 274 * Can be called while holding spinlocks.
276 * 275 *
277 */ 276 */
278inline void get_futex_key_refs(union futex_key *key) 277static void get_futex_key_refs(union futex_key *key)
279{ 278{
280 if (key->both.ptr == 0) 279 if (key->both.ptr == 0)
281 return; 280 return;
@@ -288,13 +287,12 @@ inline void get_futex_key_refs(union futex_key *key)
288 break; 287 break;
289 } 288 }
290} 289}
291EXPORT_SYMBOL_GPL(get_futex_key_refs);
292 290
293/* 291/*
294 * Drop a reference to the resource addressed by a key. 292 * Drop a reference to the resource addressed by a key.
295 * The hash bucket spinlock must not be held. 293 * The hash bucket spinlock must not be held.
296 */ 294 */
297void drop_futex_key_refs(union futex_key *key) 295static void drop_futex_key_refs(union futex_key *key)
298{ 296{
299 if (!key->both.ptr) 297 if (!key->both.ptr)
300 return; 298 return;
@@ -307,7 +305,6 @@ void drop_futex_key_refs(union futex_key *key)
307 break; 305 break;
308 } 306 }
309} 307}
310EXPORT_SYMBOL_GPL(drop_futex_key_refs);
311 308
312static u32 cmpxchg_futex_value_locked(u32 __user *uaddr, u32 uval, u32 newval) 309static u32 cmpxchg_futex_value_locked(u32 __user *uaddr, u32 uval, u32 newval)
313{ 310{
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 00b572666cc7..0a43def6fee7 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -30,6 +30,15 @@ fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry,
30 return 0; 30 return 0;
31} 31}
32 32
33static void __user *futex_uaddr(struct robust_list *entry,
34 compat_long_t futex_offset)
35{
36 compat_uptr_t base = ptr_to_compat(entry);
37 void __user *uaddr = compat_ptr(base + futex_offset);
38
39 return uaddr;
40}
41
33/* 42/*
34 * Walk curr->robust_list (very carefully, it's a userspace list!) 43 * Walk curr->robust_list (very carefully, it's a userspace list!)
35 * and mark any locks found there dead, and notify any waiters. 44 * and mark any locks found there dead, and notify any waiters.
@@ -76,11 +85,12 @@ void compat_exit_robust_list(struct task_struct *curr)
76 * A pending lock might already be on the list, so 85 * A pending lock might already be on the list, so
77 * dont process it twice: 86 * dont process it twice:
78 */ 87 */
79 if (entry != pending) 88 if (entry != pending) {
80 if (handle_futex_death((void __user *)entry + futex_offset, 89 void __user *uaddr = futex_uaddr(entry, futex_offset);
81 curr, pi))
82 return;
83 90
91 if (handle_futex_death(uaddr, curr, pi))
92 return;
93 }
84 if (rc) 94 if (rc)
85 return; 95 return;
86 uentry = next_uentry; 96 uentry = next_uentry;
@@ -94,9 +104,11 @@ void compat_exit_robust_list(struct task_struct *curr)
94 104
95 cond_resched(); 105 cond_resched();
96 } 106 }
97 if (pending) 107 if (pending) {
98 handle_futex_death((void __user *)pending + futex_offset, 108 void __user *uaddr = futex_uaddr(pending, futex_offset);
99 curr, pip); 109
110 handle_futex_death(uaddr, curr, pip);
111 }
100} 112}
101 113
102asmlinkage long 114asmlinkage long
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/irq/handle.c b/kernel/irq/handle.c
index e391cbb1f566..dc335ad27525 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -178,9 +178,11 @@ fastcall unsigned int __do_IRQ(unsigned int irq)
178 */ 178 */
179 if (desc->chip->ack) 179 if (desc->chip->ack)
180 desc->chip->ack(irq); 180 desc->chip->ack(irq);
181 action_ret = handle_IRQ_event(irq, desc->action); 181 if (likely(!(desc->status & IRQ_DISABLED))) {
182 if (!noirqdebug) 182 action_ret = handle_IRQ_event(irq, desc->action);
183 note_interrupt(irq, desc, action_ret); 183 if (!noirqdebug)
184 note_interrupt(irq, desc, action_ret);
185 }
184 desc->chip->end(irq); 186 desc->chip->end(irq);
185 return 1; 187 return 1;
186 } 188 }
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 55fe0c7cd95f..ed38bbfc48a3 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2424,7 +2424,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
2424 return 0; 2424 return 0;
2425 2425
2426 /* 2426 /*
2427 * Calculate the chain hash: it's the combined has of all the 2427 * Calculate the chain hash: it's the combined hash of all the
2428 * lock keys along the dependency chain. We save the hash value 2428 * lock keys along the dependency chain. We save the hash value
2429 * at every step so that we can get the current hash easily 2429 * at every step so that we can get the current hash easily
2430 * after unlock. The chain hash is then used to cache dependency 2430 * after unlock. The chain hash is then used to cache dependency
diff --git a/kernel/marker.c b/kernel/marker.c
index ccb48d9a3657..5323cfaedbce 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -28,7 +28,7 @@ extern struct marker __start___markers[];
28extern struct marker __stop___markers[]; 28extern struct marker __stop___markers[];
29 29
30/* 30/*
31 * module_mutex nests inside markers_mutex. Markers mutex protects the builtin 31 * markers_mutex nests inside module_mutex. Markers mutex protects the builtin
32 * and module markers, the hash table and deferred_sync. 32 * and module markers, the hash table and deferred_sync.
33 */ 33 */
34static DEFINE_MUTEX(markers_mutex); 34static DEFINE_MUTEX(markers_mutex);
@@ -257,7 +257,6 @@ static void disable_marker(struct marker *elem)
257 * @refcount: number of references left to the given probe_module (out) 257 * @refcount: number of references left to the given probe_module (out)
258 * 258 *
259 * Updates the probe callback corresponding to a range of markers. 259 * Updates the probe callback corresponding to a range of markers.
260 * Must be called with markers_mutex held.
261 */ 260 */
262void marker_update_probe_range(struct marker *begin, 261void marker_update_probe_range(struct marker *begin,
263 struct marker *end, struct module *probe_module, 262 struct marker *end, struct module *probe_module,
@@ -266,6 +265,7 @@ void marker_update_probe_range(struct marker *begin,
266 struct marker *iter; 265 struct marker *iter;
267 struct marker_entry *mark_entry; 266 struct marker_entry *mark_entry;
268 267
268 mutex_lock(&markers_mutex);
269 for (iter = begin; iter < end; iter++) { 269 for (iter = begin; iter < end; iter++) {
270 mark_entry = get_marker(iter->name); 270 mark_entry = get_marker(iter->name);
271 if (mark_entry && mark_entry->refcount) { 271 if (mark_entry && mark_entry->refcount) {
@@ -281,6 +281,7 @@ void marker_update_probe_range(struct marker *begin,
281 disable_marker(iter); 281 disable_marker(iter);
282 } 282 }
283 } 283 }
284 mutex_unlock(&markers_mutex);
284} 285}
285 286
286/* 287/*
@@ -293,7 +294,6 @@ static void marker_update_probes(struct module *probe_module)
293{ 294{
294 int refcount = 0; 295 int refcount = 0;
295 296
296 mutex_lock(&markers_mutex);
297 /* Core kernel markers */ 297 /* Core kernel markers */
298 marker_update_probe_range(__start___markers, 298 marker_update_probe_range(__start___markers,
299 __stop___markers, probe_module, &refcount); 299 __stop___markers, probe_module, &refcount);
@@ -303,7 +303,6 @@ static void marker_update_probes(struct module *probe_module)
303 synchronize_sched(); 303 synchronize_sched();
304 deferred_sync = 0; 304 deferred_sync = 0;
305 } 305 }
306 mutex_unlock(&markers_mutex);
307} 306}
308 307
309/** 308/**
@@ -320,7 +319,7 @@ int marker_probe_register(const char *name, const char *format,
320 marker_probe_func *probe, void *private) 319 marker_probe_func *probe, void *private)
321{ 320{
322 struct marker_entry *entry; 321 struct marker_entry *entry;
323 int ret = 0, need_update = 0; 322 int ret = 0;
324 323
325 mutex_lock(&markers_mutex); 324 mutex_lock(&markers_mutex);
326 entry = get_marker(name); 325 entry = get_marker(name);
@@ -335,11 +334,11 @@ int marker_probe_register(const char *name, const char *format,
335 ret = add_marker(name, format, probe, private); 334 ret = add_marker(name, format, probe, private);
336 if (ret) 335 if (ret)
337 goto end; 336 goto end;
338 need_update = 1; 337 mutex_unlock(&markers_mutex);
338 marker_update_probes(NULL);
339 return ret;
339end: 340end:
340 mutex_unlock(&markers_mutex); 341 mutex_unlock(&markers_mutex);
341 if (need_update)
342 marker_update_probes(NULL);
343 return ret; 342 return ret;
344} 343}
345EXPORT_SYMBOL_GPL(marker_probe_register); 344EXPORT_SYMBOL_GPL(marker_probe_register);
@@ -355,7 +354,6 @@ void *marker_probe_unregister(const char *name)
355 struct module *probe_module; 354 struct module *probe_module;
356 struct marker_entry *entry; 355 struct marker_entry *entry;
357 void *private; 356 void *private;
358 int need_update = 0;
359 357
360 mutex_lock(&markers_mutex); 358 mutex_lock(&markers_mutex);
361 entry = get_marker(name); 359 entry = get_marker(name);
@@ -368,11 +366,11 @@ void *marker_probe_unregister(const char *name)
368 probe_module = __module_text_address((unsigned long)entry->probe); 366 probe_module = __module_text_address((unsigned long)entry->probe);
369 private = remove_marker(name); 367 private = remove_marker(name);
370 deferred_sync = 1; 368 deferred_sync = 1;
371 need_update = 1; 369 mutex_unlock(&markers_mutex);
370 marker_update_probes(probe_module);
371 return private;
372end: 372end:
373 mutex_unlock(&markers_mutex); 373 mutex_unlock(&markers_mutex);
374 if (need_update)
375 marker_update_probes(probe_module);
376 return private; 374 return private;
377} 375}
378EXPORT_SYMBOL_GPL(marker_probe_unregister); 376EXPORT_SYMBOL_GPL(marker_probe_unregister);
@@ -392,7 +390,6 @@ void *marker_probe_unregister_private_data(void *private)
392 struct marker_entry *entry; 390 struct marker_entry *entry;
393 int found = 0; 391 int found = 0;
394 unsigned int i; 392 unsigned int i;
395 int need_update = 0;
396 393
397 mutex_lock(&markers_mutex); 394 mutex_lock(&markers_mutex);
398 for (i = 0; i < MARKER_TABLE_SIZE; i++) { 395 for (i = 0; i < MARKER_TABLE_SIZE; i++) {
@@ -414,11 +411,11 @@ iter_end:
414 probe_module = __module_text_address((unsigned long)entry->probe); 411 probe_module = __module_text_address((unsigned long)entry->probe);
415 private = remove_marker(entry->name); 412 private = remove_marker(entry->name);
416 deferred_sync = 1; 413 deferred_sync = 1;
417 need_update = 1; 414 mutex_unlock(&markers_mutex);
415 marker_update_probes(probe_module);
416 return private;
418end: 417end:
419 mutex_unlock(&markers_mutex); 418 mutex_unlock(&markers_mutex);
420 if (need_update)
421 marker_update_probes(probe_module);
422 return private; 419 return private;
423} 420}
424EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data); 421EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data);
@@ -434,7 +431,7 @@ EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data);
434int marker_arm(const char *name) 431int marker_arm(const char *name)
435{ 432{
436 struct marker_entry *entry; 433 struct marker_entry *entry;
437 int ret = 0, need_update = 0; 434 int ret = 0;
438 435
439 mutex_lock(&markers_mutex); 436 mutex_lock(&markers_mutex);
440 entry = get_marker(name); 437 entry = get_marker(name);
@@ -447,11 +444,9 @@ int marker_arm(const char *name)
447 */ 444 */
448 if (entry->refcount++) 445 if (entry->refcount++)
449 goto end; 446 goto end;
450 need_update = 1;
451end: 447end:
452 mutex_unlock(&markers_mutex); 448 mutex_unlock(&markers_mutex);
453 if (need_update) 449 marker_update_probes(NULL);
454 marker_update_probes(NULL);
455 return ret; 450 return ret;
456} 451}
457EXPORT_SYMBOL_GPL(marker_arm); 452EXPORT_SYMBOL_GPL(marker_arm);
@@ -467,7 +462,7 @@ EXPORT_SYMBOL_GPL(marker_arm);
467int marker_disarm(const char *name) 462int marker_disarm(const char *name)
468{ 463{
469 struct marker_entry *entry; 464 struct marker_entry *entry;
470 int ret = 0, need_update = 0; 465 int ret = 0;
471 466
472 mutex_lock(&markers_mutex); 467 mutex_lock(&markers_mutex);
473 entry = get_marker(name); 468 entry = get_marker(name);
@@ -486,11 +481,9 @@ int marker_disarm(const char *name)
486 ret = -EPERM; 481 ret = -EPERM;
487 goto end; 482 goto end;
488 } 483 }
489 need_update = 1;
490end: 484end:
491 mutex_unlock(&markers_mutex); 485 mutex_unlock(&markers_mutex);
492 if (need_update) 486 marker_update_probes(NULL);
493 marker_update_probes(NULL);
494 return ret; 487 return ret;
495} 488}
496EXPORT_SYMBOL_GPL(marker_disarm); 489EXPORT_SYMBOL_GPL(marker_disarm);
diff --git a/kernel/module.c b/kernel/module.c
index 3202c9950073..91fe6958b6e1 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -81,7 +81,8 @@ int unregister_module_notifier(struct notifier_block * nb)
81} 81}
82EXPORT_SYMBOL(unregister_module_notifier); 82EXPORT_SYMBOL(unregister_module_notifier);
83 83
84/* We require a truly strong try_module_get() */ 84/* We require a truly strong try_module_get(): 0 means failure due to
85 ongoing or failed initialization etc. */
85static inline int strong_try_module_get(struct module *mod) 86static inline int strong_try_module_get(struct module *mod)
86{ 87{
87 if (mod && mod->state == MODULE_STATE_COMING) 88 if (mod && mod->state == MODULE_STATE_COMING)
@@ -952,7 +953,8 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
952 ret = __find_symbol(name, &owner, &crc, 953 ret = __find_symbol(name, &owner, &crc,
953 !(mod->taints & TAINT_PROPRIETARY_MODULE)); 954 !(mod->taints & TAINT_PROPRIETARY_MODULE));
954 if (ret) { 955 if (ret) {
955 /* use_module can fail due to OOM, or module unloading */ 956 /* use_module can fail due to OOM,
957 or module initialization or unloading */
956 if (!check_version(sechdrs, versindex, name, mod, crc) || 958 if (!check_version(sechdrs, versindex, name, mod, crc) ||
957 !use_module(mod, owner)) 959 !use_module(mod, owner))
958 ret = 0; 960 ret = 0;
@@ -1369,7 +1371,7 @@ dup:
1369 return ret; 1371 return ret;
1370} 1372}
1371 1373
1372/* Change all symbols so that sh_value encodes the pointer directly. */ 1374/* Change all symbols so that st_value encodes the pointer directly. */
1373static int simplify_symbols(Elf_Shdr *sechdrs, 1375static int simplify_symbols(Elf_Shdr *sechdrs,
1374 unsigned int symindex, 1376 unsigned int symindex,
1375 const char *strtab, 1377 const char *strtab,
diff --git a/kernel/params.c b/kernel/params.c
index 16f269e9ddc9..2a4c51487e72 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -592,19 +592,16 @@ static void __init param_sysfs_builtin(void)
592 592
593 for (i=0; i < __stop___param - __start___param; i++) { 593 for (i=0; i < __stop___param - __start___param; i++) {
594 char *dot; 594 char *dot;
595 size_t kplen; 595 size_t max_name_len;
596 596
597 kp = &__start___param[i]; 597 kp = &__start___param[i];
598 kplen = strlen(kp->name); 598 max_name_len =
599 min_t(size_t, MAX_KBUILD_MODNAME, strlen(kp->name));
599 600
600 /* We do not handle args without periods. */ 601 dot = memchr(kp->name, '.', max_name_len);
601 if (kplen > MAX_KBUILD_MODNAME) {
602 DEBUGP("kernel parameter name is too long: %s\n", kp->name);
603 continue;
604 }
605 dot = memchr(kp->name, '.', kplen);
606 if (!dot) { 602 if (!dot) {
607 DEBUGP("couldn't find period in %s\n", kp->name); 603 DEBUGP("couldn't find period in first %d characters "
604 "of %s\n", MAX_KBUILD_MODNAME, kp->name);
608 continue; 605 continue;
609 } 606 }
610 name_len = dot - kp->name; 607 name_len = dot - kp->name;
diff --git a/kernel/pid.c b/kernel/pid.c
index d1db36b94674..f815455431bf 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -537,6 +537,7 @@ err_alloc:
537 return NULL; 537 return NULL;
538} 538}
539 539
540#ifdef CONFIG_PID_NS
540static struct pid_namespace *create_pid_namespace(int level) 541static struct pid_namespace *create_pid_namespace(int level)
541{ 542{
542 struct pid_namespace *ns; 543 struct pid_namespace *ns;
@@ -621,6 +622,7 @@ void free_pid_ns(struct kref *kref)
621 if (parent != NULL) 622 if (parent != NULL)
622 put_pid_ns(parent); 623 put_pid_ns(parent);
623} 624}
625#endif /* CONFIG_PID_NS */
624 626
625void zap_pid_ns_processes(struct pid_namespace *pid_ns) 627void zap_pid_ns_processes(struct pid_namespace *pid_ns)
626{ 628{
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 8b15f777010a..05b64790fe83 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -456,7 +456,17 @@ static int software_resume(void)
456 int error; 456 int error;
457 unsigned int flags; 457 unsigned int flags;
458 458
459 mutex_lock(&pm_mutex); 459 /*
460 * name_to_dev_t() below takes a sysfs buffer mutex when sysfs
461 * is configured into the kernel. Since the regular hibernate
462 * trigger path is via sysfs which takes a buffer mutex before
463 * calling hibernate functions (which take pm_mutex) this can
464 * cause lockdep to complain about a possible ABBA deadlock
465 * which cannot happen since we're in the boot code here and
466 * sysfs can't be invoked yet. Therefore, we use a subclass
467 * here to avoid lockdep complaining.
468 */
469 mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING);
460 if (!swsusp_resume_device) { 470 if (!swsusp_resume_device) {
461 if (!strlen(resume_file)) { 471 if (!strlen(resume_file)) {
462 mutex_unlock(&pm_mutex); 472 mutex_unlock(&pm_mutex);
diff --git a/kernel/resource.c b/kernel/resource.c
index a358142ff48f..2eb553d9b517 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -277,7 +277,7 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg,
277 int ret = -1; 277 int ret = -1;
278 res.start = (u64) start_pfn << PAGE_SHIFT; 278 res.start = (u64) start_pfn << PAGE_SHIFT;
279 res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1; 279 res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1;
280 res.flags = IORESOURCE_MEM; 280 res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
281 orig_end = res.end; 281 orig_end = res.end;
282 while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) { 282 while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) {
283 pfn = (unsigned long)(res.start >> PAGE_SHIFT); 283 pfn = (unsigned long)(res.start >> PAGE_SHIFT);
diff --git a/kernel/sched.c b/kernel/sched.c
index b4fbbc440453..38933cafea8a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -52,7 +52,6 @@
52#include <linux/cpu.h> 52#include <linux/cpu.h>
53#include <linux/cpuset.h> 53#include <linux/cpuset.h>
54#include <linux/percpu.h> 54#include <linux/percpu.h>
55#include <linux/cpu_acct.h>
56#include <linux/kthread.h> 55#include <linux/kthread.h>
57#include <linux/seq_file.h> 56#include <linux/seq_file.h>
58#include <linux/sysctl.h> 57#include <linux/sysctl.h>
@@ -75,7 +74,7 @@
75 */ 74 */
76unsigned long long __attribute__((weak)) sched_clock(void) 75unsigned long long __attribute__((weak)) sched_clock(void)
77{ 76{
78 return (unsigned long long)jiffies * (1000000000 / HZ); 77 return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ);
79} 78}
80 79
81/* 80/*
@@ -99,8 +98,8 @@ unsigned long long __attribute__((weak)) sched_clock(void)
99/* 98/*
100 * Some helpers for converting nanosecond timing to jiffy resolution 99 * Some helpers for converting nanosecond timing to jiffy resolution
101 */ 100 */
102#define NS_TO_JIFFIES(TIME) ((unsigned long)(TIME) / (1000000000 / HZ)) 101#define NS_TO_JIFFIES(TIME) ((unsigned long)(TIME) / (NSEC_PER_SEC / HZ))
103#define JIFFIES_TO_NS(TIME) ((TIME) * (1000000000 / HZ)) 102#define JIFFIES_TO_NS(TIME) ((TIME) * (NSEC_PER_SEC / HZ))
104 103
105#define NICE_0_LOAD SCHED_LOAD_SCALE 104#define NICE_0_LOAD SCHED_LOAD_SCALE
106#define NICE_0_SHIFT SCHED_LOAD_SHIFT 105#define NICE_0_SHIFT SCHED_LOAD_SHIFT
@@ -172,6 +171,7 @@ struct task_group {
172 unsigned long shares; 171 unsigned long shares;
173 /* spinlock to serialize modification to shares */ 172 /* spinlock to serialize modification to shares */
174 spinlock_t lock; 173 spinlock_t lock;
174 struct rcu_head rcu;
175}; 175};
176 176
177/* Default task group's sched entity on each cpu */ 177/* Default task group's sched entity on each cpu */
@@ -216,15 +216,15 @@ static inline struct task_group *task_group(struct task_struct *p)
216} 216}
217 217
218/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */ 218/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
219static inline void set_task_cfs_rq(struct task_struct *p) 219static inline void set_task_cfs_rq(struct task_struct *p, unsigned int cpu)
220{ 220{
221 p->se.cfs_rq = task_group(p)->cfs_rq[task_cpu(p)]; 221 p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
222 p->se.parent = task_group(p)->se[task_cpu(p)]; 222 p->se.parent = task_group(p)->se[cpu];
223} 223}
224 224
225#else 225#else
226 226
227static inline void set_task_cfs_rq(struct task_struct *p) { } 227static inline void set_task_cfs_rq(struct task_struct *p, unsigned int cpu) { }
228 228
229#endif /* CONFIG_FAIR_GROUP_SCHED */ 229#endif /* CONFIG_FAIR_GROUP_SCHED */
230 230
@@ -258,7 +258,6 @@ struct cfs_rq {
258 */ 258 */
259 struct list_head leaf_cfs_rq_list; /* Better name : task_cfs_rq_list? */ 259 struct list_head leaf_cfs_rq_list; /* Better name : task_cfs_rq_list? */
260 struct task_group *tg; /* group that "owns" this runqueue */ 260 struct task_group *tg; /* group that "owns" this runqueue */
261 struct rcu_head rcu;
262#endif 261#endif
263}; 262};
264 263
@@ -456,24 +455,28 @@ static void update_rq_clock(struct rq *rq)
456 */ 455 */
457enum { 456enum {
458 SCHED_FEAT_NEW_FAIR_SLEEPERS = 1, 457 SCHED_FEAT_NEW_FAIR_SLEEPERS = 1,
459 SCHED_FEAT_START_DEBIT = 2, 458 SCHED_FEAT_WAKEUP_PREEMPT = 2,
460 SCHED_FEAT_TREE_AVG = 4, 459 SCHED_FEAT_START_DEBIT = 4,
461 SCHED_FEAT_APPROX_AVG = 8, 460 SCHED_FEAT_TREE_AVG = 8,
462 SCHED_FEAT_WAKEUP_PREEMPT = 16, 461 SCHED_FEAT_APPROX_AVG = 16,
463 SCHED_FEAT_PREEMPT_RESTRICT = 32,
464}; 462};
465 463
466const_debug unsigned int sysctl_sched_features = 464const_debug unsigned int sysctl_sched_features =
467 SCHED_FEAT_NEW_FAIR_SLEEPERS * 1 | 465 SCHED_FEAT_NEW_FAIR_SLEEPERS * 1 |
466 SCHED_FEAT_WAKEUP_PREEMPT * 1 |
468 SCHED_FEAT_START_DEBIT * 1 | 467 SCHED_FEAT_START_DEBIT * 1 |
469 SCHED_FEAT_TREE_AVG * 0 | 468 SCHED_FEAT_TREE_AVG * 0 |
470 SCHED_FEAT_APPROX_AVG * 0 | 469 SCHED_FEAT_APPROX_AVG * 0;
471 SCHED_FEAT_WAKEUP_PREEMPT * 1 |
472 SCHED_FEAT_PREEMPT_RESTRICT * 1;
473 470
474#define sched_feat(x) (sysctl_sched_features & SCHED_FEAT_##x) 471#define sched_feat(x) (sysctl_sched_features & SCHED_FEAT_##x)
475 472
476/* 473/*
474 * Number of tasks to iterate in a single balance run.
475 * Limited because this is done with IRQs disabled.
476 */
477const_debug unsigned int sysctl_sched_nr_migrate = 32;
478
479/*
477 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu 480 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
478 * clock constructed from sched_clock(): 481 * clock constructed from sched_clock():
479 */ 482 */
@@ -1019,10 +1022,16 @@ unsigned long weighted_cpuload(const int cpu)
1019 1022
1020static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu) 1023static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)
1021{ 1024{
1025 set_task_cfs_rq(p, cpu);
1022#ifdef CONFIG_SMP 1026#ifdef CONFIG_SMP
1027 /*
1028 * After ->cpu is set up to a new value, task_rq_lock(p, ...) can be
1029 * successfuly executed on another CPU. We must ensure that updates of
1030 * per-task data have been completed by this moment.
1031 */
1032 smp_wmb();
1023 task_thread_info(p)->cpu = cpu; 1033 task_thread_info(p)->cpu = cpu;
1024#endif 1034#endif
1025 set_task_cfs_rq(p);
1026} 1035}
1027 1036
1028#ifdef CONFIG_SMP 1037#ifdef CONFIG_SMP
@@ -2237,7 +2246,7 @@ balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
2237 enum cpu_idle_type idle, int *all_pinned, 2246 enum cpu_idle_type idle, int *all_pinned,
2238 int *this_best_prio, struct rq_iterator *iterator) 2247 int *this_best_prio, struct rq_iterator *iterator)
2239{ 2248{
2240 int pulled = 0, pinned = 0, skip_for_load; 2249 int loops = 0, pulled = 0, pinned = 0, skip_for_load;
2241 struct task_struct *p; 2250 struct task_struct *p;
2242 long rem_load_move = max_load_move; 2251 long rem_load_move = max_load_move;
2243 2252
@@ -2251,10 +2260,10 @@ balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
2251 */ 2260 */
2252 p = iterator->start(iterator->arg); 2261 p = iterator->start(iterator->arg);
2253next: 2262next:
2254 if (!p) 2263 if (!p || loops++ > sysctl_sched_nr_migrate)
2255 goto out; 2264 goto out;
2256 /* 2265 /*
2257 * To help distribute high priority tasks accross CPUs we don't 2266 * To help distribute high priority tasks across CPUs we don't
2258 * skip a task if it will be the highest priority task (i.e. smallest 2267 * skip a task if it will be the highest priority task (i.e. smallest
2259 * prio value) on its new queue regardless of its load weight 2268 * prio value) on its new queue regardless of its load weight
2260 */ 2269 */
@@ -2271,8 +2280,7 @@ next:
2271 rem_load_move -= p->se.load.weight; 2280 rem_load_move -= p->se.load.weight;
2272 2281
2273 /* 2282 /*
2274 * We only want to steal up to the prescribed number of tasks 2283 * We only want to steal up to the prescribed amount of weighted load.
2275 * and the prescribed amount of weighted load.
2276 */ 2284 */
2277 if (rem_load_move > 0) { 2285 if (rem_load_move > 0) {
2278 if (p->prio < *this_best_prio) 2286 if (p->prio < *this_best_prio)
@@ -3335,13 +3343,9 @@ void account_user_time(struct task_struct *p, cputime_t cputime)
3335{ 3343{
3336 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; 3344 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
3337 cputime64_t tmp; 3345 cputime64_t tmp;
3338 struct rq *rq = this_rq();
3339 3346
3340 p->utime = cputime_add(p->utime, cputime); 3347 p->utime = cputime_add(p->utime, cputime);
3341 3348
3342 if (p != rq->idle)
3343 cpuacct_charge(p, cputime);
3344
3345 /* Add user time to cpustat. */ 3349 /* Add user time to cpustat. */
3346 tmp = cputime_to_cputime64(cputime); 3350 tmp = cputime_to_cputime64(cputime);
3347 if (TASK_NICE(p) > 0) 3351 if (TASK_NICE(p) > 0)
@@ -3355,7 +3359,7 @@ void account_user_time(struct task_struct *p, cputime_t cputime)
3355 * @p: the process that the cpu time gets accounted to 3359 * @p: the process that the cpu time gets accounted to
3356 * @cputime: the cpu time spent in virtual machine since the last update 3360 * @cputime: the cpu time spent in virtual machine since the last update
3357 */ 3361 */
3358void account_guest_time(struct task_struct *p, cputime_t cputime) 3362static void account_guest_time(struct task_struct *p, cputime_t cputime)
3359{ 3363{
3360 cputime64_t tmp; 3364 cputime64_t tmp;
3361 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; 3365 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
@@ -3392,10 +3396,8 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
3392 struct rq *rq = this_rq(); 3396 struct rq *rq = this_rq();
3393 cputime64_t tmp; 3397 cputime64_t tmp;
3394 3398
3395 if (p->flags & PF_VCPU) { 3399 if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0))
3396 account_guest_time(p, cputime); 3400 return account_guest_time(p, cputime);
3397 return;
3398 }
3399 3401
3400 p->stime = cputime_add(p->stime, cputime); 3402 p->stime = cputime_add(p->stime, cputime);
3401 3403
@@ -3405,10 +3407,9 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
3405 cpustat->irq = cputime64_add(cpustat->irq, tmp); 3407 cpustat->irq = cputime64_add(cpustat->irq, tmp);
3406 else if (softirq_count()) 3408 else if (softirq_count())
3407 cpustat->softirq = cputime64_add(cpustat->softirq, tmp); 3409 cpustat->softirq = cputime64_add(cpustat->softirq, tmp);
3408 else if (p != rq->idle) { 3410 else if (p != rq->idle)
3409 cpustat->system = cputime64_add(cpustat->system, tmp); 3411 cpustat->system = cputime64_add(cpustat->system, tmp);
3410 cpuacct_charge(p, cputime); 3412 else if (atomic_read(&rq->nr_iowait) > 0)
3411 } else if (atomic_read(&rq->nr_iowait) > 0)
3412 cpustat->iowait = cputime64_add(cpustat->iowait, tmp); 3413 cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
3413 else 3414 else
3414 cpustat->idle = cputime64_add(cpustat->idle, tmp); 3415 cpustat->idle = cputime64_add(cpustat->idle, tmp);
@@ -3444,10 +3445,8 @@ void account_steal_time(struct task_struct *p, cputime_t steal)
3444 cpustat->iowait = cputime64_add(cpustat->iowait, tmp); 3445 cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
3445 else 3446 else
3446 cpustat->idle = cputime64_add(cpustat->idle, tmp); 3447 cpustat->idle = cputime64_add(cpustat->idle, tmp);
3447 } else { 3448 } else
3448 cpustat->steal = cputime64_add(cpustat->steal, tmp); 3449 cpustat->steal = cputime64_add(cpustat->steal, tmp);
3449 cpuacct_charge(p, -tmp);
3450 }
3451} 3450}
3452 3451
3453/* 3452/*
@@ -4992,6 +4991,32 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
4992 */ 4991 */
4993cpumask_t nohz_cpu_mask = CPU_MASK_NONE; 4992cpumask_t nohz_cpu_mask = CPU_MASK_NONE;
4994 4993
4994/*
4995 * Increase the granularity value when there are more CPUs,
4996 * because with more CPUs the 'effective latency' as visible
4997 * to users decreases. But the relationship is not linear,
4998 * so pick a second-best guess by going with the log2 of the
4999 * number of CPUs.
5000 *
5001 * This idea comes from the SD scheduler of Con Kolivas:
5002 */
5003static inline void sched_init_granularity(void)
5004{
5005 unsigned int factor = 1 + ilog2(num_online_cpus());
5006 const unsigned long limit = 200000000;
5007
5008 sysctl_sched_min_granularity *= factor;
5009 if (sysctl_sched_min_granularity > limit)
5010 sysctl_sched_min_granularity = limit;
5011
5012 sysctl_sched_latency *= factor;
5013 if (sysctl_sched_latency > limit)
5014 sysctl_sched_latency = limit;
5015
5016 sysctl_sched_wakeup_granularity *= factor;
5017 sysctl_sched_batch_wakeup_granularity *= factor;
5018}
5019
4995#ifdef CONFIG_SMP 5020#ifdef CONFIG_SMP
4996/* 5021/*
4997 * This is how migration works: 5022 * This is how migration works:
@@ -5257,23 +5282,9 @@ static void migrate_live_tasks(int src_cpu)
5257} 5282}
5258 5283
5259/* 5284/*
5260 * activate_idle_task - move idle task to the _front_ of runqueue.
5261 */
5262static void activate_idle_task(struct task_struct *p, struct rq *rq)
5263{
5264 update_rq_clock(rq);
5265
5266 if (p->state == TASK_UNINTERRUPTIBLE)
5267 rq->nr_uninterruptible--;
5268
5269 enqueue_task(rq, p, 0);
5270 inc_nr_running(p, rq);
5271}
5272
5273/*
5274 * Schedules idle task to be the next runnable task on current CPU. 5285 * Schedules idle task to be the next runnable task on current CPU.
5275 * It does so by boosting its priority to highest possible and adding it to 5286 * It does so by boosting its priority to highest possible.
5276 * the _front_ of the runqueue. Used by CPU offline code. 5287 * Used by CPU offline code.
5277 */ 5288 */
5278void sched_idle_next(void) 5289void sched_idle_next(void)
5279{ 5290{
@@ -5293,8 +5304,8 @@ void sched_idle_next(void)
5293 5304
5294 __setscheduler(rq, p, SCHED_FIFO, MAX_RT_PRIO-1); 5305 __setscheduler(rq, p, SCHED_FIFO, MAX_RT_PRIO-1);
5295 5306
5296 /* Add idle task to the _front_ of its priority queue: */ 5307 update_rq_clock(rq);
5297 activate_idle_task(p, rq); 5308 activate_task(rq, p, 0);
5298 5309
5299 spin_unlock_irqrestore(&rq->lock, flags); 5310 spin_unlock_irqrestore(&rq->lock, flags);
5300} 5311}
@@ -5365,7 +5376,7 @@ static struct ctl_table sd_ctl_dir[] = {
5365 .procname = "sched_domain", 5376 .procname = "sched_domain",
5366 .mode = 0555, 5377 .mode = 0555,
5367 }, 5378 },
5368 {0,}, 5379 {0, },
5369}; 5380};
5370 5381
5371static struct ctl_table sd_ctl_root[] = { 5382static struct ctl_table sd_ctl_root[] = {
@@ -5375,7 +5386,7 @@ static struct ctl_table sd_ctl_root[] = {
5375 .mode = 0555, 5386 .mode = 0555,
5376 .child = sd_ctl_dir, 5387 .child = sd_ctl_dir,
5377 }, 5388 },
5378 {0,}, 5389 {0, },
5379}; 5390};
5380 5391
5381static struct ctl_table *sd_alloc_ctl_entry(int n) 5392static struct ctl_table *sd_alloc_ctl_entry(int n)
@@ -5621,7 +5632,7 @@ static struct notifier_block __cpuinitdata migration_notifier = {
5621 .priority = 10 5632 .priority = 10
5622}; 5633};
5623 5634
5624int __init migration_init(void) 5635void __init migration_init(void)
5625{ 5636{
5626 void *cpu = (void *)(long)smp_processor_id(); 5637 void *cpu = (void *)(long)smp_processor_id();
5627 int err; 5638 int err;
@@ -5631,8 +5642,6 @@ int __init migration_init(void)
5631 BUG_ON(err == NOTIFY_BAD); 5642 BUG_ON(err == NOTIFY_BAD);
5632 migration_call(&migration_notifier, CPU_ONLINE, cpu); 5643 migration_call(&migration_notifier, CPU_ONLINE, cpu);
5633 register_cpu_notifier(&migration_notifier); 5644 register_cpu_notifier(&migration_notifier);
5634
5635 return 0;
5636} 5645}
5637#endif 5646#endif
5638 5647
@@ -6688,10 +6697,12 @@ void __init sched_init_smp(void)
6688 /* Move init over to a non-isolated CPU */ 6697 /* Move init over to a non-isolated CPU */
6689 if (set_cpus_allowed(current, non_isolated_cpus) < 0) 6698 if (set_cpus_allowed(current, non_isolated_cpus) < 0)
6690 BUG(); 6699 BUG();
6700 sched_init_granularity();
6691} 6701}
6692#else 6702#else
6693void __init sched_init_smp(void) 6703void __init sched_init_smp(void)
6694{ 6704{
6705 sched_init_granularity();
6695} 6706}
6696#endif /* CONFIG_SMP */ 6707#endif /* CONFIG_SMP */
6697 6708
@@ -7019,8 +7030,8 @@ err:
7019/* rcu callback to free various structures associated with a task group */ 7030/* rcu callback to free various structures associated with a task group */
7020static void free_sched_group(struct rcu_head *rhp) 7031static void free_sched_group(struct rcu_head *rhp)
7021{ 7032{
7022 struct cfs_rq *cfs_rq = container_of(rhp, struct cfs_rq, rcu); 7033 struct task_group *tg = container_of(rhp, struct task_group, rcu);
7023 struct task_group *tg = cfs_rq->tg; 7034 struct cfs_rq *cfs_rq;
7024 struct sched_entity *se; 7035 struct sched_entity *se;
7025 int i; 7036 int i;
7026 7037
@@ -7041,7 +7052,7 @@ static void free_sched_group(struct rcu_head *rhp)
7041/* Destroy runqueue etc associated with a task group */ 7052/* Destroy runqueue etc associated with a task group */
7042void sched_destroy_group(struct task_group *tg) 7053void sched_destroy_group(struct task_group *tg)
7043{ 7054{
7044 struct cfs_rq *cfs_rq; 7055 struct cfs_rq *cfs_rq = NULL;
7045 int i; 7056 int i;
7046 7057
7047 for_each_possible_cpu(i) { 7058 for_each_possible_cpu(i) {
@@ -7049,10 +7060,10 @@ void sched_destroy_group(struct task_group *tg)
7049 list_del_rcu(&cfs_rq->leaf_cfs_rq_list); 7060 list_del_rcu(&cfs_rq->leaf_cfs_rq_list);
7050 } 7061 }
7051 7062
7052 cfs_rq = tg->cfs_rq[0]; 7063 BUG_ON(!cfs_rq);
7053 7064
7054 /* wait for possible concurrent references to cfs_rqs complete */ 7065 /* wait for possible concurrent references to cfs_rqs complete */
7055 call_rcu(&cfs_rq->rcu, free_sched_group); 7066 call_rcu(&tg->rcu, free_sched_group);
7056} 7067}
7057 7068
7058/* change task's runqueue when it moves between groups. 7069/* change task's runqueue when it moves between groups.
@@ -7068,8 +7079,10 @@ void sched_move_task(struct task_struct *tsk)
7068 7079
7069 rq = task_rq_lock(tsk, &flags); 7080 rq = task_rq_lock(tsk, &flags);
7070 7081
7071 if (tsk->sched_class != &fair_sched_class) 7082 if (tsk->sched_class != &fair_sched_class) {
7083 set_task_cfs_rq(tsk, task_cpu(tsk));
7072 goto done; 7084 goto done;
7085 }
7073 7086
7074 update_rq_clock(rq); 7087 update_rq_clock(rq);
7075 7088
@@ -7082,7 +7095,7 @@ void sched_move_task(struct task_struct *tsk)
7082 tsk->sched_class->put_prev_task(rq, tsk); 7095 tsk->sched_class->put_prev_task(rq, tsk);
7083 } 7096 }
7084 7097
7085 set_task_cfs_rq(tsk); 7098 set_task_cfs_rq(tsk, task_cpu(tsk));
7086 7099
7087 if (on_rq) { 7100 if (on_rq) {
7088 if (unlikely(running)) 7101 if (unlikely(running))
@@ -7211,25 +7224,53 @@ static u64 cpu_shares_read_uint(struct cgroup *cgrp, struct cftype *cft)
7211 return (u64) tg->shares; 7224 return (u64) tg->shares;
7212} 7225}
7213 7226
7214static struct cftype cpu_shares = { 7227static u64 cpu_usage_read(struct cgroup *cgrp, struct cftype *cft)
7215 .name = "shares", 7228{
7216 .read_uint = cpu_shares_read_uint, 7229 struct task_group *tg = cgroup_tg(cgrp);
7217 .write_uint = cpu_shares_write_uint, 7230 unsigned long flags;
7231 u64 res = 0;
7232 int i;
7233
7234 for_each_possible_cpu(i) {
7235 /*
7236 * Lock to prevent races with updating 64-bit counters
7237 * on 32-bit arches.
7238 */
7239 spin_lock_irqsave(&cpu_rq(i)->lock, flags);
7240 res += tg->se[i]->sum_exec_runtime;
7241 spin_unlock_irqrestore(&cpu_rq(i)->lock, flags);
7242 }
7243 /* Convert from ns to ms */
7244 do_div(res, NSEC_PER_MSEC);
7245
7246 return res;
7247}
7248
7249static struct cftype cpu_files[] = {
7250 {
7251 .name = "shares",
7252 .read_uint = cpu_shares_read_uint,
7253 .write_uint = cpu_shares_write_uint,
7254 },
7255 {
7256 .name = "usage",
7257 .read_uint = cpu_usage_read,
7258 },
7218}; 7259};
7219 7260
7220static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont) 7261static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont)
7221{ 7262{
7222 return cgroup_add_file(cont, ss, &cpu_shares); 7263 return cgroup_add_files(cont, ss, cpu_files, ARRAY_SIZE(cpu_files));
7223} 7264}
7224 7265
7225struct cgroup_subsys cpu_cgroup_subsys = { 7266struct cgroup_subsys cpu_cgroup_subsys = {
7226 .name = "cpu", 7267 .name = "cpu",
7227 .create = cpu_cgroup_create, 7268 .create = cpu_cgroup_create,
7228 .destroy = cpu_cgroup_destroy, 7269 .destroy = cpu_cgroup_destroy,
7229 .can_attach = cpu_cgroup_can_attach, 7270 .can_attach = cpu_cgroup_can_attach,
7230 .attach = cpu_cgroup_attach, 7271 .attach = cpu_cgroup_attach,
7231 .populate = cpu_cgroup_populate, 7272 .populate = cpu_cgroup_populate,
7232 .subsys_id = cpu_cgroup_subsys_id, 7273 .subsys_id = cpu_cgroup_subsys_id,
7233 .early_init = 1, 7274 .early_init = 1,
7234}; 7275};
7235 7276
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index e6fb392e5164..5d0d623a5465 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -80,6 +80,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
80static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu) 80static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
81{ 81{
82 struct task_struct *g, *p; 82 struct task_struct *g, *p;
83 unsigned long flags;
83 84
84 SEQ_printf(m, 85 SEQ_printf(m,
85 "\nrunnable tasks:\n" 86 "\nrunnable tasks:\n"
@@ -88,7 +89,7 @@ static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
88 "------------------------------------------------------" 89 "------------------------------------------------------"
89 "----------------------------------------------------\n"); 90 "----------------------------------------------------\n");
90 91
91 read_lock_irq(&tasklist_lock); 92 read_lock_irqsave(&tasklist_lock, flags);
92 93
93 do_each_thread(g, p) { 94 do_each_thread(g, p) {
94 if (!p->se.on_rq || task_cpu(p) != rq_cpu) 95 if (!p->se.on_rq || task_cpu(p) != rq_cpu)
@@ -97,7 +98,7 @@ static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
97 print_task(m, rq, p); 98 print_task(m, rq, p);
98 } while_each_thread(g, p); 99 } while_each_thread(g, p);
99 100
100 read_unlock_irq(&tasklist_lock); 101 read_unlock_irqrestore(&tasklist_lock, flags);
101} 102}
102 103
103void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) 104void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
@@ -198,7 +199,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
198 u64 now = ktime_to_ns(ktime_get()); 199 u64 now = ktime_to_ns(ktime_get());
199 int cpu; 200 int cpu;
200 201
201 SEQ_printf(m, "Sched Debug Version: v0.06-v22, %s %.*s\n", 202 SEQ_printf(m, "Sched Debug Version: v0.07, %s %.*s\n",
202 init_utsname()->release, 203 init_utsname()->release,
203 (int)strcspn(init_utsname()->version, " "), 204 (int)strcspn(init_utsname()->version, " "),
204 init_utsname()->version); 205 init_utsname()->version);
@@ -210,7 +211,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
210#define PN(x) \ 211#define PN(x) \
211 SEQ_printf(m, " .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x)) 212 SEQ_printf(m, " .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x))
212 PN(sysctl_sched_latency); 213 PN(sysctl_sched_latency);
213 PN(sysctl_sched_nr_latency); 214 PN(sysctl_sched_min_granularity);
214 PN(sysctl_sched_wakeup_granularity); 215 PN(sysctl_sched_wakeup_granularity);
215 PN(sysctl_sched_batch_wakeup_granularity); 216 PN(sysctl_sched_batch_wakeup_granularity);
216 PN(sysctl_sched_child_runs_first); 217 PN(sysctl_sched_child_runs_first);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 9971831b560e..2f16e15c022c 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -22,7 +22,7 @@
22 22
23/* 23/*
24 * Targeted preemption latency for CPU-bound tasks: 24 * Targeted preemption latency for CPU-bound tasks:
25 * (default: 20ms, units: nanoseconds) 25 * (default: 20ms * (1 + ilog(ncpus)), units: nanoseconds)
26 * 26 *
27 * NOTE: this latency value is not the same as the concept of 27 * NOTE: this latency value is not the same as the concept of
28 * 'timeslice length' - timeslices in CFS are of variable length 28 * 'timeslice length' - timeslices in CFS are of variable length
@@ -32,19 +32,24 @@
32 * (to see the precise effective timeslice length of your workload, 32 * (to see the precise effective timeslice length of your workload,
33 * run vmstat and monitor the context-switches (cs) field) 33 * run vmstat and monitor the context-switches (cs) field)
34 */ 34 */
35const_debug unsigned int sysctl_sched_latency = 20000000ULL; 35unsigned int sysctl_sched_latency = 20000000ULL;
36 36
37/* 37/*
38 * After fork, child runs first. (default) If set to 0 then 38 * Minimal preemption granularity for CPU-bound tasks:
39 * parent will (try to) run first. 39 * (default: 4 msec * (1 + ilog(ncpus)), units: nanoseconds)
40 */ 40 */
41const_debug unsigned int sysctl_sched_child_runs_first = 1; 41unsigned int sysctl_sched_min_granularity = 4000000ULL;
42 42
43/* 43/*
44 * Minimal preemption granularity for CPU-bound tasks: 44 * is kept at sysctl_sched_latency / sysctl_sched_min_granularity
45 * (default: 2 msec, units: nanoseconds) 45 */
46static unsigned int sched_nr_latency = 5;
47
48/*
49 * After fork, child runs first. (default) If set to 0 then
50 * parent will (try to) run first.
46 */ 51 */
47const_debug unsigned int sysctl_sched_nr_latency = 20; 52const_debug unsigned int sysctl_sched_child_runs_first = 1;
48 53
49/* 54/*
50 * sys_sched_yield() compat mode 55 * sys_sched_yield() compat mode
@@ -56,23 +61,23 @@ unsigned int __read_mostly sysctl_sched_compat_yield;
56 61
57/* 62/*
58 * SCHED_BATCH wake-up granularity. 63 * SCHED_BATCH wake-up granularity.
59 * (default: 10 msec, units: nanoseconds) 64 * (default: 10 msec * (1 + ilog(ncpus)), units: nanoseconds)
60 * 65 *
61 * This option delays the preemption effects of decoupled workloads 66 * This option delays the preemption effects of decoupled workloads
62 * and reduces their over-scheduling. Synchronous workloads will still 67 * and reduces their over-scheduling. Synchronous workloads will still
63 * have immediate wakeup/sleep latencies. 68 * have immediate wakeup/sleep latencies.
64 */ 69 */
65const_debug unsigned int sysctl_sched_batch_wakeup_granularity = 10000000UL; 70unsigned int sysctl_sched_batch_wakeup_granularity = 10000000UL;
66 71
67/* 72/*
68 * SCHED_OTHER wake-up granularity. 73 * SCHED_OTHER wake-up granularity.
69 * (default: 10 msec, units: nanoseconds) 74 * (default: 10 msec * (1 + ilog(ncpus)), units: nanoseconds)
70 * 75 *
71 * This option delays the preemption effects of decoupled workloads 76 * This option delays the preemption effects of decoupled workloads
72 * and reduces their over-scheduling. Synchronous workloads will still 77 * and reduces their over-scheduling. Synchronous workloads will still
73 * have immediate wakeup/sleep latencies. 78 * have immediate wakeup/sleep latencies.
74 */ 79 */
75const_debug unsigned int sysctl_sched_wakeup_granularity = 10000000UL; 80unsigned int sysctl_sched_wakeup_granularity = 10000000UL;
76 81
77const_debug unsigned int sysctl_sched_migration_cost = 500000UL; 82const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
78 83
@@ -212,6 +217,22 @@ static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
212 * Scheduling class statistics methods: 217 * Scheduling class statistics methods:
213 */ 218 */
214 219
220#ifdef CONFIG_SCHED_DEBUG
221int sched_nr_latency_handler(struct ctl_table *table, int write,
222 struct file *filp, void __user *buffer, size_t *lenp,
223 loff_t *ppos)
224{
225 int ret = proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos);
226
227 if (ret || !write)
228 return ret;
229
230 sched_nr_latency = DIV_ROUND_UP(sysctl_sched_latency,
231 sysctl_sched_min_granularity);
232
233 return 0;
234}
235#endif
215 236
216/* 237/*
217 * The idea is to set a period in which each task runs once. 238 * The idea is to set a period in which each task runs once.
@@ -224,7 +245,7 @@ static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
224static u64 __sched_period(unsigned long nr_running) 245static u64 __sched_period(unsigned long nr_running)
225{ 246{
226 u64 period = sysctl_sched_latency; 247 u64 period = sysctl_sched_latency;
227 unsigned long nr_latency = sysctl_sched_nr_latency; 248 unsigned long nr_latency = sched_nr_latency;
228 249
229 if (unlikely(nr_running > nr_latency)) { 250 if (unlikely(nr_running > nr_latency)) {
230 period *= nr_running; 251 period *= nr_running;
@@ -259,6 +280,7 @@ static u64 __sched_vslice(unsigned long rq_weight, unsigned long nr_running)
259{ 280{
260 u64 vslice = __sched_period(nr_running); 281 u64 vslice = __sched_period(nr_running);
261 282
283 vslice *= NICE_0_LOAD;
262 do_div(vslice, rq_weight); 284 do_div(vslice, rq_weight);
263 285
264 return vslice; 286 return vslice;
@@ -472,19 +494,26 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
472 } else if (sched_feat(APPROX_AVG) && cfs_rq->nr_running) 494 } else if (sched_feat(APPROX_AVG) && cfs_rq->nr_running)
473 vruntime += sched_vslice(cfs_rq)/2; 495 vruntime += sched_vslice(cfs_rq)/2;
474 496
497 /*
498 * The 'current' period is already promised to the current tasks,
499 * however the extra weight of the new task will slow them down a
500 * little, place the new task so that it fits in the slot that
501 * stays open at the end.
502 */
475 if (initial && sched_feat(START_DEBIT)) 503 if (initial && sched_feat(START_DEBIT))
476 vruntime += sched_vslice_add(cfs_rq, se); 504 vruntime += sched_vslice_add(cfs_rq, se);
477 505
478 if (!initial) { 506 if (!initial) {
507 /* sleeps upto a single latency don't count. */
479 if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se) && 508 if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se) &&
480 task_of(se)->policy != SCHED_BATCH) 509 task_of(se)->policy != SCHED_BATCH)
481 vruntime -= sysctl_sched_latency; 510 vruntime -= sysctl_sched_latency;
482 511
483 vruntime = max_t(s64, vruntime, se->vruntime); 512 /* ensure we never gain time by being placed backwards. */
513 vruntime = max_vruntime(se->vruntime, vruntime);
484 } 514 }
485 515
486 se->vruntime = vruntime; 516 se->vruntime = vruntime;
487
488} 517}
489 518
490static void 519static void
@@ -517,7 +546,6 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
517 546
518 update_stats_dequeue(cfs_rq, se); 547 update_stats_dequeue(cfs_rq, se);
519 if (sleep) { 548 if (sleep) {
520 se->peer_preempt = 0;
521#ifdef CONFIG_SCHEDSTATS 549#ifdef CONFIG_SCHEDSTATS
522 if (entity_is_task(se)) { 550 if (entity_is_task(se)) {
523 struct task_struct *tsk = task_of(se); 551 struct task_struct *tsk = task_of(se);
@@ -545,10 +573,8 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
545 573
546 ideal_runtime = sched_slice(cfs_rq, curr); 574 ideal_runtime = sched_slice(cfs_rq, curr);
547 delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime; 575 delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime;
548 if (delta_exec > ideal_runtime || 576 if (delta_exec > ideal_runtime)
549 (sched_feat(PREEMPT_RESTRICT) && curr->peer_preempt))
550 resched_task(rq_of(cfs_rq)->curr); 577 resched_task(rq_of(cfs_rq)->curr);
551 curr->peer_preempt = 0;
552} 578}
553 579
554static void 580static void
@@ -811,7 +837,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p)
811 struct task_struct *curr = rq->curr; 837 struct task_struct *curr = rq->curr;
812 struct cfs_rq *cfs_rq = task_cfs_rq(curr); 838 struct cfs_rq *cfs_rq = task_cfs_rq(curr);
813 struct sched_entity *se = &curr->se, *pse = &p->se; 839 struct sched_entity *se = &curr->se, *pse = &p->se;
814 s64 delta, gran; 840 unsigned long gran;
815 841
816 if (unlikely(rt_prio(p->prio))) { 842 if (unlikely(rt_prio(p->prio))) {
817 update_rq_clock(rq); 843 update_rq_clock(rq);
@@ -826,24 +852,20 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p)
826 if (unlikely(p->policy == SCHED_BATCH)) 852 if (unlikely(p->policy == SCHED_BATCH))
827 return; 853 return;
828 854
829 if (sched_feat(WAKEUP_PREEMPT)) { 855 if (!sched_feat(WAKEUP_PREEMPT))
830 while (!is_same_group(se, pse)) { 856 return;
831 se = parent_entity(se);
832 pse = parent_entity(pse);
833 }
834 857
835 delta = se->vruntime - pse->vruntime; 858 while (!is_same_group(se, pse)) {
836 gran = sysctl_sched_wakeup_granularity; 859 se = parent_entity(se);
837 if (unlikely(se->load.weight != NICE_0_LOAD)) 860 pse = parent_entity(pse);
838 gran = calc_delta_fair(gran, &se->load); 861 }
839 862
840 if (delta > gran) { 863 gran = sysctl_sched_wakeup_granularity;
841 int now = !sched_feat(PREEMPT_RESTRICT); 864 if (unlikely(se->load.weight != NICE_0_LOAD))
865 gran = calc_delta_fair(gran, &se->load);
842 866
843 if (now || p->prio < curr->prio || !se->peer_preempt++) 867 if (pse->vruntime + gran < se->vruntime)
844 resched_task(curr); 868 resched_task(curr);
845 }
846 }
847} 869}
848 870
849static struct task_struct *pick_next_task_fair(struct rq *rq) 871static struct task_struct *pick_next_task_fair(struct rq *rq)
@@ -1025,7 +1047,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr)
1025 } 1047 }
1026} 1048}
1027 1049
1028#define swap(a,b) do { typeof(a) tmp = (a); (a) = (b); (b) = tmp; } while (0) 1050#define swap(a, b) do { typeof(a) tmp = (a); (a) = (b); (b) = tmp; } while (0)
1029 1051
1030/* 1052/*
1031 * Share the fairness runtime between parent and child, thus the 1053 * Share the fairness runtime between parent and child, thus the
@@ -1045,8 +1067,9 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
1045 update_curr(cfs_rq); 1067 update_curr(cfs_rq);
1046 place_entity(cfs_rq, se, 1); 1068 place_entity(cfs_rq, se, 1);
1047 1069
1070 /* 'curr' will be NULL if the child belongs to a different group */
1048 if (sysctl_sched_child_runs_first && this_cpu == task_cpu(p) && 1071 if (sysctl_sched_child_runs_first && this_cpu == task_cpu(p) &&
1049 curr->vruntime < se->vruntime) { 1072 curr && curr->vruntime < se->vruntime) {
1050 /* 1073 /*
1051 * Upon rescheduling, sched_class::put_prev_task() will place 1074 * Upon rescheduling, sched_class::put_prev_task() will place
1052 * 'current' within the tree based on its new key value. 1075 * 'current' within the tree based on its new key value.
@@ -1054,7 +1077,6 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
1054 swap(curr->vruntime, se->vruntime); 1077 swap(curr->vruntime, se->vruntime);
1055 } 1078 }
1056 1079
1057 se->peer_preempt = 0;
1058 enqueue_task_fair(rq, p, 0); 1080 enqueue_task_fair(rq, p, 0);
1059 resched_task(rq->curr); 1081 resched_task(rq->curr);
1060} 1082}
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index ef1a7df80ea2..630178e53bb6 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -127,7 +127,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)
127# define schedstat_set(var, val) do { } while (0) 127# define schedstat_set(var, val) do { } while (0)
128#endif 128#endif
129 129
130#ifdef CONFIG_SCHEDSTATS 130#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
131/* 131/*
132 * Called when a process is dequeued from the active array and given 132 * Called when a process is dequeued from the active array and given
133 * the cpu. We should note that with the exception of interactive 133 * the cpu. We should note that with the exception of interactive
@@ -155,7 +155,7 @@ static inline void sched_info_dequeued(struct task_struct *t)
155 */ 155 */
156static void sched_info_arrive(struct task_struct *t) 156static void sched_info_arrive(struct task_struct *t)
157{ 157{
158 unsigned long long now = sched_clock(), delta = 0; 158 unsigned long long now = task_rq(t)->clock, delta = 0;
159 159
160 if (t->sched_info.last_queued) 160 if (t->sched_info.last_queued)
161 delta = now - t->sched_info.last_queued; 161 delta = now - t->sched_info.last_queued;
@@ -186,7 +186,7 @@ static inline void sched_info_queued(struct task_struct *t)
186{ 186{
187 if (unlikely(sched_info_on())) 187 if (unlikely(sched_info_on()))
188 if (!t->sched_info.last_queued) 188 if (!t->sched_info.last_queued)
189 t->sched_info.last_queued = sched_clock(); 189 t->sched_info.last_queued = task_rq(t)->clock;
190} 190}
191 191
192/* 192/*
@@ -195,7 +195,8 @@ static inline void sched_info_queued(struct task_struct *t)
195 */ 195 */
196static inline void sched_info_depart(struct task_struct *t) 196static inline void sched_info_depart(struct task_struct *t)
197{ 197{
198 unsigned long long delta = sched_clock() - t->sched_info.last_arrival; 198 unsigned long long delta = task_rq(t)->clock -
199 t->sched_info.last_arrival;
199 200
200 t->sched_info.cpu_time += delta; 201 t->sched_info.cpu_time += delta;
201 rq_sched_info_depart(task_rq(t), delta); 202 rq_sched_info_depart(task_rq(t), delta);
@@ -231,5 +232,5 @@ sched_info_switch(struct task_struct *prev, struct task_struct *next)
231#else 232#else
232#define sched_info_queued(t) do { } while (0) 233#define sched_info_queued(t) do { } while (0)
233#define sched_info_switch(t, next) do { } while (0) 234#define sched_info_switch(t, next) do { } while (0)
234#endif /* CONFIG_SCHEDSTATS */ 235#endif /* CONFIG_SCHEDSTATS || CONFIG_TASK_DELAY_ACCT */
235 236
diff --git a/kernel/signal.c b/kernel/signal.c
index 12006308c7eb..afa4f781f924 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -55,7 +55,7 @@ static int sig_ignored(struct task_struct *t, int sig)
55 * signal handler may change by the time it is 55 * signal handler may change by the time it is
56 * unblocked. 56 * unblocked.
57 */ 57 */
58 if (sigismember(&t->blocked, sig)) 58 if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig))
59 return 0; 59 return 0;
60 60
61 /* Is it explicitly or implicitly ignored? */ 61 /* Is it explicitly or implicitly ignored? */
@@ -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.c b/kernel/sys.c
index 304b5410d746..d1fe71eb4546 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1750,7 +1750,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
1750} 1750}
1751 1751
1752asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, 1752asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep,
1753 struct getcpu_cache __user *cache) 1753 struct getcpu_cache __user *unused)
1754{ 1754{
1755 int err = 0; 1755 int err = 0;
1756 int cpu = raw_smp_processor_id(); 1756 int cpu = raw_smp_processor_id();
@@ -1758,24 +1758,6 @@ asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep,
1758 err |= put_user(cpu, cpup); 1758 err |= put_user(cpu, cpup);
1759 if (nodep) 1759 if (nodep)
1760 err |= put_user(cpu_to_node(cpu), nodep); 1760 err |= put_user(cpu_to_node(cpu), nodep);
1761 if (cache) {
1762 /*
1763 * The cache is not needed for this implementation,
1764 * but make sure user programs pass something
1765 * valid. vsyscall implementations can instead make
1766 * good use of the cache. Only use t0 and t1 because
1767 * these are available in both 32bit and 64bit ABI (no
1768 * need for a compat_getcpu). 32bit has enough
1769 * padding
1770 */
1771 unsigned long t0, t1;
1772 get_user(t0, &cache->blob[0]);
1773 get_user(t1, &cache->blob[1]);
1774 t0++;
1775 t1++;
1776 put_user(t0, &cache->blob[0]);
1777 put_user(t1, &cache->blob[1]);
1778 }
1779 return err ? -EFAULT : 0; 1761 return err ? -EFAULT : 0;
1780} 1762}
1781 1763
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/sysctl.c b/kernel/sysctl.c
index 3b4efbe26445..0deed82a6156 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -226,20 +226,23 @@ static struct ctl_table root_table[] = {
226 226
227#ifdef CONFIG_SCHED_DEBUG 227#ifdef CONFIG_SCHED_DEBUG
228static unsigned long min_sched_granularity_ns = 100000; /* 100 usecs */ 228static unsigned long min_sched_granularity_ns = 100000; /* 100 usecs */
229static unsigned long max_sched_granularity_ns = 1000000000; /* 1 second */ 229static unsigned long max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
230static unsigned long min_wakeup_granularity_ns; /* 0 usecs */ 230static unsigned long min_wakeup_granularity_ns; /* 0 usecs */
231static unsigned long max_wakeup_granularity_ns = 1000000000; /* 1 second */ 231static unsigned long max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
232#endif 232#endif
233 233
234static struct ctl_table kern_table[] = { 234static struct ctl_table kern_table[] = {
235#ifdef CONFIG_SCHED_DEBUG 235#ifdef CONFIG_SCHED_DEBUG
236 { 236 {
237 .ctl_name = CTL_UNNUMBERED, 237 .ctl_name = CTL_UNNUMBERED,
238 .procname = "sched_nr_latency", 238 .procname = "sched_min_granularity_ns",
239 .data = &sysctl_sched_nr_latency, 239 .data = &sysctl_sched_min_granularity,
240 .maxlen = sizeof(unsigned int), 240 .maxlen = sizeof(unsigned int),
241 .mode = 0644, 241 .mode = 0644,
242 .proc_handler = &proc_dointvec, 242 .proc_handler = &sched_nr_latency_handler,
243 .strategy = &sysctl_intvec,
244 .extra1 = &min_sched_granularity_ns,
245 .extra2 = &max_sched_granularity_ns,
243 }, 246 },
244 { 247 {
245 .ctl_name = CTL_UNNUMBERED, 248 .ctl_name = CTL_UNNUMBERED,
@@ -247,7 +250,7 @@ static struct ctl_table kern_table[] = {
247 .data = &sysctl_sched_latency, 250 .data = &sysctl_sched_latency,
248 .maxlen = sizeof(unsigned int), 251 .maxlen = sizeof(unsigned int),
249 .mode = 0644, 252 .mode = 0644,
250 .proc_handler = &proc_dointvec_minmax, 253 .proc_handler = &sched_nr_latency_handler,
251 .strategy = &sysctl_intvec, 254 .strategy = &sysctl_intvec,
252 .extra1 = &min_sched_granularity_ns, 255 .extra1 = &min_sched_granularity_ns,
253 .extra2 = &max_sched_granularity_ns, 256 .extra2 = &max_sched_granularity_ns,
@@ -298,6 +301,14 @@ static struct ctl_table kern_table[] = {
298 .mode = 0644, 301 .mode = 0644,
299 .proc_handler = &proc_dointvec, 302 .proc_handler = &proc_dointvec,
300 }, 303 },
304 {
305 .ctl_name = CTL_UNNUMBERED,
306 .procname = "sched_nr_migrate",
307 .data = &sysctl_sched_nr_migrate,
308 .maxlen = sizeof(unsigned int),
309 .mode = 644,
310 .proc_handler = &proc_dointvec,
311 },
301#endif 312#endif
302 { 313 {
303 .ctl_name = CTL_UNNUMBERED, 314 .ctl_name = CTL_UNNUMBERED,
@@ -2609,6 +2620,10 @@ static int deprecated_sysctl_warning(struct __sysctl_args *args)
2609 int name[CTL_MAXNAME]; 2620 int name[CTL_MAXNAME];
2610 int i; 2621 int i;
2611 2622
2623 /* Check args->nlen. */
2624 if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
2625 return -ENOTDIR;
2626
2612 /* Read in the sysctl name for better debug message logging */ 2627 /* Read in the sysctl name for better debug message logging */
2613 for (i = 0; i < args->nlen; i++) 2628 for (i = 0; i < args->nlen; i++)
2614 if (get_user(name[i], args->name + i)) 2629 if (get_user(name[i], args->name + i))
diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c
index ed6fe51df77a..6972f26c65f7 100644
--- a/kernel/sysctl_check.c
+++ b/kernel/sysctl_check.c
@@ -140,9 +140,6 @@ static struct trans_ctl_table trans_vm_table[] = {
140 { VM_PANIC_ON_OOM, "panic_on_oom" }, 140 { VM_PANIC_ON_OOM, "panic_on_oom" },
141 { VM_VDSO_ENABLED, "vdso_enabled" }, 141 { VM_VDSO_ENABLED, "vdso_enabled" },
142 { VM_MIN_SLAB, "min_slab_ratio" }, 142 { VM_MIN_SLAB, "min_slab_ratio" },
143 { VM_CMM_PAGES, "cmm_pages" },
144 { VM_CMM_TIMED_PAGES, "cmm_timed_pages" },
145 { VM_CMM_TIMEOUT, "cmm_timeout" },
146 143
147 {} 144 {}
148}; 145};
@@ -237,36 +234,6 @@ static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
237 {} 234 {}
238}; 235};
239 236
240
241static struct trans_ctl_table trans_net_ipv4_vs_table[] = {
242 { NET_IPV4_VS_AMEMTHRESH, "amemthresh" },
243 { NET_IPV4_VS_DEBUG_LEVEL, "debug_level" },
244 { NET_IPV4_VS_AMDROPRATE, "am_droprate" },
245 { NET_IPV4_VS_DROP_ENTRY, "drop_entry" },
246 { NET_IPV4_VS_DROP_PACKET, "drop_packet" },
247 { NET_IPV4_VS_SECURE_TCP, "secure_tcp" },
248 { NET_IPV4_VS_TO_ES, "timeout_established" },
249 { NET_IPV4_VS_TO_SS, "timeout_synsent" },
250 { NET_IPV4_VS_TO_SR, "timeout_synrecv" },
251 { NET_IPV4_VS_TO_FW, "timeout_finwait" },
252 { NET_IPV4_VS_TO_TW, "timeout_timewait" },
253 { NET_IPV4_VS_TO_CL, "timeout_close" },
254 { NET_IPV4_VS_TO_CW, "timeout_closewait" },
255 { NET_IPV4_VS_TO_LA, "timeout_lastack" },
256 { NET_IPV4_VS_TO_LI, "timeout_listen" },
257 { NET_IPV4_VS_TO_SA, "timeout_synack" },
258 { NET_IPV4_VS_TO_UDP, "timeout_udp" },
259 { NET_IPV4_VS_TO_ICMP, "timeout_icmp" },
260 { NET_IPV4_VS_CACHE_BYPASS, "cache_bypass" },
261 { NET_IPV4_VS_EXPIRE_NODEST_CONN, "expire_nodest_conn" },
262 { NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE, "expire_quiescent_template" },
263 { NET_IPV4_VS_SYNC_THRESHOLD, "sync_threshold" },
264 { NET_IPV4_VS_NAT_ICMP_SEND, "nat_icmp_send" },
265 { NET_IPV4_VS_LBLC_EXPIRE, "lblc_expiration" },
266 { NET_IPV4_VS_LBLCR_EXPIRE, "lblcr_expiration" },
267 {}
268};
269
270static struct trans_ctl_table trans_net_neigh_vars_table[] = { 237static struct trans_ctl_table trans_net_neigh_vars_table[] = {
271 { NET_NEIGH_MCAST_SOLICIT, "mcast_solicit" }, 238 { NET_NEIGH_MCAST_SOLICIT, "mcast_solicit" },
272 { NET_NEIGH_UCAST_SOLICIT, "ucast_solicit" }, 239 { NET_NEIGH_UCAST_SOLICIT, "ucast_solicit" },
@@ -341,7 +308,6 @@ static struct trans_ctl_table trans_net_ipv4_table[] = {
341 { NET_IPV4_ROUTE, "route", trans_net_ipv4_route_table }, 308 { NET_IPV4_ROUTE, "route", trans_net_ipv4_route_table },
342 /* NET_IPV4_FIB_HASH unused */ 309 /* NET_IPV4_FIB_HASH unused */
343 { NET_IPV4_NETFILTER, "netfilter", trans_net_ipv4_netfilter_table }, 310 { NET_IPV4_NETFILTER, "netfilter", trans_net_ipv4_netfilter_table },
344 { NET_IPV4_VS, "vs", trans_net_ipv4_vs_table },
345 311
346 { NET_IPV4_TCP_TIMESTAMPS, "tcp_timestamps" }, 312 { NET_IPV4_TCP_TIMESTAMPS, "tcp_timestamps" },
347 { NET_IPV4_TCP_WINDOW_SCALING, "tcp_window_scaling" }, 313 { NET_IPV4_TCP_WINDOW_SCALING, "tcp_window_scaling" },
@@ -738,7 +704,7 @@ static struct trans_ctl_table trans_net_table[] = {
738 { NET_ROSE, "rose", trans_net_rose_table }, 704 { NET_ROSE, "rose", trans_net_rose_table },
739 { NET_IPV6, "ipv6", trans_net_ipv6_table }, 705 { NET_IPV6, "ipv6", trans_net_ipv6_table },
740 { NET_X25, "x25", trans_net_x25_table }, 706 { NET_X25, "x25", trans_net_x25_table },
741 { NET_TR, "tr", trans_net_tr_table }, 707 { NET_TR, "token-ring", trans_net_tr_table },
742 { NET_DECNET, "decnet", trans_net_decnet_table }, 708 { NET_DECNET, "decnet", trans_net_decnet_table },
743 /* NET_ECONET not used */ 709 /* NET_ECONET not used */
744 { NET_SCTP, "sctp", trans_net_sctp_table }, 710 { NET_SCTP, "sctp", trans_net_sctp_table },
@@ -1219,16 +1185,6 @@ static struct trans_ctl_table trans_arlan_table[] = {
1219 {} 1185 {}
1220}; 1186};
1221 1187
1222static struct trans_ctl_table trans_appldata_table[] = {
1223 { CTL_APPLDATA_TIMER, "timer" },
1224 { CTL_APPLDATA_INTERVAL, "interval" },
1225 { CTL_APPLDATA_OS, "os" },
1226 { CTL_APPLDATA_NET_SUM, "net_sum" },
1227 { CTL_APPLDATA_MEM, "mem" },
1228 {}
1229
1230};
1231
1232static struct trans_ctl_table trans_s390dbf_table[] = { 1188static struct trans_ctl_table trans_s390dbf_table[] = {
1233 { 5678 /* CTL_S390DBF_STOPPABLE */, "debug_stoppable" }, 1189 { 5678 /* CTL_S390DBF_STOPPABLE */, "debug_stoppable" },
1234 { 5679 /* CTL_S390DBF_ACTIVE */, "debug_active" }, 1190 { 5679 /* CTL_S390DBF_ACTIVE */, "debug_active" },
@@ -1273,7 +1229,6 @@ static struct trans_ctl_table trans_root_table[] = {
1273 { CTL_ABI, "abi" }, 1229 { CTL_ABI, "abi" },
1274 /* CTL_CPU not used */ 1230 /* CTL_CPU not used */
1275 { CTL_ARLAN, "arlan", trans_arlan_table }, 1231 { CTL_ARLAN, "arlan", trans_arlan_table },
1276 { CTL_APPLDATA, "appldata", trans_appldata_table },
1277 { CTL_S390DBF, "s390dbf", trans_s390dbf_table }, 1232 { CTL_S390DBF, "s390dbf", trans_s390dbf_table },
1278 { CTL_SUNRPC, "sunrpc", trans_sunrpc_table }, 1233 { CTL_SUNRPC, "sunrpc", trans_sunrpc_table },
1279 { CTL_PM, "pm", trans_pm_table }, 1234 { CTL_PM, "pm", trans_pm_table },
@@ -1432,6 +1387,7 @@ static void set_fail(const char **fail, struct ctl_table *table, const char *str
1432 printk(KERN_ERR "sysctl table check failed: "); 1387 printk(KERN_ERR "sysctl table check failed: ");
1433 sysctl_print_path(table); 1388 sysctl_print_path(table);
1434 printk(" %s\n", *fail); 1389 printk(" %s\n", *fail);
1390 dump_stack();
1435 } 1391 }
1436 *fail = str; 1392 *fail = str;
1437} 1393}
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 354e74bc17c1..07e86a828073 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -398,31 +398,31 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
398 398
399 fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]); 399 fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]);
400 file = fget_light(fd, &fput_needed); 400 file = fget_light(fd, &fput_needed);
401 if (file) { 401 if (!file)
402 size = nla_total_size(sizeof(struct cgroupstats)); 402 return 0;
403 403
404 rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb, 404 size = nla_total_size(sizeof(struct cgroupstats));
405 size);
406 if (rc < 0)
407 goto err;
408 405
409 na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS, 406 rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb,
410 sizeof(struct cgroupstats)); 407 size);
411 stats = nla_data(na); 408 if (rc < 0)
412 memset(stats, 0, sizeof(*stats)); 409 goto err;
413 410
414 rc = cgroupstats_build(stats, file->f_dentry); 411 na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS,
415 if (rc < 0) 412 sizeof(struct cgroupstats));
416 goto err; 413 stats = nla_data(na);
414 memset(stats, 0, sizeof(*stats));
417 415
418 fput_light(file, fput_needed); 416 rc = cgroupstats_build(stats, file->f_dentry);
419 return send_reply(rep_skb, info->snd_pid); 417 if (rc < 0) {
418 nlmsg_free(rep_skb);
419 goto err;
420 } 420 }
421 421
422 rc = send_reply(rep_skb, info->snd_pid);
423
422err: 424err:
423 if (file) 425 fput_light(file, fput_needed);
424 fput_light(file, fput_needed);
425 nlmsg_free(rep_skb);
426 return rc; 426 return rc;
427} 427}
428 428
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index de6a2d6b3ebb..e64efaf957e8 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -205,7 +205,7 @@ static void sync_cmos_clock(unsigned long dummy)
205 return; 205 return;
206 206
207 getnstimeofday(&now); 207 getnstimeofday(&now);
208 if (abs(xtime.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2) 208 if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2)
209 fail = update_persistent_clock(now); 209 fail = update_persistent_clock(now);
210 210
211 next.tv_nsec = (NSEC_PER_SEC / 2) - now.tv_nsec; 211 next.tv_nsec = (NSEC_PER_SEC / 2) - now.tv_nsec;
@@ -249,10 +249,12 @@ int do_adjtimex(struct timex *txc)
249 249
250 /* Now we validate the data before disabling interrupts */ 250 /* Now we validate the data before disabling interrupts */
251 251
252 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) 252 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) {
253 /* singleshot must not be used with any other mode bits */ 253 /* singleshot must not be used with any other mode bits */
254 if (txc->modes != ADJ_OFFSET_SINGLESHOT) 254 if (txc->modes != ADJ_OFFSET_SINGLESHOT &&
255 txc->modes != ADJ_OFFSET_SS_READ)
255 return -EINVAL; 256 return -EINVAL;
257 }
256 258
257 if (txc->modes != ADJ_OFFSET_SINGLESHOT && (txc->modes & ADJ_OFFSET)) 259 if (txc->modes != ADJ_OFFSET_SINGLESHOT && (txc->modes & ADJ_OFFSET))
258 /* adjustment Offset limited to +- .512 seconds */ 260 /* adjustment Offset limited to +- .512 seconds */
@@ -372,7 +374,8 @@ int do_adjtimex(struct timex *txc)
372leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) 374leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
373 result = TIME_ERROR; 375 result = TIME_ERROR;
374 376
375 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) 377 if ((txc->modes == ADJ_OFFSET_SINGLESHOT) ||
378 (txc->modes == ADJ_OFFSET_SS_READ))
376 txc->offset = save_adjust; 379 txc->offset = save_adjust;
377 else 380 else
378 txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) * 381 txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) *
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 8cfb8b2ce773..aa82d7bf478a 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -508,7 +508,7 @@ static void tick_broadcast_clear_oneshot(int cpu)
508} 508}
509 509
510/** 510/**
511 * tick_broadcast_setup_highres - setup the broadcast device for highres 511 * tick_broadcast_setup_oneshot - setup the broadcast device
512 */ 512 */
513void tick_broadcast_setup_oneshot(struct clock_event_device *bc) 513void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
514{ 514{
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 10a1347597fd..27a2338deb4a 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -320,10 +320,8 @@ 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 * tick_nohz_restart_sched_tick - restart the idle tick from the idle task
327 * 325 *
328 * Restart the idle tick when the CPU is woken up from idle 326 * Restart the idle tick when the CPU is woken up from idle
329 */ 327 */
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/timer.c b/kernel/timer.c
index fb4e67d5dd60..a05817c021d6 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -790,7 +790,7 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now,
790} 790}
791 791
792/** 792/**
793 * next_timer_interrupt - return the jiffy of the next pending timer 793 * get_next_timer_interrupt - return the jiffy of the next pending timer
794 * @now: current time (in jiffies) 794 * @now: current time (in jiffies)
795 */ 795 */
796unsigned long get_next_timer_interrupt(unsigned long now) 796unsigned long get_next_timer_interrupt(unsigned long now)
@@ -817,6 +817,19 @@ unsigned long next_timer_interrupt(void)
817 817
818#endif 818#endif
819 819
820#ifndef CONFIG_VIRT_CPU_ACCOUNTING
821void account_process_tick(struct task_struct *p, int user_tick)
822{
823 if (user_tick) {
824 account_user_time(p, jiffies_to_cputime(1));
825 account_user_time_scaled(p, jiffies_to_cputime(1));
826 } else {
827 account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));
828 account_system_time_scaled(p, jiffies_to_cputime(1));
829 }
830}
831#endif
832
820/* 833/*
821 * Called from the timer interrupt handler to charge one tick to the current 834 * Called from the timer interrupt handler to charge one tick to the current
822 * process. user_tick is 1 if the tick is user time, 0 for system. 835 * process. user_tick is 1 if the tick is user time, 0 for system.
@@ -827,13 +840,7 @@ void update_process_times(int user_tick)
827 int cpu = smp_processor_id(); 840 int cpu = smp_processor_id();
828 841
829 /* Note: this timer irq context must be accounted for as well. */ 842 /* Note: this timer irq context must be accounted for as well. */
830 if (user_tick) { 843 account_process_tick(p, user_tick);
831 account_user_time(p, jiffies_to_cputime(1));
832 account_user_time_scaled(p, jiffies_to_cputime(1));
833 } else {
834 account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));
835 account_system_time_scaled(p, jiffies_to_cputime(1));
836 }
837 run_local_timers(); 844 run_local_timers();
838 if (rcu_pending(cpu)) 845 if (rcu_pending(cpu))
839 rcu_check_callbacks(cpu, user_tick); 846 rcu_check_callbacks(cpu, user_tick);
diff --git a/kernel/user.c b/kernel/user.c
index 0f3aa0234107..8320a87f3e5a 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -337,8 +337,11 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
337 struct user_struct *new; 337 struct user_struct *new;
338 338
339 new = kmem_cache_alloc(uid_cachep, GFP_KERNEL); 339 new = kmem_cache_alloc(uid_cachep, GFP_KERNEL);
340 if (!new) 340 if (!new) {
341 uids_mutex_unlock();
341 return NULL; 342 return NULL;
343 }
344
342 new->uid = uid; 345 new->uid = uid;
343 atomic_set(&new->__count, 1); 346 atomic_set(&new->__count, 1);
344 atomic_set(&new->processes, 0); 347 atomic_set(&new->processes, 0);
@@ -355,6 +358,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
355 358
356 if (alloc_uid_keyring(new, current) < 0) { 359 if (alloc_uid_keyring(new, current) < 0) {
357 kmem_cache_free(uid_cachep, new); 360 kmem_cache_free(uid_cachep, new);
361 uids_mutex_unlock();
358 return NULL; 362 return NULL;
359 } 363 }
360 364
@@ -362,6 +366,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
362 key_put(new->uid_keyring); 366 key_put(new->uid_keyring);
363 key_put(new->session_keyring); 367 key_put(new->session_keyring);
364 kmem_cache_free(uid_cachep, new); 368 kmem_cache_free(uid_cachep, new);
369 uids_mutex_unlock();
365 return NULL; 370 return NULL;
366 } 371 }
367 372
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 1e5f207b9074..a60109307d32 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -359,7 +359,7 @@ config DEBUG_HIGHMEM
359config DEBUG_BUGVERBOSE 359config DEBUG_BUGVERBOSE
360 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED 360 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED
361 depends on BUG 361 depends on BUG
362 depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || FRV || SUPERH || GENERIC_BUG || BFIN 362 depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || FRV || SUPERH || GENERIC_BUG || BLACKFIN
363 default !EMBEDDED 363 default !EMBEDDED
364 help 364 help
365 Say Y here to make BUG() panics output the file name and line number 365 Say Y here to make BUG() panics output the file name and line number
@@ -409,7 +409,7 @@ config DEBUG_SG
409 409
410config FRAME_POINTER 410config FRAME_POINTER
411 bool "Compile the kernel with frame pointers" 411 bool "Compile the kernel with frame pointers"
412 depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390 || AVR32 || SUPERH || BFIN) 412 depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390 || AVR32 || SUPERH || BLACKFIN)
413 default y if DEBUG_INFO && UML 413 default y if DEBUG_INFO && UML
414 help 414 help
415 If you say Y here the resulting kernel image will be slightly larger 415 If you say Y here the resulting kernel image will be slightly larger
diff --git a/lib/Makefile b/lib/Makefile
index 3a0983b77412..b6793ed28d84 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -4,7 +4,7 @@
4 4
5lib-y := ctype.o string.o vsprintf.o cmdline.o \ 5lib-y := ctype.o string.o vsprintf.o cmdline.o \
6 rbtree.o radix-tree.o dump_stack.o \ 6 rbtree.o radix-tree.o dump_stack.o \
7 idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \ 7 idr.o int_sqrt.o extable.o prio_tree.o \
8 sha1.o irq_regs.o reciprocal_div.o argv_split.o \ 8 sha1.o irq_regs.o reciprocal_div.o argv_split.o \
9 proportions.o prio_heap.o 9 proportions.o prio_heap.o
10 10
@@ -14,7 +14,7 @@ lib-$(CONFIG_SMP) += cpumask.o
14lib-y += kobject.o kref.o klist.o 14lib-y += kobject.o kref.o klist.o
15 15
16obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ 16obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
17 bust_spinlocks.o hexdump.o kasprintf.o 17 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o
18 18
19ifeq ($(CONFIG_DEBUG_KOBJECT),y) 19ifeq ($(CONFIG_DEBUG_KOBJECT),y)
20CFLAGS_kobject.o += -DDEBUG 20CFLAGS_kobject.o += -DDEBUG
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 26ebafa8c41d..2c9242e3fed0 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -469,6 +469,10 @@ int bitmap_scnlistprintf(char *buf, unsigned int buflen,
469 /* current bit is 'cur', most recently seen range is [rbot, rtop] */ 469 /* current bit is 'cur', most recently seen range is [rbot, rtop] */
470 int cur, rbot, rtop; 470 int cur, rbot, rtop;
471 471
472 if (buflen == 0)
473 return 0;
474 buf[0] = 0;
475
472 rbot = cur = find_first_bit(maskp, nmaskbits); 476 rbot = cur = find_first_bit(maskp, nmaskbits);
473 while (cur < nmaskbits) { 477 while (cur < nmaskbits) {
474 rtop = cur; 478 rtop = cur;
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/lib/libcrc32c.c b/lib/libcrc32c.c
index 802f11f0bf5b..b5c3287d8ea4 100644
--- a/lib/libcrc32c.c
+++ b/lib/libcrc32c.c
@@ -33,7 +33,6 @@
33#include <linux/crc32c.h> 33#include <linux/crc32c.h>
34#include <linux/compiler.h> 34#include <linux/compiler.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <asm/byteorder.h>
37 36
38MODULE_AUTHOR("Clay Haapala <chaapala@cisco.com>"); 37MODULE_AUTHOR("Clay Haapala <chaapala@cisco.com>");
39MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations"); 38MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations");
@@ -161,15 +160,13 @@ static const u32 crc32c_table[256] = {
161 */ 160 */
162 161
163u32 __pure 162u32 __pure
164crc32c_le(u32 seed, unsigned char const *data, size_t length) 163crc32c_le(u32 crc, unsigned char const *data, size_t length)
165{ 164{
166 u32 crc = __cpu_to_le32(seed);
167
168 while (length--) 165 while (length--)
169 crc = 166 crc =
170 crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8); 167 crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8);
171 168
172 return __le32_to_cpu(crc); 169 return crc;
173} 170}
174 171
175#endif /* CRC_LE_BITS == 8 */ 172#endif /* CRC_LE_BITS == 8 */
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/hugetlb.c b/mm/hugetlb.c
index 8b809ecefa39..6121b57bbe96 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -116,7 +116,9 @@ static void update_and_free_page(struct page *page)
116static void free_huge_page(struct page *page) 116static void free_huge_page(struct page *page)
117{ 117{
118 int nid = page_to_nid(page); 118 int nid = page_to_nid(page);
119 struct address_space *mapping;
119 120
121 mapping = (struct address_space *) page_private(page);
120 BUG_ON(page_count(page)); 122 BUG_ON(page_count(page));
121 INIT_LIST_HEAD(&page->lru); 123 INIT_LIST_HEAD(&page->lru);
122 124
@@ -129,6 +131,9 @@ static void free_huge_page(struct page *page)
129 enqueue_huge_page(page); 131 enqueue_huge_page(page);
130 } 132 }
131 spin_unlock(&hugetlb_lock); 133 spin_unlock(&hugetlb_lock);
134 if (mapping)
135 hugetlb_put_quota(mapping, 1);
136 set_page_private(page, 0);
132} 137}
133 138
134/* 139/*
@@ -323,7 +328,7 @@ free:
323 * allocated to satisfy the reservation must be explicitly freed if they were 328 * allocated to satisfy the reservation must be explicitly freed if they were
324 * never used. 329 * never used.
325 */ 330 */
326void return_unused_surplus_pages(unsigned long unused_resv_pages) 331static void return_unused_surplus_pages(unsigned long unused_resv_pages)
327{ 332{
328 static int nid = -1; 333 static int nid = -1;
329 struct page *page; 334 struct page *page;
@@ -353,35 +358,50 @@ void return_unused_surplus_pages(unsigned long unused_resv_pages)
353 } 358 }
354} 359}
355 360
356static struct page *alloc_huge_page(struct vm_area_struct *vma, 361
357 unsigned long addr) 362static struct page *alloc_huge_page_shared(struct vm_area_struct *vma,
363 unsigned long addr)
358{ 364{
359 struct page *page = NULL; 365 struct page *page;
360 int use_reserved_page = vma->vm_flags & VM_MAYSHARE;
361 366
362 spin_lock(&hugetlb_lock); 367 spin_lock(&hugetlb_lock);
363 if (!use_reserved_page && (free_huge_pages <= resv_huge_pages))
364 goto fail;
365
366 page = dequeue_huge_page(vma, addr); 368 page = dequeue_huge_page(vma, addr);
367 if (!page)
368 goto fail;
369
370 spin_unlock(&hugetlb_lock); 369 spin_unlock(&hugetlb_lock);
371 set_page_refcounted(page); 370 return page ? page : ERR_PTR(-VM_FAULT_OOM);
372 return page; 371}
373 372
374fail: 373static struct page *alloc_huge_page_private(struct vm_area_struct *vma,
375 spin_unlock(&hugetlb_lock); 374 unsigned long addr)
375{
376 struct page *page = NULL;
376 377
377 /* 378 if (hugetlb_get_quota(vma->vm_file->f_mapping, 1))
378 * Private mappings do not use reserved huge pages so the allocation 379 return ERR_PTR(-VM_FAULT_SIGBUS);
379 * may have failed due to an undersized hugetlb pool. Try to grab a 380
380 * surplus huge page from the buddy allocator. 381 spin_lock(&hugetlb_lock);
381 */ 382 if (free_huge_pages > resv_huge_pages)
382 if (!use_reserved_page) 383 page = dequeue_huge_page(vma, addr);
384 spin_unlock(&hugetlb_lock);
385 if (!page)
383 page = alloc_buddy_huge_page(vma, addr); 386 page = alloc_buddy_huge_page(vma, addr);
387 return page ? page : ERR_PTR(-VM_FAULT_OOM);
388}
389
390static struct page *alloc_huge_page(struct vm_area_struct *vma,
391 unsigned long addr)
392{
393 struct page *page;
394 struct address_space *mapping = vma->vm_file->f_mapping;
384 395
396 if (vma->vm_flags & VM_MAYSHARE)
397 page = alloc_huge_page_shared(vma, addr);
398 else
399 page = alloc_huge_page_private(vma, addr);
400
401 if (!IS_ERR(page)) {
402 set_page_refcounted(page);
403 set_page_private(page, (unsigned long) mapping);
404 }
385 return page; 405 return page;
386} 406}
387 407
@@ -726,9 +746,9 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
726 page_cache_get(old_page); 746 page_cache_get(old_page);
727 new_page = alloc_huge_page(vma, address); 747 new_page = alloc_huge_page(vma, address);
728 748
729 if (!new_page) { 749 if (IS_ERR(new_page)) {
730 page_cache_release(old_page); 750 page_cache_release(old_page);
731 return VM_FAULT_OOM; 751 return -PTR_ERR(new_page);
732 } 752 }
733 753
734 spin_unlock(&mm->page_table_lock); 754 spin_unlock(&mm->page_table_lock);
@@ -772,27 +792,28 @@ retry:
772 size = i_size_read(mapping->host) >> HPAGE_SHIFT; 792 size = i_size_read(mapping->host) >> HPAGE_SHIFT;
773 if (idx >= size) 793 if (idx >= size)
774 goto out; 794 goto out;
775 if (hugetlb_get_quota(mapping))
776 goto out;
777 page = alloc_huge_page(vma, address); 795 page = alloc_huge_page(vma, address);
778 if (!page) { 796 if (IS_ERR(page)) {
779 hugetlb_put_quota(mapping); 797 ret = -PTR_ERR(page);
780 ret = VM_FAULT_OOM;
781 goto out; 798 goto out;
782 } 799 }
783 clear_huge_page(page, address); 800 clear_huge_page(page, address);
784 801
785 if (vma->vm_flags & VM_SHARED) { 802 if (vma->vm_flags & VM_SHARED) {
786 int err; 803 int err;
804 struct inode *inode = mapping->host;
787 805
788 err = add_to_page_cache(page, mapping, idx, GFP_KERNEL); 806 err = add_to_page_cache(page, mapping, idx, GFP_KERNEL);
789 if (err) { 807 if (err) {
790 put_page(page); 808 put_page(page);
791 hugetlb_put_quota(mapping);
792 if (err == -EEXIST) 809 if (err == -EEXIST)
793 goto retry; 810 goto retry;
794 goto out; 811 goto out;
795 } 812 }
813
814 spin_lock(&inode->i_lock);
815 inode->i_blocks += BLOCKS_PER_HUGEPAGE;
816 spin_unlock(&inode->i_lock);
796 } else 817 } else
797 lock_page(page); 818 lock_page(page);
798 } 819 }
@@ -822,7 +843,6 @@ out:
822 843
823backout: 844backout:
824 spin_unlock(&mm->page_table_lock); 845 spin_unlock(&mm->page_table_lock);
825 hugetlb_put_quota(mapping);
826 unlock_page(page); 846 unlock_page(page);
827 put_page(page); 847 put_page(page);
828 goto out; 848 goto out;
@@ -868,7 +888,8 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
868 888
869int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, 889int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
870 struct page **pages, struct vm_area_struct **vmas, 890 struct page **pages, struct vm_area_struct **vmas,
871 unsigned long *position, int *length, int i) 891 unsigned long *position, int *length, int i,
892 int write)
872{ 893{
873 unsigned long pfn_offset; 894 unsigned long pfn_offset;
874 unsigned long vaddr = *position; 895 unsigned long vaddr = *position;
@@ -890,7 +911,7 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
890 int ret; 911 int ret;
891 912
892 spin_unlock(&mm->page_table_lock); 913 spin_unlock(&mm->page_table_lock);
893 ret = hugetlb_fault(mm, vma, vaddr, 0); 914 ret = hugetlb_fault(mm, vma, vaddr, write);
894 spin_lock(&mm->page_table_lock); 915 spin_lock(&mm->page_table_lock);
895 if (!(ret & VM_FAULT_ERROR)) 916 if (!(ret & VM_FAULT_ERROR))
896 continue; 917 continue;
@@ -1132,6 +1153,8 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to)
1132 if (chg < 0) 1153 if (chg < 0)
1133 return chg; 1154 return chg;
1134 1155
1156 if (hugetlb_get_quota(inode->i_mapping, chg))
1157 return -ENOSPC;
1135 ret = hugetlb_acct_memory(chg); 1158 ret = hugetlb_acct_memory(chg);
1136 if (ret < 0) 1159 if (ret < 0)
1137 return ret; 1160 return ret;
@@ -1142,5 +1165,11 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to)
1142void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed) 1165void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed)
1143{ 1166{
1144 long chg = region_truncate(&inode->i_mapping->private_list, offset); 1167 long chg = region_truncate(&inode->i_mapping->private_list, offset);
1145 hugetlb_acct_memory(freed - chg); 1168
1169 spin_lock(&inode->i_lock);
1170 inode->i_blocks -= BLOCKS_PER_HUGEPAGE * freed;
1171 spin_unlock(&inode->i_lock);
1172
1173 hugetlb_put_quota(inode->i_mapping, (chg - freed));
1174 hugetlb_acct_memory(-(chg - freed));
1146} 1175}
diff --git a/mm/memory.c b/mm/memory.c
index eefd5b68bc42..4bf0b6d0eb2a 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1036,7 +1036,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1036 1036
1037 if (is_vm_hugetlb_page(vma)) { 1037 if (is_vm_hugetlb_page(vma)) {
1038 i = follow_hugetlb_page(mm, vma, pages, vmas, 1038 i = follow_hugetlb_page(mm, vma, pages, vmas,
1039 &start, &len, i); 1039 &start, &len, i, write);
1040 continue; 1040 continue;
1041 } 1041 }
1042 1042
@@ -2084,9 +2084,9 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
2084 count_vm_event(PGMAJFAULT); 2084 count_vm_event(PGMAJFAULT);
2085 } 2085 }
2086 2086
2087 delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
2088 mark_page_accessed(page); 2087 mark_page_accessed(page);
2089 lock_page(page); 2088 lock_page(page);
2089 delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
2090 2090
2091 /* 2091 /*
2092 * Back out if somebody else already faulted in this pte. 2092 * Back out if somebody else already faulted in this pte.
@@ -2748,4 +2748,3 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
2748 2748
2749 return buf - old_buf; 2749 return buf - old_buf;
2750} 2750}
2751EXPORT_SYMBOL_GPL(access_process_vm);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 3a47871a29d9..9512a544d044 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -39,7 +39,7 @@ static struct resource *register_memory_resource(u64 start, u64 size)
39 res->name = "System RAM"; 39 res->name = "System RAM";
40 res->start = start; 40 res->start = start;
41 res->end = start + size - 1; 41 res->end = start + size - 1;
42 res->flags = IORESOURCE_MEM; 42 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
43 if (request_resource(&iomem_resource, res) < 0) { 43 if (request_resource(&iomem_resource, res) < 0) {
44 printk("System RAM resource %llx - %llx cannot be added\n", 44 printk("System RAM resource %llx - %llx cannot be added\n",
45 (unsigned long long)res->start, (unsigned long long)res->end); 45 (unsigned long long)res->start, (unsigned long long)res->end);
@@ -574,8 +574,8 @@ repeat:
574 /* Ok, all of our target is islaoted. 574 /* Ok, all of our target is islaoted.
575 We cannot do rollback at this point. */ 575 We cannot do rollback at this point. */
576 offline_isolated_pages(start_pfn, end_pfn); 576 offline_isolated_pages(start_pfn, end_pfn);
577 /* reset pagetype flags */ 577 /* reset pagetype flags and makes migrate type to be MOVABLE */
578 start_isolate_page_range(start_pfn, end_pfn); 578 undo_isolate_page_range(start_pfn, end_pfn);
579 /* removal success */ 579 /* removal success */
580 zone->present_pages -= offlined_pages; 580 zone->present_pages -= offlined_pages;
581 zone->zone_pgdat->node_present_pages -= offlined_pages; 581 zone->zone_pgdat->node_present_pages -= offlined_pages;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index c1592a94582f..83c69f8a64c2 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -722,12 +722,29 @@ out:
722 722
723} 723}
724 724
725/*
726 * Allocate a new page for page migration based on vma policy.
727 * Start assuming that page is mapped by vma pointed to by @private.
728 * Search forward from there, if not. N.B., this assumes that the
729 * list of pages handed to migrate_pages()--which is how we get here--
730 * is in virtual address order.
731 */
725static struct page *new_vma_page(struct page *page, unsigned long private, int **x) 732static struct page *new_vma_page(struct page *page, unsigned long private, int **x)
726{ 733{
727 struct vm_area_struct *vma = (struct vm_area_struct *)private; 734 struct vm_area_struct *vma = (struct vm_area_struct *)private;
735 unsigned long uninitialized_var(address);
728 736
729 return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, 737 while (vma) {
730 page_address_in_vma(page, vma)); 738 address = page_address_in_vma(page, vma);
739 if (address != -EFAULT)
740 break;
741 vma = vma->vm_next;
742 }
743
744 /*
745 * if !vma, alloc_page_vma() will use task or system default policy
746 */
747 return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
731} 748}
732#else 749#else
733 750
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/page-writeback.c b/mm/page-writeback.c
index 838a5e31394c..d55cfcae2ef1 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -297,20 +297,12 @@ get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
297{ 297{
298 int background_ratio; /* Percentages */ 298 int background_ratio; /* Percentages */
299 int dirty_ratio; 299 int dirty_ratio;
300 int unmapped_ratio;
301 long background; 300 long background;
302 long dirty; 301 long dirty;
303 unsigned long available_memory = determine_dirtyable_memory(); 302 unsigned long available_memory = determine_dirtyable_memory();
304 struct task_struct *tsk; 303 struct task_struct *tsk;
305 304
306 unmapped_ratio = 100 - ((global_page_state(NR_FILE_MAPPED) +
307 global_page_state(NR_ANON_PAGES)) * 100) /
308 available_memory;
309
310 dirty_ratio = vm_dirty_ratio; 305 dirty_ratio = vm_dirty_ratio;
311 if (dirty_ratio > unmapped_ratio / 2)
312 dirty_ratio = unmapped_ratio / 2;
313
314 if (dirty_ratio < 5) 306 if (dirty_ratio < 5)
315 dirty_ratio = 5; 307 dirty_ratio = 5;
316 308
@@ -355,8 +347,8 @@ get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
355 */ 347 */
356static void balance_dirty_pages(struct address_space *mapping) 348static void balance_dirty_pages(struct address_space *mapping)
357{ 349{
358 long bdi_nr_reclaimable; 350 long nr_reclaimable, bdi_nr_reclaimable;
359 long bdi_nr_writeback; 351 long nr_writeback, bdi_nr_writeback;
360 long background_thresh; 352 long background_thresh;
361 long dirty_thresh; 353 long dirty_thresh;
362 long bdi_thresh; 354 long bdi_thresh;
@@ -376,11 +368,26 @@ static void balance_dirty_pages(struct address_space *mapping)
376 368
377 get_dirty_limits(&background_thresh, &dirty_thresh, 369 get_dirty_limits(&background_thresh, &dirty_thresh,
378 &bdi_thresh, bdi); 370 &bdi_thresh, bdi);
371
372 nr_reclaimable = global_page_state(NR_FILE_DIRTY) +
373 global_page_state(NR_UNSTABLE_NFS);
374 nr_writeback = global_page_state(NR_WRITEBACK);
375
379 bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE); 376 bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE);
380 bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK); 377 bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK);
378
381 if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh) 379 if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh)
382 break; 380 break;
383 381
382 /*
383 * Throttle it only when the background writeback cannot
384 * catch-up. This avoids (excessively) small writeouts
385 * when the bdi limits are ramping up.
386 */
387 if (nr_reclaimable + nr_writeback <
388 (background_thresh + dirty_thresh) / 2)
389 break;
390
384 if (!bdi->dirty_exceeded) 391 if (!bdi->dirty_exceeded)
385 bdi->dirty_exceeded = 1; 392 bdi->dirty_exceeded = 1;
386 393
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index da69d833e067..12376ae3f733 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -749,23 +749,6 @@ int move_freepages_block(struct zone *zone, struct page *page, int migratetype)
749 return move_freepages(zone, start_page, end_page, migratetype); 749 return move_freepages(zone, start_page, end_page, migratetype);
750} 750}
751 751
752/* Return the page with the lowest PFN in the list */
753static struct page *min_page(struct list_head *list)
754{
755 unsigned long min_pfn = -1UL;
756 struct page *min_page = NULL, *page;;
757
758 list_for_each_entry(page, list, lru) {
759 unsigned long pfn = page_to_pfn(page);
760 if (pfn < min_pfn) {
761 min_pfn = pfn;
762 min_page = page;
763 }
764 }
765
766 return min_page;
767}
768
769/* Remove an element from the buddy allocator from the fallback list */ 752/* Remove an element from the buddy allocator from the fallback list */
770static struct page *__rmqueue_fallback(struct zone *zone, int order, 753static struct page *__rmqueue_fallback(struct zone *zone, int order,
771 int start_migratetype) 754 int start_migratetype)
@@ -789,11 +772,8 @@ static struct page *__rmqueue_fallback(struct zone *zone, int order,
789 if (list_empty(&area->free_list[migratetype])) 772 if (list_empty(&area->free_list[migratetype]))
790 continue; 773 continue;
791 774
792 /* Bias kernel allocations towards low pfns */
793 page = list_entry(area->free_list[migratetype].next, 775 page = list_entry(area->free_list[migratetype].next,
794 struct page, lru); 776 struct page, lru);
795 if (unlikely(start_migratetype != MIGRATE_MOVABLE))
796 page = min_page(&area->free_list[migratetype]);
797 area->nr_free--; 777 area->nr_free--;
798 778
799 /* 779 /*
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 8f92a29695cc..3444b58033c8 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -55,7 +55,7 @@ start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
55 return 0; 55 return 0;
56undo: 56undo:
57 for (pfn = start_pfn; 57 for (pfn = start_pfn;
58 pfn <= undo_pfn; 58 pfn < undo_pfn;
59 pfn += pageblock_nr_pages) 59 pfn += pageblock_nr_pages)
60 unset_migratetype_isolate(pfn_to_page(pfn)); 60 unset_migratetype_isolate(pfn_to_page(pfn));
61 61
@@ -76,7 +76,7 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn)
76 pfn < end_pfn; 76 pfn < end_pfn;
77 pfn += pageblock_nr_pages) { 77 pfn += pageblock_nr_pages) {
78 page = __first_valid_page(pfn, pageblock_nr_pages); 78 page = __first_valid_page(pfn, pageblock_nr_pages);
79 if (!page || get_pageblock_flags(page) != MIGRATE_ISOLATE) 79 if (!page || get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
80 continue; 80 continue;
81 unset_migratetype_isolate(page); 81 unset_migratetype_isolate(page);
82 } 82 }
@@ -126,7 +126,7 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
126 */ 126 */
127 for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { 127 for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) {
128 page = __first_valid_page(pfn, pageblock_nr_pages); 128 page = __first_valid_page(pfn, pageblock_nr_pages);
129 if (page && get_pageblock_flags(page) != MIGRATE_ISOLATE) 129 if (page && get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
130 break; 130 break;
131 } 131 }
132 if (pfn < end_pfn) 132 if (pfn < end_pfn)
diff --git a/mm/rmap.c b/mm/rmap.c
index 8990f909492f..dbc2ca2057a5 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -183,7 +183,9 @@ static void page_unlock_anon_vma(struct anon_vma *anon_vma)
183} 183}
184 184
185/* 185/*
186 * At what user virtual address is page expected in vma? 186 * At what user virtual address is page expected in @vma?
187 * Returns virtual address or -EFAULT if page's index/offset is not
188 * within the range mapped the @vma.
187 */ 189 */
188static inline unsigned long 190static inline unsigned long
189vma_address(struct page *page, struct vm_area_struct *vma) 191vma_address(struct page *page, struct vm_area_struct *vma)
@@ -193,8 +195,7 @@ vma_address(struct page *page, struct vm_area_struct *vma)
193 195
194 address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); 196 address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
195 if (unlikely(address < vma->vm_start || address >= vma->vm_end)) { 197 if (unlikely(address < vma->vm_start || address >= vma->vm_end)) {
196 /* page should be within any vma from prio_tree_next */ 198 /* page should be within @vma mapping range */
197 BUG_ON(!PageAnon(page));
198 return -EFAULT; 199 return -EFAULT;
199 } 200 }
200 return address; 201 return address;
@@ -470,11 +471,12 @@ int page_mkclean(struct page *page)
470 471
471 if (page_mapped(page)) { 472 if (page_mapped(page)) {
472 struct address_space *mapping = page_mapping(page); 473 struct address_space *mapping = page_mapping(page);
473 if (mapping) 474 if (mapping) {
474 ret = page_mkclean_file(mapping, page); 475 ret = page_mkclean_file(mapping, page);
475 if (page_test_dirty(page)) { 476 if (page_test_dirty(page)) {
476 page_clear_dirty(page); 477 page_clear_dirty(page);
477 ret = 1; 478 ret = 1;
479 }
478 } 480 }
479 } 481 }
480 482
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/slab.c b/mm/slab.c
index cfa6be4e378e..c31cd3682a0b 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1043,7 +1043,7 @@ static struct array_cache **alloc_alien_cache(int node, int limit)
1043 } 1043 }
1044 ac_ptr[i] = alloc_arraycache(node, limit, 0xbaadf00d); 1044 ac_ptr[i] = alloc_arraycache(node, limit, 0xbaadf00d);
1045 if (!ac_ptr[i]) { 1045 if (!ac_ptr[i]) {
1046 for (i--; i <= 0; i--) 1046 for (i--; i >= 0; i--)
1047 kfree(ac_ptr[i]); 1047 kfree(ac_ptr[i]);
1048 kfree(ac_ptr); 1048 kfree(ac_ptr);
1049 return NULL; 1049 return NULL;
diff --git a/mm/slob.c b/mm/slob.c
index 5bc2ceb692ec..08a9bd91a1aa 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -321,7 +321,8 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
321 /* Improve fragment distribution and reduce our average 321 /* Improve fragment distribution and reduce our average
322 * search time by starting our next search here. (see 322 * search time by starting our next search here. (see
323 * Knuth vol 1, sec 2.5, pg 449) */ 323 * Knuth vol 1, sec 2.5, pg 449) */
324 if (free_slob_pages.next != prev->next) 324 if (prev != free_slob_pages.prev &&
325 free_slob_pages.next != prev->next)
325 list_move_tail(&free_slob_pages, prev->next); 326 list_move_tail(&free_slob_pages, prev->next);
326 break; 327 break;
327 } 328 }
diff --git a/mm/slub.c b/mm/slub.c
index aac1dd3c657d..9acb413858ac 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1080,7 +1080,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
1080 struct page *page; 1080 struct page *page;
1081 struct kmem_cache_node *n; 1081 struct kmem_cache_node *n;
1082 void *start; 1082 void *start;
1083 void *end;
1084 void *last; 1083 void *last;
1085 void *p; 1084 void *p;
1086 1085
@@ -1101,7 +1100,6 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
1101 SetSlabDebug(page); 1100 SetSlabDebug(page);
1102 1101
1103 start = page_address(page); 1102 start = page_address(page);
1104 end = start + s->objects * s->size;
1105 1103
1106 if (unlikely(s->flags & SLAB_POISON)) 1104 if (unlikely(s->flags & SLAB_POISON))
1107 memset(start, POISON_INUSE, PAGE_SIZE << s->order); 1105 memset(start, POISON_INUSE, PAGE_SIZE << s->order);
@@ -1511,26 +1509,8 @@ new_slab:
1511 1509
1512 if (new) { 1510 if (new) {
1513 c = get_cpu_slab(s, smp_processor_id()); 1511 c = get_cpu_slab(s, smp_processor_id());
1514 if (c->page) { 1512 if (c->page)
1515 /*
1516 * Someone else populated the cpu_slab while we
1517 * enabled interrupts, or we have gotten scheduled
1518 * on another cpu. The page may not be on the
1519 * requested node even if __GFP_THISNODE was
1520 * specified. So we need to recheck.
1521 */
1522 if (node_match(c, node)) {
1523 /*
1524 * Current cpuslab is acceptable and we
1525 * want the current one since its cache hot
1526 */
1527 discard_slab(s, new);
1528 slab_lock(c->page);
1529 goto load_freelist;
1530 }
1531 /* New slab does not fit our expectations */
1532 flush_slab(s, c); 1513 flush_slab(s, c);
1533 }
1534 slab_lock(new); 1514 slab_lock(new);
1535 SetSlabFrozen(new); 1515 SetSlabFrozen(new);
1536 c->page = new; 1516 c->page = new;
@@ -2734,7 +2714,7 @@ static void slab_mem_offline_callback(void *arg)
2734 * and offline_pages() function shoudn't call this 2714 * and offline_pages() function shoudn't call this
2735 * callback. So, we must fail. 2715 * callback. So, we must fail.
2736 */ 2716 */
2737 BUG_ON(atomic_read(&n->nr_slabs)); 2717 BUG_ON(atomic_long_read(&n->nr_slabs));
2738 2718
2739 s->node[offline_node] = NULL; 2719 s->node[offline_node] = NULL;
2740 kmem_cache_free(kmalloc_caches, n); 2720 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/mm/util.c b/mm/util.c
index 5f64026cbb4d..8f18683825bc 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -95,8 +95,8 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
95 return (void *)p; 95 return (void *)p;
96 96
97 ret = kmalloc_track_caller(new_size, flags); 97 ret = kmalloc_track_caller(new_size, flags);
98 if (ret) { 98 if (ret && p) {
99 memcpy(ret, p, min(new_size, ks)); 99 memcpy(ret, p, ks);
100 kfree(p); 100 kfree(p);
101 } 101 }
102 return ret; 102 return ret;
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 4651bf153f35..e8d846f57774 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -803,7 +803,7 @@ static void vmstat_update(struct work_struct *w)
803 sysctl_stat_interval); 803 sysctl_stat_interval);
804} 804}
805 805
806static void __devinit start_cpu_timer(int cpu) 806static void __cpuinit start_cpu_timer(int cpu)
807{ 807{
808 struct delayed_work *vmstat_work = &per_cpu(vmstat_work, cpu); 808 struct delayed_work *vmstat_work = &per_cpu(vmstat_work, cpu);
809 809
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 3fe4fc86055f..6567213959cb 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -376,6 +376,7 @@ void vlan_setup(struct net_device *new_dev)
376 new_dev->init = vlan_dev_init; 376 new_dev->init = vlan_dev_init;
377 new_dev->open = vlan_dev_open; 377 new_dev->open = vlan_dev_open;
378 new_dev->stop = vlan_dev_stop; 378 new_dev->stop = vlan_dev_stop;
379 new_dev->set_mac_address = vlan_set_mac_address;
379 new_dev->set_multicast_list = vlan_dev_set_multicast_list; 380 new_dev->set_multicast_list = vlan_dev_set_multicast_list;
380 new_dev->change_rx_flags = vlan_change_rx_flags; 381 new_dev->change_rx_flags = vlan_change_rx_flags;
381 new_dev->destructor = free_netdev; 382 new_dev->destructor = free_netdev;
@@ -636,6 +637,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
636 if (!vlandev) 637 if (!vlandev)
637 continue; 638 continue;
638 639
640 flgs = vlandev->flags;
641 if (!(flgs & IFF_UP))
642 continue;
643
639 vlan_sync_address(dev, vlandev); 644 vlan_sync_address(dev, vlandev);
640 } 645 }
641 break; 646 break;
@@ -747,6 +752,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
747 vlan_dev_set_ingress_priority(dev, 752 vlan_dev_set_ingress_priority(dev,
748 args.u.skb_priority, 753 args.u.skb_priority,
749 args.vlan_qos); 754 args.vlan_qos);
755 err = 0;
750 break; 756 break;
751 757
752 case SET_VLAN_EGRESS_PRIORITY_CMD: 758 case SET_VLAN_EGRESS_PRIORITY_CMD:
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index cf4a80d06b35..2cd1393073ec 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -60,6 +60,7 @@ int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev
60int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); 60int vlan_dev_change_mtu(struct net_device *dev, int new_mtu);
61int vlan_dev_open(struct net_device* dev); 61int vlan_dev_open(struct net_device* dev);
62int vlan_dev_stop(struct net_device* dev); 62int vlan_dev_stop(struct net_device* dev);
63int vlan_set_mac_address(struct net_device *dev, void *p);
63int vlan_dev_ioctl(struct net_device* dev, struct ifreq *ifr, int cmd); 64int vlan_dev_ioctl(struct net_device* dev, struct ifreq *ifr, int cmd);
64void vlan_dev_set_ingress_priority(const struct net_device *dev, 65void vlan_dev_set_ingress_priority(const struct net_device *dev,
65 u32 skb_prio, short vlan_prio); 66 u32 skb_prio, short vlan_prio);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 1a1740aa9a8b..7a36878241da 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -665,6 +665,32 @@ int vlan_dev_stop(struct net_device *dev)
665 return 0; 665 return 0;
666} 666}
667 667
668int vlan_set_mac_address(struct net_device *dev, void *p)
669{
670 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
671 struct sockaddr *addr = p;
672 int err;
673
674 if (!is_valid_ether_addr(addr->sa_data))
675 return -EADDRNOTAVAIL;
676
677 if (!(dev->flags & IFF_UP))
678 goto out;
679
680 if (compare_ether_addr(addr->sa_data, real_dev->dev_addr)) {
681 err = dev_unicast_add(real_dev, addr->sa_data, ETH_ALEN);
682 if (err < 0)
683 return err;
684 }
685
686 if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr))
687 dev_unicast_delete(real_dev, dev->dev_addr, ETH_ALEN);
688
689out:
690 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
691 return 0;
692}
693
668int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 694int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
669{ 695{
670 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; 696 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
diff --git a/net/9p/mod.c b/net/9p/mod.c
index 41d70f47375d..8f9763a9dc12 100644
--- a/net/9p/mod.c
+++ b/net/9p/mod.c
@@ -76,9 +76,9 @@ struct p9_trans_module *v9fs_match_trans(const substring_t *name)
76 list_for_each(p, &v9fs_trans_list) { 76 list_for_each(p, &v9fs_trans_list) {
77 t = list_entry(p, struct p9_trans_module, list); 77 t = list_entry(p, struct p9_trans_module, list);
78 if (strncmp(t->name, name->from, name->to-name->from) == 0) 78 if (strncmp(t->name, name->from, name->to-name->from) == 0)
79 break; 79 return t;
80 } 80 }
81 return t; 81 return NULL;
82} 82}
83EXPORT_SYMBOL(v9fs_match_trans); 83EXPORT_SYMBOL(v9fs_match_trans);
84 84
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 30269a4ff22a..62332ed9da4a 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -62,13 +62,14 @@ struct p9_trans_fd {
62 62
63enum { 63enum {
64 /* Options that take integer arguments */ 64 /* Options that take integer arguments */
65 Opt_port, Opt_rfdno, Opt_wfdno, 65 Opt_port, Opt_rfdno, Opt_wfdno, Opt_err,
66}; 66};
67 67
68static match_table_t tokens = { 68static match_table_t tokens = {
69 {Opt_port, "port=%u"}, 69 {Opt_port, "port=%u"},
70 {Opt_rfdno, "rfdno=%u"}, 70 {Opt_rfdno, "rfdno=%u"},
71 {Opt_wfdno, "wfdno=%u"}, 71 {Opt_wfdno, "wfdno=%u"},
72 {Opt_err, NULL},
72}; 73};
73 74
74/** 75/**
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/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index da22f900e89d..c1757c79dfbb 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -766,6 +766,9 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb,
766 if (!nf_bridge) 766 if (!nf_bridge)
767 return NF_ACCEPT; 767 return NF_ACCEPT;
768 768
769 if (!(nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT)))
770 return NF_ACCEPT;
771
769 if (!realoutdev) 772 if (!realoutdev)
770 return NF_DROP; 773 return NF_DROP;
771 774
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index 392d877040d3..6436d30a550e 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -187,7 +187,7 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
187 187
188 if (datalen != EBT_ALIGN(expected_length)) { 188 if (datalen != EBT_ALIGN(expected_length)) {
189 printk(KERN_WARNING 189 printk(KERN_WARNING
190 "ebtables: among: wrong size: %d" 190 "ebtables: among: wrong size: %d "
191 "against expected %d, rounded to %Zd\n", 191 "against expected %d, rounded to %Zd\n",
192 datalen, expected_length, 192 datalen, expected_length,
193 EBT_ALIGN(expected_length)); 193 EBT_ALIGN(expected_length));
diff --git a/net/bridge/netfilter/ebt_arp.c b/net/bridge/netfilter/ebt_arp.c
index 1a46952a56d9..18141392a9b4 100644
--- a/net/bridge/netfilter/ebt_arp.c
+++ b/net/bridge/netfilter/ebt_arp.c
@@ -34,7 +34,7 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in
34 ah->ar_pro, EBT_ARP_PTYPE)) 34 ah->ar_pro, EBT_ARP_PTYPE))
35 return EBT_NOMATCH; 35 return EBT_NOMATCH;
36 36
37 if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP)) { 37 if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_GRAT)) {
38 __be32 saddr, daddr, *sap, *dap; 38 __be32 saddr, daddr, *sap, *dap;
39 39
40 if (ah->ar_pln != sizeof(__be32) || ah->ar_pro != htons(ETH_P_IP)) 40 if (ah->ar_pln != sizeof(__be32) || ah->ar_pro != htons(ETH_P_IP))
diff --git a/net/core/dev.c b/net/core/dev.c
index 853c8b575f1d..86d62611f2fc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1171,6 +1171,8 @@ rollback:
1171 nb->notifier_call(nb, NETDEV_UNREGISTER, dev); 1171 nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
1172 } 1172 }
1173 } 1173 }
1174
1175 raw_notifier_chain_unregister(&netdev_chain, nb);
1174 goto unlock; 1176 goto unlock;
1175} 1177}
1176 1178
@@ -1751,9 +1753,6 @@ DEFINE_PER_CPU(struct netif_rx_stats, netdev_rx_stat) = { 0, };
1751 * 1753 *
1752 * return values: 1754 * return values:
1753 * NET_RX_SUCCESS (no congestion) 1755 * NET_RX_SUCCESS (no congestion)
1754 * NET_RX_CN_LOW (low congestion)
1755 * NET_RX_CN_MOD (moderate congestion)
1756 * NET_RX_CN_HIGH (high congestion)
1757 * NET_RX_DROP (packet was dropped) 1756 * NET_RX_DROP (packet was dropped)
1758 * 1757 *
1759 */ 1758 */
@@ -2001,6 +2000,21 @@ out:
2001} 2000}
2002#endif 2001#endif
2003 2002
2003/**
2004 * netif_receive_skb - process receive buffer from network
2005 * @skb: buffer to process
2006 *
2007 * netif_receive_skb() is the main receive data processing function.
2008 * It always succeeds. The buffer may be dropped during processing
2009 * for congestion control or by the protocol layers.
2010 *
2011 * This function may only be called from softirq context and interrupts
2012 * should be enabled.
2013 *
2014 * Return values (usually ignored):
2015 * NET_RX_SUCCESS: no congestion
2016 * NET_RX_DROP: packet was dropped
2017 */
2004int netif_receive_skb(struct sk_buff *skb) 2018int netif_receive_skb(struct sk_buff *skb)
2005{ 2019{
2006 struct packet_type *ptype, *pt_prev; 2020 struct packet_type *ptype, *pt_prev;
@@ -2172,7 +2186,15 @@ static void net_rx_action(struct softirq_action *h)
2172 2186
2173 weight = n->weight; 2187 weight = n->weight;
2174 2188
2175 work = n->poll(n, weight); 2189 /* This NAPI_STATE_SCHED test is for avoiding a race
2190 * with netpoll's poll_napi(). Only the entity which
2191 * obtains the lock and sees NAPI_STATE_SCHED set will
2192 * actually make the ->poll() call. Therefore we avoid
2193 * accidently calling ->poll() when NAPI is not scheduled.
2194 */
2195 work = 0;
2196 if (test_bit(NAPI_STATE_SCHED, &n->state))
2197 work = n->poll(n, weight);
2176 2198
2177 WARN_ON_ONCE(work > weight); 2199 WARN_ON_ONCE(work > weight);
2178 2200
@@ -2668,7 +2690,7 @@ static void __net_exit dev_proc_net_exit(struct net *net)
2668 proc_net_remove(net, "dev"); 2690 proc_net_remove(net, "dev");
2669} 2691}
2670 2692
2671static struct pernet_operations dev_proc_ops = { 2693static struct pernet_operations __net_initdata dev_proc_ops = {
2672 .init = dev_proc_net_init, 2694 .init = dev_proc_net_init,
2673 .exit = dev_proc_net_exit, 2695 .exit = dev_proc_net_exit,
2674}; 2696};
@@ -3488,6 +3510,60 @@ static void net_set_todo(struct net_device *dev)
3488 spin_unlock(&net_todo_list_lock); 3510 spin_unlock(&net_todo_list_lock);
3489} 3511}
3490 3512
3513static void rollback_registered(struct net_device *dev)
3514{
3515 BUG_ON(dev_boot_phase);
3516 ASSERT_RTNL();
3517
3518 /* Some devices call without registering for initialization unwind. */
3519 if (dev->reg_state == NETREG_UNINITIALIZED) {
3520 printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
3521 "was registered\n", dev->name, dev);
3522
3523 WARN_ON(1);
3524 return;
3525 }
3526
3527 BUG_ON(dev->reg_state != NETREG_REGISTERED);
3528
3529 /* If device is running, close it first. */
3530 dev_close(dev);
3531
3532 /* And unlink it from device chain. */
3533 unlist_netdevice(dev);
3534
3535 dev->reg_state = NETREG_UNREGISTERING;
3536
3537 synchronize_net();
3538
3539 /* Shutdown queueing discipline. */
3540 dev_shutdown(dev);
3541
3542
3543 /* Notify protocols, that we are about to destroy
3544 this device. They should clean all the things.
3545 */
3546 call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
3547
3548 /*
3549 * Flush the unicast and multicast chains
3550 */
3551 dev_addr_discard(dev);
3552
3553 if (dev->uninit)
3554 dev->uninit(dev);
3555
3556 /* Notifier chain MUST detach us from master device. */
3557 BUG_TRAP(!dev->master);
3558
3559 /* Remove entries from kobject tree */
3560 netdev_unregister_kobject(dev);
3561
3562 synchronize_net();
3563
3564 dev_put(dev);
3565}
3566
3491/** 3567/**
3492 * register_netdevice - register a network device 3568 * register_netdevice - register a network device
3493 * @dev: device to register 3569 * @dev: device to register
@@ -3625,8 +3701,10 @@ int register_netdevice(struct net_device *dev)
3625 /* Notify protocols, that a new device appeared. */ 3701 /* Notify protocols, that a new device appeared. */
3626 ret = call_netdevice_notifiers(NETDEV_REGISTER, dev); 3702 ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
3627 ret = notifier_to_errno(ret); 3703 ret = notifier_to_errno(ret);
3628 if (ret) 3704 if (ret) {
3629 unregister_netdevice(dev); 3705 rollback_registered(dev);
3706 dev->reg_state = NETREG_UNREGISTERED;
3707 }
3630 3708
3631out: 3709out:
3632 return ret; 3710 return ret;
@@ -3903,59 +3981,9 @@ void synchronize_net(void)
3903 3981
3904void unregister_netdevice(struct net_device *dev) 3982void unregister_netdevice(struct net_device *dev)
3905{ 3983{
3906 BUG_ON(dev_boot_phase); 3984 rollback_registered(dev);
3907 ASSERT_RTNL();
3908
3909 /* Some devices call without registering for initialization unwind. */
3910 if (dev->reg_state == NETREG_UNINITIALIZED) {
3911 printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
3912 "was registered\n", dev->name, dev);
3913
3914 WARN_ON(1);
3915 return;
3916 }
3917
3918 BUG_ON(dev->reg_state != NETREG_REGISTERED);
3919
3920 /* If device is running, close it first. */
3921 dev_close(dev);
3922
3923 /* And unlink it from device chain. */
3924 unlist_netdevice(dev);
3925
3926 dev->reg_state = NETREG_UNREGISTERING;
3927
3928 synchronize_net();
3929
3930 /* Shutdown queueing discipline. */
3931 dev_shutdown(dev);
3932
3933
3934 /* Notify protocols, that we are about to destroy
3935 this device. They should clean all the things.
3936 */
3937 call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
3938
3939 /*
3940 * Flush the unicast and multicast chains
3941 */
3942 dev_addr_discard(dev);
3943
3944 if (dev->uninit)
3945 dev->uninit(dev);
3946
3947 /* Notifier chain MUST detach us from master device. */
3948 BUG_TRAP(!dev->master);
3949
3950 /* Remove entries from kobject tree */
3951 netdev_unregister_kobject(dev);
3952
3953 /* Finish processing unregister after unlock */ 3985 /* Finish processing unregister after unlock */
3954 net_set_todo(dev); 3986 net_set_todo(dev);
3955
3956 synchronize_net();
3957
3958 dev_put(dev);
3959} 3987}
3960 3988
3961/** 3989/**
@@ -4304,7 +4332,6 @@ static struct hlist_head *netdev_create_hash(void)
4304static int __net_init netdev_init(struct net *net) 4332static int __net_init netdev_init(struct net *net)
4305{ 4333{
4306 INIT_LIST_HEAD(&net->dev_base_head); 4334 INIT_LIST_HEAD(&net->dev_base_head);
4307 rwlock_init(&dev_base_lock);
4308 4335
4309 net->dev_name_head = netdev_create_hash(); 4336 net->dev_name_head = netdev_create_hash();
4310 if (net->dev_name_head == NULL) 4337 if (net->dev_name_head == NULL)
@@ -4328,7 +4355,7 @@ static void __net_exit netdev_exit(struct net *net)
4328 kfree(net->dev_index_head); 4355 kfree(net->dev_index_head);
4329} 4356}
4330 4357
4331static struct pernet_operations netdev_net_ops = { 4358static struct pernet_operations __net_initdata netdev_net_ops = {
4332 .init = netdev_init, 4359 .init = netdev_init,
4333 .exit = netdev_exit, 4360 .exit = netdev_exit,
4334}; 4361};
@@ -4359,7 +4386,7 @@ static void __net_exit default_device_exit(struct net *net)
4359 rtnl_unlock(); 4386 rtnl_unlock();
4360} 4387}
4361 4388
4362static struct pernet_operations default_device_ops = { 4389static struct pernet_operations __net_initdata default_device_ops = {
4363 .exit = default_device_exit, 4390 .exit = default_device_exit,
4364}; 4391};
4365 4392
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index ae354057d84c..69fff16ece10 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -168,13 +168,13 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
168 da = from->mc_list; 168 da = from->mc_list;
169 while (da != NULL) { 169 while (da != NULL) {
170 next = da->next; 170 next = da->next;
171 if (!da->da_synced) 171 if (da->da_synced) {
172 continue; 172 __dev_addr_delete(&to->mc_list, &to->mc_count,
173 __dev_addr_delete(&to->mc_list, &to->mc_count, 173 da->da_addr, da->da_addrlen, 0);
174 da->da_addr, da->da_addrlen, 0); 174 da->da_synced = 0;
175 da->da_synced = 0; 175 __dev_addr_delete(&from->mc_list, &from->mc_count,
176 __dev_addr_delete(&from->mc_list, &from->mc_count, 176 da->da_addr, da->da_addrlen, 0);
177 da->da_addr, da->da_addrlen, 0); 177 }
178 da = next; 178 da = next;
179 } 179 }
180 __dev_set_rx_mode(to); 180 __dev_set_rx_mode(to);
@@ -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 dev_mc_net_ops = { 288static struct pernet_operations __net_initdata 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/dst.c b/net/core/dst.c
index 16958e64e577..03daead3592a 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -18,7 +18,6 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <net/net_namespace.h> 19#include <net/net_namespace.h>
20 20
21#include <net/net_namespace.h>
22#include <net/dst.h> 21#include <net/dst.h>
23 22
24/* 23/*
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 13de6f53f098..848132b6cb73 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -18,6 +18,28 @@
18static LIST_HEAD(rules_ops); 18static LIST_HEAD(rules_ops);
19static DEFINE_SPINLOCK(rules_mod_lock); 19static DEFINE_SPINLOCK(rules_mod_lock);
20 20
21int fib_default_rule_add(struct fib_rules_ops *ops,
22 u32 pref, u32 table, u32 flags)
23{
24 struct fib_rule *r;
25
26 r = kzalloc(ops->rule_size, GFP_KERNEL);
27 if (r == NULL)
28 return -ENOMEM;
29
30 atomic_set(&r->refcnt, 1);
31 r->action = FR_ACT_TO_TBL;
32 r->pref = pref;
33 r->table = table;
34 r->flags = flags;
35
36 /* The lock is not required here, the list in unreacheable
37 * at the moment this function is called */
38 list_add_tail(&r->list, &ops->rules_list);
39 return 0;
40}
41EXPORT_SYMBOL(fib_default_rule_add);
42
21static void notify_rule_change(int event, struct fib_rule *rule, 43static void notify_rule_change(int event, struct fib_rule *rule,
22 struct fib_rules_ops *ops, struct nlmsghdr *nlh, 44 struct fib_rules_ops *ops, struct nlmsghdr *nlh,
23 u32 pid); 45 u32 pid);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 05979e356963..29b8ee4e35d6 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1435,6 +1435,8 @@ int neigh_table_clear(struct neigh_table *tbl)
1435 kfree(tbl->phash_buckets); 1435 kfree(tbl->phash_buckets);
1436 tbl->phash_buckets = NULL; 1436 tbl->phash_buckets = NULL;
1437 1437
1438 remove_proc_entry(tbl->id, init_net.proc_net_stat);
1439
1438 free_percpu(tbl->stats); 1440 free_percpu(tbl->stats);
1439 tbl->stats = NULL; 1441 tbl->stats = NULL;
1440 1442
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 6f71db8c4428..383252b50411 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,33 @@ 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
67static void net_free(struct net *net)
68{
69 if (!net)
70 return;
71
72 if (unlikely(atomic_read(&net->use_count) != 0)) {
73 printk(KERN_EMERG "network namespace not free! Usage: %d\n",
74 atomic_read(&net->use_count));
75 return;
76 }
77
78 kmem_cache_free(net_cachep, net);
79}
80
118struct net *copy_net_ns(unsigned long flags, struct net *old_net) 81struct net *copy_net_ns(unsigned long flags, struct net *old_net)
119{ 82{
120 struct net *new_net = NULL; 83 struct net *new_net = NULL;
@@ -125,10 +88,6 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net)
125 if (!(flags & CLONE_NEWNET)) 88 if (!(flags & CLONE_NEWNET))
126 return old_net; 89 return old_net;
127 90
128#ifndef CONFIG_NET_NS
129 return ERR_PTR(-EINVAL);
130#endif
131
132 err = -ENOMEM; 91 err = -ENOMEM;
133 new_net = net_alloc(); 92 new_net = net_alloc();
134 if (!new_net) 93 if (!new_net)
@@ -155,14 +114,64 @@ out:
155 return new_net; 114 return new_net;
156} 115}
157 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
@@ -179,35 +188,35 @@ static int __init net_ns_init(void)
179 188
180pure_initcall(net_ns_init); 189pure_initcall(net_ns_init);
181 190
191#ifdef CONFIG_NET_NS
182static int register_pernet_operations(struct list_head *list, 192static int register_pernet_operations(struct list_head *list,
183 struct pernet_operations *ops) 193 struct pernet_operations *ops)
184{ 194{
185 struct net *net, *undo_net; 195 struct net *net, *undo_net;
186 int error; 196 int error;
187 197
188 error = 0;
189 list_add_tail(&ops->list, list); 198 list_add_tail(&ops->list, list);
190 for_each_net(net) { 199 if (ops->init) {
191 if (ops->init) { 200 for_each_net(net) {
192 error = ops->init(net); 201 error = ops->init(net);
193 if (error) 202 if (error)
194 goto out_undo; 203 goto out_undo;
195 } 204 }
196 } 205 }
197out: 206 return 0;
198 return error;
199 207
200out_undo: 208out_undo:
201 /* If I have an error cleanup all namespaces I initialized */ 209 /* If I have an error cleanup all namespaces I initialized */
202 list_del(&ops->list); 210 list_del(&ops->list);
203 for_each_net(undo_net) { 211 if (ops->exit) {
204 if (undo_net == net) 212 for_each_net(undo_net) {
205 goto undone; 213 if (undo_net == net)
206 if (ops->exit) 214 goto undone;
207 ops->exit(undo_net); 215 ops->exit(undo_net);
216 }
208 } 217 }
209undone: 218undone:
210 goto out; 219 return error;
211} 220}
212 221
213static void unregister_pernet_operations(struct pernet_operations *ops) 222static void unregister_pernet_operations(struct pernet_operations *ops)
@@ -215,11 +224,28 @@ static void unregister_pernet_operations(struct pernet_operations *ops)
215 struct net *net; 224 struct net *net;
216 225
217 list_del(&ops->list); 226 list_del(&ops->list);
218 for_each_net(net) 227 if (ops->exit)
219 if (ops->exit) 228 for_each_net(net)
220 ops->exit(net); 229 ops->exit(net);
221} 230}
222 231
232#else
233
234static int register_pernet_operations(struct list_head *list,
235 struct pernet_operations *ops)
236{
237 if (ops->init == NULL)
238 return 0;
239 return ops->init(&init_net);
240}
241
242static void unregister_pernet_operations(struct pernet_operations *ops)
243{
244 if (ops->exit)
245 ops->exit(&init_net);
246}
247#endif
248
223/** 249/**
224 * register_pernet_subsys - register a network namespace subsystem 250 * register_pernet_subsys - register a network namespace subsystem
225 * @ops: pernet operations structure for the subsystem 251 * @ops: pernet operations structure for the subsystem
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/pktgen.c b/net/core/pktgen.c
index de33f36947e9..285ec3ed9b37 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2463,8 +2463,6 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev)
2463 2463
2464 x->curlft.bytes +=skb->len; 2464 x->curlft.bytes +=skb->len;
2465 x->curlft.packets++; 2465 x->curlft.packets++;
2466 spin_unlock(&x->lock);
2467
2468error: 2466error:
2469 spin_unlock(&x->lock); 2467 spin_unlock(&x->lock);
2470 return err; 2468 return err;
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index 5f0818d815e6..45aed75cb571 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -71,6 +71,41 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
71 71
72EXPORT_SYMBOL(reqsk_queue_alloc); 72EXPORT_SYMBOL(reqsk_queue_alloc);
73 73
74void __reqsk_queue_destroy(struct request_sock_queue *queue)
75{
76 struct listen_sock *lopt;
77 size_t lopt_size;
78
79 /*
80 * this is an error recovery path only
81 * no locking needed and the lopt is not NULL
82 */
83
84 lopt = queue->listen_opt;
85 lopt_size = sizeof(struct listen_sock) +
86 lopt->nr_table_entries * sizeof(struct request_sock *);
87
88 if (lopt_size > PAGE_SIZE)
89 vfree(lopt);
90 else
91 kfree(lopt);
92}
93
94EXPORT_SYMBOL(__reqsk_queue_destroy);
95
96static inline struct listen_sock *reqsk_queue_yank_listen_sk(
97 struct request_sock_queue *queue)
98{
99 struct listen_sock *lopt;
100
101 write_lock_bh(&queue->syn_wait_lock);
102 lopt = queue->listen_opt;
103 queue->listen_opt = NULL;
104 write_unlock_bh(&queue->syn_wait_lock);
105
106 return lopt;
107}
108
74void reqsk_queue_destroy(struct request_sock_queue *queue) 109void reqsk_queue_destroy(struct request_sock_queue *queue)
75{ 110{
76 /* make all the listen_opt local to us */ 111 /* make all the listen_opt local to us */
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 573e17240197..5b4ce9b4dd20 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -275,12 +275,11 @@ static void skb_release_data(struct sk_buff *skb)
275/* 275/*
276 * Free an skbuff by memory without cleaning the state. 276 * Free an skbuff by memory without cleaning the state.
277 */ 277 */
278void kfree_skbmem(struct sk_buff *skb) 278static void kfree_skbmem(struct sk_buff *skb)
279{ 279{
280 struct sk_buff *other; 280 struct sk_buff *other;
281 atomic_t *fclone_ref; 281 atomic_t *fclone_ref;
282 282
283 skb_release_data(skb);
284 switch (skb->fclone) { 283 switch (skb->fclone) {
285 case SKB_FCLONE_UNAVAILABLE: 284 case SKB_FCLONE_UNAVAILABLE:
286 kmem_cache_free(skbuff_head_cache, skb); 285 kmem_cache_free(skbuff_head_cache, skb);
@@ -307,16 +306,8 @@ void kfree_skbmem(struct sk_buff *skb)
307 } 306 }
308} 307}
309 308
310/** 309/* Free everything but the sk_buff shell. */
311 * __kfree_skb - private function 310static void skb_release_all(struct sk_buff *skb)
312 * @skb: buffer
313 *
314 * Free an sk_buff. Release anything attached to the buffer.
315 * Clean the state. This is an internal helper function. Users should
316 * always call kfree_skb
317 */
318
319void __kfree_skb(struct sk_buff *skb)
320{ 311{
321 dst_release(skb->dst); 312 dst_release(skb->dst);
322#ifdef CONFIG_XFRM 313#ifdef CONFIG_XFRM
@@ -340,7 +331,21 @@ void __kfree_skb(struct sk_buff *skb)
340 skb->tc_verd = 0; 331 skb->tc_verd = 0;
341#endif 332#endif
342#endif 333#endif
334 skb_release_data(skb);
335}
343 336
337/**
338 * __kfree_skb - private function
339 * @skb: buffer
340 *
341 * Free an sk_buff. Release anything attached to the buffer.
342 * Clean the state. This is an internal helper function. Users should
343 * always call kfree_skb
344 */
345
346void __kfree_skb(struct sk_buff *skb)
347{
348 skb_release_all(skb);
344 kfree_skbmem(skb); 349 kfree_skbmem(skb);
345} 350}
346 351
@@ -441,7 +446,7 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
441 */ 446 */
442struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src) 447struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src)
443{ 448{
444 skb_release_data(dst); 449 skb_release_all(dst);
445 return __skb_clone(dst, src); 450 return __skb_clone(dst, src);
446} 451}
447EXPORT_SYMBOL_GPL(skb_morph); 452EXPORT_SYMBOL_GPL(skb_morph);
@@ -2028,8 +2033,8 @@ void __init skb_init(void)
2028 * Fill the specified scatter-gather list with mappings/pointers into a 2033 * Fill the specified scatter-gather list with mappings/pointers into a
2029 * region of the buffer space attached to a socket buffer. 2034 * region of the buffer space attached to a socket buffer.
2030 */ 2035 */
2031int 2036static int
2032skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) 2037__skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2033{ 2038{
2034 int start = skb_headlen(skb); 2039 int start = skb_headlen(skb);
2035 int i, copy = start - offset; 2040 int i, copy = start - offset;
@@ -2078,7 +2083,8 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2078 if ((copy = end - offset) > 0) { 2083 if ((copy = end - offset) > 0) {
2079 if (copy > len) 2084 if (copy > len)
2080 copy = len; 2085 copy = len;
2081 elt += skb_to_sgvec(list, sg+elt, offset - start, copy); 2086 elt += __skb_to_sgvec(list, sg+elt, offset - start,
2087 copy);
2082 if ((len -= copy) == 0) 2088 if ((len -= copy) == 0)
2083 return elt; 2089 return elt;
2084 offset += copy; 2090 offset += copy;
@@ -2090,6 +2096,15 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2090 return elt; 2096 return elt;
2091} 2097}
2092 2098
2099int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
2100{
2101 int nsg = __skb_to_sgvec(skb, sg, offset, len);
2102
2103 sg_mark_end(&sg[nsg - 1]);
2104
2105 return nsg;
2106}
2107
2093/** 2108/**
2094 * skb_cow_data - Check that a socket buffer's data buffers are writable 2109 * skb_cow_data - Check that a socket buffer's data buffers are writable
2095 * @skb: The socket buffer to check. 2110 * @skb: The socket buffer to check.
diff --git a/net/core/sock.c b/net/core/sock.c
index bba9949681ff..c519b439b8b1 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);
@@ -1764,11 +1801,65 @@ EXPORT_SYMBOL(sk_common_release);
1764static DEFINE_RWLOCK(proto_list_lock); 1801static DEFINE_RWLOCK(proto_list_lock);
1765static LIST_HEAD(proto_list); 1802static LIST_HEAD(proto_list);
1766 1803
1804#ifdef CONFIG_SMP
1805/*
1806 * Define default functions to keep track of inuse sockets per protocol
1807 * Note that often used protocols use dedicated functions to get a speed increase.
1808 * (see DEFINE_PROTO_INUSE/REF_PROTO_INUSE)
1809 */
1810static void inuse_add(struct proto *prot, int inc)
1811{
1812 per_cpu_ptr(prot->inuse_ptr, smp_processor_id())[0] += inc;
1813}
1814
1815static int inuse_get(const struct proto *prot)
1816{
1817 int res = 0, cpu;
1818 for_each_possible_cpu(cpu)
1819 res += per_cpu_ptr(prot->inuse_ptr, cpu)[0];
1820 return res;
1821}
1822
1823static int inuse_init(struct proto *prot)
1824{
1825 if (!prot->inuse_getval || !prot->inuse_add) {
1826 prot->inuse_ptr = alloc_percpu(int);
1827 if (prot->inuse_ptr == NULL)
1828 return -ENOBUFS;
1829
1830 prot->inuse_getval = inuse_get;
1831 prot->inuse_add = inuse_add;
1832 }
1833 return 0;
1834}
1835
1836static void inuse_fini(struct proto *prot)
1837{
1838 if (prot->inuse_ptr != NULL) {
1839 free_percpu(prot->inuse_ptr);
1840 prot->inuse_ptr = NULL;
1841 prot->inuse_getval = NULL;
1842 prot->inuse_add = NULL;
1843 }
1844}
1845#else
1846static inline int inuse_init(struct proto *prot)
1847{
1848 return 0;
1849}
1850
1851static inline void inuse_fini(struct proto *prot)
1852{
1853}
1854#endif
1855
1767int proto_register(struct proto *prot, int alloc_slab) 1856int proto_register(struct proto *prot, int alloc_slab)
1768{ 1857{
1769 char *request_sock_slab_name = NULL; 1858 char *request_sock_slab_name = NULL;
1770 char *timewait_sock_slab_name; 1859 char *timewait_sock_slab_name;
1771 int rc = -ENOBUFS; 1860
1861 if (inuse_init(prot))
1862 goto out;
1772 1863
1773 if (alloc_slab) { 1864 if (alloc_slab) {
1774 prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0, 1865 prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,
@@ -1777,7 +1868,7 @@ int proto_register(struct proto *prot, int alloc_slab)
1777 if (prot->slab == NULL) { 1868 if (prot->slab == NULL) {
1778 printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", 1869 printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n",
1779 prot->name); 1870 prot->name);
1780 goto out; 1871 goto out_free_inuse;
1781 } 1872 }
1782 1873
1783 if (prot->rsk_prot != NULL) { 1874 if (prot->rsk_prot != NULL) {
@@ -1821,9 +1912,8 @@ int proto_register(struct proto *prot, int alloc_slab)
1821 write_lock(&proto_list_lock); 1912 write_lock(&proto_list_lock);
1822 list_add(&prot->node, &proto_list); 1913 list_add(&prot->node, &proto_list);
1823 write_unlock(&proto_list_lock); 1914 write_unlock(&proto_list_lock);
1824 rc = 0; 1915 return 0;
1825out: 1916
1826 return rc;
1827out_free_timewait_sock_slab_name: 1917out_free_timewait_sock_slab_name:
1828 kfree(timewait_sock_slab_name); 1918 kfree(timewait_sock_slab_name);
1829out_free_request_sock_slab: 1919out_free_request_sock_slab:
@@ -1836,7 +1926,10 @@ out_free_request_sock_slab_name:
1836out_free_sock_slab: 1926out_free_sock_slab:
1837 kmem_cache_destroy(prot->slab); 1927 kmem_cache_destroy(prot->slab);
1838 prot->slab = NULL; 1928 prot->slab = NULL;
1839 goto out; 1929out_free_inuse:
1930 inuse_fini(prot);
1931out:
1932 return -ENOBUFS;
1840} 1933}
1841 1934
1842EXPORT_SYMBOL(proto_register); 1935EXPORT_SYMBOL(proto_register);
@@ -1847,6 +1940,7 @@ void proto_unregister(struct proto *prot)
1847 list_del(&prot->node); 1940 list_del(&prot->node);
1848 write_unlock(&proto_list_lock); 1941 write_unlock(&proto_list_lock);
1849 1942
1943 inuse_fini(prot);
1850 if (prot->slab != NULL) { 1944 if (prot->slab != NULL) {
1851 kmem_cache_destroy(prot->slab); 1945 kmem_cache_destroy(prot->slab);
1852 prot->slab = NULL; 1946 prot->slab = NULL;
@@ -2003,7 +2097,3 @@ EXPORT_SYMBOL(sock_wmalloc);
2003EXPORT_SYMBOL(sock_i_uid); 2097EXPORT_SYMBOL(sock_i_uid);
2004EXPORT_SYMBOL(sock_i_ino); 2098EXPORT_SYMBOL(sock_i_ino);
2005EXPORT_SYMBOL(sysctl_optmem_max); 2099EXPORT_SYMBOL(sysctl_optmem_max);
2006#ifdef CONFIG_SYSCTL
2007EXPORT_SYMBOL(sysctl_rmem_max);
2008EXPORT_SYMBOL(sysctl_wmem_max);
2009#endif
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c
index 40ad428a27f5..d26b88dbbb45 100644
--- a/net/dccp/ccids/lib/loss_interval.c
+++ b/net/dccp/ccids/lib/loss_interval.c
@@ -166,7 +166,7 @@ static u32 dccp_li_calc_first_li(struct sock *sk,
166 } 166 }
167 167
168 if (unlikely(interval == 0)) { 168 if (unlikely(interval == 0)) {
169 DCCP_WARN("%s(%p), Could not find a win_count interval > 0." 169 DCCP_WARN("%s(%p), Could not find a win_count interval > 0. "
170 "Defaulting to 1\n", dccp_role(sk), sk); 170 "Defaulting to 1\n", dccp_role(sk), sk);
171 interval = 1; 171 interval = 1;
172 } 172 }
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 01a6a808bdb7..db17b83e8d3e 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -922,6 +922,8 @@ static struct timewait_sock_ops dccp_timewait_sock_ops = {
922 .twsk_obj_size = sizeof(struct inet_timewait_sock), 922 .twsk_obj_size = sizeof(struct inet_timewait_sock),
923}; 923};
924 924
925DEFINE_PROTO_INUSE(dccp_v4)
926
925static struct proto dccp_v4_prot = { 927static struct proto dccp_v4_prot = {
926 .name = "DCCP", 928 .name = "DCCP",
927 .owner = THIS_MODULE, 929 .owner = THIS_MODULE,
@@ -950,6 +952,7 @@ static struct proto dccp_v4_prot = {
950 .compat_setsockopt = compat_dccp_setsockopt, 952 .compat_setsockopt = compat_dccp_setsockopt,
951 .compat_getsockopt = compat_dccp_getsockopt, 953 .compat_getsockopt = compat_dccp_getsockopt,
952#endif 954#endif
955 REF_PROTO_INUSE(dccp_v4)
953}; 956};
954 957
955static struct net_protocol dccp_v4_protocol = { 958static struct net_protocol dccp_v4_protocol = {
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 62428ff137dd..87c98fb86fa8 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -1107,6 +1107,8 @@ static struct timewait_sock_ops dccp6_timewait_sock_ops = {
1107 .twsk_obj_size = sizeof(struct dccp6_timewait_sock), 1107 .twsk_obj_size = sizeof(struct dccp6_timewait_sock),
1108}; 1108};
1109 1109
1110DEFINE_PROTO_INUSE(dccp_v6)
1111
1110static struct proto dccp_v6_prot = { 1112static struct proto dccp_v6_prot = {
1111 .name = "DCCPv6", 1113 .name = "DCCPv6",
1112 .owner = THIS_MODULE, 1114 .owner = THIS_MODULE,
@@ -1135,6 +1137,7 @@ static struct proto dccp_v6_prot = {
1135 .compat_setsockopt = compat_dccp_setsockopt, 1137 .compat_setsockopt = compat_dccp_setsockopt,
1136 .compat_getsockopt = compat_dccp_getsockopt, 1138 .compat_getsockopt = compat_dccp_getsockopt,
1137#endif 1139#endif
1140 REF_PROTO_INUSE(dccp_v6)
1138}; 1141};
1139 1142
1140static struct inet6_protocol dccp_v6_protocol = { 1143static struct inet6_protocol dccp_v6_protocol = {
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index d84973928033..7a3bea9c28c1 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -1072,11 +1072,13 @@ static int __init dccp_init(void)
1072 } 1072 }
1073 1073
1074 for (i = 0; i < dccp_hashinfo.ehash_size; i++) { 1074 for (i = 0; i < dccp_hashinfo.ehash_size; i++) {
1075 rwlock_init(&dccp_hashinfo.ehash[i].lock);
1076 INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].chain); 1075 INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].chain);
1077 INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].twchain); 1076 INIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].twchain);
1078 } 1077 }
1079 1078
1079 if (inet_ehash_locks_alloc(&dccp_hashinfo))
1080 goto out_free_dccp_ehash;
1081
1080 bhash_order = ehash_order; 1082 bhash_order = ehash_order;
1081 1083
1082 do { 1084 do {
@@ -1091,7 +1093,7 @@ static int __init dccp_init(void)
1091 1093
1092 if (!dccp_hashinfo.bhash) { 1094 if (!dccp_hashinfo.bhash) {
1093 DCCP_CRIT("Failed to allocate DCCP bind hash table"); 1095 DCCP_CRIT("Failed to allocate DCCP bind hash table");
1094 goto out_free_dccp_ehash; 1096 goto out_free_dccp_locks;
1095 } 1097 }
1096 1098
1097 for (i = 0; i < dccp_hashinfo.bhash_size; i++) { 1099 for (i = 0; i < dccp_hashinfo.bhash_size; i++) {
@@ -1121,6 +1123,8 @@ out_free_dccp_mib:
1121out_free_dccp_bhash: 1123out_free_dccp_bhash:
1122 free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order); 1124 free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order);
1123 dccp_hashinfo.bhash = NULL; 1125 dccp_hashinfo.bhash = NULL;
1126out_free_dccp_locks:
1127 inet_ehash_locks_free(&dccp_hashinfo);
1124out_free_dccp_ehash: 1128out_free_dccp_ehash:
1125 free_pages((unsigned long)dccp_hashinfo.ehash, ehash_order); 1129 free_pages((unsigned long)dccp_hashinfo.ehash, ehash_order);
1126 dccp_hashinfo.ehash = NULL; 1130 dccp_hashinfo.ehash = NULL;
@@ -1139,6 +1143,7 @@ static void __exit dccp_fini(void)
1139 free_pages((unsigned long)dccp_hashinfo.ehash, 1143 free_pages((unsigned long)dccp_hashinfo.ehash,
1140 get_order(dccp_hashinfo.ehash_size * 1144 get_order(dccp_hashinfo.ehash_size *
1141 sizeof(struct inet_ehash_bucket))); 1145 sizeof(struct inet_ehash_bucket)));
1146 inet_ehash_locks_free(&dccp_hashinfo);
1142 kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); 1147 kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep);
1143 dccp_ackvec_exit(); 1148 dccp_ackvec_exit();
1144 dccp_sysctl_exit(); 1149 dccp_sysctl_exit();
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/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 26130afd8029..66e266fb5908 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -1439,7 +1439,7 @@ static const struct file_operations dn_dev_seq_fops = {
1439 1439
1440#endif /* CONFIG_PROC_FS */ 1440#endif /* CONFIG_PROC_FS */
1441 1441
1442static int __initdata addr[2]; 1442static int addr[2];
1443module_param_array(addr, int, NULL, 0444); 1443module_param_array(addr, int, NULL, 0444);
1444MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); 1444MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node");
1445 1445
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 97eee5e8fbbe..66663e5d7acd 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -293,9 +293,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
293 dn_rt_hash_table[hash].chain); 293 dn_rt_hash_table[hash].chain);
294 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); 294 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth);
295 295
296 rth->u.dst.__use++; 296 dst_use(&rth->u.dst, now);
297 dst_hold(&rth->u.dst);
298 rth->u.dst.lastuse = now;
299 spin_unlock_bh(&dn_rt_hash_table[hash].lock); 297 spin_unlock_bh(&dn_rt_hash_table[hash].lock);
300 298
301 dnrt_drop(rt); 299 dnrt_drop(rt);
@@ -308,9 +306,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
308 rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain); 306 rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain);
309 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); 307 rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
310 308
311 dst_hold(&rt->u.dst); 309 dst_use(&rt->u.dst, now);
312 rt->u.dst.__use++;
313 rt->u.dst.lastuse = now;
314 spin_unlock_bh(&dn_rt_hash_table[hash].lock); 310 spin_unlock_bh(&dn_rt_hash_table[hash].lock);
315 *rp = rt; 311 *rp = rt;
316 return 0; 312 return 0;
@@ -1182,9 +1178,7 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
1182 (flp->mark == rt->fl.mark) && 1178 (flp->mark == rt->fl.mark) &&
1183 (rt->fl.iif == 0) && 1179 (rt->fl.iif == 0) &&
1184 (rt->fl.oif == flp->oif)) { 1180 (rt->fl.oif == flp->oif)) {
1185 rt->u.dst.lastuse = jiffies; 1181 dst_use(&rt->u.dst, jiffies);
1186 dst_hold(&rt->u.dst);
1187 rt->u.dst.__use++;
1188 rcu_read_unlock_bh(); 1182 rcu_read_unlock_bh();
1189 *pprt = &rt->u.dst; 1183 *pprt = &rt->u.dst;
1190 return 0; 1184 return 0;
@@ -1456,9 +1450,7 @@ int dn_route_input(struct sk_buff *skb)
1456 (rt->fl.oif == 0) && 1450 (rt->fl.oif == 0) &&
1457 (rt->fl.mark == skb->mark) && 1451 (rt->fl.mark == skb->mark) &&
1458 (rt->fl.iif == cb->iif)) { 1452 (rt->fl.iif == cb->iif)) {
1459 rt->u.dst.lastuse = jiffies; 1453 dst_use(&rt->u.dst, jiffies);
1460 dst_hold(&rt->u.dst);
1461 rt->u.dst.__use++;
1462 rcu_read_unlock(); 1454 rcu_read_unlock();
1463 skb->dst = (struct dst_entry *)rt; 1455 skb->dst = (struct dst_entry *)rt;
1464 return 0; 1456 return 0;
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index ddd3f04f0919..ffebea04cc99 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -48,15 +48,6 @@ struct dn_fib_rule
48 u8 flags; 48 u8 flags;
49}; 49};
50 50
51static struct dn_fib_rule default_rule = {
52 .common = {
53 .refcnt = ATOMIC_INIT(2),
54 .pref = 0x7fff,
55 .table = RT_TABLE_MAIN,
56 .action = FR_ACT_TO_TBL,
57 },
58};
59
60 51
61int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res) 52int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res)
62{ 53{
@@ -262,8 +253,8 @@ static struct fib_rules_ops dn_fib_rules_ops = {
262 253
263void __init dn_fib_rules_init(void) 254void __init dn_fib_rules_init(void)
264{ 255{
265 list_add_tail(&default_rule.common.list, 256 BUG_ON(fib_default_rule_add(&dn_fib_rules_ops, 0x7fff,
266 &dn_fib_rules_ops.rules_list); 257 RT_TABLE_MAIN, 0));
267 fib_rules_register(&dn_fib_rules_ops); 258 fib_rules_register(&dn_fib_rules_ops);
268} 259}
269 260
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/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c
index 0936a3e0210b..208bf35b5546 100644
--- a/net/ieee80211/ieee80211_crypt_ccmp.c
+++ b/net/ieee80211/ieee80211_crypt_ccmp.c
@@ -25,7 +25,6 @@
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>
29 28
30MODULE_AUTHOR("Jouni Malinen"); 29MODULE_AUTHOR("Jouni Malinen");
31MODULE_DESCRIPTION("Host AP crypt: CCMP"); 30MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -339,7 +338,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
339 pos += 8; 338 pos += 8;
340 339
341 if (ccmp_replay_check(pn, key->rx_pn)) { 340 if (ccmp_replay_check(pn, key->rx_pn)) {
342 if (net_ratelimit()) { 341 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
343 IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%s " 342 IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%s "
344 "previous PN %02x%02x%02x%02x%02x%02x " 343 "previous PN %02x%02x%02x%02x%02x%02x "
345 "received PN %02x%02x%02x%02x%02x%02x\n", 344 "received PN %02x%02x%02x%02x%02x%02x\n",
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index 4cce3534e408..8e146949fc6f 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -25,7 +25,6 @@
25#include <net/ieee80211.h> 25#include <net/ieee80211.h>
26 26
27#include <linux/crypto.h> 27#include <linux/crypto.h>
28#include <linux/scatterlist.h>
29#include <linux/crc32.h> 28#include <linux/crc32.h>
30 29
31MODULE_AUTHOR("Jouni Malinen"); 30MODULE_AUTHOR("Jouni Malinen");
@@ -465,7 +464,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
465 pos += 8; 464 pos += 8;
466 465
467 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { 466 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) {
468 if (net_ratelimit()) { 467 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
469 IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%s" 468 IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%s"
470 " previous TSC %08x%04x received TSC " 469 " previous TSC %08x%04x received TSC "
471 "%08x%04x\n", print_mac(mac, hdr->addr2), 470 "%08x%04x\n", print_mac(mac, hdr->addr2),
@@ -505,7 +504,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
505 * it needs to be recalculated for the next packet. */ 504 * it needs to be recalculated for the next packet. */
506 tkey->rx_phase1_done = 0; 505 tkey->rx_phase1_done = 0;
507 } 506 }
508 if (net_ratelimit()) { 507 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
509 IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA=" 508 IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA="
510 "%s\n", print_mac(mac, hdr->addr2)); 509 "%s\n", print_mac(mac, hdr->addr2));
511 } 510 }
diff --git a/net/ieee80211/ieee80211_crypt_wep.c b/net/ieee80211/ieee80211_crypt_wep.c
index 866fc04c44f9..3fa30c40779f 100644
--- a/net/ieee80211/ieee80211_crypt_wep.c
+++ b/net/ieee80211/ieee80211_crypt_wep.c
@@ -22,7 +22,6 @@
22#include <net/ieee80211.h> 22#include <net/ieee80211.h>
23 23
24#include <linux/crypto.h> 24#include <linux/crypto.h>
25#include <linux/scatterlist.h>
26#include <linux/crc32.h> 25#include <linux/crc32.h>
27 26
28MODULE_AUTHOR("Jouni Malinen"); 27MODULE_AUTHOR("Jouni Malinen");
diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c
index ac36767b56e8..e01b59aedc54 100644
--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -470,7 +470,7 @@ ieee80211softmac_wx_set_mlme(struct net_device *dev,
470{ 470{
471 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 471 struct ieee80211softmac_device *mac = ieee80211_priv(dev);
472 struct iw_mlme *mlme = (struct iw_mlme *)extra; 472 struct iw_mlme *mlme = (struct iw_mlme *)extra;
473 u16 reason = cpu_to_le16(mlme->reason_code); 473 u16 reason = mlme->reason_code;
474 struct ieee80211softmac_network *net; 474 struct ieee80211softmac_network *net;
475 int err = -EINVAL; 475 int err = -EINVAL;
476 476
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/ah4.c b/net/ipv4/ah4.c
index 4e8e3b079f5b..5fc346d8b566 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -8,7 +8,6 @@
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <net/icmp.h> 9#include <net/icmp.h>
10#include <net/protocol.h> 10#include <net/protocol.h>
11#include <asm/scatterlist.h>
12 11
13 12
14/* Clear mutable options and find final destination to substitute 13/* Clear mutable options and find final destination to substitute
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 36d6798947b5..b3f366a33a5c 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -111,12 +111,8 @@
111#include <net/tcp.h> 111#include <net/tcp.h>
112#include <net/sock.h> 112#include <net/sock.h>
113#include <net/arp.h> 113#include <net/arp.h>
114#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
115#include <net/ax25.h> 114#include <net/ax25.h>
116#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
117#include <net/netrom.h> 115#include <net/netrom.h>
118#endif
119#endif
120#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) 116#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
121#include <net/atmclip.h> 117#include <net/atmclip.h>
122struct neigh_table *clip_tbl_hook; 118struct neigh_table *clip_tbl_hook;
@@ -731,20 +727,10 @@ static int arp_process(struct sk_buff *skb)
731 htons(dev_type) != arp->ar_hrd) 727 htons(dev_type) != arp->ar_hrd)
732 goto out; 728 goto out;
733 break; 729 break;
734#ifdef CONFIG_NET_ETHERNET
735 case ARPHRD_ETHER: 730 case ARPHRD_ETHER:
736#endif
737#ifdef CONFIG_TR
738 case ARPHRD_IEEE802_TR: 731 case ARPHRD_IEEE802_TR:
739#endif
740#ifdef CONFIG_FDDI
741 case ARPHRD_FDDI: 732 case ARPHRD_FDDI:
742#endif
743#ifdef CONFIG_NET_FC
744 case ARPHRD_IEEE802: 733 case ARPHRD_IEEE802:
745#endif
746#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_TR) || \
747 defined(CONFIG_FDDI) || defined(CONFIG_NET_FC)
748 /* 734 /*
749 * ETHERNET, Token Ring and Fibre Channel (which are IEEE 802 735 * ETHERNET, Token Ring and Fibre Channel (which are IEEE 802
750 * devices, according to RFC 2625) devices will accept ARP 736 * devices, according to RFC 2625) devices will accept ARP
@@ -759,21 +745,16 @@ static int arp_process(struct sk_buff *skb)
759 arp->ar_pro != htons(ETH_P_IP)) 745 arp->ar_pro != htons(ETH_P_IP))
760 goto out; 746 goto out;
761 break; 747 break;
762#endif
763#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
764 case ARPHRD_AX25: 748 case ARPHRD_AX25:
765 if (arp->ar_pro != htons(AX25_P_IP) || 749 if (arp->ar_pro != htons(AX25_P_IP) ||
766 arp->ar_hrd != htons(ARPHRD_AX25)) 750 arp->ar_hrd != htons(ARPHRD_AX25))
767 goto out; 751 goto out;
768 break; 752 break;
769#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
770 case ARPHRD_NETROM: 753 case ARPHRD_NETROM:
771 if (arp->ar_pro != htons(AX25_P_IP) || 754 if (arp->ar_pro != htons(AX25_P_IP) ||
772 arp->ar_hrd != htons(ARPHRD_NETROM)) 755 arp->ar_hrd != htons(ARPHRD_NETROM))
773 goto out; 756 goto out;
774 break; 757 break;
775#endif
776#endif
777 } 758 }
778 759
779 /* Understand only these message types */ 760 /* Understand only these message types */
@@ -828,7 +809,8 @@ static int arp_process(struct sk_buff *skb)
828 if (arp->ar_op == htons(ARPOP_REQUEST) && 809 if (arp->ar_op == htons(ARPOP_REQUEST) &&
829 inet_addr_type(tip) == RTN_LOCAL && 810 inet_addr_type(tip) == RTN_LOCAL &&
830 !arp_ignore(in_dev,dev,sip,tip)) 811 !arp_ignore(in_dev,dev,sip,tip))
831 arp_send(ARPOP_REPLY,ETH_P_ARP,tip,dev,tip,sha,dev->dev_addr,dev->dev_addr); 812 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
813 dev->dev_addr, sha);
832 goto out; 814 goto out;
833 } 815 }
834 816
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index cad4278025ad..c31bccb9b526 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -111,9 +111,10 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
111 goto unlock; 111 goto unlock;
112 } 112 }
113 sg_init_table(sg, nfrags); 113 sg_init_table(sg, nfrags);
114 sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data + 114 skb_to_sgvec(skb, sg,
115 esp->conf.ivlen - 115 esph->enc_data +
116 skb->data, clen)); 116 esp->conf.ivlen -
117 skb->data, clen);
117 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); 118 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
118 if (unlikely(sg != &esp->sgbuf[0])) 119 if (unlikely(sg != &esp->sgbuf[0]))
119 kfree(sg); 120 kfree(sg);
@@ -205,8 +206,9 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
205 goto out; 206 goto out;
206 } 207 }
207 sg_init_table(sg, nfrags); 208 sg_init_table(sg, nfrags);
208 sg_mark_end(sg, skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, 209 skb_to_sgvec(skb, sg,
209 elen)); 210 sizeof(*esph) + esp->conf.ivlen,
211 elen);
210 err = crypto_blkcipher_decrypt(&desc, sg, sg, elen); 212 err = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
211 if (unlikely(sg != &esp->sgbuf[0])) 213 if (unlikely(sg != &esp->sgbuf[0]))
212 kfree(sg); 214 kfree(sg);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 60123905dbbf..732d8f088b13 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -59,6 +59,13 @@ struct fib_table *ip_fib_main_table;
59#define FIB_TABLE_HASHSZ 1 59#define FIB_TABLE_HASHSZ 1
60static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; 60static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ];
61 61
62static void __init fib4_rules_init(void)
63{
64 ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL);
65 hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]);
66 ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN);
67 hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]);
68}
62#else 69#else
63 70
64#define FIB_TABLE_HASHSZ 256 71#define FIB_TABLE_HASHSZ 256
@@ -905,14 +912,8 @@ void __init ip_fib_init(void)
905 912
906 for (i = 0; i < FIB_TABLE_HASHSZ; i++) 913 for (i = 0; i < FIB_TABLE_HASHSZ; i++)
907 INIT_HLIST_HEAD(&fib_table_hash[i]); 914 INIT_HLIST_HEAD(&fib_table_hash[i]);
908#ifndef CONFIG_IP_MULTIPLE_TABLES 915
909 ip_fib_local_table = fib_hash_init(RT_TABLE_LOCAL);
910 hlist_add_head_rcu(&ip_fib_local_table->tb_hlist, &fib_table_hash[0]);
911 ip_fib_main_table = fib_hash_init(RT_TABLE_MAIN);
912 hlist_add_head_rcu(&ip_fib_main_table->tb_hlist, &fib_table_hash[0]);
913#else
914 fib4_rules_init(); 916 fib4_rules_init();
915#endif
916 917
917 register_netdevice_notifier(&fib_netdev_notifier); 918 register_netdevice_notifier(&fib_netdev_notifier);
918 register_inetaddr_notifier(&fib_inetaddr_notifier); 919 register_inetaddr_notifier(&fib_inetaddr_notifier);
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index f16839c6a721..a0ada3a8d8dd 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -49,33 +49,6 @@ struct fib4_rule
49#endif 49#endif
50}; 50};
51 51
52static struct fib4_rule default_rule = {
53 .common = {
54 .refcnt = ATOMIC_INIT(2),
55 .pref = 0x7FFF,
56 .table = RT_TABLE_DEFAULT,
57 .action = FR_ACT_TO_TBL,
58 },
59};
60
61static struct fib4_rule main_rule = {
62 .common = {
63 .refcnt = ATOMIC_INIT(2),
64 .pref = 0x7FFE,
65 .table = RT_TABLE_MAIN,
66 .action = FR_ACT_TO_TBL,
67 },
68};
69
70static struct fib4_rule local_rule = {
71 .common = {
72 .refcnt = ATOMIC_INIT(2),
73 .table = RT_TABLE_LOCAL,
74 .action = FR_ACT_TO_TBL,
75 .flags = FIB_RULE_PERMANENT,
76 },
77};
78
79#ifdef CONFIG_NET_CLS_ROUTE 52#ifdef CONFIG_NET_CLS_ROUTE
80u32 fib_rules_tclass(struct fib_result *res) 53u32 fib_rules_tclass(struct fib_result *res)
81{ 54{
@@ -319,11 +292,27 @@ static struct fib_rules_ops fib4_rules_ops = {
319 .owner = THIS_MODULE, 292 .owner = THIS_MODULE,
320}; 293};
321 294
322void __init fib4_rules_init(void) 295static int __init fib_default_rules_init(void)
323{ 296{
324 list_add_tail(&local_rule.common.list, &fib4_rules_ops.rules_list); 297 int err;
325 list_add_tail(&main_rule.common.list, &fib4_rules_ops.rules_list); 298
326 list_add_tail(&default_rule.common.list, &fib4_rules_ops.rules_list); 299 err = fib_default_rule_add(&fib4_rules_ops, 0,
300 RT_TABLE_LOCAL, FIB_RULE_PERMANENT);
301 if (err < 0)
302 return err;
303 err = fib_default_rule_add(&fib4_rules_ops, 0x7FFE,
304 RT_TABLE_MAIN, 0);
305 if (err < 0)
306 return err;
307 err = fib_default_rule_add(&fib4_rules_ops, 0x7FFF,
308 RT_TABLE_DEFAULT, 0);
309 if (err < 0)
310 return err;
311 return 0;
312}
327 313
314void __init fib4_rules_init(void)
315{
316 BUG_ON(fib_default_rules_init());
328 fib_rules_register(&fib4_rules_ops); 317 fib_rules_register(&fib4_rules_ops);
329} 318}
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index dc429b6b0ba6..b0170732b5e9 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -747,13 +747,14 @@ skip_listen_ht:
747 747
748 for (i = s_i; i < hashinfo->ehash_size; i++) { 748 for (i = s_i; i < hashinfo->ehash_size; i++) {
749 struct inet_ehash_bucket *head = &hashinfo->ehash[i]; 749 struct inet_ehash_bucket *head = &hashinfo->ehash[i];
750 rwlock_t *lock = inet_ehash_lockp(hashinfo, i);
750 struct sock *sk; 751 struct sock *sk;
751 struct hlist_node *node; 752 struct hlist_node *node;
752 753
753 if (i > s_i) 754 if (i > s_i)
754 s_num = 0; 755 s_num = 0;
755 756
756 read_lock_bh(&head->lock); 757 read_lock_bh(lock);
757 num = 0; 758 num = 0;
758 sk_for_each(sk, node, &head->chain) { 759 sk_for_each(sk, node, &head->chain) {
759 struct inet_sock *inet = inet_sk(sk); 760 struct inet_sock *inet = inet_sk(sk);
@@ -769,7 +770,7 @@ skip_listen_ht:
769 r->id.idiag_dport) 770 r->id.idiag_dport)
770 goto next_normal; 771 goto next_normal;
771 if (inet_csk_diag_dump(sk, skb, cb) < 0) { 772 if (inet_csk_diag_dump(sk, skb, cb) < 0) {
772 read_unlock_bh(&head->lock); 773 read_unlock_bh(lock);
773 goto done; 774 goto done;
774 } 775 }
775next_normal: 776next_normal:
@@ -791,14 +792,14 @@ next_normal:
791 r->id.idiag_dport) 792 r->id.idiag_dport)
792 goto next_dying; 793 goto next_dying;
793 if (inet_twsk_diag_dump(tw, skb, cb) < 0) { 794 if (inet_twsk_diag_dump(tw, skb, cb) < 0) {
794 read_unlock_bh(&head->lock); 795 read_unlock_bh(lock);
795 goto done; 796 goto done;
796 } 797 }
797next_dying: 798next_dying:
798 ++num; 799 ++num;
799 } 800 }
800 } 801 }
801 read_unlock_bh(&head->lock); 802 read_unlock_bh(lock);
802 } 803 }
803 804
804done: 805done:
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 16eecc7046a3..67704da04fc4 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -204,12 +204,13 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,
204 const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); 204 const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport);
205 unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport); 205 unsigned int hash = inet_ehashfn(daddr, lport, saddr, inet->dport);
206 struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); 206 struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash);
207 rwlock_t *lock = inet_ehash_lockp(hinfo, hash);
207 struct sock *sk2; 208 struct sock *sk2;
208 const struct hlist_node *node; 209 const struct hlist_node *node;
209 struct inet_timewait_sock *tw; 210 struct inet_timewait_sock *tw;
210 211
211 prefetch(head->chain.first); 212 prefetch(head->chain.first);
212 write_lock(&head->lock); 213 write_lock(lock);
213 214
214 /* Check TIME-WAIT sockets first. */ 215 /* Check TIME-WAIT sockets first. */
215 sk_for_each(sk2, node, &head->twchain) { 216 sk_for_each(sk2, node, &head->twchain) {
@@ -239,7 +240,7 @@ unique:
239 BUG_TRAP(sk_unhashed(sk)); 240 BUG_TRAP(sk_unhashed(sk));
240 __sk_add_node(sk, &head->chain); 241 __sk_add_node(sk, &head->chain);
241 sock_prot_inc_use(sk->sk_prot); 242 sock_prot_inc_use(sk->sk_prot);
242 write_unlock(&head->lock); 243 write_unlock(lock);
243 244
244 if (twp) { 245 if (twp) {
245 *twp = tw; 246 *twp = tw;
@@ -255,7 +256,7 @@ unique:
255 return 0; 256 return 0;
256 257
257not_unique: 258not_unique:
258 write_unlock(&head->lock); 259 write_unlock(lock);
259 return -EADDRNOTAVAIL; 260 return -EADDRNOTAVAIL;
260} 261}
261 262
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 4e189e28f306..a60b99e0ebdc 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -20,16 +20,16 @@ static void __inet_twsk_kill(struct inet_timewait_sock *tw,
20 struct inet_bind_hashbucket *bhead; 20 struct inet_bind_hashbucket *bhead;
21 struct inet_bind_bucket *tb; 21 struct inet_bind_bucket *tb;
22 /* Unlink from established hashes. */ 22 /* Unlink from established hashes. */
23 struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, tw->tw_hash); 23 rwlock_t *lock = inet_ehash_lockp(hashinfo, tw->tw_hash);
24 24
25 write_lock(&ehead->lock); 25 write_lock(lock);
26 if (hlist_unhashed(&tw->tw_node)) { 26 if (hlist_unhashed(&tw->tw_node)) {
27 write_unlock(&ehead->lock); 27 write_unlock(lock);
28 return; 28 return;
29 } 29 }
30 __hlist_del(&tw->tw_node); 30 __hlist_del(&tw->tw_node);
31 sk_node_init(&tw->tw_node); 31 sk_node_init(&tw->tw_node);
32 write_unlock(&ehead->lock); 32 write_unlock(lock);
33 33
34 /* Disassociate with bind bucket. */ 34 /* Disassociate with bind bucket. */
35 bhead = &hashinfo->bhash[inet_bhashfn(tw->tw_num, hashinfo->bhash_size)]; 35 bhead = &hashinfo->bhash[inet_bhashfn(tw->tw_num, hashinfo->bhash_size)];
@@ -59,6 +59,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
59 const struct inet_sock *inet = inet_sk(sk); 59 const struct inet_sock *inet = inet_sk(sk);
60 const struct inet_connection_sock *icsk = inet_csk(sk); 60 const struct inet_connection_sock *icsk = inet_csk(sk);
61 struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, sk->sk_hash); 61 struct inet_ehash_bucket *ehead = inet_ehash_bucket(hashinfo, sk->sk_hash);
62 rwlock_t *lock = inet_ehash_lockp(hashinfo, sk->sk_hash);
62 struct inet_bind_hashbucket *bhead; 63 struct inet_bind_hashbucket *bhead;
63 /* Step 1: Put TW into bind hash. Original socket stays there too. 64 /* Step 1: Put TW into bind hash. Original socket stays there too.
64 Note, that any socket with inet->num != 0 MUST be bound in 65 Note, that any socket with inet->num != 0 MUST be bound in
@@ -71,7 +72,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
71 inet_twsk_add_bind_node(tw, &tw->tw_tb->owners); 72 inet_twsk_add_bind_node(tw, &tw->tw_tb->owners);
72 spin_unlock(&bhead->lock); 73 spin_unlock(&bhead->lock);
73 74
74 write_lock(&ehead->lock); 75 write_lock(lock);
75 76
76 /* Step 2: Remove SK from established hash. */ 77 /* Step 2: Remove SK from established hash. */
77 if (__sk_del_node_init(sk)) 78 if (__sk_del_node_init(sk))
@@ -81,7 +82,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
81 inet_twsk_add_node(tw, &ehead->twchain); 82 inet_twsk_add_node(tw, &ehead->twchain);
82 atomic_inc(&tw->tw_refcnt); 83 atomic_inc(&tw->tw_refcnt);
83 84
84 write_unlock(&ehead->lock); 85 write_unlock(lock);
85} 86}
86 87
87EXPORT_SYMBOL_GPL(__inet_twsk_hashdance); 88EXPORT_SYMBOL_GPL(__inet_twsk_hashdance);
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 771031dfbd0f..af995198f643 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -61,7 +61,7 @@
61 * 4. Global variable peer_total is modified under the pool lock. 61 * 4. Global variable peer_total is modified under the pool lock.
62 * 5. struct inet_peer fields modification: 62 * 5. struct inet_peer fields modification:
63 * avl_left, avl_right, avl_parent, avl_height: pool lock 63 * avl_left, avl_right, avl_parent, avl_height: pool lock
64 * unused_next, unused_prevp: unused node list lock 64 * unused: unused node list lock
65 * refcnt: atomically against modifications on other CPU; 65 * refcnt: atomically against modifications on other CPU;
66 * usually under some other lock to prevent node disappearing 66 * usually under some other lock to prevent node disappearing
67 * dtime: unused node list lock 67 * dtime: unused node list lock
@@ -94,8 +94,7 @@ int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min
94int inet_peer_gc_mintime __read_mostly = 10 * HZ; 94int inet_peer_gc_mintime __read_mostly = 10 * HZ;
95int inet_peer_gc_maxtime __read_mostly = 120 * HZ; 95int inet_peer_gc_maxtime __read_mostly = 120 * HZ;
96 96
97static struct inet_peer *inet_peer_unused_head; 97static LIST_HEAD(unused_peers);
98static struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head;
99static DEFINE_SPINLOCK(inet_peer_unused_lock); 98static DEFINE_SPINLOCK(inet_peer_unused_lock);
100 99
101static void peer_check_expire(unsigned long dummy); 100static void peer_check_expire(unsigned long dummy);
@@ -138,15 +137,7 @@ void __init inet_initpeers(void)
138static void unlink_from_unused(struct inet_peer *p) 137static void unlink_from_unused(struct inet_peer *p)
139{ 138{
140 spin_lock_bh(&inet_peer_unused_lock); 139 spin_lock_bh(&inet_peer_unused_lock);
141 if (p->unused_prevp != NULL) { 140 list_del_init(&p->unused);
142 /* On unused list. */
143 *p->unused_prevp = p->unused_next;
144 if (p->unused_next != NULL)
145 p->unused_next->unused_prevp = p->unused_prevp;
146 else
147 inet_peer_unused_tailp = p->unused_prevp;
148 p->unused_prevp = NULL; /* mark it as removed */
149 }
150 spin_unlock_bh(&inet_peer_unused_lock); 141 spin_unlock_bh(&inet_peer_unused_lock);
151} 142}
152 143
@@ -337,24 +328,24 @@ static void unlink_from_pool(struct inet_peer *p)
337/* May be called with local BH enabled. */ 328/* May be called with local BH enabled. */
338static int cleanup_once(unsigned long ttl) 329static int cleanup_once(unsigned long ttl)
339{ 330{
340 struct inet_peer *p; 331 struct inet_peer *p = NULL;
341 332
342 /* Remove the first entry from the list of unused nodes. */ 333 /* Remove the first entry from the list of unused nodes. */
343 spin_lock_bh(&inet_peer_unused_lock); 334 spin_lock_bh(&inet_peer_unused_lock);
344 p = inet_peer_unused_head; 335 if (!list_empty(&unused_peers)) {
345 if (p != NULL) { 336 __u32 delta;
346 __u32 delta = (__u32)jiffies - p->dtime; 337
338 p = list_first_entry(&unused_peers, struct inet_peer, unused);
339 delta = (__u32)jiffies - p->dtime;
340
347 if (delta < ttl) { 341 if (delta < ttl) {
348 /* Do not prune fresh entries. */ 342 /* Do not prune fresh entries. */
349 spin_unlock_bh(&inet_peer_unused_lock); 343 spin_unlock_bh(&inet_peer_unused_lock);
350 return -1; 344 return -1;
351 } 345 }
352 inet_peer_unused_head = p->unused_next; 346
353 if (p->unused_next != NULL) 347 list_del_init(&p->unused);
354 p->unused_next->unused_prevp = p->unused_prevp; 348
355 else
356 inet_peer_unused_tailp = p->unused_prevp;
357 p->unused_prevp = NULL; /* mark as not on the list */
358 /* Grab an extra reference to prevent node disappearing 349 /* Grab an extra reference to prevent node disappearing
359 * before unlink_from_pool() call. */ 350 * before unlink_from_pool() call. */
360 atomic_inc(&p->refcnt); 351 atomic_inc(&p->refcnt);
@@ -412,7 +403,7 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create)
412 403
413 /* Link the node. */ 404 /* Link the node. */
414 link_to_pool(n); 405 link_to_pool(n);
415 n->unused_prevp = NULL; /* not on the list */ 406 INIT_LIST_HEAD(&n->unused);
416 peer_total++; 407 peer_total++;
417 write_unlock_bh(&peer_pool_lock); 408 write_unlock_bh(&peer_pool_lock);
418 409
@@ -467,10 +458,7 @@ void inet_putpeer(struct inet_peer *p)
467{ 458{
468 spin_lock_bh(&inet_peer_unused_lock); 459 spin_lock_bh(&inet_peer_unused_lock);
469 if (atomic_dec_and_test(&p->refcnt)) { 460 if (atomic_dec_and_test(&p->refcnt)) {
470 p->unused_prevp = inet_peer_unused_tailp; 461 list_add_tail(&p->unused, &unused_peers);
471 p->unused_next = NULL;
472 *inet_peer_unused_tailp = p;
473 inet_peer_unused_tailp = &p->unused_next;
474 p->dtime = (__u32)jiffies; 462 p->dtime = (__u32)jiffies;
475 } 463 }
476 spin_unlock_bh(&inet_peer_unused_lock); 464 spin_unlock_bh(&inet_peer_unused_lock);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index e5f7dc2de303..fd99fbd685ea 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1183,6 +1183,17 @@ error:
1183 return err; 1183 return err;
1184} 1184}
1185 1185
1186static void ip_cork_release(struct inet_sock *inet)
1187{
1188 inet->cork.flags &= ~IPCORK_OPT;
1189 kfree(inet->cork.opt);
1190 inet->cork.opt = NULL;
1191 if (inet->cork.rt) {
1192 ip_rt_put(inet->cork.rt);
1193 inet->cork.rt = NULL;
1194 }
1195}
1196
1186/* 1197/*
1187 * Combined all pending IP fragments on the socket as one IP datagram 1198 * Combined all pending IP fragments on the socket as one IP datagram
1188 * and push them out. 1199 * and push them out.
@@ -1276,13 +1287,7 @@ int ip_push_pending_frames(struct sock *sk)
1276 } 1287 }
1277 1288
1278out: 1289out:
1279 inet->cork.flags &= ~IPCORK_OPT; 1290 ip_cork_release(inet);
1280 kfree(inet->cork.opt);
1281 inet->cork.opt = NULL;
1282 if (inet->cork.rt) {
1283 ip_rt_put(inet->cork.rt);
1284 inet->cork.rt = NULL;
1285 }
1286 return err; 1291 return err;
1287 1292
1288error: 1293error:
@@ -1295,19 +1300,12 @@ error:
1295 */ 1300 */
1296void ip_flush_pending_frames(struct sock *sk) 1301void ip_flush_pending_frames(struct sock *sk)
1297{ 1302{
1298 struct inet_sock *inet = inet_sk(sk);
1299 struct sk_buff *skb; 1303 struct sk_buff *skb;
1300 1304
1301 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) 1305 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL)
1302 kfree_skb(skb); 1306 kfree_skb(skb);
1303 1307
1304 inet->cork.flags &= ~IPCORK_OPT; 1308 ip_cork_release(inet_sk(sk));
1305 kfree(inet->cork.opt);
1306 inet->cork.opt = NULL;
1307 if (inet->cork.rt) {
1308 ip_rt_put(inet->cork.rt);
1309 inet->cork.rt = NULL;
1310 }
1311} 1309}
1312 1310
1313 1311
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index f51f20e487c8..82817e554363 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -437,10 +437,8 @@ static int do_ip_setsockopt(struct sock *sk, int level,
437 437
438 /* If optlen==0, it is equivalent to val == 0 */ 438 /* If optlen==0, it is equivalent to val == 0 */
439 439
440#ifdef CONFIG_IP_MROUTE 440 if (ip_mroute_opt(optname))
441 if (optname >= MRT_BASE && optname <= (MRT_BASE + 10))
442 return ip_mroute_setsockopt(sk,optname,optval,optlen); 441 return ip_mroute_setsockopt(sk,optname,optval,optlen);
443#endif
444 442
445 err = 0; 443 err = 0;
446 lock_sock(sk); 444 lock_sock(sk);
@@ -909,11 +907,9 @@ int ip_setsockopt(struct sock *sk, int level,
909#ifdef CONFIG_NETFILTER 907#ifdef CONFIG_NETFILTER
910 /* we need to exclude all possible ENOPROTOOPTs except default case */ 908 /* we need to exclude all possible ENOPROTOOPTs except default case */
911 if (err == -ENOPROTOOPT && optname != IP_HDRINCL && 909 if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
912 optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY 910 optname != IP_IPSEC_POLICY &&
913#ifdef CONFIG_IP_MROUTE 911 optname != IP_XFRM_POLICY &&
914 && (optname < MRT_BASE || optname > (MRT_BASE + 10)) 912 !ip_mroute_opt(optname)) {
915#endif
916 ) {
917 lock_sock(sk); 913 lock_sock(sk);
918 err = nf_setsockopt(sk, PF_INET, optname, optval, optlen); 914 err = nf_setsockopt(sk, PF_INET, optname, optval, optlen);
919 release_sock(sk); 915 release_sock(sk);
@@ -935,11 +931,9 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname,
935#ifdef CONFIG_NETFILTER 931#ifdef CONFIG_NETFILTER
936 /* we need to exclude all possible ENOPROTOOPTs except default case */ 932 /* we need to exclude all possible ENOPROTOOPTs except default case */
937 if (err == -ENOPROTOOPT && optname != IP_HDRINCL && 933 if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
938 optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY 934 optname != IP_IPSEC_POLICY &&
939#ifdef CONFIG_IP_MROUTE 935 optname != IP_XFRM_POLICY &&
940 && (optname < MRT_BASE || optname > (MRT_BASE + 10)) 936 !ip_mroute_opt(optname)) {
941#endif
942 ) {
943 lock_sock(sk); 937 lock_sock(sk);
944 err = compat_nf_setsockopt(sk, PF_INET, optname, 938 err = compat_nf_setsockopt(sk, PF_INET, optname,
945 optval, optlen); 939 optval, optlen);
@@ -967,11 +961,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
967 if (level != SOL_IP) 961 if (level != SOL_IP)
968 return -EOPNOTSUPP; 962 return -EOPNOTSUPP;
969 963
970#ifdef CONFIG_IP_MROUTE 964 if (ip_mroute_opt(optname))
971 if (optname >= MRT_BASE && optname <= MRT_BASE+10) {
972 return ip_mroute_getsockopt(sk,optname,optval,optlen); 965 return ip_mroute_getsockopt(sk,optname,optval,optlen);
973 }
974#endif
975 966
976 if (get_user(len,optlen)) 967 if (get_user(len,optlen))
977 return -EFAULT; 968 return -EFAULT;
@@ -1171,11 +1162,8 @@ int ip_getsockopt(struct sock *sk, int level,
1171 err = do_ip_getsockopt(sk, level, optname, optval, optlen); 1162 err = do_ip_getsockopt(sk, level, optname, optval, optlen);
1172#ifdef CONFIG_NETFILTER 1163#ifdef CONFIG_NETFILTER
1173 /* we need to exclude all possible ENOPROTOOPTs except default case */ 1164 /* we need to exclude all possible ENOPROTOOPTs except default case */
1174 if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS 1165 if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS &&
1175#ifdef CONFIG_IP_MROUTE 1166 !ip_mroute_opt(optname)) {
1176 && (optname < MRT_BASE || optname > MRT_BASE+10)
1177#endif
1178 ) {
1179 int len; 1167 int len;
1180 1168
1181 if (get_user(len,optlen)) 1169 if (get_user(len,optlen))
@@ -1200,11 +1188,8 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname,
1200 int err = do_ip_getsockopt(sk, level, optname, optval, optlen); 1188 int err = do_ip_getsockopt(sk, level, optname, optval, optlen);
1201#ifdef CONFIG_NETFILTER 1189#ifdef CONFIG_NETFILTER
1202 /* we need to exclude all possible ENOPROTOOPTs except default case */ 1190 /* we need to exclude all possible ENOPROTOOPTs except default case */
1203 if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS 1191 if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS &&
1204#ifdef CONFIG_IP_MROUTE 1192 !ip_mroute_opt(optname)) {
1205 && (optname < MRT_BASE || optname > MRT_BASE+10)
1206#endif
1207 ) {
1208 int len; 1193 int len;
1209 1194
1210 if (get_user(len, optlen)) 1195 if (get_user(len, optlen))
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index 0bfeb02a5f87..2c44a94c2135 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -14,9 +14,9 @@
14 * - Adaptive compression. 14 * - Adaptive compression.
15 */ 15 */
16#include <linux/module.h> 16#include <linux/module.h>
17#include <asm/scatterlist.h>
18#include <asm/semaphore.h> 17#include <asm/semaphore.h>
19#include <linux/crypto.h> 18#include <linux/crypto.h>
19#include <linux/err.h>
20#include <linux/pfkeyv2.h> 20#include <linux/pfkeyv2.h>
21#include <linux/percpu.h> 21#include <linux/percpu.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
@@ -345,7 +345,7 @@ static struct crypto_comp **ipcomp_alloc_tfms(const char *alg_name)
345 for_each_possible_cpu(cpu) { 345 for_each_possible_cpu(cpu) {
346 struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, 346 struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0,
347 CRYPTO_ALG_ASYNC); 347 CRYPTO_ALG_ASYNC);
348 if (!tfm) 348 if (IS_ERR(tfm))
349 goto error; 349 goto error;
350 *per_cpu_ptr(tfms, cpu) = tfm; 350 *per_cpu_ptr(tfms, cpu) = tfm;
351 } 351 }
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
index 4b702f708d30..0a9f3c37e18d 100644
--- a/net/ipv4/ipvs/ip_vs_conn.c
+++ b/net/ipv4/ipvs/ip_vs_conn.c
@@ -426,6 +426,24 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest)
426 426
427 427
428/* 428/*
429 * Check if there is a destination for the connection, if so
430 * bind the connection to the destination.
431 */
432struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp)
433{
434 struct ip_vs_dest *dest;
435
436 if ((cp) && (!cp->dest)) {
437 dest = ip_vs_find_dest(cp->daddr, cp->dport,
438 cp->vaddr, cp->vport, cp->protocol);
439 ip_vs_bind_dest(cp, dest);
440 return dest;
441 } else
442 return NULL;
443}
444
445
446/*
429 * Unbind a connection entry with its VS destination 447 * Unbind a connection entry with its VS destination
430 * Called by the ip_vs_conn_expire function. 448 * Called by the ip_vs_conn_expire function.
431 */ 449 */
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
index c6ed7654e839..8fba20256f52 100644
--- a/net/ipv4/ipvs/ip_vs_core.c
+++ b/net/ipv4/ipvs/ip_vs_core.c
@@ -637,7 +637,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related)
637 verdict = NF_DROP; 637 verdict = NF_DROP;
638 638
639 if (IP_VS_FWD_METHOD(cp) != 0) { 639 if (IP_VS_FWD_METHOD(cp) != 0) {
640 IP_VS_ERR("shouldn't reach here, because the box is on the" 640 IP_VS_ERR("shouldn't reach here, because the box is on the "
641 "half connection in the tun/dr module.\n"); 641 "half connection in the tun/dr module.\n");
642 } 642 }
643 643
@@ -979,15 +979,23 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb,
979 ret = NF_ACCEPT; 979 ret = NF_ACCEPT;
980 } 980 }
981 981
982 /* increase its packet counter and check if it is needed 982 /* Increase its packet counter and check if it is needed
983 to be synchronized */ 983 * to be synchronized
984 *
985 * Sync connection if it is about to close to
986 * encorage the standby servers to update the connections timeout
987 */
984 atomic_inc(&cp->in_pkts); 988 atomic_inc(&cp->in_pkts);
985 if ((ip_vs_sync_state & IP_VS_STATE_MASTER) && 989 if ((ip_vs_sync_state & IP_VS_STATE_MASTER) &&
986 (cp->protocol != IPPROTO_TCP || 990 (((cp->protocol != IPPROTO_TCP ||
987 cp->state == IP_VS_TCP_S_ESTABLISHED) && 991 cp->state == IP_VS_TCP_S_ESTABLISHED) &&
988 (atomic_read(&cp->in_pkts) % sysctl_ip_vs_sync_threshold[1] 992 (atomic_read(&cp->in_pkts) % sysctl_ip_vs_sync_threshold[1]
989 == sysctl_ip_vs_sync_threshold[0])) 993 == sysctl_ip_vs_sync_threshold[0])) ||
994 ((cp->protocol == IPPROTO_TCP) && (cp->old_state != cp->state) &&
995 ((cp->state == IP_VS_TCP_S_FIN_WAIT) ||
996 (cp->state == IP_VS_TCP_S_CLOSE)))))
990 ip_vs_sync_conn(cp); 997 ip_vs_sync_conn(cp);
998 cp->old_state = cp->state;
991 999
992 ip_vs_conn_put(cp); 1000 ip_vs_conn_put(cp);
993 return ret; 1001 return ret;
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index 7345fc252a23..693d92490c11 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -579,6 +579,31 @@ ip_vs_lookup_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport)
579 return NULL; 579 return NULL;
580} 580}
581 581
582/*
583 * Find destination by {daddr,dport,vaddr,protocol}
584 * Cretaed to be used in ip_vs_process_message() in
585 * the backup synchronization daemon. It finds the
586 * destination to be bound to the received connection
587 * on the backup.
588 *
589 * ip_vs_lookup_real_service() looked promissing, but
590 * seems not working as expected.
591 */
592struct ip_vs_dest *ip_vs_find_dest(__be32 daddr, __be16 dport,
593 __be32 vaddr, __be16 vport, __u16 protocol)
594{
595 struct ip_vs_dest *dest;
596 struct ip_vs_service *svc;
597
598 svc = ip_vs_service_get(0, protocol, vaddr, vport);
599 if (!svc)
600 return NULL;
601 dest = ip_vs_lookup_dest(svc, daddr, dport);
602 if (dest)
603 atomic_inc(&dest->refcnt);
604 ip_vs_service_put(svc);
605 return dest;
606}
582 607
583/* 608/*
584 * Lookup dest by {svc,addr,port} in the destination trash. 609 * Lookup dest by {svc,addr,port} in the destination trash.
@@ -1399,7 +1424,6 @@ proc_do_sync_threshold(ctl_table *table, int write, struct file *filp,
1399 1424
1400static struct ctl_table vs_vars[] = { 1425static struct ctl_table vs_vars[] = {
1401 { 1426 {
1402 .ctl_name = NET_IPV4_VS_AMEMTHRESH,
1403 .procname = "amemthresh", 1427 .procname = "amemthresh",
1404 .data = &sysctl_ip_vs_amemthresh, 1428 .data = &sysctl_ip_vs_amemthresh,
1405 .maxlen = sizeof(int), 1429 .maxlen = sizeof(int),
@@ -1408,7 +1432,6 @@ static struct ctl_table vs_vars[] = {
1408 }, 1432 },
1409#ifdef CONFIG_IP_VS_DEBUG 1433#ifdef CONFIG_IP_VS_DEBUG
1410 { 1434 {
1411 .ctl_name = NET_IPV4_VS_DEBUG_LEVEL,
1412 .procname = "debug_level", 1435 .procname = "debug_level",
1413 .data = &sysctl_ip_vs_debug_level, 1436 .data = &sysctl_ip_vs_debug_level,
1414 .maxlen = sizeof(int), 1437 .maxlen = sizeof(int),
@@ -1417,7 +1440,6 @@ static struct ctl_table vs_vars[] = {
1417 }, 1440 },
1418#endif 1441#endif
1419 { 1442 {
1420 .ctl_name = NET_IPV4_VS_AMDROPRATE,
1421 .procname = "am_droprate", 1443 .procname = "am_droprate",
1422 .data = &sysctl_ip_vs_am_droprate, 1444 .data = &sysctl_ip_vs_am_droprate,
1423 .maxlen = sizeof(int), 1445 .maxlen = sizeof(int),
@@ -1425,7 +1447,6 @@ static struct ctl_table vs_vars[] = {
1425 .proc_handler = &proc_dointvec, 1447 .proc_handler = &proc_dointvec,
1426 }, 1448 },
1427 { 1449 {
1428 .ctl_name = NET_IPV4_VS_DROP_ENTRY,
1429 .procname = "drop_entry", 1450 .procname = "drop_entry",
1430 .data = &sysctl_ip_vs_drop_entry, 1451 .data = &sysctl_ip_vs_drop_entry,
1431 .maxlen = sizeof(int), 1452 .maxlen = sizeof(int),
@@ -1433,7 +1454,6 @@ static struct ctl_table vs_vars[] = {
1433 .proc_handler = &proc_do_defense_mode, 1454 .proc_handler = &proc_do_defense_mode,
1434 }, 1455 },
1435 { 1456 {
1436 .ctl_name = NET_IPV4_VS_DROP_PACKET,
1437 .procname = "drop_packet", 1457 .procname = "drop_packet",
1438 .data = &sysctl_ip_vs_drop_packet, 1458 .data = &sysctl_ip_vs_drop_packet,
1439 .maxlen = sizeof(int), 1459 .maxlen = sizeof(int),
@@ -1441,7 +1461,6 @@ static struct ctl_table vs_vars[] = {
1441 .proc_handler = &proc_do_defense_mode, 1461 .proc_handler = &proc_do_defense_mode,
1442 }, 1462 },
1443 { 1463 {
1444 .ctl_name = NET_IPV4_VS_SECURE_TCP,
1445 .procname = "secure_tcp", 1464 .procname = "secure_tcp",
1446 .data = &sysctl_ip_vs_secure_tcp, 1465 .data = &sysctl_ip_vs_secure_tcp,
1447 .maxlen = sizeof(int), 1466 .maxlen = sizeof(int),
@@ -1450,7 +1469,6 @@ static struct ctl_table vs_vars[] = {
1450 }, 1469 },
1451#if 0 1470#if 0
1452 { 1471 {
1453 .ctl_name = NET_IPV4_VS_TO_ES,
1454 .procname = "timeout_established", 1472 .procname = "timeout_established",
1455 .data = &vs_timeout_table_dos.timeout[IP_VS_S_ESTABLISHED], 1473 .data = &vs_timeout_table_dos.timeout[IP_VS_S_ESTABLISHED],
1456 .maxlen = sizeof(int), 1474 .maxlen = sizeof(int),
@@ -1458,7 +1476,6 @@ static struct ctl_table vs_vars[] = {
1458 .proc_handler = &proc_dointvec_jiffies, 1476 .proc_handler = &proc_dointvec_jiffies,
1459 }, 1477 },
1460 { 1478 {
1461 .ctl_name = NET_IPV4_VS_TO_SS,
1462 .procname = "timeout_synsent", 1479 .procname = "timeout_synsent",
1463 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_SENT], 1480 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_SENT],
1464 .maxlen = sizeof(int), 1481 .maxlen = sizeof(int),
@@ -1466,7 +1483,6 @@ static struct ctl_table vs_vars[] = {
1466 .proc_handler = &proc_dointvec_jiffies, 1483 .proc_handler = &proc_dointvec_jiffies,
1467 }, 1484 },
1468 { 1485 {
1469 .ctl_name = NET_IPV4_VS_TO_SR,
1470 .procname = "timeout_synrecv", 1486 .procname = "timeout_synrecv",
1471 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_RECV], 1487 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_RECV],
1472 .maxlen = sizeof(int), 1488 .maxlen = sizeof(int),
@@ -1474,7 +1490,6 @@ static struct ctl_table vs_vars[] = {
1474 .proc_handler = &proc_dointvec_jiffies, 1490 .proc_handler = &proc_dointvec_jiffies,
1475 }, 1491 },
1476 { 1492 {
1477 .ctl_name = NET_IPV4_VS_TO_FW,
1478 .procname = "timeout_finwait", 1493 .procname = "timeout_finwait",
1479 .data = &vs_timeout_table_dos.timeout[IP_VS_S_FIN_WAIT], 1494 .data = &vs_timeout_table_dos.timeout[IP_VS_S_FIN_WAIT],
1480 .maxlen = sizeof(int), 1495 .maxlen = sizeof(int),
@@ -1482,7 +1497,6 @@ static struct ctl_table vs_vars[] = {
1482 .proc_handler = &proc_dointvec_jiffies, 1497 .proc_handler = &proc_dointvec_jiffies,
1483 }, 1498 },
1484 { 1499 {
1485 .ctl_name = NET_IPV4_VS_TO_TW,
1486 .procname = "timeout_timewait", 1500 .procname = "timeout_timewait",
1487 .data = &vs_timeout_table_dos.timeout[IP_VS_S_TIME_WAIT], 1501 .data = &vs_timeout_table_dos.timeout[IP_VS_S_TIME_WAIT],
1488 .maxlen = sizeof(int), 1502 .maxlen = sizeof(int),
@@ -1490,7 +1504,6 @@ static struct ctl_table vs_vars[] = {
1490 .proc_handler = &proc_dointvec_jiffies, 1504 .proc_handler = &proc_dointvec_jiffies,
1491 }, 1505 },
1492 { 1506 {
1493 .ctl_name = NET_IPV4_VS_TO_CL,
1494 .procname = "timeout_close", 1507 .procname = "timeout_close",
1495 .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE], 1508 .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE],
1496 .maxlen = sizeof(int), 1509 .maxlen = sizeof(int),
@@ -1498,7 +1511,6 @@ static struct ctl_table vs_vars[] = {
1498 .proc_handler = &proc_dointvec_jiffies, 1511 .proc_handler = &proc_dointvec_jiffies,
1499 }, 1512 },
1500 { 1513 {
1501 .ctl_name = NET_IPV4_VS_TO_CW,
1502 .procname = "timeout_closewait", 1514 .procname = "timeout_closewait",
1503 .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE_WAIT], 1515 .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE_WAIT],
1504 .maxlen = sizeof(int), 1516 .maxlen = sizeof(int),
@@ -1506,7 +1518,6 @@ static struct ctl_table vs_vars[] = {
1506 .proc_handler = &proc_dointvec_jiffies, 1518 .proc_handler = &proc_dointvec_jiffies,
1507 }, 1519 },
1508 { 1520 {
1509 .ctl_name = NET_IPV4_VS_TO_LA,
1510 .procname = "timeout_lastack", 1521 .procname = "timeout_lastack",
1511 .data = &vs_timeout_table_dos.timeout[IP_VS_S_LAST_ACK], 1522 .data = &vs_timeout_table_dos.timeout[IP_VS_S_LAST_ACK],
1512 .maxlen = sizeof(int), 1523 .maxlen = sizeof(int),
@@ -1514,7 +1525,6 @@ static struct ctl_table vs_vars[] = {
1514 .proc_handler = &proc_dointvec_jiffies, 1525 .proc_handler = &proc_dointvec_jiffies,
1515 }, 1526 },
1516 { 1527 {
1517 .ctl_name = NET_IPV4_VS_TO_LI,
1518 .procname = "timeout_listen", 1528 .procname = "timeout_listen",
1519 .data = &vs_timeout_table_dos.timeout[IP_VS_S_LISTEN], 1529 .data = &vs_timeout_table_dos.timeout[IP_VS_S_LISTEN],
1520 .maxlen = sizeof(int), 1530 .maxlen = sizeof(int),
@@ -1522,7 +1532,6 @@ static struct ctl_table vs_vars[] = {
1522 .proc_handler = &proc_dointvec_jiffies, 1532 .proc_handler = &proc_dointvec_jiffies,
1523 }, 1533 },
1524 { 1534 {
1525 .ctl_name = NET_IPV4_VS_TO_SA,
1526 .procname = "timeout_synack", 1535 .procname = "timeout_synack",
1527 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYNACK], 1536 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYNACK],
1528 .maxlen = sizeof(int), 1537 .maxlen = sizeof(int),
@@ -1530,7 +1539,6 @@ static struct ctl_table vs_vars[] = {
1530 .proc_handler = &proc_dointvec_jiffies, 1539 .proc_handler = &proc_dointvec_jiffies,
1531 }, 1540 },
1532 { 1541 {
1533 .ctl_name = NET_IPV4_VS_TO_UDP,
1534 .procname = "timeout_udp", 1542 .procname = "timeout_udp",
1535 .data = &vs_timeout_table_dos.timeout[IP_VS_S_UDP], 1543 .data = &vs_timeout_table_dos.timeout[IP_VS_S_UDP],
1536 .maxlen = sizeof(int), 1544 .maxlen = sizeof(int),
@@ -1538,7 +1546,6 @@ static struct ctl_table vs_vars[] = {
1538 .proc_handler = &proc_dointvec_jiffies, 1546 .proc_handler = &proc_dointvec_jiffies,
1539 }, 1547 },
1540 { 1548 {
1541 .ctl_name = NET_IPV4_VS_TO_ICMP,
1542 .procname = "timeout_icmp", 1549 .procname = "timeout_icmp",
1543 .data = &vs_timeout_table_dos.timeout[IP_VS_S_ICMP], 1550 .data = &vs_timeout_table_dos.timeout[IP_VS_S_ICMP],
1544 .maxlen = sizeof(int), 1551 .maxlen = sizeof(int),
@@ -1547,7 +1554,6 @@ static struct ctl_table vs_vars[] = {
1547 }, 1554 },
1548#endif 1555#endif
1549 { 1556 {
1550 .ctl_name = NET_IPV4_VS_CACHE_BYPASS,
1551 .procname = "cache_bypass", 1557 .procname = "cache_bypass",
1552 .data = &sysctl_ip_vs_cache_bypass, 1558 .data = &sysctl_ip_vs_cache_bypass,
1553 .maxlen = sizeof(int), 1559 .maxlen = sizeof(int),
@@ -1555,7 +1561,6 @@ static struct ctl_table vs_vars[] = {
1555 .proc_handler = &proc_dointvec, 1561 .proc_handler = &proc_dointvec,
1556 }, 1562 },
1557 { 1563 {
1558 .ctl_name = NET_IPV4_VS_EXPIRE_NODEST_CONN,
1559 .procname = "expire_nodest_conn", 1564 .procname = "expire_nodest_conn",
1560 .data = &sysctl_ip_vs_expire_nodest_conn, 1565 .data = &sysctl_ip_vs_expire_nodest_conn,
1561 .maxlen = sizeof(int), 1566 .maxlen = sizeof(int),
@@ -1563,7 +1568,6 @@ static struct ctl_table vs_vars[] = {
1563 .proc_handler = &proc_dointvec, 1568 .proc_handler = &proc_dointvec,
1564 }, 1569 },
1565 { 1570 {
1566 .ctl_name = NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE,
1567 .procname = "expire_quiescent_template", 1571 .procname = "expire_quiescent_template",
1568 .data = &sysctl_ip_vs_expire_quiescent_template, 1572 .data = &sysctl_ip_vs_expire_quiescent_template,
1569 .maxlen = sizeof(int), 1573 .maxlen = sizeof(int),
@@ -1571,7 +1575,6 @@ static struct ctl_table vs_vars[] = {
1571 .proc_handler = &proc_dointvec, 1575 .proc_handler = &proc_dointvec,
1572 }, 1576 },
1573 { 1577 {
1574 .ctl_name = NET_IPV4_VS_SYNC_THRESHOLD,
1575 .procname = "sync_threshold", 1578 .procname = "sync_threshold",
1576 .data = &sysctl_ip_vs_sync_threshold, 1579 .data = &sysctl_ip_vs_sync_threshold,
1577 .maxlen = sizeof(sysctl_ip_vs_sync_threshold), 1580 .maxlen = sizeof(sysctl_ip_vs_sync_threshold),
@@ -1579,7 +1582,6 @@ static struct ctl_table vs_vars[] = {
1579 .proc_handler = &proc_do_sync_threshold, 1582 .proc_handler = &proc_do_sync_threshold,
1580 }, 1583 },
1581 { 1584 {
1582 .ctl_name = NET_IPV4_VS_NAT_ICMP_SEND,
1583 .procname = "nat_icmp_send", 1585 .procname = "nat_icmp_send",
1584 .data = &sysctl_ip_vs_nat_icmp_send, 1586 .data = &sysctl_ip_vs_nat_icmp_send,
1585 .maxlen = sizeof(int), 1587 .maxlen = sizeof(int),
@@ -1591,7 +1593,6 @@ static struct ctl_table vs_vars[] = {
1591 1593
1592static ctl_table vs_table[] = { 1594static ctl_table vs_table[] = {
1593 { 1595 {
1594 .ctl_name = NET_IPV4_VS,
1595 .procname = "vs", 1596 .procname = "vs",
1596 .mode = 0555, 1597 .mode = 0555,
1597 .child = vs_vars 1598 .child = vs_vars
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c
index 052f4ed59174..b843a11d7cf7 100644
--- a/net/ipv4/ipvs/ip_vs_lblc.c
+++ b/net/ipv4/ipvs/ip_vs_lblc.c
@@ -114,7 +114,6 @@ struct ip_vs_lblc_table {
114 114
115static ctl_table vs_vars_table[] = { 115static ctl_table vs_vars_table[] = {
116 { 116 {
117 .ctl_name = NET_IPV4_VS_LBLC_EXPIRE,
118 .procname = "lblc_expiration", 117 .procname = "lblc_expiration",
119 .data = &sysctl_ip_vs_lblc_expiration, 118 .data = &sysctl_ip_vs_lblc_expiration,
120 .maxlen = sizeof(int), 119 .maxlen = sizeof(int),
@@ -126,7 +125,6 @@ static ctl_table vs_vars_table[] = {
126 125
127static ctl_table vs_table[] = { 126static ctl_table vs_table[] = {
128 { 127 {
129 .ctl_name = NET_IPV4_VS,
130 .procname = "vs", 128 .procname = "vs",
131 .mode = 0555, 129 .mode = 0555,
132 .child = vs_vars_table 130 .child = vs_vars_table
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c
index 6a1fec416eaf..e5b323a6b2f7 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>
@@ -304,7 +302,6 @@ struct ip_vs_lblcr_table {
304 302
305static ctl_table vs_vars_table[] = { 303static ctl_table vs_vars_table[] = {
306 { 304 {
307 .ctl_name = NET_IPV4_VS_LBLCR_EXPIRE,
308 .procname = "lblcr_expiration", 305 .procname = "lblcr_expiration",
309 .data = &sysctl_ip_vs_lblcr_expiration, 306 .data = &sysctl_ip_vs_lblcr_expiration,
310 .maxlen = sizeof(int), 307 .maxlen = sizeof(int),
@@ -316,7 +313,6 @@ static ctl_table vs_vars_table[] = {
316 313
317static ctl_table vs_table[] = { 314static ctl_table vs_table[] = {
318 { 315 {
319 .ctl_name = NET_IPV4_VS,
320 .procname = "vs", 316 .procname = "vs",
321 .mode = 0555, 317 .mode = 0555,
322 .child = vs_vars_table 318 .child = vs_vars_table
@@ -547,71 +543,6 @@ static void ip_vs_lblcr_check_expire(unsigned long data)
547 mod_timer(&tbl->periodic_timer, jiffies+CHECK_EXPIRE_INTERVAL); 543 mod_timer(&tbl->periodic_timer, jiffies+CHECK_EXPIRE_INTERVAL);
548} 544}
549 545
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) 546static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
616{ 547{
617 int i; 548 int i;
@@ -650,9 +581,6 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
650 tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL; 581 tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL;
651 add_timer(&tbl->periodic_timer); 582 add_timer(&tbl->periodic_timer);
652 583
653#ifdef CONFIG_IP_VS_LBLCR_DEBUG
654 lblcr_table_list = tbl;
655#endif
656 return 0; 584 return 0;
657} 585}
658 586
@@ -843,18 +771,12 @@ static int __init ip_vs_lblcr_init(void)
843{ 771{
844 INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); 772 INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list);
845 sysctl_header = register_sysctl_table(lblcr_root_table); 773 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); 774 return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
850} 775}
851 776
852 777
853static void __exit ip_vs_lblcr_cleanup(void) 778static void __exit ip_vs_lblcr_cleanup(void)
854{ 779{
855#ifdef CONFIG_IP_VS_LBLCR_DEBUG
856 proc_net_remove(&init_net, "ip_vs_lblcr");
857#endif
858 unregister_sysctl_table(sysctl_header); 780 unregister_sysctl_table(sysctl_header);
859 unregister_ip_vs_scheduler(&ip_vs_lblcr_scheduler); 781 unregister_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
860} 782}
diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c
index e844ddb82b9a..c0e11ec8f0f9 100644
--- a/net/ipv4/ipvs/ip_vs_proto.c
+++ b/net/ipv4/ipvs/ip_vs_proto.c
@@ -45,7 +45,7 @@ static struct ip_vs_protocol *ip_vs_proto_table[IP_VS_PROTO_TAB_SIZE];
45/* 45/*
46 * register an ipvs protocol 46 * register an ipvs protocol
47 */ 47 */
48static int register_ip_vs_protocol(struct ip_vs_protocol *pp) 48static int __used register_ip_vs_protocol(struct ip_vs_protocol *pp)
49{ 49{
50 unsigned hash = IP_VS_PROTO_HASH(pp->protocol); 50 unsigned hash = IP_VS_PROTO_HASH(pp->protocol);
51 51
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
index c99f2a33fb9e..bd930efc18da 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,8 @@ 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 struct ip_vs_dest *dest;
287 char *p; 288 char *p;
288 int i; 289 int i;
289 290
@@ -317,20 +318,34 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen)
317 s->caddr, s->cport, 318 s->caddr, s->cport,
318 s->vaddr, s->vport); 319 s->vaddr, s->vport);
319 if (!cp) { 320 if (!cp) {
321 /*
322 * Find the appropriate destination for the connection.
323 * If it is not found the connection will remain unbound
324 * but still handled.
325 */
326 dest = ip_vs_find_dest(s->daddr, s->dport,
327 s->vaddr, s->vport,
328 s->protocol);
320 cp = ip_vs_conn_new(s->protocol, 329 cp = ip_vs_conn_new(s->protocol,
321 s->caddr, s->cport, 330 s->caddr, s->cport,
322 s->vaddr, s->vport, 331 s->vaddr, s->vport,
323 s->daddr, s->dport, 332 s->daddr, s->dport,
324 flags, NULL); 333 flags, dest);
334 if (dest)
335 atomic_dec(&dest->refcnt);
325 if (!cp) { 336 if (!cp) {
326 IP_VS_ERR("ip_vs_conn_new failed\n"); 337 IP_VS_ERR("ip_vs_conn_new failed\n");
327 return; 338 return;
328 } 339 }
329 cp->state = ntohs(s->state); 340 cp->state = ntohs(s->state);
330 } else if (!cp->dest) { 341 } else if (!cp->dest) {
331 /* it is an entry created by the synchronization */ 342 dest = ip_vs_try_bind_dest(cp);
332 cp->state = ntohs(s->state); 343 if (!dest) {
333 cp->flags = flags | IP_VS_CONN_F_HASHED; 344 /* it is an unbound entry created by
345 * synchronization */
346 cp->flags = flags | IP_VS_CONN_F_HASHED;
347 } else
348 atomic_dec(&dest->refcnt);
334 } /* Note that we don't touch its state and flags 349 } /* Note that we don't touch its state and flags
335 if it is a normal entry. */ 350 if it is a normal entry. */
336 351
@@ -342,7 +357,9 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen)
342 p += SIMPLE_CONN_SIZE; 357 p += SIMPLE_CONN_SIZE;
343 358
344 atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); 359 atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]);
345 cp->timeout = IP_VS_SYNC_CONN_TIMEOUT; 360 cp->state = ntohs(s->state);
361 pp = ip_vs_proto_get(s->protocol);
362 cp->timeout = pp->timeout_table[cp->state];
346 ip_vs_conn_put(cp); 363 ip_vs_conn_put(cp);
347 364
348 if (p > buffer+buflen) { 365 if (p > buffer+buflen) {
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/netfilter/Makefile b/net/ipv4/netfilter/Makefile
index 409d273f6f82..7456833d6ade 100644
--- a/net/ipv4/netfilter/Makefile
+++ b/net/ipv4/netfilter/Makefile
@@ -41,27 +41,27 @@ obj-$(CONFIG_NF_NAT) += iptable_nat.o
41obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o 41obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o
42 42
43# matches 43# matches
44obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o
45obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o
46obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o
44obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o 47obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o
45obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o 48obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o
46obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o
47obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o 49obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o
48obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o 50obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o
49obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o
50obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o 51obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o
51obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o
52 52
53# targets 53# targets
54obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o 54obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
55obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o
56obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o 55obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
56obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o
57obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o 57obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
58obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
59obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o 58obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
59obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
60obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o
60obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o 61obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o
61obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o 62obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o
62obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o
63obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
64obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o 63obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o
64obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o
65 65
66# generic ARP tables 66# generic ARP tables
67obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o 67obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 10a2ce09fd8e..14d64a383db1 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -22,6 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/sysctl.h> 23#include <linux/sysctl.h>
24#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
25#include <linux/seq_file.h>
25#include <linux/security.h> 26#include <linux/security.h>
26#include <linux/mutex.h> 27#include <linux/mutex.h>
27#include <net/net_namespace.h> 28#include <net/net_namespace.h>
@@ -607,15 +608,11 @@ static ctl_table ipq_root_table[] = {
607 { .ctl_name = 0 } 608 { .ctl_name = 0 }
608}; 609};
609 610
610#ifdef CONFIG_PROC_FS 611static int ip_queue_show(struct seq_file *m, void *v)
611static int
612ipq_get_info(char *buffer, char **start, off_t offset, int length)
613{ 612{
614 int len;
615
616 read_lock_bh(&queue_lock); 613 read_lock_bh(&queue_lock);
617 614
618 len = sprintf(buffer, 615 seq_printf(m,
619 "Peer PID : %d\n" 616 "Peer PID : %d\n"
620 "Copy mode : %hu\n" 617 "Copy mode : %hu\n"
621 "Copy range : %u\n" 618 "Copy range : %u\n"
@@ -632,16 +629,21 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length)
632 queue_user_dropped); 629 queue_user_dropped);
633 630
634 read_unlock_bh(&queue_lock); 631 read_unlock_bh(&queue_lock);
632 return 0;
633}
635 634
636 *start = buffer + offset; 635static int ip_queue_open(struct inode *inode, struct file *file)
637 len -= offset; 636{
638 if (len > length) 637 return single_open(file, ip_queue_show, NULL);
639 len = length;
640 else if (len < 0)
641 len = 0;
642 return len;
643} 638}
644#endif /* CONFIG_PROC_FS */ 639
640static const struct file_operations ip_queue_proc_fops = {
641 .open = ip_queue_open,
642 .read = seq_read,
643 .llseek = seq_lseek,
644 .release = single_release,
645 .owner = THIS_MODULE,
646};
645 647
646static struct nf_queue_handler nfqh = { 648static struct nf_queue_handler nfqh = {
647 .name = "ip_queue", 649 .name = "ip_queue",
@@ -661,10 +663,11 @@ static int __init ip_queue_init(void)
661 goto cleanup_netlink_notifier; 663 goto cleanup_netlink_notifier;
662 } 664 }
663 665
664 proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info); 666 proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net);
665 if (proc) 667 if (proc) {
666 proc->owner = THIS_MODULE; 668 proc->owner = THIS_MODULE;
667 else { 669 proc->proc_fops = &ip_queue_proc_fops;
670 } else {
668 printk(KERN_ERR "ip_queue: failed to create proc entry\n"); 671 printk(KERN_ERR "ip_queue: failed to create proc entry\n");
669 goto cleanup_ipqnl; 672 goto cleanup_ipqnl;
670 } 673 }
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c
index 5de6e57ac55c..f8678651250f 100644
--- a/net/ipv4/netfilter/iptable_raw.c
+++ b/net/ipv4/netfilter/iptable_raw.c
@@ -66,7 +66,7 @@ ipt_local_hook(unsigned int hook,
66 if (skb->len < sizeof(struct iphdr) || 66 if (skb->len < sizeof(struct iphdr) ||
67 ip_hdrlen(skb) < sizeof(struct iphdr)) { 67 ip_hdrlen(skb) < sizeof(struct iphdr)) {
68 if (net_ratelimit()) 68 if (net_ratelimit())
69 printk("iptable_raw: ignoring short SOCK_RAW" 69 printk("iptable_raw: ignoring short SOCK_RAW "
70 "packet.\n"); 70 "packet.\n");
71 return NF_ACCEPT; 71 return NF_ACCEPT;
72 } 72 }
diff --git a/net/ipv4/netfilter/nf_nat_amanda.c b/net/ipv4/netfilter/nf_nat_amanda.c
index 35a5aa69cd92..c31b87668250 100644
--- a/net/ipv4/netfilter/nf_nat_amanda.c
+++ b/net/ipv4/netfilter/nf_nat_amanda.c
@@ -69,7 +69,7 @@ static void __exit nf_nat_amanda_fini(void)
69 69
70static int __init nf_nat_amanda_init(void) 70static int __init nf_nat_amanda_init(void)
71{ 71{
72 BUG_ON(rcu_dereference(nf_nat_amanda_hook)); 72 BUG_ON(nf_nat_amanda_hook != NULL);
73 rcu_assign_pointer(nf_nat_amanda_hook, help); 73 rcu_assign_pointer(nf_nat_amanda_hook, help);
74 return 0; 74 return 0;
75} 75}
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 56e93f692e82..86b465b176ba 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -607,13 +607,10 @@ static void nf_nat_move_storage(struct nf_conn *conntrack, void *old)
607 struct nf_conn_nat *new_nat = nf_ct_ext_find(conntrack, NF_CT_EXT_NAT); 607 struct nf_conn_nat *new_nat = nf_ct_ext_find(conntrack, NF_CT_EXT_NAT);
608 struct nf_conn_nat *old_nat = (struct nf_conn_nat *)old; 608 struct nf_conn_nat *old_nat = (struct nf_conn_nat *)old;
609 struct nf_conn *ct = old_nat->ct; 609 struct nf_conn *ct = old_nat->ct;
610 unsigned int srchash;
611 610
612 if (!(ct->status & IPS_NAT_DONE_MASK)) 611 if (!ct || !(ct->status & IPS_NAT_DONE_MASK))
613 return; 612 return;
614 613
615 srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
616
617 write_lock_bh(&nf_nat_lock); 614 write_lock_bh(&nf_nat_lock);
618 hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); 615 hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource);
619 new_nat->ct = ct; 616 new_nat->ct = ct;
@@ -681,7 +678,7 @@ static int clean_nat(struct nf_conn *i, void *data)
681 678
682 if (!nat) 679 if (!nat)
683 return 0; 680 return 0;
684 memset(nat, 0, sizeof(nat)); 681 memset(nat, 0, sizeof(*nat));
685 i->status &= ~(IPS_NAT_MASK | IPS_NAT_DONE_MASK | IPS_SEQ_ADJUST); 682 i->status &= ~(IPS_NAT_MASK | IPS_NAT_DONE_MASK | IPS_SEQ_ADJUST);
686 return 0; 683 return 0;
687} 684}
diff --git a/net/ipv4/netfilter/nf_nat_ftp.c b/net/ipv4/netfilter/nf_nat_ftp.c
index e1a16d3ea4cb..a1d5d58a58bf 100644
--- a/net/ipv4/netfilter/nf_nat_ftp.c
+++ b/net/ipv4/netfilter/nf_nat_ftp.c
@@ -147,7 +147,7 @@ static void __exit nf_nat_ftp_fini(void)
147 147
148static int __init nf_nat_ftp_init(void) 148static int __init nf_nat_ftp_init(void)
149{ 149{
150 BUG_ON(rcu_dereference(nf_nat_ftp_hook)); 150 BUG_ON(nf_nat_ftp_hook != NULL);
151 rcu_assign_pointer(nf_nat_ftp_hook, nf_nat_ftp); 151 rcu_assign_pointer(nf_nat_ftp_hook, nf_nat_ftp);
152 return 0; 152 return 0;
153} 153}
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c
index a868c8c41328..93e18ef114f2 100644
--- a/net/ipv4/netfilter/nf_nat_h323.c
+++ b/net/ipv4/netfilter/nf_nat_h323.c
@@ -544,15 +544,15 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct,
544/****************************************************************************/ 544/****************************************************************************/
545static int __init init(void) 545static int __init init(void)
546{ 546{
547 BUG_ON(rcu_dereference(set_h245_addr_hook) != NULL); 547 BUG_ON(set_h245_addr_hook != NULL);
548 BUG_ON(rcu_dereference(set_h225_addr_hook) != NULL); 548 BUG_ON(set_h225_addr_hook != NULL);
549 BUG_ON(rcu_dereference(set_sig_addr_hook) != NULL); 549 BUG_ON(set_sig_addr_hook != NULL);
550 BUG_ON(rcu_dereference(set_ras_addr_hook) != NULL); 550 BUG_ON(set_ras_addr_hook != NULL);
551 BUG_ON(rcu_dereference(nat_rtp_rtcp_hook) != NULL); 551 BUG_ON(nat_rtp_rtcp_hook != NULL);
552 BUG_ON(rcu_dereference(nat_t120_hook) != NULL); 552 BUG_ON(nat_t120_hook != NULL);
553 BUG_ON(rcu_dereference(nat_h245_hook) != NULL); 553 BUG_ON(nat_h245_hook != NULL);
554 BUG_ON(rcu_dereference(nat_callforwarding_hook) != NULL); 554 BUG_ON(nat_callforwarding_hook != NULL);
555 BUG_ON(rcu_dereference(nat_q931_hook) != NULL); 555 BUG_ON(nat_q931_hook != NULL);
556 556
557 rcu_assign_pointer(set_h245_addr_hook, set_h245_addr); 557 rcu_assign_pointer(set_h245_addr_hook, set_h245_addr);
558 rcu_assign_pointer(set_h225_addr_hook, set_h225_addr); 558 rcu_assign_pointer(set_h225_addr_hook, set_h225_addr);
diff --git a/net/ipv4/netfilter/nf_nat_irc.c b/net/ipv4/netfilter/nf_nat_irc.c
index 766e2c16c6b9..fe6f9cef6c85 100644
--- a/net/ipv4/netfilter/nf_nat_irc.c
+++ b/net/ipv4/netfilter/nf_nat_irc.c
@@ -74,7 +74,7 @@ static void __exit nf_nat_irc_fini(void)
74 74
75static int __init nf_nat_irc_init(void) 75static int __init nf_nat_irc_init(void)
76{ 76{
77 BUG_ON(rcu_dereference(nf_nat_irc_hook)); 77 BUG_ON(nf_nat_irc_hook != NULL);
78 rcu_assign_pointer(nf_nat_irc_hook, help); 78 rcu_assign_pointer(nf_nat_irc_hook, help);
79 return 0; 79 return 0;
80} 80}
diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c
index e1385a099079..6817e7995f35 100644
--- a/net/ipv4/netfilter/nf_nat_pptp.c
+++ b/net/ipv4/netfilter/nf_nat_pptp.c
@@ -281,16 +281,16 @@ static int __init nf_nat_helper_pptp_init(void)
281{ 281{
282 nf_nat_need_gre(); 282 nf_nat_need_gre();
283 283
284 BUG_ON(rcu_dereference(nf_nat_pptp_hook_outbound)); 284 BUG_ON(nf_nat_pptp_hook_outbound != NULL);
285 rcu_assign_pointer(nf_nat_pptp_hook_outbound, pptp_outbound_pkt); 285 rcu_assign_pointer(nf_nat_pptp_hook_outbound, pptp_outbound_pkt);
286 286
287 BUG_ON(rcu_dereference(nf_nat_pptp_hook_inbound)); 287 BUG_ON(nf_nat_pptp_hook_inbound != NULL);
288 rcu_assign_pointer(nf_nat_pptp_hook_inbound, pptp_inbound_pkt); 288 rcu_assign_pointer(nf_nat_pptp_hook_inbound, pptp_inbound_pkt);
289 289
290 BUG_ON(rcu_dereference(nf_nat_pptp_hook_exp_gre)); 290 BUG_ON(nf_nat_pptp_hook_exp_gre != NULL);
291 rcu_assign_pointer(nf_nat_pptp_hook_exp_gre, pptp_exp_gre); 291 rcu_assign_pointer(nf_nat_pptp_hook_exp_gre, pptp_exp_gre);
292 292
293 BUG_ON(rcu_dereference(nf_nat_pptp_hook_expectfn)); 293 BUG_ON(nf_nat_pptp_hook_expectfn != NULL);
294 rcu_assign_pointer(nf_nat_pptp_hook_expectfn, pptp_nat_expected); 294 rcu_assign_pointer(nf_nat_pptp_hook_expectfn, pptp_nat_expected);
295 return 0; 295 return 0;
296} 296}
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c
index ce9edbcc01e3..3ca98971a1e9 100644
--- a/net/ipv4/netfilter/nf_nat_sip.c
+++ b/net/ipv4/netfilter/nf_nat_sip.c
@@ -293,8 +293,8 @@ static void __exit nf_nat_sip_fini(void)
293 293
294static int __init nf_nat_sip_init(void) 294static int __init nf_nat_sip_init(void)
295{ 295{
296 BUG_ON(rcu_dereference(nf_nat_sip_hook)); 296 BUG_ON(nf_nat_sip_hook != NULL);
297 BUG_ON(rcu_dereference(nf_nat_sdp_hook)); 297 BUG_ON(nf_nat_sdp_hook != NULL);
298 rcu_assign_pointer(nf_nat_sip_hook, ip_nat_sip); 298 rcu_assign_pointer(nf_nat_sip_hook, ip_nat_sip);
299 rcu_assign_pointer(nf_nat_sdp_hook, ip_nat_sdp); 299 rcu_assign_pointer(nf_nat_sdp_hook, ip_nat_sdp);
300 return 0; 300 return 0;
diff --git a/net/ipv4/netfilter/nf_nat_tftp.c b/net/ipv4/netfilter/nf_nat_tftp.c
index 0ecec701cb44..1360a94766dd 100644
--- a/net/ipv4/netfilter/nf_nat_tftp.c
+++ b/net/ipv4/netfilter/nf_nat_tftp.c
@@ -43,7 +43,7 @@ static void __exit nf_nat_tftp_fini(void)
43 43
44static int __init nf_nat_tftp_init(void) 44static int __init nf_nat_tftp_init(void)
45{ 45{
46 BUG_ON(rcu_dereference(nf_nat_tftp_hook)); 46 BUG_ON(nf_nat_tftp_hook != NULL);
47 rcu_assign_pointer(nf_nat_tftp_hook, help); 47 rcu_assign_pointer(nf_nat_tftp_hook, help);
48 return 0; 48 return 0;
49} 49}
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 9be0daa9c0ec..ce34b281803f 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -46,17 +46,6 @@
46#include <net/sock.h> 46#include <net/sock.h>
47#include <net/raw.h> 47#include <net/raw.h>
48 48
49static int fold_prot_inuse(struct proto *proto)
50{
51 int res = 0;
52 int cpu;
53
54 for_each_possible_cpu(cpu)
55 res += proto->stats[cpu].inuse;
56
57 return res;
58}
59
60/* 49/*
61 * Report socket allocation statistics [mea@utu.fi] 50 * Report socket allocation statistics [mea@utu.fi]
62 */ 51 */
@@ -64,12 +53,12 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
64{ 53{
65 socket_seq_show(seq); 54 socket_seq_show(seq);
66 seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", 55 seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n",
67 fold_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count), 56 sock_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count),
68 tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated), 57 tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated),
69 atomic_read(&tcp_memory_allocated)); 58 atomic_read(&tcp_memory_allocated));
70 seq_printf(seq, "UDP: inuse %d\n", fold_prot_inuse(&udp_prot)); 59 seq_printf(seq, "UDP: inuse %d\n", sock_prot_inuse(&udp_prot));
71 seq_printf(seq, "UDPLITE: inuse %d\n", fold_prot_inuse(&udplite_prot)); 60 seq_printf(seq, "UDPLITE: inuse %d\n", sock_prot_inuse(&udplite_prot));
72 seq_printf(seq, "RAW: inuse %d\n", fold_prot_inuse(&raw_prot)); 61 seq_printf(seq, "RAW: inuse %d\n", sock_prot_inuse(&raw_prot));
73 seq_printf(seq, "FRAG: inuse %d memory %d\n", 62 seq_printf(seq, "FRAG: inuse %d memory %d\n",
74 ip_frag_nqueues(), ip_frag_mem()); 63 ip_frag_nqueues(), ip_frag_mem());
75 return 0; 64 return 0;
@@ -304,7 +293,7 @@ static void icmp_put(struct seq_file *seq)
304 for (i=0; icmpmibmap[i].name != NULL; i++) 293 for (i=0; icmpmibmap[i].name != NULL; i++)
305 seq_printf(seq, " %lu", 294 seq_printf(seq, " %lu",
306 snmp_fold_field((void **) icmpmsg_statistics, 295 snmp_fold_field((void **) icmpmsg_statistics,
307 icmpmibmap[i].index)); 296 icmpmibmap[i].index | 0x100));
308} 297}
309 298
310/* 299/*
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 3916faca3afe..66b42f547bf9 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -760,6 +760,8 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
760 } 760 }
761} 761}
762 762
763DEFINE_PROTO_INUSE(raw)
764
763struct proto raw_prot = { 765struct proto raw_prot = {
764 .name = "RAW", 766 .name = "RAW",
765 .owner = THIS_MODULE, 767 .owner = THIS_MODULE,
@@ -781,6 +783,7 @@ struct proto raw_prot = {
781 .compat_setsockopt = compat_raw_setsockopt, 783 .compat_setsockopt = compat_raw_setsockopt,
782 .compat_getsockopt = compat_raw_getsockopt, 784 .compat_getsockopt = compat_raw_getsockopt,
783#endif 785#endif
786 REF_PROTO_INUSE(raw)
784}; 787};
785 788
786#ifdef CONFIG_PROC_FS 789#ifdef CONFIG_PROC_FS
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 21b12de9e653..c426dec6d579 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -578,6 +578,9 @@ static void rt_check_expire(struct work_struct *work)
578 i = (i + 1) & rt_hash_mask; 578 i = (i + 1) & rt_hash_mask;
579 rthp = &rt_hash_table[i].chain; 579 rthp = &rt_hash_table[i].chain;
580 580
581 if (need_resched())
582 cond_resched();
583
581 if (*rthp == NULL) 584 if (*rthp == NULL)
582 continue; 585 continue;
583 spin_lock_bh(rt_hash_lock_addr(i)); 586 spin_lock_bh(rt_hash_lock_addr(i));
@@ -851,9 +854,7 @@ restart:
851 */ 854 */
852 rcu_assign_pointer(rt_hash_table[hash].chain, rth); 855 rcu_assign_pointer(rt_hash_table[hash].chain, rth);
853 856
854 rth->u.dst.__use++; 857 dst_use(&rth->u.dst, now);
855 dst_hold(&rth->u.dst);
856 rth->u.dst.lastuse = now;
857 spin_unlock_bh(rt_hash_lock_addr(hash)); 858 spin_unlock_bh(rt_hash_lock_addr(hash));
858 859
859 rt_drop(rt); 860 rt_drop(rt);
@@ -1813,11 +1814,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1813 goto martian_destination; 1814 goto martian_destination;
1814 1815
1815 err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos); 1816 err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos);
1816 if (err == -ENOBUFS)
1817 goto e_nobufs;
1818 if (err == -EINVAL)
1819 goto e_inval;
1820
1821done: 1817done:
1822 in_dev_put(in_dev); 1818 in_dev_put(in_dev);
1823 if (free_res) 1819 if (free_res)
@@ -1935,9 +1931,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1935 rth->fl.oif == 0 && 1931 rth->fl.oif == 0 &&
1936 rth->fl.mark == skb->mark && 1932 rth->fl.mark == skb->mark &&
1937 rth->fl.fl4_tos == tos) { 1933 rth->fl.fl4_tos == tos) {
1938 rth->u.dst.lastuse = jiffies; 1934 dst_use(&rth->u.dst, jiffies);
1939 dst_hold(&rth->u.dst);
1940 rth->u.dst.__use++;
1941 RT_CACHE_STAT_INC(in_hit); 1935 RT_CACHE_STAT_INC(in_hit);
1942 rcu_read_unlock(); 1936 rcu_read_unlock();
1943 skb->dst = (struct dst_entry*)rth; 1937 skb->dst = (struct dst_entry*)rth;
@@ -2331,9 +2325,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
2331 rth->fl.mark == flp->mark && 2325 rth->fl.mark == flp->mark &&
2332 !((rth->fl.fl4_tos ^ flp->fl4_tos) & 2326 !((rth->fl.fl4_tos ^ flp->fl4_tos) &
2333 (IPTOS_RT_MASK | RTO_ONLINK))) { 2327 (IPTOS_RT_MASK | RTO_ONLINK))) {
2334 rth->u.dst.lastuse = jiffies; 2328 dst_use(&rth->u.dst, jiffies);
2335 dst_hold(&rth->u.dst);
2336 rth->u.dst.__use++;
2337 RT_CACHE_STAT_INC(out_hit); 2329 RT_CACHE_STAT_INC(out_hit);
2338 rcu_read_unlock_bh(); 2330 rcu_read_unlock_bh();
2339 *rp = rth; 2331 *rp = rth;
@@ -2896,18 +2888,14 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset,
2896 offset /= sizeof(u32); 2888 offset /= sizeof(u32);
2897 2889
2898 if (length > 0) { 2890 if (length > 0) {
2899 u32 *src = ((u32 *) IP_RT_ACCT_CPU(0)) + offset;
2900 u32 *dst = (u32 *) buffer; 2891 u32 *dst = (u32 *) buffer;
2901 2892
2902 /* Copy first cpu. */
2903 *start = buffer; 2893 *start = buffer;
2904 memcpy(dst, src, length); 2894 memset(dst, 0, length);
2905 2895
2906 /* Add the other cpus in, one int at a time */
2907 for_each_possible_cpu(i) { 2896 for_each_possible_cpu(i) {
2908 unsigned int j; 2897 unsigned int j;
2909 2898 u32 *src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
2910 src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
2911 2899
2912 for (j = 0; j < length/4; j++) 2900 for (j = 0; j < length/4; j++)
2913 dst[j] += src[j]; 2901 dst[j] += src[j];
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index ffddd2b45352..bec6fe880657 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -191,7 +191,7 @@ static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
191 191
192 tcp_get_default_congestion_control(val); 192 tcp_get_default_congestion_control(val);
193 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen); 193 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
194 if (ret == 0 && newval && newlen) 194 if (ret == 1 && newval && newlen)
195 ret = tcp_set_default_congestion_control(val); 195 ret = tcp_set_default_congestion_control(val);
196 return ret; 196 return ret;
197} 197}
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2e6ad6dbba6c..8e65182f7af1 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2453,14 +2453,14 @@ 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);
2460 INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].chain); 2459 INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].chain);
2461 INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].twchain); 2460 INIT_HLIST_HEAD(&tcp_hashinfo.ehash[i].twchain);
2462 } 2461 }
2463 2462 if (inet_ehash_locks_alloc(&tcp_hashinfo))
2463 panic("TCP: failed to alloc ehash_locks");
2464 tcp_hashinfo.bhash = 2464 tcp_hashinfo.bhash =
2465 alloc_large_system_hash("TCP bind", 2465 alloc_large_system_hash("TCP bind",
2466 sizeof(struct inet_bind_hashbucket), 2466 sizeof(struct inet_bind_hashbucket),
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 69d8c38ccd39..0f0c1c9829a1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1269,6 +1269,9 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1269 if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window)) 1269 if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window))
1270 return 0; 1270 return 0;
1271 1271
1272 if (!tp->packets_out)
1273 goto out;
1274
1272 /* SACK fastpath: 1275 /* SACK fastpath:
1273 * if the only SACK change is the increase of the end_seq of 1276 * if the only SACK change is the increase of the end_seq of
1274 * the first block then only apply that SACK block 1277 * the first block then only apply that SACK block
@@ -1330,12 +1333,15 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1330 cached_fack_count = 0; 1333 cached_fack_count = 0;
1331 } 1334 }
1332 1335
1333 for (i=0; i<num_sacks; i++, sp++) { 1336 for (i = 0; i < num_sacks; i++) {
1334 struct sk_buff *skb; 1337 struct sk_buff *skb;
1335 __u32 start_seq = ntohl(sp->start_seq); 1338 __u32 start_seq = ntohl(sp->start_seq);
1336 __u32 end_seq = ntohl(sp->end_seq); 1339 __u32 end_seq = ntohl(sp->end_seq);
1337 int fack_count; 1340 int fack_count;
1338 int dup_sack = (found_dup_sack && (i == first_sack_index)); 1341 int dup_sack = (found_dup_sack && (i == first_sack_index));
1342 int next_dup = (found_dup_sack && (i+1 == first_sack_index));
1343
1344 sp++;
1339 1345
1340 if (!tcp_is_sackblock_valid(tp, dup_sack, start_seq, end_seq)) { 1346 if (!tcp_is_sackblock_valid(tp, dup_sack, start_seq, end_seq)) {
1341 if (dup_sack) { 1347 if (dup_sack) {
@@ -1361,7 +1367,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1361 flag |= FLAG_DATA_LOST; 1367 flag |= FLAG_DATA_LOST;
1362 1368
1363 tcp_for_write_queue_from(skb, sk) { 1369 tcp_for_write_queue_from(skb, sk) {
1364 int in_sack; 1370 int in_sack = 0;
1365 u8 sacked; 1371 u8 sacked;
1366 1372
1367 if (skb == tcp_send_head(sk)) 1373 if (skb == tcp_send_head(sk))
@@ -1380,11 +1386,25 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1380 if (!before(TCP_SKB_CB(skb)->seq, end_seq)) 1386 if (!before(TCP_SKB_CB(skb)->seq, end_seq))
1381 break; 1387 break;
1382 1388
1383 in_sack = tcp_match_skb_to_sack(sk, skb, start_seq, end_seq); 1389 dup_sack = (found_dup_sack && (i == first_sack_index));
1384 if (in_sack < 0) 1390
1385 break; 1391 /* Due to sorting DSACK may reside within this SACK block! */
1392 if (next_dup) {
1393 u32 dup_start = ntohl(sp->start_seq);
1394 u32 dup_end = ntohl(sp->end_seq);
1386 1395
1387 fack_count += tcp_skb_pcount(skb); 1396 if (before(TCP_SKB_CB(skb)->seq, dup_end)) {
1397 in_sack = tcp_match_skb_to_sack(sk, skb, dup_start, dup_end);
1398 if (in_sack > 0)
1399 dup_sack = 1;
1400 }
1401 }
1402
1403 /* DSACK info lost if out-of-mem, try SACK still */
1404 if (in_sack <= 0)
1405 in_sack = tcp_match_skb_to_sack(sk, skb, start_seq, end_seq);
1406 if (unlikely(in_sack < 0))
1407 break;
1388 1408
1389 sacked = TCP_SKB_CB(skb)->sacked; 1409 sacked = TCP_SKB_CB(skb)->sacked;
1390 1410
@@ -1400,19 +1420,17 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1400 if ((dup_sack && in_sack) && 1420 if ((dup_sack && in_sack) &&
1401 (sacked&TCPCB_SACKED_ACKED)) 1421 (sacked&TCPCB_SACKED_ACKED))
1402 reord = min(fack_count, reord); 1422 reord = min(fack_count, reord);
1403 } else {
1404 /* If it was in a hole, we detected reordering. */
1405 if (fack_count < prior_fackets &&
1406 !(sacked&TCPCB_SACKED_ACKED))
1407 reord = min(fack_count, reord);
1408 } 1423 }
1409 1424
1410 /* Nothing to do; acked frame is about to be dropped. */ 1425 /* Nothing to do; acked frame is about to be dropped. */
1426 fack_count += tcp_skb_pcount(skb);
1411 continue; 1427 continue;
1412 } 1428 }
1413 1429
1414 if (!in_sack) 1430 if (!in_sack) {
1431 fack_count += tcp_skb_pcount(skb);
1415 continue; 1432 continue;
1433 }
1416 1434
1417 if (!(sacked&TCPCB_SACKED_ACKED)) { 1435 if (!(sacked&TCPCB_SACKED_ACKED)) {
1418 if (sacked & TCPCB_SACKED_RETRANS) { 1436 if (sacked & TCPCB_SACKED_RETRANS) {
@@ -1429,12 +1447,17 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1429 tp->retransmit_skb_hint = NULL; 1447 tp->retransmit_skb_hint = NULL;
1430 } 1448 }
1431 } else { 1449 } else {
1432 /* New sack for not retransmitted frame, 1450 if (!(sacked & TCPCB_RETRANS)) {
1433 * which was in hole. It is reordering. 1451 /* New sack for not retransmitted frame,
1434 */ 1452 * which was in hole. It is reordering.
1435 if (!(sacked & TCPCB_RETRANS) && 1453 */
1436 fack_count < prior_fackets) 1454 if (fack_count < prior_fackets)
1437 reord = min(fack_count, reord); 1455 reord = min(fack_count, reord);
1456
1457 /* SACK enhanced F-RTO (RFC4138; Appendix B) */
1458 if (!after(TCP_SKB_CB(skb)->end_seq, tp->frto_highmark))
1459 flag |= FLAG_ONLY_ORIG_SACKED;
1460 }
1438 1461
1439 if (sacked & TCPCB_LOST) { 1462 if (sacked & TCPCB_LOST) {
1440 TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST; 1463 TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST;
@@ -1443,24 +1466,13 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1443 /* clear lost hint */ 1466 /* clear lost hint */
1444 tp->retransmit_skb_hint = NULL; 1467 tp->retransmit_skb_hint = NULL;
1445 } 1468 }
1446 /* SACK enhanced F-RTO detection.
1447 * Set flag if and only if non-rexmitted
1448 * segments below frto_highmark are
1449 * SACKed (RFC4138; Appendix B).
1450 * Clearing correct due to in-order walk
1451 */
1452 if (after(end_seq, tp->frto_highmark)) {
1453 flag &= ~FLAG_ONLY_ORIG_SACKED;
1454 } else {
1455 if (!(sacked & TCPCB_RETRANS))
1456 flag |= FLAG_ONLY_ORIG_SACKED;
1457 }
1458 } 1469 }
1459 1470
1460 TCP_SKB_CB(skb)->sacked |= TCPCB_SACKED_ACKED; 1471 TCP_SKB_CB(skb)->sacked |= TCPCB_SACKED_ACKED;
1461 flag |= FLAG_DATA_SACKED; 1472 flag |= FLAG_DATA_SACKED;
1462 tp->sacked_out += tcp_skb_pcount(skb); 1473 tp->sacked_out += tcp_skb_pcount(skb);
1463 1474
1475 fack_count += tcp_skb_pcount(skb);
1464 if (fack_count > tp->fackets_out) 1476 if (fack_count > tp->fackets_out)
1465 tp->fackets_out = fack_count; 1477 tp->fackets_out = fack_count;
1466 1478
@@ -1471,6 +1483,8 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1471 } else { 1483 } else {
1472 if (dup_sack && (sacked&TCPCB_RETRANS)) 1484 if (dup_sack && (sacked&TCPCB_RETRANS))
1473 reord = min(fack_count, reord); 1485 reord = min(fack_count, reord);
1486
1487 fack_count += tcp_skb_pcount(skb);
1474 } 1488 }
1475 1489
1476 /* D-SACK. We can detect redundant retransmission 1490 /* D-SACK. We can detect redundant retransmission
@@ -1485,6 +1499,12 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1485 tp->retransmit_skb_hint = NULL; 1499 tp->retransmit_skb_hint = NULL;
1486 } 1500 }
1487 } 1501 }
1502
1503 /* SACK enhanced FRTO (RFC4138, Appendix B): Clearing correct
1504 * due to in-order walk
1505 */
1506 if (after(end_seq, tp->frto_highmark))
1507 flag &= ~FLAG_ONLY_ORIG_SACKED;
1488 } 1508 }
1489 1509
1490 if (tp->retrans_out && 1510 if (tp->retrans_out &&
@@ -1496,7 +1516,9 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1496 1516
1497 if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss && 1517 if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss &&
1498 (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark))) 1518 (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark)))
1499 tcp_update_reordering(sk, ((tp->fackets_out + 1) - reord), 0); 1519 tcp_update_reordering(sk, tp->fackets_out - reord, 0);
1520
1521out:
1500 1522
1501#if FASTRETRANS_DEBUG > 0 1523#if FASTRETRANS_DEBUG > 0
1502 BUG_TRAP((int)tp->sacked_out >= 0); 1524 BUG_TRAP((int)tp->sacked_out >= 0);
@@ -1652,6 +1674,9 @@ void tcp_enter_frto(struct sock *sk)
1652 } 1674 }
1653 tcp_verify_left_out(tp); 1675 tcp_verify_left_out(tp);
1654 1676
1677 /* Too bad if TCP was application limited */
1678 tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp) + 1);
1679
1655 /* Earlier loss recovery underway (see RFC4138; Appendix B). 1680 /* Earlier loss recovery underway (see RFC4138; Appendix B).
1656 * The last condition is necessary at least in tp->frto_counter case. 1681 * The last condition is necessary at least in tp->frto_counter case.
1657 */ 1682 */
@@ -1684,6 +1709,8 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag)
1684 tcp_for_write_queue(skb, sk) { 1709 tcp_for_write_queue(skb, sk) {
1685 if (skb == tcp_send_head(sk)) 1710 if (skb == tcp_send_head(sk))
1686 break; 1711 break;
1712
1713 TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST;
1687 /* 1714 /*
1688 * Count the retransmission made on RTO correctly (only when 1715 * Count the retransmission made on RTO correctly (only when
1689 * waiting for the first ACK and did not get it)... 1716 * waiting for the first ACK and did not get it)...
@@ -1697,7 +1724,7 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag)
1697 } else { 1724 } else {
1698 if (TCP_SKB_CB(skb)->sacked & TCPCB_RETRANS) 1725 if (TCP_SKB_CB(skb)->sacked & TCPCB_RETRANS)
1699 tp->undo_marker = 0; 1726 tp->undo_marker = 0;
1700 TCP_SKB_CB(skb)->sacked &= ~(TCPCB_LOST|TCPCB_SACKED_RETRANS); 1727 TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS;
1701 } 1728 }
1702 1729
1703 /* Don't lost mark skbs that were fwd transmitted after RTO */ 1730 /* Don't lost mark skbs that were fwd transmitted after RTO */
@@ -2059,7 +2086,7 @@ static void tcp_update_scoreboard(struct sock *sk)
2059 if (!tcp_skb_timedout(sk, skb)) 2086 if (!tcp_skb_timedout(sk, skb))
2060 break; 2087 break;
2061 2088
2062 if (!(TCP_SKB_CB(skb)->sacked&TCPCB_TAGBITS)) { 2089 if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_SACKED_ACKED|TCPCB_LOST))) {
2063 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; 2090 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
2064 tp->lost_out += tcp_skb_pcount(skb); 2091 tp->lost_out += tcp_skb_pcount(skb);
2065 tcp_verify_retransmit_hint(tp, skb); 2092 tcp_verify_retransmit_hint(tp, skb);
@@ -2611,7 +2638,8 @@ static u32 tcp_tso_acked(struct sock *sk, struct sk_buff *skb)
2611 * is before the ack sequence we can discard it as it's confirmed to have 2638 * is before the ack sequence we can discard it as it's confirmed to have
2612 * arrived at the other end. 2639 * arrived at the other end.
2613 */ 2640 */
2614static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p) 2641static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
2642 int prior_fackets)
2615{ 2643{
2616 struct tcp_sock *tp = tcp_sk(sk); 2644 struct tcp_sock *tp = tcp_sk(sk);
2617 const struct inet_connection_sock *icsk = inet_csk(sk); 2645 const struct inet_connection_sock *icsk = inet_csk(sk);
@@ -2620,6 +2648,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
2620 int fully_acked = 1; 2648 int fully_acked = 1;
2621 int flag = 0; 2649 int flag = 0;
2622 int prior_packets = tp->packets_out; 2650 int prior_packets = tp->packets_out;
2651 u32 cnt = 0;
2652 u32 reord = tp->packets_out;
2623 s32 seq_rtt = -1; 2653 s32 seq_rtt = -1;
2624 ktime_t last_ackt = net_invalid_timestamp(); 2654 ktime_t last_ackt = net_invalid_timestamp();
2625 2655
@@ -2660,10 +2690,14 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
2660 if ((flag & FLAG_DATA_ACKED) || 2690 if ((flag & FLAG_DATA_ACKED) ||
2661 (packets_acked > 1)) 2691 (packets_acked > 1))
2662 flag |= FLAG_NONHEAD_RETRANS_ACKED; 2692 flag |= FLAG_NONHEAD_RETRANS_ACKED;
2663 } else if (seq_rtt < 0) { 2693 } else {
2664 seq_rtt = now - scb->when; 2694 if (seq_rtt < 0) {
2665 if (fully_acked) 2695 seq_rtt = now - scb->when;
2666 last_ackt = skb->tstamp; 2696 if (fully_acked)
2697 last_ackt = skb->tstamp;
2698 }
2699 if (!(sacked & TCPCB_SACKED_ACKED))
2700 reord = min(cnt, reord);
2667 } 2701 }
2668 2702
2669 if (sacked & TCPCB_SACKED_ACKED) 2703 if (sacked & TCPCB_SACKED_ACKED)
@@ -2674,12 +2708,16 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
2674 if ((sacked & TCPCB_URG) && tp->urg_mode && 2708 if ((sacked & TCPCB_URG) && tp->urg_mode &&
2675 !before(end_seq, tp->snd_up)) 2709 !before(end_seq, tp->snd_up))
2676 tp->urg_mode = 0; 2710 tp->urg_mode = 0;
2677 } else if (seq_rtt < 0) { 2711 } else {
2678 seq_rtt = now - scb->when; 2712 if (seq_rtt < 0) {
2679 if (fully_acked) 2713 seq_rtt = now - scb->when;
2680 last_ackt = skb->tstamp; 2714 if (fully_acked)
2715 last_ackt = skb->tstamp;
2716 }
2717 reord = min(cnt, reord);
2681 } 2718 }
2682 tp->packets_out -= packets_acked; 2719 tp->packets_out -= packets_acked;
2720 cnt += packets_acked;
2683 2721
2684 /* Initial outgoing SYN's get put onto the write_queue 2722 /* Initial outgoing SYN's get put onto the write_queue
2685 * just like anything else we transmit. It is not 2723 * just like anything else we transmit. It is not
@@ -2711,13 +2749,18 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p)
2711 tcp_ack_update_rtt(sk, flag, seq_rtt); 2749 tcp_ack_update_rtt(sk, flag, seq_rtt);
2712 tcp_rearm_rto(sk); 2750 tcp_rearm_rto(sk);
2713 2751
2752 if (tcp_is_reno(tp)) {
2753 tcp_remove_reno_sacks(sk, pkts_acked);
2754 } else {
2755 /* Non-retransmitted hole got filled? That's reordering */
2756 if (reord < prior_fackets)
2757 tcp_update_reordering(sk, tp->fackets_out - reord, 0);
2758 }
2759
2714 tp->fackets_out -= min(pkts_acked, tp->fackets_out); 2760 tp->fackets_out -= min(pkts_acked, tp->fackets_out);
2715 /* hint's skb might be NULL but we don't need to care */ 2761 /* hint's skb might be NULL but we don't need to care */
2716 tp->fastpath_cnt_hint -= min_t(u32, pkts_acked, 2762 tp->fastpath_cnt_hint -= min_t(u32, pkts_acked,
2717 tp->fastpath_cnt_hint); 2763 tp->fastpath_cnt_hint);
2718 if (tcp_is_reno(tp))
2719 tcp_remove_reno_sacks(sk, pkts_acked);
2720
2721 if (ca_ops->pkts_acked) { 2764 if (ca_ops->pkts_acked) {
2722 s32 rtt_us = -1; 2765 s32 rtt_us = -1;
2723 2766
@@ -3000,6 +3043,7 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
3000 u32 ack_seq = TCP_SKB_CB(skb)->seq; 3043 u32 ack_seq = TCP_SKB_CB(skb)->seq;
3001 u32 ack = TCP_SKB_CB(skb)->ack_seq; 3044 u32 ack = TCP_SKB_CB(skb)->ack_seq;
3002 u32 prior_in_flight; 3045 u32 prior_in_flight;
3046 u32 prior_fackets;
3003 s32 seq_rtt; 3047 s32 seq_rtt;
3004 int prior_packets; 3048 int prior_packets;
3005 int frto_cwnd = 0; 3049 int frto_cwnd = 0;
@@ -3024,6 +3068,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
3024 tp->bytes_acked += min(ack - prior_snd_una, tp->mss_cache); 3068 tp->bytes_acked += min(ack - prior_snd_una, tp->mss_cache);
3025 } 3069 }
3026 3070
3071 prior_fackets = tp->fackets_out;
3072
3027 if (!(flag&FLAG_SLOWPATH) && after(ack, prior_snd_una)) { 3073 if (!(flag&FLAG_SLOWPATH) && after(ack, prior_snd_una)) {
3028 /* Window is constant, pure forward advance. 3074 /* Window is constant, pure forward advance.
3029 * No more checks are required. 3075 * No more checks are required.
@@ -3065,13 +3111,13 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
3065 prior_in_flight = tcp_packets_in_flight(tp); 3111 prior_in_flight = tcp_packets_in_flight(tp);
3066 3112
3067 /* See if we can take anything off of the retransmit queue. */ 3113 /* See if we can take anything off of the retransmit queue. */
3068 flag |= tcp_clean_rtx_queue(sk, &seq_rtt); 3114 flag |= tcp_clean_rtx_queue(sk, &seq_rtt, prior_fackets);
3069 3115
3116 if (tp->frto_counter)
3117 frto_cwnd = tcp_process_frto(sk, flag);
3070 /* Guarantee sacktag reordering detection against wrap-arounds */ 3118 /* Guarantee sacktag reordering detection against wrap-arounds */
3071 if (before(tp->frto_highmark, tp->snd_una)) 3119 if (before(tp->frto_highmark, tp->snd_una))
3072 tp->frto_highmark = 0; 3120 tp->frto_highmark = 0;
3073 if (tp->frto_counter)
3074 frto_cwnd = tcp_process_frto(sk, flag);
3075 3121
3076 if (tcp_ack_is_dubious(sk, flag)) { 3122 if (tcp_ack_is_dubious(sk, flag)) {
3077 /* Advance CWND, if state allows this. */ 3123 /* Advance CWND, if state allows this. */
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index ad759f1c3777..652c32368ccc 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
@@ -900,8 +900,7 @@ int tcp_v4_md5_do_add(struct sock *sk, __be32 addr,
900 sizeof(*keys) * md5sig->entries4); 900 sizeof(*keys) * md5sig->entries4);
901 901
902 /* Free old key list, and reference new one */ 902 /* Free old key list, and reference new one */
903 if (md5sig->keys4) 903 kfree(md5sig->keys4);
904 kfree(md5sig->keys4);
905 md5sig->keys4 = keys; 904 md5sig->keys4 = keys;
906 md5sig->alloced4++; 905 md5sig->alloced4++;
907 } 906 }
@@ -939,10 +938,10 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr)
939 tp->md5sig_info->alloced4 = 0; 938 tp->md5sig_info->alloced4 = 0;
940 } else if (tp->md5sig_info->entries4 != i) { 939 } else if (tp->md5sig_info->entries4 != i) {
941 /* Need to do some manipulation */ 940 /* Need to do some manipulation */
942 memcpy(&tp->md5sig_info->keys4[i], 941 memmove(&tp->md5sig_info->keys4[i],
943 &tp->md5sig_info->keys4[i+1], 942 &tp->md5sig_info->keys4[i+1],
944 (tp->md5sig_info->entries4 - i) * 943 (tp->md5sig_info->entries4 - i) *
945 sizeof(struct tcp4_md5sig_key)); 944 sizeof(struct tcp4_md5sig_key));
946 } 945 }
947 tcp_free_md5sig_pool(); 946 tcp_free_md5sig_pool();
948 return 0; 947 return 0;
@@ -1083,7 +1082,7 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
1083 sg_set_buf(&sg[block++], key->key, key->keylen); 1082 sg_set_buf(&sg[block++], key->key, key->keylen);
1084 nbytes += key->keylen; 1083 nbytes += key->keylen;
1085 1084
1086 sg_mark_end(sg, block); 1085 sg_mark_end(&sg[block - 1]);
1087 1086
1088 /* Now store the Hash into the packet */ 1087 /* Now store the Hash into the packet */
1089 err = crypto_hash_init(desc); 1088 err = crypto_hash_init(desc);
@@ -2049,8 +2048,9 @@ static void *established_get_first(struct seq_file *seq)
2049 struct sock *sk; 2048 struct sock *sk;
2050 struct hlist_node *node; 2049 struct hlist_node *node;
2051 struct inet_timewait_sock *tw; 2050 struct inet_timewait_sock *tw;
2051 rwlock_t *lock = inet_ehash_lockp(&tcp_hashinfo, st->bucket);
2052 2052
2053 read_lock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2053 read_lock_bh(lock);
2054 sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { 2054 sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
2055 if (sk->sk_family != st->family) { 2055 if (sk->sk_family != st->family) {
2056 continue; 2056 continue;
@@ -2067,7 +2067,7 @@ static void *established_get_first(struct seq_file *seq)
2067 rc = tw; 2067 rc = tw;
2068 goto out; 2068 goto out;
2069 } 2069 }
2070 read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2070 read_unlock_bh(lock);
2071 st->state = TCP_SEQ_STATE_ESTABLISHED; 2071 st->state = TCP_SEQ_STATE_ESTABLISHED;
2072 } 2072 }
2073out: 2073out:
@@ -2094,11 +2094,11 @@ get_tw:
2094 cur = tw; 2094 cur = tw;
2095 goto out; 2095 goto out;
2096 } 2096 }
2097 read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2097 read_unlock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket));
2098 st->state = TCP_SEQ_STATE_ESTABLISHED; 2098 st->state = TCP_SEQ_STATE_ESTABLISHED;
2099 2099
2100 if (++st->bucket < tcp_hashinfo.ehash_size) { 2100 if (++st->bucket < tcp_hashinfo.ehash_size) {
2101 read_lock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2101 read_lock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket));
2102 sk = sk_head(&tcp_hashinfo.ehash[st->bucket].chain); 2102 sk = sk_head(&tcp_hashinfo.ehash[st->bucket].chain);
2103 } else { 2103 } else {
2104 cur = NULL; 2104 cur = NULL;
@@ -2206,7 +2206,7 @@ static void tcp_seq_stop(struct seq_file *seq, void *v)
2206 case TCP_SEQ_STATE_TIME_WAIT: 2206 case TCP_SEQ_STATE_TIME_WAIT:
2207 case TCP_SEQ_STATE_ESTABLISHED: 2207 case TCP_SEQ_STATE_ESTABLISHED:
2208 if (v) 2208 if (v)
2209 read_unlock_bh(&tcp_hashinfo.ehash[st->bucket].lock); 2209 read_unlock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket));
2210 break; 2210 break;
2211 } 2211 }
2212} 2212}
@@ -2417,6 +2417,8 @@ void tcp4_proc_exit(void)
2417} 2417}
2418#endif /* CONFIG_PROC_FS */ 2418#endif /* CONFIG_PROC_FS */
2419 2419
2420DEFINE_PROTO_INUSE(tcp)
2421
2420struct proto tcp_prot = { 2422struct proto tcp_prot = {
2421 .name = "TCP", 2423 .name = "TCP",
2422 .owner = THIS_MODULE, 2424 .owner = THIS_MODULE,
@@ -2451,6 +2453,7 @@ struct proto tcp_prot = {
2451 .compat_setsockopt = compat_tcp_setsockopt, 2453 .compat_setsockopt = compat_tcp_setsockopt,
2452 .compat_getsockopt = compat_tcp_getsockopt, 2454 .compat_getsockopt = compat_tcp_getsockopt,
2453#endif 2455#endif
2456 REF_PROTO_INUSE(tcp)
2454}; 2457};
2455 2458
2456void __init tcp_v4_init(struct net_proto_family *ops) 2459void __init tcp_v4_init(struct net_proto_family *ops)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 324b4207254a..e5130a7fe181 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1295,6 +1295,7 @@ static int tcp_mtu_probe(struct sock *sk)
1295 struct sk_buff *skb, *nskb, *next; 1295 struct sk_buff *skb, *nskb, *next;
1296 int len; 1296 int len;
1297 int probe_size; 1297 int probe_size;
1298 int size_needed;
1298 unsigned int pif; 1299 unsigned int pif;
1299 int copy; 1300 int copy;
1300 int mss_now; 1301 int mss_now;
@@ -1313,27 +1314,20 @@ static int tcp_mtu_probe(struct sock *sk)
1313 /* Very simple search strategy: just double the MSS. */ 1314 /* Very simple search strategy: just double the MSS. */
1314 mss_now = tcp_current_mss(sk, 0); 1315 mss_now = tcp_current_mss(sk, 0);
1315 probe_size = 2*tp->mss_cache; 1316 probe_size = 2*tp->mss_cache;
1317 size_needed = probe_size + (tp->reordering + 1) * tp->mss_cache;
1316 if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high)) { 1318 if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high)) {
1317 /* TODO: set timer for probe_converge_event */ 1319 /* TODO: set timer for probe_converge_event */
1318 return -1; 1320 return -1;
1319 } 1321 }
1320 1322
1321 /* Have enough data in the send queue to probe? */ 1323 /* Have enough data in the send queue to probe? */
1322 len = 0; 1324 if (tp->write_seq - tp->snd_nxt < size_needed)
1323 if ((skb = tcp_send_head(sk)) == NULL)
1324 return -1;
1325 while ((len += skb->len) < probe_size && !tcp_skb_is_last(sk, skb))
1326 skb = tcp_write_queue_next(sk, skb);
1327 if (len < probe_size)
1328 return -1; 1325 return -1;
1329 1326
1330 /* Receive window check. */ 1327 if (tp->snd_wnd < size_needed)
1331 if (after(TCP_SKB_CB(skb)->seq + probe_size, tp->snd_una + tp->snd_wnd)) { 1328 return -1;
1332 if (tp->snd_wnd < probe_size) 1329 if (after(tp->snd_nxt + size_needed, tp->snd_una + tp->snd_wnd))
1333 return -1; 1330 return 0;
1334 else
1335 return 0;
1336 }
1337 1331
1338 /* Do we need to wait to drain cwnd? */ 1332 /* Do we need to wait to drain cwnd? */
1339 pif = tcp_packets_in_flight(tp); 1333 pif = tcp_packets_in_flight(tp);
@@ -1352,7 +1346,6 @@ static int tcp_mtu_probe(struct sock *sk)
1352 1346
1353 skb = tcp_send_head(sk); 1347 skb = tcp_send_head(sk);
1354 tcp_insert_write_queue_before(nskb, skb, sk); 1348 tcp_insert_write_queue_before(nskb, skb, sk);
1355 tcp_advance_send_head(sk, skb);
1356 1349
1357 TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(skb)->seq; 1350 TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(skb)->seq;
1358 TCP_SKB_CB(nskb)->end_seq = TCP_SKB_CB(skb)->seq + probe_size; 1351 TCP_SKB_CB(nskb)->end_seq = TCP_SKB_CB(skb)->seq + probe_size;
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/tunnel4.c b/net/ipv4/tunnel4.c
index a794a8ca8b4f..978b3fd61e65 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -17,6 +17,11 @@ static struct xfrm_tunnel *tunnel4_handlers;
17static struct xfrm_tunnel *tunnel64_handlers; 17static struct xfrm_tunnel *tunnel64_handlers;
18static DEFINE_MUTEX(tunnel4_mutex); 18static DEFINE_MUTEX(tunnel4_mutex);
19 19
20static inline struct xfrm_tunnel **fam_handlers(unsigned short family)
21{
22 return (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers;
23}
24
20int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family) 25int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family)
21{ 26{
22 struct xfrm_tunnel **pprev; 27 struct xfrm_tunnel **pprev;
@@ -25,8 +30,7 @@ int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family)
25 30
26 mutex_lock(&tunnel4_mutex); 31 mutex_lock(&tunnel4_mutex);
27 32
28 for (pprev = (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; 33 for (pprev = fam_handlers(family); *pprev; pprev = &(*pprev)->next) {
29 *pprev; pprev = &(*pprev)->next) {
30 if ((*pprev)->priority > priority) 34 if ((*pprev)->priority > priority)
31 break; 35 break;
32 if ((*pprev)->priority == priority) 36 if ((*pprev)->priority == priority)
@@ -53,8 +57,7 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family)
53 57
54 mutex_lock(&tunnel4_mutex); 58 mutex_lock(&tunnel4_mutex);
55 59
56 for (pprev = (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers; 60 for (pprev = fam_handlers(family); *pprev; pprev = &(*pprev)->next) {
57 *pprev; pprev = &(*pprev)->next) {
58 if (*pprev == handler) { 61 if (*pprev == handler) {
59 *pprev = handler->next; 62 *pprev = handler->next;
60 ret = 0; 63 ret = 0;
@@ -118,6 +121,17 @@ static void tunnel4_err(struct sk_buff *skb, u32 info)
118 break; 121 break;
119} 122}
120 123
124#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
125static void tunnel64_err(struct sk_buff *skb, u32 info)
126{
127 struct xfrm_tunnel *handler;
128
129 for (handler = tunnel64_handlers; handler; handler = handler->next)
130 if (!handler->err_handler(skb, info))
131 break;
132}
133#endif
134
121static struct net_protocol tunnel4_protocol = { 135static struct net_protocol tunnel4_protocol = {
122 .handler = tunnel4_rcv, 136 .handler = tunnel4_rcv,
123 .err_handler = tunnel4_err, 137 .err_handler = tunnel4_err,
@@ -127,7 +141,7 @@ static struct net_protocol tunnel4_protocol = {
127#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 141#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
128static struct net_protocol tunnel64_protocol = { 142static struct net_protocol tunnel64_protocol = {
129 .handler = tunnel64_rcv, 143 .handler = tunnel64_rcv,
130 .err_handler = tunnel4_err, 144 .err_handler = tunnel64_err,
131 .no_policy = 1, 145 .no_policy = 1,
132}; 146};
133#endif 147#endif
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 4bc25b46f33f..03c400ca14c5 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1430,6 +1430,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
1430 1430
1431} 1431}
1432 1432
1433DEFINE_PROTO_INUSE(udp)
1434
1433struct proto udp_prot = { 1435struct proto udp_prot = {
1434 .name = "UDP", 1436 .name = "UDP",
1435 .owner = THIS_MODULE, 1437 .owner = THIS_MODULE,
@@ -1452,6 +1454,7 @@ struct proto udp_prot = {
1452 .compat_setsockopt = compat_udp_setsockopt, 1454 .compat_setsockopt = compat_udp_setsockopt,
1453 .compat_getsockopt = compat_udp_getsockopt, 1455 .compat_getsockopt = compat_udp_getsockopt,
1454#endif 1456#endif
1457 REF_PROTO_INUSE(udp)
1455}; 1458};
1456 1459
1457/* ------------------------------------------------------------------------ */ 1460/* ------------------------------------------------------------------------ */
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index 94977205abb4..f5baeb3e8b85 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -44,6 +44,8 @@ static struct net_protocol udplite_protocol = {
44 .no_policy = 1, 44 .no_policy = 1,
45}; 45};
46 46
47DEFINE_PROTO_INUSE(udplite)
48
47struct proto udplite_prot = { 49struct proto udplite_prot = {
48 .name = "UDP-Lite", 50 .name = "UDP-Lite",
49 .owner = THIS_MODULE, 51 .owner = THIS_MODULE,
@@ -67,6 +69,7 @@ struct proto udplite_prot = {
67 .compat_setsockopt = compat_udp_setsockopt, 69 .compat_setsockopt = compat_udp_setsockopt,
68 .compat_getsockopt = compat_udp_getsockopt, 70 .compat_getsockopt = compat_udp_getsockopt,
69#endif 71#endif
72 REF_PROTO_INUSE(udplite)
70}; 73};
71 74
72static struct inet_protosw udplite4_protosw = { 75static struct inet_protosw udplite4_protosw = {
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 348bd8d06112..567664eac463 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -967,7 +967,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
967 if (unlikely(score.addr_type == IPV6_ADDR_ANY || 967 if (unlikely(score.addr_type == IPV6_ADDR_ANY ||
968 score.addr_type & IPV6_ADDR_MULTICAST)) { 968 score.addr_type & IPV6_ADDR_MULTICAST)) {
969 LIMIT_NETDEBUG(KERN_DEBUG 969 LIMIT_NETDEBUG(KERN_DEBUG
970 "ADDRCONF: unspecified / multicast address" 970 "ADDRCONF: unspecified / multicast address "
971 "assigned as unicast address on %s", 971 "assigned as unicast address on %s",
972 dev->name); 972 dev->name);
973 continue; 973 continue;
@@ -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/ah6.c b/net/ipv6/ah6.c
index 66a9139d46e9..4eaf55072b1b 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -35,7 +35,6 @@
35#include <net/ipv6.h> 35#include <net/ipv6.h>
36#include <net/protocol.h> 36#include <net/protocol.h>
37#include <net/xfrm.h> 37#include <net/xfrm.h>
38#include <asm/scatterlist.h>
39 38
40static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr) 39static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr)
41{ 40{
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index ab17b5e62355..7db66f10e00d 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -110,9 +110,10 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
110 goto unlock; 110 goto unlock;
111 } 111 }
112 sg_init_table(sg, nfrags); 112 sg_init_table(sg, nfrags);
113 sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data + 113 skb_to_sgvec(skb, sg,
114 esp->conf.ivlen - 114 esph->enc_data +
115 skb->data, clen)); 115 esp->conf.ivlen -
116 skb->data, clen);
116 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); 117 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
117 if (unlikely(sg != &esp->sgbuf[0])) 118 if (unlikely(sg != &esp->sgbuf[0]))
118 kfree(sg); 119 kfree(sg);
@@ -209,9 +210,9 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
209 } 210 }
210 } 211 }
211 sg_init_table(sg, nfrags); 212 sg_init_table(sg, nfrags);
212 sg_mark_end(sg, skb_to_sgvec(skb, sg, 213 skb_to_sgvec(skb, sg,
213 sizeof(*esph) + esp->conf.ivlen, 214 sizeof(*esph) + esp->conf.ivlen,
214 elen)); 215 elen);
215 ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen); 216 ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
216 if (unlikely(sg != &esp->sgbuf[0])) 217 if (unlikely(sg != &esp->sgbuf[0]))
217 kfree(sg); 218 kfree(sg);
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 706622af206f..428c6b0e26d8 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -31,25 +31,6 @@ struct fib6_rule
31 31
32static struct fib_rules_ops fib6_rules_ops; 32static struct fib_rules_ops fib6_rules_ops;
33 33
34static struct fib6_rule main_rule = {
35 .common = {
36 .refcnt = ATOMIC_INIT(2),
37 .pref = 0x7FFE,
38 .action = FR_ACT_TO_TBL,
39 .table = RT6_TABLE_MAIN,
40 },
41};
42
43static struct fib6_rule local_rule = {
44 .common = {
45 .refcnt = ATOMIC_INIT(2),
46 .pref = 0,
47 .action = FR_ACT_TO_TBL,
48 .table = RT6_TABLE_LOCAL,
49 .flags = FIB_RULE_PERMANENT,
50 },
51};
52
53struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags, 34struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
54 pol_lookup_t lookup) 35 pol_lookup_t lookup)
55{ 36{
@@ -270,11 +251,23 @@ static struct fib_rules_ops fib6_rules_ops = {
270 .owner = THIS_MODULE, 251 .owner = THIS_MODULE,
271}; 252};
272 253
273void __init fib6_rules_init(void) 254static int __init fib6_default_rules_init(void)
274{ 255{
275 list_add_tail(&local_rule.common.list, &fib6_rules_ops.rules_list); 256 int err;
276 list_add_tail(&main_rule.common.list, &fib6_rules_ops.rules_list); 257
258 err = fib_default_rule_add(&fib6_rules_ops, 0,
259 RT6_TABLE_LOCAL, FIB_RULE_PERMANENT);
260 if (err < 0)
261 return err;
262 err = fib_default_rule_add(&fib6_rules_ops, 0x7FFE, RT6_TABLE_MAIN, 0);
263 if (err < 0)
264 return err;
265 return 0;
266}
277 267
268void __init fib6_rules_init(void)
269{
270 BUG_ON(fib6_default_rules_init());
278 fib_rules_register(&fib6_rules_ops); 271 fib_rules_register(&fib6_rules_ops);
279} 272}
280 273
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index d6f1026f1943..adc73adadfae 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -37,9 +37,8 @@ void __inet6_hash(struct inet_hashinfo *hashinfo,
37 } else { 37 } else {
38 unsigned int hash; 38 unsigned int hash;
39 sk->sk_hash = hash = inet6_sk_ehashfn(sk); 39 sk->sk_hash = hash = inet6_sk_ehashfn(sk);
40 hash &= (hashinfo->ehash_size - 1); 40 list = &inet_ehash_bucket(hashinfo, hash)->chain;
41 list = &hashinfo->ehash[hash].chain; 41 lock = inet_ehash_lockp(hashinfo, hash);
42 lock = &hashinfo->ehash[hash].lock;
43 write_lock(lock); 42 write_lock(lock);
44 } 43 }
45 44
@@ -70,9 +69,10 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
70 */ 69 */
71 unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport); 70 unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport);
72 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); 71 struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
72 rwlock_t *lock = inet_ehash_lockp(hashinfo, hash);
73 73
74 prefetch(head->chain.first); 74 prefetch(head->chain.first);
75 read_lock(&head->lock); 75 read_lock(lock);
76 sk_for_each(sk, node, &head->chain) { 76 sk_for_each(sk, node, &head->chain) {
77 /* For IPV6 do the cheaper port and family tests first. */ 77 /* For IPV6 do the cheaper port and family tests first. */
78 if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif)) 78 if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif))
@@ -92,12 +92,12 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
92 goto hit; 92 goto hit;
93 } 93 }
94 } 94 }
95 read_unlock(&head->lock); 95 read_unlock(lock);
96 return NULL; 96 return NULL;
97 97
98hit: 98hit:
99 sock_hold(sk); 99 sock_hold(sk);
100 read_unlock(&head->lock); 100 read_unlock(lock);
101 return sk; 101 return sk;
102} 102}
103EXPORT_SYMBOL(__inet6_lookup_established); 103EXPORT_SYMBOL(__inet6_lookup_established);
@@ -175,12 +175,13 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
175 const unsigned int hash = inet6_ehashfn(daddr, lport, saddr, 175 const unsigned int hash = inet6_ehashfn(daddr, lport, saddr,
176 inet->dport); 176 inet->dport);
177 struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); 177 struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash);
178 rwlock_t *lock = inet_ehash_lockp(hinfo, hash);
178 struct sock *sk2; 179 struct sock *sk2;
179 const struct hlist_node *node; 180 const struct hlist_node *node;
180 struct inet_timewait_sock *tw; 181 struct inet_timewait_sock *tw;
181 182
182 prefetch(head->chain.first); 183 prefetch(head->chain.first);
183 write_lock(&head->lock); 184 write_lock(lock);
184 185
185 /* Check TIME-WAIT sockets first. */ 186 /* Check TIME-WAIT sockets first. */
186 sk_for_each(sk2, node, &head->twchain) { 187 sk_for_each(sk2, node, &head->twchain) {
@@ -216,7 +217,7 @@ unique:
216 __sk_add_node(sk, &head->chain); 217 __sk_add_node(sk, &head->chain);
217 sk->sk_hash = hash; 218 sk->sk_hash = hash;
218 sock_prot_inc_use(sk->sk_prot); 219 sock_prot_inc_use(sk->sk_prot);
219 write_unlock(&head->lock); 220 write_unlock(lock);
220 221
221 if (twp != NULL) { 222 if (twp != NULL) {
222 *twp = tw; 223 *twp = tw;
@@ -231,7 +232,7 @@ unique:
231 return 0; 232 return 0;
232 233
233not_unique: 234not_unique:
234 write_unlock(&head->lock); 235 write_unlock(lock);
235 return -EADDRNOTAVAIL; 236 return -EADDRNOTAVAIL;
236} 237}
237 238
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 653fc0a8235b..86e1835ce4e4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1339,6 +1339,19 @@ error:
1339 return err; 1339 return err;
1340} 1340}
1341 1341
1342static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np)
1343{
1344 inet->cork.flags &= ~IPCORK_OPT;
1345 kfree(np->cork.opt);
1346 np->cork.opt = NULL;
1347 if (np->cork.rt) {
1348 dst_release(&np->cork.rt->u.dst);
1349 np->cork.rt = NULL;
1350 inet->cork.flags &= ~IPCORK_ALLFRAG;
1351 }
1352 memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
1353}
1354
1342int ip6_push_pending_frames(struct sock *sk) 1355int ip6_push_pending_frames(struct sock *sk)
1343{ 1356{
1344 struct sk_buff *skb, *tmp_skb; 1357 struct sk_buff *skb, *tmp_skb;
@@ -1415,15 +1428,7 @@ int ip6_push_pending_frames(struct sock *sk)
1415 } 1428 }
1416 1429
1417out: 1430out:
1418 inet->cork.flags &= ~IPCORK_OPT; 1431 ip6_cork_release(inet, np);
1419 kfree(np->cork.opt);
1420 np->cork.opt = NULL;
1421 if (np->cork.rt) {
1422 dst_release(&np->cork.rt->u.dst);
1423 np->cork.rt = NULL;
1424 inet->cork.flags &= ~IPCORK_ALLFRAG;
1425 }
1426 memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
1427 return err; 1432 return err;
1428error: 1433error:
1429 goto out; 1434 goto out;
@@ -1431,8 +1436,6 @@ error:
1431 1436
1432void ip6_flush_pending_frames(struct sock *sk) 1437void ip6_flush_pending_frames(struct sock *sk)
1433{ 1438{
1434 struct inet_sock *inet = inet_sk(sk);
1435 struct ipv6_pinfo *np = inet6_sk(sk);
1436 struct sk_buff *skb; 1439 struct sk_buff *skb;
1437 1440
1438 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { 1441 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
@@ -1442,14 +1445,5 @@ void ip6_flush_pending_frames(struct sock *sk)
1442 kfree_skb(skb); 1445 kfree_skb(skb);
1443 } 1446 }
1444 1447
1445 inet->cork.flags &= ~IPCORK_OPT; 1448 ip6_cork_release(inet_sk(sk), inet6_sk(sk));
1446
1447 kfree(np->cork.opt);
1448 np->cork.opt = NULL;
1449 if (np->cork.rt) {
1450 dst_release(&np->cork.rt->u.dst);
1451 np->cork.rt = NULL;
1452 inet->cork.flags &= ~IPCORK_ALLFRAG;
1453 }
1454 memset(&inet->cork.fl, 0, sizeof(inet->cork.fl));
1455} 1449}
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 80ef2a1d39fd..0cd4056f9127 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -34,9 +34,9 @@
34#include <net/ip.h> 34#include <net/ip.h>
35#include <net/xfrm.h> 35#include <net/xfrm.h>
36#include <net/ipcomp.h> 36#include <net/ipcomp.h>
37#include <asm/scatterlist.h>
38#include <asm/semaphore.h> 37#include <asm/semaphore.h>
39#include <linux/crypto.h> 38#include <linux/crypto.h>
39#include <linux/err.h>
40#include <linux/pfkeyv2.h> 40#include <linux/pfkeyv2.h>
41#include <linux/random.h> 41#include <linux/random.h>
42#include <linux/percpu.h> 42#include <linux/percpu.h>
@@ -359,7 +359,7 @@ static struct crypto_comp **ipcomp6_alloc_tfms(const char *alg_name)
359 for_each_possible_cpu(cpu) { 359 for_each_possible_cpu(cpu) {
360 struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0, 360 struct crypto_comp *tfm = crypto_alloc_comp(alg_name, 0,
361 CRYPTO_ALG_ASYNC); 361 CRYPTO_ALG_ASYNC);
362 if (!tfm) 362 if (IS_ERR(tfm))
363 goto error; 363 goto error;
364 *per_cpu_ptr(tfms, cpu) = tfm; 364 *per_cpu_ptr(tfms, cpu) = tfm;
365 } 365 }
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 20cfc90d5597..67997a74ddce 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1037,6 +1037,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
1037 1037
1038 ndmsg = nlmsg_data(nlh); 1038 ndmsg = nlmsg_data(nlh);
1039 ndmsg->nduseropt_family = AF_INET6; 1039 ndmsg->nduseropt_family = AF_INET6;
1040 ndmsg->nduseropt_ifindex = ra->dev->ifindex;
1040 ndmsg->nduseropt_icmp_type = icmp6h->icmp6_type; 1041 ndmsg->nduseropt_icmp_type = icmp6h->icmp6_type;
1041 ndmsg->nduseropt_icmp_code = icmp6h->icmp6_code; 1042 ndmsg->nduseropt_icmp_code = icmp6h->icmp6_code;
1042 ndmsg->nduseropt_opts_len = opt->nd_opt_len << 3; 1043 ndmsg->nduseropt_opts_len = opt->nd_opt_len << 3;
@@ -1670,7 +1671,7 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f
1670 filp, buffer, lenp, ppos); 1671 filp, buffer, lenp, ppos);
1671 1672
1672 else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) || 1673 else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) ||
1673 (strcmp(ctl->procname, "base_reacable_time_ms") == 0)) 1674 (strcmp(ctl->procname, "base_reachable_time_ms") == 0))
1674 ret = proc_dointvec_ms_jiffies(ctl, write, 1675 ret = proc_dointvec_ms_jiffies(ctl, write,
1675 filp, buffer, lenp, ppos); 1676 filp, buffer, lenp, ppos);
1676 else 1677 else
diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile
index 4513eab77397..e789ec44d23b 100644
--- a/net/ipv6/netfilter/Makefile
+++ b/net/ipv6/netfilter/Makefile
@@ -4,25 +4,29 @@
4 4
5# Link order matters here. 5# Link order matters here.
6obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o 6obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o
7obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o
8obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o
9obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o
10obj-$(CONFIG_IP6_NF_MATCH_FRAG) += ip6t_frag.o
11obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o
12obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o
13obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o
14obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o 7obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
15obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o 8obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
16obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o
17obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o 9obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
18obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
19obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o 10obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o
20obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o
21obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o
22obj-$(CONFIG_IP6_NF_MATCH_MH) += ip6t_mh.o
23 11
24# objects for l3 independent conntrack 12# objects for l3 independent conntrack
25nf_conntrack_ipv6-objs := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o nf_conntrack_reasm.o 13nf_conntrack_ipv6-objs := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o nf_conntrack_reasm.o
26 14
27# l3 independent conntrack 15# l3 independent conntrack
28obj-$(CONFIG_NF_CONNTRACK_IPV6) += nf_conntrack_ipv6.o 16obj-$(CONFIG_NF_CONNTRACK_IPV6) += nf_conntrack_ipv6.o
17
18# matches
19obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o
20obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o
21obj-$(CONFIG_IP6_NF_MATCH_FRAG) += ip6t_frag.o
22obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o
23obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o
24obj-$(CONFIG_IP6_NF_MATCH_MH) += ip6t_mh.o
25obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o
26obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o
27obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o
28
29# targets
30obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o
31obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
32obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 6413a30d9f68..e273605eef85 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -23,6 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/sysctl.h> 24#include <linux/sysctl.h>
25#include <linux/proc_fs.h> 25#include <linux/proc_fs.h>
26#include <linux/seq_file.h>
26#include <linux/mutex.h> 27#include <linux/mutex.h>
27#include <net/net_namespace.h> 28#include <net/net_namespace.h>
28#include <net/sock.h> 29#include <net/sock.h>
@@ -596,15 +597,11 @@ static ctl_table ipq_root_table[] = {
596 { .ctl_name = 0 } 597 { .ctl_name = 0 }
597}; 598};
598 599
599#ifdef CONFIG_PROC_FS 600static int ip6_queue_show(struct seq_file *m, void *v)
600static int
601ipq_get_info(char *buffer, char **start, off_t offset, int length)
602{ 601{
603 int len;
604
605 read_lock_bh(&queue_lock); 602 read_lock_bh(&queue_lock);
606 603
607 len = sprintf(buffer, 604 seq_printf(m,
608 "Peer PID : %d\n" 605 "Peer PID : %d\n"
609 "Copy mode : %hu\n" 606 "Copy mode : %hu\n"
610 "Copy range : %u\n" 607 "Copy range : %u\n"
@@ -621,16 +618,21 @@ ipq_get_info(char *buffer, char **start, off_t offset, int length)
621 queue_user_dropped); 618 queue_user_dropped);
622 619
623 read_unlock_bh(&queue_lock); 620 read_unlock_bh(&queue_lock);
621 return 0;
622}
624 623
625 *start = buffer + offset; 624static int ip6_queue_open(struct inode *inode, struct file *file)
626 len -= offset; 625{
627 if (len > length) 626 return single_open(file, ip6_queue_show, NULL);
628 len = length;
629 else if (len < 0)
630 len = 0;
631 return len;
632} 627}
633#endif /* CONFIG_PROC_FS */ 628
629static const struct file_operations ip6_queue_proc_fops = {
630 .open = ip6_queue_open,
631 .read = seq_read,
632 .llseek = seq_lseek,
633 .release = single_release,
634 .owner = THIS_MODULE,
635};
634 636
635static struct nf_queue_handler nfqh = { 637static struct nf_queue_handler nfqh = {
636 .name = "ip6_queue", 638 .name = "ip6_queue",
@@ -650,10 +652,11 @@ static int __init ip6_queue_init(void)
650 goto cleanup_netlink_notifier; 652 goto cleanup_netlink_notifier;
651 } 653 }
652 654
653 proc = proc_net_create(&init_net, IPQ_PROC_FS_NAME, 0, ipq_get_info); 655 proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net);
654 if (proc) 656 if (proc) {
655 proc->owner = THIS_MODULE; 657 proc->owner = THIS_MODULE;
656 else { 658 proc->proc_fops = &ip6_queue_proc_fops;
659 } else {
657 printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); 660 printk(KERN_ERR "ip6_queue: failed to create proc entry\n");
658 goto cleanup_ipqnl; 661 goto cleanup_ipqnl;
659 } 662 }
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index be526ad92543..8631ed7fe8a9 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -32,27 +32,16 @@
32 32
33static struct proc_dir_entry *proc_net_devsnmp6; 33static struct proc_dir_entry *proc_net_devsnmp6;
34 34
35static int fold_prot_inuse(struct proto *proto)
36{
37 int res = 0;
38 int cpu;
39
40 for_each_possible_cpu(cpu)
41 res += proto->stats[cpu].inuse;
42
43 return res;
44}
45
46static int sockstat6_seq_show(struct seq_file *seq, void *v) 35static int sockstat6_seq_show(struct seq_file *seq, void *v)
47{ 36{
48 seq_printf(seq, "TCP6: inuse %d\n", 37 seq_printf(seq, "TCP6: inuse %d\n",
49 fold_prot_inuse(&tcpv6_prot)); 38 sock_prot_inuse(&tcpv6_prot));
50 seq_printf(seq, "UDP6: inuse %d\n", 39 seq_printf(seq, "UDP6: inuse %d\n",
51 fold_prot_inuse(&udpv6_prot)); 40 sock_prot_inuse(&udpv6_prot));
52 seq_printf(seq, "UDPLITE6: inuse %d\n", 41 seq_printf(seq, "UDPLITE6: inuse %d\n",
53 fold_prot_inuse(&udplitev6_prot)); 42 sock_prot_inuse(&udplitev6_prot));
54 seq_printf(seq, "RAW6: inuse %d\n", 43 seq_printf(seq, "RAW6: inuse %d\n",
55 fold_prot_inuse(&rawv6_prot)); 44 sock_prot_inuse(&rawv6_prot));
56 seq_printf(seq, "FRAG6: inuse %d memory %d\n", 45 seq_printf(seq, "FRAG6: inuse %d memory %d\n",
57 ip6_frag_nqueues(), ip6_frag_mem()); 46 ip6_frag_nqueues(), ip6_frag_mem());
58 return 0; 47 return 0;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index ca24ef19cd8f..807260d03586 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1144,6 +1144,8 @@ static int rawv6_init_sk(struct sock *sk)
1144 return(0); 1144 return(0);
1145} 1145}
1146 1146
1147DEFINE_PROTO_INUSE(rawv6)
1148
1147struct proto rawv6_prot = { 1149struct proto rawv6_prot = {
1148 .name = "RAWv6", 1150 .name = "RAWv6",
1149 .owner = THIS_MODULE, 1151 .owner = THIS_MODULE,
@@ -1166,6 +1168,7 @@ struct proto rawv6_prot = {
1166 .compat_setsockopt = compat_rawv6_setsockopt, 1168 .compat_setsockopt = compat_rawv6_setsockopt,
1167 .compat_getsockopt = compat_rawv6_getsockopt, 1169 .compat_getsockopt = compat_rawv6_getsockopt,
1168#endif 1170#endif
1171 REF_PROTO_INUSE(rawv6)
1169}; 1172};
1170 1173
1171#ifdef CONFIG_PROC_FS 1174#ifdef CONFIG_PROC_FS
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 95f8e4a62f68..6ecb5e6fae2e 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -38,12 +38,8 @@
38#include <linux/in6.h> 38#include <linux/in6.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/if_arp.h> 40#include <linux/if_arp.h>
41
42#ifdef CONFIG_PROC_FS
43#include <linux/proc_fs.h> 41#include <linux/proc_fs.h>
44#include <linux/seq_file.h> 42#include <linux/seq_file.h>
45#endif
46
47#include <net/net_namespace.h> 43#include <net/net_namespace.h>
48#include <net/snmp.h> 44#include <net/snmp.h>
49#include <net/ipv6.h> 45#include <net/ipv6.h>
@@ -548,12 +544,8 @@ restart:
548 rt = rt6_device_match(rt, fl->oif, flags); 544 rt = rt6_device_match(rt, fl->oif, flags);
549 BACKTRACK(&fl->fl6_src); 545 BACKTRACK(&fl->fl6_src);
550out: 546out:
551 dst_hold(&rt->u.dst); 547 dst_use(&rt->u.dst, jiffies);
552 read_unlock_bh(&table->tb6_lock); 548 read_unlock_bh(&table->tb6_lock);
553
554 rt->u.dst.lastuse = jiffies;
555 rt->u.dst.__use++;
556
557 return rt; 549 return rt;
558 550
559} 551}
@@ -2288,71 +2280,50 @@ struct rt6_proc_arg
2288 2280
2289static int rt6_info_route(struct rt6_info *rt, void *p_arg) 2281static int rt6_info_route(struct rt6_info *rt, void *p_arg)
2290{ 2282{
2291 struct rt6_proc_arg *arg = (struct rt6_proc_arg *) p_arg; 2283 struct seq_file *m = p_arg;
2292
2293 if (arg->skip < arg->offset / RT6_INFO_LEN) {
2294 arg->skip++;
2295 return 0;
2296 }
2297
2298 if (arg->len >= arg->length)
2299 return 0;
2300 2284
2301 arg->len += sprintf(arg->buffer + arg->len, 2285 seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_dst.addr),
2302 NIP6_SEQFMT " %02x ", 2286 rt->rt6i_dst.plen);
2303 NIP6(rt->rt6i_dst.addr),
2304 rt->rt6i_dst.plen);
2305 2287
2306#ifdef CONFIG_IPV6_SUBTREES 2288#ifdef CONFIG_IPV6_SUBTREES
2307 arg->len += sprintf(arg->buffer + arg->len, 2289 seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_src.addr),
2308 NIP6_SEQFMT " %02x ", 2290 rt->rt6i_src.plen);
2309 NIP6(rt->rt6i_src.addr),
2310 rt->rt6i_src.plen);
2311#else 2291#else
2312 arg->len += sprintf(arg->buffer + arg->len, 2292 seq_puts(m, "00000000000000000000000000000000 00 ");
2313 "00000000000000000000000000000000 00 ");
2314#endif 2293#endif
2315 2294
2316 if (rt->rt6i_nexthop) { 2295 if (rt->rt6i_nexthop) {
2317 arg->len += sprintf(arg->buffer + arg->len, 2296 seq_printf(m, NIP6_SEQFMT,
2318 NIP6_SEQFMT, 2297 NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key)));
2319 NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key)));
2320 } else { 2298 } else {
2321 arg->len += sprintf(arg->buffer + arg->len, 2299 seq_puts(m, "00000000000000000000000000000000");
2322 "00000000000000000000000000000000");
2323 } 2300 }
2324 arg->len += sprintf(arg->buffer + arg->len, 2301 seq_printf(m, " %08x %08x %08x %08x %8s\n",
2325 " %08x %08x %08x %08x %8s\n", 2302 rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt),
2326 rt->rt6i_metric, atomic_read(&rt->u.dst.__refcnt), 2303 rt->u.dst.__use, rt->rt6i_flags,
2327 rt->u.dst.__use, rt->rt6i_flags, 2304 rt->rt6i_dev ? rt->rt6i_dev->name : "");
2328 rt->rt6i_dev ? rt->rt6i_dev->name : "");
2329 return 0; 2305 return 0;
2330} 2306}
2331 2307
2332static int rt6_proc_info(char *buffer, char **start, off_t offset, int length) 2308static int ipv6_route_show(struct seq_file *m, void *v)
2333{ 2309{
2334 struct rt6_proc_arg arg = { 2310 fib6_clean_all(rt6_info_route, 0, m);
2335 .buffer = buffer, 2311 return 0;
2336 .offset = offset, 2312}
2337 .length = length,
2338 };
2339
2340 fib6_clean_all(rt6_info_route, 0, &arg);
2341
2342 *start = buffer;
2343 if (offset)
2344 *start += offset % RT6_INFO_LEN;
2345
2346 arg.len -= offset % RT6_INFO_LEN;
2347
2348 if (arg.len > length)
2349 arg.len = length;
2350 if (arg.len < 0)
2351 arg.len = 0;
2352 2313
2353 return arg.len; 2314static int ipv6_route_open(struct inode *inode, struct file *file)
2315{
2316 return single_open(file, ipv6_route_show, NULL);
2354} 2317}
2355 2318
2319static const struct file_operations ipv6_route_proc_fops = {
2320 .owner = THIS_MODULE,
2321 .open = ipv6_route_open,
2322 .read = seq_read,
2323 .llseek = seq_lseek,
2324 .release = single_release,
2325};
2326
2356static int rt6_stats_seq_show(struct seq_file *seq, void *v) 2327static int rt6_stats_seq_show(struct seq_file *seq, void *v)
2357{ 2328{
2358 seq_printf(seq, "%04x %04x %04x %04x %04x %04x %04x\n", 2329 seq_printf(seq, "%04x %04x %04x %04x %04x %04x %04x\n",
@@ -2489,22 +2460,14 @@ ctl_table ipv6_route_table[] = {
2489 2460
2490void __init ip6_route_init(void) 2461void __init ip6_route_init(void)
2491{ 2462{
2492#ifdef CONFIG_PROC_FS
2493 struct proc_dir_entry *p;
2494#endif
2495 ip6_dst_ops.kmem_cachep = 2463 ip6_dst_ops.kmem_cachep =
2496 kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0, 2464 kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0,
2497 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 2465 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
2498 ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep; 2466 ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep;
2499 2467
2500 fib6_init(); 2468 fib6_init();
2501#ifdef CONFIG_PROC_FS 2469 proc_net_fops_create(&init_net, "ipv6_route", 0, &ipv6_route_proc_fops);
2502 p = proc_net_create(&init_net, "ipv6_route", 0, rt6_proc_info);
2503 if (p)
2504 p->owner = THIS_MODULE;
2505
2506 proc_net_fops_create(&init_net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops); 2470 proc_net_fops_create(&init_net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
2507#endif
2508#ifdef CONFIG_XFRM 2471#ifdef CONFIG_XFRM
2509 xfrm6_init(); 2472 xfrm6_init();
2510#endif 2473#endif
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 85208026278b..93980c3b83e6 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -561,16 +561,16 @@ static int tcp_v6_md5_do_add(struct sock *sk, struct in6_addr *peer,
561 char *newkey, u8 newkeylen) 561 char *newkey, u8 newkeylen)
562{ 562{
563 /* Add key to the list */ 563 /* Add key to the list */
564 struct tcp6_md5sig_key *key; 564 struct tcp_md5sig_key *key;
565 struct tcp_sock *tp = tcp_sk(sk); 565 struct tcp_sock *tp = tcp_sk(sk);
566 struct tcp6_md5sig_key *keys; 566 struct tcp6_md5sig_key *keys;
567 567
568 key = (struct tcp6_md5sig_key*) tcp_v6_md5_do_lookup(sk, peer); 568 key = tcp_v6_md5_do_lookup(sk, peer);
569 if (key) { 569 if (key) {
570 /* modify existing entry - just update that one */ 570 /* modify existing entry - just update that one */
571 kfree(key->base.key); 571 kfree(key->key);
572 key->base.key = newkey; 572 key->key = newkey;
573 key->base.keylen = newkeylen; 573 key->keylen = newkeylen;
574 } else { 574 } else {
575 /* reallocate new list if current one is full. */ 575 /* reallocate new list if current one is full. */
576 if (!tp->md5sig_info) { 576 if (!tp->md5sig_info) {
@@ -581,7 +581,10 @@ static int tcp_v6_md5_do_add(struct sock *sk, struct in6_addr *peer,
581 } 581 }
582 sk->sk_route_caps &= ~NETIF_F_GSO_MASK; 582 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
583 } 583 }
584 tcp_alloc_md5sig_pool(); 584 if (tcp_alloc_md5sig_pool() == NULL) {
585 kfree(newkey);
586 return -ENOMEM;
587 }
585 if (tp->md5sig_info->alloced6 == tp->md5sig_info->entries6) { 588 if (tp->md5sig_info->alloced6 == tp->md5sig_info->entries6) {
586 keys = kmalloc((sizeof (tp->md5sig_info->keys6[0]) * 589 keys = kmalloc((sizeof (tp->md5sig_info->keys6[0]) *
587 (tp->md5sig_info->entries6 + 1)), GFP_ATOMIC); 590 (tp->md5sig_info->entries6 + 1)), GFP_ATOMIC);
@@ -634,10 +637,6 @@ static int tcp_v6_md5_do_del(struct sock *sk, struct in6_addr *peer)
634 kfree(tp->md5sig_info->keys6); 637 kfree(tp->md5sig_info->keys6);
635 tp->md5sig_info->keys6 = NULL; 638 tp->md5sig_info->keys6 = NULL;
636 tp->md5sig_info->alloced6 = 0; 639 tp->md5sig_info->alloced6 = 0;
637
638 tcp_free_md5sig_pool();
639
640 return 0;
641 } else { 640 } else {
642 /* shrink the database */ 641 /* shrink the database */
643 if (tp->md5sig_info->entries6 != i) 642 if (tp->md5sig_info->entries6 != i)
@@ -646,6 +645,8 @@ static int tcp_v6_md5_do_del(struct sock *sk, struct in6_addr *peer)
646 (tp->md5sig_info->entries6 - i) 645 (tp->md5sig_info->entries6 - i)
647 * sizeof (tp->md5sig_info->keys6[0])); 646 * sizeof (tp->md5sig_info->keys6[0]));
648 } 647 }
648 tcp_free_md5sig_pool();
649 return 0;
649 } 650 }
650 } 651 }
651 return -ENOENT; 652 return -ENOENT;
@@ -781,7 +782,7 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
781 sg_set_buf(&sg[block++], key->key, key->keylen); 782 sg_set_buf(&sg[block++], key->key, key->keylen);
782 nbytes += key->keylen; 783 nbytes += key->keylen;
783 784
784 sg_mark_end(sg, block); 785 sg_mark_end(&sg[block - 1]);
785 786
786 /* Now store the hash into the packet */ 787 /* Now store the hash into the packet */
787 err = crypto_hash_init(desc); 788 err = crypto_hash_init(desc);
@@ -2107,6 +2108,8 @@ void tcp6_proc_exit(void)
2107} 2108}
2108#endif 2109#endif
2109 2110
2111DEFINE_PROTO_INUSE(tcpv6)
2112
2110struct proto tcpv6_prot = { 2113struct proto tcpv6_prot = {
2111 .name = "TCPv6", 2114 .name = "TCPv6",
2112 .owner = THIS_MODULE, 2115 .owner = THIS_MODULE,
@@ -2141,6 +2144,7 @@ struct proto tcpv6_prot = {
2141 .compat_setsockopt = compat_tcp_setsockopt, 2144 .compat_setsockopt = compat_tcp_setsockopt,
2142 .compat_getsockopt = compat_tcp_getsockopt, 2145 .compat_getsockopt = compat_tcp_getsockopt,
2143#endif 2146#endif
2147 REF_PROTO_INUSE(tcpv6)
2144}; 2148};
2145 2149
2146static struct inet6_protocol tcpv6_protocol = { 2150static struct inet6_protocol tcpv6_protocol = {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index caebad6ee510..ee1cc3f8599f 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -205,12 +205,11 @@ out:
205 return err; 205 return err;
206 206
207csum_copy_err: 207csum_copy_err:
208 UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
208 skb_kill_datagram(sk, skb, flags); 209 skb_kill_datagram(sk, skb, flags);
209 210
210 if (flags & MSG_DONTWAIT) { 211 if (flags & MSG_DONTWAIT)
211 UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
212 return -EAGAIN; 212 return -EAGAIN;
213 }
214 goto try_again; 213 goto try_again;
215} 214}
216 215
@@ -971,6 +970,8 @@ void udp6_proc_exit(void) {
971 970
972/* ------------------------------------------------------------------------ */ 971/* ------------------------------------------------------------------------ */
973 972
973DEFINE_PROTO_INUSE(udpv6)
974
974struct proto udpv6_prot = { 975struct proto udpv6_prot = {
975 .name = "UDPv6", 976 .name = "UDPv6",
976 .owner = THIS_MODULE, 977 .owner = THIS_MODULE,
@@ -992,6 +993,7 @@ struct proto udpv6_prot = {
992 .compat_setsockopt = compat_udpv6_setsockopt, 993 .compat_setsockopt = compat_udpv6_setsockopt,
993 .compat_getsockopt = compat_udpv6_getsockopt, 994 .compat_getsockopt = compat_udpv6_getsockopt,
994#endif 995#endif
996 REF_PROTO_INUSE(udpv6)
995}; 997};
996 998
997static struct inet_protosw udpv6_protosw = { 999static struct inet_protosw udpv6_protosw = {
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 766566f7de47..5a0379f71415 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -40,6 +40,8 @@ static int udplite_v6_get_port(struct sock *sk, unsigned short snum)
40 return udplite_get_port(sk, snum, ipv6_rcv_saddr_equal); 40 return udplite_get_port(sk, snum, ipv6_rcv_saddr_equal);
41} 41}
42 42
43DEFINE_PROTO_INUSE(udplitev6)
44
43struct proto udplitev6_prot = { 45struct proto udplitev6_prot = {
44 .name = "UDPLITEv6", 46 .name = "UDPLITEv6",
45 .owner = THIS_MODULE, 47 .owner = THIS_MODULE,
@@ -62,6 +64,7 @@ struct proto udplitev6_prot = {
62 .compat_setsockopt = compat_udpv6_setsockopt, 64 .compat_setsockopt = compat_udpv6_setsockopt,
63 .compat_getsockopt = compat_udpv6_getsockopt, 65 .compat_getsockopt = compat_udpv6_getsockopt,
64#endif 66#endif
67 REF_PROTO_INUSE(udplitev6)
65}; 68};
66 69
67static struct inet_protosw udplite6_protosw = { 70static struct inet_protosw udplite6_protosw = {
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 29b063d43120..c76a9523091b 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -92,11 +92,6 @@ extern int ipxrtr_route_skb(struct sk_buff *skb);
92extern struct ipx_route *ipxrtr_lookup(__be32 net); 92extern struct ipx_route *ipxrtr_lookup(__be32 net);
93extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg); 93extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
94 94
95#undef IPX_REFCNT_DEBUG
96#ifdef IPX_REFCNT_DEBUG
97atomic_t ipx_sock_nr;
98#endif
99
100struct ipx_interface *ipx_interfaces_head(void) 95struct ipx_interface *ipx_interfaces_head(void)
101{ 96{
102 struct ipx_interface *rc = NULL; 97 struct ipx_interface *rc = NULL;
@@ -151,14 +146,7 @@ static void ipx_destroy_socket(struct sock *sk)
151{ 146{
152 ipx_remove_socket(sk); 147 ipx_remove_socket(sk);
153 skb_queue_purge(&sk->sk_receive_queue); 148 skb_queue_purge(&sk->sk_receive_queue);
154#ifdef IPX_REFCNT_DEBUG 149 sk_refcnt_debug_dec(sk);
155 atomic_dec(&ipx_sock_nr);
156 printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk,
157 atomic_read(&ipx_sock_nr));
158 if (atomic_read(&sk->sk_refcnt) != 1)
159 printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n",
160 sk, atomic_read(&sk->sk_refcnt));
161#endif
162 sock_put(sk); 150 sock_put(sk);
163} 151}
164 152
@@ -1381,14 +1369,11 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol)
1381 goto out; 1369 goto out;
1382 1370
1383 rc = -ENOMEM; 1371 rc = -ENOMEM;
1384 sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto, 1); 1372 sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto);
1385 if (!sk) 1373 if (!sk)
1386 goto out; 1374 goto out;
1387#ifdef IPX_REFCNT_DEBUG 1375
1388 atomic_inc(&ipx_sock_nr); 1376 sk_refcnt_debug_inc(sk);
1389 printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk,
1390 atomic_read(&ipx_sock_nr));
1391#endif
1392 sock_init_data(sock, sk); 1377 sock_init_data(sock, sk);
1393 sk->sk_no_check = 1; /* Checksum off by default */ 1378 sk->sk_no_check = 1; /* Checksum off by default */
1394 sock->ops = &ipx_dgram_ops; 1379 sock->ops = &ipx_dgram_ops;
@@ -1409,6 +1394,7 @@ static int ipx_release(struct socket *sock)
1409 1394
1410 sock_set_flag(sk, SOCK_DEAD); 1395 sock_set_flag(sk, SOCK_DEAD);
1411 sock->sk = NULL; 1396 sock->sk = NULL;
1397 sk_refcnt_debug_release(sk);
1412 ipx_destroy_socket(sk); 1398 ipx_destroy_socket(sk);
1413out: 1399out:
1414 return 0; 1400 return 0;
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/iriap.c b/net/irda/iriap.c
index dc5e34a01620..a86a5d83786b 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -928,7 +928,7 @@ void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb)
928 928
929 opcode = fp[0]; 929 opcode = fp[0];
930 if (~opcode & 0x80) { 930 if (~opcode & 0x80) {
931 IRDA_WARNING("%s: IrIAS multiframe commands or results" 931 IRDA_WARNING("%s: IrIAS multiframe commands or results "
932 "is not implemented yet!\n", __FUNCTION__); 932 "is not implemented yet!\n", __FUNCTION__);
933 return; 933 return;
934 } 934 }
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index 7f9c8542e5fc..c68220773d28 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -296,6 +296,7 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
296 */ 296 */
297void irlan_eth_send_gratuitous_arp(struct net_device *dev) 297void irlan_eth_send_gratuitous_arp(struct net_device *dev)
298{ 298{
299#ifdef CONFIG_INET
299 struct in_device *in_dev; 300 struct in_device *in_dev;
300 301
301 /* 302 /*
@@ -303,7 +304,6 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev)
303 * is useful if we have changed access points on the same 304 * is useful if we have changed access points on the same
304 * subnet. 305 * subnet.
305 */ 306 */
306#ifdef CONFIG_INET
307 IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); 307 IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n");
308 rcu_read_lock(); 308 rcu_read_lock();
309 in_dev = __in_dev_get_rcu(dev); 309 in_dev = __in_dev_get_rcu(dev);
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/iucv/iucv.c b/net/iucv/iucv.c
index a2f5a6ea3895..7698f6c459d6 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -97,7 +97,7 @@ struct iucv_irq_list {
97 struct iucv_irq_data data; 97 struct iucv_irq_data data;
98}; 98};
99 99
100static struct iucv_irq_data *iucv_irq_data; 100static struct iucv_irq_data *iucv_irq_data[NR_CPUS];
101static cpumask_t iucv_buffer_cpumask = CPU_MASK_NONE; 101static cpumask_t iucv_buffer_cpumask = CPU_MASK_NONE;
102static cpumask_t iucv_irq_cpumask = CPU_MASK_NONE; 102static cpumask_t iucv_irq_cpumask = CPU_MASK_NONE;
103 103
@@ -277,7 +277,7 @@ union iucv_param {
277/* 277/*
278 * Anchor for per-cpu IUCV command parameter block. 278 * Anchor for per-cpu IUCV command parameter block.
279 */ 279 */
280static union iucv_param *iucv_param; 280static union iucv_param *iucv_param[NR_CPUS];
281 281
282/** 282/**
283 * iucv_call_b2f0 283 * iucv_call_b2f0
@@ -356,7 +356,7 @@ static void iucv_allow_cpu(void *data)
356 * 0x10 - Flag to allow priority message completion interrupts 356 * 0x10 - Flag to allow priority message completion interrupts
357 * 0x08 - Flag to allow IUCV control interrupts 357 * 0x08 - Flag to allow IUCV control interrupts
358 */ 358 */
359 parm = percpu_ptr(iucv_param, smp_processor_id()); 359 parm = iucv_param[cpu];
360 memset(parm, 0, sizeof(union iucv_param)); 360 memset(parm, 0, sizeof(union iucv_param));
361 parm->set_mask.ipmask = 0xf8; 361 parm->set_mask.ipmask = 0xf8;
362 iucv_call_b2f0(IUCV_SETMASK, parm); 362 iucv_call_b2f0(IUCV_SETMASK, parm);
@@ -377,7 +377,7 @@ static void iucv_block_cpu(void *data)
377 union iucv_param *parm; 377 union iucv_param *parm;
378 378
379 /* Disable all iucv interrupts. */ 379 /* Disable all iucv interrupts. */
380 parm = percpu_ptr(iucv_param, smp_processor_id()); 380 parm = iucv_param[cpu];
381 memset(parm, 0, sizeof(union iucv_param)); 381 memset(parm, 0, sizeof(union iucv_param));
382 iucv_call_b2f0(IUCV_SETMASK, parm); 382 iucv_call_b2f0(IUCV_SETMASK, parm);
383 383
@@ -401,9 +401,9 @@ static void iucv_declare_cpu(void *data)
401 return; 401 return;
402 402
403 /* Declare interrupt buffer. */ 403 /* Declare interrupt buffer. */
404 parm = percpu_ptr(iucv_param, cpu); 404 parm = iucv_param[cpu];
405 memset(parm, 0, sizeof(union iucv_param)); 405 memset(parm, 0, sizeof(union iucv_param));
406 parm->db.ipbfadr1 = virt_to_phys(percpu_ptr(iucv_irq_data, cpu)); 406 parm->db.ipbfadr1 = virt_to_phys(iucv_irq_data[cpu]);
407 rc = iucv_call_b2f0(IUCV_DECLARE_BUFFER, parm); 407 rc = iucv_call_b2f0(IUCV_DECLARE_BUFFER, parm);
408 if (rc) { 408 if (rc) {
409 char *err = "Unknown"; 409 char *err = "Unknown";
@@ -458,7 +458,7 @@ static void iucv_retrieve_cpu(void *data)
458 iucv_block_cpu(NULL); 458 iucv_block_cpu(NULL);
459 459
460 /* Retrieve interrupt buffer. */ 460 /* Retrieve interrupt buffer. */
461 parm = percpu_ptr(iucv_param, cpu); 461 parm = iucv_param[cpu];
462 iucv_call_b2f0(IUCV_RETRIEVE_BUFFER, parm); 462 iucv_call_b2f0(IUCV_RETRIEVE_BUFFER, parm);
463 463
464 /* Clear indication that an iucv buffer exists for this cpu. */ 464 /* Clear indication that an iucv buffer exists for this cpu. */
@@ -558,22 +558,23 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
558 switch (action) { 558 switch (action) {
559 case CPU_UP_PREPARE: 559 case CPU_UP_PREPARE:
560 case CPU_UP_PREPARE_FROZEN: 560 case CPU_UP_PREPARE_FROZEN:
561 if (!percpu_populate(iucv_irq_data, 561 iucv_irq_data[cpu] = kmalloc_node(sizeof(struct iucv_irq_data),
562 sizeof(struct iucv_irq_data), 562 GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
563 GFP_KERNEL|GFP_DMA, cpu)) 563 if (!iucv_irq_data[cpu])
564 return NOTIFY_BAD; 564 return NOTIFY_BAD;
565 if (!percpu_populate(iucv_param, sizeof(union iucv_param), 565 iucv_param[cpu] = kmalloc_node(sizeof(union iucv_param),
566 GFP_KERNEL|GFP_DMA, cpu)) { 566 GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
567 percpu_depopulate(iucv_irq_data, cpu); 567 if (!iucv_param[cpu])
568 return NOTIFY_BAD; 568 return NOTIFY_BAD;
569 }
570 break; 569 break;
571 case CPU_UP_CANCELED: 570 case CPU_UP_CANCELED:
572 case CPU_UP_CANCELED_FROZEN: 571 case CPU_UP_CANCELED_FROZEN:
573 case CPU_DEAD: 572 case CPU_DEAD:
574 case CPU_DEAD_FROZEN: 573 case CPU_DEAD_FROZEN:
575 percpu_depopulate(iucv_param, cpu); 574 kfree(iucv_param[cpu]);
576 percpu_depopulate(iucv_irq_data, cpu); 575 iucv_param[cpu] = NULL;
576 kfree(iucv_irq_data[cpu]);
577 iucv_irq_data[cpu] = NULL;
577 break; 578 break;
578 case CPU_ONLINE: 579 case CPU_ONLINE:
579 case CPU_ONLINE_FROZEN: 580 case CPU_ONLINE_FROZEN:
@@ -612,7 +613,7 @@ static int iucv_sever_pathid(u16 pathid, u8 userdata[16])
612{ 613{
613 union iucv_param *parm; 614 union iucv_param *parm;
614 615
615 parm = percpu_ptr(iucv_param, smp_processor_id()); 616 parm = iucv_param[smp_processor_id()];
616 memset(parm, 0, sizeof(union iucv_param)); 617 memset(parm, 0, sizeof(union iucv_param));
617 if (userdata) 618 if (userdata)
618 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser)); 619 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
@@ -755,7 +756,7 @@ int iucv_path_accept(struct iucv_path *path, struct iucv_handler *handler,
755 756
756 local_bh_disable(); 757 local_bh_disable();
757 /* Prepare parameter block. */ 758 /* Prepare parameter block. */
758 parm = percpu_ptr(iucv_param, smp_processor_id()); 759 parm = iucv_param[smp_processor_id()];
759 memset(parm, 0, sizeof(union iucv_param)); 760 memset(parm, 0, sizeof(union iucv_param));
760 parm->ctrl.ippathid = path->pathid; 761 parm->ctrl.ippathid = path->pathid;
761 parm->ctrl.ipmsglim = path->msglim; 762 parm->ctrl.ipmsglim = path->msglim;
@@ -799,7 +800,7 @@ int iucv_path_connect(struct iucv_path *path, struct iucv_handler *handler,
799 BUG_ON(in_atomic()); 800 BUG_ON(in_atomic());
800 spin_lock_bh(&iucv_table_lock); 801 spin_lock_bh(&iucv_table_lock);
801 iucv_cleanup_queue(); 802 iucv_cleanup_queue();
802 parm = percpu_ptr(iucv_param, smp_processor_id()); 803 parm = iucv_param[smp_processor_id()];
803 memset(parm, 0, sizeof(union iucv_param)); 804 memset(parm, 0, sizeof(union iucv_param));
804 parm->ctrl.ipmsglim = path->msglim; 805 parm->ctrl.ipmsglim = path->msglim;
805 parm->ctrl.ipflags1 = path->flags; 806 parm->ctrl.ipflags1 = path->flags;
@@ -854,7 +855,7 @@ int iucv_path_quiesce(struct iucv_path *path, u8 userdata[16])
854 int rc; 855 int rc;
855 856
856 local_bh_disable(); 857 local_bh_disable();
857 parm = percpu_ptr(iucv_param, smp_processor_id()); 858 parm = iucv_param[smp_processor_id()];
858 memset(parm, 0, sizeof(union iucv_param)); 859 memset(parm, 0, sizeof(union iucv_param));
859 if (userdata) 860 if (userdata)
860 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser)); 861 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
@@ -881,7 +882,7 @@ int iucv_path_resume(struct iucv_path *path, u8 userdata[16])
881 int rc; 882 int rc;
882 883
883 local_bh_disable(); 884 local_bh_disable();
884 parm = percpu_ptr(iucv_param, smp_processor_id()); 885 parm = iucv_param[smp_processor_id()];
885 memset(parm, 0, sizeof(union iucv_param)); 886 memset(parm, 0, sizeof(union iucv_param));
886 if (userdata) 887 if (userdata)
887 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser)); 888 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
@@ -936,7 +937,7 @@ int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
936 int rc; 937 int rc;
937 938
938 local_bh_disable(); 939 local_bh_disable();
939 parm = percpu_ptr(iucv_param, smp_processor_id()); 940 parm = iucv_param[smp_processor_id()];
940 memset(parm, 0, sizeof(union iucv_param)); 941 memset(parm, 0, sizeof(union iucv_param));
941 parm->purge.ippathid = path->pathid; 942 parm->purge.ippathid = path->pathid;
942 parm->purge.ipmsgid = msg->id; 943 parm->purge.ipmsgid = msg->id;
@@ -1003,7 +1004,7 @@ int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
1003 } 1004 }
1004 1005
1005 local_bh_disable(); 1006 local_bh_disable();
1006 parm = percpu_ptr(iucv_param, smp_processor_id()); 1007 parm = iucv_param[smp_processor_id()];
1007 memset(parm, 0, sizeof(union iucv_param)); 1008 memset(parm, 0, sizeof(union iucv_param));
1008 parm->db.ipbfadr1 = (u32)(addr_t) buffer; 1009 parm->db.ipbfadr1 = (u32)(addr_t) buffer;
1009 parm->db.ipbfln1f = (u32) size; 1010 parm->db.ipbfln1f = (u32) size;
@@ -1040,7 +1041,7 @@ int iucv_message_reject(struct iucv_path *path, struct iucv_message *msg)
1040 int rc; 1041 int rc;
1041 1042
1042 local_bh_disable(); 1043 local_bh_disable();
1043 parm = percpu_ptr(iucv_param, smp_processor_id()); 1044 parm = iucv_param[smp_processor_id()];
1044 memset(parm, 0, sizeof(union iucv_param)); 1045 memset(parm, 0, sizeof(union iucv_param));
1045 parm->db.ippathid = path->pathid; 1046 parm->db.ippathid = path->pathid;
1046 parm->db.ipmsgid = msg->id; 1047 parm->db.ipmsgid = msg->id;
@@ -1074,7 +1075,7 @@ int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
1074 int rc; 1075 int rc;
1075 1076
1076 local_bh_disable(); 1077 local_bh_disable();
1077 parm = percpu_ptr(iucv_param, smp_processor_id()); 1078 parm = iucv_param[smp_processor_id()];
1078 memset(parm, 0, sizeof(union iucv_param)); 1079 memset(parm, 0, sizeof(union iucv_param));
1079 if (flags & IUCV_IPRMDATA) { 1080 if (flags & IUCV_IPRMDATA) {
1080 parm->dpl.ippathid = path->pathid; 1081 parm->dpl.ippathid = path->pathid;
@@ -1118,7 +1119,7 @@ int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
1118 int rc; 1119 int rc;
1119 1120
1120 local_bh_disable(); 1121 local_bh_disable();
1121 parm = percpu_ptr(iucv_param, smp_processor_id()); 1122 parm = iucv_param[smp_processor_id()];
1122 memset(parm, 0, sizeof(union iucv_param)); 1123 memset(parm, 0, sizeof(union iucv_param));
1123 if (flags & IUCV_IPRMDATA) { 1124 if (flags & IUCV_IPRMDATA) {
1124 /* Message of 8 bytes can be placed into the parameter list. */ 1125 /* Message of 8 bytes can be placed into the parameter list. */
@@ -1172,7 +1173,7 @@ int iucv_message_send2way(struct iucv_path *path, struct iucv_message *msg,
1172 int rc; 1173 int rc;
1173 1174
1174 local_bh_disable(); 1175 local_bh_disable();
1175 parm = percpu_ptr(iucv_param, smp_processor_id()); 1176 parm = iucv_param[smp_processor_id()];
1176 memset(parm, 0, sizeof(union iucv_param)); 1177 memset(parm, 0, sizeof(union iucv_param));
1177 if (flags & IUCV_IPRMDATA) { 1178 if (flags & IUCV_IPRMDATA) {
1178 parm->dpl.ippathid = path->pathid; 1179 parm->dpl.ippathid = path->pathid;
@@ -1559,7 +1560,7 @@ static void iucv_external_interrupt(u16 code)
1559 struct iucv_irq_data *p; 1560 struct iucv_irq_data *p;
1560 struct iucv_irq_list *work; 1561 struct iucv_irq_list *work;
1561 1562
1562 p = percpu_ptr(iucv_irq_data, smp_processor_id()); 1563 p = iucv_irq_data[smp_processor_id()];
1563 if (p->ippathid >= iucv_max_pathid) { 1564 if (p->ippathid >= iucv_max_pathid) {
1564 printk(KERN_WARNING "iucv_do_int: Got interrupt with " 1565 printk(KERN_WARNING "iucv_do_int: Got interrupt with "
1565 "pathid %d > max_connections (%ld)\n", 1566 "pathid %d > max_connections (%ld)\n",
@@ -1598,6 +1599,7 @@ static void iucv_external_interrupt(u16 code)
1598static int __init iucv_init(void) 1599static int __init iucv_init(void)
1599{ 1600{
1600 int rc; 1601 int rc;
1602 int cpu;
1601 1603
1602 if (!MACHINE_IS_VM) { 1604 if (!MACHINE_IS_VM) {
1603 rc = -EPROTONOSUPPORT; 1605 rc = -EPROTONOSUPPORT;
@@ -1617,19 +1619,23 @@ static int __init iucv_init(void)
1617 rc = PTR_ERR(iucv_root); 1619 rc = PTR_ERR(iucv_root);
1618 goto out_bus; 1620 goto out_bus;
1619 } 1621 }
1620 /* Note: GFP_DMA used to get memory below 2G */ 1622
1621 iucv_irq_data = percpu_alloc(sizeof(struct iucv_irq_data), 1623 for_each_online_cpu(cpu) {
1622 GFP_KERNEL|GFP_DMA); 1624 /* Note: GFP_DMA used to get memory below 2G */
1623 if (!iucv_irq_data) { 1625 iucv_irq_data[cpu] = kmalloc_node(sizeof(struct iucv_irq_data),
1624 rc = -ENOMEM; 1626 GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
1625 goto out_root; 1627 if (!iucv_irq_data[cpu]) {
1626 } 1628 rc = -ENOMEM;
1627 /* Allocate parameter blocks. */ 1629 goto out_free;
1628 iucv_param = percpu_alloc(sizeof(union iucv_param), 1630 }
1629 GFP_KERNEL|GFP_DMA); 1631
1630 if (!iucv_param) { 1632 /* Allocate parameter blocks. */
1631 rc = -ENOMEM; 1633 iucv_param[cpu] = kmalloc_node(sizeof(union iucv_param),
1632 goto out_extint; 1634 GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
1635 if (!iucv_param[cpu]) {
1636 rc = -ENOMEM;
1637 goto out_free;
1638 }
1633 } 1639 }
1634 register_hotcpu_notifier(&iucv_cpu_notifier); 1640 register_hotcpu_notifier(&iucv_cpu_notifier);
1635 ASCEBC(iucv_error_no_listener, 16); 1641 ASCEBC(iucv_error_no_listener, 16);
@@ -1638,9 +1644,13 @@ static int __init iucv_init(void)
1638 iucv_available = 1; 1644 iucv_available = 1;
1639 return 0; 1645 return 0;
1640 1646
1641out_extint: 1647out_free:
1642 percpu_free(iucv_irq_data); 1648 for_each_possible_cpu(cpu) {
1643out_root: 1649 kfree(iucv_param[cpu]);
1650 iucv_param[cpu] = NULL;
1651 kfree(iucv_irq_data[cpu]);
1652 iucv_irq_data[cpu] = NULL;
1653 }
1644 s390_root_dev_unregister(iucv_root); 1654 s390_root_dev_unregister(iucv_root);
1645out_bus: 1655out_bus:
1646 bus_unregister(&iucv_bus); 1656 bus_unregister(&iucv_bus);
@@ -1658,6 +1668,7 @@ out:
1658static void __exit iucv_exit(void) 1668static void __exit iucv_exit(void)
1659{ 1669{
1660 struct iucv_irq_list *p, *n; 1670 struct iucv_irq_list *p, *n;
1671 int cpu;
1661 1672
1662 spin_lock_irq(&iucv_queue_lock); 1673 spin_lock_irq(&iucv_queue_lock);
1663 list_for_each_entry_safe(p, n, &iucv_task_queue, list) 1674 list_for_each_entry_safe(p, n, &iucv_task_queue, list)
@@ -1666,8 +1677,12 @@ static void __exit iucv_exit(void)
1666 kfree(p); 1677 kfree(p);
1667 spin_unlock_irq(&iucv_queue_lock); 1678 spin_unlock_irq(&iucv_queue_lock);
1668 unregister_hotcpu_notifier(&iucv_cpu_notifier); 1679 unregister_hotcpu_notifier(&iucv_cpu_notifier);
1669 percpu_free(iucv_param); 1680 for_each_possible_cpu(cpu) {
1670 percpu_free(iucv_irq_data); 1681 kfree(iucv_param[cpu]);
1682 iucv_param[cpu] = NULL;
1683 kfree(iucv_irq_data[cpu]);
1684 iucv_irq_data[cpu] = NULL;
1685 }
1671 s390_root_dev_unregister(iucv_root); 1686 s390_root_dev_unregister(iucv_root);
1672 bus_unregister(&iucv_bus); 1687 bus_unregister(&iucv_bus);
1673 unregister_external_interrupt(0x4000, iucv_external_interrupt); 1688 unregister_external_interrupt(0x4000, iucv_external_interrupt);
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 7969f8a716df..878039b9557d 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);
@@ -1015,9 +1015,7 @@ static inline struct sk_buff *pfkey_xfrm_state2msg(struct xfrm_state *x)
1015{ 1015{
1016 struct sk_buff *skb; 1016 struct sk_buff *skb;
1017 1017
1018 spin_lock_bh(&x->lock);
1019 skb = __pfkey_xfrm_state2msg(x, 1, 3); 1018 skb = __pfkey_xfrm_state2msg(x, 1, 3);
1020 spin_unlock_bh(&x->lock);
1021 1019
1022 return skb; 1020 return skb;
1023} 1021}
@@ -1552,7 +1550,7 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
1552 1550
1553 out_hdr = (struct sadb_msg *) out_skb->data; 1551 out_hdr = (struct sadb_msg *) out_skb->data;
1554 out_hdr->sadb_msg_version = hdr->sadb_msg_version; 1552 out_hdr->sadb_msg_version = hdr->sadb_msg_version;
1555 out_hdr->sadb_msg_type = SADB_DUMP; 1553 out_hdr->sadb_msg_type = SADB_GET;
1556 out_hdr->sadb_msg_satype = pfkey_proto2satype(proto); 1554 out_hdr->sadb_msg_satype = pfkey_proto2satype(proto);
1557 out_hdr->sadb_msg_errno = 0; 1555 out_hdr->sadb_msg_errno = 0;
1558 out_hdr->sadb_msg_reserved = 0; 1556 out_hdr->sadb_msg_reserved = 0;
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/Kconfig b/net/mac80211/Kconfig
index 6fffb3845ab6..ce176e691afe 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -13,6 +13,18 @@ config MAC80211
13 This option enables the hardware independent IEEE 802.11 13 This option enables the hardware independent IEEE 802.11
14 networking stack. 14 networking stack.
15 15
16config MAC80211_RCSIMPLE
17 bool "'simple' rate control algorithm" if EMBEDDED
18 default y
19 depends on MAC80211
20 help
21 This option allows you to turn off the 'simple' rate
22 control algorithm in mac80211. If you do turn it off,
23 you absolutely need another rate control algorithm.
24
25 Say Y unless you know you will have another algorithm
26 available.
27
16config MAC80211_LEDS 28config MAC80211_LEDS
17 bool "Enable LED triggers" 29 bool "Enable LED triggers"
18 depends on MAC80211 && LEDS_TRIGGERS 30 depends on MAC80211 && LEDS_TRIGGERS
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 219cd9f9341f..1e6237b34846 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -1,8 +1,9 @@
1obj-$(CONFIG_MAC80211) += mac80211.o rc80211_simple.o 1obj-$(CONFIG_MAC80211) += mac80211.o
2 2
3mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o 3mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
4mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o 4mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
5mac80211-objs-$(CONFIG_NET_SCHED) += wme.o 5mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
6mac80211-objs-$(CONFIG_MAC80211_RCSIMPLE) += rc80211_simple.o
6 7
7mac80211-objs := \ 8mac80211-objs := \
8 ieee80211.o \ 9 ieee80211.o \
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c
index bf7ba128b963..e62fe55944b8 100644
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aes_ccm.c
@@ -11,7 +11,6 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/crypto.h> 12#include <linux/crypto.h>
13#include <linux/err.h> 13#include <linux/err.h>
14#include <asm/scatterlist.h>
15 14
16#include <net/mac80211.h> 15#include <net/mac80211.h>
17#include "ieee80211_key.h" 16#include "ieee80211_key.h"
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index f484ca7ade9c..59350b8727ec 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -267,6 +267,17 @@ static int ieee80211_open(struct net_device *dev)
267 tasklet_enable(&local->tasklet); 267 tasklet_enable(&local->tasklet);
268 } 268 }
269 269
270 /*
271 * set_multicast_list will be invoked by the networking core
272 * which will check whether any increments here were done in
273 * error and sync them down to the hardware as filter flags.
274 */
275 if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
276 atomic_inc(&local->iff_allmultis);
277
278 if (sdata->flags & IEEE80211_SDATA_PROMISC)
279 atomic_inc(&local->iff_promiscs);
280
270 local->open_count++; 281 local->open_count++;
271 282
272 netif_start_queue(dev); 283 netif_start_queue(dev);
@@ -284,6 +295,18 @@ static int ieee80211_stop(struct net_device *dev)
284 295
285 netif_stop_queue(dev); 296 netif_stop_queue(dev);
286 297
298 /*
299 * Don't count this interface for promisc/allmulti while it
300 * is down. dev_mc_unsync() will invoke set_multicast_list
301 * on the master interface which will sync these down to the
302 * hardware as filter flags.
303 */
304 if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
305 atomic_dec(&local->iff_allmultis);
306
307 if (sdata->flags & IEEE80211_SDATA_PROMISC)
308 atomic_dec(&local->iff_promiscs);
309
287 dev_mc_unsync(local->mdev, dev); 310 dev_mc_unsync(local->mdev, dev);
288 311
289 /* down all dependent devices, that is VLANs */ 312 /* down all dependent devices, that is VLANs */
@@ -366,8 +389,8 @@ static void ieee80211_set_multicast_list(struct net_device *dev)
366 389
367 allmulti = !!(dev->flags & IFF_ALLMULTI); 390 allmulti = !!(dev->flags & IFF_ALLMULTI);
368 promisc = !!(dev->flags & IFF_PROMISC); 391 promisc = !!(dev->flags & IFF_PROMISC);
369 sdata_allmulti = sdata->flags & IEEE80211_SDATA_ALLMULTI; 392 sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI);
370 sdata_promisc = sdata->flags & IEEE80211_SDATA_PROMISC; 393 sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC);
371 394
372 if (allmulti != sdata_allmulti) { 395 if (allmulti != sdata_allmulti) {
373 if (dev->flags & IFF_ALLMULTI) 396 if (dev->flags & IFF_ALLMULTI)
@@ -1072,7 +1095,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1072 ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); 1095 ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev));
1073 ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP); 1096 ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP);
1074 1097
1075 result = ieee80211_init_rate_ctrl_alg(local, NULL); 1098 result = ieee80211_init_rate_ctrl_alg(local,
1099 hw->rate_control_algorithm);
1076 if (result < 0) { 1100 if (result < 0) {
1077 printk(KERN_DEBUG "%s: Failed to initialize rate control " 1101 printk(KERN_DEBUG "%s: Failed to initialize rate control "
1078 "algorithm\n", wiphy_name(local->hw.wiphy)); 1102 "algorithm\n", wiphy_name(local->hw.wiphy));
@@ -1233,8 +1257,17 @@ static int __init ieee80211_init(void)
1233 1257
1234 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); 1258 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb));
1235 1259
1260#ifdef CONFIG_MAC80211_RCSIMPLE
1261 ret = ieee80211_rate_control_register(&mac80211_rcsimple);
1262 if (ret)
1263 return ret;
1264#endif
1265
1236 ret = ieee80211_wme_register(); 1266 ret = ieee80211_wme_register();
1237 if (ret) { 1267 if (ret) {
1268#ifdef CONFIG_MAC80211_RCSIMPLE
1269 ieee80211_rate_control_unregister(&mac80211_rcsimple);
1270#endif
1238 printk(KERN_DEBUG "ieee80211_init: failed to " 1271 printk(KERN_DEBUG "ieee80211_init: failed to "
1239 "initialize WME (err=%d)\n", ret); 1272 "initialize WME (err=%d)\n", ret);
1240 return ret; 1273 return ret;
@@ -1248,6 +1281,10 @@ static int __init ieee80211_init(void)
1248 1281
1249static void __exit ieee80211_exit(void) 1282static void __exit ieee80211_exit(void)
1250{ 1283{
1284#ifdef CONFIG_MAC80211_RCSIMPLE
1285 ieee80211_rate_control_unregister(&mac80211_rcsimple);
1286#endif
1287
1251 ieee80211_wme_unregister(); 1288 ieee80211_wme_unregister();
1252 ieee80211_debugfs_netdev_exit(); 1289 ieee80211_debugfs_netdev_exit();
1253} 1290}
diff --git a/net/mac80211/ieee80211_common.h b/net/mac80211/ieee80211_common.h
deleted file mode 100644
index c15295d43d87..000000000000
--- a/net/mac80211/ieee80211_common.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * IEEE 802.11 driver (80211.o) -- hostapd interface
3 * Copyright 2002-2004, Instant802 Networks, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef IEEE80211_COMMON_H
11#define IEEE80211_COMMON_H
12
13#include <linux/types.h>
14
15/*
16 * This is common header information with user space. It is used on all
17 * frames sent to wlan#ap interface.
18 */
19
20#define IEEE80211_FI_VERSION 0x80211001
21
22struct ieee80211_frame_info {
23 __be32 version;
24 __be32 length;
25 __be64 mactime;
26 __be64 hosttime;
27 __be32 phytype;
28 __be32 channel;
29 __be32 datarate;
30 __be32 antenna;
31 __be32 priority;
32 __be32 ssi_type;
33 __be32 ssi_signal;
34 __be32 ssi_noise;
35 __be32 preamble;
36 __be32 encoding;
37
38 /* Note: this structure is otherwise identical to capture format used
39 * in linux-wlan-ng, but this additional field is used to provide meta
40 * data about the frame to hostapd. This was the easiest method for
41 * providing this information, but this might change in the future. */
42 __be32 msg_type;
43} __attribute__ ((packed));
44
45
46enum ieee80211_msg_type {
47 ieee80211_msg_normal = 0,
48 ieee80211_msg_tx_callback_ack = 1,
49 ieee80211_msg_tx_callback_fail = 2,
50 /* hole at 3, was ieee80211_msg_passive_scan but unused */
51 /* hole at 4, was ieee80211_msg_wep_frame_unknown_key but now unused */
52 ieee80211_msg_michael_mic_failure = 5,
53 /* hole at 6, was monitor but never sent to userspace */
54 ieee80211_msg_sta_not_assoc = 7,
55 /* 8 was ieee80211_msg_set_aid_for_sta */
56 /* 9 was ieee80211_msg_key_threshold_notification */
57 /* 11 was ieee80211_msg_radar */
58};
59
60struct ieee80211_msg_key_notification {
61 int tx_rx_count;
62 char ifname[IFNAMSIZ];
63 u8 addr[ETH_ALEN]; /* ff:ff:ff:ff:ff:ff for broadcast keys */
64};
65
66
67enum ieee80211_phytype {
68 ieee80211_phytype_fhss_dot11_97 = 1,
69 ieee80211_phytype_dsss_dot11_97 = 2,
70 ieee80211_phytype_irbaseband = 3,
71 ieee80211_phytype_dsss_dot11_b = 4,
72 ieee80211_phytype_pbcc_dot11_b = 5,
73 ieee80211_phytype_ofdm_dot11_g = 6,
74 ieee80211_phytype_pbcc_dot11_g = 7,
75 ieee80211_phytype_ofdm_dot11_a = 8,
76};
77
78enum ieee80211_ssi_type {
79 ieee80211_ssi_none = 0,
80 ieee80211_ssi_norm = 1, /* normalized, 0-1000 */
81 ieee80211_ssi_dbm = 2,
82 ieee80211_ssi_raw = 3, /* raw SSI */
83};
84
85struct ieee80211_radar_info {
86 int channel;
87 int radar;
88 int radar_type;
89};
90
91#endif /* IEEE80211_COMMON_H */
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 4b4ed2a5803c..72e1c93dd87e 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -230,6 +230,7 @@ struct ieee80211_if_vlan {
230#define IEEE80211_STA_AUTO_SSID_SEL BIT(10) 230#define IEEE80211_STA_AUTO_SSID_SEL BIT(10)
231#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) 231#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)
232#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) 232#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
233#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
233struct ieee80211_if_sta { 234struct ieee80211_if_sta {
234 enum { 235 enum {
235 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, 236 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
@@ -241,6 +242,8 @@ struct ieee80211_if_sta {
241 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 242 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
242 u8 ssid[IEEE80211_MAX_SSID_LEN]; 243 u8 ssid[IEEE80211_MAX_SSID_LEN];
243 size_t ssid_len; 244 size_t ssid_len;
245 u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
246 size_t scan_ssid_len;
244 u16 aid; 247 u16 aid;
245 u16 ap_capab, capab; 248 u16 ap_capab, capab;
246 u8 *extra_ie; /* to be added to the end of AssocReq */ 249 u8 *extra_ie; /* to be added to the end of AssocReq */
@@ -259,7 +262,6 @@ struct ieee80211_if_sta {
259 unsigned long request; 262 unsigned long request;
260 struct sk_buff_head skb_queue; 263 struct sk_buff_head skb_queue;
261 264
262 int key_management_enabled;
263 unsigned long last_probe; 265 unsigned long last_probe;
264 266
265#define IEEE80211_AUTH_ALG_OPEN BIT(0) 267#define IEEE80211_AUTH_ALG_OPEN BIT(0)
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 6caa3ec2cff7..7027eed4d4ae 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -917,7 +917,6 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
917 struct iw_request_info *info, 917 struct iw_request_info *info,
918 struct iw_param *data, char *extra) 918 struct iw_param *data, char *extra)
919{ 919{
920 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
921 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 920 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
922 int ret = 0; 921 int ret = 0;
923 922
@@ -927,18 +926,21 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
927 case IW_AUTH_CIPHER_GROUP: 926 case IW_AUTH_CIPHER_GROUP:
928 case IW_AUTH_WPA_ENABLED: 927 case IW_AUTH_WPA_ENABLED:
929 case IW_AUTH_RX_UNENCRYPTED_EAPOL: 928 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
930 break;
931 case IW_AUTH_KEY_MGMT: 929 case IW_AUTH_KEY_MGMT:
930 break;
931 case IW_AUTH_PRIVACY_INVOKED:
932 if (sdata->type != IEEE80211_IF_TYPE_STA) 932 if (sdata->type != IEEE80211_IF_TYPE_STA)
933 ret = -EINVAL; 933 ret = -EINVAL;
934 else { 934 else {
935 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
935 /* 936 /*
936 * Key management was set by wpa_supplicant, 937 * Privacy invoked by wpa_supplicant, store the
937 * we only need this to associate to a network 938 * value and allow associating to a protected
938 * that has privacy enabled regardless of not 939 * network without having a key up front.
939 * having a key.
940 */ 940 */
941 sdata->u.sta.key_management_enabled = !!data->value; 941 if (data->value)
942 sdata->u.sta.flags |=
943 IEEE80211_STA_PRIVACY_INVOKED;
942 } 944 }
943 break; 945 break;
944 case IW_AUTH_80211_AUTH_ALG: 946 case IW_AUTH_80211_AUTH_ALG:
@@ -948,11 +950,6 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
948 else 950 else
949 ret = -EOPNOTSUPP; 951 ret = -EOPNOTSUPP;
950 break; 952 break;
951 case IW_AUTH_PRIVACY_INVOKED:
952 if (local->ops->set_privacy_invoked)
953 ret = local->ops->set_privacy_invoked(
954 local_to_hw(local), data->value);
955 break;
956 default: 953 default:
957 ret = -EOPNOTSUPP; 954 ret = -EOPNOTSUPP;
958 break; 955 break;
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index 93abb8fff141..7254bd609839 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -25,13 +25,25 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
25{ 25{
26 struct rate_control_alg *alg; 26 struct rate_control_alg *alg;
27 27
28 if (!ops->name)
29 return -EINVAL;
30
31 mutex_lock(&rate_ctrl_mutex);
32 list_for_each_entry(alg, &rate_ctrl_algs, list) {
33 if (!strcmp(alg->ops->name, ops->name)) {
34 /* don't register an algorithm twice */
35 WARN_ON(1);
36 return -EALREADY;
37 }
38 }
39
28 alg = kzalloc(sizeof(*alg), GFP_KERNEL); 40 alg = kzalloc(sizeof(*alg), GFP_KERNEL);
29 if (alg == NULL) { 41 if (alg == NULL) {
42 mutex_unlock(&rate_ctrl_mutex);
30 return -ENOMEM; 43 return -ENOMEM;
31 } 44 }
32 alg->ops = ops; 45 alg->ops = ops;
33 46
34 mutex_lock(&rate_ctrl_mutex);
35 list_add_tail(&alg->list, &rate_ctrl_algs); 47 list_add_tail(&alg->list, &rate_ctrl_algs);
36 mutex_unlock(&rate_ctrl_mutex); 48 mutex_unlock(&rate_ctrl_mutex);
37 49
@@ -61,9 +73,12 @@ ieee80211_try_rate_control_ops_get(const char *name)
61 struct rate_control_alg *alg; 73 struct rate_control_alg *alg;
62 struct rate_control_ops *ops = NULL; 74 struct rate_control_ops *ops = NULL;
63 75
76 if (!name)
77 return NULL;
78
64 mutex_lock(&rate_ctrl_mutex); 79 mutex_lock(&rate_ctrl_mutex);
65 list_for_each_entry(alg, &rate_ctrl_algs, list) { 80 list_for_each_entry(alg, &rate_ctrl_algs, list) {
66 if (!name || !strcmp(alg->ops->name, name)) 81 if (!strcmp(alg->ops->name, name))
67 if (try_module_get(alg->ops->module)) { 82 if (try_module_get(alg->ops->module)) {
68 ops = alg->ops; 83 ops = alg->ops;
69 break; 84 break;
@@ -80,9 +95,12 @@ ieee80211_rate_control_ops_get(const char *name)
80{ 95{
81 struct rate_control_ops *ops; 96 struct rate_control_ops *ops;
82 97
98 if (!name)
99 name = "simple";
100
83 ops = ieee80211_try_rate_control_ops_get(name); 101 ops = ieee80211_try_rate_control_ops_get(name);
84 if (!ops) { 102 if (!ops) {
85 request_module("rc80211_%s", name ? name : "default"); 103 request_module("rc80211_%s", name);
86 ops = ieee80211_try_rate_control_ops_get(name); 104 ops = ieee80211_try_rate_control_ops_get(name);
87 } 105 }
88 return ops; 106 return ops;
diff --git a/net/mac80211/ieee80211_rate.h b/net/mac80211/ieee80211_rate.h
index 7cd1ebab4f83..23688139ffb3 100644
--- a/net/mac80211/ieee80211_rate.h
+++ b/net/mac80211/ieee80211_rate.h
@@ -65,6 +65,9 @@ struct rate_control_ref {
65 struct kref kref; 65 struct kref kref;
66}; 66};
67 67
68/* default 'simple' algorithm */
69extern struct rate_control_ops mac80211_rcsimple;
70
68int ieee80211_rate_control_register(struct rate_control_ops *ops); 71int ieee80211_rate_control_register(struct rate_control_ops *ops);
69void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 72void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
70 73
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index fda0e06453e8..16afd24d4f6b 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -704,10 +704,11 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
704{ 704{
705 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 705 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
706 struct ieee80211_sta_bss *bss; 706 struct ieee80211_sta_bss *bss;
707 int res = 0; 707 int bss_privacy;
708 int wep_privacy;
709 int privacy_invoked;
708 710
709 if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL) || 711 if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL))
710 ifsta->key_management_enabled)
711 return 0; 712 return 0;
712 713
713 bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel, 714 bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel,
@@ -715,13 +716,16 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
715 if (!bss) 716 if (!bss)
716 return 0; 717 return 0;
717 718
718 if (ieee80211_sta_wep_configured(dev) != 719 bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY);
719 !!(bss->capability & WLAN_CAPABILITY_PRIVACY)) 720 wep_privacy = !!ieee80211_sta_wep_configured(dev);
720 res = 1; 721 privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED);
721 722
722 ieee80211_rx_bss_put(dev, bss); 723 ieee80211_rx_bss_put(dev, bss);
723 724
724 return res; 725 if ((bss_privacy == wep_privacy) || (bss_privacy == privacy_invoked))
726 return 0;
727
728 return 1;
725} 729}
726 730
727 731
@@ -1998,7 +2002,10 @@ void ieee80211_sta_work(struct work_struct *work)
1998 if (ifsta->state != IEEE80211_AUTHENTICATE && 2002 if (ifsta->state != IEEE80211_AUTHENTICATE &&
1999 ifsta->state != IEEE80211_ASSOCIATE && 2003 ifsta->state != IEEE80211_ASSOCIATE &&
2000 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { 2004 test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) {
2001 ieee80211_sta_start_scan(dev, NULL, 0); 2005 if (ifsta->scan_ssid_len)
2006 ieee80211_sta_start_scan(dev, ifsta->scan_ssid, ifsta->scan_ssid_len);
2007 else
2008 ieee80211_sta_start_scan(dev, NULL, 0);
2002 return; 2009 return;
2003 } 2010 }
2004 2011
@@ -2640,7 +2647,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
2640 local->sta_scanning = 0; 2647 local->sta_scanning = 0;
2641 2648
2642 if (ieee80211_hw_config(local)) 2649 if (ieee80211_hw_config(local))
2643 printk(KERN_DEBUG "%s: failed to restore operational" 2650 printk(KERN_DEBUG "%s: failed to restore operational "
2644 "channel after scan\n", dev->name); 2651 "channel after scan\n", dev->name);
2645 2652
2646 2653
@@ -2868,6 +2875,9 @@ int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len)
2868 return -EBUSY; 2875 return -EBUSY;
2869 } 2876 }
2870 2877
2878 ifsta->scan_ssid_len = ssid_len;
2879 if (ssid_len)
2880 memcpy(ifsta->scan_ssid, ssid, ssid_len);
2871 set_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request); 2881 set_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request);
2872 queue_work(local->hw.workqueue, &ifsta->work); 2882 queue_work(local->hw.workqueue, &ifsta->work);
2873 return 0; 2883 return 0;
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c
index 314b8de88862..da72737364e4 100644
--- a/net/mac80211/rc80211_simple.c
+++ b/net/mac80211/rc80211_simple.c
@@ -7,7 +7,6 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 */ 8 */
9 9
10#include <linux/module.h>
11#include <linux/init.h> 10#include <linux/init.h>
12#include <linux/netdevice.h> 11#include <linux/netdevice.h>
13#include <linux/types.h> 12#include <linux/types.h>
@@ -29,8 +28,6 @@
29#define RATE_CONTROL_INTERVAL (HZ / 20) 28#define RATE_CONTROL_INTERVAL (HZ / 20)
30#define RATE_CONTROL_MIN_TX 10 29#define RATE_CONTROL_MIN_TX 10
31 30
32MODULE_ALIAS("rc80211_default");
33
34static void rate_control_rate_inc(struct ieee80211_local *local, 31static void rate_control_rate_inc(struct ieee80211_local *local,
35 struct sta_info *sta) 32 struct sta_info *sta)
36{ 33{
@@ -394,8 +391,7 @@ static void rate_control_simple_remove_sta_debugfs(void *priv, void *priv_sta)
394} 391}
395#endif 392#endif
396 393
397static struct rate_control_ops rate_control_simple = { 394struct rate_control_ops mac80211_rcsimple = {
398 .module = THIS_MODULE,
399 .name = "simple", 395 .name = "simple",
400 .tx_status = rate_control_simple_tx_status, 396 .tx_status = rate_control_simple_tx_status,
401 .get_rate = rate_control_simple_get_rate, 397 .get_rate = rate_control_simple_get_rate,
@@ -410,22 +406,3 @@ static struct rate_control_ops rate_control_simple = {
410 .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs, 406 .remove_sta_debugfs = rate_control_simple_remove_sta_debugfs,
411#endif 407#endif
412}; 408};
413
414
415static int __init rate_control_simple_init(void)
416{
417 return ieee80211_rate_control_register(&rate_control_simple);
418}
419
420
421static void __exit rate_control_simple_exit(void)
422{
423 ieee80211_rate_control_unregister(&rate_control_simple);
424}
425
426
427subsys_initcall(rate_control_simple_init);
428module_exit(rate_control_simple_exit);
429
430MODULE_DESCRIPTION("Simple rate control algorithm for ieee80211");
431MODULE_LICENSE("GPL");
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ece77766ea2b..428a9fcf57d6 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -509,9 +509,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
509 rx->key->tx_rx_count++; 509 rx->key->tx_rx_count++;
510 /* TODO: add threshold stuff again */ 510 /* TODO: add threshold stuff again */
511 } else { 511 } else {
512#ifdef CONFIG_MAC80211_DEBUG
512 if (net_ratelimit()) 513 if (net_ratelimit())
513 printk(KERN_DEBUG "%s: RX protected frame," 514 printk(KERN_DEBUG "%s: RX protected frame,"
514 " but have no key\n", rx->dev->name); 515 " but have no key\n", rx->dev->name);
516#endif /* CONFIG_MAC80211_DEBUG */
515 return TXRX_DROP; 517 return TXRX_DROP;
516 } 518 }
517 519
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index a84a23310ff4..9bf0e1cc530a 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -314,9 +314,11 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx)
314 314
315 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) { 315 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) {
316 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { 316 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) {
317#ifdef CONFIG_MAC80211_DEBUG
317 if (net_ratelimit()) 318 if (net_ratelimit())
318 printk(KERN_DEBUG "%s: RX WEP frame, decrypt " 319 printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
319 "failed\n", rx->dev->name); 320 "failed\n", rx->dev->name);
321#endif /* CONFIG_MAC80211_DEBUG */
320 return TXRX_DROP; 322 return TXRX_DROP;
321 } 323 }
322 } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) { 324 } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) {
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 6695efba57ec..20cec1cb956f 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -323,9 +323,12 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_txrx_data *rx)
323 &rx->u.rx.tkip_iv32, 323 &rx->u.rx.tkip_iv32,
324 &rx->u.rx.tkip_iv16); 324 &rx->u.rx.tkip_iv16);
325 if (res != TKIP_DECRYPT_OK || wpa_test) { 325 if (res != TKIP_DECRYPT_OK || wpa_test) {
326 printk(KERN_DEBUG "%s: TKIP decrypt failed for RX frame from " 326#ifdef CONFIG_MAC80211_DEBUG
327 "%s (res=%d)\n", 327 if (net_ratelimit())
328 rx->dev->name, print_mac(mac, rx->sta->addr), res); 328 printk(KERN_DEBUG "%s: TKIP decrypt failed for RX "
329 "frame from %s (res=%d)\n", rx->dev->name,
330 print_mac(mac, rx->sta->addr), res);
331#endif /* CONFIG_MAC80211_DEBUG */
329 return TXRX_DROP; 332 return TXRX_DROP;
330 } 333 }
331 334
@@ -594,9 +597,12 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx)
594 skb->data + hdrlen + CCMP_HDR_LEN, data_len, 597 skb->data + hdrlen + CCMP_HDR_LEN, data_len,
595 skb->data + skb->len - CCMP_MIC_LEN, 598 skb->data + skb->len - CCMP_MIC_LEN,
596 skb->data + hdrlen + CCMP_HDR_LEN)) { 599 skb->data + hdrlen + CCMP_HDR_LEN)) {
597 printk(KERN_DEBUG "%s: CCMP decrypt failed for RX " 600#ifdef CONFIG_MAC80211_DEBUG
598 "frame from %s\n", rx->dev->name, 601 if (net_ratelimit())
599 print_mac(mac, rx->sta->addr)); 602 printk(KERN_DEBUG "%s: CCMP decrypt failed "
603 "for RX frame from %s\n", rx->dev->name,
604 print_mac(mac, rx->sta->addr));
605#endif /* CONFIG_MAC80211_DEBUG */
600 return TXRX_DROP; 606 return TXRX_DROP;
601 } 607 }
602 } 608 }
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/Makefile b/net/netfilter/Makefile
index 93c58f973831..ad0e36ebea3d 100644
--- a/net/netfilter/Makefile
+++ b/net/netfilter/Makefile
@@ -40,15 +40,15 @@ obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
40# targets 40# targets
41obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o 41obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIFY) += xt_CLASSIFY.o
42obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o 42obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMARK) += xt_CONNMARK.o
43obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o
43obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o 44obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
44obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o 45obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o
45obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o
46obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o 46obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o
47obj-$(CONFIG_NETFILTER_XT_TARGET_NFQUEUE) += xt_NFQUEUE.o
47obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o 48obj-$(CONFIG_NETFILTER_XT_TARGET_NOTRACK) += xt_NOTRACK.o
48obj-$(CONFIG_NETFILTER_XT_TARGET_TRACE) += xt_TRACE.o
49obj-$(CONFIG_NETFILTER_XT_TARGET_SECMARK) += xt_SECMARK.o 49obj-$(CONFIG_NETFILTER_XT_TARGET_SECMARK) += xt_SECMARK.o
50obj-$(CONFIG_NETFILTER_XT_TARGET_TCPMSS) += xt_TCPMSS.o 50obj-$(CONFIG_NETFILTER_XT_TARGET_TCPMSS) += xt_TCPMSS.o
51obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o 51obj-$(CONFIG_NETFILTER_XT_TARGET_TRACE) += xt_TRACE.o
52 52
53# matches 53# matches
54obj-$(CONFIG_NETFILTER_XT_MATCH_COMMENT) += xt_comment.o 54obj-$(CONFIG_NETFILTER_XT_MATCH_COMMENT) += xt_comment.o
@@ -59,22 +59,22 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_CONNTRACK) += xt_conntrack.o
59obj-$(CONFIG_NETFILTER_XT_MATCH_DCCP) += xt_dccp.o 59obj-$(CONFIG_NETFILTER_XT_MATCH_DCCP) += xt_dccp.o
60obj-$(CONFIG_NETFILTER_XT_MATCH_DSCP) += xt_dscp.o 60obj-$(CONFIG_NETFILTER_XT_MATCH_DSCP) += xt_dscp.o
61obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += xt_esp.o 61obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += xt_esp.o
62obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o
62obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o 63obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o
63obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o 64obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o
64obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o 65obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o
65obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o 66obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o
66obj-$(CONFIG_NETFILTER_XT_MATCH_MARK) += xt_mark.o 67obj-$(CONFIG_NETFILTER_XT_MATCH_MARK) += xt_mark.o
67obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o 68obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o
68obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o 69obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o
69obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o 70obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o
71obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o
70obj-$(CONFIG_NETFILTER_XT_MATCH_QUOTA) += xt_quota.o 72obj-$(CONFIG_NETFILTER_XT_MATCH_QUOTA) += xt_quota.o
71obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o 73obj-$(CONFIG_NETFILTER_XT_MATCH_REALM) += xt_realm.o
72obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o 74obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o
73obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o 75obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o
74obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o 76obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o
75obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o 77obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o
76obj-$(CONFIG_NETFILTER_XT_MATCH_TIME) += xt_time.o
77obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o 78obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o
78obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o 79obj-$(CONFIG_NETFILTER_XT_MATCH_TIME) += xt_time.o
79obj-$(CONFIG_NETFILTER_XT_MATCH_U32) += xt_u32.o 80obj-$(CONFIG_NETFILTER_XT_MATCH_U32) += xt_u32.o
80obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o
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/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c
index a1a65a1313b3..cf6ba6659a80 100644
--- a/net/netfilter/nf_conntrack_extend.c
+++ b/net/netfilter/nf_conntrack_extend.c
@@ -109,7 +109,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
109 rcu_read_lock(); 109 rcu_read_lock();
110 t = rcu_dereference(nf_ct_ext_types[i]); 110 t = rcu_dereference(nf_ct_ext_types[i]);
111 if (t && t->move) 111 if (t && t->move)
112 t->move(ct, ct->ext + ct->ext->offset[id]); 112 t->move(ct, ct->ext + ct->ext->offset[i]);
113 rcu_read_unlock(); 113 rcu_read_unlock();
114 } 114 }
115 kfree(ct->ext); 115 kfree(ct->ext);
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c
index aa2831587b82..3dd4b3c76d81 100644
--- a/net/netfilter/nf_sockopt.c
+++ b/net/netfilter/nf_sockopt.c
@@ -23,14 +23,13 @@ static inline int overlap(int min1, int max1, int min2, int max2)
23/* Functions to register sockopt ranges (exclusive). */ 23/* Functions to register sockopt ranges (exclusive). */
24int nf_register_sockopt(struct nf_sockopt_ops *reg) 24int nf_register_sockopt(struct nf_sockopt_ops *reg)
25{ 25{
26 struct list_head *i; 26 struct nf_sockopt_ops *ops;
27 int ret = 0; 27 int ret = 0;
28 28
29 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 29 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0)
30 return -EINTR; 30 return -EINTR;
31 31
32 list_for_each(i, &nf_sockopts) { 32 list_for_each_entry(ops, &nf_sockopts, list) {
33 struct nf_sockopt_ops *ops = (struct nf_sockopt_ops *)i;
34 if (ops->pf == reg->pf 33 if (ops->pf == reg->pf
35 && (overlap(ops->set_optmin, ops->set_optmax, 34 && (overlap(ops->set_optmin, ops->set_optmax,
36 reg->set_optmin, reg->set_optmax) 35 reg->set_optmin, reg->set_optmax)
@@ -61,48 +60,57 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg)
61} 60}
62EXPORT_SYMBOL(nf_unregister_sockopt); 61EXPORT_SYMBOL(nf_unregister_sockopt);
63 62
64/* Call get/setsockopt() */ 63static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, int pf,
65static int nf_sockopt(struct sock *sk, int pf, int val, 64 int val, int get)
66 char __user *opt, int *len, int get)
67{ 65{
68 struct list_head *i;
69 struct nf_sockopt_ops *ops; 66 struct nf_sockopt_ops *ops;
70 int ret;
71 67
72 if (sk->sk_net != &init_net) 68 if (sk->sk_net != &init_net)
73 return -ENOPROTOOPT; 69 return ERR_PTR(-ENOPROTOOPT);
74 70
75 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 71 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0)
76 return -EINTR; 72 return ERR_PTR(-EINTR);
77 73
78 list_for_each(i, &nf_sockopts) { 74 list_for_each_entry(ops, &nf_sockopts, list) {
79 ops = (struct nf_sockopt_ops *)i;
80 if (ops->pf == pf) { 75 if (ops->pf == pf) {
81 if (!try_module_get(ops->owner)) 76 if (!try_module_get(ops->owner))
82 goto out_nosup; 77 goto out_nosup;
78
83 if (get) { 79 if (get) {
84 if (val >= ops->get_optmin 80 if (val >= ops->get_optmin &&
85 && val < ops->get_optmax) { 81 val < ops->get_optmax)
86 mutex_unlock(&nf_sockopt_mutex);
87 ret = ops->get(sk, val, opt, len);
88 goto out; 82 goto out;
89 }
90 } else { 83 } else {
91 if (val >= ops->set_optmin 84 if (val >= ops->set_optmin &&
92 && val < ops->set_optmax) { 85 val < ops->set_optmax)
93 mutex_unlock(&nf_sockopt_mutex);
94 ret = ops->set(sk, val, opt, *len);
95 goto out; 86 goto out;
96 }
97 } 87 }
98 module_put(ops->owner); 88 module_put(ops->owner);
99 } 89 }
100 } 90 }
101 out_nosup: 91out_nosup:
92 ops = ERR_PTR(-ENOPROTOOPT);
93out:
102 mutex_unlock(&nf_sockopt_mutex); 94 mutex_unlock(&nf_sockopt_mutex);
103 return -ENOPROTOOPT; 95 return ops;
96}
97
98/* Call get/setsockopt() */
99static int nf_sockopt(struct sock *sk, int pf, int val,
100 char __user *opt, int *len, int get)
101{
102 struct nf_sockopt_ops *ops;
103 int ret;
104
105 ops = nf_sockopt_find(sk, pf, val, get);
106 if (IS_ERR(ops))
107 return PTR_ERR(ops);
108
109 if (get)
110 ret = ops->get(sk, val, opt, len);
111 else
112 ret = ops->set(sk, val, opt, *len);
104 113
105 out:
106 module_put(ops->owner); 114 module_put(ops->owner);
107 return ret; 115 return ret;
108} 116}
@@ -124,56 +132,25 @@ EXPORT_SYMBOL(nf_getsockopt);
124static int compat_nf_sockopt(struct sock *sk, int pf, int val, 132static int compat_nf_sockopt(struct sock *sk, int pf, int val,
125 char __user *opt, int *len, int get) 133 char __user *opt, int *len, int get)
126{ 134{
127 struct list_head *i;
128 struct nf_sockopt_ops *ops; 135 struct nf_sockopt_ops *ops;
129 int ret; 136 int ret;
130 137
131 if (sk->sk_net != &init_net) 138 ops = nf_sockopt_find(sk, pf, val, get);
132 return -ENOPROTOOPT; 139 if (IS_ERR(ops))
133 140 return PTR_ERR(ops);
134 141
135 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 142 if (get) {
136 return -EINTR; 143 if (ops->compat_get)
137 144 ret = ops->compat_get(sk, val, opt, len);
138 list_for_each(i, &nf_sockopts) { 145 else
139 ops = (struct nf_sockopt_ops *)i; 146 ret = ops->get(sk, val, opt, len);
140 if (ops->pf == pf) { 147 } else {
141 if (!try_module_get(ops->owner)) 148 if (ops->compat_set)
142 goto out_nosup; 149 ret = ops->compat_set(sk, val, opt, *len);
143 150 else
144 if (get) { 151 ret = ops->set(sk, val, opt, *len);
145 if (val >= ops->get_optmin
146 && val < ops->get_optmax) {
147 mutex_unlock(&nf_sockopt_mutex);
148 if (ops->compat_get)
149 ret = ops->compat_get(sk,
150 val, opt, len);
151 else
152 ret = ops->get(sk,
153 val, opt, len);
154 goto out;
155 }
156 } else {
157 if (val >= ops->set_optmin
158 && val < ops->set_optmax) {
159 mutex_unlock(&nf_sockopt_mutex);
160 if (ops->compat_set)
161 ret = ops->compat_set(sk,
162 val, opt, *len);
163 else
164 ret = ops->set(sk,
165 val, opt, *len);
166 goto out;
167 }
168 }
169 module_put(ops->owner);
170 }
171 } 152 }
172 out_nosup:
173 mutex_unlock(&nf_sockopt_mutex);
174 return -ENOPROTOOPT;
175 153
176 out:
177 module_put(ops->owner); 154 module_put(ops->owner);
178 return ret; 155 return ret;
179} 156}
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index 06cff1d13690..d7becf08a93a 100644
--- a/net/netfilter/xt_connlimit.c
+++ b/net/netfilter/xt_connlimit.c
@@ -4,7 +4,8 @@
4 * (c) 2000 Gerd Knorr <kraxel@bytesex.org> 4 * (c) 2000 Gerd Knorr <kraxel@bytesex.org>
5 * Nov 2002: Martin Bene <martin.bene@icomedias.com>: 5 * Nov 2002: Martin Bene <martin.bene@icomedias.com>:
6 * only ignore TIME_WAIT or gone connections 6 * only ignore TIME_WAIT or gone connections
7 * Copyright © Jan Engelhardt <jengelh@gmx.de>, 2007 7 * (C) CC Computer Consultants GmbH, 2007
8 * Contact: <jengelh@computergmbh.de>
8 * 9 *
9 * based on ... 10 * based on ...
10 * 11 *
@@ -306,7 +307,7 @@ static void __exit xt_connlimit_exit(void)
306 307
307module_init(xt_connlimit_init); 308module_init(xt_connlimit_init);
308module_exit(xt_connlimit_exit); 309module_exit(xt_connlimit_exit);
309MODULE_AUTHOR("Jan Engelhardt <jengelh@gmx.de>"); 310MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>");
310MODULE_DESCRIPTION("netfilter xt_connlimit match module"); 311MODULE_DESCRIPTION("netfilter xt_connlimit match module");
311MODULE_LICENSE("GPL"); 312MODULE_LICENSE("GPL");
312MODULE_ALIAS("ipt_connlimit"); 313MODULE_ALIAS("ipt_connlimit");
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
index ef48bbd93573..f9c55dcd894b 100644
--- a/net/netfilter/xt_time.c
+++ b/net/netfilter/xt_time.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * xt_time 2 * xt_time
3 * Copyright © Jan Engelhardt <jengelh@computergmbh.de>, 2007 3 * Copyright © CC Computer Consultants GmbH, 2007
4 * Contact: <jengelh@computergmbh.de>
4 * 5 *
5 * based on ipt_time by Fabrice MARIE <fabrice@netfilter.org> 6 * based on ipt_time by Fabrice MARIE <fabrice@netfilter.org>
6 * This is a module which is used for time matching 7 * This is a module which is used for time matching
@@ -169,7 +170,7 @@ static bool xt_time_match(const struct sk_buff *skb,
169 if (skb->tstamp.tv64 == 0) 170 if (skb->tstamp.tv64 == 0)
170 __net_timestamp((struct sk_buff *)skb); 171 __net_timestamp((struct sk_buff *)skb);
171 172
172 stamp = skb->tstamp.tv64; 173 stamp = ktime_to_ns(skb->tstamp);
173 do_div(stamp, NSEC_PER_SEC); 174 do_div(stamp, NSEC_PER_SEC);
174 175
175 if (info->flags & XT_TIME_LOCAL_TZ) 176 if (info->flags & XT_TIME_LOCAL_TZ)
diff --git a/net/netfilter/xt_u32.c b/net/netfilter/xt_u32.c
index bec427915b30..af75b8c3f20b 100644
--- a/net/netfilter/xt_u32.c
+++ b/net/netfilter/xt_u32.c
@@ -2,7 +2,8 @@
2 * xt_u32 - kernel module to match u32 packet content 2 * xt_u32 - kernel module to match u32 packet content
3 * 3 *
4 * Original author: Don Cohen <don@isis.cs3-inc.com> 4 * Original author: Don Cohen <don@isis.cs3-inc.com>
5 * © Jan Engelhardt <jengelh@gmx.de>, 2007 5 * (C) CC Computer Consultants GmbH, 2007
6 * Contact: <jengelh@computergmbh.de>
6 */ 7 */
7 8
8#include <linux/module.h> 9#include <linux/module.h>
@@ -129,7 +130,7 @@ static void __exit xt_u32_exit(void)
129 130
130module_init(xt_u32_init); 131module_init(xt_u32_init);
131module_exit(xt_u32_exit); 132module_exit(xt_u32_exit);
132MODULE_AUTHOR("Jan Engelhardt <jengelh@gmx.de>"); 133MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>");
133MODULE_DESCRIPTION("netfilter u32 match module"); 134MODULE_DESCRIPTION("netfilter u32 match module");
134MODULE_LICENSE("GPL"); 135MODULE_LICENSE("GPL");
135MODULE_ALIAS("ipt_u32"); 136MODULE_ALIAS("ipt_u32");
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 4f994c0fb3f8..de3988ba1f46 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
@@ -752,7 +752,7 @@ struct sock *netlink_getsockbyfilp(struct file *filp)
752 * 1: repeat lookup - reference dropped while waiting for socket memory. 752 * 1: repeat lookup - reference dropped while waiting for socket memory.
753 */ 753 */
754int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 754int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
755 long timeo, struct sock *ssk) 755 long *timeo, struct sock *ssk)
756{ 756{
757 struct netlink_sock *nlk; 757 struct netlink_sock *nlk;
758 758
@@ -761,7 +761,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
761 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || 761 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
762 test_bit(0, &nlk->state)) { 762 test_bit(0, &nlk->state)) {
763 DECLARE_WAITQUEUE(wait, current); 763 DECLARE_WAITQUEUE(wait, current);
764 if (!timeo) { 764 if (!*timeo) {
765 if (!ssk || netlink_is_kernel(ssk)) 765 if (!ssk || netlink_is_kernel(ssk))
766 netlink_overrun(sk); 766 netlink_overrun(sk);
767 sock_put(sk); 767 sock_put(sk);
@@ -775,7 +775,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
775 if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || 775 if ((atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
776 test_bit(0, &nlk->state)) && 776 test_bit(0, &nlk->state)) &&
777 !sock_flag(sk, SOCK_DEAD)) 777 !sock_flag(sk, SOCK_DEAD))
778 timeo = schedule_timeout(timeo); 778 *timeo = schedule_timeout(*timeo);
779 779
780 __set_current_state(TASK_RUNNING); 780 __set_current_state(TASK_RUNNING);
781 remove_wait_queue(&nlk->wait, &wait); 781 remove_wait_queue(&nlk->wait, &wait);
@@ -783,7 +783,7 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
783 783
784 if (signal_pending(current)) { 784 if (signal_pending(current)) {
785 kfree_skb(skb); 785 kfree_skb(skb);
786 return sock_intr_errno(timeo); 786 return sock_intr_errno(*timeo);
787 } 787 }
788 return 1; 788 return 1;
789 } 789 }
@@ -877,7 +877,7 @@ retry:
877 if (netlink_is_kernel(sk)) 877 if (netlink_is_kernel(sk))
878 return netlink_unicast_kernel(sk, skb); 878 return netlink_unicast_kernel(sk, skb);
879 879
880 err = netlink_attachskb(sk, skb, nonblock, timeo, ssk); 880 err = netlink_attachskb(sk, skb, nonblock, &timeo, ssk);
881 if (err == 1) 881 if (err == 1)
882 goto retry; 882 goto retry;
883 if (err) 883 if (err)
@@ -1888,7 +1888,7 @@ static void __net_exit netlink_net_exit(struct net *net)
1888#endif 1888#endif
1889} 1889}
1890 1890
1891static struct pernet_operations netlink_net_ops = { 1891static struct pernet_operations __net_initdata netlink_net_ops = {
1892 .init = netlink_net_init, 1892 .init = netlink_net_init,
1893 .exit = netlink_net_exit, 1893 .exit = netlink_net_exit,
1894}; 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..8a7807dbba01 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it)
139static HLIST_HEAD(packet_sklist); 139static HLIST_HEAD(packet_sklist);
140static DEFINE_RWLOCK(packet_sklist_lock); 140static DEFINE_RWLOCK(packet_sklist_lock);
141 141
142static atomic_t packet_socks_nr;
143
144
145/* Private packet socket structures. */ 142/* Private packet socket structures. */
146 143
147struct packet_mclist 144struct packet_mclist
@@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk)
236 return; 233 return;
237 } 234 }
238 235
239 atomic_dec(&packet_socks_nr); 236 sk_refcnt_debug_dec(sk);
240#ifdef PACKET_REFCNT_DEBUG
241 printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr));
242#endif
243} 237}
244 238
245 239
@@ -515,7 +509,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
515 sll->sll_hatype = dev->type; 509 sll->sll_hatype = dev->type;
516 sll->sll_protocol = skb->protocol; 510 sll->sll_protocol = skb->protocol;
517 sll->sll_pkttype = skb->pkt_type; 511 sll->sll_pkttype = skb->pkt_type;
518 if (unlikely(po->origdev) && skb->pkt_type == PACKET_HOST) 512 if (unlikely(po->origdev))
519 sll->sll_ifindex = orig_dev->ifindex; 513 sll->sll_ifindex = orig_dev->ifindex;
520 else 514 else
521 sll->sll_ifindex = dev->ifindex; 515 sll->sll_ifindex = dev->ifindex;
@@ -661,7 +655,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
661 sll->sll_hatype = dev->type; 655 sll->sll_hatype = dev->type;
662 sll->sll_protocol = skb->protocol; 656 sll->sll_protocol = skb->protocol;
663 sll->sll_pkttype = skb->pkt_type; 657 sll->sll_pkttype = skb->pkt_type;
664 if (unlikely(po->origdev) && skb->pkt_type == PACKET_HOST) 658 if (unlikely(po->origdev))
665 sll->sll_ifindex = orig_dev->ifindex; 659 sll->sll_ifindex = orig_dev->ifindex;
666 else 660 else
667 sll->sll_ifindex = dev->ifindex; 661 sll->sll_ifindex = dev->ifindex;
@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock)
849 /* Purge queues */ 843 /* Purge queues */
850 844
851 skb_queue_purge(&sk->sk_receive_queue); 845 skb_queue_purge(&sk->sk_receive_queue);
846 sk_refcnt_debug_release(sk);
852 847
853 sock_put(sk); 848 sock_put(sk);
854 return 0; 849 return 0;
@@ -886,20 +881,14 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
886 if (protocol == 0) 881 if (protocol == 0)
887 goto out_unlock; 882 goto out_unlock;
888 883
889 if (dev) { 884 if (!dev || (dev->flags & IFF_UP)) {
890 if (dev->flags&IFF_UP) {
891 dev_add_pack(&po->prot_hook);
892 sock_hold(sk);
893 po->running = 1;
894 } else {
895 sk->sk_err = ENETDOWN;
896 if (!sock_flag(sk, SOCK_DEAD))
897 sk->sk_error_report(sk);
898 }
899 } else {
900 dev_add_pack(&po->prot_hook); 885 dev_add_pack(&po->prot_hook);
901 sock_hold(sk); 886 sock_hold(sk);
902 po->running = 1; 887 po->running = 1;
888 } else {
889 sk->sk_err = ENETDOWN;
890 if (!sock_flag(sk, SOCK_DEAD))
891 sk->sk_error_report(sk);
903 } 892 }
904 893
905out_unlock: 894out_unlock:
@@ -995,7 +984,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
995 sock->state = SS_UNCONNECTED; 984 sock->state = SS_UNCONNECTED;
996 985
997 err = -ENOBUFS; 986 err = -ENOBUFS;
998 sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto, 1); 987 sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto);
999 if (sk == NULL) 988 if (sk == NULL)
1000 goto out; 989 goto out;
1001 990
@@ -1010,7 +999,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
1010 po->num = proto; 999 po->num = proto;
1011 1000
1012 sk->sk_destruct = packet_sock_destruct; 1001 sk->sk_destruct = packet_sock_destruct;
1013 atomic_inc(&packet_socks_nr); 1002 sk_refcnt_debug_inc(sk);
1014 1003
1015 /* 1004 /*
1016 * Attach a protocol block 1005 * Attach a protocol block
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 51d151c0e962..73d60a307129 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -27,6 +27,10 @@
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/rfkill.h> 28#include <linux/rfkill.h>
29 29
30/* Get declaration of rfkill_switch_all() to shut up sparse. */
31#include "rfkill-input.h"
32
33
30MODULE_AUTHOR("Ivo van Doorn <IvDoorn@gmail.com>"); 34MODULE_AUTHOR("Ivo van Doorn <IvDoorn@gmail.com>");
31MODULE_VERSION("1.0"); 35MODULE_VERSION("1.0");
32MODULE_DESCRIPTION("RF switch support"); 36MODULE_DESCRIPTION("RF switch support");
@@ -276,21 +280,17 @@ static struct class rfkill_class = {
276 280
277static int rfkill_add_switch(struct rfkill *rfkill) 281static int rfkill_add_switch(struct rfkill *rfkill)
278{ 282{
279 int retval; 283 int error;
280
281 retval = mutex_lock_interruptible(&rfkill_mutex);
282 if (retval)
283 return retval;
284 284
285 retval = rfkill_toggle_radio(rfkill, rfkill_states[rfkill->type]); 285 mutex_lock(&rfkill_mutex);
286 if (retval)
287 goto out;
288 286
289 list_add_tail(&rfkill->node, &rfkill_list); 287 error = rfkill_toggle_radio(rfkill, rfkill_states[rfkill->type]);
288 if (!error)
289 list_add_tail(&rfkill->node, &rfkill_list);
290 290
291 out:
292 mutex_unlock(&rfkill_mutex); 291 mutex_unlock(&rfkill_mutex);
293 return retval; 292
293 return error;
294} 294}
295 295
296static void rfkill_remove_switch(struct rfkill *rfkill) 296static void rfkill_remove_switch(struct rfkill *rfkill)
@@ -387,20 +387,23 @@ int rfkill_register(struct rfkill *rfkill)
387 387
388 if (!rfkill->toggle_radio) 388 if (!rfkill->toggle_radio)
389 return -EINVAL; 389 return -EINVAL;
390 if (rfkill->type >= RFKILL_TYPE_MAX)
391 return -EINVAL;
392
393 snprintf(dev->bus_id, sizeof(dev->bus_id),
394 "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1);
395
396 rfkill_led_trigger_register(rfkill);
390 397
391 error = rfkill_add_switch(rfkill); 398 error = rfkill_add_switch(rfkill);
392 if (error) 399 if (error)
393 return error; 400 return error;
394 401
395 snprintf(dev->bus_id, sizeof(dev->bus_id),
396 "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1);
397
398 error = device_add(dev); 402 error = device_add(dev);
399 if (error) { 403 if (error) {
400 rfkill_remove_switch(rfkill); 404 rfkill_remove_switch(rfkill);
401 return error; 405 return error;
402 } 406 }
403 rfkill_led_trigger_register(rfkill);
404 407
405 return 0; 408 return 0;
406} 409}
@@ -416,9 +419,9 @@ EXPORT_SYMBOL(rfkill_register);
416 */ 419 */
417void rfkill_unregister(struct rfkill *rfkill) 420void rfkill_unregister(struct rfkill *rfkill)
418{ 421{
419 rfkill_led_trigger_unregister(rfkill);
420 device_del(&rfkill->dev); 422 device_del(&rfkill->dev);
421 rfkill_remove_switch(rfkill); 423 rfkill_remove_switch(rfkill);
424 rfkill_led_trigger_unregister(rfkill);
422 put_device(&rfkill->dev); 425 put_device(&rfkill->dev);
423} 426}
424EXPORT_SYMBOL(rfkill_unregister); 427EXPORT_SYMBOL(rfkill_unregister);
@@ -448,5 +451,5 @@ static void __exit rfkill_exit(void)
448 class_unregister(&rfkill_class); 451 class_unregister(&rfkill_class);
449} 452}
450 453
451module_init(rfkill_init); 454subsys_initcall(rfkill_init);
452module_exit(rfkill_exit); 455module_exit(rfkill_exit);
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/ar-local.c b/net/rxrpc/ar-local.c
index fe03f71f17da..f3a2bd747a8f 100644
--- a/net/rxrpc/ar-local.c
+++ b/net/rxrpc/ar-local.c
@@ -114,7 +114,7 @@ static int rxrpc_create_local(struct rxrpc_local *local)
114 return 0; 114 return 0;
115 115
116error: 116error:
117 local->socket->ops->shutdown(local->socket, 2); 117 kernel_sock_shutdown(local->socket, SHUT_RDWR);
118 local->socket->sk->sk_user_data = NULL; 118 local->socket->sk->sk_user_data = NULL;
119 sock_release(local->socket); 119 sock_release(local->socket);
120 local->socket = NULL; 120 local->socket = NULL;
@@ -267,7 +267,7 @@ static void rxrpc_destroy_local(struct work_struct *work)
267 /* finish cleaning up the local descriptor */ 267 /* finish cleaning up the local descriptor */
268 rxrpc_purge_queue(&local->accept_queue); 268 rxrpc_purge_queue(&local->accept_queue);
269 rxrpc_purge_queue(&local->reject_queue); 269 rxrpc_purge_queue(&local->reject_queue);
270 local->socket->ops->shutdown(local->socket, 2); 270 kernel_sock_shutdown(local->socket, SHUT_RDWR);
271 sock_release(local->socket); 271 sock_release(local->socket);
272 272
273 up_read(&rxrpc_local_sem); 273 up_read(&rxrpc_local_sem);
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index eebefb6ef139..e09a95aa68ff 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -237,7 +237,8 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call,
237 len = data_size + call->conn->size_align - 1; 237 len = data_size + call->conn->size_align - 1;
238 len &= ~(call->conn->size_align - 1); 238 len &= ~(call->conn->size_align - 1);
239 239
240 sg_init_table(sg, skb_to_sgvec(skb, sg, 0, len)); 240 sg_init_table(sg, nsg);
241 skb_to_sgvec(skb, sg, 0, len);
241 crypto_blkcipher_encrypt_iv(&desc, sg, sg, len); 242 crypto_blkcipher_encrypt_iv(&desc, sg, sg, len);
242 243
243 _leave(" = 0"); 244 _leave(" = 0");
@@ -344,7 +345,7 @@ static int rxkad_verify_packet_auth(const struct rxrpc_call *call,
344 goto nomem; 345 goto nomem;
345 346
346 sg_init_table(sg, nsg); 347 sg_init_table(sg, nsg);
347 sg_mark_end(sg, skb_to_sgvec(skb, sg, 0, 8)); 348 skb_to_sgvec(skb, sg, 0, 8);
348 349
349 /* start the decryption afresh */ 350 /* start the decryption afresh */
350 memset(&iv, 0, sizeof(iv)); 351 memset(&iv, 0, sizeof(iv));
@@ -426,7 +427,7 @@ static int rxkad_verify_packet_encrypt(const struct rxrpc_call *call,
426 } 427 }
427 428
428 sg_init_table(sg, nsg); 429 sg_init_table(sg, nsg);
429 sg_mark_end(sg, 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 */
432 payload = call->conn->key->payload.data; 433 payload = call->conn->key->payload.data;
@@ -701,7 +702,7 @@ static void rxkad_sg_set_buf2(struct scatterlist sg[2],
701 nsg++; 702 nsg++;
702 } 703 }
703 704
704 sg_mark_end(sg, nsg); 705 sg_mark_end(&sg[nsg - 1]);
705 706
706 ASSERTCMP(sg[0].length + sg[1].length, ==, buflen); 707 ASSERTCMP(sg[0].length + sg[1].length, ==, buflen);
707} 708}
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 9e98c6e567dd..c39008209164 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -91,7 +91,7 @@ static struct tc_u_common *u32_list;
91 91
92static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel, u8 fshift) 92static __inline__ unsigned u32_hash_fold(u32 key, struct tc_u32_sel *sel, u8 fshift)
93{ 93{
94 unsigned h = (key & sel->hmask)>>fshift; 94 unsigned h = ntohl(key & sel->hmask)>>fshift;
95 95
96 return h; 96 return h;
97} 97}
@@ -613,17 +613,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
613 memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)); 613 memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key));
614 n->ht_up = ht; 614 n->ht_up = ht;
615 n->handle = handle; 615 n->handle = handle;
616{ 616 n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0;
617 u8 i = 0;
618 u32 mask = s->hmask;
619 if (mask) {
620 while (!(mask & 1)) {
621 i++;
622 mask>>=1;
623 }
624 }
625 n->fshift = i;
626}
627 617
628#ifdef CONFIG_CLS_U32_MARK 618#ifdef CONFIG_CLS_U32_MARK
629 if (tb[TCA_U32_MARK-1]) { 619 if (tb[TCA_U32_MARK-1]) {
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index fa1a6f45dc41..e595e6570ce0 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -134,7 +134,7 @@ static inline int qdisc_restart(struct net_device *dev)
134{ 134{
135 struct Qdisc *q = dev->qdisc; 135 struct Qdisc *q = dev->qdisc;
136 struct sk_buff *skb; 136 struct sk_buff *skb;
137 int ret; 137 int ret = NETDEV_TX_BUSY;
138 138
139 /* Dequeue packet */ 139 /* Dequeue packet */
140 if (unlikely((skb = dev_dequeue_skb(dev, q)) == NULL)) 140 if (unlikely((skb = dev_dequeue_skb(dev, q)) == NULL))
@@ -145,7 +145,8 @@ static inline int qdisc_restart(struct net_device *dev)
145 spin_unlock(&dev->queue_lock); 145 spin_unlock(&dev->queue_lock);
146 146
147 HARD_TX_LOCK(dev, smp_processor_id()); 147 HARD_TX_LOCK(dev, smp_processor_id());
148 ret = dev_hard_start_xmit(skb, dev); 148 if (!netif_subqueue_stopped(dev, skb))
149 ret = dev_hard_start_xmit(skb, dev);
149 HARD_TX_UNLOCK(dev); 150 HARD_TX_UNLOCK(dev);
150 151
151 spin_lock(&dev->queue_lock); 152 spin_lock(&dev->queue_lock);
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 421281d9dd1d..c0ed06d4a504 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -252,6 +252,9 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *
252static inline int teql_resolve(struct sk_buff *skb, 252static inline int teql_resolve(struct sk_buff *skb,
253 struct sk_buff *skb_res, struct net_device *dev) 253 struct sk_buff *skb_res, struct net_device *dev)
254{ 254{
255 if (dev->qdisc == &noop_qdisc)
256 return -ENODEV;
257
255 if (dev->header_ops == NULL || 258 if (dev->header_ops == NULL ||
256 skb->dst == NULL || 259 skb->dst == NULL ||
257 skb->dst->neighbour == NULL) 260 skb->dst->neighbour == NULL)
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 03158e3665da..013e3d3ab0f1 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -262,10 +262,14 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
262 */ 262 */
263 asoc->peer.sack_needed = 1; 263 asoc->peer.sack_needed = 1;
264 264
265 /* Assume that the peer recongizes ASCONF until reported otherwise 265 /* Assume that the peer will tell us if he recognizes ASCONF
266 * via an ERROR chunk. 266 * as part of INIT exchange.
267 * The sctp_addip_noauth option is there for backward compatibilty
268 * and will revert old behavior.
267 */ 269 */
268 asoc->peer.asconf_capable = 1; 270 asoc->peer.asconf_capable = 0;
271 if (sctp_addip_noauth)
272 asoc->peer.asconf_capable = 1;
269 273
270 /* Create an input queue. */ 274 /* Create an input queue. */
271 sctp_inq_init(&asoc->base.inqueue); 275 sctp_inq_init(&asoc->base.inqueue);
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 8af1004abefe..6d5fa6bb371b 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -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;
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index dfffa94fb9f6..cae95af9a8cc 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -180,9 +180,7 @@ int sctp_add_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *new,
180/* Delete an address from the bind address list in the SCTP_bind_addr 180/* Delete an address from the bind address list in the SCTP_bind_addr
181 * structure. 181 * structure.
182 */ 182 */
183int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr, 183int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
184 void fastcall (*rcu_call)(struct rcu_head *head,
185 void (*func)(struct rcu_head *head)))
186{ 184{
187 struct sctp_sockaddr_entry *addr, *temp; 185 struct sctp_sockaddr_entry *addr, *temp;
188 186
@@ -198,15 +196,10 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr,
198 } 196 }
199 } 197 }
200 198
201 /* Call the rcu callback provided in the args. This function is
202 * called by both BH packet processing and user side socket option
203 * processing, but it works on different lists in those 2 contexts.
204 * Each context provides it's own callback, whether call_rcu_bh()
205 * or call_rcu(), to make sure that we wait for an appropriate time.
206 */
207 if (addr && !addr->valid) { 199 if (addr && !addr->valid) {
208 rcu_call(&addr->rcu, sctp_local_addr_free); 200 call_rcu(&addr->rcu, sctp_local_addr_free);
209 SCTP_DBG_OBJCNT_DEC(addr); 201 SCTP_DBG_OBJCNT_DEC(addr);
202 return 0;
210 } 203 }
211 204
212 return -EINVAL; 205 return -EINVAL;
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 2d2d81ef4a69..de6f505d6ff8 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -328,24 +328,35 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
328 const union sctp_addr *paddr, 328 const union sctp_addr *paddr,
329 struct sctp_transport **transport) 329 struct sctp_transport **transport)
330{ 330{
331 struct sctp_association *asoc = NULL;
332 struct sctp_transport *t = NULL;
333 struct sctp_hashbucket *head;
334 struct sctp_ep_common *epb;
335 struct hlist_node *node;
336 int hash;
331 int rport; 337 int rport;
332 struct sctp_association *asoc;
333 struct list_head *pos;
334 338
339 *transport = NULL;
335 rport = ntohs(paddr->v4.sin_port); 340 rport = ntohs(paddr->v4.sin_port);
336 341
337 list_for_each(pos, &ep->asocs) { 342 hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport);
338 asoc = list_entry(pos, struct sctp_association, asocs); 343 head = &sctp_assoc_hashtable[hash];
339 if (rport == asoc->peer.port) { 344 read_lock(&head->lock);
340 *transport = sctp_assoc_lookup_paddr(asoc, paddr); 345 sctp_for_each_hentry(epb, node, &head->chain) {
341 346 asoc = sctp_assoc(epb);
342 if (*transport) 347 if (asoc->ep != ep || rport != asoc->peer.port)
343 return asoc; 348 goto next;
349
350 t = sctp_assoc_lookup_paddr(asoc, paddr);
351 if (t) {
352 *transport = t;
353 break;
344 } 354 }
355next:
356 asoc = NULL;
345 } 357 }
346 358 read_unlock(&head->lock);
347 *transport = NULL; 359 return asoc;
348 return NULL;
349} 360}
350 361
351/* Lookup association on an endpoint based on a peer address. BH-safe. */ 362/* Lookup association on an endpoint based on a peer address. BH-safe. */
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 86503e7fa21e..91ae463b079b 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -656,7 +656,6 @@ discard:
656/* Insert endpoint into the hash table. */ 656/* Insert endpoint into the hash table. */
657static void __sctp_hash_endpoint(struct sctp_endpoint *ep) 657static void __sctp_hash_endpoint(struct sctp_endpoint *ep)
658{ 658{
659 struct sctp_ep_common **epp;
660 struct sctp_ep_common *epb; 659 struct sctp_ep_common *epb;
661 struct sctp_hashbucket *head; 660 struct sctp_hashbucket *head;
662 661
@@ -666,12 +665,7 @@ static void __sctp_hash_endpoint(struct sctp_endpoint *ep)
666 head = &sctp_ep_hashtable[epb->hashent]; 665 head = &sctp_ep_hashtable[epb->hashent];
667 666
668 sctp_write_lock(&head->lock); 667 sctp_write_lock(&head->lock);
669 epp = &head->chain; 668 hlist_add_head(&epb->node, &head->chain);
670 epb->next = *epp;
671 if (epb->next)
672 (*epp)->pprev = &epb->next;
673 *epp = epb;
674 epb->pprev = epp;
675 sctp_write_unlock(&head->lock); 669 sctp_write_unlock(&head->lock);
676} 670}
677 671
@@ -691,19 +685,15 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep)
691 685
692 epb = &ep->base; 686 epb = &ep->base;
693 687
688 if (hlist_unhashed(&epb->node))
689 return;
690
694 epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); 691 epb->hashent = sctp_ep_hashfn(epb->bind_addr.port);
695 692
696 head = &sctp_ep_hashtable[epb->hashent]; 693 head = &sctp_ep_hashtable[epb->hashent];
697 694
698 sctp_write_lock(&head->lock); 695 sctp_write_lock(&head->lock);
699 696 __hlist_del(&epb->node);
700 if (epb->pprev) {
701 if (epb->next)
702 epb->next->pprev = epb->pprev;
703 *epb->pprev = epb->next;
704 epb->pprev = NULL;
705 }
706
707 sctp_write_unlock(&head->lock); 697 sctp_write_unlock(&head->lock);
708} 698}
709 699
@@ -721,12 +711,13 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l
721 struct sctp_hashbucket *head; 711 struct sctp_hashbucket *head;
722 struct sctp_ep_common *epb; 712 struct sctp_ep_common *epb;
723 struct sctp_endpoint *ep; 713 struct sctp_endpoint *ep;
714 struct hlist_node *node;
724 int hash; 715 int hash;
725 716
726 hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port)); 717 hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port));
727 head = &sctp_ep_hashtable[hash]; 718 head = &sctp_ep_hashtable[hash];
728 read_lock(&head->lock); 719 read_lock(&head->lock);
729 for (epb = head->chain; epb; epb = epb->next) { 720 sctp_for_each_hentry(epb, node, &head->chain) {
730 ep = sctp_ep(epb); 721 ep = sctp_ep(epb);
731 if (sctp_endpoint_is_match(ep, laddr)) 722 if (sctp_endpoint_is_match(ep, laddr))
732 goto hit; 723 goto hit;
@@ -744,7 +735,6 @@ hit:
744/* Insert association into the hash table. */ 735/* Insert association into the hash table. */
745static void __sctp_hash_established(struct sctp_association *asoc) 736static void __sctp_hash_established(struct sctp_association *asoc)
746{ 737{
747 struct sctp_ep_common **epp;
748 struct sctp_ep_common *epb; 738 struct sctp_ep_common *epb;
749 struct sctp_hashbucket *head; 739 struct sctp_hashbucket *head;
750 740
@@ -756,12 +746,7 @@ static void __sctp_hash_established(struct sctp_association *asoc)
756 head = &sctp_assoc_hashtable[epb->hashent]; 746 head = &sctp_assoc_hashtable[epb->hashent];
757 747
758 sctp_write_lock(&head->lock); 748 sctp_write_lock(&head->lock);
759 epp = &head->chain; 749 hlist_add_head(&epb->node, &head->chain);
760 epb->next = *epp;
761 if (epb->next)
762 (*epp)->pprev = &epb->next;
763 *epp = epb;
764 epb->pprev = epp;
765 sctp_write_unlock(&head->lock); 750 sctp_write_unlock(&head->lock);
766} 751}
767 752
@@ -790,14 +775,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc)
790 head = &sctp_assoc_hashtable[epb->hashent]; 775 head = &sctp_assoc_hashtable[epb->hashent];
791 776
792 sctp_write_lock(&head->lock); 777 sctp_write_lock(&head->lock);
793 778 __hlist_del(&epb->node);
794 if (epb->pprev) {
795 if (epb->next)
796 epb->next->pprev = epb->pprev;
797 *epb->pprev = epb->next;
798 epb->pprev = NULL;
799 }
800
801 sctp_write_unlock(&head->lock); 779 sctp_write_unlock(&head->lock);
802} 780}
803 781
@@ -822,6 +800,7 @@ static struct sctp_association *__sctp_lookup_association(
822 struct sctp_ep_common *epb; 800 struct sctp_ep_common *epb;
823 struct sctp_association *asoc; 801 struct sctp_association *asoc;
824 struct sctp_transport *transport; 802 struct sctp_transport *transport;
803 struct hlist_node *node;
825 int hash; 804 int hash;
826 805
827 /* Optimize here for direct hit, only listening connections can 806 /* Optimize here for direct hit, only listening connections can
@@ -830,7 +809,7 @@ static struct sctp_association *__sctp_lookup_association(
830 hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port)); 809 hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port));
831 head = &sctp_assoc_hashtable[hash]; 810 head = &sctp_assoc_hashtable[hash];
832 read_lock(&head->lock); 811 read_lock(&head->lock);
833 for (epb = head->chain; epb; epb = epb->next) { 812 sctp_for_each_hentry(epb, node, &head->chain) {
834 asoc = sctp_assoc(epb); 813 asoc = sctp_assoc(epb);
835 transport = sctp_assoc_is_match(asoc, local, peer); 814 transport = sctp_assoc_is_match(asoc, local, peer);
836 if (transport) 815 if (transport)
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index f10fe7fbf24c..cf4b7eb023b3 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -90,6 +90,10 @@ void sctp_inq_free(struct sctp_inq *queue)
90void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk) 90void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk)
91{ 91{
92 /* Directly call the packet handling routine. */ 92 /* Directly call the packet handling routine. */
93 if (chunk->rcvr->dead) {
94 sctp_chunk_free(chunk);
95 return;
96 }
93 97
94 /* We are now calling this either from the soft interrupt 98 /* We are now calling this either from the soft interrupt
95 * or from the backlog processing. 99 * or from the backlog processing.
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/outqueue.c b/net/sctp/outqueue.c
index 28f4fe77ceee..fa76f235169b 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -382,7 +382,7 @@ static void sctp_insert_list(struct list_head *head, struct list_head *new)
382/* Mark all the eligible packets on a transport for retransmission. */ 382/* Mark all the eligible packets on a transport for retransmission. */
383void sctp_retransmit_mark(struct sctp_outq *q, 383void sctp_retransmit_mark(struct sctp_outq *q,
384 struct sctp_transport *transport, 384 struct sctp_transport *transport,
385 __u8 fast_retransmit) 385 __u8 reason)
386{ 386{
387 struct list_head *lchunk, *ltemp; 387 struct list_head *lchunk, *ltemp;
388 struct sctp_chunk *chunk; 388 struct sctp_chunk *chunk;
@@ -412,20 +412,20 @@ void sctp_retransmit_mark(struct sctp_outq *q,
412 continue; 412 continue;
413 } 413 }
414 414
415 /* If we are doing retransmission due to a fast retransmit, 415 /* If we are doing retransmission due to a timeout or pmtu
416 * only the chunk's that are marked for fast retransmit 416 * discovery, only the chunks that are not yet acked should
417 * should be added to the retransmit queue. If we are doing 417 * be added to the retransmit queue.
418 * retransmission due to a timeout or pmtu discovery, only the
419 * chunks that are not yet acked should be added to the
420 * retransmit queue.
421 */ 418 */
422 if ((fast_retransmit && (chunk->fast_retransmit > 0)) || 419 if ((reason == SCTP_RTXR_FAST_RTX &&
423 (!fast_retransmit && !chunk->tsn_gap_acked)) { 420 (chunk->fast_retransmit > 0)) ||
421 (reason != SCTP_RTXR_FAST_RTX && !chunk->tsn_gap_acked)) {
424 /* If this chunk was sent less then 1 rto ago, do not 422 /* If this chunk was sent less then 1 rto ago, do not
425 * retransmit this chunk, but give the peer time 423 * retransmit this chunk, but give the peer time
426 * to acknowlege it. 424 * to acknowlege it. Do this only when
425 * retransmitting due to T3 timeout.
427 */ 426 */
428 if ((jiffies - chunk->sent_at) < transport->rto) 427 if (reason == SCTP_RTXR_T3_RTX &&
428 (jiffies - chunk->sent_at) < transport->last_rto)
429 continue; 429 continue;
430 430
431 /* RFC 2960 6.2.1 Processing a Received SACK 431 /* RFC 2960 6.2.1 Processing a Received SACK
@@ -467,10 +467,10 @@ void sctp_retransmit_mark(struct sctp_outq *q,
467 } 467 }
468 } 468 }
469 469
470 SCTP_DEBUG_PRINTK("%s: transport: %p, fast_retransmit: %d, " 470 SCTP_DEBUG_PRINTK("%s: transport: %p, reason: %d, "
471 "cwnd: %d, ssthresh: %d, flight_size: %d, " 471 "cwnd: %d, ssthresh: %d, flight_size: %d, "
472 "pba: %d\n", __FUNCTION__, 472 "pba: %d\n", __FUNCTION__,
473 transport, fast_retransmit, 473 transport, reason,
474 transport->cwnd, transport->ssthresh, 474 transport->cwnd, transport->ssthresh,
475 transport->flight_size, 475 transport->flight_size,
476 transport->partial_bytes_acked); 476 transport->partial_bytes_acked);
@@ -484,7 +484,6 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
484 sctp_retransmit_reason_t reason) 484 sctp_retransmit_reason_t reason)
485{ 485{
486 int error = 0; 486 int error = 0;
487 __u8 fast_retransmit = 0;
488 487
489 switch(reason) { 488 switch(reason) {
490 case SCTP_RTXR_T3_RTX: 489 case SCTP_RTXR_T3_RTX:
@@ -499,16 +498,18 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
499 case SCTP_RTXR_FAST_RTX: 498 case SCTP_RTXR_FAST_RTX:
500 SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS); 499 SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS);
501 sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX); 500 sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX);
502 fast_retransmit = 1;
503 break; 501 break;
504 case SCTP_RTXR_PMTUD: 502 case SCTP_RTXR_PMTUD:
505 SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS); 503 SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS);
506 break; 504 break;
505 case SCTP_RTXR_T1_RTX:
506 SCTP_INC_STATS(SCTP_MIB_T1_RETRANSMITS);
507 break;
507 default: 508 default:
508 BUG(); 509 BUG();
509 } 510 }
510 511
511 sctp_retransmit_mark(q, transport, fast_retransmit); 512 sctp_retransmit_mark(q, transport, reason);
512 513
513 /* PR-SCTP A5) Any time the T3-rtx timer expires, on any destination, 514 /* PR-SCTP A5) Any time the T3-rtx timer expires, on any destination,
514 * the sender SHOULD try to advance the "Advanced.Peer.Ack.Point" by 515 * the sender SHOULD try to advance the "Advanced.Peer.Ack.Point" by
@@ -641,7 +642,8 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
641 642
642 /* If we are here due to a retransmit timeout or a fast 643 /* If we are here due to a retransmit timeout or a fast
643 * retransmit and if there are any chunks left in the retransmit 644 * retransmit and if there are any chunks left in the retransmit
644 * queue that could not fit in the PMTU sized packet, they need * to be marked as ineligible for a subsequent fast retransmit. 645 * queue that could not fit in the PMTU sized packet, they need
646 * to be marked as ineligible for a subsequent fast retransmit.
645 */ 647 */
646 if (rtx_timeout && !lchunk) { 648 if (rtx_timeout && !lchunk) {
647 list_for_each(lchunk1, lqueue) { 649 list_for_each(lchunk1, lqueue) {
@@ -660,10 +662,9 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
660int sctp_outq_uncork(struct sctp_outq *q) 662int sctp_outq_uncork(struct sctp_outq *q)
661{ 663{
662 int error = 0; 664 int error = 0;
663 if (q->cork) { 665 if (q->cork)
664 q->cork = 0; 666 q->cork = 0;
665 error = sctp_outq_flush(q, 0); 667 error = sctp_outq_flush(q, 0);
666 }
667 return error; 668 return error;
668} 669}
669 670
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index e4cd841a22e4..249973204070 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -225,6 +225,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v)
225 struct sctp_ep_common *epb; 225 struct sctp_ep_common *epb;
226 struct sctp_endpoint *ep; 226 struct sctp_endpoint *ep;
227 struct sock *sk; 227 struct sock *sk;
228 struct hlist_node *node;
228 int hash = *(loff_t *)v; 229 int hash = *(loff_t *)v;
229 230
230 if (hash >= sctp_ep_hashsize) 231 if (hash >= sctp_ep_hashsize)
@@ -233,7 +234,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v)
233 head = &sctp_ep_hashtable[hash]; 234 head = &sctp_ep_hashtable[hash];
234 sctp_local_bh_disable(); 235 sctp_local_bh_disable();
235 read_lock(&head->lock); 236 read_lock(&head->lock);
236 for (epb = head->chain; epb; epb = epb->next) { 237 sctp_for_each_hentry(epb, node, &head->chain) {
237 ep = sctp_ep(epb); 238 ep = sctp_ep(epb);
238 sk = epb->sk; 239 sk = epb->sk;
239 seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, 240 seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk,
@@ -328,6 +329,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
328 struct sctp_ep_common *epb; 329 struct sctp_ep_common *epb;
329 struct sctp_association *assoc; 330 struct sctp_association *assoc;
330 struct sock *sk; 331 struct sock *sk;
332 struct hlist_node *node;
331 int hash = *(loff_t *)v; 333 int hash = *(loff_t *)v;
332 334
333 if (hash >= sctp_assoc_hashsize) 335 if (hash >= sctp_assoc_hashsize)
@@ -336,7 +338,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
336 head = &sctp_assoc_hashtable[hash]; 338 head = &sctp_assoc_hashtable[hash];
337 sctp_local_bh_disable(); 339 sctp_local_bh_disable();
338 read_lock(&head->lock); 340 read_lock(&head->lock);
339 for (epb = head->chain; epb; epb = epb->next) { 341 sctp_for_each_hentry(epb, node, &head->chain) {
340 assoc = sctp_assoc(epb); 342 assoc = sctp_assoc(epb);
341 sk = epb->sk; 343 sk = epb->sk;
342 seq_printf(seq, 344 seq_printf(seq,
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index f5cd96f5fe74..d50f610d1b02 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;
@@ -1136,7 +1137,7 @@ SCTP_STATIC __init int sctp_init(void)
1136 } 1137 }
1137 for (i = 0; i < sctp_assoc_hashsize; i++) { 1138 for (i = 0; i < sctp_assoc_hashsize; i++) {
1138 rwlock_init(&sctp_assoc_hashtable[i].lock); 1139 rwlock_init(&sctp_assoc_hashtable[i].lock);
1139 sctp_assoc_hashtable[i].chain = NULL; 1140 INIT_HLIST_HEAD(&sctp_assoc_hashtable[i].chain);
1140 } 1141 }
1141 1142
1142 /* Allocate and initialize the endpoint hash table. */ 1143 /* Allocate and initialize the endpoint hash table. */
@@ -1150,7 +1151,7 @@ SCTP_STATIC __init int sctp_init(void)
1150 } 1151 }
1151 for (i = 0; i < sctp_ep_hashsize; i++) { 1152 for (i = 0; i < sctp_ep_hashsize; i++) {
1152 rwlock_init(&sctp_ep_hashtable[i].lock); 1153 rwlock_init(&sctp_ep_hashtable[i].lock);
1153 sctp_ep_hashtable[i].chain = NULL; 1154 INIT_HLIST_HEAD(&sctp_ep_hashtable[i].chain);
1154 } 1155 }
1155 1156
1156 /* Allocate and initialize the SCTP port hash table. */ 1157 /* Allocate and initialize the SCTP port hash table. */
@@ -1169,7 +1170,7 @@ SCTP_STATIC __init int sctp_init(void)
1169 } 1170 }
1170 for (i = 0; i < sctp_port_hashsize; i++) { 1171 for (i = 0; i < sctp_port_hashsize; i++) {
1171 spin_lock_init(&sctp_port_hashtable[i].lock); 1172 spin_lock_init(&sctp_port_hashtable[i].lock);
1172 sctp_port_hashtable[i].chain = NULL; 1173 INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain);
1173 } 1174 }
1174 1175
1175 printk(KERN_INFO "SCTP: Hash tables configured " 1176 printk(KERN_INFO "SCTP: Hash tables configured "
@@ -1178,6 +1179,7 @@ SCTP_STATIC __init int sctp_init(void)
1178 1179
1179 /* Disable ADDIP by default. */ 1180 /* Disable ADDIP by default. */
1180 sctp_addip_enable = 0; 1181 sctp_addip_enable = 0;
1182 sctp_addip_noauth = 0;
1181 1183
1182 /* Enable PR-SCTP by default. */ 1184 /* Enable PR-SCTP by default. */
1183 sctp_prsctp_enable = 1; 1185 sctp_prsctp_enable = 1;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index c377e4e8f653..5a9783c38de1 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1788,9 +1788,14 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
1788 sizeof(sctp_paramhdr_t); 1788 sizeof(sctp_paramhdr_t);
1789 1789
1790 1790
1791 /* This is a fatal error. Any accumulated non-fatal errors are
1792 * not reported.
1793 */
1794 if (*errp)
1795 sctp_chunk_free(*errp);
1796
1791 /* Create an error chunk and fill it in with our payload. */ 1797 /* Create an error chunk and fill it in with our payload. */
1792 if (!*errp) 1798 *errp = sctp_make_op_error_space(asoc, chunk, payload_len);
1793 *errp = sctp_make_op_error_space(asoc, chunk, payload_len);
1794 1799
1795 if (*errp) { 1800 if (*errp) {
1796 sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION, 1801 sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION,
@@ -1813,9 +1818,15 @@ static int sctp_process_hn_param(const struct sctp_association *asoc,
1813{ 1818{
1814 __u16 len = ntohs(param.p->length); 1819 __u16 len = ntohs(param.p->length);
1815 1820
1816 /* Make an ERROR chunk. */ 1821 /* Processing of the HOST_NAME parameter will generate an
1817 if (!*errp) 1822 * ABORT. If we've accumulated any non-fatal errors, they
1818 *errp = sctp_make_op_error_space(asoc, chunk, len); 1823 * would be unrecognized parameters and we should not include
1824 * them in the ABORT.
1825 */
1826 if (*errp)
1827 sctp_chunk_free(*errp);
1828
1829 *errp = sctp_make_op_error_space(asoc, chunk, len);
1819 1830
1820 if (*errp) { 1831 if (*errp) {
1821 sctp_init_cause(*errp, SCTP_ERROR_DNS_FAILED, len); 1832 sctp_init_cause(*errp, SCTP_ERROR_DNS_FAILED, len);
@@ -1847,7 +1858,7 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
1847 break; 1858 break;
1848 case SCTP_CID_ASCONF: 1859 case SCTP_CID_ASCONF:
1849 case SCTP_CID_ASCONF_ACK: 1860 case SCTP_CID_ASCONF_ACK:
1850 asoc->peer.addip_capable = 1; 1861 asoc->peer.asconf_capable = 1;
1851 break; 1862 break;
1852 default: 1863 default:
1853 break; 1864 break;
@@ -1862,56 +1873,40 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
1862 * taken if the processing endpoint does not recognize the 1873 * taken if the processing endpoint does not recognize the
1863 * Parameter Type. 1874 * Parameter Type.
1864 * 1875 *
1865 * 00 - Stop processing this SCTP chunk and discard it, 1876 * 00 - Stop processing this parameter; do not process any further
1866 * do not process any further chunks within it. 1877 * parameters within this chunk
1867 * 1878 *
1868 * 01 - Stop processing this SCTP chunk and discard it, 1879 * 01 - Stop processing this parameter, do not process any further
1869 * do not process any further chunks within it, and report 1880 * parameters within this chunk, and report the unrecognized
1870 * the unrecognized parameter in an 'Unrecognized 1881 * parameter in an 'Unrecognized Parameter' ERROR chunk.
1871 * Parameter Type' (in either an ERROR or in the INIT ACK).
1872 * 1882 *
1873 * 10 - Skip this parameter and continue processing. 1883 * 10 - Skip this parameter and continue processing.
1874 * 1884 *
1875 * 11 - Skip this parameter and continue processing but 1885 * 11 - Skip this parameter and continue processing but
1876 * report the unrecognized parameter in an 1886 * report the unrecognized parameter in an
1877 * 'Unrecognized Parameter Type' (in either an ERROR or in 1887 * 'Unrecognized Parameter' ERROR chunk.
1878 * the INIT ACK).
1879 * 1888 *
1880 * Return value: 1889 * Return value:
1881 * 0 - discard the chunk 1890 * SCTP_IERROR_NO_ERROR - continue with the chunk
1882 * 1 - continue with the chunk 1891 * SCTP_IERROR_ERROR - stop and report an error.
1892 * SCTP_IERROR_NOMEME - out of memory.
1883 */ 1893 */
1884static int sctp_process_unk_param(const struct sctp_association *asoc, 1894static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc,
1885 union sctp_params param, 1895 union sctp_params param,
1886 struct sctp_chunk *chunk, 1896 struct sctp_chunk *chunk,
1887 struct sctp_chunk **errp) 1897 struct sctp_chunk **errp)
1888{ 1898{
1889 int retval = 1; 1899 int retval = SCTP_IERROR_NO_ERROR;
1890 1900
1891 switch (param.p->type & SCTP_PARAM_ACTION_MASK) { 1901 switch (param.p->type & SCTP_PARAM_ACTION_MASK) {
1892 case SCTP_PARAM_ACTION_DISCARD: 1902 case SCTP_PARAM_ACTION_DISCARD:
1893 retval = 0; 1903 retval = SCTP_IERROR_ERROR;
1894 break;
1895 case SCTP_PARAM_ACTION_DISCARD_ERR:
1896 retval = 0;
1897 /* Make an ERROR chunk, preparing enough room for
1898 * returning multiple unknown parameters.
1899 */
1900 if (NULL == *errp)
1901 *errp = sctp_make_op_error_space(asoc, chunk,
1902 ntohs(chunk->chunk_hdr->length));
1903
1904 if (*errp) {
1905 sctp_init_cause(*errp, SCTP_ERROR_UNKNOWN_PARAM,
1906 WORD_ROUND(ntohs(param.p->length)));
1907 sctp_addto_chunk(*errp,
1908 WORD_ROUND(ntohs(param.p->length)),
1909 param.v);
1910 }
1911
1912 break; 1904 break;
1913 case SCTP_PARAM_ACTION_SKIP: 1905 case SCTP_PARAM_ACTION_SKIP:
1914 break; 1906 break;
1907 case SCTP_PARAM_ACTION_DISCARD_ERR:
1908 retval = SCTP_IERROR_ERROR;
1909 /* Fall through */
1915 case SCTP_PARAM_ACTION_SKIP_ERR: 1910 case SCTP_PARAM_ACTION_SKIP_ERR:
1916 /* Make an ERROR chunk, preparing enough room for 1911 /* Make an ERROR chunk, preparing enough room for
1917 * returning multiple unknown parameters. 1912 * returning multiple unknown parameters.
@@ -1932,9 +1927,8 @@ static int sctp_process_unk_param(const struct sctp_association *asoc,
1932 * to the peer and the association won't be 1927 * to the peer and the association won't be
1933 * established. 1928 * established.
1934 */ 1929 */
1935 retval = 0; 1930 retval = SCTP_IERROR_NOMEM;
1936 } 1931 }
1937
1938 break; 1932 break;
1939 default: 1933 default:
1940 break; 1934 break;
@@ -1943,18 +1937,20 @@ static int sctp_process_unk_param(const struct sctp_association *asoc,
1943 return retval; 1937 return retval;
1944} 1938}
1945 1939
1946/* Find unrecognized parameters in the chunk. 1940/* Verify variable length parameters
1947 * Return values: 1941 * Return values:
1948 * 0 - discard the chunk 1942 * SCTP_IERROR_ABORT - trigger an ABORT
1949 * 1 - continue with the chunk 1943 * SCTP_IERROR_NOMEM - out of memory (abort)
1944 * SCTP_IERROR_ERROR - stop processing, trigger an ERROR
1945 * SCTP_IERROR_NO_ERROR - continue with the chunk
1950 */ 1946 */
1951static int sctp_verify_param(const struct sctp_association *asoc, 1947static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
1952 union sctp_params param, 1948 union sctp_params param,
1953 sctp_cid_t cid, 1949 sctp_cid_t cid,
1954 struct sctp_chunk *chunk, 1950 struct sctp_chunk *chunk,
1955 struct sctp_chunk **err_chunk) 1951 struct sctp_chunk **err_chunk)
1956{ 1952{
1957 int retval = 1; 1953 int retval = SCTP_IERROR_NO_ERROR;
1958 1954
1959 /* FIXME - This routine is not looking at each parameter per the 1955 /* FIXME - This routine is not looking at each parameter per the
1960 * chunk type, i.e., unrecognized parameters should be further 1956 * chunk type, i.e., unrecognized parameters should be further
@@ -1976,7 +1972,9 @@ static int sctp_verify_param(const struct sctp_association *asoc,
1976 1972
1977 case SCTP_PARAM_HOST_NAME_ADDRESS: 1973 case SCTP_PARAM_HOST_NAME_ADDRESS:
1978 /* Tell the peer, we won't support this param. */ 1974 /* Tell the peer, we won't support this param. */
1979 return sctp_process_hn_param(asoc, param, chunk, err_chunk); 1975 sctp_process_hn_param(asoc, param, chunk, err_chunk);
1976 retval = SCTP_IERROR_ABORT;
1977 break;
1980 1978
1981 case SCTP_PARAM_FWD_TSN_SUPPORT: 1979 case SCTP_PARAM_FWD_TSN_SUPPORT:
1982 if (sctp_prsctp_enable) 1980 if (sctp_prsctp_enable)
@@ -1993,9 +1991,11 @@ static int sctp_verify_param(const struct sctp_association *asoc,
1993 * cause 'Protocol Violation'. 1991 * cause 'Protocol Violation'.
1994 */ 1992 */
1995 if (SCTP_AUTH_RANDOM_LENGTH != 1993 if (SCTP_AUTH_RANDOM_LENGTH !=
1996 ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) 1994 ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) {
1997 return sctp_process_inv_paramlength(asoc, param.p, 1995 sctp_process_inv_paramlength(asoc, param.p,
1998 chunk, err_chunk); 1996 chunk, err_chunk);
1997 retval = SCTP_IERROR_ABORT;
1998 }
1999 break; 1999 break;
2000 2000
2001 case SCTP_PARAM_CHUNKS: 2001 case SCTP_PARAM_CHUNKS:
@@ -2007,9 +2007,11 @@ static int sctp_verify_param(const struct sctp_association *asoc,
2007 * INIT-ACK chunk if the sender wants to receive authenticated 2007 * INIT-ACK chunk if the sender wants to receive authenticated
2008 * chunks. Its maximum length is 260 bytes. 2008 * chunks. Its maximum length is 260 bytes.
2009 */ 2009 */
2010 if (260 < ntohs(param.p->length)) 2010 if (260 < ntohs(param.p->length)) {
2011 return sctp_process_inv_paramlength(asoc, param.p, 2011 sctp_process_inv_paramlength(asoc, param.p,
2012 chunk, err_chunk); 2012 chunk, err_chunk);
2013 retval = SCTP_IERROR_ABORT;
2014 }
2013 break; 2015 break;
2014 2016
2015 case SCTP_PARAM_HMAC_ALGO: 2017 case SCTP_PARAM_HMAC_ALGO:
@@ -2020,8 +2022,7 @@ fallthrough:
2020 default: 2022 default:
2021 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n", 2023 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n",
2022 ntohs(param.p->type), cid); 2024 ntohs(param.p->type), cid);
2023 return sctp_process_unk_param(asoc, param, chunk, err_chunk); 2025 retval = sctp_process_unk_param(asoc, param, chunk, err_chunk);
2024
2025 break; 2026 break;
2026 } 2027 }
2027 return retval; 2028 return retval;
@@ -2036,6 +2037,7 @@ int sctp_verify_init(const struct sctp_association *asoc,
2036{ 2037{
2037 union sctp_params param; 2038 union sctp_params param;
2038 int has_cookie = 0; 2039 int has_cookie = 0;
2040 int result;
2039 2041
2040 /* Verify stream values are non-zero. */ 2042 /* Verify stream values are non-zero. */
2041 if ((0 == peer_init->init_hdr.num_outbound_streams) || 2043 if ((0 == peer_init->init_hdr.num_outbound_streams) ||
@@ -2043,8 +2045,7 @@ int sctp_verify_init(const struct sctp_association *asoc,
2043 (0 == peer_init->init_hdr.init_tag) || 2045 (0 == peer_init->init_hdr.init_tag) ||
2044 (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) { 2046 (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) {
2045 2047
2046 sctp_process_inv_mandatory(asoc, chunk, errp); 2048 return sctp_process_inv_mandatory(asoc, chunk, errp);
2047 return 0;
2048 } 2049 }
2049 2050
2050 /* Check for missing mandatory parameters. */ 2051 /* Check for missing mandatory parameters. */
@@ -2062,29 +2063,29 @@ int sctp_verify_init(const struct sctp_association *asoc,
2062 * VIOLATION error. We build the ERROR chunk here and let the normal 2063 * VIOLATION error. We build the ERROR chunk here and let the normal
2063 * error handling code build and send the packet. 2064 * error handling code build and send the packet.
2064 */ 2065 */
2065 if (param.v != (void*)chunk->chunk_end) { 2066 if (param.v != (void*)chunk->chunk_end)
2066 sctp_process_inv_paramlength(asoc, param.p, chunk, errp); 2067 return sctp_process_inv_paramlength(asoc, param.p, chunk, errp);
2067 return 0;
2068 }
2069 2068
2070 /* The only missing mandatory param possible today is 2069 /* The only missing mandatory param possible today is
2071 * the state cookie for an INIT-ACK chunk. 2070 * the state cookie for an INIT-ACK chunk.
2072 */ 2071 */
2073 if ((SCTP_CID_INIT_ACK == cid) && !has_cookie) { 2072 if ((SCTP_CID_INIT_ACK == cid) && !has_cookie)
2074 sctp_process_missing_param(asoc, SCTP_PARAM_STATE_COOKIE, 2073 return sctp_process_missing_param(asoc, SCTP_PARAM_STATE_COOKIE,
2075 chunk, errp); 2074 chunk, errp);
2076 return 0;
2077 }
2078
2079 /* Find unrecognized parameters. */
2080 2075
2076 /* Verify all the variable length parameters */
2081 sctp_walk_params(param, peer_init, init_hdr.params) { 2077 sctp_walk_params(param, peer_init, init_hdr.params) {
2082 2078
2083 if (!sctp_verify_param(asoc, param, cid, chunk, errp)) { 2079 result = sctp_verify_param(asoc, param, cid, chunk, errp);
2084 if (SCTP_PARAM_HOST_NAME_ADDRESS == param.p->type) 2080 switch (result) {
2081 case SCTP_IERROR_ABORT:
2082 case SCTP_IERROR_NOMEM:
2085 return 0; 2083 return 0;
2086 else 2084 case SCTP_IERROR_ERROR:
2087 return 1; 2085 return 1;
2086 case SCTP_IERROR_NO_ERROR:
2087 default:
2088 break;
2088 } 2089 }
2089 2090
2090 } /* for (loop through all parameters) */ 2091 } /* for (loop through all parameters) */
@@ -2137,11 +2138,14 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid,
2137 2138
2138 /* If the peer claims support for ADD-IP without support 2139 /* If the peer claims support for ADD-IP without support
2139 * for AUTH, disable support for ADD-IP. 2140 * for AUTH, disable support for ADD-IP.
2141 * Do this only if backward compatible mode is turned off.
2140 */ 2142 */
2141 if (asoc->peer.addip_capable && !asoc->peer.auth_capable) { 2143 if (!sctp_addip_noauth &&
2144 (asoc->peer.asconf_capable && !asoc->peer.auth_capable)) {
2142 asoc->peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP | 2145 asoc->peer.addip_disabled_mask |= (SCTP_PARAM_ADD_IP |
2143 SCTP_PARAM_DEL_IP | 2146 SCTP_PARAM_DEL_IP |
2144 SCTP_PARAM_SET_PRIMARY); 2147 SCTP_PARAM_SET_PRIMARY);
2148 asoc->peer.asconf_capable = 0;
2145 } 2149 }
2146 2150
2147 /* Walk list of transports, removing transports in the UNKNOWN state. */ 2151 /* Walk list of transports, removing transports in the UNKNOWN state. */
@@ -2848,10 +2852,11 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
2848 2852
2849 __be16 err_code; 2853 __be16 err_code;
2850 int length = 0; 2854 int length = 0;
2851 int chunk_len = asconf->skb->len; 2855 int chunk_len;
2852 __u32 serial; 2856 __u32 serial;
2853 int all_param_pass = 1; 2857 int all_param_pass = 1;
2854 2858
2859 chunk_len = ntohs(asconf->chunk_hdr->length) - sizeof(sctp_chunkhdr_t);
2855 hdr = (sctp_addiphdr_t *)asconf->skb->data; 2860 hdr = (sctp_addiphdr_t *)asconf->skb->data;
2856 serial = ntohl(hdr->serial); 2861 serial = ntohl(hdr->serial);
2857 2862
@@ -2952,13 +2957,17 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
2952 /* This is always done in BH context with a socket lock 2957 /* This is always done in BH context with a socket lock
2953 * held, so the list can not change. 2958 * held, so the list can not change.
2954 */ 2959 */
2960 local_bh_disable();
2955 list_for_each_entry(saddr, &bp->address_list, list) { 2961 list_for_each_entry(saddr, &bp->address_list, list) {
2956 if (sctp_cmp_addr_exact(&saddr->a, &addr)) 2962 if (sctp_cmp_addr_exact(&saddr->a, &addr))
2957 saddr->use_as_src = 1; 2963 saddr->use_as_src = 1;
2958 } 2964 }
2965 local_bh_enable();
2959 break; 2966 break;
2960 case SCTP_PARAM_DEL_IP: 2967 case SCTP_PARAM_DEL_IP:
2961 retval = sctp_del_bind_addr(bp, &addr, call_rcu_bh); 2968 local_bh_disable();
2969 retval = sctp_del_bind_addr(bp, &addr);
2970 local_bh_enable();
2962 list_for_each(pos, &asoc->peer.transport_addr_list) { 2971 list_for_each(pos, &asoc->peer.transport_addr_list) {
2963 transport = list_entry(pos, struct sctp_transport, 2972 transport = list_entry(pos, struct sctp_transport,
2964 transports); 2973 transports);
@@ -2990,7 +2999,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
2990 sctp_addip_param_t *asconf_ack_param; 2999 sctp_addip_param_t *asconf_ack_param;
2991 sctp_errhdr_t *err_param; 3000 sctp_errhdr_t *err_param;
2992 int length; 3001 int length;
2993 int asconf_ack_len = asconf_ack->skb->len; 3002 int asconf_ack_len;
2994 __be16 err_code; 3003 __be16 err_code;
2995 3004
2996 if (no_err) 3005 if (no_err)
@@ -2998,6 +3007,9 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack,
2998 else 3007 else
2999 err_code = SCTP_ERROR_REQ_REFUSED; 3008 err_code = SCTP_ERROR_REQ_REFUSED;
3000 3009
3010 asconf_ack_len = ntohs(asconf_ack->chunk_hdr->length) -
3011 sizeof(sctp_chunkhdr_t);
3012
3001 /* Skip the addiphdr from the asconf_ack chunk and store a pointer to 3013 /* Skip the addiphdr from the asconf_ack chunk and store a pointer to
3002 * the first asconf_ack parameter. 3014 * the first asconf_ack parameter.
3003 */ 3015 */
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index bbdc938da86f..78d1a8a49bd0 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -453,6 +453,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
453 * maximum value discussed in rule C7 above (RTO.max) may be 453 * maximum value discussed in rule C7 above (RTO.max) may be
454 * used to provide an upper bound to this doubling operation. 454 * used to provide an upper bound to this doubling operation.
455 */ 455 */
456 transport->last_rto = transport->rto;
456 transport->rto = min((transport->rto * 2), transport->asoc->rto_max); 457 transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
457} 458}
458 459
@@ -1267,6 +1268,12 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1267 sctp_ootb_pkt_free(packet); 1268 sctp_ootb_pkt_free(packet);
1268 break; 1269 break;
1269 1270
1271 case SCTP_CMD_T1_RETRAN:
1272 /* Mark a transport for retransmission. */
1273 sctp_retransmit(&asoc->outqueue, cmd->obj.transport,
1274 SCTP_RTXR_T1_RTX);
1275 break;
1276
1270 case SCTP_CMD_RETRAN: 1277 case SCTP_CMD_RETRAN:
1271 /* Mark a transport for retransmission. */ 1278 /* Mark a transport for retransmission. */
1272 sctp_retransmit(&asoc->outqueue, cmd->obj.transport, 1279 sctp_retransmit(&asoc->outqueue, cmd->obj.transport,
@@ -1393,7 +1400,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1393 list_for_each(pos, &asoc->peer.transport_addr_list) { 1400 list_for_each(pos, &asoc->peer.transport_addr_list) {
1394 t = list_entry(pos, struct sctp_transport, 1401 t = list_entry(pos, struct sctp_transport,
1395 transports); 1402 transports);
1396 sctp_retransmit_mark(&asoc->outqueue, t, 0); 1403 sctp_retransmit_mark(&asoc->outqueue, t,
1404 SCTP_RTXR_T1_RTX);
1397 } 1405 }
1398 1406
1399 sctp_add_cmd_sf(commands, 1407 sctp_add_cmd_sf(commands,
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index f01b408508ff..b8bbb960723c 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1146,7 +1146,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
1146 /* Check if the timestamp looks valid. */ 1146 /* Check if the timestamp looks valid. */
1147 if (time_after(hbinfo->sent_at, jiffies) || 1147 if (time_after(hbinfo->sent_at, jiffies) ||
1148 time_after(jiffies, hbinfo->sent_at + max_interval)) { 1148 time_after(jiffies, hbinfo->sent_at + max_interval)) {
1149 SCTP_DEBUG_PRINTK("%s: HEARTBEAT ACK with invalid timestamp" 1149 SCTP_DEBUG_PRINTK("%s: HEARTBEAT ACK with invalid timestamp "
1150 "received for transport: %p\n", 1150 "received for transport: %p\n",
1151 __FUNCTION__, link); 1151 __FUNCTION__, link);
1152 return SCTP_DISPOSITION_DISCARD; 1152 return SCTP_DISPOSITION_DISCARD;
@@ -2305,7 +2305,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep,
2305 /* If we've sent any data bundled with COOKIE-ECHO we will need to 2305 /* If we've sent any data bundled with COOKIE-ECHO we will need to
2306 * resend 2306 * resend
2307 */ 2307 */
2308 sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, 2308 sctp_add_cmd_sf(commands, SCTP_CMD_T1_RETRAN,
2309 SCTP_TRANSPORT(asoc->peer.primary_path)); 2309 SCTP_TRANSPORT(asoc->peer.primary_path));
2310 2310
2311 /* Cast away the const modifier, as we want to just 2311 /* Cast away the const modifier, as we want to just
@@ -4064,11 +4064,6 @@ static sctp_disposition_t sctp_sf_abort_violation(
4064 struct sctp_chunk *chunk = arg; 4064 struct sctp_chunk *chunk = arg;
4065 struct sctp_chunk *abort = NULL; 4065 struct sctp_chunk *abort = NULL;
4066 4066
4067 /* Make the abort chunk. */
4068 abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
4069 if (!abort)
4070 goto nomem;
4071
4072 /* SCTP-AUTH, Section 6.3: 4067 /* SCTP-AUTH, Section 6.3:
4073 * It should be noted that if the receiver wants to tear 4068 * It should be noted that if the receiver wants to tear
4074 * down an association in an authenticated way only, the 4069 * down an association in an authenticated way only, the
@@ -4083,6 +4078,11 @@ static sctp_disposition_t sctp_sf_abort_violation(
4083 if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) 4078 if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc))
4084 goto discard; 4079 goto discard;
4085 4080
4081 /* Make the abort chunk. */
4082 abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
4083 if (!abort)
4084 goto nomem;
4085
4086 if (asoc) { 4086 if (asoc) {
4087 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 4087 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
4088 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); 4088 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index bd6f42a15a4b..ff8bc95670ed 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -660,7 +660,7 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
660 * socket routing and failover schemes. Refer to comments in 660 * socket routing and failover schemes. Refer to comments in
661 * sctp_do_bind(). -daisy 661 * sctp_do_bind(). -daisy
662 */ 662 */
663 retval = sctp_del_bind_addr(bp, sa_addr, call_rcu); 663 retval = sctp_del_bind_addr(bp, sa_addr);
664 664
665 addr_buf += af->sockaddr_len; 665 addr_buf += af->sockaddr_len;
666err_bindx_rem: 666err_bindx_rem:
@@ -5307,6 +5307,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
5307{ 5307{
5308 struct sctp_bind_hashbucket *head; /* hash list */ 5308 struct sctp_bind_hashbucket *head; /* hash list */
5309 struct sctp_bind_bucket *pp; /* hash list port iterator */ 5309 struct sctp_bind_bucket *pp; /* hash list port iterator */
5310 struct hlist_node *node;
5310 unsigned short snum; 5311 unsigned short snum;
5311 int ret; 5312 int ret;
5312 5313
@@ -5331,7 +5332,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
5331 index = sctp_phashfn(rover); 5332 index = sctp_phashfn(rover);
5332 head = &sctp_port_hashtable[index]; 5333 head = &sctp_port_hashtable[index];
5333 sctp_spin_lock(&head->lock); 5334 sctp_spin_lock(&head->lock);
5334 for (pp = head->chain; pp; pp = pp->next) 5335 sctp_for_each_hentry(pp, node, &head->chain)
5335 if (pp->port == rover) 5336 if (pp->port == rover)
5336 goto next; 5337 goto next;
5337 break; 5338 break;
@@ -5358,7 +5359,7 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
5358 */ 5359 */
5359 head = &sctp_port_hashtable[sctp_phashfn(snum)]; 5360 head = &sctp_port_hashtable[sctp_phashfn(snum)];
5360 sctp_spin_lock(&head->lock); 5361 sctp_spin_lock(&head->lock);
5361 for (pp = head->chain; pp; pp = pp->next) { 5362 sctp_for_each_hentry(pp, node, &head->chain) {
5362 if (pp->port == snum) 5363 if (pp->port == snum)
5363 goto pp_found; 5364 goto pp_found;
5364 } 5365 }
@@ -5702,10 +5703,7 @@ static struct sctp_bind_bucket *sctp_bucket_create(
5702 pp->port = snum; 5703 pp->port = snum;
5703 pp->fastreuse = 0; 5704 pp->fastreuse = 0;
5704 INIT_HLIST_HEAD(&pp->owner); 5705 INIT_HLIST_HEAD(&pp->owner);
5705 if ((pp->next = head->chain) != NULL) 5706 hlist_add_head(&pp->node, &head->chain);
5706 pp->next->pprev = &pp->next;
5707 head->chain = pp;
5708 pp->pprev = &head->chain;
5709 } 5707 }
5710 return pp; 5708 return pp;
5711} 5709}
@@ -5714,9 +5712,7 @@ static struct sctp_bind_bucket *sctp_bucket_create(
5714static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) 5712static void sctp_bucket_destroy(struct sctp_bind_bucket *pp)
5715{ 5713{
5716 if (pp && hlist_empty(&pp->owner)) { 5714 if (pp && hlist_empty(&pp->owner)) {
5717 if (pp->next) 5715 __hlist_del(&pp->node);
5718 pp->next->pprev = pp->pprev;
5719 *(pp->pprev) = pp->next;
5720 kmem_cache_free(sctp_bucket_cachep, pp); 5716 kmem_cache_free(sctp_bucket_cachep, pp);
5721 SCTP_DBG_OBJCNT_DEC(bind_bucket); 5717 SCTP_DBG_OBJCNT_DEC(bind_bucket);
5722 } 5718 }
@@ -6455,6 +6451,8 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
6455} 6451}
6456 6452
6457 6453
6454DEFINE_PROTO_INUSE(sctp)
6455
6458/* This proto struct describes the ULP interface for SCTP. */ 6456/* This proto struct describes the ULP interface for SCTP. */
6459struct proto sctp_prot = { 6457struct proto sctp_prot = {
6460 .name = "SCTP", 6458 .name = "SCTP",
@@ -6483,9 +6481,12 @@ struct proto sctp_prot = {
6483 .memory_pressure = &sctp_memory_pressure, 6481 .memory_pressure = &sctp_memory_pressure,
6484 .enter_memory_pressure = sctp_enter_memory_pressure, 6482 .enter_memory_pressure = sctp_enter_memory_pressure,
6485 .memory_allocated = &sctp_memory_allocated, 6483 .memory_allocated = &sctp_memory_allocated,
6484 REF_PROTO_INUSE(sctp)
6486}; 6485};
6487 6486
6488#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 6487#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
6488DEFINE_PROTO_INUSE(sctpv6)
6489
6489struct proto sctpv6_prot = { 6490struct proto sctpv6_prot = {
6490 .name = "SCTPv6", 6491 .name = "SCTPv6",
6491 .owner = THIS_MODULE, 6492 .owner = THIS_MODULE,
@@ -6513,5 +6514,6 @@ struct proto sctpv6_prot = {
6513 .memory_pressure = &sctp_memory_pressure, 6514 .memory_pressure = &sctp_memory_pressure,
6514 .enter_memory_pressure = sctp_enter_memory_pressure, 6515 .enter_memory_pressure = sctp_enter_memory_pressure,
6515 .memory_allocated = &sctp_memory_allocated, 6516 .memory_allocated = &sctp_memory_allocated,
6517 REF_PROTO_INUSE(sctpv6)
6516}; 6518};
6517#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 6519#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 0669778e4335..da4f15734fb1 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -263,6 +263,15 @@ static ctl_table sctp_table[] = {
263 .proc_handler = &proc_dointvec, 263 .proc_handler = &proc_dointvec,
264 .strategy = &sysctl_intvec 264 .strategy = &sysctl_intvec
265 }, 265 },
266 {
267 .ctl_name = CTL_UNNUMBERED,
268 .procname = "addip_noauth_enable",
269 .data = &sctp_addip_noauth,
270 .maxlen = sizeof(int),
271 .mode = 0644,
272 .proc_handler = &proc_dointvec,
273 .strategy = &sysctl_intvec
274 },
266 { .ctl_name = 0 } 275 { .ctl_name = 0 }
267}; 276};
268 277
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 5f467c914f80..d55ce83a020b 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -74,8 +74,8 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
74 * given destination transport address, set RTO to the protocol 74 * given destination transport address, set RTO to the protocol
75 * parameter 'RTO.Initial'. 75 * parameter 'RTO.Initial'.
76 */ 76 */
77 peer->last_rto = peer->rto = msecs_to_jiffies(sctp_rto_initial);
77 peer->rtt = 0; 78 peer->rtt = 0;
78 peer->rto = msecs_to_jiffies(sctp_rto_initial);
79 peer->rttvar = 0; 79 peer->rttvar = 0;
80 peer->srtt = 0; 80 peer->srtt = 0;
81 peer->rto_pending = 0; 81 peer->rto_pending = 0;
@@ -385,6 +385,7 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
385 tp->rto = tp->asoc->rto_max; 385 tp->rto = tp->asoc->rto_max;
386 386
387 tp->rtt = rtt; 387 tp->rtt = rtt;
388 tp->last_rto = tp->rto;
388 389
389 /* Reset rto_pending so that a new RTT measurement is started when a 390 /* Reset rto_pending so that a new RTT measurement is started when a
390 * new data chunk is sent. 391 * new data chunk is sent.
@@ -578,7 +579,7 @@ void sctp_transport_reset(struct sctp_transport *t)
578 */ 579 */
579 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380)); 580 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
580 t->ssthresh = asoc->peer.i.a_rwnd; 581 t->ssthresh = asoc->peer.i.a_rwnd;
581 t->rto = asoc->rto_initial; 582 t->last_rto = t->rto = asoc->rto_initial;
582 t->rtt = 0; 583 t->rtt = 0;
583 t->srtt = 0; 584 t->srtt = 0;
584 t->rttvar = 0; 585 t->rttvar = 0;
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 4be92d0a2cab..4908041ffb31 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -862,7 +862,7 @@ static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq, __u16 sid)
862 continue; 862 continue;
863 863
864 /* see if this ssn has been marked by skipping */ 864 /* see if this ssn has been marked by skipping */
865 if (!SSN_lt(cssn, sctp_ssn_peek(in, csid))) 865 if (!SSN_lte(cssn, sctp_ssn_peek(in, csid)))
866 break; 866 break;
867 867
868 __skb_unlink(pos, &ulpq->lobby); 868 __skb_unlink(pos, &ulpq->lobby);
diff --git a/net/socket.c b/net/socket.c
index 540013ea8620..74784dfe8e5b 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;
@@ -2316,6 +2319,11 @@ int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg)
2316 return err; 2319 return err;
2317} 2320}
2318 2321
2322int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how)
2323{
2324 return sock->ops->shutdown(sock, how);
2325}
2326
2319/* ABI emulation layers need these two */ 2327/* ABI emulation layers need these two */
2320EXPORT_SYMBOL(move_addr_to_kernel); 2328EXPORT_SYMBOL(move_addr_to_kernel);
2321EXPORT_SYMBOL(move_addr_to_user); 2329EXPORT_SYMBOL(move_addr_to_user);
@@ -2342,3 +2350,4 @@ EXPORT_SYMBOL(kernel_getsockopt);
2342EXPORT_SYMBOL(kernel_setsockopt); 2350EXPORT_SYMBOL(kernel_setsockopt);
2343EXPORT_SYMBOL(kernel_sendpage); 2351EXPORT_SYMBOL(kernel_sendpage);
2344EXPORT_SYMBOL(kernel_sock_ioctl); 2352EXPORT_SYMBOL(kernel_sock_ioctl);
2353EXPORT_SYMBOL(kernel_sock_shutdown);
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 53995af9ca4b..a6e57d1c2eb6 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -540,7 +540,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
540 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); 540 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech);
541 if (IS_ERR(p)) { 541 if (IS_ERR(p)) {
542 err = PTR_ERR(p); 542 err = PTR_ERR(p);
543 gss_msg->msg.errno = (err == -EACCES) ? -EACCES : -EAGAIN; 543 gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES;
544 goto err_release_msg; 544 goto err_release_msg;
545 } 545 }
546 gss_msg->ctx = gss_get_ctx(ctx); 546 gss_msg->ctx = gss_get_ctx(ctx);
@@ -967,7 +967,7 @@ gss_validate(struct rpc_task *task, __be32 *p)
967 if (maj_stat == GSS_S_CONTEXT_EXPIRED) 967 if (maj_stat == GSS_S_CONTEXT_EXPIRED)
968 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); 968 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
969 if (maj_stat) { 969 if (maj_stat) {
970 dprintk("RPC: %5u gss_validate: gss_verify_mic returned" 970 dprintk("RPC: %5u gss_validate: gss_verify_mic returned "
971 "error 0x%08x\n", task->tk_pid, maj_stat); 971 "error 0x%08x\n", task->tk_pid, maj_stat);
972 goto out_bad; 972 goto out_bad;
973 } 973 }
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index 91cd8f0d1e10..0dd792338fa9 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -211,8 +211,8 @@ encryptor(struct scatterlist *sg, void *data)
211 if (thislen == 0) 211 if (thislen == 0)
212 return 0; 212 return 0;
213 213
214 sg_mark_end(desc->infrags, desc->fragno); 214 sg_mark_end(&desc->infrags[desc->fragno - 1]);
215 sg_mark_end(desc->outfrags, desc->fragno); 215 sg_mark_end(&desc->outfrags[desc->fragno - 1]);
216 216
217 ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags, 217 ret = crypto_blkcipher_encrypt_iv(&desc->desc, desc->outfrags,
218 desc->infrags, thislen); 218 desc->infrags, thislen);
@@ -293,7 +293,7 @@ decryptor(struct scatterlist *sg, void *data)
293 if (thislen == 0) 293 if (thislen == 0)
294 return 0; 294 return 0;
295 295
296 sg_mark_end(desc->frags, desc->fragno); 296 sg_mark_end(&desc->frags[desc->fragno - 1]);
297 297
298 ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags, 298 ret = crypto_blkcipher_decrypt_iv(&desc->desc, desc->frags,
299 desc->frags, thislen); 299 desc->frags, thislen);
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
index 9843eacef11d..60c3dba545d7 100644
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
@@ -147,13 +147,17 @@ gss_import_sec_context_kerberos(const void *p,
147 p = simple_get_bytes(p, end, &tmp, sizeof(tmp)); 147 p = simple_get_bytes(p, end, &tmp, sizeof(tmp));
148 if (IS_ERR(p)) 148 if (IS_ERR(p))
149 goto out_err_free_ctx; 149 goto out_err_free_ctx;
150 if (tmp != SGN_ALG_DES_MAC_MD5) 150 if (tmp != SGN_ALG_DES_MAC_MD5) {
151 p = ERR_PTR(-ENOSYS);
151 goto out_err_free_ctx; 152 goto out_err_free_ctx;
153 }
152 p = simple_get_bytes(p, end, &tmp, sizeof(tmp)); 154 p = simple_get_bytes(p, end, &tmp, sizeof(tmp));
153 if (IS_ERR(p)) 155 if (IS_ERR(p))
154 goto out_err_free_ctx; 156 goto out_err_free_ctx;
155 if (tmp != SEAL_ALG_DES) 157 if (tmp != SEAL_ALG_DES) {
158 p = ERR_PTR(-ENOSYS);
156 goto out_err_free_ctx; 159 goto out_err_free_ctx;
160 }
157 p = simple_get_bytes(p, end, &ctx->endtime, sizeof(ctx->endtime)); 161 p = simple_get_bytes(p, end, &ctx->endtime, sizeof(ctx->endtime));
158 if (IS_ERR(p)) 162 if (IS_ERR(p))
159 goto out_err_free_ctx; 163 goto out_err_free_ctx;
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
index a0d9faa59cb5..dedcbd6108f4 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seal.c
@@ -63,7 +63,6 @@
63#include <linux/jiffies.h> 63#include <linux/jiffies.h>
64#include <linux/sunrpc/gss_krb5.h> 64#include <linux/sunrpc/gss_krb5.h>
65#include <linux/random.h> 65#include <linux/random.h>
66#include <asm/scatterlist.h>
67#include <linux/crypto.h> 66#include <linux/crypto.h>
68 67
69#ifdef RPC_DEBUG 68#ifdef RPC_DEBUG
@@ -84,6 +83,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
84 u32 seq_send; 83 u32 seq_send;
85 84
86 dprintk("RPC: gss_krb5_seal\n"); 85 dprintk("RPC: gss_krb5_seal\n");
86 BUG_ON(ctx == NULL);
87 87
88 now = get_seconds(); 88 now = get_seconds();
89 89
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 8bd074df27d3..3bdc527ee64a 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -4,7 +4,6 @@
4#include <linux/sunrpc/gss_krb5.h> 4#include <linux/sunrpc/gss_krb5.h>
5#include <linux/random.h> 5#include <linux/random.h>
6#include <linux/pagemap.h> 6#include <linux/pagemap.h>
7#include <asm/scatterlist.h>
8#include <linux/crypto.h> 7#include <linux/crypto.h>
9 8
10#ifdef RPC_DEBUG 9#ifdef RPC_DEBUG
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 18f0a8dcc095..c59f3ca2b41b 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -280,7 +280,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
280 mask = POLLOUT | POLLWRNORM; 280 mask = POLLOUT | POLLWRNORM;
281 if (rpci->ops == NULL) 281 if (rpci->ops == NULL)
282 mask |= POLLERR | POLLHUP; 282 mask |= POLLERR | POLLHUP;
283 if (!list_empty(&rpci->pipe)) 283 if (filp->private_data || !list_empty(&rpci->pipe))
284 mask |= POLLIN | POLLRDNORM; 284 mask |= POLLIN | POLLRDNORM;
285 return mask; 285 return mask;
286} 286}
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/xprt.c b/net/sunrpc/xprt.c
index 282a9a2ec90c..cd641c8634f0 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -62,7 +62,7 @@ static inline void do_xprt_reserve(struct rpc_task *);
62static void xprt_connect_status(struct rpc_task *task); 62static void xprt_connect_status(struct rpc_task *task);
63static int __xprt_get_cong(struct rpc_xprt *, struct rpc_task *); 63static int __xprt_get_cong(struct rpc_xprt *, struct rpc_task *);
64 64
65static spinlock_t xprt_list_lock = SPIN_LOCK_UNLOCKED; 65static DEFINE_SPINLOCK(xprt_list_lock);
66static LIST_HEAD(xprt_list); 66static LIST_HEAD(xprt_list);
67 67
68/* 68/*
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/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index dc55cc974c90..6f2112dd9f78 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -89,7 +89,7 @@ static struct ctl_table_header *sunrpc_table_header;
89 89
90static ctl_table xr_tunables_table[] = { 90static ctl_table xr_tunables_table[] = {
91 { 91 {
92 .ctl_name = CTL_SLOTTABLE_RDMA, 92 .ctl_name = CTL_UNNUMBERED,
93 .procname = "rdma_slot_table_entries", 93 .procname = "rdma_slot_table_entries",
94 .data = &xprt_rdma_slot_table_entries, 94 .data = &xprt_rdma_slot_table_entries,
95 .maxlen = sizeof(unsigned int), 95 .maxlen = sizeof(unsigned int),
@@ -100,7 +100,7 @@ static ctl_table xr_tunables_table[] = {
100 .extra2 = &max_slot_table_size 100 .extra2 = &max_slot_table_size
101 }, 101 },
102 { 102 {
103 .ctl_name = CTL_RDMA_MAXINLINEREAD, 103 .ctl_name = CTL_UNNUMBERED,
104 .procname = "rdma_max_inline_read", 104 .procname = "rdma_max_inline_read",
105 .data = &xprt_rdma_max_inline_read, 105 .data = &xprt_rdma_max_inline_read,
106 .maxlen = sizeof(unsigned int), 106 .maxlen = sizeof(unsigned int),
@@ -109,7 +109,7 @@ static ctl_table xr_tunables_table[] = {
109 .strategy = &sysctl_intvec, 109 .strategy = &sysctl_intvec,
110 }, 110 },
111 { 111 {
112 .ctl_name = CTL_RDMA_MAXINLINEWRITE, 112 .ctl_name = CTL_UNNUMBERED,
113 .procname = "rdma_max_inline_write", 113 .procname = "rdma_max_inline_write",
114 .data = &xprt_rdma_max_inline_write, 114 .data = &xprt_rdma_max_inline_write,
115 .maxlen = sizeof(unsigned int), 115 .maxlen = sizeof(unsigned int),
@@ -118,7 +118,7 @@ static ctl_table xr_tunables_table[] = {
118 .strategy = &sysctl_intvec, 118 .strategy = &sysctl_intvec,
119 }, 119 },
120 { 120 {
121 .ctl_name = CTL_RDMA_WRITEPADDING, 121 .ctl_name = CTL_UNNUMBERED,
122 .procname = "rdma_inline_write_padding", 122 .procname = "rdma_inline_write_padding",
123 .data = &xprt_rdma_inline_write_padding, 123 .data = &xprt_rdma_inline_write_padding,
124 .maxlen = sizeof(unsigned int), 124 .maxlen = sizeof(unsigned int),
@@ -129,7 +129,7 @@ static ctl_table xr_tunables_table[] = {
129 .extra2 = &max_padding, 129 .extra2 = &max_padding,
130 }, 130 },
131 { 131 {
132 .ctl_name = CTL_RDMA_MEMREG, 132 .ctl_name = CTL_UNNUMBERED,
133 .procname = "rdma_memreg_strategy", 133 .procname = "rdma_memreg_strategy",
134 .data = &xprt_rdma_memreg_strategy, 134 .data = &xprt_rdma_memreg_strategy,
135 .maxlen = sizeof(unsigned int), 135 .maxlen = sizeof(unsigned int),
@@ -320,9 +320,9 @@ xprt_setup_rdma(struct xprt_create *args)
320 xprt->slot = kcalloc(xprt->max_reqs, 320 xprt->slot = kcalloc(xprt->max_reqs,
321 sizeof(struct rpc_rqst), GFP_KERNEL); 321 sizeof(struct rpc_rqst), GFP_KERNEL);
322 if (xprt->slot == NULL) { 322 if (xprt->slot == NULL) {
323 kfree(xprt);
324 dprintk("RPC: %s: couldn't allocate %d slots\n", 323 dprintk("RPC: %s: couldn't allocate %d slots\n",
325 __func__, xprt->max_reqs); 324 __func__, xprt->max_reqs);
325 kfree(xprt);
326 return ERR_PTR(-ENOMEM); 326 return ERR_PTR(-ENOMEM);
327 } 327 }
328 328
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 02298f529dad..2f630a512ab7 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1828,7 +1828,7 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args,
1828 * @args: rpc transport creation arguments 1828 * @args: rpc transport creation arguments
1829 * 1829 *
1830 */ 1830 */
1831struct rpc_xprt *xs_setup_udp(struct xprt_create *args) 1831static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1832{ 1832{
1833 struct sockaddr *addr = args->dstaddr; 1833 struct sockaddr *addr = args->dstaddr;
1834 struct rpc_xprt *xprt; 1834 struct rpc_xprt *xprt;
@@ -1894,7 +1894,7 @@ struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1894 * @args: rpc transport creation arguments 1894 * @args: rpc transport creation arguments
1895 * 1895 *
1896 */ 1896 */
1897struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) 1897static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
1898{ 1898{
1899 struct sockaddr *addr = args->dstaddr; 1899 struct sockaddr *addr = args->dstaddr;
1900 struct rpc_xprt *xprt; 1900 struct rpc_xprt *xprt;
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..e835da8fc091 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -457,7 +457,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
457 * What the above comment does talk about? --ANK(980817) 457 * What the above comment does talk about? --ANK(980817)
458 */ 458 */
459 459
460 if (atomic_read(&unix_tot_inflight)) 460 if (unix_tot_inflight)
461 unix_gc(); /* Garbage collect fds */ 461 unix_gc(); /* Garbage collect fds */
462 462
463 return 0; 463 return 0;
@@ -599,15 +599,14 @@ static struct sock * unix_create1(struct net *net, struct socket *sock)
599 struct sock *sk = NULL; 599 struct sock *sk = NULL;
600 struct unix_sock *u; 600 struct unix_sock *u;
601 601
602 if (atomic_read(&unix_nr_socks) >= 2*get_max_files()) 602 atomic_inc(&unix_nr_socks);
603 if (atomic_read(&unix_nr_socks) > 2 * get_max_files())
603 goto out; 604 goto out;
604 605
605 sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto, 1); 606 sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto);
606 if (!sk) 607 if (!sk)
607 goto out; 608 goto out;
608 609
609 atomic_inc(&unix_nr_socks);
610
611 sock_init_data(sock,sk); 610 sock_init_data(sock,sk);
612 lockdep_set_class(&sk->sk_receive_queue.lock, 611 lockdep_set_class(&sk->sk_receive_queue.lock,
613 &af_unix_sk_receive_queue_lock_key); 612 &af_unix_sk_receive_queue_lock_key);
@@ -625,6 +624,8 @@ static struct sock * unix_create1(struct net *net, struct socket *sock)
625 init_waitqueue_head(&u->peer_wait); 624 init_waitqueue_head(&u->peer_wait);
626 unix_insert_socket(unix_sockets_unbound, sk); 625 unix_insert_socket(unix_sockets_unbound, sk);
627out: 626out:
627 if (sk == NULL)
628 atomic_dec(&unix_nr_socks);
628 return sk; 629 return sk;
629} 630}
630 631
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 406b6433e467..ebdff3d877a1 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -92,7 +92,7 @@ static LIST_HEAD(gc_inflight_list);
92static LIST_HEAD(gc_candidates); 92static LIST_HEAD(gc_candidates);
93static DEFINE_SPINLOCK(unix_gc_lock); 93static DEFINE_SPINLOCK(unix_gc_lock);
94 94
95atomic_t unix_tot_inflight = ATOMIC_INIT(0); 95unsigned int unix_tot_inflight;
96 96
97 97
98static struct sock *unix_get_socket(struct file *filp) 98static struct sock *unix_get_socket(struct file *filp)
@@ -133,7 +133,7 @@ void unix_inflight(struct file *fp)
133 } else { 133 } else {
134 BUG_ON(list_empty(&u->link)); 134 BUG_ON(list_empty(&u->link));
135 } 135 }
136 atomic_inc(&unix_tot_inflight); 136 unix_tot_inflight++;
137 spin_unlock(&unix_gc_lock); 137 spin_unlock(&unix_gc_lock);
138 } 138 }
139} 139}
@@ -147,7 +147,7 @@ void unix_notinflight(struct file *fp)
147 BUG_ON(list_empty(&u->link)); 147 BUG_ON(list_empty(&u->link));
148 if (atomic_dec_and_test(&u->inflight)) 148 if (atomic_dec_and_test(&u->inflight))
149 list_del_init(&u->link); 149 list_del_init(&u->link);
150 atomic_dec(&unix_tot_inflight); 150 unix_tot_inflight--;
151 spin_unlock(&unix_gc_lock); 151 spin_unlock(&unix_gc_lock);
152 } 152 }
153} 153}
@@ -161,7 +161,7 @@ static inline struct sk_buff *sock_queue_head(struct sock *sk)
161 for (skb = sock_queue_head(sk)->next, next = skb->next; \ 161 for (skb = sock_queue_head(sk)->next, next = skb->next; \
162 skb != sock_queue_head(sk); skb = next, next = skb->next) 162 skb != sock_queue_head(sk); skb = next, next = skb->next)
163 163
164static void scan_inflight(struct sock *x, void (*func)(struct sock *), 164static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *),
165 struct sk_buff_head *hitlist) 165 struct sk_buff_head *hitlist)
166{ 166{
167 struct sk_buff *skb; 167 struct sk_buff *skb;
@@ -185,9 +185,9 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *),
185 * if it indeed does so 185 * if it indeed does so
186 */ 186 */
187 struct sock *sk = unix_get_socket(*fp++); 187 struct sock *sk = unix_get_socket(*fp++);
188 if(sk) { 188 if (sk) {
189 hit = true; 189 hit = true;
190 func(sk); 190 func(unix_sk(sk));
191 } 191 }
192 } 192 }
193 if (hit && hitlist != NULL) { 193 if (hit && hitlist != NULL) {
@@ -199,7 +199,7 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *),
199 spin_unlock(&x->sk_receive_queue.lock); 199 spin_unlock(&x->sk_receive_queue.lock);
200} 200}
201 201
202static void scan_children(struct sock *x, void (*func)(struct sock *), 202static void scan_children(struct sock *x, void (*func)(struct unix_sock *),
203 struct sk_buff_head *hitlist) 203 struct sk_buff_head *hitlist)
204{ 204{
205 if (x->sk_state != TCP_LISTEN) 205 if (x->sk_state != TCP_LISTEN)
@@ -235,20 +235,18 @@ static void scan_children(struct sock *x, void (*func)(struct sock *),
235 } 235 }
236} 236}
237 237
238static void dec_inflight(struct sock *sk) 238static void dec_inflight(struct unix_sock *usk)
239{ 239{
240 atomic_dec(&unix_sk(sk)->inflight); 240 atomic_dec(&usk->inflight);
241} 241}
242 242
243static void inc_inflight(struct sock *sk) 243static void inc_inflight(struct unix_sock *usk)
244{ 244{
245 atomic_inc(&unix_sk(sk)->inflight); 245 atomic_inc(&usk->inflight);
246} 246}
247 247
248static void inc_inflight_move_tail(struct sock *sk) 248static void inc_inflight_move_tail(struct unix_sock *u)
249{ 249{
250 struct unix_sock *u = unix_sk(sk);
251
252 atomic_inc(&u->inflight); 250 atomic_inc(&u->inflight);
253 /* 251 /*
254 * If this is still a candidate, move it to the end of the 252 * If this is still a candidate, move it to the end of the
diff --git a/net/wireless/wext.c b/net/wireless/wext.c
index 85e5f9dd0d8e..47e80cc2077c 100644
--- a/net/wireless/wext.c
+++ b/net/wireless/wext.c
@@ -1094,7 +1094,7 @@ int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
1094 rtnl_lock(); 1094 rtnl_lock();
1095 ret = wireless_process_ioctl(net, ifr, cmd); 1095 ret = wireless_process_ioctl(net, ifr, cmd);
1096 rtnl_unlock(); 1096 rtnl_unlock();
1097 if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct ifreq))) 1097 if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq)))
1098 return -EFAULT; 1098 return -EFAULT;
1099 return ret; 1099 return ret;
1100} 1100}
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 0426388d351d..1686f64c4352 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -21,7 +21,6 @@
21#if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE) 21#if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
22#include <net/esp.h> 22#include <net/esp.h>
23#endif 23#endif
24#include <asm/scatterlist.h>
25 24
26/* 25/*
27 * Algorithms supported by IPsec. These entries contain properties which 26 * Algorithms supported by IPsec. These entries contain properties which
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 224b44e31a07..cf43c49eab37 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -552,7 +552,7 @@ int __xfrm_state_delete(struct xfrm_state *x)
552 * The xfrm_state_alloc call gives a reference, and that 552 * The xfrm_state_alloc call gives a reference, and that
553 * is what we are dropping here. 553 * is what we are dropping here.
554 */ 554 */
555 __xfrm_state_put(x); 555 xfrm_state_put(x);
556 err = 0; 556 err = 0;
557 } 557 }
558 558
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d41588d101d0..e75dbdcb08a4 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -507,7 +507,6 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
507 struct xfrm_usersa_info *p, 507 struct xfrm_usersa_info *p,
508 struct sk_buff *skb) 508 struct sk_buff *skb)
509{ 509{
510 spin_lock_bh(&x->lock);
511 copy_to_user_state(x, p); 510 copy_to_user_state(x, p);
512 511
513 if (x->coaddr) 512 if (x->coaddr)
@@ -515,7 +514,6 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
515 514
516 if (x->lastused) 515 if (x->lastused)
517 NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused); 516 NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused);
518 spin_unlock_bh(&x->lock);
519 517
520 if (x->aalg) 518 if (x->aalg)
521 NLA_PUT(skb, XFRMA_ALG_AUTH, alg_len(x->aalg), x->aalg); 519 NLA_PUT(skb, XFRMA_ALG_AUTH, alg_len(x->aalg), x->aalg);
diff --git a/samples/markers/marker-example.c b/samples/markers/marker-example.c
index e787c6d16dd7..05e438f8b4e2 100644
--- a/samples/markers/marker-example.c
+++ b/samples/markers/marker-example.c
@@ -19,7 +19,8 @@ static int my_open(struct inode *inode, struct file *file)
19{ 19{
20 int i; 20 int i;
21 21
22 trace_mark(subsystem_event, "%d %s", 123, "example string"); 22 trace_mark(subsystem_event, "integer %d string %s", 123,
23 "example string");
23 for (i = 0; i < 10; i++) 24 for (i = 0; i < 10; i++)
24 trace_mark(subsystem_eventb, MARK_NOARGS); 25 trace_mark(subsystem_eventb, MARK_NOARGS);
25 return -EPERM; 26 return -EPERM;
diff --git a/samples/markers/probe-example.c b/samples/markers/probe-example.c
index 238b2e384fc8..a36797535615 100644
--- a/samples/markers/probe-example.c
+++ b/samples/markers/probe-example.c
@@ -53,7 +53,7 @@ void probe_subsystem_eventb(const struct marker *mdata, void *private,
53static struct probe_data probe_array[] = 53static struct probe_data probe_array[] =
54{ 54{
55 { .name = "subsystem_event", 55 { .name = "subsystem_event",
56 .format = "%d %s", 56 .format = "integer %d string %s",
57 .probe_func = probe_subsystem_event }, 57 .probe_func = probe_subsystem_event },
58 { .name = "subsystem_eventb", 58 { .name = "subsystem_eventb",
59 .format = MARK_NOARGS, 59 .format = MARK_NOARGS,
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 59594126e8b6..1ad6f7fc490a 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -4,12 +4,7 @@
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 7Kconfig := arch/$(SRCARCH)/Kconfig
8ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/Kconfig.$(ARCH)),)
9 Kconfig := arch/$(SRCARCH)/Kconfig.$(ARCH)
10else
11 Kconfig := arch/$(SRCARCH)/Kconfig
12endif
13 8
14xconfig: $(obj)/qconf 9xconfig: $(obj)/qconf
15 $< $(Kconfig) 10 $< $(Kconfig)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index b2913e9da495..e0f402f3b75d 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -83,6 +83,68 @@ char *conf_get_default_confname(void)
83 return name; 83 return name;
84} 84}
85 85
86static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
87{
88 char *p2;
89
90 switch (sym->type) {
91 case S_TRISTATE:
92 if (p[0] == 'm') {
93 sym->def[def].tri = mod;
94 sym->flags |= def_flags;
95 break;
96 }
97 case S_BOOLEAN:
98 if (p[0] == 'y') {
99 sym->def[def].tri = yes;
100 sym->flags |= def_flags;
101 break;
102 }
103 if (p[0] == 'n') {
104 sym->def[def].tri = no;
105 sym->flags |= def_flags;
106 break;
107 }
108 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
109 break;
110 case S_OTHER:
111 if (*p != '"') {
112 for (p2 = p; *p2 && !isspace(*p2); p2++)
113 ;
114 sym->type = S_STRING;
115 goto done;
116 }
117 case S_STRING:
118 if (*p++ != '"')
119 break;
120 for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
121 if (*p2 == '"') {
122 *p2 = 0;
123 break;
124 }
125 memmove(p2, p2 + 1, strlen(p2));
126 }
127 if (!p2) {
128 conf_warning("invalid string found");
129 return 1;
130 }
131 case S_INT:
132 case S_HEX:
133 done:
134 if (sym_string_valid(sym, p)) {
135 sym->def[def].val = strdup(p);
136 sym->flags |= def_flags;
137 } else {
138 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
139 return 1;
140 }
141 break;
142 default:
143 ;
144 }
145 return 0;
146}
147
86int conf_read_simple(const char *name, int def) 148int conf_read_simple(const char *name, int def)
87{ 149{
88 FILE *in = NULL; 150 FILE *in = NULL;
@@ -213,61 +275,8 @@ load:
213 conf_warning("trying to reassign symbol %s", sym->name); 275 conf_warning("trying to reassign symbol %s", sym->name);
214 break; 276 break;
215 } 277 }
216 switch (sym->type) { 278 if (conf_set_sym_val(sym, def, def_flags, p))
217 case S_TRISTATE: 279 continue;
218 if (p[0] == 'm') {
219 sym->def[def].tri = mod;
220 sym->flags |= def_flags;
221 break;
222 }
223 case S_BOOLEAN:
224 if (p[0] == 'y') {
225 sym->def[def].tri = yes;
226 sym->flags |= def_flags;
227 break;
228 }
229 if (p[0] == 'n') {
230 sym->def[def].tri = no;
231 sym->flags |= def_flags;
232 break;
233 }
234 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
235 break;
236 case S_OTHER:
237 if (*p != '"') {
238 for (p2 = p; *p2 && !isspace(*p2); p2++)
239 ;
240 sym->type = S_STRING;
241 goto done;
242 }
243 case S_STRING:
244 if (*p++ != '"')
245 break;
246 for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
247 if (*p2 == '"') {
248 *p2 = 0;
249 break;
250 }
251 memmove(p2, p2 + 1, strlen(p2));
252 }
253 if (!p2) {
254 conf_warning("invalid string found");
255 continue;
256 }
257 case S_INT:
258 case S_HEX:
259 done:
260 if (sym_string_valid(sym, p)) {
261 sym->def[def].val = strdup(p);
262 sym->flags |= def_flags;
263 } else {
264 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
265 continue;
266 }
267 break;
268 default:
269 ;
270 }
271 break; 280 break;
272 case '\r': 281 case '\r':
273 case '\n': 282 case '\n':
diff --git a/security/commoncap.c b/security/commoncap.c
index bf67871173ef..302e8d0839a9 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -526,6 +526,10 @@ int cap_task_kill(struct task_struct *p, struct siginfo *info,
526 if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info))) 526 if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
527 return 0; 527 return 0;
528 528
529 /* sigcont is permitted within same session */
530 if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p)))
531 return 0;
532
529 if (secid) 533 if (secid)
530 /* 534 /*
531 * Signal sent as a particular user. 535 * Signal sent as a particular user.
diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c
index 7551af1f7899..9e70a160d7da 100644
--- a/security/selinux/ss/avtab.c
+++ b/security/selinux/ss/avtab.c
@@ -325,7 +325,7 @@ static uint16_t spec_order[] = {
325 AVTAB_MEMBER 325 AVTAB_MEMBER
326}; 326};
327 327
328int avtab_read_item(void *fp, u32 vers, struct avtab *a, 328int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
329 int (*insertf)(struct avtab *a, struct avtab_key *k, 329 int (*insertf)(struct avtab *a, struct avtab_key *k,
330 struct avtab_datum *d, void *p), 330 struct avtab_datum *d, void *p),
331 void *p) 331 void *p)
@@ -333,10 +333,11 @@ int avtab_read_item(void *fp, u32 vers, struct avtab *a,
333 __le16 buf16[4]; 333 __le16 buf16[4];
334 u16 enabled; 334 u16 enabled;
335 __le32 buf32[7]; 335 __le32 buf32[7];
336 u32 items, items2, val; 336 u32 items, items2, val, vers = pol->policyvers;
337 struct avtab_key key; 337 struct avtab_key key;
338 struct avtab_datum datum; 338 struct avtab_datum datum;
339 int i, rc; 339 int i, rc;
340 unsigned set;
340 341
341 memset(&key, 0, sizeof(struct avtab_key)); 342 memset(&key, 0, sizeof(struct avtab_key));
342 memset(&datum, 0, sizeof(struct avtab_datum)); 343 memset(&datum, 0, sizeof(struct avtab_datum));
@@ -420,12 +421,35 @@ int avtab_read_item(void *fp, u32 vers, struct avtab *a,
420 key.target_class = le16_to_cpu(buf16[items++]); 421 key.target_class = le16_to_cpu(buf16[items++]);
421 key.specified = le16_to_cpu(buf16[items++]); 422 key.specified = le16_to_cpu(buf16[items++]);
422 423
424 if (!policydb_type_isvalid(pol, key.source_type) ||
425 !policydb_type_isvalid(pol, key.target_type) ||
426 !policydb_class_isvalid(pol, key.target_class)) {
427 printk(KERN_WARNING "security: avtab: invalid type or class\n");
428 return -1;
429 }
430
431 set = 0;
432 for (i = 0; i < ARRAY_SIZE(spec_order); i++) {
433 if (key.specified & spec_order[i])
434 set++;
435 }
436 if (!set || set > 1) {
437 printk(KERN_WARNING
438 "security: avtab: more than one specifier\n");
439 return -1;
440 }
441
423 rc = next_entry(buf32, fp, sizeof(u32)); 442 rc = next_entry(buf32, fp, sizeof(u32));
424 if (rc < 0) { 443 if (rc < 0) {
425 printk("security: avtab: truncated entry\n"); 444 printk("security: avtab: truncated entry\n");
426 return -1; 445 return -1;
427 } 446 }
428 datum.data = le32_to_cpu(*buf32); 447 datum.data = le32_to_cpu(*buf32);
448 if ((key.specified & AVTAB_TYPE) &&
449 !policydb_type_isvalid(pol, datum.data)) {
450 printk(KERN_WARNING "security: avtab: invalid type\n");
451 return -1;
452 }
429 return insertf(a, &key, &datum, p); 453 return insertf(a, &key, &datum, p);
430} 454}
431 455
@@ -435,7 +459,7 @@ static int avtab_insertf(struct avtab *a, struct avtab_key *k,
435 return avtab_insert(a, k, d); 459 return avtab_insert(a, k, d);
436} 460}
437 461
438int avtab_read(struct avtab *a, void *fp, u32 vers) 462int avtab_read(struct avtab *a, void *fp, struct policydb *pol)
439{ 463{
440 int rc; 464 int rc;
441 __le32 buf[1]; 465 __le32 buf[1];
@@ -459,7 +483,7 @@ int avtab_read(struct avtab *a, void *fp, u32 vers)
459 goto bad; 483 goto bad;
460 484
461 for (i = 0; i < nel; i++) { 485 for (i = 0; i < nel; i++) {
462 rc = avtab_read_item(fp,vers, a, avtab_insertf, NULL); 486 rc = avtab_read_item(a, fp, pol, avtab_insertf, NULL);
463 if (rc) { 487 if (rc) {
464 if (rc == -ENOMEM) 488 if (rc == -ENOMEM)
465 printk(KERN_ERR "security: avtab: out of memory\n"); 489 printk(KERN_ERR "security: avtab: out of memory\n");
diff --git a/security/selinux/ss/avtab.h b/security/selinux/ss/avtab.h
index d8edf8ca56d1..8da6a8428086 100644
--- a/security/selinux/ss/avtab.h
+++ b/security/selinux/ss/avtab.h
@@ -64,12 +64,13 @@ struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k);
64void avtab_destroy(struct avtab *h); 64void avtab_destroy(struct avtab *h);
65void avtab_hash_eval(struct avtab *h, char *tag); 65void avtab_hash_eval(struct avtab *h, char *tag);
66 66
67int avtab_read_item(void *fp, uint32_t vers, struct avtab *a, 67struct policydb;
68int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
68 int (*insert)(struct avtab *a, struct avtab_key *k, 69 int (*insert)(struct avtab *a, struct avtab_key *k,
69 struct avtab_datum *d, void *p), 70 struct avtab_datum *d, void *p),
70 void *p); 71 void *p);
71 72
72int avtab_read(struct avtab *a, void *fp, u32 vers); 73int avtab_read(struct avtab *a, void *fp, struct policydb *pol);
73 74
74struct avtab_node *avtab_insert_nonunique(struct avtab *h, struct avtab_key *key, 75struct avtab_node *avtab_insert_nonunique(struct avtab *h, struct avtab_key *key,
75 struct avtab_datum *datum); 76 struct avtab_datum *datum);
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index 45b93a827c80..50ad85d4b77c 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -362,7 +362,8 @@ static int cond_read_av_list(struct policydb *p, void *fp, struct cond_av_list *
362 data.head = NULL; 362 data.head = NULL;
363 data.tail = NULL; 363 data.tail = NULL;
364 for (i = 0; i < len; i++) { 364 for (i = 0; i < len; i++) {
365 rc = avtab_read_item(fp, p->policyvers, &p->te_cond_avtab, cond_insertf, &data); 365 rc = avtab_read_item(&p->te_cond_avtab, fp, p, cond_insertf,
366 &data);
366 if (rc) 367 if (rc)
367 return rc; 368 return rc;
368 369
diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c
index c1a6b22d48d9..920b5e36a1af 100644
--- a/security/selinux/ss/ebitmap.c
+++ b/security/selinux/ss/ebitmap.c
@@ -129,8 +129,8 @@ int ebitmap_netlbl_export(struct ebitmap *ebmap,
129 cmap_sft = delta % NETLBL_CATMAP_MAPSIZE; 129 cmap_sft = delta % NETLBL_CATMAP_MAPSIZE;
130 c_iter->bitmap[cmap_idx] 130 c_iter->bitmap[cmap_idx]
131 |= e_iter->maps[cmap_idx] << cmap_sft; 131 |= e_iter->maps[cmap_idx] << cmap_sft;
132 e_iter = e_iter->next;
133 } 132 }
133 e_iter = e_iter->next;
134 } 134 }
135 135
136 return 0; 136 return 0;
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index 9a11deaaa9e7..fb5d70a6628d 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -157,49 +157,55 @@ void mls_sid_to_context(struct context *context,
157 return; 157 return;
158} 158}
159 159
160int mls_level_isvalid(struct policydb *p, struct mls_level *l)
161{
162 struct level_datum *levdatum;
163 struct ebitmap_node *node;
164 int i;
165
166 if (!l->sens || l->sens > p->p_levels.nprim)
167 return 0;
168 levdatum = hashtab_search(p->p_levels.table,
169 p->p_sens_val_to_name[l->sens - 1]);
170 if (!levdatum)
171 return 0;
172
173 ebitmap_for_each_positive_bit(&l->cat, node, i) {
174 if (i > p->p_cats.nprim)
175 return 0;
176 if (!ebitmap_get_bit(&levdatum->level->cat, i)) {
177 /*
178 * Category may not be associated with
179 * sensitivity.
180 */
181 return 0;
182 }
183 }
184
185 return 1;
186}
187
188int mls_range_isvalid(struct policydb *p, struct mls_range *r)
189{
190 return (mls_level_isvalid(p, &r->level[0]) &&
191 mls_level_isvalid(p, &r->level[1]) &&
192 mls_level_dom(&r->level[1], &r->level[0]));
193}
194
160/* 195/*
161 * Return 1 if the MLS fields in the security context 196 * Return 1 if the MLS fields in the security context
162 * structure `c' are valid. Return 0 otherwise. 197 * structure `c' are valid. Return 0 otherwise.
163 */ 198 */
164int mls_context_isvalid(struct policydb *p, struct context *c) 199int mls_context_isvalid(struct policydb *p, struct context *c)
165{ 200{
166 struct level_datum *levdatum;
167 struct user_datum *usrdatum; 201 struct user_datum *usrdatum;
168 struct ebitmap_node *node;
169 int i, l;
170 202
171 if (!selinux_mls_enabled) 203 if (!selinux_mls_enabled)
172 return 1; 204 return 1;
173 205
174 /* 206 if (!mls_range_isvalid(p, &c->range))
175 * MLS range validity checks: high must dominate low, low level must
176 * be valid (category set <-> sensitivity check), and high level must
177 * be valid (category set <-> sensitivity check)
178 */
179 if (!mls_level_dom(&c->range.level[1], &c->range.level[0]))
180 /* High does not dominate low. */
181 return 0; 207 return 0;
182 208
183 for (l = 0; l < 2; l++) {
184 if (!c->range.level[l].sens || c->range.level[l].sens > p->p_levels.nprim)
185 return 0;
186 levdatum = hashtab_search(p->p_levels.table,
187 p->p_sens_val_to_name[c->range.level[l].sens - 1]);
188 if (!levdatum)
189 return 0;
190
191 ebitmap_for_each_positive_bit(&c->range.level[l].cat, node, i) {
192 if (i > p->p_cats.nprim)
193 return 0;
194 if (!ebitmap_get_bit(&levdatum->level->cat, i))
195 /*
196 * Category may not be associated with
197 * sensitivity in low level.
198 */
199 return 0;
200 }
201 }
202
203 if (c->role == OBJECT_R_VAL) 209 if (c->role == OBJECT_R_VAL)
204 return 1; 210 return 1;
205 211
diff --git a/security/selinux/ss/mls.h b/security/selinux/ss/mls.h
index 096d1b4ef7fb..ab53663d9f5f 100644
--- a/security/selinux/ss/mls.h
+++ b/security/selinux/ss/mls.h
@@ -27,6 +27,8 @@
27int mls_compute_context_len(struct context *context); 27int mls_compute_context_len(struct context *context);
28void mls_sid_to_context(struct context *context, char **scontext); 28void mls_sid_to_context(struct context *context, char **scontext);
29int mls_context_isvalid(struct policydb *p, struct context *c); 29int mls_context_isvalid(struct policydb *p, struct context *c);
30int mls_range_isvalid(struct policydb *p, struct mls_range *r);
31int mls_level_isvalid(struct policydb *p, struct mls_level *l);
30 32
31int mls_context_to_sid(char oldc, 33int mls_context_to_sid(char oldc,
32 char **scontext, 34 char **scontext,
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 539828b229b2..b582aae3c62c 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -713,6 +713,27 @@ out:
713 return rc; 713 return rc;
714} 714}
715 715
716int policydb_class_isvalid(struct policydb *p, unsigned int class)
717{
718 if (!class || class > p->p_classes.nprim)
719 return 0;
720 return 1;
721}
722
723int policydb_role_isvalid(struct policydb *p, unsigned int role)
724{
725 if (!role || role > p->p_roles.nprim)
726 return 0;
727 return 1;
728}
729
730int policydb_type_isvalid(struct policydb *p, unsigned int type)
731{
732 if (!type || type > p->p_types.nprim)
733 return 0;
734 return 1;
735}
736
716/* 737/*
717 * Return 1 if the fields in the security context 738 * Return 1 if the fields in the security context
718 * structure `c' are valid. Return 0 otherwise. 739 * structure `c' are valid. Return 0 otherwise.
@@ -1260,6 +1281,7 @@ static int mls_read_level(struct mls_level *lp, void *fp)
1260 "categories\n"); 1281 "categories\n");
1261 goto bad; 1282 goto bad;
1262 } 1283 }
1284
1263 return 0; 1285 return 0;
1264 1286
1265bad: 1287bad:
@@ -1563,7 +1585,7 @@ int policydb_read(struct policydb *p, void *fp)
1563 p->symtab[i].nprim = nprim; 1585 p->symtab[i].nprim = nprim;
1564 } 1586 }
1565 1587
1566 rc = avtab_read(&p->te_avtab, fp, p->policyvers); 1588 rc = avtab_read(&p->te_avtab, fp, p);
1567 if (rc) 1589 if (rc)
1568 goto bad; 1590 goto bad;
1569 1591
@@ -1595,6 +1617,12 @@ int policydb_read(struct policydb *p, void *fp)
1595 tr->role = le32_to_cpu(buf[0]); 1617 tr->role = le32_to_cpu(buf[0]);
1596 tr->type = le32_to_cpu(buf[1]); 1618 tr->type = le32_to_cpu(buf[1]);
1597 tr->new_role = le32_to_cpu(buf[2]); 1619 tr->new_role = le32_to_cpu(buf[2]);
1620 if (!policydb_role_isvalid(p, tr->role) ||
1621 !policydb_type_isvalid(p, tr->type) ||
1622 !policydb_role_isvalid(p, tr->new_role)) {
1623 rc = -EINVAL;
1624 goto bad;
1625 }
1598 ltr = tr; 1626 ltr = tr;
1599 } 1627 }
1600 1628
@@ -1619,6 +1647,11 @@ int policydb_read(struct policydb *p, void *fp)
1619 goto bad; 1647 goto bad;
1620 ra->role = le32_to_cpu(buf[0]); 1648 ra->role = le32_to_cpu(buf[0]);
1621 ra->new_role = le32_to_cpu(buf[1]); 1649 ra->new_role = le32_to_cpu(buf[1]);
1650 if (!policydb_role_isvalid(p, ra->role) ||
1651 !policydb_role_isvalid(p, ra->new_role)) {
1652 rc = -EINVAL;
1653 goto bad;
1654 }
1622 lra = ra; 1655 lra = ra;
1623 } 1656 }
1624 1657
@@ -1872,9 +1905,19 @@ int policydb_read(struct policydb *p, void *fp)
1872 rt->target_class = le32_to_cpu(buf[0]); 1905 rt->target_class = le32_to_cpu(buf[0]);
1873 } else 1906 } else
1874 rt->target_class = SECCLASS_PROCESS; 1907 rt->target_class = SECCLASS_PROCESS;
1908 if (!policydb_type_isvalid(p, rt->source_type) ||
1909 !policydb_type_isvalid(p, rt->target_type) ||
1910 !policydb_class_isvalid(p, rt->target_class)) {
1911 rc = -EINVAL;
1912 goto bad;
1913 }
1875 rc = mls_read_range_helper(&rt->target_range, fp); 1914 rc = mls_read_range_helper(&rt->target_range, fp);
1876 if (rc) 1915 if (rc)
1877 goto bad; 1916 goto bad;
1917 if (!mls_range_isvalid(p, &rt->target_range)) {
1918 printk(KERN_WARNING "security: rangetrans: invalid range\n");
1919 goto bad;
1920 }
1878 lrt = rt; 1921 lrt = rt;
1879 } 1922 }
1880 } 1923 }
diff --git a/security/selinux/ss/policydb.h b/security/selinux/ss/policydb.h
index 844d310f4f1b..ed6fc687c66f 100644
--- a/security/selinux/ss/policydb.h
+++ b/security/selinux/ss/policydb.h
@@ -251,6 +251,9 @@ struct policydb {
251extern void policydb_destroy(struct policydb *p); 251extern void policydb_destroy(struct policydb *p);
252extern int policydb_load_isids(struct policydb *p, struct sidtab *s); 252extern int policydb_load_isids(struct policydb *p, struct sidtab *s);
253extern int policydb_context_isvalid(struct policydb *p, struct context *c); 253extern int policydb_context_isvalid(struct policydb *p, struct context *c);
254extern int policydb_class_isvalid(struct policydb *p, unsigned int class);
255extern int policydb_type_isvalid(struct policydb *p, unsigned int type);
256extern int policydb_role_isvalid(struct policydb *p, unsigned int role);
254extern int policydb_read(struct policydb *p, void *fp); 257extern int policydb_read(struct policydb *p, void *fp);
255 258
256#define PERM_SYMTAB_SIZE 32 259#define PERM_SYMTAB_SIZE 32
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index 36a191e7004e..e07603969033 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -211,26 +211,27 @@ static int selinux_xfrm_sec_ctx_alloc(struct xfrm_sec_ctx **ctxp,
211 if (uctx->ctx_doi != XFRM_SC_ALG_SELINUX) 211 if (uctx->ctx_doi != XFRM_SC_ALG_SELINUX)
212 return -EINVAL; 212 return -EINVAL;
213 213
214 if (uctx->ctx_len >= PAGE_SIZE) 214 str_len = uctx->ctx_len;
215 if (str_len >= PAGE_SIZE)
215 return -ENOMEM; 216 return -ENOMEM;
216 217
217 *ctxp = ctx = kmalloc(sizeof(*ctx) + 218 *ctxp = ctx = kmalloc(sizeof(*ctx) +
218 uctx->ctx_len + 1, 219 str_len + 1,
219 GFP_KERNEL); 220 GFP_KERNEL);
220 221
221 if (!ctx) 222 if (!ctx)
222 return -ENOMEM; 223 return -ENOMEM;
223 224
224 ctx->ctx_doi = uctx->ctx_doi; 225 ctx->ctx_doi = uctx->ctx_doi;
225 ctx->ctx_len = uctx->ctx_len; 226 ctx->ctx_len = str_len;
226 ctx->ctx_alg = uctx->ctx_alg; 227 ctx->ctx_alg = uctx->ctx_alg;
227 228
228 memcpy(ctx->ctx_str, 229 memcpy(ctx->ctx_str,
229 uctx+1, 230 uctx+1,
230 ctx->ctx_len); 231 str_len);
231 ctx->ctx_str[ctx->ctx_len] = 0; 232 ctx->ctx_str[str_len] = 0;
232 rc = security_context_to_sid(ctx->ctx_str, 233 rc = security_context_to_sid(ctx->ctx_str,
233 ctx->ctx_len, 234 str_len,
234 &ctx->ctx_sid); 235 &ctx->ctx_sid);
235 236
236 if (rc) 237 if (rc)
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index 3306ecd49243..b57f2d5a1c9d 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -97,23 +97,27 @@ static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu)
97 97
98static void uart_interrupt_tx(struct snd_mpu401 *mpu) 98static void uart_interrupt_tx(struct snd_mpu401 *mpu)
99{ 99{
100 unsigned long flags;
101
100 if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) && 102 if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) &&
101 test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) { 103 test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) {
102 spin_lock(&mpu->output_lock); 104 spin_lock_irqsave(&mpu->output_lock, flags);
103 snd_mpu401_uart_output_write(mpu); 105 snd_mpu401_uart_output_write(mpu);
104 spin_unlock(&mpu->output_lock); 106 spin_unlock_irqrestore(&mpu->output_lock, flags);
105 } 107 }
106} 108}
107 109
108static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu) 110static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu)
109{ 111{
112 unsigned long flags;
113
110 if (mpu->info_flags & MPU401_INFO_INPUT) { 114 if (mpu->info_flags & MPU401_INFO_INPUT) {
111 spin_lock(&mpu->input_lock); 115 spin_lock_irqsave(&mpu->input_lock, flags);
112 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) 116 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode))
113 snd_mpu401_uart_input_read(mpu); 117 snd_mpu401_uart_input_read(mpu);
114 else 118 else
115 snd_mpu401_uart_clear_rx(mpu); 119 snd_mpu401_uart_clear_rx(mpu);
116 spin_unlock(&mpu->input_lock); 120 spin_unlock_irqrestore(&mpu->input_lock, flags);
117 } 121 }
118 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ)) 122 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ))
119 /* ok. for better Tx performance try do some output 123 /* ok. for better Tx performance try do some output
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index e065b2a6444a..1b832870cc84 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -668,7 +668,7 @@ static int __devinit snd_portman_probe_port(struct parport *p)
668 parport_release(pardev); 668 parport_release(pardev);
669 parport_unregister_device(pardev); 669 parport_unregister_device(pardev);
670 670
671 return res; 671 return res ? -EIO : 0;
672} 672}
673 673
674static void __devinit snd_portman_attach(struct parport *p) 674static void __devinit snd_portman_attach(struct parport *p)
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index be519a17dfa5..3f9b5c560036 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -86,7 +86,7 @@ static int snd_ca0106_shared_spdif_get(struct snd_kcontrol *kcontrol,
86{ 86{
87 struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol); 87 struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
88 88
89 ucontrol->value.enumerated.item[0] = emu->spdif_enable; 89 ucontrol->value.integer.value[0] = emu->spdif_enable;
90 return 0; 90 return 0;
91} 91}
92 92
@@ -98,11 +98,11 @@ static int snd_ca0106_shared_spdif_put(struct snd_kcontrol *kcontrol,
98 int change = 0; 98 int change = 0;
99 u32 mask; 99 u32 mask;
100 100
101 val = ucontrol->value.enumerated.item[0] ; 101 val = !!ucontrol->value.integer.value[0];
102 change = (emu->spdif_enable != val); 102 change = (emu->spdif_enable != val);
103 if (change) { 103 if (change) {
104 emu->spdif_enable = val; 104 emu->spdif_enable = val;
105 if (val == 1) { 105 if (val) {
106 /* Digital */ 106 /* Digital */
107 snd_ca0106_ptr_write(emu, SPDIF_SELECT1, 0, 0xf); 107 snd_ca0106_ptr_write(emu, SPDIF_SELECT1, 0, 0xf);
108 snd_ca0106_ptr_write(emu, SPDIF_SELECT2, 0, 0x0b000000); 108 snd_ca0106_ptr_write(emu, SPDIF_SELECT2, 0, 0x0b000000);
@@ -159,6 +159,8 @@ static int snd_ca0106_capture_source_put(struct snd_kcontrol *kcontrol,
159 u32 source; 159 u32 source;
160 160
161 val = ucontrol->value.enumerated.item[0] ; 161 val = ucontrol->value.enumerated.item[0] ;
162 if (val >= 6)
163 return -EINVAL;
162 change = (emu->capture_source != val); 164 change = (emu->capture_source != val);
163 if (change) { 165 if (change) {
164 emu->capture_source = val; 166 emu->capture_source = val;
@@ -207,6 +209,8 @@ static int snd_ca0106_i2c_capture_source_put(struct snd_kcontrol *kcontrol,
207 * for the particular source. 209 * for the particular source.
208 */ 210 */
209 source_id = ucontrol->value.enumerated.item[0] ; 211 source_id = ucontrol->value.enumerated.item[0] ;
212 if (source_id >= 4)
213 return -EINVAL;
210 change = (emu->i2c_capture_source != source_id); 214 change = (emu->i2c_capture_source != source_id);
211 if (change) { 215 if (change) {
212 snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */ 216 snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */
@@ -271,6 +275,8 @@ static int snd_ca0106_capture_mic_line_in_put(struct snd_kcontrol *kcontrol,
271 u32 tmp; 275 u32 tmp;
272 276
273 val = ucontrol->value.enumerated.item[0] ; 277 val = ucontrol->value.enumerated.item[0] ;
278 if (val > 1)
279 return -EINVAL;
274 change = (emu->capture_mic_line_in != val); 280 change = (emu->capture_mic_line_in != val);
275 if (change) { 281 if (change) {
276 emu->capture_mic_line_in = val; 282 emu->capture_mic_line_in = val;
@@ -443,7 +449,7 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
443 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ 449 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
444 ngain = ucontrol->value.integer.value[0]; 450 ngain = ucontrol->value.integer.value[0];
445 if (ngain > 0xff) 451 if (ngain > 0xff)
446 return 0; 452 return -EINVAL;
447 if (ogain != ngain) { 453 if (ogain != ngain) {
448 if (emu->i2c_capture_source == source_id) 454 if (emu->i2c_capture_source == source_id)
449 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) ); 455 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) );
@@ -453,7 +459,7 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
453 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ 459 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
454 ngain = ucontrol->value.integer.value[1]; 460 ngain = ucontrol->value.integer.value[1];
455 if (ngain > 0xff) 461 if (ngain > 0xff)
456 return 0; 462 return -EINVAL;
457 if (ogain != ngain) { 463 if (ogain != ngain) {
458 if (emu->i2c_capture_source == source_id) 464 if (emu->i2c_capture_source == source_id)
459 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff)); 465 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
@@ -497,7 +503,7 @@ static int spi_mute_put(struct snd_kcontrol *kcontrol,
497 } 503 }
498 504
499 ret = snd_ca0106_spi_write(emu, emu->spi_dac_reg[reg]); 505 ret = snd_ca0106_spi_write(emu, emu->spi_dac_reg[reg]);
500 return ret ? -1 : 1; 506 return ret ? -EINVAL : 1;
501} 507}
502 508
503#define CA_VOLUME(xname,chid,reg) \ 509#define CA_VOLUME(xname,chid,reg) \
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c
index ae80f51d8c4f..61f2718ae359 100644
--- a/sound/pci/ca0106/ca0106_proc.c
+++ b/sound/pci/ca0106/ca0106_proc.c
@@ -445,13 +445,11 @@ int __devinit snd_ca0106_proc_init(struct snd_ca0106 * emu)
445 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1); 445 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1);
446 entry->c.text.write = snd_ca0106_proc_reg_write; 446 entry->c.text.write = snd_ca0106_proc_reg_write;
447 entry->mode |= S_IWUSR; 447 entry->mode |= S_IWUSR;
448// entry->private_data = emu;
449 } 448 }
450 if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) { 449 if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) {
451 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_i2c_write);
452 entry->c.text.write = snd_ca0106_proc_i2c_write; 450 entry->c.text.write = snd_ca0106_proc_i2c_write;
451 entry->private_data = emu;
453 entry->mode |= S_IWUSR; 452 entry->mode |= S_IWUSR;
454// entry->private_data = emu;
455 } 453 }
456 if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry)) 454 if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry))
457 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2); 455 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2);
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 6832649879ce..1fa5f004e858 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -246,10 +246,9 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
246#define CM_MMODE_MASK 0x00000E00 /* model DAA interface mode */ 246#define CM_MMODE_MASK 0x00000E00 /* model DAA interface mode */
247#define CM_SPDIF_SELECT2 0x00000100 /* for model > 039 ? */ 247#define CM_SPDIF_SELECT2 0x00000100 /* for model > 039 ? */
248#define CM_ENCENTER 0x00000080 248#define CM_ENCENTER 0x00000080
249#define CM_FLINKON 0x00000080 /* force modem link detection on, model 037 */ 249#define CM_FLINKON 0x00000040 /* force modem link detection on, model 037 */
250#define CM_MUTECH1 0x00000040 /* mute PCI ch1 to DAC */ 250#define CM_MUTECH1 0x00000040 /* mute PCI ch1 to DAC */
251#define CM_FLINKOFF 0x00000040 /* force modem link detection off, model 037 */ 251#define CM_FLINKOFF 0x00000020 /* force modem link detection off, model 037 */
252#define CM_UNKNOWN_18_5 0x00000020 /* ? */
253#define CM_MIDSMP 0x00000010 /* 1/2 interpolation at front end DAC */ 252#define CM_MIDSMP 0x00000010 /* 1/2 interpolation at front end DAC */
254#define CM_UPDDMA_MASK 0x0000000C /* TDMA position update notification */ 253#define CM_UPDDMA_MASK 0x0000000C /* TDMA position update notification */
255#define CM_UPDDMA_2048 0x00000000 254#define CM_UPDDMA_2048 0x00000000
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index 54a2034d8edd..ccacd7b890e8 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -58,6 +58,9 @@ static int snd_emu10k1_spdif_get(struct snd_kcontrol *kcontrol,
58 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 58 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
59 unsigned long flags; 59 unsigned long flags;
60 60
61 /* Limit: emu->spdif_bits */
62 if (idx >= 3)
63 return -EINVAL;
61 spin_lock_irqsave(&emu->reg_lock, flags); 64 spin_lock_irqsave(&emu->reg_lock, flags);
62 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff; 65 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff;
63 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff; 66 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff;
@@ -272,9 +275,12 @@ static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol,
272 struct snd_ctl_elem_value *ucontrol) 275 struct snd_ctl_elem_value *ucontrol)
273{ 276{
274 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 277 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
275 int channel; 278 unsigned int channel;
276 279
277 channel = (kcontrol->private_value) & 0xff; 280 channel = (kcontrol->private_value) & 0xff;
281 /* Limit: emu1010_output_dst, emu->emu1010.output_source */
282 if (channel >= 24)
283 return -EINVAL;
278 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel]; 284 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel];
279 return 0; 285 return 0;
280} 286}
@@ -285,11 +291,17 @@ static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol,
285 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 291 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
286 int change = 0; 292 int change = 0;
287 unsigned int val; 293 unsigned int val;
288 int channel; 294 unsigned int channel;
289 295
296 val = ucontrol->value.enumerated.item[0];
297 if (val >= 53)
298 return -EINVAL;
290 channel = (kcontrol->private_value) & 0xff; 299 channel = (kcontrol->private_value) & 0xff;
291 if (emu->emu1010.output_source[channel] != ucontrol->value.enumerated.item[0]) { 300 /* Limit: emu1010_output_dst, emu->emu1010.output_source */
292 val = emu->emu1010.output_source[channel] = ucontrol->value.enumerated.item[0]; 301 if (channel >= 24)
302 return -EINVAL;
303 if (emu->emu1010.output_source[channel] != val) {
304 emu->emu1010.output_source[channel] = val;
293 change = 1; 305 change = 1;
294 snd_emu1010_fpga_link_dst_src_write(emu, 306 snd_emu1010_fpga_link_dst_src_write(emu,
295 emu1010_output_dst[channel], emu1010_src_regs[val]); 307 emu1010_output_dst[channel], emu1010_src_regs[val]);
@@ -301,9 +313,12 @@ static int snd_emu1010_input_source_get(struct snd_kcontrol *kcontrol,
301 struct snd_ctl_elem_value *ucontrol) 313 struct snd_ctl_elem_value *ucontrol)
302{ 314{
303 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 315 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
304 int channel; 316 unsigned int channel;
305 317
306 channel = (kcontrol->private_value) & 0xff; 318 channel = (kcontrol->private_value) & 0xff;
319 /* Limit: emu1010_input_dst, emu->emu1010.input_source */
320 if (channel >= 22)
321 return -EINVAL;
307 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel]; 322 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel];
308 return 0; 323 return 0;
309} 324}
@@ -314,11 +329,17 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
314 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 329 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
315 int change = 0; 330 int change = 0;
316 unsigned int val; 331 unsigned int val;
317 int channel; 332 unsigned int channel;
318 333
334 val = ucontrol->value.enumerated.item[0];
335 if (val >= 53)
336 return -EINVAL;
319 channel = (kcontrol->private_value) & 0xff; 337 channel = (kcontrol->private_value) & 0xff;
320 if (emu->emu1010.input_source[channel] != ucontrol->value.enumerated.item[0]) { 338 /* Limit: emu1010_input_dst, emu->emu1010.input_source */
321 val = emu->emu1010.input_source[channel] = ucontrol->value.enumerated.item[0]; 339 if (channel >= 22)
340 return -EINVAL;
341 if (emu->emu1010.input_source[channel] != val) {
342 emu->emu1010.input_source[channel] = val;
322 change = 1; 343 change = 1;
323 snd_emu1010_fpga_link_dst_src_write(emu, 344 snd_emu1010_fpga_link_dst_src_write(emu,
324 emu1010_input_dst[channel], emu1010_src_regs[val]); 345 emu1010_input_dst[channel], emu1010_src_regs[val]);
@@ -533,6 +554,9 @@ static int snd_emu1010_internal_clock_put(struct snd_kcontrol *kcontrol,
533 int change = 0; 554 int change = 0;
534 555
535 val = ucontrol->value.enumerated.item[0] ; 556 val = ucontrol->value.enumerated.item[0] ;
557 /* Limit: uinfo->value.enumerated.items = 4; */
558 if (val >= 4)
559 return -EINVAL;
536 change = (emu->emu1010.internal_clock != val); 560 change = (emu->emu1010.internal_clock != val);
537 if (change) { 561 if (change) {
538 emu->emu1010.internal_clock = val; 562 emu->emu1010.internal_clock = val;
@@ -669,7 +693,11 @@ static int snd_audigy_i2c_capture_source_put(struct snd_kcontrol *kcontrol,
669 * update the capture volume from the cached value 693 * update the capture volume from the cached value
670 * for the particular source. 694 * for the particular source.
671 */ 695 */
672 source_id = ucontrol->value.enumerated.item[0]; /* Use 2 and 3 */ 696 source_id = ucontrol->value.enumerated.item[0];
697 /* Limit: uinfo->value.enumerated.items = 2; */
698 /* emu->i2c_capture_volume */
699 if (source_id >= 2)
700 return -EINVAL;
673 change = (emu->i2c_capture_source != source_id); 701 change = (emu->i2c_capture_source != source_id);
674 if (change) { 702 if (change) {
675 snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */ 703 snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */
@@ -720,9 +748,13 @@ static int snd_audigy_i2c_volume_get(struct snd_kcontrol *kcontrol,
720 struct snd_ctl_elem_value *ucontrol) 748 struct snd_ctl_elem_value *ucontrol)
721{ 749{
722 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 750 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
723 int source_id; 751 unsigned int source_id;
724 752
725 source_id = kcontrol->private_value; 753 source_id = kcontrol->private_value;
754 /* Limit: emu->i2c_capture_volume */
755 /* capture_source: uinfo->value.enumerated.items = 2 */
756 if (source_id >= 2)
757 return -EINVAL;
726 758
727 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0]; 759 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0];
728 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1]; 760 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1];
@@ -735,10 +767,14 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
735 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 767 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
736 unsigned int ogain; 768 unsigned int ogain;
737 unsigned int ngain; 769 unsigned int ngain;
738 int source_id; 770 unsigned int source_id;
739 int change = 0; 771 int change = 0;
740 772
741 source_id = kcontrol->private_value; 773 source_id = kcontrol->private_value;
774 /* Limit: emu->i2c_capture_volume */
775 /* capture_source: uinfo->value.enumerated.items = 2 */
776 if (source_id >= 2)
777 return -EINVAL;
742 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ 778 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
743 ngain = ucontrol->value.integer.value[0]; 779 ngain = ucontrol->value.integer.value[0];
744 if (ngain > 0xff) 780 if (ngain > 0xff)
@@ -746,7 +782,7 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
746 if (ogain != ngain) { 782 if (ogain != ngain) {
747 if (emu->i2c_capture_source == source_id) 783 if (emu->i2c_capture_source == source_id)
748 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) ); 784 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) );
749 emu->i2c_capture_volume[source_id][0] = ucontrol->value.integer.value[0]; 785 emu->i2c_capture_volume[source_id][0] = ngain;
750 change = 1; 786 change = 1;
751 } 787 }
752 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ 788 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
@@ -756,7 +792,7 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
756 if (ogain != ngain) { 792 if (ogain != ngain) {
757 if (emu->i2c_capture_source == source_id) 793 if (emu->i2c_capture_source == source_id)
758 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff)); 794 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
759 emu->i2c_capture_volume[source_id][1] = ucontrol->value.integer.value[1]; 795 emu->i2c_capture_volume[source_id][1] = ngain;
760 change = 1; 796 change = 1;
761 } 797 }
762 798
@@ -877,6 +913,9 @@ static int snd_emu10k1_spdif_put(struct snd_kcontrol *kcontrol,
877 unsigned int val; 913 unsigned int val;
878 unsigned long flags; 914 unsigned long flags;
879 915
916 /* Limit: emu->spdif_bits */
917 if (idx >= 3)
918 return -EINVAL;
880 val = (ucontrol->value.iec958.status[0] << 0) | 919 val = (ucontrol->value.iec958.status[0] << 0) |
881 (ucontrol->value.iec958.status[1] << 8) | 920 (ucontrol->value.iec958.status[1] << 8) |
882 (ucontrol->value.iec958.status[2] << 16) | 921 (ucontrol->value.iec958.status[2] << 16) |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index d619a3842cdd..9fd3135f3118 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -742,6 +742,8 @@ static int snd_p16v_capture_source_put(struct snd_kcontrol *kcontrol,
742 u32 source; 742 u32 source;
743 743
744 val = ucontrol->value.enumerated.item[0] ; 744 val = ucontrol->value.enumerated.item[0] ;
745 if (val > 7)
746 return -EINVAL;
745 change = (emu->p16v_capture_source != val); 747 change = (emu->p16v_capture_source != val);
746 if (change) { 748 if (change) {
747 emu->p16v_capture_source = val; 749 emu->p16v_capture_source = val;
@@ -784,6 +786,8 @@ static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
784 u32 tmp; 786 u32 tmp;
785 787
786 val = ucontrol->value.enumerated.item[0] ; 788 val = ucontrol->value.enumerated.item[0] ;
789 if (val > 3)
790 return -EINVAL;
787 change = (emu->p16v_capture_channel != val); 791 change = (emu->p16v_capture_channel != val);
788 if (change) { 792 if (change) {
789 emu->p16v_capture_channel = val; 793 emu->p16v_capture_channel = val;
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ad4cb38109fc..8cbe3bf1e317 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1625,19 +1625,26 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
1625 1625
1626 nid = codec->start_nid; 1626 nid = codec->start_nid;
1627 for (i = 0; i < codec->num_nodes; i++, nid++) { 1627 for (i = 0; i < codec->num_nodes; i++, nid++) {
1628 if (get_wcaps(codec, nid) & AC_WCAP_POWER) { 1628 unsigned int wcaps = get_wcaps(codec, nid);
1629 unsigned int pincap; 1629 if (wcaps & AC_WCAP_POWER) {
1630 /* 1630 unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >>
1631 * don't power down the widget if it controls eapd 1631 AC_WCAP_TYPE_SHIFT;
1632 * and EAPD_BTLENABLE is set. 1632 if (wid_type == AC_WID_PIN) {
1633 */ 1633 unsigned int pincap;
1634 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 1634 /*
1635 if (pincap & AC_PINCAP_EAPD) { 1635 * don't power down the widget if it controls
1636 int eapd = snd_hda_codec_read(codec, nid, 1636 * eapd and EAPD_BTLENABLE is set.
1637 0, AC_VERB_GET_EAPD_BTLENABLE, 0); 1637 */
1638 eapd &= 0x02; 1638 pincap = snd_hda_param_read(codec, nid,
1639 if (power_state == AC_PWRST_D3 && eapd) 1639 AC_PAR_PIN_CAP);
1640 continue; 1640 if (pincap & AC_PINCAP_EAPD) {
1641 int eapd = snd_hda_codec_read(codec,
1642 nid, 0,
1643 AC_VERB_GET_EAPD_BTLENABLE, 0);
1644 eapd &= 0x02;
1645 if (power_state == AC_PWRST_D3 && eapd)
1646 continue;
1647 }
1641 } 1648 }
1642 snd_hda_codec_write(codec, nid, 0, 1649 snd_hda_codec_write(codec, nid, 0,
1643 AC_VERB_SET_POWER_STATE, 1650 AC_VERB_SET_POWER_STATE,
@@ -2485,13 +2492,14 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
2485 /* front */ 2492 /* front */
2486 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 2493 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag,
2487 0, format); 2494 0, format);
2488 if (mout->hp_nid && mout->hp_nid != nids[HDA_FRONT]) 2495 if (!mout->no_share_stream &&
2496 mout->hp_nid && mout->hp_nid != nids[HDA_FRONT])
2489 /* headphone out will just decode front left/right (stereo) */ 2497 /* headphone out will just decode front left/right (stereo) */
2490 snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, 2498 snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag,
2491 0, format); 2499 0, format);
2492 /* extra outputs copied from front */ 2500 /* extra outputs copied from front */
2493 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) 2501 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++)
2494 if (mout->extra_out_nid[i]) 2502 if (!mout->no_share_stream && mout->extra_out_nid[i])
2495 snd_hda_codec_setup_stream(codec, 2503 snd_hda_codec_setup_stream(codec,
2496 mout->extra_out_nid[i], 2504 mout->extra_out_nid[i],
2497 stream_tag, 0, format); 2505 stream_tag, 0, format);
@@ -2501,7 +2509,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
2501 if (chs >= (i + 1) * 2) /* independent out */ 2509 if (chs >= (i + 1) * 2) /* independent out */
2502 snd_hda_codec_setup_stream(codec, nids[i], stream_tag, 2510 snd_hda_codec_setup_stream(codec, nids[i], stream_tag,
2503 i * 2, format); 2511 i * 2, format);
2504 else /* copy front */ 2512 else if (!mout->no_share_stream) /* copy front */
2505 snd_hda_codec_setup_stream(codec, nids[i], stream_tag, 2513 snd_hda_codec_setup_stream(codec, nids[i], stream_tag,
2506 0, format); 2514 0, format);
2507 } 2515 }
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 20c5e6250374..8c56c9cb0d09 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -220,6 +220,7 @@ struct hda_multi_out {
220 hda_nid_t dig_out_nid; /* digital out audio widget */ 220 hda_nid_t dig_out_nid; /* digital out audio widget */
221 int max_channels; /* currently supported analog channels */ 221 int max_channels; /* currently supported analog channels */
222 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ 222 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */
223 int no_share_stream; /* don't share a stream with multiple pins */
223}; 224};
224 225
225int snd_hda_multi_out_dig_open(struct hda_codec *codec, 226int snd_hda_multi_out_dig_open(struct hda_codec *codec,
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 0ee8ae4d4410..196ad3c9405d 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -957,6 +957,14 @@ static int patch_ad1986a(struct hda_codec *codec)
957 break; 957 break;
958 } 958 }
959 959
960 /* AD1986A has a hardware problem that it can't share a stream
961 * with multiple output pins. The copy of front to surrounds
962 * causes noisy or silent outputs at a certain timing, e.g.
963 * changing the volume.
964 * So, let's disable the shared stream.
965 */
966 spec->multiout.no_share_stream = 1;
967
960 return 0; 968 return 0;
961} 969}
962 970
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 },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f9b2c435a130..04012237096c 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -111,7 +111,6 @@ struct sigmatel_spec {
111 unsigned int alt_switch: 1; 111 unsigned int alt_switch: 1;
112 unsigned int hp_detect: 1; 112 unsigned int hp_detect: 1;
113 unsigned int gpio_mute: 1; 113 unsigned int gpio_mute: 1;
114 unsigned int no_vol_knob :1;
115 114
116 unsigned int gpio_mask, gpio_data; 115 unsigned int gpio_mask, gpio_data;
117 116
@@ -342,42 +341,6 @@ static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
342 return 1; 341 return 1;
343} 342}
344 343
345static int stac92xx_volknob_info(struct snd_kcontrol *kcontrol,
346 struct snd_ctl_elem_info *uinfo)
347{
348 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
349 uinfo->count = 1;
350 uinfo->value.integer.min = 0;
351 uinfo->value.integer.max = 127;
352 return 0;
353}
354
355static int stac92xx_volknob_get(struct snd_kcontrol *kcontrol,
356 struct snd_ctl_elem_value *ucontrol)
357{
358 ucontrol->value.integer.value[0] = kcontrol->private_value & 0xff;
359 return 0;
360}
361
362static int stac92xx_volknob_put(struct snd_kcontrol *kcontrol,
363 struct snd_ctl_elem_value *ucontrol)
364{
365 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
366 unsigned int val = kcontrol->private_value & 0xff;
367
368 if (val == ucontrol->value.integer.value[0])
369 return 0;
370
371 val = ucontrol->value.integer.value[0];
372 kcontrol->private_value &= ~0xff;
373 kcontrol->private_value |= val;
374
375 snd_hda_codec_write_cache(codec, kcontrol->private_value >> 16, 0,
376 AC_VERB_SET_VOLUME_KNOB_CONTROL, val | 0x80);
377 return 1;
378}
379
380
381static struct hda_verb stac9200_core_init[] = { 344static struct hda_verb stac9200_core_init[] = {
382 /* set dac0mux for dac converter */ 345 /* set dac0mux for dac converter */
383 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 346 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -446,18 +409,6 @@ static struct hda_verb stac9205_core_init[] = {
446 .private_value = verb_read | (verb_write << 16), \ 409 .private_value = verb_read | (verb_write << 16), \
447 } 410 }
448 411
449#define STAC_VOLKNOB(knob_nid) \
450 { \
451 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
452 .name = "Master Playback Volume", \
453 .count = 1, \
454 .info = stac92xx_volknob_info, \
455 .get = stac92xx_volknob_get, \
456 .put = stac92xx_volknob_put, \
457 .private_value = 127 | (knob_nid << 16), \
458 }
459
460
461static struct snd_kcontrol_new stac9200_mixer[] = { 412static struct snd_kcontrol_new stac9200_mixer[] = {
462 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), 413 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
463 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), 414 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
@@ -487,7 +438,6 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
487 }, 438 },
488 STAC_INPUT_SOURCE(2), 439 STAC_INPUT_SOURCE(2),
489 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0), 440 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0),
490 STAC_VOLKNOB(0x24),
491 441
492 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), 442 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
493 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), 443 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
@@ -503,7 +453,6 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
503/* This needs to be generated dynamically based on sequence */ 453/* This needs to be generated dynamically based on sequence */
504static struct snd_kcontrol_new stac922x_mixer[] = { 454static struct snd_kcontrol_new stac922x_mixer[] = {
505 STAC_INPUT_SOURCE(2), 455 STAC_INPUT_SOURCE(2),
506 STAC_VOLKNOB(0x16),
507 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), 456 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
508 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), 457 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
509 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT), 458 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
@@ -517,7 +466,6 @@ static struct snd_kcontrol_new stac922x_mixer[] = {
517 466
518static struct snd_kcontrol_new stac927x_mixer[] = { 467static struct snd_kcontrol_new stac927x_mixer[] = {
519 STAC_INPUT_SOURCE(3), 468 STAC_INPUT_SOURCE(3),
520 STAC_VOLKNOB(0x24),
521 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), 469 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB),
522 470
523 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), 471 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
@@ -1931,8 +1879,7 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
1931 } 1879 }
1932 if (spec->multiout.hp_nid) { 1880 if (spec->multiout.hp_nid) {
1933 const char *pfx; 1881 const char *pfx;
1934 if (old_num_dacs == spec->multiout.num_dacs && 1882 if (old_num_dacs == spec->multiout.num_dacs)
1935 spec->no_vol_knob)
1936 pfx = "Master"; 1883 pfx = "Master";
1937 else 1884 else
1938 pfx = "Headphone"; 1885 pfx = "Headphone";
@@ -2489,7 +2436,6 @@ static int patch_stac9200(struct hda_codec *codec)
2489 codec->spec = spec; 2436 codec->spec = spec;
2490 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 2437 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
2491 spec->pin_nids = stac9200_pin_nids; 2438 spec->pin_nids = stac9200_pin_nids;
2492 spec->no_vol_knob = 1;
2493 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, 2439 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
2494 stac9200_models, 2440 stac9200_models,
2495 stac9200_cfg_tbl); 2441 stac9200_cfg_tbl);
@@ -2544,7 +2490,6 @@ static int patch_stac925x(struct hda_codec *codec)
2544 codec->spec = spec; 2490 codec->spec = spec;
2545 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 2491 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
2546 spec->pin_nids = stac925x_pin_nids; 2492 spec->pin_nids = stac925x_pin_nids;
2547 spec->no_vol_knob = 1;
2548 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 2493 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
2549 stac925x_models, 2494 stac925x_models,
2550 stac925x_cfg_tbl); 2495 stac925x_cfg_tbl);
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 5d601ad6da70..abac62866da8 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -725,7 +725,8 @@ static int cs4270_probe(struct platform_device *pdev)
725 codec->owner = THIS_MODULE; 725 codec->owner = THIS_MODULE;
726 codec->dai = &cs4270_dai; 726 codec->dai = &cs4270_dai;
727 codec->num_dai = 1; 727 codec->num_dai = 1;
728 codec->private_data = codec + ALIGN(sizeof(struct snd_soc_codec), 4); 728 codec->private_data = (void *) codec +
729 ALIGN(sizeof(struct snd_soc_codec), 4);
729 730
730 socdev->codec = codec; 731 socdev->codec = codec;
731 732
diff --git a/sound/soc/s3c24xx/s3c2443-ac97.c b/sound/soc/s3c24xx/s3c2443-ac97.c
index 75acf7ef5528..758a2637e7ac 100644
--- a/sound/soc/s3c24xx/s3c2443-ac97.c
+++ b/sound/soc/s3c24xx/s3c2443-ac97.c
@@ -32,7 +32,7 @@
32 32
33#include <asm/hardware.h> 33#include <asm/hardware.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/arch/regs-ac97.h> 35#include <asm/plat-s3c/regs-ac97.h>
36#include <asm/arch/regs-gpio.h> 36#include <asm/arch/regs-gpio.h>
37#include <asm/arch/regs-clock.h> 37#include <asm/arch/regs-clock.h>
38#include <asm/arch/audio.h> 38#include <asm/arch/audio.h>