aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-02-23 23:38:20 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-23 23:38:20 -0500
commit8d3c202be23c5a915f7053ebd4e96f44700c6a62 (patch)
treee0f017aff86d3ad0b858fe85f44e11096087ed00
parent1b04ab4597725f75f94942da9aa40daa7b9a4bd9 (diff)
parent038eb0ea04b245351be34b0ae76b55eee4603989 (diff)
Merge branch 'master' of ../linux-2.6/
-rw-r--r--Documentation/00-INDEX2
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/filesystems.tmpl20
-rw-r--r--Documentation/DocBook/kernel-api.tmpl84
-rw-r--r--Documentation/DocBook/networking.tmpl106
-rw-r--r--Documentation/RCU/NMI-RCU.txt2
-rw-r--r--Documentation/SubmitChecklist16
-rw-r--r--Documentation/atomic_ops.txt3
-rw-r--r--Documentation/cgroups.txt66
-rw-r--r--Documentation/controllers/memory.txt24
-rw-r--r--Documentation/cpuidle/core.txt23
-rw-r--r--Documentation/cpuidle/driver.txt31
-rw-r--r--Documentation/cpuidle/governor.txt29
-rw-r--r--Documentation/cpuidle/sysfs.txt79
-rw-r--r--Documentation/cpusets.txt2
-rw-r--r--Documentation/hwmon/adt747379
-rw-r--r--Documentation/hwmon/coretemp6
-rw-r--r--Documentation/i386/IO-APIC.txt32
-rw-r--r--Documentation/ja_JP/stable_kernel_rules.txt106
-rw-r--r--Documentation/kernel-parameters.txt37
-rw-r--r--Documentation/kprobes.txt11
-rw-r--r--Documentation/laptops/thinkpad-acpi.txt63
-rw-r--r--Documentation/memory-barriers.txt2
-rw-r--r--Documentation/power/devices.txt13
-rw-r--r--Documentation/sched-rt-group.txt59
-rw-r--r--Documentation/stable_kernel_rules.txt7
-rw-r--r--Documentation/sysctl/kernel.txt2
-rw-r--r--Documentation/video4linux/CARDLIST.em28xx2
-rw-r--r--Documentation/video4linux/CARDLIST.saa71346
-rw-r--r--Documentation/video4linux/zr364xx.txt4
-rw-r--r--Documentation/vm/slabinfo.c2
-rw-r--r--MAINTAINERS54
-rw-r--r--Makefile15
-rw-r--r--arch/alpha/kernel/osf_sys.c4
-rw-r--r--arch/alpha/kernel/time.c15
-rw-r--r--arch/arm/mach-orion/ts209-setup.c15
-rw-r--r--arch/arm/mach-pxa/clock.c23
-rw-r--r--arch/arm/mach-pxa/cpu-pxa.c8
-rw-r--r--arch/blackfin/kernel/time.c8
-rw-r--r--arch/blackfin/kernel/traps.c12
-rw-r--r--arch/cris/arch-v10/lib/memset.c397
-rw-r--r--arch/cris/arch-v32/lib/memset.c398
-rw-r--r--arch/frv/kernel/entry.S4
-rw-r--r--arch/frv/kernel/time.c6
-rw-r--r--arch/frv/kernel/vmlinux.lds.S7
-rw-r--r--arch/h8300/defconfig263
-rw-r--r--arch/h8300/kernel/irq.c4
-rw-r--r--arch/h8300/kernel/signal.c4
-rw-r--r--arch/h8300/platform/h8300h/Makefile2
-rw-r--r--arch/h8300/platform/h8300h/irq.c82
-rw-r--r--arch/h8300/platform/h8s/ints.c304
-rw-r--r--arch/h8300/platform/h8s/irq.c (renamed from arch/h8300/platform/h8s/ints_h8s.c)8
-rw-r--r--arch/m68knommu/kernel/time.c12
-rw-r--r--arch/m68knommu/platform/5206/Makefile4
-rw-r--r--arch/m68knommu/platform/5206e/Makefile4
-rw-r--r--arch/m68knommu/platform/520x/Makefile4
-rw-r--r--arch/m68knommu/platform/523x/Makefile4
-rw-r--r--arch/m68knommu/platform/5249/Makefile4
-rw-r--r--arch/m68knommu/platform/5272/Makefile4
-rw-r--r--arch/m68knommu/platform/527x/Makefile4
-rw-r--r--arch/m68knommu/platform/528x/Makefile4
-rw-r--r--arch/m68knommu/platform/5307/Makefile4
-rw-r--r--arch/m68knommu/platform/532x/Makefile4
-rw-r--r--arch/m68knommu/platform/5407/Makefile4
-rw-r--r--arch/m68knommu/platform/coldfire/Makefile4
-rw-r--r--arch/m68knommu/platform/coldfire/entry.S9
-rw-r--r--arch/m68knommu/platform/coldfire/timers.c17
-rw-r--r--arch/mips/bcm47xx/setup.c12
-rw-r--r--arch/mips/bcm47xx/wgt634u.c71
-rw-r--r--arch/mips/configs/bcm47xx_defconfig1939
-rw-r--r--arch/mips/configs/ip28_defconfig891
-rw-r--r--arch/mips/configs/qemu_defconfig800
-rw-r--r--arch/mips/kernel/irq-rm7000.c1
-rw-r--r--arch/mips/kernel/irq-rm9000.c1
-rw-r--r--arch/mips/kernel/mips-mt-fpaff.c2
-rw-r--r--arch/mips/kernel/scall32-o32.S3
-rw-r--r--arch/mips/kernel/scall64-64.S3
-rw-r--r--arch/mips/kernel/scall64-n32.S3
-rw-r--r--arch/mips/kernel/scall64-o32.S3
-rw-r--r--arch/mips/kernel/sysirix.c14
-rw-r--r--arch/mips/mm/c-r4k.c9
-rw-r--r--arch/mips/mm/cache.c15
-rw-r--r--arch/mips/mm/init.c9
-rw-r--r--arch/mips/mm/pg-sb1.c14
-rw-r--r--arch/mips/pci/pci.c14
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c1
-rw-r--r--arch/mn10300/Kconfig4
-rw-r--r--arch/mn10300/configs/asb2303_defconfig33
-rw-r--r--arch/mn10300/kernel/gdb-io-ttysm.c2
-rw-r--r--arch/mn10300/kernel/time.c4
-rw-r--r--arch/mn10300/kernel/traps.c2
-rw-r--r--arch/parisc/hpux/sys_hpux.c4
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/boot/Makefile10
-rw-r--r--arch/powerpc/boot/dts/bamboo.dts3
-rw-r--r--arch/powerpc/boot/dts/ebony.dts2
-rw-r--r--arch/powerpc/boot/dts/katmai.dts2
-rw-r--r--arch/powerpc/boot/dts/kilauea.dts3
-rw-r--r--arch/powerpc/boot/dts/makalu.dts3
-rw-r--r--arch/powerpc/boot/dts/rainier.dts4
-rw-r--r--arch/powerpc/boot/dts/sequoia.dts4
-rw-r--r--arch/powerpc/boot/dts/taishan.dts4
-rw-r--r--arch/powerpc/boot/ps3-hvcall.S2
-rw-r--r--arch/powerpc/configs/bamboo_defconfig81
-rw-r--r--arch/powerpc/configs/ebony_defconfig79
-rw-r--r--arch/powerpc/configs/ep405_defconfig92
-rw-r--r--arch/powerpc/configs/kilauea_defconfig69
-rw-r--r--arch/powerpc/configs/makalu_defconfig69
-rw-r--r--arch/powerpc/configs/ppc44x_defconfig904
-rw-r--r--arch/powerpc/configs/rainier_defconfig82
-rw-r--r--arch/powerpc/configs/sequoia_defconfig77
-rw-r--r--arch/powerpc/configs/taishan_defconfig81
-rw-r--r--arch/powerpc/configs/walnut_defconfig81
-rw-r--r--arch/powerpc/configs/warp_defconfig139
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/kprobes.c9
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/prom.c13
-rw-r--r--arch/powerpc/kernel/vdso.c12
-rw-r--r--arch/powerpc/oprofile/cell/spu_task_sync.c15
-rw-r--r--arch/powerpc/platforms/44x/Kconfig10
-rw-r--r--arch/powerpc/platforms/512x/Kconfig1
-rw-r--r--arch/powerpc/platforms/52xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/Kconfig2
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype4
-rw-r--r--arch/powerpc/platforms/cell/ras.c11
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c12
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c18
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c8
-rw-r--r--arch/powerpc/platforms/cell/spufs/sputrace.c31
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c6
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig4
-rw-r--r--arch/powerpc/platforms/iseries/vio.c2
-rw-r--r--arch/powerpc/platforms/pasemi/Makefile2
-rw-r--r--arch/powerpc/platforms/pasemi/misc.c97
-rw-r--r--arch/powerpc/platforms/pseries/power.c2
-rw-r--r--arch/powerpc/sysdev/mpic_pasemi_msi.c5
-rw-r--r--arch/ppc/platforms/4xx/ibm440ep.c6
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/kernel/process.c15
-rw-r--r--arch/s390/kernel/smp.c53
-rw-r--r--arch/s390/kernel/time.c2
-rw-r--r--arch/s390/lib/uaccess_std.c8
-rw-r--r--arch/sh/Kconfig19
-rw-r--r--arch/sh/Kconfig.cpu4
-rw-r--r--arch/sh/Kconfig.debug3
-rw-r--r--arch/sh/Makefile1
-rw-r--r--arch/sh/boards/renesas/migor/Makefile1
-rw-r--r--arch/sh/boards/renesas/migor/setup.c61
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c47
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c45
-rw-r--r--arch/sh/boards/renesas/sdk7780/Kconfig7
-rw-r--r--arch/sh/cchips/hd6446x/hd64465/setup.c47
-rw-r--r--arch/sh/configs/migor_defconfig824
-rw-r--r--arch/sh/configs/rts7751r2d1_defconfig340
-rw-r--r--arch/sh/configs/rts7751r2dplus_defconfig340
-rw-r--r--arch/sh/configs/se7705_defconfig1
-rw-r--r--arch/sh/drivers/dma/dma-api.c2
-rw-r--r--arch/sh/drivers/pci/fixups-lboxre2.c4
-rw-r--r--arch/sh/drivers/pci/fixups-rts7751r2d.c4
-rw-r--r--arch/sh/drivers/pci/ops-dreamcast.c44
-rw-r--r--arch/sh/drivers/pci/ops-rts7751r2d.c3
-rw-r--r--arch/sh/drivers/pci/pci-sh4.h4
-rw-r--r--arch/sh/drivers/pci/pci-sh7751.c16
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.c2
-rw-r--r--arch/sh/kernel/Makefile_321
-rw-r--r--arch/sh/kernel/Makefile_641
-rw-r--r--arch/sh/kernel/cpu/irq/Makefile1
-rw-r--r--arch/sh/kernel/cpu/irq/intc-sh5.c27
-rw-r--r--arch/sh/kernel/cpu/irq/maskreg.c93
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c8
-rw-r--r--arch/sh/kernel/cpu/sh4a/Makefile2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c10
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c177
-rw-r--r--arch/sh/kernel/cpu/sh5/probe.c61
-rw-r--r--arch/sh/kernel/io.c8
-rw-r--r--arch/sh/kernel/io_generic.c24
-rw-r--r--arch/sh/kernel/io_trapped.c276
-rw-r--r--arch/sh/kernel/irq.c3
-rw-r--r--arch/sh/kernel/process_64.c9
-rw-r--r--arch/sh/kernel/ptrace_32.c4
-rw-r--r--arch/sh/kernel/setup.c2
-rw-r--r--arch/sh/kernel/syscalls_32.S4
-rw-r--r--arch/sh/kernel/syscalls_64.S4
-rw-r--r--arch/sh/kernel/time_32.c19
-rw-r--r--arch/sh/kernel/time_64.c31
-rw-r--r--arch/sh/kernel/timers/timer-cmt.c9
-rw-r--r--arch/sh/kernel/timers/timer-mtu2.c3
-rw-r--r--arch/sh/kernel/traps_32.c164
-rw-r--r--arch/sh/kernel/traps_64.c4
-rw-r--r--arch/sh/kernel/vmlinux_64.lds.S2
-rw-r--r--arch/sh/mm/cache-sh5.c1019
-rw-r--r--arch/sh/mm/consistent.c32
-rw-r--r--arch/sh/mm/fault_32.c11
-rw-r--r--arch/sh/mm/init.c2
-rw-r--r--arch/sh/tools/mach-types2
-rw-r--r--arch/sparc/kernel/pcic.c2
-rw-r--r--arch/sparc/kernel/process.c6
-rw-r--r--arch/sparc/kernel/setup.c4
-rw-r--r--arch/sparc/kernel/time.c7
-rw-r--r--arch/sparc/mm/sun4c.c4
-rw-r--r--arch/sparc/prom/misc.c7
-rw-r--r--arch/sparc64/Kconfig.debug4
-rw-r--r--arch/sparc64/Makefile36
-rw-r--r--arch/sparc64/defconfig33
-rw-r--r--arch/sparc64/kernel/iommu.c3
-rw-r--r--arch/sparc64/kernel/pci.c21
-rw-r--r--arch/sparc64/kernel/process.c15
-rw-r--r--arch/sparc64/kernel/prom.c1
-rw-r--r--arch/sparc64/kernel/setup.c29
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c3
-rw-r--r--arch/sparc64/kernel/unaligned.c3
-rw-r--r--arch/sparc64/mm/init.c49
-rw-r--r--arch/sparc64/prom/misc.c9
-rw-r--r--arch/sparc64/solaris/fs.c12
-rw-r--r--arch/um/defconfig280
-rw-r--r--arch/um/drivers/harddog_user.c4
-rw-r--r--arch/um/drivers/mconsole_kern.c6
-rw-r--r--arch/um/include/registers.h2
-rw-r--r--arch/um/include/sysdep-i386/ptrace_user.h3
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace_user.h3
-rw-r--r--arch/um/kernel/initrd.c2
-rw-r--r--arch/um/kernel/mem.c6
-rw-r--r--arch/um/os-Linux/skas/process.c15
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c16
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c10
-rw-r--r--arch/um/sys-i386/user-offsets.c27
-rw-r--r--arch/um/sys-x86_64/user-offsets.c28
-rw-r--r--arch/x86/Kconfig6
-rw-r--r--arch/x86/Kconfig.debug2
-rw-r--r--arch/x86/Makefile2
-rw-r--r--arch/x86/kernel/Makefile10
-rw-r--r--arch/x86/kernel/acpi/boot.c3
-rw-r--r--arch/x86/kernel/acpi/cstate.c2
-rw-r--r--arch/x86/kernel/asm-offsets_32.c6
-rw-r--r--arch/x86/kernel/cpu/bugs.c8
-rw-r--r--arch/x86/kernel/efi.c16
-rw-r--r--arch/x86/kernel/efi_32.c1
-rw-r--r--arch/x86/kernel/efi_64.c32
-rw-r--r--arch/x86/kernel/entry_32.S2
-rw-r--r--arch/x86/kernel/entry_64.S2
-rw-r--r--arch/x86/kernel/head64.c3
-rw-r--r--arch/x86/kernel/head_32.S2
-rw-r--r--arch/x86/kernel/head_64.S9
-rw-r--r--arch/x86/kernel/i387.c2
-rw-r--r--arch/x86/kernel/i8253.c2
-rw-r--r--arch/x86/kernel/i8259_32.c25
-rw-r--r--arch/x86/kernel/io_delay.c1
-rw-r--r--arch/x86/kernel/kprobes.c4
-rw-r--r--arch/x86/kernel/nmi_32.c21
-rw-r--r--arch/x86/kernel/nmi_64.c21
-rw-r--r--arch/x86/kernel/pci-gart_64.c9
-rw-r--r--arch/x86/kernel/ptrace.c4
-rw-r--r--arch/x86/kernel/reboot.c46
-rw-r--r--arch/x86/kernel/setup_32.c1
-rw-r--r--arch/x86/kernel/setup_64.c6
-rw-r--r--arch/x86/kernel/test_rodata.c2
-rw-r--r--arch/x86/kernel/topology.c2
-rw-r--r--arch/x86/kernel/traps_64.c4
-rw-r--r--arch/x86/kernel/vmlinux_32.lds.S26
-rw-r--r--arch/x86/kernel/vmlinux_64.lds.S30
-rw-r--r--arch/x86/lib/csum-wrappers_64.c147
-rw-r--r--arch/x86/lib/io_64.c18
-rw-r--r--arch/x86/mm/fault.c2
-rw-r--r--arch/x86/mm/init_32.c1
-rw-r--r--arch/x86/mm/init_64.c28
-rw-r--r--arch/x86/mm/ioremap.c30
-rw-r--r--arch/x86/mm/numa_64.c5
-rw-r--r--arch/x86/mm/pageattr.c253
-rw-r--r--arch/x86/mm/srat_64.c3
-rw-r--r--arch/x86/pci/common.c2
-rw-r--r--arch/x86/pci/irq.c4
-rw-r--r--arch/x86/power/hibernate_asm_64.S5
-rw-r--r--arch/x86/xen/enlighten.c4
-rw-r--r--arch/xtensa/Makefile2
-rw-r--r--arch/xtensa/boot/boot-elf/Makefile9
-rw-r--r--arch/xtensa/boot/boot-elf/boot.lds.S (renamed from arch/xtensa/boot/boot-elf/boot.ld)4
-rw-r--r--arch/xtensa/boot/boot-redboot/Makefile2
-rw-r--r--arch/xtensa/boot/boot-redboot/boot.ld2
-rw-r--r--arch/xtensa/kernel/asm-offsets.c17
-rw-r--r--arch/xtensa/kernel/coprocessor.S443
-rw-r--r--arch/xtensa/kernel/entry.S355
-rw-r--r--arch/xtensa/kernel/module.c2
-rw-r--r--arch/xtensa/kernel/process.c306
-rw-r--r--arch/xtensa/kernel/ptrace.c351
-rw-r--r--arch/xtensa/kernel/setup.c5
-rw-r--r--arch/xtensa/kernel/signal.c89
-rw-r--r--arch/xtensa/kernel/traps.c20
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S6
-rw-r--r--arch/xtensa/mm/cache.c7
-rw-r--r--arch/xtensa/mm/init.c2
-rw-r--r--arch/xtensa/mm/misc.S2
-rw-r--r--arch/xtensa/platforms/iss/Makefile (renamed from arch/xtensa/platform-iss/Makefile)0
-rw-r--r--arch/xtensa/platforms/iss/console.c (renamed from arch/xtensa/platform-iss/console.c)1
-rw-r--r--arch/xtensa/platforms/iss/io.c (renamed from arch/xtensa/platform-iss/io.c)0
-rw-r--r--arch/xtensa/platforms/iss/network.c (renamed from arch/xtensa/platform-iss/network.c)2
-rw-r--r--arch/xtensa/platforms/iss/setup.c (renamed from arch/xtensa/platform-iss/setup.c)0
-rw-r--r--block/blk-core.c4
-rw-r--r--block/blk-ioc.c37
-rw-r--r--block/blk-map.c20
-rw-r--r--block/blk-merge.c6
-rw-r--r--block/blk-settings.c9
-rw-r--r--block/bsg.c8
-rw-r--r--block/cfq-iosched.c38
-rw-r--r--block/elevator.c15
-rw-r--r--block/scsi_ioctl.c3
-rw-r--r--crypto/Kconfig2
-rw-r--r--drivers/acpi/blacklist.c64
-rw-r--r--drivers/acpi/ec.c6
-rw-r--r--drivers/acpi/event.c2
-rw-r--r--drivers/acpi/executer/exregion.c5
-rw-r--r--drivers/acpi/fan.c30
-rw-r--r--drivers/acpi/hardware/hwsleep.c1
-rw-r--r--drivers/acpi/osl.c22
-rw-r--r--drivers/acpi/processor_core.c39
-rw-r--r--drivers/acpi/processor_idle.c29
-rw-r--r--drivers/acpi/utils.c18
-rw-r--r--drivers/acpi/video.c3
-rw-r--r--drivers/acpi/wmi.c2
-rw-r--r--drivers/ata/ahci.c7
-rw-r--r--drivers/ata/ata_piix.c4
-rw-r--r--drivers/ata/libata-core.c633
-rw-r--r--drivers/ata/libata-eh.c8
-rw-r--r--drivers/ata/libata-scsi.c74
-rw-r--r--drivers/ata/libata.h1
-rw-r--r--drivers/ata/pata_acpi.c4
-rw-r--r--drivers/ata/pata_amd.c7
-rw-r--r--drivers/ata/pata_cs5536.c10
-rw-r--r--drivers/ata/pata_icside.c8
-rw-r--r--drivers/ata/pata_jmicron.c3
-rw-r--r--drivers/ata/pata_legacy.c46
-rw-r--r--drivers/ata/pata_marvell.c4
-rw-r--r--drivers/ata/pata_scc.c2
-rw-r--r--drivers/ata/sata_fsl.c13
-rw-r--r--drivers/ata/sata_mv.c19
-rw-r--r--drivers/ata/sata_promise.c2
-rw-r--r--drivers/ata/sata_sil24.c5
-rw-r--r--drivers/ata/sata_via.c4
-rw-r--r--drivers/base/bus.c9
-rw-r--r--drivers/base/driver.c3
-rw-r--r--drivers/base/power/main.c4
-rw-r--r--drivers/block/nbd.c6
-rw-r--r--drivers/block/swim3.c4
-rw-r--r--drivers/block/xen-blkfront.c18
-rw-r--r--drivers/char/agp/amd-k7-agp.c9
-rw-r--r--drivers/char/agp/ati-agp.c16
-rw-r--r--drivers/char/agp/generic.c9
-rw-r--r--drivers/char/agp/sis-agp.c47
-rw-r--r--drivers/char/agp/sworks-agp.c18
-rw-r--r--drivers/char/drm/drmP.h2
-rw-r--r--drivers/char/drm/drm_pciids.h3
-rw-r--r--drivers/char/drm/drm_sysfs.c2
-rw-r--r--drivers/char/drm/drm_vm.c125
-rw-r--r--drivers/char/drm/i830_dma.c2
-rw-r--r--drivers/char/drm/i915_dma.c5
-rw-r--r--drivers/char/drm/i915_drv.c52
-rw-r--r--drivers/char/drm/i915_drv.h17
-rw-r--r--drivers/char/drm/radeon_cp.c81
-rw-r--r--drivers/char/drm/radeon_drv.h38
-rw-r--r--drivers/char/hvc_rtas.c2
-rw-r--r--drivers/char/pcmcia/Kconfig2
-rw-r--r--drivers/cpufreq/cpufreq.c8
-rw-r--r--drivers/cpuidle/cpuidle.c3
-rw-r--r--drivers/cpuidle/sysfs.c14
-rw-r--r--drivers/crypto/hifn_795x.c6
-rw-r--r--drivers/firmware/dmi_scan.c82
-rw-r--r--drivers/hid/hid-input-quirks.c17
-rw-r--r--drivers/hid/hid-input.c8
-rw-r--r--drivers/hid/usbhid/hid-quirks.c38
-rw-r--r--drivers/hwmon/Kconfig10
-rw-r--r--drivers/hwmon/Makefile1
-rw-r--r--drivers/hwmon/ad7418.c2
-rw-r--r--drivers/hwmon/adm1021.c6
-rw-r--r--drivers/hwmon/adm1025.c2
-rw-r--r--drivers/hwmon/adm1026.c4
-rw-r--r--drivers/hwmon/adm1029.c6
-rw-r--r--drivers/hwmon/adm1031.c2
-rw-r--r--drivers/hwmon/adm9240.c2
-rw-r--r--drivers/hwmon/ads7828.c2
-rw-r--r--drivers/hwmon/adt7470.c2
-rw-r--r--drivers/hwmon/adt7473.c1157
-rw-r--r--drivers/hwmon/applesmc.c29
-rw-r--r--drivers/hwmon/asb100.c2
-rw-r--r--drivers/hwmon/atxp1.c2
-rw-r--r--drivers/hwmon/coretemp.c119
-rw-r--r--drivers/hwmon/dme1737.c2
-rw-r--r--drivers/hwmon/ds1621.c2
-rw-r--r--drivers/hwmon/f75375s.c2
-rw-r--r--drivers/hwmon/fscher.c2
-rw-r--r--drivers/hwmon/fschmd.c2
-rw-r--r--drivers/hwmon/fscpos.c2
-rw-r--r--drivers/hwmon/gl518sm.c2
-rw-r--r--drivers/hwmon/gl520sm.c2
-rw-r--r--drivers/hwmon/lm63.c2
-rw-r--r--drivers/hwmon/lm75.c2
-rw-r--r--drivers/hwmon/lm77.c3
-rw-r--r--drivers/hwmon/lm78.c4
-rw-r--r--drivers/hwmon/lm80.c4
-rw-r--r--drivers/hwmon/lm83.c6
-rw-r--r--drivers/hwmon/lm85.c2
-rw-r--r--drivers/hwmon/lm87.c2
-rw-r--r--drivers/hwmon/lm90.c6
-rw-r--r--drivers/hwmon/lm92.c20
-rw-r--r--drivers/hwmon/lm93.c2
-rw-r--r--drivers/hwmon/max1619.c23
-rw-r--r--drivers/hwmon/max6650.c3
-rw-r--r--drivers/hwmon/smsc47m1.c25
-rw-r--r--drivers/hwmon/smsc47m192.c2
-rw-r--r--drivers/hwmon/thmc50.c8
-rw-r--r--drivers/hwmon/via686a.c28
-rw-r--r--drivers/hwmon/vt8231.c44
-rw-r--r--drivers/hwmon/w83781d.c4
-rw-r--r--drivers/hwmon/w83791d.c3
-rw-r--r--drivers/hwmon/w83792d.c3
-rw-r--r--drivers/hwmon/w83793.c3
-rw-r--r--drivers/hwmon/w83l785ts.c2
-rw-r--r--drivers/hwmon/w83l786ng.c2
-rw-r--r--drivers/i2c/busses/i2c-pxa.c4
-rw-r--r--drivers/ide/ide-cd.c6
-rw-r--r--drivers/ide/ide-disk.c1
-rw-r--r--drivers/ide/ide-generic.c6
-rw-r--r--drivers/ide/ide.c2
-rw-r--r--drivers/ide/legacy/falconide.c4
-rw-r--r--drivers/ide/legacy/ht6560b.c25
-rw-r--r--drivers/ide/legacy/macide.c2
-rw-r--r--drivers/ide/pci/via82cxxx.c1
-rw-r--r--drivers/ide/ppc/pmac.c4
-rw-r--r--drivers/infiniband/core/cm.c26
-rw-r--r--drivers/infiniband/core/cma.c10
-rw-r--r--drivers/infiniband/core/sysfs.c4
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c17
-rw-r--r--drivers/infiniband/hw/mlx4/mr.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_memfree.c1
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c2
-rw-r--r--drivers/infiniband/hw/nes/nes_nic.c62
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c10
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c1
-rw-r--r--drivers/macintosh/mediabay.c5
-rw-r--r--drivers/md/bitmap.c8
-rw-r--r--drivers/md/dm-raid1.c9
-rw-r--r--drivers/md/dm-table.c4
-rw-r--r--drivers/md/md.c3
-rw-r--r--drivers/media/Kconfig18
-rw-r--r--drivers/media/common/Kconfig2
-rw-r--r--drivers/media/common/ir-keymaps.c46
-rw-r--r--drivers/media/common/saa7146_vbi.c1
-rw-r--r--drivers/media/common/saa7146_video.c2
-rw-r--r--drivers/media/dvb/bt8xx/bt878.c23
-rw-r--r--drivers/media/dvb/dvb-usb/ttusb2.c1
-rw-r--r--drivers/media/dvb/frontends/tda10086.c28
-rw-r--r--drivers/media/dvb/frontends/tda10086.h3
-rw-r--r--drivers/media/dvb/frontends/tda18271-common.c2
-rw-r--r--drivers/media/dvb/frontends/xc5000.h3
-rw-r--r--drivers/media/dvb/ttpci/av7110_av.c15
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c8
-rw-r--r--drivers/media/dvb/ttpci/budget.c1
-rw-r--r--drivers/media/radio/Kconfig4
-rw-r--r--drivers/media/radio/radio-sf16fmi.c1
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c5
-rw-r--r--drivers/media/radio/radio-si470x.c597
-rw-r--r--drivers/media/video/Kconfig4
-rw-r--r--drivers/media/video/Makefile5
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c51
-rw-r--r--drivers/media/video/bt8xx/bttv-vbi.c4
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c16
-rw-r--r--drivers/media/video/cx88/cx88.h1
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c6
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c8
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c111
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c79
-rw-r--r--drivers/media/video/em28xx/em28xx.h5
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c123
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c28
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c6
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c6
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c20
-rw-r--r--drivers/media/video/saa7134/saa7134.h2
-rw-r--r--drivers/media/video/stk-sensor.c23
-rw-r--r--drivers/media/video/stk-webcam.c104
-rw-r--r--drivers/media/video/stk-webcam.h3
-rw-r--r--drivers/media/video/tcm825x.c2
-rw-r--r--drivers/media/video/tuner-core.c2
-rw-r--r--drivers/media/video/tuner-xc2028.c3
-rw-r--r--drivers/media/video/tvaudio.c10
-rw-r--r--drivers/media/video/tveeprom.c2
-rw-r--r--drivers/media/video/v4l2-common.c393
-rw-r--r--drivers/media/video/videobuf-core.c78
-rw-r--r--drivers/media/video/videobuf-dma-sg.c4
-rw-r--r--drivers/media/video/videobuf-vmalloc.c20
-rw-r--r--drivers/media/video/videodev.c444
-rw-r--r--drivers/media/video/zoran.h22
-rw-r--r--drivers/media/video/zoran_device.c12
-rw-r--r--drivers/media/video/zr364xx.c2
-rw-r--r--drivers/memstick/host/tifm_ms.c2
-rw-r--r--drivers/message/fusion/mptbase.c54
-rw-r--r--drivers/message/fusion/mptbase.h3
-rw-r--r--drivers/misc/Kconfig17
-rw-r--r--drivers/misc/acer-wmi.c9
-rw-r--r--drivers/misc/intel_menlow.c11
-rw-r--r--drivers/misc/thinkpad_acpi.c127
-rw-r--r--drivers/mtd/mtdsuper.c14
-rw-r--r--drivers/net/ibm_newemac/rgmii.c1
-rw-r--r--drivers/net/mlx4/mr.c21
-rw-r--r--drivers/oprofile/buffer_sync.c21
-rw-r--r--drivers/parport/parport_pc.c4
-rw-r--r--drivers/pci/dmar.c9
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c6
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c33
-rw-r--r--drivers/pci/intel-iommu.c7
-rw-r--r--drivers/pci/intel-iommu.h5
-rw-r--r--drivers/pci/iova.c3
-rw-r--r--drivers/pci/iova.h3
-rw-r--r--drivers/pci/pci-acpi.c3
-rw-r--r--drivers/pci/pci.c1
-rw-r--r--drivers/pci/proc.c2
-rw-r--r--drivers/pci/quirks.c79
-rw-r--r--drivers/pci/setup-bus.c6
-rw-r--r--drivers/pcmcia/i82092.c7
-rw-r--r--drivers/pnp/pnpacpi/core.c2
-rw-r--r--drivers/pnp/pnpbios/core.c2
-rw-r--r--drivers/ps3/ps3-lpm.c22
-rw-r--r--drivers/ps3/ps3-sys-manager.c44
-rw-r--r--drivers/rtc/rtc-cmos.c2
-rw-r--r--drivers/s390/block/dasd.c12
-rw-r--r--drivers/s390/block/dcssblk.c2
-rw-r--r--drivers/s390/char/sclp.c12
-rw-r--r--drivers/s390/char/sclp.h6
-rw-r--r--drivers/s390/char/sclp_config.c2
-rw-r--r--drivers/s390/char/sclp_cpi_sys.c2
-rw-r--r--drivers/s390/char/sclp_rw.c4
-rw-r--r--drivers/s390/char/sclp_vt220.c2
-rw-r--r--drivers/s390/cio/device.c15
-rw-r--r--drivers/s390/cio/qdio.c13
-rw-r--r--drivers/s390/cio/qdio.h2
-rw-r--r--drivers/scsi/Kconfig12
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/aacraid/aachba.c70
-rw-r--r--drivers/scsi/aacraid/aacraid.h2
-rw-r--r--drivers/scsi/aacraid/commsup.c2
-rw-r--r--drivers/scsi/aacraid/linit.c47
-rw-r--r--drivers/scsi/aacraid/rx.c5
-rw-r--r--drivers/scsi/aacraid/sa.c5
-rw-r--r--drivers/scsi/advansys.c13
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm_pci.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c11
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c2
-rw-r--r--drivers/scsi/aic94xx/aic94xx_sas.h2
-rw-r--r--drivers/scsi/aic94xx/aic94xx_scb.c14
-rw-r--r--drivers/scsi/aic94xx/aic94xx_tmf.c6
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c26
-rw-r--r--drivers/scsi/arm/fas216.c16
-rw-r--r--drivers/scsi/arm/fas216.h3
-rw-r--r--drivers/scsi/gdth.c16
-rw-r--r--drivers/scsi/gdth_proc.c6
-rw-r--r--drivers/scsi/ipr.c4
-rw-r--r--drivers/scsi/ips.c2
-rw-r--r--drivers/scsi/libsas/sas_ata.c4
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c68
-rw-r--r--drivers/scsi/lpfc/lpfc.h19
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c19
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h5
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c41
-rw-r--r--drivers/scsi/lpfc/lpfc_disc.h66
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c384
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c328
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h18
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c154
-rw-r--r--drivers/scsi/lpfc/lpfc_logmsg.h10
-rw-r--r--drivers/scsi/lpfc/lpfc_mem.c13
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c55
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c115
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.c70
-rw-r--r--drivers/scsi/megaraid.c10
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.c20
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.h1
-rw-r--r--drivers/scsi/mesh.c1
-rw-r--r--drivers/scsi/mvsas.c2970
-rw-r--r--drivers/scsi/qla2xxx/qla_dfs.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_isr.c3
-rw-r--r--drivers/scsi/qlogicpti.c12
-rw-r--r--drivers/scsi/scsi_debug.c2
-rw-r--r--drivers/scsi/scsi_lib.c8
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c4
-rw-r--r--drivers/scsi/sd.c3
-rw-r--r--drivers/scsi/ses.c147
-rw-r--r--drivers/scsi/st.c11
-rw-r--r--drivers/scsi/st.h1
-rw-r--r--drivers/scsi/stex.c44
-rw-r--r--drivers/scsi/sym53c416.c16
-rw-r--r--drivers/serial/atmel_serial.c2
-rw-r--r--drivers/serial/sh-sci.c2
-rw-r--r--drivers/serial/sh-sci.h9
-rw-r--r--drivers/sh/maple/maple.c981
-rw-r--r--drivers/spi/atmel_spi.c10
-rw-r--r--drivers/spi/pxa2xx_spi.c41
-rw-r--r--drivers/thermal/thermal.c39
-rw-r--r--drivers/uio/uio.c54
-rw-r--r--drivers/usb/class/cdc-acm.c10
-rw-r--r--drivers/usb/class/usblp.c1
-rw-r--r--drivers/usb/core/quirks.c12
-rw-r--r--drivers/usb/gadget/ether.c1
-rw-r--r--drivers/usb/gadget/file_storage.c8
-rw-r--r--drivers/usb/gadget/printer.c2
-rw-r--r--drivers/usb/host/Kconfig5
-rw-r--r--drivers/usb/host/ehci-hcd.c26
-rw-r--r--drivers/usb/host/sl811-hcd.c1
-rw-r--r--drivers/usb/host/u132-hcd.c15
-rw-r--r--drivers/usb/misc/ldusb.c2
-rw-r--r--drivers/usb/misc/trancevibrator.c4
-rw-r--r--drivers/usb/serial/ftdi_sio.c4
-rw-r--r--drivers/usb/serial/option.c43
-rw-r--r--drivers/usb/serial/sierra.c1
-rw-r--r--drivers/usb/storage/protocol.c27
-rw-r--r--drivers/usb/storage/transport.c11
-rw-r--r--drivers/usb/storage/unusual_devs.h34
-rw-r--r--drivers/video/aty/atyfb_base.c64
-rw-r--r--drivers/video/cg14.c1
-rw-r--r--drivers/video/chipsfb.c2
-rw-r--r--drivers/video/nvidia/nvidia.c2
-rw-r--r--drivers/video/pxafb.c8
-rw-r--r--drivers/video/sbuslib.c1
-rw-r--r--drivers/video/uvesafb.c2
-rw-r--r--drivers/watchdog/Kconfig25
-rw-r--r--drivers/watchdog/Makefile2
-rw-r--r--drivers/watchdog/bfin_wdt.c7
-rw-r--r--drivers/watchdog/hpwdt.c926
-rw-r--r--drivers/watchdog/mtx-1_wdt.c35
-rw-r--r--drivers/watchdog/sb_wdog.c353
-rw-r--r--fs/afs/mntpt.c23
-rw-r--r--fs/autofs4/root.c5
-rw-r--r--fs/binfmt_flat.c8
-rw-r--r--fs/bio.c2
-rw-r--r--fs/block_dev.c207
-rw-r--r--fs/cifs/cifs_dfs_ref.c25
-rw-r--r--fs/coda/pioctl.c6
-rw-r--r--fs/compat.c11
-rw-r--r--fs/compat_ioctl.c2
-rw-r--r--fs/configfs/symlink.c8
-rw-r--r--fs/dcache.c103
-rw-r--r--fs/dcookies.c34
-rw-r--r--fs/dlm/rcom.c2
-rw-r--r--fs/dquot.c9
-rw-r--r--fs/ecryptfs/dentry.c12
-rw-r--r--fs/ecryptfs/inode.c24
-rw-r--r--fs/ecryptfs/main.c6
-rw-r--r--fs/efs/dir.c2
-rw-r--r--fs/efs/efs.h140
-rw-r--r--fs/efs/file.c2
-rw-r--r--fs/efs/inode.c4
-rw-r--r--fs/efs/namei.c2
-rw-r--r--fs/efs/super.c7
-rw-r--r--fs/efs/symlink.c2
-rw-r--r--fs/exec.c8
-rw-r--r--fs/ext3/super.c8
-rw-r--r--fs/ext4/super.c8
-rw-r--r--fs/fuse/dir.c2
-rw-r--r--fs/gfs2/ops_fstype.c7
-rw-r--r--fs/inotify_user.c12
-rw-r--r--fs/lockd/svc.c2
-rw-r--r--fs/namei.c311
-rw-r--r--fs/namespace.c268
-rw-r--r--fs/nfs/callback.c21
-rw-r--r--fs/nfs/callback_xdr.c6
-rw-r--r--fs/nfs/delegation.c2
-rw-r--r--fs/nfs/dir.c8
-rw-r--r--fs/nfs/idmap.c2
-rw-r--r--fs/nfs/namespace.c29
-rw-r--r--fs/nfs/nfs4proc.c8
-rw-r--r--fs/nfs/nfs4state.c6
-rw-r--r--fs/nfs/super.c4
-rw-r--r--fs/nfsctl.c4
-rw-r--r--fs/nfsd/export.c122
-rw-r--r--fs/nfsd/nfs3proc.c2
-rw-r--r--fs/nfsd/nfs3xdr.c4
-rw-r--r--fs/nfsd/nfs4recover.c34
-rw-r--r--fs/nfsd/nfs4state.c4
-rw-r--r--fs/nfsd/nfs4xdr.c12
-rw-r--r--fs/nfsd/nfsfh.c28
-rw-r--r--fs/nfsd/nfsproc.c6
-rw-r--r--fs/nfsd/nfsxdr.c2
-rw-r--r--fs/nfsd/vfs.c13
-rw-r--r--fs/open.c61
-rw-r--r--fs/pipe.c10
-rw-r--r--fs/proc/base.c62
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/nommu.c2
-rw-r--r--fs/proc/proc_sysctl.c2
-rw-r--r--fs/proc/task_mmu.c10
-rw-r--r--fs/proc/task_nommu.c6
-rw-r--r--fs/reiserfs/super.c14
-rw-r--r--fs/seq_file.c6
-rw-r--r--fs/smbfs/inode.c2
-rw-r--r--fs/stat.c19
-rw-r--r--fs/udf/balloc.c2
-rw-r--r--fs/udf/dir.c14
-rw-r--r--fs/ufs/util.h2
-rw-r--r--fs/utimes.c4
-rw-r--r--fs/xattr.c32
-rw-r--r--fs/xfs/Kbuild6
-rw-r--r--fs/xfs/Makefile118
-rw-r--r--fs/xfs/Makefile-linux-2.6117
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c8
-rw-r--r--fs/xfs/quota/xfs_qm.c6
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c6
-rw-r--r--fs/xfs/xfs_alloc.c16
-rw-r--r--fs/xfs/xfs_alloc_btree.c16
-rw-r--r--fs/xfs/xfs_arch.h15
-rw-r--r--fs/xfs/xfs_attr_leaf.c46
-rw-r--r--fs/xfs/xfs_bmap_btree.c16
-rw-r--r--fs/xfs/xfs_da_btree.c14
-rw-r--r--fs/xfs/xfs_dir2_block.c8
-rw-r--r--fs/xfs/xfs_dir2_data.c4
-rw-r--r--fs/xfs/xfs_dir2_leaf.c16
-rw-r--r--fs/xfs/xfs_dir2_node.c18
-rw-r--r--fs/xfs/xfs_fsops.c4
-rw-r--r--fs/xfs/xfs_ialloc.c12
-rw-r--r--fs/xfs/xfs_ialloc_btree.c16
-rw-r--r--fs/xfs/xfs_log.c6
-rw-r--r--fs/xfs/xfs_trans.c24
-rw-r--r--include/acpi/acpiosxf.h2
-rw-r--r--include/acpi/processor.h9
-rw-r--r--include/asm-arm/arch-pxa/regs-ssp.h1
-rw-r--r--include/asm-arm/mach/arch.h2
-rw-r--r--include/asm-frv/unistd.h4
-rw-r--r--include/asm-generic/percpu.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h3
-rw-r--r--include/asm-h8300/hardirq.h2
-rw-r--r--include/asm-h8300/irq.h19
-rw-r--r--include/asm-h8300/uaccess.h4
-rw-r--r--include/asm-m68knommu/cacheflush.h14
-rw-r--r--include/asm-m68knommu/system.h2
-rw-r--r--include/asm-mips/mach-ip27/dma-coherence.h2
-rw-r--r--include/asm-mips/qemu.h30
-rw-r--r--include/asm-mips/sni.h7
-rw-r--r--include/asm-mips/unistd.h21
-rw-r--r--include/asm-mn10300/highmem.h4
-rw-r--r--include/asm-mn10300/linkage.h2
-rw-r--r--include/asm-mn10300/param.h2
-rw-r--r--include/asm-mn10300/socket.h2
-rw-r--r--include/asm-powerpc/percpu.h2
-rw-r--r--include/asm-powerpc/spu.h3
-rw-r--r--include/asm-powerpc/systbl.h4
-rw-r--r--include/asm-powerpc/unistd.h6
-rw-r--r--include/asm-ppc/page.h2
-rw-r--r--include/asm-s390/bitops.h20
-rw-r--r--include/asm-sh/bugs.h2
-rw-r--r--include/asm-sh/cpu-sh4/freq.h4
-rw-r--r--include/asm-sh/cpu-sh5/cacheflush.h6
-rw-r--r--include/asm-sh/cpu-sh5/mmu_context.h6
-rw-r--r--include/asm-sh/hp6xx.h28
-rw-r--r--include/asm-sh/io.h22
-rw-r--r--include/asm-sh/io_trapped.h58
-rw-r--r--include/asm-sh/ioctls.h4
-rw-r--r--include/asm-sh/irq.h4
-rw-r--r--include/asm-sh/mmu_context_64.h3
-rw-r--r--include/asm-sh/page.h7
-rw-r--r--include/asm-sh/pgtable_64.h13
-rw-r--r--include/asm-sh/processor.h2
-rw-r--r--include/asm-sh/r7780rp.h3
-rw-r--r--include/asm-sh/rts7751r2d.h3
-rw-r--r--include/asm-sh/system.h5
-rw-r--r--include/asm-sh/system_32.h3
-rw-r--r--include/asm-sh/termbits.h5
-rw-r--r--include/asm-sh/termios.h6
-rw-r--r--include/asm-sh/tlb.h1
-rw-r--r--include/asm-sh/uaccess.h29
-rw-r--r--include/asm-sh/uaccess_32.h24
-rw-r--r--include/asm-sh/uaccess_64.h19
-rw-r--r--include/asm-sh/unistd_32.h6
-rw-r--r--include/asm-sh/unistd_64.h6
-rw-r--r--include/asm-sparc64/ptrace.h1
-rw-r--r--include/asm-x86/cacheflush.h7
-rw-r--r--include/asm-x86/desc_64.h1
-rw-r--r--include/asm-x86/i387.h1
-rw-r--r--include/asm-x86/kdebug.h1
-rw-r--r--include/asm-x86/pgtable_64.h2
-rw-r--r--include/asm-x86/processor.h5
-rw-r--r--include/asm-x86/sigcontext.h66
-rw-r--r--include/asm-xtensa/cacheflush.h2
-rw-r--r--include/asm-xtensa/coprocessor.h214
-rw-r--r--include/asm-xtensa/elf.h110
-rw-r--r--include/asm-xtensa/module.h4
-rw-r--r--include/asm-xtensa/pgalloc.h2
-rw-r--r--include/asm-xtensa/pgtable.h8
-rw-r--r--include/asm-xtensa/processor.h13
-rw-r--r--include/asm-xtensa/ptrace.h44
-rw-r--r--include/asm-xtensa/regs.h9
-rw-r--r--include/asm-xtensa/sigcontext.h4
-rw-r--r--include/asm-xtensa/stat.h36
-rw-r--r--include/asm-xtensa/system.h39
-rw-r--r--include/asm-xtensa/thread_info.h21
-rw-r--r--include/asm-xtensa/timex.h8
-rw-r--r--include/asm-xtensa/uaccess.h99
-rw-r--r--include/asm-xtensa/variant-fsf/tie-asm.h70
-rw-r--r--include/asm-xtensa/variant-fsf/tie.h75
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/acpi.h1
-rw-r--r--include/linux/aio.h21
-rw-r--r--include/linux/audit.h5
-rw-r--r--include/linux/bio.h1
-rw-r--r--include/linux/blkdev.h8
-rw-r--r--include/linux/buffer_head.h6
-rw-r--r--include/linux/cgroup.h50
-rw-r--r--include/linux/cgroup_subsys.h2
-rw-r--r--include/linux/configfs.h1
-rw-r--r--include/linux/cpuidle.h2
-rw-r--r--include/linux/dcache.h5
-rw-r--r--include/linux/dcookies.h15
-rw-r--r--include/linux/efs_dir.h42
-rw-r--r--include/linux/efs_fs.h56
-rw-r--r--include/linux/efs_fs_i.h68
-rw-r--r--include/linux/etherdevice.h3
-rw-r--r--include/linux/file.h16
-rw-r--r--include/linux/fs.h7
-rw-r--r--include/linux/fs_struct.h10
-rw-r--r--include/linux/futex.h1
-rw-r--r--include/linux/gfp.h15
-rw-r--r--include/linux/hdsmart.h4
-rw-r--r--include/linux/hid.h2
-rw-r--r--include/linux/hugetlb.h2
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/interrupt.h8
-rw-r--r--include/linux/iocontext.h2
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/ktime.h2
-rw-r--r--include/linux/libata.h30
-rw-r--r--include/linux/linkage.h5
-rw-r--r--include/linux/maple.h100
-rw-r--r--include/linux/marker.h68
-rw-r--r--include/linux/memcontrol.h3
-rw-r--r--include/linux/mm.h12
-rw-r--r--include/linux/module.h5
-rw-r--r--include/linux/moduleparam.h12
-rw-r--r--include/linux/mutex-debug.h2
-rw-r--r--include/linux/namei.h17
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/nfsd/export.h8
-rw-r--r--include/linux/page-flags.h4
-rw-r--r--include/linux/pagemap.h10
-rw-r--r--include/linux/path.h15
-rw-r--r--include/linux/pci_ids.h7
-rw-r--r--include/linux/pid.h21
-rw-r--r--include/linux/pm.h9
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/rwsem-spinlock.h16
-rw-r--r--include/linux/sched.h32
-rw-r--r--include/linux/seq_file.h5
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/slub_def.h15
-rw-r--r--include/linux/swap.h8
-rw-r--r--include/linux/videodev.h1
-rw-r--r--include/linux/videodev2.h1
-rw-r--r--include/linux/wait.h34
-rw-r--r--include/linux/workqueue.h13
-rw-r--r--include/media/ir-common.h1
-rw-r--r--include/media/v4l2-common.h2
-rw-r--r--include/media/v4l2-dev.h2
-rw-r--r--include/media/videobuf-core.h2
-rw-r--r--include/media/videobuf-vmalloc.h2
-rw-r--r--include/scsi/scsi_host.h8
-rw-r--r--include/sound/opl3.h9
-rw-r--r--init/Kconfig31
-rw-r--r--init/do_mounts.c6
-rw-r--r--kernel/audit.c12
-rw-r--r--kernel/audit_tree.c28
-rw-r--r--kernel/auditfilter.c15
-rw-r--r--kernel/auditsc.c33
-rw-r--r--kernel/cgroup.c153
-rw-r--r--kernel/exit.c12
-rw-r--r--kernel/fork.c18
-rw-r--r--kernel/futex.c52
-rw-r--r--kernel/futex_compat.c11
-rw-r--r--kernel/hrtimer.c48
-rw-r--r--kernel/irq/chip.c20
-rw-r--r--kernel/irq/spurious.c3
-rw-r--r--kernel/kmod.c5
-rw-r--r--kernel/marker.c677
-rw-r--r--kernel/module.c14
-rw-r--r--kernel/posix-timers.c8
-rw-r--r--kernel/power/disk.c4
-rw-r--r--kernel/power/snapshot.c42
-rw-r--r--kernel/rcupdate.c5
-rw-r--r--kernel/rtmutex.c5
-rw-r--r--kernel/sched.c499
-rw-r--r--kernel/sched_rt.c102
-rw-r--r--kernel/signal.c2
-rw-r--r--kernel/sysctl.c36
-rw-r--r--kernel/time/timer_list.c4
-rw-r--r--kernel/timeconst.pl2
-rw-r--r--kernel/user.c50
-rw-r--r--lib/Kconfig.debug4
-rw-r--r--lib/vsprintf.c2
-rw-r--r--mm/filemap.c2
-rw-r--r--mm/hugetlb.c8
-rw-r--r--mm/internal.h13
-rw-r--r--mm/memcontrol.c5
-rw-r--r--mm/memory.c9
-rw-r--r--mm/mempolicy.c2
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/slab.c3
-rw-r--r--mm/slub.c175
-rw-r--r--mm/swapfile.c2
-rw-r--r--net/bluetooth/rfcomm/core.c4
-rw-r--r--net/core/dev.c5
-rw-r--r--net/core/skbuff.c4
-rw-r--r--net/core/sock.c4
-rw-r--r--net/rfkill/rfkill.c2
-rw-r--r--net/sunrpc/clnt.c10
-rw-r--r--net/sunrpc/rpc_pipe.c10
-rw-r--r--net/sunrpc/svcsock.c6
-rw-r--r--net/sunrpc/xprt.c2
-rw-r--r--net/unix/af_unix.c26
-rw-r--r--samples/markers/probe-example.c25
-rw-r--r--scripts/Makefile.modpost11
-rw-r--r--scripts/kconfig/symbol.c34
-rwxr-xr-xscripts/kernel-doc7
-rw-r--r--scripts/mod/modpost.c166
-rw-r--r--scripts/mod/modpost.h3
-rw-r--r--security/commoncap.c2
-rw-r--r--security/selinux/avc.c15
-rw-r--r--security/selinux/hooks.c32
-rw-r--r--security/selinux/include/avc.h6
-rw-r--r--security/smack/smack_lsm.c134
-rw-r--r--security/smack/smackfs.c61
-rw-r--r--sound/core/seq/seq_clientmgr.c4
-rw-r--r--sound/core/seq/seq_device.c3
-rw-r--r--sound/core/sound.c4
-rw-r--r--sound/core/timer.c2
-rw-r--r--sound/drivers/opl3/opl3_synth.c8
-rw-r--r--sound/pci/bt87x.c9
-rw-r--r--sound/pci/hda/hda_codec.c14
-rw-r--r--sound/pci/hda/hda_intel.c23
-rw-r--r--sound/pci/hda/hda_proc.c3
-rw-r--r--sound/pci/hda/patch_conexant.c7
-rw-r--r--sound/pci/hda/patch_realtek.c8
-rw-r--r--sound/pci/oxygen/oxygen.c35
-rw-r--r--sound/pci/oxygen/oxygen_lib.c10
-rw-r--r--sound/pci/oxygen/oxygen_pcm.c2
-rw-r--r--sound/pci/rme9652/hdsp.c7
-rw-r--r--sound/ppc/daca.c5
-rw-r--r--sound/ppc/tumbler.c5
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c2
-rw-r--r--sound/usb/caiaq/caiaq-device.c6
-rw-r--r--sound/usb/usbmidi.c19
952 files changed, 25657 insertions, 11524 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 8d556707bb68..30b327a116ea 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -109,6 +109,8 @@ cpu-hotplug.txt
109 - document describing CPU hotplug support in the Linux kernel. 109 - document describing CPU hotplug support in the Linux kernel.
110cpu-load.txt 110cpu-load.txt
111 - document describing how CPU load statistics are collected. 111 - document describing how CPU load statistics are collected.
112cpuidle/
113 - info on CPU_IDLE, CPU idle state management subsystem.
112cpusets.txt 114cpusets.txt
113 - documents the cpusets feature; assign CPUs and Mem to a set of tasks. 115 - documents the cpusets feature; assign CPUs and Mem to a set of tasks.
114cputopology.txt 116cputopology.txt
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 6a0ad4715e9f..300e1707893f 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -8,7 +8,7 @@
8 8
9DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \ 9DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
10 kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ 10 kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
11 procfs-guide.xml writing_usb_driver.xml \ 11 procfs-guide.xml writing_usb_driver.xml networking.xml \
12 kernel-api.xml filesystems.xml lsm.xml usb.xml \ 12 kernel-api.xml filesystems.xml lsm.xml usb.xml \
13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ 13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
14 genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml 14 genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml
diff --git a/Documentation/DocBook/filesystems.tmpl b/Documentation/DocBook/filesystems.tmpl
index 5eaef87e8f1b..5e87ad58c0b5 100644
--- a/Documentation/DocBook/filesystems.tmpl
+++ b/Documentation/DocBook/filesystems.tmpl
@@ -398,4 +398,24 @@ an example.
398 398
399 </chapter> 399 </chapter>
400 400
401 <chapter id="splice">
402 <title>splice API</title>
403 <para>
404 splice is a method for moving blocks of data around inside the
405 kernel, without continually transferring them between the kernel
406 and user space.
407 </para>
408!Ffs/splice.c
409 </chapter>
410
411 <chapter id="pipes">
412 <title>pipes API</title>
413 <para>
414 Pipe interfaces are all for in-kernel (builtin image) use.
415 They are not exported for use by modules.
416 </para>
417!Iinclude/linux/pipe_fs_i.h
418!Ffs/pipe.c
419 </chapter>
420
401</book> 421</book>
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 059aaf20951a..f31601e8bd89 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -204,65 +204,6 @@ X!Ilib/string.c
204 </sect1> 204 </sect1>
205 </chapter> 205 </chapter>
206 206
207 <chapter id="netcore">
208 <title>Linux Networking</title>
209 <sect1><title>Networking Base Types</title>
210!Iinclude/linux/net.h
211 </sect1>
212 <sect1><title>Socket Buffer Functions</title>
213!Iinclude/linux/skbuff.h
214!Iinclude/net/sock.h
215!Enet/socket.c
216!Enet/core/skbuff.c
217!Enet/core/sock.c
218!Enet/core/datagram.c
219!Enet/core/stream.c
220 </sect1>
221 <sect1><title>Socket Filter</title>
222!Enet/core/filter.c
223 </sect1>
224 <sect1><title>Generic Network Statistics</title>
225!Iinclude/linux/gen_stats.h
226!Enet/core/gen_stats.c
227!Enet/core/gen_estimator.c
228 </sect1>
229 <sect1><title>SUN RPC subsystem</title>
230<!-- The !D functionality is not perfect, garbage has to be protected by comments
231!Dnet/sunrpc/sunrpc_syms.c
232-->
233!Enet/sunrpc/xdr.c
234!Enet/sunrpc/svcsock.c
235!Enet/sunrpc/sched.c
236 </sect1>
237 </chapter>
238
239 <chapter id="netdev">
240 <title>Network device support</title>
241 <sect1><title>Driver Support</title>
242!Enet/core/dev.c
243!Enet/ethernet/eth.c
244!Enet/sched/sch_generic.c
245!Iinclude/linux/etherdevice.h
246!Iinclude/linux/netdevice.h
247 </sect1>
248 <sect1><title>PHY Support</title>
249!Edrivers/net/phy/phy.c
250!Idrivers/net/phy/phy.c
251!Edrivers/net/phy/phy_device.c
252!Idrivers/net/phy/phy_device.c
253!Edrivers/net/phy/mdio_bus.c
254!Idrivers/net/phy/mdio_bus.c
255 </sect1>
256<!-- FIXME: Removed for now since no structured comments in source
257 <sect1><title>Wireless</title>
258X!Enet/core/wireless.c
259 </sect1>
260-->
261 <sect1><title>Synchronous PPP</title>
262!Edrivers/net/wan/syncppp.c
263 </sect1>
264 </chapter>
265
266 <chapter id="modload"> 207 <chapter id="modload">
267 <title>Module Support</title> 208 <title>Module Support</title>
268 <sect1><title>Module Loading</title> 209 <sect1><title>Module Loading</title>
@@ -508,11 +449,6 @@ X!Isound/sound_firmware.c
508!Edrivers/serial/8250.c 449!Edrivers/serial/8250.c
509 </chapter> 450 </chapter>
510 451
511 <chapter id="z85230">
512 <title>Z85230 Support Library</title>
513!Edrivers/net/wan/z85230.c
514 </chapter>
515
516 <chapter id="fbdev"> 452 <chapter id="fbdev">
517 <title>Frame Buffer Library</title> 453 <title>Frame Buffer Library</title>
518 454
@@ -712,24 +648,4 @@ X!Idrivers/video/console/fonts.c
712!Edrivers/i2c/i2c-core.c 648!Edrivers/i2c/i2c-core.c
713 </chapter> 649 </chapter>
714 650
715 <chapter id="splice">
716 <title>splice API</title>
717 <para>
718 splice is a method for moving blocks of data around inside the
719 kernel, without continually transferring them between the kernel
720 and user space.
721 </para>
722!Ffs/splice.c
723 </chapter>
724
725 <chapter id="pipes">
726 <title>pipes API</title>
727 <para>
728 Pipe interfaces are all for in-kernel (builtin image) use.
729 They are not exported for use by modules.
730 </para>
731!Iinclude/linux/pipe_fs_i.h
732!Ffs/pipe.c
733 </chapter>
734
735</book> 651</book>
diff --git a/Documentation/DocBook/networking.tmpl b/Documentation/DocBook/networking.tmpl
new file mode 100644
index 000000000000..f24f9e85e4ae
--- /dev/null
+++ b/Documentation/DocBook/networking.tmpl
@@ -0,0 +1,106 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="LinuxNetworking">
6 <bookinfo>
7 <title>Linux Networking and Network Devices APIs</title>
8
9 <legalnotice>
10 <para>
11 This documentation is free software; you can redistribute
12 it and/or modify it under the terms of the GNU General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later
15 version.
16 </para>
17
18 <para>
19 This program is distributed in the hope that it will be
20 useful, but WITHOUT ANY WARRANTY; without even the implied
21 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 See the GNU General Public License for more details.
23 </para>
24
25 <para>
26 You should have received a copy of the GNU General Public
27 License along with this program; if not, write to the Free
28 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 MA 02111-1307 USA
30 </para>
31
32 <para>
33 For more details see the file COPYING in the source
34 distribution of Linux.
35 </para>
36 </legalnotice>
37 </bookinfo>
38
39<toc></toc>
40
41 <chapter id="netcore">
42 <title>Linux Networking</title>
43 <sect1><title>Networking Base Types</title>
44!Iinclude/linux/net.h
45 </sect1>
46 <sect1><title>Socket Buffer Functions</title>
47!Iinclude/linux/skbuff.h
48!Iinclude/net/sock.h
49!Enet/socket.c
50!Enet/core/skbuff.c
51!Enet/core/sock.c
52!Enet/core/datagram.c
53!Enet/core/stream.c
54 </sect1>
55 <sect1><title>Socket Filter</title>
56!Enet/core/filter.c
57 </sect1>
58 <sect1><title>Generic Network Statistics</title>
59!Iinclude/linux/gen_stats.h
60!Enet/core/gen_stats.c
61!Enet/core/gen_estimator.c
62 </sect1>
63 <sect1><title>SUN RPC subsystem</title>
64<!-- The !D functionality is not perfect, garbage has to be protected by comments
65!Dnet/sunrpc/sunrpc_syms.c
66-->
67!Enet/sunrpc/xdr.c
68!Enet/sunrpc/svc_xprt.c
69!Enet/sunrpc/xprt.c
70!Enet/sunrpc/sched.c
71!Enet/sunrpc/socklib.c
72!Enet/sunrpc/stats.c
73!Enet/sunrpc/rpc_pipe.c
74!Enet/sunrpc/rpcb_clnt.c
75!Enet/sunrpc/clnt.c
76 </sect1>
77 </chapter>
78
79 <chapter id="netdev">
80 <title>Network device support</title>
81 <sect1><title>Driver Support</title>
82!Enet/core/dev.c
83!Enet/ethernet/eth.c
84!Enet/sched/sch_generic.c
85!Iinclude/linux/etherdevice.h
86!Iinclude/linux/netdevice.h
87 </sect1>
88 <sect1><title>PHY Support</title>
89!Edrivers/net/phy/phy.c
90!Idrivers/net/phy/phy.c
91!Edrivers/net/phy/phy_device.c
92!Idrivers/net/phy/phy_device.c
93!Edrivers/net/phy/mdio_bus.c
94!Idrivers/net/phy/mdio_bus.c
95 </sect1>
96<!-- FIXME: Removed for now since no structured comments in source
97 <sect1><title>Wireless</title>
98X!Enet/core/wireless.c
99 </sect1>
100-->
101 <sect1><title>Synchronous PPP</title>
102!Edrivers/net/wan/syncppp.c
103 </sect1>
104 </chapter>
105
106</book>
diff --git a/Documentation/RCU/NMI-RCU.txt b/Documentation/RCU/NMI-RCU.txt
index d0634a5c3445..c64158ecde43 100644
--- a/Documentation/RCU/NMI-RCU.txt
+++ b/Documentation/RCU/NMI-RCU.txt
@@ -25,7 +25,7 @@ the NMI handler to take the default machine-specific action.
25This nmi_callback variable is a global function pointer to the current 25This nmi_callback variable is a global function pointer to the current
26NMI handler. 26NMI handler.
27 27
28 fastcall void do_nmi(struct pt_regs * regs, long error_code) 28 void do_nmi(struct pt_regs * regs, long error_code)
29 { 29 {
30 int cpu; 30 int cpu;
31 31
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist
index 34e06d2f194f..da10e0714241 100644
--- a/Documentation/SubmitChecklist
+++ b/Documentation/SubmitChecklist
@@ -20,7 +20,11 @@ kernel patches.
204: ppc64 is a good architecture for cross-compilation checking because it 204: ppc64 is a good architecture for cross-compilation checking because it
21 tends to use `unsigned long' for 64-bit quantities. 21 tends to use `unsigned long' for 64-bit quantities.
22 22
235: Matches kernel coding style(!) 235: Check your patch for general style as detailed in
24 Documentation/CodingStyle. Check for trivial violations with the
25 patch style checker prior to submission (scripts/checkpatch.pl).
26 You should be able to justify all violations that remain in
27 your patch.
24 28
256: Any new or modified CONFIG options don't muck up the config menu. 296: Any new or modified CONFIG options don't muck up the config menu.
26 30
@@ -79,13 +83,3 @@ kernel patches.
7923: Tested after it has been merged into the -mm patchset to make sure 8323: Tested after it has been merged into the -mm patchset to make sure
80 that it still works with all of the other queued patches and various 84 that it still works with all of the other queued patches and various
81 changes in the VM, VFS, and other subsystems. 85 changes in the VM, VFS, and other subsystems.
82
8324: Avoid whitespace damage such as indenting with spaces or whitespace
84 at the end of lines. You can test this by feeding the patch to
85 "git apply --check --whitespace=error-all"
86
8725: Check your patch for general style as detailed in
88 Documentation/CodingStyle. Check for trivial violations with the
89 patch style checker prior to submission (scripts/checkpatch.pl).
90 You should be able to justify all violations that remain in
91 your patch.
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
index f20c10c2858f..4ef245010457 100644
--- a/Documentation/atomic_ops.txt
+++ b/Documentation/atomic_ops.txt
@@ -186,7 +186,8 @@ If the atomic value v is not equal to u, this function adds a to v, and
186returns non zero. If v is equal to u then it returns zero. This is done as 186returns non zero. If v is equal to u then it returns zero. This is done as
187an atomic operation. 187an atomic operation.
188 188
189atomic_add_unless requires explicit memory barriers around the operation. 189atomic_add_unless requires explicit memory barriers around the operation
190unless it fails (returns 0).
190 191
191atomic_inc_not_zero, equivalent to atomic_add_unless(v, 1, 0) 192atomic_inc_not_zero, equivalent to atomic_add_unless(v, 1, 0)
192 193
diff --git a/Documentation/cgroups.txt b/Documentation/cgroups.txt
index 42d7c4cb39cd..31d12e21ff8a 100644
--- a/Documentation/cgroups.txt
+++ b/Documentation/cgroups.txt
@@ -28,7 +28,7 @@ CONTENTS:
284. Questions 284. Questions
29 29
301. Control Groups 301. Control Groups
31========== 31=================
32 32
331.1 What are cgroups ? 331.1 What are cgroups ?
34---------------------- 34----------------------
@@ -143,10 +143,10 @@ proliferation of such cgroups.
143 143
144Also lets say that the administrator would like to give enhanced network 144Also lets say that the administrator would like to give enhanced network
145access temporarily to a student's browser (since it is night and the user 145access temporarily to a student's browser (since it is night and the user
146wants to do online gaming :) OR give one of the students simulation 146wants to do online gaming :)) OR give one of the students simulation
147apps enhanced CPU power, 147apps enhanced CPU power,
148 148
149With ability to write pids directly to resource classes, its just a 149With ability to write pids directly to resource classes, it's just a
150matter of : 150matter of :
151 151
152 # echo pid > /mnt/network/<new_class>/tasks 152 # echo pid > /mnt/network/<new_class>/tasks
@@ -227,10 +227,13 @@ Each cgroup is represented by a directory in the cgroup file system
227containing the following files describing that cgroup: 227containing the following files describing that cgroup:
228 228
229 - tasks: list of tasks (by pid) attached to that cgroup 229 - tasks: list of tasks (by pid) attached to that cgroup
230 - notify_on_release flag: run /sbin/cgroup_release_agent on exit? 230 - releasable flag: cgroup currently removeable?
231 - notify_on_release flag: run the release agent on exit?
232 - release_agent: the path to use for release notifications (this file
233 exists in the top cgroup only)
231 234
232Other subsystems such as cpusets may add additional files in each 235Other subsystems such as cpusets may add additional files in each
233cgroup dir 236cgroup dir.
234 237
235New cgroups are created using the mkdir system call or shell 238New cgroups are created using the mkdir system call or shell
236command. The properties of a cgroup, such as its flags, are 239command. The properties of a cgroup, such as its flags, are
@@ -257,7 +260,7 @@ performance.
257To allow access from a cgroup to the css_sets (and hence tasks) 260To allow access from a cgroup to the css_sets (and hence tasks)
258that comprise it, a set of cg_cgroup_link objects form a lattice; 261that comprise it, a set of cg_cgroup_link objects form a lattice;
259each cg_cgroup_link is linked into a list of cg_cgroup_links for 262each cg_cgroup_link is linked into a list of cg_cgroup_links for
260a single cgroup on its cont_link_list field, and a list of 263a single cgroup on its cgrp_link_list field, and a list of
261cg_cgroup_links for a single css_set on its cg_link_list. 264cg_cgroup_links for a single css_set on its cg_link_list.
262 265
263Thus the set of tasks in a cgroup can be listed by iterating over 266Thus the set of tasks in a cgroup can be listed by iterating over
@@ -271,9 +274,6 @@ for cgroups, with a minimum of additional kernel code.
2711.4 What does notify_on_release do ? 2741.4 What does notify_on_release do ?
272------------------------------------ 275------------------------------------
273 276
274*** notify_on_release is disabled in the current patch set. It will be
275*** reactivated in a future patch in a less-intrusive manner
276
277If the notify_on_release flag is enabled (1) in a cgroup, then 277If the notify_on_release flag is enabled (1) in a cgroup, then
278whenever the last task in the cgroup leaves (exits or attaches to 278whenever the last task in the cgroup leaves (exits or attaches to
279some other cgroup) and the last child cgroup of that cgroup 279some other cgroup) and the last child cgroup of that cgroup
@@ -360,8 +360,8 @@ Now you want to do something with this cgroup.
360 360
361In this directory you can find several files: 361In this directory you can find several files:
362# ls 362# ls
363notify_on_release release_agent tasks 363notify_on_release releasable tasks
364(plus whatever files are added by the attached subsystems) 364(plus whatever files added by the attached subsystems)
365 365
366Now attach your shell to this cgroup: 366Now attach your shell to this cgroup:
367# /bin/echo $$ > tasks 367# /bin/echo $$ > tasks
@@ -404,19 +404,13 @@ with a subsystem id which will be assigned by the cgroup system.
404Other fields in the cgroup_subsys object include: 404Other fields in the cgroup_subsys object include:
405 405
406- subsys_id: a unique array index for the subsystem, indicating which 406- subsys_id: a unique array index for the subsystem, indicating which
407 entry in cgroup->subsys[] this subsystem should be 407 entry in cgroup->subsys[] this subsystem should be managing.
408 managing. Initialized by cgroup_register_subsys(); prior to this
409 it should be initialized to -1
410 408
411- hierarchy: an index indicating which hierarchy, if any, this 409- name: should be initialized to a unique subsystem name. Should be
412 subsystem is currently attached to. If this is -1, then the 410 no longer than MAX_CGROUP_TYPE_NAMELEN.
413 subsystem is not attached to any hierarchy, and all tasks should be
414 considered to be members of the subsystem's top_cgroup. It should
415 be initialized to -1.
416 411
417- name: should be initialized to a unique subsystem name prior to 412- early_init: indicate if the subsystem needs early initialization
418 calling cgroup_register_subsystem. Should be no longer than 413 at system boot.
419 MAX_CGROUP_TYPE_NAMELEN
420 414
421Each cgroup object created by the system has an array of pointers, 415Each cgroup object created by the system has an array of pointers,
422indexed by subsystem id; this pointer is entirely managed by the 416indexed by subsystem id; this pointer is entirely managed by the
@@ -434,8 +428,6 @@ situation.
434See kernel/cgroup.c for more details. 428See kernel/cgroup.c for more details.
435 429
436Subsystems can take/release the cgroup_mutex via the functions 430Subsystems can take/release the cgroup_mutex via the functions
437cgroup_lock()/cgroup_unlock(), and can
438take/release the callback_mutex via the functions
439cgroup_lock()/cgroup_unlock(). 431cgroup_lock()/cgroup_unlock().
440 432
441Accessing a task's cgroup pointer may be done in the following ways: 433Accessing a task's cgroup pointer may be done in the following ways:
@@ -444,7 +436,7 @@ Accessing a task's cgroup pointer may be done in the following ways:
444- inside an rcu_read_lock() section via rcu_dereference() 436- inside an rcu_read_lock() section via rcu_dereference()
445 437
4463.3 Subsystem API 4383.3 Subsystem API
447-------------------------- 439-----------------
448 440
449Each subsystem should: 441Each subsystem should:
450 442
@@ -455,7 +447,8 @@ Each subsystem may export the following methods. The only mandatory
455methods are create/destroy. Any others that are null are presumed to 447methods are create/destroy. Any others that are null are presumed to
456be successful no-ops. 448be successful no-ops.
457 449
458struct cgroup_subsys_state *create(struct cgroup *cont) 450struct cgroup_subsys_state *create(struct cgroup_subsys *ss,
451 struct cgroup *cgrp)
459(cgroup_mutex held by caller) 452(cgroup_mutex held by caller)
460 453
461Called to create a subsystem state object for a cgroup. The 454Called to create a subsystem state object for a cgroup. The
@@ -470,7 +463,7 @@ identified by the passed cgroup object having a NULL parent (since
470it's the root of the hierarchy) and may be an appropriate place for 463it's the root of the hierarchy) and may be an appropriate place for
471initialization code. 464initialization code.
472 465
473void destroy(struct cgroup *cont) 466void destroy(struct cgroup_subsys *ss, struct cgroup *cgrp)
474(cgroup_mutex held by caller) 467(cgroup_mutex held by caller)
475 468
476The cgroup system is about to destroy the passed cgroup; the subsystem 469The cgroup system is about to destroy the passed cgroup; the subsystem
@@ -481,7 +474,14 @@ cgroup->parent is still valid. (Note - can also be called for a
481newly-created cgroup if an error occurs after this subsystem's 474newly-created cgroup if an error occurs after this subsystem's
482create() method has been called for the new cgroup). 475create() method has been called for the new cgroup).
483 476
484int can_attach(struct cgroup_subsys *ss, struct cgroup *cont, 477void pre_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp);
478(cgroup_mutex held by caller)
479
480Called before checking the reference count on each subsystem. This may
481be useful for subsystems which have some extra references even if
482there are not tasks in the cgroup.
483
484int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
485 struct task_struct *task) 485 struct task_struct *task)
486(cgroup_mutex held by caller) 486(cgroup_mutex held by caller)
487 487
@@ -492,8 +492,8 @@ unspecified task can be moved into the cgroup. Note that this isn't
492called on a fork. If this method returns 0 (success) then this should 492called on a fork. If this method returns 0 (success) then this should
493remain valid while the caller holds cgroup_mutex. 493remain valid while the caller holds cgroup_mutex.
494 494
495void attach(struct cgroup_subsys *ss, struct cgroup *cont, 495void attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
496 struct cgroup *old_cont, struct task_struct *task) 496 struct cgroup *old_cgrp, struct task_struct *task)
497 497
498Called after the task has been attached to the cgroup, to allow any 498Called after the task has been attached to the cgroup, to allow any
499post-attachment activity that requires memory allocations or blocking. 499post-attachment activity that requires memory allocations or blocking.
@@ -505,9 +505,9 @@ registration for all existing tasks.
505 505
506void exit(struct cgroup_subsys *ss, struct task_struct *task) 506void exit(struct cgroup_subsys *ss, struct task_struct *task)
507 507
508Called during task exit 508Called during task exit.
509 509
510int populate(struct cgroup_subsys *ss, struct cgroup *cont) 510int populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
511 511
512Called after creation of a cgroup to allow a subsystem to populate 512Called after creation of a cgroup to allow a subsystem to populate
513the cgroup directory with file entries. The subsystem should make 513the cgroup directory with file entries. The subsystem should make
@@ -516,7 +516,7 @@ include/linux/cgroup.h for details). Note that although this
516method can return an error code, the error code is currently not 516method can return an error code, the error code is currently not
517always handled well. 517always handled well.
518 518
519void post_clone(struct cgroup_subsys *ss, struct cgroup *cont) 519void post_clone(struct cgroup_subsys *ss, struct cgroup *cgrp)
520 520
521Called at the end of cgroup_clone() to do any paramater 521Called at the end of cgroup_clone() to do any paramater
522initialization which might be required before a task could attach. For 522initialization which might be required before a task could attach. For
diff --git a/Documentation/controllers/memory.txt b/Documentation/controllers/memory.txt
index b5bbea92a61a..6015347b41e2 100644
--- a/Documentation/controllers/memory.txt
+++ b/Documentation/controllers/memory.txt
@@ -170,14 +170,14 @@ NOTE: We can use a suffix (k, K, m, M, g or G) to indicate values in kilo,
170mega or gigabytes. 170mega or gigabytes.
171 171
172# cat /cgroups/0/memory.limit_in_bytes 172# cat /cgroups/0/memory.limit_in_bytes
1734194304 Bytes 1734194304
174 174
175NOTE: The interface has now changed to display the usage in bytes 175NOTE: The interface has now changed to display the usage in bytes
176instead of pages 176instead of pages
177 177
178We can check the usage: 178We can check the usage:
179# cat /cgroups/0/memory.usage_in_bytes 179# cat /cgroups/0/memory.usage_in_bytes
1801216512 Bytes 1801216512
181 181
182A successful write to this file does not guarantee a successful set of 182A successful write to this file does not guarantee a successful set of
183this limit to the value written into the file. This can be due to a 183this limit to the value written into the file. This can be due to a
@@ -187,7 +187,7 @@ this file after a write to guarantee the value committed by the kernel.
187 187
188# echo -n 1 > memory.limit_in_bytes 188# echo -n 1 > memory.limit_in_bytes
189# cat memory.limit_in_bytes 189# cat memory.limit_in_bytes
1904096 Bytes 1904096
191 191
192The memory.failcnt field gives the number of times that the cgroup limit was 192The memory.failcnt field gives the number of times that the cgroup limit was
193exceeded. 193exceeded.
@@ -233,13 +233,6 @@ cgroup might have some charge associated with it, even though all
233tasks have migrated away from it. Such charges are automatically dropped at 233tasks have migrated away from it. Such charges are automatically dropped at
234rmdir() if there are no tasks. 234rmdir() if there are no tasks.
235 235
2364.4 Choosing what to account -- Page Cache (unmapped) vs RSS (mapped)?
237
238The type of memory accounted by the cgroup can be limited to just
239mapped pages by writing "1" to memory.control_type field
240
241echo -n 1 > memory.control_type
242
2435. TODO 2365. TODO
244 237
2451. Add support for accounting huge pages (as a separate controller) 2381. Add support for accounting huge pages (as a separate controller)
@@ -262,18 +255,19 @@ References
2623. Emelianov, Pavel. Resource controllers based on process cgroups 2553. Emelianov, Pavel. Resource controllers based on process cgroups
263 http://lkml.org/lkml/2007/3/6/198 256 http://lkml.org/lkml/2007/3/6/198
2644. Emelianov, Pavel. RSS controller based on process cgroups (v2) 2574. Emelianov, Pavel. RSS controller based on process cgroups (v2)
265 http://lkml.org/lkml/2007/4/9/74 258 http://lkml.org/lkml/2007/4/9/78
2665. Emelianov, Pavel. RSS controller based on process cgroups (v3) 2595. Emelianov, Pavel. RSS controller based on process cgroups (v3)
267 http://lkml.org/lkml/2007/5/30/244 260 http://lkml.org/lkml/2007/5/30/244
2686. Menage, Paul. Control Groups v10, http://lwn.net/Articles/236032/ 2616. Menage, Paul. Control Groups v10, http://lwn.net/Articles/236032/
2697. Vaidyanathan, Srinivasan, Control Groups: Pagecache accounting and control 2627. Vaidyanathan, Srinivasan, Control Groups: Pagecache accounting and control
270 subsystem (v3), http://lwn.net/Articles/235534/ 263 subsystem (v3), http://lwn.net/Articles/235534/
2718. Singh, Balbir. RSS controller V2 test results (lmbench), 2648. Singh, Balbir. RSS controller v2 test results (lmbench),
272 http://lkml.org/lkml/2007/5/17/232 265 http://lkml.org/lkml/2007/5/17/232
2739. Singh, Balbir. RSS controller V2 AIM9 results 2669. Singh, Balbir. RSS controller v2 AIM9 results
274 http://lkml.org/lkml/2007/5/18/1 267 http://lkml.org/lkml/2007/5/18/1
27510. Singh, Balbir. Memory controller v6 results, 26810. Singh, Balbir. Memory controller v6 test results,
276 http://lkml.org/lkml/2007/8/19/36 269 http://lkml.org/lkml/2007/8/19/36
27711. Singh, Balbir. Memory controller v6, http://lkml.org/lkml/2007/8/17/69 27011. Singh, Balbir. Memory controller introduction (v6),
271 http://lkml.org/lkml/2007/8/17/69
27812. Corbet, Jonathan, Controlling memory use in cgroups, 27212. Corbet, Jonathan, Controlling memory use in cgroups,
279 http://lwn.net/Articles/243795/ 273 http://lwn.net/Articles/243795/
diff --git a/Documentation/cpuidle/core.txt b/Documentation/cpuidle/core.txt
new file mode 100644
index 000000000000..63ecc5dc9d8a
--- /dev/null
+++ b/Documentation/cpuidle/core.txt
@@ -0,0 +1,23 @@
1
2 Supporting multiple CPU idle levels in kernel
3
4 cpuidle
5
6General Information:
7
8Various CPUs today support multiple idle levels that are differentiated
9by varying exit latencies and power consumption during idle.
10cpuidle is a generic in-kernel infrastructure that separates
11idle policy (governor) from idle mechanism (driver) and provides a
12standardized infrastructure to support independent development of
13governors and drivers.
14
15cpuidle resides under drivers/cpuidle.
16
17Boot options:
18"cpuidle_sysfs_switch"
19enables current_governor interface in /sys/devices/system/cpu/cpuidle/,
20which can be used to switch governors at run time. This boot option
21is meant for developer testing only. In normal usage, kernel picks the
22best governor based on governor ratings.
23SEE ALSO: sysfs.txt in this directory.
diff --git a/Documentation/cpuidle/driver.txt b/Documentation/cpuidle/driver.txt
new file mode 100644
index 000000000000..7a9e09ece931
--- /dev/null
+++ b/Documentation/cpuidle/driver.txt
@@ -0,0 +1,31 @@
1
2
3 Supporting multiple CPU idle levels in kernel
4
5 cpuidle drivers
6
7
8
9
10cpuidle driver hooks into the cpuidle infrastructure and handles the
11architecture/platform dependent part of CPU idle states. Driver
12provides the platform idle state detection capability and also
13has mechanisms in place to support actual entry-exit into CPU idle states.
14
15cpuidle driver initializes the cpuidle_device structure for each CPU device
16and registers with cpuidle using cpuidle_register_device.
17
18It can also support the dynamic changes (like battery <-> AC), by using
19cpuidle_pause_and_lock, cpuidle_disable_device and cpuidle_enable_device,
20cpuidle_resume_and_unlock.
21
22Interfaces:
23extern int cpuidle_register_driver(struct cpuidle_driver *drv);
24extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
25extern int cpuidle_register_device(struct cpuidle_device *dev);
26extern void cpuidle_unregister_device(struct cpuidle_device *dev);
27
28extern void cpuidle_pause_and_lock(void);
29extern void cpuidle_resume_and_unlock(void);
30extern int cpuidle_enable_device(struct cpuidle_device *dev);
31extern void cpuidle_disable_device(struct cpuidle_device *dev);
diff --git a/Documentation/cpuidle/governor.txt b/Documentation/cpuidle/governor.txt
new file mode 100644
index 000000000000..12c6bd50c9f6
--- /dev/null
+++ b/Documentation/cpuidle/governor.txt
@@ -0,0 +1,29 @@
1
2
3
4 Supporting multiple CPU idle levels in kernel
5
6 cpuidle governors
7
8
9
10
11cpuidle governor is policy routine that decides what idle state to enter at
12any given time. cpuidle core uses different callbacks to the governor.
13
14* enable() to enable governor for a particular device
15* disable() to disable governor for a particular device
16* select() to select an idle state to enter
17* reflect() called after returning from the idle state, which can be used
18 by the governor for some record keeping.
19
20More than one governor can be registered at the same time and
21users can switch between drivers using /sysfs interface (when enabled).
22More than one governor part is supported for developers to easily experiment
23with different governors. By default, most optimal governor based on your
24kernel configuration and platform will be selected by cpuidle.
25
26Interfaces:
27extern int cpuidle_register_governor(struct cpuidle_governor *gov);
28extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
29struct cpuidle_governor
diff --git a/Documentation/cpuidle/sysfs.txt b/Documentation/cpuidle/sysfs.txt
new file mode 100644
index 000000000000..50d7b1642759
--- /dev/null
+++ b/Documentation/cpuidle/sysfs.txt
@@ -0,0 +1,79 @@
1
2
3 Supporting multiple CPU idle levels in kernel
4
5 cpuidle sysfs
6
7System global cpuidle related information and tunables are under
8/sys/devices/system/cpu/cpuidle
9
10The current interfaces in this directory has self-explanatory names:
11* current_driver
12* current_governor_ro
13
14With cpuidle_sysfs_switch boot option (meant for developer testing)
15following objects are visible instead.
16* current_driver
17* available_governors
18* current_governor
19In this case users can switch the governor at run time by writing
20to current_governor.
21
22
23Per logical CPU specific cpuidle information are under
24/sys/devices/system/cpu/cpuX/cpuidle
25for each online cpu X
26
27--------------------------------------------------------------------------------
28# ls -lR /sys/devices/system/cpu/cpu0/cpuidle/
29/sys/devices/system/cpu/cpu0/cpuidle/:
30total 0
31drwxr-xr-x 2 root root 0 Feb 8 10:42 state0
32drwxr-xr-x 2 root root 0 Feb 8 10:42 state1
33drwxr-xr-x 2 root root 0 Feb 8 10:42 state2
34drwxr-xr-x 2 root root 0 Feb 8 10:42 state3
35
36/sys/devices/system/cpu/cpu0/cpuidle/state0:
37total 0
38-r--r--r-- 1 root root 4096 Feb 8 10:42 desc
39-r--r--r-- 1 root root 4096 Feb 8 10:42 latency
40-r--r--r-- 1 root root 4096 Feb 8 10:42 name
41-r--r--r-- 1 root root 4096 Feb 8 10:42 power
42-r--r--r-- 1 root root 4096 Feb 8 10:42 time
43-r--r--r-- 1 root root 4096 Feb 8 10:42 usage
44
45/sys/devices/system/cpu/cpu0/cpuidle/state1:
46total 0
47-r--r--r-- 1 root root 4096 Feb 8 10:42 desc
48-r--r--r-- 1 root root 4096 Feb 8 10:42 latency
49-r--r--r-- 1 root root 4096 Feb 8 10:42 name
50-r--r--r-- 1 root root 4096 Feb 8 10:42 power
51-r--r--r-- 1 root root 4096 Feb 8 10:42 time
52-r--r--r-- 1 root root 4096 Feb 8 10:42 usage
53
54/sys/devices/system/cpu/cpu0/cpuidle/state2:
55total 0
56-r--r--r-- 1 root root 4096 Feb 8 10:42 desc
57-r--r--r-- 1 root root 4096 Feb 8 10:42 latency
58-r--r--r-- 1 root root 4096 Feb 8 10:42 name
59-r--r--r-- 1 root root 4096 Feb 8 10:42 power
60-r--r--r-- 1 root root 4096 Feb 8 10:42 time
61-r--r--r-- 1 root root 4096 Feb 8 10:42 usage
62
63/sys/devices/system/cpu/cpu0/cpuidle/state3:
64total 0
65-r--r--r-- 1 root root 4096 Feb 8 10:42 desc
66-r--r--r-- 1 root root 4096 Feb 8 10:42 latency
67-r--r--r-- 1 root root 4096 Feb 8 10:42 name
68-r--r--r-- 1 root root 4096 Feb 8 10:42 power
69-r--r--r-- 1 root root 4096 Feb 8 10:42 time
70-r--r--r-- 1 root root 4096 Feb 8 10:42 usage
71--------------------------------------------------------------------------------
72
73
74* desc : Small description about the idle state (string)
75* latency : Latency to exit out of this idle state (in microseconds)
76* name : Name of the idle state (string)
77* power : Power consumed while in this idle state (in milliwatts)
78* time : Total time spent in this idle state (in microseconds)
79* usage : Number of times this state was entered (count)
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
index 43db6fe12814..ad2bb3b3acc1 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cpusets.txt
@@ -209,7 +209,7 @@ and name space for cpusets, with a minimum of additional kernel code.
209The cpus and mems files in the root (top_cpuset) cpuset are 209The cpus and mems files in the root (top_cpuset) cpuset are
210read-only. The cpus file automatically tracks the value of 210read-only. The cpus file automatically tracks the value of
211cpu_online_map using a CPU hotplug notifier, and the mems file 211cpu_online_map using a CPU hotplug notifier, and the mems file
212automatically tracks the value of node_states[N_MEMORY]--i.e., 212automatically tracks the value of node_states[N_HIGH_MEMORY]--i.e.,
213nodes with memory--using the cpuset_track_online_nodes() hook. 213nodes with memory--using the cpuset_track_online_nodes() hook.
214 214
215 215
diff --git a/Documentation/hwmon/adt7473 b/Documentation/hwmon/adt7473
new file mode 100644
index 000000000000..22d8b19046ab
--- /dev/null
+++ b/Documentation/hwmon/adt7473
@@ -0,0 +1,79 @@
1Kernel driver adt7473
2======================
3
4Supported chips:
5 * Analog Devices ADT7473
6 Prefix: 'adt7473'
7 Addresses scanned: I2C 0x2C, 0x2D, 0x2E
8 Datasheet: Publicly available at the Analog Devices website
9
10Author: Darrick J. Wong
11
12Description
13-----------
14
15This driver implements support for the Analog Devices ADT7473 chip family.
16
17The LM85 uses the 2-wire interface compatible with the SMBUS 2.0
18specification. Using an analog to digital converter it measures three (3)
19temperatures and two (2) voltages. It has three (3) 16-bit counters for
20measuring fan speed. There are three (3) PWM outputs that can be used
21to control fan speed.
22
23A sophisticated control system for the PWM outputs is designed into the
24LM85 that allows fan speed to be adjusted automatically based on any of the
25three temperature sensors. Each PWM output is individually adjustable and
26programmable. Once configured, the ADT7473 will adjust the PWM outputs in
27response to the measured temperatures without further host intervention.
28This feature can also be disabled for manual control of the PWM's.
29
30Each of the measured inputs (voltage, temperature, fan speed) has
31corresponding high/low limit values. The ADT7473 will signal an ALARM if
32any measured value exceeds either limit.
33
34The ADT7473 samples all inputs continuously. The driver will not read
35the registers more often than once every other second. Further,
36configuration data is only read once per minute.
37
38Special Features
39----------------
40
41The ADT7473 have a 10-bit ADC and can therefore measure temperatures
42with 0.25 degC resolution. Temperature readings can be configured either
43for twos complement format or "Offset 64" format, wherein 63 is subtracted
44from the raw value to get the temperature value.
45
46The Analog Devices datasheet is very detailed and describes a procedure for
47determining an optimal configuration for the automatic PWM control.
48
49Hardware Configurations
50-----------------------
51
52The ADT7473 chips have an optional SMBALERT output that can be used to
53signal the chipset in case a limit is exceeded or the temperature sensors
54fail. Individual sensor interrupts can be masked so they won't trigger
55SMBALERT. The SMBALERT output if configured replaces the PWM2 function.
56
57Configuration Notes
58-------------------
59
60Besides standard interfaces driver adds the following:
61
62* PWM Control
63
64* pwm#_auto_point1_pwm and pwm#_auto_point1_temp and
65* pwm#_auto_point2_pwm and pwm#_auto_point2_temp -
66
67point1: Set the pwm speed at a lower temperature bound.
68point2: Set the pwm speed at a higher temperature bound.
69
70The ADT7473 will scale the pwm between the lower and higher pwm speed when
71the temperature is between the two temperature boundaries. PWM values range
72from 0 (off) to 255 (full speed).
73
74Notes
75-----
76
77The NVIDIA binary driver presents an ADT7473 chip via an on-card i2c bus.
78Unfortunately, they fail to set the i2c adapter class, so this driver may
79fail to find the chip until the nvidia driver is patched.
diff --git a/Documentation/hwmon/coretemp b/Documentation/hwmon/coretemp
index 170bf862437b..dbbe6c7025b0 100644
--- a/Documentation/hwmon/coretemp
+++ b/Documentation/hwmon/coretemp
@@ -4,9 +4,10 @@ Kernel driver coretemp
4Supported chips: 4Supported chips:
5 * All Intel Core family 5 * All Intel Core family
6 Prefix: 'coretemp' 6 Prefix: 'coretemp'
7 CPUID: family 0x6, models 0xe, 0xf, 0x16 7 CPUID: family 0x6, models 0xe, 0xf, 0x16, 0x17
8 Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual 8 Datasheet: Intel 64 and IA-32 Architectures Software Developer's Manual
9 Volume 3A: System Programming Guide 9 Volume 3A: System Programming Guide
10 http://softwarecommunity.intel.com/Wiki/Mobility/720.htm
10 11
11Author: Rudolf Marek 12Author: Rudolf Marek
12 13
@@ -25,7 +26,8 @@ may be raised, if the temperature grows enough (more than TjMax) to trigger
25the Out-Of-Spec bit. Following table summarizes the exported sysfs files: 26the Out-Of-Spec bit. Following table summarizes the exported sysfs files:
26 27
27temp1_input - Core temperature (in millidegrees Celsius). 28temp1_input - Core temperature (in millidegrees Celsius).
28temp1_crit - Maximum junction temperature (in millidegrees Celsius). 29temp1_max - All cooling devices should be turned on (on Core2).
30temp1_crit - Maximum junction temperature (in millidegrees Celsius).
29temp1_crit_alarm - Set when Out-of-spec bit is set, never clears. 31temp1_crit_alarm - Set when Out-of-spec bit is set, never clears.
30 Correct CPU operation is no longer guaranteed. 32 Correct CPU operation is no longer guaranteed.
31temp1_label - Contains string "Core X", where X is processor 33temp1_label - Contains string "Core X", where X is processor
diff --git a/Documentation/i386/IO-APIC.txt b/Documentation/i386/IO-APIC.txt
index 435e69e6e9aa..f95166645d29 100644
--- a/Documentation/i386/IO-APIC.txt
+++ b/Documentation/i386/IO-APIC.txt
@@ -1,12 +1,14 @@
1Most (all) Intel-MP compliant SMP boards have the so-called 'IO-APIC', 1Most (all) Intel-MP compliant SMP boards have the so-called 'IO-APIC',
2which is an enhanced interrupt controller, it enables us to route 2which is an enhanced interrupt controller. It enables us to route
3hardware interrupts to multiple CPUs, or to CPU groups. 3hardware interrupts to multiple CPUs, or to CPU groups. Without an
4IO-APIC, interrupts from hardware will be delivered only to the
5CPU which boots the operating system (usually CPU#0).
4 6
5Linux supports all variants of compliant SMP boards, including ones with 7Linux supports all variants of compliant SMP boards, including ones with
6multiple IO-APICs. (multiple IO-APICs are used in high-end servers to 8multiple IO-APICs. Multiple IO-APICs are used in high-end servers to
7distribute IRQ load further). 9distribute IRQ load further.
8 10
9There are (a few) known breakages in certain older boards, which bugs are 11There are (a few) known breakages in certain older boards, such bugs are
10usually worked around by the kernel. If your MP-compliant SMP board does 12usually worked around by the kernel. If your MP-compliant SMP board does
11not boot Linux, then consult the linux-smp mailing list archives first. 13not boot Linux, then consult the linux-smp mailing list archives first.
12 14
@@ -28,18 +30,18 @@ If your box boots fine with enabled IO-APIC IRQs, then your
28 hell:~> 30 hell:~>
29 <---------------------------- 31 <----------------------------
30 32
31some interrupts are still listed as 'XT PIC', but this is not a problem, 33Some interrupts are still listed as 'XT PIC', but this is not a problem;
32none of those IRQ sources is performance-critical. 34none of those IRQ sources is performance-critical.
33 35
34 36
35in the unlikely case that your board does not create a working mp-table, 37In the unlikely case that your board does not create a working mp-table,
36you can use the pirq= boot parameter to 'hand-construct' IRQ entries. This 38you can use the pirq= boot parameter to 'hand-construct' IRQ entries. This
37is nontrivial though and cannot be automated. One sample /etc/lilo.conf 39is non-trivial though and cannot be automated. One sample /etc/lilo.conf
38entry: 40entry:
39 41
40 append="pirq=15,11,10" 42 append="pirq=15,11,10"
41 43
42the actual numbers depend on your system, on your PCI cards and on their 44The actual numbers depend on your system, on your PCI cards and on their
43PCI slot position. Usually PCI slots are 'daisy chained' before they are 45PCI slot position. Usually PCI slots are 'daisy chained' before they are
44connected to the PCI chipset IRQ routing facility (the incoming PIRQ1-4 46connected to the PCI chipset IRQ routing facility (the incoming PIRQ1-4
45lines): 47lines):
@@ -54,7 +56,7 @@ lines):
54 PIRQ1 ----| |- `----| |- `----| |- `----| |--------| | 56 PIRQ1 ----| |- `----| |- `----| |- `----| |--------| |
55 `-' `-' `-' `-' `-' 57 `-' `-' `-' `-' `-'
56 58
57every PCI card emits a PCI IRQ, which can be INTA,INTB,INTC,INTD: 59Every PCI card emits a PCI IRQ, which can be INTA, INTB, INTC or INTD:
58 60
59 ,-. 61 ,-.
60 INTD--| | 62 INTD--| |
@@ -95,21 +97,21 @@ card (IRQ11) in Slot3, and have Slot1 empty:
95[value '0' is a generic 'placeholder', reserved for empty (or non-IRQ emitting) 97[value '0' is a generic 'placeholder', reserved for empty (or non-IRQ emitting)
96slots.] 98slots.]
97 99
98generally, it's always possible to find out the correct pirq= settings, just 100Generally, it's always possible to find out the correct pirq= settings, just
99permute all IRQ numbers properly ... it will take some time though. An 101permute all IRQ numbers properly ... it will take some time though. An
100'incorrect' pirq line will cause the booting process to hang, or a device 102'incorrect' pirq line will cause the booting process to hang, or a device
101won't function properly (if it's inserted as eg. a module). 103won't function properly (e.g. if it's inserted as a module).
102 104
103If you have 2 PCI buses, then you can use up to 8 pirq values. Although such 105If you have 2 PCI buses, then you can use up to 8 pirq values, although such
104boards tend to have a good configuration. 106boards tend to have a good configuration.
105 107
106Be prepared that it might happen that you need some strange pirq line: 108Be prepared that it might happen that you need some strange pirq line:
107 109
108 append="pirq=0,0,0,0,0,0,9,11" 110 append="pirq=0,0,0,0,0,0,9,11"
109 111
110use smart try-and-err techniques to find out the correct pirq line ... 112Use smart trial-and-error techniques to find out the correct pirq line ...
111 113
112good luck and mail to linux-smp@vger.kernel.org or 114Good luck and mail to linux-smp@vger.kernel.org or
113linux-kernel@vger.kernel.org if you have any problems that are not covered 115linux-kernel@vger.kernel.org if you have any problems that are not covered
114by this document. 116by this document.
115 117
diff --git a/Documentation/ja_JP/stable_kernel_rules.txt b/Documentation/ja_JP/stable_kernel_rules.txt
index 17d87519e468..b3ffe870de33 100644
--- a/Documentation/ja_JP/stable_kernel_rules.txt
+++ b/Documentation/ja_JP/stable_kernel_rules.txt
@@ -11,69 +11,69 @@ comment or update of this file, please try to update Original(English)
11file at first. 11file at first.
12 12
13================================== 13==================================
14ãÂÂãÂ΋¯ã 14ãれã¯ã
15linux-2.6.24/Documentation/stable_kernel_rules.txt 15linux-2.6.24/Documentation/stable_kernel_rules.txt
16ã®åŒ訳ã§ãÂÂã 16ã®å’Œè¨³ã§ã。
17 17
18翻訳å£ä½Â: JF ãƒÂロã¸ã§ã¯ト < http://www.linux.or.jp/JF/ > 18翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
19翻訳æÂ¥ï¼š 2007/12/30 19翻訳日: 2007/12/30
20翻訳èÂÂ: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 20翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
21æ ¡æ­£èÂÂ: æ­¦äºÂ伸åÂÂãÂÂãÂÂãÂÂ<takei at webmasters dot gr dot jp> 21校正者: 武井伸光ãã‚“ã€<takei at webmasters dot gr dot jp>
22 ãÂÂã­ãÂÂãÂÂã“ (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp> 22 ãã­ããã‚“ (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp>
23 å°ÂæžÂéÂÂå¸ãÂÂã“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> 23 å°æž— é›…å…¸ãã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
24 éÂŽå£ãÂÂã“ (Kenji Noguchi) <tokyo246 at gmail dot com> 24 野å£ãã‚“ (Kenji Noguchi) <tokyo246 at gmail dot com>
25 神宮信太郎ãÂÂã“ <jin at libjingu dot jp> 25 神宮信太郎ãã‚“ <jin at libjingu dot jp>
26================================== 26==================================
27 27
28ãšã£ã¨知ãŠãŸãÂÂã£ãŸ Linux 2.6 -stable リリーã¹ã®å¨ã¦ 28ãšã£ã¨çŸ¥ã‚ŠãŸãã£ãŸ Linux 2.6 -stable リリースã®å…¨ã¦
29 29
30"-stable" ツリーã«ã©ã®よã†ãª種類ã®パッãƒÂãÂΌÂ—ã‘入れられるã‹ã€Âã©ã®よã†ãª 30"-stable" ツリーã«ã©ã®ã‚ˆã†ãªç¨®é¡žã®ãƒ‘ッãƒãŒå—ã‘入れられるã‹ã€ã©ã®ã‚ˆã†ãª
31ãÂÂã®ãÂΌÂÂãÂÂå¥ãÂ΋ÂÂãÂ΋ªãÂÂãÂÂãÂÂã«ã¤ãÂÂã¦ã®è¦Âå‡- 31ã‚‚ã®ãŒåã入れられãªãããã«ã¤ãã¦ã®è¦å‰‡-
32 32
33 - 明らã‹ã«正ã—ãÂÂã€Âテストã•れã¦ã„るもã®ã§ãªã‘れã°ãªらãªã„。 33 - 明らã‹ã«æ­£ã—ãã€ãƒ†ã‚¹ãƒˆã•れã¦ã„ã‚‹ã‚‚ã®ã§ãªã‘れã°ãªã‚‰ãªã„。
34 - 文脈(変更行ã®å‰Â後)をå«ã‚Â㦠100 行より大ãÂÂãÂÂã¦ã¯ã„ã‘ãªã„。 34 - 文脈(変更行ã®å‰å¾Œ)ã‚’å«ã‚㦠100 行より大ããã¦ã¯ã„ã‘ãªã„。
35 - ãŸã ä¸ÂÃ¥ÂÂã®ãÂÂã¨ã ãÂÂãÂÂ修正ãÂÂã¦ãÂÂãÂÂã¹ãÂÂã 35 - ãŸã ä¸€å€‹ã®ãã¨ã ãを修正ãã¦ãã‚‹ã¹ã。
36 - 皆を悩ã¾ãÂ݋¦ã„る本物ã®ãƒÂグを修正ã—ãªã‘れã°ãªらãªã„。("ã“れã¯ãƒÂグã§ 36 - 皆を悩ã¾ã›ã¦ã„る本物ã®ãƒã‚°ã‚’修正ã—ãªã‘れã°ãªã‚‰ãªã„。("ã“れã¯ãƒã‚°ã§
37 ãÂÂãÂÂãÂÂãÂÂãÂÂãÂ΋ªãÂÂãÂÂŒ..." ã®ãˆãÂÂãªãÂÂã®ã§ã¯ãªã„) 37 ãã‚‹ãã‚‚ãれãªããŒ..." ã®ã‚ˆããªã‚‚ã®ã§ã¯ãªã„)
38 - ビルドエラー(CONFIG_BROKENã«ãªã£ã¦ã„るもã®を除ãÂÂ), oops, ãƒÂングã€Âデー 38 - ビルドエラー(CONFIG_BROKENã«ãªã£ã¦ã„ã‚‹ã‚‚ã®ã‚’除ã), oops, ãƒãƒ³ã‚°ã€ãƒ‡ãƒ¼
39 タ破壊ã€Âç¾実ã®セキュリティå•Â題ã€ÂãÂÂã®他 "ã‚ã‚ã€Âã“れã¯ダメã ã­"ã¨ã„ㆠ39 タ破壊ã€ç¾å®Ÿã®ã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•題ã€ãã®ä»– "ã‚ã‚ã€ã“れã¯ãƒ€ãƒ¡ã ã­"ã¨ã„ã†
40 よã†ãªもã®を修正ã—ãªã‘れã°ãªらãªã„。短ãÂÂ言ãˆã°ã€Âé‡Â大ãªå•Â題。 40 よã†ãªã‚‚ã®ã‚’修正ã—ãªã‘れã°ãªã‚‰ãªã„。短ã言ãˆã°ã€é‡å¤§ãªå•題。
41 - ã©ã®よã†ã«競åˆ状態ãŒ発生ã™るã‹ã®説明も一緒ã«書ã‹れã¦ã„ãªã„é™Âり〠41 - ã©ã®ã‚ˆã†ã«ç«¶åˆçŠ¶æ…‹ãŒç™ºç”Ÿã™ã‚‹ã‹ã®èª¬æ˜Žã‚‚ä¸€ç·’ã«æ›¸ã‹ã‚Œã¦ã„ãªã„é™ã‚Šã€
42 "ç†論的ã«ã¯競åˆ状態ã«ãªる"よã†ãªもã®ã¯ä¸Âå¯。 42 "ç†è«–çš„ã«ã¯ç«¶åˆçŠ¶æ…‹ã«ãªã‚‹"よã†ãªã‚‚ã®ã¯ä¸å¯ã€‚
43 - ã„ã‹ãªる些細ãª修正もå«ã‚Âるã“ã¨ã¯ã§ãÂÂãªã„。(スペルã®修正ã€Â空白ã®クリー 43 - ã„ã‹ãªã‚‹äº›ç´°ãªä¿®æ­£ã‚‚å«ã‚ã‚‹ã“ã¨ã¯ã§ããªã„。(スペルã®ä¿®æ­£ã€ç©ºç™½ã®ã‚¯ãƒªãƒ¼
44 ンã¢ッãƒÂãªã©) 44 ンアップãªã©)
45 - 対応ã™るサブシステムメンテナãÂΌÂ—ã‘入れãŸもã®ã§ãªã‘れã°ãªらãªã„。 45 - 対応ã™ã‚‹ã‚µãƒ–システムメンテナãŒå—ã‘入れãŸã‚‚ã®ã§ãªã‘れã°ãªã‚‰ãªã„。
46 - Documentation/SubmittingPatches ã®è¦Â則ã«従ã£ãŸもã®ã§ãªã‘れã°ãªらãªã„。 46 - Documentation/SubmittingPatches ã®è¦å‰‡ã«å¾“ã£ãŸã‚‚ã®ã§ãªã‘れã°ãªã‚‰ãªã„。
47 47
48-stable ãƒÂリーã«ãƒÂッãƒÂãÂÂéÂÂ付ãÂÂãÂÂæÂÂçšãÂÂ- 48-stable ツリーã«ãƒ‘ッãƒã‚’é付ãる手続ã-
49 49
50 - 上記ã®è¦Â則ã«従ã£ã¦ã„るã‹を確èªÂã—ãŸ後ã«ã€Âstable@kernel.org ã«パッム50 - 上記ã®è¦å‰‡ã«å¾“ã£ã¦ã„ã‚‹ã‹ã‚’確èªã—ãŸå¾Œã«ã€stable@kernel.org ã«ãƒ‘ッãƒ
51 ãÂÂéÂÂãÂÂã 51 ã‚’éる。
52 - é€Â信者ã¯パッãƒÂãŒキューã«å—ã‘付ã‘られãŸ際ã«ã¯ ACK をã€Âå´下ã•れãŸ場åˆ 52 - é€ä¿¡è€…ã¯ãƒ‘ッãƒãŒã‚­ãƒ¥ãƒ¼ã«å—ã‘付ã‘られãŸéš›ã«ã¯ ACK ã‚’ã€å´ä¸‹ã•れãŸå ´åˆ
53 ã«ã¯ NAK をå—ã‘å–る。ã“ã®åÂÂ応ã¯開発者ãŸã¡ã®スケジュールã«よã£ã¦ã€Â数 53 ã«ã¯ NAK ã‚’å—ã‘å–る。ã“ã®å応ã¯é–‹ç™ºè€…ãŸã¡ã®ã‚¹ã‚±ã‚¸ãƒ¥ãƒ¼ãƒ«ã«ã‚ˆã£ã¦ã€æ•°
54 æÂ¥ãÂÂãÂÂãÂÂå ´åˆãÂ΋ÂÂãÂÂã 54 æ—¥ããã‚‹å ´åˆãŒãる。
55 - もã—å—ã‘å–られãŸらã€ÂパッãƒÂã¯他ã®開発者ãŸã¡ã®レビューã®ãŸã‚Âã« 55 - ã‚‚ã—å—ã‘å–られãŸã‚‰ã€ãƒ‘ッãƒã¯ä»–ã®é–‹ç™ºè€…ãŸã¡ã®ãƒ¬ãƒ“ューã®ãŸã‚ã«
56 -stable ã­ューã«追加ãÂÂãÂ΋ÂÂã 56 -stable キューã«è¿½åŠ ãれる。
57 - セキュリティパッãƒÂã¯ã“ã®エイリアス (stable@kernel.org) ã«é€Âられるã¹ 57 - セキュリティパッãƒã¯ã“ã®ã‚¨ã‚¤ãƒªã‚¢ã‚¹ (stable@kernel.org) ã«é€ã‚‰ã‚Œã‚‹ã¹
58 ãÂÂã§ã¯ãªãÂÂã€Â代ã‚Âりã« security@kernel.org ã®アドレスã«é€Âられる。 58 ãã§ã¯ãªãã€ä»£ã‚り㫠security@kernel.org ã®ã‚¢ãƒ‰ãƒ¬ã‚¹ã«é€ã‚‰ã‚Œã‚‹ã€‚
59 59
60レãƒÂューãµã¤ã¯ル- 60レビューサイクル-
61 61
62 - -stable メンテナãŒレビューサイクルを決ã‚Âるã¨ãÂÂã€ÂパッãƒÂã¯レビュー委 62 - -stable メンテナãŒãƒ¬ãƒ“ューサイクルを決ã‚ã‚‹ã¨ãã€ãƒ‘ッãƒã¯ãƒ¬ãƒ“ュー委
63 員会ã¨パッãƒÂãŒ影響ã™る領域ã®メンテナ(æÂÂ供者ãÂ΋ÂÂã®領域ã®メンテナã§無 63 員会ã¨ãƒ‘ッãƒãŒå½±éŸ¿ã™ã‚‹é ˜åŸŸã®ãƒ¡ãƒ³ãƒ†ãƒŠ(æä¾›è€…ãŒãã®é ˜åŸŸã®ãƒ¡ãƒ³ãƒ†ãƒŠã§ç„¡
64 ã„é™Âり)ã«é€Âられã€Âlinux-kernel メーリングリストã«CCã•れる。 64 ã„é™ã‚Š)ã«é€ã‚‰ã‚Œã€linux-kernel メーリングリストã«CCã•れる。
65 - レãƒÂューå§Âå¡会㯠48æÂÂéÂÂã®éÂÂã« ACK ã‹ NAK ãÂÂåºãÂÂã 65 - レビュー委員会㯠48時間ã®é–“ã« ACK ã‹ NAK を出ã。
66 - もã—パッãƒÂãŒ委員会ã®メンãƒÂã‹らå´下れるã‹ã€Âメンテナé”やメンãƒÂãŒ気付 66 - ã‚‚ã—パッãƒãŒå§”員会ã®ãƒ¡ãƒ³ãƒã‹ã‚‰å´ä¸‹ã•れるã‹ã€ãƒ¡ãƒ³ãƒ†ãƒŠé”やメンãƒãŒæ°—付
67 ã‹ãªã‹ã£ãŸå•Â題ãÂŒæŒÂã¡ã‚ãŒりã€Âlinux-kernel メンãƒÂãŒパッãƒÂã«異議を唱㈠67 ã‹ãªã‹ã£ãŸå•é¡ŒãŒæŒã¡ã‚ãŒã‚Šã€linux-kernel メンãƒãŒãƒ‘ッãƒã«ç•°è­°ã‚’å”±ãˆ
68 ãŸ場åˆã«ã¯ã€ÂパッãƒÂã¯キューã‹ら削除ã•れる。 68 ãŸå ´åˆã«ã¯ã€ãƒ‘ッãƒã¯ã‚­ãƒ¥ãƒ¼ã‹ã‚‰å‰Šé™¤ã•れる。
69 - レビューサイクルã®最後ã«ã€ÂACK をå—ã‘ãŸパッãƒÂã¯最新ã® -stable リリー 69 - ãƒ¬ãƒ“ãƒ¥ãƒ¼ã‚µã‚¤ã‚¯ãƒ«ã®æœ€å¾Œã«ã€ACK ã‚’å—ã‘ãŸãƒ‘ッãƒã¯æœ€æ–°ã® -stable リリー
70 スã«追加ã•れã€ÂãÂÂã®後ã«新ã—ã„ -stable リリースãŒ行ã‚Âれる。 70 スã«è¿½åŠ ã•れã€ãã®å¾Œã«æ–°ã—ã„ -stable リリースãŒè¡Œã‚れる。
71 - セキュリティパッãƒÂã¯ã€Â通常ã®レビューサイクルを通らãšã€Âセキュリティ 71 - セキュリティパッãƒã¯ã€é€šå¸¸ã®ãƒ¬ãƒ“ューサイクルを通らãšã€ã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£
72 カーãƒÂルãƒÂームã‹ら直接 -stable ツリーã«å—ã‘付ã‘られる。 72 カーãƒãƒ«ãƒãƒ¼ãƒ ã‹ã‚‰ç›´æŽ¥ -stable ツリーã«å—ã‘付ã‘られる。
73 ã“ã®手続ãÂÂã®詳細ã«ã¤ã„ã¦ã¯ kernel security ãƒÂームã«å•Âã„åˆã‚Âã›るã“ã¨。 73 ã“ã®æ‰‹ç¶šãã®è©³ç´°ã«ã¤ã„ã¦ã¯ kernel security ãƒãƒ¼ãƒ ã«å•ã„åˆã‚ã›ã‚‹ã“ã¨ã€‚
74 74
75レãƒÂューå§Âå¡会- 75レビュー委員会-
76 76
77 - ã“ã®委員会ã¯ã€Âã“ã®タスクã«ã¤ã„ã¦活動ã™る多ãÂÂã®ボランティアã¨ã€Â少数ã® 77 - ã“ã®å§”員会ã¯ã€ã“ã®ã‚¿ã‚¹ã‚¯ã«ã¤ã„ã¦æ´»å‹•ã™ã‚‹å¤šãã®ãƒœãƒ©ãƒ³ãƒ†ã‚£ã‚¢ã¨ã€å°‘æ•°ã®
78 éžボランティアã®カーãƒÂル開発者éÂӋ§構æˆÂã•れã¦ã„る。 78 éžãƒœãƒ©ãƒ³ãƒ†ã‚£ã‚¢ã®ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…é”ã§æ§‹æˆã•れã¦ã„る。
79 79
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index a4fc7fc21439..9a5b6658c65e 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -950,6 +950,41 @@ and is between 256 and 4096 characters. It is defined in the file
950 when set. 950 when set.
951 Format: <int> 951 Format: <int>
952 952
953 libata.force= [LIBATA] Force configurations. The format is comma
954 separated list of "[ID:]VAL" where ID is
955 PORT[:DEVICE]. PORT and DEVICE are decimal numbers
956 matching port, link or device. Basically, it matches
957 the ATA ID string printed on console by libata. If
958 the whole ID part is omitted, the last PORT and DEVICE
959 values are used. If ID hasn't been specified yet, the
960 configuration applies to all ports, links and devices.
961
962 If only DEVICE is omitted, the parameter applies to
963 the port and all links and devices behind it. DEVICE
964 number of 0 either selects the first device or the
965 first fan-out link behind PMP device. It does not
966 select the host link. DEVICE number of 15 selects the
967 host link and device attached to it.
968
969 The VAL specifies the configuration to force. As long
970 as there's no ambiguity shortcut notation is allowed.
971 For example, both 1.5 and 1.5G would work for 1.5Gbps.
972 The following configurations can be forced.
973
974 * Cable type: 40c, 80c, short40c, unk, ign or sata.
975 Any ID with matching PORT is used.
976
977 * SATA link speed limit: 1.5Gbps or 3.0Gbps.
978
979 * Transfer mode: pio[0-7], mwdma[0-4] and udma[0-7].
980 udma[/][16,25,33,44,66,100,133] notation is also
981 allowed.
982
983 * [no]ncq: Turn on or off NCQ.
984
985 If there are multiple matching configurations changing
986 the same attribute, the last one is used.
987
953 load_ramdisk= [RAM] List of ramdisks to load from floppy 988 load_ramdisk= [RAM] List of ramdisks to load from floppy
954 See Documentation/ramdisk.txt. 989 See Documentation/ramdisk.txt.
955 990
@@ -1056,8 +1091,6 @@ and is between 256 and 4096 characters. It is defined in the file
1056 [SCSI] Maximum number of LUNs received. 1091 [SCSI] Maximum number of LUNs received.
1057 Should be between 1 and 16384. 1092 Should be between 1 and 16384.
1058 1093
1059 mca-pentium [BUGS=X86-32]
1060
1061 mcatest= [IA-64] 1094 mcatest= [IA-64]
1062 1095
1063 mce [X86-32] Machine Check Exception 1096 mce [X86-32] Machine Check Exception
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 30c101761d0d..83f515c2905a 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -92,9 +92,8 @@ handler has run. Up to MAX_STACK_SIZE bytes are copied -- e.g.,
9264 bytes on i386. 9264 bytes on i386.
93 93
94Note that the probed function's args may be passed on the stack 94Note that the probed function's args may be passed on the stack
95or in registers (e.g., for x86_64 or for an i386 fastcall function). 95or in registers. The jprobe will work in either case, so long as the
96The jprobe will work in either case, so long as the handler's 96handler's prototype matches that of the probed function.
97prototype matches that of the probed function.
98 97
991.3 Return Probes 981.3 Return Probes
100 99
@@ -270,9 +269,9 @@ Kprobes runs the handler whose address is jp->entry.
270The handler should have the same arg list and return type as the probed 269The handler should have the same arg list and return type as the probed
271function; and just before it returns, it must call jprobe_return(). 270function; and just before it returns, it must call jprobe_return().
272(The handler never actually returns, since jprobe_return() returns 271(The handler never actually returns, since jprobe_return() returns
273control to Kprobes.) If the probed function is declared asmlinkage, 272control to Kprobes.) If the probed function is declared asmlinkage
274fastcall, or anything else that affects how args are passed, the 273or anything else that affects how args are passed, the handler's
275handler's declaration must match. 274declaration must match.
276 275
277register_jprobe() returns 0 on success, or a negative errno otherwise. 276register_jprobe() returns 0 on success, or a negative errno otherwise.
278 277
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index 6c2477754a2a..76cb428435da 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
@@ -160,7 +160,7 @@ Hot keys
160procfs: /proc/acpi/ibm/hotkey 160procfs: /proc/acpi/ibm/hotkey
161sysfs device attribute: hotkey_* 161sysfs device attribute: hotkey_*
162 162
163In a ThinkPad, the ACPI HKEY handler is responsible for comunicating 163In a ThinkPad, the ACPI HKEY handler is responsible for communicating
164some important events and also keyboard hot key presses to the operating 164some important events and also keyboard hot key presses to the operating
165system. Enabling the hotkey functionality of thinkpad-acpi signals the 165system. Enabling the hotkey functionality of thinkpad-acpi signals the
166firmware that such a driver is present, and modifies how the ThinkPad 166firmware that such a driver is present, and modifies how the ThinkPad
@@ -193,7 +193,7 @@ Not all bits in the mask can be modified. Not all bits that can be
193modified do anything. Not all hot keys can be individually controlled 193modified do anything. Not all hot keys can be individually controlled
194by the mask. Some models do not support the mask at all, and in those 194by the mask. Some models do not support the mask at all, and in those
195models, hot keys cannot be controlled individually. The behaviour of 195models, hot keys cannot be controlled individually. The behaviour of
196the mask is, therefore, higly dependent on the ThinkPad model. 196the mask is, therefore, highly dependent on the ThinkPad model.
197 197
198Note that unmasking some keys prevents their default behavior. For 198Note that unmasking some keys prevents their default behavior. For
199example, if Fn+F5 is unmasked, that key will no longer enable/disable 199example, if Fn+F5 is unmasked, that key will no longer enable/disable
@@ -288,7 +288,7 @@ sysfs notes:
288 in ACPI event mode, volume up/down/mute are reported as 288 in ACPI event mode, volume up/down/mute are reported as
289 separate events, but this behaviour may be corrected in 289 separate events, but this behaviour may be corrected in
290 future releases of this driver, in which case the 290 future releases of this driver, in which case the
291 ThinkPad volume mixer user interface semanthics will be 291 ThinkPad volume mixer user interface semantics will be
292 enforced. 292 enforced.
293 293
294 hotkey_poll_freq: 294 hotkey_poll_freq:
@@ -306,13 +306,20 @@ sysfs notes:
306 The recommended polling frequency is 10Hz. 306 The recommended polling frequency is 10Hz.
307 307
308 hotkey_radio_sw: 308 hotkey_radio_sw:
309 if the ThinkPad has a hardware radio switch, this 309 If the ThinkPad has a hardware radio switch, this
310 attribute will read 0 if the switch is in the "radios 310 attribute will read 0 if the switch is in the "radios
311 disabled" postition, and 1 if the switch is in the 311 disabled" position, and 1 if the switch is in the
312 "radios enabled" position. 312 "radios enabled" position.
313 313
314 This attribute has poll()/select() support. 314 This attribute has poll()/select() support.
315 315
316 hotkey_tablet_mode:
317 If the ThinkPad has tablet capabilities, this attribute
318 will read 0 if the ThinkPad is in normal mode, and
319 1 if the ThinkPad is in tablet mode.
320
321 This attribute has poll()/select() support.
322
316 hotkey_report_mode: 323 hotkey_report_mode:
317 Returns the state of the procfs ACPI event report mode 324 Returns the state of the procfs ACPI event report mode
318 filter for hot keys. If it is set to 1 (the default), 325 filter for hot keys. If it is set to 1 (the default),
@@ -339,7 +346,7 @@ sysfs notes:
339 wakeup_hotunplug_complete: 346 wakeup_hotunplug_complete:
340 Set to 1 if the system was waken up because of an 347 Set to 1 if the system was waken up because of an
341 undock or bay ejection request, and that request 348 undock or bay ejection request, and that request
342 was sucessfully completed. At this point, it might 349 was successfully completed. At this point, it might
343 be useful to send the system back to sleep, at the 350 be useful to send the system back to sleep, at the
344 user's choice. Refer to HKEY events 0x4003 and 351 user's choice. Refer to HKEY events 0x4003 and
345 0x3003, below. 352 0x3003, below.
@@ -392,7 +399,7 @@ event code Key Notes
392 Lenovo: battery 399 Lenovo: battery
393 400
3940x1004 0x03 FN+F4 Sleep button (ACPI sleep button 4010x1004 0x03 FN+F4 Sleep button (ACPI sleep button
395 semanthics, i.e. sleep-to-RAM). 402 semantics, i.e. sleep-to-RAM).
396 It is always generate some kind 403 It is always generate some kind
397 of event, either the hot key 404 of event, either the hot key
398 event or a ACPI sleep button 405 event or a ACPI sleep button
@@ -403,12 +410,12 @@ event code Key Notes
403 time passes. 410 time passes.
404 411
4050x1005 0x04 FN+F5 Radio. Enables/disables 4120x1005 0x04 FN+F5 Radio. Enables/disables
406 the internal BlueTooth hardware 413 the internal Bluetooth hardware
407 and W-WAN card if left in control 414 and W-WAN card if left in control
408 of the firmware. Does not affect 415 of the firmware. Does not affect
409 the WLAN card. 416 the WLAN card.
410 Should be used to turn on/off all 417 Should be used to turn on/off all
411 radios (bluetooth+W-WAN+WLAN), 418 radios (Bluetooth+W-WAN+WLAN),
412 really. 419 really.
413 420
4140x1006 0x05 FN+F6 - 4210x1006 0x05 FN+F6 -
@@ -417,7 +424,7 @@ event code Key Notes
417 Do you feel lucky today? 424 Do you feel lucky today?
418 425
4190x1008 0x07 FN+F8 IBM: toggle screen expand 4260x1008 0x07 FN+F8 IBM: toggle screen expand
420 Lenovo: configure ultranav 427 Lenovo: configure UltraNav
421 428
4220x1009 0x08 FN+F9 - 4290x1009 0x08 FN+F9 -
423 .. .. .. 430 .. .. ..
@@ -447,7 +454,7 @@ event code Key Notes
4470x1011 0x10 FN+END Brightness down. See brightness 4540x1011 0x10 FN+END Brightness down. See brightness
448 up for details. 455 up for details.
449 456
4500x1012 0x11 FN+PGUP Thinklight toggle. This key is 4570x1012 0x11 FN+PGUP ThinkLight toggle. This key is
451 always handled by the firmware, 458 always handled by the firmware,
452 even when unmasked. 459 even when unmasked.
453 460
@@ -469,7 +476,7 @@ event code Key Notes
469 key is always handled by the 476 key is always handled by the
470 firmware, even when unmasked. 477 firmware, even when unmasked.
471 478
4720x1018 0x17 THINKPAD Thinkpad/Access IBM/Lenovo key 4790x1018 0x17 THINKPAD ThinkPad/Access IBM/Lenovo key
473 480
4740x1019 0x18 unknown 4810x1019 0x18 unknown
475.. .. .. 482.. .. ..
@@ -488,9 +495,17 @@ If a key is mapped to KEY_UNKNOWN, it generates an input event that
488includes an scan code. If a key is mapped to anything else, it will 495includes an scan code. If a key is mapped to anything else, it will
489generate input device EV_KEY events. 496generate input device EV_KEY events.
490 497
498In addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW
499events for switches:
500
501SW_RADIO T60 and later hardare rfkill rocker switch
502SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A
503
491Non hot-key ACPI HKEY event map: 504Non hot-key ACPI HKEY event map:
4920x5001 Lid closed 5050x5001 Lid closed
4930x5002 Lid opened 5060x5002 Lid opened
5070x5009 Tablet swivel: switched to tablet mode
5080x500A Tablet swivel: switched to normal mode
4940x7000 Radio Switch may have changed state 5090x7000 Radio Switch may have changed state
495 510
496The above events are not propagated by the driver, except for legacy 511The above events are not propagated by the driver, except for legacy
@@ -505,9 +520,7 @@ The above events are never propagated by the driver.
505 520
5060x3003 Bay ejection (see 0x2x05) complete, can sleep again 5210x3003 Bay ejection (see 0x2x05) complete, can sleep again
5070x4003 Undocked (see 0x2x04), can sleep again 5220x4003 Undocked (see 0x2x04), can sleep again
5080x5009 Tablet swivel: switched to tablet mode 5230x500B Tablet pen inserted into its storage bay
5090x500A Tablet swivel: switched to normal mode
5100x500B Tablet pen insterted into its storage bay
5110x500C Tablet pen removed from its storage bay 5240x500C Tablet pen removed from its storage bay
5120x5010 Brightness level changed (newer Lenovo BIOSes) 5250x5010 Brightness level changed (newer Lenovo BIOSes)
513 526
@@ -539,7 +552,7 @@ sysfs (it is read-only).
539If the hotkey_report_mode module parameter is set to 1 or 2, it cannot 552If the hotkey_report_mode module parameter is set to 1 or 2, it cannot
540be changed later through sysfs (any writes will return -EPERM to signal 553be changed later through sysfs (any writes will return -EPERM to signal
541that hotkey_report_mode was locked. On 2.6.23 and later, where 554that hotkey_report_mode was locked. On 2.6.23 and later, where
542hotkey_report_mode cannot be changed at all, writes will return -EACES). 555hotkey_report_mode cannot be changed at all, writes will return -EACCES).
543 556
544hotkey_report_mode set to 1 makes the driver export through the procfs 557hotkey_report_mode set to 1 makes the driver export through the procfs
545ACPI event interface all hot key presses (which are *also* sent to the 558ACPI event interface all hot key presses (which are *also* sent to the
@@ -584,7 +597,7 @@ Sysfs notes:
584 0: disables Bluetooth / Bluetooth is disabled 597 0: disables Bluetooth / Bluetooth is disabled
585 1: enables Bluetooth / Bluetooth is enabled. 598 1: enables Bluetooth / Bluetooth is enabled.
586 599
587 Note: this interface will be probably be superseeded by the 600 Note: this interface will be probably be superseded by the
588 generic rfkill class, so it is NOT to be considered stable yet. 601 generic rfkill class, so it is NOT to be considered stable yet.
589 602
590Video output control -- /proc/acpi/ibm/video 603Video output control -- /proc/acpi/ibm/video
@@ -791,12 +804,12 @@ on the X40 (tpb is the ThinkPad Buttons utility):
791 1 - Related to "Volume up" key press 804 1 - Related to "Volume up" key press
792 2 - Related to "Mute on" key press 805 2 - Related to "Mute on" key press
793 3 - Related to "Access IBM" key press 806 3 - Related to "Access IBM" key press
794 4 - Related to "LCD brightness up" key pess 807 4 - Related to "LCD brightness up" key press
795 5 - Related to "LCD brightness down" key press 808 5 - Related to "LCD brightness down" key press
796 11 - Related to "toggle screen expansion" key press/function 809 11 - Related to "toggle screen expansion" key press/function
797 12 - Related to "ThinkLight on" 810 12 - Related to "ThinkLight on"
798 13 - Related to "ThinkLight off" 811 13 - Related to "ThinkLight off"
799 14 - Related to "ThinkLight" key press (toggle thinklight) 812 14 - Related to "ThinkLight" key press (toggle ThinkLight)
800 813
801The cmos command interface is prone to firmware split-brain problems, as 814The cmos command interface is prone to firmware split-brain problems, as
802in newer ThinkPads it is just a compatibility layer. Do not use it, it is 815in newer ThinkPads it is just a compatibility layer. Do not use it, it is
@@ -1024,7 +1037,7 @@ There are two interfaces to the firmware for direct brightness control,
1024EC and CMOS. To select which one should be used, use the 1037EC and CMOS. To select which one should be used, use the
1025brightness_mode module parameter: brightness_mode=1 selects EC mode, 1038brightness_mode module parameter: brightness_mode=1 selects EC mode,
1026brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC 1039brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC
1027and CMOS. The driver tries to autodetect which interface to use. 1040and CMOS. The driver tries to auto-detect which interface to use.
1028 1041
1029When display backlight brightness controls are available through the 1042When display backlight brightness controls are available through the
1030standard ACPI interface, it is best to use it instead of this direct 1043standard ACPI interface, it is best to use it instead of this direct
@@ -1266,8 +1279,8 @@ experimental=1 parameter when loading the module.
1266This feature shows the presence and current state of a W-WAN (Sierra 1279This feature shows the presence and current state of a W-WAN (Sierra
1267Wireless EV-DO) device. 1280Wireless EV-DO) device.
1268 1281
1269It was tested on a Lenovo Thinkpad X60. It should probably work on other 1282It was tested on a Lenovo ThinkPad X60. It should probably work on other
1270Thinkpad models which come with this module installed. 1283ThinkPad models which come with this module installed.
1271 1284
1272Procfs notes: 1285Procfs notes:
1273 1286
@@ -1286,7 +1299,7 @@ Sysfs notes:
1286 0: disables WWAN card / WWAN card is disabled 1299 0: disables WWAN card / WWAN card is disabled
1287 1: enables WWAN card / WWAN card is enabled. 1300 1: enables WWAN card / WWAN card is enabled.
1288 1301
1289 Note: this interface will be probably be superseeded by the 1302 Note: this interface will be probably be superseded by the
1290 generic rfkill class, so it is NOT to be considered stable yet. 1303 generic rfkill class, so it is NOT to be considered stable yet.
1291 1304
1292Multiple Commands, Module Parameters 1305Multiple Commands, Module Parameters
@@ -1309,7 +1322,7 @@ Enabling debugging output
1309The module takes a debug parameter which can be used to selectively 1322The module takes a debug parameter which can be used to selectively
1310enable various classes of debugging output, for example: 1323enable various classes of debugging output, for example:
1311 1324
1312 modprobe ibm_acpi debug=0xffff 1325 modprobe thinkpad_acpi debug=0xffff
1313 1326
1314will enable all debugging output classes. It takes a bitmask, so 1327will enable all debugging output classes. It takes a bitmask, so
1315to enable more than one output class, just add their values. 1328to enable more than one output class, just add their values.
@@ -1356,7 +1369,7 @@ Sysfs interface changelog:
1356 NVRAM is compiled out by the user because it is 1369 NVRAM is compiled out by the user because it is
1357 unneeded/undesired in the first place). 1370 unneeded/undesired in the first place).
13580x020101: Marker for thinkpad-acpi with hot key NVRAM polling 13710x020101: Marker for thinkpad-acpi with hot key NVRAM polling
1359 and proper hotkey_mask semanthics (version 8 of the 1372 and proper hotkey_mask semantics (version 8 of the
1360 NVRAM polling patch). Some development snapshots of 1373 NVRAM polling patch). Some development snapshots of
1361 0.18 had an earlier version that did strange things 1374 0.18 had an earlier version that did strange things
1362 to hotkey_mask. 1375 to hotkey_mask.
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 4e17beba2379..1f506f7830ec 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -1493,7 +1493,7 @@ explicit lock operations, described later). These include:
1493 atomic_dec_and_test(); 1493 atomic_dec_and_test();
1494 atomic_sub_and_test(); 1494 atomic_sub_and_test();
1495 atomic_add_negative(); 1495 atomic_add_negative();
1496 atomic_add_unless(); 1496 atomic_add_unless(); /* when succeeds (returns 1) */
1497 test_and_set_bit(); 1497 test_and_set_bit();
1498 test_and_clear_bit(); 1498 test_and_clear_bit();
1499 test_and_change_bit(); 1499 test_and_change_bit();
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt
index c53d26361919..461e4f1dbec4 100644
--- a/Documentation/power/devices.txt
+++ b/Documentation/power/devices.txt
@@ -310,9 +310,12 @@ used with suspend-to-disk:
310 PM_EVENT_SUSPEND -- quiesce the driver and put hardware into a low-power 310 PM_EVENT_SUSPEND -- quiesce the driver and put hardware into a low-power
311 state. When used with system sleep states like "suspend-to-RAM" or 311 state. When used with system sleep states like "suspend-to-RAM" or
312 "standby", the upcoming resume() call will often be able to rely on 312 "standby", the upcoming resume() call will often be able to rely on
313 state kept in hardware, or issue system wakeup events. When used 313 state kept in hardware, or issue system wakeup events.
314 instead with suspend-to-disk, few devices support this capability; 314
315 most are completely powered off. 315 PM_EVENT_HIBERNATE -- Put hardware into a low-power state and enable wakeup
316 events as appropriate. It is only used with hibernation
317 (suspend-to-disk) and few devices are able to wake up the system from
318 this state; most are completely powered off.
316 319
317 PM_EVENT_FREEZE -- quiesce the driver, but don't necessarily change into 320 PM_EVENT_FREEZE -- quiesce the driver, but don't necessarily change into
318 any low power mode. A system snapshot is about to be taken, often 321 any low power mode. A system snapshot is about to be taken, often
@@ -329,8 +332,8 @@ used with suspend-to-disk:
329 wakeup events nor DMA are allowed. 332 wakeup events nor DMA are allowed.
330 333
331To enter "standby" (ACPI S1) or "Suspend to RAM" (STR, ACPI S3) states, or 334To enter "standby" (ACPI S1) or "Suspend to RAM" (STR, ACPI S3) states, or
332the similarly named APM states, only PM_EVENT_SUSPEND is used; for "Suspend 335the similarly named APM states, only PM_EVENT_SUSPEND is used; the other event
333to Disk" (STD, hibernate, ACPI S4), all of those event codes are used. 336codes are used for hibernation ("Suspend to Disk", STD, ACPI S4).
334 337
335There's also PM_EVENT_ON, a value which never appears as a suspend event 338There's also PM_EVENT_ON, a value which never appears as a suspend event
336but is sometimes used to record the "not suspended" device state. 339but is sometimes used to record the "not suspended" device state.
diff --git a/Documentation/sched-rt-group.txt b/Documentation/sched-rt-group.txt
new file mode 100644
index 000000000000..1c6332f4543c
--- /dev/null
+++ b/Documentation/sched-rt-group.txt
@@ -0,0 +1,59 @@
1
2
3Real-Time group scheduling.
4
5The problem space:
6
7In order to schedule multiple groups of realtime tasks each group must
8be assigned a fixed portion of the CPU time available. Without a minimum
9guarantee a realtime group can obviously fall short. A fuzzy upper limit
10is of no use since it cannot be relied upon. Which leaves us with just
11the single fixed portion.
12
13CPU time is divided by means of specifying how much time can be spent
14running in a given period. Say a frame fixed realtime renderer must
15deliver 25 frames a second, which yields a period of 0.04s. Now say
16it will also have to play some music and respond to input, leaving it
17with around 80% for the graphics. We can then give this group a runtime
18of 0.8 * 0.04s = 0.032s.
19
20This way the graphics group will have a 0.04s period with a 0.032s runtime
21limit.
22
23Now if the audio thread needs to refill the DMA buffer every 0.005s, but
24needs only about 3% CPU time to do so, it can do with a 0.03 * 0.005s
25= 0.00015s.
26
27
28The Interface:
29
30system wide:
31
32/proc/sys/kernel/sched_rt_period_ms
33/proc/sys/kernel/sched_rt_runtime_us
34
35CONFIG_FAIR_USER_SCHED
36
37/sys/kernel/uids/<uid>/cpu_rt_runtime_us
38
39or
40
41CONFIG_FAIR_CGROUP_SCHED
42
43/cgroup/<cgroup>/cpu.rt_runtime_us
44
45[ time is specified in us because the interface is s32; this gives an
46 operating range of ~35m to 1us ]
47
48The period takes values in [ 1, INT_MAX ], runtime in [ -1, INT_MAX - 1 ].
49
50A runtime of -1 specifies runtime == period, ie. no limit.
51
52New groups get the period from /proc/sys/kernel/sched_rt_period_us and
53a runtime of 0.
54
55Settings are constrained to:
56
57 \Sum_{i} runtime_{i} / global_period <= global_runtime / global_period
58
59in order to keep the configuration schedulable.
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
index c815c5206e84..4cfc78835bc1 100644
--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -16,8 +16,9 @@ Rules on what kind of patches are accepted, and which ones are not, into the
16 race can be exploited is also provided. 16 race can be exploited is also provided.
17 - It cannot contain any "trivial" fixes in it (spelling changes, 17 - It cannot contain any "trivial" fixes in it (spelling changes,
18 whitespace cleanups, etc). 18 whitespace cleanups, etc).
19 - It must be accepted by the relevant subsystem maintainer.
20 - It must follow the Documentation/SubmittingPatches rules. 19 - It must follow the Documentation/SubmittingPatches rules.
20 - It or an equivalent fix must already exist in Linus' tree. Quote the
21 respective commit ID in Linus' tree in your patch submission to -stable.
21 22
22 23
23Procedure for submitting patches to the -stable tree: 24Procedure for submitting patches to the -stable tree:
@@ -28,7 +29,9 @@ Procedure for submitting patches to the -stable tree:
28 queue, or a NAK if the patch is rejected. This response might take a few 29 queue, or a NAK if the patch is rejected. This response might take a few
29 days, according to the developer's schedules. 30 days, according to the developer's schedules.
30 - If accepted, the patch will be added to the -stable queue, for review by 31 - If accepted, the patch will be added to the -stable queue, for review by
31 other developers. 32 other developers and by the relevant subsystem maintainer.
33 - If the stable@kernel.org address is added to a patch, when it goes into
34 Linus's tree it will automatically be emailed to the stable team.
32 - Security patches should not be sent to this alias, but instead to the 35 - Security patches should not be sent to this alias, but instead to the
33 documented security@kernel.org address. 36 documented security@kernel.org address.
34 37
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index dc8801d4e944..276a7e637822 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -29,7 +29,7 @@ show up in /proc/sys/kernel:
29- java-interpreter [ binfmt_java, obsolete ] 29- java-interpreter [ binfmt_java, obsolete ]
30- kstack_depth_to_print [ X86 only ] 30- kstack_depth_to_print [ X86 only ]
31- l2cr [ PPC only ] 31- l2cr [ PPC only ]
32- modprobe ==> Documentation/kmod.txt 32- modprobe ==> Documentation/debugging-modules.txt
33- msgmax 33- msgmax
34- msgmnb 34- msgmnb
35- msgmni 35- msgmni
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index 6a8469f2bcae..f40e09296f30 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -8,7 +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/DVC 100 (em2820/em2840) [2304:0207,2304:021a] 10 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a]
11 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500] 11 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500,2040:6502]
12 11 -> Terratec Hybrid XS (em2880) [0ccd:0042] 12 11 -> Terratec Hybrid XS (em2880) [0ccd:0042]
13 12 -> Kworld PVR TV 2800 RF (em2820/em2840) 13 12 -> Kworld PVR TV 2800 RF (em2820/em2840)
14 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] 14 13 -> Terratec Prodigy XS (em2880) [0ccd:0047]
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index 5d3b6b4d2515..0424901ebc78 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -92,9 +92,9 @@
92 91 -> AVerMedia A169 B [1461:7360] 92 91 -> AVerMedia A169 B [1461:7360]
93 92 -> AVerMedia A169 B1 [1461:6360] 93 92 -> AVerMedia A169 B1 [1461:6360]
94 93 -> Medion 7134 Bridge #2 [16be:0005] 94 93 -> Medion 7134 Bridge #2 [16be:0005]
95 94 -> LifeView FlyDVB-T Hybrid Cardbus/MSI TV @nywhere A/D NB [5168:3306,5168:3502,4e42:3502] 95 94 -> LifeView FlyDVB-T Hybrid Cardbus/MSI TV @nywhere A/D NB [5168:3306,5168:3502,5168:3307,4e42:3502]
96 95 -> LifeView FlyVIDEO3000 (NTSC) [5169:0138] 96 95 -> LifeView FlyVIDEO3000 (NTSC) [5169:0138]
97 96 -> Medion Md8800 Quadro [16be:0007,16be:0008] 97 96 -> Medion Md8800 Quadro [16be:0007,16be:0008,16be:000d]
98 97 -> LifeView FlyDVB-S /Acorp TV134DS [5168:0300,4e42:0300] 98 97 -> LifeView FlyDVB-S /Acorp TV134DS [5168:0300,4e42:0300]
99 98 -> Proteus Pro 2309 [0919:2003] 99 98 -> Proteus Pro 2309 [0919:2003]
100 99 -> AVerMedia TV Hybrid A16AR [1461:2c00] 100 99 -> AVerMedia TV Hybrid A16AR [1461:2c00]
@@ -129,3 +129,5 @@
129128 -> Beholder BeholdTV Columbus TVFM [0000:5201] 129128 -> Beholder BeholdTV Columbus TVFM [0000:5201]
130129 -> Beholder BeholdTV 607 / BeholdTV 609 [5ace:6070,5ace:6071,5ace:6072,5ace:6073,5ace:6090,5ace:6091,5ace:6092,5ace:6093] 130129 -> Beholder BeholdTV 607 / BeholdTV 609 [5ace:6070,5ace:6071,5ace:6072,5ace:6073,5ace:6090,5ace:6091,5ace:6092,5ace:6093]
131130 -> Beholder BeholdTV M6 / BeholdTV M6 Extra [5ace:6190,5ace:6193] 131130 -> Beholder BeholdTV M6 / BeholdTV M6 Extra [5ace:6190,5ace:6193]
132131 -> Twinhan Hybrid DTV-DVB 3056 PCI [1822:0022]
133132 -> Genius TVGO AM11MCE
diff --git a/Documentation/video4linux/zr364xx.txt b/Documentation/video4linux/zr364xx.txt
index 4d9a0c33f2fd..5c81e3ae6458 100644
--- a/Documentation/video4linux/zr364xx.txt
+++ b/Documentation/video4linux/zr364xx.txt
@@ -25,7 +25,7 @@ modprobe zr364xx debug=X mode=Y
25 - debug : set to 1 to enable verbose debug messages 25 - debug : set to 1 to enable verbose debug messages
26 - mode : 0 = 320x240, 1 = 160x120, 2 = 640x480 26 - mode : 0 = 320x240, 1 = 160x120, 2 = 640x480
27You can then use the camera with V4L2 compatible applications, for example Ekiga. 27You can then use the camera with V4L2 compatible applications, for example Ekiga.
28To capture a single image, try this: dd if=/dev/video0 of=test.jpg bs=1 count=1 28To capture a single image, try this: dd if=/dev/video0 of=test.jpg bs=1M count=1
29 29
30links : 30links :
31http://mxhaard.free.fr/ (support for many others cams including some Aiptek PocketDV) 31http://mxhaard.free.fr/ (support for many others cams including some Aiptek PocketDV)
@@ -63,3 +63,5 @@ Vendor Product Distributor Model
630x06d6 0x0034 Trust Powerc@m 750 630x06d6 0x0034 Trust Powerc@m 750
640x0a17 0x0062 Pentax Optio 50L 640x0a17 0x0062 Pentax Optio 50L
650x06d6 0x003b Trust Powerc@m 970Z 650x06d6 0x003b Trust Powerc@m 970Z
660x0a17 0x004e Pentax Optio 50
670x041e 0x405d Creative DiVi CAM 516
diff --git a/Documentation/vm/slabinfo.c b/Documentation/vm/slabinfo.c
index 7123fee708ca..22d7e3e4d60c 100644
--- a/Documentation/vm/slabinfo.c
+++ b/Documentation/vm/slabinfo.c
@@ -1123,7 +1123,7 @@ void read_slab_dir(void)
1123 char *t; 1123 char *t;
1124 int count; 1124 int count;
1125 1125
1126 if (chdir("/sys/kernel/slab")) 1126 if (chdir("/sys/kernel/slab") && chdir("/sys/slab"))
1127 fatal("SYSFS support for SLUB not active\n"); 1127 fatal("SYSFS support for SLUB not active\n");
1128 1128
1129 dir = opendir("."); 1129 dir = opendir(".");
diff --git a/MAINTAINERS b/MAINTAINERS
index 6680ec44779e..36c7bc641dba 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -640,8 +640,8 @@ S: Maintained
640ASYNCHRONOUS TRANSFERS/TRANSFORMS API 640ASYNCHRONOUS TRANSFERS/TRANSFORMS API
641P: Dan Williams 641P: Dan Williams
642M: dan.j.williams@intel.com 642M: dan.j.williams@intel.com
643P: Shannon Nelson 643P: Maciej Sosnowski
644M: shannon.nelson@intel.com 644M: maciej.sosnowski@intel.com
645L: linux-kernel@vger.kernel.org 645L: linux-kernel@vger.kernel.org
646W: http://sourceforge.net/projects/xscaleiop 646W: http://sourceforge.net/projects/xscaleiop
647S: Supported 647S: Supported
@@ -697,7 +697,7 @@ S: Supported
697ATMEL LCDFB DRIVER 697ATMEL LCDFB DRIVER
698P: Nicolas Ferre 698P: Nicolas Ferre
699M: nicolas.ferre@atmel.com 699M: nicolas.ferre@atmel.com
700L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 700L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
701S: Maintained 701S: Maintained
702 702
703ATMEL MACB ETHERNET DRIVER 703ATMEL MACB ETHERNET DRIVER
@@ -1202,7 +1202,7 @@ S: Maintained
1202CYBLAFB FRAMEBUFFER DRIVER 1202CYBLAFB FRAMEBUFFER DRIVER
1203P: Knut Petersen 1203P: Knut Petersen
1204M: Knut_Petersen@t-online.de 1204M: Knut_Petersen@t-online.de
1205L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1205L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
1206S: Maintained 1206S: Maintained
1207 1207
1208CYCLADES 2X SYNC CARD DRIVER 1208CYCLADES 2X SYNC CARD DRIVER
@@ -1255,8 +1255,8 @@ W: http://linux-net.osdl.org/index.php/DCCP
1255S: Maintained 1255S: Maintained
1256 1256
1257DECnet NETWORK LAYER 1257DECnet NETWORK LAYER
1258P: Patrick Caulfield 1258P: Christine Caulfield
1259M: patrick@tykepenguin.com 1259M: christine.caulfield@googlemail.com
1260W: http://linux-decnet.sourceforge.net 1260W: http://linux-decnet.sourceforge.net
1261L: linux-decnet-user@lists.sourceforge.net 1261L: linux-decnet-user@lists.sourceforge.net
1262S: Maintained 1262S: Maintained
@@ -1318,14 +1318,13 @@ L: linux-kernel@vger.kernel.org
1318S: Maintained 1318S: Maintained
1319 1319
1320DISTRIBUTED LOCK MANAGER 1320DISTRIBUTED LOCK MANAGER
1321P: Patrick Caulfield 1321P: Christine Caulfield
1322M: pcaulfie@redhat.com 1322M: ccaulfie@redhat.com
1323P: David Teigland 1323P: David Teigland
1324M: teigland@redhat.com 1324M: teigland@redhat.com
1325L: cluster-devel@redhat.com 1325L: cluster-devel@redhat.com
1326W: http://sources.redhat.com/cluster/ 1326W: http://sources.redhat.com/cluster/
1327T: git kernel.org:/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes.git 1327T: git kernel.org:/pub/scm/linux/kernel/git/teigland/dlm.git
1328T: git kernel.org:/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw.git
1329S: Supported 1328S: Supported
1330 1329
1331DAVICOM FAST ETHERNET (DMFE) NETWORK DRIVER 1330DAVICOM FAST ETHERNET (DMFE) NETWORK DRIVER
@@ -1335,8 +1334,8 @@ L: netdev@vger.kernel.org
1335S: Maintained 1334S: Maintained
1336 1335
1337DMA GENERIC OFFLOAD ENGINE SUBSYSTEM 1336DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
1338P: Shannon Nelson 1337P: Maciej Sosnowski
1339M: shannon.nelson@intel.com 1338M: maciej.sosnowski@intel.com
1340P: Dan Williams 1339P: Dan Williams
1341M: dan.j.williams@intel.com 1340M: dan.j.williams@intel.com
1342L: linux-kernel@vger.kernel.org 1341L: linux-kernel@vger.kernel.org
@@ -1580,7 +1579,7 @@ S: Supported
1580FRAMEBUFFER LAYER 1579FRAMEBUFFER LAYER
1581P: Antonino Daplas 1580P: Antonino Daplas
1582M: adaplas@gmail.com 1581M: adaplas@gmail.com
1583L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1582L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
1584W: http://linux-fbdev.sourceforge.net/ 1583W: http://linux-fbdev.sourceforge.net/
1585S: Maintained 1584S: Maintained
1586 1585
@@ -1616,6 +1615,7 @@ S: Maintained
1616FILESYSTEMS (VFS and infrastructure) 1615FILESYSTEMS (VFS and infrastructure)
1617P: Alexander Viro 1616P: Alexander Viro
1618M: viro@zeniv.linux.org.uk 1617M: viro@zeniv.linux.org.uk
1618L: linux-fsdevel@vger.kernel.org
1619S: Maintained 1619S: Maintained
1620 1620
1621FIREWIRE SUBSYSTEM (drivers/firewire, <linux/firewire*.h>) 1621FIREWIRE SUBSYSTEM (drivers/firewire, <linux/firewire*.h>)
@@ -1712,9 +1712,7 @@ T: git lm-sensors.org:/kernel/mhoffman/hwmon-2.6.git release
1712S: Maintained 1712S: Maintained
1713 1713
1714HARDWARE RANDOM NUMBER GENERATOR CORE 1714HARDWARE RANDOM NUMBER GENERATOR CORE
1715P: Michael Buesch 1715S: Orphaned
1716M: mb@bu3sch.de
1717S: Maintained
1718 1716
1719HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER 1717HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
1720P: Robert Love 1718P: Robert Love
@@ -1923,7 +1921,7 @@ S: Maintained
1923 1921
1924IDE/ATAPI CDROM DRIVER 1922IDE/ATAPI CDROM DRIVER
1925P: Borislav Petkov 1923P: Borislav Petkov
1926M: bbpetkov@yahoo.de 1924M: petkovbb@gmail.com
1927L: linux-ide@vger.kernel.org 1925L: linux-ide@vger.kernel.org
1928S: Maintained 1926S: Maintained
1929 1927
@@ -1964,7 +1962,7 @@ L: linux1394-devel@lists.sourceforge.net
1964S: Maintained 1962S: Maintained
1965 1963
1966IMS TWINTURBO FRAMEBUFFER DRIVER 1964IMS TWINTURBO FRAMEBUFFER DRIVER
1967L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1965L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
1968S: Orphan 1966S: Orphan
1969 1967
1970INFINIBAND SUBSYSTEM 1968INFINIBAND SUBSYSTEM
@@ -1998,13 +1996,13 @@ S: Maintained
1998INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) 1996INTEL FRAMEBUFFER DRIVER (excluding 810 and 815)
1999P: Sylvain Meyer 1997P: Sylvain Meyer
2000M: sylvain.meyer@worldonline.fr 1998M: sylvain.meyer@worldonline.fr
2001L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1999L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
2002S: Maintained 2000S: Maintained
2003 2001
2004INTEL 810/815 FRAMEBUFFER DRIVER 2002INTEL 810/815 FRAMEBUFFER DRIVER
2005P: Antonino Daplas 2003P: Antonino Daplas
2006M: adaplas@gmail.com 2004M: adaplas@gmail.com
2007L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 2005L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
2008S: Maintained 2006S: Maintained
2009 2007
2010INTEL IA32 MICROCODE UPDATE SUPPORT 2008INTEL IA32 MICROCODE UPDATE SUPPORT
@@ -2013,8 +2011,8 @@ M: tigran@aivazian.fsnet.co.uk
2013S: Maintained 2011S: Maintained
2014 2012
2015INTEL I/OAT DMA DRIVER 2013INTEL I/OAT DMA DRIVER
2016P: Shannon Nelson 2014P: Maciej Sosnowski
2017M: shannon.nelson@intel.com 2015M: maciej.sosnowski@intel.com
2018L: linux-kernel@vger.kernel.org 2016L: linux-kernel@vger.kernel.org
2019S: Supported 2017S: Supported
2020 2018
@@ -2600,7 +2598,7 @@ S: Odd Fixes for 2.4; Maintained for 2.6.
2600MATROX FRAMEBUFFER DRIVER 2598MATROX FRAMEBUFFER DRIVER
2601P: Petr Vandrovec 2599P: Petr Vandrovec
2602M: vandrove@vc.cvut.cz 2600M: vandrove@vc.cvut.cz
2603L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 2601L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
2604S: Maintained 2602S: Maintained
2605 2603
2606MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER 2604MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER
@@ -2909,7 +2907,7 @@ S: Maintained
2909NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER 2907NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER
2910P: Antonino Daplas 2908P: Antonino Daplas
2911M: adaplas@gmail.com 2909M: adaplas@gmail.com
2912L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 2910L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
2913S: Maintained 2911S: Maintained
2914 2912
2915OPENCORES I2C BUS DRIVER 2913OPENCORES I2C BUS DRIVER
@@ -3238,13 +3236,13 @@ S: Maintained
3238RADEON FRAMEBUFFER DISPLAY DRIVER 3236RADEON FRAMEBUFFER DISPLAY DRIVER
3239P: Benjamin Herrenschmidt 3237P: Benjamin Herrenschmidt
3240M: benh@kernel.crashing.org 3238M: benh@kernel.crashing.org
3241L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 3239L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
3242S: Maintained 3240S: Maintained
3243 3241
3244RAGE128 FRAMEBUFFER DISPLAY DRIVER 3242RAGE128 FRAMEBUFFER DISPLAY DRIVER
3245P: Paul Mackerras 3243P: Paul Mackerras
3246M: paulus@samba.org 3244M: paulus@samba.org
3247L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 3245L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
3248S: Maintained 3246S: Maintained
3249 3247
3250RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER 3248RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER
@@ -3349,7 +3347,7 @@ S: Maintained
3349S3 SAVAGE FRAMEBUFFER DRIVER 3347S3 SAVAGE FRAMEBUFFER DRIVER
3350P: Antonino Daplas 3348P: Antonino Daplas
3351M: adaplas@gmail.com 3349M: adaplas@gmail.com
3352L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 3350L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers)
3353S: Maintained 3351S: Maintained
3354 3352
3355S390 3353S390
@@ -4261,7 +4259,7 @@ S: Maintained
4261 4259
4262VT8231 HARDWARE MONITOR DRIVER 4260VT8231 HARDWARE MONITOR DRIVER
4263P: Roger Lucas 4261P: Roger Lucas
4264M: roger@planbit.co.uk 4262M: vt8231@hiddenengine.co.uk
4265L: lm-sensors@lm-sensors.org 4263L: lm-sensors@lm-sensors.org
4266S: Maintained 4264S: Maintained
4267 4265
diff --git a/Makefile b/Makefile
index c162370c7367..99300dc680e9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 25 3SUBLEVEL = 25
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Arr Matey! A Hairy Bilge Rat! 5NAME = Funky Weasel is Jiggy wit it
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
@@ -507,6 +507,10 @@ else
507KBUILD_CFLAGS += -O2 507KBUILD_CFLAGS += -O2
508endif 508endif
509 509
510# Force gcc to behave correct even for buggy distributions
511# Arch Makefiles may override this setting
512KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
513
510include $(srctree)/arch/$(SRCARCH)/Makefile 514include $(srctree)/arch/$(SRCARCH)/Makefile
511 515
512ifdef CONFIG_FRAME_POINTER 516ifdef CONFIG_FRAME_POINTER
@@ -525,9 +529,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
525KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) 529KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
526endif 530endif
527 531
528# Force gcc to behave correct even for buggy distributions
529KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
530
531# arch Makefile may override CC so keep this after arch Makefile is included 532# arch Makefile may override CC so keep this after arch Makefile is included
532NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) 533NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
533CHECKFLAGS += $(NOSTDINC_FLAGS) 534CHECKFLAGS += $(NOSTDINC_FLAGS)
@@ -810,7 +811,9 @@ endif
810 $(Q)rm -f .old_version 811 $(Q)rm -f .old_version
811 812
812# build vmlinux.o first to catch section mismatch errors early 813# build vmlinux.o first to catch section mismatch errors early
813$(kallsyms.o): vmlinux.o 814ifdef CONFIG_KALLSYMS
815.tmp_vmlinux1: vmlinux.o
816endif
814vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE 817vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE
815 $(call if_changed_rule,vmlinux-modpost) 818 $(call if_changed_rule,vmlinux-modpost)
816 819
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 973c5c3705e3..8c71daf94a59 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -259,8 +259,8 @@ osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bu
259 259
260 retval = user_path_walk(path, &nd); 260 retval = user_path_walk(path, &nd);
261 if (!retval) { 261 if (!retval) {
262 retval = do_osf_statfs(nd.dentry, buffer, bufsiz); 262 retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz);
263 path_release(&nd); 263 path_put(&nd.path);
264 } 264 }
265 return retval; 265 return retval;
266} 266}
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 1dd50d07693c..75480cab0893 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -119,13 +119,8 @@ irqreturn_t timer_interrupt(int irq, void *dev)
119 state.partial_tick = delta & ((1UL << FIX_SHIFT) - 1); 119 state.partial_tick = delta & ((1UL << FIX_SHIFT) - 1);
120 nticks = delta >> FIX_SHIFT; 120 nticks = delta >> FIX_SHIFT;
121 121
122 while (nticks > 0) { 122 if (nticks)
123 do_timer(1); 123 do_timer(nticks);
124#ifndef CONFIG_SMP
125 update_process_times(user_mode(get_irq_regs()));
126#endif
127 nticks--;
128 }
129 124
130 /* 125 /*
131 * If we have an externally synchronized Linux clock, then update 126 * If we have an externally synchronized Linux clock, then update
@@ -141,6 +136,12 @@ irqreturn_t timer_interrupt(int irq, void *dev)
141 } 136 }
142 137
143 write_sequnlock(&xtime_lock); 138 write_sequnlock(&xtime_lock);
139
140#ifndef CONFIG_SMP
141 while (nticks--)
142 update_process_times(user_mode(get_irq_regs()));
143#endif
144
144 return IRQ_HANDLED; 145 return IRQ_HANDLED;
145} 146}
146 147
diff --git a/arch/arm/mach-orion/ts209-setup.c b/arch/arm/mach-orion/ts209-setup.c
index 306dbcd1e37b..b8cfe6813e9d 100644
--- a/arch/arm/mach-orion/ts209-setup.c
+++ b/arch/arm/mach-orion/ts209-setup.c
@@ -192,9 +192,13 @@ static struct mv643xx_eth_platform_data qnap_ts209_eth_data = {
192/***************************************************************************** 192/*****************************************************************************
193 * RTC S35390A on I2C bus 193 * RTC S35390A on I2C bus
194 ****************************************************************************/ 194 ****************************************************************************/
195
196#define TS209_RTC_GPIO 3
197
195static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = { 198static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = {
196 .driver_name = "rtc-s35390a", 199 .driver_name = "rtc-s35390a",
197 .addr = 0x30, 200 .addr = 0x30,
201 .irq = 0,
198}; 202};
199 203
200/**************************************************************************** 204/****************************************************************************
@@ -328,7 +332,18 @@ static void __init qnap_ts209_init(void)
328 332
329 platform_add_devices(qnap_ts209_devices, 333 platform_add_devices(qnap_ts209_devices,
330 ARRAY_SIZE(qnap_ts209_devices)); 334 ARRAY_SIZE(qnap_ts209_devices));
335
336 /* Get RTC IRQ and register the chip */
337 if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) {
338 if (gpio_direction_input(TS209_RTC_GPIO) == 0)
339 qnap_ts209_i2c_rtc.irq = gpio_to_irq(TS209_RTC_GPIO);
340 else
341 gpio_free(TS209_RTC_GPIO);
342 }
343 if (qnap_ts209_i2c_rtc.irq == 0)
344 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n");
331 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1); 345 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
346
332 orion_eth_init(&qnap_ts209_eth_data); 347 orion_eth_init(&qnap_ts209_eth_data);
333 orion_sata_init(&qnap_ts209_sata_data); 348 orion_sata_init(&qnap_ts209_sata_data);
334} 349}
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index 83ef5ecaf432..df5ae2710ab1 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -23,18 +23,27 @@ static LIST_HEAD(clocks);
23static DEFINE_MUTEX(clocks_mutex); 23static DEFINE_MUTEX(clocks_mutex);
24static DEFINE_SPINLOCK(clocks_lock); 24static DEFINE_SPINLOCK(clocks_lock);
25 25
26static struct clk *clk_lookup(struct device *dev, const char *id)
27{
28 struct clk *p;
29
30 list_for_each_entry(p, &clocks, node)
31 if (strcmp(id, p->name) == 0 && p->dev == dev)
32 return p;
33
34 return NULL;
35}
36
26struct clk *clk_get(struct device *dev, const char *id) 37struct clk *clk_get(struct device *dev, const char *id)
27{ 38{
28 struct clk *p, *clk = ERR_PTR(-ENOENT); 39 struct clk *p, *clk = ERR_PTR(-ENOENT);
29 40
30 mutex_lock(&clocks_mutex); 41 mutex_lock(&clocks_mutex);
31 list_for_each_entry(p, &clocks, node) { 42 p = clk_lookup(dev, id);
32 if (strcmp(id, p->name) == 0 && 43 if (!p)
33 (p->dev == NULL || p->dev == dev)) { 44 p = clk_lookup(NULL, id);
34 clk = p; 45 if (p)
35 break; 46 clk = p;
36 }
37 }
38 mutex_unlock(&clocks_mutex); 47 mutex_unlock(&clocks_mutex);
39 48
40 return clk; 49 return clk;
diff --git a/arch/arm/mach-pxa/cpu-pxa.c b/arch/arm/mach-pxa/cpu-pxa.c
index cbc583beedc8..939a3867f77c 100644
--- a/arch/arm/mach-pxa/cpu-pxa.c
+++ b/arch/arm/mach-pxa/cpu-pxa.c
@@ -134,7 +134,7 @@ static int pxa_set_target(struct cpufreq_policy *policy,
134 struct cpufreq_frequency_table *pxa_freqs_table; 134 struct cpufreq_frequency_table *pxa_freqs_table;
135 pxa_freqs_t *pxa_freq_settings; 135 pxa_freqs_t *pxa_freq_settings;
136 struct cpufreq_freqs freqs; 136 struct cpufreq_freqs freqs;
137 int idx; 137 unsigned int idx;
138 unsigned long flags; 138 unsigned long flags;
139 unsigned int unused, preset_mdrefr, postset_mdrefr; 139 unsigned int unused, preset_mdrefr, postset_mdrefr;
140 void *ramstart = phys_to_virt(0xa0000000); 140 void *ramstart = phys_to_virt(0xa0000000);
@@ -233,6 +233,11 @@ static int pxa_set_target(struct cpufreq_policy *policy,
233 return 0; 233 return 0;
234} 234}
235 235
236static unsigned int pxa_cpufreq_get(unsigned int cpu)
237{
238 return get_clk_frequency_khz(0);
239}
240
236static int pxa_cpufreq_init(struct cpufreq_policy *policy) 241static int pxa_cpufreq_init(struct cpufreq_policy *policy)
237{ 242{
238 int i; 243 int i;
@@ -269,6 +274,7 @@ static struct cpufreq_driver pxa_cpufreq_driver = {
269 .verify = pxa_verify_policy, 274 .verify = pxa_verify_policy,
270 .target = pxa_set_target, 275 .target = pxa_set_target,
271 .init = pxa_cpufreq_init, 276 .init = pxa_cpufreq_init,
277 .get = pxa_cpufreq_get,
272 .name = "PXA25x", 278 .name = "PXA25x",
273}; 279};
274 280
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index 5bd64e341df3..9bdc8f99183a 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -137,9 +137,6 @@ irqreturn_t timer_interrupt(int irq, void *dummy)
137 137
138 do_timer(1); 138 do_timer(1);
139 139
140#ifndef CONFIG_SMP
141 update_process_times(user_mode(get_irq_regs()));
142#endif
143 profile_tick(CPU_PROFILING); 140 profile_tick(CPU_PROFILING);
144 141
145 /* 142 /*
@@ -161,6 +158,11 @@ irqreturn_t timer_interrupt(int irq, void *dummy)
161 last_rtc_update = xtime.tv_sec - 600; 158 last_rtc_update = xtime.tv_sec - 600;
162 } 159 }
163 write_sequnlock(&xtime_lock); 160 write_sequnlock(&xtime_lock);
161
162#ifndef CONFIG_SMP
163 update_process_times(user_mode(get_irq_regs()));
164#endif
165
164 return IRQ_HANDLED; 166 return IRQ_HANDLED;
165} 167}
166 168
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 58717cb19707..56a67ab698c7 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -126,15 +126,13 @@ static void decode_address(char *buf, unsigned long address)
126 struct vm_area_struct *vma = vml->vma; 126 struct vm_area_struct *vma = vml->vma;
127 127
128 if (address >= vma->vm_start && address < vma->vm_end) { 128 if (address >= vma->vm_start && address < vma->vm_end) {
129 char _tmpbuf[256];
129 char *name = p->comm; 130 char *name = p->comm;
130 struct file *file = vma->vm_file; 131 struct file *file = vma->vm_file;
131 if (file) { 132
132 char _tmpbuf[256]; 133 if (file)
133 name = d_path(file->f_dentry, 134 name = d_path(&file->f_path, _tmpbuf,
134 file->f_vfsmnt, 135 sizeof(_tmpbuf));
135 _tmpbuf,
136 sizeof(_tmpbuf));
137 }
138 136
139 /* FLAT does not have its text aligned to the start of 137 /* FLAT does not have its text aligned to the start of
140 * the map while FDPIC ELF does ... 138 * the map while FDPIC ELF does ...
diff --git a/arch/cris/arch-v10/lib/memset.c b/arch/cris/arch-v10/lib/memset.c
index 42c1101043a3..c94ea9b3ec29 100644
--- a/arch/cris/arch-v10/lib/memset.c
+++ b/arch/cris/arch-v10/lib/memset.c
@@ -1,252 +1,259 @@
1/*#************************************************************************#*/ 1/* A memset for CRIS.
2/*#-------------------------------------------------------------------------*/ 2 Copyright (C) 1999-2005 Axis Communications.
3/*# */ 3 All rights reserved.
4/*# FUNCTION NAME: memset() */ 4
5/*# */ 5 Redistribution and use in source and binary forms, with or without
6/*# PARAMETERS: void* dst; Destination address. */ 6 modification, are permitted provided that the following conditions
7/*# int c; Value of byte to write. */ 7 are met:
8/*# int len; Number of bytes to write. */ 8
9/*# */ 9 1. Redistributions of source code must retain the above copyright
10/*# RETURNS: dst. */ 10 notice, this list of conditions and the following disclaimer.
11/*# */ 11
12/*# DESCRIPTION: Sets the memory dst of length len bytes to c, as standard. */ 12 2. Neither the name of Axis Communications nor the names of its
13/*# Framework taken from memcpy. This routine is */ 13 contributors may be used to endorse or promote products derived
14/*# very sensitive to compiler changes in register allocation. */ 14 from this software without specific prior written permission.
15/*# Should really be rewritten to avoid this problem. */ 15
16/*# */ 16 THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
17/*#-------------------------------------------------------------------------*/ 17 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18/*# */ 18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19/*# HISTORY */ 19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
20/*# */ 20 COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21/*# DATE NAME CHANGES */ 21 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22/*# ---- ---- ------- */ 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23/*# 990713 HP Tired of watching this function (or */ 23 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24/*# really, the nonoptimized generic */ 24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25/*# implementation) take up 90% of simulator */ 25 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26/*# output. Measurements needed. */ 26 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27/*# */ 27 POSSIBILITY OF SUCH DAMAGE. */
28/*#-------------------------------------------------------------------------*/ 28
29 29/* FIXME: This file should really only be used for reference, as the
30#include <linux/types.h> 30 result is somewhat depending on gcc generating what we expect rather
31 31 than what we describe. An assembly file should be used instead. */
32/* No, there's no macro saying 12*4, since it is "hard" to get it into 32
33 the asm in a good way. Thus better to expose the problem everywhere. 33/* Note the multiple occurrence of the expression "12*4", including the
34 */ 34 asm. It is hard to get it into the asm in a good way. Thus better to
35 35 expose the problem everywhere: no macro. */
36/* Assuming 1 cycle per dword written or read (ok, not really true), and 36
37 one per instruction, then 43+3*(n/48-1) <= 24+24*(n/48-1) 37/* Assuming one cycle per dword written or read (ok, not really true; the
38 so n >= 45.7; n >= 0.9; we win on the first full 48-byte block to set. */ 38 world is not ideal), and one cycle per instruction, then 43+3*(n/48-1)
39 39 <= 24+24*(n/48-1) so n >= 45.7; n >= 0.9; we win on the first full
40#define ZERO_BLOCK_SIZE (1*12*4) 40 48-byte block to set. */
41 41
42void *memset(void *pdst, 42#define MEMSET_BY_BLOCK_THRESHOLD (1 * 48)
43 int c, 43
44 size_t plen) 44/* No name ambiguities in this file. */
45__asm__ (".syntax no_register_prefix");
46
47void *memset(void *pdst, int c, unsigned int plen)
45{ 48{
46 /* Ok. Now we want the parameters put in special registers. 49 /* Now we want the parameters in special registers. Make sure the
47 Make sure the compiler is able to make something useful of this. */ 50 compiler does something usable with this. */
48 51
49 register char *return_dst __asm__ ("r10") = pdst; 52 register char *return_dst __asm__ ("r10") = pdst;
50 register int n __asm__ ("r12") = plen; 53 register int n __asm__ ("r12") = plen;
51 register int lc __asm__ ("r11") = c; 54 register int lc __asm__ ("r11") = c;
52 55
53 /* Most apps use memset sanely. Only those memsetting about 3..4 56 /* Most apps use memset sanely. Memsetting about 3..4 bytes or less get
54 bytes or less get penalized compared to the generic implementation 57 penalized here compared to the generic implementation. */
55 - and that's not really sane use. */
56 58
57 /* Ugh. This is fragile at best. Check with newer GCC releases, if 59 /* This is fragile performancewise at best. Check with newer GCC
58 they compile cascaded "x |= x << 8" sanely! */ 60 releases, if they compile cascaded "x |= x << 8" to sane code. */
59 __asm__("movu.b %0,$r13\n\t" 61 __asm__("movu.b %0,r13 \n\
60 "lslq 8,$r13\n\t" 62 lslq 8,r13 \n\
61 "move.b %0,$r13\n\t" 63 move.b %0,r13 \n\
62 "move.d $r13,%0\n\t" 64 move.d r13,%0 \n\
63 "lslq 16,$r13\n\t" 65 lslq 16,r13 \n\
64 "or.d $r13,%0" 66 or.d r13,%0"
65 : "=r" (lc) : "0" (lc) : "r13"); 67 : "=r" (lc) /* Inputs. */
68 : "0" (lc) /* Outputs. */
69 : "r13"); /* Trash. */
66 70
67 { 71 {
68 register char *dst __asm__ ("r13") = pdst; 72 register char *dst __asm__ ("r13") = pdst;
69 73
70 /* This is NONPORTABLE, but since this whole routine is */ 74 if (((unsigned long) pdst & 3) != 0
71 /* grossly nonportable that doesn't matter. */ 75 /* Oops! n = 0 must be a valid call, regardless of alignment. */
76 && n >= 3)
77 {
78 if ((unsigned long) dst & 1)
79 {
80 *dst = (char) lc;
81 n--;
82 dst++;
83 }
72 84
73 if (((unsigned long) pdst & 3) != 0 85 if ((unsigned long) dst & 2)
74 /* Oops! n=0 must be a legal call, regardless of alignment. */ 86 {
75 && n >= 3) 87 *(short *) dst = lc;
76 { 88 n -= 2;
77 if ((unsigned long)dst & 1) 89 dst += 2;
78 { 90 }
79 *dst = (char) lc; 91 }
80 n--;
81 dst++;
82 }
83
84 if ((unsigned long)dst & 2)
85 {
86 *(short *)dst = lc;
87 n -= 2;
88 dst += 2;
89 }
90 }
91 92
92 /* Now the fun part. For the threshold value of this, check the equation 93 /* Decide which setting method to use. */
93 above. */ 94 if (n >= MEMSET_BY_BLOCK_THRESHOLD)
94 /* Decide which copying method to use. */ 95 {
95 if (n >= ZERO_BLOCK_SIZE) 96 /* It is not optimal to tell the compiler about clobbering any
96 { 97 registers; that will move the saving/restoring of those registers
97 /* For large copies we use 'movem' */ 98 to the function prologue/epilogue, and make non-block sizes
98 99 suboptimal. */
99 /* It is not optimal to tell the compiler about clobbering any 100 __asm__ volatile
100 registers; that will move the saving/restoring of those registers 101 ("\
101 to the function prologue/epilogue, and make non-movem sizes 102 ;; GCC does promise correct register allocations, but let's \n\
102 suboptimal. 103 ;; make sure it keeps its promises. \n\
103 104 .ifnc %0-%1-%4,$r13-$r12-$r11 \n\
104 This method is not foolproof; it assumes that the "asm reg" 105 .error \"GCC reg alloc bug: %0-%1-%4 != $r13-$r12-$r11\" \n\
105 declarations at the beginning of the function really are used 106 .endif \n\
106 here (beware: they may be moved to temporary registers). 107 \n\
107 This way, we do not have to save/move the registers around into 108 ;; Save the registers we'll clobber in the movem process \n\
108 temporaries; we can safely use them straight away. 109 ;; on the stack. Don't mention them to gcc, it will only be \n\
109 110 ;; upset. \n\
110 If you want to check that the allocation was right; then 111 subq 11*4,sp \n\
111 check the equalities in the first comment. It should say 112 movem r10,[sp] \n\
112 "r13=r13, r12=r12, r11=r11" */
113 __asm__ volatile ("\n\
114 ;; Check that the following is true (same register names on \n\
115 ;; both sides of equal sign, as in r8=r8): \n\
116 ;; %0=r13, %1=r12, %4=r11 \n\
117 ;; \n\
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 \n\
120 ;; upset. \n\
121 subq 11*4,$sp \n\
122 movem $r10,[$sp] \n\
123 \n\ 113 \n\
124 move.d $r11,$r0 \n\ 114 move.d r11,r0 \n\
125 move.d $r11,$r1 \n\ 115 move.d r11,r1 \n\
126 move.d $r11,$r2 \n\ 116 move.d r11,r2 \n\
127 move.d $r11,$r3 \n\ 117 move.d r11,r3 \n\
128 move.d $r11,$r4 \n\ 118 move.d r11,r4 \n\
129 move.d $r11,$r5 \n\ 119 move.d r11,r5 \n\
130 move.d $r11,$r6 \n\ 120 move.d r11,r6 \n\
131 move.d $r11,$r7 \n\ 121 move.d r11,r7 \n\
132 move.d $r11,$r8 \n\ 122 move.d r11,r8 \n\
133 move.d $r11,$r9 \n\ 123 move.d r11,r9 \n\
134 move.d $r11,$r10 \n\ 124 move.d r11,r10 \n\
135 \n\ 125 \n\
136 ;; Now we've got this: \n\ 126 ;; Now we've got this: \n\
137 ;; r13 - dst \n\ 127 ;; r13 - dst \n\
138 ;; r12 - n \n\ 128 ;; r12 - n \n\
139 \n\ 129 \n\
140 ;; Update n for the first loop \n\ 130 ;; Update n for the first loop \n\
141 subq 12*4,$r12 \n\ 131 subq 12*4,r12 \n\
1420: \n\ 1320: \n\
143 subq 12*4,$r12 \n\ 133"
144 bge 0b \n\ 134#ifdef __arch_common_v10_v32
145 movem $r11,[$r13+] \n\ 135 /* Cater to branch offset difference between v32 and v10. We
136 assume the branch below has an 8-bit offset. */
137" setf\n"
138#endif
139" subq 12*4,r12 \n\
140 bge 0b \n\
141 movem r11,[r13+] \n\
146 \n\ 142 \n\
147 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\ 143 ;; Compensate for last loop underflowing n. \n\
144 addq 12*4,r12 \n\
148 \n\ 145 \n\
149 ;; Restore registers from stack \n\ 146 ;; Restore registers from stack. \n\
150 movem [$sp+],$r10" 147 movem [sp+],r10"
151 148
152 /* Outputs */ : "=r" (dst), "=r" (n) 149 /* Outputs. */
153 /* Inputs */ : "0" (dst), "1" (n), "r" (lc)); 150 : "=r" (dst), "=r" (n)
154 151
155 } 152 /* Inputs. */
153 : "0" (dst), "1" (n), "r" (lc));
154 }
155
156 /* An ad-hoc unroll, used for 4*12-1..16 bytes. */
157 while (n >= 16)
158 {
159 *(long *) dst = lc; dst += 4;
160 *(long *) dst = lc; dst += 4;
161 *(long *) dst = lc; dst += 4;
162 *(long *) dst = lc; dst += 4;
163 n -= 16;
164 }
156 165
157 /* Either we directly starts copying, using dword copying
158 in a loop, or we copy as much as possible with 'movem'
159 and then the last block (<44 bytes) is copied here.
160 This will work since 'movem' will have updated src,dst,n. */
161
162 while ( n >= 16 )
163 {
164 *((long*)dst)++ = lc;
165 *((long*)dst)++ = lc;
166 *((long*)dst)++ = lc;
167 *((long*)dst)++ = lc;
168 n -= 16;
169 }
170
171 /* A switch() is definitely the fastest although it takes a LOT of code.
172 * Particularly if you inline code this.
173 */
174 switch (n) 166 switch (n)
175 { 167 {
176 case 0: 168 case 0:
177 break; 169 break;
170
178 case 1: 171 case 1:
179 *(char*)dst = (char) lc; 172 *dst = (char) lc;
180 break; 173 break;
174
181 case 2: 175 case 2:
182 *(short*)dst = (short) lc; 176 *(short *) dst = (short) lc;
183 break; 177 break;
178
184 case 3: 179 case 3:
185 *((short*)dst)++ = (short) lc; 180 *(short *) dst = (short) lc; dst += 2;
186 *(char*)dst = (char) lc; 181 *dst = (char) lc;
187 break; 182 break;
183
188 case 4: 184 case 4:
189 *((long*)dst)++ = lc; 185 *(long *) dst = lc;
190 break; 186 break;
187
191 case 5: 188 case 5:
192 *((long*)dst)++ = lc; 189 *(long *) dst = lc; dst += 4;
193 *(char*)dst = (char) lc; 190 *dst = (char) lc;
194 break; 191 break;
192
195 case 6: 193 case 6:
196 *((long*)dst)++ = lc; 194 *(long *) dst = lc; dst += 4;
197 *(short*)dst = (short) lc; 195 *(short *) dst = (short) lc;
198 break; 196 break;
197
199 case 7: 198 case 7:
200 *((long*)dst)++ = lc; 199 *(long *) dst = lc; dst += 4;
201 *((short*)dst)++ = (short) lc; 200 *(short *) dst = (short) lc; dst += 2;
202 *(char*)dst = (char) lc; 201 *dst = (char) lc;
203 break; 202 break;
203
204 case 8: 204 case 8:
205 *((long*)dst)++ = lc; 205 *(long *) dst = lc; dst += 4;
206 *((long*)dst)++ = lc; 206 *(long *) dst = lc;
207 break; 207 break;
208
208 case 9: 209 case 9:
209 *((long*)dst)++ = lc; 210 *(long *) dst = lc; dst += 4;
210 *((long*)dst)++ = lc; 211 *(long *) dst = lc; dst += 4;
211 *(char*)dst = (char) lc; 212 *dst = (char) lc;
212 break; 213 break;
214
213 case 10: 215 case 10:
214 *((long*)dst)++ = lc; 216 *(long *) dst = lc; dst += 4;
215 *((long*)dst)++ = lc; 217 *(long *) dst = lc; dst += 4;
216 *(short*)dst = (short) lc; 218 *(short *) dst = (short) lc;
217 break; 219 break;
220
218 case 11: 221 case 11:
219 *((long*)dst)++ = lc; 222 *(long *) dst = lc; dst += 4;
220 *((long*)dst)++ = lc; 223 *(long *) dst = lc; dst += 4;
221 *((short*)dst)++ = (short) lc; 224 *(short *) dst = (short) lc; dst += 2;
222 *(char*)dst = (char) lc; 225 *dst = (char) lc;
223 break; 226 break;
227
224 case 12: 228 case 12:
225 *((long*)dst)++ = lc; 229 *(long *) dst = lc; dst += 4;
226 *((long*)dst)++ = lc; 230 *(long *) dst = lc; dst += 4;
227 *((long*)dst)++ = lc; 231 *(long *) dst = lc;
228 break; 232 break;
233
229 case 13: 234 case 13:
230 *((long*)dst)++ = lc; 235 *(long *) dst = lc; dst += 4;
231 *((long*)dst)++ = lc; 236 *(long *) dst = lc; dst += 4;
232 *((long*)dst)++ = lc; 237 *(long *) dst = lc; dst += 4;
233 *(char*)dst = (char) lc; 238 *dst = (char) lc;
234 break; 239 break;
240
235 case 14: 241 case 14:
236 *((long*)dst)++ = lc; 242 *(long *) dst = lc; dst += 4;
237 *((long*)dst)++ = lc; 243 *(long *) dst = lc; dst += 4;
238 *((long*)dst)++ = lc; 244 *(long *) dst = lc; dst += 4;
239 *(short*)dst = (short) lc; 245 *(short *) dst = (short) lc;
240 break; 246 break;
247
241 case 15: 248 case 15:
242 *((long*)dst)++ = lc; 249 *(long *) dst = lc; dst += 4;
243 *((long*)dst)++ = lc; 250 *(long *) dst = lc; dst += 4;
244 *((long*)dst)++ = lc; 251 *(long *) dst = lc; dst += 4;
245 *((short*)dst)++ = (short) lc; 252 *(short *) dst = (short) lc; dst += 2;
246 *(char*)dst = (char) lc; 253 *dst = (char) lc;
247 break; 254 break;
248 } 255 }
249 } 256 }
250 257
251 return return_dst; /* destination pointer. */ 258 return return_dst;
252} /* memset() */ 259}
diff --git a/arch/cris/arch-v32/lib/memset.c b/arch/cris/arch-v32/lib/memset.c
index ffca1214674e..c94ea9b3ec29 100644
--- a/arch/cris/arch-v32/lib/memset.c
+++ b/arch/cris/arch-v32/lib/memset.c
@@ -1,253 +1,259 @@
1/*#************************************************************************#*/ 1/* A memset for CRIS.
2/*#-------------------------------------------------------------------------*/ 2 Copyright (C) 1999-2005 Axis Communications.
3/*# */ 3 All rights reserved.
4/*# FUNCTION NAME: memset() */ 4
5/*# */ 5 Redistribution and use in source and binary forms, with or without
6/*# PARAMETERS: void* dst; Destination address. */ 6 modification, are permitted provided that the following conditions
7/*# int c; Value of byte to write. */ 7 are met:
8/*# int len; Number of bytes to write. */ 8
9/*# */ 9 1. Redistributions of source code must retain the above copyright
10/*# RETURNS: dst. */ 10 notice, this list of conditions and the following disclaimer.
11/*# */ 11
12/*# DESCRIPTION: Sets the memory dst of length len bytes to c, as standard. */ 12 2. Neither the name of Axis Communications nor the names of its
13/*# Framework taken from memcpy. This routine is */ 13 contributors may be used to endorse or promote products derived
14/*# very sensitive to compiler changes in register allocation. */ 14 from this software without specific prior written permission.
15/*# Should really be rewritten to avoid this problem. */ 15
16/*# */ 16 THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
17/*#-------------------------------------------------------------------------*/ 17 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18/*# */ 18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19/*# HISTORY */ 19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
20/*# */ 20 COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21/*# DATE NAME CHANGES */ 21 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22/*# ---- ---- ------- */ 22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23/*# 990713 HP Tired of watching this function (or */ 23 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24/*# really, the nonoptimized generic */ 24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25/*# implementation) take up 90% of simulator */ 25 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26/*# output. Measurements needed. */ 26 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27/*# */ 27 POSSIBILITY OF SUCH DAMAGE. */
28/*#-------------------------------------------------------------------------*/ 28
29 29/* FIXME: This file should really only be used for reference, as the
30#include <linux/types.h> 30 result is somewhat depending on gcc generating what we expect rather
31 31 than what we describe. An assembly file should be used instead. */
32/* No, there's no macro saying 12*4, since it is "hard" to get it into 32
33 the asm in a good way. Thus better to expose the problem everywhere. 33/* Note the multiple occurrence of the expression "12*4", including the
34 */ 34 asm. It is hard to get it into the asm in a good way. Thus better to
35 35 expose the problem everywhere: no macro. */
36/* Assuming 1 cycle per dword written or read (ok, not really true), and 36
37 one per instruction, then 43+3*(n/48-1) <= 24+24*(n/48-1) 37/* Assuming one cycle per dword written or read (ok, not really true; the
38 so n >= 45.7; n >= 0.9; we win on the first full 48-byte block to set. */ 38 world is not ideal), and one cycle per instruction, then 43+3*(n/48-1)
39 39 <= 24+24*(n/48-1) so n >= 45.7; n >= 0.9; we win on the first full
40#define ZERO_BLOCK_SIZE (1*12*4) 40 48-byte block to set. */
41 41
42void *memset(void *pdst, 42#define MEMSET_BY_BLOCK_THRESHOLD (1 * 48)
43 int c, 43
44 size_t plen) 44/* No name ambiguities in this file. */
45__asm__ (".syntax no_register_prefix");
46
47void *memset(void *pdst, int c, unsigned int plen)
45{ 48{
46 /* Ok. Now we want the parameters put in special registers. 49 /* Now we want the parameters in special registers. Make sure the
47 Make sure the compiler is able to make something useful of this. */ 50 compiler does something usable with this. */
48 51
49 register char *return_dst __asm__ ("r10") = pdst; 52 register char *return_dst __asm__ ("r10") = pdst;
50 register int n __asm__ ("r12") = plen; 53 register int n __asm__ ("r12") = plen;
51 register int lc __asm__ ("r11") = c; 54 register int lc __asm__ ("r11") = c;
52 55
53 /* Most apps use memset sanely. Only those memsetting about 3..4 56 /* Most apps use memset sanely. Memsetting about 3..4 bytes or less get
54 bytes or less get penalized compared to the generic implementation 57 penalized here compared to the generic implementation. */
55 - and that's not really sane use. */
56 58
57 /* Ugh. This is fragile at best. Check with newer GCC releases, if 59 /* This is fragile performancewise at best. Check with newer GCC
58 they compile cascaded "x |= x << 8" sanely! */ 60 releases, if they compile cascaded "x |= x << 8" to sane code. */
59 __asm__("movu.b %0,$r13 \n\ 61 __asm__("movu.b %0,r13 \n\
60 lslq 8,$r13 \n\ 62 lslq 8,r13 \n\
61 move.b %0,$r13 \n\ 63 move.b %0,r13 \n\
62 move.d $r13,%0 \n\ 64 move.d r13,%0 \n\
63 lslq 16,$r13 \n\ 65 lslq 16,r13 \n\
64 or.d $r13,%0" 66 or.d r13,%0"
65 : "=r" (lc) : "0" (lc) : "r13"); 67 : "=r" (lc) /* Inputs. */
68 : "0" (lc) /* Outputs. */
69 : "r13"); /* Trash. */
66 70
67 { 71 {
68 register char *dst __asm__ ("r13") = pdst; 72 register char *dst __asm__ ("r13") = pdst;
69 73
70 /* This is NONPORTABLE, but since this whole routine is */ 74 if (((unsigned long) pdst & 3) != 0
71 /* grossly nonportable that doesn't matter. */ 75 /* Oops! n = 0 must be a valid call, regardless of alignment. */
76 && n >= 3)
77 {
78 if ((unsigned long) dst & 1)
79 {
80 *dst = (char) lc;
81 n--;
82 dst++;
83 }
72 84
73 if (((unsigned long) pdst & 3) != 0 85 if ((unsigned long) dst & 2)
74 /* Oops! n=0 must be a legal call, regardless of alignment. */ 86 {
75 && n >= 3) 87 *(short *) dst = lc;
76 { 88 n -= 2;
77 if ((unsigned long)dst & 1) 89 dst += 2;
78 { 90 }
79 *dst = (char) lc; 91 }
80 n--;
81 dst++;
82 }
83
84 if ((unsigned long)dst & 2)
85 {
86 *(short *)dst = lc;
87 n -= 2;
88 dst += 2;
89 }
90 }
91 92
92 /* Now the fun part. For the threshold value of this, check the equation 93 /* Decide which setting method to use. */
93 above. */ 94 if (n >= MEMSET_BY_BLOCK_THRESHOLD)
94 /* Decide which copying method to use. */ 95 {
95 if (n >= ZERO_BLOCK_SIZE) 96 /* It is not optimal to tell the compiler about clobbering any
96 { 97 registers; that will move the saving/restoring of those registers
97 /* For large copies we use 'movem' */ 98 to the function prologue/epilogue, and make non-block sizes
98 99 suboptimal. */
99 /* It is not optimal to tell the compiler about clobbering any 100 __asm__ volatile
100 registers; that will move the saving/restoring of those registers 101 ("\
101 to the function prologue/epilogue, and make non-movem sizes 102 ;; GCC does promise correct register allocations, but let's \n\
102 suboptimal. 103 ;; make sure it keeps its promises. \n\
103 104 .ifnc %0-%1-%4,$r13-$r12-$r11 \n\
104 This method is not foolproof; it assumes that the "asm reg" 105 .error \"GCC reg alloc bug: %0-%1-%4 != $r13-$r12-$r11\" \n\
105 declarations at the beginning of the function really are used 106 .endif \n\
106 here (beware: they may be moved to temporary registers).
107 This way, we do not have to save/move the registers around into
108 temporaries; we can safely use them straight away.
109
110 If you want to check that the allocation was right; then
111 check the equalities in the first comment. It should say
112 "r13=r13, r12=r12, r11=r11" */
113 __asm__ volatile (" \n\
114 ;; Check that the register asm declaration got right. \n\
115 ;; The GCC manual says it will work, but there *has* been bugs. \n\
116 .ifnc %0-%1-%4,$r13-$r12-$r11 \n\
117 .err \n\
118 .endif \n\
119 \n\ 107 \n\
120 ;; Save the registers we'll clobber in the movem process \n\ 108 ;; Save the registers we'll clobber in the movem process \n\
121 ;; on the stack. Don't mention them to gcc, it will only be \n\ 109 ;; on the stack. Don't mention them to gcc, it will only be \n\
122 ;; upset. \n\ 110 ;; upset. \n\
123 subq 11*4,$sp \n\ 111 subq 11*4,sp \n\
124 movem $r10,[$sp] \n\ 112 movem r10,[sp] \n\
125 \n\ 113 \n\
126 move.d $r11,$r0 \n\ 114 move.d r11,r0 \n\
127 move.d $r11,$r1 \n\ 115 move.d r11,r1 \n\
128 move.d $r11,$r2 \n\ 116 move.d r11,r2 \n\
129 move.d $r11,$r3 \n\ 117 move.d r11,r3 \n\
130 move.d $r11,$r4 \n\ 118 move.d r11,r4 \n\
131 move.d $r11,$r5 \n\ 119 move.d r11,r5 \n\
132 move.d $r11,$r6 \n\ 120 move.d r11,r6 \n\
133 move.d $r11,$r7 \n\ 121 move.d r11,r7 \n\
134 move.d $r11,$r8 \n\ 122 move.d r11,r8 \n\
135 move.d $r11,$r9 \n\ 123 move.d r11,r9 \n\
136 move.d $r11,$r10 \n\ 124 move.d r11,r10 \n\
137 \n\ 125 \n\
138 ;; Now we've got this: \n\ 126 ;; Now we've got this: \n\
139 ;; r13 - dst \n\ 127 ;; r13 - dst \n\
140 ;; r12 - n \n\ 128 ;; r12 - n \n\
141 \n\ 129 \n\
142 ;; Update n for the first loop \n\ 130 ;; Update n for the first loop \n\
143 subq 12*4,$r12 \n\ 131 subq 12*4,r12 \n\
1440: \n\ 1320: \n\
145 subq 12*4,$r12 \n\ 133"
146 bge 0b \n\ 134#ifdef __arch_common_v10_v32
147 movem $r11,[$r13+] \n\ 135 /* Cater to branch offset difference between v32 and v10. We
136 assume the branch below has an 8-bit offset. */
137" setf\n"
138#endif
139" subq 12*4,r12 \n\
140 bge 0b \n\
141 movem r11,[r13+] \n\
148 \n\ 142 \n\
149 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\ 143 ;; Compensate for last loop underflowing n. \n\
144 addq 12*4,r12 \n\
150 \n\ 145 \n\
151 ;; Restore registers from stack \n\ 146 ;; Restore registers from stack. \n\
152 movem [$sp+],$r10" 147 movem [sp+],r10"
153 148
154 /* Outputs */ : "=r" (dst), "=r" (n) 149 /* Outputs. */
155 /* Inputs */ : "0" (dst), "1" (n), "r" (lc)); 150 : "=r" (dst), "=r" (n)
156 } 151
152 /* Inputs. */
153 : "0" (dst), "1" (n), "r" (lc));
154 }
155
156 /* An ad-hoc unroll, used for 4*12-1..16 bytes. */
157 while (n >= 16)
158 {
159 *(long *) dst = lc; dst += 4;
160 *(long *) dst = lc; dst += 4;
161 *(long *) dst = lc; dst += 4;
162 *(long *) dst = lc; dst += 4;
163 n -= 16;
164 }
157 165
158 /* Either we directly starts copying, using dword copying
159 in a loop, or we copy as much as possible with 'movem'
160 and then the last block (<44 bytes) is copied here.
161 This will work since 'movem' will have updated src,dst,n. */
162
163 while ( n >= 16 )
164 {
165 *((long*)dst)++ = lc;
166 *((long*)dst)++ = lc;
167 *((long*)dst)++ = lc;
168 *((long*)dst)++ = lc;
169 n -= 16;
170 }
171
172 /* A switch() is definitely the fastest although it takes a LOT of code.
173 * Particularly if you inline code this.
174 */
175 switch (n) 166 switch (n)
176 { 167 {
177 case 0: 168 case 0:
178 break; 169 break;
170
179 case 1: 171 case 1:
180 *(char*)dst = (char) lc; 172 *dst = (char) lc;
181 break; 173 break;
174
182 case 2: 175 case 2:
183 *(short*)dst = (short) lc; 176 *(short *) dst = (short) lc;
184 break; 177 break;
178
185 case 3: 179 case 3:
186 *((short*)dst)++ = (short) lc; 180 *(short *) dst = (short) lc; dst += 2;
187 *(char*)dst = (char) lc; 181 *dst = (char) lc;
188 break; 182 break;
183
189 case 4: 184 case 4:
190 *((long*)dst)++ = lc; 185 *(long *) dst = lc;
191 break; 186 break;
187
192 case 5: 188 case 5:
193 *((long*)dst)++ = lc; 189 *(long *) dst = lc; dst += 4;
194 *(char*)dst = (char) lc; 190 *dst = (char) lc;
195 break; 191 break;
192
196 case 6: 193 case 6:
197 *((long*)dst)++ = lc; 194 *(long *) dst = lc; dst += 4;
198 *(short*)dst = (short) lc; 195 *(short *) dst = (short) lc;
199 break; 196 break;
197
200 case 7: 198 case 7:
201 *((long*)dst)++ = lc; 199 *(long *) dst = lc; dst += 4;
202 *((short*)dst)++ = (short) lc; 200 *(short *) dst = (short) lc; dst += 2;
203 *(char*)dst = (char) lc; 201 *dst = (char) lc;
204 break; 202 break;
203
205 case 8: 204 case 8:
206 *((long*)dst)++ = lc; 205 *(long *) dst = lc; dst += 4;
207 *((long*)dst)++ = lc; 206 *(long *) dst = lc;
208 break; 207 break;
208
209 case 9: 209 case 9:
210 *((long*)dst)++ = lc; 210 *(long *) dst = lc; dst += 4;
211 *((long*)dst)++ = lc; 211 *(long *) dst = lc; dst += 4;
212 *(char*)dst = (char) lc; 212 *dst = (char) lc;
213 break; 213 break;
214
214 case 10: 215 case 10:
215 *((long*)dst)++ = lc; 216 *(long *) dst = lc; dst += 4;
216 *((long*)dst)++ = lc; 217 *(long *) dst = lc; dst += 4;
217 *(short*)dst = (short) lc; 218 *(short *) dst = (short) lc;
218 break; 219 break;
220
219 case 11: 221 case 11:
220 *((long*)dst)++ = lc; 222 *(long *) dst = lc; dst += 4;
221 *((long*)dst)++ = lc; 223 *(long *) dst = lc; dst += 4;
222 *((short*)dst)++ = (short) lc; 224 *(short *) dst = (short) lc; dst += 2;
223 *(char*)dst = (char) lc; 225 *dst = (char) lc;
224 break; 226 break;
227
225 case 12: 228 case 12:
226 *((long*)dst)++ = lc; 229 *(long *) dst = lc; dst += 4;
227 *((long*)dst)++ = lc; 230 *(long *) dst = lc; dst += 4;
228 *((long*)dst)++ = lc; 231 *(long *) dst = lc;
229 break; 232 break;
233
230 case 13: 234 case 13:
231 *((long*)dst)++ = lc; 235 *(long *) dst = lc; dst += 4;
232 *((long*)dst)++ = lc; 236 *(long *) dst = lc; dst += 4;
233 *((long*)dst)++ = lc; 237 *(long *) dst = lc; dst += 4;
234 *(char*)dst = (char) lc; 238 *dst = (char) lc;
235 break; 239 break;
240
236 case 14: 241 case 14:
237 *((long*)dst)++ = lc; 242 *(long *) dst = lc; dst += 4;
238 *((long*)dst)++ = lc; 243 *(long *) dst = lc; dst += 4;
239 *((long*)dst)++ = lc; 244 *(long *) dst = lc; dst += 4;
240 *(short*)dst = (short) lc; 245 *(short *) dst = (short) lc;
241 break; 246 break;
247
242 case 15: 248 case 15:
243 *((long*)dst)++ = lc; 249 *(long *) dst = lc; dst += 4;
244 *((long*)dst)++ = lc; 250 *(long *) dst = lc; dst += 4;
245 *((long*)dst)++ = lc; 251 *(long *) dst = lc; dst += 4;
246 *((short*)dst)++ = (short) lc; 252 *(short *) dst = (short) lc; dst += 2;
247 *(char*)dst = (char) lc; 253 *dst = (char) lc;
248 break; 254 break;
249 } 255 }
250 } 256 }
251 257
252 return return_dst; /* destination pointer. */ 258 return return_dst;
253} /* memset() */ 259}
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index ca6a345b87e4..f36d7f4a7c25 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -1494,9 +1494,11 @@ sys_call_table:
1494 .long sys_epoll_pwait 1494 .long sys_epoll_pwait
1495 .long sys_utimensat /* 320 */ 1495 .long sys_utimensat /* 320 */
1496 .long sys_signalfd 1496 .long sys_signalfd
1497 .long sys_ni_syscall 1497 .long sys_timerfd_create
1498 .long sys_eventfd 1498 .long sys_eventfd
1499 .long sys_fallocate 1499 .long sys_fallocate
1500 .long sys_timerfd_settime /* 325 */
1501 .long sys_timerfd_gettime
1500 1502
1501 1503
1502syscall_table_size = (. - sys_call_table) 1504syscall_table_size = (. - sys_call_table)
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 925fb0199a0f..69f6a4ef5d61 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -63,6 +63,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
63 /* last time the cmos clock got updated */ 63 /* last time the cmos clock got updated */
64 static long last_rtc_update = 0; 64 static long last_rtc_update = 0;
65 65
66 profile_tick(CPU_PROFILING);
66 /* 67 /*
67 * Here we are in the timer irq handler. We just have irqs locally 68 * Here we are in the timer irq handler. We just have irqs locally
68 * disabled but we don't know if the timer_bh is running on the other 69 * disabled but we don't know if the timer_bh is running on the other
@@ -73,8 +74,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
73 write_seqlock(&xtime_lock); 74 write_seqlock(&xtime_lock);
74 75
75 do_timer(1); 76 do_timer(1);
76 update_process_times(user_mode(get_irq_regs()));
77 profile_tick(CPU_PROFILING);
78 77
79 /* 78 /*
80 * If we have an externally synchronized Linux clock, then update 79 * If we have an externally synchronized Linux clock, then update
@@ -99,6 +98,9 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
99#endif /* CONFIG_HEARTBEAT */ 98#endif /* CONFIG_HEARTBEAT */
100 99
101 write_sequnlock(&xtime_lock); 100 write_sequnlock(&xtime_lock);
101
102 update_process_times(user_mode(get_irq_regs()));
103
102 return IRQ_HANDLED; 104 return IRQ_HANDLED;
103} 105}
104 106
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index ef7527b8b0c7..b95c4eace62f 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -76,9 +76,6 @@ SECTIONS
76 *(.data.init_task) 76 *(.data.init_task)
77 } 77 }
78 78
79 . = ALIGN(4096);
80 .data.page_aligned : { *(.data.idt) }
81
82 . = ALIGN(L1_CACHE_BYTES); 79 . = ALIGN(L1_CACHE_BYTES);
83 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 80 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
84 81
@@ -105,11 +102,9 @@ SECTIONS
105 SCHED_TEXT 102 SCHED_TEXT
106 LOCK_TEXT 103 LOCK_TEXT
107#ifdef CONFIG_DEBUG_INFO 104#ifdef CONFIG_DEBUG_INFO
108 *(
109 INIT_TEXT 105 INIT_TEXT
110 EXIT_TEXT 106 EXIT_TEXT
111 .exitcall.exit 107 *(.exitcall.exit)
112 )
113#endif 108#endif
114 *(.fixup) 109 *(.fixup)
115 *(.gnu.warning) 110 *(.gnu.warning)
diff --git a/arch/h8300/defconfig b/arch/h8300/defconfig
index 8f1ec3297150..8901cdb5e75b 100644
--- a/arch/h8300/defconfig
+++ b/arch/h8300/defconfig
@@ -1,51 +1,98 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc1 3# Linux kernel version: 2.6.25-rc1
4# Sun Jan 16 17:24:38 2005 4# Fri Feb 15 17:13:14 2008
5# 5#
6CONFIG_H8300=y 6CONFIG_H8300=y
7# CONFIG_MMU is not set 7# CONFIG_MMU is not set
8# CONFIG_SWAP is not set 8# CONFIG_SWAP is not set
9CONFIG_ZONE_DMA=y
9# CONFIG_FPU is not set 10# CONFIG_FPU is not set
10CONFIG_UID16=y
11CONFIG_RWSEM_GENERIC_SPINLOCK=y 11CONFIG_RWSEM_GENERIC_SPINLOCK=y
12# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 12# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
13# CONFIG_ARCH_HAS_ILOG2_U32 is not set
14# CONFIG_ARCH_HAS_ILOG2_U64 is not set
15CONFIG_GENERIC_FIND_NEXT_BIT=y
16CONFIG_GENERIC_HWEIGHT=y
17CONFIG_GENERIC_HARDIRQS=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
19CONFIG_GENERIC_TIME=y
20CONFIG_TIME_LOW_RES=y
21CONFIG_ARCH_SUPPORTS_AOUT=y
22CONFIG_NO_IOPORT=y
23CONFIG_NO_DMA=y
14CONFIG_ISA=y 24CONFIG_ISA=y
15# CONFIG_PCI is not set 25# CONFIG_PCI is not set
26CONFIG_HZ=100
27CONFIG_C_SYMBOL_PREFIX=y
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
16 29
17# 30#
18# Code maturity level options 31# General setup
19# 32#
20CONFIG_EXPERIMENTAL=y 33CONFIG_EXPERIMENTAL=y
21CONFIG_CLEAN_COMPILE=y
22CONFIG_BROKEN_ON_SMP=y 34CONFIG_BROKEN_ON_SMP=y
23 35CONFIG_INIT_ENV_ARG_LIMIT=32
24#
25# General setup
26#
27CONFIG_LOCALVERSION="" 36CONFIG_LOCALVERSION=""
37# CONFIG_LOCALVERSION_AUTO is not set
38# CONFIG_SYSVIPC is not set
28# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
29# CONFIG_SYSCTL is not set
30# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32# CONFIG_HOTPLUG is not set
33# CONFIG_IKCONFIG is not set 40# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=14
42# CONFIG_CGROUPS is not set
43# CONFIG_FAIR_GROUP_SCHED is not set
44# CONFIG_SYSFS_DEPRECATED is not set
45# CONFIG_RELAY is not set
46# CONFIG_NAMESPACES is not set
47# CONFIG_BLK_DEV_INITRD is not set
48CONFIG_CC_OPTIMIZE_FOR_SIZE=y
49CONFIG_SYSCTL=y
34CONFIG_EMBEDDED=y 50CONFIG_EMBEDDED=y
51# CONFIG_UID16 is not set
52# CONFIG_SYSCTL_SYSCALL is not set
35# CONFIG_KALLSYMS is not set 53# CONFIG_KALLSYMS is not set
54# CONFIG_HOTPLUG is not set
55CONFIG_PRINTK=y
56CONFIG_BUG=y
57CONFIG_ELF_CORE=y
58# CONFIG_COMPAT_BRK is not set
59# CONFIG_BASE_FULL is not set
36# CONFIG_FUTEX is not set 60# CONFIG_FUTEX is not set
37# CONFIG_EPOLL is not set 61# CONFIG_EPOLL is not set
38CONFIG_CC_OPTIMIZE_FOR_SIZE=y 62# CONFIG_SIGNALFD is not set
39CONFIG_CC_ALIGN_FUNCTIONS=0 63# CONFIG_TIMERFD is not set
40CONFIG_CC_ALIGN_LABELS=0 64# CONFIG_EVENTFD is not set
41CONFIG_CC_ALIGN_LOOPS=0 65# CONFIG_VM_EVENT_COUNTERS is not set
42CONFIG_CC_ALIGN_JUMPS=0 66# CONFIG_SLAB is not set
67# CONFIG_SLUB is not set
68CONFIG_SLOB=y
69# CONFIG_PROFILING is not set
70# CONFIG_MARKERS is not set
71# CONFIG_HAVE_OPROFILE is not set
72# CONFIG_HAVE_KPROBES is not set
43CONFIG_TINY_SHMEM=y 73CONFIG_TINY_SHMEM=y
74CONFIG_BASE_SMALL=1
75# CONFIG_MODULES is not set
76CONFIG_BLOCK=y
77# CONFIG_LBD is not set
78# CONFIG_BLK_DEV_IO_TRACE is not set
79# CONFIG_LSF is not set
80# CONFIG_BLK_DEV_BSG is not set
44 81
45# 82#
46# Loadable module support 83# IO Schedulers
47# 84#
48# CONFIG_MODULES is not set 85CONFIG_IOSCHED_NOOP=y
86# CONFIG_IOSCHED_AS is not set
87# CONFIG_IOSCHED_DEADLINE is not set
88# CONFIG_IOSCHED_CFQ is not set
89# CONFIG_DEFAULT_AS is not set
90# CONFIG_DEFAULT_DEADLINE is not set
91# CONFIG_DEFAULT_CFQ is not set
92CONFIG_DEFAULT_NOOP=y
93CONFIG_DEFAULT_IOSCHED="noop"
94CONFIG_CLASSIC_RCU=y
95# CONFIG_PREEMPT_RCU is not set
49 96
50# 97#
51# Processor type and features 98# Processor type and features
@@ -62,14 +109,26 @@ CONFIG_H8300H_GENERIC=y
62# Detail Selection 109# Detail Selection
63# 110#
64# CONFIG_H83002 is not set 111# CONFIG_H83002 is not set
65# CONFIG_H83007 is not set 112CONFIG_H83007=y
66# CONFIG_H83048 is not set 113# CONFIG_H83048 is not set
67CONFIG_H83068=y 114# CONFIG_H83068 is not set
68CONFIG_CPU_CLOCK=20000 115CONFIG_CPU_CLOCK=20000
69# CONFIG_RAMKERNEL is not set 116CONFIG_RAMKERNEL=y
70CONFIG_ROMKERNEL=y 117# CONFIG_ROMKERNEL is not set
71CONFIG_CPU_H8300H=y 118CONFIG_CPU_H8300H=y
72# CONFIG_PREEMPT is not set 119# CONFIG_PREEMPT is not set
120CONFIG_SELECT_MEMORY_MODEL=y
121CONFIG_FLATMEM_MANUAL=y
122# CONFIG_DISCONTIGMEM_MANUAL is not set
123# CONFIG_SPARSEMEM_MANUAL is not set
124CONFIG_FLATMEM=y
125CONFIG_FLAT_NODE_MEM_MAP=y
126# CONFIG_SPARSEMEM_STATIC is not set
127# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
128CONFIG_SPLIT_PTLOCK_CPUS=4
129# CONFIG_RESOURCES_64BIT is not set
130CONFIG_ZONE_DMA_FLAG=1
131CONFIG_VIRT_TO_BUS=y
73 132
74# 133#
75# Executable file formats 134# Executable file formats
@@ -77,34 +136,42 @@ CONFIG_CPU_H8300H=y
77CONFIG_BINFMT_FLAT=y 136CONFIG_BINFMT_FLAT=y
78CONFIG_BINFMT_ZFLAT=y 137CONFIG_BINFMT_ZFLAT=y
79# CONFIG_BINFMT_SHARED_FLAT is not set 138# CONFIG_BINFMT_SHARED_FLAT is not set
80# CONFIG_BINFMT_MISC is not set 139CONFIG_BINFMT_MISC=y
81 140
82# 141#
83# Generic Driver Options 142# Networking
84# 143#
85# CONFIG_STANDALONE is not set 144# CONFIG_NET is not set
86# CONFIG_PREVENT_FIRMWARE_BUILD is not set
87# CONFIG_FW_LOADER is not set
88# CONFIG_DEBUG_DRIVER is not set
89 145
90# 146#
91# Memory Technology Devices (MTD) 147# Generic Driver Options
92# 148#
149CONFIG_STANDALONE=y
150# CONFIG_PREVENT_FIRMWARE_BUILD is not set
151# CONFIG_SYS_HYPERVISOR is not set
93CONFIG_MTD=y 152CONFIG_MTD=y
94# CONFIG_MTD_DEBUG is not set 153# CONFIG_MTD_DEBUG is not set
154# CONFIG_MTD_CONCAT is not set
95CONFIG_MTD_PARTITIONS=y 155CONFIG_MTD_PARTITIONS=y
96CONFIG_MTD_CONCAT=y 156CONFIG_MTD_REDBOOT_PARTS=y
97# CONFIG_MTD_REDBOOT_PARTS is not set 157CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
158# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
159# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
98# CONFIG_MTD_CMDLINE_PARTS is not set 160# CONFIG_MTD_CMDLINE_PARTS is not set
99 161
100# 162#
101# User Modules And Translation Layers 163# User Modules And Translation Layers
102# 164#
103CONFIG_MTD_CHAR=y 165CONFIG_MTD_CHAR=y
104CONFIG_MTD_BLOCK=y 166# CONFIG_MTD_BLKDEVS is not set
167# CONFIG_MTD_BLOCK is not set
168# CONFIG_MTD_BLOCK_RO is not set
105# CONFIG_FTL is not set 169# CONFIG_FTL is not set
106# CONFIG_NFTL is not set 170# CONFIG_NFTL is not set
107# CONFIG_INFTL is not set 171# CONFIG_INFTL is not set
172# CONFIG_RFD_FTL is not set
173# CONFIG_SSFDC is not set
174# CONFIG_MTD_OOPS is not set
108 175
109# 176#
110# RAM/ROM/Flash chip drivers 177# RAM/ROM/Flash chip drivers
@@ -129,7 +196,9 @@ CONFIG_MTD_ROM=y
129# Mapping drivers for chip access 196# Mapping drivers for chip access
130# 197#
131# CONFIG_MTD_COMPLEX_MAPPINGS is not set 198# CONFIG_MTD_COMPLEX_MAPPINGS is not set
199# CONFIG_MTD_PHYSMAP is not set
132CONFIG_MTD_UCLINUX=y 200CONFIG_MTD_UCLINUX=y
201# CONFIG_MTD_PLATRAM is not set
133 202
134# 203#
135# Self-contained MTD device drivers 204# Self-contained MTD device drivers
@@ -137,7 +206,6 @@ CONFIG_MTD_UCLINUX=y
137# CONFIG_MTD_SLRAM is not set 206# CONFIG_MTD_SLRAM is not set
138# CONFIG_MTD_PHRAM is not set 207# CONFIG_MTD_PHRAM is not set
139# CONFIG_MTD_MTDRAM is not set 208# CONFIG_MTD_MTDRAM is not set
140# CONFIG_MTD_BLKMTD is not set
141# CONFIG_MTD_BLOCK2MTD is not set 209# CONFIG_MTD_BLOCK2MTD is not set
142 210
143# 211#
@@ -146,63 +214,27 @@ CONFIG_MTD_UCLINUX=y
146# CONFIG_MTD_DOC2000 is not set 214# CONFIG_MTD_DOC2000 is not set
147# CONFIG_MTD_DOC2001 is not set 215# CONFIG_MTD_DOC2001 is not set
148# CONFIG_MTD_DOC2001PLUS is not set 216# CONFIG_MTD_DOC2001PLUS is not set
149
150#
151# NAND Flash Device Drivers
152#
153# CONFIG_MTD_NAND is not set 217# CONFIG_MTD_NAND is not set
218# CONFIG_MTD_ONENAND is not set
154 219
155# 220#
156# Block devices 221# UBI - Unsorted block images
157#
158# CONFIG_BLK_DEV_FD is not set
159# CONFIG_BLK_DEV_XD is not set
160# CONFIG_BLK_DEV_LOOP is not set
161# CONFIG_BLK_DEV_RAM is not set
162CONFIG_BLK_DEV_RAM_COUNT=16
163CONFIG_INITRAMFS_SOURCE=""
164# CONFIG_CDROM_PKTCDVD is not set
165
166#
167# IO Schedulers
168#
169CONFIG_IOSCHED_NOOP=y
170# CONFIG_IOSCHED_AS is not set
171# CONFIG_IOSCHED_DEADLINE is not set
172# CONFIG_IOSCHED_CFQ is not set
173
174#
175# ATA/ATAPI/MFM/RLL support
176# 222#
223# CONFIG_MTD_UBI is not set
224# CONFIG_BLK_DEV is not set
225CONFIG_HAVE_IDE=y
177# CONFIG_IDE is not set 226# CONFIG_IDE is not set
178 227
179# 228#
180# Networking support
181#
182# CONFIG_NET is not set
183# CONFIG_NETPOLL is not set
184# CONFIG_NET_POLL_CONTROLLER is not set
185
186#
187# Input device support 229# Input device support
188# 230#
189# CONFIG_INPUT is not set 231# CONFIG_INPUT is not set
190 232
191# 233#
192# Userland interfaces 234# Hardware I/O ports
193#
194
195#
196# Input I/O drivers
197# 235#
198# CONFIG_GAMEPORT is not set
199CONFIG_SOUND_GAMEPORT=y
200# CONFIG_SERIO is not set 236# CONFIG_SERIO is not set
201# CONFIG_SERIO_I8042 is not set 237# CONFIG_GAMEPORT is not set
202
203#
204# Input Device Drivers
205#
206 238
207# 239#
208# Character devices 240# Character devices
@@ -223,45 +255,31 @@ CONFIG_SOUND_GAMEPORT=y
223# Non-8250 serial port support 255# Non-8250 serial port support
224# 256#
225CONFIG_SERIAL_SH_SCI=y 257CONFIG_SERIAL_SH_SCI=y
258CONFIG_SERIAL_SH_SCI_NR_UARTS=2
226CONFIG_SERIAL_SH_SCI_CONSOLE=y 259CONFIG_SERIAL_SH_SCI_CONSOLE=y
227CONFIG_SERIAL_CORE=y 260CONFIG_SERIAL_CORE=y
228CONFIG_SERIAL_CORE_CONSOLE=y 261CONFIG_SERIAL_CORE_CONSOLE=y
229
230#
231# I2C support
232#
233# CONFIG_I2C is not set 262# CONFIG_I2C is not set
234 263# CONFIG_HWMON is not set
235# 264# CONFIG_USB_SUPPORT is not set
236# USB support
237#
238# CONFIG_USB_ARCH_HAS_HCD is not set
239# CONFIG_USB_ARCH_HAS_OHCI is not set
240
241#
242# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
243#
244
245#
246# USB Gadget Support
247#
248# CONFIG_USB_GADGET is not set
249 265
250# 266#
251# File systems 267# File systems
252# 268#
253# CONFIG_EXT2_FS is not set 269# CONFIG_EXT2_FS is not set
254# CONFIG_EXT3_FS is not set 270# CONFIG_EXT3_FS is not set
255# CONFIG_JBD is not set 271# CONFIG_EXT4DEV_FS is not set
256# CONFIG_REISERFS_FS is not set 272# CONFIG_REISERFS_FS is not set
257# CONFIG_JFS_FS is not set 273# CONFIG_JFS_FS is not set
274# CONFIG_FS_POSIX_ACL is not set
258# CONFIG_XFS_FS is not set 275# CONFIG_XFS_FS is not set
259# CONFIG_MINIX_FS is not set 276# CONFIG_GFS2_FS is not set
260CONFIG_ROMFS_FS=y
261# CONFIG_QUOTA is not set
262# CONFIG_DNOTIFY is not set 277# CONFIG_DNOTIFY is not set
278# CONFIG_INOTIFY is not set
279# CONFIG_QUOTA is not set
263# CONFIG_AUTOFS_FS is not set 280# CONFIG_AUTOFS_FS is not set
264# CONFIG_AUTOFS4_FS is not set 281# CONFIG_AUTOFS4_FS is not set
282# CONFIG_FUSE_FS is not set
265 283
266# 284#
267# CD-ROM/DVD Filesystems 285# CD-ROM/DVD Filesystems
@@ -280,11 +298,11 @@ CONFIG_ROMFS_FS=y
280# Pseudo filesystems 298# Pseudo filesystems
281# 299#
282CONFIG_PROC_FS=y 300CONFIG_PROC_FS=y
283# CONFIG_SYSFS is not set 301CONFIG_PROC_SYSCTL=y
284# CONFIG_DEVFS_FS is not set 302CONFIG_SYSFS=y
285# CONFIG_TMPFS is not set 303# CONFIG_TMPFS is not set
286# CONFIG_HUGETLB_PAGE is not set 304# CONFIG_HUGETLB_PAGE is not set
287CONFIG_RAMFS=y 305# CONFIG_CONFIGFS_FS is not set
288 306
289# 307#
290# Miscellaneous filesystems 308# Miscellaneous filesystems
@@ -296,12 +314,13 @@ CONFIG_RAMFS=y
296# CONFIG_BEFS_FS is not set 314# CONFIG_BEFS_FS is not set
297# CONFIG_BFS_FS is not set 315# CONFIG_BFS_FS is not set
298# CONFIG_EFS_FS is not set 316# CONFIG_EFS_FS is not set
299# CONFIG_JFFS_FS is not set
300# CONFIG_JFFS2_FS is not set 317# CONFIG_JFFS2_FS is not set
301# CONFIG_CRAMFS is not set 318# CONFIG_CRAMFS is not set
302# CONFIG_VXFS_FS is not set 319# CONFIG_VXFS_FS is not set
320# CONFIG_MINIX_FS is not set
303# CONFIG_HPFS_FS is not set 321# CONFIG_HPFS_FS is not set
304# CONFIG_QNX4FS_FS is not set 322# CONFIG_QNX4FS_FS is not set
323CONFIG_ROMFS_FS=y
305# CONFIG_SYSV_FS is not set 324# CONFIG_SYSV_FS is not set
306# CONFIG_UFS_FS is not set 325# CONFIG_UFS_FS is not set
307 326
@@ -310,22 +329,23 @@ CONFIG_RAMFS=y
310# 329#
311# CONFIG_PARTITION_ADVANCED is not set 330# CONFIG_PARTITION_ADVANCED is not set
312CONFIG_MSDOS_PARTITION=y 331CONFIG_MSDOS_PARTITION=y
313
314#
315# Native Language Support
316#
317# CONFIG_NLS is not set 332# CONFIG_NLS is not set
318 333
319# 334#
320# Kernel hacking 335# Kernel hacking
321# 336#
322CONFIG_DEBUG_KERNEL=y 337# CONFIG_PRINTK_TIME is not set
323# CONFIG_SCHEDSTATS is not set 338# CONFIG_ENABLE_WARN_DEPRECATED is not set
324# CONFIG_DEBUG_KOBJECT is not set 339# CONFIG_ENABLE_MUST_CHECK is not set
340# CONFIG_MAGIC_SYSRQ is not set
341# CONFIG_UNUSED_SYMBOLS is not set
325# CONFIG_DEBUG_FS is not set 342# CONFIG_DEBUG_FS is not set
326CONFIG_FULLDEBUG=y 343# CONFIG_HEADERS_CHECK is not set
344# CONFIG_DEBUG_KERNEL is not set
345# CONFIG_SAMPLES is not set
346# CONFIG_FULLDEBUG is not set
327# CONFIG_HIGHPROFILE is not set 347# CONFIG_HIGHPROFILE is not set
328CONFIG_NO_KERNEL_MSG=y 348# CONFIG_NO_KERNEL_MSG is not set
329# CONFIG_SYSCALL_PRINT is not set 349# CONFIG_SYSCALL_PRINT is not set
330# CONFIG_GDB_DEBUG is not set 350# CONFIG_GDB_DEBUG is not set
331# CONFIG_SH_STANDARD_BIOS is not set 351# CONFIG_SH_STANDARD_BIOS is not set
@@ -337,20 +357,17 @@ CONFIG_NO_KERNEL_MSG=y
337# 357#
338# CONFIG_KEYS is not set 358# CONFIG_KEYS is not set
339# CONFIG_SECURITY is not set 359# CONFIG_SECURITY is not set
340 360# CONFIG_SECURITY_FILE_CAPABILITIES is not set
341#
342# Cryptographic options
343#
344# CONFIG_CRYPTO is not set 361# CONFIG_CRYPTO is not set
345 362
346# 363#
347# Hardware crypto devices
348#
349
350#
351# Library routines 364# Library routines
352# 365#
353# CONFIG_CRC_CCITT is not set 366# CONFIG_CRC_CCITT is not set
354CONFIG_CRC32=y 367# CONFIG_CRC16 is not set
368# CONFIG_CRC_ITU_T is not set
369# CONFIG_CRC32 is not set
370# CONFIG_CRC7 is not set
355# CONFIG_LIBCRC32C is not set 371# CONFIG_LIBCRC32C is not set
356CONFIG_ZLIB_INFLATE=y 372CONFIG_ZLIB_INFLATE=y
373CONFIG_HAS_IOMEM=y
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c
index 5a1b4cfea05b..ef4f0047067d 100644
--- a/arch/h8300/kernel/irq.c
+++ b/arch/h8300/kernel/irq.c
@@ -26,7 +26,7 @@
26 26
27extern unsigned long *interrupt_redirect_table; 27extern unsigned long *interrupt_redirect_table;
28extern const int h8300_saved_vectors[]; 28extern const int h8300_saved_vectors[];
29extern const unsigned long h8300_trap_table[]; 29extern const h8300_vector h8300_trap_table[];
30int h8300_enable_irq_pin(unsigned int irq); 30int h8300_enable_irq_pin(unsigned int irq);
31void h8300_disable_irq_pin(unsigned int irq); 31void h8300_disable_irq_pin(unsigned int irq);
32 32
@@ -116,7 +116,7 @@ static void __init setup_vector(void)
116{ 116{
117 int i; 117 int i;
118 unsigned long *ramvec,*ramvec_p; 118 unsigned long *ramvec,*ramvec_p;
119 const unsigned long *trap_entry; 119 const h8300_vector *trap_entry;
120 const int *saved_vector; 120 const int *saved_vector;
121 121
122 ramvec = get_vector_address(); 122 ramvec = get_vector_address();
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
index 62ea12d339b9..cf3472f7389b 100644
--- a/arch/h8300/kernel/signal.c
+++ b/arch/h8300/kernel/signal.c
@@ -352,7 +352,7 @@ static void setup_frame (int sig, struct k_sigaction *ka,
352 ret = (unsigned char *)(ka->sa.sa_restorer); 352 ret = (unsigned char *)(ka->sa.sa_restorer);
353 else { 353 else {
354 /* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */ 354 /* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */
355 err != __put_user(0x1a80f800 + (__NR_sigreturn & 0xff), 355 err |= __put_user(0x1a80f800 + (__NR_sigreturn & 0xff),
356 (unsigned long *)(frame->retcode + 0)); 356 (unsigned long *)(frame->retcode + 0));
357 err |= __put_user(0x5700, (unsigned short *)(frame->retcode + 4)); 357 err |= __put_user(0x5700, (unsigned short *)(frame->retcode + 4));
358 } 358 }
@@ -428,7 +428,7 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
428 ret = (unsigned char *)(ka->sa.sa_restorer); 428 ret = (unsigned char *)(ka->sa.sa_restorer);
429 else { 429 else {
430 /* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */ 430 /* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */
431 err != __put_user(0x1a80f800 + (__NR_sigreturn & 0xff), 431 err |= __put_user(0x1a80f800 + (__NR_sigreturn & 0xff),
432 (unsigned long *)(frame->retcode + 0)); 432 (unsigned long *)(frame->retcode + 0));
433 err |= __put_user(0x5700, (unsigned short *)(frame->retcode + 4)); 433 err |= __put_user(0x5700, (unsigned short *)(frame->retcode + 4));
434 } 434 }
diff --git a/arch/h8300/platform/h8300h/Makefile b/arch/h8300/platform/h8300h/Makefile
index c5096369ea50..420f73b0d962 100644
--- a/arch/h8300/platform/h8300h/Makefile
+++ b/arch/h8300/platform/h8300h/Makefile
@@ -4,4 +4,4 @@
4# Reuse any files we can from the H8/300H 4# Reuse any files we can from the H8/300H
5# 5#
6 6
7obj-y := irq_pin.o ptrace_h8300h.o 7obj-y := irq.o ptrace_h8300h.o
diff --git a/arch/h8300/platform/h8300h/irq.c b/arch/h8300/platform/h8300h/irq.c
new file mode 100644
index 000000000000..e977345105d7
--- /dev/null
+++ b/arch/h8300/platform/h8300h/irq.c
@@ -0,0 +1,82 @@
1/*
2 * Interrupt handling H8/300H depend.
3 * Yoshinori Sato <ysato@users.sourceforge.jp>
4 *
5 */
6
7#include <linux/init.h>
8#include <linux/errno.h>
9
10#include <asm/ptrace.h>
11#include <asm/traps.h>
12#include <asm/irq.h>
13#include <asm/io.h>
14#include <asm/gpio.h>
15#include <asm/regs306x.h>
16
17const int __initdata h8300_saved_vectors[] = {
18#if defined(CONFIG_GDB_DEBUG)
19 TRAP3_VEC, /* TRAPA #3 is GDB breakpoint */
20#endif
21 -1,
22};
23
24const h8300_vector __initdata h8300_trap_table[] = {
25 0, 0, 0, 0, 0, 0, 0, 0,
26 system_call,
27 0,
28 0,
29 trace_break,
30};
31
32int h8300_enable_irq_pin(unsigned int irq)
33{
34 int bitmask;
35 if (irq < EXT_IRQ0 || irq > EXT_IRQ5)
36 return 0;
37
38 /* initialize IRQ pin */
39 bitmask = 1 << (irq - EXT_IRQ0);
40 switch(irq) {
41 case EXT_IRQ0:
42 case EXT_IRQ1:
43 case EXT_IRQ2:
44 case EXT_IRQ3:
45 if (H8300_GPIO_RESERVE(H8300_GPIO_P8, bitmask) == 0)
46 return -EBUSY;
47 H8300_GPIO_DDR(H8300_GPIO_P8, bitmask, H8300_GPIO_INPUT);
48 break;
49 case EXT_IRQ4:
50 case EXT_IRQ5:
51 if (H8300_GPIO_RESERVE(H8300_GPIO_P9, bitmask) == 0)
52 return -EBUSY;
53 H8300_GPIO_DDR(H8300_GPIO_P9, bitmask, H8300_GPIO_INPUT);
54 break;
55 }
56
57 return 0;
58}
59
60void h8300_disable_irq_pin(unsigned int irq)
61{
62 int bitmask;
63 if (irq < EXT_IRQ0 || irq > EXT_IRQ5)
64 return;
65
66 /* disable interrupt & release IRQ pin */
67 bitmask = 1 << (irq - EXT_IRQ0);
68 switch(irq) {
69 case EXT_IRQ0:
70 case EXT_IRQ1:
71 case EXT_IRQ2:
72 case EXT_IRQ3:
73 *(volatile unsigned char *)IER &= ~bitmask;
74 H8300_GPIO_FREE(H8300_GPIO_P8, bitmask);
75 break ;
76 case EXT_IRQ4:
77 case EXT_IRQ5:
78 *(volatile unsigned char *)IER &= ~bitmask;
79 H8300_GPIO_FREE(H8300_GPIO_P9, bitmask);
80 break;
81 }
82}
diff --git a/arch/h8300/platform/h8s/ints.c b/arch/h8300/platform/h8s/ints.c
deleted file mode 100644
index ac10b9783850..000000000000
--- a/arch/h8300/platform/h8s/ints.c
+++ /dev/null
@@ -1,304 +0,0 @@
1/*
2 * linux/arch/h8300/platform/h8s/ints.c
3 *
4 * Yoshinori Sato <ysato@users.sourceforge.jp>
5 *
6 * Based on linux/arch/$(ARCH)/platform/$(PLATFORM)/ints.c
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
10 * for more details.
11 *
12 * Copyright 1996 Roman Zippel
13 * Copyright 1999 D. Jeff Dionne <jeff@rt-control.com>
14 */
15
16#include <linux/module.h>
17#include <linux/types.h>
18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/kernel_stat.h>
21#include <linux/seq_file.h>
22#include <linux/init.h>
23#include <linux/interrupt.h>
24#include <linux/bootmem.h>
25#include <linux/random.h>
26#include <linux/hardirq.h>
27
28#include <asm/system.h>
29#include <asm/irq.h>
30#include <asm/traps.h>
31#include <asm/io.h>
32#include <asm/setup.h>
33#include <asm/gpio.h>
34#include <asm/regs267x.h>
35#include <asm/errno.h>
36
37/*
38 * This structure has only 4 elements for speed reasons
39 */
40typedef struct irq_handler {
41 irqreturn_t (*handler)(int, void *, struct pt_regs *);
42 int flags;
43 int count;
44 void *dev_id;
45 const char *devname;
46} irq_handler_t;
47
48static irq_handler_t *irq_list[NR_IRQS];
49
50/* IRQ pin assignment */
51struct irq_pins {
52 unsigned char port_no;
53 unsigned char bit_no;
54};
55/* ISTR = 0 */
56static const struct irq_pins irq_assign_table0[16]={
57 {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1},
58 {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3},
59 {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5},
60 {H8300_GPIO_P5,H8300_GPIO_B6},{H8300_GPIO_P5,H8300_GPIO_B7},
61 {H8300_GPIO_P6,H8300_GPIO_B0},{H8300_GPIO_P6,H8300_GPIO_B1},
62 {H8300_GPIO_P6,H8300_GPIO_B2},{H8300_GPIO_P6,H8300_GPIO_B3},
63 {H8300_GPIO_P6,H8300_GPIO_B4},{H8300_GPIO_P6,H8300_GPIO_B5},
64 {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2},
65};
66/* ISTR = 1 */
67static const struct irq_pins irq_assign_table1[16]={
68 {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1},
69 {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3},
70 {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5},
71 {H8300_GPIO_PH,H8300_GPIO_B2},{H8300_GPIO_PH,H8300_GPIO_B3},
72 {H8300_GPIO_P2,H8300_GPIO_B0},{H8300_GPIO_P2,H8300_GPIO_B1},
73 {H8300_GPIO_P2,H8300_GPIO_B2},{H8300_GPIO_P2,H8300_GPIO_B3},
74 {H8300_GPIO_P2,H8300_GPIO_B4},{H8300_GPIO_P2,H8300_GPIO_B5},
75 {H8300_GPIO_P2,H8300_GPIO_B6},{H8300_GPIO_P2,H8300_GPIO_B7},
76};
77
78static short use_kmalloc = 0;
79
80extern unsigned long *interrupt_redirect_table;
81
82#define CPU_VECTOR ((unsigned long *)0x000000)
83#define ADDR_MASK (0xffffff)
84
85static inline unsigned long *get_vector_address(void)
86{
87 volatile unsigned long *rom_vector = CPU_VECTOR;
88 unsigned long base,tmp;
89 int vec_no;
90
91 base = rom_vector[EXT_IRQ0] & ADDR_MASK;
92
93 /* check romvector format */
94 for (vec_no = EXT_IRQ1; vec_no <= EXT_IRQ15; vec_no++) {
95 if ((base+(vec_no - EXT_IRQ0)*4) != (rom_vector[vec_no] & ADDR_MASK))
96 return NULL;
97 }
98
99 /* ramvector base address */
100 base -= EXT_IRQ0*4;
101
102 /* writerble check */
103 tmp = ~(*(unsigned long *)base);
104 (*(unsigned long *)base) = tmp;
105 if ((*(unsigned long *)base) != tmp)
106 return NULL;
107 return (unsigned long *)base;
108}
109
110void __init init_IRQ(void)
111{
112#if defined(CONFIG_RAMKERNEL)
113 int i;
114 unsigned long *ramvec,*ramvec_p;
115 unsigned long break_vec;
116
117 ramvec = get_vector_address();
118 if (ramvec == NULL)
119 panic("interrupt vector serup failed.");
120 else
121 printk("virtual vector at 0x%08lx\n",(unsigned long)ramvec);
122
123#if defined(CONFIG_GDB_DEBUG)
124 /* save original break vector */
125 break_vec = ramvec[TRAP3_VEC];
126#else
127 break_vec = VECTOR(trace_break);
128#endif
129
130 /* create redirect table */
131 for (ramvec_p = ramvec, i = 0; i < NR_IRQS; i++)
132 *ramvec_p++ = REDIRECT(interrupt_entry);
133
134 /* set special vector */
135 ramvec[TRAP0_VEC] = VECTOR(system_call);
136 ramvec[TRAP3_VEC] = break_vec;
137 interrupt_redirect_table = ramvec;
138#ifdef DUMP_VECTOR
139 ramvec_p = ramvec;
140 for (i = 0; i < NR_IRQS; i++) {
141 if ((i % 8) == 0)
142 printk("\n%p: ",ramvec_p);
143 printk("%p ",*ramvec_p);
144 ramvec_p++;
145 }
146 printk("\n");
147#endif
148#endif
149}
150
151int request_irq(unsigned int irq,
152 irqreturn_t (*handler)(int, void *, struct pt_regs *),
153 unsigned long flags, const char *devname, void *dev_id)
154{
155 unsigned short ptn = 1 << (irq - EXT_IRQ0);
156 irq_handler_t *irq_handle;
157 if (irq < 0 || irq >= NR_IRQS) {
158 printk("Incorrect IRQ %d from %s\n", irq, devname);
159 return -EINVAL;
160 }
161 if (irq_list[irq])
162 return -EBUSY; /* already used */
163 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15) {
164 /* initialize IRQ pin */
165 unsigned int port_no,bit_no;
166 if (*(volatile unsigned short *)ITSR & ptn) {
167 port_no = irq_assign_table1[irq - EXT_IRQ0].port_no;
168 bit_no = irq_assign_table1[irq - EXT_IRQ0].bit_no;
169 } else {
170 port_no = irq_assign_table0[irq - EXT_IRQ0].port_no;
171 bit_no = irq_assign_table0[irq - EXT_IRQ0].bit_no;
172 }
173 if (H8300_GPIO_RESERVE(port_no, bit_no) == 0)
174 return -EBUSY; /* pin already use */
175 H8300_GPIO_DDR(port_no, bit_no, H8300_GPIO_INPUT);
176 *(volatile unsigned short *)ISR &= ~ptn; /* ISR clear */
177 }
178
179 if (use_kmalloc)
180 irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
181 else {
182 /* use bootmem allocator */
183 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
184 irq_handle = (irq_handler_t *)((unsigned long)irq_handle | 0x80000000);
185 }
186
187 if (irq_handle == NULL)
188 return -ENOMEM;
189
190 irq_handle->handler = handler;
191 irq_handle->flags = flags;
192 irq_handle->count = 0;
193 irq_handle->dev_id = dev_id;
194 irq_handle->devname = devname;
195 irq_list[irq] = irq_handle;
196 if (irq_handle->flags & IRQF_SAMPLE_RANDOM)
197 rand_initialize_irq(irq);
198
199 /* enable interrupt */
200 /* compatible i386 */
201 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15)
202 *(volatile unsigned short *)IER |= ptn;
203 return 0;
204}
205
206EXPORT_SYMBOL(request_irq);
207
208void free_irq(unsigned int irq, void *dev_id)
209{
210 if (irq >= NR_IRQS)
211 return;
212 if (irq_list[irq]->dev_id != dev_id)
213 printk("%s: Removing probably wrong IRQ %d from %s\n",
214 __FUNCTION__, irq, irq_list[irq]->devname);
215 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15) {
216 /* disable interrupt & release IRQ pin */
217 unsigned short port_no,bit_no;
218 *(volatile unsigned short *)ISR &= ~(1 << (irq - EXT_IRQ0));
219 *(volatile unsigned short *)IER |= 1 << (irq - EXT_IRQ0);
220 if (*(volatile unsigned short *)ITSR & (1 << (irq - EXT_IRQ0))) {
221 port_no = irq_assign_table1[irq - EXT_IRQ0].port_no;
222 bit_no = irq_assign_table1[irq - EXT_IRQ0].bit_no;
223 } else {
224 port_no = irq_assign_table0[irq - EXT_IRQ0].port_no;
225 bit_no = irq_assign_table0[irq - EXT_IRQ0].bit_no;
226 }
227 H8300_GPIO_FREE(port_no, bit_no);
228 }
229 if (((unsigned long)irq_list[irq] & 0x80000000) == 0) {
230 kfree(irq_list[irq]);
231 irq_list[irq] = NULL;
232 }
233}
234
235EXPORT_SYMBOL(free_irq);
236
237unsigned long probe_irq_on (void)
238{
239 return 0;
240}
241
242EXPORT_SYMBOL(probe_irq_on);
243
244int probe_irq_off (unsigned long irqs)
245{
246 return 0;
247}
248
249EXPORT_SYMBOL(probe_irq_off);
250
251void enable_irq(unsigned int irq)
252{
253 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15)
254 *(volatile unsigned short *)IER |= 1 << (irq - EXT_IRQ0);
255}
256
257void disable_irq(unsigned int irq)
258{
259 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15)
260 *(volatile unsigned short *)IER &= ~(1 << (irq - EXT_IRQ0));
261}
262
263asmlinkage void process_int(unsigned long vec, struct pt_regs *fp)
264{
265 irq_enter();
266 /* ISR clear */
267 /* compatible i386 */
268 if (vec >= EXT_IRQ0 && vec <= EXT_IRQ15)
269 *(volatile unsigned short *)ISR &= ~(1 << (vec - EXT_IRQ0));
270 if (vec < NR_IRQS) {
271 if (irq_list[vec]) {
272 irq_list[vec]->handler(vec, irq_list[vec]->dev_id, fp);
273 irq_list[vec]->count++;
274 if (irq_list[vec]->flags & IRQF_SAMPLE_RANDOM)
275 add_interrupt_randomness(vec);
276 }
277 } else {
278 BUG();
279 }
280 irq_exit();
281}
282
283int show_interrupts(struct seq_file *p, void *v)
284{
285 int i = *(loff_t *) v;
286
287 if ((i < NR_IRQS) && (irq_list[i] !=NULL)) {
288 seq_printf(p, "%3d: %10u ",i,irq_list[i]->count);
289 seq_printf(p, "%s\n", irq_list[i]->devname);
290 }
291
292 return 0;
293}
294
295void init_irq_proc(void)
296{
297}
298
299static int __init enable_kmalloc(void)
300{
301 use_kmalloc = 1;
302 return 0;
303}
304core_initcall(enable_kmalloc);
diff --git a/arch/h8300/platform/h8s/ints_h8s.c b/arch/h8300/platform/h8s/irq.c
index faa8a459d952..8182f041f829 100644
--- a/arch/h8300/platform/h8s/ints_h8s.c
+++ b/arch/h8300/platform/h8s/irq.c
@@ -27,11 +27,11 @@ const int __initdata h8300_saved_vectors[]={
27}; 27};
28 28
29/* trap entry table */ 29/* trap entry table */
30const unsigned long __initdata h8300_trap_table[NR_TRAPS]={ 30const H8300_VECTOR __initdata h8300_trap_table[] = {
31 0,0,0,0,0, 31 0,0,0,0,0,
32 (unsigned long)trace_break, /* TRACE */ 32 trace_break, /* TRACE */
33 0,0, 33 0,0,
34 (unsigned long)system_call, /* TRAPA #0 */ 34 system_call, /* TRAPA #0 */
35 0,0,0,0,0,0,0 35 0,0,0,0,0,0,0
36}; 36};
37 37
@@ -50,7 +50,7 @@ static const struct irq_pins irq_assign_table0[16]={
50 {H8300_GPIO_P6,H8300_GPIO_B2},{H8300_GPIO_P6,H8300_GPIO_B3}, 50 {H8300_GPIO_P6,H8300_GPIO_B2},{H8300_GPIO_P6,H8300_GPIO_B3},
51 {H8300_GPIO_P6,H8300_GPIO_B4},{H8300_GPIO_P6,H8300_GPIO_B5}, 51 {H8300_GPIO_P6,H8300_GPIO_B4},{H8300_GPIO_P6,H8300_GPIO_B5},
52 {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2}, 52 {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2},
53}; 53};
54/* ISTR = 1 */ 54/* ISTR = 1 */
55static const struct irq_pins irq_assign_table1[16]={ 55static const struct irq_pins irq_assign_table1[16]={
56 {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1}, 56 {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1},
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 89cdbcaeb45f..0ccfb2ad6380 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -42,14 +42,12 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
42 /* last time the cmos clock got updated */ 42 /* last time the cmos clock got updated */
43 static long last_rtc_update=0; 43 static long last_rtc_update=0;
44 44
45 if (current->pid)
46 profile_tick(CPU_PROFILING);
47
45 write_seqlock(&xtime_lock); 48 write_seqlock(&xtime_lock);
46 49
47 do_timer(1); 50 do_timer(1);
48#ifndef CONFIG_SMP
49 update_process_times(user_mode(get_irq_regs()));
50#endif
51 if (current->pid)
52 profile_tick(CPU_PROFILING);
53 51
54 /* 52 /*
55 * If we have an externally synchronized Linux clock, then update 53 * If we have an externally synchronized Linux clock, then update
@@ -67,6 +65,10 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
67 } 65 }
68 66
69 write_sequnlock(&xtime_lock); 67 write_sequnlock(&xtime_lock);
68
69#ifndef CONFIG_SMP
70 update_process_times(user_mode(get_irq_regs()));
71#endif
70 return(IRQ_HANDLED); 72 return(IRQ_HANDLED);
71} 73}
72 74
diff --git a/arch/m68knommu/platform/5206/Makefile b/arch/m68knommu/platform/5206/Makefile
index c7bb0cef31a0..a439d9ab3f27 100644
--- a/arch/m68knommu/platform/5206/Makefile
+++ b/arch/m68knommu/platform/5206/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
20 18
diff --git a/arch/m68knommu/platform/5206e/Makefile b/arch/m68knommu/platform/5206e/Makefile
index c7bb0cef31a0..a439d9ab3f27 100644
--- a/arch/m68knommu/platform/5206e/Makefile
+++ b/arch/m68knommu/platform/5206e/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
20 18
diff --git a/arch/m68knommu/platform/520x/Makefile b/arch/m68knommu/platform/520x/Makefile
index 31b4eb51739d..a50e76acc8fd 100644
--- a/arch/m68knommu/platform/520x/Makefile
+++ b/arch/m68knommu/platform/520x/Makefile
@@ -12,8 +12,6 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
diff --git a/arch/m68knommu/platform/523x/Makefile b/arch/m68knommu/platform/523x/Makefile
index ac9fbece8a4f..5694d593f029 100644
--- a/arch/m68knommu/platform/523x/Makefile
+++ b/arch/m68knommu/platform/523x/Makefile
@@ -12,8 +12,6 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
diff --git a/arch/m68knommu/platform/5249/Makefile b/arch/m68knommu/platform/5249/Makefile
index c7bb0cef31a0..a439d9ab3f27 100644
--- a/arch/m68knommu/platform/5249/Makefile
+++ b/arch/m68knommu/platform/5249/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
20 18
diff --git a/arch/m68knommu/platform/5272/Makefile b/arch/m68knommu/platform/5272/Makefile
index 7475c38c3b4e..26135d92b34d 100644
--- a/arch/m68knommu/platform/5272/Makefile
+++ b/arch/m68knommu/platform/5272/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
20 18
diff --git a/arch/m68knommu/platform/527x/Makefile b/arch/m68knommu/platform/527x/Makefile
index 7475c38c3b4e..26135d92b34d 100644
--- a/arch/m68knommu/platform/527x/Makefile
+++ b/arch/m68knommu/platform/527x/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
20 18
diff --git a/arch/m68knommu/platform/528x/Makefile b/arch/m68knommu/platform/528x/Makefile
index 7475c38c3b4e..26135d92b34d 100644
--- a/arch/m68knommu/platform/528x/Makefile
+++ b/arch/m68knommu/platform/528x/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
20 18
diff --git a/arch/m68knommu/platform/5307/Makefile b/arch/m68knommu/platform/5307/Makefile
index 580fd6658d7c..cfd586860fd8 100644
--- a/arch/m68knommu/platform/5307/Makefile
+++ b/arch/m68knommu/platform/5307/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y += config.o 17obj-y += config.o
20 18
diff --git a/arch/m68knommu/platform/532x/Makefile b/arch/m68knommu/platform/532x/Makefile
index 475b92866a9b..e431912f5628 100644
--- a/arch/m68knommu/platform/532x/Makefile
+++ b/arch/m68knommu/platform/532x/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19#obj-y := config.o usb-mcf532x.o spi-mcf532x.o 17#obj-y := config.o usb-mcf532x.o spi-mcf532x.o
20obj-y := config.o 18obj-y := config.o
diff --git a/arch/m68knommu/platform/5407/Makefile b/arch/m68knommu/platform/5407/Makefile
index 68633b27df51..e6035e7a2d3f 100644
--- a/arch/m68knommu/platform/5407/Makefile
+++ b/arch/m68knommu/platform/5407/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-y := config.o 17obj-y := config.o
20 18
diff --git a/arch/m68knommu/platform/coldfire/Makefile b/arch/m68knommu/platform/coldfire/Makefile
index e5fff297ae01..40cf20be1b90 100644
--- a/arch/m68knommu/platform/coldfire/Makefile
+++ b/arch/m68knommu/platform/coldfire/Makefile
@@ -12,9 +12,7 @@
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT 12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13# 13#
14 14
15ifdef CONFIG_FULLDEBUG 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18 16
19obj-$(CONFIG_COLDFIRE) += dma.o entry.o vectors.o 17obj-$(CONFIG_COLDFIRE) += dma.o entry.o vectors.o
20obj-$(CONFIG_M5206) += timers.o 18obj-$(CONFIG_M5206) += timers.o
diff --git a/arch/m68knommu/platform/coldfire/entry.S b/arch/m68knommu/platform/coldfire/entry.S
index b333731b875a..111b66dc737b 100644
--- a/arch/m68knommu/platform/coldfire/entry.S
+++ b/arch/m68knommu/platform/coldfire/entry.S
@@ -197,14 +197,13 @@ ENTRY(fasthandler)
197 RESTORE_LOCAL 197 RESTORE_LOCAL
198 198
199ENTRY(ret_from_interrupt) 199ENTRY(ret_from_interrupt)
200 jeq 2f
2011:
202 RESTORE_ALL
2032:
204 moveb %sp@(PT_SR),%d0 200 moveb %sp@(PT_SR),%d0
205 andl #0x7,%d0 201 andl #0x7,%d0
206 jhi 1b 202 jeq 1f
207 203
204 RESTORE_ALL
205
2061:
208 /* check if we need to do software interrupts */ 207 /* check if we need to do software interrupts */
209 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0 208 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
210 jeq ret_from_exception 209 jeq ret_from_exception
diff --git a/arch/m68knommu/platform/coldfire/timers.c b/arch/m68knommu/platform/coldfire/timers.c
index a60213e877ef..ba5a9f32ebd4 100644
--- a/arch/m68knommu/platform/coldfire/timers.c
+++ b/arch/m68knommu/platform/coldfire/timers.c
@@ -148,25 +148,32 @@ irqreturn_t coldfire_profile_tick(int irq, void *dummy)
148 /* Reset ColdFire timer2 */ 148 /* Reset ColdFire timer2 */
149 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, PA(MCFTIMER_TER)); 149 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, PA(MCFTIMER_TER));
150 if (current->pid) 150 if (current->pid)
151 profile_tick(CPU_PROFILING, regs); 151 profile_tick(CPU_PROFILING);
152 return IRQ_HANDLED; 152 return IRQ_HANDLED;
153} 153}
154 154
155/***************************************************************************/ 155/***************************************************************************/
156 156
157static struct irqaction coldfire_profile_irq = {
158 .name = "profile timer",
159 .flags = IRQF_DISABLED | IRQF_TIMER,
160 .handler = coldfire_profile_tick,
161};
162
157void coldfire_profile_init(void) 163void coldfire_profile_init(void)
158{ 164{
159 printk(KERN_INFO "PROFILE: lodging TIMER2 @ %dHz as profile timer\n", PROFILEHZ); 165 printk(KERN_INFO "PROFILE: lodging TIMER2 @ %dHz as profile timer\n",
166 PROFILEHZ);
167
168 setup_irq(mcf_profilevector, &coldfire_profile_irq);
160 169
161 /* Set up TIMER 2 as high speed profile clock */ 170 /* Set up TIMER 2 as high speed profile clock */
162 __raw_writew(MCFTIMER_TMR_DISABLE, PA(MCFTIMER_TMR)); 171 __raw_writew(MCFTIMER_TMR_DISABLE, PA(MCFTIMER_TMR));
163 172
164 __raw_writetrr(((MCF_CLK / 16) / PROFILEHZ), PA(MCFTIMER_TRR)); 173 __raw_writetrr(((MCF_BUSCLK / 16) / PROFILEHZ), PA(MCFTIMER_TRR));
165 __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | 174 __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
166 MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, PA(MCFTIMER_TMR)); 175 MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, PA(MCFTIMER_TMR));
167 176
168 request_irq(mcf_profilevector, coldfire_profile_tick,
169 (IRQF_DISABLED | IRQ_FLG_FAST), "profile timer", NULL);
170 mcf_settimericr(2, 7); 177 mcf_settimericr(2, 7);
171} 178}
172 179
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 1b6b0fa5028f..8d36f186890e 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -92,17 +92,17 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
92 iv->sprom.revision = 3; 92 iv->sprom.revision = 3;
93 93
94 if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0) 94 if (cfe_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
95 str2eaddr(buf, iv->sprom.r1.et0mac); 95 str2eaddr(buf, iv->sprom.et0mac);
96 if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0) 96 if (cfe_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
97 str2eaddr(buf, iv->sprom.r1.et1mac); 97 str2eaddr(buf, iv->sprom.et1mac);
98 if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0) 98 if (cfe_getenv("et0phyaddr", buf, sizeof(buf)) >= 0)
99 iv->sprom.r1.et0phyaddr = simple_strtoul(buf, NULL, 10); 99 iv->sprom.et0phyaddr = simple_strtoul(buf, NULL, 10);
100 if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0) 100 if (cfe_getenv("et1phyaddr", buf, sizeof(buf)) >= 0)
101 iv->sprom.r1.et1phyaddr = simple_strtoul(buf, NULL, 10); 101 iv->sprom.et1phyaddr = simple_strtoul(buf, NULL, 10);
102 if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0) 102 if (cfe_getenv("et0mdcport", buf, sizeof(buf)) >= 0)
103 iv->sprom.r1.et0mdcport = simple_strtoul(buf, NULL, 10); 103 iv->sprom.et0mdcport = simple_strtoul(buf, NULL, 10);
104 if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0) 104 if (cfe_getenv("et1mdcport", buf, sizeof(buf)) >= 0)
105 iv->sprom.r1.et1mdcport = simple_strtoul(buf, NULL, 10); 105 iv->sprom.et1mdcport = simple_strtoul(buf, NULL, 10);
106 106
107 return 0; 107 return 0;
108} 108}
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index 5a017eaee712..d1d90c9ef2fa 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -9,6 +9,7 @@
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/leds.h> 11#include <linux/leds.h>
12#include <linux/mtd/physmap.h>
12#include <linux/ssb/ssb.h> 13#include <linux/ssb/ssb.h>
13#include <asm/mach-bcm47xx/bcm47xx.h> 14#include <asm/mach-bcm47xx/bcm47xx.h>
14 15
@@ -43,6 +44,61 @@ static struct platform_device wgt634u_gpio_leds = {
43 } 44 }
44}; 45};
45 46
47
48/* 8MiB flash. The struct mtd_partition matches original Netgear WGT634U
49 firmware. */
50static struct mtd_partition wgt634u_partitions[] = {
51 {
52 .name = "cfe",
53 .offset = 0,
54 .size = 0x60000, /* 384k */
55 .mask_flags = MTD_WRITEABLE /* force read-only */
56 },
57 {
58 .name = "config",
59 .offset = 0x60000,
60 .size = 0x20000 /* 128k */
61 },
62 {
63 .name = "linux",
64 .offset = 0x80000,
65 .size = 0x140000 /* 1280k */
66 },
67 {
68 .name = "jffs",
69 .offset = 0x1c0000,
70 .size = 0x620000 /* 6272k */
71 },
72 {
73 .name = "nvram",
74 .offset = 0x7e0000,
75 .size = 0x20000 /* 128k */
76 },
77};
78
79static struct physmap_flash_data wgt634u_flash_data = {
80 .parts = wgt634u_partitions,
81 .nr_parts = ARRAY_SIZE(wgt634u_partitions)
82};
83
84static struct resource wgt634u_flash_resource = {
85 .flags = IORESOURCE_MEM,
86};
87
88static struct platform_device wgt634u_flash = {
89 .name = "physmap-flash",
90 .id = 0,
91 .dev = { .platform_data = &wgt634u_flash_data, },
92 .resource = &wgt634u_flash_resource,
93 .num_resources = 1,
94};
95
96/* Platform devices */
97static struct platform_device *wgt634u_devices[] __initdata = {
98 &wgt634u_flash,
99 &wgt634u_gpio_leds,
100};
101
46static int __init wgt634u_init(void) 102static int __init wgt634u_init(void)
47{ 103{
48 /* There is no easy way to detect that we are running on a WGT634U 104 /* There is no easy way to detect that we are running on a WGT634U
@@ -50,13 +106,20 @@ static int __init wgt634u_init(void)
50 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx. 106 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
51 */ 107 */
52 108
53 u8 *et0mac = ssb_bcm47xx.sprom.r1.et0mac; 109 u8 *et0mac = ssb_bcm47xx.sprom.et0mac;
54 110
55 if (et0mac[0] == 0x00 && 111 if (et0mac[0] == 0x00 &&
56 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) || 112 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
57 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) 113 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
58 return platform_device_register(&wgt634u_gpio_leds); 114 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
59 else 115 wgt634u_flash_data.width = mcore->flash_buswidth;
116 wgt634u_flash_resource.start = mcore->flash_window;
117 wgt634u_flash_resource.end = mcore->flash_window
118 + mcore->flash_window_size
119 - 1;
120 return platform_add_devices(wgt634u_devices,
121 ARRAY_SIZE(wgt634u_devices));
122 } else
60 return -ENODEV; 123 return -ENODEV;
61} 124}
62 125
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
new file mode 100644
index 000000000000..c0e42e74dfbd
--- /dev/null
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -0,0 +1,1939 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.25-rc2
4# Mon Feb 18 11:55:24 2008
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13CONFIG_BCM47XX=y
14# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set
16# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set
18# CONFIG_LEMOTE_FULONG is not set
19# CONFIG_MIPS_ATLAS is not set
20# CONFIG_MIPS_MALTA is not set
21# CONFIG_MIPS_SEAD is not set
22# CONFIG_MIPS_SIM is not set
23# CONFIG_MARKEINS is not set
24# CONFIG_MACH_VR41XX is not set
25# CONFIG_PNX8550_JBS is not set
26# CONFIG_PNX8550_STB810 is not set
27# CONFIG_PMC_MSP is not set
28# CONFIG_PMC_YOSEMITE is not set
29# CONFIG_SGI_IP22 is not set
30# CONFIG_SGI_IP27 is not set
31# CONFIG_SGI_IP28 is not set
32# CONFIG_SGI_IP32 is not set
33# CONFIG_SIBYTE_CRHINE is not set
34# CONFIG_SIBYTE_CARMEL is not set
35# CONFIG_SIBYTE_CRHONE is not set
36# CONFIG_SIBYTE_RHONE is not set
37# CONFIG_SIBYTE_SWARM is not set
38# CONFIG_SIBYTE_LITTLESUR is not set
39# CONFIG_SIBYTE_SENTOSA is not set
40# CONFIG_SIBYTE_BIGSUR is not set
41# CONFIG_SNI_RM is not set
42# CONFIG_TOSHIBA_JMR3927 is not set
43# CONFIG_TOSHIBA_RBTX4927 is not set
44# CONFIG_TOSHIBA_RBTX4938 is not set
45# CONFIG_WR_PPMC is not set
46CONFIG_RWSEM_GENERIC_SPINLOCK=y
47# CONFIG_ARCH_HAS_ILOG2_U32 is not set
48# CONFIG_ARCH_HAS_ILOG2_U64 is not set
49CONFIG_ARCH_SUPPORTS_OPROFILE=y
50CONFIG_GENERIC_FIND_NEXT_BIT=y
51CONFIG_GENERIC_HWEIGHT=y
52CONFIG_GENERIC_CALIBRATE_DELAY=y
53CONFIG_GENERIC_CLOCKEVENTS=y
54CONFIG_GENERIC_TIME=y
55CONFIG_GENERIC_CMOS_UPDATE=y
56CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
57# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
58CONFIG_CEVT_R4K=y
59CONFIG_CSRC_R4K=y
60CONFIG_CFE=y
61CONFIG_DMA_NONCOHERENT=y
62CONFIG_DMA_NEED_PCI_MAP_STATE=y
63CONFIG_EARLY_PRINTK=y
64CONFIG_SYS_HAS_EARLY_PRINTK=y
65# CONFIG_HOTPLUG_CPU is not set
66# CONFIG_NO_IOPORT is not set
67CONFIG_GENERIC_GPIO=y
68# CONFIG_CPU_BIG_ENDIAN is not set
69CONFIG_CPU_LITTLE_ENDIAN=y
70CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
71CONFIG_IRQ_CPU=y
72CONFIG_MIPS_L1_CACHE_SHIFT=5
73
74#
75# CPU selection
76#
77# CONFIG_CPU_LOONGSON2 is not set
78CONFIG_CPU_MIPS32_R1=y
79# CONFIG_CPU_MIPS32_R2 is not set
80# CONFIG_CPU_MIPS64_R1 is not set
81# CONFIG_CPU_MIPS64_R2 is not set
82# CONFIG_CPU_R3000 is not set
83# CONFIG_CPU_TX39XX is not set
84# CONFIG_CPU_VR41XX is not set
85# CONFIG_CPU_R4300 is not set
86# CONFIG_CPU_R4X00 is not set
87# CONFIG_CPU_TX49XX is not set
88# CONFIG_CPU_R5000 is not set
89# CONFIG_CPU_R5432 is not set
90# CONFIG_CPU_R6000 is not set
91# CONFIG_CPU_NEVADA is not set
92# CONFIG_CPU_R8000 is not set
93# CONFIG_CPU_R10000 is not set
94# CONFIG_CPU_RM7000 is not set
95# CONFIG_CPU_RM9000 is not set
96# CONFIG_CPU_SB1 is not set
97CONFIG_SYS_HAS_CPU_MIPS32_R1=y
98CONFIG_CPU_MIPS32=y
99CONFIG_CPU_MIPSR1=y
100CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
101CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
102
103#
104# Kernel type
105#
106CONFIG_32BIT=y
107# CONFIG_64BIT is not set
108CONFIG_PAGE_SIZE_4KB=y
109# CONFIG_PAGE_SIZE_8KB is not set
110# CONFIG_PAGE_SIZE_16KB is not set
111# CONFIG_PAGE_SIZE_64KB is not set
112CONFIG_CPU_HAS_PREFETCH=y
113CONFIG_MIPS_MT_DISABLED=y
114# CONFIG_MIPS_MT_SMP is not set
115# CONFIG_MIPS_MT_SMTC is not set
116CONFIG_CPU_HAS_LLSC=y
117CONFIG_CPU_HAS_SYNC=y
118CONFIG_GENERIC_HARDIRQS=y
119CONFIG_GENERIC_IRQ_PROBE=y
120CONFIG_CPU_SUPPORTS_HIGHMEM=y
121CONFIG_ARCH_FLATMEM_ENABLE=y
122CONFIG_ARCH_POPULATES_NODE_MAP=y
123CONFIG_SELECT_MEMORY_MODEL=y
124CONFIG_FLATMEM_MANUAL=y
125# CONFIG_DISCONTIGMEM_MANUAL is not set
126# CONFIG_SPARSEMEM_MANUAL is not set
127CONFIG_FLATMEM=y
128CONFIG_FLAT_NODE_MEM_MAP=y
129# CONFIG_SPARSEMEM_STATIC is not set
130# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
131CONFIG_SPLIT_PTLOCK_CPUS=4
132# CONFIG_RESOURCES_64BIT is not set
133CONFIG_ZONE_DMA_FLAG=0
134CONFIG_VIRT_TO_BUS=y
135CONFIG_TICK_ONESHOT=y
136CONFIG_NO_HZ=y
137CONFIG_HIGH_RES_TIMERS=y
138CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
139# CONFIG_HZ_48 is not set
140# CONFIG_HZ_100 is not set
141# CONFIG_HZ_128 is not set
142CONFIG_HZ_250=y
143# CONFIG_HZ_256 is not set
144# CONFIG_HZ_1000 is not set
145# CONFIG_HZ_1024 is not set
146CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
147CONFIG_HZ=250
148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set
151CONFIG_RCU_TRACE=y
152CONFIG_KEXEC=y
153# CONFIG_SECCOMP is not set
154CONFIG_LOCKDEP_SUPPORT=y
155CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157
158#
159# General setup
160#
161CONFIG_EXPERIMENTAL=y
162CONFIG_BROKEN_ON_SMP=y
163CONFIG_INIT_ENV_ARG_LIMIT=32
164CONFIG_LOCALVERSION=""
165# CONFIG_LOCALVERSION_AUTO is not set
166CONFIG_SWAP=y
167CONFIG_SYSVIPC=y
168CONFIG_SYSVIPC_SYSCTL=y
169CONFIG_POSIX_MQUEUE=y
170CONFIG_BSD_PROCESS_ACCT=y
171CONFIG_BSD_PROCESS_ACCT_V3=y
172CONFIG_TASKSTATS=y
173CONFIG_TASK_DELAY_ACCT=y
174CONFIG_TASK_XACCT=y
175CONFIG_TASK_IO_ACCOUNTING=y
176CONFIG_AUDIT=y
177# CONFIG_IKCONFIG is not set
178CONFIG_LOG_BUF_SHIFT=17
179CONFIG_CGROUPS=y
180# CONFIG_CGROUP_DEBUG is not set
181CONFIG_CGROUP_NS=y
182CONFIG_GROUP_SCHED=y
183CONFIG_FAIR_GROUP_SCHED=y
184# CONFIG_RT_GROUP_SCHED is not set
185CONFIG_USER_SCHED=y
186# CONFIG_CGROUP_SCHED is not set
187CONFIG_CGROUP_CPUACCT=y
188# CONFIG_RESOURCE_COUNTERS is not set
189CONFIG_SYSFS_DEPRECATED=y
190CONFIG_RELAY=y
191# CONFIG_NAMESPACES is not set
192CONFIG_BLK_DEV_INITRD=y
193CONFIG_INITRAMFS_SOURCE=""
194CONFIG_CC_OPTIMIZE_FOR_SIZE=y
195CONFIG_SYSCTL=y
196CONFIG_EMBEDDED=y
197CONFIG_SYSCTL_SYSCALL=y
198CONFIG_KALLSYMS=y
199# CONFIG_KALLSYMS_EXTRA_PASS is not set
200CONFIG_HOTPLUG=y
201CONFIG_PRINTK=y
202CONFIG_BUG=y
203CONFIG_ELF_CORE=y
204CONFIG_COMPAT_BRK=y
205CONFIG_BASE_FULL=y
206CONFIG_FUTEX=y
207CONFIG_ANON_INODES=y
208CONFIG_EPOLL=y
209CONFIG_SIGNALFD=y
210CONFIG_TIMERFD=y
211CONFIG_EVENTFD=y
212CONFIG_SHMEM=y
213CONFIG_VM_EVENT_COUNTERS=y
214CONFIG_SLAB=y
215# CONFIG_SLUB is not set
216# CONFIG_SLOB is not set
217# CONFIG_PROFILING is not set
218# CONFIG_MARKERS is not set
219CONFIG_HAVE_OPROFILE=y
220# CONFIG_HAVE_KPROBES is not set
221CONFIG_PROC_PAGE_MONITOR=y
222CONFIG_SLABINFO=y
223CONFIG_RT_MUTEXES=y
224# CONFIG_TINY_SHMEM is not set
225CONFIG_BASE_SMALL=0
226CONFIG_MODULES=y
227CONFIG_MODULE_UNLOAD=y
228CONFIG_MODULE_FORCE_UNLOAD=y
229CONFIG_MODVERSIONS=y
230# CONFIG_MODULE_SRCVERSION_ALL is not set
231CONFIG_KMOD=y
232CONFIG_BLOCK=y
233CONFIG_LBD=y
234CONFIG_BLK_DEV_IO_TRACE=y
235CONFIG_LSF=y
236# CONFIG_BLK_DEV_BSG is not set
237
238#
239# IO Schedulers
240#
241CONFIG_IOSCHED_NOOP=y
242CONFIG_IOSCHED_AS=y
243CONFIG_IOSCHED_DEADLINE=y
244CONFIG_IOSCHED_CFQ=y
245# CONFIG_DEFAULT_AS is not set
246# CONFIG_DEFAULT_DEADLINE is not set
247CONFIG_DEFAULT_CFQ=y
248# CONFIG_DEFAULT_NOOP is not set
249CONFIG_DEFAULT_IOSCHED="cfq"
250CONFIG_CLASSIC_RCU=y
251# CONFIG_PREEMPT_RCU is not set
252
253#
254# Bus options (PCI, PCMCIA, EISA, ISA, TC)
255#
256CONFIG_HW_HAS_PCI=y
257CONFIG_PCI=y
258CONFIG_PCI_DOMAINS=y
259# CONFIG_ARCH_SUPPORTS_MSI is not set
260CONFIG_PCI_LEGACY=y
261CONFIG_MMU=y
262# CONFIG_PCCARD is not set
263# CONFIG_HOTPLUG_PCI is not set
264
265#
266# Executable file formats
267#
268CONFIG_BINFMT_ELF=y
269CONFIG_BINFMT_MISC=m
270CONFIG_TRAD_SIGNALS=y
271
272#
273# Power management options
274#
275CONFIG_ARCH_SUSPEND_POSSIBLE=y
276# CONFIG_PM is not set
277
278#
279# Networking
280#
281CONFIG_NET=y
282
283#
284# Networking options
285#
286CONFIG_PACKET=y
287CONFIG_PACKET_MMAP=y
288CONFIG_UNIX=y
289CONFIG_XFRM=y
290CONFIG_XFRM_USER=m
291# CONFIG_XFRM_SUB_POLICY is not set
292# CONFIG_XFRM_MIGRATE is not set
293# CONFIG_XFRM_STATISTICS is not set
294CONFIG_NET_KEY=m
295# CONFIG_NET_KEY_MIGRATE is not set
296CONFIG_INET=y
297CONFIG_IP_MULTICAST=y
298CONFIG_IP_ADVANCED_ROUTER=y
299CONFIG_ASK_IP_FIB_HASH=y
300# CONFIG_IP_FIB_TRIE is not set
301CONFIG_IP_FIB_HASH=y
302CONFIG_IP_MULTIPLE_TABLES=y
303CONFIG_IP_ROUTE_MULTIPATH=y
304CONFIG_IP_ROUTE_VERBOSE=y
305# CONFIG_IP_PNP is not set
306CONFIG_NET_IPIP=m
307CONFIG_NET_IPGRE=m
308CONFIG_NET_IPGRE_BROADCAST=y
309CONFIG_IP_MROUTE=y
310CONFIG_IP_PIMSM_V1=y
311CONFIG_IP_PIMSM_V2=y
312# CONFIG_ARPD is not set
313CONFIG_SYN_COOKIES=y
314CONFIG_INET_AH=m
315CONFIG_INET_ESP=m
316CONFIG_INET_IPCOMP=m
317CONFIG_INET_XFRM_TUNNEL=m
318CONFIG_INET_TUNNEL=m
319CONFIG_INET_XFRM_MODE_TRANSPORT=m
320CONFIG_INET_XFRM_MODE_TUNNEL=m
321CONFIG_INET_XFRM_MODE_BEET=m
322CONFIG_INET_LRO=m
323CONFIG_INET_DIAG=m
324CONFIG_INET_TCP_DIAG=m
325CONFIG_TCP_CONG_ADVANCED=y
326CONFIG_TCP_CONG_BIC=y
327CONFIG_TCP_CONG_CUBIC=m
328CONFIG_TCP_CONG_WESTWOOD=m
329CONFIG_TCP_CONG_HTCP=m
330CONFIG_TCP_CONG_HSTCP=m
331CONFIG_TCP_CONG_HYBLA=m
332CONFIG_TCP_CONG_VEGAS=m
333CONFIG_TCP_CONG_SCALABLE=m
334CONFIG_TCP_CONG_LP=m
335CONFIG_TCP_CONG_VENO=m
336CONFIG_TCP_CONG_YEAH=m
337CONFIG_TCP_CONG_ILLINOIS=m
338CONFIG_DEFAULT_BIC=y
339# CONFIG_DEFAULT_CUBIC is not set
340# CONFIG_DEFAULT_HTCP is not set
341# CONFIG_DEFAULT_VEGAS is not set
342# CONFIG_DEFAULT_WESTWOOD is not set
343# CONFIG_DEFAULT_RENO is not set
344CONFIG_DEFAULT_TCP_CONG="bic"
345# CONFIG_TCP_MD5SIG is not set
346CONFIG_IP_VS=m
347# CONFIG_IP_VS_DEBUG is not set
348CONFIG_IP_VS_TAB_BITS=12
349
350#
351# IPVS transport protocol load balancing support
352#
353CONFIG_IP_VS_PROTO_TCP=y
354CONFIG_IP_VS_PROTO_UDP=y
355CONFIG_IP_VS_PROTO_ESP=y
356CONFIG_IP_VS_PROTO_AH=y
357
358#
359# IPVS scheduler
360#
361CONFIG_IP_VS_RR=m
362CONFIG_IP_VS_WRR=m
363CONFIG_IP_VS_LC=m
364CONFIG_IP_VS_WLC=m
365CONFIG_IP_VS_LBLC=m
366CONFIG_IP_VS_LBLCR=m
367CONFIG_IP_VS_DH=m
368CONFIG_IP_VS_SH=m
369CONFIG_IP_VS_SED=m
370CONFIG_IP_VS_NQ=m
371
372#
373# IPVS application helper
374#
375CONFIG_IP_VS_FTP=m
376CONFIG_IPV6=m
377CONFIG_IPV6_PRIVACY=y
378# CONFIG_IPV6_ROUTER_PREF is not set
379# CONFIG_IPV6_OPTIMISTIC_DAD is not set
380CONFIG_INET6_AH=m
381CONFIG_INET6_ESP=m
382CONFIG_INET6_IPCOMP=m
383# CONFIG_IPV6_MIP6 is not set
384CONFIG_INET6_XFRM_TUNNEL=m
385CONFIG_INET6_TUNNEL=m
386CONFIG_INET6_XFRM_MODE_TRANSPORT=m
387CONFIG_INET6_XFRM_MODE_TUNNEL=m
388CONFIG_INET6_XFRM_MODE_BEET=m
389CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
390CONFIG_IPV6_SIT=m
391CONFIG_IPV6_TUNNEL=m
392CONFIG_IPV6_MULTIPLE_TABLES=y
393CONFIG_IPV6_SUBTREES=y
394CONFIG_NETWORK_SECMARK=y
395CONFIG_NETFILTER=y
396# CONFIG_NETFILTER_DEBUG is not set
397CONFIG_NETFILTER_ADVANCED=y
398CONFIG_BRIDGE_NETFILTER=y
399
400#
401# Core Netfilter Configuration
402#
403CONFIG_NETFILTER_NETLINK=m
404CONFIG_NETFILTER_NETLINK_QUEUE=m
405CONFIG_NETFILTER_NETLINK_LOG=m
406CONFIG_NF_CONNTRACK=m
407CONFIG_NF_CT_ACCT=y
408CONFIG_NF_CONNTRACK_MARK=y
409CONFIG_NF_CONNTRACK_SECMARK=y
410CONFIG_NF_CONNTRACK_EVENTS=y
411CONFIG_NF_CT_PROTO_GRE=m
412CONFIG_NF_CT_PROTO_SCTP=m
413CONFIG_NF_CT_PROTO_UDPLITE=m
414CONFIG_NF_CONNTRACK_AMANDA=m
415CONFIG_NF_CONNTRACK_FTP=m
416CONFIG_NF_CONNTRACK_H323=m
417CONFIG_NF_CONNTRACK_IRC=m
418CONFIG_NF_CONNTRACK_NETBIOS_NS=m
419CONFIG_NF_CONNTRACK_PPTP=m
420CONFIG_NF_CONNTRACK_SANE=m
421CONFIG_NF_CONNTRACK_SIP=m
422CONFIG_NF_CONNTRACK_TFTP=m
423CONFIG_NF_CT_NETLINK=m
424CONFIG_NETFILTER_XTABLES=m
425CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
426CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
427CONFIG_NETFILTER_XT_TARGET_DSCP=m
428CONFIG_NETFILTER_XT_TARGET_MARK=m
429CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
430CONFIG_NETFILTER_XT_TARGET_NFLOG=m
431CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
432# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
433CONFIG_NETFILTER_XT_TARGET_TRACE=m
434CONFIG_NETFILTER_XT_TARGET_SECMARK=m
435CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
436CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
437# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
438CONFIG_NETFILTER_XT_MATCH_COMMENT=m
439CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
440CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
441CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
442CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
443CONFIG_NETFILTER_XT_MATCH_DCCP=m
444CONFIG_NETFILTER_XT_MATCH_DSCP=m
445CONFIG_NETFILTER_XT_MATCH_ESP=m
446CONFIG_NETFILTER_XT_MATCH_HELPER=m
447# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
448CONFIG_NETFILTER_XT_MATCH_LENGTH=m
449CONFIG_NETFILTER_XT_MATCH_LIMIT=m
450CONFIG_NETFILTER_XT_MATCH_MAC=m
451CONFIG_NETFILTER_XT_MATCH_MARK=m
452# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
453CONFIG_NETFILTER_XT_MATCH_POLICY=m
454CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
455CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
456CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
457CONFIG_NETFILTER_XT_MATCH_QUOTA=m
458# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
459CONFIG_NETFILTER_XT_MATCH_REALM=m
460CONFIG_NETFILTER_XT_MATCH_SCTP=m
461CONFIG_NETFILTER_XT_MATCH_STATE=m
462CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
463CONFIG_NETFILTER_XT_MATCH_STRING=m
464CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
465CONFIG_NETFILTER_XT_MATCH_TIME=m
466CONFIG_NETFILTER_XT_MATCH_U32=m
467CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
468
469#
470# IP: Netfilter Configuration
471#
472CONFIG_NF_CONNTRACK_IPV4=m
473CONFIG_NF_CONNTRACK_PROC_COMPAT=y
474CONFIG_IP_NF_QUEUE=m
475CONFIG_IP_NF_IPTABLES=m
476CONFIG_IP_NF_MATCH_RECENT=m
477CONFIG_IP_NF_MATCH_ECN=m
478CONFIG_IP_NF_MATCH_AH=m
479CONFIG_IP_NF_MATCH_TTL=m
480CONFIG_IP_NF_MATCH_ADDRTYPE=m
481CONFIG_IP_NF_FILTER=m
482CONFIG_IP_NF_TARGET_REJECT=m
483CONFIG_IP_NF_TARGET_LOG=m
484CONFIG_IP_NF_TARGET_ULOG=m
485CONFIG_NF_NAT=m
486CONFIG_NF_NAT_NEEDED=y
487CONFIG_IP_NF_TARGET_MASQUERADE=m
488CONFIG_IP_NF_TARGET_REDIRECT=m
489CONFIG_IP_NF_TARGET_NETMAP=m
490CONFIG_NF_NAT_SNMP_BASIC=m
491CONFIG_NF_NAT_PROTO_GRE=m
492CONFIG_NF_NAT_FTP=m
493CONFIG_NF_NAT_IRC=m
494CONFIG_NF_NAT_TFTP=m
495CONFIG_NF_NAT_AMANDA=m
496CONFIG_NF_NAT_PPTP=m
497CONFIG_NF_NAT_H323=m
498CONFIG_NF_NAT_SIP=m
499CONFIG_IP_NF_MANGLE=m
500CONFIG_IP_NF_TARGET_ECN=m
501CONFIG_IP_NF_TARGET_TTL=m
502CONFIG_IP_NF_TARGET_CLUSTERIP=m
503CONFIG_IP_NF_RAW=m
504CONFIG_IP_NF_ARPTABLES=m
505CONFIG_IP_NF_ARPFILTER=m
506CONFIG_IP_NF_ARP_MANGLE=m
507
508#
509# IPv6: Netfilter Configuration
510#
511CONFIG_NF_CONNTRACK_IPV6=m
512CONFIG_IP6_NF_QUEUE=m
513CONFIG_IP6_NF_IPTABLES=m
514CONFIG_IP6_NF_MATCH_RT=m
515CONFIG_IP6_NF_MATCH_OPTS=m
516CONFIG_IP6_NF_MATCH_FRAG=m
517CONFIG_IP6_NF_MATCH_HL=m
518CONFIG_IP6_NF_MATCH_IPV6HEADER=m
519CONFIG_IP6_NF_MATCH_AH=m
520CONFIG_IP6_NF_MATCH_MH=m
521CONFIG_IP6_NF_MATCH_EUI64=m
522CONFIG_IP6_NF_FILTER=m
523CONFIG_IP6_NF_TARGET_LOG=m
524CONFIG_IP6_NF_TARGET_REJECT=m
525CONFIG_IP6_NF_MANGLE=m
526CONFIG_IP6_NF_TARGET_HL=m
527CONFIG_IP6_NF_RAW=m
528
529#
530# Bridge: Netfilter Configuration
531#
532CONFIG_BRIDGE_NF_EBTABLES=m
533CONFIG_BRIDGE_EBT_BROUTE=m
534CONFIG_BRIDGE_EBT_T_FILTER=m
535CONFIG_BRIDGE_EBT_T_NAT=m
536CONFIG_BRIDGE_EBT_802_3=m
537CONFIG_BRIDGE_EBT_AMONG=m
538CONFIG_BRIDGE_EBT_ARP=m
539CONFIG_BRIDGE_EBT_IP=m
540CONFIG_BRIDGE_EBT_LIMIT=m
541CONFIG_BRIDGE_EBT_MARK=m
542CONFIG_BRIDGE_EBT_PKTTYPE=m
543CONFIG_BRIDGE_EBT_STP=m
544CONFIG_BRIDGE_EBT_VLAN=m
545CONFIG_BRIDGE_EBT_ARPREPLY=m
546CONFIG_BRIDGE_EBT_DNAT=m
547CONFIG_BRIDGE_EBT_MARK_T=m
548CONFIG_BRIDGE_EBT_REDIRECT=m
549CONFIG_BRIDGE_EBT_SNAT=m
550CONFIG_BRIDGE_EBT_LOG=m
551CONFIG_BRIDGE_EBT_ULOG=m
552CONFIG_IP_DCCP=m
553CONFIG_INET_DCCP_DIAG=m
554CONFIG_IP_DCCP_ACKVEC=y
555
556#
557# DCCP CCIDs Configuration (EXPERIMENTAL)
558#
559CONFIG_IP_DCCP_CCID2=m
560# CONFIG_IP_DCCP_CCID2_DEBUG is not set
561CONFIG_IP_DCCP_CCID3=m
562# CONFIG_IP_DCCP_CCID3_DEBUG is not set
563CONFIG_IP_DCCP_CCID3_RTO=100
564CONFIG_IP_DCCP_TFRC_LIB=m
565CONFIG_IP_SCTP=m
566# CONFIG_SCTP_DBG_MSG is not set
567# CONFIG_SCTP_DBG_OBJCNT is not set
568# CONFIG_SCTP_HMAC_NONE is not set
569# CONFIG_SCTP_HMAC_SHA1 is not set
570CONFIG_SCTP_HMAC_MD5=y
571CONFIG_TIPC=m
572CONFIG_TIPC_ADVANCED=y
573CONFIG_TIPC_ZONES=3
574CONFIG_TIPC_CLUSTERS=1
575CONFIG_TIPC_NODES=255
576CONFIG_TIPC_SLAVE_NODES=0
577CONFIG_TIPC_PORTS=8191
578CONFIG_TIPC_LOG=0
579# CONFIG_TIPC_DEBUG is not set
580CONFIG_ATM=m
581CONFIG_ATM_CLIP=m
582# CONFIG_ATM_CLIP_NO_ICMP is not set
583CONFIG_ATM_LANE=m
584CONFIG_ATM_MPOA=m
585CONFIG_ATM_BR2684=m
586# CONFIG_ATM_BR2684_IPFILTER is not set
587CONFIG_BRIDGE=m
588CONFIG_VLAN_8021Q=m
589# CONFIG_DECNET is not set
590CONFIG_LLC=m
591# CONFIG_LLC2 is not set
592# CONFIG_IPX is not set
593# CONFIG_ATALK is not set
594# CONFIG_X25 is not set
595# CONFIG_LAPB is not set
596# CONFIG_ECONET is not set
597# CONFIG_WAN_ROUTER is not set
598CONFIG_NET_SCHED=y
599
600#
601# Queueing/Scheduling
602#
603CONFIG_NET_SCH_CBQ=m
604CONFIG_NET_SCH_HTB=m
605CONFIG_NET_SCH_HFSC=m
606CONFIG_NET_SCH_ATM=m
607CONFIG_NET_SCH_PRIO=m
608CONFIG_NET_SCH_RR=m
609CONFIG_NET_SCH_RED=m
610CONFIG_NET_SCH_SFQ=m
611CONFIG_NET_SCH_TEQL=m
612CONFIG_NET_SCH_TBF=m
613CONFIG_NET_SCH_GRED=m
614CONFIG_NET_SCH_DSMARK=m
615CONFIG_NET_SCH_NETEM=m
616CONFIG_NET_SCH_INGRESS=m
617
618#
619# Classification
620#
621CONFIG_NET_CLS=y
622CONFIG_NET_CLS_BASIC=m
623CONFIG_NET_CLS_TCINDEX=m
624CONFIG_NET_CLS_ROUTE4=m
625CONFIG_NET_CLS_ROUTE=y
626CONFIG_NET_CLS_FW=m
627CONFIG_NET_CLS_U32=m
628CONFIG_CLS_U32_PERF=y
629CONFIG_CLS_U32_MARK=y
630CONFIG_NET_CLS_RSVP=m
631CONFIG_NET_CLS_RSVP6=m
632# CONFIG_NET_CLS_FLOW is not set
633CONFIG_NET_EMATCH=y
634CONFIG_NET_EMATCH_STACK=32
635CONFIG_NET_EMATCH_CMP=m
636CONFIG_NET_EMATCH_NBYTE=m
637CONFIG_NET_EMATCH_U32=m
638CONFIG_NET_EMATCH_META=m
639CONFIG_NET_EMATCH_TEXT=m
640CONFIG_NET_CLS_ACT=y
641CONFIG_NET_ACT_POLICE=m
642CONFIG_NET_ACT_GACT=m
643CONFIG_GACT_PROB=y
644CONFIG_NET_ACT_MIRRED=m
645CONFIG_NET_ACT_IPT=m
646CONFIG_NET_ACT_NAT=m
647CONFIG_NET_ACT_PEDIT=m
648CONFIG_NET_ACT_SIMP=m
649CONFIG_NET_CLS_IND=y
650CONFIG_NET_SCH_FIFO=y
651
652#
653# Network testing
654#
655CONFIG_NET_PKTGEN=m
656# CONFIG_HAMRADIO is not set
657# CONFIG_CAN is not set
658CONFIG_IRDA=m
659
660#
661# IrDA protocols
662#
663CONFIG_IRLAN=m
664CONFIG_IRNET=m
665CONFIG_IRCOMM=m
666# CONFIG_IRDA_ULTRA is not set
667
668#
669# IrDA options
670#
671CONFIG_IRDA_CACHE_LAST_LSAP=y
672CONFIG_IRDA_FAST_RR=y
673# CONFIG_IRDA_DEBUG is not set
674
675#
676# Infrared-port device drivers
677#
678
679#
680# SIR device drivers
681#
682CONFIG_IRTTY_SIR=m
683
684#
685# Dongle support
686#
687CONFIG_DONGLE=y
688CONFIG_ESI_DONGLE=m
689CONFIG_ACTISYS_DONGLE=m
690CONFIG_TEKRAM_DONGLE=m
691CONFIG_TOIM3232_DONGLE=m
692CONFIG_LITELINK_DONGLE=m
693CONFIG_MA600_DONGLE=m
694CONFIG_GIRBIL_DONGLE=m
695CONFIG_MCP2120_DONGLE=m
696CONFIG_OLD_BELKIN_DONGLE=m
697CONFIG_ACT200L_DONGLE=m
698CONFIG_KINGSUN_DONGLE=m
699CONFIG_KSDAZZLE_DONGLE=m
700CONFIG_KS959_DONGLE=m
701
702#
703# FIR device drivers
704#
705CONFIG_USB_IRDA=m
706CONFIG_SIGMATEL_FIR=m
707CONFIG_TOSHIBA_FIR=m
708CONFIG_VLSI_FIR=m
709CONFIG_MCS_FIR=m
710CONFIG_BT=m
711# CONFIG_BT_L2CAP is not set
712# CONFIG_BT_SCO is not set
713
714#
715# Bluetooth device drivers
716#
717CONFIG_BT_HCIUSB=m
718CONFIG_BT_HCIUSB_SCO=y
719CONFIG_BT_HCIUART=m
720CONFIG_BT_HCIUART_H4=y
721CONFIG_BT_HCIUART_BCSP=y
722CONFIG_BT_HCIUART_LL=y
723CONFIG_BT_HCIBCM203X=m
724CONFIG_BT_HCIBPA10X=m
725CONFIG_BT_HCIBFUSB=m
726CONFIG_BT_HCIVHCI=m
727# CONFIG_AF_RXRPC is not set
728CONFIG_FIB_RULES=y
729
730#
731# Wireless
732#
733CONFIG_CFG80211=m
734CONFIG_NL80211=y
735CONFIG_WIRELESS_EXT=y
736CONFIG_MAC80211=m
737
738#
739# Rate control algorithm selection
740#
741CONFIG_MAC80211_RC_DEFAULT_PID=y
742# CONFIG_MAC80211_RC_DEFAULT_SIMPLE is not set
743# CONFIG_MAC80211_RC_DEFAULT_NONE is not set
744
745#
746# Selecting 'y' for an algorithm will
747#
748
749#
750# build the algorithm into mac80211.
751#
752CONFIG_MAC80211_RC_DEFAULT="pid"
753CONFIG_MAC80211_RC_PID=y
754# CONFIG_MAC80211_RC_SIMPLE is not set
755CONFIG_MAC80211_LEDS=y
756# CONFIG_MAC80211_DEBUGFS is not set
757# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
758# CONFIG_MAC80211_DEBUG is not set
759CONFIG_IEEE80211=m
760# CONFIG_IEEE80211_DEBUG is not set
761CONFIG_IEEE80211_CRYPT_WEP=m
762CONFIG_IEEE80211_CRYPT_CCMP=m
763CONFIG_IEEE80211_CRYPT_TKIP=m
764CONFIG_IEEE80211_SOFTMAC=m
765# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
766CONFIG_RFKILL=m
767CONFIG_RFKILL_INPUT=m
768CONFIG_RFKILL_LEDS=y
769CONFIG_NET_9P=m
770CONFIG_NET_9P_FD=m
771# CONFIG_NET_9P_DEBUG is not set
772
773#
774# Device Drivers
775#
776
777#
778# Generic Driver Options
779#
780CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
781CONFIG_STANDALONE=y
782CONFIG_PREVENT_FIRMWARE_BUILD=y
783CONFIG_FW_LOADER=m
784# CONFIG_SYS_HYPERVISOR is not set
785CONFIG_CONNECTOR=m
786CONFIG_MTD=y
787# CONFIG_MTD_DEBUG is not set
788CONFIG_MTD_CONCAT=y
789CONFIG_MTD_PARTITIONS=y
790# CONFIG_MTD_REDBOOT_PARTS is not set
791# CONFIG_MTD_CMDLINE_PARTS is not set
792
793#
794# User Modules And Translation Layers
795#
796CONFIG_MTD_CHAR=y
797CONFIG_MTD_BLKDEVS=y
798CONFIG_MTD_BLOCK=y
799# CONFIG_FTL is not set
800# CONFIG_NFTL is not set
801# CONFIG_INFTL is not set
802# CONFIG_RFD_FTL is not set
803# CONFIG_SSFDC is not set
804# CONFIG_MTD_OOPS is not set
805
806#
807# RAM/ROM/Flash chip drivers
808#
809CONFIG_MTD_CFI=y
810# CONFIG_MTD_JEDECPROBE is not set
811CONFIG_MTD_GEN_PROBE=y
812# CONFIG_MTD_CFI_ADV_OPTIONS is not set
813CONFIG_MTD_MAP_BANK_WIDTH_1=y
814CONFIG_MTD_MAP_BANK_WIDTH_2=y
815CONFIG_MTD_MAP_BANK_WIDTH_4=y
816# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
817# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
818# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
819CONFIG_MTD_CFI_I1=y
820CONFIG_MTD_CFI_I2=y
821# CONFIG_MTD_CFI_I4 is not set
822# CONFIG_MTD_CFI_I8 is not set
823CONFIG_MTD_CFI_INTELEXT=y
824CONFIG_MTD_CFI_AMDSTD=y
825CONFIG_MTD_CFI_STAA=y
826CONFIG_MTD_CFI_UTIL=y
827CONFIG_MTD_RAM=y
828CONFIG_MTD_ROM=y
829CONFIG_MTD_ABSENT=y
830
831#
832# Mapping drivers for chip access
833#
834# CONFIG_MTD_COMPLEX_MAPPINGS is not set
835CONFIG_MTD_PHYSMAP=y
836CONFIG_MTD_PHYSMAP_START=0x8000000
837CONFIG_MTD_PHYSMAP_LEN=0x0
838CONFIG_MTD_PHYSMAP_BANKWIDTH=2
839# CONFIG_MTD_INTEL_VR_NOR is not set
840# CONFIG_MTD_PLATRAM is not set
841
842#
843# Self-contained MTD device drivers
844#
845# CONFIG_MTD_PMC551 is not set
846# CONFIG_MTD_SLRAM is not set
847# CONFIG_MTD_PHRAM is not set
848# CONFIG_MTD_MTDRAM is not set
849# CONFIG_MTD_BLOCK2MTD is not set
850
851#
852# Disk-On-Chip Device Drivers
853#
854# CONFIG_MTD_DOC2000 is not set
855# CONFIG_MTD_DOC2001 is not set
856# CONFIG_MTD_DOC2001PLUS is not set
857# CONFIG_MTD_NAND is not set
858# CONFIG_MTD_ONENAND is not set
859
860#
861# UBI - Unsorted block images
862#
863# CONFIG_MTD_UBI is not set
864# CONFIG_PARPORT is not set
865CONFIG_BLK_DEV=y
866# CONFIG_BLK_CPQ_DA is not set
867# CONFIG_BLK_CPQ_CISS_DA is not set
868# CONFIG_BLK_DEV_DAC960 is not set
869# CONFIG_BLK_DEV_UMEM is not set
870# CONFIG_BLK_DEV_COW_COMMON is not set
871CONFIG_BLK_DEV_LOOP=m
872CONFIG_BLK_DEV_CRYPTOLOOP=m
873CONFIG_BLK_DEV_NBD=m
874# CONFIG_BLK_DEV_SX8 is not set
875# CONFIG_BLK_DEV_UB is not set
876CONFIG_BLK_DEV_RAM=y
877CONFIG_BLK_DEV_RAM_COUNT=16
878CONFIG_BLK_DEV_RAM_SIZE=16384
879# CONFIG_BLK_DEV_XIP is not set
880# CONFIG_CDROM_PKTCDVD is not set
881CONFIG_ATA_OVER_ETH=m
882CONFIG_MISC_DEVICES=y
883# CONFIG_PHANTOM is not set
884# CONFIG_EEPROM_93CX6 is not set
885# CONFIG_SGI_IOC4 is not set
886# CONFIG_TIFM_CORE is not set
887# CONFIG_ENCLOSURE_SERVICES is not set
888CONFIG_HAVE_IDE=y
889# CONFIG_IDE is not set
890
891#
892# SCSI device support
893#
894CONFIG_RAID_ATTRS=m
895CONFIG_SCSI=y
896CONFIG_SCSI_DMA=y
897CONFIG_SCSI_TGT=m
898# CONFIG_SCSI_NETLINK is not set
899CONFIG_SCSI_PROC_FS=y
900
901#
902# SCSI support type (disk, tape, CD-ROM)
903#
904CONFIG_BLK_DEV_SD=y
905CONFIG_CHR_DEV_ST=m
906CONFIG_CHR_DEV_OSST=m
907CONFIG_BLK_DEV_SR=m
908CONFIG_BLK_DEV_SR_VENDOR=y
909CONFIG_CHR_DEV_SG=m
910CONFIG_CHR_DEV_SCH=m
911
912#
913# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
914#
915CONFIG_SCSI_MULTI_LUN=y
916CONFIG_SCSI_CONSTANTS=y
917CONFIG_SCSI_LOGGING=y
918CONFIG_SCSI_SCAN_ASYNC=y
919CONFIG_SCSI_WAIT_SCAN=m
920
921#
922# SCSI Transports
923#
924# CONFIG_SCSI_SPI_ATTRS is not set
925# CONFIG_SCSI_FC_ATTRS is not set
926CONFIG_SCSI_ISCSI_ATTRS=m
927# CONFIG_SCSI_SAS_LIBSAS is not set
928# CONFIG_SCSI_SRP_ATTRS is not set
929CONFIG_SCSI_LOWLEVEL=y
930CONFIG_ISCSI_TCP=m
931# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
932# CONFIG_SCSI_3W_9XXX is not set
933# CONFIG_SCSI_ACARD is not set
934# CONFIG_SCSI_AACRAID is not set
935# CONFIG_SCSI_AIC7XXX is not set
936# CONFIG_SCSI_AIC7XXX_OLD is not set
937# CONFIG_SCSI_AIC79XX is not set
938# CONFIG_SCSI_AIC94XX is not set
939# CONFIG_SCSI_DPT_I2O is not set
940# CONFIG_SCSI_ADVANSYS is not set
941# CONFIG_SCSI_ARCMSR is not set
942# CONFIG_MEGARAID_NEWGEN is not set
943# CONFIG_MEGARAID_LEGACY is not set
944# CONFIG_MEGARAID_SAS is not set
945# CONFIG_SCSI_HPTIOP is not set
946# CONFIG_SCSI_DMX3191D is not set
947# CONFIG_SCSI_FUTURE_DOMAIN is not set
948# CONFIG_SCSI_IPS is not set
949# CONFIG_SCSI_INITIO is not set
950# CONFIG_SCSI_INIA100 is not set
951# CONFIG_SCSI_STEX is not set
952# CONFIG_SCSI_SYM53C8XX_2 is not set
953# CONFIG_SCSI_QLOGIC_1280 is not set
954# CONFIG_SCSI_QLA_FC is not set
955# CONFIG_SCSI_QLA_ISCSI is not set
956# CONFIG_SCSI_LPFC is not set
957# CONFIG_SCSI_DC395x is not set
958# CONFIG_SCSI_DC390T is not set
959# CONFIG_SCSI_NSP32 is not set
960# CONFIG_SCSI_DEBUG is not set
961# CONFIG_SCSI_SRP is not set
962# CONFIG_ATA is not set
963# CONFIG_MD is not set
964# CONFIG_FUSION is not set
965
966#
967# IEEE 1394 (FireWire) support
968#
969# CONFIG_FIREWIRE is not set
970# CONFIG_IEEE1394 is not set
971# CONFIG_I2O is not set
972CONFIG_NETDEVICES=y
973# CONFIG_NETDEVICES_MULTIQUEUE is not set
974# CONFIG_IFB is not set
975CONFIG_DUMMY=m
976# CONFIG_BONDING is not set
977# CONFIG_MACVLAN is not set
978CONFIG_EQUALIZER=m
979CONFIG_TUN=m
980CONFIG_VETH=m
981# CONFIG_ARCNET is not set
982CONFIG_PHYLIB=m
983
984#
985# MII PHY device drivers
986#
987CONFIG_MARVELL_PHY=m
988CONFIG_DAVICOM_PHY=m
989CONFIG_QSEMI_PHY=m
990CONFIG_LXT_PHY=m
991CONFIG_CICADA_PHY=m
992CONFIG_VITESSE_PHY=m
993CONFIG_SMSC_PHY=m
994CONFIG_BROADCOM_PHY=m
995CONFIG_ICPLUS_PHY=m
996# CONFIG_REALTEK_PHY is not set
997# CONFIG_FIXED_PHY is not set
998CONFIG_MDIO_BITBANG=m
999CONFIG_NET_ETHERNET=y
1000CONFIG_MII=y
1001# CONFIG_AX88796 is not set
1002# CONFIG_HAPPYMEAL is not set
1003# CONFIG_SUNGEM is not set
1004# CONFIG_CASSINI is not set
1005# CONFIG_NET_VENDOR_3COM is not set
1006# CONFIG_DM9000 is not set
1007# CONFIG_NET_TULIP is not set
1008# CONFIG_HP100 is not set
1009# CONFIG_IBM_NEW_EMAC_ZMII is not set
1010# CONFIG_IBM_NEW_EMAC_RGMII is not set
1011# CONFIG_IBM_NEW_EMAC_TAH is not set
1012# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
1013CONFIG_NET_PCI=y
1014# CONFIG_PCNET32 is not set
1015# CONFIG_AMD8111_ETH is not set
1016# CONFIG_ADAPTEC_STARFIRE is not set
1017CONFIG_B44=y
1018CONFIG_B44_PCI_AUTOSELECT=y
1019CONFIG_B44_PCICORE_AUTOSELECT=y
1020CONFIG_B44_PCI=y
1021# CONFIG_FORCEDETH is not set
1022# CONFIG_TC35815 is not set
1023# CONFIG_EEPRO100 is not set
1024# CONFIG_E100 is not set
1025# CONFIG_FEALNX is not set
1026# CONFIG_NATSEMI is not set
1027# CONFIG_NE2K_PCI is not set
1028# CONFIG_8139CP is not set
1029# CONFIG_8139TOO is not set
1030# CONFIG_R6040 is not set
1031# CONFIG_SIS900 is not set
1032# CONFIG_EPIC100 is not set
1033# CONFIG_SUNDANCE is not set
1034# CONFIG_TLAN is not set
1035# CONFIG_VIA_RHINE is not set
1036# CONFIG_SC92031 is not set
1037# CONFIG_NETDEV_1000 is not set
1038# CONFIG_NETDEV_10000 is not set
1039# CONFIG_TR is not set
1040
1041#
1042# Wireless LAN
1043#
1044# CONFIG_WLAN_PRE80211 is not set
1045CONFIG_WLAN_80211=y
1046# CONFIG_IPW2100 is not set
1047# CONFIG_IPW2200 is not set
1048# CONFIG_LIBERTAS is not set
1049# CONFIG_HERMES is not set
1050# CONFIG_ATMEL is not set
1051# CONFIG_PRISM54 is not set
1052# CONFIG_USB_ZD1201 is not set
1053# CONFIG_USB_NET_RNDIS_WLAN is not set
1054# CONFIG_RTL8180 is not set
1055# CONFIG_RTL8187 is not set
1056# CONFIG_ADM8211 is not set
1057# CONFIG_P54_COMMON is not set
1058CONFIG_ATH5K=m
1059# CONFIG_IWL4965 is not set
1060# CONFIG_IWL3945 is not set
1061# CONFIG_HOSTAP is not set
1062# CONFIG_BCM43XX is not set
1063# CONFIG_B43 is not set
1064# CONFIG_B43LEGACY is not set
1065CONFIG_ZD1211RW=m
1066# CONFIG_ZD1211RW_DEBUG is not set
1067# CONFIG_RT2X00 is not set
1068
1069#
1070# USB Network Adapters
1071#
1072CONFIG_USB_CATC=m
1073CONFIG_USB_KAWETH=m
1074CONFIG_USB_PEGASUS=m
1075CONFIG_USB_RTL8150=m
1076CONFIG_USB_USBNET=m
1077CONFIG_USB_NET_AX8817X=m
1078CONFIG_USB_NET_CDCETHER=m
1079CONFIG_USB_NET_DM9601=m
1080CONFIG_USB_NET_GL620A=m
1081CONFIG_USB_NET_NET1080=m
1082CONFIG_USB_NET_PLUSB=m
1083CONFIG_USB_NET_MCS7830=m
1084CONFIG_USB_NET_RNDIS_HOST=m
1085CONFIG_USB_NET_CDC_SUBSET=m
1086CONFIG_USB_ALI_M5632=y
1087CONFIG_USB_AN2720=y
1088CONFIG_USB_BELKIN=y
1089CONFIG_USB_ARMLINUX=y
1090CONFIG_USB_EPSON2888=y
1091CONFIG_USB_KC2190=y
1092CONFIG_USB_NET_ZAURUS=m
1093# CONFIG_WAN is not set
1094CONFIG_ATM_DRIVERS=y
1095CONFIG_ATM_DUMMY=m
1096CONFIG_ATM_TCP=m
1097# CONFIG_ATM_LANAI is not set
1098# CONFIG_ATM_ENI is not set
1099# CONFIG_ATM_FIRESTREAM is not set
1100# CONFIG_ATM_ZATM is not set
1101# CONFIG_ATM_NICSTAR is not set
1102# CONFIG_ATM_IDT77252 is not set
1103# CONFIG_ATM_AMBASSADOR is not set
1104# CONFIG_ATM_HORIZON is not set
1105# CONFIG_ATM_IA is not set
1106# CONFIG_ATM_FORE200E_MAYBE is not set
1107# CONFIG_ATM_HE is not set
1108# CONFIG_FDDI is not set
1109# CONFIG_HIPPI is not set
1110CONFIG_PPP=m
1111# CONFIG_PPP_MULTILINK is not set
1112# CONFIG_PPP_FILTER is not set
1113CONFIG_PPP_ASYNC=m
1114# CONFIG_PPP_SYNC_TTY is not set
1115CONFIG_PPP_DEFLATE=m
1116CONFIG_PPP_BSDCOMP=m
1117CONFIG_PPP_MPPE=m
1118CONFIG_PPPOE=m
1119CONFIG_PPPOATM=m
1120# CONFIG_PPPOL2TP is not set
1121CONFIG_SLIP=m
1122# CONFIG_SLIP_COMPRESSED is not set
1123CONFIG_SLHC=m
1124# CONFIG_SLIP_SMART is not set
1125# CONFIG_SLIP_MODE_SLIP6 is not set
1126# CONFIG_NET_FC is not set
1127CONFIG_NETCONSOLE=y
1128# CONFIG_NETCONSOLE_DYNAMIC is not set
1129CONFIG_NETPOLL=y
1130# CONFIG_NETPOLL_TRAP is not set
1131CONFIG_NET_POLL_CONTROLLER=y
1132# CONFIG_ISDN is not set
1133# CONFIG_PHONE is not set
1134
1135#
1136# Input device support
1137#
1138CONFIG_INPUT=y
1139# CONFIG_INPUT_FF_MEMLESS is not set
1140# CONFIG_INPUT_POLLDEV is not set
1141
1142#
1143# Userland interfaces
1144#
1145CONFIG_INPUT_MOUSEDEV=y
1146CONFIG_INPUT_MOUSEDEV_PSAUX=y
1147CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
1148CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
1149# CONFIG_INPUT_JOYDEV is not set
1150CONFIG_INPUT_EVDEV=m
1151# CONFIG_INPUT_EVBUG is not set
1152
1153#
1154# Input Device Drivers
1155#
1156# CONFIG_INPUT_KEYBOARD is not set
1157# CONFIG_INPUT_MOUSE is not set
1158# CONFIG_INPUT_JOYSTICK is not set
1159# CONFIG_INPUT_TABLET is not set
1160# CONFIG_INPUT_TOUCHSCREEN is not set
1161# CONFIG_INPUT_MISC is not set
1162
1163#
1164# Hardware I/O ports
1165#
1166# CONFIG_SERIO is not set
1167# CONFIG_GAMEPORT is not set
1168
1169#
1170# Character devices
1171#
1172# CONFIG_VT is not set
1173# CONFIG_SERIAL_NONSTANDARD is not set
1174# CONFIG_NOZOMI is not set
1175
1176#
1177# Serial drivers
1178#
1179CONFIG_SERIAL_8250=y
1180CONFIG_SERIAL_8250_CONSOLE=y
1181# CONFIG_SERIAL_8250_PCI is not set
1182CONFIG_SERIAL_8250_NR_UARTS=2
1183CONFIG_SERIAL_8250_RUNTIME_UARTS=2
1184# CONFIG_SERIAL_8250_EXTENDED is not set
1185
1186#
1187# Non-8250 serial port support
1188#
1189CONFIG_SERIAL_CORE=y
1190CONFIG_SERIAL_CORE_CONSOLE=y
1191# CONFIG_SERIAL_JSM is not set
1192CONFIG_UNIX98_PTYS=y
1193# CONFIG_LEGACY_PTYS is not set
1194# CONFIG_IPMI_HANDLER is not set
1195# CONFIG_HW_RANDOM is not set
1196# CONFIG_RTC is not set
1197# CONFIG_R3964 is not set
1198# CONFIG_APPLICOM is not set
1199# CONFIG_RAW_DRIVER is not set
1200# CONFIG_TCG_TPM is not set
1201CONFIG_DEVPORT=y
1202# CONFIG_I2C is not set
1203
1204#
1205# SPI support
1206#
1207# CONFIG_SPI is not set
1208# CONFIG_SPI_MASTER is not set
1209CONFIG_W1=m
1210CONFIG_W1_CON=y
1211
1212#
1213# 1-wire Bus Masters
1214#
1215CONFIG_W1_MASTER_MATROX=m
1216CONFIG_W1_MASTER_DS2490=m
1217# CONFIG_W1_MASTER_GPIO is not set
1218
1219#
1220# 1-wire Slaves
1221#
1222CONFIG_W1_SLAVE_THERM=m
1223CONFIG_W1_SLAVE_SMEM=m
1224CONFIG_W1_SLAVE_DS2433=m
1225# CONFIG_W1_SLAVE_DS2433_CRC is not set
1226CONFIG_W1_SLAVE_DS2760=m
1227# CONFIG_POWER_SUPPLY is not set
1228# CONFIG_HWMON is not set
1229CONFIG_THERMAL=y
1230# CONFIG_WATCHDOG is not set
1231
1232#
1233# Sonics Silicon Backplane
1234#
1235CONFIG_SSB_POSSIBLE=y
1236CONFIG_SSB=y
1237CONFIG_SSB_PCIHOST_POSSIBLE=y
1238CONFIG_SSB_PCIHOST=y
1239# CONFIG_SSB_SILENT is not set
1240# CONFIG_SSB_DEBUG is not set
1241CONFIG_SSB_SERIAL=y
1242CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
1243CONFIG_SSB_DRIVER_PCICORE=y
1244CONFIG_SSB_PCICORE_HOSTMODE=y
1245CONFIG_SSB_DRIVER_MIPS=y
1246CONFIG_SSB_DRIVER_EXTIF=y
1247
1248#
1249# Multifunction device drivers
1250#
1251# CONFIG_MFD_SM501 is not set
1252
1253#
1254# Multimedia devices
1255#
1256# CONFIG_VIDEO_DEV is not set
1257# CONFIG_DVB_CORE is not set
1258CONFIG_DAB=y
1259CONFIG_USB_DABUSB=m
1260
1261#
1262# Graphics support
1263#
1264# CONFIG_DRM is not set
1265# CONFIG_VGASTATE is not set
1266# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1267# CONFIG_FB is not set
1268# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1269
1270#
1271# Display device support
1272#
1273CONFIG_DISPLAY_SUPPORT=m
1274
1275#
1276# Display hardware drivers
1277#
1278
1279#
1280# Sound
1281#
1282CONFIG_SOUND=m
1283
1284#
1285# Advanced Linux Sound Architecture
1286#
1287CONFIG_SND=m
1288CONFIG_SND_TIMER=m
1289CONFIG_SND_PCM=m
1290CONFIG_SND_HWDEP=m
1291CONFIG_SND_RAWMIDI=m
1292CONFIG_SND_SEQUENCER=m
1293CONFIG_SND_SEQ_DUMMY=m
1294CONFIG_SND_OSSEMUL=y
1295CONFIG_SND_MIXER_OSS=m
1296CONFIG_SND_PCM_OSS=m
1297CONFIG_SND_PCM_OSS_PLUGINS=y
1298CONFIG_SND_SEQUENCER_OSS=y
1299# CONFIG_SND_DYNAMIC_MINORS is not set
1300CONFIG_SND_SUPPORT_OLD_API=y
1301CONFIG_SND_VERBOSE_PROCFS=y
1302# CONFIG_SND_VERBOSE_PRINTK is not set
1303# CONFIG_SND_DEBUG is not set
1304
1305#
1306# Generic devices
1307#
1308CONFIG_SND_DUMMY=m
1309CONFIG_SND_VIRMIDI=m
1310# CONFIG_SND_MTPAV is not set
1311# CONFIG_SND_SERIAL_U16550 is not set
1312# CONFIG_SND_MPU401 is not set
1313
1314#
1315# PCI devices
1316#
1317# CONFIG_SND_AD1889 is not set
1318# CONFIG_SND_ALS300 is not set
1319# CONFIG_SND_ALI5451 is not set
1320# CONFIG_SND_ATIIXP is not set
1321# CONFIG_SND_ATIIXP_MODEM is not set
1322# CONFIG_SND_AU8810 is not set
1323# CONFIG_SND_AU8820 is not set
1324# CONFIG_SND_AU8830 is not set
1325# CONFIG_SND_AZT3328 is not set
1326# CONFIG_SND_BT87X is not set
1327# CONFIG_SND_CA0106 is not set
1328# CONFIG_SND_CMIPCI is not set
1329# CONFIG_SND_OXYGEN is not set
1330# CONFIG_SND_CS4281 is not set
1331# CONFIG_SND_CS46XX is not set
1332# CONFIG_SND_DARLA20 is not set
1333# CONFIG_SND_GINA20 is not set
1334# CONFIG_SND_LAYLA20 is not set
1335# CONFIG_SND_DARLA24 is not set
1336# CONFIG_SND_GINA24 is not set
1337# CONFIG_SND_LAYLA24 is not set
1338# CONFIG_SND_MONA is not set
1339# CONFIG_SND_MIA is not set
1340# CONFIG_SND_ECHO3G is not set
1341# CONFIG_SND_INDIGO is not set
1342# CONFIG_SND_INDIGOIO is not set
1343# CONFIG_SND_INDIGODJ is not set
1344# CONFIG_SND_EMU10K1 is not set
1345# CONFIG_SND_EMU10K1X is not set
1346# CONFIG_SND_ENS1370 is not set
1347# CONFIG_SND_ENS1371 is not set
1348# CONFIG_SND_ES1938 is not set
1349# CONFIG_SND_ES1968 is not set
1350# CONFIG_SND_FM801 is not set
1351# CONFIG_SND_HDA_INTEL is not set
1352# CONFIG_SND_HDSP is not set
1353# CONFIG_SND_HDSPM is not set
1354# CONFIG_SND_HIFIER is not set
1355# CONFIG_SND_ICE1712 is not set
1356# CONFIG_SND_ICE1724 is not set
1357# CONFIG_SND_INTEL8X0 is not set
1358# CONFIG_SND_INTEL8X0M is not set
1359# CONFIG_SND_KORG1212 is not set
1360# CONFIG_SND_MAESTRO3 is not set
1361# CONFIG_SND_MIXART is not set
1362# CONFIG_SND_NM256 is not set
1363# CONFIG_SND_PCXHR is not set
1364# CONFIG_SND_RIPTIDE is not set
1365# CONFIG_SND_RME32 is not set
1366# CONFIG_SND_RME96 is not set
1367# CONFIG_SND_RME9652 is not set
1368# CONFIG_SND_SONICVIBES is not set
1369# CONFIG_SND_TRIDENT is not set
1370# CONFIG_SND_VIA82XX is not set
1371# CONFIG_SND_VIA82XX_MODEM is not set
1372# CONFIG_SND_VIRTUOSO is not set
1373# CONFIG_SND_VX222 is not set
1374# CONFIG_SND_YMFPCI is not set
1375
1376#
1377# ALSA MIPS devices
1378#
1379
1380#
1381# USB devices
1382#
1383CONFIG_SND_USB_AUDIO=m
1384# CONFIG_SND_USB_CAIAQ is not set
1385
1386#
1387# System on Chip audio support
1388#
1389# CONFIG_SND_SOC is not set
1390
1391#
1392# SoC Audio support for SuperH
1393#
1394
1395#
1396# ALSA SoC audio for Freescale SOCs
1397#
1398
1399#
1400# Open Sound System
1401#
1402# CONFIG_SOUND_PRIME is not set
1403CONFIG_HID_SUPPORT=y
1404CONFIG_HID=m
1405# CONFIG_HID_DEBUG is not set
1406# CONFIG_HIDRAW is not set
1407
1408#
1409# USB Input Devices
1410#
1411CONFIG_USB_HID=m
1412# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1413# CONFIG_HID_FF is not set
1414CONFIG_USB_HIDDEV=y
1415
1416#
1417# USB HID Boot Protocol drivers
1418#
1419# CONFIG_USB_KBD is not set
1420# CONFIG_USB_MOUSE is not set
1421CONFIG_USB_SUPPORT=y
1422CONFIG_USB_ARCH_HAS_HCD=y
1423CONFIG_USB_ARCH_HAS_OHCI=y
1424CONFIG_USB_ARCH_HAS_EHCI=y
1425CONFIG_USB=y
1426# CONFIG_USB_DEBUG is not set
1427# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1428
1429#
1430# Miscellaneous USB options
1431#
1432CONFIG_USB_DEVICEFS=y
1433# CONFIG_USB_DEVICE_CLASS is not set
1434# CONFIG_USB_DYNAMIC_MINORS is not set
1435# CONFIG_USB_OTG is not set
1436
1437#
1438# USB Host Controller Drivers
1439#
1440CONFIG_USB_EHCI_HCD=y
1441CONFIG_USB_EHCI_ROOT_HUB_TT=y
1442CONFIG_USB_EHCI_TT_NEWSCHED=y
1443# CONFIG_USB_ISP116X_HCD is not set
1444CONFIG_USB_OHCI_HCD=y
1445# CONFIG_USB_OHCI_HCD_SSB is not set
1446# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1447# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1448CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1449# CONFIG_USB_UHCI_HCD is not set
1450CONFIG_USB_U132_HCD=m
1451# CONFIG_USB_SL811_HCD is not set
1452CONFIG_USB_R8A66597_HCD=m
1453
1454#
1455# USB Device Class drivers
1456#
1457CONFIG_USB_ACM=m
1458CONFIG_USB_PRINTER=m
1459
1460#
1461# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1462#
1463
1464#
1465# may also be needed; see USB_STORAGE Help for more information
1466#
1467CONFIG_USB_STORAGE=y
1468# CONFIG_USB_STORAGE_DEBUG is not set
1469CONFIG_USB_STORAGE_DATAFAB=y
1470CONFIG_USB_STORAGE_FREECOM=y
1471# CONFIG_USB_STORAGE_ISD200 is not set
1472CONFIG_USB_STORAGE_DPCM=y
1473CONFIG_USB_STORAGE_USBAT=y
1474CONFIG_USB_STORAGE_SDDR09=y
1475CONFIG_USB_STORAGE_SDDR55=y
1476CONFIG_USB_STORAGE_JUMPSHOT=y
1477CONFIG_USB_STORAGE_ALAUDA=y
1478CONFIG_USB_STORAGE_ONETOUCH=y
1479CONFIG_USB_STORAGE_KARMA=y
1480# CONFIG_USB_LIBUSUAL is not set
1481
1482#
1483# USB Imaging devices
1484#
1485CONFIG_USB_MDC800=m
1486CONFIG_USB_MICROTEK=m
1487# CONFIG_USB_MON is not set
1488
1489#
1490# USB port drivers
1491#
1492CONFIG_USB_SERIAL=m
1493CONFIG_USB_EZUSB=y
1494CONFIG_USB_SERIAL_GENERIC=y
1495CONFIG_USB_SERIAL_AIRCABLE=m
1496CONFIG_USB_SERIAL_AIRPRIME=m
1497CONFIG_USB_SERIAL_ARK3116=m
1498CONFIG_USB_SERIAL_BELKIN=m
1499CONFIG_USB_SERIAL_CH341=m
1500# CONFIG_USB_SERIAL_WHITEHEAT is not set
1501CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1502CONFIG_USB_SERIAL_CP2101=m
1503CONFIG_USB_SERIAL_CYPRESS_M8=m
1504CONFIG_USB_SERIAL_EMPEG=m
1505CONFIG_USB_SERIAL_FTDI_SIO=m
1506CONFIG_USB_SERIAL_FUNSOFT=m
1507CONFIG_USB_SERIAL_VISOR=m
1508CONFIG_USB_SERIAL_IPAQ=m
1509CONFIG_USB_SERIAL_IR=m
1510# CONFIG_USB_SERIAL_EDGEPORT is not set
1511# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1512CONFIG_USB_SERIAL_GARMIN=m
1513CONFIG_USB_SERIAL_IPW=m
1514# CONFIG_USB_SERIAL_IUU is not set
1515CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1516# CONFIG_USB_SERIAL_KEYSPAN is not set
1517CONFIG_USB_SERIAL_KLSI=m
1518CONFIG_USB_SERIAL_KOBIL_SCT=m
1519CONFIG_USB_SERIAL_MCT_U232=m
1520CONFIG_USB_SERIAL_MOS7720=m
1521CONFIG_USB_SERIAL_MOS7840=m
1522CONFIG_USB_SERIAL_NAVMAN=m
1523CONFIG_USB_SERIAL_PL2303=m
1524CONFIG_USB_SERIAL_OTI6858=m
1525CONFIG_USB_SERIAL_HP4X=m
1526CONFIG_USB_SERIAL_SAFE=m
1527# CONFIG_USB_SERIAL_SAFE_PADDED is not set
1528CONFIG_USB_SERIAL_SIERRAWIRELESS=m
1529# CONFIG_USB_SERIAL_TI is not set
1530CONFIG_USB_SERIAL_CYBERJACK=m
1531CONFIG_USB_SERIAL_XIRCOM=m
1532CONFIG_USB_SERIAL_OPTION=m
1533CONFIG_USB_SERIAL_OMNINET=m
1534CONFIG_USB_SERIAL_DEBUG=m
1535
1536#
1537# USB Miscellaneous drivers
1538#
1539# CONFIG_USB_EMI62 is not set
1540# CONFIG_USB_EMI26 is not set
1541CONFIG_USB_ADUTUX=m
1542CONFIG_USB_AUERSWALD=m
1543CONFIG_USB_RIO500=m
1544CONFIG_USB_LEGOTOWER=m
1545CONFIG_USB_LCD=m
1546CONFIG_USB_BERRY_CHARGE=m
1547CONFIG_USB_LED=m
1548CONFIG_USB_CYPRESS_CY7C63=m
1549CONFIG_USB_CYTHERM=m
1550CONFIG_USB_PHIDGET=m
1551CONFIG_USB_PHIDGETKIT=m
1552CONFIG_USB_PHIDGETMOTORCONTROL=m
1553CONFIG_USB_PHIDGETSERVO=m
1554CONFIG_USB_IDMOUSE=m
1555CONFIG_USB_FTDI_ELAN=m
1556# CONFIG_USB_APPLEDISPLAY is not set
1557CONFIG_USB_SISUSBVGA=m
1558CONFIG_USB_LD=m
1559CONFIG_USB_TRANCEVIBRATOR=m
1560CONFIG_USB_IOWARRIOR=m
1561CONFIG_USB_TEST=m
1562CONFIG_USB_ATM=m
1563CONFIG_USB_SPEEDTOUCH=m
1564CONFIG_USB_CXACRU=m
1565CONFIG_USB_UEAGLEATM=m
1566CONFIG_USB_XUSBATM=m
1567CONFIG_USB_GADGET=m
1568# CONFIG_USB_GADGET_DEBUG_FILES is not set
1569# CONFIG_USB_GADGET_DEBUG_FS is not set
1570CONFIG_USB_GADGET_SELECTED=y
1571# CONFIG_USB_GADGET_AMD5536UDC is not set
1572# CONFIG_USB_GADGET_ATMEL_USBA is not set
1573# CONFIG_USB_GADGET_FSL_USB2 is not set
1574CONFIG_USB_GADGET_NET2280=y
1575CONFIG_USB_NET2280=m
1576# CONFIG_USB_GADGET_PXA2XX is not set
1577# CONFIG_USB_GADGET_M66592 is not set
1578# CONFIG_USB_GADGET_GOKU is not set
1579# CONFIG_USB_GADGET_LH7A40X is not set
1580# CONFIG_USB_GADGET_OMAP is not set
1581# CONFIG_USB_GADGET_S3C2410 is not set
1582# CONFIG_USB_GADGET_AT91 is not set
1583# CONFIG_USB_GADGET_DUMMY_HCD is not set
1584CONFIG_USB_GADGET_DUALSPEED=y
1585CONFIG_USB_ZERO=m
1586CONFIG_USB_ETH=m
1587CONFIG_USB_ETH_RNDIS=y
1588CONFIG_USB_GADGETFS=m
1589CONFIG_USB_FILE_STORAGE=m
1590# CONFIG_USB_FILE_STORAGE_TEST is not set
1591CONFIG_USB_G_SERIAL=m
1592CONFIG_USB_MIDI_GADGET=m
1593# CONFIG_USB_G_PRINTER is not set
1594# CONFIG_MMC is not set
1595# CONFIG_MEMSTICK is not set
1596CONFIG_NEW_LEDS=y
1597CONFIG_LEDS_CLASS=y
1598
1599#
1600# LED drivers
1601#
1602CONFIG_LEDS_GPIO=y
1603
1604#
1605# LED Triggers
1606#
1607CONFIG_LEDS_TRIGGERS=y
1608CONFIG_LEDS_TRIGGER_TIMER=y
1609CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1610# CONFIG_INFINIBAND is not set
1611CONFIG_RTC_LIB=y
1612# CONFIG_RTC_CLASS is not set
1613
1614#
1615# Userspace I/O
1616#
1617# CONFIG_UIO is not set
1618
1619#
1620# File systems
1621#
1622CONFIG_EXT2_FS=y
1623CONFIG_EXT2_FS_XATTR=y
1624CONFIG_EXT2_FS_POSIX_ACL=y
1625CONFIG_EXT2_FS_SECURITY=y
1626# CONFIG_EXT2_FS_XIP is not set
1627CONFIG_EXT3_FS=y
1628CONFIG_EXT3_FS_XATTR=y
1629CONFIG_EXT3_FS_POSIX_ACL=y
1630CONFIG_EXT3_FS_SECURITY=y
1631# CONFIG_EXT4DEV_FS is not set
1632CONFIG_JBD=y
1633# CONFIG_JBD_DEBUG is not set
1634CONFIG_FS_MBCACHE=y
1635CONFIG_REISERFS_FS=m
1636# CONFIG_REISERFS_CHECK is not set
1637# CONFIG_REISERFS_PROC_INFO is not set
1638CONFIG_REISERFS_FS_XATTR=y
1639CONFIG_REISERFS_FS_POSIX_ACL=y
1640CONFIG_REISERFS_FS_SECURITY=y
1641CONFIG_JFS_FS=m
1642CONFIG_JFS_POSIX_ACL=y
1643CONFIG_JFS_SECURITY=y
1644# CONFIG_JFS_DEBUG is not set
1645# CONFIG_JFS_STATISTICS is not set
1646CONFIG_FS_POSIX_ACL=y
1647CONFIG_XFS_FS=m
1648CONFIG_XFS_QUOTA=y
1649CONFIG_XFS_SECURITY=y
1650CONFIG_XFS_POSIX_ACL=y
1651CONFIG_XFS_RT=y
1652CONFIG_GFS2_FS=m
1653CONFIG_GFS2_FS_LOCKING_NOLOCK=m
1654CONFIG_GFS2_FS_LOCKING_DLM=m
1655# CONFIG_OCFS2_FS is not set
1656CONFIG_DNOTIFY=y
1657CONFIG_INOTIFY=y
1658CONFIG_INOTIFY_USER=y
1659CONFIG_QUOTA=y
1660CONFIG_QUOTA_NETLINK_INTERFACE=y
1661CONFIG_PRINT_QUOTA_WARNING=y
1662CONFIG_QFMT_V1=m
1663CONFIG_QFMT_V2=m
1664CONFIG_QUOTACTL=y
1665CONFIG_AUTOFS_FS=m
1666CONFIG_AUTOFS4_FS=m
1667CONFIG_FUSE_FS=m
1668CONFIG_GENERIC_ACL=y
1669
1670#
1671# CD-ROM/DVD Filesystems
1672#
1673CONFIG_ISO9660_FS=m
1674CONFIG_JOLIET=y
1675CONFIG_ZISOFS=y
1676CONFIG_UDF_FS=m
1677CONFIG_UDF_NLS=y
1678
1679#
1680# DOS/FAT/NT Filesystems
1681#
1682CONFIG_FAT_FS=m
1683CONFIG_MSDOS_FS=m
1684CONFIG_VFAT_FS=m
1685CONFIG_FAT_DEFAULT_CODEPAGE=437
1686CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1687CONFIG_NTFS_FS=m
1688# CONFIG_NTFS_DEBUG is not set
1689CONFIG_NTFS_RW=y
1690
1691#
1692# Pseudo filesystems
1693#
1694CONFIG_PROC_FS=y
1695CONFIG_PROC_KCORE=y
1696CONFIG_PROC_SYSCTL=y
1697CONFIG_SYSFS=y
1698CONFIG_TMPFS=y
1699CONFIG_TMPFS_POSIX_ACL=y
1700# CONFIG_HUGETLB_PAGE is not set
1701CONFIG_CONFIGFS_FS=m
1702
1703#
1704# Miscellaneous filesystems
1705#
1706CONFIG_ADFS_FS=m
1707# CONFIG_ADFS_FS_RW is not set
1708CONFIG_AFFS_FS=m
1709CONFIG_HFS_FS=m
1710CONFIG_HFSPLUS_FS=m
1711CONFIG_BEFS_FS=m
1712# CONFIG_BEFS_DEBUG is not set
1713CONFIG_BFS_FS=m
1714CONFIG_EFS_FS=m
1715CONFIG_JFFS2_FS=m
1716CONFIG_JFFS2_FS_DEBUG=0
1717CONFIG_JFFS2_FS_WRITEBUFFER=y
1718# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1719# CONFIG_JFFS2_SUMMARY is not set
1720CONFIG_JFFS2_FS_XATTR=y
1721CONFIG_JFFS2_FS_POSIX_ACL=y
1722CONFIG_JFFS2_FS_SECURITY=y
1723# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1724CONFIG_JFFS2_ZLIB=y
1725# CONFIG_JFFS2_LZO is not set
1726CONFIG_JFFS2_RTIME=y
1727# CONFIG_JFFS2_RUBIN is not set
1728CONFIG_CRAMFS=m
1729CONFIG_VXFS_FS=m
1730CONFIG_MINIX_FS=m
1731CONFIG_HPFS_FS=m
1732CONFIG_QNX4FS_FS=m
1733CONFIG_ROMFS_FS=m
1734CONFIG_SYSV_FS=m
1735CONFIG_UFS_FS=m
1736# CONFIG_UFS_FS_WRITE is not set
1737# CONFIG_UFS_DEBUG is not set
1738CONFIG_NETWORK_FILESYSTEMS=y
1739CONFIG_NFS_FS=m
1740CONFIG_NFS_V3=y
1741CONFIG_NFS_V3_ACL=y
1742CONFIG_NFS_V4=y
1743# CONFIG_NFS_DIRECTIO is not set
1744CONFIG_NFSD=m
1745CONFIG_NFSD_V2_ACL=y
1746CONFIG_NFSD_V3=y
1747CONFIG_NFSD_V3_ACL=y
1748CONFIG_NFSD_V4=y
1749CONFIG_NFSD_TCP=y
1750CONFIG_LOCKD=m
1751CONFIG_LOCKD_V4=y
1752CONFIG_EXPORTFS=m
1753CONFIG_NFS_ACL_SUPPORT=m
1754CONFIG_NFS_COMMON=y
1755CONFIG_SUNRPC=m
1756CONFIG_SUNRPC_GSS=m
1757CONFIG_SUNRPC_BIND34=y
1758CONFIG_RPCSEC_GSS_KRB5=m
1759CONFIG_RPCSEC_GSS_SPKM3=m
1760# CONFIG_SMB_FS is not set
1761CONFIG_CIFS=m
1762# CONFIG_CIFS_STATS is not set
1763# CONFIG_CIFS_WEAK_PW_HASH is not set
1764CONFIG_CIFS_XATTR=y
1765CONFIG_CIFS_POSIX=y
1766# CONFIG_CIFS_DEBUG2 is not set
1767# CONFIG_CIFS_EXPERIMENTAL is not set
1768CONFIG_NCP_FS=m
1769# CONFIG_NCPFS_PACKET_SIGNING is not set
1770# CONFIG_NCPFS_IOCTL_LOCKING is not set
1771# CONFIG_NCPFS_STRONG is not set
1772CONFIG_NCPFS_NFS_NS=y
1773CONFIG_NCPFS_OS2_NS=y
1774# CONFIG_NCPFS_SMALLDOS is not set
1775CONFIG_NCPFS_NLS=y
1776CONFIG_NCPFS_EXTRAS=y
1777CONFIG_CODA_FS=m
1778# CONFIG_CODA_FS_OLD_API is not set
1779# CONFIG_AFS_FS is not set
1780CONFIG_9P_FS=m
1781
1782#
1783# Partition Types
1784#
1785CONFIG_PARTITION_ADVANCED=y
1786# CONFIG_ACORN_PARTITION is not set
1787# CONFIG_OSF_PARTITION is not set
1788# CONFIG_AMIGA_PARTITION is not set
1789# CONFIG_ATARI_PARTITION is not set
1790# CONFIG_MAC_PARTITION is not set
1791CONFIG_MSDOS_PARTITION=y
1792# CONFIG_BSD_DISKLABEL is not set
1793# CONFIG_MINIX_SUBPARTITION is not set
1794# CONFIG_SOLARIS_X86_PARTITION is not set
1795# CONFIG_UNIXWARE_DISKLABEL is not set
1796# CONFIG_LDM_PARTITION is not set
1797# CONFIG_SGI_PARTITION is not set
1798# CONFIG_ULTRIX_PARTITION is not set
1799# CONFIG_SUN_PARTITION is not set
1800CONFIG_KARMA_PARTITION=y
1801# CONFIG_EFI_PARTITION is not set
1802# CONFIG_SYSV68_PARTITION is not set
1803CONFIG_NLS=y
1804CONFIG_NLS_DEFAULT="iso8859-1"
1805CONFIG_NLS_CODEPAGE_437=m
1806CONFIG_NLS_CODEPAGE_737=m
1807CONFIG_NLS_CODEPAGE_775=m
1808CONFIG_NLS_CODEPAGE_850=m
1809CONFIG_NLS_CODEPAGE_852=m
1810CONFIG_NLS_CODEPAGE_855=m
1811CONFIG_NLS_CODEPAGE_857=m
1812CONFIG_NLS_CODEPAGE_860=m
1813CONFIG_NLS_CODEPAGE_861=m
1814CONFIG_NLS_CODEPAGE_862=m
1815CONFIG_NLS_CODEPAGE_863=m
1816CONFIG_NLS_CODEPAGE_864=m
1817CONFIG_NLS_CODEPAGE_865=m
1818CONFIG_NLS_CODEPAGE_866=m
1819CONFIG_NLS_CODEPAGE_869=m
1820CONFIG_NLS_CODEPAGE_936=m
1821CONFIG_NLS_CODEPAGE_950=m
1822CONFIG_NLS_CODEPAGE_932=m
1823CONFIG_NLS_CODEPAGE_949=m
1824CONFIG_NLS_CODEPAGE_874=m
1825CONFIG_NLS_ISO8859_8=m
1826CONFIG_NLS_CODEPAGE_1250=m
1827CONFIG_NLS_CODEPAGE_1251=m
1828CONFIG_NLS_ASCII=m
1829CONFIG_NLS_ISO8859_1=m
1830CONFIG_NLS_ISO8859_2=m
1831CONFIG_NLS_ISO8859_3=m
1832CONFIG_NLS_ISO8859_4=m
1833CONFIG_NLS_ISO8859_5=m
1834CONFIG_NLS_ISO8859_6=m
1835CONFIG_NLS_ISO8859_7=m
1836CONFIG_NLS_ISO8859_9=m
1837CONFIG_NLS_ISO8859_13=m
1838CONFIG_NLS_ISO8859_14=m
1839CONFIG_NLS_ISO8859_15=m
1840CONFIG_NLS_KOI8_R=m
1841CONFIG_NLS_KOI8_U=m
1842CONFIG_NLS_UTF8=m
1843CONFIG_DLM=m
1844CONFIG_DLM_DEBUG=y
1845
1846#
1847# Kernel hacking
1848#
1849CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1850# CONFIG_PRINTK_TIME is not set
1851CONFIG_ENABLE_WARN_DEPRECATED=y
1852CONFIG_ENABLE_MUST_CHECK=y
1853# CONFIG_MAGIC_SYSRQ is not set
1854# CONFIG_UNUSED_SYMBOLS is not set
1855CONFIG_DEBUG_FS=y
1856# CONFIG_HEADERS_CHECK is not set
1857# CONFIG_DEBUG_KERNEL is not set
1858# CONFIG_SAMPLES is not set
1859CONFIG_CMDLINE=""
1860
1861#
1862# Security options
1863#
1864# CONFIG_KEYS is not set
1865# CONFIG_SECURITY is not set
1866# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1867CONFIG_CRYPTO=y
1868CONFIG_CRYPTO_ALGAPI=y
1869CONFIG_CRYPTO_AEAD=m
1870CONFIG_CRYPTO_BLKCIPHER=m
1871# CONFIG_CRYPTO_SEQIV is not set
1872CONFIG_CRYPTO_HASH=y
1873CONFIG_CRYPTO_MANAGER=y
1874CONFIG_CRYPTO_HMAC=y
1875CONFIG_CRYPTO_XCBC=m
1876CONFIG_CRYPTO_NULL=m
1877CONFIG_CRYPTO_MD4=m
1878CONFIG_CRYPTO_MD5=y
1879CONFIG_CRYPTO_SHA1=m
1880CONFIG_CRYPTO_SHA256=m
1881CONFIG_CRYPTO_SHA512=m
1882CONFIG_CRYPTO_WP512=m
1883CONFIG_CRYPTO_TGR192=m
1884CONFIG_CRYPTO_GF128MUL=m
1885CONFIG_CRYPTO_ECB=m
1886CONFIG_CRYPTO_CBC=m
1887CONFIG_CRYPTO_PCBC=m
1888CONFIG_CRYPTO_LRW=m
1889CONFIG_CRYPTO_XTS=m
1890# CONFIG_CRYPTO_CTR is not set
1891# CONFIG_CRYPTO_GCM is not set
1892# CONFIG_CRYPTO_CCM is not set
1893# CONFIG_CRYPTO_CRYPTD is not set
1894CONFIG_CRYPTO_DES=m
1895CONFIG_CRYPTO_FCRYPT=m
1896CONFIG_CRYPTO_BLOWFISH=m
1897CONFIG_CRYPTO_TWOFISH=m
1898CONFIG_CRYPTO_TWOFISH_COMMON=m
1899CONFIG_CRYPTO_SERPENT=m
1900CONFIG_CRYPTO_AES=m
1901CONFIG_CRYPTO_CAST5=m
1902CONFIG_CRYPTO_CAST6=m
1903CONFIG_CRYPTO_TEA=m
1904CONFIG_CRYPTO_ARC4=m
1905CONFIG_CRYPTO_KHAZAD=m
1906CONFIG_CRYPTO_ANUBIS=m
1907CONFIG_CRYPTO_SEED=m
1908# CONFIG_CRYPTO_SALSA20 is not set
1909CONFIG_CRYPTO_DEFLATE=m
1910CONFIG_CRYPTO_MICHAEL_MIC=m
1911CONFIG_CRYPTO_CRC32C=m
1912CONFIG_CRYPTO_CAMELLIA=m
1913CONFIG_CRYPTO_TEST=m
1914CONFIG_CRYPTO_AUTHENC=m
1915# CONFIG_CRYPTO_LZO is not set
1916CONFIG_CRYPTO_HW=y
1917# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1918
1919#
1920# Library routines
1921#
1922CONFIG_BITREVERSE=y
1923CONFIG_CRC_CCITT=m
1924CONFIG_CRC16=m
1925CONFIG_CRC_ITU_T=m
1926CONFIG_CRC32=y
1927CONFIG_CRC7=m
1928CONFIG_LIBCRC32C=m
1929CONFIG_AUDIT_GENERIC=y
1930CONFIG_ZLIB_INFLATE=m
1931CONFIG_ZLIB_DEFLATE=m
1932CONFIG_TEXTSEARCH=y
1933CONFIG_TEXTSEARCH_KMP=m
1934CONFIG_TEXTSEARCH_BM=m
1935CONFIG_TEXTSEARCH_FSM=m
1936CONFIG_PLIST=y
1937CONFIG_HAS_IOMEM=y
1938CONFIG_HAS_IOPORT=y
1939CONFIG_HAS_DMA=y
diff --git a/arch/mips/configs/ip28_defconfig b/arch/mips/configs/ip28_defconfig
new file mode 100644
index 000000000000..ec188be9a67a
--- /dev/null
+++ b/arch/mips/configs/ip28_defconfig
@@ -0,0 +1,891 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.25-rc1
4# Mon Feb 11 15:58:54 2008
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set
16# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set
18# CONFIG_LEMOTE_FULONG is not set
19# CONFIG_MIPS_ATLAS is not set
20# CONFIG_MIPS_MALTA is not set
21# CONFIG_MIPS_SEAD is not set
22# CONFIG_MIPS_SIM is not set
23# CONFIG_MARKEINS is not set
24# CONFIG_MACH_VR41XX is not set
25# CONFIG_PNX8550_JBS is not set
26# CONFIG_PNX8550_STB810 is not set
27# CONFIG_PMC_MSP is not set
28# CONFIG_PMC_YOSEMITE is not set
29# CONFIG_SGI_IP22 is not set
30# CONFIG_SGI_IP27 is not set
31CONFIG_SGI_IP28=y
32# CONFIG_SGI_IP32 is not set
33# CONFIG_SIBYTE_CRHINE is not set
34# CONFIG_SIBYTE_CARMEL is not set
35# CONFIG_SIBYTE_CRHONE is not set
36# CONFIG_SIBYTE_RHONE is not set
37# CONFIG_SIBYTE_SWARM is not set
38# CONFIG_SIBYTE_LITTLESUR is not set
39# CONFIG_SIBYTE_SENTOSA is not set
40# CONFIG_SIBYTE_BIGSUR is not set
41# CONFIG_SNI_RM is not set
42# CONFIG_TOSHIBA_JMR3927 is not set
43# CONFIG_TOSHIBA_RBTX4927 is not set
44# CONFIG_TOSHIBA_RBTX4938 is not set
45# CONFIG_WR_PPMC is not set
46CONFIG_RWSEM_GENERIC_SPINLOCK=y
47# CONFIG_ARCH_HAS_ILOG2_U32 is not set
48# CONFIG_ARCH_HAS_ILOG2_U64 is not set
49CONFIG_ARCH_SUPPORTS_OPROFILE=y
50CONFIG_GENERIC_FIND_NEXT_BIT=y
51CONFIG_GENERIC_HWEIGHT=y
52CONFIG_GENERIC_CALIBRATE_DELAY=y
53CONFIG_GENERIC_CLOCKEVENTS=y
54CONFIG_GENERIC_TIME=y
55CONFIG_GENERIC_CMOS_UPDATE=y
56CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
57# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
58CONFIG_ARC=y
59CONFIG_CEVT_R4K=y
60CONFIG_CSRC_R4K=y
61CONFIG_DMA_NONCOHERENT=y
62CONFIG_DMA_NEED_PCI_MAP_STATE=y
63CONFIG_EARLY_PRINTK=y
64CONFIG_SYS_HAS_EARLY_PRINTK=y
65# CONFIG_HOTPLUG_CPU is not set
66CONFIG_I8259=y
67# CONFIG_NO_IOPORT is not set
68CONFIG_GENERIC_ISA_DMA=y
69CONFIG_GENERIC_ISA_DMA_SUPPORT_BROKEN=y
70CONFIG_CPU_BIG_ENDIAN=y
71# CONFIG_CPU_LITTLE_ENDIAN is not set
72CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
73CONFIG_IRQ_CPU=y
74CONFIG_SWAP_IO_SPACE=y
75CONFIG_SGI_HAS_DS1286=y
76CONFIG_SGI_HAS_INDYDOG=y
77CONFIG_SGI_HAS_SEEQ=y
78CONFIG_SGI_HAS_WD93=y
79CONFIG_SGI_HAS_ZILOG=y
80CONFIG_SGI_HAS_I8042=y
81CONFIG_DEFAULT_SGI_PARTITION=y
82CONFIG_MIPS_L1_CACHE_SHIFT=7
83CONFIG_ARC_CONSOLE=y
84CONFIG_ARC_PROMLIB=y
85CONFIG_ARC64=y
86CONFIG_BOOT_ELF64=y
87
88#
89# CPU selection
90#
91# CONFIG_CPU_LOONGSON2 is not set
92# CONFIG_CPU_MIPS32_R1 is not set
93# CONFIG_CPU_MIPS32_R2 is not set
94# CONFIG_CPU_MIPS64_R1 is not set
95# CONFIG_CPU_MIPS64_R2 is not set
96# CONFIG_CPU_R3000 is not set
97# CONFIG_CPU_TX39XX is not set
98# CONFIG_CPU_VR41XX is not set
99# CONFIG_CPU_R4300 is not set
100# CONFIG_CPU_R4X00 is not set
101# CONFIG_CPU_TX49XX is not set
102# CONFIG_CPU_R5000 is not set
103# CONFIG_CPU_R5432 is not set
104# CONFIG_CPU_R6000 is not set
105# CONFIG_CPU_NEVADA is not set
106# CONFIG_CPU_R8000 is not set
107CONFIG_CPU_R10000=y
108# CONFIG_CPU_RM7000 is not set
109# CONFIG_CPU_RM9000 is not set
110# CONFIG_CPU_SB1 is not set
111CONFIG_SYS_HAS_CPU_R10000=y
112CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
113CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
114CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
115
116#
117# Kernel type
118#
119# CONFIG_32BIT is not set
120CONFIG_64BIT=y
121CONFIG_PAGE_SIZE_4KB=y
122# CONFIG_PAGE_SIZE_8KB is not set
123# CONFIG_PAGE_SIZE_16KB is not set
124# CONFIG_PAGE_SIZE_64KB is not set
125CONFIG_CPU_HAS_PREFETCH=y
126CONFIG_MIPS_MT_DISABLED=y
127# CONFIG_MIPS_MT_SMP is not set
128# CONFIG_MIPS_MT_SMTC is not set
129CONFIG_CPU_HAS_LLSC=y
130CONFIG_CPU_HAS_SYNC=y
131CONFIG_GENERIC_HARDIRQS=y
132CONFIG_GENERIC_IRQ_PROBE=y
133CONFIG_CPU_SUPPORTS_HIGHMEM=y
134CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_ARCH_POPULATES_NODE_MAP=y
136CONFIG_SELECT_MEMORY_MODEL=y
137CONFIG_FLATMEM_MANUAL=y
138# CONFIG_DISCONTIGMEM_MANUAL is not set
139# CONFIG_SPARSEMEM_MANUAL is not set
140CONFIG_FLATMEM=y
141CONFIG_FLAT_NODE_MEM_MAP=y
142# CONFIG_SPARSEMEM_STATIC is not set
143# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
144CONFIG_SPLIT_PTLOCK_CPUS=4
145CONFIG_RESOURCES_64BIT=y
146CONFIG_ZONE_DMA_FLAG=0
147CONFIG_VIRT_TO_BUS=y
148# CONFIG_TICK_ONESHOT is not set
149# CONFIG_NO_HZ is not set
150# CONFIG_HIGH_RES_TIMERS is not set
151CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
152# CONFIG_HZ_48 is not set
153# CONFIG_HZ_100 is not set
154# CONFIG_HZ_128 is not set
155CONFIG_HZ_250=y
156# CONFIG_HZ_256 is not set
157# CONFIG_HZ_1000 is not set
158# CONFIG_HZ_1024 is not set
159CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
160CONFIG_HZ=250
161# CONFIG_PREEMPT_NONE is not set
162CONFIG_PREEMPT_VOLUNTARY=y
163# CONFIG_PREEMPT is not set
164# CONFIG_RCU_TRACE is not set
165# CONFIG_MIPS_INSANE_LARGE is not set
166# CONFIG_KEXEC is not set
167CONFIG_SECCOMP=y
168CONFIG_LOCKDEP_SUPPORT=y
169CONFIG_STACKTRACE_SUPPORT=y
170CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
171
172#
173# General setup
174#
175CONFIG_EXPERIMENTAL=y
176CONFIG_BROKEN_ON_SMP=y
177CONFIG_INIT_ENV_ARG_LIMIT=32
178CONFIG_LOCALVERSION=""
179CONFIG_LOCALVERSION_AUTO=y
180CONFIG_SWAP=y
181CONFIG_SYSVIPC=y
182CONFIG_SYSVIPC_SYSCTL=y
183# CONFIG_POSIX_MQUEUE is not set
184# CONFIG_BSD_PROCESS_ACCT is not set
185# CONFIG_TASKSTATS is not set
186# CONFIG_AUDIT is not set
187CONFIG_IKCONFIG=y
188CONFIG_IKCONFIG_PROC=y
189CONFIG_LOG_BUF_SHIFT=14
190# CONFIG_CGROUPS is not set
191CONFIG_FAIR_GROUP_SCHED=y
192CONFIG_FAIR_USER_SCHED=y
193# CONFIG_FAIR_CGROUP_SCHED is not set
194CONFIG_SYSFS_DEPRECATED=y
195CONFIG_RELAY=y
196# CONFIG_NAMESPACES is not set
197# CONFIG_BLK_DEV_INITRD is not set
198# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
199CONFIG_SYSCTL=y
200CONFIG_EMBEDDED=y
201CONFIG_SYSCTL_SYSCALL=y
202CONFIG_KALLSYMS=y
203# CONFIG_KALLSYMS_EXTRA_PASS is not set
204# CONFIG_HOTPLUG is not set
205CONFIG_PRINTK=y
206CONFIG_BUG=y
207CONFIG_ELF_CORE=y
208CONFIG_COMPAT_BRK=y
209CONFIG_BASE_FULL=y
210CONFIG_FUTEX=y
211CONFIG_ANON_INODES=y
212CONFIG_EPOLL=y
213CONFIG_SIGNALFD=y
214CONFIG_TIMERFD=y
215CONFIG_EVENTFD=y
216CONFIG_SHMEM=y
217CONFIG_VM_EVENT_COUNTERS=y
218CONFIG_SLAB=y
219# CONFIG_SLUB is not set
220# CONFIG_SLOB is not set
221# CONFIG_PROFILING is not set
222# CONFIG_MARKERS is not set
223CONFIG_HAVE_OPROFILE=y
224# CONFIG_HAVE_KPROBES is not set
225# CONFIG_PROC_PAGE_MONITOR is not set
226CONFIG_SLABINFO=y
227CONFIG_RT_MUTEXES=y
228# CONFIG_TINY_SHMEM is not set
229CONFIG_BASE_SMALL=0
230CONFIG_MODULES=y
231CONFIG_MODULE_UNLOAD=y
232# CONFIG_MODULE_FORCE_UNLOAD is not set
233CONFIG_MODVERSIONS=y
234CONFIG_MODULE_SRCVERSION_ALL=y
235CONFIG_KMOD=y
236CONFIG_BLOCK=y
237# CONFIG_BLK_DEV_IO_TRACE is not set
238# CONFIG_BLK_DEV_BSG is not set
239CONFIG_BLOCK_COMPAT=y
240
241#
242# IO Schedulers
243#
244CONFIG_IOSCHED_NOOP=y
245CONFIG_IOSCHED_AS=y
246CONFIG_IOSCHED_DEADLINE=y
247CONFIG_IOSCHED_CFQ=y
248CONFIG_DEFAULT_AS=y
249# CONFIG_DEFAULT_DEADLINE is not set
250# CONFIG_DEFAULT_CFQ is not set
251# CONFIG_DEFAULT_NOOP is not set
252CONFIG_DEFAULT_IOSCHED="anticipatory"
253CONFIG_CLASSIC_RCU=y
254# CONFIG_PREEMPT_RCU is not set
255
256#
257# Bus options (PCI, PCMCIA, EISA, ISA, TC)
258#
259CONFIG_HW_HAS_EISA=y
260# CONFIG_ARCH_SUPPORTS_MSI is not set
261CONFIG_ISA=y
262CONFIG_EISA=y
263CONFIG_EISA_NAMES=y
264CONFIG_MMU=y
265CONFIG_I8253=y
266
267#
268# Executable file formats
269#
270CONFIG_BINFMT_ELF=y
271# CONFIG_BINFMT_MISC is not set
272CONFIG_MIPS32_COMPAT=y
273CONFIG_COMPAT=y
274CONFIG_SYSVIPC_COMPAT=y
275CONFIG_MIPS32_O32=y
276CONFIG_MIPS32_N32=y
277CONFIG_BINFMT_ELF32=y
278
279#
280# Power management options
281#
282CONFIG_ARCH_SUSPEND_POSSIBLE=y
283CONFIG_PM=y
284# CONFIG_PM_LEGACY is not set
285# CONFIG_PM_DEBUG is not set
286# CONFIG_SUSPEND is not set
287
288#
289# Networking
290#
291CONFIG_NET=y
292
293#
294# Networking options
295#
296CONFIG_PACKET=y
297CONFIG_PACKET_MMAP=y
298CONFIG_UNIX=y
299CONFIG_XFRM=y
300# CONFIG_XFRM_USER is not set
301# CONFIG_XFRM_SUB_POLICY is not set
302CONFIG_XFRM_MIGRATE=y
303# CONFIG_XFRM_STATISTICS is not set
304CONFIG_NET_KEY=y
305CONFIG_NET_KEY_MIGRATE=y
306CONFIG_INET=y
307CONFIG_IP_MULTICAST=y
308# CONFIG_IP_ADVANCED_ROUTER is not set
309CONFIG_IP_FIB_HASH=y
310CONFIG_IP_PNP=y
311CONFIG_IP_PNP_DHCP=y
312CONFIG_IP_PNP_BOOTP=y
313# CONFIG_IP_PNP_RARP is not set
314# CONFIG_NET_IPIP is not set
315# CONFIG_NET_IPGRE is not set
316# CONFIG_IP_MROUTE is not set
317# CONFIG_ARPD is not set
318# CONFIG_SYN_COOKIES is not set
319# CONFIG_INET_AH is not set
320# CONFIG_INET_ESP is not set
321# CONFIG_INET_IPCOMP is not set
322# CONFIG_INET_XFRM_TUNNEL is not set
323# CONFIG_INET_TUNNEL is not set
324# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
325# CONFIG_INET_XFRM_MODE_TUNNEL is not set
326# CONFIG_INET_XFRM_MODE_BEET is not set
327# CONFIG_INET_LRO is not set
328CONFIG_INET_DIAG=y
329CONFIG_INET_TCP_DIAG=y
330# CONFIG_TCP_CONG_ADVANCED is not set
331CONFIG_TCP_CONG_CUBIC=y
332CONFIG_DEFAULT_TCP_CONG="cubic"
333CONFIG_TCP_MD5SIG=y
334# CONFIG_IPV6 is not set
335# CONFIG_INET6_XFRM_TUNNEL is not set
336# CONFIG_INET6_TUNNEL is not set
337# CONFIG_NETWORK_SECMARK is not set
338# CONFIG_NETFILTER is not set
339# CONFIG_IP_DCCP is not set
340# CONFIG_IP_SCTP is not set
341# CONFIG_TIPC is not set
342# CONFIG_ATM is not set
343# CONFIG_BRIDGE is not set
344# CONFIG_VLAN_8021Q is not set
345# CONFIG_DECNET is not set
346# CONFIG_LLC2 is not set
347# CONFIG_IPX is not set
348# CONFIG_ATALK is not set
349# CONFIG_X25 is not set
350# CONFIG_LAPB is not set
351# CONFIG_ECONET is not set
352# CONFIG_WAN_ROUTER is not set
353# CONFIG_NET_SCHED is not set
354
355#
356# Network testing
357#
358# CONFIG_NET_PKTGEN is not set
359# CONFIG_HAMRADIO is not set
360# CONFIG_CAN is not set
361# CONFIG_IRDA is not set
362# CONFIG_BT is not set
363# CONFIG_AF_RXRPC is not set
364
365#
366# Wireless
367#
368# CONFIG_CFG80211 is not set
369# CONFIG_WIRELESS_EXT is not set
370# CONFIG_MAC80211 is not set
371# CONFIG_IEEE80211 is not set
372# CONFIG_RFKILL is not set
373# CONFIG_NET_9P is not set
374
375#
376# Device Drivers
377#
378
379#
380# Generic Driver Options
381#
382CONFIG_STANDALONE=y
383CONFIG_PREVENT_FIRMWARE_BUILD=y
384# CONFIG_SYS_HYPERVISOR is not set
385# CONFIG_CONNECTOR is not set
386# CONFIG_MTD is not set
387# CONFIG_PARPORT is not set
388# CONFIG_PNP is not set
389CONFIG_BLK_DEV=y
390# CONFIG_BLK_DEV_COW_COMMON is not set
391# CONFIG_BLK_DEV_LOOP is not set
392# CONFIG_BLK_DEV_NBD is not set
393# CONFIG_BLK_DEV_RAM is not set
394# CONFIG_CDROM_PKTCDVD is not set
395# CONFIG_ATA_OVER_ETH is not set
396# CONFIG_MISC_DEVICES is not set
397CONFIG_HAVE_IDE=y
398# CONFIG_IDE is not set
399
400#
401# SCSI device support
402#
403# CONFIG_RAID_ATTRS is not set
404CONFIG_SCSI=y
405CONFIG_SCSI_DMA=y
406# CONFIG_SCSI_TGT is not set
407# CONFIG_SCSI_NETLINK is not set
408CONFIG_SCSI_PROC_FS=y
409
410#
411# SCSI support type (disk, tape, CD-ROM)
412#
413CONFIG_BLK_DEV_SD=y
414# CONFIG_CHR_DEV_ST is not set
415# CONFIG_CHR_DEV_OSST is not set
416CONFIG_BLK_DEV_SR=y
417# CONFIG_BLK_DEV_SR_VENDOR is not set
418# CONFIG_CHR_DEV_SG is not set
419# CONFIG_CHR_DEV_SCH is not set
420
421#
422# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
423#
424# CONFIG_SCSI_MULTI_LUN is not set
425CONFIG_SCSI_CONSTANTS=y
426# CONFIG_SCSI_LOGGING is not set
427# CONFIG_SCSI_SCAN_ASYNC is not set
428CONFIG_SCSI_WAIT_SCAN=m
429
430#
431# SCSI Transports
432#
433# CONFIG_SCSI_SPI_ATTRS is not set
434# CONFIG_SCSI_FC_ATTRS is not set
435# CONFIG_SCSI_ISCSI_ATTRS is not set
436# CONFIG_SCSI_SAS_LIBSAS is not set
437# CONFIG_SCSI_SRP_ATTRS is not set
438CONFIG_SCSI_LOWLEVEL=y
439# CONFIG_ISCSI_TCP is not set
440CONFIG_SGIWD93_SCSI=y
441# CONFIG_SCSI_AHA1740 is not set
442# CONFIG_SCSI_AIC7XXX is not set
443# CONFIG_SCSI_AIC7XXX_OLD is not set
444# CONFIG_SCSI_ADVANSYS is not set
445# CONFIG_SCSI_IN2000 is not set
446# CONFIG_SCSI_DTC3280 is not set
447# CONFIG_SCSI_FUTURE_DOMAIN is not set
448# CONFIG_SCSI_GENERIC_NCR5380 is not set
449# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
450# CONFIG_SCSI_NCR53C406A is not set
451# CONFIG_SCSI_PAS16 is not set
452# CONFIG_SCSI_QLOGIC_FAS is not set
453# CONFIG_SCSI_SIM710 is not set
454# CONFIG_SCSI_SYM53C416 is not set
455# CONFIG_SCSI_T128 is not set
456# CONFIG_SCSI_DEBUG is not set
457# CONFIG_ATA is not set
458# CONFIG_MD is not set
459CONFIG_NETDEVICES=y
460# CONFIG_NETDEVICES_MULTIQUEUE is not set
461CONFIG_DUMMY=m
462# CONFIG_BONDING is not set
463# CONFIG_MACVLAN is not set
464# CONFIG_EQUALIZER is not set
465# CONFIG_TUN is not set
466# CONFIG_VETH is not set
467# CONFIG_ARCNET is not set
468# CONFIG_PHYLIB is not set
469CONFIG_NET_ETHERNET=y
470# CONFIG_MII is not set
471# CONFIG_AX88796 is not set
472# CONFIG_NET_VENDOR_3COM is not set
473# CONFIG_NET_VENDOR_SMC is not set
474# CONFIG_DM9000 is not set
475# CONFIG_NET_VENDOR_RACAL is not set
476# CONFIG_NET_TULIP is not set
477# CONFIG_AT1700 is not set
478# CONFIG_DEPCA is not set
479# CONFIG_HP100 is not set
480# CONFIG_NET_ISA is not set
481# CONFIG_IBM_NEW_EMAC_ZMII is not set
482# CONFIG_IBM_NEW_EMAC_RGMII is not set
483# CONFIG_IBM_NEW_EMAC_TAH is not set
484# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
485# CONFIG_NET_PCI is not set
486# CONFIG_B44 is not set
487CONFIG_SGISEEQ=y
488# CONFIG_NETDEV_1000 is not set
489# CONFIG_NETDEV_10000 is not set
490# CONFIG_TR is not set
491
492#
493# Wireless LAN
494#
495# CONFIG_WLAN_PRE80211 is not set
496# CONFIG_WLAN_80211 is not set
497# CONFIG_WAN is not set
498# CONFIG_FDDI is not set
499# CONFIG_PPP is not set
500# CONFIG_SLIP is not set
501# CONFIG_NETCONSOLE is not set
502# CONFIG_NETPOLL is not set
503# CONFIG_NET_POLL_CONTROLLER is not set
504# CONFIG_ISDN is not set
505# CONFIG_PHONE is not set
506
507#
508# Input device support
509#
510CONFIG_INPUT=y
511# CONFIG_INPUT_FF_MEMLESS is not set
512# CONFIG_INPUT_POLLDEV is not set
513
514#
515# Userland interfaces
516#
517CONFIG_INPUT_MOUSEDEV=y
518CONFIG_INPUT_MOUSEDEV_PSAUX=y
519CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
520CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
521# CONFIG_INPUT_JOYDEV is not set
522# CONFIG_INPUT_EVDEV is not set
523# CONFIG_INPUT_EVBUG is not set
524
525#
526# Input Device Drivers
527#
528CONFIG_INPUT_KEYBOARD=y
529CONFIG_KEYBOARD_ATKBD=y
530# CONFIG_KEYBOARD_SUNKBD is not set
531# CONFIG_KEYBOARD_LKKBD is not set
532# CONFIG_KEYBOARD_XTKBD is not set
533# CONFIG_KEYBOARD_NEWTON is not set
534# CONFIG_KEYBOARD_STOWAWAY is not set
535CONFIG_INPUT_MOUSE=y
536CONFIG_MOUSE_PS2=y
537# CONFIG_MOUSE_PS2_ALPS is not set
538CONFIG_MOUSE_PS2_LOGIPS2PP=y
539# CONFIG_MOUSE_PS2_SYNAPTICS is not set
540# CONFIG_MOUSE_PS2_LIFEBOOK is not set
541CONFIG_MOUSE_PS2_TRACKPOINT=y
542# CONFIG_MOUSE_PS2_TOUCHKIT is not set
543# CONFIG_MOUSE_SERIAL is not set
544# CONFIG_MOUSE_INPORT is not set
545# CONFIG_MOUSE_LOGIBM is not set
546# CONFIG_MOUSE_PC110PAD is not set
547# CONFIG_MOUSE_VSXXXAA is not set
548# CONFIG_INPUT_JOYSTICK is not set
549# CONFIG_INPUT_TABLET is not set
550# CONFIG_INPUT_TOUCHSCREEN is not set
551# CONFIG_INPUT_MISC is not set
552
553#
554# Hardware I/O ports
555#
556CONFIG_SERIO=y
557CONFIG_SERIO_I8042=y
558CONFIG_SERIO_SERPORT=y
559CONFIG_SERIO_LIBPS2=y
560# CONFIG_SERIO_RAW is not set
561# CONFIG_GAMEPORT is not set
562
563#
564# Character devices
565#
566CONFIG_VT=y
567CONFIG_VT_CONSOLE=y
568CONFIG_HW_CONSOLE=y
569CONFIG_VT_HW_CONSOLE_BINDING=y
570# CONFIG_SERIAL_NONSTANDARD is not set
571
572#
573# Serial drivers
574#
575# CONFIG_SERIAL_8250 is not set
576
577#
578# Non-8250 serial port support
579#
580CONFIG_SERIAL_IP22_ZILOG=y
581CONFIG_SERIAL_IP22_ZILOG_CONSOLE=y
582CONFIG_SERIAL_CORE=y
583CONFIG_SERIAL_CORE_CONSOLE=y
584CONFIG_UNIX98_PTYS=y
585CONFIG_LEGACY_PTYS=y
586CONFIG_LEGACY_PTY_COUNT=256
587# CONFIG_IPMI_HANDLER is not set
588# CONFIG_HW_RANDOM is not set
589# CONFIG_RTC is not set
590CONFIG_SGI_DS1286=y
591# CONFIG_DTLK is not set
592# CONFIG_R3964 is not set
593# CONFIG_RAW_DRIVER is not set
594# CONFIG_TCG_TPM is not set
595CONFIG_DEVPORT=y
596# CONFIG_I2C is not set
597
598#
599# SPI support
600#
601# CONFIG_SPI is not set
602# CONFIG_SPI_MASTER is not set
603# CONFIG_W1 is not set
604# CONFIG_POWER_SUPPLY is not set
605# CONFIG_HWMON is not set
606# CONFIG_THERMAL is not set
607CONFIG_WATCHDOG=y
608# CONFIG_WATCHDOG_NOWAYOUT is not set
609
610#
611# Watchdog Device Drivers
612#
613# CONFIG_SOFT_WATCHDOG is not set
614CONFIG_INDYDOG=y
615
616#
617# ISA-based Watchdog Cards
618#
619# CONFIG_PCWATCHDOG is not set
620# CONFIG_MIXCOMWD is not set
621# CONFIG_WDT is not set
622
623#
624# Sonics Silicon Backplane
625#
626CONFIG_SSB_POSSIBLE=y
627# CONFIG_SSB is not set
628
629#
630# Multifunction device drivers
631#
632# CONFIG_MFD_SM501 is not set
633
634#
635# Multimedia devices
636#
637# CONFIG_VIDEO_DEV is not set
638# CONFIG_DVB_CORE is not set
639# CONFIG_DAB is not set
640
641#
642# Graphics support
643#
644# CONFIG_VGASTATE is not set
645# CONFIG_VIDEO_OUTPUT_CONTROL is not set
646# CONFIG_FB is not set
647# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
648
649#
650# Display device support
651#
652# CONFIG_DISPLAY_SUPPORT is not set
653
654#
655# Console display driver support
656#
657# CONFIG_VGA_CONSOLE is not set
658# CONFIG_MDA_CONSOLE is not set
659CONFIG_DUMMY_CONSOLE=y
660
661#
662# Sound
663#
664# CONFIG_SOUND is not set
665CONFIG_HID_SUPPORT=y
666CONFIG_HID=y
667# CONFIG_HID_DEBUG is not set
668# CONFIG_HIDRAW is not set
669CONFIG_USB_SUPPORT=y
670# CONFIG_USB_ARCH_HAS_HCD is not set
671# CONFIG_USB_ARCH_HAS_OHCI is not set
672# CONFIG_USB_ARCH_HAS_EHCI is not set
673
674#
675# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
676#
677# CONFIG_USB_GADGET is not set
678# CONFIG_MMC is not set
679# CONFIG_MEMSTICK is not set
680# CONFIG_NEW_LEDS is not set
681CONFIG_RTC_LIB=y
682# CONFIG_RTC_CLASS is not set
683
684#
685# Userspace I/O
686#
687# CONFIG_UIO is not set
688
689#
690# File systems
691#
692CONFIG_EXT2_FS=y
693# CONFIG_EXT2_FS_XATTR is not set
694# CONFIG_EXT2_FS_XIP is not set
695CONFIG_EXT3_FS=y
696CONFIG_EXT3_FS_XATTR=y
697CONFIG_EXT3_FS_POSIX_ACL=y
698CONFIG_EXT3_FS_SECURITY=y
699# CONFIG_EXT4DEV_FS is not set
700CONFIG_JBD=y
701CONFIG_FS_MBCACHE=y
702# CONFIG_REISERFS_FS is not set
703# CONFIG_JFS_FS is not set
704CONFIG_FS_POSIX_ACL=y
705# CONFIG_XFS_FS is not set
706# CONFIG_GFS2_FS is not set
707# CONFIG_OCFS2_FS is not set
708CONFIG_DNOTIFY=y
709CONFIG_INOTIFY=y
710CONFIG_INOTIFY_USER=y
711CONFIG_QUOTA=y
712# CONFIG_QUOTA_NETLINK_INTERFACE is not set
713CONFIG_PRINT_QUOTA_WARNING=y
714# CONFIG_QFMT_V1 is not set
715# CONFIG_QFMT_V2 is not set
716CONFIG_QUOTACTL=y
717# CONFIG_AUTOFS_FS is not set
718# CONFIG_AUTOFS4_FS is not set
719# CONFIG_FUSE_FS is not set
720CONFIG_GENERIC_ACL=y
721
722#
723# CD-ROM/DVD Filesystems
724#
725# CONFIG_ISO9660_FS is not set
726# CONFIG_UDF_FS is not set
727
728#
729# DOS/FAT/NT Filesystems
730#
731# CONFIG_MSDOS_FS is not set
732# CONFIG_VFAT_FS is not set
733# CONFIG_NTFS_FS is not set
734
735#
736# Pseudo filesystems
737#
738CONFIG_PROC_FS=y
739CONFIG_PROC_KCORE=y
740CONFIG_PROC_SYSCTL=y
741CONFIG_SYSFS=y
742CONFIG_TMPFS=y
743CONFIG_TMPFS_POSIX_ACL=y
744# CONFIG_HUGETLB_PAGE is not set
745# CONFIG_CONFIGFS_FS is not set
746
747#
748# Miscellaneous filesystems
749#
750# CONFIG_ADFS_FS is not set
751# CONFIG_AFFS_FS is not set
752# CONFIG_HFS_FS is not set
753# CONFIG_HFSPLUS_FS is not set
754# CONFIG_BEFS_FS is not set
755# CONFIG_BFS_FS is not set
756# CONFIG_EFS_FS is not set
757# CONFIG_CRAMFS is not set
758# CONFIG_VXFS_FS is not set
759# CONFIG_MINIX_FS is not set
760# CONFIG_HPFS_FS is not set
761# CONFIG_QNX4FS_FS is not set
762# CONFIG_ROMFS_FS is not set
763# CONFIG_SYSV_FS is not set
764# CONFIG_UFS_FS is not set
765CONFIG_NETWORK_FILESYSTEMS=y
766CONFIG_NFS_FS=y
767CONFIG_NFS_V3=y
768CONFIG_NFS_V3_ACL=y
769# CONFIG_NFS_V4 is not set
770# CONFIG_NFS_DIRECTIO is not set
771# CONFIG_NFSD is not set
772CONFIG_ROOT_NFS=y
773CONFIG_LOCKD=y
774CONFIG_LOCKD_V4=y
775CONFIG_NFS_ACL_SUPPORT=y
776CONFIG_NFS_COMMON=y
777CONFIG_SUNRPC=y
778# CONFIG_SUNRPC_BIND34 is not set
779# CONFIG_RPCSEC_GSS_KRB5 is not set
780# CONFIG_RPCSEC_GSS_SPKM3 is not set
781# CONFIG_SMB_FS is not set
782# CONFIG_CIFS is not set
783# CONFIG_NCP_FS is not set
784# CONFIG_CODA_FS is not set
785# CONFIG_AFS_FS is not set
786
787#
788# Partition Types
789#
790CONFIG_PARTITION_ADVANCED=y
791# CONFIG_ACORN_PARTITION is not set
792# CONFIG_OSF_PARTITION is not set
793# CONFIG_AMIGA_PARTITION is not set
794# CONFIG_ATARI_PARTITION is not set
795# CONFIG_MAC_PARTITION is not set
796CONFIG_MSDOS_PARTITION=y
797# CONFIG_BSD_DISKLABEL is not set
798# CONFIG_MINIX_SUBPARTITION is not set
799# CONFIG_SOLARIS_X86_PARTITION is not set
800# CONFIG_UNIXWARE_DISKLABEL is not set
801# CONFIG_LDM_PARTITION is not set
802CONFIG_SGI_PARTITION=y
803# CONFIG_ULTRIX_PARTITION is not set
804# CONFIG_SUN_PARTITION is not set
805# CONFIG_KARMA_PARTITION is not set
806# CONFIG_EFI_PARTITION is not set
807# CONFIG_SYSV68_PARTITION is not set
808# CONFIG_NLS is not set
809# CONFIG_DLM is not set
810
811#
812# Kernel hacking
813#
814CONFIG_TRACE_IRQFLAGS_SUPPORT=y
815# CONFIG_PRINTK_TIME is not set
816CONFIG_ENABLE_WARN_DEPRECATED=y
817CONFIG_ENABLE_MUST_CHECK=y
818CONFIG_MAGIC_SYSRQ=y
819# CONFIG_UNUSED_SYMBOLS is not set
820# CONFIG_DEBUG_FS is not set
821# CONFIG_HEADERS_CHECK is not set
822# CONFIG_DEBUG_KERNEL is not set
823# CONFIG_SAMPLES is not set
824CONFIG_CMDLINE=""
825
826#
827# Security options
828#
829# CONFIG_KEYS is not set
830# CONFIG_SECURITY is not set
831# CONFIG_SECURITY_FILE_CAPABILITIES is not set
832CONFIG_CRYPTO=y
833CONFIG_CRYPTO_ALGAPI=y
834# CONFIG_CRYPTO_SEQIV is not set
835CONFIG_CRYPTO_MANAGER=y
836# CONFIG_CRYPTO_HMAC is not set
837# CONFIG_CRYPTO_XCBC is not set
838# CONFIG_CRYPTO_NULL is not set
839# CONFIG_CRYPTO_MD4 is not set
840CONFIG_CRYPTO_MD5=y
841# CONFIG_CRYPTO_SHA1 is not set
842# CONFIG_CRYPTO_SHA256 is not set
843# CONFIG_CRYPTO_SHA512 is not set
844# CONFIG_CRYPTO_WP512 is not set
845# CONFIG_CRYPTO_TGR192 is not set
846# CONFIG_CRYPTO_GF128MUL is not set
847# CONFIG_CRYPTO_ECB is not set
848# CONFIG_CRYPTO_CBC is not set
849# CONFIG_CRYPTO_PCBC is not set
850# CONFIG_CRYPTO_LRW is not set
851# CONFIG_CRYPTO_XTS is not set
852# CONFIG_CRYPTO_CTR is not set
853# CONFIG_CRYPTO_GCM is not set
854# CONFIG_CRYPTO_CCM is not set
855# CONFIG_CRYPTO_CRYPTD is not set
856# CONFIG_CRYPTO_DES is not set
857# CONFIG_CRYPTO_FCRYPT is not set
858# CONFIG_CRYPTO_BLOWFISH is not set
859# CONFIG_CRYPTO_TWOFISH is not set
860# CONFIG_CRYPTO_SERPENT is not set
861# CONFIG_CRYPTO_AES is not set
862# CONFIG_CRYPTO_CAST5 is not set
863# CONFIG_CRYPTO_CAST6 is not set
864# CONFIG_CRYPTO_TEA is not set
865# CONFIG_CRYPTO_ARC4 is not set
866# CONFIG_CRYPTO_KHAZAD is not set
867# CONFIG_CRYPTO_ANUBIS is not set
868# CONFIG_CRYPTO_SEED is not set
869# CONFIG_CRYPTO_SALSA20 is not set
870# CONFIG_CRYPTO_DEFLATE is not set
871# CONFIG_CRYPTO_MICHAEL_MIC is not set
872# CONFIG_CRYPTO_CRC32C is not set
873# CONFIG_CRYPTO_CAMELLIA is not set
874# CONFIG_CRYPTO_TEST is not set
875# CONFIG_CRYPTO_AUTHENC is not set
876# CONFIG_CRYPTO_LZO is not set
877# CONFIG_CRYPTO_HW is not set
878
879#
880# Library routines
881#
882# CONFIG_CRC_CCITT is not set
883# CONFIG_CRC16 is not set
884# CONFIG_CRC_ITU_T is not set
885# CONFIG_CRC32 is not set
886# CONFIG_CRC7 is not set
887# CONFIG_LIBCRC32C is not set
888CONFIG_PLIST=y
889CONFIG_HAS_IOMEM=y
890CONFIG_HAS_IOPORT=y
891CONFIG_HAS_DMA=y
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
deleted file mode 100644
index 72ca147f9422..000000000000
--- a/arch/mips/configs/qemu_defconfig
+++ /dev/null
@@ -1,800 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20
4# Tue Feb 20 21:47:39 2007
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11CONFIG_ZONE_DMA=y
12# CONFIG_MIPS_MTX1 is not set
13# CONFIG_MIPS_BOSPORUS is not set
14# CONFIG_MIPS_PB1000 is not set
15# CONFIG_MIPS_PB1100 is not set
16# CONFIG_MIPS_PB1500 is not set
17# CONFIG_MIPS_PB1550 is not set
18# CONFIG_MIPS_PB1200 is not set
19# CONFIG_MIPS_DB1000 is not set
20# CONFIG_MIPS_DB1100 is not set
21# CONFIG_MIPS_DB1500 is not set
22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set
29# CONFIG_MIPS_ATLAS is not set
30# CONFIG_MIPS_MALTA is not set
31# CONFIG_MIPS_SEAD is not set
32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MIPS_XXS1500 is not set
36# CONFIG_PNX8550_JBS is not set
37# CONFIG_PNX8550_STB810 is not set
38# CONFIG_MACH_VR41XX is not set
39# CONFIG_PMC_YOSEMITE is not set
40# CONFIG_MARKEINS is not set
41# CONFIG_SGI_IP22 is not set
42# CONFIG_SGI_IP27 is not set
43# CONFIG_SGI_IP32 is not set
44# CONFIG_SIBYTE_BIGSUR is not set
45# CONFIG_SIBYTE_SWARM is not set
46# CONFIG_SIBYTE_SENTOSA is not set
47# CONFIG_SIBYTE_RHONE is not set
48# CONFIG_SIBYTE_CARMEL is not set
49# CONFIG_SIBYTE_LITTLESUR is not set
50# CONFIG_SIBYTE_CRHINE is not set
51# CONFIG_SIBYTE_CRHONE is not set
52# CONFIG_SNI_RM is not set
53# CONFIG_TOSHIBA_JMR3927 is not set
54# CONFIG_TOSHIBA_RBTX4927 is not set
55# CONFIG_TOSHIBA_RBTX4938 is not set
56CONFIG_RWSEM_GENERIC_SPINLOCK=y
57# CONFIG_ARCH_HAS_ILOG2_U32 is not set
58# CONFIG_ARCH_HAS_ILOG2_U64 is not set
59CONFIG_GENERIC_FIND_NEXT_BIT=y
60CONFIG_GENERIC_HWEIGHT=y
61CONFIG_GENERIC_CALIBRATE_DELAY=y
62CONFIG_GENERIC_TIME=y
63CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
64CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
65CONFIG_DMA_COHERENT=y
66CONFIG_GENERIC_ISA_DMA=y
67CONFIG_I8259=y
68CONFIG_CPU_BIG_ENDIAN=y
69# CONFIG_CPU_LITTLE_ENDIAN is not set
70CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
71CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
72CONFIG_SWAP_IO_SPACE=y
73CONFIG_MIPS_L1_CACHE_SHIFT=5
74CONFIG_HAVE_STD_PC_SERIAL_PORT=y
75
76#
77# CPU selection
78#
79CONFIG_CPU_MIPS32_R1=y
80# CONFIG_CPU_MIPS32_R2 is not set
81# CONFIG_CPU_MIPS64_R1 is not set
82# CONFIG_CPU_MIPS64_R2 is not set
83# CONFIG_CPU_R3000 is not set
84# CONFIG_CPU_TX39XX is not set
85# CONFIG_CPU_VR41XX is not set
86# CONFIG_CPU_R4300 is not set
87# CONFIG_CPU_R4X00 is not set
88# CONFIG_CPU_TX49XX is not set
89# CONFIG_CPU_R5000 is not set
90# CONFIG_CPU_R5432 is not set
91# CONFIG_CPU_R6000 is not set
92# CONFIG_CPU_NEVADA is not set
93# CONFIG_CPU_R8000 is not set
94# CONFIG_CPU_R10000 is not set
95# CONFIG_CPU_RM7000 is not set
96# CONFIG_CPU_RM9000 is not set
97# CONFIG_CPU_SB1 is not set
98CONFIG_SYS_HAS_CPU_MIPS32_R1=y
99CONFIG_CPU_MIPS32=y
100CONFIG_CPU_MIPSR1=y
101CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
102CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
103
104#
105# Kernel type
106#
107CONFIG_32BIT=y
108# CONFIG_64BIT is not set
109CONFIG_PAGE_SIZE_4KB=y
110# CONFIG_PAGE_SIZE_8KB is not set
111# CONFIG_PAGE_SIZE_16KB is not set
112# CONFIG_PAGE_SIZE_64KB is not set
113CONFIG_CPU_HAS_PREFETCH=y
114CONFIG_MIPS_MT_DISABLED=y
115# CONFIG_MIPS_MT_SMP is not set
116# CONFIG_MIPS_MT_SMTC is not set
117# CONFIG_MIPS_VPE_LOADER is not set
118# CONFIG_64BIT_PHYS_ADDR is not set
119CONFIG_CPU_HAS_LLSC=y
120CONFIG_CPU_HAS_SYNC=y
121CONFIG_GENERIC_HARDIRQS=y
122CONFIG_GENERIC_IRQ_PROBE=y
123CONFIG_CPU_SUPPORTS_HIGHMEM=y
124CONFIG_ARCH_FLATMEM_ENABLE=y
125CONFIG_ARCH_SPARSEMEM_ENABLE=y
126CONFIG_FLATMEM=y
127CONFIG_FLAT_NODE_MEM_MAP=y
128CONFIG_SPARSEMEM_STATIC=y
129CONFIG_SPLIT_PTLOCK_CPUS=4
130# CONFIG_RESOURCES_64BIT is not set
131CONFIG_ZONE_DMA_FLAG=1
132# CONFIG_HZ_48 is not set
133CONFIG_HZ_100=y
134# CONFIG_HZ_128 is not set
135# CONFIG_HZ_250 is not set
136# CONFIG_HZ_256 is not set
137# CONFIG_HZ_1000 is not set
138# CONFIG_HZ_1024 is not set
139CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
140CONFIG_HZ=100
141CONFIG_PREEMPT_NONE=y
142# CONFIG_PREEMPT_VOLUNTARY is not set
143# CONFIG_PREEMPT is not set
144CONFIG_LOCKDEP_SUPPORT=y
145CONFIG_STACKTRACE_SUPPORT=y
146CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
147
148#
149# Code maturity level options
150#
151# CONFIG_EXPERIMENTAL is not set
152CONFIG_BROKEN_ON_SMP=y
153CONFIG_INIT_ENV_ARG_LIMIT=32
154
155#
156# General setup
157#
158CONFIG_LOCALVERSION=""
159CONFIG_LOCALVERSION_AUTO=y
160# CONFIG_SWAP is not set
161# CONFIG_SYSVIPC is not set
162# CONFIG_BSD_PROCESS_ACCT is not set
163# CONFIG_TASKSTATS is not set
164# CONFIG_UTS_NS is not set
165# CONFIG_AUDIT is not set
166# CONFIG_IKCONFIG is not set
167CONFIG_SYSFS_DEPRECATED=y
168CONFIG_RELAY=y
169CONFIG_SYSCTL=y
170CONFIG_EMBEDDED=y
171CONFIG_SYSCTL_SYSCALL=y
172CONFIG_KALLSYMS=y
173# CONFIG_KALLSYMS_EXTRA_PASS is not set
174# CONFIG_HOTPLUG is not set
175CONFIG_PRINTK=y
176# CONFIG_BUG is not set
177CONFIG_ELF_CORE=y
178# CONFIG_BASE_FULL is not set
179# CONFIG_FUTEX is not set
180# CONFIG_EPOLL is not set
181# CONFIG_SHMEM is not set
182CONFIG_SLAB=y
183CONFIG_VM_EVENT_COUNTERS=y
184CONFIG_TINY_SHMEM=y
185CONFIG_BASE_SMALL=1
186# CONFIG_SLOB is not set
187
188#
189# Loadable module support
190#
191# CONFIG_MODULES is not set
192
193#
194# Block layer
195#
196CONFIG_BLOCK=y
197# CONFIG_LBD is not set
198# CONFIG_BLK_DEV_IO_TRACE is not set
199# CONFIG_LSF is not set
200
201#
202# IO Schedulers
203#
204CONFIG_IOSCHED_NOOP=y
205# CONFIG_IOSCHED_AS is not set
206# CONFIG_IOSCHED_DEADLINE is not set
207# CONFIG_IOSCHED_CFQ is not set
208# CONFIG_DEFAULT_AS is not set
209# CONFIG_DEFAULT_DEADLINE is not set
210# CONFIG_DEFAULT_CFQ is not set
211CONFIG_DEFAULT_NOOP=y
212CONFIG_DEFAULT_IOSCHED="noop"
213
214#
215# Bus options (PCI, PCMCIA, EISA, ISA, TC)
216#
217CONFIG_ISA=y
218CONFIG_MMU=y
219CONFIG_PCSPEAKER=y
220
221#
222# PCCARD (PCMCIA/CardBus) support
223#
224
225#
226# PCI Hotplug Support
227#
228
229#
230# Executable file formats
231#
232CONFIG_BINFMT_ELF=y
233# CONFIG_BINFMT_MISC is not set
234CONFIG_TRAD_SIGNALS=y
235
236#
237# Power management options
238#
239CONFIG_PM=y
240# CONFIG_PM_LEGACY is not set
241# CONFIG_PM_DEBUG is not set
242# CONFIG_PM_SYSFS_DEPRECATED is not set
243
244#
245# Networking
246#
247CONFIG_NET=y
248
249#
250# Networking options
251#
252# CONFIG_NETDEBUG is not set
253CONFIG_PACKET=y
254CONFIG_PACKET_MMAP=y
255CONFIG_UNIX=y
256CONFIG_XFRM=y
257# CONFIG_XFRM_USER is not set
258# CONFIG_NET_KEY is not set
259CONFIG_INET=y
260CONFIG_IP_MULTICAST=y
261# CONFIG_IP_ADVANCED_ROUTER is not set
262CONFIG_IP_FIB_HASH=y
263CONFIG_IP_PNP=y
264CONFIG_IP_PNP_DHCP=y
265CONFIG_IP_PNP_BOOTP=y
266# CONFIG_IP_PNP_RARP is not set
267# CONFIG_NET_IPIP is not set
268# CONFIG_NET_IPGRE is not set
269# CONFIG_IP_MROUTE is not set
270# CONFIG_SYN_COOKIES is not set
271# CONFIG_INET_AH is not set
272# CONFIG_INET_ESP is not set
273# CONFIG_INET_IPCOMP is not set
274# CONFIG_INET_XFRM_TUNNEL is not set
275# CONFIG_INET_TUNNEL is not set
276CONFIG_INET_XFRM_MODE_TRANSPORT=y
277CONFIG_INET_XFRM_MODE_TUNNEL=y
278CONFIG_INET_XFRM_MODE_BEET=y
279CONFIG_INET_DIAG=y
280CONFIG_INET_TCP_DIAG=y
281# CONFIG_TCP_CONG_ADVANCED is not set
282CONFIG_TCP_CONG_CUBIC=y
283CONFIG_DEFAULT_TCP_CONG="cubic"
284# CONFIG_IPV6 is not set
285# CONFIG_INET6_XFRM_TUNNEL is not set
286# CONFIG_INET6_TUNNEL is not set
287CONFIG_NETWORK_SECMARK=y
288# CONFIG_NETFILTER is not set
289# CONFIG_BRIDGE is not set
290# CONFIG_VLAN_8021Q is not set
291# CONFIG_DECNET is not set
292# CONFIG_LLC2 is not set
293# CONFIG_IPX is not set
294# CONFIG_ATALK is not set
295
296#
297# QoS and/or fair queueing
298#
299# CONFIG_NET_SCHED is not set
300
301#
302# Network testing
303#
304# CONFIG_NET_PKTGEN is not set
305# CONFIG_HAMRADIO is not set
306# CONFIG_IRDA is not set
307# CONFIG_BT is not set
308# CONFIG_IEEE80211 is not set
309
310#
311# Device Drivers
312#
313
314#
315# Generic Driver Options
316#
317CONFIG_STANDALONE=y
318# CONFIG_PREVENT_FIRMWARE_BUILD is not set
319# CONFIG_SYS_HYPERVISOR is not set
320
321#
322# Connector - unified userspace <-> kernelspace linker
323#
324CONFIG_CONNECTOR=y
325CONFIG_PROC_EVENTS=y
326
327#
328# Memory Technology Devices (MTD)
329#
330# CONFIG_MTD is not set
331
332#
333# Parallel port support
334#
335# CONFIG_PARPORT is not set
336
337#
338# Plug and Play support
339#
340# CONFIG_PNP is not set
341# CONFIG_PNPACPI is not set
342
343#
344# Block devices
345#
346# CONFIG_BLK_DEV_COW_COMMON is not set
347# CONFIG_BLK_DEV_LOOP is not set
348# CONFIG_BLK_DEV_NBD is not set
349# CONFIG_BLK_DEV_RAM is not set
350# CONFIG_BLK_DEV_INITRD is not set
351# CONFIG_CDROM_PKTCDVD is not set
352# CONFIG_ATA_OVER_ETH is not set
353
354#
355# Misc devices
356#
357
358#
359# ATA/ATAPI/MFM/RLL support
360#
361# CONFIG_IDE is not set
362
363#
364# SCSI device support
365#
366# CONFIG_RAID_ATTRS is not set
367# CONFIG_SCSI is not set
368# CONFIG_SCSI_NETLINK is not set
369
370#
371# Serial ATA (prod) and Parallel ATA (experimental) drivers
372#
373# CONFIG_ATA is not set
374
375#
376# Old CD-ROM drivers (not SCSI, not IDE)
377#
378# CONFIG_CD_NO_IDESCSI is not set
379
380#
381# Multi-device support (RAID and LVM)
382#
383# CONFIG_MD is not set
384
385#
386# Fusion MPT device support
387#
388# CONFIG_FUSION is not set
389
390#
391# IEEE 1394 (FireWire) support
392#
393
394#
395# I2O device support
396#
397
398#
399# Network device support
400#
401CONFIG_NETDEVICES=y
402# CONFIG_DUMMY is not set
403# CONFIG_BONDING is not set
404# CONFIG_EQUALIZER is not set
405# CONFIG_TUN is not set
406
407#
408# ARCnet devices
409#
410# CONFIG_ARCNET is not set
411
412#
413# PHY device support
414#
415# CONFIG_PHYLIB is not set
416
417#
418# Ethernet (10 or 100Mbit)
419#
420CONFIG_NET_ETHERNET=y
421# CONFIG_MII is not set
422# CONFIG_NET_VENDOR_3COM is not set
423# CONFIG_NET_VENDOR_SMC is not set
424# CONFIG_DM9000 is not set
425# CONFIG_NET_VENDOR_RACAL is not set
426# CONFIG_DEPCA is not set
427# CONFIG_HP100 is not set
428CONFIG_NET_ISA=y
429# CONFIG_E2100 is not set
430# CONFIG_EWRK3 is not set
431# CONFIG_EEXPRESS is not set
432# CONFIG_EEXPRESS_PRO is not set
433# CONFIG_HPLAN_PLUS is not set
434# CONFIG_HPLAN is not set
435# CONFIG_LP486E is not set
436# CONFIG_ETH16I is not set
437CONFIG_NE2000=y
438# CONFIG_NET_PCI is not set
439
440#
441# Ethernet (1000 Mbit)
442#
443
444#
445# Ethernet (10000 Mbit)
446#
447
448#
449# Token Ring devices
450#
451# CONFIG_TR is not set
452
453#
454# Wireless LAN (non-hamradio)
455#
456# CONFIG_NET_RADIO is not set
457
458#
459# Wan interfaces
460#
461# CONFIG_WAN is not set
462# CONFIG_PPP is not set
463# CONFIG_SLIP is not set
464# CONFIG_NETPOLL is not set
465# CONFIG_NET_POLL_CONTROLLER is not set
466
467#
468# ISDN subsystem
469#
470# CONFIG_ISDN is not set
471
472#
473# Telephony Support
474#
475# CONFIG_PHONE is not set
476
477#
478# Input device support
479#
480CONFIG_INPUT=y
481# CONFIG_INPUT_FF_MEMLESS is not set
482
483#
484# Userland interfaces
485#
486# CONFIG_INPUT_MOUSEDEV is not set
487# CONFIG_INPUT_JOYDEV is not set
488# CONFIG_INPUT_TSDEV is not set
489# CONFIG_INPUT_EVDEV is not set
490# CONFIG_INPUT_EVBUG is not set
491
492#
493# Input Device Drivers
494#
495# CONFIG_INPUT_KEYBOARD is not set
496# CONFIG_INPUT_MOUSE is not set
497# CONFIG_INPUT_JOYSTICK is not set
498# CONFIG_INPUT_TOUCHSCREEN is not set
499# CONFIG_INPUT_MISC is not set
500
501#
502# Hardware I/O ports
503#
504# CONFIG_SERIO is not set
505# CONFIG_GAMEPORT is not set
506
507#
508# Character devices
509#
510CONFIG_VT=y
511CONFIG_VT_CONSOLE=y
512CONFIG_HW_CONSOLE=y
513CONFIG_VT_HW_CONSOLE_BINDING=y
514# CONFIG_SERIAL_NONSTANDARD is not set
515
516#
517# Serial drivers
518#
519CONFIG_SERIAL_8250=y
520CONFIG_SERIAL_8250_CONSOLE=y
521CONFIG_SERIAL_8250_NR_UARTS=4
522CONFIG_SERIAL_8250_RUNTIME_UARTS=4
523# CONFIG_SERIAL_8250_EXTENDED is not set
524
525#
526# Non-8250 serial port support
527#
528CONFIG_SERIAL_CORE=y
529CONFIG_SERIAL_CORE_CONSOLE=y
530CONFIG_UNIX98_PTYS=y
531CONFIG_LEGACY_PTYS=y
532CONFIG_LEGACY_PTY_COUNT=256
533
534#
535# IPMI
536#
537# CONFIG_IPMI_HANDLER is not set
538
539#
540# Watchdog Cards
541#
542# CONFIG_WATCHDOG is not set
543# CONFIG_HW_RANDOM is not set
544# CONFIG_RTC is not set
545# CONFIG_GEN_RTC is not set
546# CONFIG_DTLK is not set
547# CONFIG_R3964 is not set
548# CONFIG_RAW_DRIVER is not set
549
550#
551# TPM devices
552#
553
554#
555# I2C support
556#
557# CONFIG_I2C is not set
558
559#
560# SPI support
561#
562# CONFIG_SPI is not set
563# CONFIG_SPI_MASTER is not set
564
565#
566# Dallas's 1-wire bus
567#
568# CONFIG_W1 is not set
569
570#
571# Hardware Monitoring support
572#
573# CONFIG_HWMON is not set
574# CONFIG_HWMON_VID is not set
575
576#
577# Multimedia devices
578#
579# CONFIG_VIDEO_DEV is not set
580
581#
582# Digital Video Broadcasting Devices
583#
584# CONFIG_DVB is not set
585
586#
587# Graphics support
588#
589# CONFIG_FIRMWARE_EDID is not set
590# CONFIG_FB is not set
591
592#
593# Console display driver support
594#
595CONFIG_VGA_CONSOLE=y
596# CONFIG_VGACON_SOFT_SCROLLBACK is not set
597# CONFIG_MDA_CONSOLE is not set
598CONFIG_DUMMY_CONSOLE=y
599# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
600
601#
602# Sound
603#
604# CONFIG_SOUND is not set
605
606#
607# HID Devices
608#
609CONFIG_HID=y
610# CONFIG_HID_DEBUG is not set
611
612#
613# USB support
614#
615# CONFIG_USB_ARCH_HAS_HCD is not set
616# CONFIG_USB_ARCH_HAS_OHCI is not set
617# CONFIG_USB_ARCH_HAS_EHCI is not set
618
619#
620# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
621#
622
623#
624# USB Gadget Support
625#
626# CONFIG_USB_GADGET is not set
627
628#
629# MMC/SD Card support
630#
631# CONFIG_MMC is not set
632
633#
634# LED devices
635#
636# CONFIG_NEW_LEDS is not set
637
638#
639# LED drivers
640#
641
642#
643# LED Triggers
644#
645
646#
647# InfiniBand support
648#
649
650#
651# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
652#
653
654#
655# Real Time Clock
656#
657
658#
659# DMA Engine support
660#
661# CONFIG_DMA_ENGINE is not set
662
663#
664# DMA Clients
665#
666
667#
668# DMA Devices
669#
670
671#
672# Auxiliary Display support
673#
674
675#
676# Virtualization
677#
678
679#
680# File systems
681#
682# CONFIG_EXT2_FS is not set
683# CONFIG_EXT3_FS is not set
684# CONFIG_REISERFS_FS is not set
685# CONFIG_JFS_FS is not set
686CONFIG_FS_POSIX_ACL=y
687# CONFIG_XFS_FS is not set
688# CONFIG_OCFS2_FS is not set
689# CONFIG_MINIX_FS is not set
690# CONFIG_ROMFS_FS is not set
691CONFIG_INOTIFY=y
692CONFIG_INOTIFY_USER=y
693# CONFIG_QUOTA is not set
694# CONFIG_DNOTIFY is not set
695# CONFIG_AUTOFS_FS is not set
696# CONFIG_AUTOFS4_FS is not set
697CONFIG_FUSE_FS=y
698CONFIG_GENERIC_ACL=y
699
700#
701# CD-ROM/DVD Filesystems
702#
703# CONFIG_ISO9660_FS is not set
704# CONFIG_UDF_FS is not set
705
706#
707# DOS/FAT/NT Filesystems
708#
709# CONFIG_MSDOS_FS is not set
710# CONFIG_VFAT_FS is not set
711# CONFIG_NTFS_FS is not set
712
713#
714# Pseudo filesystems
715#
716CONFIG_PROC_FS=y
717CONFIG_PROC_KCORE=y
718CONFIG_PROC_SYSCTL=y
719CONFIG_SYSFS=y
720CONFIG_TMPFS=y
721CONFIG_TMPFS_POSIX_ACL=y
722# CONFIG_HUGETLB_PAGE is not set
723CONFIG_RAMFS=y
724
725#
726# Miscellaneous filesystems
727#
728# CONFIG_HFSPLUS_FS is not set
729# CONFIG_CRAMFS is not set
730# CONFIG_VXFS_FS is not set
731# CONFIG_HPFS_FS is not set
732# CONFIG_QNX4FS_FS is not set
733# CONFIG_SYSV_FS is not set
734# CONFIG_UFS_FS is not set
735
736#
737# Network File Systems
738#
739CONFIG_NFS_FS=y
740CONFIG_NFS_V3=y
741# CONFIG_NFS_V3_ACL is not set
742CONFIG_NFS_DIRECTIO=y
743# CONFIG_NFSD is not set
744CONFIG_ROOT_NFS=y
745CONFIG_LOCKD=y
746CONFIG_LOCKD_V4=y
747CONFIG_NFS_COMMON=y
748CONFIG_SUNRPC=y
749# CONFIG_SMB_FS is not set
750# CONFIG_CIFS is not set
751# CONFIG_NCP_FS is not set
752# CONFIG_CODA_FS is not set
753
754#
755# Partition Types
756#
757# CONFIG_PARTITION_ADVANCED is not set
758CONFIG_MSDOS_PARTITION=y
759
760#
761# Native Language Support
762#
763# CONFIG_NLS is not set
764
765#
766# Kernel hacking
767#
768CONFIG_TRACE_IRQFLAGS_SUPPORT=y
769# CONFIG_PRINTK_TIME is not set
770CONFIG_ENABLE_MUST_CHECK=y
771# CONFIG_MAGIC_SYSRQ is not set
772# CONFIG_UNUSED_SYMBOLS is not set
773# CONFIG_DEBUG_FS is not set
774# CONFIG_HEADERS_CHECK is not set
775# CONFIG_DEBUG_KERNEL is not set
776CONFIG_LOG_BUF_SHIFT=14
777CONFIG_CROSSCOMPILE=y
778CONFIG_CMDLINE=""
779
780#
781# Security options
782#
783# CONFIG_KEYS is not set
784# CONFIG_SECURITY is not set
785
786#
787# Cryptographic options
788#
789# CONFIG_CRYPTO is not set
790
791#
792# Library routines
793#
794CONFIG_BITREVERSE=y
795# CONFIG_CRC_CCITT is not set
796# CONFIG_CRC16 is not set
797CONFIG_CRC32=y
798# CONFIG_LIBCRC32C is not set
799CONFIG_HAS_IOMEM=y
800CONFIG_HAS_IOPORT=y
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index 971adf6ef4f4..fb50cc78b28b 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -33,6 +33,7 @@ static struct irq_chip rm7k_irq_controller = {
33 .mask = mask_rm7k_irq, 33 .mask = mask_rm7k_irq,
34 .mask_ack = mask_rm7k_irq, 34 .mask_ack = mask_rm7k_irq,
35 .unmask = unmask_rm7k_irq, 35 .unmask = unmask_rm7k_irq,
36 .eoi = unmask_rm7k_irq
36}; 37};
37 38
38void __init rm7k_cpu_irq_init(void) 39void __init rm7k_cpu_irq_init(void)
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index 7b04583bd800..ed9febe63d72 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -75,6 +75,7 @@ static struct irq_chip rm9k_irq_controller = {
75 .mask = mask_rm9k_irq, 75 .mask = mask_rm9k_irq,
76 .mask_ack = mask_rm9k_irq, 76 .mask_ack = mask_rm9k_irq,
77 .unmask = unmask_rm9k_irq, 77 .unmask = unmask_rm9k_irq,
78 .eoi = unmask_rm9k_irq
78}; 79};
79 80
80static struct irq_chip rm9k_perfcounter_irq = { 81static struct irq_chip rm9k_perfcounter_irq = {
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index bb4f00c0cbe9..df4d3f2f740c 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -36,7 +36,7 @@ unsigned long mt_fpemul_threshold = 0;
36 */ 36 */
37static inline struct task_struct *find_process_by_pid(pid_t pid) 37static inline struct task_struct *find_process_by_pid(pid_t pid)
38{ 38{
39 return pid ? find_task_by_pid(pid) : current; 39 return pid ? find_task_by_vpid(pid) : current;
40} 40}
41 41
42 42
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index f798139e888e..08a9c5070ea8 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -663,6 +663,9 @@ einval: li v0, -EINVAL
663 sys sys_ni_syscall 0 663 sys sys_ni_syscall 0
664 sys sys_eventfd 1 664 sys sys_eventfd 1
665 sys sys_fallocate 6 /* 4320 */ 665 sys sys_fallocate 6 /* 4320 */
666 sys sys_timerfd_create 2
667 sys sys_timerfd_gettime 2
668 sys sys_timerfd_settime 4
666 .endm 669 .endm
667 670
668 /* We pre-compute the number of _instruction_ bytes needed to 671 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index a626be6baea3..dc597b600c68 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -478,4 +478,7 @@ sys_call_table:
478 PTR sys_ni_syscall 478 PTR sys_ni_syscall
479 PTR sys_eventfd 479 PTR sys_eventfd
480 PTR sys_fallocate 480 PTR sys_fallocate
481 PTR sys_timerfd_create /* 5280 */
482 PTR sys_timerfd_gettime
483 PTR sys_timerfd_settime
481 .size sys_call_table,.-sys_call_table 484 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 9d5bcaf1b389..12940eca7893 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -404,4 +404,7 @@ EXPORT(sysn32_call_table)
404 PTR sys_ni_syscall 404 PTR sys_ni_syscall
405 PTR sys_eventfd 405 PTR sys_eventfd
406 PTR sys_fallocate 406 PTR sys_fallocate
407 PTR sys_timerfd_create
408 PTR sys_timerfd_gettime /* 5285 */
409 PTR sys_timerfd_settime
407 .size sysn32_call_table,.-sysn32_call_table 410 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index fd2019c1ec2d..9a275efb4f04 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -526,4 +526,7 @@ sys_call_table:
526 PTR sys_ni_syscall 526 PTR sys_ni_syscall
527 PTR sys_eventfd 527 PTR sys_eventfd
528 PTR sys32_fallocate /* 4320 */ 528 PTR sys32_fallocate /* 4320 */
529 PTR sys_timerfd_create
530 PTR sys_timerfd_gettime
531 PTR sys_timerfd_settime
529 .size sys_call_table,.-sys_call_table 532 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index d70c4e0e85fb..c357762b8012 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -111,7 +111,7 @@ asmlinkage int irix_prctl(unsigned option, ...)
111 printk("irix_prctl[%s:%d]: Wants PR_ISBLOCKED\n", 111 printk("irix_prctl[%s:%d]: Wants PR_ISBLOCKED\n",
112 current->comm, current->pid); 112 current->comm, current->pid);
113 read_lock(&tasklist_lock); 113 read_lock(&tasklist_lock);
114 task = find_task_by_pid(va_arg(args, pid_t)); 114 task = find_task_by_vpid(va_arg(args, pid_t));
115 error = -ESRCH; 115 error = -ESRCH;
116 if (error) 116 if (error)
117 error = (task->run_list.next != NULL); 117 error = (task->run_list.next != NULL);
@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __user *path,
694 if (error) 694 if (error)
695 goto out; 695 goto out;
696 696
697 error = vfs_statfs(nd.dentry, &kbuf); 697 error = vfs_statfs(nd.path.dentry, &kbuf);
698 if (error) 698 if (error)
699 goto dput_and_out; 699 goto dput_and_out;
700 700
@@ -711,7 +711,7 @@ asmlinkage int irix_statfs(const char __user *path,
711 } 711 }
712 712
713dput_and_out: 713dput_and_out:
714 path_release(&nd); 714 path_put(&nd.path);
715out: 715out:
716 return error; 716 return error;
717} 717}
@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
1360 error = user_path_walk(fname, &nd); 1360 error = user_path_walk(fname, &nd);
1361 if (error) 1361 if (error)
1362 goto out; 1362 goto out;
1363 error = vfs_statfs(nd.dentry, &kbuf); 1363 error = vfs_statfs(nd.path.dentry, &kbuf);
1364 if (error) 1364 if (error)
1365 goto dput_and_out; 1365 goto dput_and_out;
1366 1366
@@ -1385,7 +1385,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
1385 error |= __put_user(0, &buf->f_fstr[i]); 1385 error |= __put_user(0, &buf->f_fstr[i]);
1386 1386
1387dput_and_out: 1387dput_and_out:
1388 path_release(&nd); 1388 path_put(&nd.path);
1389out: 1389out:
1390 return error; 1390 return error;
1391} 1391}
@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
1611 error = user_path_walk(fname, &nd); 1611 error = user_path_walk(fname, &nd);
1612 if (error) 1612 if (error)
1613 goto out; 1613 goto out;
1614 error = vfs_statfs(nd.dentry, &kbuf); 1614 error = vfs_statfs(nd.path.dentry, &kbuf);
1615 if (error) 1615 if (error)
1616 goto dput_and_out; 1616 goto dput_and_out;
1617 1617
@@ -1636,7 +1636,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
1636 error |= __put_user(0, &buf->f_fstr[i]); 1636 error |= __put_user(0, &buf->f_fstr[i]);
1637 1637
1638dput_and_out: 1638dput_and_out:
1639 path_release(&nd); 1639 path_put(&nd.path);
1640out: 1640out:
1641 return error; 1641 return error;
1642} 1642}
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 53ec05267a98..2c4f7e11f0d5 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -364,20 +364,23 @@ static inline int has_valid_asid(const struct mm_struct *mm)
364static inline void local_r4k_flush_cache_range(void * args) 364static inline void local_r4k_flush_cache_range(void * args)
365{ 365{
366 struct vm_area_struct *vma = args; 366 struct vm_area_struct *vma = args;
367 int exec = vma->vm_flags & VM_EXEC;
367 368
368 if (!(has_valid_asid(vma->vm_mm))) 369 if (!(has_valid_asid(vma->vm_mm)))
369 return; 370 return;
370 371
371 r4k_blast_dcache(); 372 r4k_blast_dcache();
373 if (exec)
374 r4k_blast_icache();
372} 375}
373 376
374static void r4k_flush_cache_range(struct vm_area_struct *vma, 377static void r4k_flush_cache_range(struct vm_area_struct *vma,
375 unsigned long start, unsigned long end) 378 unsigned long start, unsigned long end)
376{ 379{
377 if (!cpu_has_dc_aliases) 380 int exec = vma->vm_flags & VM_EXEC;
378 return;
379 381
380 r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1); 382 if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc))
383 r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1);
381} 384}
382 385
383static inline void local_r4k_flush_cache_mm(void * args) 386static inline void local_r4k_flush_cache_mm(void * args)
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 81f30ac2bff9..6a24651971df 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -92,12 +92,17 @@ EXPORT_SYMBOL(__flush_dcache_page);
92 92
93void __flush_anon_page(struct page *page, unsigned long vmaddr) 93void __flush_anon_page(struct page *page, unsigned long vmaddr)
94{ 94{
95 if (pages_do_alias((unsigned long)page_address(page), vmaddr)) { 95 unsigned long addr = (unsigned long) page_address(page);
96 void *kaddr;
97 96
98 kaddr = kmap_coherent(page, vmaddr); 97 if (pages_do_alias(addr, vmaddr)) {
99 flush_data_cache_page((unsigned long)kaddr); 98 if (page_mapped(page) && !Page_dcache_dirty(page)) {
100 kunmap_coherent(); 99 void *kaddr;
100
101 kaddr = kmap_coherent(page, vmaddr);
102 flush_data_cache_page((unsigned long)kaddr);
103 kunmap_coherent();
104 } else
105 flush_data_cache_page(addr);
101 } 106 }
102} 107}
103 108
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 480dec04f552..c7aed133d11d 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -211,7 +211,8 @@ void copy_user_highpage(struct page *to, struct page *from,
211 void *vfrom, *vto; 211 void *vfrom, *vto;
212 212
213 vto = kmap_atomic(to, KM_USER1); 213 vto = kmap_atomic(to, KM_USER1);
214 if (cpu_has_dc_aliases && page_mapped(from)) { 214 if (cpu_has_dc_aliases &&
215 page_mapped(from) && !Page_dcache_dirty(from)) {
215 vfrom = kmap_coherent(from, vaddr); 216 vfrom = kmap_coherent(from, vaddr);
216 copy_page(vto, vfrom); 217 copy_page(vto, vfrom);
217 kunmap_coherent(); 218 kunmap_coherent();
@@ -234,7 +235,8 @@ void copy_to_user_page(struct vm_area_struct *vma,
234 struct page *page, unsigned long vaddr, void *dst, const void *src, 235 struct page *page, unsigned long vaddr, void *dst, const void *src,
235 unsigned long len) 236 unsigned long len)
236{ 237{
237 if (cpu_has_dc_aliases && page_mapped(page)) { 238 if (cpu_has_dc_aliases &&
239 page_mapped(page) && !Page_dcache_dirty(page)) {
238 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 240 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
239 memcpy(vto, src, len); 241 memcpy(vto, src, len);
240 kunmap_coherent(); 242 kunmap_coherent();
@@ -253,7 +255,8 @@ void copy_from_user_page(struct vm_area_struct *vma,
253 struct page *page, unsigned long vaddr, void *dst, const void *src, 255 struct page *page, unsigned long vaddr, void *dst, const void *src,
254 unsigned long len) 256 unsigned long len)
255{ 257{
256 if (cpu_has_dc_aliases && page_mapped(page)) { 258 if (cpu_has_dc_aliases &&
259 page_mapped(page) && !Page_dcache_dirty(page)) {
257 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 260 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
258 memcpy(dst, vfrom, len); 261 memcpy(dst, vfrom, len);
259 kunmap_coherent(); 262 kunmap_coherent();
diff --git a/arch/mips/mm/pg-sb1.c b/arch/mips/mm/pg-sb1.c
index a3e98c243a89..89925ec57d6a 100644
--- a/arch/mips/mm/pg-sb1.c
+++ b/arch/mips/mm/pg-sb1.c
@@ -216,7 +216,7 @@ void sb1_dma_init(void)
216 int i; 216 int i;
217 217
218 for (i = 0; i < DM_NUM_CHANNELS; i++) { 218 for (i = 0; i < DM_NUM_CHANNELS; i++) {
219 const u64 base_val = CPHYSADDR(&page_descr[i]) | 219 const u64 base_val = CPHYSADDR((unsigned long)&page_descr[i]) |
220 V_DM_DSCR_BASE_RINGSZ(1); 220 V_DM_DSCR_BASE_RINGSZ(1);
221 void *base_reg = IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE)); 221 void *base_reg = IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE));
222 222
@@ -228,11 +228,11 @@ void sb1_dma_init(void)
228 228
229void clear_page(void *page) 229void clear_page(void *page)
230{ 230{
231 u64 to_phys = CPHYSADDR(page); 231 u64 to_phys = CPHYSADDR((unsigned long)page);
232 unsigned int cpu = smp_processor_id(); 232 unsigned int cpu = smp_processor_id();
233 233
234 /* if the page is not in KSEG0, use old way */ 234 /* if the page is not in KSEG0, use old way */
235 if ((long)KSEGX(page) != (long)CKSEG0) 235 if ((long)KSEGX((unsigned long)page) != (long)CKSEG0)
236 return clear_page_cpu(page); 236 return clear_page_cpu(page);
237 237
238 page_descr[cpu].dscr_a = to_phys | M_DM_DSCRA_ZERO_MEM | 238 page_descr[cpu].dscr_a = to_phys | M_DM_DSCRA_ZERO_MEM |
@@ -252,13 +252,13 @@ void clear_page(void *page)
252 252
253void copy_page(void *to, void *from) 253void copy_page(void *to, void *from)
254{ 254{
255 u64 from_phys = CPHYSADDR(from); 255 u64 from_phys = CPHYSADDR((unsigned long)from);
256 u64 to_phys = CPHYSADDR(to); 256 u64 to_phys = CPHYSADDR((unsigned long)to);
257 unsigned int cpu = smp_processor_id(); 257 unsigned int cpu = smp_processor_id();
258 258
259 /* if any page is not in KSEG0, use old way */ 259 /* if any page is not in KSEG0, use old way */
260 if ((long)KSEGX(to) != (long)CKSEG0 260 if ((long)KSEGX((unsigned long)to) != (long)CKSEG0
261 || (long)KSEGX(from) != (long)CKSEG0) 261 || (long)KSEGX((unsigned long)from) != (long)CKSEG0)
262 return copy_page_cpu(to, from); 262 return copy_page_cpu(to, from);
263 263
264 page_descr[cpu].dscr_a = to_phys | M_DM_DSCRA_L2C_DEST | 264 page_descr[cpu].dscr_a = to_phys | M_DM_DSCRA_L2C_DEST |
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 6e6981fd7934..f9471d77c096 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -177,8 +177,15 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
177 continue; 177 continue;
178 178
179 r = &dev->resource[idx]; 179 r = &dev->resource[idx];
180 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
181 continue;
182 if ((idx == PCI_ROM_RESOURCE) &&
183 (!(r->flags & IORESOURCE_ROM_ENABLE)))
184 continue;
180 if (!r->start && r->end) { 185 if (!r->start && r->end) {
181 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); 186 printk(KERN_ERR "PCI: Device %s not available "
187 "because of resource collisions\n",
188 pci_name(dev));
182 return -EINVAL; 189 return -EINVAL;
183 } 190 }
184 if (r->flags & IORESOURCE_IO) 191 if (r->flags & IORESOURCE_IO)
@@ -186,10 +193,9 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
186 if (r->flags & IORESOURCE_MEM) 193 if (r->flags & IORESOURCE_MEM)
187 cmd |= PCI_COMMAND_MEMORY; 194 cmd |= PCI_COMMAND_MEMORY;
188 } 195 }
189 if (dev->resource[PCI_ROM_RESOURCE].start)
190 cmd |= PCI_COMMAND_MEMORY;
191 if (cmd != old_cmd) { 196 if (cmd != old_cmd) {
192 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); 197 printk("PCI: Enabling device %s (%04x -> %04x)\n",
198 pci_name(dev), old_cmd, cmd);
193 pci_write_config_word(dev, PCI_COMMAND, cmd); 199 pci_write_config_word(dev, PCI_COMMAND, cmd);
194 } 200 }
195 return 0; 201 return 0;
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index 183c460b9ca1..bd9eeb43ed0e 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -110,7 +110,6 @@ static void __cpuinit bcm1480_smp_finish(void)
110 110
111 sb1480_clockevent_init(); 111 sb1480_clockevent_init();
112 local_irq_enable(); 112 local_irq_enable();
113 bcm1480_smp_finish();
114} 113}
115 114
116/* 115/*
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index eedc3a5e0d9b..6a6409adc564 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -63,6 +63,10 @@ config GENERIC_HARDIRQS
63config HOTPLUG_CPU 63config HOTPLUG_CPU
64 def_bool n 64 def_bool n
65 65
66config HZ
67 int
68 default 1000
69
66mainmenu "Matsushita MN10300/AM33 Kernel Configuration" 70mainmenu "Matsushita MN10300/AM33 Kernel Configuration"
67 71
68source "init/Kconfig" 72source "init/Kconfig"
diff --git a/arch/mn10300/configs/asb2303_defconfig b/arch/mn10300/configs/asb2303_defconfig
index ca9876a111d3..3aa8906b3dea 100644
--- a/arch/mn10300/configs/asb2303_defconfig
+++ b/arch/mn10300/configs/asb2303_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.24-rc2 3# Linux kernel version: 2.6.25-rc2
4# Fri Nov 16 13:36:38 2007 4# Tue Feb 19 18:52:24 2008
5# 5#
6CONFIG_MN10300=y 6CONFIG_MN10300=y
7CONFIG_AM33=y 7CONFIG_AM33=y
@@ -21,6 +21,7 @@ CONFIG_ARCH_HAS_ILOG2_U32=y
21# CONFIG_ARCH_SUPPORTS_AOUT is not set 21# CONFIG_ARCH_SUPPORTS_AOUT is not set
22CONFIG_GENERIC_HARDIRQS=y 22CONFIG_GENERIC_HARDIRQS=y
23# CONFIG_HOTPLUG_CPU is not set 23# CONFIG_HOTPLUG_CPU is not set
24CONFIG_HZ=1000
24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25 26
26# 27#
@@ -38,15 +39,16 @@ CONFIG_SYSVIPC_SYSCTL=y
38CONFIG_BSD_PROCESS_ACCT=y 39CONFIG_BSD_PROCESS_ACCT=y
39# CONFIG_BSD_PROCESS_ACCT_V3 is not set 40# CONFIG_BSD_PROCESS_ACCT_V3 is not set
40# CONFIG_TASKSTATS is not set 41# CONFIG_TASKSTATS is not set
41# CONFIG_USER_NS is not set
42# CONFIG_PID_NS is not set
43# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
44# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
45CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
46# CONFIG_CGROUPS is not set 45# CONFIG_CGROUPS is not set
47# CONFIG_FAIR_GROUP_SCHED is not set 46# CONFIG_GROUP_SCHED is not set
47# CONFIG_USER_SCHED is not set
48# CONFIG_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
51# CONFIG_NAMESPACES is not set
50# CONFIG_BLK_DEV_INITRD is not set 52# CONFIG_BLK_DEV_INITRD is not set
51# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 53# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
52CONFIG_SYSCTL=y 54CONFIG_SYSCTL=y
@@ -57,22 +59,33 @@ CONFIG_SYSCTL_SYSCALL=y
57CONFIG_PRINTK=y 59CONFIG_PRINTK=y
58CONFIG_BUG=y 60CONFIG_BUG=y
59CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62CONFIG_COMPAT_BRK=y
60CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
61CONFIG_FUTEX=y 64CONFIG_FUTEX=y
62CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
63CONFIG_EPOLL=y 66CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
65CONFIG_EVENTFD=y 69CONFIG_EVENTFD=y
66CONFIG_SHMEM=y 70CONFIG_SHMEM=y
67# CONFIG_VM_EVENT_COUNTERS is not set 71# CONFIG_VM_EVENT_COUNTERS is not set
68CONFIG_SLAB=y 72CONFIG_SLAB=y
69# CONFIG_SLUB is not set 73# CONFIG_SLUB is not set
70# CONFIG_SLOB is not set 74# CONFIG_SLOB is not set
75CONFIG_PROFILING=y
76# CONFIG_MARKERS is not set
77CONFIG_OPROFILE=y
78# CONFIG_HAVE_OPROFILE is not set
79# CONFIG_HAVE_KPROBES is not set
80# CONFIG_PROC_PAGE_MONITOR is not set
81CONFIG_SLABINFO=y
71CONFIG_RT_MUTEXES=y 82CONFIG_RT_MUTEXES=y
72# CONFIG_TINY_SHMEM is not set 83# CONFIG_TINY_SHMEM is not set
73CONFIG_BASE_SMALL=0 84CONFIG_BASE_SMALL=0
74# CONFIG_MODULES is not set 85# CONFIG_MODULES is not set
75# CONFIG_BLOCK is not set 86# CONFIG_BLOCK is not set
87CONFIG_CLASSIC_RCU=y
88# CONFIG_PREEMPT_RCU is not set
76 89
77# 90#
78# Matsushita MN10300 system setup 91# Matsushita MN10300 system setup
@@ -206,6 +219,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
206# 219#
207# CONFIG_NET_PKTGEN is not set 220# CONFIG_NET_PKTGEN is not set
208# CONFIG_HAMRADIO is not set 221# CONFIG_HAMRADIO is not set
222# CONFIG_CAN is not set
209# CONFIG_IRDA is not set 223# CONFIG_IRDA is not set
210# CONFIG_BT is not set 224# CONFIG_BT is not set
211# CONFIG_AF_RXRPC is not set 225# CONFIG_AF_RXRPC is not set
@@ -311,6 +325,8 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
311# CONFIG_PARPORT is not set 325# CONFIG_PARPORT is not set
312CONFIG_MISC_DEVICES=y 326CONFIG_MISC_DEVICES=y
313# CONFIG_EEPROM_93CX6 is not set 327# CONFIG_EEPROM_93CX6 is not set
328# CONFIG_ENCLOSURE_SERVICES is not set
329# CONFIG_HAVE_IDE is not set
314 330
315# 331#
316# SCSI device support 332# SCSI device support
@@ -345,7 +361,6 @@ CONFIG_SMC91X=y
345# CONFIG_WAN is not set 361# CONFIG_WAN is not set
346# CONFIG_PPP is not set 362# CONFIG_PPP is not set
347# CONFIG_SLIP is not set 363# CONFIG_SLIP is not set
348# CONFIG_SHAPER is not set
349# CONFIG_NETCONSOLE is not set 364# CONFIG_NETCONSOLE is not set
350# CONFIG_NETPOLL is not set 365# CONFIG_NETPOLL is not set
351# CONFIG_NET_POLL_CONTROLLER is not set 366# CONFIG_NET_POLL_CONTROLLER is not set
@@ -405,6 +420,7 @@ CONFIG_RTC=y
405# CONFIG_W1 is not set 420# CONFIG_W1 is not set
406# CONFIG_POWER_SUPPLY is not set 421# CONFIG_POWER_SUPPLY is not set
407# CONFIG_HWMON is not set 422# CONFIG_HWMON is not set
423# CONFIG_THERMAL is not set
408# CONFIG_WATCHDOG is not set 424# CONFIG_WATCHDOG is not set
409 425
410# 426#
@@ -444,6 +460,7 @@ CONFIG_SSB_POSSIBLE=y
444# CONFIG_SOUND is not set 460# CONFIG_SOUND is not set
445# CONFIG_USB_SUPPORT is not set 461# CONFIG_USB_SUPPORT is not set
446# CONFIG_MMC is not set 462# CONFIG_MMC is not set
463# CONFIG_MEMSTICK is not set
447# CONFIG_NEW_LEDS is not set 464# CONFIG_NEW_LEDS is not set
448# CONFIG_RTC_CLASS is not set 465# CONFIG_RTC_CLASS is not set
449 466
@@ -455,10 +472,10 @@ CONFIG_SSB_POSSIBLE=y
455# 472#
456# File systems 473# File systems
457# 474#
475CONFIG_DNOTIFY=y
458CONFIG_INOTIFY=y 476CONFIG_INOTIFY=y
459CONFIG_INOTIFY_USER=y 477CONFIG_INOTIFY_USER=y
460# CONFIG_QUOTA is not set 478# CONFIG_QUOTA is not set
461CONFIG_DNOTIFY=y
462# CONFIG_AUTOFS_FS is not set 479# CONFIG_AUTOFS_FS is not set
463# CONFIG_AUTOFS4_FS is not set 480# CONFIG_AUTOFS4_FS is not set
464# CONFIG_FUSE_FS is not set 481# CONFIG_FUSE_FS is not set
@@ -554,5 +571,3 @@ CONFIG_HAS_DMA=y
554# 571#
555# Profiling support 572# Profiling support
556# 573#
557CONFIG_PROFILING=y
558CONFIG_OPROFILE=y
diff --git a/arch/mn10300/kernel/gdb-io-ttysm.c b/arch/mn10300/kernel/gdb-io-ttysm.c
index c5451592d403..e94c25e8ca05 100644
--- a/arch/mn10300/kernel/gdb-io-ttysm.c
+++ b/arch/mn10300/kernel/gdb-io-ttysm.c
@@ -196,6 +196,7 @@ int gdbstub_io_rx_char(unsigned char *_ch, int nonblock)
196try_again: 196try_again:
197 /* pull chars out of the buffer */ 197 /* pull chars out of the buffer */
198 ix = gdbstub_rx_outp; 198 ix = gdbstub_rx_outp;
199 barrier();
199 if (ix == gdbstub_rx_inp) { 200 if (ix == gdbstub_rx_inp) {
200 if (nonblock) 201 if (nonblock)
201 return -EAGAIN; 202 return -EAGAIN;
@@ -207,6 +208,7 @@ try_again:
207 208
208 ch = gdbstub_rx_buffer[ix++]; 209 ch = gdbstub_rx_buffer[ix++];
209 st = gdbstub_rx_buffer[ix++]; 210 st = gdbstub_rx_buffer[ix++];
211 barrier();
210 gdbstub_rx_outp = ix & (PAGE_SIZE - 1); 212 gdbstub_rx_outp = ix & (PAGE_SIZE - 1);
211 213
212 st &= SC01STR_RXF | SC01STR_RBF | SC01STR_FEF | SC01STR_PEF | 214 st &= SC01STR_RXF | SC01STR_RBF | SC01STR_FEF | SC01STR_PEF |
diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c
index ff492e3b3457..babb7c2ac377 100644
--- a/arch/mn10300/kernel/time.c
+++ b/arch/mn10300/kernel/time.c
@@ -84,11 +84,13 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
84 /* advance the kernel's time tracking system */ 84 /* advance the kernel's time tracking system */
85 profile_tick(CPU_PROFILING); 85 profile_tick(CPU_PROFILING);
86 do_timer(1); 86 do_timer(1);
87 update_process_times(user_mode(get_irq_regs()));
88 check_rtc_time(); 87 check_rtc_time();
89 } 88 }
90 89
91 write_sequnlock(&xtime_lock); 90 write_sequnlock(&xtime_lock);
91
92 update_process_times(user_mode(get_irq_regs()));
93
92 return IRQ_HANDLED; 94 return IRQ_HANDLED;
93} 95}
94 96
diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c
index 8b9dc6d9dcc6..fcb9a03d46a8 100644
--- a/arch/mn10300/kernel/traps.c
+++ b/arch/mn10300/kernel/traps.c
@@ -391,7 +391,7 @@ static asmlinkage void unsupported_syscall(struct pt_regs *regs,
391 if (code == EXCEP_SYSCALL15 && !user_mode(regs)) { 391 if (code == EXCEP_SYSCALL15 && !user_mode(regs)) {
392 if (report_bug(regs->pc, regs) == BUG_TRAP_TYPE_BUG) { 392 if (report_bug(regs->pc, regs) == BUG_TRAP_TYPE_BUG) {
393#ifdef CONFIG_GDBSTUB 393#ifdef CONFIG_GDBSTUB
394 __gdbstub_bug_trap(); 394 gdbstub_intercept(regs, code);
395#endif 395#endif
396 } 396 }
397 } 397 }
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index 3e025df2dc86..0c5b9dabb475 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -219,10 +219,10 @@ asmlinkage long hpux_statfs(const char __user *path,
219 error = user_path_walk(path, &nd); 219 error = user_path_walk(path, &nd);
220 if (!error) { 220 if (!error) {
221 struct hpux_statfs tmp; 221 struct hpux_statfs tmp;
222 error = vfs_statfs_hpux(nd.dentry, &tmp); 222 error = vfs_statfs_hpux(nd.path.dentry, &tmp);
223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 223 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
224 error = -EFAULT; 224 error = -EFAULT;
225 path_release(&nd); 225 path_put(&nd.path);
226 } 226 }
227 return error; 227 return error;
228} 228}
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 485513c9f1af..5b8d8382b762 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -442,10 +442,6 @@ config SECCOMP
442 442
443 If unsure, say Y. Only embedded should say N here. 443 If unsure, say Y. Only embedded should say N here.
444 444
445config WANT_DEVICE_TREE
446 bool
447 default n
448
449endmenu 445endmenu
450 446
451config ISA_DMA_API 447config ISA_DMA_API
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 6845482f0093..1c6ce3536e4c 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -176,7 +176,7 @@ define archhelp
176 @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 176 @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs'
177endef 177endef
178 178
179install: vdso_install 179install:
180 $(Q)$(MAKE) $(build)=$(boot) install 180 $(Q)$(MAKE) $(build)=$(boot) install
181 181
182vdso_install: 182vdso_install:
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 49797a45416c..e3993a607584 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -35,10 +35,10 @@ endif
35 35
36BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt 36BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt
37 37
38$(obj)/4xx.o: BOOTCFLAGS += -mcpu=440 38$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
39$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440 39$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
40$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440 40$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
41$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440 41$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
42$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405 42$(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
43 43
44 44
@@ -147,6 +147,8 @@ HOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/
147targets += dtc-src/dtc-parser.tab.c 147targets += dtc-src/dtc-parser.tab.c
148targets += dtc-src/dtc-lexer.lex.c 148targets += dtc-src/dtc-lexer.lex.c
149 149
150clean-files += dtc-src/dtc-parser.tab.h
151
150ifdef DTC_GENPARSER 152ifdef DTC_GENPARSER
151BISON = bison 153BISON = bison
152FLEX = flex 154FLEX = flex
diff --git a/arch/powerpc/boot/dts/bamboo.dts b/arch/powerpc/boot/dts/bamboo.dts
index 29f1a6f3e373..7dc37c9a7446 100644
--- a/arch/powerpc/boot/dts/bamboo.dts
+++ b/arch/powerpc/boot/dts/bamboo.dts
@@ -185,7 +185,6 @@
185 }; 185 };
186 186
187 IIC0: i2c@ef600700 { 187 IIC0: i2c@ef600700 {
188 device_type = "i2c";
189 compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic"; 188 compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic";
190 reg = <ef600700 14>; 189 reg = <ef600700 14>;
191 interrupt-parent = <&UIC0>; 190 interrupt-parent = <&UIC0>;
@@ -193,7 +192,6 @@
193 }; 192 };
194 193
195 IIC1: i2c@ef600800 { 194 IIC1: i2c@ef600800 {
196 device_type = "i2c";
197 compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic"; 195 compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic";
198 reg = <ef600800 14>; 196 reg = <ef600800 14>;
199 interrupt-parent = <&UIC0>; 197 interrupt-parent = <&UIC0>;
@@ -201,7 +199,6 @@
201 }; 199 };
202 200
203 ZMII0: emac-zmii@ef600d00 { 201 ZMII0: emac-zmii@ef600d00 {
204 device_type = "zmii-interface";
205 compatible = "ibm,zmii-440ep", "ibm,zmii-440gp", "ibm,zmii"; 202 compatible = "ibm,zmii-440ep", "ibm,zmii-440gp", "ibm,zmii";
206 reg = <ef600d00 c>; 203 reg = <ef600d00 c>;
207 }; 204 };
diff --git a/arch/powerpc/boot/dts/ebony.dts b/arch/powerpc/boot/dts/ebony.dts
index 7aad135a44b0..0b000cb7ed8b 100644
--- a/arch/powerpc/boot/dts/ebony.dts
+++ b/arch/powerpc/boot/dts/ebony.dts
@@ -216,7 +216,6 @@
216 216
217 IIC0: i2c@40000400 { 217 IIC0: i2c@40000400 {
218 /* FIXME */ 218 /* FIXME */
219 device_type = "i2c";
220 compatible = "ibm,iic-440gp", "ibm,iic"; 219 compatible = "ibm,iic-440gp", "ibm,iic";
221 reg = <40000400 14>; 220 reg = <40000400 14>;
222 interrupt-parent = <&UIC0>; 221 interrupt-parent = <&UIC0>;
@@ -224,7 +223,6 @@
224 }; 223 };
225 IIC1: i2c@40000500 { 224 IIC1: i2c@40000500 {
226 /* FIXME */ 225 /* FIXME */
227 device_type = "i2c";
228 compatible = "ibm,iic-440gp", "ibm,iic"; 226 compatible = "ibm,iic-440gp", "ibm,iic";
229 reg = <40000500 14>; 227 reg = <40000500 14>;
230 interrupt-parent = <&UIC0>; 228 interrupt-parent = <&UIC0>;
diff --git a/arch/powerpc/boot/dts/katmai.dts b/arch/powerpc/boot/dts/katmai.dts
index 9bdfc0ff3c24..bc32ac7250ec 100644
--- a/arch/powerpc/boot/dts/katmai.dts
+++ b/arch/powerpc/boot/dts/katmai.dts
@@ -187,7 +187,6 @@
187 }; 187 };
188 188
189 IIC0: i2c@10000400 { 189 IIC0: i2c@10000400 {
190 device_type = "i2c";
191 compatible = "ibm,iic-440spe", "ibm,iic-440gp", "ibm,iic"; 190 compatible = "ibm,iic-440spe", "ibm,iic-440gp", "ibm,iic";
192 reg = <10000400 14>; 191 reg = <10000400 14>;
193 interrupt-parent = <&UIC0>; 192 interrupt-parent = <&UIC0>;
@@ -195,7 +194,6 @@
195 }; 194 };
196 195
197 IIC1: i2c@10000500 { 196 IIC1: i2c@10000500 {
198 device_type = "i2c";
199 compatible = "ibm,iic-440spe", "ibm,iic-440gp", "ibm,iic"; 197 compatible = "ibm,iic-440spe", "ibm,iic-440gp", "ibm,iic";
200 reg = <10000500 14>; 198 reg = <10000500 14>;
201 interrupt-parent = <&UIC0>; 199 interrupt-parent = <&UIC0>;
diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
index 67c7ea179a07..8baef61f31cd 100644
--- a/arch/powerpc/boot/dts/kilauea.dts
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -182,7 +182,6 @@
182 }; 182 };
183 183
184 IIC0: i2c@ef600400 { 184 IIC0: i2c@ef600400 {
185 device_type = "i2c";
186 compatible = "ibm,iic-405ex", "ibm,iic"; 185 compatible = "ibm,iic-405ex", "ibm,iic";
187 reg = <ef600400 14>; 186 reg = <ef600400 14>;
188 interrupt-parent = <&UIC0>; 187 interrupt-parent = <&UIC0>;
@@ -190,7 +189,6 @@
190 }; 189 };
191 190
192 IIC1: i2c@ef600500 { 191 IIC1: i2c@ef600500 {
193 device_type = "i2c";
194 compatible = "ibm,iic-405ex", "ibm,iic"; 192 compatible = "ibm,iic-405ex", "ibm,iic";
195 reg = <ef600500 14>; 193 reg = <ef600500 14>;
196 interrupt-parent = <&UIC0>; 194 interrupt-parent = <&UIC0>;
@@ -199,7 +197,6 @@
199 197
200 198
201 RGMII0: emac-rgmii@ef600b00 { 199 RGMII0: emac-rgmii@ef600b00 {
202 device_type = "rgmii-interface";
203 compatible = "ibm,rgmii-405ex", "ibm,rgmii"; 200 compatible = "ibm,rgmii-405ex", "ibm,rgmii";
204 reg = <ef600b00 104>; 201 reg = <ef600b00 104>;
205 has-mdio; 202 has-mdio;
diff --git a/arch/powerpc/boot/dts/makalu.dts b/arch/powerpc/boot/dts/makalu.dts
index bdd70e4596ae..710c01168179 100644
--- a/arch/powerpc/boot/dts/makalu.dts
+++ b/arch/powerpc/boot/dts/makalu.dts
@@ -182,7 +182,6 @@
182 }; 182 };
183 183
184 IIC0: i2c@ef600400 { 184 IIC0: i2c@ef600400 {
185 device_type = "i2c";
186 compatible = "ibm,iic-405ex", "ibm,iic"; 185 compatible = "ibm,iic-405ex", "ibm,iic";
187 reg = <ef600400 14>; 186 reg = <ef600400 14>;
188 interrupt-parent = <&UIC0>; 187 interrupt-parent = <&UIC0>;
@@ -190,7 +189,6 @@
190 }; 189 };
191 190
192 IIC1: i2c@ef600500 { 191 IIC1: i2c@ef600500 {
193 device_type = "i2c";
194 compatible = "ibm,iic-405ex", "ibm,iic"; 192 compatible = "ibm,iic-405ex", "ibm,iic";
195 reg = <ef600500 14>; 193 reg = <ef600500 14>;
196 interrupt-parent = <&UIC0>; 194 interrupt-parent = <&UIC0>;
@@ -199,7 +197,6 @@
199 197
200 198
201 RGMII0: emac-rgmii@ef600b00 { 199 RGMII0: emac-rgmii@ef600b00 {
202 device_type = "rgmii-interface";
203 compatible = "ibm,rgmii-405ex", "ibm,rgmii"; 200 compatible = "ibm,rgmii-405ex", "ibm,rgmii";
204 reg = <ef600b00 104>; 201 reg = <ef600b00 104>;
205 has-mdio; 202 has-mdio;
diff --git a/arch/powerpc/boot/dts/rainier.dts b/arch/powerpc/boot/dts/rainier.dts
index d3c2ac394ce9..f947c75a2e94 100644
--- a/arch/powerpc/boot/dts/rainier.dts
+++ b/arch/powerpc/boot/dts/rainier.dts
@@ -229,7 +229,6 @@
229 }; 229 };
230 230
231 IIC0: i2c@ef600700 { 231 IIC0: i2c@ef600700 {
232 device_type = "i2c";
233 compatible = "ibm,iic-440grx", "ibm,iic"; 232 compatible = "ibm,iic-440grx", "ibm,iic";
234 reg = <ef600700 14>; 233 reg = <ef600700 14>;
235 interrupt-parent = <&UIC0>; 234 interrupt-parent = <&UIC0>;
@@ -237,7 +236,6 @@
237 }; 236 };
238 237
239 IIC1: i2c@ef600800 { 238 IIC1: i2c@ef600800 {
240 device_type = "i2c";
241 compatible = "ibm,iic-440grx", "ibm,iic"; 239 compatible = "ibm,iic-440grx", "ibm,iic";
242 reg = <ef600800 14>; 240 reg = <ef600800 14>;
243 interrupt-parent = <&UIC0>; 241 interrupt-parent = <&UIC0>;
@@ -245,13 +243,11 @@
245 }; 243 };
246 244
247 ZMII0: emac-zmii@ef600d00 { 245 ZMII0: emac-zmii@ef600d00 {
248 device_type = "zmii-interface";
249 compatible = "ibm,zmii-440grx", "ibm,zmii"; 246 compatible = "ibm,zmii-440grx", "ibm,zmii";
250 reg = <ef600d00 c>; 247 reg = <ef600d00 c>;
251 }; 248 };
252 249
253 RGMII0: emac-rgmii@ef601000 { 250 RGMII0: emac-rgmii@ef601000 {
254 device_type = "rgmii-interface";
255 compatible = "ibm,rgmii-440grx", "ibm,rgmii"; 251 compatible = "ibm,rgmii-440grx", "ibm,rgmii";
256 reg = <ef601000 8>; 252 reg = <ef601000 8>;
257 has-mdio; 253 has-mdio;
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
index 5c13d46f441d..8db9515d7dc3 100644
--- a/arch/powerpc/boot/dts/sequoia.dts
+++ b/arch/powerpc/boot/dts/sequoia.dts
@@ -244,7 +244,6 @@
244 }; 244 };
245 245
246 IIC0: i2c@ef600700 { 246 IIC0: i2c@ef600700 {
247 device_type = "i2c";
248 compatible = "ibm,iic-440epx", "ibm,iic"; 247 compatible = "ibm,iic-440epx", "ibm,iic";
249 reg = <ef600700 14>; 248 reg = <ef600700 14>;
250 interrupt-parent = <&UIC0>; 249 interrupt-parent = <&UIC0>;
@@ -252,7 +251,6 @@
252 }; 251 };
253 252
254 IIC1: i2c@ef600800 { 253 IIC1: i2c@ef600800 {
255 device_type = "i2c";
256 compatible = "ibm,iic-440epx", "ibm,iic"; 254 compatible = "ibm,iic-440epx", "ibm,iic";
257 reg = <ef600800 14>; 255 reg = <ef600800 14>;
258 interrupt-parent = <&UIC0>; 256 interrupt-parent = <&UIC0>;
@@ -260,13 +258,11 @@
260 }; 258 };
261 259
262 ZMII0: emac-zmii@ef600d00 { 260 ZMII0: emac-zmii@ef600d00 {
263 device_type = "zmii-interface";
264 compatible = "ibm,zmii-440epx", "ibm,zmii"; 261 compatible = "ibm,zmii-440epx", "ibm,zmii";
265 reg = <ef600d00 c>; 262 reg = <ef600d00 c>;
266 }; 263 };
267 264
268 RGMII0: emac-rgmii@ef601000 { 265 RGMII0: emac-rgmii@ef601000 {
269 device_type = "rgmii-interface";
270 compatible = "ibm,rgmii-440epx", "ibm,rgmii"; 266 compatible = "ibm,rgmii-440epx", "ibm,rgmii";
271 reg = <ef601000 8>; 267 reg = <ef601000 8>;
272 has-mdio; 268 has-mdio;
diff --git a/arch/powerpc/boot/dts/taishan.dts b/arch/powerpc/boot/dts/taishan.dts
index 0706a4a13b9f..8278068c802c 100644
--- a/arch/powerpc/boot/dts/taishan.dts
+++ b/arch/powerpc/boot/dts/taishan.dts
@@ -203,7 +203,6 @@
203 203
204 IIC0: i2c@40000400 { 204 IIC0: i2c@40000400 {
205 /* FIXME */ 205 /* FIXME */
206 device_type = "i2c";
207 compatible = "ibm,iic-440gp", "ibm,iic"; 206 compatible = "ibm,iic-440gp", "ibm,iic";
208 reg = <40000400 14>; 207 reg = <40000400 14>;
209 interrupt-parent = <&UIC0>; 208 interrupt-parent = <&UIC0>;
@@ -211,7 +210,6 @@
211 }; 210 };
212 IIC1: i2c@40000500 { 211 IIC1: i2c@40000500 {
213 /* FIXME */ 212 /* FIXME */
214 device_type = "i2c";
215 compatible = "ibm,iic-440gp", "ibm,iic"; 213 compatible = "ibm,iic-440gp", "ibm,iic";
216 reg = <40000500 14>; 214 reg = <40000500 14>;
217 interrupt-parent = <&UIC0>; 215 interrupt-parent = <&UIC0>;
@@ -225,13 +223,11 @@
225 }; 223 };
226 224
227 ZMII0: emac-zmii@40000780 { 225 ZMII0: emac-zmii@40000780 {
228 device_type = "zgmii-interface";
229 compatible = "ibm,zmii-440gx", "ibm,zmii"; 226 compatible = "ibm,zmii-440gx", "ibm,zmii";
230 reg = <40000780 c>; 227 reg = <40000780 c>;
231 }; 228 };
232 229
233 RGMII0: emac-rgmii@40000790 { 230 RGMII0: emac-rgmii@40000790 {
234 device_type = "rgmii-interface";
235 compatible = "ibm,rgmii"; 231 compatible = "ibm,rgmii";
236 reg = <40000790 8>; 232 reg = <40000790 8>;
237 }; 233 };
diff --git a/arch/powerpc/boot/ps3-hvcall.S b/arch/powerpc/boot/ps3-hvcall.S
index 585965f7e6a8..d6068f1829ca 100644
--- a/arch/powerpc/boot/ps3-hvcall.S
+++ b/arch/powerpc/boot/ps3-hvcall.S
@@ -145,7 +145,7 @@
145.macro STORE_REGS_5_2 145.macro STORE_REGS_5_2
146 lwz r11, 16(r1) 146 lwz r11, 16(r1)
147 std r4, 0(r11) 147 std r4, 0(r11)
148 lwz r11, 24(r1) 148 lwz r11, 20(r1)
149 std r5, 0(r11) 149 std r5, 0(r11)
150.endm 150.endm
151 151
diff --git a/arch/powerpc/configs/bamboo_defconfig b/arch/powerpc/configs/bamboo_defconfig
index 1ed9afc9b281..c44db554cdc6 100644
--- a/arch/powerpc/configs/bamboo_defconfig
+++ b/arch/powerpc/configs/bamboo_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Mon Dec 24 10:49:50 2007 4# Fri Feb 15 21:36:39 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -30,6 +30,7 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 30CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 31CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 32CONFIG_GENERIC_HARDIRQS=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
33CONFIG_IRQ_PER_CPU=y 34CONFIG_IRQ_PER_CPU=y
34CONFIG_RWSEM_XCHGADD_ALGORITHM=y 35CONFIG_RWSEM_XCHGADD_ALGORITHM=y
35CONFIG_ARCH_HAS_ILOG2_U32=y 36CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -68,17 +69,18 @@ CONFIG_SYSVIPC_SYSCTL=y
68CONFIG_POSIX_MQUEUE=y 69CONFIG_POSIX_MQUEUE=y
69# CONFIG_BSD_PROCESS_ACCT is not set 70# CONFIG_BSD_PROCESS_ACCT is not set
70# CONFIG_TASKSTATS is not set 71# CONFIG_TASKSTATS is not set
71# CONFIG_USER_NS is not set
72# CONFIG_PID_NS is not set
73# CONFIG_AUDIT is not set 72# CONFIG_AUDIT is not set
74# CONFIG_IKCONFIG is not set 73# CONFIG_IKCONFIG is not set
75CONFIG_LOG_BUF_SHIFT=14 74CONFIG_LOG_BUF_SHIFT=14
76# CONFIG_CGROUPS is not set 75# CONFIG_CGROUPS is not set
76CONFIG_GROUP_SCHED=y
77CONFIG_FAIR_GROUP_SCHED=y 77CONFIG_FAIR_GROUP_SCHED=y
78CONFIG_FAIR_USER_SCHED=y 78# CONFIG_RT_GROUP_SCHED is not set
79# CONFIG_FAIR_CGROUP_SCHED is not set 79CONFIG_USER_SCHED=y
80# CONFIG_CGROUP_SCHED is not set
80CONFIG_SYSFS_DEPRECATED=y 81CONFIG_SYSFS_DEPRECATED=y
81# CONFIG_RELAY is not set 82# CONFIG_RELAY is not set
83# CONFIG_NAMESPACES is not set
82CONFIG_BLK_DEV_INITRD=y 84CONFIG_BLK_DEV_INITRD=y
83CONFIG_INITRAMFS_SOURCE="" 85CONFIG_INITRAMFS_SOURCE=""
84# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 86# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -92,11 +94,13 @@ CONFIG_HOTPLUG=y
92CONFIG_PRINTK=y 94CONFIG_PRINTK=y
93CONFIG_BUG=y 95CONFIG_BUG=y
94CONFIG_ELF_CORE=y 96CONFIG_ELF_CORE=y
97CONFIG_COMPAT_BRK=y
95CONFIG_BASE_FULL=y 98CONFIG_BASE_FULL=y
96CONFIG_FUTEX=y 99CONFIG_FUTEX=y
97CONFIG_ANON_INODES=y 100CONFIG_ANON_INODES=y
98CONFIG_EPOLL=y 101CONFIG_EPOLL=y
99CONFIG_SIGNALFD=y 102CONFIG_SIGNALFD=y
103CONFIG_TIMERFD=y
100CONFIG_EVENTFD=y 104CONFIG_EVENTFD=y
101CONFIG_SHMEM=y 105CONFIG_SHMEM=y
102CONFIG_VM_EVENT_COUNTERS=y 106CONFIG_VM_EVENT_COUNTERS=y
@@ -104,6 +108,13 @@ CONFIG_SLUB_DEBUG=y
104# CONFIG_SLAB is not set 108# CONFIG_SLAB is not set
105CONFIG_SLUB=y 109CONFIG_SLUB=y
106# CONFIG_SLOB is not set 110# CONFIG_SLOB is not set
111# CONFIG_PROFILING is not set
112# CONFIG_MARKERS is not set
113CONFIG_HAVE_OPROFILE=y
114# CONFIG_KPROBES is not set
115CONFIG_HAVE_KPROBES=y
116CONFIG_PROC_PAGE_MONITOR=y
117CONFIG_SLABINFO=y
107CONFIG_RT_MUTEXES=y 118CONFIG_RT_MUTEXES=y
108# CONFIG_TINY_SHMEM is not set 119# CONFIG_TINY_SHMEM is not set
109CONFIG_BASE_SMALL=0 120CONFIG_BASE_SMALL=0
@@ -131,13 +142,15 @@ CONFIG_DEFAULT_AS=y
131# CONFIG_DEFAULT_CFQ is not set 142# CONFIG_DEFAULT_CFQ is not set
132# CONFIG_DEFAULT_NOOP is not set 143# CONFIG_DEFAULT_NOOP is not set
133CONFIG_DEFAULT_IOSCHED="anticipatory" 144CONFIG_DEFAULT_IOSCHED="anticipatory"
145CONFIG_CLASSIC_RCU=y
146# CONFIG_PREEMPT_RCU is not set
134# CONFIG_PPC4xx_PCI_EXPRESS is not set 147# CONFIG_PPC4xx_PCI_EXPRESS is not set
135 148
136# 149#
137# Platform support 150# Platform support
138# 151#
139# CONFIG_PPC_MPC52xx is not set 152# CONFIG_PPC_MPC512x is not set
140# CONFIG_PPC_MPC5200 is not set 153# CONFIG_PPC_MPC5121 is not set
141# CONFIG_PPC_CELL is not set 154# CONFIG_PPC_CELL is not set
142# CONFIG_PPC_CELL_NATIVE is not set 155# CONFIG_PPC_CELL_NATIVE is not set
143# CONFIG_PQ2ADS is not set 156# CONFIG_PQ2ADS is not set
@@ -147,8 +160,10 @@ CONFIG_BAMBOO=y
147# CONFIG_TAISHAN is not set 160# CONFIG_TAISHAN is not set
148# CONFIG_KATMAI is not set 161# CONFIG_KATMAI is not set
149# CONFIG_RAINIER is not set 162# CONFIG_RAINIER is not set
163# CONFIG_WARP is not set
150CONFIG_440EP=y 164CONFIG_440EP=y
151CONFIG_IBM440EP_ERR42=y 165CONFIG_IBM440EP_ERR42=y
166# CONFIG_IPIC is not set
152# CONFIG_MPIC is not set 167# CONFIG_MPIC is not set
153# CONFIG_MPIC_WEIRD is not set 168# CONFIG_MPIC_WEIRD is not set
154# CONFIG_PPC_I8259 is not set 169# CONFIG_PPC_I8259 is not set
@@ -159,7 +174,6 @@ CONFIG_IBM440EP_ERR42=y
159# CONFIG_PPC_INDIRECT_IO is not set 174# CONFIG_PPC_INDIRECT_IO is not set
160# CONFIG_GENERIC_IOMAP is not set 175# CONFIG_GENERIC_IOMAP is not set
161# CONFIG_CPU_FREQ is not set 176# CONFIG_CPU_FREQ is not set
162# CONFIG_CPM2 is not set
163# CONFIG_FSL_ULI1575 is not set 177# CONFIG_FSL_ULI1575 is not set
164 178
165# 179#
@@ -175,13 +189,18 @@ CONFIG_HZ_250=y
175# CONFIG_HZ_300 is not set 189# CONFIG_HZ_300 is not set
176# CONFIG_HZ_1000 is not set 190# CONFIG_HZ_1000 is not set
177CONFIG_HZ=250 191CONFIG_HZ=250
192# CONFIG_SCHED_HRTICK is not set
178CONFIG_PREEMPT_NONE=y 193CONFIG_PREEMPT_NONE=y
179# CONFIG_PREEMPT_VOLUNTARY is not set 194# CONFIG_PREEMPT_VOLUNTARY is not set
180# CONFIG_PREEMPT is not set 195# CONFIG_PREEMPT is not set
196CONFIG_RCU_TRACE=y
181CONFIG_BINFMT_ELF=y 197CONFIG_BINFMT_ELF=y
182# CONFIG_BINFMT_MISC is not set 198# CONFIG_BINFMT_MISC is not set
183# CONFIG_MATH_EMULATION is not set 199# CONFIG_MATH_EMULATION is not set
200# CONFIG_IOMMU_HELPER is not set
184CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 201CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
202CONFIG_ARCH_HAS_WALK_MEMORY=y
203CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
185CONFIG_ARCH_FLATMEM_ENABLE=y 204CONFIG_ARCH_FLATMEM_ENABLE=y
186CONFIG_ARCH_POPULATES_NODE_MAP=y 205CONFIG_ARCH_POPULATES_NODE_MAP=y
187CONFIG_SELECT_MEMORY_MODEL=y 206CONFIG_SELECT_MEMORY_MODEL=y
@@ -201,8 +220,6 @@ CONFIG_PROC_DEVICETREE=y
201CONFIG_CMDLINE_BOOL=y 220CONFIG_CMDLINE_BOOL=y
202CONFIG_CMDLINE="" 221CONFIG_CMDLINE=""
203CONFIG_SECCOMP=y 222CONFIG_SECCOMP=y
204CONFIG_WANT_DEVICE_TREE=y
205CONFIG_DEVICE_TREE="bamboo.dts"
206CONFIG_ISA_DMA_API=y 223CONFIG_ISA_DMA_API=y
207 224
208# 225#
@@ -302,6 +319,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
302# 319#
303# CONFIG_NET_PKTGEN is not set 320# CONFIG_NET_PKTGEN is not set
304# CONFIG_HAMRADIO is not set 321# CONFIG_HAMRADIO is not set
322# CONFIG_CAN is not set
305# CONFIG_IRDA is not set 323# CONFIG_IRDA is not set
306# CONFIG_BT is not set 324# CONFIG_BT is not set
307# CONFIG_AF_RXRPC is not set 325# CONFIG_AF_RXRPC is not set
@@ -348,7 +366,7 @@ CONFIG_BLK_DEV=y
348CONFIG_BLK_DEV_RAM=y 366CONFIG_BLK_DEV_RAM=y
349CONFIG_BLK_DEV_RAM_COUNT=16 367CONFIG_BLK_DEV_RAM_COUNT=16
350CONFIG_BLK_DEV_RAM_SIZE=35000 368CONFIG_BLK_DEV_RAM_SIZE=35000
351CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 369# CONFIG_BLK_DEV_XIP is not set
352# CONFIG_CDROM_PKTCDVD is not set 370# CONFIG_CDROM_PKTCDVD is not set
353# CONFIG_ATA_OVER_ETH is not set 371# CONFIG_ATA_OVER_ETH is not set
354# CONFIG_XILINX_SYSACE is not set 372# CONFIG_XILINX_SYSACE is not set
@@ -357,6 +375,8 @@ CONFIG_MISC_DEVICES=y
357# CONFIG_EEPROM_93CX6 is not set 375# CONFIG_EEPROM_93CX6 is not set
358# CONFIG_SGI_IOC4 is not set 376# CONFIG_SGI_IOC4 is not set
359# CONFIG_TIFM_CORE is not set 377# CONFIG_TIFM_CORE is not set
378# CONFIG_ENCLOSURE_SERVICES is not set
379CONFIG_HAVE_IDE=y
360# CONFIG_IDE is not set 380# CONFIG_IDE is not set
361 381
362# 382#
@@ -385,7 +405,6 @@ CONFIG_NETDEVICES=y
385# CONFIG_EQUALIZER is not set 405# CONFIG_EQUALIZER is not set
386# CONFIG_TUN is not set 406# CONFIG_TUN is not set
387# CONFIG_VETH is not set 407# CONFIG_VETH is not set
388# CONFIG_IP1000 is not set
389# CONFIG_ARCNET is not set 408# CONFIG_ARCNET is not set
390# CONFIG_PHYLIB is not set 409# CONFIG_PHYLIB is not set
391CONFIG_NET_ETHERNET=y 410CONFIG_NET_ETHERNET=y
@@ -414,6 +433,9 @@ CONFIG_NETDEV_1000=y
414# CONFIG_DL2K is not set 433# CONFIG_DL2K is not set
415# CONFIG_E1000 is not set 434# CONFIG_E1000 is not set
416# CONFIG_E1000E is not set 435# CONFIG_E1000E is not set
436# CONFIG_E1000E_ENABLED is not set
437# CONFIG_IP1000 is not set
438# CONFIG_IGB is not set
417# CONFIG_NS83820 is not set 439# CONFIG_NS83820 is not set
418# CONFIG_HAMACHI is not set 440# CONFIG_HAMACHI is not set
419# CONFIG_YELLOWFIN is not set 441# CONFIG_YELLOWFIN is not set
@@ -438,6 +460,7 @@ CONFIG_NETDEV_10000=y
438# CONFIG_NIU is not set 460# CONFIG_NIU is not set
439# CONFIG_MLX4_CORE is not set 461# CONFIG_MLX4_CORE is not set
440# CONFIG_TEHUTI is not set 462# CONFIG_TEHUTI is not set
463# CONFIG_BNX2X is not set
441# CONFIG_TR is not set 464# CONFIG_TR is not set
442 465
443# 466#
@@ -450,7 +473,6 @@ CONFIG_NETDEV_10000=y
450# CONFIG_HIPPI is not set 473# CONFIG_HIPPI is not set
451# CONFIG_PPP is not set 474# CONFIG_PPP is not set
452# CONFIG_SLIP is not set 475# CONFIG_SLIP is not set
453# CONFIG_SHAPER is not set
454# CONFIG_NETCONSOLE is not set 476# CONFIG_NETCONSOLE is not set
455# CONFIG_NETPOLL is not set 477# CONFIG_NETPOLL is not set
456# CONFIG_NET_POLL_CONTROLLER is not set 478# CONFIG_NET_POLL_CONTROLLER is not set
@@ -473,6 +495,7 @@ CONFIG_NETDEV_10000=y
473# 495#
474# CONFIG_VT is not set 496# CONFIG_VT is not set
475# CONFIG_SERIAL_NONSTANDARD is not set 497# CONFIG_SERIAL_NONSTANDARD is not set
498# CONFIG_NOZOMI is not set
476 499
477# 500#
478# Serial drivers 501# Serial drivers
@@ -518,6 +541,7 @@ CONFIG_DEVPORT=y
518# CONFIG_W1 is not set 541# CONFIG_W1 is not set
519# CONFIG_POWER_SUPPLY is not set 542# CONFIG_POWER_SUPPLY is not set
520# CONFIG_HWMON is not set 543# CONFIG_HWMON is not set
544CONFIG_THERMAL=y
521# CONFIG_WATCHDOG is not set 545# CONFIG_WATCHDOG is not set
522 546
523# 547#
@@ -566,12 +590,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
566# 590#
567# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 591# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
568# 592#
569
570#
571# USB Gadget Support
572#
573# CONFIG_USB_GADGET is not set 593# CONFIG_USB_GADGET is not set
574# CONFIG_MMC is not set 594# CONFIG_MMC is not set
595# CONFIG_MEMSTICK is not set
575# CONFIG_NEW_LEDS is not set 596# CONFIG_NEW_LEDS is not set
576# CONFIG_INFINIBAND is not set 597# CONFIG_INFINIBAND is not set
577# CONFIG_EDAC is not set 598# CONFIG_EDAC is not set
@@ -596,12 +617,10 @@ CONFIG_EXT2_FS=y
596# CONFIG_XFS_FS is not set 617# CONFIG_XFS_FS is not set
597# CONFIG_GFS2_FS is not set 618# CONFIG_GFS2_FS is not set
598# CONFIG_OCFS2_FS is not set 619# CONFIG_OCFS2_FS is not set
599# CONFIG_MINIX_FS is not set 620CONFIG_DNOTIFY=y
600# CONFIG_ROMFS_FS is not set
601CONFIG_INOTIFY=y 621CONFIG_INOTIFY=y
602CONFIG_INOTIFY_USER=y 622CONFIG_INOTIFY_USER=y
603# CONFIG_QUOTA is not set 623# CONFIG_QUOTA is not set
604CONFIG_DNOTIFY=y
605# CONFIG_AUTOFS_FS is not set 624# CONFIG_AUTOFS_FS is not set
606# CONFIG_AUTOFS4_FS is not set 625# CONFIG_AUTOFS4_FS is not set
607# CONFIG_FUSE_FS is not set 626# CONFIG_FUSE_FS is not set
@@ -643,8 +662,10 @@ CONFIG_TMPFS=y
643# CONFIG_EFS_FS is not set 662# CONFIG_EFS_FS is not set
644CONFIG_CRAMFS=y 663CONFIG_CRAMFS=y
645# CONFIG_VXFS_FS is not set 664# CONFIG_VXFS_FS is not set
665# CONFIG_MINIX_FS is not set
646# CONFIG_HPFS_FS is not set 666# CONFIG_HPFS_FS is not set
647# CONFIG_QNX4FS_FS is not set 667# CONFIG_QNX4FS_FS is not set
668# CONFIG_ROMFS_FS is not set
648# CONFIG_SYSV_FS is not set 669# CONFIG_SYSV_FS is not set
649# CONFIG_UFS_FS is not set 670# CONFIG_UFS_FS is not set
650CONFIG_NETWORK_FILESYSTEMS=y 671CONFIG_NETWORK_FILESYSTEMS=y
@@ -675,7 +696,6 @@ CONFIG_SUNRPC=y
675CONFIG_MSDOS_PARTITION=y 696CONFIG_MSDOS_PARTITION=y
676# CONFIG_NLS is not set 697# CONFIG_NLS is not set
677# CONFIG_DLM is not set 698# CONFIG_DLM is not set
678# CONFIG_UCC_SLOW is not set
679 699
680# 700#
681# Library routines 701# Library routines
@@ -692,10 +712,6 @@ CONFIG_PLIST=y
692CONFIG_HAS_IOMEM=y 712CONFIG_HAS_IOMEM=y
693CONFIG_HAS_IOPORT=y 713CONFIG_HAS_IOPORT=y
694CONFIG_HAS_DMA=y 714CONFIG_HAS_DMA=y
695CONFIG_INSTRUMENTATION=y
696# CONFIG_PROFILING is not set
697# CONFIG_KPROBES is not set
698# CONFIG_MARKERS is not set
699 715
700# 716#
701# Kernel hacking 717# Kernel hacking
@@ -705,7 +721,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
705CONFIG_ENABLE_MUST_CHECK=y 721CONFIG_ENABLE_MUST_CHECK=y
706CONFIG_MAGIC_SYSRQ=y 722CONFIG_MAGIC_SYSRQ=y
707# CONFIG_UNUSED_SYMBOLS is not set 723# CONFIG_UNUSED_SYMBOLS is not set
708# CONFIG_DEBUG_FS is not set 724CONFIG_DEBUG_FS=y
709# CONFIG_HEADERS_CHECK is not set 725# CONFIG_HEADERS_CHECK is not set
710CONFIG_DEBUG_KERNEL=y 726CONFIG_DEBUG_KERNEL=y
711# CONFIG_DEBUG_SHIRQ is not set 727# CONFIG_DEBUG_SHIRQ is not set
@@ -714,6 +730,7 @@ CONFIG_SCHED_DEBUG=y
714# CONFIG_SCHEDSTATS is not set 730# CONFIG_SCHEDSTATS is not set
715# CONFIG_TIMER_STATS is not set 731# CONFIG_TIMER_STATS is not set
716# CONFIG_SLUB_DEBUG_ON is not set 732# CONFIG_SLUB_DEBUG_ON is not set
733# CONFIG_SLUB_STATS is not set
717# CONFIG_DEBUG_RT_MUTEXES is not set 734# CONFIG_DEBUG_RT_MUTEXES is not set
718# CONFIG_RT_MUTEX_TESTER is not set 735# CONFIG_RT_MUTEX_TESTER is not set
719# CONFIG_DEBUG_SPINLOCK is not set 736# CONFIG_DEBUG_SPINLOCK is not set
@@ -726,9 +743,9 @@ CONFIG_SCHED_DEBUG=y
726# CONFIG_DEBUG_VM is not set 743# CONFIG_DEBUG_VM is not set
727# CONFIG_DEBUG_LIST is not set 744# CONFIG_DEBUG_LIST is not set
728# CONFIG_DEBUG_SG is not set 745# CONFIG_DEBUG_SG is not set
729CONFIG_FORCED_INLINING=y
730# CONFIG_BOOT_PRINTK_DELAY is not set 746# CONFIG_BOOT_PRINTK_DELAY is not set
731# CONFIG_RCU_TORTURE_TEST is not set 747# CONFIG_RCU_TORTURE_TEST is not set
748# CONFIG_BACKTRACE_SELF_TEST is not set
732# CONFIG_FAULT_INJECTION is not set 749# CONFIG_FAULT_INJECTION is not set
733# CONFIG_SAMPLES is not set 750# CONFIG_SAMPLES is not set
734# CONFIG_DEBUG_STACKOVERFLOW is not set 751# CONFIG_DEBUG_STACKOVERFLOW is not set
@@ -737,6 +754,7 @@ CONFIG_FORCED_INLINING=y
737CONFIG_DEBUGGER=y 754CONFIG_DEBUGGER=y
738# CONFIG_KGDB is not set 755# CONFIG_KGDB is not set
739# CONFIG_XMON is not set 756# CONFIG_XMON is not set
757# CONFIG_VIRQ_DEBUG is not set
740# CONFIG_BDI_SWITCH is not set 758# CONFIG_BDI_SWITCH is not set
741# CONFIG_PPC_EARLY_DEBUG is not set 759# CONFIG_PPC_EARLY_DEBUG is not set
742 760
@@ -749,6 +767,7 @@ CONFIG_DEBUGGER=y
749CONFIG_CRYPTO=y 767CONFIG_CRYPTO=y
750CONFIG_CRYPTO_ALGAPI=y 768CONFIG_CRYPTO_ALGAPI=y
751CONFIG_CRYPTO_BLKCIPHER=y 769CONFIG_CRYPTO_BLKCIPHER=y
770# CONFIG_CRYPTO_SEQIV is not set
752CONFIG_CRYPTO_MANAGER=y 771CONFIG_CRYPTO_MANAGER=y
753# CONFIG_CRYPTO_HMAC is not set 772# CONFIG_CRYPTO_HMAC is not set
754# CONFIG_CRYPTO_XCBC is not set 773# CONFIG_CRYPTO_XCBC is not set
@@ -766,6 +785,9 @@ CONFIG_CRYPTO_CBC=y
766CONFIG_CRYPTO_PCBC=y 785CONFIG_CRYPTO_PCBC=y
767# CONFIG_CRYPTO_LRW is not set 786# CONFIG_CRYPTO_LRW is not set
768# CONFIG_CRYPTO_XTS is not set 787# CONFIG_CRYPTO_XTS is not set
788# CONFIG_CRYPTO_CTR is not set
789# CONFIG_CRYPTO_GCM is not set
790# CONFIG_CRYPTO_CCM is not set
769# CONFIG_CRYPTO_CRYPTD is not set 791# CONFIG_CRYPTO_CRYPTD is not set
770CONFIG_CRYPTO_DES=y 792CONFIG_CRYPTO_DES=y
771# CONFIG_CRYPTO_FCRYPT is not set 793# CONFIG_CRYPTO_FCRYPT is not set
@@ -780,11 +802,14 @@ CONFIG_CRYPTO_DES=y
780# CONFIG_CRYPTO_KHAZAD is not set 802# CONFIG_CRYPTO_KHAZAD is not set
781# CONFIG_CRYPTO_ANUBIS is not set 803# CONFIG_CRYPTO_ANUBIS is not set
782# CONFIG_CRYPTO_SEED is not set 804# CONFIG_CRYPTO_SEED is not set
805# CONFIG_CRYPTO_SALSA20 is not set
783# CONFIG_CRYPTO_DEFLATE is not set 806# CONFIG_CRYPTO_DEFLATE is not set
784# CONFIG_CRYPTO_MICHAEL_MIC is not set 807# CONFIG_CRYPTO_MICHAEL_MIC is not set
785# CONFIG_CRYPTO_CRC32C is not set 808# CONFIG_CRYPTO_CRC32C is not set
786# CONFIG_CRYPTO_CAMELLIA is not set 809# CONFIG_CRYPTO_CAMELLIA is not set
787# CONFIG_CRYPTO_TEST is not set 810# CONFIG_CRYPTO_TEST is not set
788# CONFIG_CRYPTO_AUTHENC is not set 811# CONFIG_CRYPTO_AUTHENC is not set
812# CONFIG_CRYPTO_LZO is not set
789CONFIG_CRYPTO_HW=y 813CONFIG_CRYPTO_HW=y
814# CONFIG_CRYPTO_DEV_HIFN_795X is not set
790# CONFIG_PPC_CLOCK is not set 815# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/ebony_defconfig b/arch/powerpc/configs/ebony_defconfig
index cf860f166659..07c8d4ce175a 100644
--- a/arch/powerpc/configs/ebony_defconfig
+++ b/arch/powerpc/configs/ebony_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Mon Dec 24 11:16:26 2007 4# Fri Feb 15 21:50:44 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -29,6 +29,7 @@ CONFIG_GENERIC_TIME=y
29CONFIG_GENERIC_TIME_VSYSCALL=y 29CONFIG_GENERIC_TIME_VSYSCALL=y
30CONFIG_GENERIC_CLOCKEVENTS=y 30CONFIG_GENERIC_CLOCKEVENTS=y
31CONFIG_GENERIC_HARDIRQS=y 31CONFIG_GENERIC_HARDIRQS=y
32# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
32CONFIG_IRQ_PER_CPU=y 33CONFIG_IRQ_PER_CPU=y
33CONFIG_RWSEM_XCHGADD_ALGORITHM=y 34CONFIG_RWSEM_XCHGADD_ALGORITHM=y
34CONFIG_ARCH_HAS_ILOG2_U32=y 35CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -67,17 +68,18 @@ CONFIG_SYSVIPC_SYSCTL=y
67CONFIG_POSIX_MQUEUE=y 68CONFIG_POSIX_MQUEUE=y
68# CONFIG_BSD_PROCESS_ACCT is not set 69# CONFIG_BSD_PROCESS_ACCT is not set
69# CONFIG_TASKSTATS is not set 70# CONFIG_TASKSTATS is not set
70# CONFIG_USER_NS is not set
71# CONFIG_PID_NS is not set
72# CONFIG_AUDIT is not set 71# CONFIG_AUDIT is not set
73# CONFIG_IKCONFIG is not set 72# CONFIG_IKCONFIG is not set
74CONFIG_LOG_BUF_SHIFT=14 73CONFIG_LOG_BUF_SHIFT=14
75# CONFIG_CGROUPS is not set 74# CONFIG_CGROUPS is not set
75CONFIG_GROUP_SCHED=y
76CONFIG_FAIR_GROUP_SCHED=y 76CONFIG_FAIR_GROUP_SCHED=y
77CONFIG_FAIR_USER_SCHED=y 77# CONFIG_RT_GROUP_SCHED is not set
78# CONFIG_FAIR_CGROUP_SCHED is not set 78CONFIG_USER_SCHED=y
79# CONFIG_CGROUP_SCHED is not set
79CONFIG_SYSFS_DEPRECATED=y 80CONFIG_SYSFS_DEPRECATED=y
80# CONFIG_RELAY is not set 81# CONFIG_RELAY is not set
82# CONFIG_NAMESPACES is not set
81CONFIG_BLK_DEV_INITRD=y 83CONFIG_BLK_DEV_INITRD=y
82CONFIG_INITRAMFS_SOURCE="" 84CONFIG_INITRAMFS_SOURCE=""
83# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 85# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -91,11 +93,13 @@ CONFIG_HOTPLUG=y
91CONFIG_PRINTK=y 93CONFIG_PRINTK=y
92CONFIG_BUG=y 94CONFIG_BUG=y
93CONFIG_ELF_CORE=y 95CONFIG_ELF_CORE=y
96CONFIG_COMPAT_BRK=y
94CONFIG_BASE_FULL=y 97CONFIG_BASE_FULL=y
95CONFIG_FUTEX=y 98CONFIG_FUTEX=y
96CONFIG_ANON_INODES=y 99CONFIG_ANON_INODES=y
97CONFIG_EPOLL=y 100CONFIG_EPOLL=y
98CONFIG_SIGNALFD=y 101CONFIG_SIGNALFD=y
102CONFIG_TIMERFD=y
99CONFIG_EVENTFD=y 103CONFIG_EVENTFD=y
100CONFIG_SHMEM=y 104CONFIG_SHMEM=y
101CONFIG_VM_EVENT_COUNTERS=y 105CONFIG_VM_EVENT_COUNTERS=y
@@ -103,6 +107,13 @@ CONFIG_SLUB_DEBUG=y
103# CONFIG_SLAB is not set 107# CONFIG_SLAB is not set
104CONFIG_SLUB=y 108CONFIG_SLUB=y
105# CONFIG_SLOB is not set 109# CONFIG_SLOB is not set
110# CONFIG_PROFILING is not set
111# CONFIG_MARKERS is not set
112CONFIG_HAVE_OPROFILE=y
113# CONFIG_KPROBES is not set
114CONFIG_HAVE_KPROBES=y
115CONFIG_PROC_PAGE_MONITOR=y
116CONFIG_SLABINFO=y
106CONFIG_RT_MUTEXES=y 117CONFIG_RT_MUTEXES=y
107# CONFIG_TINY_SHMEM is not set 118# CONFIG_TINY_SHMEM is not set
108CONFIG_BASE_SMALL=0 119CONFIG_BASE_SMALL=0
@@ -130,13 +141,15 @@ CONFIG_DEFAULT_AS=y
130# CONFIG_DEFAULT_CFQ is not set 141# CONFIG_DEFAULT_CFQ is not set
131# CONFIG_DEFAULT_NOOP is not set 142# CONFIG_DEFAULT_NOOP is not set
132CONFIG_DEFAULT_IOSCHED="anticipatory" 143CONFIG_DEFAULT_IOSCHED="anticipatory"
144CONFIG_CLASSIC_RCU=y
145# CONFIG_PREEMPT_RCU is not set
133# CONFIG_PPC4xx_PCI_EXPRESS is not set 146# CONFIG_PPC4xx_PCI_EXPRESS is not set
134 147
135# 148#
136# Platform support 149# Platform support
137# 150#
138# CONFIG_PPC_MPC52xx is not set 151# CONFIG_PPC_MPC512x is not set
139# CONFIG_PPC_MPC5200 is not set 152# CONFIG_PPC_MPC5121 is not set
140# CONFIG_PPC_CELL is not set 153# CONFIG_PPC_CELL is not set
141# CONFIG_PPC_CELL_NATIVE is not set 154# CONFIG_PPC_CELL_NATIVE is not set
142# CONFIG_PQ2ADS is not set 155# CONFIG_PQ2ADS is not set
@@ -146,7 +159,9 @@ CONFIG_EBONY=y
146# CONFIG_TAISHAN is not set 159# CONFIG_TAISHAN is not set
147# CONFIG_KATMAI is not set 160# CONFIG_KATMAI is not set
148# CONFIG_RAINIER is not set 161# CONFIG_RAINIER is not set
162# CONFIG_WARP is not set
149CONFIG_440GP=y 163CONFIG_440GP=y
164# CONFIG_IPIC is not set
150# CONFIG_MPIC is not set 165# CONFIG_MPIC is not set
151# CONFIG_MPIC_WEIRD is not set 166# CONFIG_MPIC_WEIRD is not set
152# CONFIG_PPC_I8259 is not set 167# CONFIG_PPC_I8259 is not set
@@ -157,8 +172,8 @@ CONFIG_440GP=y
157# CONFIG_PPC_INDIRECT_IO is not set 172# CONFIG_PPC_INDIRECT_IO is not set
158# CONFIG_GENERIC_IOMAP is not set 173# CONFIG_GENERIC_IOMAP is not set
159# CONFIG_CPU_FREQ is not set 174# CONFIG_CPU_FREQ is not set
160# CONFIG_CPM2 is not set
161# CONFIG_FSL_ULI1575 is not set 175# CONFIG_FSL_ULI1575 is not set
176CONFIG_OF_RTC=y
162 177
163# 178#
164# Kernel options 179# Kernel options
@@ -173,13 +188,18 @@ CONFIG_HZ_250=y
173# CONFIG_HZ_300 is not set 188# CONFIG_HZ_300 is not set
174# CONFIG_HZ_1000 is not set 189# CONFIG_HZ_1000 is not set
175CONFIG_HZ=250 190CONFIG_HZ=250
191# CONFIG_SCHED_HRTICK is not set
176CONFIG_PREEMPT_NONE=y 192CONFIG_PREEMPT_NONE=y
177# CONFIG_PREEMPT_VOLUNTARY is not set 193# CONFIG_PREEMPT_VOLUNTARY is not set
178# CONFIG_PREEMPT is not set 194# CONFIG_PREEMPT is not set
195CONFIG_RCU_TRACE=y
179CONFIG_BINFMT_ELF=y 196CONFIG_BINFMT_ELF=y
180# CONFIG_BINFMT_MISC is not set 197# CONFIG_BINFMT_MISC is not set
181CONFIG_MATH_EMULATION=y 198CONFIG_MATH_EMULATION=y
199# CONFIG_IOMMU_HELPER is not set
182CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 200CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
201CONFIG_ARCH_HAS_WALK_MEMORY=y
202CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
183CONFIG_ARCH_FLATMEM_ENABLE=y 203CONFIG_ARCH_FLATMEM_ENABLE=y
184CONFIG_ARCH_POPULATES_NODE_MAP=y 204CONFIG_ARCH_POPULATES_NODE_MAP=y
185CONFIG_SELECT_MEMORY_MODEL=y 205CONFIG_SELECT_MEMORY_MODEL=y
@@ -198,8 +218,6 @@ CONFIG_VIRT_TO_BUS=y
198CONFIG_PROC_DEVICETREE=y 218CONFIG_PROC_DEVICETREE=y
199# CONFIG_CMDLINE_BOOL is not set 219# CONFIG_CMDLINE_BOOL is not set
200CONFIG_SECCOMP=y 220CONFIG_SECCOMP=y
201CONFIG_WANT_DEVICE_TREE=y
202CONFIG_DEVICE_TREE="ebony.dts"
203CONFIG_ISA_DMA_API=y 221CONFIG_ISA_DMA_API=y
204 222
205# 223#
@@ -299,6 +317,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
299# 317#
300# CONFIG_NET_PKTGEN is not set 318# CONFIG_NET_PKTGEN is not set
301# CONFIG_HAMRADIO is not set 319# CONFIG_HAMRADIO is not set
320# CONFIG_CAN is not set
302# CONFIG_IRDA is not set 321# CONFIG_IRDA is not set
303# CONFIG_BT is not set 322# CONFIG_BT is not set
304# CONFIG_AF_RXRPC is not set 323# CONFIG_AF_RXRPC is not set
@@ -335,6 +354,7 @@ CONFIG_MTD=y
335CONFIG_MTD_PARTITIONS=y 354CONFIG_MTD_PARTITIONS=y
336# CONFIG_MTD_REDBOOT_PARTS is not set 355# CONFIG_MTD_REDBOOT_PARTS is not set
337# CONFIG_MTD_CMDLINE_PARTS is not set 356# CONFIG_MTD_CMDLINE_PARTS is not set
357CONFIG_MTD_OF_PARTS=y
338 358
339# 359#
340# User Modules And Translation Layers 360# User Modules And Translation Layers
@@ -420,7 +440,7 @@ CONFIG_BLK_DEV=y
420CONFIG_BLK_DEV_RAM=y 440CONFIG_BLK_DEV_RAM=y
421CONFIG_BLK_DEV_RAM_COUNT=16 441CONFIG_BLK_DEV_RAM_COUNT=16
422CONFIG_BLK_DEV_RAM_SIZE=35000 442CONFIG_BLK_DEV_RAM_SIZE=35000
423CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 443# CONFIG_BLK_DEV_XIP is not set
424# CONFIG_CDROM_PKTCDVD is not set 444# CONFIG_CDROM_PKTCDVD is not set
425# CONFIG_ATA_OVER_ETH is not set 445# CONFIG_ATA_OVER_ETH is not set
426# CONFIG_XILINX_SYSACE is not set 446# CONFIG_XILINX_SYSACE is not set
@@ -429,6 +449,8 @@ CONFIG_MISC_DEVICES=y
429# CONFIG_EEPROM_93CX6 is not set 449# CONFIG_EEPROM_93CX6 is not set
430# CONFIG_SGI_IOC4 is not set 450# CONFIG_SGI_IOC4 is not set
431# CONFIG_TIFM_CORE is not set 451# CONFIG_TIFM_CORE is not set
452# CONFIG_ENCLOSURE_SERVICES is not set
453CONFIG_HAVE_IDE=y
432# CONFIG_IDE is not set 454# CONFIG_IDE is not set
433 455
434# 456#
@@ -457,7 +479,6 @@ CONFIG_NETDEVICES=y
457# CONFIG_EQUALIZER is not set 479# CONFIG_EQUALIZER is not set
458# CONFIG_TUN is not set 480# CONFIG_TUN is not set
459# CONFIG_VETH is not set 481# CONFIG_VETH is not set
460# CONFIG_IP1000 is not set
461# CONFIG_ARCNET is not set 482# CONFIG_ARCNET is not set
462# CONFIG_PHYLIB is not set 483# CONFIG_PHYLIB is not set
463CONFIG_NET_ETHERNET=y 484CONFIG_NET_ETHERNET=y
@@ -486,6 +507,9 @@ CONFIG_NETDEV_1000=y
486# CONFIG_DL2K is not set 507# CONFIG_DL2K is not set
487# CONFIG_E1000 is not set 508# CONFIG_E1000 is not set
488# CONFIG_E1000E is not set 509# CONFIG_E1000E is not set
510# CONFIG_E1000E_ENABLED is not set
511# CONFIG_IP1000 is not set
512# CONFIG_IGB is not set
489# CONFIG_NS83820 is not set 513# CONFIG_NS83820 is not set
490# CONFIG_HAMACHI is not set 514# CONFIG_HAMACHI is not set
491# CONFIG_YELLOWFIN is not set 515# CONFIG_YELLOWFIN is not set
@@ -510,6 +534,7 @@ CONFIG_NETDEV_10000=y
510# CONFIG_NIU is not set 534# CONFIG_NIU is not set
511# CONFIG_MLX4_CORE is not set 535# CONFIG_MLX4_CORE is not set
512# CONFIG_TEHUTI is not set 536# CONFIG_TEHUTI is not set
537# CONFIG_BNX2X is not set
513# CONFIG_TR is not set 538# CONFIG_TR is not set
514 539
515# 540#
@@ -522,7 +547,6 @@ CONFIG_NETDEV_10000=y
522# CONFIG_HIPPI is not set 547# CONFIG_HIPPI is not set
523# CONFIG_PPP is not set 548# CONFIG_PPP is not set
524# CONFIG_SLIP is not set 549# CONFIG_SLIP is not set
525# CONFIG_SHAPER is not set
526# CONFIG_NETCONSOLE is not set 550# CONFIG_NETCONSOLE is not set
527# CONFIG_NETPOLL is not set 551# CONFIG_NETPOLL is not set
528# CONFIG_NET_POLL_CONTROLLER is not set 552# CONFIG_NET_POLL_CONTROLLER is not set
@@ -545,6 +569,7 @@ CONFIG_NETDEV_10000=y
545# 569#
546# CONFIG_VT is not set 570# CONFIG_VT is not set
547# CONFIG_SERIAL_NONSTANDARD is not set 571# CONFIG_SERIAL_NONSTANDARD is not set
572# CONFIG_NOZOMI is not set
548 573
549# 574#
550# Serial drivers 575# Serial drivers
@@ -590,6 +615,7 @@ CONFIG_DEVPORT=y
590# CONFIG_W1 is not set 615# CONFIG_W1 is not set
591# CONFIG_POWER_SUPPLY is not set 616# CONFIG_POWER_SUPPLY is not set
592# CONFIG_HWMON is not set 617# CONFIG_HWMON is not set
618CONFIG_THERMAL=y
593# CONFIG_WATCHDOG is not set 619# CONFIG_WATCHDOG is not set
594 620
595# 621#
@@ -638,12 +664,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
638# 664#
639# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 665# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
640# 666#
641
642#
643# USB Gadget Support
644#
645# CONFIG_USB_GADGET is not set 667# CONFIG_USB_GADGET is not set
646# CONFIG_MMC is not set 668# CONFIG_MMC is not set
669# CONFIG_MEMSTICK is not set
647# CONFIG_NEW_LEDS is not set 670# CONFIG_NEW_LEDS is not set
648# CONFIG_INFINIBAND is not set 671# CONFIG_INFINIBAND is not set
649# CONFIG_EDAC is not set 672# CONFIG_EDAC is not set
@@ -668,12 +691,10 @@ CONFIG_EXT2_FS=y
668# CONFIG_XFS_FS is not set 691# CONFIG_XFS_FS is not set
669# CONFIG_GFS2_FS is not set 692# CONFIG_GFS2_FS is not set
670# CONFIG_OCFS2_FS is not set 693# CONFIG_OCFS2_FS is not set
671# CONFIG_MINIX_FS is not set 694CONFIG_DNOTIFY=y
672# CONFIG_ROMFS_FS is not set
673CONFIG_INOTIFY=y 695CONFIG_INOTIFY=y
674CONFIG_INOTIFY_USER=y 696CONFIG_INOTIFY_USER=y
675# CONFIG_QUOTA is not set 697# CONFIG_QUOTA is not set
676CONFIG_DNOTIFY=y
677# CONFIG_AUTOFS_FS is not set 698# CONFIG_AUTOFS_FS is not set
678# CONFIG_AUTOFS4_FS is not set 699# CONFIG_AUTOFS4_FS is not set
679# CONFIG_FUSE_FS is not set 700# CONFIG_FUSE_FS is not set
@@ -726,8 +747,10 @@ CONFIG_JFFS2_RTIME=y
726# CONFIG_JFFS2_RUBIN is not set 747# CONFIG_JFFS2_RUBIN is not set
727CONFIG_CRAMFS=y 748CONFIG_CRAMFS=y
728# CONFIG_VXFS_FS is not set 749# CONFIG_VXFS_FS is not set
750# CONFIG_MINIX_FS is not set
729# CONFIG_HPFS_FS is not set 751# CONFIG_HPFS_FS is not set
730# CONFIG_QNX4FS_FS is not set 752# CONFIG_QNX4FS_FS is not set
753# CONFIG_ROMFS_FS is not set
731# CONFIG_SYSV_FS is not set 754# CONFIG_SYSV_FS is not set
732# CONFIG_UFS_FS is not set 755# CONFIG_UFS_FS is not set
733CONFIG_NETWORK_FILESYSTEMS=y 756CONFIG_NETWORK_FILESYSTEMS=y
@@ -758,7 +781,6 @@ CONFIG_SUNRPC=y
758CONFIG_MSDOS_PARTITION=y 781CONFIG_MSDOS_PARTITION=y
759# CONFIG_NLS is not set 782# CONFIG_NLS is not set
760# CONFIG_DLM is not set 783# CONFIG_DLM is not set
761# CONFIG_UCC_SLOW is not set
762 784
763# 785#
764# Library routines 786# Library routines
@@ -776,7 +798,6 @@ CONFIG_PLIST=y
776CONFIG_HAS_IOMEM=y 798CONFIG_HAS_IOMEM=y
777CONFIG_HAS_IOPORT=y 799CONFIG_HAS_IOPORT=y
778CONFIG_HAS_DMA=y 800CONFIG_HAS_DMA=y
779# CONFIG_INSTRUMENTATION is not set
780 801
781# 802#
782# Kernel hacking 803# Kernel hacking
@@ -786,7 +807,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
786CONFIG_ENABLE_MUST_CHECK=y 807CONFIG_ENABLE_MUST_CHECK=y
787CONFIG_MAGIC_SYSRQ=y 808CONFIG_MAGIC_SYSRQ=y
788# CONFIG_UNUSED_SYMBOLS is not set 809# CONFIG_UNUSED_SYMBOLS is not set
789# CONFIG_DEBUG_FS is not set 810CONFIG_DEBUG_FS=y
790# CONFIG_HEADERS_CHECK is not set 811# CONFIG_HEADERS_CHECK is not set
791CONFIG_DEBUG_KERNEL=y 812CONFIG_DEBUG_KERNEL=y
792# CONFIG_DEBUG_SHIRQ is not set 813# CONFIG_DEBUG_SHIRQ is not set
@@ -795,6 +816,7 @@ CONFIG_SCHED_DEBUG=y
795# CONFIG_SCHEDSTATS is not set 816# CONFIG_SCHEDSTATS is not set
796# CONFIG_TIMER_STATS is not set 817# CONFIG_TIMER_STATS is not set
797# CONFIG_SLUB_DEBUG_ON is not set 818# CONFIG_SLUB_DEBUG_ON is not set
819# CONFIG_SLUB_STATS is not set
798# CONFIG_DEBUG_RT_MUTEXES is not set 820# CONFIG_DEBUG_RT_MUTEXES is not set
799# CONFIG_RT_MUTEX_TESTER is not set 821# CONFIG_RT_MUTEX_TESTER is not set
800# CONFIG_DEBUG_SPINLOCK is not set 822# CONFIG_DEBUG_SPINLOCK is not set
@@ -807,15 +829,16 @@ CONFIG_DEBUG_BUGVERBOSE=y
807# CONFIG_DEBUG_VM is not set 829# CONFIG_DEBUG_VM is not set
808# CONFIG_DEBUG_LIST is not set 830# CONFIG_DEBUG_LIST is not set
809# CONFIG_DEBUG_SG is not set 831# CONFIG_DEBUG_SG is not set
810CONFIG_FORCED_INLINING=y
811# CONFIG_BOOT_PRINTK_DELAY is not set 832# CONFIG_BOOT_PRINTK_DELAY is not set
812# CONFIG_RCU_TORTURE_TEST is not set 833# CONFIG_RCU_TORTURE_TEST is not set
834# CONFIG_BACKTRACE_SELF_TEST is not set
813# CONFIG_FAULT_INJECTION is not set 835# CONFIG_FAULT_INJECTION is not set
814# CONFIG_SAMPLES is not set 836# CONFIG_SAMPLES is not set
815# CONFIG_DEBUG_STACKOVERFLOW is not set 837# CONFIG_DEBUG_STACKOVERFLOW is not set
816# CONFIG_DEBUG_STACK_USAGE is not set 838# CONFIG_DEBUG_STACK_USAGE is not set
817# CONFIG_DEBUG_PAGEALLOC is not set 839# CONFIG_DEBUG_PAGEALLOC is not set
818# CONFIG_DEBUGGER is not set 840# CONFIG_DEBUGGER is not set
841# CONFIG_VIRQ_DEBUG is not set
819# CONFIG_BDI_SWITCH is not set 842# CONFIG_BDI_SWITCH is not set
820# CONFIG_PPC_EARLY_DEBUG is not set 843# CONFIG_PPC_EARLY_DEBUG is not set
821 844
@@ -828,6 +851,7 @@ CONFIG_FORCED_INLINING=y
828CONFIG_CRYPTO=y 851CONFIG_CRYPTO=y
829CONFIG_CRYPTO_ALGAPI=y 852CONFIG_CRYPTO_ALGAPI=y
830CONFIG_CRYPTO_BLKCIPHER=y 853CONFIG_CRYPTO_BLKCIPHER=y
854# CONFIG_CRYPTO_SEQIV is not set
831CONFIG_CRYPTO_MANAGER=y 855CONFIG_CRYPTO_MANAGER=y
832# CONFIG_CRYPTO_HMAC is not set 856# CONFIG_CRYPTO_HMAC is not set
833# CONFIG_CRYPTO_XCBC is not set 857# CONFIG_CRYPTO_XCBC is not set
@@ -845,6 +869,9 @@ CONFIG_CRYPTO_CBC=y
845CONFIG_CRYPTO_PCBC=y 869CONFIG_CRYPTO_PCBC=y
846# CONFIG_CRYPTO_LRW is not set 870# CONFIG_CRYPTO_LRW is not set
847# CONFIG_CRYPTO_XTS is not set 871# CONFIG_CRYPTO_XTS is not set
872# CONFIG_CRYPTO_CTR is not set
873# CONFIG_CRYPTO_GCM is not set
874# CONFIG_CRYPTO_CCM is not set
848# CONFIG_CRYPTO_CRYPTD is not set 875# CONFIG_CRYPTO_CRYPTD is not set
849CONFIG_CRYPTO_DES=y 876CONFIG_CRYPTO_DES=y
850# CONFIG_CRYPTO_FCRYPT is not set 877# CONFIG_CRYPTO_FCRYPT is not set
@@ -859,11 +886,13 @@ CONFIG_CRYPTO_DES=y
859# CONFIG_CRYPTO_KHAZAD is not set 886# CONFIG_CRYPTO_KHAZAD is not set
860# CONFIG_CRYPTO_ANUBIS is not set 887# CONFIG_CRYPTO_ANUBIS is not set
861# CONFIG_CRYPTO_SEED is not set 888# CONFIG_CRYPTO_SEED is not set
889# CONFIG_CRYPTO_SALSA20 is not set
862# CONFIG_CRYPTO_DEFLATE is not set 890# CONFIG_CRYPTO_DEFLATE is not set
863# CONFIG_CRYPTO_MICHAEL_MIC is not set 891# CONFIG_CRYPTO_MICHAEL_MIC is not set
864# CONFIG_CRYPTO_CRC32C is not set 892# CONFIG_CRYPTO_CRC32C is not set
865# CONFIG_CRYPTO_CAMELLIA is not set 893# CONFIG_CRYPTO_CAMELLIA is not set
866# CONFIG_CRYPTO_TEST is not set 894# CONFIG_CRYPTO_TEST is not set
867# CONFIG_CRYPTO_AUTHENC is not set 895# CONFIG_CRYPTO_AUTHENC is not set
896# CONFIG_CRYPTO_LZO is not set
868# CONFIG_CRYPTO_HW is not set 897# CONFIG_CRYPTO_HW is not set
869# CONFIG_PPC_CLOCK is not set 898# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/ep405_defconfig b/arch/powerpc/configs/ep405_defconfig
index 3829c9166256..e24240a9a047 100644
--- a/arch/powerpc/configs/ep405_defconfig
+++ b/arch/powerpc/configs/ep405_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Mon Dec 24 11:17:13 2007 4# Fri Feb 15 21:50:09 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -26,6 +26,7 @@ CONFIG_GENERIC_TIME=y
26CONFIG_GENERIC_TIME_VSYSCALL=y 26CONFIG_GENERIC_TIME_VSYSCALL=y
27CONFIG_GENERIC_CLOCKEVENTS=y 27CONFIG_GENERIC_CLOCKEVENTS=y
28CONFIG_GENERIC_HARDIRQS=y 28CONFIG_GENERIC_HARDIRQS=y
29# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
29CONFIG_IRQ_PER_CPU=y 30CONFIG_IRQ_PER_CPU=y
30CONFIG_RWSEM_XCHGADD_ALGORITHM=y 31CONFIG_RWSEM_XCHGADD_ALGORITHM=y
31CONFIG_ARCH_HAS_ILOG2_U32=y 32CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -64,17 +65,18 @@ CONFIG_SYSVIPC_SYSCTL=y
64CONFIG_POSIX_MQUEUE=y 65CONFIG_POSIX_MQUEUE=y
65# CONFIG_BSD_PROCESS_ACCT is not set 66# CONFIG_BSD_PROCESS_ACCT is not set
66# CONFIG_TASKSTATS is not set 67# CONFIG_TASKSTATS is not set
67# CONFIG_USER_NS is not set
68# CONFIG_PID_NS is not set
69# CONFIG_AUDIT is not set 68# CONFIG_AUDIT is not set
70# CONFIG_IKCONFIG is not set 69# CONFIG_IKCONFIG is not set
71CONFIG_LOG_BUF_SHIFT=14 70CONFIG_LOG_BUF_SHIFT=14
72# CONFIG_CGROUPS is not set 71# CONFIG_CGROUPS is not set
72CONFIG_GROUP_SCHED=y
73CONFIG_FAIR_GROUP_SCHED=y 73CONFIG_FAIR_GROUP_SCHED=y
74CONFIG_FAIR_USER_SCHED=y 74# CONFIG_RT_GROUP_SCHED is not set
75# CONFIG_FAIR_CGROUP_SCHED is not set 75CONFIG_USER_SCHED=y
76# CONFIG_CGROUP_SCHED is not set
76CONFIG_SYSFS_DEPRECATED=y 77CONFIG_SYSFS_DEPRECATED=y
77# CONFIG_RELAY is not set 78# CONFIG_RELAY is not set
79# CONFIG_NAMESPACES is not set
78CONFIG_BLK_DEV_INITRD=y 80CONFIG_BLK_DEV_INITRD=y
79CONFIG_INITRAMFS_SOURCE="" 81CONFIG_INITRAMFS_SOURCE=""
80# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 82# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -88,11 +90,13 @@ CONFIG_HOTPLUG=y
88CONFIG_PRINTK=y 90CONFIG_PRINTK=y
89CONFIG_BUG=y 91CONFIG_BUG=y
90CONFIG_ELF_CORE=y 92CONFIG_ELF_CORE=y
93CONFIG_COMPAT_BRK=y
91CONFIG_BASE_FULL=y 94CONFIG_BASE_FULL=y
92CONFIG_FUTEX=y 95CONFIG_FUTEX=y
93CONFIG_ANON_INODES=y 96CONFIG_ANON_INODES=y
94CONFIG_EPOLL=y 97CONFIG_EPOLL=y
95CONFIG_SIGNALFD=y 98CONFIG_SIGNALFD=y
99CONFIG_TIMERFD=y
96CONFIG_EVENTFD=y 100CONFIG_EVENTFD=y
97CONFIG_SHMEM=y 101CONFIG_SHMEM=y
98CONFIG_VM_EVENT_COUNTERS=y 102CONFIG_VM_EVENT_COUNTERS=y
@@ -100,6 +104,13 @@ CONFIG_SLUB_DEBUG=y
100# CONFIG_SLAB is not set 104# CONFIG_SLAB is not set
101CONFIG_SLUB=y 105CONFIG_SLUB=y
102# CONFIG_SLOB is not set 106# CONFIG_SLOB is not set
107# CONFIG_PROFILING is not set
108# CONFIG_MARKERS is not set
109CONFIG_HAVE_OPROFILE=y
110# CONFIG_KPROBES is not set
111CONFIG_HAVE_KPROBES=y
112CONFIG_PROC_PAGE_MONITOR=y
113CONFIG_SLABINFO=y
103CONFIG_RT_MUTEXES=y 114CONFIG_RT_MUTEXES=y
104# CONFIG_TINY_SHMEM is not set 115# CONFIG_TINY_SHMEM is not set
105CONFIG_BASE_SMALL=0 116CONFIG_BASE_SMALL=0
@@ -127,13 +138,15 @@ CONFIG_DEFAULT_AS=y
127# CONFIG_DEFAULT_CFQ is not set 138# CONFIG_DEFAULT_CFQ is not set
128# CONFIG_DEFAULT_NOOP is not set 139# CONFIG_DEFAULT_NOOP is not set
129CONFIG_DEFAULT_IOSCHED="anticipatory" 140CONFIG_DEFAULT_IOSCHED="anticipatory"
141CONFIG_CLASSIC_RCU=y
142# CONFIG_PREEMPT_RCU is not set
130# CONFIG_PPC4xx_PCI_EXPRESS is not set 143# CONFIG_PPC4xx_PCI_EXPRESS is not set
131 144
132# 145#
133# Platform support 146# Platform support
134# 147#
135# CONFIG_PPC_MPC52xx is not set 148# CONFIG_PPC_MPC512x is not set
136# CONFIG_PPC_MPC5200 is not set 149# CONFIG_PPC_MPC5121 is not set
137# CONFIG_PPC_CELL is not set 150# CONFIG_PPC_CELL is not set
138# CONFIG_PPC_CELL_NATIVE is not set 151# CONFIG_PPC_CELL_NATIVE is not set
139# CONFIG_PQ2ADS is not set 152# CONFIG_PQ2ADS is not set
@@ -145,6 +158,7 @@ CONFIG_EP405=y
145CONFIG_405GP=y 158CONFIG_405GP=y
146CONFIG_IBM405_ERR77=y 159CONFIG_IBM405_ERR77=y
147CONFIG_IBM405_ERR51=y 160CONFIG_IBM405_ERR51=y
161# CONFIG_IPIC is not set
148# CONFIG_MPIC is not set 162# CONFIG_MPIC is not set
149# CONFIG_MPIC_WEIRD is not set 163# CONFIG_MPIC_WEIRD is not set
150# CONFIG_PPC_I8259 is not set 164# CONFIG_PPC_I8259 is not set
@@ -155,7 +169,6 @@ CONFIG_IBM405_ERR51=y
155# CONFIG_PPC_INDIRECT_IO is not set 169# CONFIG_PPC_INDIRECT_IO is not set
156# CONFIG_GENERIC_IOMAP is not set 170# CONFIG_GENERIC_IOMAP is not set
157# CONFIG_CPU_FREQ is not set 171# CONFIG_CPU_FREQ is not set
158# CONFIG_CPM2 is not set
159# CONFIG_FSL_ULI1575 is not set 172# CONFIG_FSL_ULI1575 is not set
160 173
161# 174#
@@ -171,13 +184,18 @@ CONFIG_HZ_250=y
171# CONFIG_HZ_300 is not set 184# CONFIG_HZ_300 is not set
172# CONFIG_HZ_1000 is not set 185# CONFIG_HZ_1000 is not set
173CONFIG_HZ=250 186CONFIG_HZ=250
187# CONFIG_SCHED_HRTICK is not set
174CONFIG_PREEMPT_NONE=y 188CONFIG_PREEMPT_NONE=y
175# CONFIG_PREEMPT_VOLUNTARY is not set 189# CONFIG_PREEMPT_VOLUNTARY is not set
176# CONFIG_PREEMPT is not set 190# CONFIG_PREEMPT is not set
191CONFIG_RCU_TRACE=y
177CONFIG_BINFMT_ELF=y 192CONFIG_BINFMT_ELF=y
178# CONFIG_BINFMT_MISC is not set 193# CONFIG_BINFMT_MISC is not set
179# CONFIG_MATH_EMULATION is not set 194# CONFIG_MATH_EMULATION is not set
195# CONFIG_IOMMU_HELPER is not set
180CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 196CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
197CONFIG_ARCH_HAS_WALK_MEMORY=y
198CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
181CONFIG_ARCH_FLATMEM_ENABLE=y 199CONFIG_ARCH_FLATMEM_ENABLE=y
182CONFIG_ARCH_POPULATES_NODE_MAP=y 200CONFIG_ARCH_POPULATES_NODE_MAP=y
183CONFIG_SELECT_MEMORY_MODEL=y 201CONFIG_SELECT_MEMORY_MODEL=y
@@ -196,11 +214,7 @@ CONFIG_VIRT_TO_BUS=y
196CONFIG_PROC_DEVICETREE=y 214CONFIG_PROC_DEVICETREE=y
197# CONFIG_CMDLINE_BOOL is not set 215# CONFIG_CMDLINE_BOOL is not set
198# CONFIG_PM is not set 216# CONFIG_PM is not set
199CONFIG_SUSPEND_UP_POSSIBLE=y
200CONFIG_HIBERNATION_UP_POSSIBLE=y
201CONFIG_SECCOMP=y 217CONFIG_SECCOMP=y
202CONFIG_WANT_DEVICE_TREE=y
203CONFIG_DEVICE_TREE="ep405.dts"
204CONFIG_ISA_DMA_API=y 218CONFIG_ISA_DMA_API=y
205 219
206# 220#
@@ -300,6 +314,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
300# 314#
301# CONFIG_NET_PKTGEN is not set 315# CONFIG_NET_PKTGEN is not set
302# CONFIG_HAMRADIO is not set 316# CONFIG_HAMRADIO is not set
317# CONFIG_CAN is not set
303# CONFIG_IRDA is not set 318# CONFIG_IRDA is not set
304# CONFIG_BT is not set 319# CONFIG_BT is not set
305# CONFIG_AF_RXRPC is not set 320# CONFIG_AF_RXRPC is not set
@@ -336,6 +351,7 @@ CONFIG_MTD=y
336CONFIG_MTD_PARTITIONS=y 351CONFIG_MTD_PARTITIONS=y
337# CONFIG_MTD_REDBOOT_PARTS is not set 352# CONFIG_MTD_REDBOOT_PARTS is not set
338CONFIG_MTD_CMDLINE_PARTS=y 353CONFIG_MTD_CMDLINE_PARTS=y
354CONFIG_MTD_OF_PARTS=y
339 355
340# 356#
341# User Modules And Translation Layers 357# User Modules And Translation Layers
@@ -423,7 +439,7 @@ CONFIG_BLK_DEV=y
423CONFIG_BLK_DEV_RAM=y 439CONFIG_BLK_DEV_RAM=y
424CONFIG_BLK_DEV_RAM_COUNT=16 440CONFIG_BLK_DEV_RAM_COUNT=16
425CONFIG_BLK_DEV_RAM_SIZE=35000 441CONFIG_BLK_DEV_RAM_SIZE=35000
426CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 442# CONFIG_BLK_DEV_XIP is not set
427# CONFIG_CDROM_PKTCDVD is not set 443# CONFIG_CDROM_PKTCDVD is not set
428# CONFIG_ATA_OVER_ETH is not set 444# CONFIG_ATA_OVER_ETH is not set
429# CONFIG_XILINX_SYSACE is not set 445# CONFIG_XILINX_SYSACE is not set
@@ -432,6 +448,8 @@ CONFIG_MISC_DEVICES=y
432# CONFIG_EEPROM_93CX6 is not set 448# CONFIG_EEPROM_93CX6 is not set
433# CONFIG_SGI_IOC4 is not set 449# CONFIG_SGI_IOC4 is not set
434# CONFIG_TIFM_CORE is not set 450# CONFIG_TIFM_CORE is not set
451# CONFIG_ENCLOSURE_SERVICES is not set
452CONFIG_HAVE_IDE=y
435# CONFIG_IDE is not set 453# CONFIG_IDE is not set
436 454
437# 455#
@@ -460,7 +478,6 @@ CONFIG_NETDEVICES=y
460# CONFIG_EQUALIZER is not set 478# CONFIG_EQUALIZER is not set
461# CONFIG_TUN is not set 479# CONFIG_TUN is not set
462# CONFIG_VETH is not set 480# CONFIG_VETH is not set
463# CONFIG_IP1000 is not set
464# CONFIG_ARCNET is not set 481# CONFIG_ARCNET is not set
465# CONFIG_PHYLIB is not set 482# CONFIG_PHYLIB is not set
466CONFIG_NET_ETHERNET=y 483CONFIG_NET_ETHERNET=y
@@ -489,6 +506,9 @@ CONFIG_NETDEV_1000=y
489# CONFIG_DL2K is not set 506# CONFIG_DL2K is not set
490# CONFIG_E1000 is not set 507# CONFIG_E1000 is not set
491# CONFIG_E1000E is not set 508# CONFIG_E1000E is not set
509# CONFIG_E1000E_ENABLED is not set
510# CONFIG_IP1000 is not set
511# CONFIG_IGB is not set
492# CONFIG_NS83820 is not set 512# CONFIG_NS83820 is not set
493# CONFIG_HAMACHI is not set 513# CONFIG_HAMACHI is not set
494# CONFIG_YELLOWFIN is not set 514# CONFIG_YELLOWFIN is not set
@@ -513,6 +533,7 @@ CONFIG_NETDEV_10000=y
513# CONFIG_NIU is not set 533# CONFIG_NIU is not set
514# CONFIG_MLX4_CORE is not set 534# CONFIG_MLX4_CORE is not set
515# CONFIG_TEHUTI is not set 535# CONFIG_TEHUTI is not set
536# CONFIG_BNX2X is not set
516# CONFIG_TR is not set 537# CONFIG_TR is not set
517 538
518# 539#
@@ -534,7 +555,6 @@ CONFIG_NETDEV_10000=y
534# CONFIG_HIPPI is not set 555# CONFIG_HIPPI is not set
535# CONFIG_PPP is not set 556# CONFIG_PPP is not set
536# CONFIG_SLIP is not set 557# CONFIG_SLIP is not set
537# CONFIG_SHAPER is not set
538# CONFIG_NETCONSOLE is not set 558# CONFIG_NETCONSOLE is not set
539# CONFIG_NETPOLL is not set 559# CONFIG_NETPOLL is not set
540# CONFIG_NET_POLL_CONTROLLER is not set 560# CONFIG_NET_POLL_CONTROLLER is not set
@@ -557,6 +577,7 @@ CONFIG_NETDEV_10000=y
557# 577#
558# CONFIG_VT is not set 578# CONFIG_VT is not set
559# CONFIG_SERIAL_NONSTANDARD is not set 579# CONFIG_SERIAL_NONSTANDARD is not set
580# CONFIG_NOZOMI is not set
560 581
561# 582#
562# Serial drivers 583# Serial drivers
@@ -602,6 +623,7 @@ CONFIG_DEVPORT=y
602# CONFIG_W1 is not set 623# CONFIG_W1 is not set
603# CONFIG_POWER_SUPPLY is not set 624# CONFIG_POWER_SUPPLY is not set
604# CONFIG_HWMON is not set 625# CONFIG_HWMON is not set
626CONFIG_THERMAL=y
605# CONFIG_WATCHDOG is not set 627# CONFIG_WATCHDOG is not set
606 628
607# 629#
@@ -647,6 +669,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
647CONFIG_USB_ARCH_HAS_EHCI=y 669CONFIG_USB_ARCH_HAS_EHCI=y
648CONFIG_USB=y 670CONFIG_USB=y
649# CONFIG_USB_DEBUG is not set 671# CONFIG_USB_DEBUG is not set
672# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
650 673
651# 674#
652# Miscellaneous USB options 675# Miscellaneous USB options
@@ -697,10 +720,6 @@ CONFIG_USB_MON=y
697# 720#
698# USB port drivers 721# USB port drivers
699# 722#
700
701#
702# USB Serial Converter support
703#
704# CONFIG_USB_SERIAL is not set 723# CONFIG_USB_SERIAL is not set
705 724
706# 725#
@@ -725,16 +744,9 @@ CONFIG_USB_MON=y
725# CONFIG_USB_TRANCEVIBRATOR is not set 744# CONFIG_USB_TRANCEVIBRATOR is not set
726# CONFIG_USB_IOWARRIOR is not set 745# CONFIG_USB_IOWARRIOR is not set
727# CONFIG_USB_TEST is not set 746# CONFIG_USB_TEST is not set
728
729#
730# USB DSL modem support
731#
732
733#
734# USB Gadget Support
735#
736# CONFIG_USB_GADGET is not set 747# CONFIG_USB_GADGET is not set
737# CONFIG_MMC is not set 748# CONFIG_MMC is not set
749# CONFIG_MEMSTICK is not set
738# CONFIG_NEW_LEDS is not set 750# CONFIG_NEW_LEDS is not set
739# CONFIG_INFINIBAND is not set 751# CONFIG_INFINIBAND is not set
740# CONFIG_EDAC is not set 752# CONFIG_EDAC is not set
@@ -759,12 +771,10 @@ CONFIG_EXT2_FS=y
759# CONFIG_XFS_FS is not set 771# CONFIG_XFS_FS is not set
760# CONFIG_GFS2_FS is not set 772# CONFIG_GFS2_FS is not set
761# CONFIG_OCFS2_FS is not set 773# CONFIG_OCFS2_FS is not set
762# CONFIG_MINIX_FS is not set 774CONFIG_DNOTIFY=y
763# CONFIG_ROMFS_FS is not set
764CONFIG_INOTIFY=y 775CONFIG_INOTIFY=y
765CONFIG_INOTIFY_USER=y 776CONFIG_INOTIFY_USER=y
766# CONFIG_QUOTA is not set 777# CONFIG_QUOTA is not set
767CONFIG_DNOTIFY=y
768# CONFIG_AUTOFS_FS is not set 778# CONFIG_AUTOFS_FS is not set
769# CONFIG_AUTOFS4_FS is not set 779# CONFIG_AUTOFS4_FS is not set
770# CONFIG_FUSE_FS is not set 780# CONFIG_FUSE_FS is not set
@@ -807,8 +817,10 @@ CONFIG_TMPFS=y
807# CONFIG_JFFS2_FS is not set 817# CONFIG_JFFS2_FS is not set
808CONFIG_CRAMFS=y 818CONFIG_CRAMFS=y
809# CONFIG_VXFS_FS is not set 819# CONFIG_VXFS_FS is not set
820# CONFIG_MINIX_FS is not set
810# CONFIG_HPFS_FS is not set 821# CONFIG_HPFS_FS is not set
811# CONFIG_QNX4FS_FS is not set 822# CONFIG_QNX4FS_FS is not set
823# CONFIG_ROMFS_FS is not set
812# CONFIG_SYSV_FS is not set 824# CONFIG_SYSV_FS is not set
813# CONFIG_UFS_FS is not set 825# CONFIG_UFS_FS is not set
814CONFIG_NETWORK_FILESYSTEMS=y 826CONFIG_NETWORK_FILESYSTEMS=y
@@ -839,7 +851,6 @@ CONFIG_SUNRPC=y
839CONFIG_MSDOS_PARTITION=y 851CONFIG_MSDOS_PARTITION=y
840# CONFIG_NLS is not set 852# CONFIG_NLS is not set
841# CONFIG_DLM is not set 853# CONFIG_DLM is not set
842# CONFIG_UCC_SLOW is not set
843 854
844# 855#
845# Library routines 856# Library routines
@@ -856,10 +867,6 @@ CONFIG_PLIST=y
856CONFIG_HAS_IOMEM=y 867CONFIG_HAS_IOMEM=y
857CONFIG_HAS_IOPORT=y 868CONFIG_HAS_IOPORT=y
858CONFIG_HAS_DMA=y 869CONFIG_HAS_DMA=y
859CONFIG_INSTRUMENTATION=y
860# CONFIG_PROFILING is not set
861# CONFIG_KPROBES is not set
862# CONFIG_MARKERS is not set
863 870
864# 871#
865# Kernel hacking 872# Kernel hacking
@@ -869,7 +876,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
869CONFIG_ENABLE_MUST_CHECK=y 876CONFIG_ENABLE_MUST_CHECK=y
870CONFIG_MAGIC_SYSRQ=y 877CONFIG_MAGIC_SYSRQ=y
871# CONFIG_UNUSED_SYMBOLS is not set 878# CONFIG_UNUSED_SYMBOLS is not set
872# CONFIG_DEBUG_FS is not set 879CONFIG_DEBUG_FS=y
873# CONFIG_HEADERS_CHECK is not set 880# CONFIG_HEADERS_CHECK is not set
874CONFIG_DEBUG_KERNEL=y 881CONFIG_DEBUG_KERNEL=y
875# CONFIG_DEBUG_SHIRQ is not set 882# CONFIG_DEBUG_SHIRQ is not set
@@ -878,6 +885,7 @@ CONFIG_SCHED_DEBUG=y
878# CONFIG_SCHEDSTATS is not set 885# CONFIG_SCHEDSTATS is not set
879# CONFIG_TIMER_STATS is not set 886# CONFIG_TIMER_STATS is not set
880# CONFIG_SLUB_DEBUG_ON is not set 887# CONFIG_SLUB_DEBUG_ON is not set
888# CONFIG_SLUB_STATS is not set
881# CONFIG_DEBUG_RT_MUTEXES is not set 889# CONFIG_DEBUG_RT_MUTEXES is not set
882# CONFIG_RT_MUTEX_TESTER is not set 890# CONFIG_RT_MUTEX_TESTER is not set
883# CONFIG_DEBUG_SPINLOCK is not set 891# CONFIG_DEBUG_SPINLOCK is not set
@@ -890,15 +898,16 @@ CONFIG_DEBUG_BUGVERBOSE=y
890# CONFIG_DEBUG_VM is not set 898# CONFIG_DEBUG_VM is not set
891# CONFIG_DEBUG_LIST is not set 899# CONFIG_DEBUG_LIST is not set
892# CONFIG_DEBUG_SG is not set 900# CONFIG_DEBUG_SG is not set
893CONFIG_FORCED_INLINING=y
894# CONFIG_BOOT_PRINTK_DELAY is not set 901# CONFIG_BOOT_PRINTK_DELAY is not set
895# CONFIG_RCU_TORTURE_TEST is not set 902# CONFIG_RCU_TORTURE_TEST is not set
903# CONFIG_BACKTRACE_SELF_TEST is not set
896# CONFIG_FAULT_INJECTION is not set 904# CONFIG_FAULT_INJECTION is not set
897# CONFIG_SAMPLES is not set 905# CONFIG_SAMPLES is not set
898# CONFIG_DEBUG_STACKOVERFLOW is not set 906# CONFIG_DEBUG_STACKOVERFLOW is not set
899# CONFIG_DEBUG_STACK_USAGE is not set 907# CONFIG_DEBUG_STACK_USAGE is not set
900# CONFIG_DEBUG_PAGEALLOC is not set 908# CONFIG_DEBUG_PAGEALLOC is not set
901# CONFIG_DEBUGGER is not set 909# CONFIG_DEBUGGER is not set
910# CONFIG_VIRQ_DEBUG is not set
902# CONFIG_BDI_SWITCH is not set 911# CONFIG_BDI_SWITCH is not set
903# CONFIG_PPC_EARLY_DEBUG is not set 912# CONFIG_PPC_EARLY_DEBUG is not set
904 913
@@ -911,6 +920,7 @@ CONFIG_FORCED_INLINING=y
911CONFIG_CRYPTO=y 920CONFIG_CRYPTO=y
912CONFIG_CRYPTO_ALGAPI=y 921CONFIG_CRYPTO_ALGAPI=y
913CONFIG_CRYPTO_BLKCIPHER=y 922CONFIG_CRYPTO_BLKCIPHER=y
923# CONFIG_CRYPTO_SEQIV is not set
914CONFIG_CRYPTO_MANAGER=y 924CONFIG_CRYPTO_MANAGER=y
915# CONFIG_CRYPTO_HMAC is not set 925# CONFIG_CRYPTO_HMAC is not set
916# CONFIG_CRYPTO_XCBC is not set 926# CONFIG_CRYPTO_XCBC is not set
@@ -928,6 +938,9 @@ CONFIG_CRYPTO_CBC=y
928CONFIG_CRYPTO_PCBC=y 938CONFIG_CRYPTO_PCBC=y
929# CONFIG_CRYPTO_LRW is not set 939# CONFIG_CRYPTO_LRW is not set
930# CONFIG_CRYPTO_XTS is not set 940# CONFIG_CRYPTO_XTS is not set
941# CONFIG_CRYPTO_CTR is not set
942# CONFIG_CRYPTO_GCM is not set
943# CONFIG_CRYPTO_CCM is not set
931# CONFIG_CRYPTO_CRYPTD is not set 944# CONFIG_CRYPTO_CRYPTD is not set
932CONFIG_CRYPTO_DES=y 945CONFIG_CRYPTO_DES=y
933# CONFIG_CRYPTO_FCRYPT is not set 946# CONFIG_CRYPTO_FCRYPT is not set
@@ -942,11 +955,14 @@ CONFIG_CRYPTO_DES=y
942# CONFIG_CRYPTO_KHAZAD is not set 955# CONFIG_CRYPTO_KHAZAD is not set
943# CONFIG_CRYPTO_ANUBIS is not set 956# CONFIG_CRYPTO_ANUBIS is not set
944# CONFIG_CRYPTO_SEED is not set 957# CONFIG_CRYPTO_SEED is not set
958# CONFIG_CRYPTO_SALSA20 is not set
945# CONFIG_CRYPTO_DEFLATE is not set 959# CONFIG_CRYPTO_DEFLATE is not set
946# CONFIG_CRYPTO_MICHAEL_MIC is not set 960# CONFIG_CRYPTO_MICHAEL_MIC is not set
947# CONFIG_CRYPTO_CRC32C is not set 961# CONFIG_CRYPTO_CRC32C is not set
948# CONFIG_CRYPTO_CAMELLIA is not set 962# CONFIG_CRYPTO_CAMELLIA is not set
949# CONFIG_CRYPTO_TEST is not set 963# CONFIG_CRYPTO_TEST is not set
950# CONFIG_CRYPTO_AUTHENC is not set 964# CONFIG_CRYPTO_AUTHENC is not set
965# CONFIG_CRYPTO_LZO is not set
951CONFIG_CRYPTO_HW=y 966CONFIG_CRYPTO_HW=y
967# CONFIG_CRYPTO_DEV_HIFN_795X is not set
952# CONFIG_PPC_CLOCK is not set 968# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/kilauea_defconfig b/arch/powerpc/configs/kilauea_defconfig
index 8dca3d451c0e..2f475391f1d1 100644
--- a/arch/powerpc/configs/kilauea_defconfig
+++ b/arch/powerpc/configs/kilauea_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Thu Jan 3 14:21:31 2008 4# Fri Feb 15 21:51:43 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -26,6 +26,7 @@ CONFIG_GENERIC_TIME=y
26CONFIG_GENERIC_TIME_VSYSCALL=y 26CONFIG_GENERIC_TIME_VSYSCALL=y
27CONFIG_GENERIC_CLOCKEVENTS=y 27CONFIG_GENERIC_CLOCKEVENTS=y
28CONFIG_GENERIC_HARDIRQS=y 28CONFIG_GENERIC_HARDIRQS=y
29# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
29CONFIG_IRQ_PER_CPU=y 30CONFIG_IRQ_PER_CPU=y
30CONFIG_RWSEM_XCHGADD_ALGORITHM=y 31CONFIG_RWSEM_XCHGADD_ALGORITHM=y
31CONFIG_ARCH_HAS_ILOG2_U32=y 32CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -64,15 +65,18 @@ CONFIG_SYSVIPC_SYSCTL=y
64CONFIG_POSIX_MQUEUE=y 65CONFIG_POSIX_MQUEUE=y
65# CONFIG_BSD_PROCESS_ACCT is not set 66# CONFIG_BSD_PROCESS_ACCT is not set
66# CONFIG_TASKSTATS is not set 67# CONFIG_TASKSTATS is not set
67# CONFIG_USER_NS is not set
68# CONFIG_PID_NS is not set
69# CONFIG_AUDIT is not set 68# CONFIG_AUDIT is not set
70# CONFIG_IKCONFIG is not set 69# CONFIG_IKCONFIG is not set
71CONFIG_LOG_BUF_SHIFT=14 70CONFIG_LOG_BUF_SHIFT=14
72# CONFIG_CGROUPS is not set 71# CONFIG_CGROUPS is not set
72CONFIG_GROUP_SCHED=y
73# CONFIG_FAIR_GROUP_SCHED is not set 73# CONFIG_FAIR_GROUP_SCHED is not set
74# CONFIG_RT_GROUP_SCHED is not set
75CONFIG_USER_SCHED=y
76# CONFIG_CGROUP_SCHED is not set
74CONFIG_SYSFS_DEPRECATED=y 77CONFIG_SYSFS_DEPRECATED=y
75# CONFIG_RELAY is not set 78# CONFIG_RELAY is not set
79# CONFIG_NAMESPACES is not set
76CONFIG_BLK_DEV_INITRD=y 80CONFIG_BLK_DEV_INITRD=y
77CONFIG_INITRAMFS_SOURCE="" 81CONFIG_INITRAMFS_SOURCE=""
78# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 82# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -86,11 +90,13 @@ CONFIG_HOTPLUG=y
86CONFIG_PRINTK=y 90CONFIG_PRINTK=y
87CONFIG_BUG=y 91CONFIG_BUG=y
88CONFIG_ELF_CORE=y 92CONFIG_ELF_CORE=y
93CONFIG_COMPAT_BRK=y
89CONFIG_BASE_FULL=y 94CONFIG_BASE_FULL=y
90CONFIG_FUTEX=y 95CONFIG_FUTEX=y
91CONFIG_ANON_INODES=y 96CONFIG_ANON_INODES=y
92CONFIG_EPOLL=y 97CONFIG_EPOLL=y
93CONFIG_SIGNALFD=y 98CONFIG_SIGNALFD=y
99CONFIG_TIMERFD=y
94CONFIG_EVENTFD=y 100CONFIG_EVENTFD=y
95CONFIG_SHMEM=y 101CONFIG_SHMEM=y
96CONFIG_VM_EVENT_COUNTERS=y 102CONFIG_VM_EVENT_COUNTERS=y
@@ -98,6 +104,13 @@ CONFIG_SLUB_DEBUG=y
98# CONFIG_SLAB is not set 104# CONFIG_SLAB is not set
99CONFIG_SLUB=y 105CONFIG_SLUB=y
100# CONFIG_SLOB is not set 106# CONFIG_SLOB is not set
107# CONFIG_PROFILING is not set
108# CONFIG_MARKERS is not set
109CONFIG_HAVE_OPROFILE=y
110# CONFIG_KPROBES is not set
111CONFIG_HAVE_KPROBES=y
112CONFIG_PROC_PAGE_MONITOR=y
113CONFIG_SLABINFO=y
101CONFIG_RT_MUTEXES=y 114CONFIG_RT_MUTEXES=y
102# CONFIG_TINY_SHMEM is not set 115# CONFIG_TINY_SHMEM is not set
103CONFIG_BASE_SMALL=0 116CONFIG_BASE_SMALL=0
@@ -125,13 +138,15 @@ CONFIG_DEFAULT_AS=y
125# CONFIG_DEFAULT_CFQ is not set 138# CONFIG_DEFAULT_CFQ is not set
126# CONFIG_DEFAULT_NOOP is not set 139# CONFIG_DEFAULT_NOOP is not set
127CONFIG_DEFAULT_IOSCHED="anticipatory" 140CONFIG_DEFAULT_IOSCHED="anticipatory"
141CONFIG_CLASSIC_RCU=y
142# CONFIG_PREEMPT_RCU is not set
128CONFIG_PPC4xx_PCI_EXPRESS=y 143CONFIG_PPC4xx_PCI_EXPRESS=y
129 144
130# 145#
131# Platform support 146# Platform support
132# 147#
133# CONFIG_PPC_MPC52xx is not set 148# CONFIG_PPC_MPC512x is not set
134# CONFIG_PPC_MPC5200 is not set 149# CONFIG_PPC_MPC5121 is not set
135# CONFIG_PPC_CELL is not set 150# CONFIG_PPC_CELL is not set
136# CONFIG_PPC_CELL_NATIVE is not set 151# CONFIG_PPC_CELL_NATIVE is not set
137# CONFIG_PQ2ADS is not set 152# CONFIG_PQ2ADS is not set
@@ -141,6 +156,7 @@ CONFIG_KILAUEA=y
141# CONFIG_WALNUT is not set 156# CONFIG_WALNUT is not set
142# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set 157# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set
143CONFIG_405EX=y 158CONFIG_405EX=y
159# CONFIG_IPIC is not set
144# CONFIG_MPIC is not set 160# CONFIG_MPIC is not set
145# CONFIG_MPIC_WEIRD is not set 161# CONFIG_MPIC_WEIRD is not set
146# CONFIG_PPC_I8259 is not set 162# CONFIG_PPC_I8259 is not set
@@ -151,7 +167,6 @@ CONFIG_405EX=y
151# CONFIG_PPC_INDIRECT_IO is not set 167# CONFIG_PPC_INDIRECT_IO is not set
152# CONFIG_GENERIC_IOMAP is not set 168# CONFIG_GENERIC_IOMAP is not set
153# CONFIG_CPU_FREQ is not set 169# CONFIG_CPU_FREQ is not set
154# CONFIG_CPM2 is not set
155# CONFIG_FSL_ULI1575 is not set 170# CONFIG_FSL_ULI1575 is not set
156 171
157# 172#
@@ -167,13 +182,18 @@ CONFIG_HZ_250=y
167# CONFIG_HZ_300 is not set 182# CONFIG_HZ_300 is not set
168# CONFIG_HZ_1000 is not set 183# CONFIG_HZ_1000 is not set
169CONFIG_HZ=250 184CONFIG_HZ=250
185# CONFIG_SCHED_HRTICK is not set
170CONFIG_PREEMPT_NONE=y 186CONFIG_PREEMPT_NONE=y
171# CONFIG_PREEMPT_VOLUNTARY is not set 187# CONFIG_PREEMPT_VOLUNTARY is not set
172# CONFIG_PREEMPT is not set 188# CONFIG_PREEMPT is not set
189CONFIG_RCU_TRACE=y
173CONFIG_BINFMT_ELF=y 190CONFIG_BINFMT_ELF=y
174# CONFIG_BINFMT_MISC is not set 191# CONFIG_BINFMT_MISC is not set
175# CONFIG_MATH_EMULATION is not set 192# CONFIG_MATH_EMULATION is not set
193# CONFIG_IOMMU_HELPER is not set
176CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 194CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
195CONFIG_ARCH_HAS_WALK_MEMORY=y
196CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
177CONFIG_ARCH_FLATMEM_ENABLE=y 197CONFIG_ARCH_FLATMEM_ENABLE=y
178CONFIG_ARCH_POPULATES_NODE_MAP=y 198CONFIG_ARCH_POPULATES_NODE_MAP=y
179CONFIG_SELECT_MEMORY_MODEL=y 199CONFIG_SELECT_MEMORY_MODEL=y
@@ -192,11 +212,7 @@ CONFIG_VIRT_TO_BUS=y
192CONFIG_PROC_DEVICETREE=y 212CONFIG_PROC_DEVICETREE=y
193# CONFIG_CMDLINE_BOOL is not set 213# CONFIG_CMDLINE_BOOL is not set
194# CONFIG_PM is not set 214# CONFIG_PM is not set
195CONFIG_SUSPEND_UP_POSSIBLE=y
196CONFIG_HIBERNATION_UP_POSSIBLE=y
197CONFIG_SECCOMP=y 215CONFIG_SECCOMP=y
198CONFIG_WANT_DEVICE_TREE=y
199CONFIG_DEVICE_TREE="kilauea.dts"
200CONFIG_ISA_DMA_API=y 216CONFIG_ISA_DMA_API=y
201 217
202# 218#
@@ -296,6 +312,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
296# 312#
297# CONFIG_NET_PKTGEN is not set 313# CONFIG_NET_PKTGEN is not set
298# CONFIG_HAMRADIO is not set 314# CONFIG_HAMRADIO is not set
315# CONFIG_CAN is not set
299# CONFIG_IRDA is not set 316# CONFIG_IRDA is not set
300# CONFIG_BT is not set 317# CONFIG_BT is not set
301# CONFIG_AF_RXRPC is not set 318# CONFIG_AF_RXRPC is not set
@@ -332,6 +349,7 @@ CONFIG_MTD=y
332CONFIG_MTD_PARTITIONS=y 349CONFIG_MTD_PARTITIONS=y
333# CONFIG_MTD_REDBOOT_PARTS is not set 350# CONFIG_MTD_REDBOOT_PARTS is not set
334CONFIG_MTD_CMDLINE_PARTS=y 351CONFIG_MTD_CMDLINE_PARTS=y
352CONFIG_MTD_OF_PARTS=y
335 353
336# 354#
337# User Modules And Translation Layers 355# User Modules And Translation Layers
@@ -418,11 +436,12 @@ CONFIG_BLK_DEV=y
418CONFIG_BLK_DEV_RAM=y 436CONFIG_BLK_DEV_RAM=y
419CONFIG_BLK_DEV_RAM_COUNT=16 437CONFIG_BLK_DEV_RAM_COUNT=16
420CONFIG_BLK_DEV_RAM_SIZE=35000 438CONFIG_BLK_DEV_RAM_SIZE=35000
421CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 439# CONFIG_BLK_DEV_XIP is not set
422# CONFIG_CDROM_PKTCDVD is not set 440# CONFIG_CDROM_PKTCDVD is not set
423# CONFIG_ATA_OVER_ETH is not set 441# CONFIG_ATA_OVER_ETH is not set
424# CONFIG_XILINX_SYSACE is not set 442# CONFIG_XILINX_SYSACE is not set
425# CONFIG_MISC_DEVICES is not set 443# CONFIG_MISC_DEVICES is not set
444CONFIG_HAVE_IDE=y
426# CONFIG_IDE is not set 445# CONFIG_IDE is not set
427 446
428# 447#
@@ -451,7 +470,6 @@ CONFIG_NETDEVICES=y
451# CONFIG_EQUALIZER is not set 470# CONFIG_EQUALIZER is not set
452# CONFIG_TUN is not set 471# CONFIG_TUN is not set
453# CONFIG_VETH is not set 472# CONFIG_VETH is not set
454# CONFIG_IP1000 is not set
455# CONFIG_ARCNET is not set 473# CONFIG_ARCNET is not set
456# CONFIG_PHYLIB is not set 474# CONFIG_PHYLIB is not set
457CONFIG_NET_ETHERNET=y 475CONFIG_NET_ETHERNET=y
@@ -489,7 +507,6 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
489# CONFIG_HIPPI is not set 507# CONFIG_HIPPI is not set
490# CONFIG_PPP is not set 508# CONFIG_PPP is not set
491# CONFIG_SLIP is not set 509# CONFIG_SLIP is not set
492# CONFIG_SHAPER is not set
493# CONFIG_NETCONSOLE is not set 510# CONFIG_NETCONSOLE is not set
494# CONFIG_NETPOLL is not set 511# CONFIG_NETPOLL is not set
495# CONFIG_NET_POLL_CONTROLLER is not set 512# CONFIG_NET_POLL_CONTROLLER is not set
@@ -512,6 +529,7 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
512# 529#
513# CONFIG_VT is not set 530# CONFIG_VT is not set
514# CONFIG_SERIAL_NONSTANDARD is not set 531# CONFIG_SERIAL_NONSTANDARD is not set
532# CONFIG_NOZOMI is not set
515 533
516# 534#
517# Serial drivers 535# Serial drivers
@@ -557,6 +575,7 @@ CONFIG_DEVPORT=y
557# CONFIG_W1 is not set 575# CONFIG_W1 is not set
558# CONFIG_POWER_SUPPLY is not set 576# CONFIG_POWER_SUPPLY is not set
559# CONFIG_HWMON is not set 577# CONFIG_HWMON is not set
578CONFIG_THERMAL=y
560# CONFIG_WATCHDOG is not set 579# CONFIG_WATCHDOG is not set
561 580
562# 581#
@@ -598,6 +617,7 @@ CONFIG_SSB_POSSIBLE=y
598# CONFIG_SOUND is not set 617# CONFIG_SOUND is not set
599# CONFIG_USB_SUPPORT is not set 618# CONFIG_USB_SUPPORT is not set
600# CONFIG_MMC is not set 619# CONFIG_MMC is not set
620# CONFIG_MEMSTICK is not set
601# CONFIG_NEW_LEDS is not set 621# CONFIG_NEW_LEDS is not set
602# CONFIG_INFINIBAND is not set 622# CONFIG_INFINIBAND is not set
603# CONFIG_EDAC is not set 623# CONFIG_EDAC is not set
@@ -622,12 +642,10 @@ CONFIG_EXT2_FS=y
622# CONFIG_XFS_FS is not set 642# CONFIG_XFS_FS is not set
623# CONFIG_GFS2_FS is not set 643# CONFIG_GFS2_FS is not set
624# CONFIG_OCFS2_FS is not set 644# CONFIG_OCFS2_FS is not set
625# CONFIG_MINIX_FS is not set 645CONFIG_DNOTIFY=y
626# CONFIG_ROMFS_FS is not set
627CONFIG_INOTIFY=y 646CONFIG_INOTIFY=y
628CONFIG_INOTIFY_USER=y 647CONFIG_INOTIFY_USER=y
629# CONFIG_QUOTA is not set 648# CONFIG_QUOTA is not set
630CONFIG_DNOTIFY=y
631# CONFIG_AUTOFS_FS is not set 649# CONFIG_AUTOFS_FS is not set
632# CONFIG_AUTOFS4_FS is not set 650# CONFIG_AUTOFS4_FS is not set
633# CONFIG_FUSE_FS is not set 651# CONFIG_FUSE_FS is not set
@@ -670,8 +688,10 @@ CONFIG_TMPFS=y
670# CONFIG_JFFS2_FS is not set 688# CONFIG_JFFS2_FS is not set
671CONFIG_CRAMFS=y 689CONFIG_CRAMFS=y
672# CONFIG_VXFS_FS is not set 690# CONFIG_VXFS_FS is not set
691# CONFIG_MINIX_FS is not set
673# CONFIG_HPFS_FS is not set 692# CONFIG_HPFS_FS is not set
674# CONFIG_QNX4FS_FS is not set 693# CONFIG_QNX4FS_FS is not set
694# CONFIG_ROMFS_FS is not set
675# CONFIG_SYSV_FS is not set 695# CONFIG_SYSV_FS is not set
676# CONFIG_UFS_FS is not set 696# CONFIG_UFS_FS is not set
677CONFIG_NETWORK_FILESYSTEMS=y 697CONFIG_NETWORK_FILESYSTEMS=y
@@ -702,7 +722,6 @@ CONFIG_SUNRPC=y
702CONFIG_MSDOS_PARTITION=y 722CONFIG_MSDOS_PARTITION=y
703# CONFIG_NLS is not set 723# CONFIG_NLS is not set
704# CONFIG_DLM is not set 724# CONFIG_DLM is not set
705# CONFIG_UCC_SLOW is not set
706 725
707# 726#
708# Library routines 727# Library routines
@@ -719,7 +738,6 @@ CONFIG_PLIST=y
719CONFIG_HAS_IOMEM=y 738CONFIG_HAS_IOMEM=y
720CONFIG_HAS_IOPORT=y 739CONFIG_HAS_IOPORT=y
721CONFIG_HAS_DMA=y 740CONFIG_HAS_DMA=y
722# CONFIG_INSTRUMENTATION is not set
723 741
724# 742#
725# Kernel hacking 743# Kernel hacking
@@ -729,7 +747,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
729CONFIG_ENABLE_MUST_CHECK=y 747CONFIG_ENABLE_MUST_CHECK=y
730CONFIG_MAGIC_SYSRQ=y 748CONFIG_MAGIC_SYSRQ=y
731# CONFIG_UNUSED_SYMBOLS is not set 749# CONFIG_UNUSED_SYMBOLS is not set
732# CONFIG_DEBUG_FS is not set 750CONFIG_DEBUG_FS=y
733# CONFIG_HEADERS_CHECK is not set 751# CONFIG_HEADERS_CHECK is not set
734CONFIG_DEBUG_KERNEL=y 752CONFIG_DEBUG_KERNEL=y
735# CONFIG_DEBUG_SHIRQ is not set 753# CONFIG_DEBUG_SHIRQ is not set
@@ -738,6 +756,7 @@ CONFIG_SCHED_DEBUG=y
738# CONFIG_SCHEDSTATS is not set 756# CONFIG_SCHEDSTATS is not set
739# CONFIG_TIMER_STATS is not set 757# CONFIG_TIMER_STATS is not set
740# CONFIG_SLUB_DEBUG_ON is not set 758# CONFIG_SLUB_DEBUG_ON is not set
759# CONFIG_SLUB_STATS is not set
741# CONFIG_DEBUG_RT_MUTEXES is not set 760# CONFIG_DEBUG_RT_MUTEXES is not set
742# CONFIG_RT_MUTEX_TESTER is not set 761# CONFIG_RT_MUTEX_TESTER is not set
743# CONFIG_DEBUG_SPINLOCK is not set 762# CONFIG_DEBUG_SPINLOCK is not set
@@ -750,15 +769,16 @@ CONFIG_DEBUG_BUGVERBOSE=y
750# CONFIG_DEBUG_VM is not set 769# CONFIG_DEBUG_VM is not set
751# CONFIG_DEBUG_LIST is not set 770# CONFIG_DEBUG_LIST is not set
752# CONFIG_DEBUG_SG is not set 771# CONFIG_DEBUG_SG is not set
753CONFIG_FORCED_INLINING=y
754# CONFIG_BOOT_PRINTK_DELAY is not set 772# CONFIG_BOOT_PRINTK_DELAY is not set
755# CONFIG_RCU_TORTURE_TEST is not set 773# CONFIG_RCU_TORTURE_TEST is not set
774# CONFIG_BACKTRACE_SELF_TEST is not set
756# CONFIG_FAULT_INJECTION is not set 775# CONFIG_FAULT_INJECTION is not set
757# CONFIG_SAMPLES is not set 776# CONFIG_SAMPLES is not set
758# CONFIG_DEBUG_STACKOVERFLOW is not set 777# CONFIG_DEBUG_STACKOVERFLOW is not set
759# CONFIG_DEBUG_STACK_USAGE is not set 778# CONFIG_DEBUG_STACK_USAGE is not set
760# CONFIG_DEBUG_PAGEALLOC is not set 779# CONFIG_DEBUG_PAGEALLOC is not set
761# CONFIG_DEBUGGER is not set 780# CONFIG_DEBUGGER is not set
781# CONFIG_VIRQ_DEBUG is not set
762# CONFIG_BDI_SWITCH is not set 782# CONFIG_BDI_SWITCH is not set
763# CONFIG_PPC_EARLY_DEBUG is not set 783# CONFIG_PPC_EARLY_DEBUG is not set
764 784
@@ -771,6 +791,7 @@ CONFIG_FORCED_INLINING=y
771CONFIG_CRYPTO=y 791CONFIG_CRYPTO=y
772CONFIG_CRYPTO_ALGAPI=y 792CONFIG_CRYPTO_ALGAPI=y
773CONFIG_CRYPTO_BLKCIPHER=y 793CONFIG_CRYPTO_BLKCIPHER=y
794# CONFIG_CRYPTO_SEQIV is not set
774CONFIG_CRYPTO_MANAGER=y 795CONFIG_CRYPTO_MANAGER=y
775# CONFIG_CRYPTO_HMAC is not set 796# CONFIG_CRYPTO_HMAC is not set
776# CONFIG_CRYPTO_XCBC is not set 797# CONFIG_CRYPTO_XCBC is not set
@@ -788,6 +809,9 @@ CONFIG_CRYPTO_CBC=y
788CONFIG_CRYPTO_PCBC=y 809CONFIG_CRYPTO_PCBC=y
789# CONFIG_CRYPTO_LRW is not set 810# CONFIG_CRYPTO_LRW is not set
790# CONFIG_CRYPTO_XTS is not set 811# CONFIG_CRYPTO_XTS is not set
812# CONFIG_CRYPTO_CTR is not set
813# CONFIG_CRYPTO_GCM is not set
814# CONFIG_CRYPTO_CCM is not set
791# CONFIG_CRYPTO_CRYPTD is not set 815# CONFIG_CRYPTO_CRYPTD is not set
792CONFIG_CRYPTO_DES=y 816CONFIG_CRYPTO_DES=y
793# CONFIG_CRYPTO_FCRYPT is not set 817# CONFIG_CRYPTO_FCRYPT is not set
@@ -802,11 +826,14 @@ CONFIG_CRYPTO_DES=y
802# CONFIG_CRYPTO_KHAZAD is not set 826# CONFIG_CRYPTO_KHAZAD is not set
803# CONFIG_CRYPTO_ANUBIS is not set 827# CONFIG_CRYPTO_ANUBIS is not set
804# CONFIG_CRYPTO_SEED is not set 828# CONFIG_CRYPTO_SEED is not set
829# CONFIG_CRYPTO_SALSA20 is not set
805# CONFIG_CRYPTO_DEFLATE is not set 830# CONFIG_CRYPTO_DEFLATE is not set
806# CONFIG_CRYPTO_MICHAEL_MIC is not set 831# CONFIG_CRYPTO_MICHAEL_MIC is not set
807# CONFIG_CRYPTO_CRC32C is not set 832# CONFIG_CRYPTO_CRC32C is not set
808# CONFIG_CRYPTO_CAMELLIA is not set 833# CONFIG_CRYPTO_CAMELLIA is not set
809# CONFIG_CRYPTO_TEST is not set 834# CONFIG_CRYPTO_TEST is not set
810# CONFIG_CRYPTO_AUTHENC is not set 835# CONFIG_CRYPTO_AUTHENC is not set
836# CONFIG_CRYPTO_LZO is not set
811CONFIG_CRYPTO_HW=y 837CONFIG_CRYPTO_HW=y
838# CONFIG_CRYPTO_DEV_HIFN_795X is not set
812# CONFIG_PPC_CLOCK is not set 839# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/makalu_defconfig b/arch/powerpc/configs/makalu_defconfig
index c5db0265e5d8..9ef4d8a312c8 100644
--- a/arch/powerpc/configs/makalu_defconfig
+++ b/arch/powerpc/configs/makalu_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Mon Dec 24 11:18:32 2007 4# Fri Feb 15 21:52:30 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -26,6 +26,7 @@ CONFIG_GENERIC_TIME=y
26CONFIG_GENERIC_TIME_VSYSCALL=y 26CONFIG_GENERIC_TIME_VSYSCALL=y
27CONFIG_GENERIC_CLOCKEVENTS=y 27CONFIG_GENERIC_CLOCKEVENTS=y
28CONFIG_GENERIC_HARDIRQS=y 28CONFIG_GENERIC_HARDIRQS=y
29# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
29CONFIG_IRQ_PER_CPU=y 30CONFIG_IRQ_PER_CPU=y
30CONFIG_RWSEM_XCHGADD_ALGORITHM=y 31CONFIG_RWSEM_XCHGADD_ALGORITHM=y
31CONFIG_ARCH_HAS_ILOG2_U32=y 32CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -64,15 +65,18 @@ CONFIG_SYSVIPC_SYSCTL=y
64CONFIG_POSIX_MQUEUE=y 65CONFIG_POSIX_MQUEUE=y
65# CONFIG_BSD_PROCESS_ACCT is not set 66# CONFIG_BSD_PROCESS_ACCT is not set
66# CONFIG_TASKSTATS is not set 67# CONFIG_TASKSTATS is not set
67# CONFIG_USER_NS is not set
68# CONFIG_PID_NS is not set
69# CONFIG_AUDIT is not set 68# CONFIG_AUDIT is not set
70# CONFIG_IKCONFIG is not set 69# CONFIG_IKCONFIG is not set
71CONFIG_LOG_BUF_SHIFT=14 70CONFIG_LOG_BUF_SHIFT=14
72# CONFIG_CGROUPS is not set 71# CONFIG_CGROUPS is not set
72CONFIG_GROUP_SCHED=y
73# CONFIG_FAIR_GROUP_SCHED is not set 73# CONFIG_FAIR_GROUP_SCHED is not set
74# CONFIG_RT_GROUP_SCHED is not set
75CONFIG_USER_SCHED=y
76# CONFIG_CGROUP_SCHED is not set
74CONFIG_SYSFS_DEPRECATED=y 77CONFIG_SYSFS_DEPRECATED=y
75# CONFIG_RELAY is not set 78# CONFIG_RELAY is not set
79# CONFIG_NAMESPACES is not set
76CONFIG_BLK_DEV_INITRD=y 80CONFIG_BLK_DEV_INITRD=y
77CONFIG_INITRAMFS_SOURCE="" 81CONFIG_INITRAMFS_SOURCE=""
78# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 82# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -86,11 +90,13 @@ CONFIG_HOTPLUG=y
86CONFIG_PRINTK=y 90CONFIG_PRINTK=y
87CONFIG_BUG=y 91CONFIG_BUG=y
88CONFIG_ELF_CORE=y 92CONFIG_ELF_CORE=y
93CONFIG_COMPAT_BRK=y
89CONFIG_BASE_FULL=y 94CONFIG_BASE_FULL=y
90CONFIG_FUTEX=y 95CONFIG_FUTEX=y
91CONFIG_ANON_INODES=y 96CONFIG_ANON_INODES=y
92CONFIG_EPOLL=y 97CONFIG_EPOLL=y
93CONFIG_SIGNALFD=y 98CONFIG_SIGNALFD=y
99CONFIG_TIMERFD=y
94CONFIG_EVENTFD=y 100CONFIG_EVENTFD=y
95CONFIG_SHMEM=y 101CONFIG_SHMEM=y
96CONFIG_VM_EVENT_COUNTERS=y 102CONFIG_VM_EVENT_COUNTERS=y
@@ -98,6 +104,13 @@ CONFIG_SLUB_DEBUG=y
98# CONFIG_SLAB is not set 104# CONFIG_SLAB is not set
99CONFIG_SLUB=y 105CONFIG_SLUB=y
100# CONFIG_SLOB is not set 106# CONFIG_SLOB is not set
107# CONFIG_PROFILING is not set
108# CONFIG_MARKERS is not set
109CONFIG_HAVE_OPROFILE=y
110# CONFIG_KPROBES is not set
111CONFIG_HAVE_KPROBES=y
112CONFIG_PROC_PAGE_MONITOR=y
113CONFIG_SLABINFO=y
101CONFIG_RT_MUTEXES=y 114CONFIG_RT_MUTEXES=y
102# CONFIG_TINY_SHMEM is not set 115# CONFIG_TINY_SHMEM is not set
103CONFIG_BASE_SMALL=0 116CONFIG_BASE_SMALL=0
@@ -125,13 +138,15 @@ CONFIG_DEFAULT_AS=y
125# CONFIG_DEFAULT_CFQ is not set 138# CONFIG_DEFAULT_CFQ is not set
126# CONFIG_DEFAULT_NOOP is not set 139# CONFIG_DEFAULT_NOOP is not set
127CONFIG_DEFAULT_IOSCHED="anticipatory" 140CONFIG_DEFAULT_IOSCHED="anticipatory"
141CONFIG_CLASSIC_RCU=y
142# CONFIG_PREEMPT_RCU is not set
128CONFIG_PPC4xx_PCI_EXPRESS=y 143CONFIG_PPC4xx_PCI_EXPRESS=y
129 144
130# 145#
131# Platform support 146# Platform support
132# 147#
133# CONFIG_PPC_MPC52xx is not set 148# CONFIG_PPC_MPC512x is not set
134# CONFIG_PPC_MPC5200 is not set 149# CONFIG_PPC_MPC5121 is not set
135# CONFIG_PPC_CELL is not set 150# CONFIG_PPC_CELL is not set
136# CONFIG_PPC_CELL_NATIVE is not set 151# CONFIG_PPC_CELL_NATIVE is not set
137# CONFIG_PQ2ADS is not set 152# CONFIG_PQ2ADS is not set
@@ -141,6 +156,7 @@ CONFIG_MAKALU=y
141# CONFIG_WALNUT is not set 156# CONFIG_WALNUT is not set
142# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set 157# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set
143CONFIG_405EX=y 158CONFIG_405EX=y
159# CONFIG_IPIC is not set
144# CONFIG_MPIC is not set 160# CONFIG_MPIC is not set
145# CONFIG_MPIC_WEIRD is not set 161# CONFIG_MPIC_WEIRD is not set
146# CONFIG_PPC_I8259 is not set 162# CONFIG_PPC_I8259 is not set
@@ -151,7 +167,6 @@ CONFIG_405EX=y
151# CONFIG_PPC_INDIRECT_IO is not set 167# CONFIG_PPC_INDIRECT_IO is not set
152# CONFIG_GENERIC_IOMAP is not set 168# CONFIG_GENERIC_IOMAP is not set
153# CONFIG_CPU_FREQ is not set 169# CONFIG_CPU_FREQ is not set
154# CONFIG_CPM2 is not set
155# CONFIG_FSL_ULI1575 is not set 170# CONFIG_FSL_ULI1575 is not set
156 171
157# 172#
@@ -167,13 +182,18 @@ CONFIG_HZ_250=y
167# CONFIG_HZ_300 is not set 182# CONFIG_HZ_300 is not set
168# CONFIG_HZ_1000 is not set 183# CONFIG_HZ_1000 is not set
169CONFIG_HZ=250 184CONFIG_HZ=250
185# CONFIG_SCHED_HRTICK is not set
170CONFIG_PREEMPT_NONE=y 186CONFIG_PREEMPT_NONE=y
171# CONFIG_PREEMPT_VOLUNTARY is not set 187# CONFIG_PREEMPT_VOLUNTARY is not set
172# CONFIG_PREEMPT is not set 188# CONFIG_PREEMPT is not set
189CONFIG_RCU_TRACE=y
173CONFIG_BINFMT_ELF=y 190CONFIG_BINFMT_ELF=y
174# CONFIG_BINFMT_MISC is not set 191# CONFIG_BINFMT_MISC is not set
175# CONFIG_MATH_EMULATION is not set 192# CONFIG_MATH_EMULATION is not set
193# CONFIG_IOMMU_HELPER is not set
176CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 194CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
195CONFIG_ARCH_HAS_WALK_MEMORY=y
196CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
177CONFIG_ARCH_FLATMEM_ENABLE=y 197CONFIG_ARCH_FLATMEM_ENABLE=y
178CONFIG_ARCH_POPULATES_NODE_MAP=y 198CONFIG_ARCH_POPULATES_NODE_MAP=y
179CONFIG_SELECT_MEMORY_MODEL=y 199CONFIG_SELECT_MEMORY_MODEL=y
@@ -192,11 +212,7 @@ CONFIG_VIRT_TO_BUS=y
192CONFIG_PROC_DEVICETREE=y 212CONFIG_PROC_DEVICETREE=y
193# CONFIG_CMDLINE_BOOL is not set 213# CONFIG_CMDLINE_BOOL is not set
194# CONFIG_PM is not set 214# CONFIG_PM is not set
195CONFIG_SUSPEND_UP_POSSIBLE=y
196CONFIG_HIBERNATION_UP_POSSIBLE=y
197CONFIG_SECCOMP=y 215CONFIG_SECCOMP=y
198CONFIG_WANT_DEVICE_TREE=y
199CONFIG_DEVICE_TREE="kilauea.dts"
200CONFIG_ISA_DMA_API=y 216CONFIG_ISA_DMA_API=y
201 217
202# 218#
@@ -296,6 +312,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
296# 312#
297# CONFIG_NET_PKTGEN is not set 313# CONFIG_NET_PKTGEN is not set
298# CONFIG_HAMRADIO is not set 314# CONFIG_HAMRADIO is not set
315# CONFIG_CAN is not set
299# CONFIG_IRDA is not set 316# CONFIG_IRDA is not set
300# CONFIG_BT is not set 317# CONFIG_BT is not set
301# CONFIG_AF_RXRPC is not set 318# CONFIG_AF_RXRPC is not set
@@ -332,6 +349,7 @@ CONFIG_MTD=y
332CONFIG_MTD_PARTITIONS=y 349CONFIG_MTD_PARTITIONS=y
333# CONFIG_MTD_REDBOOT_PARTS is not set 350# CONFIG_MTD_REDBOOT_PARTS is not set
334CONFIG_MTD_CMDLINE_PARTS=y 351CONFIG_MTD_CMDLINE_PARTS=y
352CONFIG_MTD_OF_PARTS=y
335 353
336# 354#
337# User Modules And Translation Layers 355# User Modules And Translation Layers
@@ -418,11 +436,12 @@ CONFIG_BLK_DEV=y
418CONFIG_BLK_DEV_RAM=y 436CONFIG_BLK_DEV_RAM=y
419CONFIG_BLK_DEV_RAM_COUNT=16 437CONFIG_BLK_DEV_RAM_COUNT=16
420CONFIG_BLK_DEV_RAM_SIZE=35000 438CONFIG_BLK_DEV_RAM_SIZE=35000
421CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 439# CONFIG_BLK_DEV_XIP is not set
422# CONFIG_CDROM_PKTCDVD is not set 440# CONFIG_CDROM_PKTCDVD is not set
423# CONFIG_ATA_OVER_ETH is not set 441# CONFIG_ATA_OVER_ETH is not set
424# CONFIG_XILINX_SYSACE is not set 442# CONFIG_XILINX_SYSACE is not set
425# CONFIG_MISC_DEVICES is not set 443# CONFIG_MISC_DEVICES is not set
444CONFIG_HAVE_IDE=y
426# CONFIG_IDE is not set 445# CONFIG_IDE is not set
427 446
428# 447#
@@ -451,7 +470,6 @@ CONFIG_NETDEVICES=y
451# CONFIG_EQUALIZER is not set 470# CONFIG_EQUALIZER is not set
452# CONFIG_TUN is not set 471# CONFIG_TUN is not set
453# CONFIG_VETH is not set 472# CONFIG_VETH is not set
454# CONFIG_IP1000 is not set
455# CONFIG_ARCNET is not set 473# CONFIG_ARCNET is not set
456# CONFIG_PHYLIB is not set 474# CONFIG_PHYLIB is not set
457CONFIG_NET_ETHERNET=y 475CONFIG_NET_ETHERNET=y
@@ -489,7 +507,6 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
489# CONFIG_HIPPI is not set 507# CONFIG_HIPPI is not set
490# CONFIG_PPP is not set 508# CONFIG_PPP is not set
491# CONFIG_SLIP is not set 509# CONFIG_SLIP is not set
492# CONFIG_SHAPER is not set
493# CONFIG_NETCONSOLE is not set 510# CONFIG_NETCONSOLE is not set
494# CONFIG_NETPOLL is not set 511# CONFIG_NETPOLL is not set
495# CONFIG_NET_POLL_CONTROLLER is not set 512# CONFIG_NET_POLL_CONTROLLER is not set
@@ -512,6 +529,7 @@ CONFIG_IBM_NEW_EMAC_EMAC4=y
512# 529#
513# CONFIG_VT is not set 530# CONFIG_VT is not set
514# CONFIG_SERIAL_NONSTANDARD is not set 531# CONFIG_SERIAL_NONSTANDARD is not set
532# CONFIG_NOZOMI is not set
515 533
516# 534#
517# Serial drivers 535# Serial drivers
@@ -557,6 +575,7 @@ CONFIG_DEVPORT=y
557# CONFIG_W1 is not set 575# CONFIG_W1 is not set
558# CONFIG_POWER_SUPPLY is not set 576# CONFIG_POWER_SUPPLY is not set
559# CONFIG_HWMON is not set 577# CONFIG_HWMON is not set
578CONFIG_THERMAL=y
560# CONFIG_WATCHDOG is not set 579# CONFIG_WATCHDOG is not set
561 580
562# 581#
@@ -598,6 +617,7 @@ CONFIG_SSB_POSSIBLE=y
598# CONFIG_SOUND is not set 617# CONFIG_SOUND is not set
599# CONFIG_USB_SUPPORT is not set 618# CONFIG_USB_SUPPORT is not set
600# CONFIG_MMC is not set 619# CONFIG_MMC is not set
620# CONFIG_MEMSTICK is not set
601# CONFIG_NEW_LEDS is not set 621# CONFIG_NEW_LEDS is not set
602# CONFIG_INFINIBAND is not set 622# CONFIG_INFINIBAND is not set
603# CONFIG_EDAC is not set 623# CONFIG_EDAC is not set
@@ -622,12 +642,10 @@ CONFIG_EXT2_FS=y
622# CONFIG_XFS_FS is not set 642# CONFIG_XFS_FS is not set
623# CONFIG_GFS2_FS is not set 643# CONFIG_GFS2_FS is not set
624# CONFIG_OCFS2_FS is not set 644# CONFIG_OCFS2_FS is not set
625# CONFIG_MINIX_FS is not set 645CONFIG_DNOTIFY=y
626# CONFIG_ROMFS_FS is not set
627CONFIG_INOTIFY=y 646CONFIG_INOTIFY=y
628CONFIG_INOTIFY_USER=y 647CONFIG_INOTIFY_USER=y
629# CONFIG_QUOTA is not set 648# CONFIG_QUOTA is not set
630CONFIG_DNOTIFY=y
631# CONFIG_AUTOFS_FS is not set 649# CONFIG_AUTOFS_FS is not set
632# CONFIG_AUTOFS4_FS is not set 650# CONFIG_AUTOFS4_FS is not set
633# CONFIG_FUSE_FS is not set 651# CONFIG_FUSE_FS is not set
@@ -670,8 +688,10 @@ CONFIG_TMPFS=y
670# CONFIG_JFFS2_FS is not set 688# CONFIG_JFFS2_FS is not set
671CONFIG_CRAMFS=y 689CONFIG_CRAMFS=y
672# CONFIG_VXFS_FS is not set 690# CONFIG_VXFS_FS is not set
691# CONFIG_MINIX_FS is not set
673# CONFIG_HPFS_FS is not set 692# CONFIG_HPFS_FS is not set
674# CONFIG_QNX4FS_FS is not set 693# CONFIG_QNX4FS_FS is not set
694# CONFIG_ROMFS_FS is not set
675# CONFIG_SYSV_FS is not set 695# CONFIG_SYSV_FS is not set
676# CONFIG_UFS_FS is not set 696# CONFIG_UFS_FS is not set
677CONFIG_NETWORK_FILESYSTEMS=y 697CONFIG_NETWORK_FILESYSTEMS=y
@@ -702,7 +722,6 @@ CONFIG_SUNRPC=y
702CONFIG_MSDOS_PARTITION=y 722CONFIG_MSDOS_PARTITION=y
703# CONFIG_NLS is not set 723# CONFIG_NLS is not set
704# CONFIG_DLM is not set 724# CONFIG_DLM is not set
705# CONFIG_UCC_SLOW is not set
706 725
707# 726#
708# Library routines 727# Library routines
@@ -719,7 +738,6 @@ CONFIG_PLIST=y
719CONFIG_HAS_IOMEM=y 738CONFIG_HAS_IOMEM=y
720CONFIG_HAS_IOPORT=y 739CONFIG_HAS_IOPORT=y
721CONFIG_HAS_DMA=y 740CONFIG_HAS_DMA=y
722# CONFIG_INSTRUMENTATION is not set
723 741
724# 742#
725# Kernel hacking 743# Kernel hacking
@@ -729,7 +747,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
729CONFIG_ENABLE_MUST_CHECK=y 747CONFIG_ENABLE_MUST_CHECK=y
730CONFIG_MAGIC_SYSRQ=y 748CONFIG_MAGIC_SYSRQ=y
731# CONFIG_UNUSED_SYMBOLS is not set 749# CONFIG_UNUSED_SYMBOLS is not set
732# CONFIG_DEBUG_FS is not set 750CONFIG_DEBUG_FS=y
733# CONFIG_HEADERS_CHECK is not set 751# CONFIG_HEADERS_CHECK is not set
734CONFIG_DEBUG_KERNEL=y 752CONFIG_DEBUG_KERNEL=y
735# CONFIG_DEBUG_SHIRQ is not set 753# CONFIG_DEBUG_SHIRQ is not set
@@ -738,6 +756,7 @@ CONFIG_SCHED_DEBUG=y
738# CONFIG_SCHEDSTATS is not set 756# CONFIG_SCHEDSTATS is not set
739# CONFIG_TIMER_STATS is not set 757# CONFIG_TIMER_STATS is not set
740# CONFIG_SLUB_DEBUG_ON is not set 758# CONFIG_SLUB_DEBUG_ON is not set
759# CONFIG_SLUB_STATS is not set
741# CONFIG_DEBUG_RT_MUTEXES is not set 760# CONFIG_DEBUG_RT_MUTEXES is not set
742# CONFIG_RT_MUTEX_TESTER is not set 761# CONFIG_RT_MUTEX_TESTER is not set
743# CONFIG_DEBUG_SPINLOCK is not set 762# CONFIG_DEBUG_SPINLOCK is not set
@@ -750,15 +769,16 @@ CONFIG_DEBUG_BUGVERBOSE=y
750# CONFIG_DEBUG_VM is not set 769# CONFIG_DEBUG_VM is not set
751# CONFIG_DEBUG_LIST is not set 770# CONFIG_DEBUG_LIST is not set
752# CONFIG_DEBUG_SG is not set 771# CONFIG_DEBUG_SG is not set
753CONFIG_FORCED_INLINING=y
754# CONFIG_BOOT_PRINTK_DELAY is not set 772# CONFIG_BOOT_PRINTK_DELAY is not set
755# CONFIG_RCU_TORTURE_TEST is not set 773# CONFIG_RCU_TORTURE_TEST is not set
774# CONFIG_BACKTRACE_SELF_TEST is not set
756# CONFIG_FAULT_INJECTION is not set 775# CONFIG_FAULT_INJECTION is not set
757# CONFIG_SAMPLES is not set 776# CONFIG_SAMPLES is not set
758# CONFIG_DEBUG_STACKOVERFLOW is not set 777# CONFIG_DEBUG_STACKOVERFLOW is not set
759# CONFIG_DEBUG_STACK_USAGE is not set 778# CONFIG_DEBUG_STACK_USAGE is not set
760# CONFIG_DEBUG_PAGEALLOC is not set 779# CONFIG_DEBUG_PAGEALLOC is not set
761# CONFIG_DEBUGGER is not set 780# CONFIG_DEBUGGER is not set
781# CONFIG_VIRQ_DEBUG is not set
762# CONFIG_BDI_SWITCH is not set 782# CONFIG_BDI_SWITCH is not set
763# CONFIG_PPC_EARLY_DEBUG is not set 783# CONFIG_PPC_EARLY_DEBUG is not set
764 784
@@ -771,6 +791,7 @@ CONFIG_FORCED_INLINING=y
771CONFIG_CRYPTO=y 791CONFIG_CRYPTO=y
772CONFIG_CRYPTO_ALGAPI=y 792CONFIG_CRYPTO_ALGAPI=y
773CONFIG_CRYPTO_BLKCIPHER=y 793CONFIG_CRYPTO_BLKCIPHER=y
794# CONFIG_CRYPTO_SEQIV is not set
774CONFIG_CRYPTO_MANAGER=y 795CONFIG_CRYPTO_MANAGER=y
775# CONFIG_CRYPTO_HMAC is not set 796# CONFIG_CRYPTO_HMAC is not set
776# CONFIG_CRYPTO_XCBC is not set 797# CONFIG_CRYPTO_XCBC is not set
@@ -788,6 +809,9 @@ CONFIG_CRYPTO_CBC=y
788CONFIG_CRYPTO_PCBC=y 809CONFIG_CRYPTO_PCBC=y
789# CONFIG_CRYPTO_LRW is not set 810# CONFIG_CRYPTO_LRW is not set
790# CONFIG_CRYPTO_XTS is not set 811# CONFIG_CRYPTO_XTS is not set
812# CONFIG_CRYPTO_CTR is not set
813# CONFIG_CRYPTO_GCM is not set
814# CONFIG_CRYPTO_CCM is not set
791# CONFIG_CRYPTO_CRYPTD is not set 815# CONFIG_CRYPTO_CRYPTD is not set
792CONFIG_CRYPTO_DES=y 816CONFIG_CRYPTO_DES=y
793# CONFIG_CRYPTO_FCRYPT is not set 817# CONFIG_CRYPTO_FCRYPT is not set
@@ -802,11 +826,14 @@ CONFIG_CRYPTO_DES=y
802# CONFIG_CRYPTO_KHAZAD is not set 826# CONFIG_CRYPTO_KHAZAD is not set
803# CONFIG_CRYPTO_ANUBIS is not set 827# CONFIG_CRYPTO_ANUBIS is not set
804# CONFIG_CRYPTO_SEED is not set 828# CONFIG_CRYPTO_SEED is not set
829# CONFIG_CRYPTO_SALSA20 is not set
805# CONFIG_CRYPTO_DEFLATE is not set 830# CONFIG_CRYPTO_DEFLATE is not set
806# CONFIG_CRYPTO_MICHAEL_MIC is not set 831# CONFIG_CRYPTO_MICHAEL_MIC is not set
807# CONFIG_CRYPTO_CRC32C is not set 832# CONFIG_CRYPTO_CRC32C is not set
808# CONFIG_CRYPTO_CAMELLIA is not set 833# CONFIG_CRYPTO_CAMELLIA is not set
809# CONFIG_CRYPTO_TEST is not set 834# CONFIG_CRYPTO_TEST is not set
810# CONFIG_CRYPTO_AUTHENC is not set 835# CONFIG_CRYPTO_AUTHENC is not set
836# CONFIG_CRYPTO_LZO is not set
811CONFIG_CRYPTO_HW=y 837CONFIG_CRYPTO_HW=y
838# CONFIG_CRYPTO_DEV_HIFN_795X is not set
812# CONFIG_PPC_CLOCK is not set 839# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig
new file mode 100644
index 000000000000..57bd775ef777
--- /dev/null
+++ b/arch/powerpc/configs/ppc44x_defconfig
@@ -0,0 +1,904 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.25-rc2
4# Fri Feb 15 21:57:35 2008
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11# CONFIG_6xx is not set
12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set
14# CONFIG_40x is not set
15CONFIG_44x=y
16# CONFIG_E200 is not set
17CONFIG_PPC_FPU=y
18CONFIG_4xx=y
19CONFIG_BOOKE=y
20CONFIG_PTE_64BIT=y
21CONFIG_PHYS_64BIT=y
22# CONFIG_PPC_MM_SLICES is not set
23CONFIG_NOT_COHERENT_CACHE=y
24CONFIG_PPC32=y
25CONFIG_WORD_SIZE=32
26CONFIG_PPC_MERGE=y
27CONFIG_MMU=y
28CONFIG_GENERIC_CMOS_UPDATE=y
29CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
34CONFIG_IRQ_PER_CPU=y
35CONFIG_RWSEM_XCHGADD_ALGORITHM=y
36CONFIG_ARCH_HAS_ILOG2_U32=y
37CONFIG_GENERIC_HWEIGHT=y
38CONFIG_GENERIC_CALIBRATE_DELAY=y
39CONFIG_GENERIC_FIND_NEXT_BIT=y
40# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
41CONFIG_PPC=y
42CONFIG_EARLY_PRINTK=y
43CONFIG_GENERIC_NVRAM=y
44CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
45CONFIG_ARCH_MAY_HAVE_PC_FDC=y
46CONFIG_PPC_OF=y
47CONFIG_OF=y
48CONFIG_PPC_UDBG_16550=y
49# CONFIG_GENERIC_TBSYNC is not set
50CONFIG_AUDIT_ARCH=y
51CONFIG_GENERIC_BUG=y
52# CONFIG_DEFAULT_UIMAGE is not set
53CONFIG_PPC_DCR_NATIVE=y
54# CONFIG_PPC_DCR_MMIO is not set
55CONFIG_PPC_DCR=y
56CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
57
58#
59# General setup
60#
61CONFIG_EXPERIMENTAL=y
62CONFIG_BROKEN_ON_SMP=y
63CONFIG_INIT_ENV_ARG_LIMIT=32
64CONFIG_LOCALVERSION=""
65CONFIG_LOCALVERSION_AUTO=y
66CONFIG_SWAP=y
67CONFIG_SYSVIPC=y
68CONFIG_SYSVIPC_SYSCTL=y
69CONFIG_POSIX_MQUEUE=y
70# CONFIG_BSD_PROCESS_ACCT is not set
71# CONFIG_TASKSTATS is not set
72# CONFIG_AUDIT is not set
73# CONFIG_IKCONFIG is not set
74CONFIG_LOG_BUF_SHIFT=14
75# CONFIG_CGROUPS is not set
76CONFIG_GROUP_SCHED=y
77CONFIG_FAIR_GROUP_SCHED=y
78# CONFIG_RT_GROUP_SCHED is not set
79CONFIG_USER_SCHED=y
80# CONFIG_CGROUP_SCHED is not set
81CONFIG_SYSFS_DEPRECATED=y
82# CONFIG_RELAY is not set
83# CONFIG_NAMESPACES is not set
84CONFIG_BLK_DEV_INITRD=y
85CONFIG_INITRAMFS_SOURCE=""
86# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
87CONFIG_SYSCTL=y
88CONFIG_EMBEDDED=y
89CONFIG_SYSCTL_SYSCALL=y
90CONFIG_KALLSYMS=y
91CONFIG_KALLSYMS_ALL=y
92CONFIG_KALLSYMS_EXTRA_PASS=y
93CONFIG_HOTPLUG=y
94CONFIG_PRINTK=y
95CONFIG_BUG=y
96CONFIG_ELF_CORE=y
97CONFIG_COMPAT_BRK=y
98CONFIG_BASE_FULL=y
99CONFIG_FUTEX=y
100CONFIG_ANON_INODES=y
101CONFIG_EPOLL=y
102CONFIG_SIGNALFD=y
103CONFIG_TIMERFD=y
104CONFIG_EVENTFD=y
105CONFIG_SHMEM=y
106CONFIG_VM_EVENT_COUNTERS=y
107CONFIG_SLUB_DEBUG=y
108# CONFIG_SLAB is not set
109CONFIG_SLUB=y
110# CONFIG_SLOB is not set
111# CONFIG_PROFILING is not set
112# CONFIG_MARKERS is not set
113CONFIG_HAVE_OPROFILE=y
114# CONFIG_KPROBES is not set
115CONFIG_HAVE_KPROBES=y
116CONFIG_PROC_PAGE_MONITOR=y
117CONFIG_SLABINFO=y
118CONFIG_RT_MUTEXES=y
119# CONFIG_TINY_SHMEM is not set
120CONFIG_BASE_SMALL=0
121CONFIG_MODULES=y
122CONFIG_MODULE_UNLOAD=y
123# CONFIG_MODULE_FORCE_UNLOAD is not set
124# CONFIG_MODVERSIONS is not set
125# CONFIG_MODULE_SRCVERSION_ALL is not set
126CONFIG_KMOD=y
127CONFIG_BLOCK=y
128CONFIG_LBD=y
129# CONFIG_BLK_DEV_IO_TRACE is not set
130# CONFIG_LSF is not set
131# CONFIG_BLK_DEV_BSG is not set
132
133#
134# IO Schedulers
135#
136CONFIG_IOSCHED_NOOP=y
137CONFIG_IOSCHED_AS=y
138CONFIG_IOSCHED_DEADLINE=y
139CONFIG_IOSCHED_CFQ=y
140CONFIG_DEFAULT_AS=y
141# CONFIG_DEFAULT_DEADLINE is not set
142# CONFIG_DEFAULT_CFQ is not set
143# CONFIG_DEFAULT_NOOP is not set
144CONFIG_DEFAULT_IOSCHED="anticipatory"
145CONFIG_CLASSIC_RCU=y
146# CONFIG_PREEMPT_RCU is not set
147CONFIG_PPC4xx_PCI_EXPRESS=y
148
149#
150# Platform support
151#
152# CONFIG_PPC_MPC512x is not set
153# CONFIG_PPC_MPC5121 is not set
154# CONFIG_PPC_CELL is not set
155# CONFIG_PPC_CELL_NATIVE is not set
156# CONFIG_PQ2ADS is not set
157CONFIG_BAMBOO=y
158CONFIG_EBONY=y
159CONFIG_SEQUOIA=y
160CONFIG_TAISHAN=y
161CONFIG_KATMAI=y
162CONFIG_RAINIER=y
163CONFIG_WARP=y
164CONFIG_440EP=y
165CONFIG_440EPX=y
166CONFIG_440GRX=y
167CONFIG_440GP=y
168CONFIG_440GX=y
169CONFIG_440SPe=y
170CONFIG_IBM440EP_ERR42=y
171# CONFIG_IPIC is not set
172# CONFIG_MPIC is not set
173# CONFIG_MPIC_WEIRD is not set
174# CONFIG_PPC_I8259 is not set
175# CONFIG_PPC_RTAS is not set
176# CONFIG_MMIO_NVRAM is not set
177# CONFIG_PPC_MPC106 is not set
178# CONFIG_PPC_970_NAP is not set
179# CONFIG_PPC_INDIRECT_IO is not set
180# CONFIG_GENERIC_IOMAP is not set
181# CONFIG_CPU_FREQ is not set
182# CONFIG_FSL_ULI1575 is not set
183CONFIG_OF_RTC=y
184
185#
186# Kernel options
187#
188# CONFIG_HIGHMEM is not set
189# CONFIG_TICK_ONESHOT is not set
190# CONFIG_NO_HZ is not set
191# CONFIG_HIGH_RES_TIMERS is not set
192CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
193# CONFIG_HZ_100 is not set
194CONFIG_HZ_250=y
195# CONFIG_HZ_300 is not set
196# CONFIG_HZ_1000 is not set
197CONFIG_HZ=250
198# CONFIG_SCHED_HRTICK is not set
199CONFIG_PREEMPT_NONE=y
200# CONFIG_PREEMPT_VOLUNTARY is not set
201# CONFIG_PREEMPT is not set
202# CONFIG_RCU_TRACE is not set
203CONFIG_BINFMT_ELF=y
204# CONFIG_BINFMT_MISC is not set
205CONFIG_MATH_EMULATION=y
206# CONFIG_IOMMU_HELPER is not set
207CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
208CONFIG_ARCH_HAS_WALK_MEMORY=y
209CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
210CONFIG_ARCH_FLATMEM_ENABLE=y
211CONFIG_ARCH_POPULATES_NODE_MAP=y
212CONFIG_SELECT_MEMORY_MODEL=y
213CONFIG_FLATMEM_MANUAL=y
214# CONFIG_DISCONTIGMEM_MANUAL is not set
215# CONFIG_SPARSEMEM_MANUAL is not set
216CONFIG_FLATMEM=y
217CONFIG_FLAT_NODE_MEM_MAP=y
218# CONFIG_SPARSEMEM_STATIC is not set
219# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
220CONFIG_SPLIT_PTLOCK_CPUS=4
221CONFIG_RESOURCES_64BIT=y
222CONFIG_ZONE_DMA_FLAG=1
223CONFIG_BOUNCE=y
224CONFIG_VIRT_TO_BUS=y
225CONFIG_PROC_DEVICETREE=y
226# CONFIG_CMDLINE_BOOL is not set
227CONFIG_SECCOMP=y
228CONFIG_ISA_DMA_API=y
229
230#
231# Bus options
232#
233CONFIG_ZONE_DMA=y
234CONFIG_PPC_INDIRECT_PCI=y
235CONFIG_PCI=y
236CONFIG_PCI_DOMAINS=y
237CONFIG_PCI_SYSCALL=y
238# CONFIG_PCIEPORTBUS is not set
239CONFIG_ARCH_SUPPORTS_MSI=y
240# CONFIG_PCI_MSI is not set
241CONFIG_PCI_LEGACY=y
242# CONFIG_PCI_DEBUG is not set
243# CONFIG_PCCARD is not set
244# CONFIG_HOTPLUG_PCI is not set
245
246#
247# Advanced setup
248#
249# CONFIG_ADVANCED_OPTIONS is not set
250
251#
252# Default settings for advanced configuration options are used
253#
254CONFIG_HIGHMEM_START=0xfe000000
255CONFIG_LOWMEM_SIZE=0x30000000
256CONFIG_KERNEL_START=0xc0000000
257CONFIG_TASK_SIZE=0xc0000000
258CONFIG_CONSISTENT_START=0xff100000
259CONFIG_CONSISTENT_SIZE=0x00200000
260CONFIG_BOOT_LOAD=0x01000000
261
262#
263# Networking
264#
265CONFIG_NET=y
266
267#
268# Networking options
269#
270CONFIG_PACKET=y
271# CONFIG_PACKET_MMAP is not set
272CONFIG_UNIX=y
273# CONFIG_NET_KEY is not set
274CONFIG_INET=y
275# CONFIG_IP_MULTICAST is not set
276# CONFIG_IP_ADVANCED_ROUTER is not set
277CONFIG_IP_FIB_HASH=y
278CONFIG_IP_PNP=y
279CONFIG_IP_PNP_DHCP=y
280CONFIG_IP_PNP_BOOTP=y
281# CONFIG_IP_PNP_RARP is not set
282# CONFIG_NET_IPIP is not set
283# CONFIG_NET_IPGRE is not set
284# CONFIG_ARPD is not set
285# CONFIG_SYN_COOKIES is not set
286# CONFIG_INET_AH is not set
287# CONFIG_INET_ESP is not set
288# CONFIG_INET_IPCOMP is not set
289# CONFIG_INET_XFRM_TUNNEL is not set
290# CONFIG_INET_TUNNEL is not set
291# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
292# CONFIG_INET_XFRM_MODE_TUNNEL is not set
293# CONFIG_INET_XFRM_MODE_BEET is not set
294# CONFIG_INET_LRO is not set
295CONFIG_INET_DIAG=y
296CONFIG_INET_TCP_DIAG=y
297# CONFIG_TCP_CONG_ADVANCED is not set
298CONFIG_TCP_CONG_CUBIC=y
299CONFIG_DEFAULT_TCP_CONG="cubic"
300# CONFIG_TCP_MD5SIG is not set
301# CONFIG_IPV6 is not set
302# CONFIG_INET6_XFRM_TUNNEL is not set
303# CONFIG_INET6_TUNNEL is not set
304# CONFIG_NETWORK_SECMARK is not set
305# CONFIG_NETFILTER is not set
306# CONFIG_IP_DCCP is not set
307# CONFIG_IP_SCTP is not set
308# CONFIG_TIPC is not set
309# CONFIG_ATM is not set
310# CONFIG_BRIDGE is not set
311# CONFIG_VLAN_8021Q is not set
312# CONFIG_DECNET is not set
313# CONFIG_LLC2 is not set
314# CONFIG_IPX is not set
315# CONFIG_ATALK is not set
316# CONFIG_X25 is not set
317# CONFIG_LAPB is not set
318# CONFIG_ECONET is not set
319# CONFIG_WAN_ROUTER is not set
320# CONFIG_NET_SCHED is not set
321
322#
323# Network testing
324#
325# CONFIG_NET_PKTGEN is not set
326# CONFIG_HAMRADIO is not set
327# CONFIG_CAN is not set
328# CONFIG_IRDA is not set
329# CONFIG_BT is not set
330# CONFIG_AF_RXRPC is not set
331
332#
333# Wireless
334#
335# CONFIG_CFG80211 is not set
336# CONFIG_WIRELESS_EXT is not set
337# CONFIG_MAC80211 is not set
338# CONFIG_IEEE80211 is not set
339# CONFIG_RFKILL is not set
340# CONFIG_NET_9P is not set
341
342#
343# Device Drivers
344#
345
346#
347# Generic Driver Options
348#
349CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
350CONFIG_STANDALONE=y
351CONFIG_PREVENT_FIRMWARE_BUILD=y
352CONFIG_FW_LOADER=y
353# CONFIG_DEBUG_DRIVER is not set
354# CONFIG_DEBUG_DEVRES is not set
355# CONFIG_SYS_HYPERVISOR is not set
356CONFIG_CONNECTOR=y
357CONFIG_PROC_EVENTS=y
358CONFIG_MTD=y
359# CONFIG_MTD_DEBUG is not set
360# CONFIG_MTD_CONCAT is not set
361CONFIG_MTD_PARTITIONS=y
362# CONFIG_MTD_REDBOOT_PARTS is not set
363# CONFIG_MTD_CMDLINE_PARTS is not set
364CONFIG_MTD_OF_PARTS=y
365
366#
367# User Modules And Translation Layers
368#
369CONFIG_MTD_CHAR=y
370CONFIG_MTD_BLKDEVS=y
371CONFIG_MTD_BLOCK=y
372# CONFIG_FTL is not set
373# CONFIG_NFTL is not set
374# CONFIG_INFTL is not set
375# CONFIG_RFD_FTL is not set
376# CONFIG_SSFDC is not set
377# CONFIG_MTD_OOPS is not set
378
379#
380# RAM/ROM/Flash chip drivers
381#
382CONFIG_MTD_CFI=y
383CONFIG_MTD_JEDECPROBE=y
384CONFIG_MTD_GEN_PROBE=y
385# CONFIG_MTD_CFI_ADV_OPTIONS is not set
386CONFIG_MTD_MAP_BANK_WIDTH_1=y
387CONFIG_MTD_MAP_BANK_WIDTH_2=y
388CONFIG_MTD_MAP_BANK_WIDTH_4=y
389# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
390# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
391# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
392CONFIG_MTD_CFI_I1=y
393CONFIG_MTD_CFI_I2=y
394# CONFIG_MTD_CFI_I4 is not set
395# CONFIG_MTD_CFI_I8 is not set
396# CONFIG_MTD_CFI_INTELEXT is not set
397CONFIG_MTD_CFI_AMDSTD=y
398# CONFIG_MTD_CFI_STAA is not set
399CONFIG_MTD_CFI_UTIL=y
400# CONFIG_MTD_RAM is not set
401# CONFIG_MTD_ROM is not set
402# CONFIG_MTD_ABSENT is not set
403
404#
405# Mapping drivers for chip access
406#
407# CONFIG_MTD_COMPLEX_MAPPINGS is not set
408# CONFIG_MTD_PHYSMAP is not set
409CONFIG_MTD_PHYSMAP_OF=y
410# CONFIG_MTD_INTEL_VR_NOR is not set
411# CONFIG_MTD_PLATRAM is not set
412
413#
414# Self-contained MTD device drivers
415#
416# CONFIG_MTD_PMC551 is not set
417# CONFIG_MTD_SLRAM is not set
418# CONFIG_MTD_PHRAM is not set
419# CONFIG_MTD_MTDRAM is not set
420# CONFIG_MTD_BLOCK2MTD is not set
421
422#
423# Disk-On-Chip Device Drivers
424#
425# CONFIG_MTD_DOC2000 is not set
426# CONFIG_MTD_DOC2001 is not set
427# CONFIG_MTD_DOC2001PLUS is not set
428# CONFIG_MTD_NAND is not set
429# CONFIG_MTD_ONENAND is not set
430
431#
432# UBI - Unsorted block images
433#
434# CONFIG_MTD_UBI is not set
435CONFIG_OF_DEVICE=y
436# CONFIG_PARPORT is not set
437CONFIG_BLK_DEV=y
438# CONFIG_BLK_DEV_FD is not set
439# CONFIG_BLK_CPQ_DA is not set
440# CONFIG_BLK_CPQ_CISS_DA is not set
441# CONFIG_BLK_DEV_DAC960 is not set
442# CONFIG_BLK_DEV_UMEM is not set
443# CONFIG_BLK_DEV_COW_COMMON is not set
444# CONFIG_BLK_DEV_LOOP is not set
445# CONFIG_BLK_DEV_NBD is not set
446# CONFIG_BLK_DEV_SX8 is not set
447CONFIG_BLK_DEV_RAM=y
448CONFIG_BLK_DEV_RAM_COUNT=16
449CONFIG_BLK_DEV_RAM_SIZE=35000
450# CONFIG_BLK_DEV_XIP is not set
451# CONFIG_CDROM_PKTCDVD is not set
452# CONFIG_ATA_OVER_ETH is not set
453# CONFIG_XILINX_SYSACE is not set
454CONFIG_MISC_DEVICES=y
455# CONFIG_PHANTOM is not set
456# CONFIG_EEPROM_93CX6 is not set
457# CONFIG_SGI_IOC4 is not set
458# CONFIG_TIFM_CORE is not set
459# CONFIG_ENCLOSURE_SERVICES is not set
460CONFIG_HAVE_IDE=y
461# CONFIG_IDE is not set
462
463#
464# SCSI device support
465#
466# CONFIG_RAID_ATTRS is not set
467# CONFIG_SCSI is not set
468# CONFIG_SCSI_DMA is not set
469# CONFIG_SCSI_NETLINK is not set
470# CONFIG_ATA is not set
471# CONFIG_MD is not set
472# CONFIG_FUSION is not set
473
474#
475# IEEE 1394 (FireWire) support
476#
477# CONFIG_FIREWIRE is not set
478# CONFIG_IEEE1394 is not set
479# CONFIG_I2O is not set
480# CONFIG_MACINTOSH_DRIVERS is not set
481CONFIG_NETDEVICES=y
482# CONFIG_NETDEVICES_MULTIQUEUE is not set
483# CONFIG_DUMMY is not set
484# CONFIG_BONDING is not set
485# CONFIG_MACVLAN is not set
486# CONFIG_EQUALIZER is not set
487# CONFIG_TUN is not set
488# CONFIG_VETH is not set
489# CONFIG_ARCNET is not set
490# CONFIG_PHYLIB is not set
491CONFIG_NET_ETHERNET=y
492# CONFIG_MII is not set
493# CONFIG_HAPPYMEAL is not set
494# CONFIG_SUNGEM is not set
495# CONFIG_CASSINI is not set
496# CONFIG_NET_VENDOR_3COM is not set
497# CONFIG_NET_TULIP is not set
498# CONFIG_HP100 is not set
499CONFIG_IBM_NEW_EMAC=y
500CONFIG_IBM_NEW_EMAC_RXB=128
501CONFIG_IBM_NEW_EMAC_TXB=64
502CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32
503CONFIG_IBM_NEW_EMAC_RX_COPY_THRESHOLD=256
504CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0
505# CONFIG_IBM_NEW_EMAC_DEBUG is not set
506CONFIG_IBM_NEW_EMAC_ZMII=y
507CONFIG_IBM_NEW_EMAC_RGMII=y
508CONFIG_IBM_NEW_EMAC_TAH=y
509CONFIG_IBM_NEW_EMAC_EMAC4=y
510# CONFIG_NET_PCI is not set
511# CONFIG_B44 is not set
512CONFIG_NETDEV_1000=y
513# CONFIG_ACENIC is not set
514# CONFIG_DL2K is not set
515# CONFIG_E1000 is not set
516# CONFIG_E1000E is not set
517# CONFIG_E1000E_ENABLED is not set
518# CONFIG_IP1000 is not set
519# CONFIG_IGB is not set
520# CONFIG_NS83820 is not set
521# CONFIG_HAMACHI is not set
522# CONFIG_YELLOWFIN is not set
523# CONFIG_R8169 is not set
524# CONFIG_SIS190 is not set
525# CONFIG_SKGE is not set
526# CONFIG_SKY2 is not set
527# CONFIG_SK98LIN is not set
528# CONFIG_VIA_VELOCITY is not set
529# CONFIG_TIGON3 is not set
530# CONFIG_BNX2 is not set
531# CONFIG_QLA3XXX is not set
532# CONFIG_ATL1 is not set
533CONFIG_NETDEV_10000=y
534# CONFIG_CHELSIO_T1 is not set
535# CONFIG_CHELSIO_T3 is not set
536# CONFIG_IXGBE is not set
537# CONFIG_IXGB is not set
538# CONFIG_S2IO is not set
539# CONFIG_MYRI10GE is not set
540# CONFIG_NETXEN_NIC is not set
541# CONFIG_NIU is not set
542# CONFIG_MLX4_CORE is not set
543# CONFIG_TEHUTI is not set
544# CONFIG_BNX2X is not set
545# CONFIG_TR is not set
546
547#
548# Wireless LAN
549#
550# CONFIG_WLAN_PRE80211 is not set
551# CONFIG_WLAN_80211 is not set
552# CONFIG_WAN is not set
553# CONFIG_FDDI is not set
554# CONFIG_HIPPI is not set
555# CONFIG_PPP is not set
556# CONFIG_SLIP is not set
557# CONFIG_NETCONSOLE is not set
558# CONFIG_NETPOLL is not set
559# CONFIG_NET_POLL_CONTROLLER is not set
560# CONFIG_ISDN is not set
561# CONFIG_PHONE is not set
562
563#
564# Input device support
565#
566# CONFIG_INPUT is not set
567
568#
569# Hardware I/O ports
570#
571# CONFIG_SERIO is not set
572# CONFIG_GAMEPORT is not set
573
574#
575# Character devices
576#
577# CONFIG_VT is not set
578# CONFIG_SERIAL_NONSTANDARD is not set
579# CONFIG_NOZOMI is not set
580
581#
582# Serial drivers
583#
584CONFIG_SERIAL_8250=y
585CONFIG_SERIAL_8250_CONSOLE=y
586# CONFIG_SERIAL_8250_PCI is not set
587CONFIG_SERIAL_8250_NR_UARTS=4
588CONFIG_SERIAL_8250_RUNTIME_UARTS=4
589CONFIG_SERIAL_8250_EXTENDED=y
590# CONFIG_SERIAL_8250_MANY_PORTS is not set
591CONFIG_SERIAL_8250_SHARE_IRQ=y
592# CONFIG_SERIAL_8250_DETECT_IRQ is not set
593# CONFIG_SERIAL_8250_RSA is not set
594
595#
596# Non-8250 serial port support
597#
598# CONFIG_SERIAL_UARTLITE is not set
599CONFIG_SERIAL_CORE=y
600CONFIG_SERIAL_CORE_CONSOLE=y
601# CONFIG_SERIAL_JSM is not set
602CONFIG_SERIAL_OF_PLATFORM=y
603CONFIG_UNIX98_PTYS=y
604CONFIG_LEGACY_PTYS=y
605CONFIG_LEGACY_PTY_COUNT=256
606# CONFIG_IPMI_HANDLER is not set
607# CONFIG_HW_RANDOM is not set
608# CONFIG_NVRAM is not set
609# CONFIG_GEN_RTC is not set
610# CONFIG_R3964 is not set
611# CONFIG_APPLICOM is not set
612# CONFIG_RAW_DRIVER is not set
613# CONFIG_TCG_TPM is not set
614CONFIG_DEVPORT=y
615# CONFIG_I2C is not set
616
617#
618# SPI support
619#
620# CONFIG_SPI is not set
621# CONFIG_SPI_MASTER is not set
622# CONFIG_W1 is not set
623# CONFIG_POWER_SUPPLY is not set
624# CONFIG_HWMON is not set
625# CONFIG_THERMAL is not set
626# CONFIG_WATCHDOG is not set
627
628#
629# Sonics Silicon Backplane
630#
631CONFIG_SSB_POSSIBLE=y
632# CONFIG_SSB is not set
633
634#
635# Multifunction device drivers
636#
637# CONFIG_MFD_SM501 is not set
638
639#
640# Multimedia devices
641#
642# CONFIG_VIDEO_DEV is not set
643# CONFIG_DVB_CORE is not set
644# CONFIG_DAB is not set
645
646#
647# Graphics support
648#
649# CONFIG_AGP is not set
650# CONFIG_DRM is not set
651# CONFIG_VGASTATE is not set
652# CONFIG_VIDEO_OUTPUT_CONTROL is not set
653# CONFIG_FB is not set
654# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
655
656#
657# Display device support
658#
659# CONFIG_DISPLAY_SUPPORT is not set
660
661#
662# Sound
663#
664# CONFIG_SOUND is not set
665CONFIG_USB_SUPPORT=y
666CONFIG_USB_ARCH_HAS_HCD=y
667CONFIG_USB_ARCH_HAS_OHCI=y
668CONFIG_USB_ARCH_HAS_EHCI=y
669# CONFIG_USB is not set
670
671#
672# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
673#
674# CONFIG_USB_GADGET is not set
675# CONFIG_MMC is not set
676# CONFIG_MEMSTICK is not set
677# CONFIG_NEW_LEDS is not set
678# CONFIG_INFINIBAND is not set
679# CONFIG_EDAC is not set
680# CONFIG_RTC_CLASS is not set
681
682#
683# Userspace I/O
684#
685# CONFIG_UIO is not set
686
687#
688# File systems
689#
690CONFIG_EXT2_FS=y
691# CONFIG_EXT2_FS_XATTR is not set
692# CONFIG_EXT2_FS_XIP is not set
693# CONFIG_EXT3_FS is not set
694# CONFIG_EXT4DEV_FS is not set
695# CONFIG_REISERFS_FS is not set
696# CONFIG_JFS_FS is not set
697# CONFIG_FS_POSIX_ACL is not set
698# CONFIG_XFS_FS is not set
699# CONFIG_GFS2_FS is not set
700# CONFIG_OCFS2_FS is not set
701CONFIG_DNOTIFY=y
702CONFIG_INOTIFY=y
703CONFIG_INOTIFY_USER=y
704# CONFIG_QUOTA is not set
705# CONFIG_AUTOFS_FS is not set
706# CONFIG_AUTOFS4_FS is not set
707# CONFIG_FUSE_FS is not set
708
709#
710# CD-ROM/DVD Filesystems
711#
712# CONFIG_ISO9660_FS is not set
713# CONFIG_UDF_FS is not set
714
715#
716# DOS/FAT/NT Filesystems
717#
718# CONFIG_MSDOS_FS is not set
719# CONFIG_VFAT_FS is not set
720# CONFIG_NTFS_FS is not set
721
722#
723# Pseudo filesystems
724#
725CONFIG_PROC_FS=y
726CONFIG_PROC_KCORE=y
727CONFIG_PROC_SYSCTL=y
728CONFIG_SYSFS=y
729CONFIG_TMPFS=y
730# CONFIG_TMPFS_POSIX_ACL is not set
731# CONFIG_HUGETLB_PAGE is not set
732# CONFIG_CONFIGFS_FS is not set
733
734#
735# Miscellaneous filesystems
736#
737# CONFIG_ADFS_FS is not set
738# CONFIG_AFFS_FS is not set
739# CONFIG_HFS_FS is not set
740# CONFIG_HFSPLUS_FS is not set
741# CONFIG_BEFS_FS is not set
742# CONFIG_BFS_FS is not set
743# CONFIG_EFS_FS is not set
744CONFIG_JFFS2_FS=y
745CONFIG_JFFS2_FS_DEBUG=0
746CONFIG_JFFS2_FS_WRITEBUFFER=y
747# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
748# CONFIG_JFFS2_SUMMARY is not set
749# CONFIG_JFFS2_FS_XATTR is not set
750# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
751CONFIG_JFFS2_ZLIB=y
752# CONFIG_JFFS2_LZO is not set
753CONFIG_JFFS2_RTIME=y
754# CONFIG_JFFS2_RUBIN is not set
755CONFIG_CRAMFS=y
756# CONFIG_VXFS_FS is not set
757# CONFIG_MINIX_FS is not set
758# CONFIG_HPFS_FS is not set
759# CONFIG_QNX4FS_FS is not set
760# CONFIG_ROMFS_FS is not set
761# CONFIG_SYSV_FS is not set
762# CONFIG_UFS_FS is not set
763CONFIG_NETWORK_FILESYSTEMS=y
764CONFIG_NFS_FS=y
765CONFIG_NFS_V3=y
766# CONFIG_NFS_V3_ACL is not set
767# CONFIG_NFS_V4 is not set
768# CONFIG_NFS_DIRECTIO is not set
769# CONFIG_NFSD is not set
770CONFIG_ROOT_NFS=y
771CONFIG_LOCKD=y
772CONFIG_LOCKD_V4=y
773CONFIG_NFS_COMMON=y
774CONFIG_SUNRPC=y
775# CONFIG_SUNRPC_BIND34 is not set
776# CONFIG_RPCSEC_GSS_KRB5 is not set
777# CONFIG_RPCSEC_GSS_SPKM3 is not set
778# CONFIG_SMB_FS is not set
779# CONFIG_CIFS is not set
780# CONFIG_NCP_FS is not set
781# CONFIG_CODA_FS is not set
782# CONFIG_AFS_FS is not set
783
784#
785# Partition Types
786#
787# CONFIG_PARTITION_ADVANCED is not set
788CONFIG_MSDOS_PARTITION=y
789# CONFIG_NLS is not set
790# CONFIG_DLM is not set
791
792#
793# Library routines
794#
795CONFIG_BITREVERSE=y
796# CONFIG_CRC_CCITT is not set
797# CONFIG_CRC16 is not set
798# CONFIG_CRC_ITU_T is not set
799CONFIG_CRC32=y
800# CONFIG_CRC7 is not set
801# CONFIG_LIBCRC32C is not set
802CONFIG_ZLIB_INFLATE=y
803CONFIG_ZLIB_DEFLATE=y
804CONFIG_PLIST=y
805CONFIG_HAS_IOMEM=y
806CONFIG_HAS_IOPORT=y
807CONFIG_HAS_DMA=y
808
809#
810# Kernel hacking
811#
812# CONFIG_PRINTK_TIME is not set
813CONFIG_ENABLE_WARN_DEPRECATED=y
814CONFIG_ENABLE_MUST_CHECK=y
815CONFIG_MAGIC_SYSRQ=y
816# CONFIG_UNUSED_SYMBOLS is not set
817# CONFIG_DEBUG_FS is not set
818# CONFIG_HEADERS_CHECK is not set
819CONFIG_DEBUG_KERNEL=y
820# CONFIG_DEBUG_SHIRQ is not set
821CONFIG_DETECT_SOFTLOCKUP=y
822CONFIG_SCHED_DEBUG=y
823# CONFIG_SCHEDSTATS is not set
824# CONFIG_TIMER_STATS is not set
825# CONFIG_SLUB_DEBUG_ON is not set
826# CONFIG_SLUB_STATS is not set
827# CONFIG_DEBUG_RT_MUTEXES is not set
828# CONFIG_RT_MUTEX_TESTER is not set
829# CONFIG_DEBUG_SPINLOCK is not set
830# CONFIG_DEBUG_MUTEXES is not set
831# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
832# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
833# CONFIG_DEBUG_KOBJECT is not set
834CONFIG_DEBUG_BUGVERBOSE=y
835# CONFIG_DEBUG_INFO is not set
836# CONFIG_DEBUG_VM is not set
837# CONFIG_DEBUG_LIST is not set
838# CONFIG_DEBUG_SG is not set
839# CONFIG_BOOT_PRINTK_DELAY is not set
840# CONFIG_RCU_TORTURE_TEST is not set
841# CONFIG_BACKTRACE_SELF_TEST is not set
842# CONFIG_FAULT_INJECTION is not set
843# CONFIG_SAMPLES is not set
844# CONFIG_DEBUG_STACKOVERFLOW is not set
845# CONFIG_DEBUG_STACK_USAGE is not set
846# CONFIG_DEBUG_PAGEALLOC is not set
847# CONFIG_DEBUGGER is not set
848# CONFIG_BDI_SWITCH is not set
849# CONFIG_PPC_EARLY_DEBUG is not set
850
851#
852# Security options
853#
854# CONFIG_KEYS is not set
855# CONFIG_SECURITY is not set
856# CONFIG_SECURITY_FILE_CAPABILITIES is not set
857CONFIG_CRYPTO=y
858CONFIG_CRYPTO_ALGAPI=y
859CONFIG_CRYPTO_BLKCIPHER=y
860# CONFIG_CRYPTO_SEQIV is not set
861CONFIG_CRYPTO_MANAGER=y
862# CONFIG_CRYPTO_HMAC is not set
863# CONFIG_CRYPTO_XCBC is not set
864# CONFIG_CRYPTO_NULL is not set
865# CONFIG_CRYPTO_MD4 is not set
866CONFIG_CRYPTO_MD5=y
867# CONFIG_CRYPTO_SHA1 is not set
868# CONFIG_CRYPTO_SHA256 is not set
869# CONFIG_CRYPTO_SHA512 is not set
870# CONFIG_CRYPTO_WP512 is not set
871# CONFIG_CRYPTO_TGR192 is not set
872# CONFIG_CRYPTO_GF128MUL is not set
873CONFIG_CRYPTO_ECB=y
874CONFIG_CRYPTO_CBC=y
875CONFIG_CRYPTO_PCBC=y
876# CONFIG_CRYPTO_LRW is not set
877# CONFIG_CRYPTO_XTS is not set
878# CONFIG_CRYPTO_CTR is not set
879# CONFIG_CRYPTO_GCM is not set
880# CONFIG_CRYPTO_CCM is not set
881# CONFIG_CRYPTO_CRYPTD is not set
882CONFIG_CRYPTO_DES=y
883# CONFIG_CRYPTO_FCRYPT is not set
884# CONFIG_CRYPTO_BLOWFISH is not set
885# CONFIG_CRYPTO_TWOFISH is not set
886# CONFIG_CRYPTO_SERPENT is not set
887# CONFIG_CRYPTO_AES is not set
888# CONFIG_CRYPTO_CAST5 is not set
889# CONFIG_CRYPTO_CAST6 is not set
890# CONFIG_CRYPTO_TEA is not set
891# CONFIG_CRYPTO_ARC4 is not set
892# CONFIG_CRYPTO_KHAZAD is not set
893# CONFIG_CRYPTO_ANUBIS is not set
894# CONFIG_CRYPTO_SEED is not set
895# CONFIG_CRYPTO_SALSA20 is not set
896# CONFIG_CRYPTO_DEFLATE is not set
897# CONFIG_CRYPTO_MICHAEL_MIC is not set
898# CONFIG_CRYPTO_CRC32C is not set
899# CONFIG_CRYPTO_CAMELLIA is not set
900# CONFIG_CRYPTO_TEST is not set
901# CONFIG_CRYPTO_AUTHENC is not set
902# CONFIG_CRYPTO_LZO is not set
903# CONFIG_CRYPTO_HW is not set
904# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/rainier_defconfig b/arch/powerpc/configs/rainier_defconfig
index 7b95001a22a8..dec18ca73519 100644
--- a/arch/powerpc/configs/rainier_defconfig
+++ b/arch/powerpc/configs/rainier_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Mon Dec 24 11:22:40 2007 4# Fri Feb 15 21:53:10 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -29,6 +29,7 @@ CONFIG_GENERIC_TIME=y
29CONFIG_GENERIC_TIME_VSYSCALL=y 29CONFIG_GENERIC_TIME_VSYSCALL=y
30CONFIG_GENERIC_CLOCKEVENTS=y 30CONFIG_GENERIC_CLOCKEVENTS=y
31CONFIG_GENERIC_HARDIRQS=y 31CONFIG_GENERIC_HARDIRQS=y
32# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
32CONFIG_IRQ_PER_CPU=y 33CONFIG_IRQ_PER_CPU=y
33CONFIG_RWSEM_XCHGADD_ALGORITHM=y 34CONFIG_RWSEM_XCHGADD_ALGORITHM=y
34CONFIG_ARCH_HAS_ILOG2_U32=y 35CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -67,17 +68,18 @@ CONFIG_SYSVIPC_SYSCTL=y
67CONFIG_POSIX_MQUEUE=y 68CONFIG_POSIX_MQUEUE=y
68# CONFIG_BSD_PROCESS_ACCT is not set 69# CONFIG_BSD_PROCESS_ACCT is not set
69# CONFIG_TASKSTATS is not set 70# CONFIG_TASKSTATS is not set
70# CONFIG_USER_NS is not set
71# CONFIG_PID_NS is not set
72# CONFIG_AUDIT is not set 71# CONFIG_AUDIT is not set
73# CONFIG_IKCONFIG is not set 72# CONFIG_IKCONFIG is not set
74CONFIG_LOG_BUF_SHIFT=14 73CONFIG_LOG_BUF_SHIFT=14
75# CONFIG_CGROUPS is not set 74# CONFIG_CGROUPS is not set
75CONFIG_GROUP_SCHED=y
76CONFIG_FAIR_GROUP_SCHED=y 76CONFIG_FAIR_GROUP_SCHED=y
77CONFIG_FAIR_USER_SCHED=y 77# CONFIG_RT_GROUP_SCHED is not set
78# CONFIG_FAIR_CGROUP_SCHED is not set 78CONFIG_USER_SCHED=y
79# CONFIG_CGROUP_SCHED is not set
79CONFIG_SYSFS_DEPRECATED=y 80CONFIG_SYSFS_DEPRECATED=y
80# CONFIG_RELAY is not set 81# CONFIG_RELAY is not set
82# CONFIG_NAMESPACES is not set
81CONFIG_BLK_DEV_INITRD=y 83CONFIG_BLK_DEV_INITRD=y
82CONFIG_INITRAMFS_SOURCE="" 84CONFIG_INITRAMFS_SOURCE=""
83# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 85# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -91,11 +93,13 @@ CONFIG_HOTPLUG=y
91CONFIG_PRINTK=y 93CONFIG_PRINTK=y
92CONFIG_BUG=y 94CONFIG_BUG=y
93CONFIG_ELF_CORE=y 95CONFIG_ELF_CORE=y
96CONFIG_COMPAT_BRK=y
94CONFIG_BASE_FULL=y 97CONFIG_BASE_FULL=y
95CONFIG_FUTEX=y 98CONFIG_FUTEX=y
96CONFIG_ANON_INODES=y 99CONFIG_ANON_INODES=y
97CONFIG_EPOLL=y 100CONFIG_EPOLL=y
98CONFIG_SIGNALFD=y 101CONFIG_SIGNALFD=y
102CONFIG_TIMERFD=y
99CONFIG_EVENTFD=y 103CONFIG_EVENTFD=y
100CONFIG_SHMEM=y 104CONFIG_SHMEM=y
101CONFIG_VM_EVENT_COUNTERS=y 105CONFIG_VM_EVENT_COUNTERS=y
@@ -103,6 +107,13 @@ CONFIG_SLUB_DEBUG=y
103# CONFIG_SLAB is not set 107# CONFIG_SLAB is not set
104CONFIG_SLUB=y 108CONFIG_SLUB=y
105# CONFIG_SLOB is not set 109# CONFIG_SLOB is not set
110# CONFIG_PROFILING is not set
111# CONFIG_MARKERS is not set
112CONFIG_HAVE_OPROFILE=y
113# CONFIG_KPROBES is not set
114CONFIG_HAVE_KPROBES=y
115CONFIG_PROC_PAGE_MONITOR=y
116CONFIG_SLABINFO=y
106CONFIG_RT_MUTEXES=y 117CONFIG_RT_MUTEXES=y
107# CONFIG_TINY_SHMEM is not set 118# CONFIG_TINY_SHMEM is not set
108CONFIG_BASE_SMALL=0 119CONFIG_BASE_SMALL=0
@@ -130,13 +141,15 @@ CONFIG_DEFAULT_AS=y
130# CONFIG_DEFAULT_CFQ is not set 141# CONFIG_DEFAULT_CFQ is not set
131# CONFIG_DEFAULT_NOOP is not set 142# CONFIG_DEFAULT_NOOP is not set
132CONFIG_DEFAULT_IOSCHED="anticipatory" 143CONFIG_DEFAULT_IOSCHED="anticipatory"
144CONFIG_CLASSIC_RCU=y
145# CONFIG_PREEMPT_RCU is not set
133# CONFIG_PPC4xx_PCI_EXPRESS is not set 146# CONFIG_PPC4xx_PCI_EXPRESS is not set
134 147
135# 148#
136# Platform support 149# Platform support
137# 150#
138# CONFIG_PPC_MPC52xx is not set 151# CONFIG_PPC_MPC512x is not set
139# CONFIG_PPC_MPC5200 is not set 152# CONFIG_PPC_MPC5121 is not set
140# CONFIG_PPC_CELL is not set 153# CONFIG_PPC_CELL is not set
141# CONFIG_PPC_CELL_NATIVE is not set 154# CONFIG_PPC_CELL_NATIVE is not set
142# CONFIG_PQ2ADS is not set 155# CONFIG_PQ2ADS is not set
@@ -146,7 +159,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
146# CONFIG_TAISHAN is not set 159# CONFIG_TAISHAN is not set
147# CONFIG_KATMAI is not set 160# CONFIG_KATMAI is not set
148CONFIG_RAINIER=y 161CONFIG_RAINIER=y
162# CONFIG_WARP is not set
149CONFIG_440GRX=y 163CONFIG_440GRX=y
164# CONFIG_IPIC is not set
150# CONFIG_MPIC is not set 165# CONFIG_MPIC is not set
151# CONFIG_MPIC_WEIRD is not set 166# CONFIG_MPIC_WEIRD is not set
152# CONFIG_PPC_I8259 is not set 167# CONFIG_PPC_I8259 is not set
@@ -157,7 +172,6 @@ CONFIG_440GRX=y
157# CONFIG_PPC_INDIRECT_IO is not set 172# CONFIG_PPC_INDIRECT_IO is not set
158# CONFIG_GENERIC_IOMAP is not set 173# CONFIG_GENERIC_IOMAP is not set
159# CONFIG_CPU_FREQ is not set 174# CONFIG_CPU_FREQ is not set
160# CONFIG_CPM2 is not set
161# CONFIG_FSL_ULI1575 is not set 175# CONFIG_FSL_ULI1575 is not set
162 176
163# 177#
@@ -173,13 +187,18 @@ CONFIG_HZ_250=y
173# CONFIG_HZ_300 is not set 187# CONFIG_HZ_300 is not set
174# CONFIG_HZ_1000 is not set 188# CONFIG_HZ_1000 is not set
175CONFIG_HZ=250 189CONFIG_HZ=250
190# CONFIG_SCHED_HRTICK is not set
176CONFIG_PREEMPT_NONE=y 191CONFIG_PREEMPT_NONE=y
177# CONFIG_PREEMPT_VOLUNTARY is not set 192# CONFIG_PREEMPT_VOLUNTARY is not set
178# CONFIG_PREEMPT is not set 193# CONFIG_PREEMPT is not set
194CONFIG_RCU_TRACE=y
179CONFIG_BINFMT_ELF=y 195CONFIG_BINFMT_ELF=y
180# CONFIG_BINFMT_MISC is not set 196# CONFIG_BINFMT_MISC is not set
181CONFIG_MATH_EMULATION=y 197CONFIG_MATH_EMULATION=y
198# CONFIG_IOMMU_HELPER is not set
182CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 199CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
200CONFIG_ARCH_HAS_WALK_MEMORY=y
201CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
183CONFIG_ARCH_FLATMEM_ENABLE=y 202CONFIG_ARCH_FLATMEM_ENABLE=y
184CONFIG_ARCH_POPULATES_NODE_MAP=y 203CONFIG_ARCH_POPULATES_NODE_MAP=y
185CONFIG_SELECT_MEMORY_MODEL=y 204CONFIG_SELECT_MEMORY_MODEL=y
@@ -199,8 +218,6 @@ CONFIG_PROC_DEVICETREE=y
199CONFIG_CMDLINE_BOOL=y 218CONFIG_CMDLINE_BOOL=y
200CONFIG_CMDLINE="" 219CONFIG_CMDLINE=""
201CONFIG_SECCOMP=y 220CONFIG_SECCOMP=y
202CONFIG_WANT_DEVICE_TREE=y
203CONFIG_DEVICE_TREE="rainier.dts"
204CONFIG_ISA_DMA_API=y 221CONFIG_ISA_DMA_API=y
205 222
206# 223#
@@ -300,6 +317,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
300# 317#
301# CONFIG_NET_PKTGEN is not set 318# CONFIG_NET_PKTGEN is not set
302# CONFIG_HAMRADIO is not set 319# CONFIG_HAMRADIO is not set
320# CONFIG_CAN is not set
303# CONFIG_IRDA is not set 321# CONFIG_IRDA is not set
304# CONFIG_BT is not set 322# CONFIG_BT is not set
305# CONFIG_AF_RXRPC is not set 323# CONFIG_AF_RXRPC is not set
@@ -336,6 +354,7 @@ CONFIG_MTD=y
336CONFIG_MTD_PARTITIONS=y 354CONFIG_MTD_PARTITIONS=y
337# CONFIG_MTD_REDBOOT_PARTS is not set 355# CONFIG_MTD_REDBOOT_PARTS is not set
338CONFIG_MTD_CMDLINE_PARTS=y 356CONFIG_MTD_CMDLINE_PARTS=y
357CONFIG_MTD_OF_PARTS=y
339 358
340# 359#
341# User Modules And Translation Layers 360# User Modules And Translation Layers
@@ -422,7 +441,7 @@ CONFIG_BLK_DEV=y
422CONFIG_BLK_DEV_RAM=y 441CONFIG_BLK_DEV_RAM=y
423CONFIG_BLK_DEV_RAM_COUNT=16 442CONFIG_BLK_DEV_RAM_COUNT=16
424CONFIG_BLK_DEV_RAM_SIZE=35000 443CONFIG_BLK_DEV_RAM_SIZE=35000
425CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 444# CONFIG_BLK_DEV_XIP is not set
426# CONFIG_CDROM_PKTCDVD is not set 445# CONFIG_CDROM_PKTCDVD is not set
427# CONFIG_ATA_OVER_ETH is not set 446# CONFIG_ATA_OVER_ETH is not set
428# CONFIG_XILINX_SYSACE is not set 447# CONFIG_XILINX_SYSACE is not set
@@ -431,6 +450,8 @@ CONFIG_MISC_DEVICES=y
431# CONFIG_EEPROM_93CX6 is not set 450# CONFIG_EEPROM_93CX6 is not set
432# CONFIG_SGI_IOC4 is not set 451# CONFIG_SGI_IOC4 is not set
433# CONFIG_TIFM_CORE is not set 452# CONFIG_TIFM_CORE is not set
453# CONFIG_ENCLOSURE_SERVICES is not set
454CONFIG_HAVE_IDE=y
434# CONFIG_IDE is not set 455# CONFIG_IDE is not set
435 456
436# 457#
@@ -461,7 +482,6 @@ CONFIG_NETDEVICES=y
461# CONFIG_EQUALIZER is not set 482# CONFIG_EQUALIZER is not set
462# CONFIG_TUN is not set 483# CONFIG_TUN is not set
463# CONFIG_VETH is not set 484# CONFIG_VETH is not set
464# CONFIG_IP1000 is not set
465# CONFIG_ARCNET is not set 485# CONFIG_ARCNET is not set
466# CONFIG_NET_ETHERNET is not set 486# CONFIG_NET_ETHERNET is not set
467CONFIG_IBM_NEW_EMAC_ZMII=y 487CONFIG_IBM_NEW_EMAC_ZMII=y
@@ -472,6 +492,9 @@ CONFIG_NETDEV_1000=y
472# CONFIG_DL2K is not set 492# CONFIG_DL2K is not set
473# CONFIG_E1000 is not set 493# CONFIG_E1000 is not set
474# CONFIG_E1000E is not set 494# CONFIG_E1000E is not set
495# CONFIG_E1000E_ENABLED is not set
496# CONFIG_IP1000 is not set
497# CONFIG_IGB is not set
475# CONFIG_NS83820 is not set 498# CONFIG_NS83820 is not set
476# CONFIG_HAMACHI is not set 499# CONFIG_HAMACHI is not set
477# CONFIG_YELLOWFIN is not set 500# CONFIG_YELLOWFIN is not set
@@ -496,6 +519,7 @@ CONFIG_NETDEV_10000=y
496# CONFIG_NIU is not set 519# CONFIG_NIU is not set
497# CONFIG_MLX4_CORE is not set 520# CONFIG_MLX4_CORE is not set
498# CONFIG_TEHUTI is not set 521# CONFIG_TEHUTI is not set
522# CONFIG_BNX2X is not set
499# CONFIG_TR is not set 523# CONFIG_TR is not set
500 524
501# 525#
@@ -508,7 +532,6 @@ CONFIG_NETDEV_10000=y
508# CONFIG_HIPPI is not set 532# CONFIG_HIPPI is not set
509# CONFIG_PPP is not set 533# CONFIG_PPP is not set
510# CONFIG_SLIP is not set 534# CONFIG_SLIP is not set
511# CONFIG_SHAPER is not set
512# CONFIG_NETCONSOLE is not set 535# CONFIG_NETCONSOLE is not set
513# CONFIG_NETPOLL is not set 536# CONFIG_NETPOLL is not set
514# CONFIG_NET_POLL_CONTROLLER is not set 537# CONFIG_NET_POLL_CONTROLLER is not set
@@ -531,6 +554,7 @@ CONFIG_NETDEV_10000=y
531# 554#
532# CONFIG_VT is not set 555# CONFIG_VT is not set
533# CONFIG_SERIAL_NONSTANDARD is not set 556# CONFIG_SERIAL_NONSTANDARD is not set
557# CONFIG_NOZOMI is not set
534 558
535# 559#
536# Serial drivers 560# Serial drivers
@@ -576,6 +600,7 @@ CONFIG_DEVPORT=y
576# CONFIG_W1 is not set 600# CONFIG_W1 is not set
577# CONFIG_POWER_SUPPLY is not set 601# CONFIG_POWER_SUPPLY is not set
578# CONFIG_HWMON is not set 602# CONFIG_HWMON is not set
603CONFIG_THERMAL=y
579# CONFIG_WATCHDOG is not set 604# CONFIG_WATCHDOG is not set
580 605
581# 606#
@@ -624,12 +649,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
624# 649#
625# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 650# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
626# 651#
627
628#
629# USB Gadget Support
630#
631# CONFIG_USB_GADGET is not set 652# CONFIG_USB_GADGET is not set
632# CONFIG_MMC is not set 653# CONFIG_MMC is not set
654# CONFIG_MEMSTICK is not set
633# CONFIG_NEW_LEDS is not set 655# CONFIG_NEW_LEDS is not set
634# CONFIG_INFINIBAND is not set 656# CONFIG_INFINIBAND is not set
635# CONFIG_EDAC is not set 657# CONFIG_EDAC is not set
@@ -654,12 +676,10 @@ CONFIG_EXT2_FS=y
654# CONFIG_XFS_FS is not set 676# CONFIG_XFS_FS is not set
655# CONFIG_GFS2_FS is not set 677# CONFIG_GFS2_FS is not set
656# CONFIG_OCFS2_FS is not set 678# CONFIG_OCFS2_FS is not set
657# CONFIG_MINIX_FS is not set 679CONFIG_DNOTIFY=y
658# CONFIG_ROMFS_FS is not set
659CONFIG_INOTIFY=y 680CONFIG_INOTIFY=y
660CONFIG_INOTIFY_USER=y 681CONFIG_INOTIFY_USER=y
661# CONFIG_QUOTA is not set 682# CONFIG_QUOTA is not set
662CONFIG_DNOTIFY=y
663# CONFIG_AUTOFS_FS is not set 683# CONFIG_AUTOFS_FS is not set
664# CONFIG_AUTOFS4_FS is not set 684# CONFIG_AUTOFS4_FS is not set
665# CONFIG_FUSE_FS is not set 685# CONFIG_FUSE_FS is not set
@@ -712,8 +732,10 @@ CONFIG_JFFS2_RTIME=y
712# CONFIG_JFFS2_RUBIN is not set 732# CONFIG_JFFS2_RUBIN is not set
713CONFIG_CRAMFS=y 733CONFIG_CRAMFS=y
714# CONFIG_VXFS_FS is not set 734# CONFIG_VXFS_FS is not set
735# CONFIG_MINIX_FS is not set
715# CONFIG_HPFS_FS is not set 736# CONFIG_HPFS_FS is not set
716# CONFIG_QNX4FS_FS is not set 737# CONFIG_QNX4FS_FS is not set
738# CONFIG_ROMFS_FS is not set
717# CONFIG_SYSV_FS is not set 739# CONFIG_SYSV_FS is not set
718# CONFIG_UFS_FS is not set 740# CONFIG_UFS_FS is not set
719CONFIG_NETWORK_FILESYSTEMS=y 741CONFIG_NETWORK_FILESYSTEMS=y
@@ -744,7 +766,6 @@ CONFIG_SUNRPC=y
744CONFIG_MSDOS_PARTITION=y 766CONFIG_MSDOS_PARTITION=y
745# CONFIG_NLS is not set 767# CONFIG_NLS is not set
746# CONFIG_DLM is not set 768# CONFIG_DLM is not set
747# CONFIG_UCC_SLOW is not set
748 769
749# 770#
750# Library routines 771# Library routines
@@ -762,10 +783,6 @@ CONFIG_PLIST=y
762CONFIG_HAS_IOMEM=y 783CONFIG_HAS_IOMEM=y
763CONFIG_HAS_IOPORT=y 784CONFIG_HAS_IOPORT=y
764CONFIG_HAS_DMA=y 785CONFIG_HAS_DMA=y
765CONFIG_INSTRUMENTATION=y
766# CONFIG_PROFILING is not set
767# CONFIG_KPROBES is not set
768# CONFIG_MARKERS is not set
769 786
770# 787#
771# Kernel hacking 788# Kernel hacking
@@ -775,7 +792,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
775CONFIG_ENABLE_MUST_CHECK=y 792CONFIG_ENABLE_MUST_CHECK=y
776CONFIG_MAGIC_SYSRQ=y 793CONFIG_MAGIC_SYSRQ=y
777# CONFIG_UNUSED_SYMBOLS is not set 794# CONFIG_UNUSED_SYMBOLS is not set
778# CONFIG_DEBUG_FS is not set 795CONFIG_DEBUG_FS=y
779# CONFIG_HEADERS_CHECK is not set 796# CONFIG_HEADERS_CHECK is not set
780CONFIG_DEBUG_KERNEL=y 797CONFIG_DEBUG_KERNEL=y
781# CONFIG_DEBUG_SHIRQ is not set 798# CONFIG_DEBUG_SHIRQ is not set
@@ -784,6 +801,7 @@ CONFIG_SCHED_DEBUG=y
784# CONFIG_SCHEDSTATS is not set 801# CONFIG_SCHEDSTATS is not set
785# CONFIG_TIMER_STATS is not set 802# CONFIG_TIMER_STATS is not set
786# CONFIG_SLUB_DEBUG_ON is not set 803# CONFIG_SLUB_DEBUG_ON is not set
804# CONFIG_SLUB_STATS is not set
787# CONFIG_DEBUG_RT_MUTEXES is not set 805# CONFIG_DEBUG_RT_MUTEXES is not set
788# CONFIG_RT_MUTEX_TESTER is not set 806# CONFIG_RT_MUTEX_TESTER is not set
789# CONFIG_DEBUG_SPINLOCK is not set 807# CONFIG_DEBUG_SPINLOCK is not set
@@ -796,9 +814,9 @@ CONFIG_SCHED_DEBUG=y
796# CONFIG_DEBUG_VM is not set 814# CONFIG_DEBUG_VM is not set
797# CONFIG_DEBUG_LIST is not set 815# CONFIG_DEBUG_LIST is not set
798# CONFIG_DEBUG_SG is not set 816# CONFIG_DEBUG_SG is not set
799CONFIG_FORCED_INLINING=y
800# CONFIG_BOOT_PRINTK_DELAY is not set 817# CONFIG_BOOT_PRINTK_DELAY is not set
801# CONFIG_RCU_TORTURE_TEST is not set 818# CONFIG_RCU_TORTURE_TEST is not set
819# CONFIG_BACKTRACE_SELF_TEST is not set
802# CONFIG_FAULT_INJECTION is not set 820# CONFIG_FAULT_INJECTION is not set
803# CONFIG_SAMPLES is not set 821# CONFIG_SAMPLES is not set
804# CONFIG_DEBUG_STACKOVERFLOW is not set 822# CONFIG_DEBUG_STACKOVERFLOW is not set
@@ -807,6 +825,7 @@ CONFIG_FORCED_INLINING=y
807CONFIG_DEBUGGER=y 825CONFIG_DEBUGGER=y
808# CONFIG_KGDB is not set 826# CONFIG_KGDB is not set
809# CONFIG_XMON is not set 827# CONFIG_XMON is not set
828# CONFIG_VIRQ_DEBUG is not set
810# CONFIG_BDI_SWITCH is not set 829# CONFIG_BDI_SWITCH is not set
811CONFIG_PPC_EARLY_DEBUG=y 830CONFIG_PPC_EARLY_DEBUG=y
812# CONFIG_PPC_EARLY_DEBUG_LPAR is not set 831# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
@@ -832,6 +851,7 @@ CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH=0x1
832CONFIG_CRYPTO=y 851CONFIG_CRYPTO=y
833CONFIG_CRYPTO_ALGAPI=y 852CONFIG_CRYPTO_ALGAPI=y
834CONFIG_CRYPTO_BLKCIPHER=y 853CONFIG_CRYPTO_BLKCIPHER=y
854# CONFIG_CRYPTO_SEQIV is not set
835CONFIG_CRYPTO_MANAGER=y 855CONFIG_CRYPTO_MANAGER=y
836# CONFIG_CRYPTO_HMAC is not set 856# CONFIG_CRYPTO_HMAC is not set
837# CONFIG_CRYPTO_XCBC is not set 857# CONFIG_CRYPTO_XCBC is not set
@@ -849,6 +869,9 @@ CONFIG_CRYPTO_CBC=y
849CONFIG_CRYPTO_PCBC=y 869CONFIG_CRYPTO_PCBC=y
850# CONFIG_CRYPTO_LRW is not set 870# CONFIG_CRYPTO_LRW is not set
851# CONFIG_CRYPTO_XTS is not set 871# CONFIG_CRYPTO_XTS is not set
872# CONFIG_CRYPTO_CTR is not set
873# CONFIG_CRYPTO_GCM is not set
874# CONFIG_CRYPTO_CCM is not set
852# CONFIG_CRYPTO_CRYPTD is not set 875# CONFIG_CRYPTO_CRYPTD is not set
853CONFIG_CRYPTO_DES=y 876CONFIG_CRYPTO_DES=y
854# CONFIG_CRYPTO_FCRYPT is not set 877# CONFIG_CRYPTO_FCRYPT is not set
@@ -863,11 +886,14 @@ CONFIG_CRYPTO_DES=y
863# CONFIG_CRYPTO_KHAZAD is not set 886# CONFIG_CRYPTO_KHAZAD is not set
864# CONFIG_CRYPTO_ANUBIS is not set 887# CONFIG_CRYPTO_ANUBIS is not set
865# CONFIG_CRYPTO_SEED is not set 888# CONFIG_CRYPTO_SEED is not set
889# CONFIG_CRYPTO_SALSA20 is not set
866# CONFIG_CRYPTO_DEFLATE is not set 890# CONFIG_CRYPTO_DEFLATE is not set
867# CONFIG_CRYPTO_MICHAEL_MIC is not set 891# CONFIG_CRYPTO_MICHAEL_MIC is not set
868# CONFIG_CRYPTO_CRC32C is not set 892# CONFIG_CRYPTO_CRC32C is not set
869# CONFIG_CRYPTO_CAMELLIA is not set 893# CONFIG_CRYPTO_CAMELLIA is not set
870# CONFIG_CRYPTO_TEST is not set 894# CONFIG_CRYPTO_TEST is not set
871# CONFIG_CRYPTO_AUTHENC is not set 895# CONFIG_CRYPTO_AUTHENC is not set
896# CONFIG_CRYPTO_LZO is not set
872CONFIG_CRYPTO_HW=y 897CONFIG_CRYPTO_HW=y
898# CONFIG_CRYPTO_DEV_HIFN_795X is not set
873# CONFIG_PPC_CLOCK is not set 899# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/sequoia_defconfig b/arch/powerpc/configs/sequoia_defconfig
index abbfed6582e1..dd5d6303c396 100644
--- a/arch/powerpc/configs/sequoia_defconfig
+++ b/arch/powerpc/configs/sequoia_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Mon Dec 24 11:23:22 2007 4# Fri Feb 15 21:53:46 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -30,6 +30,7 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 30CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 31CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 32CONFIG_GENERIC_HARDIRQS=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
33CONFIG_IRQ_PER_CPU=y 34CONFIG_IRQ_PER_CPU=y
34CONFIG_RWSEM_XCHGADD_ALGORITHM=y 35CONFIG_RWSEM_XCHGADD_ALGORITHM=y
35CONFIG_ARCH_HAS_ILOG2_U32=y 36CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -68,15 +69,18 @@ CONFIG_SYSVIPC_SYSCTL=y
68CONFIG_POSIX_MQUEUE=y 69CONFIG_POSIX_MQUEUE=y
69# CONFIG_BSD_PROCESS_ACCT is not set 70# CONFIG_BSD_PROCESS_ACCT is not set
70# CONFIG_TASKSTATS is not set 71# CONFIG_TASKSTATS is not set
71# CONFIG_USER_NS is not set
72# CONFIG_PID_NS is not set
73# CONFIG_AUDIT is not set 72# CONFIG_AUDIT is not set
74# CONFIG_IKCONFIG is not set 73# CONFIG_IKCONFIG is not set
75CONFIG_LOG_BUF_SHIFT=14 74CONFIG_LOG_BUF_SHIFT=14
76# CONFIG_CGROUPS is not set 75# CONFIG_CGROUPS is not set
76CONFIG_GROUP_SCHED=y
77# CONFIG_FAIR_GROUP_SCHED is not set 77# CONFIG_FAIR_GROUP_SCHED is not set
78# CONFIG_RT_GROUP_SCHED is not set
79CONFIG_USER_SCHED=y
80# CONFIG_CGROUP_SCHED is not set
78CONFIG_SYSFS_DEPRECATED=y 81CONFIG_SYSFS_DEPRECATED=y
79# CONFIG_RELAY is not set 82# CONFIG_RELAY is not set
83# CONFIG_NAMESPACES is not set
80CONFIG_BLK_DEV_INITRD=y 84CONFIG_BLK_DEV_INITRD=y
81CONFIG_INITRAMFS_SOURCE="" 85CONFIG_INITRAMFS_SOURCE=""
82# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 86# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -90,11 +94,13 @@ CONFIG_HOTPLUG=y
90CONFIG_PRINTK=y 94CONFIG_PRINTK=y
91CONFIG_BUG=y 95CONFIG_BUG=y
92CONFIG_ELF_CORE=y 96CONFIG_ELF_CORE=y
97CONFIG_COMPAT_BRK=y
93CONFIG_BASE_FULL=y 98CONFIG_BASE_FULL=y
94CONFIG_FUTEX=y 99CONFIG_FUTEX=y
95CONFIG_ANON_INODES=y 100CONFIG_ANON_INODES=y
96CONFIG_EPOLL=y 101CONFIG_EPOLL=y
97CONFIG_SIGNALFD=y 102CONFIG_SIGNALFD=y
103CONFIG_TIMERFD=y
98CONFIG_EVENTFD=y 104CONFIG_EVENTFD=y
99CONFIG_SHMEM=y 105CONFIG_SHMEM=y
100CONFIG_VM_EVENT_COUNTERS=y 106CONFIG_VM_EVENT_COUNTERS=y
@@ -102,6 +108,13 @@ CONFIG_SLUB_DEBUG=y
102# CONFIG_SLAB is not set 108# CONFIG_SLAB is not set
103CONFIG_SLUB=y 109CONFIG_SLUB=y
104# CONFIG_SLOB is not set 110# CONFIG_SLOB is not set
111# CONFIG_PROFILING is not set
112# CONFIG_MARKERS is not set
113CONFIG_HAVE_OPROFILE=y
114# CONFIG_KPROBES is not set
115CONFIG_HAVE_KPROBES=y
116CONFIG_PROC_PAGE_MONITOR=y
117CONFIG_SLABINFO=y
105CONFIG_RT_MUTEXES=y 118CONFIG_RT_MUTEXES=y
106# CONFIG_TINY_SHMEM is not set 119# CONFIG_TINY_SHMEM is not set
107CONFIG_BASE_SMALL=0 120CONFIG_BASE_SMALL=0
@@ -129,13 +142,15 @@ CONFIG_DEFAULT_AS=y
129# CONFIG_DEFAULT_CFQ is not set 142# CONFIG_DEFAULT_CFQ is not set
130# CONFIG_DEFAULT_NOOP is not set 143# CONFIG_DEFAULT_NOOP is not set
131CONFIG_DEFAULT_IOSCHED="anticipatory" 144CONFIG_DEFAULT_IOSCHED="anticipatory"
145CONFIG_CLASSIC_RCU=y
146# CONFIG_PREEMPT_RCU is not set
132# CONFIG_PPC4xx_PCI_EXPRESS is not set 147# CONFIG_PPC4xx_PCI_EXPRESS is not set
133 148
134# 149#
135# Platform support 150# Platform support
136# 151#
137# CONFIG_PPC_MPC52xx is not set 152# CONFIG_PPC_MPC512x is not set
138# CONFIG_PPC_MPC5200 is not set 153# CONFIG_PPC_MPC5121 is not set
139# CONFIG_PPC_CELL is not set 154# CONFIG_PPC_CELL is not set
140# CONFIG_PPC_CELL_NATIVE is not set 155# CONFIG_PPC_CELL_NATIVE is not set
141# CONFIG_PQ2ADS is not set 156# CONFIG_PQ2ADS is not set
@@ -145,7 +160,9 @@ CONFIG_SEQUOIA=y
145# CONFIG_TAISHAN is not set 160# CONFIG_TAISHAN is not set
146# CONFIG_KATMAI is not set 161# CONFIG_KATMAI is not set
147# CONFIG_RAINIER is not set 162# CONFIG_RAINIER is not set
163# CONFIG_WARP is not set
148CONFIG_440EPX=y 164CONFIG_440EPX=y
165# CONFIG_IPIC is not set
149# CONFIG_MPIC is not set 166# CONFIG_MPIC is not set
150# CONFIG_MPIC_WEIRD is not set 167# CONFIG_MPIC_WEIRD is not set
151# CONFIG_PPC_I8259 is not set 168# CONFIG_PPC_I8259 is not set
@@ -156,7 +173,6 @@ CONFIG_440EPX=y
156# CONFIG_PPC_INDIRECT_IO is not set 173# CONFIG_PPC_INDIRECT_IO is not set
157# CONFIG_GENERIC_IOMAP is not set 174# CONFIG_GENERIC_IOMAP is not set
158# CONFIG_CPU_FREQ is not set 175# CONFIG_CPU_FREQ is not set
159# CONFIG_CPM2 is not set
160# CONFIG_FSL_ULI1575 is not set 176# CONFIG_FSL_ULI1575 is not set
161 177
162# 178#
@@ -172,13 +188,18 @@ CONFIG_HZ_250=y
172# CONFIG_HZ_300 is not set 188# CONFIG_HZ_300 is not set
173# CONFIG_HZ_1000 is not set 189# CONFIG_HZ_1000 is not set
174CONFIG_HZ=250 190CONFIG_HZ=250
191# CONFIG_SCHED_HRTICK is not set
175CONFIG_PREEMPT_NONE=y 192CONFIG_PREEMPT_NONE=y
176# CONFIG_PREEMPT_VOLUNTARY is not set 193# CONFIG_PREEMPT_VOLUNTARY is not set
177# CONFIG_PREEMPT is not set 194# CONFIG_PREEMPT is not set
195CONFIG_RCU_TRACE=y
178CONFIG_BINFMT_ELF=y 196CONFIG_BINFMT_ELF=y
179# CONFIG_BINFMT_MISC is not set 197# CONFIG_BINFMT_MISC is not set
180# CONFIG_MATH_EMULATION is not set 198# CONFIG_MATH_EMULATION is not set
199# CONFIG_IOMMU_HELPER is not set
181CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 200CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
201CONFIG_ARCH_HAS_WALK_MEMORY=y
202CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
182CONFIG_ARCH_FLATMEM_ENABLE=y 203CONFIG_ARCH_FLATMEM_ENABLE=y
183CONFIG_ARCH_POPULATES_NODE_MAP=y 204CONFIG_ARCH_POPULATES_NODE_MAP=y
184CONFIG_SELECT_MEMORY_MODEL=y 205CONFIG_SELECT_MEMORY_MODEL=y
@@ -198,8 +219,6 @@ CONFIG_PROC_DEVICETREE=y
198CONFIG_CMDLINE_BOOL=y 219CONFIG_CMDLINE_BOOL=y
199CONFIG_CMDLINE="" 220CONFIG_CMDLINE=""
200CONFIG_SECCOMP=y 221CONFIG_SECCOMP=y
201CONFIG_WANT_DEVICE_TREE=y
202CONFIG_DEVICE_TREE="sequoia.dts"
203CONFIG_ISA_DMA_API=y 222CONFIG_ISA_DMA_API=y
204 223
205# 224#
@@ -299,6 +318,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
299# 318#
300# CONFIG_NET_PKTGEN is not set 319# CONFIG_NET_PKTGEN is not set
301# CONFIG_HAMRADIO is not set 320# CONFIG_HAMRADIO is not set
321# CONFIG_CAN is not set
302# CONFIG_IRDA is not set 322# CONFIG_IRDA is not set
303# CONFIG_BT is not set 323# CONFIG_BT is not set
304# CONFIG_AF_RXRPC is not set 324# CONFIG_AF_RXRPC is not set
@@ -335,6 +355,7 @@ CONFIG_MTD=y
335CONFIG_MTD_PARTITIONS=y 355CONFIG_MTD_PARTITIONS=y
336# CONFIG_MTD_REDBOOT_PARTS is not set 356# CONFIG_MTD_REDBOOT_PARTS is not set
337CONFIG_MTD_CMDLINE_PARTS=y 357CONFIG_MTD_CMDLINE_PARTS=y
358CONFIG_MTD_OF_PARTS=y
338 359
339# 360#
340# User Modules And Translation Layers 361# User Modules And Translation Layers
@@ -421,7 +442,7 @@ CONFIG_BLK_DEV=y
421CONFIG_BLK_DEV_RAM=y 442CONFIG_BLK_DEV_RAM=y
422CONFIG_BLK_DEV_RAM_COUNT=16 443CONFIG_BLK_DEV_RAM_COUNT=16
423CONFIG_BLK_DEV_RAM_SIZE=35000 444CONFIG_BLK_DEV_RAM_SIZE=35000
424CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 445# CONFIG_BLK_DEV_XIP is not set
425# CONFIG_CDROM_PKTCDVD is not set 446# CONFIG_CDROM_PKTCDVD is not set
426# CONFIG_ATA_OVER_ETH is not set 447# CONFIG_ATA_OVER_ETH is not set
427# CONFIG_XILINX_SYSACE is not set 448# CONFIG_XILINX_SYSACE is not set
@@ -430,6 +451,8 @@ CONFIG_MISC_DEVICES=y
430# CONFIG_EEPROM_93CX6 is not set 451# CONFIG_EEPROM_93CX6 is not set
431# CONFIG_SGI_IOC4 is not set 452# CONFIG_SGI_IOC4 is not set
432# CONFIG_TIFM_CORE is not set 453# CONFIG_TIFM_CORE is not set
454# CONFIG_ENCLOSURE_SERVICES is not set
455CONFIG_HAVE_IDE=y
433# CONFIG_IDE is not set 456# CONFIG_IDE is not set
434 457
435# 458#
@@ -458,7 +481,6 @@ CONFIG_NETDEVICES=y
458# CONFIG_EQUALIZER is not set 481# CONFIG_EQUALIZER is not set
459# CONFIG_TUN is not set 482# CONFIG_TUN is not set
460# CONFIG_VETH is not set 483# CONFIG_VETH is not set
461# CONFIG_IP1000 is not set
462# CONFIG_ARCNET is not set 484# CONFIG_ARCNET is not set
463# CONFIG_PHYLIB is not set 485# CONFIG_PHYLIB is not set
464CONFIG_NET_ETHERNET=y 486CONFIG_NET_ETHERNET=y
@@ -487,6 +509,9 @@ CONFIG_NETDEV_1000=y
487# CONFIG_DL2K is not set 509# CONFIG_DL2K is not set
488# CONFIG_E1000 is not set 510# CONFIG_E1000 is not set
489# CONFIG_E1000E is not set 511# CONFIG_E1000E is not set
512# CONFIG_E1000E_ENABLED is not set
513# CONFIG_IP1000 is not set
514# CONFIG_IGB is not set
490# CONFIG_NS83820 is not set 515# CONFIG_NS83820 is not set
491# CONFIG_HAMACHI is not set 516# CONFIG_HAMACHI is not set
492# CONFIG_YELLOWFIN is not set 517# CONFIG_YELLOWFIN is not set
@@ -511,6 +536,7 @@ CONFIG_NETDEV_10000=y
511# CONFIG_NIU is not set 536# CONFIG_NIU is not set
512# CONFIG_MLX4_CORE is not set 537# CONFIG_MLX4_CORE is not set
513# CONFIG_TEHUTI is not set 538# CONFIG_TEHUTI is not set
539# CONFIG_BNX2X is not set
514# CONFIG_TR is not set 540# CONFIG_TR is not set
515 541
516# 542#
@@ -523,7 +549,6 @@ CONFIG_NETDEV_10000=y
523# CONFIG_HIPPI is not set 549# CONFIG_HIPPI is not set
524# CONFIG_PPP is not set 550# CONFIG_PPP is not set
525# CONFIG_SLIP is not set 551# CONFIG_SLIP is not set
526# CONFIG_SHAPER is not set
527# CONFIG_NETCONSOLE is not set 552# CONFIG_NETCONSOLE is not set
528# CONFIG_NETPOLL is not set 553# CONFIG_NETPOLL is not set
529# CONFIG_NET_POLL_CONTROLLER is not set 554# CONFIG_NET_POLL_CONTROLLER is not set
@@ -546,6 +571,7 @@ CONFIG_NETDEV_10000=y
546# 571#
547# CONFIG_VT is not set 572# CONFIG_VT is not set
548# CONFIG_SERIAL_NONSTANDARD is not set 573# CONFIG_SERIAL_NONSTANDARD is not set
574# CONFIG_NOZOMI is not set
549 575
550# 576#
551# Serial drivers 577# Serial drivers
@@ -591,6 +617,7 @@ CONFIG_DEVPORT=y
591# CONFIG_W1 is not set 617# CONFIG_W1 is not set
592# CONFIG_POWER_SUPPLY is not set 618# CONFIG_POWER_SUPPLY is not set
593# CONFIG_HWMON is not set 619# CONFIG_HWMON is not set
620CONFIG_THERMAL=y
594# CONFIG_WATCHDOG is not set 621# CONFIG_WATCHDOG is not set
595 622
596# 623#
@@ -639,12 +666,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
639# 666#
640# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 667# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
641# 668#
642
643#
644# USB Gadget Support
645#
646# CONFIG_USB_GADGET is not set 669# CONFIG_USB_GADGET is not set
647# CONFIG_MMC is not set 670# CONFIG_MMC is not set
671# CONFIG_MEMSTICK is not set
648# CONFIG_NEW_LEDS is not set 672# CONFIG_NEW_LEDS is not set
649# CONFIG_INFINIBAND is not set 673# CONFIG_INFINIBAND is not set
650# CONFIG_EDAC is not set 674# CONFIG_EDAC is not set
@@ -669,12 +693,10 @@ CONFIG_EXT2_FS=y
669# CONFIG_XFS_FS is not set 693# CONFIG_XFS_FS is not set
670# CONFIG_GFS2_FS is not set 694# CONFIG_GFS2_FS is not set
671# CONFIG_OCFS2_FS is not set 695# CONFIG_OCFS2_FS is not set
672# CONFIG_MINIX_FS is not set 696CONFIG_DNOTIFY=y
673# CONFIG_ROMFS_FS is not set
674CONFIG_INOTIFY=y 697CONFIG_INOTIFY=y
675CONFIG_INOTIFY_USER=y 698CONFIG_INOTIFY_USER=y
676# CONFIG_QUOTA is not set 699# CONFIG_QUOTA is not set
677CONFIG_DNOTIFY=y
678# CONFIG_AUTOFS_FS is not set 700# CONFIG_AUTOFS_FS is not set
679# CONFIG_AUTOFS4_FS is not set 701# CONFIG_AUTOFS4_FS is not set
680# CONFIG_FUSE_FS is not set 702# CONFIG_FUSE_FS is not set
@@ -727,8 +749,10 @@ CONFIG_JFFS2_RTIME=y
727# CONFIG_JFFS2_RUBIN is not set 749# CONFIG_JFFS2_RUBIN is not set
728CONFIG_CRAMFS=y 750CONFIG_CRAMFS=y
729# CONFIG_VXFS_FS is not set 751# CONFIG_VXFS_FS is not set
752# CONFIG_MINIX_FS is not set
730# CONFIG_HPFS_FS is not set 753# CONFIG_HPFS_FS is not set
731# CONFIG_QNX4FS_FS is not set 754# CONFIG_QNX4FS_FS is not set
755# CONFIG_ROMFS_FS is not set
732# CONFIG_SYSV_FS is not set 756# CONFIG_SYSV_FS is not set
733# CONFIG_UFS_FS is not set 757# CONFIG_UFS_FS is not set
734CONFIG_NETWORK_FILESYSTEMS=y 758CONFIG_NETWORK_FILESYSTEMS=y
@@ -759,7 +783,6 @@ CONFIG_SUNRPC=y
759CONFIG_MSDOS_PARTITION=y 783CONFIG_MSDOS_PARTITION=y
760# CONFIG_NLS is not set 784# CONFIG_NLS is not set
761# CONFIG_DLM is not set 785# CONFIG_DLM is not set
762# CONFIG_UCC_SLOW is not set
763 786
764# 787#
765# Library routines 788# Library routines
@@ -777,7 +800,6 @@ CONFIG_PLIST=y
777CONFIG_HAS_IOMEM=y 800CONFIG_HAS_IOMEM=y
778CONFIG_HAS_IOPORT=y 801CONFIG_HAS_IOPORT=y
779CONFIG_HAS_DMA=y 802CONFIG_HAS_DMA=y
780# CONFIG_INSTRUMENTATION is not set
781 803
782# 804#
783# Kernel hacking 805# Kernel hacking
@@ -787,7 +809,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
787CONFIG_ENABLE_MUST_CHECK=y 809CONFIG_ENABLE_MUST_CHECK=y
788CONFIG_MAGIC_SYSRQ=y 810CONFIG_MAGIC_SYSRQ=y
789# CONFIG_UNUSED_SYMBOLS is not set 811# CONFIG_UNUSED_SYMBOLS is not set
790# CONFIG_DEBUG_FS is not set 812CONFIG_DEBUG_FS=y
791# CONFIG_HEADERS_CHECK is not set 813# CONFIG_HEADERS_CHECK is not set
792CONFIG_DEBUG_KERNEL=y 814CONFIG_DEBUG_KERNEL=y
793# CONFIG_DEBUG_SHIRQ is not set 815# CONFIG_DEBUG_SHIRQ is not set
@@ -796,6 +818,7 @@ CONFIG_SCHED_DEBUG=y
796# CONFIG_SCHEDSTATS is not set 818# CONFIG_SCHEDSTATS is not set
797# CONFIG_TIMER_STATS is not set 819# CONFIG_TIMER_STATS is not set
798# CONFIG_SLUB_DEBUG_ON is not set 820# CONFIG_SLUB_DEBUG_ON is not set
821# CONFIG_SLUB_STATS is not set
799# CONFIG_DEBUG_RT_MUTEXES is not set 822# CONFIG_DEBUG_RT_MUTEXES is not set
800# CONFIG_RT_MUTEX_TESTER is not set 823# CONFIG_RT_MUTEX_TESTER is not set
801# CONFIG_DEBUG_SPINLOCK is not set 824# CONFIG_DEBUG_SPINLOCK is not set
@@ -808,9 +831,9 @@ CONFIG_SCHED_DEBUG=y
808# CONFIG_DEBUG_VM is not set 831# CONFIG_DEBUG_VM is not set
809# CONFIG_DEBUG_LIST is not set 832# CONFIG_DEBUG_LIST is not set
810# CONFIG_DEBUG_SG is not set 833# CONFIG_DEBUG_SG is not set
811CONFIG_FORCED_INLINING=y
812# CONFIG_BOOT_PRINTK_DELAY is not set 834# CONFIG_BOOT_PRINTK_DELAY is not set
813# CONFIG_RCU_TORTURE_TEST is not set 835# CONFIG_RCU_TORTURE_TEST is not set
836# CONFIG_BACKTRACE_SELF_TEST is not set
814# CONFIG_FAULT_INJECTION is not set 837# CONFIG_FAULT_INJECTION is not set
815# CONFIG_SAMPLES is not set 838# CONFIG_SAMPLES is not set
816# CONFIG_DEBUG_STACKOVERFLOW is not set 839# CONFIG_DEBUG_STACKOVERFLOW is not set
@@ -819,6 +842,7 @@ CONFIG_FORCED_INLINING=y
819CONFIG_DEBUGGER=y 842CONFIG_DEBUGGER=y
820# CONFIG_KGDB is not set 843# CONFIG_KGDB is not set
821# CONFIG_XMON is not set 844# CONFIG_XMON is not set
845# CONFIG_VIRQ_DEBUG is not set
822# CONFIG_BDI_SWITCH is not set 846# CONFIG_BDI_SWITCH is not set
823CONFIG_PPC_EARLY_DEBUG=y 847CONFIG_PPC_EARLY_DEBUG=y
824# CONFIG_PPC_EARLY_DEBUG_LPAR is not set 848# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
@@ -844,6 +868,7 @@ CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH=0x1
844CONFIG_CRYPTO=y 868CONFIG_CRYPTO=y
845CONFIG_CRYPTO_ALGAPI=y 869CONFIG_CRYPTO_ALGAPI=y
846CONFIG_CRYPTO_BLKCIPHER=y 870CONFIG_CRYPTO_BLKCIPHER=y
871# CONFIG_CRYPTO_SEQIV is not set
847CONFIG_CRYPTO_MANAGER=y 872CONFIG_CRYPTO_MANAGER=y
848# CONFIG_CRYPTO_HMAC is not set 873# CONFIG_CRYPTO_HMAC is not set
849# CONFIG_CRYPTO_XCBC is not set 874# CONFIG_CRYPTO_XCBC is not set
@@ -861,6 +886,9 @@ CONFIG_CRYPTO_CBC=y
861CONFIG_CRYPTO_PCBC=y 886CONFIG_CRYPTO_PCBC=y
862# CONFIG_CRYPTO_LRW is not set 887# CONFIG_CRYPTO_LRW is not set
863# CONFIG_CRYPTO_XTS is not set 888# CONFIG_CRYPTO_XTS is not set
889# CONFIG_CRYPTO_CTR is not set
890# CONFIG_CRYPTO_GCM is not set
891# CONFIG_CRYPTO_CCM is not set
864# CONFIG_CRYPTO_CRYPTD is not set 892# CONFIG_CRYPTO_CRYPTD is not set
865CONFIG_CRYPTO_DES=y 893CONFIG_CRYPTO_DES=y
866# CONFIG_CRYPTO_FCRYPT is not set 894# CONFIG_CRYPTO_FCRYPT is not set
@@ -875,11 +903,14 @@ CONFIG_CRYPTO_DES=y
875# CONFIG_CRYPTO_KHAZAD is not set 903# CONFIG_CRYPTO_KHAZAD is not set
876# CONFIG_CRYPTO_ANUBIS is not set 904# CONFIG_CRYPTO_ANUBIS is not set
877# CONFIG_CRYPTO_SEED is not set 905# CONFIG_CRYPTO_SEED is not set
906# CONFIG_CRYPTO_SALSA20 is not set
878# CONFIG_CRYPTO_DEFLATE is not set 907# CONFIG_CRYPTO_DEFLATE is not set
879# CONFIG_CRYPTO_MICHAEL_MIC is not set 908# CONFIG_CRYPTO_MICHAEL_MIC is not set
880# CONFIG_CRYPTO_CRC32C is not set 909# CONFIG_CRYPTO_CRC32C is not set
881# CONFIG_CRYPTO_CAMELLIA is not set 910# CONFIG_CRYPTO_CAMELLIA is not set
882# CONFIG_CRYPTO_TEST is not set 911# CONFIG_CRYPTO_TEST is not set
883# CONFIG_CRYPTO_AUTHENC is not set 912# CONFIG_CRYPTO_AUTHENC is not set
913# CONFIG_CRYPTO_LZO is not set
884CONFIG_CRYPTO_HW=y 914CONFIG_CRYPTO_HW=y
915# CONFIG_CRYPTO_DEV_HIFN_795X is not set
885# CONFIG_PPC_CLOCK is not set 916# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/taishan_defconfig b/arch/powerpc/configs/taishan_defconfig
index ade84b92877e..087aedce1338 100644
--- a/arch/powerpc/configs/taishan_defconfig
+++ b/arch/powerpc/configs/taishan_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Mon Dec 24 11:23:39 2007 4# Fri Feb 15 21:40:44 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -29,6 +29,7 @@ CONFIG_GENERIC_TIME=y
29CONFIG_GENERIC_TIME_VSYSCALL=y 29CONFIG_GENERIC_TIME_VSYSCALL=y
30CONFIG_GENERIC_CLOCKEVENTS=y 30CONFIG_GENERIC_CLOCKEVENTS=y
31CONFIG_GENERIC_HARDIRQS=y 31CONFIG_GENERIC_HARDIRQS=y
32# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
32CONFIG_IRQ_PER_CPU=y 33CONFIG_IRQ_PER_CPU=y
33CONFIG_RWSEM_XCHGADD_ALGORITHM=y 34CONFIG_RWSEM_XCHGADD_ALGORITHM=y
34CONFIG_ARCH_HAS_ILOG2_U32=y 35CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -67,17 +68,18 @@ CONFIG_SYSVIPC_SYSCTL=y
67CONFIG_POSIX_MQUEUE=y 68CONFIG_POSIX_MQUEUE=y
68# CONFIG_BSD_PROCESS_ACCT is not set 69# CONFIG_BSD_PROCESS_ACCT is not set
69# CONFIG_TASKSTATS is not set 70# CONFIG_TASKSTATS is not set
70# CONFIG_USER_NS is not set
71# CONFIG_PID_NS is not set
72# CONFIG_AUDIT is not set 71# CONFIG_AUDIT is not set
73# CONFIG_IKCONFIG is not set 72# CONFIG_IKCONFIG is not set
74CONFIG_LOG_BUF_SHIFT=14 73CONFIG_LOG_BUF_SHIFT=14
75# CONFIG_CGROUPS is not set 74# CONFIG_CGROUPS is not set
75CONFIG_GROUP_SCHED=y
76CONFIG_FAIR_GROUP_SCHED=y 76CONFIG_FAIR_GROUP_SCHED=y
77CONFIG_FAIR_USER_SCHED=y 77# CONFIG_RT_GROUP_SCHED is not set
78# CONFIG_FAIR_CGROUP_SCHED is not set 78CONFIG_USER_SCHED=y
79# CONFIG_CGROUP_SCHED is not set
79CONFIG_SYSFS_DEPRECATED=y 80CONFIG_SYSFS_DEPRECATED=y
80# CONFIG_RELAY is not set 81# CONFIG_RELAY is not set
82# CONFIG_NAMESPACES is not set
81CONFIG_BLK_DEV_INITRD=y 83CONFIG_BLK_DEV_INITRD=y
82CONFIG_INITRAMFS_SOURCE="" 84CONFIG_INITRAMFS_SOURCE=""
83# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 85# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -91,11 +93,13 @@ CONFIG_HOTPLUG=y
91CONFIG_PRINTK=y 93CONFIG_PRINTK=y
92CONFIG_BUG=y 94CONFIG_BUG=y
93CONFIG_ELF_CORE=y 95CONFIG_ELF_CORE=y
96CONFIG_COMPAT_BRK=y
94CONFIG_BASE_FULL=y 97CONFIG_BASE_FULL=y
95CONFIG_FUTEX=y 98CONFIG_FUTEX=y
96CONFIG_ANON_INODES=y 99CONFIG_ANON_INODES=y
97CONFIG_EPOLL=y 100CONFIG_EPOLL=y
98CONFIG_SIGNALFD=y 101CONFIG_SIGNALFD=y
102CONFIG_TIMERFD=y
99CONFIG_EVENTFD=y 103CONFIG_EVENTFD=y
100CONFIG_SHMEM=y 104CONFIG_SHMEM=y
101CONFIG_VM_EVENT_COUNTERS=y 105CONFIG_VM_EVENT_COUNTERS=y
@@ -103,6 +107,13 @@ CONFIG_SLUB_DEBUG=y
103# CONFIG_SLAB is not set 107# CONFIG_SLAB is not set
104CONFIG_SLUB=y 108CONFIG_SLUB=y
105# CONFIG_SLOB is not set 109# CONFIG_SLOB is not set
110# CONFIG_PROFILING is not set
111# CONFIG_MARKERS is not set
112CONFIG_HAVE_OPROFILE=y
113# CONFIG_KPROBES is not set
114CONFIG_HAVE_KPROBES=y
115CONFIG_PROC_PAGE_MONITOR=y
116CONFIG_SLABINFO=y
106CONFIG_RT_MUTEXES=y 117CONFIG_RT_MUTEXES=y
107# CONFIG_TINY_SHMEM is not set 118# CONFIG_TINY_SHMEM is not set
108CONFIG_BASE_SMALL=0 119CONFIG_BASE_SMALL=0
@@ -130,13 +141,15 @@ CONFIG_DEFAULT_AS=y
130# CONFIG_DEFAULT_CFQ is not set 141# CONFIG_DEFAULT_CFQ is not set
131# CONFIG_DEFAULT_NOOP is not set 142# CONFIG_DEFAULT_NOOP is not set
132CONFIG_DEFAULT_IOSCHED="anticipatory" 143CONFIG_DEFAULT_IOSCHED="anticipatory"
144CONFIG_CLASSIC_RCU=y
145# CONFIG_PREEMPT_RCU is not set
133# CONFIG_PPC4xx_PCI_EXPRESS is not set 146# CONFIG_PPC4xx_PCI_EXPRESS is not set
134 147
135# 148#
136# Platform support 149# Platform support
137# 150#
138# CONFIG_PPC_MPC52xx is not set 151# CONFIG_PPC_MPC512x is not set
139# CONFIG_PPC_MPC5200 is not set 152# CONFIG_PPC_MPC5121 is not set
140# CONFIG_PPC_CELL is not set 153# CONFIG_PPC_CELL is not set
141# CONFIG_PPC_CELL_NATIVE is not set 154# CONFIG_PPC_CELL_NATIVE is not set
142# CONFIG_PQ2ADS is not set 155# CONFIG_PQ2ADS is not set
@@ -146,7 +159,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
146CONFIG_TAISHAN=y 159CONFIG_TAISHAN=y
147# CONFIG_KATMAI is not set 160# CONFIG_KATMAI is not set
148# CONFIG_RAINIER is not set 161# CONFIG_RAINIER is not set
162# CONFIG_WARP is not set
149CONFIG_440GX=y 163CONFIG_440GX=y
164# CONFIG_IPIC is not set
150# CONFIG_MPIC is not set 165# CONFIG_MPIC is not set
151# CONFIG_MPIC_WEIRD is not set 166# CONFIG_MPIC_WEIRD is not set
152# CONFIG_PPC_I8259 is not set 167# CONFIG_PPC_I8259 is not set
@@ -157,7 +172,6 @@ CONFIG_440GX=y
157# CONFIG_PPC_INDIRECT_IO is not set 172# CONFIG_PPC_INDIRECT_IO is not set
158# CONFIG_GENERIC_IOMAP is not set 173# CONFIG_GENERIC_IOMAP is not set
159# CONFIG_CPU_FREQ is not set 174# CONFIG_CPU_FREQ is not set
160# CONFIG_CPM2 is not set
161# CONFIG_FSL_ULI1575 is not set 175# CONFIG_FSL_ULI1575 is not set
162 176
163# 177#
@@ -173,13 +187,18 @@ CONFIG_HZ_250=y
173# CONFIG_HZ_300 is not set 187# CONFIG_HZ_300 is not set
174# CONFIG_HZ_1000 is not set 188# CONFIG_HZ_1000 is not set
175CONFIG_HZ=250 189CONFIG_HZ=250
190# CONFIG_SCHED_HRTICK is not set
176CONFIG_PREEMPT_NONE=y 191CONFIG_PREEMPT_NONE=y
177# CONFIG_PREEMPT_VOLUNTARY is not set 192# CONFIG_PREEMPT_VOLUNTARY is not set
178# CONFIG_PREEMPT is not set 193# CONFIG_PREEMPT is not set
194CONFIG_RCU_TRACE=y
179CONFIG_BINFMT_ELF=y 195CONFIG_BINFMT_ELF=y
180# CONFIG_BINFMT_MISC is not set 196# CONFIG_BINFMT_MISC is not set
181# CONFIG_MATH_EMULATION is not set 197# CONFIG_MATH_EMULATION is not set
198# CONFIG_IOMMU_HELPER is not set
182CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 199CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
200CONFIG_ARCH_HAS_WALK_MEMORY=y
201CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
183CONFIG_ARCH_FLATMEM_ENABLE=y 202CONFIG_ARCH_FLATMEM_ENABLE=y
184CONFIG_ARCH_POPULATES_NODE_MAP=y 203CONFIG_ARCH_POPULATES_NODE_MAP=y
185CONFIG_SELECT_MEMORY_MODEL=y 204CONFIG_SELECT_MEMORY_MODEL=y
@@ -199,8 +218,6 @@ CONFIG_PROC_DEVICETREE=y
199CONFIG_CMDLINE_BOOL=y 218CONFIG_CMDLINE_BOOL=y
200CONFIG_CMDLINE="" 219CONFIG_CMDLINE=""
201CONFIG_SECCOMP=y 220CONFIG_SECCOMP=y
202CONFIG_WANT_DEVICE_TREE=y
203CONFIG_DEVICE_TREE="taishan.dts"
204CONFIG_ISA_DMA_API=y 221CONFIG_ISA_DMA_API=y
205 222
206# 223#
@@ -300,6 +317,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
300# 317#
301# CONFIG_NET_PKTGEN is not set 318# CONFIG_NET_PKTGEN is not set
302# CONFIG_HAMRADIO is not set 319# CONFIG_HAMRADIO is not set
320# CONFIG_CAN is not set
303# CONFIG_IRDA is not set 321# CONFIG_IRDA is not set
304# CONFIG_BT is not set 322# CONFIG_BT is not set
305# CONFIG_AF_RXRPC is not set 323# CONFIG_AF_RXRPC is not set
@@ -346,7 +364,7 @@ CONFIG_BLK_DEV=y
346CONFIG_BLK_DEV_RAM=y 364CONFIG_BLK_DEV_RAM=y
347CONFIG_BLK_DEV_RAM_COUNT=16 365CONFIG_BLK_DEV_RAM_COUNT=16
348CONFIG_BLK_DEV_RAM_SIZE=35000 366CONFIG_BLK_DEV_RAM_SIZE=35000
349CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 367# CONFIG_BLK_DEV_XIP is not set
350# CONFIG_CDROM_PKTCDVD is not set 368# CONFIG_CDROM_PKTCDVD is not set
351# CONFIG_ATA_OVER_ETH is not set 369# CONFIG_ATA_OVER_ETH is not set
352# CONFIG_XILINX_SYSACE is not set 370# CONFIG_XILINX_SYSACE is not set
@@ -355,6 +373,8 @@ CONFIG_MISC_DEVICES=y
355# CONFIG_EEPROM_93CX6 is not set 373# CONFIG_EEPROM_93CX6 is not set
356# CONFIG_SGI_IOC4 is not set 374# CONFIG_SGI_IOC4 is not set
357# CONFIG_TIFM_CORE is not set 375# CONFIG_TIFM_CORE is not set
376# CONFIG_ENCLOSURE_SERVICES is not set
377CONFIG_HAVE_IDE=y
358# CONFIG_IDE is not set 378# CONFIG_IDE is not set
359 379
360# 380#
@@ -385,7 +405,6 @@ CONFIG_NETDEVICES=y
385# CONFIG_EQUALIZER is not set 405# CONFIG_EQUALIZER is not set
386# CONFIG_TUN is not set 406# CONFIG_TUN is not set
387# CONFIG_VETH is not set 407# CONFIG_VETH is not set
388# CONFIG_IP1000 is not set
389# CONFIG_ARCNET is not set 408# CONFIG_ARCNET is not set
390# CONFIG_PHYLIB is not set 409# CONFIG_PHYLIB is not set
391CONFIG_NET_ETHERNET=y 410CONFIG_NET_ETHERNET=y
@@ -414,6 +433,9 @@ CONFIG_NETDEV_1000=y
414# CONFIG_DL2K is not set 433# CONFIG_DL2K is not set
415# CONFIG_E1000 is not set 434# CONFIG_E1000 is not set
416# CONFIG_E1000E is not set 435# CONFIG_E1000E is not set
436# CONFIG_E1000E_ENABLED is not set
437# CONFIG_IP1000 is not set
438# CONFIG_IGB is not set
417# CONFIG_NS83820 is not set 439# CONFIG_NS83820 is not set
418# CONFIG_HAMACHI is not set 440# CONFIG_HAMACHI is not set
419# CONFIG_YELLOWFIN is not set 441# CONFIG_YELLOWFIN is not set
@@ -438,6 +460,7 @@ CONFIG_NETDEV_10000=y
438# CONFIG_NIU is not set 460# CONFIG_NIU is not set
439# CONFIG_MLX4_CORE is not set 461# CONFIG_MLX4_CORE is not set
440# CONFIG_TEHUTI is not set 462# CONFIG_TEHUTI is not set
463# CONFIG_BNX2X is not set
441# CONFIG_TR is not set 464# CONFIG_TR is not set
442 465
443# 466#
@@ -450,7 +473,6 @@ CONFIG_NETDEV_10000=y
450# CONFIG_HIPPI is not set 473# CONFIG_HIPPI is not set
451# CONFIG_PPP is not set 474# CONFIG_PPP is not set
452# CONFIG_SLIP is not set 475# CONFIG_SLIP is not set
453# CONFIG_SHAPER is not set
454# CONFIG_NETCONSOLE is not set 476# CONFIG_NETCONSOLE is not set
455# CONFIG_NETPOLL is not set 477# CONFIG_NETPOLL is not set
456# CONFIG_NET_POLL_CONTROLLER is not set 478# CONFIG_NET_POLL_CONTROLLER is not set
@@ -473,6 +495,7 @@ CONFIG_NETDEV_10000=y
473# 495#
474# CONFIG_VT is not set 496# CONFIG_VT is not set
475# CONFIG_SERIAL_NONSTANDARD is not set 497# CONFIG_SERIAL_NONSTANDARD is not set
498# CONFIG_NOZOMI is not set
476 499
477# 500#
478# Serial drivers 501# Serial drivers
@@ -518,6 +541,7 @@ CONFIG_DEVPORT=y
518# CONFIG_W1 is not set 541# CONFIG_W1 is not set
519# CONFIG_POWER_SUPPLY is not set 542# CONFIG_POWER_SUPPLY is not set
520# CONFIG_HWMON is not set 543# CONFIG_HWMON is not set
544CONFIG_THERMAL=y
521# CONFIG_WATCHDOG is not set 545# CONFIG_WATCHDOG is not set
522 546
523# 547#
@@ -566,12 +590,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
566# 590#
567# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 591# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
568# 592#
569
570#
571# USB Gadget Support
572#
573# CONFIG_USB_GADGET is not set 593# CONFIG_USB_GADGET is not set
574# CONFIG_MMC is not set 594# CONFIG_MMC is not set
595# CONFIG_MEMSTICK is not set
575# CONFIG_NEW_LEDS is not set 596# CONFIG_NEW_LEDS is not set
576# CONFIG_INFINIBAND is not set 597# CONFIG_INFINIBAND is not set
577# CONFIG_EDAC is not set 598# CONFIG_EDAC is not set
@@ -596,12 +617,10 @@ CONFIG_EXT2_FS=y
596# CONFIG_XFS_FS is not set 617# CONFIG_XFS_FS is not set
597# CONFIG_GFS2_FS is not set 618# CONFIG_GFS2_FS is not set
598# CONFIG_OCFS2_FS is not set 619# CONFIG_OCFS2_FS is not set
599# CONFIG_MINIX_FS is not set 620CONFIG_DNOTIFY=y
600# CONFIG_ROMFS_FS is not set
601CONFIG_INOTIFY=y 621CONFIG_INOTIFY=y
602CONFIG_INOTIFY_USER=y 622CONFIG_INOTIFY_USER=y
603# CONFIG_QUOTA is not set 623# CONFIG_QUOTA is not set
604CONFIG_DNOTIFY=y
605# CONFIG_AUTOFS_FS is not set 624# CONFIG_AUTOFS_FS is not set
606# CONFIG_AUTOFS4_FS is not set 625# CONFIG_AUTOFS4_FS is not set
607# CONFIG_FUSE_FS is not set 626# CONFIG_FUSE_FS is not set
@@ -643,8 +662,10 @@ CONFIG_TMPFS=y
643# CONFIG_EFS_FS is not set 662# CONFIG_EFS_FS is not set
644CONFIG_CRAMFS=y 663CONFIG_CRAMFS=y
645# CONFIG_VXFS_FS is not set 664# CONFIG_VXFS_FS is not set
665# CONFIG_MINIX_FS is not set
646# CONFIG_HPFS_FS is not set 666# CONFIG_HPFS_FS is not set
647# CONFIG_QNX4FS_FS is not set 667# CONFIG_QNX4FS_FS is not set
668# CONFIG_ROMFS_FS is not set
648# CONFIG_SYSV_FS is not set 669# CONFIG_SYSV_FS is not set
649# CONFIG_UFS_FS is not set 670# CONFIG_UFS_FS is not set
650CONFIG_NETWORK_FILESYSTEMS=y 671CONFIG_NETWORK_FILESYSTEMS=y
@@ -675,7 +696,6 @@ CONFIG_SUNRPC=y
675CONFIG_MSDOS_PARTITION=y 696CONFIG_MSDOS_PARTITION=y
676# CONFIG_NLS is not set 697# CONFIG_NLS is not set
677# CONFIG_DLM is not set 698# CONFIG_DLM is not set
678# CONFIG_UCC_SLOW is not set
679 699
680# 700#
681# Library routines 701# Library routines
@@ -692,10 +712,6 @@ CONFIG_PLIST=y
692CONFIG_HAS_IOMEM=y 712CONFIG_HAS_IOMEM=y
693CONFIG_HAS_IOPORT=y 713CONFIG_HAS_IOPORT=y
694CONFIG_HAS_DMA=y 714CONFIG_HAS_DMA=y
695CONFIG_INSTRUMENTATION=y
696# CONFIG_PROFILING is not set
697# CONFIG_KPROBES is not set
698# CONFIG_MARKERS is not set
699 715
700# 716#
701# Kernel hacking 717# Kernel hacking
@@ -705,7 +721,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
705CONFIG_ENABLE_MUST_CHECK=y 721CONFIG_ENABLE_MUST_CHECK=y
706CONFIG_MAGIC_SYSRQ=y 722CONFIG_MAGIC_SYSRQ=y
707# CONFIG_UNUSED_SYMBOLS is not set 723# CONFIG_UNUSED_SYMBOLS is not set
708# CONFIG_DEBUG_FS is not set 724CONFIG_DEBUG_FS=y
709# CONFIG_HEADERS_CHECK is not set 725# CONFIG_HEADERS_CHECK is not set
710CONFIG_DEBUG_KERNEL=y 726CONFIG_DEBUG_KERNEL=y
711# CONFIG_DEBUG_SHIRQ is not set 727# CONFIG_DEBUG_SHIRQ is not set
@@ -714,6 +730,7 @@ CONFIG_SCHED_DEBUG=y
714# CONFIG_SCHEDSTATS is not set 730# CONFIG_SCHEDSTATS is not set
715# CONFIG_TIMER_STATS is not set 731# CONFIG_TIMER_STATS is not set
716# CONFIG_SLUB_DEBUG_ON is not set 732# CONFIG_SLUB_DEBUG_ON is not set
733# CONFIG_SLUB_STATS is not set
717# CONFIG_DEBUG_RT_MUTEXES is not set 734# CONFIG_DEBUG_RT_MUTEXES is not set
718# CONFIG_RT_MUTEX_TESTER is not set 735# CONFIG_RT_MUTEX_TESTER is not set
719# CONFIG_DEBUG_SPINLOCK is not set 736# CONFIG_DEBUG_SPINLOCK is not set
@@ -726,9 +743,9 @@ CONFIG_SCHED_DEBUG=y
726# CONFIG_DEBUG_VM is not set 743# CONFIG_DEBUG_VM is not set
727# CONFIG_DEBUG_LIST is not set 744# CONFIG_DEBUG_LIST is not set
728# CONFIG_DEBUG_SG is not set 745# CONFIG_DEBUG_SG is not set
729CONFIG_FORCED_INLINING=y
730# CONFIG_BOOT_PRINTK_DELAY is not set 746# CONFIG_BOOT_PRINTK_DELAY is not set
731# CONFIG_RCU_TORTURE_TEST is not set 747# CONFIG_RCU_TORTURE_TEST is not set
748# CONFIG_BACKTRACE_SELF_TEST is not set
732# CONFIG_FAULT_INJECTION is not set 749# CONFIG_FAULT_INJECTION is not set
733# CONFIG_SAMPLES is not set 750# CONFIG_SAMPLES is not set
734# CONFIG_DEBUG_STACKOVERFLOW is not set 751# CONFIG_DEBUG_STACKOVERFLOW is not set
@@ -737,6 +754,7 @@ CONFIG_FORCED_INLINING=y
737CONFIG_DEBUGGER=y 754CONFIG_DEBUGGER=y
738# CONFIG_KGDB is not set 755# CONFIG_KGDB is not set
739# CONFIG_XMON is not set 756# CONFIG_XMON is not set
757# CONFIG_VIRQ_DEBUG is not set
740# CONFIG_BDI_SWITCH is not set 758# CONFIG_BDI_SWITCH is not set
741# CONFIG_PPC_EARLY_DEBUG is not set 759# CONFIG_PPC_EARLY_DEBUG is not set
742 760
@@ -749,6 +767,7 @@ CONFIG_DEBUGGER=y
749CONFIG_CRYPTO=y 767CONFIG_CRYPTO=y
750CONFIG_CRYPTO_ALGAPI=y 768CONFIG_CRYPTO_ALGAPI=y
751CONFIG_CRYPTO_BLKCIPHER=y 769CONFIG_CRYPTO_BLKCIPHER=y
770# CONFIG_CRYPTO_SEQIV is not set
752CONFIG_CRYPTO_MANAGER=y 771CONFIG_CRYPTO_MANAGER=y
753# CONFIG_CRYPTO_HMAC is not set 772# CONFIG_CRYPTO_HMAC is not set
754# CONFIG_CRYPTO_XCBC is not set 773# CONFIG_CRYPTO_XCBC is not set
@@ -766,6 +785,9 @@ CONFIG_CRYPTO_CBC=y
766CONFIG_CRYPTO_PCBC=y 785CONFIG_CRYPTO_PCBC=y
767# CONFIG_CRYPTO_LRW is not set 786# CONFIG_CRYPTO_LRW is not set
768# CONFIG_CRYPTO_XTS is not set 787# CONFIG_CRYPTO_XTS is not set
788# CONFIG_CRYPTO_CTR is not set
789# CONFIG_CRYPTO_GCM is not set
790# CONFIG_CRYPTO_CCM is not set
769# CONFIG_CRYPTO_CRYPTD is not set 791# CONFIG_CRYPTO_CRYPTD is not set
770CONFIG_CRYPTO_DES=y 792CONFIG_CRYPTO_DES=y
771# CONFIG_CRYPTO_FCRYPT is not set 793# CONFIG_CRYPTO_FCRYPT is not set
@@ -780,11 +802,14 @@ CONFIG_CRYPTO_DES=y
780# CONFIG_CRYPTO_KHAZAD is not set 802# CONFIG_CRYPTO_KHAZAD is not set
781# CONFIG_CRYPTO_ANUBIS is not set 803# CONFIG_CRYPTO_ANUBIS is not set
782# CONFIG_CRYPTO_SEED is not set 804# CONFIG_CRYPTO_SEED is not set
805# CONFIG_CRYPTO_SALSA20 is not set
783# CONFIG_CRYPTO_DEFLATE is not set 806# CONFIG_CRYPTO_DEFLATE is not set
784# CONFIG_CRYPTO_MICHAEL_MIC is not set 807# CONFIG_CRYPTO_MICHAEL_MIC is not set
785# CONFIG_CRYPTO_CRC32C is not set 808# CONFIG_CRYPTO_CRC32C is not set
786# CONFIG_CRYPTO_CAMELLIA is not set 809# CONFIG_CRYPTO_CAMELLIA is not set
787# CONFIG_CRYPTO_TEST is not set 810# CONFIG_CRYPTO_TEST is not set
788# CONFIG_CRYPTO_AUTHENC is not set 811# CONFIG_CRYPTO_AUTHENC is not set
812# CONFIG_CRYPTO_LZO is not set
789CONFIG_CRYPTO_HW=y 813CONFIG_CRYPTO_HW=y
814# CONFIG_CRYPTO_DEV_HIFN_795X is not set
790# CONFIG_PPC_CLOCK is not set 815# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/walnut_defconfig b/arch/powerpc/configs/walnut_defconfig
index e431128e8e9e..3b2689e5002a 100644
--- a/arch/powerpc/configs/walnut_defconfig
+++ b/arch/powerpc/configs/walnut_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Mon Dec 24 11:23:58 2007 4# Fri Feb 15 21:54:12 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -26,6 +26,7 @@ CONFIG_GENERIC_TIME=y
26CONFIG_GENERIC_TIME_VSYSCALL=y 26CONFIG_GENERIC_TIME_VSYSCALL=y
27CONFIG_GENERIC_CLOCKEVENTS=y 27CONFIG_GENERIC_CLOCKEVENTS=y
28CONFIG_GENERIC_HARDIRQS=y 28CONFIG_GENERIC_HARDIRQS=y
29# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
29CONFIG_IRQ_PER_CPU=y 30CONFIG_IRQ_PER_CPU=y
30CONFIG_RWSEM_XCHGADD_ALGORITHM=y 31CONFIG_RWSEM_XCHGADD_ALGORITHM=y
31CONFIG_ARCH_HAS_ILOG2_U32=y 32CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -64,17 +65,18 @@ CONFIG_SYSVIPC_SYSCTL=y
64CONFIG_POSIX_MQUEUE=y 65CONFIG_POSIX_MQUEUE=y
65# CONFIG_BSD_PROCESS_ACCT is not set 66# CONFIG_BSD_PROCESS_ACCT is not set
66# CONFIG_TASKSTATS is not set 67# CONFIG_TASKSTATS is not set
67# CONFIG_USER_NS is not set
68# CONFIG_PID_NS is not set
69# CONFIG_AUDIT is not set 68# CONFIG_AUDIT is not set
70# CONFIG_IKCONFIG is not set 69# CONFIG_IKCONFIG is not set
71CONFIG_LOG_BUF_SHIFT=14 70CONFIG_LOG_BUF_SHIFT=14
72# CONFIG_CGROUPS is not set 71# CONFIG_CGROUPS is not set
72CONFIG_GROUP_SCHED=y
73CONFIG_FAIR_GROUP_SCHED=y 73CONFIG_FAIR_GROUP_SCHED=y
74CONFIG_FAIR_USER_SCHED=y 74# CONFIG_RT_GROUP_SCHED is not set
75# CONFIG_FAIR_CGROUP_SCHED is not set 75CONFIG_USER_SCHED=y
76# CONFIG_CGROUP_SCHED is not set
76CONFIG_SYSFS_DEPRECATED=y 77CONFIG_SYSFS_DEPRECATED=y
77# CONFIG_RELAY is not set 78# CONFIG_RELAY is not set
79# CONFIG_NAMESPACES is not set
78CONFIG_BLK_DEV_INITRD=y 80CONFIG_BLK_DEV_INITRD=y
79CONFIG_INITRAMFS_SOURCE="" 81CONFIG_INITRAMFS_SOURCE=""
80# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 82# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -88,11 +90,13 @@ CONFIG_HOTPLUG=y
88CONFIG_PRINTK=y 90CONFIG_PRINTK=y
89CONFIG_BUG=y 91CONFIG_BUG=y
90CONFIG_ELF_CORE=y 92CONFIG_ELF_CORE=y
93CONFIG_COMPAT_BRK=y
91CONFIG_BASE_FULL=y 94CONFIG_BASE_FULL=y
92CONFIG_FUTEX=y 95CONFIG_FUTEX=y
93CONFIG_ANON_INODES=y 96CONFIG_ANON_INODES=y
94CONFIG_EPOLL=y 97CONFIG_EPOLL=y
95CONFIG_SIGNALFD=y 98CONFIG_SIGNALFD=y
99CONFIG_TIMERFD=y
96CONFIG_EVENTFD=y 100CONFIG_EVENTFD=y
97CONFIG_SHMEM=y 101CONFIG_SHMEM=y
98CONFIG_VM_EVENT_COUNTERS=y 102CONFIG_VM_EVENT_COUNTERS=y
@@ -100,6 +104,13 @@ CONFIG_SLUB_DEBUG=y
100# CONFIG_SLAB is not set 104# CONFIG_SLAB is not set
101CONFIG_SLUB=y 105CONFIG_SLUB=y
102# CONFIG_SLOB is not set 106# CONFIG_SLOB is not set
107# CONFIG_PROFILING is not set
108# CONFIG_MARKERS is not set
109CONFIG_HAVE_OPROFILE=y
110# CONFIG_KPROBES is not set
111CONFIG_HAVE_KPROBES=y
112CONFIG_PROC_PAGE_MONITOR=y
113CONFIG_SLABINFO=y
103CONFIG_RT_MUTEXES=y 114CONFIG_RT_MUTEXES=y
104# CONFIG_TINY_SHMEM is not set 115# CONFIG_TINY_SHMEM is not set
105CONFIG_BASE_SMALL=0 116CONFIG_BASE_SMALL=0
@@ -127,13 +138,15 @@ CONFIG_DEFAULT_AS=y
127# CONFIG_DEFAULT_CFQ is not set 138# CONFIG_DEFAULT_CFQ is not set
128# CONFIG_DEFAULT_NOOP is not set 139# CONFIG_DEFAULT_NOOP is not set
129CONFIG_DEFAULT_IOSCHED="anticipatory" 140CONFIG_DEFAULT_IOSCHED="anticipatory"
141CONFIG_CLASSIC_RCU=y
142# CONFIG_PREEMPT_RCU is not set
130# CONFIG_PPC4xx_PCI_EXPRESS is not set 143# CONFIG_PPC4xx_PCI_EXPRESS is not set
131 144
132# 145#
133# Platform support 146# Platform support
134# 147#
135# CONFIG_PPC_MPC52xx is not set 148# CONFIG_PPC_MPC512x is not set
136# CONFIG_PPC_MPC5200 is not set 149# CONFIG_PPC_MPC5121 is not set
137# CONFIG_PPC_CELL is not set 150# CONFIG_PPC_CELL is not set
138# CONFIG_PPC_CELL_NATIVE is not set 151# CONFIG_PPC_CELL_NATIVE is not set
139# CONFIG_PQ2ADS is not set 152# CONFIG_PQ2ADS is not set
@@ -145,6 +158,7 @@ CONFIG_WALNUT=y
145CONFIG_405GP=y 158CONFIG_405GP=y
146CONFIG_IBM405_ERR77=y 159CONFIG_IBM405_ERR77=y
147CONFIG_IBM405_ERR51=y 160CONFIG_IBM405_ERR51=y
161# CONFIG_IPIC is not set
148# CONFIG_MPIC is not set 162# CONFIG_MPIC is not set
149# CONFIG_MPIC_WEIRD is not set 163# CONFIG_MPIC_WEIRD is not set
150# CONFIG_PPC_I8259 is not set 164# CONFIG_PPC_I8259 is not set
@@ -155,8 +169,8 @@ CONFIG_IBM405_ERR51=y
155# CONFIG_PPC_INDIRECT_IO is not set 169# CONFIG_PPC_INDIRECT_IO is not set
156# CONFIG_GENERIC_IOMAP is not set 170# CONFIG_GENERIC_IOMAP is not set
157# CONFIG_CPU_FREQ is not set 171# CONFIG_CPU_FREQ is not set
158# CONFIG_CPM2 is not set
159# CONFIG_FSL_ULI1575 is not set 172# CONFIG_FSL_ULI1575 is not set
173CONFIG_OF_RTC=y
160 174
161# 175#
162# Kernel options 176# Kernel options
@@ -171,13 +185,18 @@ CONFIG_HZ_250=y
171# CONFIG_HZ_300 is not set 185# CONFIG_HZ_300 is not set
172# CONFIG_HZ_1000 is not set 186# CONFIG_HZ_1000 is not set
173CONFIG_HZ=250 187CONFIG_HZ=250
188# CONFIG_SCHED_HRTICK is not set
174CONFIG_PREEMPT_NONE=y 189CONFIG_PREEMPT_NONE=y
175# CONFIG_PREEMPT_VOLUNTARY is not set 190# CONFIG_PREEMPT_VOLUNTARY is not set
176# CONFIG_PREEMPT is not set 191# CONFIG_PREEMPT is not set
192CONFIG_RCU_TRACE=y
177CONFIG_BINFMT_ELF=y 193CONFIG_BINFMT_ELF=y
178# CONFIG_BINFMT_MISC is not set 194# CONFIG_BINFMT_MISC is not set
179# CONFIG_MATH_EMULATION is not set 195# CONFIG_MATH_EMULATION is not set
196# CONFIG_IOMMU_HELPER is not set
180CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 197CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
198CONFIG_ARCH_HAS_WALK_MEMORY=y
199CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
181CONFIG_ARCH_FLATMEM_ENABLE=y 200CONFIG_ARCH_FLATMEM_ENABLE=y
182CONFIG_ARCH_POPULATES_NODE_MAP=y 201CONFIG_ARCH_POPULATES_NODE_MAP=y
183CONFIG_SELECT_MEMORY_MODEL=y 202CONFIG_SELECT_MEMORY_MODEL=y
@@ -196,11 +215,7 @@ CONFIG_VIRT_TO_BUS=y
196CONFIG_PROC_DEVICETREE=y 215CONFIG_PROC_DEVICETREE=y
197# CONFIG_CMDLINE_BOOL is not set 216# CONFIG_CMDLINE_BOOL is not set
198# CONFIG_PM is not set 217# CONFIG_PM is not set
199CONFIG_SUSPEND_UP_POSSIBLE=y
200CONFIG_HIBERNATION_UP_POSSIBLE=y
201CONFIG_SECCOMP=y 218CONFIG_SECCOMP=y
202CONFIG_WANT_DEVICE_TREE=y
203CONFIG_DEVICE_TREE="walnut.dts"
204CONFIG_ISA_DMA_API=y 219CONFIG_ISA_DMA_API=y
205 220
206# 221#
@@ -300,6 +315,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
300# 315#
301# CONFIG_NET_PKTGEN is not set 316# CONFIG_NET_PKTGEN is not set
302# CONFIG_HAMRADIO is not set 317# CONFIG_HAMRADIO is not set
318# CONFIG_CAN is not set
303# CONFIG_IRDA is not set 319# CONFIG_IRDA is not set
304# CONFIG_BT is not set 320# CONFIG_BT is not set
305# CONFIG_AF_RXRPC is not set 321# CONFIG_AF_RXRPC is not set
@@ -336,6 +352,7 @@ CONFIG_MTD=y
336CONFIG_MTD_PARTITIONS=y 352CONFIG_MTD_PARTITIONS=y
337# CONFIG_MTD_REDBOOT_PARTS is not set 353# CONFIG_MTD_REDBOOT_PARTS is not set
338CONFIG_MTD_CMDLINE_PARTS=y 354CONFIG_MTD_CMDLINE_PARTS=y
355CONFIG_MTD_OF_PARTS=y
339 356
340# 357#
341# User Modules And Translation Layers 358# User Modules And Translation Layers
@@ -422,7 +439,7 @@ CONFIG_BLK_DEV=y
422CONFIG_BLK_DEV_RAM=y 439CONFIG_BLK_DEV_RAM=y
423CONFIG_BLK_DEV_RAM_COUNT=16 440CONFIG_BLK_DEV_RAM_COUNT=16
424CONFIG_BLK_DEV_RAM_SIZE=35000 441CONFIG_BLK_DEV_RAM_SIZE=35000
425CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 442# CONFIG_BLK_DEV_XIP is not set
426# CONFIG_CDROM_PKTCDVD is not set 443# CONFIG_CDROM_PKTCDVD is not set
427# CONFIG_ATA_OVER_ETH is not set 444# CONFIG_ATA_OVER_ETH is not set
428# CONFIG_XILINX_SYSACE is not set 445# CONFIG_XILINX_SYSACE is not set
@@ -431,6 +448,8 @@ CONFIG_MISC_DEVICES=y
431# CONFIG_EEPROM_93CX6 is not set 448# CONFIG_EEPROM_93CX6 is not set
432# CONFIG_SGI_IOC4 is not set 449# CONFIG_SGI_IOC4 is not set
433# CONFIG_TIFM_CORE is not set 450# CONFIG_TIFM_CORE is not set
451# CONFIG_ENCLOSURE_SERVICES is not set
452CONFIG_HAVE_IDE=y
434# CONFIG_IDE is not set 453# CONFIG_IDE is not set
435 454
436# 455#
@@ -459,7 +478,6 @@ CONFIG_NETDEVICES=y
459# CONFIG_EQUALIZER is not set 478# CONFIG_EQUALIZER is not set
460# CONFIG_TUN is not set 479# CONFIG_TUN is not set
461# CONFIG_VETH is not set 480# CONFIG_VETH is not set
462# CONFIG_IP1000 is not set
463# CONFIG_ARCNET is not set 481# CONFIG_ARCNET is not set
464# CONFIG_PHYLIB is not set 482# CONFIG_PHYLIB is not set
465CONFIG_NET_ETHERNET=y 483CONFIG_NET_ETHERNET=y
@@ -488,6 +506,9 @@ CONFIG_NETDEV_1000=y
488# CONFIG_DL2K is not set 506# CONFIG_DL2K is not set
489# CONFIG_E1000 is not set 507# CONFIG_E1000 is not set
490# CONFIG_E1000E is not set 508# CONFIG_E1000E is not set
509# CONFIG_E1000E_ENABLED is not set
510# CONFIG_IP1000 is not set
511# CONFIG_IGB is not set
491# CONFIG_NS83820 is not set 512# CONFIG_NS83820 is not set
492# CONFIG_HAMACHI is not set 513# CONFIG_HAMACHI is not set
493# CONFIG_YELLOWFIN is not set 514# CONFIG_YELLOWFIN is not set
@@ -512,6 +533,7 @@ CONFIG_NETDEV_10000=y
512# CONFIG_NIU is not set 533# CONFIG_NIU is not set
513# CONFIG_MLX4_CORE is not set 534# CONFIG_MLX4_CORE is not set
514# CONFIG_TEHUTI is not set 535# CONFIG_TEHUTI is not set
536# CONFIG_BNX2X is not set
515# CONFIG_TR is not set 537# CONFIG_TR is not set
516 538
517# 539#
@@ -524,7 +546,6 @@ CONFIG_NETDEV_10000=y
524# CONFIG_HIPPI is not set 546# CONFIG_HIPPI is not set
525# CONFIG_PPP is not set 547# CONFIG_PPP is not set
526# CONFIG_SLIP is not set 548# CONFIG_SLIP is not set
527# CONFIG_SHAPER is not set
528# CONFIG_NETCONSOLE is not set 549# CONFIG_NETCONSOLE is not set
529# CONFIG_NETPOLL is not set 550# CONFIG_NETPOLL is not set
530# CONFIG_NET_POLL_CONTROLLER is not set 551# CONFIG_NET_POLL_CONTROLLER is not set
@@ -547,6 +568,7 @@ CONFIG_NETDEV_10000=y
547# 568#
548# CONFIG_VT is not set 569# CONFIG_VT is not set
549# CONFIG_SERIAL_NONSTANDARD is not set 570# CONFIG_SERIAL_NONSTANDARD is not set
571# CONFIG_NOZOMI is not set
550 572
551# 573#
552# Serial drivers 574# Serial drivers
@@ -592,6 +614,7 @@ CONFIG_DEVPORT=y
592# CONFIG_W1 is not set 614# CONFIG_W1 is not set
593# CONFIG_POWER_SUPPLY is not set 615# CONFIG_POWER_SUPPLY is not set
594# CONFIG_HWMON is not set 616# CONFIG_HWMON is not set
617CONFIG_THERMAL=y
595# CONFIG_WATCHDOG is not set 618# CONFIG_WATCHDOG is not set
596 619
597# 620#
@@ -640,12 +663,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
640# 663#
641# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 664# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
642# 665#
643
644#
645# USB Gadget Support
646#
647# CONFIG_USB_GADGET is not set 666# CONFIG_USB_GADGET is not set
648# CONFIG_MMC is not set 667# CONFIG_MMC is not set
668# CONFIG_MEMSTICK is not set
649# CONFIG_NEW_LEDS is not set 669# CONFIG_NEW_LEDS is not set
650# CONFIG_INFINIBAND is not set 670# CONFIG_INFINIBAND is not set
651# CONFIG_EDAC is not set 671# CONFIG_EDAC is not set
@@ -670,12 +690,10 @@ CONFIG_EXT2_FS=y
670# CONFIG_XFS_FS is not set 690# CONFIG_XFS_FS is not set
671# CONFIG_GFS2_FS is not set 691# CONFIG_GFS2_FS is not set
672# CONFIG_OCFS2_FS is not set 692# CONFIG_OCFS2_FS is not set
673# CONFIG_MINIX_FS is not set 693CONFIG_DNOTIFY=y
674# CONFIG_ROMFS_FS is not set
675CONFIG_INOTIFY=y 694CONFIG_INOTIFY=y
676CONFIG_INOTIFY_USER=y 695CONFIG_INOTIFY_USER=y
677# CONFIG_QUOTA is not set 696# CONFIG_QUOTA is not set
678CONFIG_DNOTIFY=y
679# CONFIG_AUTOFS_FS is not set 697# CONFIG_AUTOFS_FS is not set
680# CONFIG_AUTOFS4_FS is not set 698# CONFIG_AUTOFS4_FS is not set
681# CONFIG_FUSE_FS is not set 699# CONFIG_FUSE_FS is not set
@@ -718,8 +736,10 @@ CONFIG_TMPFS=y
718# CONFIG_JFFS2_FS is not set 736# CONFIG_JFFS2_FS is not set
719CONFIG_CRAMFS=y 737CONFIG_CRAMFS=y
720# CONFIG_VXFS_FS is not set 738# CONFIG_VXFS_FS is not set
739# CONFIG_MINIX_FS is not set
721# CONFIG_HPFS_FS is not set 740# CONFIG_HPFS_FS is not set
722# CONFIG_QNX4FS_FS is not set 741# CONFIG_QNX4FS_FS is not set
742# CONFIG_ROMFS_FS is not set
723# CONFIG_SYSV_FS is not set 743# CONFIG_SYSV_FS is not set
724# CONFIG_UFS_FS is not set 744# CONFIG_UFS_FS is not set
725CONFIG_NETWORK_FILESYSTEMS=y 745CONFIG_NETWORK_FILESYSTEMS=y
@@ -750,7 +770,6 @@ CONFIG_SUNRPC=y
750CONFIG_MSDOS_PARTITION=y 770CONFIG_MSDOS_PARTITION=y
751# CONFIG_NLS is not set 771# CONFIG_NLS is not set
752# CONFIG_DLM is not set 772# CONFIG_DLM is not set
753# CONFIG_UCC_SLOW is not set
754 773
755# 774#
756# Library routines 775# Library routines
@@ -767,7 +786,6 @@ CONFIG_PLIST=y
767CONFIG_HAS_IOMEM=y 786CONFIG_HAS_IOMEM=y
768CONFIG_HAS_IOPORT=y 787CONFIG_HAS_IOPORT=y
769CONFIG_HAS_DMA=y 788CONFIG_HAS_DMA=y
770# CONFIG_INSTRUMENTATION is not set
771 789
772# 790#
773# Kernel hacking 791# Kernel hacking
@@ -777,7 +795,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
777CONFIG_ENABLE_MUST_CHECK=y 795CONFIG_ENABLE_MUST_CHECK=y
778CONFIG_MAGIC_SYSRQ=y 796CONFIG_MAGIC_SYSRQ=y
779# CONFIG_UNUSED_SYMBOLS is not set 797# CONFIG_UNUSED_SYMBOLS is not set
780# CONFIG_DEBUG_FS is not set 798CONFIG_DEBUG_FS=y
781# CONFIG_HEADERS_CHECK is not set 799# CONFIG_HEADERS_CHECK is not set
782CONFIG_DEBUG_KERNEL=y 800CONFIG_DEBUG_KERNEL=y
783# CONFIG_DEBUG_SHIRQ is not set 801# CONFIG_DEBUG_SHIRQ is not set
@@ -786,6 +804,7 @@ CONFIG_SCHED_DEBUG=y
786# CONFIG_SCHEDSTATS is not set 804# CONFIG_SCHEDSTATS is not set
787# CONFIG_TIMER_STATS is not set 805# CONFIG_TIMER_STATS is not set
788# CONFIG_SLUB_DEBUG_ON is not set 806# CONFIG_SLUB_DEBUG_ON is not set
807# CONFIG_SLUB_STATS is not set
789# CONFIG_DEBUG_RT_MUTEXES is not set 808# CONFIG_DEBUG_RT_MUTEXES is not set
790# CONFIG_RT_MUTEX_TESTER is not set 809# CONFIG_RT_MUTEX_TESTER is not set
791# CONFIG_DEBUG_SPINLOCK is not set 810# CONFIG_DEBUG_SPINLOCK is not set
@@ -798,15 +817,16 @@ CONFIG_DEBUG_BUGVERBOSE=y
798# CONFIG_DEBUG_VM is not set 817# CONFIG_DEBUG_VM is not set
799# CONFIG_DEBUG_LIST is not set 818# CONFIG_DEBUG_LIST is not set
800# CONFIG_DEBUG_SG is not set 819# CONFIG_DEBUG_SG is not set
801CONFIG_FORCED_INLINING=y
802# CONFIG_BOOT_PRINTK_DELAY is not set 820# CONFIG_BOOT_PRINTK_DELAY is not set
803# CONFIG_RCU_TORTURE_TEST is not set 821# CONFIG_RCU_TORTURE_TEST is not set
822# CONFIG_BACKTRACE_SELF_TEST is not set
804# CONFIG_FAULT_INJECTION is not set 823# CONFIG_FAULT_INJECTION is not set
805# CONFIG_SAMPLES is not set 824# CONFIG_SAMPLES is not set
806# CONFIG_DEBUG_STACKOVERFLOW is not set 825# CONFIG_DEBUG_STACKOVERFLOW is not set
807# CONFIG_DEBUG_STACK_USAGE is not set 826# CONFIG_DEBUG_STACK_USAGE is not set
808# CONFIG_DEBUG_PAGEALLOC is not set 827# CONFIG_DEBUG_PAGEALLOC is not set
809# CONFIG_DEBUGGER is not set 828# CONFIG_DEBUGGER is not set
829# CONFIG_VIRQ_DEBUG is not set
810# CONFIG_BDI_SWITCH is not set 830# CONFIG_BDI_SWITCH is not set
811# CONFIG_PPC_EARLY_DEBUG is not set 831# CONFIG_PPC_EARLY_DEBUG is not set
812 832
@@ -819,6 +839,7 @@ CONFIG_FORCED_INLINING=y
819CONFIG_CRYPTO=y 839CONFIG_CRYPTO=y
820CONFIG_CRYPTO_ALGAPI=y 840CONFIG_CRYPTO_ALGAPI=y
821CONFIG_CRYPTO_BLKCIPHER=y 841CONFIG_CRYPTO_BLKCIPHER=y
842# CONFIG_CRYPTO_SEQIV is not set
822CONFIG_CRYPTO_MANAGER=y 843CONFIG_CRYPTO_MANAGER=y
823# CONFIG_CRYPTO_HMAC is not set 844# CONFIG_CRYPTO_HMAC is not set
824# CONFIG_CRYPTO_XCBC is not set 845# CONFIG_CRYPTO_XCBC is not set
@@ -836,6 +857,9 @@ CONFIG_CRYPTO_CBC=y
836CONFIG_CRYPTO_PCBC=y 857CONFIG_CRYPTO_PCBC=y
837# CONFIG_CRYPTO_LRW is not set 858# CONFIG_CRYPTO_LRW is not set
838# CONFIG_CRYPTO_XTS is not set 859# CONFIG_CRYPTO_XTS is not set
860# CONFIG_CRYPTO_CTR is not set
861# CONFIG_CRYPTO_GCM is not set
862# CONFIG_CRYPTO_CCM is not set
839# CONFIG_CRYPTO_CRYPTD is not set 863# CONFIG_CRYPTO_CRYPTD is not set
840CONFIG_CRYPTO_DES=y 864CONFIG_CRYPTO_DES=y
841# CONFIG_CRYPTO_FCRYPT is not set 865# CONFIG_CRYPTO_FCRYPT is not set
@@ -850,11 +874,14 @@ CONFIG_CRYPTO_DES=y
850# CONFIG_CRYPTO_KHAZAD is not set 874# CONFIG_CRYPTO_KHAZAD is not set
851# CONFIG_CRYPTO_ANUBIS is not set 875# CONFIG_CRYPTO_ANUBIS is not set
852# CONFIG_CRYPTO_SEED is not set 876# CONFIG_CRYPTO_SEED is not set
877# CONFIG_CRYPTO_SALSA20 is not set
853# CONFIG_CRYPTO_DEFLATE is not set 878# CONFIG_CRYPTO_DEFLATE is not set
854# CONFIG_CRYPTO_MICHAEL_MIC is not set 879# CONFIG_CRYPTO_MICHAEL_MIC is not set
855# CONFIG_CRYPTO_CRC32C is not set 880# CONFIG_CRYPTO_CRC32C is not set
856# CONFIG_CRYPTO_CAMELLIA is not set 881# CONFIG_CRYPTO_CAMELLIA is not set
857# CONFIG_CRYPTO_TEST is not set 882# CONFIG_CRYPTO_TEST is not set
858# CONFIG_CRYPTO_AUTHENC is not set 883# CONFIG_CRYPTO_AUTHENC is not set
884# CONFIG_CRYPTO_LZO is not set
859CONFIG_CRYPTO_HW=y 885CONFIG_CRYPTO_HW=y
886# CONFIG_CRYPTO_DEV_HIFN_795X is not set
860# CONFIG_PPC_CLOCK is not set 887# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/configs/warp_defconfig b/arch/powerpc/configs/warp_defconfig
index 312557b5df53..2313c3e8ef61 100644
--- a/arch/powerpc/configs/warp_defconfig
+++ b/arch/powerpc/configs/warp_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.24-rc6 3# Linux kernel version: 2.6.25-rc2
4# Tue Jan 8 12:23:23 2008 4# Fri Feb 15 21:54:43 2008
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -30,6 +30,7 @@ CONFIG_GENERIC_TIME=y
30CONFIG_GENERIC_TIME_VSYSCALL=y 30CONFIG_GENERIC_TIME_VSYSCALL=y
31CONFIG_GENERIC_CLOCKEVENTS=y 31CONFIG_GENERIC_CLOCKEVENTS=y
32CONFIG_GENERIC_HARDIRQS=y 32CONFIG_GENERIC_HARDIRQS=y
33# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
33CONFIG_IRQ_PER_CPU=y 34CONFIG_IRQ_PER_CPU=y
34CONFIG_RWSEM_XCHGADD_ALGORITHM=y 35CONFIG_RWSEM_XCHGADD_ALGORITHM=y
35CONFIG_ARCH_HAS_ILOG2_U32=y 36CONFIG_ARCH_HAS_ILOG2_U32=y
@@ -68,17 +69,18 @@ CONFIG_SYSVIPC_SYSCTL=y
68# CONFIG_POSIX_MQUEUE is not set 69# CONFIG_POSIX_MQUEUE is not set
69# CONFIG_BSD_PROCESS_ACCT is not set 70# CONFIG_BSD_PROCESS_ACCT is not set
70# CONFIG_TASKSTATS is not set 71# CONFIG_TASKSTATS is not set
71# CONFIG_USER_NS is not set
72# CONFIG_PID_NS is not set
73# CONFIG_AUDIT is not set 72# CONFIG_AUDIT is not set
74# CONFIG_IKCONFIG is not set 73# CONFIG_IKCONFIG is not set
75CONFIG_LOG_BUF_SHIFT=14 74CONFIG_LOG_BUF_SHIFT=14
76# CONFIG_CGROUPS is not set 75# CONFIG_CGROUPS is not set
76CONFIG_GROUP_SCHED=y
77CONFIG_FAIR_GROUP_SCHED=y 77CONFIG_FAIR_GROUP_SCHED=y
78CONFIG_FAIR_USER_SCHED=y 78# CONFIG_RT_GROUP_SCHED is not set
79# CONFIG_FAIR_CGROUP_SCHED is not set 79CONFIG_USER_SCHED=y
80# CONFIG_CGROUP_SCHED is not set
80CONFIG_SYSFS_DEPRECATED=y 81CONFIG_SYSFS_DEPRECATED=y
81# CONFIG_RELAY is not set 82# CONFIG_RELAY is not set
83# CONFIG_NAMESPACES is not set
82CONFIG_BLK_DEV_INITRD=y 84CONFIG_BLK_DEV_INITRD=y
83CONFIG_INITRAMFS_SOURCE="" 85CONFIG_INITRAMFS_SOURCE=""
84# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 86# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -92,17 +94,26 @@ CONFIG_KALLSYMS=y
92CONFIG_PRINTK=y 94CONFIG_PRINTK=y
93CONFIG_BUG=y 95CONFIG_BUG=y
94CONFIG_ELF_CORE=y 96CONFIG_ELF_CORE=y
97CONFIG_COMPAT_BRK=y
95CONFIG_BASE_FULL=y 98CONFIG_BASE_FULL=y
96CONFIG_FUTEX=y 99CONFIG_FUTEX=y
97CONFIG_ANON_INODES=y 100CONFIG_ANON_INODES=y
98CONFIG_EPOLL=y 101CONFIG_EPOLL=y
99CONFIG_SIGNALFD=y 102CONFIG_SIGNALFD=y
103CONFIG_TIMERFD=y
100CONFIG_EVENTFD=y 104CONFIG_EVENTFD=y
101CONFIG_SHMEM=y 105CONFIG_SHMEM=y
102CONFIG_VM_EVENT_COUNTERS=y 106CONFIG_VM_EVENT_COUNTERS=y
103CONFIG_SLAB=y 107CONFIG_SLAB=y
104# CONFIG_SLUB is not set 108# CONFIG_SLUB is not set
105# CONFIG_SLOB is not set 109# CONFIG_SLOB is not set
110# CONFIG_PROFILING is not set
111# CONFIG_MARKERS is not set
112CONFIG_HAVE_OPROFILE=y
113# CONFIG_KPROBES is not set
114CONFIG_HAVE_KPROBES=y
115CONFIG_PROC_PAGE_MONITOR=y
116CONFIG_SLABINFO=y
106CONFIG_RT_MUTEXES=y 117CONFIG_RT_MUTEXES=y
107# CONFIG_TINY_SHMEM is not set 118# CONFIG_TINY_SHMEM is not set
108CONFIG_BASE_SMALL=0 119CONFIG_BASE_SMALL=0
@@ -130,12 +141,14 @@ CONFIG_DEFAULT_AS=y
130# CONFIG_DEFAULT_CFQ is not set 141# CONFIG_DEFAULT_CFQ is not set
131# CONFIG_DEFAULT_NOOP is not set 142# CONFIG_DEFAULT_NOOP is not set
132CONFIG_DEFAULT_IOSCHED="anticipatory" 143CONFIG_DEFAULT_IOSCHED="anticipatory"
144CONFIG_CLASSIC_RCU=y
145# CONFIG_PREEMPT_RCU is not set
133 146
134# 147#
135# Platform support 148# Platform support
136# 149#
137# CONFIG_PPC_MPC52xx is not set 150# CONFIG_PPC_MPC512x is not set
138# CONFIG_PPC_MPC5200 is not set 151# CONFIG_PPC_MPC5121 is not set
139# CONFIG_PPC_CELL is not set 152# CONFIG_PPC_CELL is not set
140# CONFIG_PPC_CELL_NATIVE is not set 153# CONFIG_PPC_CELL_NATIVE is not set
141# CONFIG_PQ2ADS is not set 154# CONFIG_PQ2ADS is not set
@@ -148,6 +161,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
148CONFIG_WARP=y 161CONFIG_WARP=y
149CONFIG_440EP=y 162CONFIG_440EP=y
150CONFIG_IBM440EP_ERR42=y 163CONFIG_IBM440EP_ERR42=y
164# CONFIG_IPIC is not set
151# CONFIG_MPIC is not set 165# CONFIG_MPIC is not set
152# CONFIG_MPIC_WEIRD is not set 166# CONFIG_MPIC_WEIRD is not set
153# CONFIG_PPC_I8259 is not set 167# CONFIG_PPC_I8259 is not set
@@ -158,7 +172,6 @@ CONFIG_IBM440EP_ERR42=y
158# CONFIG_PPC_INDIRECT_IO is not set 172# CONFIG_PPC_INDIRECT_IO is not set
159# CONFIG_GENERIC_IOMAP is not set 173# CONFIG_GENERIC_IOMAP is not set
160# CONFIG_CPU_FREQ is not set 174# CONFIG_CPU_FREQ is not set
161# CONFIG_CPM2 is not set
162# CONFIG_FSL_ULI1575 is not set 175# CONFIG_FSL_ULI1575 is not set
163 176
164# 177#
@@ -174,13 +187,18 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
174# CONFIG_HZ_300 is not set 187# CONFIG_HZ_300 is not set
175CONFIG_HZ_1000=y 188CONFIG_HZ_1000=y
176CONFIG_HZ=1000 189CONFIG_HZ=1000
190# CONFIG_SCHED_HRTICK is not set
177CONFIG_PREEMPT_NONE=y 191CONFIG_PREEMPT_NONE=y
178# CONFIG_PREEMPT_VOLUNTARY is not set 192# CONFIG_PREEMPT_VOLUNTARY is not set
179# CONFIG_PREEMPT is not set 193# CONFIG_PREEMPT is not set
194CONFIG_RCU_TRACE=y
180CONFIG_BINFMT_ELF=y 195CONFIG_BINFMT_ELF=y
181# CONFIG_BINFMT_MISC is not set 196# CONFIG_BINFMT_MISC is not set
182# CONFIG_MATH_EMULATION is not set 197# CONFIG_MATH_EMULATION is not set
198# CONFIG_IOMMU_HELPER is not set
183CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 199CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
200CONFIG_ARCH_HAS_WALK_MEMORY=y
201CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
184CONFIG_ARCH_FLATMEM_ENABLE=y 202CONFIG_ARCH_FLATMEM_ENABLE=y
185CONFIG_ARCH_POPULATES_NODE_MAP=y 203CONFIG_ARCH_POPULATES_NODE_MAP=y
186CONFIG_SELECT_MEMORY_MODEL=y 204CONFIG_SELECT_MEMORY_MODEL=y
@@ -200,8 +218,6 @@ CONFIG_PROC_DEVICETREE=y
200CONFIG_CMDLINE_BOOL=y 218CONFIG_CMDLINE_BOOL=y
201CONFIG_CMDLINE="ip=on" 219CONFIG_CMDLINE="ip=on"
202CONFIG_SECCOMP=y 220CONFIG_SECCOMP=y
203CONFIG_WANT_DEVICE_TREE=y
204CONFIG_DEVICE_TREE="warp.dts"
205CONFIG_ISA_DMA_API=y 221CONFIG_ISA_DMA_API=y
206 222
207# 223#
@@ -244,6 +260,7 @@ CONFIG_XFRM=y
244# CONFIG_XFRM_USER is not set 260# CONFIG_XFRM_USER is not set
245# CONFIG_XFRM_SUB_POLICY is not set 261# CONFIG_XFRM_SUB_POLICY is not set
246# CONFIG_XFRM_MIGRATE is not set 262# CONFIG_XFRM_MIGRATE is not set
263# CONFIG_XFRM_STATISTICS is not set
247# CONFIG_NET_KEY is not set 264# CONFIG_NET_KEY is not set
248CONFIG_INET=y 265CONFIG_INET=y
249# CONFIG_IP_MULTICAST is not set 266# CONFIG_IP_MULTICAST is not set
@@ -279,12 +296,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
279# CONFIG_NETWORK_SECMARK is not set 296# CONFIG_NETWORK_SECMARK is not set
280CONFIG_NETFILTER=y 297CONFIG_NETFILTER=y
281# CONFIG_NETFILTER_DEBUG is not set 298# CONFIG_NETFILTER_DEBUG is not set
299CONFIG_NETFILTER_ADVANCED=y
282 300
283# 301#
284# Core Netfilter Configuration 302# Core Netfilter Configuration
285# 303#
286# CONFIG_NETFILTER_NETLINK is not set 304# CONFIG_NETFILTER_NETLINK_QUEUE is not set
287# CONFIG_NF_CONNTRACK_ENABLED is not set 305# CONFIG_NETFILTER_NETLINK_LOG is not set
288# CONFIG_NF_CONNTRACK is not set 306# CONFIG_NF_CONNTRACK is not set
289# CONFIG_NETFILTER_XTABLES is not set 307# CONFIG_NETFILTER_XTABLES is not set
290 308
@@ -315,6 +333,7 @@ CONFIG_VLAN_8021Q=y
315# 333#
316# CONFIG_NET_PKTGEN is not set 334# CONFIG_NET_PKTGEN is not set
317# CONFIG_HAMRADIO is not set 335# CONFIG_HAMRADIO is not set
336# CONFIG_CAN is not set
318# CONFIG_IRDA is not set 337# CONFIG_IRDA is not set
319# CONFIG_BT is not set 338# CONFIG_BT is not set
320# CONFIG_AF_RXRPC is not set 339# CONFIG_AF_RXRPC is not set
@@ -348,6 +367,7 @@ CONFIG_MTD=y
348CONFIG_MTD_PARTITIONS=y 367CONFIG_MTD_PARTITIONS=y
349# CONFIG_MTD_REDBOOT_PARTS is not set 368# CONFIG_MTD_REDBOOT_PARTS is not set
350# CONFIG_MTD_CMDLINE_PARTS is not set 369# CONFIG_MTD_CMDLINE_PARTS is not set
370CONFIG_MTD_OF_PARTS=y
351 371
352# 372#
353# User Modules And Translation Layers 373# User Modules And Translation Layers
@@ -414,11 +434,11 @@ CONFIG_MTD_NAND=y
414CONFIG_MTD_NAND_ECC_SMC=y 434CONFIG_MTD_NAND_ECC_SMC=y
415# CONFIG_MTD_NAND_MUSEUM_IDS is not set 435# CONFIG_MTD_NAND_MUSEUM_IDS is not set
416CONFIG_MTD_NAND_IDS=y 436CONFIG_MTD_NAND_IDS=y
417CONFIG_MTD_NAND_NDFC=y
418# CONFIG_MTD_NAND_DISKONCHIP is not set 437# CONFIG_MTD_NAND_DISKONCHIP is not set
419# CONFIG_MTD_NAND_NANDSIM is not set 438# CONFIG_MTD_NAND_NANDSIM is not set
420# CONFIG_MTD_NAND_PLATFORM is not set 439# CONFIG_MTD_NAND_PLATFORM is not set
421# CONFIG_MTD_ALAUDA is not set 440# CONFIG_MTD_ALAUDA is not set
441# CONFIG_MTD_NAND_FSL_ELBC is not set
422# CONFIG_MTD_ONENAND is not set 442# CONFIG_MTD_ONENAND is not set
423 443
424# 444#
@@ -436,12 +456,14 @@ CONFIG_BLK_DEV=y
436CONFIG_BLK_DEV_RAM=y 456CONFIG_BLK_DEV_RAM=y
437CONFIG_BLK_DEV_RAM_COUNT=16 457CONFIG_BLK_DEV_RAM_COUNT=16
438CONFIG_BLK_DEV_RAM_SIZE=4096 458CONFIG_BLK_DEV_RAM_SIZE=4096
439CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 459# CONFIG_BLK_DEV_XIP is not set
440# CONFIG_CDROM_PKTCDVD is not set 460# CONFIG_CDROM_PKTCDVD is not set
441# CONFIG_ATA_OVER_ETH is not set 461# CONFIG_ATA_OVER_ETH is not set
442# CONFIG_XILINX_SYSACE is not set 462# CONFIG_XILINX_SYSACE is not set
443CONFIG_MISC_DEVICES=y 463CONFIG_MISC_DEVICES=y
444# CONFIG_EEPROM_93CX6 is not set 464# CONFIG_EEPROM_93CX6 is not set
465# CONFIG_ENCLOSURE_SERVICES is not set
466CONFIG_HAVE_IDE=y
445# CONFIG_IDE is not set 467# CONFIG_IDE is not set
446 468
447# 469#
@@ -471,7 +493,7 @@ CONFIG_BLK_DEV_SD=y
471# CONFIG_SCSI_CONSTANTS is not set 493# CONFIG_SCSI_CONSTANTS is not set
472# CONFIG_SCSI_LOGGING is not set 494# CONFIG_SCSI_LOGGING is not set
473# CONFIG_SCSI_SCAN_ASYNC is not set 495# CONFIG_SCSI_SCAN_ASYNC is not set
474# CONFIG_SCSI_WAIT_SCAN is not set 496CONFIG_SCSI_WAIT_SCAN=m
475 497
476# 498#
477# SCSI Transports 499# SCSI Transports
@@ -528,7 +550,6 @@ CONFIG_IBM_NEW_EMAC_ZMII=y
528# CONFIG_WAN is not set 550# CONFIG_WAN is not set
529# CONFIG_PPP is not set 551# CONFIG_PPP is not set
530# CONFIG_SLIP is not set 552# CONFIG_SLIP is not set
531# CONFIG_SHAPER is not set
532# CONFIG_NETCONSOLE is not set 553# CONFIG_NETCONSOLE is not set
533# CONFIG_NETPOLL is not set 554# CONFIG_NETPOLL is not set
534# CONFIG_NET_POLL_CONTROLLER is not set 555# CONFIG_NET_POLL_CONTROLLER is not set
@@ -596,7 +617,6 @@ CONFIG_I2C_BOARDINFO=y
596# 617#
597# I2C Hardware Bus support 618# I2C Hardware Bus support
598# 619#
599CONFIG_I2C_IBM_IIC=y
600# CONFIG_I2C_MPC is not set 620# CONFIG_I2C_MPC is not set
601# CONFIG_I2C_OCORES is not set 621# CONFIG_I2C_OCORES is not set
602# CONFIG_I2C_PARPORT_LIGHT is not set 622# CONFIG_I2C_PARPORT_LIGHT is not set
@@ -608,14 +628,12 @@ CONFIG_I2C_IBM_IIC=y
608# 628#
609# Miscellaneous I2C Chip support 629# Miscellaneous I2C Chip support
610# 630#
611# CONFIG_SENSORS_DS1337 is not set
612# CONFIG_SENSORS_DS1374 is not set
613# CONFIG_DS1682 is not set 631# CONFIG_DS1682 is not set
614CONFIG_SENSORS_EEPROM=y 632CONFIG_SENSORS_EEPROM=y
615# CONFIG_SENSORS_PCF8574 is not set 633# CONFIG_SENSORS_PCF8574 is not set
616# CONFIG_SENSORS_PCA9539 is not set 634# CONFIG_PCF8575 is not set
617# CONFIG_SENSORS_PCF8591 is not set 635# CONFIG_SENSORS_PCF8591 is not set
618# CONFIG_SENSORS_M41T00 is not set 636# CONFIG_TPS65010 is not set
619# CONFIG_SENSORS_MAX6875 is not set 637# CONFIG_SENSORS_MAX6875 is not set
620# CONFIG_SENSORS_TSL2550 is not set 638# CONFIG_SENSORS_TSL2550 is not set
621# CONFIG_I2C_DEBUG_CORE is not set 639# CONFIG_I2C_DEBUG_CORE is not set
@@ -632,7 +650,6 @@ CONFIG_SENSORS_EEPROM=y
632# CONFIG_POWER_SUPPLY is not set 650# CONFIG_POWER_SUPPLY is not set
633CONFIG_HWMON=y 651CONFIG_HWMON=y
634# CONFIG_HWMON_VID is not set 652# CONFIG_HWMON_VID is not set
635CONFIG_SENSORS_AD7414=y
636# CONFIG_SENSORS_AD7418 is not set 653# CONFIG_SENSORS_AD7418 is not set
637# CONFIG_SENSORS_ADM1021 is not set 654# CONFIG_SENSORS_ADM1021 is not set
638# CONFIG_SENSORS_ADM1025 is not set 655# CONFIG_SENSORS_ADM1025 is not set
@@ -668,6 +685,7 @@ CONFIG_SENSORS_AD7414=y
668# CONFIG_SENSORS_SMSC47M1 is not set 685# CONFIG_SENSORS_SMSC47M1 is not set
669# CONFIG_SENSORS_SMSC47M192 is not set 686# CONFIG_SENSORS_SMSC47M192 is not set
670# CONFIG_SENSORS_SMSC47B397 is not set 687# CONFIG_SENSORS_SMSC47B397 is not set
688# CONFIG_SENSORS_ADS7828 is not set
671# CONFIG_SENSORS_THMC50 is not set 689# CONFIG_SENSORS_THMC50 is not set
672# CONFIG_SENSORS_VT1211 is not set 690# CONFIG_SENSORS_VT1211 is not set
673# CONFIG_SENSORS_W83781D is not set 691# CONFIG_SENSORS_W83781D is not set
@@ -675,9 +693,11 @@ CONFIG_SENSORS_AD7414=y
675# CONFIG_SENSORS_W83792D is not set 693# CONFIG_SENSORS_W83792D is not set
676# CONFIG_SENSORS_W83793 is not set 694# CONFIG_SENSORS_W83793 is not set
677# CONFIG_SENSORS_W83L785TS is not set 695# CONFIG_SENSORS_W83L785TS is not set
696# CONFIG_SENSORS_W83L786NG is not set
678# CONFIG_SENSORS_W83627HF is not set 697# CONFIG_SENSORS_W83627HF is not set
679# CONFIG_SENSORS_W83627EHF is not set 698# CONFIG_SENSORS_W83627EHF is not set
680# CONFIG_HWMON_DEBUG_CHIP is not set 699# CONFIG_HWMON_DEBUG_CHIP is not set
700CONFIG_THERMAL=y
681# CONFIG_WATCHDOG is not set 701# CONFIG_WATCHDOG is not set
682 702
683# 703#
@@ -721,6 +741,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
721# CONFIG_USB_ARCH_HAS_EHCI is not set 741# CONFIG_USB_ARCH_HAS_EHCI is not set
722CONFIG_USB=y 742CONFIG_USB=y
723# CONFIG_USB_DEBUG is not set 743# CONFIG_USB_DEBUG is not set
744# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
724 745
725# 746#
726# Miscellaneous USB options 747# Miscellaneous USB options
@@ -781,10 +802,6 @@ CONFIG_USB_MON=y
781# 802#
782# USB port drivers 803# USB port drivers
783# 804#
784
785#
786# USB Serial Converter support
787#
788# CONFIG_USB_SERIAL is not set 805# CONFIG_USB_SERIAL is not set
789 806
790# 807#
@@ -808,14 +825,6 @@ CONFIG_USB_MON=y
808# CONFIG_USB_LD is not set 825# CONFIG_USB_LD is not set
809# CONFIG_USB_TRANCEVIBRATOR is not set 826# CONFIG_USB_TRANCEVIBRATOR is not set
810# CONFIG_USB_IOWARRIOR is not set 827# CONFIG_USB_IOWARRIOR is not set
811
812#
813# USB DSL modem support
814#
815
816#
817# USB Gadget Support
818#
819# CONFIG_USB_GADGET is not set 828# CONFIG_USB_GADGET is not set
820CONFIG_MMC=m 829CONFIG_MMC=m
821# CONFIG_MMC_DEBUG is not set 830# CONFIG_MMC_DEBUG is not set
@@ -832,6 +841,7 @@ CONFIG_MMC_BLOCK_BOUNCE=y
832# MMC/SD Host Controller Drivers 841# MMC/SD Host Controller Drivers
833# 842#
834# CONFIG_MMC_WBSD is not set 843# CONFIG_MMC_WBSD is not set
844# CONFIG_MEMSTICK is not set
835# CONFIG_NEW_LEDS is not set 845# CONFIG_NEW_LEDS is not set
836# CONFIG_EDAC is not set 846# CONFIG_EDAC is not set
837# CONFIG_RTC_CLASS is not set 847# CONFIG_RTC_CLASS is not set
@@ -855,12 +865,10 @@ CONFIG_EXT2_FS=y
855# CONFIG_XFS_FS is not set 865# CONFIG_XFS_FS is not set
856# CONFIG_GFS2_FS is not set 866# CONFIG_GFS2_FS is not set
857# CONFIG_OCFS2_FS is not set 867# CONFIG_OCFS2_FS is not set
858# CONFIG_MINIX_FS is not set 868CONFIG_DNOTIFY=y
859# CONFIG_ROMFS_FS is not set
860CONFIG_INOTIFY=y 869CONFIG_INOTIFY=y
861CONFIG_INOTIFY_USER=y 870CONFIG_INOTIFY_USER=y
862# CONFIG_QUOTA is not set 871# CONFIG_QUOTA is not set
863CONFIG_DNOTIFY=y
864# CONFIG_AUTOFS_FS is not set 872# CONFIG_AUTOFS_FS is not set
865# CONFIG_AUTOFS4_FS is not set 873# CONFIG_AUTOFS4_FS is not set
866# CONFIG_FUSE_FS is not set 874# CONFIG_FUSE_FS is not set
@@ -915,8 +923,10 @@ CONFIG_JFFS2_RTIME=y
915# CONFIG_JFFS2_RUBIN is not set 923# CONFIG_JFFS2_RUBIN is not set
916CONFIG_CRAMFS=y 924CONFIG_CRAMFS=y
917# CONFIG_VXFS_FS is not set 925# CONFIG_VXFS_FS is not set
926# CONFIG_MINIX_FS is not set
918# CONFIG_HPFS_FS is not set 927# CONFIG_HPFS_FS is not set
919# CONFIG_QNX4FS_FS is not set 928# CONFIG_QNX4FS_FS is not set
929# CONFIG_ROMFS_FS is not set
920# CONFIG_SYSV_FS is not set 930# CONFIG_SYSV_FS is not set
921# CONFIG_UFS_FS is not set 931# CONFIG_UFS_FS is not set
922CONFIG_NETWORK_FILESYSTEMS=y 932CONFIG_NETWORK_FILESYSTEMS=y
@@ -986,7 +996,6 @@ CONFIG_NLS_ISO8859_15=y
986# CONFIG_NLS_KOI8_U is not set 996# CONFIG_NLS_KOI8_U is not set
987CONFIG_NLS_UTF8=y 997CONFIG_NLS_UTF8=y
988# CONFIG_DLM is not set 998# CONFIG_DLM is not set
989# CONFIG_UCC_SLOW is not set
990 999
991# 1000#
992# Library routines 1001# Library routines
@@ -1004,7 +1013,6 @@ CONFIG_PLIST=y
1004CONFIG_HAS_IOMEM=y 1013CONFIG_HAS_IOMEM=y
1005CONFIG_HAS_IOPORT=y 1014CONFIG_HAS_IOPORT=y
1006CONFIG_HAS_DMA=y 1015CONFIG_HAS_DMA=y
1007# CONFIG_INSTRUMENTATION is not set
1008 1016
1009# 1017#
1010# Kernel hacking 1018# Kernel hacking
@@ -1014,7 +1022,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1014CONFIG_ENABLE_MUST_CHECK=y 1022CONFIG_ENABLE_MUST_CHECK=y
1015CONFIG_MAGIC_SYSRQ=y 1023CONFIG_MAGIC_SYSRQ=y
1016# CONFIG_UNUSED_SYMBOLS is not set 1024# CONFIG_UNUSED_SYMBOLS is not set
1017# CONFIG_DEBUG_FS is not set 1025CONFIG_DEBUG_FS=y
1018# CONFIG_HEADERS_CHECK is not set 1026# CONFIG_HEADERS_CHECK is not set
1019CONFIG_DEBUG_KERNEL=y 1027CONFIG_DEBUG_KERNEL=y
1020# CONFIG_DEBUG_SHIRQ is not set 1028# CONFIG_DEBUG_SHIRQ is not set
@@ -1035,15 +1043,16 @@ CONFIG_DEBUG_INFO=y
1035# CONFIG_DEBUG_VM is not set 1043# CONFIG_DEBUG_VM is not set
1036# CONFIG_DEBUG_LIST is not set 1044# CONFIG_DEBUG_LIST is not set
1037# CONFIG_DEBUG_SG is not set 1045# CONFIG_DEBUG_SG is not set
1038CONFIG_FORCED_INLINING=y
1039# CONFIG_BOOT_PRINTK_DELAY is not set 1046# CONFIG_BOOT_PRINTK_DELAY is not set
1040# CONFIG_RCU_TORTURE_TEST is not set 1047# CONFIG_RCU_TORTURE_TEST is not set
1048# CONFIG_BACKTRACE_SELF_TEST is not set
1041# CONFIG_FAULT_INJECTION is not set 1049# CONFIG_FAULT_INJECTION is not set
1042# CONFIG_SAMPLES is not set 1050# CONFIG_SAMPLES is not set
1043# CONFIG_DEBUG_STACKOVERFLOW is not set 1051# CONFIG_DEBUG_STACKOVERFLOW is not set
1044# CONFIG_DEBUG_STACK_USAGE is not set 1052# CONFIG_DEBUG_STACK_USAGE is not set
1045# CONFIG_DEBUG_PAGEALLOC is not set 1053# CONFIG_DEBUG_PAGEALLOC is not set
1046# CONFIG_DEBUGGER is not set 1054# CONFIG_DEBUGGER is not set
1055# CONFIG_VIRQ_DEBUG is not set
1047CONFIG_BDI_SWITCH=y 1056CONFIG_BDI_SWITCH=y
1048# CONFIG_PPC_EARLY_DEBUG is not set 1057# CONFIG_PPC_EARLY_DEBUG is not set
1049 1058
@@ -1053,5 +1062,49 @@ CONFIG_BDI_SWITCH=y
1053# CONFIG_KEYS is not set 1062# CONFIG_KEYS is not set
1054# CONFIG_SECURITY is not set 1063# CONFIG_SECURITY is not set
1055# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1064# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1056# CONFIG_CRYPTO is not set 1065CONFIG_CRYPTO=y
1066# CONFIG_CRYPTO_SEQIV is not set
1067# CONFIG_CRYPTO_MANAGER is not set
1068# CONFIG_CRYPTO_HMAC is not set
1069# CONFIG_CRYPTO_XCBC is not set
1070# CONFIG_CRYPTO_NULL is not set
1071# CONFIG_CRYPTO_MD4 is not set
1072# CONFIG_CRYPTO_MD5 is not set
1073# CONFIG_CRYPTO_SHA1 is not set
1074# CONFIG_CRYPTO_SHA256 is not set
1075# CONFIG_CRYPTO_SHA512 is not set
1076# CONFIG_CRYPTO_WP512 is not set
1077# CONFIG_CRYPTO_TGR192 is not set
1078# CONFIG_CRYPTO_GF128MUL is not set
1079# CONFIG_CRYPTO_ECB is not set
1080# CONFIG_CRYPTO_CBC is not set
1081# CONFIG_CRYPTO_PCBC is not set
1082# CONFIG_CRYPTO_LRW is not set
1083# CONFIG_CRYPTO_XTS is not set
1084# CONFIG_CRYPTO_CTR is not set
1085# CONFIG_CRYPTO_GCM is not set
1086# CONFIG_CRYPTO_CCM is not set
1087# CONFIG_CRYPTO_CRYPTD is not set
1088# CONFIG_CRYPTO_DES is not set
1089# CONFIG_CRYPTO_FCRYPT is not set
1090# CONFIG_CRYPTO_BLOWFISH is not set
1091# CONFIG_CRYPTO_TWOFISH is not set
1092# CONFIG_CRYPTO_SERPENT is not set
1093# CONFIG_CRYPTO_AES is not set
1094# CONFIG_CRYPTO_CAST5 is not set
1095# CONFIG_CRYPTO_CAST6 is not set
1096# CONFIG_CRYPTO_TEA is not set
1097# CONFIG_CRYPTO_ARC4 is not set
1098# CONFIG_CRYPTO_KHAZAD is not set
1099# CONFIG_CRYPTO_ANUBIS is not set
1100# CONFIG_CRYPTO_SEED is not set
1101# CONFIG_CRYPTO_SALSA20 is not set
1102# CONFIG_CRYPTO_DEFLATE is not set
1103# CONFIG_CRYPTO_MICHAEL_MIC is not set
1104# CONFIG_CRYPTO_CRC32C is not set
1105# CONFIG_CRYPTO_CAMELLIA is not set
1106# CONFIG_CRYPTO_TEST is not set
1107# CONFIG_CRYPTO_AUTHENC is not set
1108# CONFIG_CRYPTO_LZO is not set
1109CONFIG_CRYPTO_HW=y
1057# CONFIG_PPC_CLOCK is not set 1110# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 0662ae46f724..c1baf9d5903f 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -104,3 +104,5 @@ quiet_cmd_systbl_chk = CALL $<
104PHONY += systbl_chk 104PHONY += systbl_chk
105systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i 105systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
106 $(call cmd,systbl_chk) 106 $(call cmd,systbl_chk)
107
108clean-files := vmlinux.lds
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 5338e4855712..c176c513566b 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -274,7 +274,7 @@ no_kprobe:
274 * - When the probed function returns, this probe 274 * - When the probed function returns, this probe
275 * causes the handlers to fire 275 * causes the handlers to fire
276 */ 276 */
277void kretprobe_trampoline_holder(void) 277static void __used kretprobe_trampoline_holder(void)
278{ 278{
279 asm volatile(".global kretprobe_trampoline\n" 279 asm volatile(".global kretprobe_trampoline\n"
280 "kretprobe_trampoline:\n" 280 "kretprobe_trampoline:\n"
@@ -284,7 +284,8 @@ void kretprobe_trampoline_holder(void)
284/* 284/*
285 * Called when the probe at kretprobe trampoline is hit 285 * Called when the probe at kretprobe trampoline is hit
286 */ 286 */
287int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 287static int __kprobes trampoline_probe_handler(struct kprobe *p,
288 struct pt_regs *regs)
288{ 289{
289 struct kretprobe_instance *ri = NULL; 290 struct kretprobe_instance *ri = NULL;
290 struct hlist_head *head, empty_rp; 291 struct hlist_head *head, empty_rp;
@@ -517,12 +518,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
517 return 1; 518 return 1;
518} 519}
519 520
520void __kprobes jprobe_return(void) 521void __used __kprobes jprobe_return(void)
521{ 522{
522 asm volatile("trap" ::: "memory"); 523 asm volatile("trap" ::: "memory");
523} 524}
524 525
525void __kprobes jprobe_return_end(void) 526static void __used __kprobes jprobe_return_end(void)
526{ 527{
527}; 528};
528 529
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index b9d88374f14f..4846bf543a8c 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -462,7 +462,7 @@ void show_regs(struct pt_regs * regs)
462 current, task_pid_nr(current), current->comm, task_thread_info(current)); 462 current, task_pid_nr(current), current->comm, task_thread_info(current));
463 463
464#ifdef CONFIG_SMP 464#ifdef CONFIG_SMP
465 printk(" CPU: %d", smp_processor_id()); 465 printk(" CPU: %d", raw_smp_processor_id());
466#endif /* CONFIG_SMP */ 466#endif /* CONFIG_SMP */
467 467
468 for (i = 0; i < 32; i++) { 468 for (i = 0; i < 32; i++) {
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 8b5efbce8d90..eac97f48b9b8 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -865,12 +865,12 @@ static int __init early_init_dt_scan_root(unsigned long node,
865 return 1; 865 return 1;
866} 866}
867 867
868static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) 868static u64 __init dt_mem_next_cell(int s, cell_t **cellp)
869{ 869{
870 cell_t *p = *cellp; 870 cell_t *p = *cellp;
871 871
872 *cellp = p + s; 872 *cellp = p + s;
873 return of_read_ulong(p, s); 873 return of_read_number(p, s);
874} 874}
875 875
876#ifdef CONFIG_PPC_PSERIES 876#ifdef CONFIG_PPC_PSERIES
@@ -883,8 +883,8 @@ static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp)
883static int __init early_init_dt_scan_drconf_memory(unsigned long node) 883static int __init early_init_dt_scan_drconf_memory(unsigned long node)
884{ 884{
885 cell_t *dm, *ls; 885 cell_t *dm, *ls;
886 unsigned long l, n; 886 unsigned long l, n, flags;
887 unsigned long base, size, lmb_size, flags; 887 u64 base, size, lmb_size;
888 888
889 ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l); 889 ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
890 if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t)) 890 if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
@@ -959,14 +959,15 @@ static int __init early_init_dt_scan_memory(unsigned long node,
959 uname, l, reg[0], reg[1], reg[2], reg[3]); 959 uname, l, reg[0], reg[1], reg[2], reg[3]);
960 960
961 while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) { 961 while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
962 unsigned long base, size; 962 u64 base, size;
963 963
964 base = dt_mem_next_cell(dt_root_addr_cells, &reg); 964 base = dt_mem_next_cell(dt_root_addr_cells, &reg);
965 size = dt_mem_next_cell(dt_root_size_cells, &reg); 965 size = dt_mem_next_cell(dt_root_size_cells, &reg);
966 966
967 if (size == 0) 967 if (size == 0)
968 continue; 968 continue;
969 DBG(" - %lx , %lx\n", base, size); 969 DBG(" - %llx , %llx\n", (unsigned long long)base,
970 (unsigned long long)size);
970#ifdef CONFIG_PPC64 971#ifdef CONFIG_PPC64
971 if (iommu_is_off) { 972 if (iommu_is_off) {
972 if (base >= 0x80000000ul) 973 if (base >= 0x80000000ul)
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 3702df7dc567..d3437c4c4a6f 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -336,9 +336,9 @@ static unsigned long __init find_function32(struct lib32_elfinfo *lib,
336 return sym->st_value - VDSO32_LBASE; 336 return sym->st_value - VDSO32_LBASE;
337} 337}
338 338
339static int vdso_do_func_patch32(struct lib32_elfinfo *v32, 339static int __init vdso_do_func_patch32(struct lib32_elfinfo *v32,
340 struct lib64_elfinfo *v64, 340 struct lib64_elfinfo *v64,
341 const char *orig, const char *fix) 341 const char *orig, const char *fix)
342{ 342{
343 Elf32_Sym *sym32_gen, *sym32_fix; 343 Elf32_Sym *sym32_gen, *sym32_fix;
344 344
@@ -433,9 +433,9 @@ static unsigned long __init find_function64(struct lib64_elfinfo *lib,
433#endif 433#endif
434} 434}
435 435
436static int vdso_do_func_patch64(struct lib32_elfinfo *v32, 436static int __init vdso_do_func_patch64(struct lib32_elfinfo *v32,
437 struct lib64_elfinfo *v64, 437 struct lib64_elfinfo *v64,
438 const char *orig, const char *fix) 438 const char *orig, const char *fix)
439{ 439{
440 Elf64_Sym *sym64_gen, *sym64_fix; 440 Elf64_Sym *sym64_gen, *sym64_fix;
441 441
diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c
index 4a890cb42b98..257b13cb18af 100644
--- a/arch/powerpc/oprofile/cell/spu_task_sync.c
+++ b/arch/powerpc/oprofile/cell/spu_task_sync.c
@@ -198,14 +198,13 @@ out:
198 * dcookie user still being registered (namely, the reader 198 * dcookie user still being registered (namely, the reader
199 * of the event buffer). 199 * of the event buffer).
200 */ 200 */
201static inline unsigned long fast_get_dcookie(struct dentry *dentry, 201static inline unsigned long fast_get_dcookie(struct path *path)
202 struct vfsmount *vfsmnt)
203{ 202{
204 unsigned long cookie; 203 unsigned long cookie;
205 204
206 if (dentry->d_cookie) 205 if (path->dentry->d_cookie)
207 return (unsigned long)dentry; 206 return (unsigned long)path->dentry;
208 get_dcookie(dentry, vfsmnt, &cookie); 207 get_dcookie(path, &cookie);
209 return cookie; 208 return cookie;
210} 209}
211 210
@@ -240,8 +239,7 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp,
240 continue; 239 continue;
241 if (!(vma->vm_flags & VM_EXECUTABLE)) 240 if (!(vma->vm_flags & VM_EXECUTABLE))
242 continue; 241 continue;
243 app_cookie = fast_get_dcookie(vma->vm_file->f_dentry, 242 app_cookie = fast_get_dcookie(&vma->vm_file->f_path);
244 vma->vm_file->f_vfsmnt);
245 pr_debug("got dcookie for %s\n", 243 pr_debug("got dcookie for %s\n",
246 vma->vm_file->f_dentry->d_name.name); 244 vma->vm_file->f_dentry->d_name.name);
247 app = vma->vm_file; 245 app = vma->vm_file;
@@ -262,8 +260,7 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp,
262 break; 260 break;
263 } 261 }
264 262
265 *spu_bin_dcookie = fast_get_dcookie(vma->vm_file->f_dentry, 263 *spu_bin_dcookie = fast_get_dcookie(&vma->vm_file->f_path);
266 vma->vm_file->f_vfsmnt);
267 pr_debug("got dcookie for %s\n", vma->vm_file->f_dentry->d_name.name); 264 pr_debug("got dcookie for %s\n", vma->vm_file->f_dentry->d_name.name);
268 265
269 up_read(&mm->mmap_sem); 266 up_read(&mm->mmap_sem);
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index c062c4cbbed5..1bfb2191010a 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -61,7 +61,7 @@ config WARP
61 select 440EP 61 select 440EP
62 help 62 help
63 This option enables support for the PIKA Warp(tm) Appliance. The Warp 63 This option enables support for the PIKA Warp(tm) Appliance. The Warp
64 is a small computer replacement with up to 9 ports of FXO/FXS plus VOIP 64 is a small computer replacement with up to 9 ports of FXO/FXS plus VOIP
65 stations and trunks. 65 stations and trunks.
66 66
67 See http://www.pikatechnologies.com/ and follow the "PIKA for Computer 67 See http://www.pikatechnologies.com/ and follow the "PIKA for Computer
@@ -110,17 +110,17 @@ config 440GP
110 110
111config 440GX 111config 440GX
112 bool 112 bool
113 select IBM_NEW_EMAC_EMAC4 113 select IBM_NEW_EMAC_EMAC4
114 select IBM_NEW_EMAC_RGMII 114 select IBM_NEW_EMAC_RGMII
115 select IBM_NEW_EMAC_ZMII #test only 115 select IBM_NEW_EMAC_ZMII #test only
116 select IBM_NEW_EMAC_TAH #test only 116 select IBM_NEW_EMAC_TAH #test only
117 117
118config 440SP 118config 440SP
119 bool 119 bool
120 120
121config 440SPe 121config 440SPe
122 select IBM_NEW_EMAC_EMAC4
123 bool 122 bool
123 select IBM_NEW_EMAC_EMAC4
124 124
125# 44x errata/workaround config symbols, selected by the CPU models above 125# 44x errata/workaround config symbols, selected by the CPU models above
126config IBM440EP_ERR42 126config IBM440EP_ERR42
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index c6fa49e23dc0..4c0da0c079e9 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -13,7 +13,6 @@ config MPC5121_ADS
13 bool "Freescale MPC5121E ADS" 13 bool "Freescale MPC5121E ADS"
14 depends on PPC_MULTIPLATFORM && PPC32 14 depends on PPC_MULTIPLATFORM && PPC32
15 select DEFAULT_UIMAGE 15 select DEFAULT_UIMAGE
16 select WANT_DEVICE_TREE
17 select PPC_MPC5121 16 select PPC_MPC5121
18 help 17 help
19 This option enables support for the MPC5121E ADS board. 18 This option enables support for the MPC5121E ADS board.
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig
index 515f244c90bb..cf945d55c276 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -8,7 +8,6 @@ config PPC_MPC5200_SIMPLE
8 bool "Generic support for simple MPC5200 based boards" 8 bool "Generic support for simple MPC5200 based boards"
9 depends on PPC_MPC52xx 9 depends on PPC_MPC52xx
10 select DEFAULT_UIMAGE 10 select DEFAULT_UIMAGE
11 select WANT_DEVICE_TREE
12 help 11 help
13 This option enables support for a simple MPC52xx based boards which 12 This option enables support for a simple MPC52xx based boards which
14 do not need a custom platform specific setup. Such boards are 13 do not need a custom platform specific setup. Such boards are
@@ -35,7 +34,6 @@ config PPC_LITE5200
35 bool "Freescale Lite5200 Eval Board" 34 bool "Freescale Lite5200 Eval Board"
36 depends on PPC_MPC52xx 35 depends on PPC_MPC52xx
37 select DEFAULT_UIMAGE 36 select DEFAULT_UIMAGE
38 select WANT_DEVICE_TREE
39 37
40config PPC_MPC5200_BUGFIX 38config PPC_MPC5200_BUGFIX
41 bool "MPC5200 (L25R) bugfix support" 39 bool "MPC5200 (L25R) bugfix support"
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index fcedbec07f94..0afd22595546 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -15,7 +15,6 @@ config PPC_MULTIPLATFORM
15config PPC_82xx 15config PPC_82xx
16 bool "Freescale 82xx" 16 bool "Freescale 82xx"
17 depends on 6xx 17 depends on 6xx
18 select WANT_DEVICE_TREE
19 18
20config PPC_83xx 19config PPC_83xx
21 bool "Freescale 83xx" 20 bool "Freescale 83xx"
@@ -23,7 +22,6 @@ config PPC_83xx
23 select FSL_SOC 22 select FSL_SOC
24 select MPC83xx 23 select MPC83xx
25 select IPIC 24 select IPIC
26 select WANT_DEVICE_TREE
27 select FSL_EMB_PERFMON 25 select FSL_EMB_PERFMON
28 26
29config PPC_86xx 27config PPC_86xx
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 69941ba70975..73d81ce14b67 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -29,26 +29,22 @@ config PPC_85xx
29 bool "Freescale 85xx" 29 bool "Freescale 85xx"
30 select E500 30 select E500
31 select FSL_SOC 31 select FSL_SOC
32 select WANT_DEVICE_TREE
33 select MPC85xx 32 select MPC85xx
34 33
35config PPC_8xx 34config PPC_8xx
36 bool "Freescale 8xx" 35 bool "Freescale 8xx"
37 select FSL_SOC 36 select FSL_SOC
38 select 8xx 37 select 8xx
39 select WANT_DEVICE_TREE
40 select PPC_LIB_RHEAP 38 select PPC_LIB_RHEAP
41 39
42config 40x 40config 40x
43 bool "AMCC 40x" 41 bool "AMCC 40x"
44 select PPC_DCR_NATIVE 42 select PPC_DCR_NATIVE
45 select WANT_DEVICE_TREE
46 select PPC_UDBG_16550 43 select PPC_UDBG_16550
47 44
48config 44x 45config 44x
49 bool "AMCC 44x" 46 bool "AMCC 44x"
50 select PPC_DCR_NATIVE 47 select PPC_DCR_NATIVE
51 select WANT_DEVICE_TREE
52 select PPC_UDBG_16550 48 select PPC_UDBG_16550
53 49
54config E200 50config E200
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index b2494ebcdbe9..e43024c0392e 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -1,4 +1,13 @@
1#define DEBUG 1/*
2 * Copyright 2006-2008, IBM 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
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#undef DEBUG
2 11
3#include <linux/types.h> 12#include <linux/types.h>
4#include <linux/kernel.h> 13#include <linux/kernel.h>
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index e45cfa84911f..87eb07f94c5f 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -160,13 +160,6 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
160 160
161 pr_debug("%s\n", __FUNCTION__); 161 pr_debug("%s\n", __FUNCTION__);
162 162
163 if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags)) {
164 /* SLBs are pre-loaded for context switch, so
165 * we should never get here!
166 */
167 printk("%s: invalid access during switch!\n", __func__);
168 return 1;
169 }
170 slb.esid = (ea & ESID_MASK) | SLB_ESID_V; 163 slb.esid = (ea & ESID_MASK) | SLB_ESID_V;
171 164
172 switch(REGION_ID(ea)) { 165 switch(REGION_ID(ea)) {
@@ -226,11 +219,6 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
226 return 0; 219 return 0;
227 } 220 }
228 221
229 if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags)) {
230 printk("%s: invalid access during switch!\n", __func__);
231 return 1;
232 }
233
234 spu->class_0_pending = 0; 222 spu->class_0_pending = 0;
235 spu->dar = ea; 223 spu->dar = ea;
236 spu->dsisr = dsisr; 224 spu->dsisr = dsisr;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index e6e6559c55ed..6d1228c66c5e 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * SPU file system 3 * SPU file system
3 * 4 *
@@ -592,7 +593,7 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
592 593
593 ret = -EINVAL; 594 ret = -EINVAL;
594 /* check if we are on spufs */ 595 /* check if we are on spufs */
595 if (nd->dentry->d_sb->s_type != &spufs_type) 596 if (nd->path.dentry->d_sb->s_type != &spufs_type)
596 goto out; 597 goto out;
597 598
598 /* don't accept undefined flags */ 599 /* don't accept undefined flags */
@@ -600,9 +601,9 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
600 goto out; 601 goto out;
601 602
602 /* only threads can be underneath a gang */ 603 /* only threads can be underneath a gang */
603 if (nd->dentry != nd->dentry->d_sb->s_root) { 604 if (nd->path.dentry != nd->path.dentry->d_sb->s_root) {
604 if ((flags & SPU_CREATE_GANG) || 605 if ((flags & SPU_CREATE_GANG) ||
605 !SPUFS_I(nd->dentry->d_inode)->i_gang) 606 !SPUFS_I(nd->path.dentry->d_inode)->i_gang)
606 goto out; 607 goto out;
607 } 608 }
608 609
@@ -618,16 +619,17 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
618 mode &= ~current->fs->umask; 619 mode &= ~current->fs->umask;
619 620
620 if (flags & SPU_CREATE_GANG) 621 if (flags & SPU_CREATE_GANG)
621 return spufs_create_gang(nd->dentry->d_inode, 622 return spufs_create_gang(nd->path.dentry->d_inode,
622 dentry, nd->mnt, mode); 623 dentry, nd->path.mnt, mode);
623 else 624 else
624 return spufs_create_context(nd->dentry->d_inode, 625 return spufs_create_context(nd->path.dentry->d_inode,
625 dentry, nd->mnt, flags, mode, filp); 626 dentry, nd->path.mnt, flags, mode,
627 filp);
626 628
627out_dput: 629out_dput:
628 dput(dentry); 630 dput(dentry);
629out_dir: 631out_dir:
630 mutex_unlock(&nd->dentry->d_inode->i_mutex); 632 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
631out: 633out:
632 return ret; 634 return ret;
633} 635}
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index fca22e18069a..6221968c2a3c 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -234,6 +234,7 @@ static int spu_run_fini(struct spu_context *ctx, u32 *npc,
234 *npc = ctx->ops->npc_read(ctx); 234 *npc = ctx->ops->npc_read(ctx);
235 235
236 spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED); 236 spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED);
237 ctx->policy = SCHED_IDLE;
237 spu_release(ctx); 238 spu_release(ctx);
238 239
239 if (signal_pending(current)) 240 if (signal_pending(current))
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 5915343e2599..3a5972117de7 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -856,21 +856,18 @@ static noinline void spusched_tick(struct spu_context *ctx)
856{ 856{
857 struct spu_context *new = NULL; 857 struct spu_context *new = NULL;
858 struct spu *spu = NULL; 858 struct spu *spu = NULL;
859 u32 status;
860 859
861 if (spu_acquire(ctx)) 860 if (spu_acquire(ctx))
862 BUG(); /* a kernel thread never has signals pending */ 861 BUG(); /* a kernel thread never has signals pending */
863 862
864 if (ctx->state != SPU_STATE_RUNNABLE) 863 if (ctx->state != SPU_STATE_RUNNABLE)
865 goto out; 864 goto out;
866 if (spu_stopped(ctx, &status))
867 goto out;
868 if (ctx->flags & SPU_CREATE_NOSCHED) 865 if (ctx->flags & SPU_CREATE_NOSCHED)
869 goto out; 866 goto out;
870 if (ctx->policy == SCHED_FIFO) 867 if (ctx->policy == SCHED_FIFO)
871 goto out; 868 goto out;
872 869
873 if (--ctx->time_slice) 870 if (--ctx->time_slice && ctx->policy != SCHED_IDLE)
874 goto out; 871 goto out;
875 872
876 spu = ctx->spu; 873 spu = ctx->spu;
@@ -880,7 +877,8 @@ static noinline void spusched_tick(struct spu_context *ctx)
880 new = grab_runnable_context(ctx->prio + 1, spu->node); 877 new = grab_runnable_context(ctx->prio + 1, spu->node);
881 if (new) { 878 if (new) {
882 spu_unschedule(spu, ctx); 879 spu_unschedule(spu, ctx);
883 spu_add_to_rq(ctx); 880 if (ctx->policy != SCHED_IDLE)
881 spu_add_to_rq(ctx);
884 } else { 882 } else {
885 spu_context_nospu_trace(spusched_tick__newslice, ctx); 883 spu_context_nospu_trace(spusched_tick__newslice, ctx);
886 ctx->time_slice++; 884 ctx->time_slice++;
diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c
index 2b1953f6f12e..01974f7776e1 100644
--- a/arch/powerpc/platforms/cell/spufs/sputrace.c
+++ b/arch/powerpc/platforms/cell/spufs/sputrace.c
@@ -146,34 +146,28 @@ static void sputrace_log_item(const char *name, struct spu_context *ctx,
146 wake_up(&sputrace_wait); 146 wake_up(&sputrace_wait);
147} 147}
148 148
149static void spu_context_event(const struct marker *mdata, 149static void spu_context_event(void *probe_private, void *call_data,
150 void *private, const char *format, ...) 150 const char *format, va_list *args)
151{ 151{
152 struct spu_probe *p = mdata->private; 152 struct spu_probe *p = probe_private;
153 va_list ap;
154 struct spu_context *ctx; 153 struct spu_context *ctx;
155 struct spu *spu; 154 struct spu *spu;
156 155
157 va_start(ap, format); 156 ctx = va_arg(*args, struct spu_context *);
158 ctx = va_arg(ap, struct spu_context *); 157 spu = va_arg(*args, struct spu *);
159 spu = va_arg(ap, struct spu *);
160 158
161 sputrace_log_item(p->name, ctx, spu); 159 sputrace_log_item(p->name, ctx, spu);
162 va_end(ap);
163} 160}
164 161
165static void spu_context_nospu_event(const struct marker *mdata, 162static void spu_context_nospu_event(void *probe_private, void *call_data,
166 void *private, const char *format, ...) 163 const char *format, va_list *args)
167{ 164{
168 struct spu_probe *p = mdata->private; 165 struct spu_probe *p = probe_private;
169 va_list ap;
170 struct spu_context *ctx; 166 struct spu_context *ctx;
171 167
172 va_start(ap, format); 168 ctx = va_arg(*args, struct spu_context *);
173 ctx = va_arg(ap, struct spu_context *);
174 169
175 sputrace_log_item(p->name, ctx, NULL); 170 sputrace_log_item(p->name, ctx, NULL);
176 va_end(ap);
177} 171}
178 172
179struct spu_probe spu_probes[] = { 173struct spu_probe spu_probes[] = {
@@ -219,10 +213,6 @@ static int __init sputrace_init(void)
219 if (error) 213 if (error)
220 printk(KERN_INFO "Unable to register probe %s\n", 214 printk(KERN_INFO "Unable to register probe %s\n",
221 p->name); 215 p->name);
222
223 error = marker_arm(p->name);
224 if (error)
225 printk(KERN_INFO "Unable to arm probe %s\n", p->name);
226 } 216 }
227 217
228 return 0; 218 return 0;
@@ -238,7 +228,8 @@ static void __exit sputrace_exit(void)
238 int i; 228 int i;
239 229
240 for (i = 0; i < ARRAY_SIZE(spu_probes); i++) 230 for (i = 0; i < ARRAY_SIZE(spu_probes); i++)
241 marker_probe_unregister(spu_probes[i].name); 231 marker_probe_unregister(spu_probes[i].name,
232 spu_probes[i].probe_func, &spu_probes[i]);
242 233
243 remove_proc_entry("sputrace", NULL); 234 remove_proc_entry("sputrace", NULL);
244 kfree(sputrace_log); 235 kfree(sputrace_log);
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 6063c88c26d2..6f5886c7b1f9 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -720,8 +720,9 @@ static inline void set_switch_active(struct spu_state *csa, struct spu *spu)
720 * Restore, Step 23. 720 * Restore, Step 23.
721 * Change the software context switch pending flag 721 * Change the software context switch pending flag
722 * to context switch active. 722 * to context switch active.
723 *
724 * This implementation does not uses a switch active flag.
723 */ 725 */
724 set_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags);
725 clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); 726 clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags);
726 mb(); 727 mb();
727} 728}
@@ -1739,9 +1740,8 @@ static inline void reset_switch_active(struct spu_state *csa, struct spu *spu)
1739{ 1740{
1740 /* Restore, Step 74: 1741 /* Restore, Step 74:
1741 * Reset the "context switch active" flag. 1742 * Reset the "context switch active" flag.
1743 * Not performed by this implementation.
1742 */ 1744 */
1743 clear_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags);
1744 mb();
1745} 1745}
1746 1746
1747static inline void reenable_interrupts(struct spu_state *csa, struct spu *spu) 1747static inline void reenable_interrupts(struct spu_state *csa, struct spu *spu)
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 430404413178..49c87769b1f8 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -73,7 +73,7 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
73 LOOKUP_OPEN|LOOKUP_CREATE, &nd); 73 LOOKUP_OPEN|LOOKUP_CREATE, &nd);
74 if (!ret) { 74 if (!ret) {
75 ret = spufs_create(&nd, flags, mode, neighbor); 75 ret = spufs_create(&nd, flags, mode, neighbor);
76 path_release(&nd); 76 path_put(&nd.path);
77 } 77 }
78 putname(tmp); 78 putname(tmp);
79 } 79 }
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 6c8083757938..429088967813 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -24,7 +24,6 @@ config STORCENTER
24 select MPIC 24 select MPIC
25 select FSL_SOC 25 select FSL_SOC
26 select PPC_UDBG_16550 if SERIAL_8250 26 select PPC_UDBG_16550 if SERIAL_8250
27 select WANT_DEVICE_TREE
28 select MPC10X_OPENPIC 27 select MPC10X_OPENPIC
29 select MPC10X_BRIDGE 28 select MPC10X_BRIDGE
30 help 29 help
@@ -37,7 +36,6 @@ config MPC7448HPC2
37 select TSI108_BRIDGE 36 select TSI108_BRIDGE
38 select DEFAULT_UIMAGE 37 select DEFAULT_UIMAGE
39 select PPC_UDBG_16550 38 select PPC_UDBG_16550
40 select WANT_DEVICE_TREE
41 select TSI108_BRIDGE 39 select TSI108_BRIDGE
42 help 40 help
43 Select MPC7448HPC2 if configuring for Freescale MPC7448HPC2 (Taiga) 41 Select MPC7448HPC2 if configuring for Freescale MPC7448HPC2 (Taiga)
@@ -48,7 +46,6 @@ config PPC_HOLLY
48 depends on EMBEDDED6xx 46 depends on EMBEDDED6xx
49 select TSI108_BRIDGE 47 select TSI108_BRIDGE
50 select PPC_UDBG_16550 48 select PPC_UDBG_16550
51 select WANT_DEVICE_TREE
52 select TSI108_BRIDGE 49 select TSI108_BRIDGE
53 help 50 help
54 Select PPC_HOLLY if configuring for an IBM 750GX/CL Eval 51 Select PPC_HOLLY if configuring for an IBM 750GX/CL Eval
@@ -59,7 +56,6 @@ config PPC_PRPMC2800
59 depends on EMBEDDED6xx 56 depends on EMBEDDED6xx
60 select MV64X60 57 select MV64X60
61 select NOT_COHERENT_CACHE 58 select NOT_COHERENT_CACHE
62 select WANT_DEVICE_TREE
63 help 59 help
64 This option enables support for the Motorola PrPMC2800 board 60 This option enables support for the Motorola PrPMC2800 board
65 61
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
index be06cfd9fa3d..657b72f68493 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -75,7 +75,7 @@ static struct property *new_property(const char *name, int length,
75 return np; 75 return np;
76} 76}
77 77
78static void __init free_property(struct property *np) 78static void free_property(struct property *np)
79{ 79{
80 kfree(np); 80 kfree(np);
81} 81}
diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile
index 8f52d7515793..ce6d789e0741 100644
--- a/arch/powerpc/platforms/pasemi/Makefile
+++ b/arch/powerpc/platforms/pasemi/Makefile
@@ -1,3 +1,3 @@
1obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o dma_lib.o 1obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o dma_lib.o misc.o
2obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o 2obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o
3obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o 3obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o
diff --git a/arch/powerpc/platforms/pasemi/misc.c b/arch/powerpc/platforms/pasemi/misc.c
new file mode 100644
index 000000000000..ded7d152d00c
--- /dev/null
+++ b/arch/powerpc/platforms/pasemi/misc.c
@@ -0,0 +1,97 @@
1/*
2 * Copyright (C) 2007 PA Semi, Inc
3 *
4 * Parts based on arch/powerpc/sysdev/fsl_soc.c:
5 *
6 * 2006 (c) MontaVista Software, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/errno.h>
15#include <linux/kernel.h>
16#include <linux/pci.h>
17#include <linux/of.h>
18#include <linux/i2c.h>
19
20#ifdef CONFIG_I2C_BOARDINFO
21/* The below is from fsl_soc.c. It's copied because since there are no
22 * official bus bindings at this time it doesn't make sense to share across
23 * the platforms, even though they happen to be common.
24 */
25struct i2c_driver_device {
26 char *of_device;
27 char *i2c_driver;
28 char *i2c_type;
29};
30
31static struct i2c_driver_device i2c_devices[] __initdata = {
32 {"dallas,ds1338", "rtc-ds1307", "ds1338"},
33};
34
35static int __init find_i2c_driver(struct device_node *node,
36 struct i2c_board_info *info)
37{
38 int i;
39
40 for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
41 if (!of_device_is_compatible(node, i2c_devices[i].of_device))
42 continue;
43 if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver,
44 KOBJ_NAME_LEN) >= KOBJ_NAME_LEN ||
45 strlcpy(info->type, i2c_devices[i].i2c_type,
46 I2C_NAME_SIZE) >= I2C_NAME_SIZE)
47 return -ENOMEM;
48 return 0;
49 }
50 return -ENODEV;
51}
52
53static int __init pasemi_register_i2c_devices(void)
54{
55 struct pci_dev *pdev;
56 struct device_node *adap_node;
57 struct device_node *node;
58
59 pdev = NULL;
60 while ((pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa003, pdev))) {
61 adap_node = pci_device_to_OF_node(pdev);
62
63 if (!adap_node)
64 continue;
65
66 node = NULL;
67 while ((node = of_get_next_child(adap_node, node))) {
68 struct i2c_board_info info = {};
69 const u32 *addr;
70 int len;
71
72 addr = of_get_property(node, "reg", &len);
73 if (!addr || len < sizeof(int) ||
74 *addr > (1 << 10) - 1) {
75 printk(KERN_WARNING
76 "pasemi_register_i2c_devices: "
77 "invalid i2c device entry\n");
78 continue;
79 }
80
81 info.irq = irq_of_parse_and_map(node, 0);
82 if (info.irq == NO_IRQ)
83 info.irq = -1;
84
85 if (find_i2c_driver(node, &info) < 0)
86 continue;
87
88 info.addr = *addr;
89
90 i2c_register_board_info(PCI_FUNC(pdev->devfn), &info,
91 1);
92 }
93 }
94 return 0;
95}
96device_initcall(pasemi_register_i2c_devices);
97#endif
diff --git a/arch/powerpc/platforms/pseries/power.c b/arch/powerpc/platforms/pseries/power.c
index e95fc1594c84..6d6266236446 100644
--- a/arch/powerpc/platforms/pseries/power.c
+++ b/arch/powerpc/platforms/pseries/power.c
@@ -75,7 +75,7 @@ core_initcall(pm_init);
75#else 75#else
76static int __init apo_pm_init(void) 76static int __init apo_pm_init(void)
77{ 77{
78 return (sysfs_create_file(power_kobj, &auto_poweron_attr)); 78 return (sysfs_create_file(power_kobj, &auto_poweron_attr.attr));
79} 79}
80__initcall(apo_pm_init); 80__initcall(apo_pm_init);
81#endif 81#endif
diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c
index d6bfda30ac87..33cbfb22ce3e 100644
--- a/arch/powerpc/sysdev/mpic_pasemi_msi.c
+++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c
@@ -95,7 +95,6 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
95 unsigned int virq; 95 unsigned int virq;
96 struct msi_desc *entry; 96 struct msi_desc *entry;
97 struct msi_msg msg; 97 struct msi_msg msg;
98 u64 addr;
99 98
100 pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n", 99 pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n",
101 pdev, nvec, type); 100 pdev, nvec, type);
@@ -132,8 +131,8 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
132 set_irq_chip(virq, &mpic_pasemi_msi_chip); 131 set_irq_chip(virq, &mpic_pasemi_msi_chip);
133 set_irq_type(virq, IRQ_TYPE_EDGE_RISING); 132 set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
134 133
135 pr_debug("pasemi_msi: allocated virq 0x%x (hw 0x%lx) addr 0x%lx\n", 134 pr_debug("pasemi_msi: allocated virq 0x%x (hw 0x%lx) addr 0x%x\n",
136 virq, hwirq, addr); 135 virq, hwirq, msg.address_lo);
137 136
138 /* Likewise, the device writes [0...511] into the target 137 /* Likewise, the device writes [0...511] into the target
139 * register to generate MSI [512...1023] 138 * register to generate MSI [512...1023]
diff --git a/arch/ppc/platforms/4xx/ibm440ep.c b/arch/ppc/platforms/4xx/ibm440ep.c
index 1fed6638c81f..0de91532aabb 100644
--- a/arch/ppc/platforms/4xx/ibm440ep.c
+++ b/arch/ppc/platforms/4xx/ibm440ep.c
@@ -172,11 +172,11 @@ struct ocp_def core_ocp[] = {
172/* Polarity and triggering settings for internal interrupt sources */ 172/* Polarity and triggering settings for internal interrupt sources */
173struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = { 173struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
174 { .polarity = 0xffbffe03, 174 { .polarity = 0xffbffe03,
175 .triggering = 0xfffffe00, 175 .triggering = 0x00000000,
176 .ext_irq_mask = 0x000001fc, /* IRQ0 - IRQ6 */ 176 .ext_irq_mask = 0x000001fc, /* IRQ0 - IRQ6 */
177 }, 177 },
178 { .polarity = 0xffffc6ef, 178 { .polarity = 0xffffc6af,
179 .triggering = 0xffffc7ff, 179 .triggering = 0x06000140,
180 .ext_irq_mask = 0x00003800, /* IRQ7 - IRQ9 */ 180 .ext_irq_mask = 0x00003800, /* IRQ7 - IRQ9 */
181 }, 181 },
182}; 182};
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 92a4f7b4323a..b21444b681b6 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -100,7 +100,8 @@ config NR_CPUS
100 int "Maximum number of CPUs (2-64)" 100 int "Maximum number of CPUs (2-64)"
101 range 2 64 101 range 2 64
102 depends on SMP 102 depends on SMP
103 default "32" 103 default "32" if !64BIT
104 default "64" if 64BIT
104 help 105 help
105 This allows you to specify the maximum number of CPUs which this 106 This allows you to specify the maximum number of CPUs which this
106 kernel will support. The maximum supported value is 64 and the 107 kernel will support. The maximum supported value is 64 and the
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index a6a4729e0e94..1c59ec161cf8 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -114,24 +114,27 @@ extern void s390_handle_mcck(void);
114static void default_idle(void) 114static void default_idle(void)
115{ 115{
116 int cpu, rc; 116 int cpu, rc;
117 int nr_calls = 0;
118 void *hcpu;
117#ifdef CONFIG_SMP 119#ifdef CONFIG_SMP
118 struct s390_idle_data *idle; 120 struct s390_idle_data *idle;
119#endif 121#endif
120 122
121 /* CPU is going idle. */ 123 /* CPU is going idle. */
122 cpu = smp_processor_id(); 124 cpu = smp_processor_id();
123 125 hcpu = (void *)(long)cpu;
124 local_irq_disable(); 126 local_irq_disable();
125 if (need_resched()) { 127 if (need_resched()) {
126 local_irq_enable(); 128 local_irq_enable();
127 return; 129 return;
128 } 130 }
129 131
130 rc = atomic_notifier_call_chain(&idle_chain, 132 rc = __atomic_notifier_call_chain(&idle_chain, S390_CPU_IDLE, hcpu, -1,
131 S390_CPU_IDLE, (void *)(long) cpu); 133 &nr_calls);
132 if (rc != NOTIFY_OK && rc != NOTIFY_DONE) 134 if (rc == NOTIFY_BAD) {
133 BUG(); 135 nr_calls--;
134 if (rc != NOTIFY_OK) { 136 __atomic_notifier_call_chain(&idle_chain, S390_CPU_NOT_IDLE,
137 hcpu, nr_calls, NULL);
135 local_irq_enable(); 138 local_irq_enable();
136 return; 139 return;
137 } 140 }
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 85060659fb12..818bd09c0260 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -626,13 +626,17 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
626 if (!lowcore) 626 if (!lowcore)
627 return -ENOMEM; 627 return -ENOMEM;
628 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER); 628 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
629 if (!async_stack)
630 goto out_async_stack;
631 panic_stack = __get_free_page(GFP_KERNEL); 629 panic_stack = __get_free_page(GFP_KERNEL);
632 if (!panic_stack) 630 if (!panic_stack || !async_stack)
633 goto out_panic_stack; 631 goto out;
634 632 /*
635 *lowcore = S390_lowcore; 633 * Only need to copy the first 512 bytes from address 0. But since
634 * the compiler emits a warning if src == NULL for memcpy use copy_page
635 * instead. Copies more than needed but this code is not performance
636 * critical.
637 */
638 copy_page(lowcore, &S390_lowcore);
639 memset((void *)lowcore + 512, 0, sizeof(*lowcore) - 512);
636 lowcore->async_stack = async_stack + ASYNC_SIZE; 640 lowcore->async_stack = async_stack + ASYNC_SIZE;
637 lowcore->panic_stack = panic_stack + PAGE_SIZE; 641 lowcore->panic_stack = panic_stack + PAGE_SIZE;
638 642
@@ -653,9 +657,8 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
653out_save_area: 657out_save_area:
654 free_page(panic_stack); 658 free_page(panic_stack);
655#endif 659#endif
656out_panic_stack: 660out:
657 free_pages(async_stack, ASYNC_ORDER); 661 free_pages(async_stack, ASYNC_ORDER);
658out_async_stack:
659 free_pages((unsigned long) lowcore, lc_order); 662 free_pages((unsigned long) lowcore, lc_order);
660 return -ENOMEM; 663 return -ENOMEM;
661} 664}
@@ -719,8 +722,8 @@ int __cpuinit __cpu_up(unsigned int cpu)
719 cpu_lowcore->percpu_offset = __per_cpu_offset[cpu]; 722 cpu_lowcore->percpu_offset = __per_cpu_offset[cpu];
720 cpu_lowcore->current_task = (unsigned long) idle; 723 cpu_lowcore->current_task = (unsigned long) idle;
721 cpu_lowcore->cpu_data.cpu_nr = cpu; 724 cpu_lowcore->cpu_data.cpu_nr = cpu;
722 cpu_lowcore->softirq_pending = 0; 725 cpu_lowcore->kernel_asce = S390_lowcore.kernel_asce;
723 cpu_lowcore->ext_call_fast = 0; 726 cpu_lowcore->ipl_device = S390_lowcore.ipl_device;
724 eieio(); 727 eieio();
725 728
726 while (signal_processor(cpu, sigp_restart) == sigp_busy) 729 while (signal_processor(cpu, sigp_restart) == sigp_busy)
@@ -797,23 +800,43 @@ void cpu_die(void)
797 800
798void __init smp_prepare_cpus(unsigned int max_cpus) 801void __init smp_prepare_cpus(unsigned int max_cpus)
799{ 802{
803#ifndef CONFIG_64BIT
804 unsigned long save_area = 0;
805#endif
806 unsigned long async_stack, panic_stack;
807 struct _lowcore *lowcore;
800 unsigned int cpu; 808 unsigned int cpu;
809 int lc_order;
801 810
802 smp_detect_cpus(); 811 smp_detect_cpus();
803 812
804 /* request the 0x1201 emergency signal external interrupt */ 813 /* request the 0x1201 emergency signal external interrupt */
805 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) 814 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0)
806 panic("Couldn't request external interrupt 0x1201"); 815 panic("Couldn't request external interrupt 0x1201");
807 memset(lowcore_ptr, 0, sizeof(lowcore_ptr));
808 print_cpu_info(&S390_lowcore.cpu_data); 816 print_cpu_info(&S390_lowcore.cpu_data);
809 smp_alloc_lowcore(smp_processor_id());
810 817
818 /* Reallocate current lowcore, but keep its contents. */
819 lc_order = sizeof(long) == 8 ? 1 : 0;
820 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
821 panic_stack = __get_free_page(GFP_KERNEL);
822 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
811#ifndef CONFIG_64BIT 823#ifndef CONFIG_64BIT
812 if (MACHINE_HAS_IEEE) 824 if (MACHINE_HAS_IEEE)
813 ctl_set_bit(14, 29); /* enable extended save area */ 825 save_area = get_zeroed_page(GFP_KERNEL);
814#endif 826#endif
815 set_prefix((u32)(unsigned long) lowcore_ptr[smp_processor_id()]); 827 local_irq_disable();
816 828 local_mcck_disable();
829 lowcore_ptr[smp_processor_id()] = lowcore;
830 *lowcore = S390_lowcore;
831 lowcore->panic_stack = panic_stack + PAGE_SIZE;
832 lowcore->async_stack = async_stack + ASYNC_SIZE;
833#ifndef CONFIG_64BIT
834 if (MACHINE_HAS_IEEE)
835 lowcore->extended_save_area_addr = (u32) save_area;
836#endif
837 set_prefix((u32)(unsigned long) lowcore);
838 local_mcck_enable();
839 local_irq_enable();
817 for_each_possible_cpu(cpu) 840 for_each_possible_cpu(cpu)
818 if (cpu != smp_processor_id()) 841 if (cpu != smp_processor_id())
819 smp_create_idle(cpu); 842 smp_create_idle(cpu);
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 3bbac1293be4..76a5dd1b4ce9 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -744,7 +744,6 @@ static void etr_adjust_time(unsigned long long clock, unsigned long long delay)
744 } 744 }
745} 745}
746 746
747#ifdef CONFIG_SMP
748static void etr_sync_cpu_start(void *dummy) 747static void etr_sync_cpu_start(void *dummy)
749{ 748{
750 int *in_sync = dummy; 749 int *in_sync = dummy;
@@ -777,7 +776,6 @@ static void etr_sync_cpu_start(void *dummy)
777static void etr_sync_cpu_end(void *dummy) 776static void etr_sync_cpu_end(void *dummy)
778{ 777{
779} 778}
780#endif /* CONFIG_SMP */
781 779
782/* 780/*
783 * Sync the TOD clock using the port refered to by aibp. This port 781 * Sync the TOD clock using the port refered to by aibp. This port
diff --git a/arch/s390/lib/uaccess_std.c b/arch/s390/lib/uaccess_std.c
index 28c4500a58d0..d2ffbadb51a7 100644
--- a/arch/s390/lib/uaccess_std.c
+++ b/arch/s390/lib/uaccess_std.c
@@ -293,10 +293,10 @@ int futex_atomic_cmpxchg_std(int __user *uaddr, int oldval, int newval)
293 293
294 asm volatile( 294 asm volatile(
295 " sacf 256\n" 295 " sacf 256\n"
296 " cs %1,%4,0(%5)\n" 296 "0: cs %1,%4,0(%5)\n"
297 "0: lr %0,%1\n" 297 "1: lr %0,%1\n"
298 "1: sacf 0\n" 298 "2: sacf 0\n"
299 EX_TABLE(0b,1b) 299 EX_TABLE(0b,2b) EX_TABLE(1b,2b)
300 : "=d" (ret), "+d" (oldval), "=m" (*uaddr) 300 : "=d" (ret), "+d" (oldval), "=m" (*uaddr)
301 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr) 301 : "0" (-EFAULT), "d" (newval), "a" (uaddr), "m" (*uaddr)
302 : "cc", "memory" ); 302 : "cc", "memory" );
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index d87d4bf88803..b3400b5ad5c6 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -93,6 +93,9 @@ config ARCH_NO_VIRT_TO_BUS
93config ARCH_SUPPORTS_AOUT 93config ARCH_SUPPORTS_AOUT
94 def_bool y 94 def_bool y
95 95
96config IO_TRAPPED
97 bool
98
96source "init/Kconfig" 99source "init/Kconfig"
97 100
98menu "System type" 101menu "System type"
@@ -312,6 +315,13 @@ config CPU_SUBTYPE_SH7722
312 select ARCH_SPARSEMEM_ENABLE 315 select ARCH_SPARSEMEM_ENABLE
313 select SYS_SUPPORTS_NUMA 316 select SYS_SUPPORTS_NUMA
314 317
318config CPU_SUBTYPE_SH7366
319 bool "Support SH7366 processor"
320 select CPU_SH4AL_DSP
321 select CPU_SHX2
322 select ARCH_SPARSEMEM_ENABLE
323 select SYS_SUPPORTS_NUMA
324
315# SH-5 Processor Support 325# SH-5 Processor Support
316 326
317config CPU_SUBTYPE_SH5_101 327config CPU_SUBTYPE_SH5_101
@@ -456,6 +466,7 @@ config SH_RTS7751R2D
456 bool "RTS7751R2D" 466 bool "RTS7751R2D"
457 depends on CPU_SUBTYPE_SH7751R 467 depends on CPU_SUBTYPE_SH7751R
458 select SYS_SUPPORTS_PCI 468 select SYS_SUPPORTS_PCI
469 select IO_TRAPPED
459 help 470 help
460 Select RTS7751R2D if configuring for a Renesas Technology 471 Select RTS7751R2D if configuring for a Renesas Technology
461 Sales SH-Graphics board. 472 Sales SH-Graphics board.
@@ -472,6 +483,14 @@ config SH_HIGHLANDER
472 bool "Highlander" 483 bool "Highlander"
473 depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785 484 depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
474 select SYS_SUPPORTS_PCI 485 select SYS_SUPPORTS_PCI
486 select IO_TRAPPED
487
488config SH_MIGOR
489 bool "Migo-R"
490 depends on CPU_SUBTYPE_SH7722
491 help
492 Select Migo-R if configuring for the SH7722 Migo-R platform
493 by Renesas System Solutions Asia Pte. Ltd.
475 494
476config SH_EDOSK7705 495config SH_EDOSK7705
477 bool "EDOSK7705" 496 bool "EDOSK7705"
diff --git a/arch/sh/Kconfig.cpu b/arch/sh/Kconfig.cpu
index d850184d0694..0e27fe3b182b 100644
--- a/arch/sh/Kconfig.cpu
+++ b/arch/sh/Kconfig.cpu
@@ -12,6 +12,7 @@ config CPU_LITTLE_ENDIAN
12 12
13config CPU_BIG_ENDIAN 13config CPU_BIG_ENDIAN
14 bool "Big Endian" 14 bool "Big Endian"
15 depends on !CPU_SH5
15 16
16endchoice 17endchoice
17 18
@@ -87,9 +88,6 @@ config SH64_ID2815_WORKAROUND
87config CPU_HAS_INTEVT 88config CPU_HAS_INTEVT
88 bool 89 bool
89 90
90config CPU_HAS_MASKREG_IRQ
91 bool
92
93config CPU_HAS_IPR_IRQ 91config CPU_HAS_IPR_IRQ
94 bool 92 bool
95 93
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index f7c716166ce8..5dcb74b947a9 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -29,7 +29,8 @@ config EARLY_SCIF_CONSOLE
29config EARLY_SCIF_CONSOLE_PORT 29config EARLY_SCIF_CONSOLE_PORT
30 hex 30 hex
31 depends on EARLY_SCIF_CONSOLE 31 depends on EARLY_SCIF_CONSOLE
32 default "0xffe00000" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7763 32 default "0xffe00000" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7763
33 default "0xffe00000" if CPU_SUBTYPE_SH7722 || CPU_SUBTYPE_SH7366
33 default "0xffea0000" if CPU_SUBTYPE_SH7785 34 default "0xffea0000" if CPU_SUBTYPE_SH7785
34 default "0xfffe8000" if CPU_SUBTYPE_SH7203 35 default "0xfffe8000" if CPU_SUBTYPE_SH7203
35 default "0xfffe9800" if CPU_SUBTYPE_SH7206 || CPU_SUBTYPE_SH7263 36 default "0xfffe9800" if CPU_SUBTYPE_SH7206 || CPU_SUBTYPE_SH7263
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 17fc36186bf4..81381e5773c8 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -116,6 +116,7 @@ machdir-$(CONFIG_SH_RTS7751R2D) += renesas/rts7751r2d
116machdir-$(CONFIG_SH_7751_SYSTEMH) += renesas/systemh 116machdir-$(CONFIG_SH_7751_SYSTEMH) += renesas/systemh
117machdir-$(CONFIG_SH_EDOSK7705) += renesas/edosk7705 117machdir-$(CONFIG_SH_EDOSK7705) += renesas/edosk7705
118machdir-$(CONFIG_SH_HIGHLANDER) += renesas/r7780rp 118machdir-$(CONFIG_SH_HIGHLANDER) += renesas/r7780rp
119machdir-$(CONFIG_SH_MIGOR) += renesas/migor
119machdir-$(CONFIG_SH_SDK7780) += renesas/sdk7780 120machdir-$(CONFIG_SH_SDK7780) += renesas/sdk7780
120machdir-$(CONFIG_SH_7710VOIPGW) += renesas/sh7710voipgw 121machdir-$(CONFIG_SH_7710VOIPGW) += renesas/sh7710voipgw
121machdir-$(CONFIG_SH_X3PROTO) += renesas/x3proto 122machdir-$(CONFIG_SH_X3PROTO) += renesas/x3proto
diff --git a/arch/sh/boards/renesas/migor/Makefile b/arch/sh/boards/renesas/migor/Makefile
new file mode 100644
index 000000000000..77037567633b
--- /dev/null
+++ b/arch/sh/boards/renesas/migor/Makefile
@@ -0,0 +1 @@
obj-y := setup.o
diff --git a/arch/sh/boards/renesas/migor/setup.c b/arch/sh/boards/renesas/migor/setup.c
new file mode 100644
index 000000000000..21ab8c8fb590
--- /dev/null
+++ b/arch/sh/boards/renesas/migor/setup.c
@@ -0,0 +1,61 @@
1/*
2 * Renesas System Solutions Asia Pte. Ltd - Migo-R
3 *
4 * Copyright (C) 2008 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/interrupt.h>
13#include <asm/machvec.h>
14#include <asm/io.h>
15
16/* Address IRQ Size Bus Description
17 * 0x00000000 64MB 16 NOR Flash (SP29PL256N)
18 * 0x0c000000 64MB 64 SDRAM (2xK4M563233G)
19 * 0x10000000 IRQ0 16 Ethernet (SMC91C111)
20 * 0x14000000 IRQ4 16 USB 2.0 Host Controller (M66596)
21 * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A)
22 */
23
24static struct resource smc91x_eth_resources[] = {
25 [0] = {
26 .name = "smc91x-regs" ,
27 .start = P2SEGADDR(0x10000300),
28 .end = P2SEGADDR(0x1000030f),
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .start = 32, /* IRQ0 */
33 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
34 },
35};
36
37static struct platform_device smc91x_eth_device = {
38 .name = "smc91x",
39 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
40 .resource = smc91x_eth_resources,
41};
42
43static struct platform_device *migor_devices[] __initdata = {
44 &smc91x_eth_device,
45};
46
47static int __init migor_devices_setup(void)
48{
49 return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
50}
51__initcall(migor_devices_setup);
52
53static void __init migor_setup(char **cmdline_p)
54{
55 ctrl_outw(0x1000, 0xa4050110); /* Enable IRQ0 in PJCR */
56}
57
58static struct sh_machine_vector mv_migor __initmv = {
59 .mv_name = "Migo-R",
60 .mv_setup = migor_setup,
61};
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c
index f7a8d5c9d510..2f68bea7890c 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/renesas/r7780rp/setup.c
@@ -23,6 +23,7 @@
23#include <asm/clock.h> 23#include <asm/clock.h>
24#include <asm/heartbeat.h> 24#include <asm/heartbeat.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/io_trapped.h>
26 27
27static struct resource r8a66597_usb_host_resources[] = { 28static struct resource r8a66597_usb_host_resources[] = {
28 [0] = { 29 [0] = {
@@ -181,13 +182,27 @@ static struct platform_device *r7780rp_devices[] __initdata = {
181 &m66592_usb_peripheral_device, 182 &m66592_usb_peripheral_device,
182 &heartbeat_device, 183 &heartbeat_device,
183#ifndef CONFIG_SH_R7780RP 184#ifndef CONFIG_SH_R7780RP
184 &cf_ide_device,
185 &ax88796_device, 185 &ax88796_device,
186#endif 186#endif
187}; 187};
188 188
189/*
190 * The CF is connected using a 16-bit bus where 8-bit operations are
191 * unsupported. The linux ata driver is however using 8-bit operations, so
192 * insert a trapped io filter to convert 8-bit operations into 16-bit.
193 */
194static struct trapped_io cf_trapped_io = {
195 .resource = cf_ide_resources,
196 .num_resources = 2,
197 .minimum_bus_width = 16,
198};
199
189static int __init r7780rp_devices_setup(void) 200static int __init r7780rp_devices_setup(void)
190{ 201{
202#ifndef CONFIG_SH_R7780RP
203 if (register_trapped_io(&cf_trapped_io) == 0)
204 platform_device_register(&cf_ide_device);
205#endif
191 return platform_add_devices(r7780rp_devices, 206 return platform_add_devices(r7780rp_devices,
192 ARRAY_SIZE(r7780rp_devices)); 207 ARRAY_SIZE(r7780rp_devices));
193} 208}
@@ -226,34 +241,6 @@ static void r7780rp_power_off(void)
226 ctrl_outw(0x0001, PA_POFF); 241 ctrl_outw(0x0001, PA_POFF);
227} 242}
228 243
229static inline unsigned char is_ide_ioaddr(unsigned long addr)
230{
231 return ((cf_ide_resources[0].start <= addr &&
232 addr <= cf_ide_resources[0].end) ||
233 (cf_ide_resources[1].start <= addr &&
234 addr <= cf_ide_resources[1].end));
235}
236
237void highlander_writeb(u8 b, void __iomem *addr)
238{
239 unsigned long tmp = (unsigned long __force)addr;
240
241 if (is_ide_ioaddr(tmp))
242 ctrl_outw((u16)b, tmp);
243 else
244 ctrl_outb(b, tmp);
245}
246
247u8 highlander_readb(void __iomem *addr)
248{
249 unsigned long tmp = (unsigned long __force)addr;
250
251 if (is_ide_ioaddr(tmp))
252 return ctrl_inw(tmp) & 0xff;
253 else
254 return ctrl_inb(tmp);
255}
256
257/* 244/*
258 * Initialize the board 245 * Initialize the board
259 */ 246 */
@@ -338,6 +325,4 @@ static struct sh_machine_vector mv_highlander __initmv = {
338 .mv_setup = highlander_setup, 325 .mv_setup = highlander_setup,
339 .mv_init_irq = highlander_init_irq, 326 .mv_init_irq = highlander_init_irq,
340 .mv_irq_demux = highlander_irq_demux, 327 .mv_irq_demux = highlander_irq_demux,
341 .mv_readb = highlander_readb,
342 .mv_writeb = highlander_writeb,
343}; 328};
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index a0ef81b7de37..f21ee49ef3a5 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -21,6 +21,7 @@
21#include <asm/machvec.h> 21#include <asm/machvec.h>
22#include <asm/rts7751r2d.h> 22#include <asm/rts7751r2d.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/io_trapped.h>
24#include <asm/spi.h> 25#include <asm/spi.h>
25 26
26static struct resource cf_ide_resources[] = { 27static struct resource cf_ide_resources[] = {
@@ -214,13 +215,25 @@ static struct platform_device *rts7751r2d_devices[] __initdata = {
214 &uart_device, 215 &uart_device,
215 &sm501_device, 216 &sm501_device,
216#endif 217#endif
217 &cf_ide_device,
218 &heartbeat_device, 218 &heartbeat_device,
219 &spi_sh_sci_device, 219 &spi_sh_sci_device,
220}; 220};
221 221
222/*
223 * The CF is connected with a 16-bit bus where 8-bit operations are
224 * unsupported. The linux ata driver is however using 8-bit operations, so
225 * insert a trapped io filter to convert 8-bit operations into 16-bit.
226 */
227static struct trapped_io cf_trapped_io = {
228 .resource = cf_ide_resources,
229 .num_resources = 2,
230 .minimum_bus_width = 16,
231};
232
222static int __init rts7751r2d_devices_setup(void) 233static int __init rts7751r2d_devices_setup(void)
223{ 234{
235 if (register_trapped_io(&cf_trapped_io) == 0)
236 platform_device_register(&cf_ide_device);
224 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); 237 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
225 return platform_add_devices(rts7751r2d_devices, 238 return platform_add_devices(rts7751r2d_devices,
226 ARRAY_SIZE(rts7751r2d_devices)); 239 ARRAY_SIZE(rts7751r2d_devices));
@@ -232,34 +245,6 @@ static void rts7751r2d_power_off(void)
232 ctrl_outw(0x0001, PA_POWOFF); 245 ctrl_outw(0x0001, PA_POWOFF);
233} 246}
234 247
235static inline unsigned char is_ide_ioaddr(unsigned long addr)
236{
237 return ((cf_ide_resources[0].start <= addr &&
238 addr <= cf_ide_resources[0].end) ||
239 (cf_ide_resources[1].start <= addr &&
240 addr <= cf_ide_resources[1].end));
241}
242
243void rts7751r2d_writeb(u8 b, void __iomem *addr)
244{
245 unsigned long tmp = (unsigned long __force)addr;
246
247 if (is_ide_ioaddr(tmp))
248 ctrl_outw((u16)b, tmp);
249 else
250 ctrl_outb(b, tmp);
251}
252
253u8 rts7751r2d_readb(void __iomem *addr)
254{
255 unsigned long tmp = (unsigned long __force)addr;
256
257 if (is_ide_ioaddr(tmp))
258 return ctrl_inw(tmp) & 0xff;
259 else
260 return ctrl_inb(tmp);
261}
262
263/* 248/*
264 * Initialize the board 249 * Initialize the board
265 */ 250 */
@@ -310,6 +295,4 @@ static struct sh_machine_vector mv_rts7751r2d __initmv = {
310 .mv_setup = rts7751r2d_setup, 295 .mv_setup = rts7751r2d_setup,
311 .mv_init_irq = init_rts7751r2d_IRQ, 296 .mv_init_irq = init_rts7751r2d_IRQ,
312 .mv_irq_demux = rts7751r2d_irq_demux, 297 .mv_irq_demux = rts7751r2d_irq_demux,
313 .mv_writeb = rts7751r2d_writeb,
314 .mv_readb = rts7751r2d_readb,
315}; 298};
diff --git a/arch/sh/boards/renesas/sdk7780/Kconfig b/arch/sh/boards/renesas/sdk7780/Kconfig
index e4f5b6985be1..065f1df09bf1 100644
--- a/arch/sh/boards/renesas/sdk7780/Kconfig
+++ b/arch/sh/boards/renesas/sdk7780/Kconfig
@@ -4,13 +4,6 @@ choice
4 prompt "SDK7780 options" 4 prompt "SDK7780 options"
5 default SH_SDK7780_BASE 5 default SH_SDK7780_BASE
6 6
7config SH_SDK7780_STANDALONE
8 bool "SDK7780 board support"
9 depends on CPU_SUBTYPE_SH7780
10 help
11 Selecting this option will enable support for the
12 standalone version of the SDK7780. If in doubt, say Y.
13
14config SH_SDK7780_BASE 7config SH_SDK7780_BASE
15 bool "SDK7780 with base-board support" 8 bool "SDK7780 with base-board support"
16 depends on CPU_SUBTYPE_SH7780 9 depends on CPU_SUBTYPE_SH7780
diff --git a/arch/sh/cchips/hd6446x/hd64465/setup.c b/arch/sh/cchips/hd6446x/hd64465/setup.c
index 5cef0db4018b..9b8820c36701 100644
--- a/arch/sh/cchips/hd6446x/hd64465/setup.c
+++ b/arch/sh/cchips/hd6446x/hd64465/setup.c
@@ -17,10 +17,8 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20
21#include <asm/io.h> 20#include <asm/io.h>
22#include <asm/irq.h> 21#include <asm/irq.h>
23
24#include <asm/hd64465/hd64465.h> 22#include <asm/hd64465/hd64465.h>
25 23
26static void disable_hd64465_irq(unsigned int irq) 24static void disable_hd64465_irq(unsigned int irq)
@@ -28,51 +26,45 @@ static void disable_hd64465_irq(unsigned int irq)
28 unsigned short nimr; 26 unsigned short nimr;
29 unsigned short mask = 1 << (irq - HD64465_IRQ_BASE); 27 unsigned short mask = 1 << (irq - HD64465_IRQ_BASE);
30 28
31 pr_debug("disable_hd64465_irq(%d): mask=%x\n", irq, mask); 29 pr_debug("disable_hd64465_irq(%d): mask=%x\n", irq, mask);
32 nimr = inw(HD64465_REG_NIMR); 30 nimr = inw(HD64465_REG_NIMR);
33 nimr |= mask; 31 nimr |= mask;
34 outw(nimr, HD64465_REG_NIMR); 32 outw(nimr, HD64465_REG_NIMR);
35} 33}
36 34
37
38static void enable_hd64465_irq(unsigned int irq) 35static void enable_hd64465_irq(unsigned int irq)
39{ 36{
40 unsigned short nimr; 37 unsigned short nimr;
41 unsigned short mask = 1 << (irq - HD64465_IRQ_BASE); 38 unsigned short mask = 1 << (irq - HD64465_IRQ_BASE);
42 39
43 pr_debug("enable_hd64465_irq(%d): mask=%x\n", irq, mask); 40 pr_debug("enable_hd64465_irq(%d): mask=%x\n", irq, mask);
44 nimr = inw(HD64465_REG_NIMR); 41 nimr = inw(HD64465_REG_NIMR);
45 nimr &= ~mask; 42 nimr &= ~mask;
46 outw(nimr, HD64465_REG_NIMR); 43 outw(nimr, HD64465_REG_NIMR);
47} 44}
48 45
49
50static void mask_and_ack_hd64465(unsigned int irq) 46static void mask_and_ack_hd64465(unsigned int irq)
51{ 47{
52 disable_hd64465_irq(irq); 48 disable_hd64465_irq(irq);
53} 49}
54 50
55
56static void end_hd64465_irq(unsigned int irq) 51static void end_hd64465_irq(unsigned int irq)
57{ 52{
58 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 53 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
59 enable_hd64465_irq(irq); 54 enable_hd64465_irq(irq);
60} 55}
61 56
62
63static unsigned int startup_hd64465_irq(unsigned int irq) 57static unsigned int startup_hd64465_irq(unsigned int irq)
64{ 58{
65 enable_hd64465_irq(irq); 59 enable_hd64465_irq(irq);
66 return 0; 60 return 0;
67} 61}
68 62
69
70static void shutdown_hd64465_irq(unsigned int irq) 63static void shutdown_hd64465_irq(unsigned int irq)
71{ 64{
72 disable_hd64465_irq(irq); 65 disable_hd64465_irq(irq);
73} 66}
74 67
75
76static struct hw_interrupt_type hd64465_irq_type = { 68static struct hw_interrupt_type hd64465_irq_type = {
77 .typename = "HD64465-IRQ", 69 .typename = "HD64465-IRQ",
78 .startup = startup_hd64465_irq, 70 .startup = startup_hd64465_irq,
@@ -83,7 +75,6 @@ static struct hw_interrupt_type hd64465_irq_type = {
83 .end = end_hd64465_irq, 75 .end = end_hd64465_irq,
84}; 76};
85 77
86
87static irqreturn_t hd64465_interrupt(int irq, void *dev_id) 78static irqreturn_t hd64465_interrupt(int irq, void *dev_id)
88{ 79{
89 printk(KERN_INFO 80 printk(KERN_INFO
@@ -93,9 +84,6 @@ static irqreturn_t hd64465_interrupt(int irq, void *dev_id)
93 return IRQ_NONE; 84 return IRQ_NONE;
94} 85}
95 86
96
97/*====================================================*/
98
99/* 87/*
100 * Support for a secondary IRQ demux step. This is necessary 88 * Support for a secondary IRQ demux step. This is necessary
101 * because the HD64465 presents a very thin interface to the 89 * because the HD64465 presents a very thin interface to the
@@ -103,8 +91,7 @@ static irqreturn_t hd64465_interrupt(int irq, void *dev_id)
103 * normally done in hardware by other PCMCIA host bridges is 91 * normally done in hardware by other PCMCIA host bridges is
104 * instead done in software. 92 * instead done in software.
105 */ 93 */
106static struct 94static struct {
107{
108 int (*func)(int, void *); 95 int (*func)(int, void *);
109 void *dev; 96 void *dev;
110} hd64465_demux[HD64465_IRQ_NUM]; 97} hd64465_demux[HD64465_IRQ_NUM];
@@ -112,19 +99,17 @@ static struct
112void hd64465_register_irq_demux(int irq, 99void hd64465_register_irq_demux(int irq,
113 int (*demux)(int irq, void *dev), void *dev) 100 int (*demux)(int irq, void *dev), void *dev)
114{ 101{
115 hd64465_demux[irq - HD64465_IRQ_BASE].func = demux; 102 hd64465_demux[irq - HD64465_IRQ_BASE].func = demux;
116 hd64465_demux[irq - HD64465_IRQ_BASE].dev = dev; 103 hd64465_demux[irq - HD64465_IRQ_BASE].dev = dev;
117} 104}
118EXPORT_SYMBOL(hd64465_register_irq_demux); 105EXPORT_SYMBOL(hd64465_register_irq_demux);
119 106
120void hd64465_unregister_irq_demux(int irq) 107void hd64465_unregister_irq_demux(int irq)
121{ 108{
122 hd64465_demux[irq - HD64465_IRQ_BASE].func = 0; 109 hd64465_demux[irq - HD64465_IRQ_BASE].func = 0;
123} 110}
124EXPORT_SYMBOL(hd64465_unregister_irq_demux); 111EXPORT_SYMBOL(hd64465_unregister_irq_demux);
125 112
126
127
128int hd64465_irq_demux(int irq) 113int hd64465_irq_demux(int irq)
129{ 114{
130 if (irq == CONFIG_HD64465_IRQ) { 115 if (irq == CONFIG_HD64465_IRQ) {
@@ -132,16 +117,16 @@ int hd64465_irq_demux(int irq)
132 unsigned short nirr = inw(HD64465_REG_NIRR); 117 unsigned short nirr = inw(HD64465_REG_NIRR);
133 unsigned short nimr = inw(HD64465_REG_NIMR); 118 unsigned short nimr = inw(HD64465_REG_NIMR);
134 119
135 pr_debug("hd64465_irq_demux, nirr=%04x, nimr=%04x\n", nirr, nimr); 120 pr_debug("hd64465_irq_demux, nirr=%04x, nimr=%04x\n", nirr, nimr);
136 nirr &= ~nimr; 121 nirr &= ~nimr;
137 for (bit = 1, i = 0 ; i < HD64465_IRQ_NUM ; bit <<= 1, i++) 122 for (bit = 1, i = 0 ; i < HD64465_IRQ_NUM ; bit <<= 1, i++)
138 if (nirr & bit) 123 if (nirr & bit)
139 break; 124 break;
140 125
141 if (i < HD64465_IRQ_NUM) { 126 if (i < HD64465_IRQ_NUM) {
142 irq = HD64465_IRQ_BASE + i; 127 irq = HD64465_IRQ_BASE + i;
143 if (hd64465_demux[i].func != 0) 128 if (hd64465_demux[i].func != 0)
144 irq = hd64465_demux[i].func(irq, hd64465_demux[i].dev); 129 irq = hd64465_demux[i].func(irq, hd64465_demux[i].dev);
145 } 130 }
146 } 131 }
147 return irq; 132 return irq;
@@ -154,7 +139,6 @@ static struct irqaction irq0 = {
154 .name = "HD64465", 139 .name = "HD64465",
155}; 140};
156 141
157
158static int __init setup_hd64465(void) 142static int __init setup_hd64465(void)
159{ 143{
160 int i; 144 int i;
@@ -176,8 +160,8 @@ static int __init setup_hd64465(void)
176 160
177 rev = inw(HD64465_REG_SRR); 161 rev = inw(HD64465_REG_SRR);
178 printk(KERN_INFO "HD64465 hardware revision %d.%d\n", (rev >> 8) & 0xff, rev & 0xff); 162 printk(KERN_INFO "HD64465 hardware revision %d.%d\n", (rev >> 8) & 0xff, rev & 0xff);
179 163
180 outw(0xffff, HD64465_REG_NIMR); /* mask all interrupts */ 164 outw(0xffff, HD64465_REG_NIMR); /* mask all interrupts */
181 165
182 for (i = 0; i < HD64465_IRQ_NUM ; i++) { 166 for (i = 0; i < HD64465_IRQ_NUM ; i++) {
183 irq_desc[HD64465_IRQ_BASE + i].chip = &hd64465_irq_type; 167 irq_desc[HD64465_IRQ_BASE + i].chip = &hd64465_irq_type;
@@ -185,16 +169,13 @@ static int __init setup_hd64465(void)
185 169
186 setup_irq(CONFIG_HD64465_IRQ, &irq0); 170 setup_irq(CONFIG_HD64465_IRQ, &irq0);
187 171
188#ifdef CONFIG_SERIAL
189 /* wake up the UART from STANDBY at this point */ 172 /* wake up the UART from STANDBY at this point */
190 smscr = inw(HD64465_REG_SMSCR); 173 smscr = inw(HD64465_REG_SMSCR);
191 outw(smscr & (~HD64465_SMSCR_UARTST), HD64465_REG_SMSCR); 174 outw(smscr & (~HD64465_SMSCR_UARTST), HD64465_REG_SMSCR);
192 175
193 /* remap IO ports for first ISA serial port to HD64465 UART */ 176 /* remap IO ports for first ISA serial port to HD64465 UART */
194 hd64465_port_map(0x3f8, 8, CONFIG_HD64465_IOBASE + 0x8000, 1); 177 hd64465_port_map(0x3f8, 8, CONFIG_HD64465_IOBASE + 0x8000, 1);
195#endif
196 178
197 return 0; 179 return 0;
198} 180}
199
200module_init(setup_hd64465); 181module_init(setup_hd64465);
diff --git a/arch/sh/configs/migor_defconfig b/arch/sh/configs/migor_defconfig
new file mode 100644
index 000000000000..ee5900817f8f
--- /dev/null
+++ b/arch/sh/configs/migor_defconfig
@@ -0,0 +1,824 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24
4# Wed Feb 6 21:52:20 2008
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_TIME=y
16CONFIG_GENERIC_CLOCKEVENTS=y
17CONFIG_SYS_SUPPORTS_NUMA=y
18CONFIG_STACKTRACE_SUPPORT=y
19CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24
25#
26# General setup
27#
28CONFIG_EXPERIMENTAL=y
29CONFIG_BROKEN_ON_SMP=y
30CONFIG_INIT_ENV_ARG_LIMIT=32
31CONFIG_LOCALVERSION=""
32CONFIG_LOCALVERSION_AUTO=y
33CONFIG_SWAP=y
34CONFIG_SYSVIPC=y
35CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set
39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y
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
49CONFIG_SYSFS_DEPRECATED=y
50# CONFIG_RELAY is not set
51CONFIG_BLK_DEV_INITRD=y
52CONFIG_INITRAMFS_SOURCE=""
53# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
54CONFIG_SYSCTL=y
55CONFIG_EMBEDDED=y
56CONFIG_UID16=y
57# CONFIG_SYSCTL_SYSCALL is not set
58CONFIG_KALLSYMS=y
59# CONFIG_KALLSYMS_EXTRA_PASS is not set
60CONFIG_HOTPLUG=y
61CONFIG_PRINTK=y
62CONFIG_BUG=y
63CONFIG_ELF_CORE=y
64CONFIG_BASE_FULL=y
65CONFIG_FUTEX=y
66CONFIG_ANON_INODES=y
67CONFIG_EPOLL=y
68CONFIG_SIGNALFD=y
69CONFIG_EVENTFD=y
70CONFIG_SHMEM=y
71CONFIG_VM_EVENT_COUNTERS=y
72CONFIG_SLAB=y
73# CONFIG_SLUB is not set
74# CONFIG_SLOB is not set
75CONFIG_PROFILING=y
76# CONFIG_MARKERS is not set
77CONFIG_OPROFILE=y
78CONFIG_HAVE_OPROFILE=y
79# CONFIG_HAVE_KPROBES is not set
80CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y
82# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0
84CONFIG_MODULES=y
85# CONFIG_MODULE_UNLOAD is not set
86# CONFIG_MODVERSIONS is not set
87# CONFIG_MODULE_SRCVERSION_ALL is not set
88# CONFIG_KMOD is not set
89CONFIG_BLOCK=y
90# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set
93# CONFIG_BLK_DEV_BSG is not set
94
95#
96# IO Schedulers
97#
98CONFIG_IOSCHED_NOOP=y
99CONFIG_IOSCHED_AS=y
100CONFIG_IOSCHED_DEADLINE=y
101CONFIG_IOSCHED_CFQ=y
102CONFIG_DEFAULT_AS=y
103# CONFIG_DEFAULT_DEADLINE is not set
104# CONFIG_DEFAULT_CFQ is not set
105# CONFIG_DEFAULT_NOOP is not set
106CONFIG_DEFAULT_IOSCHED="anticipatory"
107CONFIG_CLASSIC_RCU=y
108# CONFIG_PREEMPT_RCU is not set
109
110#
111# System type
112#
113CONFIG_CPU_SH4=y
114CONFIG_CPU_SH4A=y
115CONFIG_CPU_SH4AL_DSP=y
116CONFIG_CPU_SHX2=y
117# CONFIG_CPU_SUBTYPE_SH7619 is not set
118# CONFIG_CPU_SUBTYPE_SH7203 is not set
119# CONFIG_CPU_SUBTYPE_SH7206 is not set
120# CONFIG_CPU_SUBTYPE_SH7263 is not set
121# CONFIG_CPU_SUBTYPE_SH7705 is not set
122# CONFIG_CPU_SUBTYPE_SH7706 is not set
123# CONFIG_CPU_SUBTYPE_SH7707 is not set
124# CONFIG_CPU_SUBTYPE_SH7708 is not set
125# CONFIG_CPU_SUBTYPE_SH7709 is not set
126# CONFIG_CPU_SUBTYPE_SH7710 is not set
127# CONFIG_CPU_SUBTYPE_SH7712 is not set
128# CONFIG_CPU_SUBTYPE_SH7720 is not set
129# CONFIG_CPU_SUBTYPE_SH7721 is not set
130# CONFIG_CPU_SUBTYPE_SH7750 is not set
131# CONFIG_CPU_SUBTYPE_SH7091 is not set
132# CONFIG_CPU_SUBTYPE_SH7750R is not set
133# CONFIG_CPU_SUBTYPE_SH7750S is not set
134# CONFIG_CPU_SUBTYPE_SH7751 is not set
135# CONFIG_CPU_SUBTYPE_SH7751R is not set
136# CONFIG_CPU_SUBTYPE_SH7760 is not set
137# CONFIG_CPU_SUBTYPE_SH4_202 is not set
138# CONFIG_CPU_SUBTYPE_SH7763 is not set
139# CONFIG_CPU_SUBTYPE_SH7770 is not set
140# CONFIG_CPU_SUBTYPE_SH7780 is not set
141# CONFIG_CPU_SUBTYPE_SH7785 is not set
142# CONFIG_CPU_SUBTYPE_SHX3 is not set
143# CONFIG_CPU_SUBTYPE_SH7343 is not set
144CONFIG_CPU_SUBTYPE_SH7722=y
145# CONFIG_CPU_SUBTYPE_SH5_101 is not set
146# CONFIG_CPU_SUBTYPE_SH5_103 is not set
147
148#
149# Memory management options
150#
151CONFIG_QUICKLIST=y
152CONFIG_MMU=y
153CONFIG_PAGE_OFFSET=0x80000000
154CONFIG_MEMORY_START=0x0c000000
155CONFIG_MEMORY_SIZE=0x04000000
156CONFIG_29BIT=y
157# CONFIG_X2TLB is not set
158CONFIG_VSYSCALL=y
159CONFIG_NUMA=y
160CONFIG_NODES_SHIFT=1
161CONFIG_ARCH_SPARSEMEM_ENABLE=y
162CONFIG_ARCH_SPARSEMEM_DEFAULT=y
163CONFIG_MAX_ACTIVE_REGIONS=2
164CONFIG_ARCH_POPULATES_NODE_MAP=y
165CONFIG_ARCH_SELECT_MEMORY_MODEL=y
166CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
167CONFIG_PAGE_SIZE_4KB=y
168# CONFIG_PAGE_SIZE_8KB is not set
169# CONFIG_PAGE_SIZE_64KB is not set
170CONFIG_SELECT_MEMORY_MODEL=y
171# CONFIG_FLATMEM_MANUAL is not set
172# CONFIG_DISCONTIGMEM_MANUAL is not set
173CONFIG_SPARSEMEM_MANUAL=y
174CONFIG_SPARSEMEM=y
175CONFIG_NEED_MULTIPLE_NODES=y
176CONFIG_HAVE_MEMORY_PRESENT=y
177CONFIG_SPARSEMEM_STATIC=y
178# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
179# CONFIG_MEMORY_HOTPLUG is not set
180CONFIG_SPLIT_PTLOCK_CPUS=4
181# CONFIG_MIGRATION is not set
182# CONFIG_RESOURCES_64BIT is not set
183CONFIG_ZONE_DMA_FLAG=0
184CONFIG_NR_QUICK=2
185
186#
187# Cache configuration
188#
189# CONFIG_SH_DIRECT_MAPPED is not set
190CONFIG_CACHE_WRITEBACK=y
191# CONFIG_CACHE_WRITETHROUGH is not set
192# CONFIG_CACHE_OFF is not set
193
194#
195# Processor features
196#
197CONFIG_CPU_LITTLE_ENDIAN=y
198# CONFIG_CPU_BIG_ENDIAN is not set
199# CONFIG_SH_FPU_EMU is not set
200CONFIG_SH_DSP=y
201# CONFIG_SH_STORE_QUEUES is not set
202CONFIG_CPU_HAS_INTEVT=y
203CONFIG_CPU_HAS_SR_RB=y
204CONFIG_CPU_HAS_PTEA=y
205CONFIG_CPU_HAS_DSP=y
206
207#
208# Board support
209#
210# CONFIG_SH_7722_SOLUTION_ENGINE is not set
211CONFIG_SH_MIGOR=y
212
213#
214# Timer and clock configuration
215#
216CONFIG_SH_TMU=y
217CONFIG_SH_TIMER_IRQ=16
218CONFIG_SH_PCLK_FREQ=33333333
219# CONFIG_TICK_ONESHOT is not set
220# CONFIG_NO_HZ is not set
221# CONFIG_HIGH_RES_TIMERS is not set
222CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
223
224#
225# CPU Frequency scaling
226#
227# CONFIG_CPU_FREQ is not set
228
229#
230# DMA support
231#
232# CONFIG_SH_DMA is not set
233
234#
235# Companion Chips
236#
237
238#
239# Additional SuperH Device Drivers
240#
241# CONFIG_HEARTBEAT is not set
242# CONFIG_PUSH_SWITCH is not set
243
244#
245# Kernel features
246#
247# CONFIG_HZ_100 is not set
248CONFIG_HZ_250=y
249# CONFIG_HZ_300 is not set
250# CONFIG_HZ_1000 is not set
251CONFIG_HZ=250
252# CONFIG_SCHED_HRTICK is not set
253# CONFIG_KEXEC is not set
254# CONFIG_CRASH_DUMP is not set
255CONFIG_PREEMPT_NONE=y
256# CONFIG_PREEMPT_VOLUNTARY is not set
257# CONFIG_PREEMPT is not set
258CONFIG_RCU_TRACE=y
259CONFIG_GUSA=y
260
261#
262# Boot options
263#
264CONFIG_ZERO_PAGE_OFFSET=0x00001000
265CONFIG_BOOT_LINK_OFFSET=0x00800000
266CONFIG_CMDLINE_BOOL=y
267CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ip=on"
268
269#
270# Bus options
271#
272# CONFIG_ARCH_SUPPORTS_MSI is not set
273# CONFIG_PCCARD is not set
274
275#
276# Executable file formats
277#
278CONFIG_BINFMT_ELF=y
279# CONFIG_BINFMT_MISC is not set
280
281#
282# Networking
283#
284CONFIG_NET=y
285
286#
287# Networking options
288#
289CONFIG_PACKET=y
290# CONFIG_PACKET_MMAP is not set
291CONFIG_UNIX=y
292CONFIG_XFRM=y
293# CONFIG_XFRM_USER is not set
294# CONFIG_XFRM_SUB_POLICY is not set
295# CONFIG_XFRM_MIGRATE is not set
296# CONFIG_XFRM_STATISTICS is not set
297# CONFIG_NET_KEY is not set
298CONFIG_INET=y
299# CONFIG_IP_MULTICAST is not set
300# CONFIG_IP_ADVANCED_ROUTER is not set
301CONFIG_IP_FIB_HASH=y
302CONFIG_IP_PNP=y
303CONFIG_IP_PNP_DHCP=y
304# CONFIG_IP_PNP_BOOTP is not set
305# CONFIG_IP_PNP_RARP is not set
306# CONFIG_NET_IPIP is not set
307# CONFIG_NET_IPGRE is not set
308# CONFIG_ARPD is not set
309# CONFIG_SYN_COOKIES is not set
310# CONFIG_INET_AH is not set
311# CONFIG_INET_ESP is not set
312# CONFIG_INET_IPCOMP is not set
313# CONFIG_INET_XFRM_TUNNEL is not set
314# CONFIG_INET_TUNNEL is not set
315CONFIG_INET_XFRM_MODE_TRANSPORT=y
316CONFIG_INET_XFRM_MODE_TUNNEL=y
317CONFIG_INET_XFRM_MODE_BEET=y
318# CONFIG_INET_LRO is not set
319CONFIG_INET_DIAG=y
320CONFIG_INET_TCP_DIAG=y
321# CONFIG_TCP_CONG_ADVANCED is not set
322CONFIG_TCP_CONG_CUBIC=y
323CONFIG_DEFAULT_TCP_CONG="cubic"
324# CONFIG_TCP_MD5SIG is not set
325# CONFIG_IPV6 is not set
326# CONFIG_INET6_XFRM_TUNNEL is not set
327# CONFIG_INET6_TUNNEL is not set
328# CONFIG_NETWORK_SECMARK is not set
329# CONFIG_NETFILTER is not set
330# CONFIG_IP_DCCP is not set
331# CONFIG_IP_SCTP is not set
332# CONFIG_TIPC is not set
333# CONFIG_ATM is not set
334# CONFIG_BRIDGE is not set
335# CONFIG_VLAN_8021Q is not set
336# CONFIG_DECNET is not set
337# CONFIG_LLC2 is not set
338# CONFIG_IPX is not set
339# CONFIG_ATALK is not set
340# CONFIG_X25 is not set
341# CONFIG_LAPB is not set
342# CONFIG_ECONET is not set
343# CONFIG_WAN_ROUTER is not set
344# CONFIG_NET_SCHED is not set
345
346#
347# Network testing
348#
349# CONFIG_NET_PKTGEN is not set
350# CONFIG_HAMRADIO is not set
351# CONFIG_CAN is not set
352# CONFIG_IRDA is not set
353# CONFIG_BT is not set
354# CONFIG_AF_RXRPC is not set
355
356#
357# Wireless
358#
359# CONFIG_CFG80211 is not set
360CONFIG_WIRELESS_EXT=y
361# CONFIG_MAC80211 is not set
362# CONFIG_IEEE80211 is not set
363# CONFIG_RFKILL is not set
364# CONFIG_NET_9P is not set
365
366#
367# Device Drivers
368#
369
370#
371# Generic Driver Options
372#
373CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
374CONFIG_STANDALONE=y
375CONFIG_PREVENT_FIRMWARE_BUILD=y
376CONFIG_FW_LOADER=m
377# CONFIG_SYS_HYPERVISOR is not set
378# CONFIG_CONNECTOR is not set
379# CONFIG_MTD is not set
380# CONFIG_PARPORT is not set
381CONFIG_BLK_DEV=y
382# CONFIG_BLK_DEV_COW_COMMON is not set
383# CONFIG_BLK_DEV_LOOP is not set
384# CONFIG_BLK_DEV_NBD is not set
385CONFIG_BLK_DEV_RAM=y
386CONFIG_BLK_DEV_RAM_COUNT=16
387CONFIG_BLK_DEV_RAM_SIZE=4096
388CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
389# CONFIG_CDROM_PKTCDVD is not set
390# CONFIG_ATA_OVER_ETH is not set
391CONFIG_MISC_DEVICES=y
392# CONFIG_EEPROM_93CX6 is not set
393# CONFIG_IDE is not set
394
395#
396# SCSI device support
397#
398# CONFIG_RAID_ATTRS is not set
399CONFIG_SCSI=y
400CONFIG_SCSI_DMA=y
401# CONFIG_SCSI_TGT is not set
402# CONFIG_SCSI_NETLINK is not set
403CONFIG_SCSI_PROC_FS=y
404
405#
406# SCSI support type (disk, tape, CD-ROM)
407#
408CONFIG_BLK_DEV_SD=y
409# CONFIG_CHR_DEV_ST is not set
410# CONFIG_CHR_DEV_OSST is not set
411# CONFIG_BLK_DEV_SR is not set
412# CONFIG_CHR_DEV_SG is not set
413# CONFIG_CHR_DEV_SCH is not set
414
415#
416# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
417#
418# CONFIG_SCSI_MULTI_LUN is not set
419# CONFIG_SCSI_CONSTANTS is not set
420# CONFIG_SCSI_LOGGING is not set
421# CONFIG_SCSI_SCAN_ASYNC is not set
422CONFIG_SCSI_WAIT_SCAN=m
423
424#
425# SCSI Transports
426#
427# CONFIG_SCSI_SPI_ATTRS is not set
428# CONFIG_SCSI_FC_ATTRS is not set
429# CONFIG_SCSI_ISCSI_ATTRS is not set
430# CONFIG_SCSI_SAS_LIBSAS is not set
431# CONFIG_SCSI_SRP_ATTRS is not set
432CONFIG_SCSI_LOWLEVEL=y
433# CONFIG_ISCSI_TCP is not set
434# CONFIG_SCSI_DEBUG is not set
435# CONFIG_ATA is not set
436# CONFIG_MD is not set
437CONFIG_NETDEVICES=y
438# CONFIG_NETDEVICES_MULTIQUEUE is not set
439# CONFIG_DUMMY is not set
440# CONFIG_BONDING is not set
441# CONFIG_MACVLAN is not set
442# CONFIG_EQUALIZER is not set
443# CONFIG_TUN is not set
444# CONFIG_VETH is not set
445# CONFIG_PHYLIB is not set
446CONFIG_NET_ETHERNET=y
447CONFIG_MII=y
448# CONFIG_AX88796 is not set
449# CONFIG_STNIC is not set
450CONFIG_SMC91X=y
451# CONFIG_IBM_NEW_EMAC_ZMII is not set
452# CONFIG_IBM_NEW_EMAC_RGMII is not set
453# CONFIG_IBM_NEW_EMAC_TAH is not set
454# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
455# CONFIG_B44 is not set
456# CONFIG_NETDEV_1000 is not set
457# CONFIG_NETDEV_10000 is not set
458
459#
460# Wireless LAN
461#
462# CONFIG_WLAN_PRE80211 is not set
463# CONFIG_WLAN_80211 is not set
464# CONFIG_WAN is not set
465# CONFIG_PPP is not set
466# CONFIG_SLIP is not set
467# CONFIG_NETCONSOLE is not set
468# CONFIG_NETPOLL is not set
469# CONFIG_NET_POLL_CONTROLLER is not set
470# CONFIG_ISDN is not set
471# CONFIG_PHONE is not set
472
473#
474# Input device support
475#
476CONFIG_INPUT=y
477# CONFIG_INPUT_FF_MEMLESS is not set
478# CONFIG_INPUT_POLLDEV is not set
479
480#
481# Userland interfaces
482#
483# CONFIG_INPUT_MOUSEDEV is not set
484# CONFIG_INPUT_JOYDEV is not set
485# CONFIG_INPUT_EVDEV is not set
486# CONFIG_INPUT_EVBUG is not set
487
488#
489# Input Device Drivers
490#
491# CONFIG_INPUT_KEYBOARD is not set
492# CONFIG_INPUT_MOUSE is not set
493# CONFIG_INPUT_JOYSTICK is not set
494# CONFIG_INPUT_TABLET is not set
495# CONFIG_INPUT_TOUCHSCREEN is not set
496# CONFIG_INPUT_MISC is not set
497
498#
499# Hardware I/O ports
500#
501# CONFIG_SERIO is not set
502# CONFIG_GAMEPORT is not set
503
504#
505# Character devices
506#
507CONFIG_VT=y
508CONFIG_VT_CONSOLE=y
509CONFIG_HW_CONSOLE=y
510CONFIG_VT_HW_CONSOLE_BINDING=y
511# CONFIG_SERIAL_NONSTANDARD is not set
512
513#
514# Serial drivers
515#
516# CONFIG_SERIAL_8250 is not set
517
518#
519# Non-8250 serial port support
520#
521CONFIG_SERIAL_SH_SCI=y
522CONFIG_SERIAL_SH_SCI_NR_UARTS=3
523CONFIG_SERIAL_SH_SCI_CONSOLE=y
524CONFIG_SERIAL_CORE=y
525CONFIG_SERIAL_CORE_CONSOLE=y
526CONFIG_UNIX98_PTYS=y
527CONFIG_LEGACY_PTYS=y
528CONFIG_LEGACY_PTY_COUNT=256
529# CONFIG_IPMI_HANDLER is not set
530CONFIG_HW_RANDOM=y
531# CONFIG_R3964 is not set
532# CONFIG_RAW_DRIVER is not set
533# CONFIG_TCG_TPM is not set
534# CONFIG_I2C is not set
535
536#
537# SPI support
538#
539# CONFIG_SPI is not set
540# CONFIG_SPI_MASTER is not set
541# CONFIG_W1 is not set
542# CONFIG_POWER_SUPPLY is not set
543# CONFIG_HWMON is not set
544# CONFIG_WATCHDOG is not set
545
546#
547# Sonics Silicon Backplane
548#
549CONFIG_SSB_POSSIBLE=y
550# CONFIG_SSB is not set
551
552#
553# Multifunction device drivers
554#
555# CONFIG_MFD_SM501 is not set
556
557#
558# Multimedia devices
559#
560# CONFIG_VIDEO_DEV is not set
561# CONFIG_DVB_CORE is not set
562# CONFIG_DAB is not set
563
564#
565# Graphics support
566#
567# CONFIG_VGASTATE is not set
568# CONFIG_VIDEO_OUTPUT_CONTROL is not set
569# CONFIG_FB is not set
570# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
571
572#
573# Display device support
574#
575# CONFIG_DISPLAY_SUPPORT is not set
576
577#
578# Console display driver support
579#
580CONFIG_DUMMY_CONSOLE=y
581
582#
583# Sound
584#
585# CONFIG_SOUND is not set
586CONFIG_HID_SUPPORT=y
587CONFIG_HID=y
588# CONFIG_HID_DEBUG is not set
589# CONFIG_HIDRAW is not set
590CONFIG_USB_SUPPORT=y
591CONFIG_USB_ARCH_HAS_HCD=y
592# CONFIG_USB_ARCH_HAS_OHCI is not set
593# CONFIG_USB_ARCH_HAS_EHCI is not set
594# CONFIG_USB is not set
595
596#
597# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
598#
599CONFIG_USB_GADGET=y
600# CONFIG_USB_GADGET_DEBUG_FILES is not set
601# CONFIG_USB_GADGET_DEBUG_FS is not set
602CONFIG_USB_GADGET_SELECTED=y
603# CONFIG_USB_GADGET_AMD5536UDC is not set
604# CONFIG_USB_GADGET_ATMEL_USBA is not set
605# CONFIG_USB_GADGET_FSL_USB2 is not set
606# CONFIG_USB_GADGET_NET2280 is not set
607# CONFIG_USB_GADGET_PXA2XX is not set
608CONFIG_USB_GADGET_M66592=y
609CONFIG_USB_M66592=y
610CONFIG_SUPERH_BUILT_IN_M66592=y
611# CONFIG_USB_GADGET_GOKU is not set
612# CONFIG_USB_GADGET_LH7A40X is not set
613# CONFIG_USB_GADGET_OMAP is not set
614# CONFIG_USB_GADGET_S3C2410 is not set
615# CONFIG_USB_GADGET_AT91 is not set
616# CONFIG_USB_GADGET_DUMMY_HCD is not set
617CONFIG_USB_GADGET_DUALSPEED=y
618# CONFIG_USB_ZERO is not set
619# CONFIG_USB_ETH is not set
620# CONFIG_USB_GADGETFS is not set
621# CONFIG_USB_FILE_STORAGE is not set
622CONFIG_USB_G_SERIAL=y
623# CONFIG_USB_MIDI_GADGET is not set
624# CONFIG_USB_G_PRINTER is not set
625# CONFIG_MMC is not set
626# CONFIG_NEW_LEDS is not set
627CONFIG_RTC_LIB=y
628CONFIG_RTC_CLASS=y
629CONFIG_RTC_HCTOSYS=y
630CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
631# CONFIG_RTC_DEBUG is not set
632
633#
634# RTC interfaces
635#
636CONFIG_RTC_INTF_SYSFS=y
637CONFIG_RTC_INTF_PROC=y
638CONFIG_RTC_INTF_DEV=y
639# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
640# CONFIG_RTC_DRV_TEST is not set
641
642#
643# SPI RTC drivers
644#
645
646#
647# Platform RTC drivers
648#
649# CONFIG_RTC_DRV_DS1553 is not set
650# CONFIG_RTC_DRV_STK17TA8 is not set
651# CONFIG_RTC_DRV_DS1742 is not set
652# CONFIG_RTC_DRV_M48T86 is not set
653# CONFIG_RTC_DRV_M48T59 is not set
654# CONFIG_RTC_DRV_V3020 is not set
655
656#
657# on-CPU RTC drivers
658#
659CONFIG_RTC_DRV_SH=y
660
661#
662# Userspace I/O
663#
664# CONFIG_UIO is not set
665
666#
667# File systems
668#
669# CONFIG_EXT2_FS is not set
670# CONFIG_EXT3_FS is not set
671# CONFIG_EXT4DEV_FS is not set
672# CONFIG_REISERFS_FS is not set
673# CONFIG_JFS_FS is not set
674# CONFIG_FS_POSIX_ACL is not set
675# CONFIG_XFS_FS is not set
676# CONFIG_GFS2_FS is not set
677# CONFIG_OCFS2_FS is not set
678# CONFIG_MINIX_FS is not set
679# CONFIG_ROMFS_FS is not set
680# CONFIG_INOTIFY is not set
681# CONFIG_QUOTA is not set
682# CONFIG_DNOTIFY is not set
683# CONFIG_AUTOFS_FS is not set
684# CONFIG_AUTOFS4_FS is not set
685# CONFIG_FUSE_FS is not set
686
687#
688# CD-ROM/DVD Filesystems
689#
690# CONFIG_ISO9660_FS is not set
691# CONFIG_UDF_FS is not set
692
693#
694# DOS/FAT/NT Filesystems
695#
696# CONFIG_MSDOS_FS is not set
697# CONFIG_VFAT_FS is not set
698# CONFIG_NTFS_FS is not set
699
700#
701# Pseudo filesystems
702#
703CONFIG_PROC_FS=y
704CONFIG_PROC_KCORE=y
705CONFIG_PROC_SYSCTL=y
706CONFIG_SYSFS=y
707CONFIG_TMPFS=y
708# CONFIG_TMPFS_POSIX_ACL is not set
709# CONFIG_HUGETLBFS is not set
710# CONFIG_HUGETLB_PAGE is not set
711# CONFIG_CONFIGFS_FS is not set
712
713#
714# Miscellaneous filesystems
715#
716# CONFIG_ADFS_FS is not set
717# CONFIG_AFFS_FS is not set
718# CONFIG_HFS_FS is not set
719# CONFIG_HFSPLUS_FS is not set
720# CONFIG_BEFS_FS is not set
721# CONFIG_BFS_FS is not set
722# CONFIG_EFS_FS is not set
723# CONFIG_CRAMFS is not set
724# CONFIG_VXFS_FS is not set
725# CONFIG_HPFS_FS is not set
726# CONFIG_QNX4FS_FS is not set
727# CONFIG_SYSV_FS is not set
728# CONFIG_UFS_FS is not set
729# CONFIG_NETWORK_FILESYSTEMS is not set
730
731#
732# Partition Types
733#
734# CONFIG_PARTITION_ADVANCED is not set
735CONFIG_MSDOS_PARTITION=y
736# CONFIG_NLS is not set
737# CONFIG_DLM is not set
738
739#
740# Kernel hacking
741#
742CONFIG_TRACE_IRQFLAGS_SUPPORT=y
743# CONFIG_PRINTK_TIME is not set
744CONFIG_ENABLE_WARN_DEPRECATED=y
745CONFIG_ENABLE_MUST_CHECK=y
746# CONFIG_MAGIC_SYSRQ is not set
747# CONFIG_UNUSED_SYMBOLS is not set
748CONFIG_DEBUG_FS=y
749# CONFIG_HEADERS_CHECK is not set
750# CONFIG_DEBUG_KERNEL is not set
751# CONFIG_DEBUG_BUGVERBOSE is not set
752# CONFIG_SAMPLES is not set
753# CONFIG_SH_STANDARD_BIOS is not set
754CONFIG_EARLY_SCIF_CONSOLE=y
755CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe00000
756CONFIG_EARLY_PRINTK=y
757# CONFIG_SH_KGDB is not set
758
759#
760# Security options
761#
762# CONFIG_KEYS is not set
763# CONFIG_SECURITY is not set
764# CONFIG_SECURITY_FILE_CAPABILITIES is not set
765CONFIG_CRYPTO=y
766# CONFIG_CRYPTO_SEQIV is not set
767# CONFIG_CRYPTO_MANAGER is not set
768# CONFIG_CRYPTO_HMAC is not set
769# CONFIG_CRYPTO_XCBC is not set
770# CONFIG_CRYPTO_NULL is not set
771# CONFIG_CRYPTO_MD4 is not set
772# CONFIG_CRYPTO_MD5 is not set
773# CONFIG_CRYPTO_SHA1 is not set
774# CONFIG_CRYPTO_SHA256 is not set
775# CONFIG_CRYPTO_SHA512 is not set
776# CONFIG_CRYPTO_WP512 is not set
777# CONFIG_CRYPTO_TGR192 is not set
778# CONFIG_CRYPTO_GF128MUL is not set
779# CONFIG_CRYPTO_ECB is not set
780# CONFIG_CRYPTO_CBC is not set
781# CONFIG_CRYPTO_PCBC is not set
782# CONFIG_CRYPTO_LRW is not set
783# CONFIG_CRYPTO_XTS is not set
784# CONFIG_CRYPTO_CTR is not set
785# CONFIG_CRYPTO_GCM is not set
786# CONFIG_CRYPTO_CCM is not set
787# CONFIG_CRYPTO_CRYPTD is not set
788# CONFIG_CRYPTO_DES is not set
789# CONFIG_CRYPTO_FCRYPT is not set
790# CONFIG_CRYPTO_BLOWFISH is not set
791# CONFIG_CRYPTO_TWOFISH is not set
792# CONFIG_CRYPTO_SERPENT is not set
793# CONFIG_CRYPTO_AES is not set
794# CONFIG_CRYPTO_CAST5 is not set
795# CONFIG_CRYPTO_CAST6 is not set
796# CONFIG_CRYPTO_TEA is not set
797# CONFIG_CRYPTO_ARC4 is not set
798# CONFIG_CRYPTO_KHAZAD is not set
799# CONFIG_CRYPTO_ANUBIS is not set
800# CONFIG_CRYPTO_SEED is not set
801# CONFIG_CRYPTO_SALSA20 is not set
802# CONFIG_CRYPTO_DEFLATE is not set
803# CONFIG_CRYPTO_MICHAEL_MIC is not set
804# CONFIG_CRYPTO_CRC32C is not set
805# CONFIG_CRYPTO_CAMELLIA is not set
806# CONFIG_CRYPTO_TEST is not set
807# CONFIG_CRYPTO_AUTHENC is not set
808# CONFIG_CRYPTO_LZO is not set
809CONFIG_CRYPTO_HW=y
810
811#
812# Library routines
813#
814CONFIG_BITREVERSE=y
815# CONFIG_CRC_CCITT is not set
816# CONFIG_CRC16 is not set
817# CONFIG_CRC_ITU_T is not set
818CONFIG_CRC32=y
819# CONFIG_CRC7 is not set
820# CONFIG_LIBCRC32C is not set
821CONFIG_PLIST=y
822CONFIG_HAS_IOMEM=y
823CONFIG_HAS_IOPORT=y
824CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/rts7751r2d1_defconfig b/arch/sh/configs/rts7751r2d1_defconfig
index 2dc754e5b733..3a915fd436d9 100644
--- a/arch/sh/configs/rts7751r2d1_defconfig
+++ b/arch/sh/configs/rts7751r2d1_defconfig
@@ -1,9 +1,10 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc2 3# Linux kernel version: 2.6.24
4# Tue Aug 14 18:04:44 2007 4# Thu Feb 7 16:25:55 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y 9CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y 10CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -36,9 +37,14 @@ CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_BSD_PROCESS_ACCT is not set 37# CONFIG_BSD_PROCESS_ACCT is not set
37# CONFIG_TASKSTATS is not set 38# CONFIG_TASKSTATS is not set
38# CONFIG_USER_NS is not set 39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
39# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
40# CONFIG_IKCONFIG is not set 42# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=14 43CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set
45CONFIG_FAIR_GROUP_SCHED=y
46CONFIG_FAIR_USER_SCHED=y
47# CONFIG_FAIR_CGROUP_SCHED is not set
42CONFIG_SYSFS_DEPRECATED=y 48CONFIG_SYSFS_DEPRECATED=y
43# CONFIG_RELAY is not set 49# CONFIG_RELAY is not set
44# CONFIG_BLK_DEV_INITRD is not set 50# CONFIG_BLK_DEV_INITRD is not set
@@ -53,6 +59,7 @@ CONFIG_HOTPLUG=y
53CONFIG_PRINTK=y 59CONFIG_PRINTK=y
54CONFIG_BUG=y 60CONFIG_BUG=y
55CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62CONFIG_COMPAT_BRK=y
56CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y 64CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -65,6 +72,13 @@ CONFIG_VM_EVENT_COUNTERS=y
65CONFIG_SLAB=y 72CONFIG_SLAB=y
66# CONFIG_SLUB is not set 73# CONFIG_SLUB is not set
67# CONFIG_SLOB is not set 74# CONFIG_SLOB is not set
75CONFIG_PROFILING=y
76# CONFIG_MARKERS is not set
77CONFIG_OPROFILE=y
78CONFIG_HAVE_OPROFILE=y
79# CONFIG_HAVE_KPROBES is not set
80CONFIG_PROC_PAGE_MONITOR=y
81CONFIG_SLABINFO=y
68CONFIG_RT_MUTEXES=y 82CONFIG_RT_MUTEXES=y
69# CONFIG_TINY_SHMEM is not set 83# CONFIG_TINY_SHMEM is not set
70CONFIG_BASE_SMALL=0 84CONFIG_BASE_SMALL=0
@@ -91,13 +105,17 @@ CONFIG_DEFAULT_AS=y
91# CONFIG_DEFAULT_CFQ is not set 105# CONFIG_DEFAULT_CFQ is not set
92# CONFIG_DEFAULT_NOOP is not set 106# CONFIG_DEFAULT_NOOP is not set
93CONFIG_DEFAULT_IOSCHED="anticipatory" 107CONFIG_DEFAULT_IOSCHED="anticipatory"
108CONFIG_CLASSIC_RCU=y
109# CONFIG_PREEMPT_RCU is not set
94 110
95# 111#
96# System type 112# System type
97# 113#
98CONFIG_CPU_SH4=y 114CONFIG_CPU_SH4=y
99# CONFIG_CPU_SUBTYPE_SH7619 is not set 115# CONFIG_CPU_SUBTYPE_SH7619 is not set
116# CONFIG_CPU_SUBTYPE_SH7203 is not set
100# CONFIG_CPU_SUBTYPE_SH7206 is not set 117# CONFIG_CPU_SUBTYPE_SH7206 is not set
118# CONFIG_CPU_SUBTYPE_SH7263 is not set
101# CONFIG_CPU_SUBTYPE_SH7705 is not set 119# CONFIG_CPU_SUBTYPE_SH7705 is not set
102# CONFIG_CPU_SUBTYPE_SH7706 is not set 120# CONFIG_CPU_SUBTYPE_SH7706 is not set
103# CONFIG_CPU_SUBTYPE_SH7707 is not set 121# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -105,6 +123,8 @@ CONFIG_CPU_SH4=y
105# CONFIG_CPU_SUBTYPE_SH7709 is not set 123# CONFIG_CPU_SUBTYPE_SH7709 is not set
106# CONFIG_CPU_SUBTYPE_SH7710 is not set 124# CONFIG_CPU_SUBTYPE_SH7710 is not set
107# CONFIG_CPU_SUBTYPE_SH7712 is not set 125# CONFIG_CPU_SUBTYPE_SH7712 is not set
126# CONFIG_CPU_SUBTYPE_SH7720 is not set
127# CONFIG_CPU_SUBTYPE_SH7721 is not set
108# CONFIG_CPU_SUBTYPE_SH7750 is not set 128# CONFIG_CPU_SUBTYPE_SH7750 is not set
109# CONFIG_CPU_SUBTYPE_SH7091 is not set 129# CONFIG_CPU_SUBTYPE_SH7091 is not set
110# CONFIG_CPU_SUBTYPE_SH7750R is not set 130# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -113,14 +133,15 @@ CONFIG_CPU_SH4=y
113CONFIG_CPU_SUBTYPE_SH7751R=y 133CONFIG_CPU_SUBTYPE_SH7751R=y
114# CONFIG_CPU_SUBTYPE_SH7760 is not set 134# CONFIG_CPU_SUBTYPE_SH7760 is not set
115# CONFIG_CPU_SUBTYPE_SH4_202 is not set 135# CONFIG_CPU_SUBTYPE_SH4_202 is not set
116# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 136# CONFIG_CPU_SUBTYPE_SH7763 is not set
117# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
118# CONFIG_CPU_SUBTYPE_SH7770 is not set 137# CONFIG_CPU_SUBTYPE_SH7770 is not set
119# CONFIG_CPU_SUBTYPE_SH7780 is not set 138# CONFIG_CPU_SUBTYPE_SH7780 is not set
120# CONFIG_CPU_SUBTYPE_SH7785 is not set 139# CONFIG_CPU_SUBTYPE_SH7785 is not set
121# CONFIG_CPU_SUBTYPE_SHX3 is not set 140# CONFIG_CPU_SUBTYPE_SHX3 is not set
122# CONFIG_CPU_SUBTYPE_SH7343 is not set 141# CONFIG_CPU_SUBTYPE_SH7343 is not set
123# CONFIG_CPU_SUBTYPE_SH7722 is not set 142# CONFIG_CPU_SUBTYPE_SH7722 is not set
143# CONFIG_CPU_SUBTYPE_SH5_101 is not set
144# CONFIG_CPU_SUBTYPE_SH5_103 is not set
124 145
125# 146#
126# Memory management options 147# Memory management options
@@ -130,6 +151,7 @@ CONFIG_MMU=y
130CONFIG_PAGE_OFFSET=0x80000000 151CONFIG_PAGE_OFFSET=0x80000000
131CONFIG_MEMORY_START=0x0c000000 152CONFIG_MEMORY_START=0x0c000000
132CONFIG_MEMORY_SIZE=0x04000000 153CONFIG_MEMORY_SIZE=0x04000000
154CONFIG_29BIT=y
133CONFIG_VSYSCALL=y 155CONFIG_VSYSCALL=y
134CONFIG_ARCH_FLATMEM_ENABLE=y 156CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_ARCH_SPARSEMEM_ENABLE=y 157CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -147,6 +169,7 @@ CONFIG_FLATMEM_MANUAL=y
147CONFIG_FLATMEM=y 169CONFIG_FLATMEM=y
148CONFIG_FLAT_NODE_MEM_MAP=y 170CONFIG_FLAT_NODE_MEM_MAP=y
149CONFIG_SPARSEMEM_STATIC=y 171CONFIG_SPARSEMEM_STATIC=y
172# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
150CONFIG_SPLIT_PTLOCK_CPUS=4 173CONFIG_SPLIT_PTLOCK_CPUS=4
151# CONFIG_RESOURCES_64BIT is not set 174# CONFIG_RESOURCES_64BIT is not set
152CONFIG_ZONE_DMA_FLAG=0 175CONFIG_ZONE_DMA_FLAG=0
@@ -168,23 +191,22 @@ CONFIG_CPU_LITTLE_ENDIAN=y
168CONFIG_SH_FPU=y 191CONFIG_SH_FPU=y
169# CONFIG_SH_STORE_QUEUES is not set 192# CONFIG_SH_STORE_QUEUES is not set
170CONFIG_CPU_HAS_INTEVT=y 193CONFIG_CPU_HAS_INTEVT=y
171CONFIG_CPU_HAS_INTC_IRQ=y
172CONFIG_CPU_HAS_SR_RB=y 194CONFIG_CPU_HAS_SR_RB=y
173CONFIG_CPU_HAS_PTEA=y 195CONFIG_CPU_HAS_PTEA=y
196CONFIG_CPU_HAS_FPU=y
174 197
175# 198#
176# Board support 199# Board support
177# 200#
178# CONFIG_SH_7751_SYSTEMH is not set 201# CONFIG_SH_7751_SYSTEMH is not set
179# CONFIG_SH_SECUREEDGE5410 is not set 202# CONFIG_SH_SECUREEDGE5410 is not set
180# CONFIG_SH_HS7751RVOIP is not set
181CONFIG_SH_RTS7751R2D=y 203CONFIG_SH_RTS7751R2D=y
182# CONFIG_SH_LANDISK is not set 204# CONFIG_SH_LANDISK is not set
183# CONFIG_SH_TITAN is not set 205# CONFIG_SH_TITAN is not set
184# CONFIG_SH_LBOX_RE2 is not set 206# CONFIG_SH_LBOX_RE2 is not set
185 207
186# 208#
187# RTS7751R2D options 209# RTS7751R2D Board Revision
188# 210#
189# CONFIG_RTS7751R2D_PLUS is not set 211# CONFIG_RTS7751R2D_PLUS is not set
190CONFIG_RTS7751R2D_1=y 212CONFIG_RTS7751R2D_1=y
@@ -198,6 +220,7 @@ CONFIG_SH_PCLK_FREQ=60000000
198# CONFIG_TICK_ONESHOT is not set 220# CONFIG_TICK_ONESHOT is not set
199# CONFIG_NO_HZ is not set 221# CONFIG_NO_HZ is not set
200# CONFIG_HIGH_RES_TIMERS is not set 222# CONFIG_HIGH_RES_TIMERS is not set
223CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
201 224
202# 225#
203# CPU Frequency scaling 226# CPU Frequency scaling
@@ -227,11 +250,15 @@ CONFIG_HZ_250=y
227# CONFIG_HZ_300 is not set 250# CONFIG_HZ_300 is not set
228# CONFIG_HZ_1000 is not set 251# CONFIG_HZ_1000 is not set
229CONFIG_HZ=250 252CONFIG_HZ=250
253# CONFIG_SCHED_HRTICK is not set
230# CONFIG_KEXEC is not set 254# CONFIG_KEXEC is not set
231# CONFIG_CRASH_DUMP is not set 255# CONFIG_CRASH_DUMP is not set
232CONFIG_PREEMPT_NONE=y 256CONFIG_PREEMPT_NONE=y
233# CONFIG_PREEMPT_VOLUNTARY is not set 257# CONFIG_PREEMPT_VOLUNTARY is not set
234# CONFIG_PREEMPT is not set 258# CONFIG_PREEMPT is not set
259CONFIG_RCU_TRACE=y
260CONFIG_GUSA=y
261# CONFIG_GUSA_RB is not set
235 262
236# 263#
237# Boot options 264# Boot options
@@ -250,10 +277,7 @@ CONFIG_SH_PCIDMA_NONCOHERENT=y
250CONFIG_PCI_AUTO=y 277CONFIG_PCI_AUTO=y
251CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 278CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
252# CONFIG_ARCH_SUPPORTS_MSI is not set 279# CONFIG_ARCH_SUPPORTS_MSI is not set
253 280CONFIG_PCI_LEGACY=y
254#
255# PCCARD (PCMCIA/CardBus) support
256#
257# CONFIG_PCCARD is not set 281# CONFIG_PCCARD is not set
258CONFIG_HOTPLUG_PCI=y 282CONFIG_HOTPLUG_PCI=y
259# CONFIG_HOTPLUG_PCI_FAKE is not set 283# CONFIG_HOTPLUG_PCI_FAKE is not set
@@ -281,6 +305,7 @@ CONFIG_XFRM=y
281# CONFIG_XFRM_USER is not set 305# CONFIG_XFRM_USER is not set
282# CONFIG_XFRM_SUB_POLICY is not set 306# CONFIG_XFRM_SUB_POLICY is not set
283# CONFIG_XFRM_MIGRATE is not set 307# CONFIG_XFRM_MIGRATE is not set
308# CONFIG_XFRM_STATISTICS is not set
284# CONFIG_NET_KEY is not set 309# CONFIG_NET_KEY is not set
285CONFIG_INET=y 310CONFIG_INET=y
286# CONFIG_IP_MULTICAST is not set 311# CONFIG_IP_MULTICAST is not set
@@ -299,6 +324,7 @@ CONFIG_IP_FIB_HASH=y
299CONFIG_INET_XFRM_MODE_TRANSPORT=y 324CONFIG_INET_XFRM_MODE_TRANSPORT=y
300CONFIG_INET_XFRM_MODE_TUNNEL=y 325CONFIG_INET_XFRM_MODE_TUNNEL=y
301CONFIG_INET_XFRM_MODE_BEET=y 326CONFIG_INET_XFRM_MODE_BEET=y
327# CONFIG_INET_LRO is not set
302CONFIG_INET_DIAG=y 328CONFIG_INET_DIAG=y
303CONFIG_INET_TCP_DIAG=y 329CONFIG_INET_TCP_DIAG=y
304# CONFIG_TCP_CONG_ADVANCED is not set 330# CONFIG_TCP_CONG_ADVANCED is not set
@@ -324,10 +350,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
324# CONFIG_LAPB is not set 350# CONFIG_LAPB is not set
325# CONFIG_ECONET is not set 351# CONFIG_ECONET is not set
326# CONFIG_WAN_ROUTER is not set 352# CONFIG_WAN_ROUTER is not set
327
328#
329# QoS and/or fair queueing
330#
331# CONFIG_NET_SCHED is not set 353# CONFIG_NET_SCHED is not set
332 354
333# 355#
@@ -335,6 +357,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
335# 357#
336# CONFIG_NET_PKTGEN is not set 358# CONFIG_NET_PKTGEN is not set
337# CONFIG_HAMRADIO is not set 359# CONFIG_HAMRADIO is not set
360# CONFIG_CAN is not set
338# CONFIG_IRDA is not set 361# CONFIG_IRDA is not set
339# CONFIG_BT is not set 362# CONFIG_BT is not set
340# CONFIG_AF_RXRPC is not set 363# CONFIG_AF_RXRPC is not set
@@ -356,6 +379,7 @@ CONFIG_WIRELESS_EXT=y
356# 379#
357# Generic Driver Options 380# Generic Driver Options
358# 381#
382CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
359CONFIG_STANDALONE=y 383CONFIG_STANDALONE=y
360CONFIG_PREVENT_FIRMWARE_BUILD=y 384CONFIG_PREVENT_FIRMWARE_BUILD=y
361CONFIG_FW_LOADER=m 385CONFIG_FW_LOADER=m
@@ -371,6 +395,7 @@ CONFIG_BLK_DEV=y
371# CONFIG_BLK_DEV_LOOP is not set 395# CONFIG_BLK_DEV_LOOP is not set
372# CONFIG_BLK_DEV_NBD is not set 396# CONFIG_BLK_DEV_NBD is not set
373# CONFIG_BLK_DEV_SX8 is not set 397# CONFIG_BLK_DEV_SX8 is not set
398# CONFIG_BLK_DEV_UB is not set
374CONFIG_BLK_DEV_RAM=y 399CONFIG_BLK_DEV_RAM=y
375CONFIG_BLK_DEV_RAM_COUNT=16 400CONFIG_BLK_DEV_RAM_COUNT=16
376CONFIG_BLK_DEV_RAM_SIZE=4096 401CONFIG_BLK_DEV_RAM_SIZE=4096
@@ -420,6 +445,7 @@ CONFIG_SCSI_WAIT_SCAN=m
420# CONFIG_SCSI_FC_ATTRS is not set 445# CONFIG_SCSI_FC_ATTRS is not set
421# CONFIG_SCSI_ISCSI_ATTRS is not set 446# CONFIG_SCSI_ISCSI_ATTRS is not set
422# CONFIG_SCSI_SAS_LIBSAS is not set 447# CONFIG_SCSI_SAS_LIBSAS is not set
448# CONFIG_SCSI_SRP_ATTRS is not set
423CONFIG_SCSI_LOWLEVEL=y 449CONFIG_SCSI_LOWLEVEL=y
424# CONFIG_ISCSI_TCP is not set 450# CONFIG_ISCSI_TCP is not set
425# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 451# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -493,7 +519,9 @@ CONFIG_ATA=y
493# CONFIG_PATA_MPIIX is not set 519# CONFIG_PATA_MPIIX is not set
494# CONFIG_PATA_OLDPIIX is not set 520# CONFIG_PATA_OLDPIIX is not set
495# CONFIG_PATA_NETCELL is not set 521# CONFIG_PATA_NETCELL is not set
522# CONFIG_PATA_NINJA32 is not set
496# CONFIG_PATA_NS87410 is not set 523# CONFIG_PATA_NS87410 is not set
524# CONFIG_PATA_NS87415 is not set
497# CONFIG_PATA_OPTI is not set 525# CONFIG_PATA_OPTI is not set
498# CONFIG_PATA_OPTIDMA is not set 526# CONFIG_PATA_OPTIDMA is not set
499# CONFIG_PATA_PDC_OLD is not set 527# CONFIG_PATA_PDC_OLD is not set
@@ -508,14 +536,7 @@ CONFIG_ATA=y
508# CONFIG_PATA_WINBOND is not set 536# CONFIG_PATA_WINBOND is not set
509CONFIG_PATA_PLATFORM=y 537CONFIG_PATA_PLATFORM=y
510# CONFIG_MD is not set 538# CONFIG_MD is not set
511
512#
513# Fusion MPT device support
514#
515# CONFIG_FUSION is not set 539# CONFIG_FUSION is not set
516# CONFIG_FUSION_SPI is not set
517# CONFIG_FUSION_FC is not set
518# CONFIG_FUSION_SAS is not set
519 540
520# 541#
521# IEEE 1394 (FireWire) support 542# IEEE 1394 (FireWire) support
@@ -530,25 +551,31 @@ CONFIG_NETDEVICES=y
530# CONFIG_MACVLAN is not set 551# CONFIG_MACVLAN is not set
531# CONFIG_EQUALIZER is not set 552# CONFIG_EQUALIZER is not set
532# CONFIG_TUN is not set 553# CONFIG_TUN is not set
554# CONFIG_VETH is not set
533# CONFIG_ARCNET is not set 555# CONFIG_ARCNET is not set
534# CONFIG_PHYLIB is not set 556# CONFIG_PHYLIB is not set
535CONFIG_NET_ETHERNET=y 557CONFIG_NET_ETHERNET=y
536CONFIG_MII=y 558CONFIG_MII=y
559# CONFIG_AX88796 is not set
537# CONFIG_STNIC is not set 560# CONFIG_STNIC is not set
538# CONFIG_HAPPYMEAL is not set 561# CONFIG_HAPPYMEAL is not set
539# CONFIG_SUNGEM is not set 562# CONFIG_SUNGEM is not set
540# CONFIG_CASSINI is not set 563# CONFIG_CASSINI is not set
541# CONFIG_NET_VENDOR_3COM is not set 564# CONFIG_NET_VENDOR_3COM is not set
542# CONFIG_SMC91X is not set 565# CONFIG_SMC91X is not set
566# CONFIG_ENC28J60 is not set
543# CONFIG_NET_TULIP is not set 567# CONFIG_NET_TULIP is not set
544# CONFIG_HP100 is not set 568# CONFIG_HP100 is not set
569# CONFIG_IBM_NEW_EMAC_ZMII is not set
570# CONFIG_IBM_NEW_EMAC_RGMII is not set
571# CONFIG_IBM_NEW_EMAC_TAH is not set
572# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
545CONFIG_NET_PCI=y 573CONFIG_NET_PCI=y
546# CONFIG_PCNET32 is not set 574# CONFIG_PCNET32 is not set
547# CONFIG_AMD8111_ETH is not set 575# CONFIG_AMD8111_ETH is not set
548# CONFIG_ADAPTEC_STARFIRE is not set 576# CONFIG_ADAPTEC_STARFIRE is not set
549# CONFIG_B44 is not set 577# CONFIG_B44 is not set
550# CONFIG_FORCEDETH is not set 578# CONFIG_FORCEDETH is not set
551# CONFIG_DGRS is not set
552# CONFIG_EEPRO100 is not set 579# CONFIG_EEPRO100 is not set
553# CONFIG_E100 is not set 580# CONFIG_E100 is not set
554# CONFIG_FEALNX is not set 581# CONFIG_FEALNX is not set
@@ -560,6 +587,7 @@ CONFIG_8139TOO=y
560# CONFIG_8139TOO_TUNE_TWISTER is not set 587# CONFIG_8139TOO_TUNE_TWISTER is not set
561# CONFIG_8139TOO_8129 is not set 588# CONFIG_8139TOO_8129 is not set
562# CONFIG_8139_OLD_RX_RESET is not set 589# CONFIG_8139_OLD_RX_RESET is not set
590# CONFIG_R6040 is not set
563# CONFIG_SIS900 is not set 591# CONFIG_SIS900 is not set
564# CONFIG_EPIC100 is not set 592# CONFIG_EPIC100 is not set
565# CONFIG_SUNDANCE is not set 593# CONFIG_SUNDANCE is not set
@@ -570,6 +598,10 @@ CONFIG_NETDEV_1000=y
570# CONFIG_ACENIC is not set 598# CONFIG_ACENIC is not set
571# CONFIG_DL2K is not set 599# CONFIG_DL2K is not set
572# CONFIG_E1000 is not set 600# CONFIG_E1000 is not set
601# CONFIG_E1000E is not set
602# CONFIG_E1000E_ENABLED is not set
603# CONFIG_IP1000 is not set
604# CONFIG_IGB is not set
573# CONFIG_NS83820 is not set 605# CONFIG_NS83820 is not set
574# CONFIG_HAMACHI is not set 606# CONFIG_HAMACHI is not set
575# CONFIG_YELLOWFIN is not set 607# CONFIG_YELLOWFIN is not set
@@ -577,6 +609,7 @@ CONFIG_NETDEV_1000=y
577# CONFIG_SIS190 is not set 609# CONFIG_SIS190 is not set
578# CONFIG_SKGE is not set 610# CONFIG_SKGE is not set
579# CONFIG_SKY2 is not set 611# CONFIG_SKY2 is not set
612# CONFIG_SK98LIN is not set
580# CONFIG_VIA_VELOCITY is not set 613# CONFIG_VIA_VELOCITY is not set
581# CONFIG_TIGON3 is not set 614# CONFIG_TIGON3 is not set
582# CONFIG_BNX2 is not set 615# CONFIG_BNX2 is not set
@@ -585,11 +618,15 @@ CONFIG_NETDEV_1000=y
585CONFIG_NETDEV_10000=y 618CONFIG_NETDEV_10000=y
586# CONFIG_CHELSIO_T1 is not set 619# CONFIG_CHELSIO_T1 is not set
587# CONFIG_CHELSIO_T3 is not set 620# CONFIG_CHELSIO_T3 is not set
621# CONFIG_IXGBE is not set
588# CONFIG_IXGB is not set 622# CONFIG_IXGB is not set
589# CONFIG_S2IO is not set 623# CONFIG_S2IO is not set
590# CONFIG_MYRI10GE is not set 624# CONFIG_MYRI10GE is not set
591# CONFIG_NETXEN_NIC is not set 625# CONFIG_NETXEN_NIC is not set
626# CONFIG_NIU is not set
592# CONFIG_MLX4_CORE is not set 627# CONFIG_MLX4_CORE is not set
628# CONFIG_TEHUTI is not set
629# CONFIG_BNX2X is not set
593# CONFIG_TR is not set 630# CONFIG_TR is not set
594 631
595# 632#
@@ -597,13 +634,21 @@ CONFIG_NETDEV_10000=y
597# 634#
598# CONFIG_WLAN_PRE80211 is not set 635# CONFIG_WLAN_PRE80211 is not set
599# CONFIG_WLAN_80211 is not set 636# CONFIG_WLAN_80211 is not set
637
638#
639# USB Network Adapters
640#
641# CONFIG_USB_CATC is not set
642# CONFIG_USB_KAWETH is not set
643# CONFIG_USB_PEGASUS is not set
644# CONFIG_USB_RTL8150 is not set
645# CONFIG_USB_USBNET is not set
600# CONFIG_WAN is not set 646# CONFIG_WAN is not set
601# CONFIG_FDDI is not set 647# CONFIG_FDDI is not set
602# CONFIG_HIPPI is not set 648# CONFIG_HIPPI is not set
603# CONFIG_PPP is not set 649# CONFIG_PPP is not set
604# CONFIG_SLIP is not set 650# CONFIG_SLIP is not set
605# CONFIG_NET_FC is not set 651# CONFIG_NET_FC is not set
606# CONFIG_SHAPER is not set
607# CONFIG_NETCONSOLE is not set 652# CONFIG_NETCONSOLE is not set
608# CONFIG_NETPOLL is not set 653# CONFIG_NETPOLL is not set
609# CONFIG_NET_POLL_CONTROLLER is not set 654# CONFIG_NET_POLL_CONTROLLER is not set
@@ -622,7 +667,6 @@ CONFIG_INPUT=y
622# 667#
623# CONFIG_INPUT_MOUSEDEV is not set 668# CONFIG_INPUT_MOUSEDEV is not set
624# CONFIG_INPUT_JOYDEV is not set 669# CONFIG_INPUT_JOYDEV is not set
625# CONFIG_INPUT_TSDEV is not set
626# CONFIG_INPUT_EVDEV is not set 670# CONFIG_INPUT_EVDEV is not set
627# CONFIG_INPUT_EVBUG is not set 671# CONFIG_INPUT_EVBUG is not set
628 672
@@ -650,6 +694,7 @@ CONFIG_VT_CONSOLE=y
650CONFIG_HW_CONSOLE=y 694CONFIG_HW_CONSOLE=y
651CONFIG_VT_HW_CONSOLE_BINDING=y 695CONFIG_VT_HW_CONSOLE_BINDING=y
652# CONFIG_SERIAL_NONSTANDARD is not set 696# CONFIG_SERIAL_NONSTANDARD is not set
697# CONFIG_NOZOMI is not set
653 698
654# 699#
655# Serial drivers 700# Serial drivers
@@ -674,11 +719,9 @@ CONFIG_UNIX98_PTYS=y
674CONFIG_LEGACY_PTYS=y 719CONFIG_LEGACY_PTYS=y
675CONFIG_LEGACY_PTY_COUNT=256 720CONFIG_LEGACY_PTY_COUNT=256
676# CONFIG_IPMI_HANDLER is not set 721# CONFIG_IPMI_HANDLER is not set
677# CONFIG_WATCHDOG is not set
678CONFIG_HW_RANDOM=y 722CONFIG_HW_RANDOM=y
679# CONFIG_R3964 is not set 723# CONFIG_R3964 is not set
680# CONFIG_APPLICOM is not set 724# CONFIG_APPLICOM is not set
681# CONFIG_DRM is not set
682# CONFIG_RAW_DRIVER is not set 725# CONFIG_RAW_DRIVER is not set
683# CONFIG_TCG_TPM is not set 726# CONFIG_TCG_TPM is not set
684CONFIG_DEVPORT=y 727CONFIG_DEVPORT=y
@@ -687,16 +730,30 @@ CONFIG_DEVPORT=y
687# 730#
688# SPI support 731# SPI support
689# 732#
690# CONFIG_SPI is not set 733CONFIG_SPI=y
691# CONFIG_SPI_MASTER is not set 734CONFIG_SPI_MASTER=y
735
736#
737# SPI Master Controller Drivers
738#
739CONFIG_SPI_BITBANG=y
740CONFIG_SPI_SH_SCI=y
741
742#
743# SPI Protocol Masters
744#
745# CONFIG_SPI_AT25 is not set
746# CONFIG_SPI_SPIDEV is not set
747# CONFIG_SPI_TLE62X0 is not set
692# CONFIG_W1 is not set 748# CONFIG_W1 is not set
693# CONFIG_POWER_SUPPLY is not set 749# CONFIG_POWER_SUPPLY is not set
694CONFIG_HWMON=y 750CONFIG_HWMON=y
695# CONFIG_HWMON_VID is not set 751# CONFIG_HWMON_VID is not set
696# CONFIG_SENSORS_ABITUGURU is not set 752# CONFIG_SENSORS_I5K_AMB is not set
697# CONFIG_SENSORS_ABITUGURU3 is not set
698# CONFIG_SENSORS_F71805F is not set 753# CONFIG_SENSORS_F71805F is not set
754# CONFIG_SENSORS_F71882FG is not set
699# CONFIG_SENSORS_IT87 is not set 755# CONFIG_SENSORS_IT87 is not set
756# CONFIG_SENSORS_LM70 is not set
700# CONFIG_SENSORS_PC87360 is not set 757# CONFIG_SENSORS_PC87360 is not set
701# CONFIG_SENSORS_PC87427 is not set 758# CONFIG_SENSORS_PC87427 is not set
702# CONFIG_SENSORS_SIS5595 is not set 759# CONFIG_SENSORS_SIS5595 is not set
@@ -708,6 +765,13 @@ CONFIG_HWMON=y
708# CONFIG_SENSORS_W83627HF is not set 765# CONFIG_SENSORS_W83627HF is not set
709# CONFIG_SENSORS_W83627EHF is not set 766# CONFIG_SENSORS_W83627EHF is not set
710# CONFIG_HWMON_DEBUG_CHIP is not set 767# CONFIG_HWMON_DEBUG_CHIP is not set
768# CONFIG_WATCHDOG is not set
769
770#
771# Sonics Silicon Backplane
772#
773CONFIG_SSB_POSSIBLE=y
774# CONFIG_SSB is not set
711 775
712# 776#
713# Multifunction device drivers 777# Multifunction device drivers
@@ -720,16 +784,12 @@ CONFIG_MFD_SM501=y
720# CONFIG_VIDEO_DEV is not set 784# CONFIG_VIDEO_DEV is not set
721# CONFIG_DVB_CORE is not set 785# CONFIG_DVB_CORE is not set
722CONFIG_DAB=y 786CONFIG_DAB=y
787# CONFIG_USB_DABUSB is not set
723 788
724# 789#
725# Graphics support 790# Graphics support
726# 791#
727# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 792# CONFIG_DRM is not set
728
729#
730# Display device support
731#
732# CONFIG_DISPLAY_SUPPORT is not set
733# CONFIG_VGASTATE is not set 793# CONFIG_VGASTATE is not set
734CONFIG_VIDEO_OUTPUT_CONTROL=m 794CONFIG_VIDEO_OUTPUT_CONTROL=m
735CONFIG_FB=y 795CONFIG_FB=y
@@ -738,6 +798,7 @@ CONFIG_FB=y
738CONFIG_FB_CFB_FILLRECT=y 798CONFIG_FB_CFB_FILLRECT=y
739CONFIG_FB_CFB_COPYAREA=y 799CONFIG_FB_CFB_COPYAREA=y
740CONFIG_FB_CFB_IMAGEBLIT=y 800CONFIG_FB_CFB_IMAGEBLIT=y
801# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
741# CONFIG_FB_SYS_FILLRECT is not set 802# CONFIG_FB_SYS_FILLRECT is not set
742# CONFIG_FB_SYS_COPYAREA is not set 803# CONFIG_FB_SYS_COPYAREA is not set
743# CONFIG_FB_SYS_IMAGEBLIT is not set 804# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -777,6 +838,12 @@ CONFIG_FB_DEFERRED_IO=y
777# CONFIG_FB_PM3 is not set 838# CONFIG_FB_PM3 is not set
778CONFIG_FB_SM501=y 839CONFIG_FB_SM501=y
779# CONFIG_FB_VIRTUAL is not set 840# CONFIG_FB_VIRTUAL is not set
841# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
842
843#
844# Display device support
845#
846# CONFIG_DISPLAY_SUPPORT is not set
780 847
781# 848#
782# Console display driver support 849# Console display driver support
@@ -844,6 +911,7 @@ CONFIG_SND_AC97_CODEC=m
844# CONFIG_SND_BT87X is not set 911# CONFIG_SND_BT87X is not set
845# CONFIG_SND_CA0106 is not set 912# CONFIG_SND_CA0106 is not set
846# CONFIG_SND_CMIPCI is not set 913# CONFIG_SND_CMIPCI is not set
914# CONFIG_SND_OXYGEN is not set
847# CONFIG_SND_CS4281 is not set 915# CONFIG_SND_CS4281 is not set
848# CONFIG_SND_CS46XX is not set 916# CONFIG_SND_CS46XX is not set
849# CONFIG_SND_DARLA20 is not set 917# CONFIG_SND_DARLA20 is not set
@@ -868,6 +936,7 @@ CONFIG_SND_AC97_CODEC=m
868# CONFIG_SND_HDA_INTEL is not set 936# CONFIG_SND_HDA_INTEL is not set
869# CONFIG_SND_HDSP is not set 937# CONFIG_SND_HDSP is not set
870# CONFIG_SND_HDSPM is not set 938# CONFIG_SND_HDSPM is not set
939# CONFIG_SND_HIFIER is not set
871# CONFIG_SND_ICE1712 is not set 940# CONFIG_SND_ICE1712 is not set
872# CONFIG_SND_ICE1724 is not set 941# CONFIG_SND_ICE1724 is not set
873# CONFIG_SND_INTEL8X0 is not set 942# CONFIG_SND_INTEL8X0 is not set
@@ -885,16 +954,27 @@ CONFIG_SND_AC97_CODEC=m
885# CONFIG_SND_TRIDENT is not set 954# CONFIG_SND_TRIDENT is not set
886# CONFIG_SND_VIA82XX is not set 955# CONFIG_SND_VIA82XX is not set
887# CONFIG_SND_VIA82XX_MODEM is not set 956# CONFIG_SND_VIA82XX_MODEM is not set
957# CONFIG_SND_VIRTUOSO is not set
888# CONFIG_SND_VX222 is not set 958# CONFIG_SND_VX222 is not set
889CONFIG_SND_YMFPCI=m 959CONFIG_SND_YMFPCI=m
890CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y 960CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
891# CONFIG_SND_AC97_POWER_SAVE is not set 961# CONFIG_SND_AC97_POWER_SAVE is not set
892 962
893# 963#
964# SPI devices
965#
966
967#
894# SUPERH devices 968# SUPERH devices
895# 969#
896 970
897# 971#
972# USB devices
973#
974# CONFIG_SND_USB_AUDIO is not set
975# CONFIG_SND_USB_CAIAQ is not set
976
977#
898# System on Chip audio support 978# System on Chip audio support
899# 979#
900# CONFIG_SND_SOC is not set 980# CONFIG_SND_SOC is not set
@@ -904,6 +984,10 @@ CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
904# 984#
905 985
906# 986#
987# ALSA SoC audio for Freescale SOCs
988#
989
990#
907# Open Sound System 991# Open Sound System
908# 992#
909CONFIG_SOUND_PRIME=m 993CONFIG_SOUND_PRIME=m
@@ -914,19 +998,104 @@ CONFIG_AC97_BUS=m
914CONFIG_HID_SUPPORT=y 998CONFIG_HID_SUPPORT=y
915CONFIG_HID=y 999CONFIG_HID=y
916# CONFIG_HID_DEBUG is not set 1000# CONFIG_HID_DEBUG is not set
1001# CONFIG_HIDRAW is not set
1002
1003#
1004# USB Input Devices
1005#
1006CONFIG_USB_HID=y
1007# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1008# CONFIG_HID_FF is not set
1009# CONFIG_USB_HIDDEV is not set
917CONFIG_USB_SUPPORT=y 1010CONFIG_USB_SUPPORT=y
918CONFIG_USB_ARCH_HAS_HCD=y 1011CONFIG_USB_ARCH_HAS_HCD=y
919CONFIG_USB_ARCH_HAS_OHCI=y 1012CONFIG_USB_ARCH_HAS_OHCI=y
920CONFIG_USB_ARCH_HAS_EHCI=y 1013CONFIG_USB_ARCH_HAS_EHCI=y
921# CONFIG_USB is not set 1014CONFIG_USB=y
1015# CONFIG_USB_DEBUG is not set
1016CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
1017
1018#
1019# Miscellaneous USB options
1020#
1021# CONFIG_USB_DEVICEFS is not set
1022CONFIG_USB_DEVICE_CLASS=y
1023# CONFIG_USB_DYNAMIC_MINORS is not set
1024# CONFIG_USB_OTG is not set
1025
1026#
1027# USB Host Controller Drivers
1028#
1029# CONFIG_USB_EHCI_HCD is not set
1030# CONFIG_USB_ISP116X_HCD is not set
1031CONFIG_USB_OHCI_HCD=y
1032# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1033# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1034CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1035# CONFIG_USB_UHCI_HCD is not set
1036# CONFIG_USB_SL811_HCD is not set
1037# CONFIG_USB_R8A66597_HCD is not set
1038
1039#
1040# USB Device Class drivers
1041#
1042# CONFIG_USB_ACM is not set
1043# CONFIG_USB_PRINTER is not set
922 1044
923# 1045#
924# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1046# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
925# 1047#
926 1048
927# 1049#
928# USB Gadget Support 1050# may also be needed; see USB_STORAGE Help for more information
1051#
1052CONFIG_USB_STORAGE=y
1053# CONFIG_USB_STORAGE_DEBUG is not set
1054# CONFIG_USB_STORAGE_DATAFAB is not set
1055# CONFIG_USB_STORAGE_FREECOM is not set
1056# CONFIG_USB_STORAGE_ISD200 is not set
1057# CONFIG_USB_STORAGE_DPCM is not set
1058# CONFIG_USB_STORAGE_USBAT is not set
1059# CONFIG_USB_STORAGE_SDDR09 is not set
1060# CONFIG_USB_STORAGE_SDDR55 is not set
1061# CONFIG_USB_STORAGE_JUMPSHOT is not set
1062# CONFIG_USB_STORAGE_ALAUDA is not set
1063# CONFIG_USB_STORAGE_KARMA is not set
1064CONFIG_USB_LIBUSUAL=y
1065
1066#
1067# USB Imaging devices
1068#
1069# CONFIG_USB_MDC800 is not set
1070# CONFIG_USB_MICROTEK is not set
1071# CONFIG_USB_MON is not set
1072
1073#
1074# USB port drivers
1075#
1076# CONFIG_USB_SERIAL is not set
1077
1078#
1079# USB Miscellaneous drivers
929# 1080#
1081# CONFIG_USB_EMI62 is not set
1082# CONFIG_USB_EMI26 is not set
1083# CONFIG_USB_ADUTUX is not set
1084# CONFIG_USB_AUERSWALD is not set
1085# CONFIG_USB_RIO500 is not set
1086# CONFIG_USB_LEGOTOWER is not set
1087# CONFIG_USB_LCD is not set
1088# CONFIG_USB_BERRY_CHARGE is not set
1089# CONFIG_USB_LED is not set
1090# CONFIG_USB_CYPRESS_CY7C63 is not set
1091# CONFIG_USB_CYTHERM is not set
1092# CONFIG_USB_PHIDGET is not set
1093# CONFIG_USB_IDMOUSE is not set
1094# CONFIG_USB_FTDI_ELAN is not set
1095# CONFIG_USB_APPLEDISPLAY is not set
1096# CONFIG_USB_LD is not set
1097# CONFIG_USB_TRANCEVIBRATOR is not set
1098# CONFIG_USB_IOWARRIOR is not set
930# CONFIG_USB_GADGET is not set 1099# CONFIG_USB_GADGET is not set
931# CONFIG_MMC is not set 1100# CONFIG_MMC is not set
932# CONFIG_NEW_LEDS is not set 1101# CONFIG_NEW_LEDS is not set
@@ -949,13 +1118,17 @@ CONFIG_RTC_INTF_DEV=y
949# 1118#
950# SPI RTC drivers 1119# SPI RTC drivers
951# 1120#
1121# CONFIG_RTC_DRV_MAX6902 is not set
1122CONFIG_RTC_DRV_R9701=y
1123# CONFIG_RTC_DRV_RS5C348 is not set
952 1124
953# 1125#
954# Platform RTC drivers 1126# Platform RTC drivers
955# 1127#
1128# CONFIG_RTC_DRV_DS1511 is not set
956# CONFIG_RTC_DRV_DS1553 is not set 1129# CONFIG_RTC_DRV_DS1553 is not set
957# CONFIG_RTC_DRV_STK17TA8 is not set
958# CONFIG_RTC_DRV_DS1742 is not set 1130# CONFIG_RTC_DRV_DS1742 is not set
1131# CONFIG_RTC_DRV_STK17TA8 is not set
959# CONFIG_RTC_DRV_M48T86 is not set 1132# CONFIG_RTC_DRV_M48T86 is not set
960# CONFIG_RTC_DRV_M48T59 is not set 1133# CONFIG_RTC_DRV_M48T59 is not set
961# CONFIG_RTC_DRV_V3020 is not set 1134# CONFIG_RTC_DRV_V3020 is not set
@@ -963,20 +1136,7 @@ CONFIG_RTC_INTF_DEV=y
963# 1136#
964# on-CPU RTC drivers 1137# on-CPU RTC drivers
965# 1138#
966CONFIG_RTC_DRV_SH=y 1139# CONFIG_RTC_DRV_SH is not set
967
968#
969# DMA Engine support
970#
971# CONFIG_DMA_ENGINE is not set
972
973#
974# DMA Clients
975#
976
977#
978# DMA Devices
979#
980 1140
981# 1141#
982# Userspace I/O 1142# Userspace I/O
@@ -1034,7 +1194,6 @@ CONFIG_TMPFS=y
1034# CONFIG_TMPFS_POSIX_ACL is not set 1194# CONFIG_TMPFS_POSIX_ACL is not set
1035# CONFIG_HUGETLBFS is not set 1195# CONFIG_HUGETLBFS is not set
1036# CONFIG_HUGETLB_PAGE is not set 1196# CONFIG_HUGETLB_PAGE is not set
1037CONFIG_RAMFS=y
1038# CONFIG_CONFIGFS_FS is not set 1197# CONFIG_CONFIGFS_FS is not set
1039 1198
1040# 1199#
@@ -1053,10 +1212,7 @@ CONFIG_RAMFS=y
1053# CONFIG_QNX4FS_FS is not set 1212# CONFIG_QNX4FS_FS is not set
1054# CONFIG_SYSV_FS is not set 1213# CONFIG_SYSV_FS is not set
1055# CONFIG_UFS_FS is not set 1214# CONFIG_UFS_FS is not set
1056 1215CONFIG_NETWORK_FILESYSTEMS=y
1057#
1058# Network File Systems
1059#
1060# CONFIG_NFS_FS is not set 1216# CONFIG_NFS_FS is not set
1061# CONFIG_NFSD is not set 1217# CONFIG_NFSD is not set
1062# CONFIG_SMB_FS is not set 1218# CONFIG_SMB_FS is not set
@@ -1070,10 +1226,6 @@ CONFIG_RAMFS=y
1070# 1226#
1071# CONFIG_PARTITION_ADVANCED is not set 1227# CONFIG_PARTITION_ADVANCED is not set
1072CONFIG_MSDOS_PARTITION=y 1228CONFIG_MSDOS_PARTITION=y
1073
1074#
1075# Native Language Support
1076#
1077CONFIG_NLS=y 1229CONFIG_NLS=y
1078CONFIG_NLS_DEFAULT="iso8859-1" 1230CONFIG_NLS_DEFAULT="iso8859-1"
1079# CONFIG_NLS_CODEPAGE_437 is not set 1231# CONFIG_NLS_CODEPAGE_437 is not set
@@ -1114,30 +1266,22 @@ CONFIG_NLS_CODEPAGE_932=y
1114# CONFIG_NLS_KOI8_R is not set 1266# CONFIG_NLS_KOI8_R is not set
1115# CONFIG_NLS_KOI8_U is not set 1267# CONFIG_NLS_KOI8_U is not set
1116# CONFIG_NLS_UTF8 is not set 1268# CONFIG_NLS_UTF8 is not set
1117
1118#
1119# Distributed Lock Manager
1120#
1121# CONFIG_DLM is not set 1269# CONFIG_DLM is not set
1122 1270
1123# 1271#
1124# Profiling support
1125#
1126CONFIG_PROFILING=y
1127CONFIG_OPROFILE=y
1128
1129#
1130# Kernel hacking 1272# Kernel hacking
1131# 1273#
1132CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1274CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1133# CONFIG_PRINTK_TIME is not set 1275# CONFIG_PRINTK_TIME is not set
1276CONFIG_ENABLE_WARN_DEPRECATED=y
1134CONFIG_ENABLE_MUST_CHECK=y 1277CONFIG_ENABLE_MUST_CHECK=y
1135# CONFIG_MAGIC_SYSRQ is not set 1278# CONFIG_MAGIC_SYSRQ is not set
1136# CONFIG_UNUSED_SYMBOLS is not set 1279# CONFIG_UNUSED_SYMBOLS is not set
1137# CONFIG_DEBUG_FS is not set 1280CONFIG_DEBUG_FS=y
1138# CONFIG_HEADERS_CHECK is not set 1281# CONFIG_HEADERS_CHECK is not set
1139# CONFIG_DEBUG_KERNEL is not set 1282# CONFIG_DEBUG_KERNEL is not set
1140# CONFIG_DEBUG_BUGVERBOSE is not set 1283# CONFIG_DEBUG_BUGVERBOSE is not set
1284# CONFIG_SAMPLES is not set
1141# CONFIG_SH_STANDARD_BIOS is not set 1285# CONFIG_SH_STANDARD_BIOS is not set
1142CONFIG_EARLY_SCIF_CONSOLE=y 1286CONFIG_EARLY_SCIF_CONSOLE=y
1143CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000 1287CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
@@ -1149,7 +1293,53 @@ CONFIG_EARLY_PRINTK=y
1149# 1293#
1150# CONFIG_KEYS is not set 1294# CONFIG_KEYS is not set
1151# CONFIG_SECURITY is not set 1295# CONFIG_SECURITY is not set
1152# CONFIG_CRYPTO is not set 1296# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1297CONFIG_CRYPTO=y
1298# CONFIG_CRYPTO_SEQIV is not set
1299# CONFIG_CRYPTO_MANAGER is not set
1300# CONFIG_CRYPTO_HMAC is not set
1301# CONFIG_CRYPTO_XCBC is not set
1302# CONFIG_CRYPTO_NULL is not set
1303# CONFIG_CRYPTO_MD4 is not set
1304# CONFIG_CRYPTO_MD5 is not set
1305# CONFIG_CRYPTO_SHA1 is not set
1306# CONFIG_CRYPTO_SHA256 is not set
1307# CONFIG_CRYPTO_SHA512 is not set
1308# CONFIG_CRYPTO_WP512 is not set
1309# CONFIG_CRYPTO_TGR192 is not set
1310# CONFIG_CRYPTO_GF128MUL is not set
1311# CONFIG_CRYPTO_ECB is not set
1312# CONFIG_CRYPTO_CBC is not set
1313# CONFIG_CRYPTO_PCBC is not set
1314# CONFIG_CRYPTO_LRW is not set
1315# CONFIG_CRYPTO_XTS is not set
1316# CONFIG_CRYPTO_CTR is not set
1317# CONFIG_CRYPTO_GCM is not set
1318# CONFIG_CRYPTO_CCM is not set
1319# CONFIG_CRYPTO_CRYPTD is not set
1320# CONFIG_CRYPTO_DES is not set
1321# CONFIG_CRYPTO_FCRYPT is not set
1322# CONFIG_CRYPTO_BLOWFISH is not set
1323# CONFIG_CRYPTO_TWOFISH is not set
1324# CONFIG_CRYPTO_SERPENT is not set
1325# CONFIG_CRYPTO_AES is not set
1326# CONFIG_CRYPTO_CAST5 is not set
1327# CONFIG_CRYPTO_CAST6 is not set
1328# CONFIG_CRYPTO_TEA is not set
1329# CONFIG_CRYPTO_ARC4 is not set
1330# CONFIG_CRYPTO_KHAZAD is not set
1331# CONFIG_CRYPTO_ANUBIS is not set
1332# CONFIG_CRYPTO_SEED is not set
1333# CONFIG_CRYPTO_SALSA20 is not set
1334# CONFIG_CRYPTO_DEFLATE is not set
1335# CONFIG_CRYPTO_MICHAEL_MIC is not set
1336# CONFIG_CRYPTO_CRC32C is not set
1337# CONFIG_CRYPTO_CAMELLIA is not set
1338# CONFIG_CRYPTO_TEST is not set
1339# CONFIG_CRYPTO_AUTHENC is not set
1340# CONFIG_CRYPTO_LZO is not set
1341CONFIG_CRYPTO_HW=y
1342# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1153 1343
1154# 1344#
1155# Library routines 1345# Library routines
diff --git a/arch/sh/configs/rts7751r2dplus_defconfig b/arch/sh/configs/rts7751r2dplus_defconfig
index 4ff5a752dcd9..0a6d3b9e648b 100644
--- a/arch/sh/configs/rts7751r2dplus_defconfig
+++ b/arch/sh/configs/rts7751r2dplus_defconfig
@@ -1,9 +1,10 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc2 3# Linux kernel version: 2.6.24
4# Tue Aug 14 16:33:08 2007 4# Thu Feb 7 16:17:47 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y 9CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y 10CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -36,9 +37,14 @@ CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_BSD_PROCESS_ACCT is not set 37# CONFIG_BSD_PROCESS_ACCT is not set
37# CONFIG_TASKSTATS is not set 38# CONFIG_TASKSTATS is not set
38# CONFIG_USER_NS is not set 39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
39# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
40# CONFIG_IKCONFIG is not set 42# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=14 43CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set
45CONFIG_FAIR_GROUP_SCHED=y
46CONFIG_FAIR_USER_SCHED=y
47# CONFIG_FAIR_CGROUP_SCHED is not set
42CONFIG_SYSFS_DEPRECATED=y 48CONFIG_SYSFS_DEPRECATED=y
43# CONFIG_RELAY is not set 49# CONFIG_RELAY is not set
44# CONFIG_BLK_DEV_INITRD is not set 50# CONFIG_BLK_DEV_INITRD is not set
@@ -53,6 +59,7 @@ CONFIG_HOTPLUG=y
53CONFIG_PRINTK=y 59CONFIG_PRINTK=y
54CONFIG_BUG=y 60CONFIG_BUG=y
55CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62CONFIG_COMPAT_BRK=y
56CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y 64CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y 65CONFIG_ANON_INODES=y
@@ -65,6 +72,13 @@ CONFIG_VM_EVENT_COUNTERS=y
65CONFIG_SLAB=y 72CONFIG_SLAB=y
66# CONFIG_SLUB is not set 73# CONFIG_SLUB is not set
67# CONFIG_SLOB is not set 74# CONFIG_SLOB is not set
75CONFIG_PROFILING=y
76# CONFIG_MARKERS is not set
77CONFIG_OPROFILE=y
78CONFIG_HAVE_OPROFILE=y
79# CONFIG_HAVE_KPROBES is not set
80CONFIG_PROC_PAGE_MONITOR=y
81CONFIG_SLABINFO=y
68CONFIG_RT_MUTEXES=y 82CONFIG_RT_MUTEXES=y
69# CONFIG_TINY_SHMEM is not set 83# CONFIG_TINY_SHMEM is not set
70CONFIG_BASE_SMALL=0 84CONFIG_BASE_SMALL=0
@@ -91,13 +105,17 @@ CONFIG_DEFAULT_AS=y
91# CONFIG_DEFAULT_CFQ is not set 105# CONFIG_DEFAULT_CFQ is not set
92# CONFIG_DEFAULT_NOOP is not set 106# CONFIG_DEFAULT_NOOP is not set
93CONFIG_DEFAULT_IOSCHED="anticipatory" 107CONFIG_DEFAULT_IOSCHED="anticipatory"
108CONFIG_CLASSIC_RCU=y
109# CONFIG_PREEMPT_RCU is not set
94 110
95# 111#
96# System type 112# System type
97# 113#
98CONFIG_CPU_SH4=y 114CONFIG_CPU_SH4=y
99# CONFIG_CPU_SUBTYPE_SH7619 is not set 115# CONFIG_CPU_SUBTYPE_SH7619 is not set
116# CONFIG_CPU_SUBTYPE_SH7203 is not set
100# CONFIG_CPU_SUBTYPE_SH7206 is not set 117# CONFIG_CPU_SUBTYPE_SH7206 is not set
118# CONFIG_CPU_SUBTYPE_SH7263 is not set
101# CONFIG_CPU_SUBTYPE_SH7705 is not set 119# CONFIG_CPU_SUBTYPE_SH7705 is not set
102# CONFIG_CPU_SUBTYPE_SH7706 is not set 120# CONFIG_CPU_SUBTYPE_SH7706 is not set
103# CONFIG_CPU_SUBTYPE_SH7707 is not set 121# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -105,6 +123,8 @@ CONFIG_CPU_SH4=y
105# CONFIG_CPU_SUBTYPE_SH7709 is not set 123# CONFIG_CPU_SUBTYPE_SH7709 is not set
106# CONFIG_CPU_SUBTYPE_SH7710 is not set 124# CONFIG_CPU_SUBTYPE_SH7710 is not set
107# CONFIG_CPU_SUBTYPE_SH7712 is not set 125# CONFIG_CPU_SUBTYPE_SH7712 is not set
126# CONFIG_CPU_SUBTYPE_SH7720 is not set
127# CONFIG_CPU_SUBTYPE_SH7721 is not set
108# CONFIG_CPU_SUBTYPE_SH7750 is not set 128# CONFIG_CPU_SUBTYPE_SH7750 is not set
109# CONFIG_CPU_SUBTYPE_SH7091 is not set 129# CONFIG_CPU_SUBTYPE_SH7091 is not set
110# CONFIG_CPU_SUBTYPE_SH7750R is not set 130# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -113,14 +133,15 @@ CONFIG_CPU_SH4=y
113CONFIG_CPU_SUBTYPE_SH7751R=y 133CONFIG_CPU_SUBTYPE_SH7751R=y
114# CONFIG_CPU_SUBTYPE_SH7760 is not set 134# CONFIG_CPU_SUBTYPE_SH7760 is not set
115# CONFIG_CPU_SUBTYPE_SH4_202 is not set 135# CONFIG_CPU_SUBTYPE_SH4_202 is not set
116# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 136# CONFIG_CPU_SUBTYPE_SH7763 is not set
117# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
118# CONFIG_CPU_SUBTYPE_SH7770 is not set 137# CONFIG_CPU_SUBTYPE_SH7770 is not set
119# CONFIG_CPU_SUBTYPE_SH7780 is not set 138# CONFIG_CPU_SUBTYPE_SH7780 is not set
120# CONFIG_CPU_SUBTYPE_SH7785 is not set 139# CONFIG_CPU_SUBTYPE_SH7785 is not set
121# CONFIG_CPU_SUBTYPE_SHX3 is not set 140# CONFIG_CPU_SUBTYPE_SHX3 is not set
122# CONFIG_CPU_SUBTYPE_SH7343 is not set 141# CONFIG_CPU_SUBTYPE_SH7343 is not set
123# CONFIG_CPU_SUBTYPE_SH7722 is not set 142# CONFIG_CPU_SUBTYPE_SH7722 is not set
143# CONFIG_CPU_SUBTYPE_SH5_101 is not set
144# CONFIG_CPU_SUBTYPE_SH5_103 is not set
124 145
125# 146#
126# Memory management options 147# Memory management options
@@ -130,6 +151,7 @@ CONFIG_MMU=y
130CONFIG_PAGE_OFFSET=0x80000000 151CONFIG_PAGE_OFFSET=0x80000000
131CONFIG_MEMORY_START=0x0c000000 152CONFIG_MEMORY_START=0x0c000000
132CONFIG_MEMORY_SIZE=0x04000000 153CONFIG_MEMORY_SIZE=0x04000000
154CONFIG_29BIT=y
133CONFIG_VSYSCALL=y 155CONFIG_VSYSCALL=y
134CONFIG_ARCH_FLATMEM_ENABLE=y 156CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_ARCH_SPARSEMEM_ENABLE=y 157CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -147,6 +169,7 @@ CONFIG_FLATMEM_MANUAL=y
147CONFIG_FLATMEM=y 169CONFIG_FLATMEM=y
148CONFIG_FLAT_NODE_MEM_MAP=y 170CONFIG_FLAT_NODE_MEM_MAP=y
149CONFIG_SPARSEMEM_STATIC=y 171CONFIG_SPARSEMEM_STATIC=y
172# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
150CONFIG_SPLIT_PTLOCK_CPUS=4 173CONFIG_SPLIT_PTLOCK_CPUS=4
151# CONFIG_RESOURCES_64BIT is not set 174# CONFIG_RESOURCES_64BIT is not set
152CONFIG_ZONE_DMA_FLAG=0 175CONFIG_ZONE_DMA_FLAG=0
@@ -168,23 +191,22 @@ CONFIG_CPU_LITTLE_ENDIAN=y
168CONFIG_SH_FPU=y 191CONFIG_SH_FPU=y
169# CONFIG_SH_STORE_QUEUES is not set 192# CONFIG_SH_STORE_QUEUES is not set
170CONFIG_CPU_HAS_INTEVT=y 193CONFIG_CPU_HAS_INTEVT=y
171CONFIG_CPU_HAS_INTC_IRQ=y
172CONFIG_CPU_HAS_SR_RB=y 194CONFIG_CPU_HAS_SR_RB=y
173CONFIG_CPU_HAS_PTEA=y 195CONFIG_CPU_HAS_PTEA=y
196CONFIG_CPU_HAS_FPU=y
174 197
175# 198#
176# Board support 199# Board support
177# 200#
178# CONFIG_SH_7751_SYSTEMH is not set 201# CONFIG_SH_7751_SYSTEMH is not set
179# CONFIG_SH_SECUREEDGE5410 is not set 202# CONFIG_SH_SECUREEDGE5410 is not set
180# CONFIG_SH_HS7751RVOIP is not set
181CONFIG_SH_RTS7751R2D=y 203CONFIG_SH_RTS7751R2D=y
182# CONFIG_SH_LANDISK is not set 204# CONFIG_SH_LANDISK is not set
183# CONFIG_SH_TITAN is not set 205# CONFIG_SH_TITAN is not set
184# CONFIG_SH_LBOX_RE2 is not set 206# CONFIG_SH_LBOX_RE2 is not set
185 207
186# 208#
187# RTS7751R2D options 209# RTS7751R2D Board Revision
188# 210#
189CONFIG_RTS7751R2D_PLUS=y 211CONFIG_RTS7751R2D_PLUS=y
190# CONFIG_RTS7751R2D_1 is not set 212# CONFIG_RTS7751R2D_1 is not set
@@ -198,6 +220,7 @@ CONFIG_SH_PCLK_FREQ=60000000
198# CONFIG_TICK_ONESHOT is not set 220# CONFIG_TICK_ONESHOT is not set
199# CONFIG_NO_HZ is not set 221# CONFIG_NO_HZ is not set
200# CONFIG_HIGH_RES_TIMERS is not set 222# CONFIG_HIGH_RES_TIMERS is not set
223CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
201 224
202# 225#
203# CPU Frequency scaling 226# CPU Frequency scaling
@@ -227,11 +250,15 @@ CONFIG_HZ_250=y
227# CONFIG_HZ_300 is not set 250# CONFIG_HZ_300 is not set
228# CONFIG_HZ_1000 is not set 251# CONFIG_HZ_1000 is not set
229CONFIG_HZ=250 252CONFIG_HZ=250
253# CONFIG_SCHED_HRTICK is not set
230# CONFIG_KEXEC is not set 254# CONFIG_KEXEC is not set
231# CONFIG_CRASH_DUMP is not set 255# CONFIG_CRASH_DUMP is not set
232CONFIG_PREEMPT_NONE=y 256CONFIG_PREEMPT_NONE=y
233# CONFIG_PREEMPT_VOLUNTARY is not set 257# CONFIG_PREEMPT_VOLUNTARY is not set
234# CONFIG_PREEMPT is not set 258# CONFIG_PREEMPT is not set
259CONFIG_RCU_TRACE=y
260CONFIG_GUSA=y
261# CONFIG_GUSA_RB is not set
235 262
236# 263#
237# Boot options 264# Boot options
@@ -250,10 +277,7 @@ CONFIG_SH_PCIDMA_NONCOHERENT=y
250CONFIG_PCI_AUTO=y 277CONFIG_PCI_AUTO=y
251CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 278CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
252# CONFIG_ARCH_SUPPORTS_MSI is not set 279# CONFIG_ARCH_SUPPORTS_MSI is not set
253 280CONFIG_PCI_LEGACY=y
254#
255# PCCARD (PCMCIA/CardBus) support
256#
257# CONFIG_PCCARD is not set 281# CONFIG_PCCARD is not set
258CONFIG_HOTPLUG_PCI=y 282CONFIG_HOTPLUG_PCI=y
259# CONFIG_HOTPLUG_PCI_FAKE is not set 283# CONFIG_HOTPLUG_PCI_FAKE is not set
@@ -281,6 +305,7 @@ CONFIG_XFRM=y
281# CONFIG_XFRM_USER is not set 305# CONFIG_XFRM_USER is not set
282# CONFIG_XFRM_SUB_POLICY is not set 306# CONFIG_XFRM_SUB_POLICY is not set
283# CONFIG_XFRM_MIGRATE is not set 307# CONFIG_XFRM_MIGRATE is not set
308# CONFIG_XFRM_STATISTICS is not set
284# CONFIG_NET_KEY is not set 309# CONFIG_NET_KEY is not set
285CONFIG_INET=y 310CONFIG_INET=y
286# CONFIG_IP_MULTICAST is not set 311# CONFIG_IP_MULTICAST is not set
@@ -299,6 +324,7 @@ CONFIG_IP_FIB_HASH=y
299CONFIG_INET_XFRM_MODE_TRANSPORT=y 324CONFIG_INET_XFRM_MODE_TRANSPORT=y
300CONFIG_INET_XFRM_MODE_TUNNEL=y 325CONFIG_INET_XFRM_MODE_TUNNEL=y
301CONFIG_INET_XFRM_MODE_BEET=y 326CONFIG_INET_XFRM_MODE_BEET=y
327# CONFIG_INET_LRO is not set
302CONFIG_INET_DIAG=y 328CONFIG_INET_DIAG=y
303CONFIG_INET_TCP_DIAG=y 329CONFIG_INET_TCP_DIAG=y
304# CONFIG_TCP_CONG_ADVANCED is not set 330# CONFIG_TCP_CONG_ADVANCED is not set
@@ -324,10 +350,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
324# CONFIG_LAPB is not set 350# CONFIG_LAPB is not set
325# CONFIG_ECONET is not set 351# CONFIG_ECONET is not set
326# CONFIG_WAN_ROUTER is not set 352# CONFIG_WAN_ROUTER is not set
327
328#
329# QoS and/or fair queueing
330#
331# CONFIG_NET_SCHED is not set 353# CONFIG_NET_SCHED is not set
332 354
333# 355#
@@ -335,6 +357,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
335# 357#
336# CONFIG_NET_PKTGEN is not set 358# CONFIG_NET_PKTGEN is not set
337# CONFIG_HAMRADIO is not set 359# CONFIG_HAMRADIO is not set
360# CONFIG_CAN is not set
338# CONFIG_IRDA is not set 361# CONFIG_IRDA is not set
339# CONFIG_BT is not set 362# CONFIG_BT is not set
340# CONFIG_AF_RXRPC is not set 363# CONFIG_AF_RXRPC is not set
@@ -356,6 +379,7 @@ CONFIG_WIRELESS_EXT=y
356# 379#
357# Generic Driver Options 380# Generic Driver Options
358# 381#
382CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
359CONFIG_STANDALONE=y 383CONFIG_STANDALONE=y
360CONFIG_PREVENT_FIRMWARE_BUILD=y 384CONFIG_PREVENT_FIRMWARE_BUILD=y
361CONFIG_FW_LOADER=m 385CONFIG_FW_LOADER=m
@@ -371,6 +395,7 @@ CONFIG_BLK_DEV=y
371# CONFIG_BLK_DEV_LOOP is not set 395# CONFIG_BLK_DEV_LOOP is not set
372# CONFIG_BLK_DEV_NBD is not set 396# CONFIG_BLK_DEV_NBD is not set
373# CONFIG_BLK_DEV_SX8 is not set 397# CONFIG_BLK_DEV_SX8 is not set
398# CONFIG_BLK_DEV_UB is not set
374CONFIG_BLK_DEV_RAM=y 399CONFIG_BLK_DEV_RAM=y
375CONFIG_BLK_DEV_RAM_COUNT=16 400CONFIG_BLK_DEV_RAM_COUNT=16
376CONFIG_BLK_DEV_RAM_SIZE=4096 401CONFIG_BLK_DEV_RAM_SIZE=4096
@@ -420,6 +445,7 @@ CONFIG_SCSI_WAIT_SCAN=m
420# CONFIG_SCSI_FC_ATTRS is not set 445# CONFIG_SCSI_FC_ATTRS is not set
421# CONFIG_SCSI_ISCSI_ATTRS is not set 446# CONFIG_SCSI_ISCSI_ATTRS is not set
422# CONFIG_SCSI_SAS_LIBSAS is not set 447# CONFIG_SCSI_SAS_LIBSAS is not set
448# CONFIG_SCSI_SRP_ATTRS is not set
423CONFIG_SCSI_LOWLEVEL=y 449CONFIG_SCSI_LOWLEVEL=y
424# CONFIG_ISCSI_TCP is not set 450# CONFIG_ISCSI_TCP is not set
425# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 451# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -493,7 +519,9 @@ CONFIG_ATA=y
493# CONFIG_PATA_MPIIX is not set 519# CONFIG_PATA_MPIIX is not set
494# CONFIG_PATA_OLDPIIX is not set 520# CONFIG_PATA_OLDPIIX is not set
495# CONFIG_PATA_NETCELL is not set 521# CONFIG_PATA_NETCELL is not set
522# CONFIG_PATA_NINJA32 is not set
496# CONFIG_PATA_NS87410 is not set 523# CONFIG_PATA_NS87410 is not set
524# CONFIG_PATA_NS87415 is not set
497# CONFIG_PATA_OPTI is not set 525# CONFIG_PATA_OPTI is not set
498# CONFIG_PATA_OPTIDMA is not set 526# CONFIG_PATA_OPTIDMA is not set
499# CONFIG_PATA_PDC_OLD is not set 527# CONFIG_PATA_PDC_OLD is not set
@@ -508,14 +536,7 @@ CONFIG_ATA=y
508# CONFIG_PATA_WINBOND is not set 536# CONFIG_PATA_WINBOND is not set
509CONFIG_PATA_PLATFORM=y 537CONFIG_PATA_PLATFORM=y
510# CONFIG_MD is not set 538# CONFIG_MD is not set
511
512#
513# Fusion MPT device support
514#
515# CONFIG_FUSION is not set 539# CONFIG_FUSION is not set
516# CONFIG_FUSION_SPI is not set
517# CONFIG_FUSION_FC is not set
518# CONFIG_FUSION_SAS is not set
519 540
520# 541#
521# IEEE 1394 (FireWire) support 542# IEEE 1394 (FireWire) support
@@ -530,25 +551,31 @@ CONFIG_NETDEVICES=y
530# CONFIG_MACVLAN is not set 551# CONFIG_MACVLAN is not set
531# CONFIG_EQUALIZER is not set 552# CONFIG_EQUALIZER is not set
532# CONFIG_TUN is not set 553# CONFIG_TUN is not set
554# CONFIG_VETH is not set
533# CONFIG_ARCNET is not set 555# CONFIG_ARCNET is not set
534# CONFIG_PHYLIB is not set 556# CONFIG_PHYLIB is not set
535CONFIG_NET_ETHERNET=y 557CONFIG_NET_ETHERNET=y
536CONFIG_MII=y 558CONFIG_MII=y
559# CONFIG_AX88796 is not set
537# CONFIG_STNIC is not set 560# CONFIG_STNIC is not set
538# CONFIG_HAPPYMEAL is not set 561# CONFIG_HAPPYMEAL is not set
539# CONFIG_SUNGEM is not set 562# CONFIG_SUNGEM is not set
540# CONFIG_CASSINI is not set 563# CONFIG_CASSINI is not set
541# CONFIG_NET_VENDOR_3COM is not set 564# CONFIG_NET_VENDOR_3COM is not set
542# CONFIG_SMC91X is not set 565# CONFIG_SMC91X is not set
566# CONFIG_ENC28J60 is not set
543# CONFIG_NET_TULIP is not set 567# CONFIG_NET_TULIP is not set
544# CONFIG_HP100 is not set 568# CONFIG_HP100 is not set
569# CONFIG_IBM_NEW_EMAC_ZMII is not set
570# CONFIG_IBM_NEW_EMAC_RGMII is not set
571# CONFIG_IBM_NEW_EMAC_TAH is not set
572# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
545CONFIG_NET_PCI=y 573CONFIG_NET_PCI=y
546# CONFIG_PCNET32 is not set 574# CONFIG_PCNET32 is not set
547# CONFIG_AMD8111_ETH is not set 575# CONFIG_AMD8111_ETH is not set
548# CONFIG_ADAPTEC_STARFIRE is not set 576# CONFIG_ADAPTEC_STARFIRE is not set
549# CONFIG_B44 is not set 577# CONFIG_B44 is not set
550# CONFIG_FORCEDETH is not set 578# CONFIG_FORCEDETH is not set
551# CONFIG_DGRS is not set
552# CONFIG_EEPRO100 is not set 579# CONFIG_EEPRO100 is not set
553# CONFIG_E100 is not set 580# CONFIG_E100 is not set
554# CONFIG_FEALNX is not set 581# CONFIG_FEALNX is not set
@@ -560,6 +587,7 @@ CONFIG_8139TOO=y
560# CONFIG_8139TOO_TUNE_TWISTER is not set 587# CONFIG_8139TOO_TUNE_TWISTER is not set
561# CONFIG_8139TOO_8129 is not set 588# CONFIG_8139TOO_8129 is not set
562# CONFIG_8139_OLD_RX_RESET is not set 589# CONFIG_8139_OLD_RX_RESET is not set
590# CONFIG_R6040 is not set
563# CONFIG_SIS900 is not set 591# CONFIG_SIS900 is not set
564# CONFIG_EPIC100 is not set 592# CONFIG_EPIC100 is not set
565# CONFIG_SUNDANCE is not set 593# CONFIG_SUNDANCE is not set
@@ -570,6 +598,10 @@ CONFIG_NETDEV_1000=y
570# CONFIG_ACENIC is not set 598# CONFIG_ACENIC is not set
571# CONFIG_DL2K is not set 599# CONFIG_DL2K is not set
572# CONFIG_E1000 is not set 600# CONFIG_E1000 is not set
601# CONFIG_E1000E is not set
602# CONFIG_E1000E_ENABLED is not set
603# CONFIG_IP1000 is not set
604# CONFIG_IGB is not set
573# CONFIG_NS83820 is not set 605# CONFIG_NS83820 is not set
574# CONFIG_HAMACHI is not set 606# CONFIG_HAMACHI is not set
575# CONFIG_YELLOWFIN is not set 607# CONFIG_YELLOWFIN is not set
@@ -577,6 +609,7 @@ CONFIG_NETDEV_1000=y
577# CONFIG_SIS190 is not set 609# CONFIG_SIS190 is not set
578# CONFIG_SKGE is not set 610# CONFIG_SKGE is not set
579# CONFIG_SKY2 is not set 611# CONFIG_SKY2 is not set
612# CONFIG_SK98LIN is not set
580# CONFIG_VIA_VELOCITY is not set 613# CONFIG_VIA_VELOCITY is not set
581# CONFIG_TIGON3 is not set 614# CONFIG_TIGON3 is not set
582# CONFIG_BNX2 is not set 615# CONFIG_BNX2 is not set
@@ -585,11 +618,15 @@ CONFIG_NETDEV_1000=y
585CONFIG_NETDEV_10000=y 618CONFIG_NETDEV_10000=y
586# CONFIG_CHELSIO_T1 is not set 619# CONFIG_CHELSIO_T1 is not set
587# CONFIG_CHELSIO_T3 is not set 620# CONFIG_CHELSIO_T3 is not set
621# CONFIG_IXGBE is not set
588# CONFIG_IXGB is not set 622# CONFIG_IXGB is not set
589# CONFIG_S2IO is not set 623# CONFIG_S2IO is not set
590# CONFIG_MYRI10GE is not set 624# CONFIG_MYRI10GE is not set
591# CONFIG_NETXEN_NIC is not set 625# CONFIG_NETXEN_NIC is not set
626# CONFIG_NIU is not set
592# CONFIG_MLX4_CORE is not set 627# CONFIG_MLX4_CORE is not set
628# CONFIG_TEHUTI is not set
629# CONFIG_BNX2X is not set
593# CONFIG_TR is not set 630# CONFIG_TR is not set
594 631
595# 632#
@@ -597,13 +634,21 @@ CONFIG_NETDEV_10000=y
597# 634#
598# CONFIG_WLAN_PRE80211 is not set 635# CONFIG_WLAN_PRE80211 is not set
599# CONFIG_WLAN_80211 is not set 636# CONFIG_WLAN_80211 is not set
637
638#
639# USB Network Adapters
640#
641# CONFIG_USB_CATC is not set
642# CONFIG_USB_KAWETH is not set
643# CONFIG_USB_PEGASUS is not set
644# CONFIG_USB_RTL8150 is not set
645# CONFIG_USB_USBNET is not set
600# CONFIG_WAN is not set 646# CONFIG_WAN is not set
601# CONFIG_FDDI is not set 647# CONFIG_FDDI is not set
602# CONFIG_HIPPI is not set 648# CONFIG_HIPPI is not set
603# CONFIG_PPP is not set 649# CONFIG_PPP is not set
604# CONFIG_SLIP is not set 650# CONFIG_SLIP is not set
605# CONFIG_NET_FC is not set 651# CONFIG_NET_FC is not set
606# CONFIG_SHAPER is not set
607# CONFIG_NETCONSOLE is not set 652# CONFIG_NETCONSOLE is not set
608# CONFIG_NETPOLL is not set 653# CONFIG_NETPOLL is not set
609# CONFIG_NET_POLL_CONTROLLER is not set 654# CONFIG_NET_POLL_CONTROLLER is not set
@@ -622,7 +667,6 @@ CONFIG_INPUT=y
622# 667#
623# CONFIG_INPUT_MOUSEDEV is not set 668# CONFIG_INPUT_MOUSEDEV is not set
624# CONFIG_INPUT_JOYDEV is not set 669# CONFIG_INPUT_JOYDEV is not set
625# CONFIG_INPUT_TSDEV is not set
626# CONFIG_INPUT_EVDEV is not set 670# CONFIG_INPUT_EVDEV is not set
627# CONFIG_INPUT_EVBUG is not set 671# CONFIG_INPUT_EVBUG is not set
628 672
@@ -650,6 +694,7 @@ CONFIG_VT_CONSOLE=y
650CONFIG_HW_CONSOLE=y 694CONFIG_HW_CONSOLE=y
651CONFIG_VT_HW_CONSOLE_BINDING=y 695CONFIG_VT_HW_CONSOLE_BINDING=y
652# CONFIG_SERIAL_NONSTANDARD is not set 696# CONFIG_SERIAL_NONSTANDARD is not set
697# CONFIG_NOZOMI is not set
653 698
654# 699#
655# Serial drivers 700# Serial drivers
@@ -674,11 +719,9 @@ CONFIG_UNIX98_PTYS=y
674CONFIG_LEGACY_PTYS=y 719CONFIG_LEGACY_PTYS=y
675CONFIG_LEGACY_PTY_COUNT=256 720CONFIG_LEGACY_PTY_COUNT=256
676# CONFIG_IPMI_HANDLER is not set 721# CONFIG_IPMI_HANDLER is not set
677# CONFIG_WATCHDOG is not set
678CONFIG_HW_RANDOM=y 722CONFIG_HW_RANDOM=y
679# CONFIG_R3964 is not set 723# CONFIG_R3964 is not set
680# CONFIG_APPLICOM is not set 724# CONFIG_APPLICOM is not set
681# CONFIG_DRM is not set
682# CONFIG_RAW_DRIVER is not set 725# CONFIG_RAW_DRIVER is not set
683# CONFIG_TCG_TPM is not set 726# CONFIG_TCG_TPM is not set
684CONFIG_DEVPORT=y 727CONFIG_DEVPORT=y
@@ -687,16 +730,30 @@ CONFIG_DEVPORT=y
687# 730#
688# SPI support 731# SPI support
689# 732#
690# CONFIG_SPI is not set 733CONFIG_SPI=y
691# CONFIG_SPI_MASTER is not set 734CONFIG_SPI_MASTER=y
735
736#
737# SPI Master Controller Drivers
738#
739CONFIG_SPI_BITBANG=y
740CONFIG_SPI_SH_SCI=y
741
742#
743# SPI Protocol Masters
744#
745# CONFIG_SPI_AT25 is not set
746# CONFIG_SPI_SPIDEV is not set
747# CONFIG_SPI_TLE62X0 is not set
692# CONFIG_W1 is not set 748# CONFIG_W1 is not set
693# CONFIG_POWER_SUPPLY is not set 749# CONFIG_POWER_SUPPLY is not set
694CONFIG_HWMON=y 750CONFIG_HWMON=y
695# CONFIG_HWMON_VID is not set 751# CONFIG_HWMON_VID is not set
696# CONFIG_SENSORS_ABITUGURU is not set 752# CONFIG_SENSORS_I5K_AMB is not set
697# CONFIG_SENSORS_ABITUGURU3 is not set
698# CONFIG_SENSORS_F71805F is not set 753# CONFIG_SENSORS_F71805F is not set
754# CONFIG_SENSORS_F71882FG is not set
699# CONFIG_SENSORS_IT87 is not set 755# CONFIG_SENSORS_IT87 is not set
756# CONFIG_SENSORS_LM70 is not set
700# CONFIG_SENSORS_PC87360 is not set 757# CONFIG_SENSORS_PC87360 is not set
701# CONFIG_SENSORS_PC87427 is not set 758# CONFIG_SENSORS_PC87427 is not set
702# CONFIG_SENSORS_SIS5595 is not set 759# CONFIG_SENSORS_SIS5595 is not set
@@ -708,6 +765,13 @@ CONFIG_HWMON=y
708# CONFIG_SENSORS_W83627HF is not set 765# CONFIG_SENSORS_W83627HF is not set
709# CONFIG_SENSORS_W83627EHF is not set 766# CONFIG_SENSORS_W83627EHF is not set
710# CONFIG_HWMON_DEBUG_CHIP is not set 767# CONFIG_HWMON_DEBUG_CHIP is not set
768# CONFIG_WATCHDOG is not set
769
770#
771# Sonics Silicon Backplane
772#
773CONFIG_SSB_POSSIBLE=y
774# CONFIG_SSB is not set
711 775
712# 776#
713# Multifunction device drivers 777# Multifunction device drivers
@@ -720,16 +784,12 @@ CONFIG_MFD_SM501=y
720# CONFIG_VIDEO_DEV is not set 784# CONFIG_VIDEO_DEV is not set
721# CONFIG_DVB_CORE is not set 785# CONFIG_DVB_CORE is not set
722CONFIG_DAB=y 786CONFIG_DAB=y
787# CONFIG_USB_DABUSB is not set
723 788
724# 789#
725# Graphics support 790# Graphics support
726# 791#
727# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 792# CONFIG_DRM is not set
728
729#
730# Display device support
731#
732# CONFIG_DISPLAY_SUPPORT is not set
733# CONFIG_VGASTATE is not set 793# CONFIG_VGASTATE is not set
734CONFIG_VIDEO_OUTPUT_CONTROL=m 794CONFIG_VIDEO_OUTPUT_CONTROL=m
735CONFIG_FB=y 795CONFIG_FB=y
@@ -738,6 +798,7 @@ CONFIG_FB=y
738CONFIG_FB_CFB_FILLRECT=y 798CONFIG_FB_CFB_FILLRECT=y
739CONFIG_FB_CFB_COPYAREA=y 799CONFIG_FB_CFB_COPYAREA=y
740CONFIG_FB_CFB_IMAGEBLIT=y 800CONFIG_FB_CFB_IMAGEBLIT=y
801# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
741# CONFIG_FB_SYS_FILLRECT is not set 802# CONFIG_FB_SYS_FILLRECT is not set
742# CONFIG_FB_SYS_COPYAREA is not set 803# CONFIG_FB_SYS_COPYAREA is not set
743# CONFIG_FB_SYS_IMAGEBLIT is not set 804# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -777,6 +838,12 @@ CONFIG_FB_DEFERRED_IO=y
777# CONFIG_FB_PM3 is not set 838# CONFIG_FB_PM3 is not set
778CONFIG_FB_SM501=y 839CONFIG_FB_SM501=y
779# CONFIG_FB_VIRTUAL is not set 840# CONFIG_FB_VIRTUAL is not set
841# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
842
843#
844# Display device support
845#
846# CONFIG_DISPLAY_SUPPORT is not set
780 847
781# 848#
782# Console display driver support 849# Console display driver support
@@ -844,6 +911,7 @@ CONFIG_SND_AC97_CODEC=m
844# CONFIG_SND_BT87X is not set 911# CONFIG_SND_BT87X is not set
845# CONFIG_SND_CA0106 is not set 912# CONFIG_SND_CA0106 is not set
846# CONFIG_SND_CMIPCI is not set 913# CONFIG_SND_CMIPCI is not set
914# CONFIG_SND_OXYGEN is not set
847# CONFIG_SND_CS4281 is not set 915# CONFIG_SND_CS4281 is not set
848# CONFIG_SND_CS46XX is not set 916# CONFIG_SND_CS46XX is not set
849# CONFIG_SND_DARLA20 is not set 917# CONFIG_SND_DARLA20 is not set
@@ -868,6 +936,7 @@ CONFIG_SND_AC97_CODEC=m
868# CONFIG_SND_HDA_INTEL is not set 936# CONFIG_SND_HDA_INTEL is not set
869# CONFIG_SND_HDSP is not set 937# CONFIG_SND_HDSP is not set
870# CONFIG_SND_HDSPM is not set 938# CONFIG_SND_HDSPM is not set
939# CONFIG_SND_HIFIER is not set
871# CONFIG_SND_ICE1712 is not set 940# CONFIG_SND_ICE1712 is not set
872# CONFIG_SND_ICE1724 is not set 941# CONFIG_SND_ICE1724 is not set
873# CONFIG_SND_INTEL8X0 is not set 942# CONFIG_SND_INTEL8X0 is not set
@@ -885,16 +954,27 @@ CONFIG_SND_AC97_CODEC=m
885# CONFIG_SND_TRIDENT is not set 954# CONFIG_SND_TRIDENT is not set
886# CONFIG_SND_VIA82XX is not set 955# CONFIG_SND_VIA82XX is not set
887# CONFIG_SND_VIA82XX_MODEM is not set 956# CONFIG_SND_VIA82XX_MODEM is not set
957# CONFIG_SND_VIRTUOSO is not set
888# CONFIG_SND_VX222 is not set 958# CONFIG_SND_VX222 is not set
889CONFIG_SND_YMFPCI=m 959CONFIG_SND_YMFPCI=m
890CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y 960CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
891# CONFIG_SND_AC97_POWER_SAVE is not set 961# CONFIG_SND_AC97_POWER_SAVE is not set
892 962
893# 963#
964# SPI devices
965#
966
967#
894# SUPERH devices 968# SUPERH devices
895# 969#
896 970
897# 971#
972# USB devices
973#
974# CONFIG_SND_USB_AUDIO is not set
975# CONFIG_SND_USB_CAIAQ is not set
976
977#
898# System on Chip audio support 978# System on Chip audio support
899# 979#
900# CONFIG_SND_SOC is not set 980# CONFIG_SND_SOC is not set
@@ -904,6 +984,10 @@ CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
904# 984#
905 985
906# 986#
987# ALSA SoC audio for Freescale SOCs
988#
989
990#
907# Open Sound System 991# Open Sound System
908# 992#
909CONFIG_SOUND_PRIME=m 993CONFIG_SOUND_PRIME=m
@@ -914,19 +998,104 @@ CONFIG_AC97_BUS=m
914CONFIG_HID_SUPPORT=y 998CONFIG_HID_SUPPORT=y
915CONFIG_HID=y 999CONFIG_HID=y
916# CONFIG_HID_DEBUG is not set 1000# CONFIG_HID_DEBUG is not set
1001# CONFIG_HIDRAW is not set
1002
1003#
1004# USB Input Devices
1005#
1006CONFIG_USB_HID=y
1007# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1008# CONFIG_HID_FF is not set
1009# CONFIG_USB_HIDDEV is not set
917CONFIG_USB_SUPPORT=y 1010CONFIG_USB_SUPPORT=y
918CONFIG_USB_ARCH_HAS_HCD=y 1011CONFIG_USB_ARCH_HAS_HCD=y
919CONFIG_USB_ARCH_HAS_OHCI=y 1012CONFIG_USB_ARCH_HAS_OHCI=y
920CONFIG_USB_ARCH_HAS_EHCI=y 1013CONFIG_USB_ARCH_HAS_EHCI=y
921# CONFIG_USB is not set 1014CONFIG_USB=y
1015# CONFIG_USB_DEBUG is not set
1016CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
1017
1018#
1019# Miscellaneous USB options
1020#
1021# CONFIG_USB_DEVICEFS is not set
1022CONFIG_USB_DEVICE_CLASS=y
1023# CONFIG_USB_DYNAMIC_MINORS is not set
1024# CONFIG_USB_OTG is not set
1025
1026#
1027# USB Host Controller Drivers
1028#
1029# CONFIG_USB_EHCI_HCD is not set
1030# CONFIG_USB_ISP116X_HCD is not set
1031CONFIG_USB_OHCI_HCD=y
1032# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1033# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1034CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1035# CONFIG_USB_UHCI_HCD is not set
1036# CONFIG_USB_SL811_HCD is not set
1037# CONFIG_USB_R8A66597_HCD is not set
1038
1039#
1040# USB Device Class drivers
1041#
1042# CONFIG_USB_ACM is not set
1043# CONFIG_USB_PRINTER is not set
922 1044
923# 1045#
924# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1046# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
925# 1047#
926 1048
927# 1049#
928# USB Gadget Support 1050# may also be needed; see USB_STORAGE Help for more information
1051#
1052CONFIG_USB_STORAGE=y
1053# CONFIG_USB_STORAGE_DEBUG is not set
1054# CONFIG_USB_STORAGE_DATAFAB is not set
1055# CONFIG_USB_STORAGE_FREECOM is not set
1056# CONFIG_USB_STORAGE_ISD200 is not set
1057# CONFIG_USB_STORAGE_DPCM is not set
1058# CONFIG_USB_STORAGE_USBAT is not set
1059# CONFIG_USB_STORAGE_SDDR09 is not set
1060# CONFIG_USB_STORAGE_SDDR55 is not set
1061# CONFIG_USB_STORAGE_JUMPSHOT is not set
1062# CONFIG_USB_STORAGE_ALAUDA is not set
1063# CONFIG_USB_STORAGE_KARMA is not set
1064CONFIG_USB_LIBUSUAL=y
1065
1066#
1067# USB Imaging devices
1068#
1069# CONFIG_USB_MDC800 is not set
1070# CONFIG_USB_MICROTEK is not set
1071# CONFIG_USB_MON is not set
1072
1073#
1074# USB port drivers
1075#
1076# CONFIG_USB_SERIAL is not set
1077
1078#
1079# USB Miscellaneous drivers
929# 1080#
1081# CONFIG_USB_EMI62 is not set
1082# CONFIG_USB_EMI26 is not set
1083# CONFIG_USB_ADUTUX is not set
1084# CONFIG_USB_AUERSWALD is not set
1085# CONFIG_USB_RIO500 is not set
1086# CONFIG_USB_LEGOTOWER is not set
1087# CONFIG_USB_LCD is not set
1088# CONFIG_USB_BERRY_CHARGE is not set
1089# CONFIG_USB_LED is not set
1090# CONFIG_USB_CYPRESS_CY7C63 is not set
1091# CONFIG_USB_CYTHERM is not set
1092# CONFIG_USB_PHIDGET is not set
1093# CONFIG_USB_IDMOUSE is not set
1094# CONFIG_USB_FTDI_ELAN is not set
1095# CONFIG_USB_APPLEDISPLAY is not set
1096# CONFIG_USB_LD is not set
1097# CONFIG_USB_TRANCEVIBRATOR is not set
1098# CONFIG_USB_IOWARRIOR is not set
930# CONFIG_USB_GADGET is not set 1099# CONFIG_USB_GADGET is not set
931# CONFIG_MMC is not set 1100# CONFIG_MMC is not set
932# CONFIG_NEW_LEDS is not set 1101# CONFIG_NEW_LEDS is not set
@@ -949,13 +1118,17 @@ CONFIG_RTC_INTF_DEV=y
949# 1118#
950# SPI RTC drivers 1119# SPI RTC drivers
951# 1120#
1121# CONFIG_RTC_DRV_MAX6902 is not set
1122CONFIG_RTC_DRV_R9701=y
1123# CONFIG_RTC_DRV_RS5C348 is not set
952 1124
953# 1125#
954# Platform RTC drivers 1126# Platform RTC drivers
955# 1127#
1128# CONFIG_RTC_DRV_DS1511 is not set
956# CONFIG_RTC_DRV_DS1553 is not set 1129# CONFIG_RTC_DRV_DS1553 is not set
957# CONFIG_RTC_DRV_STK17TA8 is not set
958# CONFIG_RTC_DRV_DS1742 is not set 1130# CONFIG_RTC_DRV_DS1742 is not set
1131# CONFIG_RTC_DRV_STK17TA8 is not set
959# CONFIG_RTC_DRV_M48T86 is not set 1132# CONFIG_RTC_DRV_M48T86 is not set
960# CONFIG_RTC_DRV_M48T59 is not set 1133# CONFIG_RTC_DRV_M48T59 is not set
961# CONFIG_RTC_DRV_V3020 is not set 1134# CONFIG_RTC_DRV_V3020 is not set
@@ -963,20 +1136,7 @@ CONFIG_RTC_INTF_DEV=y
963# 1136#
964# on-CPU RTC drivers 1137# on-CPU RTC drivers
965# 1138#
966CONFIG_RTC_DRV_SH=y 1139# CONFIG_RTC_DRV_SH is not set
967
968#
969# DMA Engine support
970#
971# CONFIG_DMA_ENGINE is not set
972
973#
974# DMA Clients
975#
976
977#
978# DMA Devices
979#
980 1140
981# 1141#
982# Userspace I/O 1142# Userspace I/O
@@ -1034,7 +1194,6 @@ CONFIG_TMPFS=y
1034# CONFIG_TMPFS_POSIX_ACL is not set 1194# CONFIG_TMPFS_POSIX_ACL is not set
1035# CONFIG_HUGETLBFS is not set 1195# CONFIG_HUGETLBFS is not set
1036# CONFIG_HUGETLB_PAGE is not set 1196# CONFIG_HUGETLB_PAGE is not set
1037CONFIG_RAMFS=y
1038# CONFIG_CONFIGFS_FS is not set 1197# CONFIG_CONFIGFS_FS is not set
1039 1198
1040# 1199#
@@ -1053,10 +1212,7 @@ CONFIG_RAMFS=y
1053# CONFIG_QNX4FS_FS is not set 1212# CONFIG_QNX4FS_FS is not set
1054# CONFIG_SYSV_FS is not set 1213# CONFIG_SYSV_FS is not set
1055# CONFIG_UFS_FS is not set 1214# CONFIG_UFS_FS is not set
1056 1215CONFIG_NETWORK_FILESYSTEMS=y
1057#
1058# Network File Systems
1059#
1060# CONFIG_NFS_FS is not set 1216# CONFIG_NFS_FS is not set
1061# CONFIG_NFSD is not set 1217# CONFIG_NFSD is not set
1062# CONFIG_SMB_FS is not set 1218# CONFIG_SMB_FS is not set
@@ -1070,10 +1226,6 @@ CONFIG_RAMFS=y
1070# 1226#
1071# CONFIG_PARTITION_ADVANCED is not set 1227# CONFIG_PARTITION_ADVANCED is not set
1072CONFIG_MSDOS_PARTITION=y 1228CONFIG_MSDOS_PARTITION=y
1073
1074#
1075# Native Language Support
1076#
1077CONFIG_NLS=y 1229CONFIG_NLS=y
1078CONFIG_NLS_DEFAULT="iso8859-1" 1230CONFIG_NLS_DEFAULT="iso8859-1"
1079# CONFIG_NLS_CODEPAGE_437 is not set 1231# CONFIG_NLS_CODEPAGE_437 is not set
@@ -1114,30 +1266,22 @@ CONFIG_NLS_CODEPAGE_932=y
1114# CONFIG_NLS_KOI8_R is not set 1266# CONFIG_NLS_KOI8_R is not set
1115# CONFIG_NLS_KOI8_U is not set 1267# CONFIG_NLS_KOI8_U is not set
1116# CONFIG_NLS_UTF8 is not set 1268# CONFIG_NLS_UTF8 is not set
1117
1118#
1119# Distributed Lock Manager
1120#
1121# CONFIG_DLM is not set 1269# CONFIG_DLM is not set
1122 1270
1123# 1271#
1124# Profiling support
1125#
1126CONFIG_PROFILING=y
1127CONFIG_OPROFILE=y
1128
1129#
1130# Kernel hacking 1272# Kernel hacking
1131# 1273#
1132CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1274CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1133# CONFIG_PRINTK_TIME is not set 1275# CONFIG_PRINTK_TIME is not set
1276CONFIG_ENABLE_WARN_DEPRECATED=y
1134CONFIG_ENABLE_MUST_CHECK=y 1277CONFIG_ENABLE_MUST_CHECK=y
1135# CONFIG_MAGIC_SYSRQ is not set 1278# CONFIG_MAGIC_SYSRQ is not set
1136# CONFIG_UNUSED_SYMBOLS is not set 1279# CONFIG_UNUSED_SYMBOLS is not set
1137# CONFIG_DEBUG_FS is not set 1280CONFIG_DEBUG_FS=y
1138# CONFIG_HEADERS_CHECK is not set 1281# CONFIG_HEADERS_CHECK is not set
1139# CONFIG_DEBUG_KERNEL is not set 1282# CONFIG_DEBUG_KERNEL is not set
1140# CONFIG_DEBUG_BUGVERBOSE is not set 1283# CONFIG_DEBUG_BUGVERBOSE is not set
1284# CONFIG_SAMPLES is not set
1141# CONFIG_SH_STANDARD_BIOS is not set 1285# CONFIG_SH_STANDARD_BIOS is not set
1142CONFIG_EARLY_SCIF_CONSOLE=y 1286CONFIG_EARLY_SCIF_CONSOLE=y
1143CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000 1287CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
@@ -1149,7 +1293,53 @@ CONFIG_EARLY_PRINTK=y
1149# 1293#
1150# CONFIG_KEYS is not set 1294# CONFIG_KEYS is not set
1151# CONFIG_SECURITY is not set 1295# CONFIG_SECURITY is not set
1152# CONFIG_CRYPTO is not set 1296# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1297CONFIG_CRYPTO=y
1298# CONFIG_CRYPTO_SEQIV is not set
1299# CONFIG_CRYPTO_MANAGER is not set
1300# CONFIG_CRYPTO_HMAC is not set
1301# CONFIG_CRYPTO_XCBC is not set
1302# CONFIG_CRYPTO_NULL is not set
1303# CONFIG_CRYPTO_MD4 is not set
1304# CONFIG_CRYPTO_MD5 is not set
1305# CONFIG_CRYPTO_SHA1 is not set
1306# CONFIG_CRYPTO_SHA256 is not set
1307# CONFIG_CRYPTO_SHA512 is not set
1308# CONFIG_CRYPTO_WP512 is not set
1309# CONFIG_CRYPTO_TGR192 is not set
1310# CONFIG_CRYPTO_GF128MUL is not set
1311# CONFIG_CRYPTO_ECB is not set
1312# CONFIG_CRYPTO_CBC is not set
1313# CONFIG_CRYPTO_PCBC is not set
1314# CONFIG_CRYPTO_LRW is not set
1315# CONFIG_CRYPTO_XTS is not set
1316# CONFIG_CRYPTO_CTR is not set
1317# CONFIG_CRYPTO_GCM is not set
1318# CONFIG_CRYPTO_CCM is not set
1319# CONFIG_CRYPTO_CRYPTD is not set
1320# CONFIG_CRYPTO_DES is not set
1321# CONFIG_CRYPTO_FCRYPT is not set
1322# CONFIG_CRYPTO_BLOWFISH is not set
1323# CONFIG_CRYPTO_TWOFISH is not set
1324# CONFIG_CRYPTO_SERPENT is not set
1325# CONFIG_CRYPTO_AES is not set
1326# CONFIG_CRYPTO_CAST5 is not set
1327# CONFIG_CRYPTO_CAST6 is not set
1328# CONFIG_CRYPTO_TEA is not set
1329# CONFIG_CRYPTO_ARC4 is not set
1330# CONFIG_CRYPTO_KHAZAD is not set
1331# CONFIG_CRYPTO_ANUBIS is not set
1332# CONFIG_CRYPTO_SEED is not set
1333# CONFIG_CRYPTO_SALSA20 is not set
1334# CONFIG_CRYPTO_DEFLATE is not set
1335# CONFIG_CRYPTO_MICHAEL_MIC is not set
1336# CONFIG_CRYPTO_CRC32C is not set
1337# CONFIG_CRYPTO_CAMELLIA is not set
1338# CONFIG_CRYPTO_TEST is not set
1339# CONFIG_CRYPTO_AUTHENC is not set
1340# CONFIG_CRYPTO_LZO is not set
1341CONFIG_CRYPTO_HW=y
1342# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1153 1343
1154# 1344#
1155# Library routines 1345# Library routines
diff --git a/arch/sh/configs/se7705_defconfig b/arch/sh/configs/se7705_defconfig
index 87ae5c1f8629..84717d854867 100644
--- a/arch/sh/configs/se7705_defconfig
+++ b/arch/sh/configs/se7705_defconfig
@@ -231,7 +231,6 @@ CONFIG_CPU_LITTLE_ENDIAN=y
231# CONFIG_SH_DSP is not set 231# CONFIG_SH_DSP is not set
232# CONFIG_SH_ADC is not set 232# CONFIG_SH_ADC is not set
233CONFIG_CPU_HAS_INTEVT=y 233CONFIG_CPU_HAS_INTEVT=y
234CONFIG_CPU_HAS_PINT_IRQ=y
235CONFIG_CPU_HAS_IPR_IRQ=y 234CONFIG_CPU_HAS_IPR_IRQ=y
236CONFIG_CPU_HAS_SR_RB=y 235CONFIG_CPU_HAS_SR_RB=y
237 236
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index 76ed816d9a24..727126e907e3 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -350,7 +350,7 @@ int register_dmac(struct dma_info *info)
350 350
351 BUG_ON((info->flags & DMAC_CHANNELS_CONFIGURED) && !info->channels); 351 BUG_ON((info->flags & DMAC_CHANNELS_CONFIGURED) && !info->channels);
352 352
353 info->pdev = platform_device_register_simple((char *)info->name, -1, 353 info->pdev = platform_device_register_simple(info->name, -1,
354 NULL, 0); 354 NULL, 0);
355 if (IS_ERR(info->pdev)) 355 if (IS_ERR(info->pdev))
356 return PTR_ERR(info->pdev); 356 return PTR_ERR(info->pdev);
diff --git a/arch/sh/drivers/pci/fixups-lboxre2.c b/arch/sh/drivers/pci/fixups-lboxre2.c
index 40b19bdfb891..1c1d41255ec0 100644
--- a/arch/sh/drivers/pci/fixups-lboxre2.c
+++ b/arch/sh/drivers/pci/fixups-lboxre2.c
@@ -18,7 +18,7 @@ int pci_fixup_pcic(void)
18{ 18{
19 unsigned long bcr1, mcr; 19 unsigned long bcr1, mcr;
20 20
21 bcr1 = inl(SH7751_BCR1); 21 bcr1 = ctrl_inl(SH7751_BCR1);
22 bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */ 22 bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */
23 pci_write_reg(bcr1, SH4_PCIBCR1); 23 pci_write_reg(bcr1, SH4_PCIBCR1);
24 24
@@ -28,7 +28,7 @@ int pci_fixup_pcic(void)
28 pci_write_reg(0xfb900047, SH7751_PCICONF1); 28 pci_write_reg(0xfb900047, SH7751_PCICONF1);
29 pci_write_reg(0xab000001, SH7751_PCICONF4); 29 pci_write_reg(0xab000001, SH7751_PCICONF4);
30 30
31 mcr = inl(SH7751_MCR); 31 mcr = ctrl_inl(SH7751_MCR);
32 mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF; 32 mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF;
33 pci_write_reg(mcr, SH4_PCIMCR); 33 pci_write_reg(mcr, SH4_PCIMCR);
34 34
diff --git a/arch/sh/drivers/pci/fixups-rts7751r2d.c b/arch/sh/drivers/pci/fixups-rts7751r2d.c
index e72ceb560d5b..904bce8768d3 100644
--- a/arch/sh/drivers/pci/fixups-rts7751r2d.c
+++ b/arch/sh/drivers/pci/fixups-rts7751r2d.c
@@ -19,7 +19,7 @@ int pci_fixup_pcic(void)
19{ 19{
20 unsigned long bcr1, mcr; 20 unsigned long bcr1, mcr;
21 21
22 bcr1 = inl(SH7751_BCR1); 22 bcr1 = ctrl_inl(SH7751_BCR1);
23 bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */ 23 bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */
24 pci_write_reg(bcr1, SH4_PCIBCR1); 24 pci_write_reg(bcr1, SH4_PCIBCR1);
25 25
@@ -30,7 +30,7 @@ int pci_fixup_pcic(void)
30 pci_write_reg(0xfb900047, SH7751_PCICONF1); 30 pci_write_reg(0xfb900047, SH7751_PCICONF1);
31 pci_write_reg(0xab000001, SH7751_PCICONF4); 31 pci_write_reg(0xab000001, SH7751_PCICONF4);
32 32
33 mcr = inl(SH7751_MCR); 33 mcr = ctrl_inl(SH7751_MCR);
34 mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF; 34 mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF;
35 pci_write_reg(mcr, SH4_PCIMCR); 35 pci_write_reg(mcr, SH4_PCIMCR);
36 36
diff --git a/arch/sh/drivers/pci/ops-dreamcast.c b/arch/sh/drivers/pci/ops-dreamcast.c
index e1284fc69361..0dac87b19624 100644
--- a/arch/sh/drivers/pci/ops-dreamcast.c
+++ b/arch/sh/drivers/pci/ops-dreamcast.c
@@ -83,9 +83,9 @@ static int gapspci_read(struct pci_bus *bus, unsigned int devfn, int where, int
83 return PCIBIOS_DEVICE_NOT_FOUND; 83 return PCIBIOS_DEVICE_NOT_FOUND;
84 84
85 switch (size) { 85 switch (size) {
86 case 1: *val = inb(GAPSPCI_BBA_CONFIG+where); break; 86 case 1: *val = ctrl_inb(GAPSPCI_BBA_CONFIG+where); break;
87 case 2: *val = inw(GAPSPCI_BBA_CONFIG+where); break; 87 case 2: *val = ctrl_inw(GAPSPCI_BBA_CONFIG+where); break;
88 case 4: *val = inl(GAPSPCI_BBA_CONFIG+where); break; 88 case 4: *val = ctrl_inl(GAPSPCI_BBA_CONFIG+where); break;
89 } 89 }
90 90
91 return PCIBIOS_SUCCESSFUL; 91 return PCIBIOS_SUCCESSFUL;
@@ -97,9 +97,9 @@ static int gapspci_write(struct pci_bus *bus, unsigned int devfn, int where, int
97 return PCIBIOS_DEVICE_NOT_FOUND; 97 return PCIBIOS_DEVICE_NOT_FOUND;
98 98
99 switch (size) { 99 switch (size) {
100 case 1: outb(( u8)val, GAPSPCI_BBA_CONFIG+where); break; 100 case 1: ctrl_outb(( u8)val, GAPSPCI_BBA_CONFIG+where); break;
101 case 2: outw((u16)val, GAPSPCI_BBA_CONFIG+where); break; 101 case 2: ctrl_outw((u16)val, GAPSPCI_BBA_CONFIG+where); break;
102 case 4: outl((u32)val, GAPSPCI_BBA_CONFIG+where); break; 102 case 4: ctrl_outl((u32)val, GAPSPCI_BBA_CONFIG+where); break;
103 } 103 }
104 104
105 return PCIBIOS_SUCCESSFUL; 105 return PCIBIOS_SUCCESSFUL;
@@ -127,36 +127,36 @@ int __init gapspci_init(void)
127 */ 127 */
128 128
129 for (i=0; i<16; i++) 129 for (i=0; i<16; i++)
130 idbuf[i] = inb(GAPSPCI_REGS+i); 130 idbuf[i] = ctrl_inb(GAPSPCI_REGS+i);
131 131
132 if (strncmp(idbuf, "GAPSPCI_BRIDGE_2", 16)) 132 if (strncmp(idbuf, "GAPSPCI_BRIDGE_2", 16))
133 return -ENODEV; 133 return -ENODEV;
134 134
135 outl(0x5a14a501, GAPSPCI_REGS+0x18); 135 ctrl_outl(0x5a14a501, GAPSPCI_REGS+0x18);
136 136
137 for (i=0; i<1000000; i++) 137 for (i=0; i<1000000; i++)
138 ; 138 ;
139 139
140 if (inl(GAPSPCI_REGS+0x18) != 1) 140 if (ctrl_inl(GAPSPCI_REGS+0x18) != 1)
141 return -EINVAL; 141 return -EINVAL;
142 142
143 outl(0x01000000, GAPSPCI_REGS+0x20); 143 ctrl_outl(0x01000000, GAPSPCI_REGS+0x20);
144 outl(0x01000000, GAPSPCI_REGS+0x24); 144 ctrl_outl(0x01000000, GAPSPCI_REGS+0x24);
145 145
146 outl(GAPSPCI_DMA_BASE, GAPSPCI_REGS+0x28); 146 ctrl_outl(GAPSPCI_DMA_BASE, GAPSPCI_REGS+0x28);
147 outl(GAPSPCI_DMA_BASE+GAPSPCI_DMA_SIZE, GAPSPCI_REGS+0x2c); 147 ctrl_outl(GAPSPCI_DMA_BASE+GAPSPCI_DMA_SIZE, GAPSPCI_REGS+0x2c);
148 148
149 outl(1, GAPSPCI_REGS+0x14); 149 ctrl_outl(1, GAPSPCI_REGS+0x14);
150 outl(1, GAPSPCI_REGS+0x34); 150 ctrl_outl(1, GAPSPCI_REGS+0x34);
151 151
152 /* Setting Broadband Adapter */ 152 /* Setting Broadband Adapter */
153 outw(0xf900, GAPSPCI_BBA_CONFIG+0x06); 153 ctrl_outw(0xf900, GAPSPCI_BBA_CONFIG+0x06);
154 outl(0x00000000, GAPSPCI_BBA_CONFIG+0x30); 154 ctrl_outl(0x00000000, GAPSPCI_BBA_CONFIG+0x30);
155 outb(0x00, GAPSPCI_BBA_CONFIG+0x3c); 155 ctrl_outb(0x00, GAPSPCI_BBA_CONFIG+0x3c);
156 outb(0xf0, GAPSPCI_BBA_CONFIG+0x0d); 156 ctrl_outb(0xf0, GAPSPCI_BBA_CONFIG+0x0d);
157 outw(0x0006, GAPSPCI_BBA_CONFIG+0x04); 157 ctrl_outw(0x0006, GAPSPCI_BBA_CONFIG+0x04);
158 outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10); 158 ctrl_outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10);
159 outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14); 159 ctrl_outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14);
160 160
161 return 0; 161 return 0;
162} 162}
diff --git a/arch/sh/drivers/pci/ops-rts7751r2d.c b/arch/sh/drivers/pci/ops-rts7751r2d.c
index ec8430c8d2d1..b3fa3e2ef184 100644
--- a/arch/sh/drivers/pci/ops-rts7751r2d.c
+++ b/arch/sh/drivers/pci/ops-rts7751r2d.c
@@ -33,7 +33,7 @@ int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
33static struct resource sh7751_io_resource = { 33static struct resource sh7751_io_resource = {
34 .name = "SH7751_IO", 34 .name = "SH7751_IO",
35 .start = 0x4000, 35 .start = 0x4000,
36 .end = 0x4000 + SH7751_PCI_IO_SIZE - 1, 36 .end = SH7751_PCI_IO_SIZE - 1,
37 .flags = IORESOURCE_IO 37 .flags = IORESOURCE_IO
38}; 38};
39 39
@@ -68,6 +68,7 @@ static struct sh4_pci_address_map sh7751_pci_map = {
68 68
69int __init pcibios_init_platform(void) 69int __init pcibios_init_platform(void)
70{ 70{
71 __set_io_port_base(SH7751_PCI_IO_BASE);
71 return sh7751_pcic_init(&sh7751_pci_map); 72 return sh7751_pcic_init(&sh7751_pci_map);
72} 73}
73 74
diff --git a/arch/sh/drivers/pci/pci-sh4.h b/arch/sh/drivers/pci/pci-sh4.h
index 4925c79ea959..07e29506080f 100644
--- a/arch/sh/drivers/pci/pci-sh4.h
+++ b/arch/sh/drivers/pci/pci-sh4.h
@@ -172,11 +172,11 @@ struct sh4_pci_address_map {
172 172
173static inline void pci_write_reg(unsigned long val, unsigned long reg) 173static inline void pci_write_reg(unsigned long val, unsigned long reg)
174{ 174{
175 outl(val, PCI_REG(reg)); 175 ctrl_outl(val, PCI_REG(reg));
176} 176}
177 177
178static inline unsigned long pci_read_reg(unsigned long reg) 178static inline unsigned long pci_read_reg(unsigned long reg)
179{ 179{
180 return inl(PCI_REG(reg)); 180 return ctrl_inl(PCI_REG(reg));
181} 181}
182#endif /* __PCI_SH4_H */ 182#endif /* __PCI_SH4_H */
diff --git a/arch/sh/drivers/pci/pci-sh7751.c b/arch/sh/drivers/pci/pci-sh7751.c
index 1aca7fe5783b..3065eb184f01 100644
--- a/arch/sh/drivers/pci/pci-sh7751.c
+++ b/arch/sh/drivers/pci/pci-sh7751.c
@@ -58,7 +58,7 @@ static int __init __area_sdram_check(unsigned int area)
58{ 58{
59 u32 word; 59 u32 word;
60 60
61 word = inl(SH7751_BCR1); 61 word = ctrl_inl(SH7751_BCR1);
62 /* check BCR for SDRAM in area */ 62 /* check BCR for SDRAM in area */
63 if (((word >> area) & 1) == 0) { 63 if (((word >> area) & 1) == 0) {
64 printk("PCI: Area %d is not configured for SDRAM. BCR1=0x%x\n", 64 printk("PCI: Area %d is not configured for SDRAM. BCR1=0x%x\n",
@@ -67,7 +67,7 @@ static int __init __area_sdram_check(unsigned int area)
67 } 67 }
68 pci_write_reg(word, SH4_PCIBCR1); 68 pci_write_reg(word, SH4_PCIBCR1);
69 69
70 word = (u16)inw(SH7751_BCR2); 70 word = (u16)ctrl_inw(SH7751_BCR2);
71 /* check BCR2 for 32bit SDRAM interface*/ 71 /* check BCR2 for 32bit SDRAM interface*/
72 if (((word >> (area << 1)) & 0x3) != 0x3) { 72 if (((word >> (area << 1)) & 0x3) != 0x3) {
73 printk("PCI: Area %d is not 32 bit SDRAM. BCR2=0x%x\n", 73 printk("PCI: Area %d is not 32 bit SDRAM. BCR2=0x%x\n",
@@ -85,9 +85,9 @@ int __init sh7751_pcic_init(struct sh4_pci_address_map *map)
85 u32 word; 85 u32 word;
86 86
87 /* Set the BCR's to enable PCI access */ 87 /* Set the BCR's to enable PCI access */
88 reg = inl(SH7751_BCR1); 88 reg = ctrl_inl(SH7751_BCR1);
89 reg |= 0x80000; 89 reg |= 0x80000;
90 outl(reg, SH7751_BCR1); 90 ctrl_outl(reg, SH7751_BCR1);
91 91
92 /* Turn the clocks back on (not done in reset)*/ 92 /* Turn the clocks back on (not done in reset)*/
93 pci_write_reg(0, SH4_PCICLKR); 93 pci_write_reg(0, SH4_PCICLKR);
@@ -179,13 +179,13 @@ int __init sh7751_pcic_init(struct sh4_pci_address_map *map)
179 return 0; 179 return 0;
180 180
181 /* configure the wait control registers */ 181 /* configure the wait control registers */
182 word = inl(SH7751_WCR1); 182 word = ctrl_inl(SH7751_WCR1);
183 pci_write_reg(word, SH4_PCIWCR1); 183 pci_write_reg(word, SH4_PCIWCR1);
184 word = inl(SH7751_WCR2); 184 word = ctrl_inl(SH7751_WCR2);
185 pci_write_reg(word, SH4_PCIWCR2); 185 pci_write_reg(word, SH4_PCIWCR2);
186 word = inl(SH7751_WCR3); 186 word = ctrl_inl(SH7751_WCR3);
187 pci_write_reg(word, SH4_PCIWCR3); 187 pci_write_reg(word, SH4_PCIWCR3);
188 word = inl(SH7751_MCR); 188 word = ctrl_inl(SH7751_MCR);
189 pci_write_reg(word, SH4_PCIMCR); 189 pci_write_reg(word, SH4_PCIMCR);
190 190
191 /* NOTE: I'm ignoring the PCI error IRQs for now.. 191 /* NOTE: I'm ignoring the PCI error IRQs for now..
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index 7d797f4de5e7..b2a2bfa3c1bd 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -52,7 +52,7 @@ static int __init sh7780_pci_init(void)
52 52
53 pr_debug("PCI: Starting intialization.\n"); 53 pr_debug("PCI: Starting intialization.\n");
54 54
55 outl(0x00000001, SH7780_PCI_VCR2); /* Enable PCIC */ 55 ctrl_outl(0x00000001, SH7780_PCI_VCR2); /* Enable PCIC */
56 56
57 /* check for SH7780/SH7780R hardware */ 57 /* check for SH7780/SH7780R hardware */
58 id = pci_read_reg(SH7780_PCIVID); 58 id = pci_read_reg(SH7780_PCIVID);
diff --git a/arch/sh/kernel/Makefile_32 b/arch/sh/kernel/Makefile_32
index c89289831053..62bf373266f7 100644
--- a/arch/sh/kernel/Makefile_32
+++ b/arch/sh/kernel/Makefile_32
@@ -22,5 +22,6 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
22obj-$(CONFIG_PM) += pm.o 22obj-$(CONFIG_PM) += pm.o
23obj-$(CONFIG_STACKTRACE) += stacktrace.o 23obj-$(CONFIG_STACKTRACE) += stacktrace.o
24obj-$(CONFIG_BINFMT_ELF) += dump_task.o 24obj-$(CONFIG_BINFMT_ELF) += dump_task.o
25obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
25 26
26EXTRA_CFLAGS += -Werror 27EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/kernel/Makefile_64 b/arch/sh/kernel/Makefile_64
index 1ef21cc087f3..e01283d49cbf 100644
--- a/arch/sh/kernel/Makefile_64
+++ b/arch/sh/kernel/Makefile_64
@@ -18,5 +18,6 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
18obj-$(CONFIG_PM) += pm.o 18obj-$(CONFIG_PM) += pm.o
19obj-$(CONFIG_STACKTRACE) += stacktrace.o 19obj-$(CONFIG_STACKTRACE) += stacktrace.o
20obj-$(CONFIG_BINFMT_ELF) += dump_task.o 20obj-$(CONFIG_BINFMT_ELF) += dump_task.o
21obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
21 22
22EXTRA_CFLAGS += -Werror 23EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/kernel/cpu/irq/Makefile b/arch/sh/kernel/cpu/irq/Makefile
index cc1836e47a5d..462a8f6dfee2 100644
--- a/arch/sh/kernel/cpu/irq/Makefile
+++ b/arch/sh/kernel/cpu/irq/Makefile
@@ -6,4 +6,3 @@ obj-y += intc.o
6obj-$(CONFIG_SUPERH32) += imask.o 6obj-$(CONFIG_SUPERH32) += imask.o
7obj-$(CONFIG_CPU_SH5) += intc-sh5.o 7obj-$(CONFIG_CPU_SH5) += intc-sh5.o
8obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o 8obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o
9obj-$(CONFIG_CPU_HAS_MASKREG_IRQ) += maskreg.o
diff --git a/arch/sh/kernel/cpu/irq/intc-sh5.c b/arch/sh/kernel/cpu/irq/intc-sh5.c
index 43ee7a9a4f0b..d6e0e2bdaad5 100644
--- a/arch/sh/kernel/cpu/irq/intc-sh5.c
+++ b/arch/sh/kernel/cpu/irq/intc-sh5.c
@@ -75,21 +75,6 @@ int intc_evt_to_irq[(0xE20/0x20)+1] = {
75 -1, -1 /* 0xE00 - 0xE20 */ 75 -1, -1 /* 0xE00 - 0xE20 */
76}; 76};
77 77
78/*
79 * Opposite mapper.
80 */
81static int IRQ_to_vectorN[NR_INTC_IRQS] = {
82 0x12, 0x15, 0x18, 0x1B, 0x40, 0x41, 0x42, 0x43, /* 0- 7 */
83 -1, -1, -1, -1, 0x50, 0x51, 0x52, 0x53, /* 8-15 */
84 0x54, 0x55, 0x32, 0x33, 0x34, 0x35, 0x36, -1, /* 16-23 */
85 -1, -1, -1, -1, -1, -1, -1, -1, /* 24-31 */
86 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x38, /* 32-39 */
87 0x39, 0x3A, 0x3B, -1, -1, -1, -1, -1, /* 40-47 */
88 -1, -1, -1, -1, -1, -1, -1, -1, /* 48-55 */
89 -1, -1, -1, -1, -1, -1, -1, 0x2B, /* 56-63 */
90
91};
92
93static unsigned long intc_virt; 78static unsigned long intc_virt;
94 79
95static unsigned int startup_intc_irq(unsigned int irq); 80static unsigned int startup_intc_irq(unsigned int irq);
@@ -176,6 +161,18 @@ void make_intc_irq(unsigned int irq)
176} 161}
177 162
178#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL) 163#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
164static int IRQ_to_vectorN[NR_INTC_IRQS] = {
165 0x12, 0x15, 0x18, 0x1B, 0x40, 0x41, 0x42, 0x43, /* 0- 7 */
166 -1, -1, -1, -1, 0x50, 0x51, 0x52, 0x53, /* 8-15 */
167 0x54, 0x55, 0x32, 0x33, 0x34, 0x35, 0x36, -1, /* 16-23 */
168 -1, -1, -1, -1, -1, -1, -1, -1, /* 24-31 */
169 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x38, /* 32-39 */
170 0x39, 0x3A, 0x3B, -1, -1, -1, -1, -1, /* 40-47 */
171 -1, -1, -1, -1, -1, -1, -1, -1, /* 48-55 */
172 -1, -1, -1, -1, -1, -1, -1, 0x2B, /* 56-63 */
173
174};
175
179int intc_irq_describe(char* p, int irq) 176int intc_irq_describe(char* p, int irq)
180{ 177{
181 if (irq < NR_INTC_IRQS) 178 if (irq < NR_INTC_IRQS)
diff --git a/arch/sh/kernel/cpu/irq/maskreg.c b/arch/sh/kernel/cpu/irq/maskreg.c
deleted file mode 100644
index 978992e367a5..000000000000
--- a/arch/sh/kernel/cpu/irq/maskreg.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Interrupt handling for Simple external interrupt mask register
3 *
4 * Copyright (C) 2001 A&D Co., Ltd. <http://www.aandd.co.jp>
5 *
6 * This is for the machine which have single 16 bit register
7 * for masking external IRQ individually.
8 * Each bit of the register is for masking each interrupt.
9 *
10 * This file may be copied or modified under the terms of the GNU
11 * General Public License. See linux/COPYING for more information.
12 */
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <asm/system.h>
17#include <asm/io.h>
18
19/* address of external interrupt mask register */
20unsigned long irq_mask_register;
21
22/* forward declaration */
23static unsigned int startup_maskreg_irq(unsigned int irq);
24static void shutdown_maskreg_irq(unsigned int irq);
25static void enable_maskreg_irq(unsigned int irq);
26static void disable_maskreg_irq(unsigned int irq);
27static void mask_and_ack_maskreg(unsigned int);
28static void end_maskreg_irq(unsigned int irq);
29
30/* hw_interrupt_type */
31static struct hw_interrupt_type maskreg_irq_type = {
32 .typename = "Mask Register",
33 .startup = startup_maskreg_irq,
34 .shutdown = shutdown_maskreg_irq,
35 .enable = enable_maskreg_irq,
36 .disable = disable_maskreg_irq,
37 .ack = mask_and_ack_maskreg,
38 .end = end_maskreg_irq
39};
40
41/* actual implementation */
42static unsigned int startup_maskreg_irq(unsigned int irq)
43{
44 enable_maskreg_irq(irq);
45 return 0; /* never anything pending */
46}
47
48static void shutdown_maskreg_irq(unsigned int irq)
49{
50 disable_maskreg_irq(irq);
51}
52
53static void disable_maskreg_irq(unsigned int irq)
54{
55 unsigned short val, mask = 0x01 << irq;
56
57 BUG_ON(!irq_mask_register);
58
59 /* Set "irq"th bit */
60 val = ctrl_inw(irq_mask_register);
61 val |= mask;
62 ctrl_outw(val, irq_mask_register);
63}
64
65static void enable_maskreg_irq(unsigned int irq)
66{
67 unsigned short val, mask = ~(0x01 << irq);
68
69 BUG_ON(!irq_mask_register);
70
71 /* Clear "irq"th bit */
72 val = ctrl_inw(irq_mask_register);
73 val &= mask;
74 ctrl_outw(val, irq_mask_register);
75}
76
77static void mask_and_ack_maskreg(unsigned int irq)
78{
79 disable_maskreg_irq(irq);
80}
81
82static void end_maskreg_irq(unsigned int irq)
83{
84 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
85 enable_maskreg_irq(irq);
86}
87
88void make_maskreg_irq(unsigned int irq)
89{
90 disable_irq_nosync(irq);
91 irq_desc[irq].handler = &maskreg_irq_type;
92 disable_maskreg_irq(irq);
93}
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index f2b9238cda04..9e89984c4f1d 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -126,12 +126,18 @@ int __init detect_cpu_and_cache_system(void)
126 CPU_HAS_LLSC; 126 CPU_HAS_LLSC;
127 break; 127 break;
128 case 0x3008: 128 case 0x3008:
129 if (prr == 0xa0) { 129 if (prr == 0xa0 || prr == 0xa1) {
130 boot_cpu_data.type = CPU_SH7722; 130 boot_cpu_data.type = CPU_SH7722;
131 boot_cpu_data.icache.ways = 4; 131 boot_cpu_data.icache.ways = 4;
132 boot_cpu_data.dcache.ways = 4; 132 boot_cpu_data.dcache.ways = 4;
133 boot_cpu_data.flags |= CPU_HAS_LLSC; 133 boot_cpu_data.flags |= CPU_HAS_LLSC;
134 } 134 }
135 else if (prr == 0x70) {
136 boot_cpu_data.type = CPU_SH7366;
137 boot_cpu_data.icache.ways = 4;
138 boot_cpu_data.dcache.ways = 4;
139 boot_cpu_data.flags |= CPU_HAS_LLSC;
140 }
135 break; 141 break;
136 case 0x4000: /* 1st cut */ 142 case 0x4000: /* 1st cut */
137 case 0x4001: /* 2nd cut */ 143 case 0x4001: /* 2nd cut */
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index 08ac6387bf17..5d890ac8e793 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o
9obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o 9obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o 11obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o
12obj-$(CONFIG_CPU_SUBTYPE_SH7366) += setup-sh7366.o
12obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o 13obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o
13 14
14# SMP setup 15# SMP setup
@@ -21,6 +22,7 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o
21clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o 22clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o
22clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o 23clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o
23clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o 24clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o
25clock-$(CONFIG_CPU_SUBTYPE_SH7366) := clock-sh7722.o
24clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o 26clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o
25 27
26obj-y += $(clock-y) 28obj-y += $(clock-y)
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index a0fd8bb21f7c..299138ebe160 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/sh/kernel/cpu/sh4a/clock-sh7722.c 2 * arch/sh/kernel/cpu/sh4a/clock-sh7722.c
3 * 3 *
4 * SH7722 support for the clock framework 4 * SH7722 & SH7366 support for the clock framework
5 * 5 *
6 * Copyright (c) 2006-2007 Nomad Global Solutions Inc 6 * Copyright (c) 2006-2007 Nomad Global Solutions Inc
7 * Based on code for sh7343 by Paul Mundt 7 * Based on code for sh7343 by Paul Mundt
@@ -417,15 +417,19 @@ static int sh7722_siu_which(struct clk *clk)
417 return 0; 417 return 0;
418 if (!strcmp(clk->name, "siu_b_clk")) 418 if (!strcmp(clk->name, "siu_b_clk"))
419 return 1; 419 return 1;
420#if defined(CONFIG_CPU_SUBTYPE_SH7722)
420 if (!strcmp(clk->name, "irda_clk")) 421 if (!strcmp(clk->name, "irda_clk"))
421 return 2; 422 return 2;
423#endif
422 return -EINVAL; 424 return -EINVAL;
423} 425}
424 426
425static unsigned long sh7722_siu_regs[] = { 427static unsigned long sh7722_siu_regs[] = {
426 [0] = SCLKACR, 428 [0] = SCLKACR,
427 [1] = SCLKBCR, 429 [1] = SCLKBCR,
430#if defined(CONFIG_CPU_SUBTYPE_SH7722)
428 [2] = IrDACLKCR, 431 [2] = IrDACLKCR,
432#endif
429}; 433};
430 434
431static int sh7722_siu_start_stop(struct clk *clk, int enable) 435static int sh7722_siu_start_stop(struct clk *clk, int enable)
@@ -571,10 +575,12 @@ static struct clk sh7722_siu_b_clock = {
571 .ops = &sh7722_siu_clk_ops, 575 .ops = &sh7722_siu_clk_ops,
572}; 576};
573 577
578#if defined(CONFIG_CPU_SUBTYPE_SH7722)
574static struct clk sh7722_irda_clock = { 579static struct clk sh7722_irda_clock = {
575 .name = "irda_clk", 580 .name = "irda_clk",
576 .ops = &sh7722_siu_clk_ops, 581 .ops = &sh7722_siu_clk_ops,
577}; 582};
583#endif
578 584
579static struct clk sh7722_video_clock = { 585static struct clk sh7722_video_clock = {
580 .name = "video_clk", 586 .name = "video_clk",
@@ -588,7 +594,9 @@ static struct clk *sh7722_clocks[] = {
588 &sh7722_sdram_clock, 594 &sh7722_sdram_clock,
589 &sh7722_siu_a_clock, 595 &sh7722_siu_a_clock,
590 &sh7722_siu_b_clock, 596 &sh7722_siu_b_clock,
597#if defined(CONFIG_CPU_SUBTYPE_SH7722)
591 &sh7722_irda_clock, 598 &sh7722_irda_clock,
599#endif
592 &sh7722_video_clock, 600 &sh7722_video_clock,
593}; 601};
594 602
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
new file mode 100644
index 000000000000..967e8b69a2f8
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -0,0 +1,177 @@
1/*
2 * SH7366 Setup
3 *
4 * Copyright (C) 2008 Renesas Solutions
5 *
6 * Based on linux/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/platform_device.h>
13#include <linux/init.h>
14#include <linux/serial.h>
15#include <asm/sci.h>
16
17static struct plat_sci_port sci_platform_data[] = {
18 {
19 .mapbase = 0xffe00000,
20 .flags = UPF_BOOT_AUTOCONF,
21 .type = PORT_SCIF,
22 .irqs = { 80, 80, 80, 80 },
23 }, {
24 .flags = 0,
25 }
26};
27
28static struct platform_device sci_device = {
29 .name = "sh-sci",
30 .id = -1,
31 .dev = {
32 .platform_data = sci_platform_data,
33 },
34};
35
36static struct platform_device *sh7366_devices[] __initdata = {
37 &sci_device,
38};
39
40static int __init sh7366_devices_setup(void)
41{
42 return platform_add_devices(sh7366_devices,
43 ARRAY_SIZE(sh7366_devices));
44}
45__initcall(sh7366_devices_setup);
46
47enum {
48 UNUSED=0,
49
50 /* interrupt sources */
51 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
52 ICB,
53 DMAC0, DMAC1, DMAC2, DMAC3,
54 VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU,
55 MFI, VPU, USB,
56 MMC_MMC1I, MMC_MMC2I, MMC_MMC3I,
57 DMAC4, DMAC5, DMAC_DADERR,
58 SCIF, SCIFA1, SCIFA2,
59 DENC, MSIOF,
60 FLCTL_FLSTEI, FLCTL_FLENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
61 I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI,
62 SDHI0, SDHI1, SDHI2, SDHI3,
63 CMT, TSIF, SIU,
64 TMU0, TMU1, TMU2,
65 VEU2, LCDC,
66
67 /* interrupt groups */
68
69 DMAC0123, VIOVOU, MMC, DMAC45, FLCTL, I2C, SDHI,
70};
71
72static struct intc_vect vectors[] __initdata = {
73 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
74 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
75 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
76 INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
77 INTC_VECT(ICB, 0x700),
78 INTC_VECT(DMAC0, 0x800), INTC_VECT(DMAC1, 0x820),
79 INTC_VECT(DMAC2, 0x840), INTC_VECT(DMAC3, 0x860),
80 INTC_VECT(VIO_CEUI, 0x880), INTC_VECT(VIO_BEUI, 0x8a0),
81 INTC_VECT(VIO_VEUI, 0x8c0), INTC_VECT(VOU, 0x8e0),
82 INTC_VECT(MFI, 0x900), INTC_VECT(VPU, 0x980), INTC_VECT(USB, 0xa20),
83 INTC_VECT(MMC_MMC1I, 0xb00), INTC_VECT(MMC_MMC2I, 0xb20),
84 INTC_VECT(MMC_MMC3I, 0xb40),
85 INTC_VECT(DMAC4, 0xb80), INTC_VECT(DMAC5, 0xba0),
86 INTC_VECT(DMAC_DADERR, 0xbc0),
87 INTC_VECT(SCIF, 0xc00), INTC_VECT(SCIFA1, 0xc20),
88 INTC_VECT(SCIFA2, 0xc40),
89 INTC_VECT(DENC, 0xc60), INTC_VECT(MSIOF, 0xc80),
90 INTC_VECT(FLCTL_FLSTEI, 0xd80), INTC_VECT(FLCTL_FLENDI, 0xda0),
91 INTC_VECT(FLCTL_FLTREQ0I, 0xdc0), INTC_VECT(FLCTL_FLTREQ1I, 0xde0),
92 INTC_VECT(I2C_ALI, 0xe00), INTC_VECT(I2C_TACKI, 0xe20),
93 INTC_VECT(I2C_WAITI, 0xe40), INTC_VECT(I2C_DTEI, 0xe60),
94 INTC_VECT(SDHI0, 0xe80), INTC_VECT(SDHI1, 0xea0),
95 INTC_VECT(SDHI2, 0xec0), INTC_VECT(SDHI3, 0xee0),
96 INTC_VECT(CMT, 0xf00), INTC_VECT(TSIF, 0xf20),
97 INTC_VECT(SIU, 0xf80),
98 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
99 INTC_VECT(TMU2, 0x440),
100 INTC_VECT(VEU2, 0x580), INTC_VECT(LCDC, 0x580),
101};
102
103static struct intc_group groups[] __initdata = {
104 INTC_GROUP(DMAC0123, DMAC0, DMAC1, DMAC2, DMAC3),
105 INTC_GROUP(VIOVOU, VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU),
106 INTC_GROUP(MMC, MMC_MMC1I, MMC_MMC2I, MMC_MMC3I),
107 INTC_GROUP(DMAC45, DMAC4, DMAC5, DMAC_DADERR),
108 INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLENDI,
109 FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
110 INTC_GROUP(I2C, I2C_ALI, I2C_TACKI, I2C_WAITI, I2C_DTEI),
111 INTC_GROUP(SDHI, SDHI0, SDHI1, SDHI2, SDHI3),
112};
113
114static struct intc_mask_reg mask_registers[] __initdata = {
115 { 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
116 { } },
117 { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
118 { VOU, VIO_VEUI, VIO_BEUI, VIO_CEUI, DMAC3, DMAC2, DMAC1, DMAC0 } },
119 { 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
120 { 0, 0, 0, VPU, 0, 0, 0, MFI } },
121 { 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
122 { 0, 0, 0, ICB } },
123 { 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
124 { 0, TMU2, TMU1, TMU0, VEU2, 0, 0, LCDC } },
125 { 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
126 { 0, DMAC_DADERR, DMAC5, DMAC4, DENC, SCIFA2, SCIFA1, SCIF } },
127 { 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
128 { 0, 0, 0, 0, 0, 0, 0, MSIOF } },
129 { 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
130 { I2C_DTEI, I2C_WAITI, I2C_TACKI, I2C_ALI,
131 FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLENDI, FLCTL_FLSTEI } },
132 { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
133 { SDHI3, SDHI2, SDHI1, SDHI0, 0, 0, 0, SIU } },
134 { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
135 { 0, 0, 0, CMT, 0, USB, } },
136 { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
137 { 0, MMC_MMC3I, MMC_MMC2I, MMC_MMC1I } },
138 { 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
139 { 0, 0, 0, 0, 0, 0, 0, TSIF } },
140 { 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
141 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
142};
143
144static struct intc_prio_reg prio_registers[] __initdata = {
145 { 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2 } },
146 { 0xa4080004, 0, 16, 4, /* IPRB */ { VEU2, LCDC, ICB } },
147 { 0xa4080008, 0, 16, 4, /* IPRC */ { } },
148 { 0xa408000c, 0, 16, 4, /* IPRD */ { } },
149 { 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0123, VIOVOU, MFI, VPU } },
150 { 0xa4080014, 0, 16, 4, /* IPRF */ { 0, DMAC45, USB, CMT } },
151 { 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF, SCIFA1, SCIFA2, DENC } },
152 { 0xa408001c, 0, 16, 4, /* IPRH */ { MSIOF, 0, FLCTL, I2C } },
153 { 0xa4080020, 0, 16, 4, /* IPRI */ { 0, 0, TSIF, } },
154 { 0xa4080024, 0, 16, 4, /* IPRJ */ { 0, 0, SIU } },
155 { 0xa4080028, 0, 16, 4, /* IPRK */ { 0, MMC, 0, SDHI } },
156 { 0xa408002c, 0, 16, 4, /* IPRL */ { } },
157 { 0xa4140010, 0, 32, 4, /* INTPRI00 */
158 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
159};
160
161static struct intc_sense_reg sense_registers[] __initdata = {
162 { 0xa414001c, 16, 2, /* ICR1 */
163 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
164};
165
166static DECLARE_INTC_DESC(intc_desc, "sh7366", vectors, groups,
167 mask_registers, prio_registers, sense_registers);
168
169void __init plat_irq_setup(void)
170{
171 register_intc_controller(&intc_desc);
172}
173
174void __init plat_mem_setup(void)
175{
176 /* TODO: Register Node 1 */
177}
diff --git a/arch/sh/kernel/cpu/sh5/probe.c b/arch/sh/kernel/cpu/sh5/probe.c
index 15d167fd0ae7..31f8cb0f6374 100644
--- a/arch/sh/kernel/cpu/sh5/probe.c
+++ b/arch/sh/kernel/cpu/sh5/probe.c
@@ -20,19 +20,18 @@ int __init detect_cpu_and_cache_system(void)
20{ 20{
21 unsigned long long cir; 21 unsigned long long cir;
22 22
23 /* Do peeks in real mode to avoid having to set up a mapping for the 23 /*
24 WPC registers. On SH5-101 cut2, such a mapping would be exposed to 24 * Do peeks in real mode to avoid having to set up a mapping for
25 an address translation erratum which would make it hard to set up 25 * the WPC registers. On SH5-101 cut2, such a mapping would be
26 correctly. */ 26 * exposed to an address translation erratum which would make it
27 * hard to set up correctly.
28 */
27 cir = peek_real_address_q(0x0d000008); 29 cir = peek_real_address_q(0x0d000008);
28 if ((cir & 0xffff) == 0x5103) { 30 if ((cir & 0xffff) == 0x5103)
29 boot_cpu_data.type = CPU_SH5_103; 31 boot_cpu_data.type = CPU_SH5_103;
30 } else if (((cir >> 32) & 0xffff) == 0x51e2) { 32 else if (((cir >> 32) & 0xffff) == 0x51e2)
31 /* CPU.VCR aliased at CIR address on SH5-101 */ 33 /* CPU.VCR aliased at CIR address on SH5-101 */
32 boot_cpu_data.type = CPU_SH5_101; 34 boot_cpu_data.type = CPU_SH5_101;
33 } else {
34 boot_cpu_data.type = CPU_SH_NONE;
35 }
36 35
37 /* 36 /*
38 * First, setup some sane values for the I-cache. 37 * First, setup some sane values for the I-cache.
@@ -40,37 +39,33 @@ int __init detect_cpu_and_cache_system(void)
40 boot_cpu_data.icache.ways = 4; 39 boot_cpu_data.icache.ways = 4;
41 boot_cpu_data.icache.sets = 256; 40 boot_cpu_data.icache.sets = 256;
42 boot_cpu_data.icache.linesz = L1_CACHE_BYTES; 41 boot_cpu_data.icache.linesz = L1_CACHE_BYTES;
42 boot_cpu_data.icache.way_incr = (1 << 13);
43 boot_cpu_data.icache.entry_shift = 5;
44 boot_cpu_data.icache.way_size = boot_cpu_data.icache.sets *
45 boot_cpu_data.icache.linesz;
46 boot_cpu_data.icache.entry_mask = 0x1fe0;
47 boot_cpu_data.icache.flags = 0;
43 48
44#if 0
45 /* 49 /*
46 * FIXME: This can probably be cleaned up a bit as well.. for example, 50 * Next, setup some sane values for the D-cache.
47 * do we really need the way shift _and_ the way_step_shift ?? Judging 51 *
48 * by the existing code, I would guess no.. is there any valid reason 52 * On the SH5, these are pretty consistent with the I-cache settings,
49 * why we need to be tracking this around? 53 * so we just copy over the existing definitions.. these can be fixed
54 * up later, especially if we add runtime CPU probing.
55 *
56 * Though in the meantime it saves us from having to duplicate all of
57 * the above definitions..
50 */ 58 */
51 boot_cpu_data.icache.way_shift = 13; 59 boot_cpu_data.dcache = boot_cpu_data.icache;
52 boot_cpu_data.icache.entry_shift = 5;
53 boot_cpu_data.icache.set_shift = 4;
54 boot_cpu_data.icache.way_step_shift = 16;
55 boot_cpu_data.icache.asid_shift = 2;
56 60
57 /* 61 /*
58 * way offset = cache size / associativity, so just don't factor in 62 * Setup any cache-related flags here
59 * associativity in the first place..
60 */ 63 */
61 boot_cpu_data.icache.way_ofs = boot_cpu_data.icache.sets * 64#if defined(CONFIG_CACHE_WRITETHROUGH)
62 boot_cpu_data.icache.linesz; 65 set_bit(SH_CACHE_MODE_WT, &(boot_cpu_data.dcache.flags));
63 66#elif defined(CONFIG_CACHE_WRITEBACK)
64 boot_cpu_data.icache.asid_mask = 0x3fc; 67 set_bit(SH_CACHE_MODE_WB, &(boot_cpu_data.dcache.flags));
65 boot_cpu_data.icache.idx_mask = 0x1fe0;
66 boot_cpu_data.icache.epn_mask = 0xffffe000;
67#endif 68#endif
68 69
69 boot_cpu_data.icache.flags = 0;
70
71 /* A trivial starting point.. */
72 memcpy(&boot_cpu_data.dcache,
73 &boot_cpu_data.icache, sizeof(struct cache_info));
74
75 return 0; 70 return 0;
76} 71}
diff --git a/arch/sh/kernel/io.c b/arch/sh/kernel/io.c
index 71c9fde2fd90..2b8991229900 100644
--- a/arch/sh/kernel/io.c
+++ b/arch/sh/kernel/io.c
@@ -63,7 +63,13 @@ EXPORT_SYMBOL(memset_io);
63 63
64void __iomem *ioport_map(unsigned long port, unsigned int nr) 64void __iomem *ioport_map(unsigned long port, unsigned int nr)
65{ 65{
66 return sh_mv.mv_ioport_map(port, nr); 66 void __iomem *ret;
67
68 ret = __ioport_map_trapped(port, nr);
69 if (ret)
70 return ret;
71
72 return __ioport_map(port, nr);
67} 73}
68EXPORT_SYMBOL(ioport_map); 74EXPORT_SYMBOL(ioport_map);
69 75
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
index 771ea4230441..db769449f5a7 100644
--- a/arch/sh/kernel/io_generic.c
+++ b/arch/sh/kernel/io_generic.c
@@ -33,17 +33,17 @@ static inline void delay(void)
33 33
34u8 generic_inb(unsigned long port) 34u8 generic_inb(unsigned long port)
35{ 35{
36 return ctrl_inb((unsigned long __force)ioport_map(port, 1)); 36 return ctrl_inb((unsigned long __force)__ioport_map(port, 1));
37} 37}
38 38
39u16 generic_inw(unsigned long port) 39u16 generic_inw(unsigned long port)
40{ 40{
41 return ctrl_inw((unsigned long __force)ioport_map(port, 2)); 41 return ctrl_inw((unsigned long __force)__ioport_map(port, 2));
42} 42}
43 43
44u32 generic_inl(unsigned long port) 44u32 generic_inl(unsigned long port)
45{ 45{
46 return ctrl_inl((unsigned long __force)ioport_map(port, 4)); 46 return ctrl_inl((unsigned long __force)__ioport_map(port, 4));
47} 47}
48 48
49u8 generic_inb_p(unsigned long port) 49u8 generic_inb_p(unsigned long port)
@@ -81,7 +81,7 @@ void generic_insb(unsigned long port, void *dst, unsigned long count)
81 volatile u8 *port_addr; 81 volatile u8 *port_addr;
82 u8 *buf = dst; 82 u8 *buf = dst;
83 83
84 port_addr = (volatile u8 *)ioport_map(port, 1); 84 port_addr = (volatile u8 *)__ioport_map(port, 1);
85 while (count--) 85 while (count--)
86 *buf++ = *port_addr; 86 *buf++ = *port_addr;
87} 87}
@@ -91,7 +91,7 @@ void generic_insw(unsigned long port, void *dst, unsigned long count)
91 volatile u16 *port_addr; 91 volatile u16 *port_addr;
92 u16 *buf = dst; 92 u16 *buf = dst;
93 93
94 port_addr = (volatile u16 *)ioport_map(port, 2); 94 port_addr = (volatile u16 *)__ioport_map(port, 2);
95 while (count--) 95 while (count--)
96 *buf++ = *port_addr; 96 *buf++ = *port_addr;
97 97
@@ -103,7 +103,7 @@ void generic_insl(unsigned long port, void *dst, unsigned long count)
103 volatile u32 *port_addr; 103 volatile u32 *port_addr;
104 u32 *buf = dst; 104 u32 *buf = dst;
105 105
106 port_addr = (volatile u32 *)ioport_map(port, 4); 106 port_addr = (volatile u32 *)__ioport_map(port, 4);
107 while (count--) 107 while (count--)
108 *buf++ = *port_addr; 108 *buf++ = *port_addr;
109 109
@@ -112,17 +112,17 @@ void generic_insl(unsigned long port, void *dst, unsigned long count)
112 112
113void generic_outb(u8 b, unsigned long port) 113void generic_outb(u8 b, unsigned long port)
114{ 114{
115 ctrl_outb(b, (unsigned long __force)ioport_map(port, 1)); 115 ctrl_outb(b, (unsigned long __force)__ioport_map(port, 1));
116} 116}
117 117
118void generic_outw(u16 b, unsigned long port) 118void generic_outw(u16 b, unsigned long port)
119{ 119{
120 ctrl_outw(b, (unsigned long __force)ioport_map(port, 2)); 120 ctrl_outw(b, (unsigned long __force)__ioport_map(port, 2));
121} 121}
122 122
123void generic_outl(u32 b, unsigned long port) 123void generic_outl(u32 b, unsigned long port)
124{ 124{
125 ctrl_outl(b, (unsigned long __force)ioport_map(port, 4)); 125 ctrl_outl(b, (unsigned long __force)__ioport_map(port, 4));
126} 126}
127 127
128void generic_outb_p(u8 b, unsigned long port) 128void generic_outb_p(u8 b, unsigned long port)
@@ -153,7 +153,7 @@ void generic_outsb(unsigned long port, const void *src, unsigned long count)
153 volatile u8 *port_addr; 153 volatile u8 *port_addr;
154 const u8 *buf = src; 154 const u8 *buf = src;
155 155
156 port_addr = (volatile u8 __force *)ioport_map(port, 1); 156 port_addr = (volatile u8 __force *)__ioport_map(port, 1);
157 157
158 while (count--) 158 while (count--)
159 *port_addr = *buf++; 159 *port_addr = *buf++;
@@ -164,7 +164,7 @@ void generic_outsw(unsigned long port, const void *src, unsigned long count)
164 volatile u16 *port_addr; 164 volatile u16 *port_addr;
165 const u16 *buf = src; 165 const u16 *buf = src;
166 166
167 port_addr = (volatile u16 __force *)ioport_map(port, 2); 167 port_addr = (volatile u16 __force *)__ioport_map(port, 2);
168 168
169 while (count--) 169 while (count--)
170 *port_addr = *buf++; 170 *port_addr = *buf++;
@@ -177,7 +177,7 @@ void generic_outsl(unsigned long port, const void *src, unsigned long count)
177 volatile u32 *port_addr; 177 volatile u32 *port_addr;
178 const u32 *buf = src; 178 const u32 *buf = src;
179 179
180 port_addr = (volatile u32 __force *)ioport_map(port, 4); 180 port_addr = (volatile u32 __force *)__ioport_map(port, 4);
181 while (count--) 181 while (count--)
182 *port_addr = *buf++; 182 *port_addr = *buf++;
183 183
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
new file mode 100644
index 000000000000..86a665d92201
--- /dev/null
+++ b/arch/sh/kernel/io_trapped.c
@@ -0,0 +1,276 @@
1/*
2 * Trapped io support
3 *
4 * Copyright (C) 2008 Magnus Damm
5 *
6 * Intercept io operations by trapping.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/kernel.h>
13#include <linux/mm.h>
14#include <linux/bitops.h>
15#include <linux/vmalloc.h>
16#include <linux/module.h>
17#include <asm/system.h>
18#include <asm/mmu_context.h>
19#include <asm/uaccess.h>
20#include <asm/io.h>
21#include <asm/io_trapped.h>
22
23#define TRAPPED_PAGES_MAX 16
24
25#ifdef CONFIG_HAS_IOPORT
26LIST_HEAD(trapped_io);
27EXPORT_SYMBOL_GPL(trapped_io);
28#endif
29#ifdef CONFIG_HAS_IOMEM
30LIST_HEAD(trapped_mem);
31EXPORT_SYMBOL_GPL(trapped_mem);
32#endif
33static DEFINE_SPINLOCK(trapped_lock);
34
35int __init register_trapped_io(struct trapped_io *tiop)
36{
37 struct resource *res;
38 unsigned long len = 0, flags = 0;
39 struct page *pages[TRAPPED_PAGES_MAX];
40 int k, n;
41
42 /* structure must be page aligned */
43 if ((unsigned long)tiop & (PAGE_SIZE - 1))
44 goto bad;
45
46 for (k = 0; k < tiop->num_resources; k++) {
47 res = tiop->resource + k;
48 len += roundup((res->end - res->start) + 1, PAGE_SIZE);
49 flags |= res->flags;
50 }
51
52 /* support IORESOURCE_IO _or_ MEM, not both */
53 if (hweight_long(flags) != 1)
54 goto bad;
55
56 n = len >> PAGE_SHIFT;
57
58 if (n >= TRAPPED_PAGES_MAX)
59 goto bad;
60
61 for (k = 0; k < n; k++)
62 pages[k] = virt_to_page(tiop);
63
64 tiop->virt_base = vmap(pages, n, VM_MAP, PAGE_NONE);
65 if (!tiop->virt_base)
66 goto bad;
67
68 len = 0;
69 for (k = 0; k < tiop->num_resources; k++) {
70 res = tiop->resource + k;
71 pr_info("trapped io 0x%08lx overrides %s 0x%08lx\n",
72 (unsigned long)(tiop->virt_base + len),
73 res->flags & IORESOURCE_IO ? "io" : "mmio",
74 (unsigned long)res->start);
75 len += roundup((res->end - res->start) + 1, PAGE_SIZE);
76 }
77
78 tiop->magic = IO_TRAPPED_MAGIC;
79 INIT_LIST_HEAD(&tiop->list);
80 spin_lock_irq(&trapped_lock);
81 if (flags & IORESOURCE_IO)
82 list_add(&tiop->list, &trapped_io);
83 if (flags & IORESOURCE_MEM)
84 list_add(&tiop->list, &trapped_mem);
85 spin_unlock_irq(&trapped_lock);
86
87 return 0;
88 bad:
89 pr_warning("unable to install trapped io filter\n");
90 return -1;
91}
92EXPORT_SYMBOL_GPL(register_trapped_io);
93
94void __iomem *match_trapped_io_handler(struct list_head *list,
95 unsigned long offset,
96 unsigned long size)
97{
98 unsigned long voffs;
99 struct trapped_io *tiop;
100 struct resource *res;
101 int k, len;
102
103 spin_lock_irq(&trapped_lock);
104 list_for_each_entry(tiop, list, list) {
105 voffs = 0;
106 for (k = 0; k < tiop->num_resources; k++) {
107 res = tiop->resource + k;
108 if (res->start == offset) {
109 spin_unlock_irq(&trapped_lock);
110 return tiop->virt_base + voffs;
111 }
112
113 len = (res->end - res->start) + 1;
114 voffs += roundup(len, PAGE_SIZE);
115 }
116 }
117 spin_unlock_irq(&trapped_lock);
118 return NULL;
119}
120EXPORT_SYMBOL_GPL(match_trapped_io_handler);
121
122static struct trapped_io *lookup_tiop(unsigned long address)
123{
124 pgd_t *pgd_k;
125 pud_t *pud_k;
126 pmd_t *pmd_k;
127 pte_t *pte_k;
128 pte_t entry;
129
130 pgd_k = swapper_pg_dir + pgd_index(address);
131 if (!pgd_present(*pgd_k))
132 return NULL;
133
134 pud_k = pud_offset(pgd_k, address);
135 if (!pud_present(*pud_k))
136 return NULL;
137
138 pmd_k = pmd_offset(pud_k, address);
139 if (!pmd_present(*pmd_k))
140 return NULL;
141
142 pte_k = pte_offset_kernel(pmd_k, address);
143 entry = *pte_k;
144
145 return pfn_to_kaddr(pte_pfn(entry));
146}
147
148static unsigned long lookup_address(struct trapped_io *tiop,
149 unsigned long address)
150{
151 struct resource *res;
152 unsigned long vaddr = (unsigned long)tiop->virt_base;
153 unsigned long len;
154 int k;
155
156 for (k = 0; k < tiop->num_resources; k++) {
157 res = tiop->resource + k;
158 len = roundup((res->end - res->start) + 1, PAGE_SIZE);
159 if (address < (vaddr + len))
160 return res->start + (address - vaddr);
161 vaddr += len;
162 }
163 return 0;
164}
165
166static unsigned long long copy_word(unsigned long src_addr, int src_len,
167 unsigned long dst_addr, int dst_len)
168{
169 unsigned long long tmp = 0;
170
171 switch (src_len) {
172 case 1:
173 tmp = ctrl_inb(src_addr);
174 break;
175 case 2:
176 tmp = ctrl_inw(src_addr);
177 break;
178 case 4:
179 tmp = ctrl_inl(src_addr);
180 break;
181 case 8:
182 tmp = ctrl_inq(src_addr);
183 break;
184 }
185
186 switch (dst_len) {
187 case 1:
188 ctrl_outb(tmp, dst_addr);
189 break;
190 case 2:
191 ctrl_outw(tmp, dst_addr);
192 break;
193 case 4:
194 ctrl_outl(tmp, dst_addr);
195 break;
196 case 8:
197 ctrl_outq(tmp, dst_addr);
198 break;
199 }
200
201 return tmp;
202}
203
204static unsigned long from_device(void *dst, const void *src, unsigned long cnt)
205{
206 struct trapped_io *tiop;
207 unsigned long src_addr = (unsigned long)src;
208 unsigned long long tmp;
209
210 pr_debug("trapped io read 0x%08lx (%ld)\n", src_addr, cnt);
211 tiop = lookup_tiop(src_addr);
212 WARN_ON(!tiop || (tiop->magic != IO_TRAPPED_MAGIC));
213
214 src_addr = lookup_address(tiop, src_addr);
215 if (!src_addr)
216 return cnt;
217
218 tmp = copy_word(src_addr,
219 max_t(unsigned long, cnt,
220 (tiop->minimum_bus_width / 8)),
221 (unsigned long)dst, cnt);
222
223 pr_debug("trapped io read 0x%08lx -> 0x%08llx\n", src_addr, tmp);
224 return 0;
225}
226
227static unsigned long to_device(void *dst, const void *src, unsigned long cnt)
228{
229 struct trapped_io *tiop;
230 unsigned long dst_addr = (unsigned long)dst;
231 unsigned long long tmp;
232
233 pr_debug("trapped io write 0x%08lx (%ld)\n", dst_addr, cnt);
234 tiop = lookup_tiop(dst_addr);
235 WARN_ON(!tiop || (tiop->magic != IO_TRAPPED_MAGIC));
236
237 dst_addr = lookup_address(tiop, dst_addr);
238 if (!dst_addr)
239 return cnt;
240
241 tmp = copy_word((unsigned long)src, cnt,
242 dst_addr, max_t(unsigned long, cnt,
243 (tiop->minimum_bus_width / 8)));
244
245 pr_debug("trapped io write 0x%08lx -> 0x%08llx\n", dst_addr, tmp);
246 return 0;
247}
248
249static struct mem_access trapped_io_access = {
250 from_device,
251 to_device,
252};
253
254int handle_trapped_io(struct pt_regs *regs, unsigned long address)
255{
256 mm_segment_t oldfs;
257 opcode_t instruction;
258 int tmp;
259
260 if (!lookup_tiop(address))
261 return 0;
262
263 WARN_ON(user_mode(regs));
264
265 oldfs = get_fs();
266 set_fs(KERNEL_DS);
267 if (copy_from_user(&instruction, (void *)(regs->pc),
268 sizeof(instruction))) {
269 set_fs(oldfs);
270 return 0;
271 }
272
273 tmp = handle_unaligned_access(instruction, regs, &trapped_io_access);
274 set_fs(oldfs);
275 return tmp == 0;
276}
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 0586bc62ad96..9bf19b00696a 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -248,9 +248,6 @@ asmlinkage void do_softirq(void)
248 248
249void __init init_IRQ(void) 249void __init init_IRQ(void)
250{ 250{
251#ifdef CONFIG_CPU_HAS_PINT_IRQ
252 init_IRQ_pint();
253#endif
254 plat_irq_setup(); 251 plat_irq_setup();
255 252
256 /* Perform the machine specific initialisation */ 253 /* Perform the machine specific initialisation */
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index cff3b7dc9c56..046999b1d1af 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -623,6 +623,7 @@ extern void interruptible_sleep_on(wait_queue_head_t *q);
623 623
624#define mid_sched ((unsigned long) interruptible_sleep_on) 624#define mid_sched ((unsigned long) interruptible_sleep_on)
625 625
626#ifdef CONFIG_FRAME_POINTER
626static int in_sh64_switch_to(unsigned long pc) 627static int in_sh64_switch_to(unsigned long pc)
627{ 628{
628 extern char __sh64_switch_to_end; 629 extern char __sh64_switch_to_end;
@@ -631,12 +632,10 @@ static int in_sh64_switch_to(unsigned long pc)
631 return (pc >= (unsigned long) sh64_switch_to) && 632 return (pc >= (unsigned long) sh64_switch_to) &&
632 (pc < (unsigned long) &__sh64_switch_to_end); 633 (pc < (unsigned long) &__sh64_switch_to_end);
633} 634}
635#endif
634 636
635unsigned long get_wchan(struct task_struct *p) 637unsigned long get_wchan(struct task_struct *p)
636{ 638{
637 unsigned long schedule_fp;
638 unsigned long sh64_switch_to_fp;
639 unsigned long schedule_caller_pc;
640 unsigned long pc; 639 unsigned long pc;
641 640
642 if (!p || p == current || p->state == TASK_RUNNING) 641 if (!p || p == current || p->state == TASK_RUNNING)
@@ -649,6 +648,10 @@ unsigned long get_wchan(struct task_struct *p)
649 648
650#ifdef CONFIG_FRAME_POINTER 649#ifdef CONFIG_FRAME_POINTER
651 if (in_sh64_switch_to(pc)) { 650 if (in_sh64_switch_to(pc)) {
651 unsigned long schedule_fp;
652 unsigned long sh64_switch_to_fp;
653 unsigned long schedule_caller_pc;
654
652 sh64_switch_to_fp = (long) p->thread.sp; 655 sh64_switch_to_fp = (long) p->thread.sp;
653 /* r14 is saved at offset 4 in the sh64_switch_to frame */ 656 /* r14 is saved at offset 4 in the sh64_switch_to frame */
654 schedule_fp = *(unsigned long *) (long)(sh64_switch_to_fp + 4); 657 schedule_fp = *(unsigned long *) (long)(sh64_switch_to_fp + 4);
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index ce0664a58b49..fddb547f3c2b 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -220,7 +220,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
220 dp = ((unsigned long) child) + THREAD_SIZE - 220 dp = ((unsigned long) child) + THREAD_SIZE -
221 sizeof(struct pt_dspregs); 221 sizeof(struct pt_dspregs);
222 if (*((int *) (dp - 4)) == SR_FD) { 222 if (*((int *) (dp - 4)) == SR_FD) {
223 copy_to_user(addr, (void *) dp, 223 copy_to_user((void *)addr, (void *) dp,
224 sizeof(struct pt_dspregs)); 224 sizeof(struct pt_dspregs));
225 ret = 0; 225 ret = 0;
226 } 226 }
@@ -234,7 +234,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
234 dp = ((unsigned long) child) + THREAD_SIZE - 234 dp = ((unsigned long) child) + THREAD_SIZE -
235 sizeof(struct pt_dspregs); 235 sizeof(struct pt_dspregs);
236 if (*((int *) (dp - 4)) == SR_FD) { 236 if (*((int *) (dp - 4)) == SR_FD) {
237 copy_from_user((void *) dp, addr, 237 copy_from_user((void *) dp, (void *)addr,
238 sizeof(struct pt_dspregs)); 238 sizeof(struct pt_dspregs));
239 ret = 0; 239 ret = 0;
240 } 240 }
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 18a5baf2cbad..ff4f54a47c07 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -333,7 +333,7 @@ static const char *cpu_name[] = {
333 [CPU_SH7343] = "SH7343", [CPU_SH7785] = "SH7785", 333 [CPU_SH7343] = "SH7343", [CPU_SH7785] = "SH7785",
334 [CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3", 334 [CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3",
335 [CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103", 335 [CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103",
336 [CPU_SH_NONE] = "Unknown" 336 [CPU_SH7366] = "SH7366", [CPU_SH_NONE] = "Unknown"
337}; 337};
338 338
339const char *get_cpu_subtype(struct sh_cpuinfo *c) 339const char *get_cpu_subtype(struct sh_cpuinfo *c)
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index 719e127a7c05..a46cc3a41148 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -338,6 +338,8 @@ ENTRY(sys_call_table)
338 .long sys_epoll_pwait 338 .long sys_epoll_pwait
339 .long sys_utimensat /* 320 */ 339 .long sys_utimensat /* 320 */
340 .long sys_signalfd 340 .long sys_signalfd
341 .long sys_ni_syscall 341 .long sys_timerfd_create
342 .long sys_eventfd 342 .long sys_eventfd
343 .long sys_fallocate 343 .long sys_fallocate
344 .long sys_timerfd_settime /* 325 */
345 .long sys_timerfd_gettime
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 12c7340356ae..d5d7843aad94 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -376,6 +376,8 @@ sys_call_table:
376 .long sys_epoll_pwait 376 .long sys_epoll_pwait
377 .long sys_utimensat 377 .long sys_utimensat
378 .long sys_signalfd 378 .long sys_signalfd
379 .long sys_ni_syscall /* 350 */ 379 .long sys_timerfd_create /* 350 */
380 .long sys_eventfd 380 .long sys_eventfd
381 .long sys_fallocate 381 .long sys_fallocate
382 .long sys_timerfd_settime
383 .long sys_timerfd_gettime
diff --git a/arch/sh/kernel/time_32.c b/arch/sh/kernel/time_32.c
index 2bc04bfee738..7281342c044d 100644
--- a/arch/sh/kernel/time_32.c
+++ b/arch/sh/kernel/time_32.c
@@ -120,10 +120,6 @@ static long last_rtc_update;
120 */ 120 */
121void handle_timer_tick(void) 121void handle_timer_tick(void)
122{ 122{
123 do_timer(1);
124#ifndef CONFIG_SMP
125 update_process_times(user_mode(get_irq_regs()));
126#endif
127 if (current->pid) 123 if (current->pid)
128 profile_tick(CPU_PROFILING); 124 profile_tick(CPU_PROFILING);
129 125
@@ -133,6 +129,16 @@ void handle_timer_tick(void)
133#endif 129#endif
134 130
135 /* 131 /*
132 * Here we are in the timer irq handler. We just have irqs locally
133 * disabled but we don't know if the timer_bh is running on the other
134 * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
135 * the irq version of write_lock because as just said we have irq
136 * locally disabled. -arca
137 */
138 write_seqlock(&xtime_lock);
139 do_timer(1);
140
141 /*
136 * If we have an externally synchronized Linux clock, then update 142 * If we have an externally synchronized Linux clock, then update
137 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be 143 * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
138 * called as close as possible to 500 ms before the new second starts. 144 * called as close as possible to 500 ms before the new second starts.
@@ -147,6 +153,11 @@ void handle_timer_tick(void)
147 /* do it again in 60s */ 153 /* do it again in 60s */
148 last_rtc_update = xtime.tv_sec - 600; 154 last_rtc_update = xtime.tv_sec - 600;
149 } 155 }
156 write_sequnlock(&xtime_lock);
157
158#ifndef CONFIG_SMP
159 update_process_times(user_mode(get_irq_regs()));
160#endif
150} 161}
151#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 162#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
152 163
diff --git a/arch/sh/kernel/time_64.c b/arch/sh/kernel/time_64.c
index f819ba38a6ce..898977ee2030 100644
--- a/arch/sh/kernel/time_64.c
+++ b/arch/sh/kernel/time_64.c
@@ -229,15 +229,22 @@ static long last_rtc_update;
229static inline void do_timer_interrupt(void) 229static inline void do_timer_interrupt(void)
230{ 230{
231 unsigned long long current_ctc; 231 unsigned long long current_ctc;
232
233 if (current->pid)
234 profile_tick(CPU_PROFILING);
235
236 /*
237 * Here we are in the timer irq handler. We just have irqs locally
238 * disabled but we don't know if the timer_bh is running on the other
239 * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
240 * the irq version of write_lock because as just said we have irq
241 * locally disabled. -arca
242 */
243 write_lock(&xtime_lock);
232 asm ("getcon cr62, %0" : "=r" (current_ctc)); 244 asm ("getcon cr62, %0" : "=r" (current_ctc));
233 ctc_last_interrupt = (unsigned long) current_ctc; 245 ctc_last_interrupt = (unsigned long) current_ctc;
234 246
235 do_timer(1); 247 do_timer(1);
236#ifndef CONFIG_SMP
237 update_process_times(user_mode(get_irq_regs()));
238#endif
239 if (current->pid)
240 profile_tick(CPU_PROFILING);
241 248
242#ifdef CONFIG_HEARTBEAT 249#ifdef CONFIG_HEARTBEAT
243 if (sh_mv.mv_heartbeat != NULL) 250 if (sh_mv.mv_heartbeat != NULL)
@@ -259,6 +266,11 @@ static inline void do_timer_interrupt(void)
259 /* do it again in 60 s */ 266 /* do it again in 60 s */
260 last_rtc_update = xtime.tv_sec - 600; 267 last_rtc_update = xtime.tv_sec - 600;
261 } 268 }
269 write_unlock(&xtime_lock);
270
271#ifndef CONFIG_SMP
272 update_process_times(user_mode(get_irq_regs()));
273#endif
262} 274}
263 275
264/* 276/*
@@ -275,16 +287,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
275 timer_status &= ~0x100; 287 timer_status &= ~0x100;
276 ctrl_outw(timer_status, TMU0_TCR); 288 ctrl_outw(timer_status, TMU0_TCR);
277 289
278 /*
279 * Here we are in the timer irq handler. We just have irqs locally
280 * disabled but we don't know if the timer_bh is running on the other
281 * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
282 * the irq version of write_lock because as just said we have irq
283 * locally disabled. -arca
284 */
285 write_lock(&xtime_lock);
286 do_timer_interrupt(); 290 do_timer_interrupt();
287 write_unlock(&xtime_lock);
288 291
289 return IRQ_HANDLED; 292 return IRQ_HANDLED;
290} 293}
diff --git a/arch/sh/kernel/timers/timer-cmt.c b/arch/sh/kernel/timers/timer-cmt.c
index 499e07beebe2..71312324b5de 100644
--- a/arch/sh/kernel/timers/timer-cmt.c
+++ b/arch/sh/kernel/timers/timer-cmt.c
@@ -100,16 +100,7 @@ static irqreturn_t cmt_timer_interrupt(int irq, void *dev_id)
100 timer_status &= ~0x80; 100 timer_status &= ~0x80;
101 ctrl_outw(timer_status, CMT_CMCSR_0); 101 ctrl_outw(timer_status, CMT_CMCSR_0);
102 102
103 /*
104 * Here we are in the timer irq handler. We just have irqs locally
105 * disabled but we don't know if the timer_bh is running on the other
106 * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
107 * the irq version of write_lock because as just said we have irq
108 * locally disabled. -arca
109 */
110 write_seqlock(&xtime_lock);
111 handle_timer_tick(); 103 handle_timer_tick();
112 write_sequnlock(&xtime_lock);
113 104
114 return IRQ_HANDLED; 105 return IRQ_HANDLED;
115} 106}
diff --git a/arch/sh/kernel/timers/timer-mtu2.c b/arch/sh/kernel/timers/timer-mtu2.c
index b7499a2a9188..ade9d6eb29f9 100644
--- a/arch/sh/kernel/timers/timer-mtu2.c
+++ b/arch/sh/kernel/timers/timer-mtu2.c
@@ -100,9 +100,7 @@ static irqreturn_t mtu2_timer_interrupt(int irq, void *dev_id)
100 ctrl_outb(timer_status, MTU2_TSR_1); 100 ctrl_outb(timer_status, MTU2_TSR_1);
101 101
102 /* Do timer tick */ 102 /* Do timer tick */
103 write_seqlock(&xtime_lock);
104 handle_timer_tick(); 103 handle_timer_tick();
105 write_sequnlock(&xtime_lock);
106 104
107 return IRQ_HANDLED; 105 return IRQ_HANDLED;
108} 106}
@@ -156,7 +154,6 @@ static int mtu2_timer_stop(void)
156 154
157static int mtu2_timer_init(void) 155static int mtu2_timer_init(void)
158{ 156{
159 u8 tmp;
160 unsigned long interval; 157 unsigned long interval;
161 158
162 setup_irq(CONFIG_SH_TIMER_IRQ, &mtu2_irq); 159 setup_irq(CONFIG_SH_TIMER_IRQ, &mtu2_irq);
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 2e58f7a6b746..baa4fa368dce 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -147,6 +147,36 @@ static int die_if_no_fixup(const char * str, struct pt_regs * regs, long err)
147 return -EFAULT; 147 return -EFAULT;
148} 148}
149 149
150static inline void sign_extend(unsigned int count, unsigned char *dst)
151{
152#ifdef __LITTLE_ENDIAN__
153 if ((count == 1) && dst[0] & 0x80) {
154 dst[1] = 0xff;
155 dst[2] = 0xff;
156 dst[3] = 0xff;
157 }
158 if ((count == 2) && dst[1] & 0x80) {
159 dst[2] = 0xff;
160 dst[3] = 0xff;
161 }
162#else
163 if ((count == 1) && dst[3] & 0x80) {
164 dst[2] = 0xff;
165 dst[1] = 0xff;
166 dst[0] = 0xff;
167 }
168 if ((count == 2) && dst[2] & 0x80) {
169 dst[1] = 0xff;
170 dst[0] = 0xff;
171 }
172#endif
173}
174
175static struct mem_access user_mem_access = {
176 copy_from_user,
177 copy_to_user,
178};
179
150/* 180/*
151 * handle an instruction that does an unaligned memory access by emulating the 181 * handle an instruction that does an unaligned memory access by emulating the
152 * desired behaviour 182 * desired behaviour
@@ -154,7 +184,8 @@ static int die_if_no_fixup(const char * str, struct pt_regs * regs, long err)
154 * (if that instruction is in a branch delay slot) 184 * (if that instruction is in a branch delay slot)
155 * - return 0 if emulation okay, -EFAULT on existential error 185 * - return 0 if emulation okay, -EFAULT on existential error
156 */ 186 */
157static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs) 187static int handle_unaligned_ins(opcode_t instruction, struct pt_regs *regs,
188 struct mem_access *ma)
158{ 189{
159 int ret, index, count; 190 int ret, index, count;
160 unsigned long *rm, *rn; 191 unsigned long *rm, *rn;
@@ -178,25 +209,13 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
178 dst = (unsigned char*) rn; 209 dst = (unsigned char*) rn;
179 *(unsigned long*)dst = 0; 210 *(unsigned long*)dst = 0;
180 211
181#ifdef __LITTLE_ENDIAN__ 212#if !defined(__LITTLE_ENDIAN__)
182 if (copy_from_user(dst, src, count))
183 goto fetch_fault;
184
185 if ((count == 2) && dst[1] & 0x80) {
186 dst[2] = 0xff;
187 dst[3] = 0xff;
188 }
189#else
190 dst += 4-count; 213 dst += 4-count;
191 214#endif
192 if (__copy_user(dst, src, count)) 215 if (ma->from(dst, src, count))
193 goto fetch_fault; 216 goto fetch_fault;
194 217
195 if ((count == 2) && dst[2] & 0x80) { 218 sign_extend(count, dst);
196 dst[0] = 0xff;
197 dst[1] = 0xff;
198 }
199#endif
200 } else { 219 } else {
201 /* to memory */ 220 /* to memory */
202 src = (unsigned char*) rm; 221 src = (unsigned char*) rm;
@@ -206,7 +225,7 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
206 dst = (unsigned char*) *rn; 225 dst = (unsigned char*) *rn;
207 dst += regs->regs[0]; 226 dst += regs->regs[0];
208 227
209 if (copy_to_user(dst, src, count)) 228 if (ma->to(dst, src, count))
210 goto fetch_fault; 229 goto fetch_fault;
211 } 230 }
212 ret = 0; 231 ret = 0;
@@ -217,7 +236,7 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
217 dst = (unsigned char*) *rn; 236 dst = (unsigned char*) *rn;
218 dst += (instruction&0x000F)<<2; 237 dst += (instruction&0x000F)<<2;
219 238
220 if (copy_to_user(dst,src,4)) 239 if (ma->to(dst, src, 4))
221 goto fetch_fault; 240 goto fetch_fault;
222 ret = 0; 241 ret = 0;
223 break; 242 break;
@@ -230,7 +249,7 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
230#if !defined(__LITTLE_ENDIAN__) 249#if !defined(__LITTLE_ENDIAN__)
231 src += 4-count; 250 src += 4-count;
232#endif 251#endif
233 if (copy_to_user(dst, src, count)) 252 if (ma->to(dst, src, count))
234 goto fetch_fault; 253 goto fetch_fault;
235 ret = 0; 254 ret = 0;
236 break; 255 break;
@@ -241,7 +260,7 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
241 dst = (unsigned char*) rn; 260 dst = (unsigned char*) rn;
242 *(unsigned long*)dst = 0; 261 *(unsigned long*)dst = 0;
243 262
244 if (copy_from_user(dst,src,4)) 263 if (ma->from(dst, src, 4))
245 goto fetch_fault; 264 goto fetch_fault;
246 ret = 0; 265 ret = 0;
247 break; 266 break;
@@ -253,25 +272,12 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
253 dst = (unsigned char*) rn; 272 dst = (unsigned char*) rn;
254 *(unsigned long*)dst = 0; 273 *(unsigned long*)dst = 0;
255 274
256#ifdef __LITTLE_ENDIAN__ 275#if !defined(__LITTLE_ENDIAN__)
257 if (copy_from_user(dst, src, count))
258 goto fetch_fault;
259
260 if ((count == 2) && dst[1] & 0x80) {
261 dst[2] = 0xff;
262 dst[3] = 0xff;
263 }
264#else
265 dst += 4-count; 276 dst += 4-count;
266
267 if (copy_from_user(dst, src, count))
268 goto fetch_fault;
269
270 if ((count == 2) && dst[2] & 0x80) {
271 dst[0] = 0xff;
272 dst[1] = 0xff;
273 }
274#endif 277#endif
278 if (ma->from(dst, src, count))
279 goto fetch_fault;
280 sign_extend(count, dst);
275 ret = 0; 281 ret = 0;
276 break; 282 break;
277 283
@@ -285,7 +291,7 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
285 dst = (unsigned char*) *rm; /* called Rn in the spec */ 291 dst = (unsigned char*) *rm; /* called Rn in the spec */
286 dst += (instruction&0x000F)<<1; 292 dst += (instruction&0x000F)<<1;
287 293
288 if (copy_to_user(dst, src, 2)) 294 if (ma->to(dst, src, 2))
289 goto fetch_fault; 295 goto fetch_fault;
290 ret = 0; 296 ret = 0;
291 break; 297 break;
@@ -299,21 +305,9 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
299#if !defined(__LITTLE_ENDIAN__) 305#if !defined(__LITTLE_ENDIAN__)
300 dst += 2; 306 dst += 2;
301#endif 307#endif
302 308 if (ma->from(dst, src, 2))
303 if (copy_from_user(dst, src, 2))
304 goto fetch_fault; 309 goto fetch_fault;
305 310 sign_extend(2, dst);
306#ifdef __LITTLE_ENDIAN__
307 if (dst[1] & 0x80) {
308 dst[2] = 0xff;
309 dst[3] = 0xff;
310 }
311#else
312 if (dst[2] & 0x80) {
313 dst[0] = 0xff;
314 dst[1] = 0xff;
315 }
316#endif
317 ret = 0; 311 ret = 0;
318 break; 312 break;
319 } 313 }
@@ -332,11 +326,14 @@ static int handle_unaligned_ins(u16 instruction, struct pt_regs *regs)
332 * emulate the instruction in the delay slot 326 * emulate the instruction in the delay slot
333 * - fetches the instruction from PC+2 327 * - fetches the instruction from PC+2
334 */ 328 */
335static inline int handle_unaligned_delayslot(struct pt_regs *regs) 329static inline int handle_delayslot(struct pt_regs *regs,
330 opcode_t old_instruction,
331 struct mem_access *ma)
336{ 332{
337 u16 instruction; 333 opcode_t instruction;
334 void *addr = (void *)(regs->pc + instruction_size(old_instruction));
338 335
339 if (copy_from_user(&instruction, (u16 *)(regs->pc+2), 2)) { 336 if (copy_from_user(&instruction, addr, sizeof(instruction))) {
340 /* the instruction-fetch faulted */ 337 /* the instruction-fetch faulted */
341 if (user_mode(regs)) 338 if (user_mode(regs))
342 return -EFAULT; 339 return -EFAULT;
@@ -346,7 +343,7 @@ static inline int handle_unaligned_delayslot(struct pt_regs *regs)
346 regs, 0); 343 regs, 0);
347 } 344 }
348 345
349 return handle_unaligned_ins(instruction,regs); 346 return handle_unaligned_ins(instruction, regs, ma);
350} 347}
351 348
352/* 349/*
@@ -369,10 +366,11 @@ static inline int handle_unaligned_delayslot(struct pt_regs *regs)
369 * XXX: SH-2A needs this too, but it needs an overhaul thanks to mixed 32-bit 366 * XXX: SH-2A needs this too, but it needs an overhaul thanks to mixed 32-bit
370 * opcodes.. 367 * opcodes..
371 */ 368 */
372#ifndef CONFIG_CPU_SH2A 369
373static int handle_unaligned_notify_count = 10; 370static int handle_unaligned_notify_count = 10;
374 371
375static int handle_unaligned_access(u16 instruction, struct pt_regs *regs) 372int handle_unaligned_access(opcode_t instruction, struct pt_regs *regs,
373 struct mem_access *ma)
376{ 374{
377 u_int rm; 375 u_int rm;
378 int ret, index; 376 int ret, index;
@@ -387,7 +385,7 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
387 printk(KERN_NOTICE "Fixing up unaligned userspace access " 385 printk(KERN_NOTICE "Fixing up unaligned userspace access "
388 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", 386 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
389 current->comm, task_pid_nr(current), 387 current->comm, task_pid_nr(current),
390 (u16 *)regs->pc, instruction); 388 (void *)regs->pc, instruction);
391 } 389 }
392 390
393 ret = -EFAULT; 391 ret = -EFAULT;
@@ -395,19 +393,19 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
395 case 0x0000: 393 case 0x0000:
396 if (instruction==0x000B) { 394 if (instruction==0x000B) {
397 /* rts */ 395 /* rts */
398 ret = handle_unaligned_delayslot(regs); 396 ret = handle_delayslot(regs, instruction, ma);
399 if (ret==0) 397 if (ret==0)
400 regs->pc = regs->pr; 398 regs->pc = regs->pr;
401 } 399 }
402 else if ((instruction&0x00FF)==0x0023) { 400 else if ((instruction&0x00FF)==0x0023) {
403 /* braf @Rm */ 401 /* braf @Rm */
404 ret = handle_unaligned_delayslot(regs); 402 ret = handle_delayslot(regs, instruction, ma);
405 if (ret==0) 403 if (ret==0)
406 regs->pc += rm + 4; 404 regs->pc += rm + 4;
407 } 405 }
408 else if ((instruction&0x00FF)==0x0003) { 406 else if ((instruction&0x00FF)==0x0003) {
409 /* bsrf @Rm */ 407 /* bsrf @Rm */
410 ret = handle_unaligned_delayslot(regs); 408 ret = handle_delayslot(regs, instruction, ma);
411 if (ret==0) { 409 if (ret==0) {
412 regs->pr = regs->pc + 4; 410 regs->pr = regs->pc + 4;
413 regs->pc += rm + 4; 411 regs->pc += rm + 4;
@@ -428,13 +426,13 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
428 case 0x4000: 426 case 0x4000:
429 if ((instruction&0x00FF)==0x002B) { 427 if ((instruction&0x00FF)==0x002B) {
430 /* jmp @Rm */ 428 /* jmp @Rm */
431 ret = handle_unaligned_delayslot(regs); 429 ret = handle_delayslot(regs, instruction, ma);
432 if (ret==0) 430 if (ret==0)
433 regs->pc = rm; 431 regs->pc = rm;
434 } 432 }
435 else if ((instruction&0x00FF)==0x000B) { 433 else if ((instruction&0x00FF)==0x000B) {
436 /* jsr @Rm */ 434 /* jsr @Rm */
437 ret = handle_unaligned_delayslot(regs); 435 ret = handle_delayslot(regs, instruction, ma);
438 if (ret==0) { 436 if (ret==0) {
439 regs->pr = regs->pc + 4; 437 regs->pr = regs->pc + 4;
440 regs->pc = rm; 438 regs->pc = rm;
@@ -461,7 +459,7 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
461 case 0x0B00: /* bf lab - no delayslot*/ 459 case 0x0B00: /* bf lab - no delayslot*/
462 break; 460 break;
463 case 0x0F00: /* bf/s lab */ 461 case 0x0F00: /* bf/s lab */
464 ret = handle_unaligned_delayslot(regs); 462 ret = handle_delayslot(regs, instruction, ma);
465 if (ret==0) { 463 if (ret==0) {
466#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB) 464#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)
467 if ((regs->sr & 0x00000001) != 0) 465 if ((regs->sr & 0x00000001) != 0)
@@ -474,7 +472,7 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
474 case 0x0900: /* bt lab - no delayslot */ 472 case 0x0900: /* bt lab - no delayslot */
475 break; 473 break;
476 case 0x0D00: /* bt/s lab */ 474 case 0x0D00: /* bt/s lab */
477 ret = handle_unaligned_delayslot(regs); 475 ret = handle_delayslot(regs, instruction, ma);
478 if (ret==0) { 476 if (ret==0) {
479#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB) 477#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)
480 if ((regs->sr & 0x00000001) == 0) 478 if ((regs->sr & 0x00000001) == 0)
@@ -488,13 +486,13 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
488 break; 486 break;
489 487
490 case 0xA000: /* bra label */ 488 case 0xA000: /* bra label */
491 ret = handle_unaligned_delayslot(regs); 489 ret = handle_delayslot(regs, instruction, ma);
492 if (ret==0) 490 if (ret==0)
493 regs->pc += SH_PC_12BIT_OFFSET(instruction); 491 regs->pc += SH_PC_12BIT_OFFSET(instruction);
494 break; 492 break;
495 493
496 case 0xB000: /* bsr label */ 494 case 0xB000: /* bsr label */
497 ret = handle_unaligned_delayslot(regs); 495 ret = handle_delayslot(regs, instruction, ma);
498 if (ret==0) { 496 if (ret==0) {
499 regs->pr = regs->pc + 4; 497 regs->pr = regs->pc + 4;
500 regs->pc += SH_PC_12BIT_OFFSET(instruction); 498 regs->pc += SH_PC_12BIT_OFFSET(instruction);
@@ -505,12 +503,11 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
505 503
506 /* handle non-delay-slot instruction */ 504 /* handle non-delay-slot instruction */
507 simple: 505 simple:
508 ret = handle_unaligned_ins(instruction,regs); 506 ret = handle_unaligned_ins(instruction, regs, ma);
509 if (ret==0) 507 if (ret==0)
510 regs->pc += instruction_size(instruction); 508 regs->pc += instruction_size(instruction);
511 return ret; 509 return ret;
512} 510}
513#endif /* CONFIG_CPU_SH2A */
514 511
515#ifdef CONFIG_CPU_HAS_SR_RB 512#ifdef CONFIG_CPU_HAS_SR_RB
516#define lookup_exception_vector(x) \ 513#define lookup_exception_vector(x) \
@@ -538,10 +535,8 @@ asmlinkage void do_address_error(struct pt_regs *regs,
538 unsigned long error_code = 0; 535 unsigned long error_code = 0;
539 mm_segment_t oldfs; 536 mm_segment_t oldfs;
540 siginfo_t info; 537 siginfo_t info;
541#ifndef CONFIG_CPU_SH2A 538 opcode_t instruction;
542 u16 instruction;
543 int tmp; 539 int tmp;
544#endif
545 540
546 /* Intentional ifdef */ 541 /* Intentional ifdef */
547#ifdef CONFIG_CPU_HAS_SR_RB 542#ifdef CONFIG_CPU_HAS_SR_RB
@@ -561,9 +556,9 @@ asmlinkage void do_address_error(struct pt_regs *regs,
561 goto uspace_segv; 556 goto uspace_segv;
562 } 557 }
563 558
564#ifndef CONFIG_CPU_SH2A
565 set_fs(USER_DS); 559 set_fs(USER_DS);
566 if (copy_from_user(&instruction, (u16 *)(regs->pc), 2)) { 560 if (copy_from_user(&instruction, (void *)(regs->pc),
561 sizeof(instruction))) {
567 /* Argh. Fault on the instruction itself. 562 /* Argh. Fault on the instruction itself.
568 This should never happen non-SMP 563 This should never happen non-SMP
569 */ 564 */
@@ -571,13 +566,12 @@ asmlinkage void do_address_error(struct pt_regs *regs,
571 goto uspace_segv; 566 goto uspace_segv;
572 } 567 }
573 568
574 tmp = handle_unaligned_access(instruction, regs); 569 tmp = handle_unaligned_access(instruction, regs,
570 &user_mem_access);
575 set_fs(oldfs); 571 set_fs(oldfs);
576 572
577 if (tmp==0) 573 if (tmp==0)
578 return; /* sorted */ 574 return; /* sorted */
579#endif
580
581uspace_segv: 575uspace_segv:
582 printk(KERN_NOTICE "Sending SIGBUS to \"%s\" due to unaligned " 576 printk(KERN_NOTICE "Sending SIGBUS to \"%s\" due to unaligned "
583 "access (PC %lx PR %lx)\n", current->comm, regs->pc, 577 "access (PC %lx PR %lx)\n", current->comm, regs->pc,
@@ -592,9 +586,9 @@ uspace_segv:
592 if (regs->pc & 1) 586 if (regs->pc & 1)
593 die("unaligned program counter", regs, error_code); 587 die("unaligned program counter", regs, error_code);
594 588
595#ifndef CONFIG_CPU_SH2A
596 set_fs(KERNEL_DS); 589 set_fs(KERNEL_DS);
597 if (copy_from_user(&instruction, (u16 *)(regs->pc), 2)) { 590 if (copy_from_user(&instruction, (void *)(regs->pc),
591 sizeof(instruction))) {
598 /* Argh. Fault on the instruction itself. 592 /* Argh. Fault on the instruction itself.
599 This should never happen non-SMP 593 This should never happen non-SMP
600 */ 594 */
@@ -602,14 +596,8 @@ uspace_segv:
602 die("insn faulting in do_address_error", regs, 0); 596 die("insn faulting in do_address_error", regs, 0);
603 } 597 }
604 598
605 handle_unaligned_access(instruction, regs); 599 handle_unaligned_access(instruction, regs, &user_mem_access);
606 set_fs(oldfs); 600 set_fs(oldfs);
607#else
608 printk(KERN_NOTICE "Killing process \"%s\" due to unaligned "
609 "access\n", current->comm);
610
611 force_sig(SIGSEGV, current);
612#endif
613 } 601 }
614} 602}
615 603
diff --git a/arch/sh/kernel/traps_64.c b/arch/sh/kernel/traps_64.c
index c0b3c6f6edb5..a55ac81d795b 100644
--- a/arch/sh/kernel/traps_64.c
+++ b/arch/sh/kernel/traps_64.c
@@ -630,7 +630,7 @@ static int misaligned_fpu_load(struct pt_regs *regs,
630 current->thread.fpu.hard.fp_regs[destreg] = buflo; 630 current->thread.fpu.hard.fp_regs[destreg] = buflo;
631 current->thread.fpu.hard.fp_regs[destreg+1] = bufhi; 631 current->thread.fpu.hard.fp_regs[destreg+1] = bufhi;
632 } else { 632 } else {
633#if defined(CONFIG_LITTLE_ENDIAN) 633#if defined(CONFIG_CPU_LITTLE_ENDIAN)
634 current->thread.fpu.hard.fp_regs[destreg] = bufhi; 634 current->thread.fpu.hard.fp_regs[destreg] = bufhi;
635 current->thread.fpu.hard.fp_regs[destreg+1] = buflo; 635 current->thread.fpu.hard.fp_regs[destreg+1] = buflo;
636#else 636#else
@@ -700,7 +700,7 @@ static int misaligned_fpu_store(struct pt_regs *regs,
700 buflo = current->thread.fpu.hard.fp_regs[srcreg]; 700 buflo = current->thread.fpu.hard.fp_regs[srcreg];
701 bufhi = current->thread.fpu.hard.fp_regs[srcreg+1]; 701 bufhi = current->thread.fpu.hard.fp_regs[srcreg+1];
702 } else { 702 } else {
703#if defined(CONFIG_LITTLE_ENDIAN) 703#if defined(CONFIG_CPU_LITTLE_ENDIAN)
704 bufhi = current->thread.fpu.hard.fp_regs[srcreg]; 704 bufhi = current->thread.fpu.hard.fp_regs[srcreg];
705 buflo = current->thread.fpu.hard.fp_regs[srcreg+1]; 705 buflo = current->thread.fpu.hard.fp_regs[srcreg+1];
706#else 706#else
diff --git a/arch/sh/kernel/vmlinux_64.lds.S b/arch/sh/kernel/vmlinux_64.lds.S
index 3f1bd6392bb3..d1e177009a41 100644
--- a/arch/sh/kernel/vmlinux_64.lds.S
+++ b/arch/sh/kernel/vmlinux_64.lds.S
@@ -51,7 +51,7 @@ SECTIONS
51 KPROBES_TEXT 51 KPROBES_TEXT
52 *(.fixup) 52 *(.fixup)
53 *(.gnu.warning) 53 *(.gnu.warning)
54#ifdef CONFIG_LITTLE_ENDIAN 54#ifdef CONFIG_CPU_LITTLE_ENDIAN
55 } = 0x6ff0fff0 55 } = 0x6ff0fff0
56#else 56#else
57 } = 0xf0fff06f 57 } = 0xf0fff06f
diff --git a/arch/sh/mm/cache-sh5.c b/arch/sh/mm/cache-sh5.c
index 4617e3aeee73..3877321fcede 100644
--- a/arch/sh/mm/cache-sh5.c
+++ b/arch/sh/mm/cache-sh5.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * arch/sh/mm/cache-sh5.c 2 * arch/sh/mm/cache-sh5.c
3 * 3 *
4 * Original version Copyright (C) 2000, 2001 Paolo Alberelli 4 * Copyright (C) 2000, 2001 Paolo Alberelli
5 * Second version Copyright (C) benedict.gaster@superh.com 2002 5 * Copyright (C) 2002 Benedict Gaster
6 * Third version Copyright Richard.Curnow@superh.com 2003 6 * Copyright (C) 2003 Richard Curnow
7 * Hacks to third version Copyright (C) 2003 Paul Mundt 7 * Copyright (C) 2003 - 2008 Paul Mundt
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive 10 * License. See the file "COPYING" in the main directory of this archive
@@ -13,101 +13,20 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/mman.h> 14#include <linux/mman.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/threads.h> 16#include <asm/tlb.h>
17#include <asm/page.h>
18#include <asm/pgtable.h>
19#include <asm/processor.h> 17#include <asm/processor.h>
20#include <asm/cache.h> 18#include <asm/cache.h>
21#include <asm/tlb.h> 19#include <asm/pgalloc.h>
22#include <asm/io.h>
23#include <asm/uaccess.h> 20#include <asm/uaccess.h>
24#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
25#include <asm/pgalloc.h> /* for flush_itlb_range */
26
27#include <linux/proc_fs.h>
28
29/* This function is in entry.S */
30extern unsigned long switch_and_save_asid(unsigned long new_asid);
31 22
32/* Wired TLB entry for the D-cache */ 23/* Wired TLB entry for the D-cache */
33static unsigned long long dtlb_cache_slot; 24static unsigned long long dtlb_cache_slot;
34 25
35/** 26void __init p3_cache_init(void)
36 * sh64_cache_init()
37 *
38 * This is pretty much just a straightforward clone of the SH
39 * detect_cpu_and_cache_system().
40 *
41 * This function is responsible for setting up all of the cache
42 * info dynamically as well as taking care of CPU probing and
43 * setting up the relevant subtype data.
44 *
45 * FIXME: For the time being, we only really support the SH5-101
46 * out of the box, and don't support dynamic probing for things
47 * like the SH5-103 or even cut2 of the SH5-101. Implement this
48 * later!
49 */
50int __init sh64_cache_init(void)
51{ 27{
52 /* 28 /* Reserve a slot for dcache colouring in the DTLB */
53 * First, setup some sane values for the I-cache. 29 dtlb_cache_slot = sh64_get_wired_dtlb_entry();
54 */
55 cpu_data->icache.ways = 4;
56 cpu_data->icache.sets = 256;
57 cpu_data->icache.linesz = L1_CACHE_BYTES;
58
59 /*
60 * FIXME: This can probably be cleaned up a bit as well.. for example,
61 * do we really need the way shift _and_ the way_step_shift ?? Judging
62 * by the existing code, I would guess no.. is there any valid reason
63 * why we need to be tracking this around?
64 */
65 cpu_data->icache.way_shift = 13;
66 cpu_data->icache.entry_shift = 5;
67 cpu_data->icache.set_shift = 4;
68 cpu_data->icache.way_step_shift = 16;
69 cpu_data->icache.asid_shift = 2;
70
71 /*
72 * way offset = cache size / associativity, so just don't factor in
73 * associativity in the first place..
74 */
75 cpu_data->icache.way_ofs = cpu_data->icache.sets *
76 cpu_data->icache.linesz;
77
78 cpu_data->icache.asid_mask = 0x3fc;
79 cpu_data->icache.idx_mask = 0x1fe0;
80 cpu_data->icache.epn_mask = 0xffffe000;
81 cpu_data->icache.flags = 0;
82
83 /*
84 * Next, setup some sane values for the D-cache.
85 *
86 * On the SH5, these are pretty consistent with the I-cache settings,
87 * so we just copy over the existing definitions.. these can be fixed
88 * up later, especially if we add runtime CPU probing.
89 *
90 * Though in the meantime it saves us from having to duplicate all of
91 * the above definitions..
92 */
93 cpu_data->dcache = cpu_data->icache;
94
95 /*
96 * Setup any cache-related flags here
97 */
98#if defined(CONFIG_DCACHE_WRITE_THROUGH)
99 set_bit(SH_CACHE_MODE_WT, &(cpu_data->dcache.flags));
100#elif defined(CONFIG_DCACHE_WRITE_BACK)
101 set_bit(SH_CACHE_MODE_WB, &(cpu_data->dcache.flags));
102#endif
103
104 /*
105 * We also need to reserve a slot for the D-cache in the DTLB, so we
106 * do this now ..
107 */
108 dtlb_cache_slot = sh64_get_wired_dtlb_entry();
109
110 return 0;
111} 30}
112 31
113#ifdef CONFIG_DCACHE_DISABLED 32#ifdef CONFIG_DCACHE_DISABLED
@@ -116,73 +35,48 @@ int __init sh64_cache_init(void)
116#define sh64_dcache_purge_user_range(mm, start, end) do { } while (0) 35#define sh64_dcache_purge_user_range(mm, start, end) do { } while (0)
117#define sh64_dcache_purge_phy_page(paddr) do { } while (0) 36#define sh64_dcache_purge_phy_page(paddr) do { } while (0)
118#define sh64_dcache_purge_virt_page(mm, eaddr) do { } while (0) 37#define sh64_dcache_purge_virt_page(mm, eaddr) do { } while (0)
119#define sh64_dcache_purge_kernel_range(start, end) do { } while (0)
120#define sh64_dcache_wback_current_user_range(start, end) do { } while (0)
121#endif 38#endif
122 39
123/*##########################################################################*/ 40/*
124 41 * The following group of functions deal with mapping and unmapping a
125/* From here onwards, a rewrite of the implementation, 42 * temporary page into a DTLB slot that has been set aside for exclusive
126 by Richard.Curnow@superh.com. 43 * use.
127 44 */
128 The major changes in this compared to the old version are; 45static inline void
129 1. use more selective purging through OCBP instead of using ALLOCO to purge 46sh64_setup_dtlb_cache_slot(unsigned long eaddr, unsigned long asid,
130 by natural replacement. This avoids purging out unrelated cache lines 47 unsigned long paddr)
131 that happen to be in the same set.
132 2. exploit the APIs copy_user_page and clear_user_page better
133 3. be more selective about I-cache purging, in particular use invalidate_all
134 more sparingly.
135
136 */
137
138/*##########################################################################
139 SUPPORT FUNCTIONS
140 ##########################################################################*/
141
142/****************************************************************************/
143/* The following group of functions deal with mapping and unmapping a temporary
144 page into the DTLB slot that have been set aside for our exclusive use. */
145/* In order to accomplish this, we use the generic interface for adding and
146 removing a wired slot entry as defined in arch/sh/mm/tlb-sh5.c */
147/****************************************************************************/
148
149static unsigned long slot_own_flags;
150
151static inline void sh64_setup_dtlb_cache_slot(unsigned long eaddr, unsigned long asid, unsigned long paddr)
152{ 48{
153 local_irq_save(slot_own_flags); 49 local_irq_disable();
154 sh64_setup_tlb_slot(dtlb_cache_slot, eaddr, asid, paddr); 50 sh64_setup_tlb_slot(dtlb_cache_slot, eaddr, asid, paddr);
155} 51}
156 52
157static inline void sh64_teardown_dtlb_cache_slot(void) 53static inline void sh64_teardown_dtlb_cache_slot(void)
158{ 54{
159 sh64_teardown_tlb_slot(dtlb_cache_slot); 55 sh64_teardown_tlb_slot(dtlb_cache_slot);
160 local_irq_restore(slot_own_flags); 56 local_irq_enable();
161} 57}
162 58
163/****************************************************************************/
164
165#ifndef CONFIG_ICACHE_DISABLED 59#ifndef CONFIG_ICACHE_DISABLED
166 60static inline void sh64_icache_inv_all(void)
167static void __inline__ sh64_icache_inv_all(void)
168{ 61{
169 unsigned long long addr, flag, data; 62 unsigned long long addr, flag, data;
170 unsigned int flags; 63 unsigned int flags;
171 64
172 addr=ICCR0; 65 addr = ICCR0;
173 flag=ICCR0_ICI; 66 flag = ICCR0_ICI;
174 data=0; 67 data = 0;
175 68
176 /* Make this a critical section for safety (probably not strictly necessary.) */ 69 /* Make this a critical section for safety (probably not strictly necessary.) */
177 local_irq_save(flags); 70 local_irq_save(flags);
178 71
179 /* Without %1 it gets unexplicably wrong */ 72 /* Without %1 it gets unexplicably wrong */
180 asm volatile("getcfg %3, 0, %0\n\t" 73 __asm__ __volatile__ (
181 "or %0, %2, %0\n\t" 74 "getcfg %3, 0, %0\n\t"
182 "putcfg %3, 0, %0\n\t" 75 "or %0, %2, %0\n\t"
183 "synci" 76 "putcfg %3, 0, %0\n\t"
184 : "=&r" (data) 77 "synci"
185 : "0" (data), "r" (flag), "r" (addr)); 78 : "=&r" (data)
79 : "0" (data), "r" (flag), "r" (addr));
186 80
187 local_irq_restore(flags); 81 local_irq_restore(flags);
188} 82}
@@ -193,20 +87,12 @@ static void sh64_icache_inv_kernel_range(unsigned long start, unsigned long end)
193 * the addresses lie in the kernel superpage. */ 87 * the addresses lie in the kernel superpage. */
194 88
195 unsigned long long ullend, addr, aligned_start; 89 unsigned long long ullend, addr, aligned_start;
196#if (NEFF == 32)
197 aligned_start = (unsigned long long)(signed long long)(signed long) start; 90 aligned_start = (unsigned long long)(signed long long)(signed long) start;
198#else 91 addr = L1_CACHE_ALIGN(aligned_start);
199#error "NEFF != 32"
200#endif
201 aligned_start &= L1_CACHE_ALIGN_MASK;
202 addr = aligned_start;
203#if (NEFF == 32)
204 ullend = (unsigned long long) (signed long long) (signed long) end; 92 ullend = (unsigned long long) (signed long long) (signed long) end;
205#else 93
206#error "NEFF != 32"
207#endif
208 while (addr <= ullend) { 94 while (addr <= ullend) {
209 asm __volatile__ ("icbi %0, 0" : : "r" (addr)); 95 __asm__ __volatile__ ("icbi %0, 0" : : "r" (addr));
210 addr += L1_CACHE_BYTES; 96 addr += L1_CACHE_BYTES;
211 } 97 }
212} 98}
@@ -215,7 +101,7 @@ static void sh64_icache_inv_user_page(struct vm_area_struct *vma, unsigned long
215{ 101{
216 /* If we get called, we know that vma->vm_flags contains VM_EXEC. 102 /* If we get called, we know that vma->vm_flags contains VM_EXEC.
217 Also, eaddr is page-aligned. */ 103 Also, eaddr is page-aligned. */
218 104 unsigned int cpu = smp_processor_id();
219 unsigned long long addr, end_addr; 105 unsigned long long addr, end_addr;
220 unsigned long flags = 0; 106 unsigned long flags = 0;
221 unsigned long running_asid, vma_asid; 107 unsigned long running_asid, vma_asid;
@@ -237,17 +123,17 @@ static void sh64_icache_inv_user_page(struct vm_area_struct *vma, unsigned long
237 */ 123 */
238 124
239 running_asid = get_asid(); 125 running_asid = get_asid();
240 vma_asid = (vma->vm_mm->context & MMU_CONTEXT_ASID_MASK); 126 vma_asid = cpu_asid(cpu, vma->vm_mm);
241 if (running_asid != vma_asid) { 127 if (running_asid != vma_asid) {
242 local_irq_save(flags); 128 local_irq_save(flags);
243 switch_and_save_asid(vma_asid); 129 switch_and_save_asid(vma_asid);
244 } 130 }
245 while (addr < end_addr) { 131 while (addr < end_addr) {
246 /* Worth unrolling a little */ 132 /* Worth unrolling a little */
247 asm __volatile__("icbi %0, 0" : : "r" (addr)); 133 __asm__ __volatile__("icbi %0, 0" : : "r" (addr));
248 asm __volatile__("icbi %0, 32" : : "r" (addr)); 134 __asm__ __volatile__("icbi %0, 32" : : "r" (addr));
249 asm __volatile__("icbi %0, 64" : : "r" (addr)); 135 __asm__ __volatile__("icbi %0, 64" : : "r" (addr));
250 asm __volatile__("icbi %0, 96" : : "r" (addr)); 136 __asm__ __volatile__("icbi %0, 96" : : "r" (addr));
251 addr += 128; 137 addr += 128;
252 } 138 }
253 if (running_asid != vma_asid) { 139 if (running_asid != vma_asid) {
@@ -256,8 +142,6 @@ static void sh64_icache_inv_user_page(struct vm_area_struct *vma, unsigned long
256 } 142 }
257} 143}
258 144
259/****************************************************************************/
260
261static void sh64_icache_inv_user_page_range(struct mm_struct *mm, 145static void sh64_icache_inv_user_page_range(struct mm_struct *mm,
262 unsigned long start, unsigned long end) 146 unsigned long start, unsigned long end)
263{ 147{
@@ -275,10 +159,10 @@ static void sh64_icache_inv_user_page_range(struct mm_struct *mm,
275 possible with the D-cache. Just assume 64 for now as a working 159 possible with the D-cache. Just assume 64 for now as a working
276 figure. 160 figure.
277 */ 161 */
278
279 int n_pages; 162 int n_pages;
280 163
281 if (!mm) return; 164 if (!mm)
165 return;
282 166
283 n_pages = ((end - start) >> PAGE_SHIFT); 167 n_pages = ((end - start) >> PAGE_SHIFT);
284 if (n_pages >= 64) { 168 if (n_pages >= 64) {
@@ -290,7 +174,7 @@ static void sh64_icache_inv_user_page_range(struct mm_struct *mm,
290 unsigned long mm_asid, current_asid; 174 unsigned long mm_asid, current_asid;
291 unsigned long long flags = 0ULL; 175 unsigned long long flags = 0ULL;
292 176
293 mm_asid = mm->context & MMU_CONTEXT_ASID_MASK; 177 mm_asid = cpu_asid(smp_processor_id(), mm);
294 current_asid = get_asid(); 178 current_asid = get_asid();
295 179
296 if (mm_asid != current_asid) { 180 if (mm_asid != current_asid) {
@@ -322,6 +206,7 @@ static void sh64_icache_inv_user_page_range(struct mm_struct *mm,
322 } 206 }
323 aligned_start = vma->vm_end; /* Skip to start of next region */ 207 aligned_start = vma->vm_end; /* Skip to start of next region */
324 } 208 }
209
325 if (mm_asid != current_asid) { 210 if (mm_asid != current_asid) {
326 switch_and_save_asid(current_asid); 211 switch_and_save_asid(current_asid);
327 local_irq_restore(flags); 212 local_irq_restore(flags);
@@ -329,47 +214,46 @@ static void sh64_icache_inv_user_page_range(struct mm_struct *mm,
329 } 214 }
330} 215}
331 216
217/*
218 * Invalidate a small range of user context I-cache, not necessarily page
219 * (or even cache-line) aligned.
220 *
221 * Since this is used inside ptrace, the ASID in the mm context typically
222 * won't match current_asid. We'll have to switch ASID to do this. For
223 * safety, and given that the range will be small, do all this under cli.
224 *
225 * Note, there is a hazard that the ASID in mm->context is no longer
226 * actually associated with mm, i.e. if the mm->context has started a new
227 * cycle since mm was last active. However, this is just a performance
228 * issue: all that happens is that we invalidate lines belonging to
229 * another mm, so the owning process has to refill them when that mm goes
230 * live again. mm itself can't have any cache entries because there will
231 * have been a flush_cache_all when the new mm->context cycle started.
232 */
332static void sh64_icache_inv_user_small_range(struct mm_struct *mm, 233static void sh64_icache_inv_user_small_range(struct mm_struct *mm,
333 unsigned long start, int len) 234 unsigned long start, int len)
334{ 235{
335
336 /* Invalidate a small range of user context I-cache, not necessarily
337 page (or even cache-line) aligned. */
338
339 unsigned long long eaddr = start; 236 unsigned long long eaddr = start;
340 unsigned long long eaddr_end = start + len; 237 unsigned long long eaddr_end = start + len;
341 unsigned long current_asid, mm_asid; 238 unsigned long current_asid, mm_asid;
342 unsigned long long flags; 239 unsigned long long flags;
343 unsigned long long epage_start; 240 unsigned long long epage_start;
344 241
345 /* Since this is used inside ptrace, the ASID in the mm context 242 /*
346 typically won't match current_asid. We'll have to switch ASID to do 243 * Align to start of cache line. Otherwise, suppose len==8 and
347 this. For safety, and given that the range will be small, do all 244 * start was at 32N+28 : the last 4 bytes wouldn't get invalidated.
348 this under cli. 245 */
349 246 eaddr = L1_CACHE_ALIGN(start);
350 Note, there is a hazard that the ASID in mm->context is no longer
351 actually associated with mm, i.e. if the mm->context has started a
352 new cycle since mm was last active. However, this is just a
353 performance issue: all that happens is that we invalidate lines
354 belonging to another mm, so the owning process has to refill them
355 when that mm goes live again. mm itself can't have any cache
356 entries because there will have been a flush_cache_all when the new
357 mm->context cycle started. */
358
359 /* Align to start of cache line. Otherwise, suppose len==8 and start
360 was at 32N+28 : the last 4 bytes wouldn't get invalidated. */
361 eaddr = start & L1_CACHE_ALIGN_MASK;
362 eaddr_end = start + len; 247 eaddr_end = start + len;
363 248
249 mm_asid = cpu_asid(smp_processor_id(), mm);
364 local_irq_save(flags); 250 local_irq_save(flags);
365 mm_asid = mm->context & MMU_CONTEXT_ASID_MASK;
366 current_asid = switch_and_save_asid(mm_asid); 251 current_asid = switch_and_save_asid(mm_asid);
367 252
368 epage_start = eaddr & PAGE_MASK; 253 epage_start = eaddr & PAGE_MASK;
369 254
370 while (eaddr < eaddr_end) 255 while (eaddr < eaddr_end) {
371 { 256 __asm__ __volatile__("icbi %0, 0" : : "r" (eaddr));
372 asm __volatile__("icbi %0, 0" : : "r" (eaddr));
373 eaddr += L1_CACHE_BYTES; 257 eaddr += L1_CACHE_BYTES;
374 } 258 }
375 switch_and_save_asid(current_asid); 259 switch_and_save_asid(current_asid);
@@ -394,30 +278,24 @@ static void sh64_icache_inv_current_user_range(unsigned long start, unsigned lon
394 been recycled since we were last active in which case we might just 278 been recycled since we were last active in which case we might just
395 invalidate another processes I-cache entries : no worries, just a 279 invalidate another processes I-cache entries : no worries, just a
396 performance drop for him. */ 280 performance drop for him. */
397 aligned_start = start & L1_CACHE_ALIGN_MASK; 281 aligned_start = L1_CACHE_ALIGN(start);
398 addr = aligned_start; 282 addr = aligned_start;
399 while (addr < ull_end) { 283 while (addr < ull_end) {
400 asm __volatile__ ("icbi %0, 0" : : "r" (addr)); 284 __asm__ __volatile__ ("icbi %0, 0" : : "r" (addr));
401 asm __volatile__ ("nop"); 285 __asm__ __volatile__ ("nop");
402 asm __volatile__ ("nop"); 286 __asm__ __volatile__ ("nop");
403 addr += L1_CACHE_BYTES; 287 addr += L1_CACHE_BYTES;
404 } 288 }
405} 289}
406
407#endif /* !CONFIG_ICACHE_DISABLED */ 290#endif /* !CONFIG_ICACHE_DISABLED */
408 291
409/****************************************************************************/
410
411#ifndef CONFIG_DCACHE_DISABLED 292#ifndef CONFIG_DCACHE_DISABLED
412
413/* Buffer used as the target of alloco instructions to purge data from cache 293/* Buffer used as the target of alloco instructions to purge data from cache
414 sets by natural eviction. -- RPC */ 294 sets by natural eviction. -- RPC */
415#define DUMMY_ALLOCO_AREA_SIZE L1_CACHE_SIZE_BYTES + (1024 * 4) 295#define DUMMY_ALLOCO_AREA_SIZE ((L1_CACHE_BYTES << 10) + (1024 * 4))
416static unsigned char dummy_alloco_area[DUMMY_ALLOCO_AREA_SIZE] __cacheline_aligned = { 0, }; 296static unsigned char dummy_alloco_area[DUMMY_ALLOCO_AREA_SIZE] __cacheline_aligned = { 0, };
417 297
418/****************************************************************************/ 298static void inline sh64_dcache_purge_sets(int sets_to_purge_base, int n_sets)
419
420static void __inline__ sh64_dcache_purge_sets(int sets_to_purge_base, int n_sets)
421{ 299{
422 /* Purge all ways in a particular block of sets, specified by the base 300 /* Purge all ways in a particular block of sets, specified by the base
423 set number and number of sets. Can handle wrap-around, if that's 301 set number and number of sets. Can handle wrap-around, if that's
@@ -428,102 +306,86 @@ static void __inline__ sh64_dcache_purge_sets(int sets_to_purge_base, int n_sets
428 int j; 306 int j;
429 int set_offset; 307 int set_offset;
430 308
431 dummy_buffer_base_set = ((int)&dummy_alloco_area & cpu_data->dcache.idx_mask) >> cpu_data->dcache.entry_shift; 309 dummy_buffer_base_set = ((int)&dummy_alloco_area &
310 cpu_data->dcache.entry_mask) >>
311 cpu_data->dcache.entry_shift;
432 set_offset = sets_to_purge_base - dummy_buffer_base_set; 312 set_offset = sets_to_purge_base - dummy_buffer_base_set;
433 313
434 for (j=0; j<n_sets; j++, set_offset++) { 314 for (j = 0; j < n_sets; j++, set_offset++) {
435 set_offset &= (cpu_data->dcache.sets - 1); 315 set_offset &= (cpu_data->dcache.sets - 1);
436 eaddr0 = (unsigned long long)dummy_alloco_area + (set_offset << cpu_data->dcache.entry_shift); 316 eaddr0 = (unsigned long long)dummy_alloco_area +
437 317 (set_offset << cpu_data->dcache.entry_shift);
438 /* Do one alloco which hits the required set per cache way. For 318
439 write-back mode, this will purge the #ways resident lines. There's 319 /*
440 little point unrolling this loop because the allocos stall more if 320 * Do one alloco which hits the required set per cache
441 they're too close together. */ 321 * way. For write-back mode, this will purge the #ways
442 eaddr1 = eaddr0 + cpu_data->dcache.way_ofs * cpu_data->dcache.ways; 322 * resident lines. There's little point unrolling this
443 for (eaddr=eaddr0; eaddr<eaddr1; eaddr+=cpu_data->dcache.way_ofs) { 323 * loop because the allocos stall more if they're too
444 asm __volatile__ ("alloco %0, 0" : : "r" (eaddr)); 324 * close together.
445 asm __volatile__ ("synco"); /* TAKum03020 */ 325 */
326 eaddr1 = eaddr0 + cpu_data->dcache.way_size *
327 cpu_data->dcache.ways;
328
329 for (eaddr = eaddr0; eaddr < eaddr1;
330 eaddr += cpu_data->dcache.way_size) {
331 __asm__ __volatile__ ("alloco %0, 0" : : "r" (eaddr));
332 __asm__ __volatile__ ("synco"); /* TAKum03020 */
446 } 333 }
447 334
448 eaddr1 = eaddr0 + cpu_data->dcache.way_ofs * cpu_data->dcache.ways; 335 eaddr1 = eaddr0 + cpu_data->dcache.way_size *
449 for (eaddr=eaddr0; eaddr<eaddr1; eaddr+=cpu_data->dcache.way_ofs) { 336 cpu_data->dcache.ways;
450 /* Load from each address. Required because alloco is a NOP if 337
451 the cache is write-through. Write-through is a config option. */ 338 for (eaddr = eaddr0; eaddr < eaddr1;
339 eaddr += cpu_data->dcache.way_size) {
340 /*
341 * Load from each address. Required because
342 * alloco is a NOP if the cache is write-through.
343 */
452 if (test_bit(SH_CACHE_MODE_WT, &(cpu_data->dcache.flags))) 344 if (test_bit(SH_CACHE_MODE_WT, &(cpu_data->dcache.flags)))
453 *(volatile unsigned char *)(int)eaddr; 345 ctrl_inb(eaddr);
454 } 346 }
455 } 347 }
456 348
457 /* Don't use OCBI to invalidate the lines. That costs cycles directly. 349 /*
458 If the dummy block is just left resident, it will naturally get 350 * Don't use OCBI to invalidate the lines. That costs cycles
459 evicted as required. */ 351 * directly. If the dummy block is just left resident, it will
460 352 * naturally get evicted as required.
461 return; 353 */
462} 354}
463 355
464/****************************************************************************/ 356/*
465 357 * Purge the entire contents of the dcache. The most efficient way to
358 * achieve this is to use alloco instructions on a region of unused
359 * memory equal in size to the cache, thereby causing the current
360 * contents to be discarded by natural eviction. The alternative, namely
361 * reading every tag, setting up a mapping for the corresponding page and
362 * doing an OCBP for the line, would be much more expensive.
363 */
466static void sh64_dcache_purge_all(void) 364static void sh64_dcache_purge_all(void)
467{ 365{
468 /* Purge the entire contents of the dcache. The most efficient way to
469 achieve this is to use alloco instructions on a region of unused
470 memory equal in size to the cache, thereby causing the current
471 contents to be discarded by natural eviction. The alternative,
472 namely reading every tag, setting up a mapping for the corresponding
473 page and doing an OCBP for the line, would be much more expensive.
474 */
475 366
476 sh64_dcache_purge_sets(0, cpu_data->dcache.sets); 367 sh64_dcache_purge_sets(0, cpu_data->dcache.sets);
477
478 return;
479
480} 368}
481 369
482/****************************************************************************/
483
484static void sh64_dcache_purge_kernel_range(unsigned long start, unsigned long end)
485{
486 /* Purge the range of addresses [start,end] from the D-cache. The
487 addresses lie in the superpage mapping. There's no harm if we
488 overpurge at either end - just a small performance loss. */
489 unsigned long long ullend, addr, aligned_start;
490#if (NEFF == 32)
491 aligned_start = (unsigned long long)(signed long long)(signed long) start;
492#else
493#error "NEFF != 32"
494#endif
495 aligned_start &= L1_CACHE_ALIGN_MASK;
496 addr = aligned_start;
497#if (NEFF == 32)
498 ullend = (unsigned long long) (signed long long) (signed long) end;
499#else
500#error "NEFF != 32"
501#endif
502 while (addr <= ullend) {
503 asm __volatile__ ("ocbp %0, 0" : : "r" (addr));
504 addr += L1_CACHE_BYTES;
505 }
506 return;
507}
508 370
509/* Assumes this address (+ (2**n_synbits) pages up from it) aren't used for 371/* Assumes this address (+ (2**n_synbits) pages up from it) aren't used for
510 anything else in the kernel */ 372 anything else in the kernel */
511#define MAGIC_PAGE0_START 0xffffffffec000000ULL 373#define MAGIC_PAGE0_START 0xffffffffec000000ULL
512 374
513static void sh64_dcache_purge_coloured_phy_page(unsigned long paddr, unsigned long eaddr) 375/* Purge the physical page 'paddr' from the cache. It's known that any
376 * cache lines requiring attention have the same page colour as the the
377 * address 'eaddr'.
378 *
379 * This relies on the fact that the D-cache matches on physical tags when
380 * no virtual tag matches. So we create an alias for the original page
381 * and purge through that. (Alternatively, we could have done this by
382 * switching ASID to match the original mapping and purged through that,
383 * but that involves ASID switching cost + probably a TLBMISS + refill
384 * anyway.)
385 */
386static void sh64_dcache_purge_coloured_phy_page(unsigned long paddr,
387 unsigned long eaddr)
514{ 388{
515 /* Purge the physical page 'paddr' from the cache. It's known that any
516 cache lines requiring attention have the same page colour as the the
517 address 'eaddr'.
518
519 This relies on the fact that the D-cache matches on physical tags
520 when no virtual tag matches. So we create an alias for the original
521 page and purge through that. (Alternatively, we could have done
522 this by switching ASID to match the original mapping and purged
523 through that, but that involves ASID switching cost + probably a
524 TLBMISS + refill anyway.)
525 */
526
527 unsigned long long magic_page_start; 389 unsigned long long magic_page_start;
528 unsigned long long magic_eaddr, magic_eaddr_end; 390 unsigned long long magic_eaddr, magic_eaddr_end;
529 391
@@ -531,47 +393,45 @@ static void sh64_dcache_purge_coloured_phy_page(unsigned long paddr, unsigned lo
531 393
532 /* As long as the kernel is not pre-emptible, this doesn't need to be 394 /* As long as the kernel is not pre-emptible, this doesn't need to be
533 under cli/sti. */ 395 under cli/sti. */
534
535 sh64_setup_dtlb_cache_slot(magic_page_start, get_asid(), paddr); 396 sh64_setup_dtlb_cache_slot(magic_page_start, get_asid(), paddr);
536 397
537 magic_eaddr = magic_page_start; 398 magic_eaddr = magic_page_start;
538 magic_eaddr_end = magic_eaddr + PAGE_SIZE; 399 magic_eaddr_end = magic_eaddr + PAGE_SIZE;
400
539 while (magic_eaddr < magic_eaddr_end) { 401 while (magic_eaddr < magic_eaddr_end) {
540 /* Little point in unrolling this loop - the OCBPs are blocking 402 /* Little point in unrolling this loop - the OCBPs are blocking
541 and won't go any quicker (i.e. the loop overhead is parallel 403 and won't go any quicker (i.e. the loop overhead is parallel
542 to part of the OCBP execution.) */ 404 to part of the OCBP execution.) */
543 asm __volatile__ ("ocbp %0, 0" : : "r" (magic_eaddr)); 405 __asm__ __volatile__ ("ocbp %0, 0" : : "r" (magic_eaddr));
544 magic_eaddr += L1_CACHE_BYTES; 406 magic_eaddr += L1_CACHE_BYTES;
545 } 407 }
546 408
547 sh64_teardown_dtlb_cache_slot(); 409 sh64_teardown_dtlb_cache_slot();
548} 410}
549 411
550/****************************************************************************/ 412/*
551 413 * Purge a page given its physical start address, by creating a temporary
414 * 1 page mapping and purging across that. Even if we know the virtual
415 * address (& vma or mm) of the page, the method here is more elegant
416 * because it avoids issues of coping with page faults on the purge
417 * instructions (i.e. no special-case code required in the critical path
418 * in the TLB miss handling).
419 */
552static void sh64_dcache_purge_phy_page(unsigned long paddr) 420static void sh64_dcache_purge_phy_page(unsigned long paddr)
553{ 421{
554 /* Pure a page given its physical start address, by creating a
555 temporary 1 page mapping and purging across that. Even if we know
556 the virtual address (& vma or mm) of the page, the method here is
557 more elegant because it avoids issues of coping with page faults on
558 the purge instructions (i.e. no special-case code required in the
559 critical path in the TLB miss handling). */
560
561 unsigned long long eaddr_start, eaddr, eaddr_end; 422 unsigned long long eaddr_start, eaddr, eaddr_end;
562 int i; 423 int i;
563 424
564 /* As long as the kernel is not pre-emptible, this doesn't need to be 425 /* As long as the kernel is not pre-emptible, this doesn't need to be
565 under cli/sti. */ 426 under cli/sti. */
566
567 eaddr_start = MAGIC_PAGE0_START; 427 eaddr_start = MAGIC_PAGE0_START;
568 for (i=0; i < (1 << CACHE_OC_N_SYNBITS); i++) { 428 for (i = 0; i < (1 << CACHE_OC_N_SYNBITS); i++) {
569 sh64_setup_dtlb_cache_slot(eaddr_start, get_asid(), paddr); 429 sh64_setup_dtlb_cache_slot(eaddr_start, get_asid(), paddr);
570 430
571 eaddr = eaddr_start; 431 eaddr = eaddr_start;
572 eaddr_end = eaddr + PAGE_SIZE; 432 eaddr_end = eaddr + PAGE_SIZE;
573 while (eaddr < eaddr_end) { 433 while (eaddr < eaddr_end) {
574 asm __volatile__ ("ocbp %0, 0" : : "r" (eaddr)); 434 __asm__ __volatile__ ("ocbp %0, 0" : : "r" (eaddr));
575 eaddr += L1_CACHE_BYTES; 435 eaddr += L1_CACHE_BYTES;
576 } 436 }
577 437
@@ -584,6 +444,7 @@ static void sh64_dcache_purge_user_pages(struct mm_struct *mm,
584 unsigned long addr, unsigned long end) 444 unsigned long addr, unsigned long end)
585{ 445{
586 pgd_t *pgd; 446 pgd_t *pgd;
447 pud_t *pud;
587 pmd_t *pmd; 448 pmd_t *pmd;
588 pte_t *pte; 449 pte_t *pte;
589 pte_t entry; 450 pte_t entry;
@@ -597,7 +458,11 @@ static void sh64_dcache_purge_user_pages(struct mm_struct *mm,
597 if (pgd_bad(*pgd)) 458 if (pgd_bad(*pgd))
598 return; 459 return;
599 460
600 pmd = pmd_offset(pgd, addr); 461 pud = pud_offset(pgd, addr);
462 if (pud_none(*pud) || pud_bad(*pud))
463 return;
464
465 pmd = pmd_offset(pud, addr);
601 if (pmd_none(*pmd) || pmd_bad(*pmd)) 466 if (pmd_none(*pmd) || pmd_bad(*pmd))
602 return; 467 return;
603 468
@@ -611,419 +476,357 @@ static void sh64_dcache_purge_user_pages(struct mm_struct *mm,
611 } while (pte++, addr += PAGE_SIZE, addr != end); 476 } while (pte++, addr += PAGE_SIZE, addr != end);
612 pte_unmap_unlock(pte - 1, ptl); 477 pte_unmap_unlock(pte - 1, ptl);
613} 478}
614/****************************************************************************/
615 479
480/*
481 * There are at least 5 choices for the implementation of this, with
482 * pros (+), cons(-), comments(*):
483 *
484 * 1. ocbp each line in the range through the original user's ASID
485 * + no lines spuriously evicted
486 * - tlbmiss handling (must either handle faults on demand => extra
487 * special-case code in tlbmiss critical path), or map the page in
488 * advance (=> flush_tlb_range in advance to avoid multiple hits)
489 * - ASID switching
490 * - expensive for large ranges
491 *
492 * 2. temporarily map each page in the range to a special effective
493 * address and ocbp through the temporary mapping; relies on the
494 * fact that SH-5 OCB* always do TLB lookup and match on ptags (they
495 * never look at the etags)
496 * + no spurious evictions
497 * - expensive for large ranges
498 * * surely cheaper than (1)
499 *
500 * 3. walk all the lines in the cache, check the tags, if a match
501 * occurs create a page mapping to ocbp the line through
502 * + no spurious evictions
503 * - tag inspection overhead
504 * - (especially for small ranges)
505 * - potential cost of setting up/tearing down page mapping for
506 * every line that matches the range
507 * * cost partly independent of range size
508 *
509 * 4. walk all the lines in the cache, check the tags, if a match
510 * occurs use 4 * alloco to purge the line (+3 other probably
511 * innocent victims) by natural eviction
512 * + no tlb mapping overheads
513 * - spurious evictions
514 * - tag inspection overhead
515 *
516 * 5. implement like flush_cache_all
517 * + no tag inspection overhead
518 * - spurious evictions
519 * - bad for small ranges
520 *
521 * (1) can be ruled out as more expensive than (2). (2) appears best
522 * for small ranges. The choice between (3), (4) and (5) for large
523 * ranges and the range size for the large/small boundary need
524 * benchmarking to determine.
525 *
526 * For now use approach (2) for small ranges and (5) for large ones.
527 */
616static void sh64_dcache_purge_user_range(struct mm_struct *mm, 528static void sh64_dcache_purge_user_range(struct mm_struct *mm,
617 unsigned long start, unsigned long end) 529 unsigned long start, unsigned long end)
618{ 530{
619 /* There are at least 5 choices for the implementation of this, with 531 int n_pages = ((end - start) >> PAGE_SHIFT);
620 pros (+), cons(-), comments(*):
621
622 1. ocbp each line in the range through the original user's ASID
623 + no lines spuriously evicted
624 - tlbmiss handling (must either handle faults on demand => extra
625 special-case code in tlbmiss critical path), or map the page in
626 advance (=> flush_tlb_range in advance to avoid multiple hits)
627 - ASID switching
628 - expensive for large ranges
629
630 2. temporarily map each page in the range to a special effective
631 address and ocbp through the temporary mapping; relies on the
632 fact that SH-5 OCB* always do TLB lookup and match on ptags (they
633 never look at the etags)
634 + no spurious evictions
635 - expensive for large ranges
636 * surely cheaper than (1)
637
638 3. walk all the lines in the cache, check the tags, if a match
639 occurs create a page mapping to ocbp the line through
640 + no spurious evictions
641 - tag inspection overhead
642 - (especially for small ranges)
643 - potential cost of setting up/tearing down page mapping for
644 every line that matches the range
645 * cost partly independent of range size
646
647 4. walk all the lines in the cache, check the tags, if a match
648 occurs use 4 * alloco to purge the line (+3 other probably
649 innocent victims) by natural eviction
650 + no tlb mapping overheads
651 - spurious evictions
652 - tag inspection overhead
653
654 5. implement like flush_cache_all
655 + no tag inspection overhead
656 - spurious evictions
657 - bad for small ranges
658
659 (1) can be ruled out as more expensive than (2). (2) appears best
660 for small ranges. The choice between (3), (4) and (5) for large
661 ranges and the range size for the large/small boundary need
662 benchmarking to determine.
663
664 For now use approach (2) for small ranges and (5) for large ones.
665
666 */
667
668 int n_pages;
669 532
670 n_pages = ((end - start) >> PAGE_SHIFT);
671 if (n_pages >= 64 || ((start ^ (end - 1)) & PMD_MASK)) { 533 if (n_pages >= 64 || ((start ^ (end - 1)) & PMD_MASK)) {
672#if 1
673 sh64_dcache_purge_all(); 534 sh64_dcache_purge_all();
674#else
675 unsigned long long set, way;
676 unsigned long mm_asid = mm->context & MMU_CONTEXT_ASID_MASK;
677 for (set = 0; set < cpu_data->dcache.sets; set++) {
678 unsigned long long set_base_config_addr = CACHE_OC_ADDRESS_ARRAY + (set << cpu_data->dcache.set_shift);
679 for (way = 0; way < cpu_data->dcache.ways; way++) {
680 unsigned long long config_addr = set_base_config_addr + (way << cpu_data->dcache.way_step_shift);
681 unsigned long long tag0;
682 unsigned long line_valid;
683
684 asm __volatile__("getcfg %1, 0, %0" : "=r" (tag0) : "r" (config_addr));
685 line_valid = tag0 & SH_CACHE_VALID;
686 if (line_valid) {
687 unsigned long cache_asid;
688 unsigned long epn;
689
690 cache_asid = (tag0 & cpu_data->dcache.asid_mask) >> cpu_data->dcache.asid_shift;
691 /* The next line needs some
692 explanation. The virtual tags
693 encode bits [31:13] of the virtual
694 address, bit [12] of the 'tag' being
695 implied by the cache set index. */
696 epn = (tag0 & cpu_data->dcache.epn_mask) | ((set & 0x80) << cpu_data->dcache.entry_shift);
697
698 if ((cache_asid == mm_asid) && (start <= epn) && (epn < end)) {
699 /* TODO : could optimise this
700 call by batching multiple
701 adjacent sets together. */
702 sh64_dcache_purge_sets(set, 1);
703 break; /* Don't waste time inspecting other ways for this set */
704 }
705 }
706 }
707 }
708#endif
709 } else { 535 } else {
710 /* Small range, covered by a single page table page */ 536 /* Small range, covered by a single page table page */
711 start &= PAGE_MASK; /* should already be so */ 537 start &= PAGE_MASK; /* should already be so */
712 end = PAGE_ALIGN(end); /* should already be so */ 538 end = PAGE_ALIGN(end); /* should already be so */
713 sh64_dcache_purge_user_pages(mm, start, end); 539 sh64_dcache_purge_user_pages(mm, start, end);
714 } 540 }
715 return;
716} 541}
717 542
718static void sh64_dcache_wback_current_user_range(unsigned long start, unsigned long end) 543/*
544 * Purge the range of addresses from the D-cache.
545 *
546 * The addresses lie in the superpage mapping. There's no harm if we
547 * overpurge at either end - just a small performance loss.
548 */
549void __flush_purge_region(void *start, int size)
719{ 550{
720 unsigned long long aligned_start; 551 unsigned long long ullend, addr, aligned_start;
721 unsigned long long ull_end;
722 unsigned long long addr;
723
724 ull_end = end;
725 552
726 /* Just wback over the range using the natural addresses. TLB miss 553 aligned_start = (unsigned long long)(signed long long)(signed long) start;
727 handling will be OK (TBC) : the range has just been written to by 554 addr = L1_CACHE_ALIGN(aligned_start);
728 the signal frame setup code, so the PTEs must exist. 555 ullend = (unsigned long long) (signed long long) (signed long) start + size;
729 556
730 Note, if we have CONFIG_PREEMPT and get preempted inside this loop, 557 while (addr <= ullend) {
731 it doesn't matter, even if the pid->ASID mapping changes whilst 558 __asm__ __volatile__ ("ocbp %0, 0" : : "r" (addr));
732 we're away. In that case the cache will have been flushed when the
733 mapping was renewed. So the writebacks below will be nugatory (and
734 we'll doubtless have to fault the TLB entry/ies in again with the
735 new ASID), but it's a rare case.
736 */
737 aligned_start = start & L1_CACHE_ALIGN_MASK;
738 addr = aligned_start;
739 while (addr < ull_end) {
740 asm __volatile__ ("ocbwb %0, 0" : : "r" (addr));
741 addr += L1_CACHE_BYTES; 559 addr += L1_CACHE_BYTES;
742 } 560 }
743} 561}
744 562
745/****************************************************************************/ 563void __flush_wback_region(void *start, int size)
746
747/* These *MUST* lie in an area of virtual address space that's otherwise unused. */
748#define UNIQUE_EADDR_START 0xe0000000UL
749#define UNIQUE_EADDR_END 0xe8000000UL
750
751static unsigned long sh64_make_unique_eaddr(unsigned long user_eaddr, unsigned long paddr)
752{ 564{
753 /* Given a physical address paddr, and a user virtual address 565 unsigned long long ullend, addr, aligned_start;
754 user_eaddr which will eventually be mapped to it, create a one-off
755 kernel-private eaddr mapped to the same paddr. This is used for
756 creating special destination pages for copy_user_page and
757 clear_user_page */
758 566
759 static unsigned long current_pointer = UNIQUE_EADDR_START; 567 aligned_start = (unsigned long long)(signed long long)(signed long) start;
760 unsigned long coloured_pointer; 568 addr = L1_CACHE_ALIGN(aligned_start);
569 ullend = (unsigned long long) (signed long long) (signed long) start + size;
761 570
762 if (current_pointer == UNIQUE_EADDR_END) { 571 while (addr < ullend) {
763 sh64_dcache_purge_all(); 572 __asm__ __volatile__ ("ocbwb %0, 0" : : "r" (addr));
764 current_pointer = UNIQUE_EADDR_START; 573 addr += L1_CACHE_BYTES;
765 } 574 }
766
767 coloured_pointer = (current_pointer & ~CACHE_OC_SYN_MASK) | (user_eaddr & CACHE_OC_SYN_MASK);
768 sh64_setup_dtlb_cache_slot(coloured_pointer, get_asid(), paddr);
769
770 current_pointer += (PAGE_SIZE << CACHE_OC_N_SYNBITS);
771
772 return coloured_pointer;
773}
774
775/****************************************************************************/
776
777static void sh64_copy_user_page_coloured(void *to, void *from, unsigned long address)
778{
779 void *coloured_to;
780
781 /* Discard any existing cache entries of the wrong colour. These are
782 present quite often, if the kernel has recently used the page
783 internally, then given it up, then it's been allocated to the user.
784 */
785 sh64_dcache_purge_coloured_phy_page(__pa(to), (unsigned long) to);
786
787 coloured_to = (void *) sh64_make_unique_eaddr(address, __pa(to));
788 sh64_page_copy(from, coloured_to);
789
790 sh64_teardown_dtlb_cache_slot();
791} 575}
792 576
793static void sh64_clear_user_page_coloured(void *to, unsigned long address) 577void __flush_invalidate_region(void *start, int size)
794{ 578{
795 void *coloured_to; 579 unsigned long long ullend, addr, aligned_start;
796
797 /* Discard any existing kernel-originated lines of the wrong colour (as
798 above) */
799 sh64_dcache_purge_coloured_phy_page(__pa(to), (unsigned long) to);
800 580
801 coloured_to = (void *) sh64_make_unique_eaddr(address, __pa(to)); 581 aligned_start = (unsigned long long)(signed long long)(signed long) start;
802 sh64_page_clear(coloured_to); 582 addr = L1_CACHE_ALIGN(aligned_start);
583 ullend = (unsigned long long) (signed long long) (signed long) start + size;
803 584
804 sh64_teardown_dtlb_cache_slot(); 585 while (addr < ullend) {
586 __asm__ __volatile__ ("ocbi %0, 0" : : "r" (addr));
587 addr += L1_CACHE_BYTES;
588 }
805} 589}
806
807#endif /* !CONFIG_DCACHE_DISABLED */ 590#endif /* !CONFIG_DCACHE_DISABLED */
808 591
809/****************************************************************************/ 592/*
810 593 * Invalidate the entire contents of both caches, after writing back to
811/*########################################################################## 594 * memory any dirty data from the D-cache.
812 EXTERNALLY CALLABLE API. 595 */
813 ##########################################################################*/
814
815/* These functions are described in Documentation/cachetlb.txt.
816 Each one of these functions varies in behaviour depending on whether the
817 I-cache and/or D-cache are configured out.
818
819 Note that the Linux term 'flush' corresponds to what is termed 'purge' in
820 the sh/sh64 jargon for the D-cache, i.e. write back dirty data then
821 invalidate the cache lines, and 'invalidate' for the I-cache.
822 */
823
824#undef FLUSH_TRACE
825
826void flush_cache_all(void) 596void flush_cache_all(void)
827{ 597{
828 /* Invalidate the entire contents of both caches, after writing back to
829 memory any dirty data from the D-cache. */
830 sh64_dcache_purge_all(); 598 sh64_dcache_purge_all();
831 sh64_icache_inv_all(); 599 sh64_icache_inv_all();
832} 600}
833 601
834/****************************************************************************/ 602/*
835 603 * Invalidate an entire user-address space from both caches, after
604 * writing back dirty data (e.g. for shared mmap etc).
605 *
606 * This could be coded selectively by inspecting all the tags then
607 * doing 4*alloco on any set containing a match (as for
608 * flush_cache_range), but fork/exit/execve (where this is called from)
609 * are expensive anyway.
610 *
611 * Have to do a purge here, despite the comments re I-cache below.
612 * There could be odd-coloured dirty data associated with the mm still
613 * in the cache - if this gets written out through natural eviction
614 * after the kernel has reused the page there will be chaos.
615 *
616 * The mm being torn down won't ever be active again, so any Icache
617 * lines tagged with its ASID won't be visible for the rest of the
618 * lifetime of this ASID cycle. Before the ASID gets reused, there
619 * will be a flush_cache_all. Hence we don't need to touch the
620 * I-cache. This is similar to the lack of action needed in
621 * flush_tlb_mm - see fault.c.
622 */
836void flush_cache_mm(struct mm_struct *mm) 623void flush_cache_mm(struct mm_struct *mm)
837{ 624{
838 /* Invalidate an entire user-address space from both caches, after
839 writing back dirty data (e.g. for shared mmap etc). */
840
841 /* This could be coded selectively by inspecting all the tags then
842 doing 4*alloco on any set containing a match (as for
843 flush_cache_range), but fork/exit/execve (where this is called from)
844 are expensive anyway. */
845
846 /* Have to do a purge here, despite the comments re I-cache below.
847 There could be odd-coloured dirty data associated with the mm still
848 in the cache - if this gets written out through natural eviction
849 after the kernel has reused the page there will be chaos.
850 */
851
852 sh64_dcache_purge_all(); 625 sh64_dcache_purge_all();
853
854 /* The mm being torn down won't ever be active again, so any Icache
855 lines tagged with its ASID won't be visible for the rest of the
856 lifetime of this ASID cycle. Before the ASID gets reused, there
857 will be a flush_cache_all. Hence we don't need to touch the
858 I-cache. This is similar to the lack of action needed in
859 flush_tlb_mm - see fault.c. */
860} 626}
861 627
862/****************************************************************************/ 628/*
863 629 * Invalidate (from both caches) the range [start,end) of virtual
630 * addresses from the user address space specified by mm, after writing
631 * back any dirty data.
632 *
633 * Note, 'end' is 1 byte beyond the end of the range to flush.
634 */
864void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 635void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
865 unsigned long end) 636 unsigned long end)
866{ 637{
867 struct mm_struct *mm = vma->vm_mm; 638 struct mm_struct *mm = vma->vm_mm;
868 639
869 /* Invalidate (from both caches) the range [start,end) of virtual
870 addresses from the user address space specified by mm, after writing
871 back any dirty data.
872
873 Note, 'end' is 1 byte beyond the end of the range to flush. */
874
875 sh64_dcache_purge_user_range(mm, start, end); 640 sh64_dcache_purge_user_range(mm, start, end);
876 sh64_icache_inv_user_page_range(mm, start, end); 641 sh64_icache_inv_user_page_range(mm, start, end);
877} 642}
878 643
879/****************************************************************************/ 644/*
880 645 * Invalidate any entries in either cache for the vma within the user
881void flush_cache_page(struct vm_area_struct *vma, unsigned long eaddr, unsigned long pfn) 646 * address space vma->vm_mm for the page starting at virtual address
647 * 'eaddr'. This seems to be used primarily in breaking COW. Note,
648 * the I-cache must be searched too in case the page in question is
649 * both writable and being executed from (e.g. stack trampolines.)
650 *
651 * Note, this is called with pte lock held.
652 */
653void flush_cache_page(struct vm_area_struct *vma, unsigned long eaddr,
654 unsigned long pfn)
882{ 655{
883 /* Invalidate any entries in either cache for the vma within the user
884 address space vma->vm_mm for the page starting at virtual address
885 'eaddr'. This seems to be used primarily in breaking COW. Note,
886 the I-cache must be searched too in case the page in question is
887 both writable and being executed from (e.g. stack trampolines.)
888
889 Note, this is called with pte lock held.
890 */
891
892 sh64_dcache_purge_phy_page(pfn << PAGE_SHIFT); 656 sh64_dcache_purge_phy_page(pfn << PAGE_SHIFT);
893 657
894 if (vma->vm_flags & VM_EXEC) { 658 if (vma->vm_flags & VM_EXEC)
895 sh64_icache_inv_user_page(vma, eaddr); 659 sh64_icache_inv_user_page(vma, eaddr);
896 }
897} 660}
898 661
899/****************************************************************************/ 662void flush_dcache_page(struct page *page)
663{
664 sh64_dcache_purge_phy_page(page_to_phys(page));
665 wmb();
666}
900 667
901#ifndef CONFIG_DCACHE_DISABLED 668/*
669 * Flush the range [start,end] of kernel virtual adddress space from
670 * the I-cache. The corresponding range must be purged from the
671 * D-cache also because the SH-5 doesn't have cache snooping between
672 * the caches. The addresses will be visible through the superpage
673 * mapping, therefore it's guaranteed that there no cache entries for
674 * the range in cache sets of the wrong colour.
675 */
676void flush_icache_range(unsigned long start, unsigned long end)
677{
678 __flush_purge_region((void *)start, end);
679 wmb();
680 sh64_icache_inv_kernel_range(start, end);
681}
902 682
903void copy_user_page(void *to, void *from, unsigned long address, struct page *page) 683/*
684 * Flush the range of user (defined by vma->vm_mm) address space starting
685 * at 'addr' for 'len' bytes from the cache. The range does not straddle
686 * a page boundary, the unique physical page containing the range is
687 * 'page'. This seems to be used mainly for invalidating an address
688 * range following a poke into the program text through the ptrace() call
689 * from another process (e.g. for BRK instruction insertion).
690 */
691void flush_icache_user_range(struct vm_area_struct *vma,
692 struct page *page, unsigned long addr, int len)
904{ 693{
905 /* 'from' and 'to' are kernel virtual addresses (within the superpage
906 mapping of the physical RAM). 'address' is the user virtual address
907 where the copy 'to' will be mapped after. This allows a custom
908 mapping to be used to ensure that the new copy is placed in the
909 right cache sets for the user to see it without having to bounce it
910 out via memory. Note however : the call to flush_page_to_ram in
911 (generic)/mm/memory.c:(break_cow) undoes all this good work in that one
912 very important case!
913
914 TBD : can we guarantee that on every call, any cache entries for
915 'from' are in the same colour sets as 'address' also? i.e. is this
916 always used just to deal with COW? (I suspect not). */
917
918 /* There are two possibilities here for when the page 'from' was last accessed:
919 * by the kernel : this is OK, no purge required.
920 * by the/a user (e.g. for break_COW) : need to purge.
921
922 If the potential user mapping at 'address' is the same colour as
923 'from' there is no need to purge any cache lines from the 'from'
924 page mapped into cache sets of colour 'address'. (The copy will be
925 accessing the page through 'from').
926 */
927 694
928 if (((address ^ (unsigned long) from) & CACHE_OC_SYN_MASK) != 0) { 695 sh64_dcache_purge_coloured_phy_page(page_to_phys(page), addr);
929 sh64_dcache_purge_coloured_phy_page(__pa(from), address); 696 mb();
930 }
931 697
932 if (((address ^ (unsigned long) to) & CACHE_OC_SYN_MASK) == 0) { 698 if (vma->vm_flags & VM_EXEC)
933 /* No synonym problem on destination */ 699 sh64_icache_inv_user_small_range(vma->vm_mm, addr, len);
934 sh64_page_copy(from, to); 700}
935 } else { 701
936 sh64_copy_user_page_coloured(to, from, address); 702/*
937 } 703 * For the address range [start,end), write back the data from the
704 * D-cache and invalidate the corresponding region of the I-cache for the
705 * current process. Used to flush signal trampolines on the stack to
706 * make them executable.
707 */
708void flush_cache_sigtramp(unsigned long vaddr)
709{
710 unsigned long end = vaddr + L1_CACHE_BYTES;
938 711
939 /* Note, don't need to flush 'from' page from the cache again - it's 712 __flush_wback_region((void *)vaddr, L1_CACHE_BYTES);
940 done anyway by the generic code */ 713 wmb();
714 sh64_icache_inv_current_user_range(vaddr, end);
941} 715}
942 716
943void clear_user_page(void *to, unsigned long address, struct page *page) 717/*
718 * These *MUST* lie in an area of virtual address space that's otherwise
719 * unused.
720 */
721#define UNIQUE_EADDR_START 0xe0000000UL
722#define UNIQUE_EADDR_END 0xe8000000UL
723
724/*
725 * Given a physical address paddr, and a user virtual address user_eaddr
726 * which will eventually be mapped to it, create a one-off kernel-private
727 * eaddr mapped to the same paddr. This is used for creating special
728 * destination pages for copy_user_page and clear_user_page.
729 */
730static unsigned long sh64_make_unique_eaddr(unsigned long user_eaddr,
731 unsigned long paddr)
944{ 732{
945 /* 'to' is a kernel virtual address (within the superpage 733 static unsigned long current_pointer = UNIQUE_EADDR_START;
946 mapping of the physical RAM). 'address' is the user virtual address 734 unsigned long coloured_pointer;
947 where the 'to' page will be mapped after. This allows a custom
948 mapping to be used to ensure that the new copy is placed in the
949 right cache sets for the user to see it without having to bounce it
950 out via memory.
951 */
952 735
953 if (((address ^ (unsigned long) to) & CACHE_OC_SYN_MASK) == 0) { 736 if (current_pointer == UNIQUE_EADDR_END) {
954 /* No synonym problem on destination */ 737 sh64_dcache_purge_all();
955 sh64_page_clear(to); 738 current_pointer = UNIQUE_EADDR_START;
956 } else {
957 sh64_clear_user_page_coloured(to, address);
958 } 739 }
959}
960 740
961#endif /* !CONFIG_DCACHE_DISABLED */ 741 coloured_pointer = (current_pointer & ~CACHE_OC_SYN_MASK) |
742 (user_eaddr & CACHE_OC_SYN_MASK);
743 sh64_setup_dtlb_cache_slot(coloured_pointer, get_asid(), paddr);
962 744
963/****************************************************************************/ 745 current_pointer += (PAGE_SIZE << CACHE_OC_N_SYNBITS);
964 746
965void flush_dcache_page(struct page *page) 747 return coloured_pointer;
966{
967 sh64_dcache_purge_phy_page(page_to_phys(page));
968 wmb();
969} 748}
970 749
971/****************************************************************************/ 750static void sh64_copy_user_page_coloured(void *to, void *from,
972 751 unsigned long address)
973void flush_icache_range(unsigned long start, unsigned long end)
974{ 752{
975 /* Flush the range [start,end] of kernel virtual adddress space from 753 void *coloured_to;
976 the I-cache. The corresponding range must be purged from the
977 D-cache also because the SH-5 doesn't have cache snooping between
978 the caches. The addresses will be visible through the superpage
979 mapping, therefore it's guaranteed that there no cache entries for
980 the range in cache sets of the wrong colour.
981 754
982 Primarily used for cohering the I-cache after a module has 755 /*
983 been loaded. */ 756 * Discard any existing cache entries of the wrong colour. These are
757 * present quite often, if the kernel has recently used the page
758 * internally, then given it up, then it's been allocated to the user.
759 */
760 sh64_dcache_purge_coloured_phy_page(__pa(to), (unsigned long)to);
984 761
985 /* We also make sure to purge the same range from the D-cache since 762 coloured_to = (void *)sh64_make_unique_eaddr(address, __pa(to));
986 flush_page_to_ram() won't be doing this for us! */ 763 copy_page(from, coloured_to);
987 764
988 sh64_dcache_purge_kernel_range(start, end); 765 sh64_teardown_dtlb_cache_slot();
989 wmb();
990 sh64_icache_inv_kernel_range(start, end);
991} 766}
992 767
993/****************************************************************************/ 768static void sh64_clear_user_page_coloured(void *to, unsigned long address)
994
995void flush_icache_user_range(struct vm_area_struct *vma,
996 struct page *page, unsigned long addr, int len)
997{ 769{
998 /* Flush the range of user (defined by vma->vm_mm) address space 770 void *coloured_to;
999 starting at 'addr' for 'len' bytes from the cache. The range does
1000 not straddle a page boundary, the unique physical page containing
1001 the range is 'page'. This seems to be used mainly for invalidating
1002 an address range following a poke into the program text through the
1003 ptrace() call from another process (e.g. for BRK instruction
1004 insertion). */
1005 771
1006 sh64_dcache_purge_coloured_phy_page(page_to_phys(page), addr); 772 /*
1007 mb(); 773 * Discard any existing kernel-originated lines of the wrong
774 * colour (as above)
775 */
776 sh64_dcache_purge_coloured_phy_page(__pa(to), (unsigned long)to);
1008 777
1009 if (vma->vm_flags & VM_EXEC) { 778 coloured_to = (void *)sh64_make_unique_eaddr(address, __pa(to));
1010 sh64_icache_inv_user_small_range(vma->vm_mm, addr, len); 779 clear_page(coloured_to);
1011 }
1012}
1013 780
1014/*########################################################################## 781 sh64_teardown_dtlb_cache_slot();
1015 ARCH/SH64 PRIVATE CALLABLE API. 782}
1016 ##########################################################################*/
1017 783
1018void flush_cache_sigtramp(unsigned long start, unsigned long end) 784/*
785 * 'from' and 'to' are kernel virtual addresses (within the superpage
786 * mapping of the physical RAM). 'address' is the user virtual address
787 * where the copy 'to' will be mapped after. This allows a custom
788 * mapping to be used to ensure that the new copy is placed in the
789 * right cache sets for the user to see it without having to bounce it
790 * out via memory. Note however : the call to flush_page_to_ram in
791 * (generic)/mm/memory.c:(break_cow) undoes all this good work in that one
792 * very important case!
793 *
794 * TBD : can we guarantee that on every call, any cache entries for
795 * 'from' are in the same colour sets as 'address' also? i.e. is this
796 * always used just to deal with COW? (I suspect not).
797 *
798 * There are two possibilities here for when the page 'from' was last accessed:
799 * - by the kernel : this is OK, no purge required.
800 * - by the/a user (e.g. for break_COW) : need to purge.
801 *
802 * If the potential user mapping at 'address' is the same colour as
803 * 'from' there is no need to purge any cache lines from the 'from'
804 * page mapped into cache sets of colour 'address'. (The copy will be
805 * accessing the page through 'from').
806 */
807void copy_user_page(void *to, void *from, unsigned long address,
808 struct page *page)
1019{ 809{
1020 /* For the address range [start,end), write back the data from the 810 if (((address ^ (unsigned long) from) & CACHE_OC_SYN_MASK) != 0)
1021 D-cache and invalidate the corresponding region of the I-cache for 811 sh64_dcache_purge_coloured_phy_page(__pa(from), address);
1022 the current process. Used to flush signal trampolines on the stack
1023 to make them executable. */
1024 812
1025 sh64_dcache_wback_current_user_range(start, end); 813 if (((address ^ (unsigned long) to) & CACHE_OC_SYN_MASK) == 0)
1026 wmb(); 814 copy_page(to, from);
1027 sh64_icache_inv_current_user_range(start, end); 815 else
816 sh64_copy_user_page_coloured(to, from, address);
1028} 817}
1029 818
819/*
820 * 'to' is a kernel virtual address (within the superpage mapping of the
821 * physical RAM). 'address' is the user virtual address where the 'to'
822 * page will be mapped after. This allows a custom mapping to be used to
823 * ensure that the new copy is placed in the right cache sets for the
824 * user to see it without having to bounce it out via memory.
825 */
826void clear_user_page(void *to, unsigned long address, struct page *page)
827{
828 if (((address ^ (unsigned long) to) & CACHE_OC_SYN_MASK) == 0)
829 clear_page(to);
830 else
831 sh64_clear_user_page_coloured(to, address);
832}
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 7b2131c9eeda..d3c33fc5b1c2 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -26,7 +26,7 @@ struct dma_coherent_mem {
26void *dma_alloc_coherent(struct device *dev, size_t size, 26void *dma_alloc_coherent(struct device *dev, size_t size,
27 dma_addr_t *dma_handle, gfp_t gfp) 27 dma_addr_t *dma_handle, gfp_t gfp)
28{ 28{
29 void *ret; 29 void *ret, *ret_nocache;
30 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; 30 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
31 int order = get_order(size); 31 int order = get_order(size);
32 32
@@ -44,17 +44,24 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
44 } 44 }
45 45
46 ret = (void *)__get_free_pages(gfp, order); 46 ret = (void *)__get_free_pages(gfp, order);
47 47 if (!ret)
48 if (ret != NULL) { 48 return NULL;
49 memset(ret, 0, size); 49
50 /* 50 memset(ret, 0, size);
51 * Pages from the page allocator may have data present in 51 /*
52 * cache. So flush the cache before using uncached memory. 52 * Pages from the page allocator may have data present in
53 */ 53 * cache. So flush the cache before using uncached memory.
54 dma_cache_sync(NULL, ret, size, DMA_BIDIRECTIONAL); 54 */
55 *dma_handle = virt_to_phys(ret); 55 dma_cache_sync(dev, ret, size, DMA_BIDIRECTIONAL);
56
57 ret_nocache = ioremap_nocache(virt_to_phys(ret), size);
58 if (!ret_nocache) {
59 free_pages((unsigned long)ret, order);
60 return NULL;
56 } 61 }
57 return ret; 62
63 *dma_handle = virt_to_phys(ret);
64 return ret_nocache;
58} 65}
59EXPORT_SYMBOL(dma_alloc_coherent); 66EXPORT_SYMBOL(dma_alloc_coherent);
60 67
@@ -71,7 +78,8 @@ void dma_free_coherent(struct device *dev, size_t size,
71 } else { 78 } else {
72 WARN_ON(irqs_disabled()); /* for portability */ 79 WARN_ON(irqs_disabled()); /* for portability */
73 BUG_ON(mem && mem->flags & DMA_MEMORY_EXCLUSIVE); 80 BUG_ON(mem && mem->flags & DMA_MEMORY_EXCLUSIVE);
74 free_pages((unsigned long)vaddr, order); 81 free_pages((unsigned long)phys_to_virt(dma_handle), order);
82 iounmap(vaddr);
75 } 83 }
76} 84}
77EXPORT_SYMBOL(dma_free_coherent); 85EXPORT_SYMBOL(dma_free_coherent);
diff --git a/arch/sh/mm/fault_32.c b/arch/sh/mm/fault_32.c
index 33b43d20e9f6..d1fa27594c6e 100644
--- a/arch/sh/mm/fault_32.c
+++ b/arch/sh/mm/fault_32.c
@@ -15,6 +15,7 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/hardirq.h> 16#include <linux/hardirq.h>
17#include <linux/kprobes.h> 17#include <linux/kprobes.h>
18#include <asm/io_trapped.h>
18#include <asm/system.h> 19#include <asm/system.h>
19#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
20#include <asm/tlbflush.h> 21#include <asm/tlbflush.h>
@@ -163,6 +164,8 @@ no_context:
163 if (fixup_exception(regs)) 164 if (fixup_exception(regs))
164 return; 165 return;
165 166
167 if (handle_trapped_io(regs, address))
168 return;
166/* 169/*
167 * Oops. The kernel tried to access some bad page. We'll have to 170 * Oops. The kernel tried to access some bad page. We'll have to
168 * terminate things with extreme prejudice. 171 * terminate things with extreme prejudice.
@@ -296,6 +299,14 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
296 entry = pte_mkdirty(entry); 299 entry = pte_mkdirty(entry);
297 entry = pte_mkyoung(entry); 300 entry = pte_mkyoung(entry);
298 301
302#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SMP)
303 /*
304 * ITLB is not affected by "ldtlb" instruction.
305 * So, we need to flush the entry by ourselves.
306 */
307 local_flush_tlb_one(get_asid(), address & PAGE_MASK);
308#endif
309
299 set_pte(pte, entry); 310 set_pte(pte, entry);
300 update_mmu_cache(NULL, address, entry); 311 update_mmu_cache(NULL, address, entry);
301 312
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 2918c6b14659..e2ed6dd252b9 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -203,6 +203,7 @@ void __init paging_init(void)
203 203
204 free_area_init_nodes(max_zone_pfns); 204 free_area_init_nodes(max_zone_pfns);
205 205
206#ifdef CONFIG_SUPERH32
206 /* Set up the uncached fixmap */ 207 /* Set up the uncached fixmap */
207 set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start)); 208 set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start));
208 209
@@ -214,6 +215,7 @@ void __init paging_init(void)
214 */ 215 */
215 cached_to_uncached = P2SEG - P1SEG; 216 cached_to_uncached = P2SEG - P1SEG;
216#endif 217#endif
218#endif
217} 219}
218 220
219static struct kcore_list kcore_mem, kcore_vmalloc; 221static struct kcore_list kcore_mem, kcore_vmalloc;
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index 25810670a0fa..67997af25c0c 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -45,3 +45,5 @@ MAGICPANELR2 SH_MAGIC_PANEL_R2
45R2D_PLUS RTS7751R2D_PLUS 45R2D_PLUS RTS7751R2D_PLUS
46R2D_1 RTS7751R2D_1 46R2D_1 RTS7751R2D_1
47CAYMAN SH_CAYMAN 47CAYMAN SH_CAYMAN
48SDK7780 SH_SDK7780
49MIGOR SH_MIGOR
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 4cd5d7818dc6..a6a6f9823370 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -713,10 +713,10 @@ static irqreturn_t pcic_timer_handler (int irq, void *h)
713 write_seqlock(&xtime_lock); /* Dummy, to show that we remember */ 713 write_seqlock(&xtime_lock); /* Dummy, to show that we remember */
714 pcic_clear_clock_irq(); 714 pcic_clear_clock_irq();
715 do_timer(1); 715 do_timer(1);
716 write_sequnlock(&xtime_lock);
716#ifndef CONFIG_SMP 717#ifndef CONFIG_SMP
717 update_process_times(user_mode(get_irq_regs())); 718 update_process_times(user_mode(get_irq_regs()));
718#endif 719#endif
719 write_sequnlock(&xtime_lock);
720 return IRQ_HANDLED; 720 return IRQ_HANDLED;
721} 721}
722 722
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index 19186ce8850d..0bd69d0b5cd7 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -141,16 +141,12 @@ void cpu_idle(void)
141 141
142extern char reboot_command []; 142extern char reboot_command [];
143 143
144extern void (*prom_palette)(int);
145
146/* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */ 144/* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */
147void machine_halt(void) 145void machine_halt(void)
148{ 146{
149 local_irq_enable(); 147 local_irq_enable();
150 mdelay(8); 148 mdelay(8);
151 local_irq_disable(); 149 local_irq_disable();
152 if (prom_palette)
153 prom_palette (1);
154 prom_halt(); 150 prom_halt();
155 panic("Halt failed!"); 151 panic("Halt failed!");
156} 152}
@@ -165,8 +161,6 @@ void machine_restart(char * cmd)
165 161
166 p = strchr (reboot_command, '\n'); 162 p = strchr (reboot_command, '\n');
167 if (p) *p = 0; 163 if (p) *p = 0;
168 if (prom_palette)
169 prom_palette (1);
170 if (cmd) 164 if (cmd)
171 prom_reboot(cmd); 165 prom_reboot(cmd);
172 if (*reboot_command) 166 if (*reboot_command)
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 3cf78f160846..3c13137685da 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -65,7 +65,6 @@ struct screen_info screen_info = {
65 */ 65 */
66 66
67extern unsigned long trapbase; 67extern unsigned long trapbase;
68void (*prom_palette)(int);
69 68
70/* Pretty sick eh? */ 69/* Pretty sick eh? */
71void prom_sync_me(void) 70void prom_sync_me(void)
@@ -80,8 +79,6 @@ void prom_sync_me(void)
80 "nop\n\t" 79 "nop\n\t"
81 "nop\n\t" : : "r" (&trapbase)); 80 "nop\n\t" : : "r" (&trapbase));
82 81
83 if (prom_palette)
84 prom_palette(1);
85 prom_printf("PROM SYNC COMMAND...\n"); 82 prom_printf("PROM SYNC COMMAND...\n");
86 show_free_areas(); 83 show_free_areas();
87 if(current->pid != 0) { 84 if(current->pid != 0) {
@@ -191,7 +188,6 @@ extern int prom_probe_memory(void);
191extern void sun4c_probe_vac(void); 188extern void sun4c_probe_vac(void);
192extern char cputypval; 189extern char cputypval;
193extern unsigned long start, end; 190extern unsigned long start, end;
194extern void panic_setup(char *, int *);
195 191
196extern unsigned short root_flags; 192extern unsigned short root_flags;
197extern unsigned short root_dev; 193extern unsigned short root_dev;
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 00b393c3a4a0..cfaf22c05bc4 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -128,10 +128,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
128 clear_clock_irq(); 128 clear_clock_irq();
129 129
130 do_timer(1); 130 do_timer(1);
131#ifndef CONFIG_SMP
132 update_process_times(user_mode(get_irq_regs()));
133#endif
134
135 131
136 /* Determine when to update the Mostek clock. */ 132 /* Determine when to update the Mostek clock. */
137 if (ntp_synced() && 133 if (ntp_synced() &&
@@ -145,6 +141,9 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
145 } 141 }
146 write_sequnlock(&xtime_lock); 142 write_sequnlock(&xtime_lock);
147 143
144#ifndef CONFIG_SMP
145 update_process_times(user_mode(get_irq_regs()));
146#endif
148 return IRQ_HANDLED; 147 return IRQ_HANDLED;
149} 148}
150 149
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index c0442e8c4b15..2375fe9dc312 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -1941,9 +1941,7 @@ static pte_t *sun4c_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long add
1941 if ((pte = sun4c_pte_alloc_one_fast(mm, address)) != NULL) 1941 if ((pte = sun4c_pte_alloc_one_fast(mm, address)) != NULL)
1942 return pte; 1942 return pte;
1943 1943
1944 pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); 1944 pte = (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
1945 if (pte)
1946 memset(pte, 0, PAGE_SIZE);
1947 return pte; 1945 return pte;
1948} 1946}
1949 1947
diff --git a/arch/sparc/prom/misc.c b/arch/sparc/prom/misc.c
index 37cff5f54704..d9fb3af41c1f 100644
--- a/arch/sparc/prom/misc.c
+++ b/arch/sparc/prom/misc.c
@@ -45,9 +45,6 @@ prom_feval(char *fstring)
45 spin_unlock_irqrestore(&prom_lock, flags); 45 spin_unlock_irqrestore(&prom_lock, flags);
46} 46}
47 47
48/* We want to do this more nicely some day. */
49extern void (*prom_palette)(int);
50
51/* Drop into the prom, with the chance to continue with the 'go' 48/* Drop into the prom, with the chance to continue with the 'go'
52 * prom command. 49 * prom command.
53 */ 50 */
@@ -58,8 +55,6 @@ prom_cmdline(void)
58 extern void install_linux_ticker(void); 55 extern void install_linux_ticker(void);
59 unsigned long flags; 56 unsigned long flags;
60 57
61 if (prom_palette)
62 prom_palette (1);
63 spin_lock_irqsave(&prom_lock, flags); 58 spin_lock_irqsave(&prom_lock, flags);
64 install_obp_ticker(); 59 install_obp_ticker();
65 (*(romvec->pv_abort))(); 60 (*(romvec->pv_abort))();
@@ -69,8 +64,6 @@ prom_cmdline(void)
69#ifdef CONFIG_SUN_AUXIO 64#ifdef CONFIG_SUN_AUXIO
70 set_auxio(AUXIO_LED, 0); 65 set_auxio(AUXIO_LED, 0);
71#endif 66#endif
72 if (prom_palette)
73 prom_palette (0);
74} 67}
75 68
76/* Drop into the prom, but completely terminate the program. 69/* Drop into the prom, but completely terminate the program.
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
index a5faa3683bd6..6a4d28a4076d 100644
--- a/arch/sparc64/Kconfig.debug
+++ b/arch/sparc64/Kconfig.debug
@@ -23,10 +23,6 @@ config STACK_DEBUG
23 depends on DEBUG_KERNEL 23 depends on DEBUG_KERNEL
24 bool "Stack Overflow Detection Support" 24 bool "Stack Overflow Detection Support"
25 25
26config DEBUG_BOOTMEM
27 depends on DEBUG_KERNEL
28 bool "Debug BOOTMEM initialization"
29
30config DEBUG_PAGEALLOC 26config DEBUG_PAGEALLOC
31 bool "Debug page memory allocations" 27 bool "Debug page memory allocations"
32 depends on DEBUG_KERNEL && !HIBERNATION 28 depends on DEBUG_KERNEL && !HIBERNATION
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
index 01159cb5f16d..f0c22f826982 100644
--- a/arch/sparc64/Makefile
+++ b/arch/sparc64/Makefile
@@ -12,39 +12,13 @@ CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -m64
12 12
13CPPFLAGS_vmlinux.lds += -Usparc 13CPPFLAGS_vmlinux.lds += -Usparc
14 14
15CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi )
16
17NEW_GCC := $(call cc-option-yn, -m64 -mcmodel=medlow)
18NEW_GAS := $(shell if $(LD) -V 2>&1 | grep 'elf64_sparc' > /dev/null; then echo y; else echo n; fi)
19UNDECLARED_REGS := $(shell if $(CC) -c -x assembler /dev/null -Wa,--help | grep undeclared-regs > /dev/null; then echo y; else echo n; fi; )
20
21ifneq ($(NEW_GAS),y)
22AS = sparc64-linux-as
23LD = sparc64-linux-ld
24NM = sparc64-linux-nm
25AR = sparc64-linux-ar
26RANLIB = sparc64-linux-ranlib
27else
28AS := $(AS) -64
29LDFLAGS := -m elf64_sparc 15LDFLAGS := -m elf64_sparc
30endif
31 16
32ifneq ($(UNDECLARED_REGS),y) 17KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
33CC_UNDECL = 18 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
34else 19 -Wa,--undeclared-regs
35CC_UNDECL = -Wa,--undeclared-regs 20KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
36AS := $(AS) --undeclared-regs 21KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
37endif
38
39ifneq ($(NEW_GCC),y)
40 KBUILD_CFLAGS += -pipe -mno-fpu -mtune=ultrasparc -mmedlow \
41 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare
42else
43 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
44 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
45 $(CC_UNDECL)
46 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL)
47endif
48 22
49ifeq ($(CONFIG_MCOUNT),y) 23ifeq ($(CONFIG_MCOUNT),y)
50 KBUILD_CFLAGS += -pg 24 KBUILD_CFLAGS += -pg
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 833d74b2b192..250958d1e3cb 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.24 3# Linux kernel version: 2.6.25-rc1
4# Tue Feb 5 17:28:19 2008 4# Sun Feb 17 22:44:12 2008
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -10,6 +10,7 @@ CONFIG_GENERIC_CMOS_UPDATE=y
10CONFIG_GENERIC_CLOCKEVENTS=y 10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_64BIT=y 11CONFIG_64BIT=y
12CONFIG_MMU=y 12CONFIG_MMU=y
13CONFIG_IOMMU_HELPER=y
13CONFIG_QUICKLIST=y 14CONFIG_QUICKLIST=y
14CONFIG_STACKTRACE_SUPPORT=y 15CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y 16CONFIG_LOCKDEP_SUPPORT=y
@@ -21,6 +22,7 @@ CONFIG_HAVE_SETUP_PER_CPU_AREA=y
21CONFIG_ARCH_NO_VIRT_TO_BUS=y 22CONFIG_ARCH_NO_VIRT_TO_BUS=y
22CONFIG_OF=y 23CONFIG_OF=y
23CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
24CONFIG_SPARC64_PAGE_SIZE_8KB=y 26CONFIG_SPARC64_PAGE_SIZE_8KB=y
25# CONFIG_SPARC64_PAGE_SIZE_64KB is not set 27# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
26# CONFIG_SPARC64_PAGE_SIZE_512KB is not set 28# CONFIG_SPARC64_PAGE_SIZE_512KB is not set
@@ -49,8 +51,6 @@ CONFIG_SYSVIPC_SYSCTL=y
49CONFIG_POSIX_MQUEUE=y 51CONFIG_POSIX_MQUEUE=y
50# CONFIG_BSD_PROCESS_ACCT is not set 52# CONFIG_BSD_PROCESS_ACCT is not set
51# CONFIG_TASKSTATS is not set 53# CONFIG_TASKSTATS is not set
52# CONFIG_USER_NS is not set
53# CONFIG_PID_NS is not set
54# CONFIG_AUDIT is not set 54# CONFIG_AUDIT is not set
55# CONFIG_IKCONFIG is not set 55# CONFIG_IKCONFIG is not set
56CONFIG_LOG_BUF_SHIFT=18 56CONFIG_LOG_BUF_SHIFT=18
@@ -60,6 +60,11 @@ CONFIG_FAIR_USER_SCHED=y
60# CONFIG_FAIR_CGROUP_SCHED is not set 60# CONFIG_FAIR_CGROUP_SCHED is not set
61CONFIG_SYSFS_DEPRECATED=y 61CONFIG_SYSFS_DEPRECATED=y
62CONFIG_RELAY=y 62CONFIG_RELAY=y
63CONFIG_NAMESPACES=y
64# CONFIG_UTS_NS is not set
65# CONFIG_IPC_NS is not set
66# CONFIG_USER_NS is not set
67# CONFIG_PID_NS is not set
63CONFIG_BLK_DEV_INITRD=y 68CONFIG_BLK_DEV_INITRD=y
64CONFIG_INITRAMFS_SOURCE="" 69CONFIG_INITRAMFS_SOURCE=""
65CONFIG_CC_OPTIMIZE_FOR_SIZE=y 70CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -74,6 +79,7 @@ CONFIG_HOTPLUG=y
74CONFIG_PRINTK=y 79CONFIG_PRINTK=y
75CONFIG_BUG=y 80CONFIG_BUG=y
76CONFIG_ELF_CORE=y 81CONFIG_ELF_CORE=y
82# CONFIG_COMPAT_BRK is not set
77CONFIG_BASE_FULL=y 83CONFIG_BASE_FULL=y
78CONFIG_FUTEX=y 84CONFIG_FUTEX=y
79CONFIG_ANON_INODES=y 85CONFIG_ANON_INODES=y
@@ -176,13 +182,13 @@ CONFIG_PCI_MSI=y
176CONFIG_SUN_OPENPROMFS=m 182CONFIG_SUN_OPENPROMFS=m
177CONFIG_SPARC32_COMPAT=y 183CONFIG_SPARC32_COMPAT=y
178CONFIG_COMPAT=y 184CONFIG_COMPAT=y
179CONFIG_BINFMT_ELF32=y
180# CONFIG_BINFMT_AOUT32 is not set 185# CONFIG_BINFMT_AOUT32 is not set
181 186
182# 187#
183# Executable file formats 188# Executable file formats
184# 189#
185CONFIG_BINFMT_ELF=y 190CONFIG_BINFMT_ELF=y
191CONFIG_COMPAT_BINFMT_ELF=y
186CONFIG_BINFMT_MISC=m 192CONFIG_BINFMT_MISC=m
187CONFIG_SOLARIS_EMUL=y 193CONFIG_SOLARIS_EMUL=y
188CONFIG_SCHED_SMT=y 194CONFIG_SCHED_SMT=y
@@ -354,6 +360,8 @@ CONFIG_MISC_DEVICES=y
354# CONFIG_EEPROM_93CX6 is not set 360# CONFIG_EEPROM_93CX6 is not set
355# CONFIG_SGI_IOC4 is not set 361# CONFIG_SGI_IOC4 is not set
356# CONFIG_TIFM_CORE is not set 362# CONFIG_TIFM_CORE is not set
363# CONFIG_ENCLOSURE_SERVICES is not set
364CONFIG_HAVE_IDE=y
357CONFIG_IDE=y 365CONFIG_IDE=y
358CONFIG_BLK_DEV_IDE=y 366CONFIG_BLK_DEV_IDE=y
359 367
@@ -376,6 +384,7 @@ CONFIG_IDE_PROC_FS=y
376# 384#
377CONFIG_IDE_GENERIC=y 385CONFIG_IDE_GENERIC=y
378# CONFIG_BLK_DEV_PLATFORM is not set 386# CONFIG_BLK_DEV_PLATFORM is not set
387CONFIG_BLK_DEV_IDEDMA_SFF=y
379 388
380# 389#
381# PCI IDE chipsets support 390# PCI IDE chipsets support
@@ -775,7 +784,6 @@ CONFIG_I2C_ALGOBIT=y
775# CONFIG_SENSORS_EEPROM is not set 784# CONFIG_SENSORS_EEPROM is not set
776# CONFIG_SENSORS_PCF8574 is not set 785# CONFIG_SENSORS_PCF8574 is not set
777# CONFIG_PCF8575 is not set 786# CONFIG_PCF8575 is not set
778# CONFIG_SENSORS_PCA9539 is not set
779# CONFIG_SENSORS_PCF8591 is not set 787# CONFIG_SENSORS_PCF8591 is not set
780# CONFIG_TPS65010 is not set 788# CONFIG_TPS65010 is not set
781# CONFIG_SENSORS_MAX6875 is not set 789# CONFIG_SENSORS_MAX6875 is not set
@@ -831,6 +839,7 @@ CONFIG_HWMON=y
831# CONFIG_SENSORS_SMSC47M1 is not set 839# CONFIG_SENSORS_SMSC47M1 is not set
832# CONFIG_SENSORS_SMSC47M192 is not set 840# CONFIG_SENSORS_SMSC47M192 is not set
833# CONFIG_SENSORS_SMSC47B397 is not set 841# CONFIG_SENSORS_SMSC47B397 is not set
842# CONFIG_SENSORS_ADS7828 is not set
834# CONFIG_SENSORS_THMC50 is not set 843# CONFIG_SENSORS_THMC50 is not set
835# CONFIG_SENSORS_VIA686A is not set 844# CONFIG_SENSORS_VIA686A is not set
836# CONFIG_SENSORS_VT1211 is not set 845# CONFIG_SENSORS_VT1211 is not set
@@ -840,9 +849,11 @@ CONFIG_HWMON=y
840# CONFIG_SENSORS_W83792D is not set 849# CONFIG_SENSORS_W83792D is not set
841# CONFIG_SENSORS_W83793 is not set 850# CONFIG_SENSORS_W83793 is not set
842# CONFIG_SENSORS_W83L785TS is not set 851# CONFIG_SENSORS_W83L785TS is not set
852# CONFIG_SENSORS_W83L786NG is not set
843# CONFIG_SENSORS_W83627HF is not set 853# CONFIG_SENSORS_W83627HF is not set
844# CONFIG_SENSORS_W83627EHF is not set 854# CONFIG_SENSORS_W83627EHF is not set
845# CONFIG_HWMON_DEBUG_CHIP is not set 855# CONFIG_HWMON_DEBUG_CHIP is not set
856# CONFIG_THERMAL is not set
846# CONFIG_WATCHDOG is not set 857# CONFIG_WATCHDOG is not set
847 858
848# 859#
@@ -1201,6 +1212,7 @@ CONFIG_USB_STORAGE=m
1201# CONFIG_USB_TEST is not set 1212# CONFIG_USB_TEST is not set
1202# CONFIG_USB_GADGET is not set 1213# CONFIG_USB_GADGET is not set
1203# CONFIG_MMC is not set 1214# CONFIG_MMC is not set
1215# CONFIG_MEMSTICK is not set
1204# CONFIG_NEW_LEDS is not set 1216# CONFIG_NEW_LEDS is not set
1205# CONFIG_INFINIBAND is not set 1217# CONFIG_INFINIBAND is not set
1206# CONFIG_RTC_CLASS is not set 1218# CONFIG_RTC_CLASS is not set
@@ -1242,12 +1254,10 @@ CONFIG_FS_POSIX_ACL=y
1242# CONFIG_XFS_FS is not set 1254# CONFIG_XFS_FS is not set
1243# CONFIG_GFS2_FS is not set 1255# CONFIG_GFS2_FS is not set
1244# CONFIG_OCFS2_FS is not set 1256# CONFIG_OCFS2_FS is not set
1245# CONFIG_MINIX_FS is not set 1257CONFIG_DNOTIFY=y
1246# CONFIG_ROMFS_FS is not set
1247CONFIG_INOTIFY=y 1258CONFIG_INOTIFY=y
1248CONFIG_INOTIFY_USER=y 1259CONFIG_INOTIFY_USER=y
1249# CONFIG_QUOTA is not set 1260# CONFIG_QUOTA is not set
1250CONFIG_DNOTIFY=y
1251# CONFIG_AUTOFS_FS is not set 1261# CONFIG_AUTOFS_FS is not set
1252# CONFIG_AUTOFS4_FS is not set 1262# CONFIG_AUTOFS4_FS is not set
1253# CONFIG_FUSE_FS is not set 1263# CONFIG_FUSE_FS is not set
@@ -1291,8 +1301,10 @@ CONFIG_HUGETLB_PAGE=y
1291# CONFIG_EFS_FS is not set 1301# CONFIG_EFS_FS is not set
1292# CONFIG_CRAMFS is not set 1302# CONFIG_CRAMFS is not set
1293# CONFIG_VXFS_FS is not set 1303# CONFIG_VXFS_FS is not set
1304# CONFIG_MINIX_FS is not set
1294# CONFIG_HPFS_FS is not set 1305# CONFIG_HPFS_FS is not set
1295# CONFIG_QNX4FS_FS is not set 1306# CONFIG_QNX4FS_FS is not set
1307# CONFIG_ROMFS_FS is not set
1296# CONFIG_SYSV_FS is not set 1308# CONFIG_SYSV_FS is not set
1297# CONFIG_UFS_FS is not set 1309# CONFIG_UFS_FS is not set
1298CONFIG_NETWORK_FILESYSTEMS=y 1310CONFIG_NETWORK_FILESYSTEMS=y
@@ -1370,6 +1382,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1370CONFIG_SCHEDSTATS=y 1382CONFIG_SCHEDSTATS=y
1371# CONFIG_TIMER_STATS is not set 1383# CONFIG_TIMER_STATS is not set
1372# CONFIG_SLUB_DEBUG_ON is not set 1384# CONFIG_SLUB_DEBUG_ON is not set
1385# CONFIG_SLUB_STATS is not set
1373# CONFIG_DEBUG_RT_MUTEXES is not set 1386# CONFIG_DEBUG_RT_MUTEXES is not set
1374# CONFIG_RT_MUTEX_TESTER is not set 1387# CONFIG_RT_MUTEX_TESTER is not set
1375# CONFIG_DEBUG_SPINLOCK is not set 1388# CONFIG_DEBUG_SPINLOCK is not set
@@ -1385,7 +1398,6 @@ CONFIG_DEBUG_BUGVERBOSE=y
1385# CONFIG_DEBUG_VM is not set 1398# CONFIG_DEBUG_VM is not set
1386# CONFIG_DEBUG_LIST is not set 1399# CONFIG_DEBUG_LIST is not set
1387# CONFIG_DEBUG_SG is not set 1400# CONFIG_DEBUG_SG is not set
1388CONFIG_FORCED_INLINING=y
1389# CONFIG_BOOT_PRINTK_DELAY is not set 1401# CONFIG_BOOT_PRINTK_DELAY is not set
1390# CONFIG_RCU_TORTURE_TEST is not set 1402# CONFIG_RCU_TORTURE_TEST is not set
1391# CONFIG_KPROBES_SANITY_TEST is not set 1403# CONFIG_KPROBES_SANITY_TEST is not set
@@ -1396,7 +1408,6 @@ CONFIG_FORCED_INLINING=y
1396# CONFIG_DEBUG_STACK_USAGE is not set 1408# CONFIG_DEBUG_STACK_USAGE is not set
1397# CONFIG_DEBUG_DCFLUSH is not set 1409# CONFIG_DEBUG_DCFLUSH is not set
1398# CONFIG_STACK_DEBUG is not set 1410# CONFIG_STACK_DEBUG is not set
1399# CONFIG_DEBUG_BOOTMEM is not set
1400# CONFIG_DEBUG_PAGEALLOC is not set 1411# CONFIG_DEBUG_PAGEALLOC is not set
1401 1412
1402# 1413#
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c
index d3276ebcfb47..0e347ff812a3 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc64/kernel/iommu.c
@@ -200,12 +200,11 @@ int iommu_table_init(struct iommu *iommu, int tsbsize,
200 /* Allocate and initialize the dummy page which we 200 /* Allocate and initialize the dummy page which we
201 * set inactive IO PTEs to point to. 201 * set inactive IO PTEs to point to.
202 */ 202 */
203 iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0); 203 iommu->dummy_page = get_zeroed_page(GFP_KERNEL);
204 if (!iommu->dummy_page) { 204 if (!iommu->dummy_page) {
205 printk(KERN_ERR "IOMMU: Error, gfp(dummy_page) failed.\n"); 205 printk(KERN_ERR "IOMMU: Error, gfp(dummy_page) failed.\n");
206 goto out_free_map; 206 goto out_free_map;
207 } 207 }
208 memset((void *)iommu->dummy_page, 0, PAGE_SIZE);
209 iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page); 208 iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page);
210 209
211 /* Now allocate and setup the IOMMU page table itself. */ 210 /* Now allocate and setup the IOMMU page table itself. */
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index a61c38fe75ea..545356b00e2e 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -225,20 +225,6 @@ static int __init pci_controller_init(const char *model_name, int namelen, struc
225 return 0; 225 return 0;
226} 226}
227 227
228static int __init pci_is_controller(const char *model_name, int namelen, struct device_node *dp)
229{
230 int i;
231
232 for (i = 0; i < PCI_NUM_CONTROLLER_TYPES; i++) {
233 if (!strncmp(model_name,
234 pci_controller_table[i].model_name,
235 namelen)) {
236 return 1;
237 }
238 }
239 return 0;
240}
241
242static int __init pci_controller_scan(int (*handler)(const char *, int, struct device_node *)) 228static int __init pci_controller_scan(int (*handler)(const char *, int, struct device_node *))
243{ 229{
244 struct device_node *dp; 230 struct device_node *dp;
@@ -273,13 +259,6 @@ static int __init pci_controller_scan(int (*handler)(const char *, int, struct d
273 return count; 259 return count;
274} 260}
275 261
276
277/* Is there some PCI controller in the system? */
278int __init pcic_present(void)
279{
280 return pci_controller_scan(pci_is_controller);
281}
282
283/* Find each controller in the system, attach and initialize 262/* Find each controller in the system, attach and initialize
284 * software state structure for each and link into the 263 * software state structure for each and link into the
285 * pci_pbm_root. Setup the controller enough such 264 * pci_pbm_root. Setup the controller enough such
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 1b2379174988..6eceac51ae62 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -113,16 +113,9 @@ void cpu_idle(void)
113 113
114extern char reboot_command []; 114extern char reboot_command [];
115 115
116extern void (*prom_palette)(int);
117extern void (*prom_keyboard)(void);
118
119void machine_halt(void) 116void machine_halt(void)
120{ 117{
121 sstate_halt(); 118 sstate_halt();
122 if (prom_palette)
123 prom_palette (1);
124 if (prom_keyboard)
125 prom_keyboard();
126 prom_halt(); 119 prom_halt();
127 panic("Halt failed!"); 120 panic("Halt failed!");
128} 121}
@@ -130,10 +123,6 @@ void machine_halt(void)
130void machine_alt_power_off(void) 123void machine_alt_power_off(void)
131{ 124{
132 sstate_poweroff(); 125 sstate_poweroff();
133 if (prom_palette)
134 prom_palette(1);
135 if (prom_keyboard)
136 prom_keyboard();
137 prom_halt_power_off(); 126 prom_halt_power_off();
138 panic("Power-off failed!"); 127 panic("Power-off failed!");
139} 128}
@@ -145,10 +134,6 @@ void machine_restart(char * cmd)
145 sstate_reboot(); 134 sstate_reboot();
146 p = strchr (reboot_command, '\n'); 135 p = strchr (reboot_command, '\n');
147 if (p) *p = 0; 136 if (p) *p = 0;
148 if (prom_palette)
149 prom_palette (1);
150 if (prom_keyboard)
151 prom_keyboard();
152 if (cmd) 137 if (cmd)
153 prom_reboot(cmd); 138 prom_reboot(cmd);
154 if (*reboot_command) 139 if (*reboot_command)
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index a246e962e5a7..68964ddcde1e 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -1716,7 +1716,6 @@ static void __init of_console_init(void)
1716 1716
1717 of_console_device = dp; 1717 of_console_device = dp;
1718 1718
1719 prom_printf(msg, of_console_path);
1720 printk(msg, of_console_path); 1719 printk(msg, of_console_path);
1721} 1720}
1722 1721
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 5964d8653ade..d036dbe72864 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -68,33 +68,22 @@ struct screen_info screen_info = {
68 16 /* orig-video-points */ 68 16 /* orig-video-points */
69}; 69};
70 70
71void (*prom_palette)(int);
72void (*prom_keyboard)(void);
73
74static void 71static void
75prom_console_write(struct console *con, const char *s, unsigned n) 72prom_console_write(struct console *con, const char *s, unsigned n)
76{ 73{
77 prom_write(s, n); 74 prom_write(s, n);
78} 75}
79 76
80unsigned int boot_flags = 0;
81#define BOOTME_DEBUG 0x1
82
83/* Exported for mm/init.c:paging_init. */ 77/* Exported for mm/init.c:paging_init. */
84unsigned long cmdline_memory_size = 0; 78unsigned long cmdline_memory_size = 0;
85 79
86static struct console prom_debug_console = { 80static struct console prom_early_console = {
87 .name = "debug", 81 .name = "earlyprom",
88 .write = prom_console_write, 82 .write = prom_console_write,
89 .flags = CON_PRINTBUFFER, 83 .flags = CON_PRINTBUFFER | CON_BOOT,
90 .index = -1, 84 .index = -1,
91}; 85};
92 86
93/* XXX Implement this at some point... */
94void kernel_enter_debugger(void)
95{
96}
97
98/* 87/*
99 * Process kernel command line switches that are specific to the 88 * Process kernel command line switches that are specific to the
100 * SPARC or that require special low-level processing. 89 * SPARC or that require special low-level processing.
@@ -103,8 +92,6 @@ static void __init process_switch(char c)
103{ 92{
104 switch (c) { 93 switch (c) {
105 case 'd': 94 case 'd':
106 boot_flags |= BOOTME_DEBUG;
107 break;
108 case 's': 95 case 's':
109 break; 96 break;
110 case 'h': 97 case 'h':
@@ -112,8 +99,7 @@ static void __init process_switch(char c)
112 prom_halt(); 99 prom_halt();
113 break; 100 break;
114 case 'p': 101 case 'p':
115 /* Use PROM debug console. */ 102 /* Just ignore, this behavior is now the default. */
116 register_console(&prom_debug_console);
117 break; 103 break;
118 case 'P': 104 case 'P':
119 /* Force UltraSPARC-III P-Cache on. */ 105 /* Force UltraSPARC-III P-Cache on. */
@@ -168,8 +154,6 @@ static void __init boot_flags_init(char *commands)
168 } 154 }
169} 155}
170 156
171extern void panic_setup(char *, int *);
172
173extern unsigned short root_flags; 157extern unsigned short root_flags;
174extern unsigned short root_dev; 158extern unsigned short root_dev;
175extern unsigned short ram_flags; 159extern unsigned short ram_flags;
@@ -296,6 +280,9 @@ void __init setup_arch(char **cmdline_p)
296 *cmdline_p = prom_getbootargs(); 280 *cmdline_p = prom_getbootargs();
297 strcpy(boot_command_line, *cmdline_p); 281 strcpy(boot_command_line, *cmdline_p);
298 282
283 boot_flags_init(*cmdline_p);
284 register_console(&prom_early_console);
285
299 if (tlb_type == hypervisor) 286 if (tlb_type == hypervisor)
300 printk("ARCH: SUN4V\n"); 287 printk("ARCH: SUN4V\n");
301 else 288 else
@@ -307,8 +294,6 @@ void __init setup_arch(char **cmdline_p)
307 conswitchp = &prom_con; 294 conswitchp = &prom_con;
308#endif 295#endif
309 296
310 boot_flags_init(*cmdline_p);
311
312 idprom_init(); 297 idprom_init();
313 298
314 if (!root_flags) 299 if (!root_flags)
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 68db08930399..51fa773f38c9 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -85,7 +85,6 @@ extern int (*handle_mathemu)(struct pt_regs *, struct fpustate *);
85extern long sparc32_open(const char __user * filename, int flags, int mode); 85extern long sparc32_open(const char __user * filename, int flags, int mode);
86extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, 86extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
87 unsigned long pfn, unsigned long size, pgprot_t prot); 87 unsigned long pfn, unsigned long size, pgprot_t prot);
88extern void (*prom_palette)(int);
89 88
90extern int __ashrdi3(int, int); 89extern int __ashrdi3(int, int);
91 90
@@ -355,5 +354,3 @@ EXPORT_SYMBOL(xor_niagara_2);
355EXPORT_SYMBOL(xor_niagara_3); 354EXPORT_SYMBOL(xor_niagara_3);
356EXPORT_SYMBOL(xor_niagara_4); 355EXPORT_SYMBOL(xor_niagara_4);
357EXPORT_SYMBOL(xor_niagara_5); 356EXPORT_SYMBOL(xor_niagara_5);
358
359EXPORT_SYMBOL(prom_palette);
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index dc7bf1b6321c..1a511e9f0d3e 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9 9
10#include <linux/jiffies.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
@@ -283,7 +284,7 @@ static void log_unaligned(struct pt_regs *regs)
283{ 284{
284 static unsigned long count, last_time; 285 static unsigned long count, last_time;
285 286
286 if (jiffies - last_time > 5 * HZ) 287 if (time_after(jiffies, last_time + 5 * HZ))
287 count = 0; 288 count = 0;
288 if (count < 5) { 289 if (count < 5) {
289 last_time = jiffies; 290 last_time = jiffies;
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index e726c45645ff..9e6bca266d88 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -618,9 +618,9 @@ static void __init inherit_prom_mappings(void)
618 read_obp_translations(); 618 read_obp_translations();
619 619
620 /* Now fixup OBP's idea about where we really are mapped. */ 620 /* Now fixup OBP's idea about where we really are mapped. */
621 prom_printf("Remapping the kernel... "); 621 printk("Remapping the kernel... ");
622 remap_kernel(); 622 remap_kernel();
623 prom_printf("done.\n"); 623 printk("done.\n");
624} 624}
625 625
626void prom_world(int enter) 626void prom_world(int enter)
@@ -739,11 +739,6 @@ static unsigned long __init choose_bootmap_pfn(unsigned long start_pfn,
739 avoid_end = PAGE_ALIGN(initrd_end); 739 avoid_end = PAGE_ALIGN(initrd_end);
740#endif 740#endif
741 741
742#ifdef CONFIG_DEBUG_BOOTMEM
743 prom_printf("choose_bootmap_pfn: kern[%lx:%lx] avoid[%lx:%lx]\n",
744 kern_base, PAGE_ALIGN(kern_base + kern_size),
745 avoid_start, avoid_end);
746#endif
747 for (i = 0; i < pavail_ents; i++) { 742 for (i = 0; i < pavail_ents; i++) {
748 unsigned long start, end; 743 unsigned long start, end;
749 744
@@ -777,10 +772,6 @@ static unsigned long __init choose_bootmap_pfn(unsigned long start_pfn,
777 } 772 }
778 773
779 /* OK, it doesn't overlap anything, use it. */ 774 /* OK, it doesn't overlap anything, use it. */
780#ifdef CONFIG_DEBUG_BOOTMEM
781 prom_printf("choose_bootmap_pfn: Using %lx [%lx]\n",
782 start >> PAGE_SHIFT, start);
783#endif
784 return start >> PAGE_SHIFT; 775 return start >> PAGE_SHIFT;
785 } 776 }
786 } 777 }
@@ -920,10 +911,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
920 unsigned long bootmap_pfn, bytes_avail, size; 911 unsigned long bootmap_pfn, bytes_avail, size;
921 int i; 912 int i;
922 913
923#ifdef CONFIG_DEBUG_BOOTMEM
924 prom_printf("bootmem_init: Scan pavail, ");
925#endif
926
927 bytes_avail = 0UL; 914 bytes_avail = 0UL;
928 for (i = 0; i < pavail_ents; i++) { 915 for (i = 0; i < pavail_ents; i++) {
929 end_of_phys_memory = pavail[i].phys_addr + 916 end_of_phys_memory = pavail[i].phys_addr +
@@ -970,33 +957,20 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
970 957
971 bootmap_pfn = choose_bootmap_pfn(min_low_pfn, end_pfn); 958 bootmap_pfn = choose_bootmap_pfn(min_low_pfn, end_pfn);
972 959
973#ifdef CONFIG_DEBUG_BOOTMEM
974 prom_printf("init_bootmem(min[%lx], bootmap[%lx], max[%lx])\n",
975 min_low_pfn, bootmap_pfn, max_low_pfn);
976#endif
977 bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap_pfn, 960 bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap_pfn,
978 min_low_pfn, end_pfn); 961 min_low_pfn, end_pfn);
979 962
980 /* Now register the available physical memory with the 963 /* Now register the available physical memory with the
981 * allocator. 964 * allocator.
982 */ 965 */
983 for (i = 0; i < pavail_ents; i++) { 966 for (i = 0; i < pavail_ents; i++)
984#ifdef CONFIG_DEBUG_BOOTMEM
985 prom_printf("free_bootmem(pavail:%d): base[%lx] size[%lx]\n",
986 i, pavail[i].phys_addr, pavail[i].reg_size);
987#endif
988 free_bootmem(pavail[i].phys_addr, pavail[i].reg_size); 967 free_bootmem(pavail[i].phys_addr, pavail[i].reg_size);
989 }
990 968
991#ifdef CONFIG_BLK_DEV_INITRD 969#ifdef CONFIG_BLK_DEV_INITRD
992 if (initrd_start) { 970 if (initrd_start) {
993 size = initrd_end - initrd_start; 971 size = initrd_end - initrd_start;
994 972
995 /* Reserve the initrd image area. */ 973 /* Reserve the initrd image area. */
996#ifdef CONFIG_DEBUG_BOOTMEM
997 prom_printf("reserve_bootmem(initrd): base[%llx] size[%lx]\n",
998 initrd_start, initrd_end);
999#endif
1000 reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT); 974 reserve_bootmem(initrd_start, size, BOOTMEM_DEFAULT);
1001 975
1002 initrd_start += PAGE_OFFSET; 976 initrd_start += PAGE_OFFSET;
@@ -1004,9 +978,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1004 } 978 }
1005#endif 979#endif
1006 /* Reserve the kernel text/data/bss. */ 980 /* Reserve the kernel text/data/bss. */
1007#ifdef CONFIG_DEBUG_BOOTMEM
1008 prom_printf("reserve_bootmem(kernel): base[%lx] size[%lx]\n", kern_base, kern_size);
1009#endif
1010 reserve_bootmem(kern_base, kern_size, BOOTMEM_DEFAULT); 981 reserve_bootmem(kern_base, kern_size, BOOTMEM_DEFAULT);
1011 *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT; 982 *pages_avail -= PAGE_ALIGN(kern_size) >> PAGE_SHIFT;
1012 983
@@ -1020,10 +991,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1020 * in free_all_bootmem. 991 * in free_all_bootmem.
1021 */ 992 */
1022 size = bootmap_size; 993 size = bootmap_size;
1023#ifdef CONFIG_DEBUG_BOOTMEM
1024 prom_printf("reserve_bootmem(bootmap): base[%lx] size[%lx]\n",
1025 (bootmap_pfn << PAGE_SHIFT), size);
1026#endif
1027 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT); 994 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size, BOOTMEM_DEFAULT);
1028 995
1029 for (i = 0; i < pavail_ents; i++) { 996 for (i = 0; i < pavail_ents; i++) {
@@ -1031,10 +998,6 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail,
1031 998
1032 start_pfn = pavail[i].phys_addr >> PAGE_SHIFT; 999 start_pfn = pavail[i].phys_addr >> PAGE_SHIFT;
1033 end_pfn = (start_pfn + (pavail[i].reg_size >> PAGE_SHIFT)); 1000 end_pfn = (start_pfn + (pavail[i].reg_size >> PAGE_SHIFT));
1034#ifdef CONFIG_DEBUG_BOOTMEM
1035 prom_printf("memory_present(0, %lx, %lx)\n",
1036 start_pfn, end_pfn);
1037#endif
1038 memory_present(0, start_pfn, end_pfn); 1001 memory_present(0, start_pfn, end_pfn);
1039 } 1002 }
1040 1003
@@ -1451,7 +1414,7 @@ void __init paging_init(void)
1451 zholes_size); 1414 zholes_size);
1452 } 1415 }
1453 1416
1454 prom_printf("Booting Linux...\n"); 1417 printk("Booting Linux...\n");
1455 1418
1456 central_probe(); 1419 central_probe();
1457 cpu_probe(); 1420 cpu_probe();
@@ -1549,10 +1512,6 @@ void __init mem_init(void)
1549 1512
1550 high_memory = __va(last_valid_pfn << PAGE_SHIFT); 1513 high_memory = __va(last_valid_pfn << PAGE_SHIFT);
1551 1514
1552#ifdef CONFIG_DEBUG_BOOTMEM
1553 prom_printf("mem_init: Calling free_all_bootmem().\n");
1554#endif
1555
1556 /* We subtract one to account for the mem_map_zero page 1515 /* We subtract one to account for the mem_map_zero page
1557 * allocated below. 1516 * allocated below.
1558 */ 1517 */
diff --git a/arch/sparc64/prom/misc.c b/arch/sparc64/prom/misc.c
index bbec7522826c..47a877a15abd 100644
--- a/arch/sparc64/prom/misc.c
+++ b/arch/sparc64/prom/misc.c
@@ -55,9 +55,6 @@ void prom_feval(const char *fstring)
55 P1275_INOUT(1, 1), fstring); 55 P1275_INOUT(1, 1), fstring);
56} 56}
57 57
58/* We want to do this more nicely some day. */
59extern void (*prom_palette)(int);
60
61#ifdef CONFIG_SMP 58#ifdef CONFIG_SMP
62extern void smp_capture(void); 59extern void smp_capture(void);
63extern void smp_release(void); 60extern void smp_release(void);
@@ -72,9 +69,6 @@ void prom_cmdline(void)
72 69
73 local_irq_save(flags); 70 local_irq_save(flags);
74 71
75 if (prom_palette)
76 prom_palette(1);
77
78#ifdef CONFIG_SMP 72#ifdef CONFIG_SMP
79 smp_capture(); 73 smp_capture();
80#endif 74#endif
@@ -85,9 +79,6 @@ void prom_cmdline(void)
85 smp_release(); 79 smp_release();
86#endif 80#endif
87 81
88 if (prom_palette)
89 prom_palette(0);
90
91 local_irq_restore(flags); 82 local_irq_restore(flags);
92} 83}
93 84
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index 9311bfe4f2f7..7d035f0d3ae1 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -434,9 +434,9 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf)
434 434
435 error = user_path_walk(A(path),&nd); 435 error = user_path_walk(A(path),&nd);
436 if (!error) { 436 if (!error) {
437 struct inode * inode = nd.dentry->d_inode; 437 struct inode *inode = nd.path.dentry->d_inode;
438 error = report_statvfs(nd.mnt, inode, buf); 438 error = report_statvfs(nd.path.mnt, inode, buf);
439 path_release(&nd); 439 path_put(&nd.path);
440 } 440 }
441 return error; 441 return error;
442} 442}
@@ -464,9 +464,9 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf)
464 lock_kernel(); 464 lock_kernel();
465 error = user_path_walk(A(path), &nd); 465 error = user_path_walk(A(path), &nd);
466 if (!error) { 466 if (!error) {
467 struct inode * inode = nd.dentry->d_inode; 467 struct inode *inode = nd.path.dentry->d_inode;
468 error = report_statvfs64(nd.mnt, inode, buf); 468 error = report_statvfs64(nd.path.mnt, inode, buf);
469 path_release(&nd); 469 path_put(&nd.path);
470 } 470 }
471 unlock_kernel(); 471 unlock_kernel();
472 return error; 472 return error;
diff --git a/arch/um/defconfig b/arch/um/defconfig
index 59215bc264ef..6bd456f96f90 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -1,13 +1,22 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-rc3 3# Linux kernel version: 2.6.24
4# Fri Apr 28 09:31:20 2006 4# Thu Feb 7 11:48:55 2008
5# 5#
6CONFIG_DEFCONFIG_LIST="arch/$ARCH/defconfig"
6CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
7CONFIG_UML=y 8CONFIG_UML=y
8CONFIG_MMU=y 9CONFIG_MMU=y
10CONFIG_NO_IOMEM=y
11# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set
12CONFIG_LOCKDEP_SUPPORT=y
13# CONFIG_STACKTRACE_SUPPORT is not set
9CONFIG_GENERIC_CALIBRATE_DELAY=y 14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_BUG=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
10CONFIG_IRQ_RELEASE_METHOD=y 18CONFIG_IRQ_RELEASE_METHOD=y
19CONFIG_HZ=100
11 20
12# 21#
13# UML-specific options 22# UML-specific options
@@ -40,11 +49,13 @@ CONFIG_M686=y
40# CONFIG_MCYRIXIII is not set 49# CONFIG_MCYRIXIII is not set
41# CONFIG_MVIAC3_2 is not set 50# CONFIG_MVIAC3_2 is not set
42# CONFIG_MVIAC7 is not set 51# CONFIG_MVIAC7 is not set
52# CONFIG_MPSC is not set
53# CONFIG_MCORE2 is not set
54# CONFIG_GENERIC_CPU is not set
43# CONFIG_X86_GENERIC is not set 55# CONFIG_X86_GENERIC is not set
44CONFIG_X86_CMPXCHG=y 56CONFIG_X86_CMPXCHG=y
45CONFIG_X86_XADD=y
46CONFIG_X86_L1_CACHE_SHIFT=5 57CONFIG_X86_L1_CACHE_SHIFT=5
47CONFIG_RWSEM_XCHGADD_ALGORITHM=y 58CONFIG_X86_XADD=y
48CONFIG_X86_PPRO_FENCE=y 59CONFIG_X86_PPRO_FENCE=y
49CONFIG_X86_WP_WORKS_OK=y 60CONFIG_X86_WP_WORKS_OK=y
50CONFIG_X86_INVLPG=y 61CONFIG_X86_INVLPG=y
@@ -53,7 +64,12 @@ CONFIG_X86_POPAD_OK=y
53CONFIG_X86_GOOD_APIC=y 64CONFIG_X86_GOOD_APIC=y
54CONFIG_X86_USE_PPRO_CHECKSUM=y 65CONFIG_X86_USE_PPRO_CHECKSUM=y
55CONFIG_X86_TSC=y 66CONFIG_X86_TSC=y
67CONFIG_X86_CMOV=y
68CONFIG_X86_MINIMUM_CPU_FAMILY=4
69CONFIG_X86_DEBUGCTLMSR=y
56CONFIG_UML_X86=y 70CONFIG_UML_X86=y
71CONFIG_X86_32=y
72CONFIG_RWSEM_XCHGADD_ALGORITHM=y
57# CONFIG_64BIT is not set 73# CONFIG_64BIT is not set
58CONFIG_SEMAPHORE_SLEEPERS=y 74CONFIG_SEMAPHORE_SLEEPERS=y
59# CONFIG_3_LEVEL_PGTABLES is not set 75# CONFIG_3_LEVEL_PGTABLES is not set
@@ -67,13 +83,18 @@ CONFIG_FLATMEM_MANUAL=y
67CONFIG_FLATMEM=y 83CONFIG_FLATMEM=y
68CONFIG_FLAT_NODE_MEM_MAP=y 84CONFIG_FLAT_NODE_MEM_MAP=y
69# CONFIG_SPARSEMEM_STATIC is not set 85# CONFIG_SPARSEMEM_STATIC is not set
86# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
70CONFIG_SPLIT_PTLOCK_CPUS=4 87CONFIG_SPLIT_PTLOCK_CPUS=4
88# CONFIG_RESOURCES_64BIT is not set
89CONFIG_ZONE_DMA_FLAG=0
90CONFIG_VIRT_TO_BUS=y
71CONFIG_TICK_ONESHOT=y 91CONFIG_TICK_ONESHOT=y
72CONFIG_NO_HZ=y 92CONFIG_NO_HZ=y
73CONFIG_HIGH_RES_TIMERS=y 93CONFIG_HIGH_RES_TIMERS=y
94CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
74CONFIG_LD_SCRIPT_DYN=y 95CONFIG_LD_SCRIPT_DYN=y
75CONFIG_NET=y
76CONFIG_BINFMT_ELF=y 96CONFIG_BINFMT_ELF=y
97# CONFIG_BINFMT_AOUT is not set
77CONFIG_BINFMT_MISC=m 98CONFIG_BINFMT_MISC=m
78CONFIG_HOSTFS=y 99CONFIG_HOSTFS=y
79# CONFIG_HPPFS is not set 100# CONFIG_HPPFS is not set
@@ -83,31 +104,38 @@ CONFIG_MAGIC_SYSRQ=y
83CONFIG_KERNEL_STACK_ORDER=0 104CONFIG_KERNEL_STACK_ORDER=0
84 105
85# 106#
86# Code maturity level options 107# General setup
87# 108#
88CONFIG_EXPERIMENTAL=y 109CONFIG_EXPERIMENTAL=y
89CONFIG_BROKEN_ON_SMP=y 110CONFIG_BROKEN_ON_SMP=y
90CONFIG_INIT_ENV_ARG_LIMIT=32 111CONFIG_INIT_ENV_ARG_LIMIT=128
91
92#
93# General setup
94#
95CONFIG_LOCALVERSION="" 112CONFIG_LOCALVERSION=""
96CONFIG_LOCALVERSION_AUTO=y 113CONFIG_LOCALVERSION_AUTO=y
97CONFIG_SWAP=y 114CONFIG_SWAP=y
98CONFIG_SYSVIPC=y 115CONFIG_SYSVIPC=y
116CONFIG_SYSVIPC_SYSCTL=y
99CONFIG_POSIX_MQUEUE=y 117CONFIG_POSIX_MQUEUE=y
100CONFIG_BSD_PROCESS_ACCT=y 118CONFIG_BSD_PROCESS_ACCT=y
101# CONFIG_BSD_PROCESS_ACCT_V3 is not set 119# CONFIG_BSD_PROCESS_ACCT_V3 is not set
102CONFIG_SYSCTL=y 120# CONFIG_TASKSTATS is not set
121# CONFIG_USER_NS is not set
122# CONFIG_PID_NS is not set
103# CONFIG_AUDIT is not set 123# CONFIG_AUDIT is not set
104CONFIG_IKCONFIG=y 124CONFIG_IKCONFIG=y
105CONFIG_IKCONFIG_PROC=y 125CONFIG_IKCONFIG_PROC=y
126CONFIG_LOG_BUF_SHIFT=14
127# CONFIG_CGROUPS is not set
128CONFIG_FAIR_GROUP_SCHED=y
129CONFIG_FAIR_USER_SCHED=y
130# CONFIG_FAIR_CGROUP_SCHED is not set
131CONFIG_SYSFS_DEPRECATED=y
106# CONFIG_RELAY is not set 132# CONFIG_RELAY is not set
107CONFIG_INITRAMFS_SOURCE="" 133# CONFIG_BLK_DEV_INITRD is not set
108CONFIG_UID16=y
109CONFIG_CC_OPTIMIZE_FOR_SIZE=y 134CONFIG_CC_OPTIMIZE_FOR_SIZE=y
135CONFIG_SYSCTL=y
110# CONFIG_EMBEDDED is not set 136# CONFIG_EMBEDDED is not set
137CONFIG_UID16=y
138CONFIG_SYSCTL_SYSCALL=y
111CONFIG_KALLSYMS=y 139CONFIG_KALLSYMS=y
112# CONFIG_KALLSYMS_ALL is not set 140# CONFIG_KALLSYMS_ALL is not set
113CONFIG_KALLSYMS_EXTRA_PASS=y 141CONFIG_KALLSYMS_EXTRA_PASS=y
@@ -117,29 +145,36 @@ CONFIG_BUG=y
117CONFIG_ELF_CORE=y 145CONFIG_ELF_CORE=y
118CONFIG_BASE_FULL=y 146CONFIG_BASE_FULL=y
119CONFIG_FUTEX=y 147CONFIG_FUTEX=y
148CONFIG_ANON_INODES=y
120CONFIG_EPOLL=y 149CONFIG_EPOLL=y
150CONFIG_SIGNALFD=y
151CONFIG_TIMERFD=y
152CONFIG_EVENTFD=y
121CONFIG_SHMEM=y 153CONFIG_SHMEM=y
154CONFIG_VM_EVENT_COUNTERS=y
122CONFIG_SLAB=y 155CONFIG_SLAB=y
156# CONFIG_SLUB is not set
157# CONFIG_SLOB is not set
158# CONFIG_PROFILING is not set
159# CONFIG_MARKERS is not set
160# CONFIG_HAVE_OPROFILE is not set
161# CONFIG_HAVE_KPROBES is not set
162CONFIG_PROC_PAGE_MONITOR=y
163CONFIG_SLABINFO=y
164CONFIG_RT_MUTEXES=y
123# CONFIG_TINY_SHMEM is not set 165# CONFIG_TINY_SHMEM is not set
124CONFIG_BASE_SMALL=0 166CONFIG_BASE_SMALL=0
125# CONFIG_SLOB is not set
126
127#
128# Loadable module support
129#
130CONFIG_MODULES=y 167CONFIG_MODULES=y
131CONFIG_MODULE_UNLOAD=y 168CONFIG_MODULE_UNLOAD=y
132# CONFIG_MODULE_FORCE_UNLOAD is not set 169# CONFIG_MODULE_FORCE_UNLOAD is not set
133# CONFIG_MODVERSIONS is not set 170# CONFIG_MODVERSIONS is not set
134# CONFIG_MODULE_SRCVERSION_ALL is not set 171# CONFIG_MODULE_SRCVERSION_ALL is not set
135CONFIG_KMOD=y 172CONFIG_KMOD=y
136 173CONFIG_BLOCK=y
137#
138# Block layer
139#
140# CONFIG_LBD is not set 174# CONFIG_LBD is not set
141# CONFIG_BLK_DEV_IO_TRACE is not set 175# CONFIG_BLK_DEV_IO_TRACE is not set
142# CONFIG_LSF is not set 176# CONFIG_LSF is not set
177# CONFIG_BLK_DEV_BSG is not set
143 178
144# 179#
145# IO Schedulers 180# IO Schedulers
@@ -153,19 +188,16 @@ CONFIG_DEFAULT_AS=y
153# CONFIG_DEFAULT_CFQ is not set 188# CONFIG_DEFAULT_CFQ is not set
154# CONFIG_DEFAULT_NOOP is not set 189# CONFIG_DEFAULT_NOOP is not set
155CONFIG_DEFAULT_IOSCHED="anticipatory" 190CONFIG_DEFAULT_IOSCHED="anticipatory"
156 191CONFIG_CLASSIC_RCU=y
157# 192# CONFIG_PREEMPT_RCU is not set
158# Block devices 193CONFIG_BLK_DEV=y
159#
160CONFIG_BLK_DEV_UBD=y 194CONFIG_BLK_DEV_UBD=y
161# CONFIG_BLK_DEV_UBD_SYNC is not set 195# CONFIG_BLK_DEV_UBD_SYNC is not set
162CONFIG_BLK_DEV_COW_COMMON=y 196CONFIG_BLK_DEV_COW_COMMON=y
163# CONFIG_MMAPPER is not set
164CONFIG_BLK_DEV_LOOP=m 197CONFIG_BLK_DEV_LOOP=m
165# CONFIG_BLK_DEV_CRYPTOLOOP is not set 198# CONFIG_BLK_DEV_CRYPTOLOOP is not set
166CONFIG_BLK_DEV_NBD=m 199CONFIG_BLK_DEV_NBD=m
167# CONFIG_BLK_DEV_RAM is not set 200# CONFIG_BLK_DEV_RAM is not set
168# CONFIG_BLK_DEV_INITRD is not set
169# CONFIG_ATA_OVER_ETH is not set 201# CONFIG_ATA_OVER_ETH is not set
170 202
171# 203#
@@ -185,32 +217,43 @@ CONFIG_CON_CHAN="xterm"
185CONFIG_SSL_CHAN="pts" 217CONFIG_SSL_CHAN="pts"
186CONFIG_UNIX98_PTYS=y 218CONFIG_UNIX98_PTYS=y
187CONFIG_LEGACY_PTYS=y 219CONFIG_LEGACY_PTYS=y
220# CONFIG_RAW_DRIVER is not set
188CONFIG_LEGACY_PTY_COUNT=32 221CONFIG_LEGACY_PTY_COUNT=32
189# CONFIG_WATCHDOG is not set 222# CONFIG_WATCHDOG is not set
190CONFIG_UML_SOUND=m 223CONFIG_UML_SOUND=m
191CONFIG_SOUND=m 224CONFIG_SOUND=m
192CONFIG_HOSTAUDIO=m 225CONFIG_HOSTAUDIO=m
226# CONFIG_HW_RANDOM is not set
193CONFIG_UML_RANDOM=y 227CONFIG_UML_RANDOM=y
228# CONFIG_MMAPPER is not set
194 229
195# 230#
196# Generic Driver Options 231# Generic Driver Options
197# 232#
233CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
198CONFIG_STANDALONE=y 234CONFIG_STANDALONE=y
199CONFIG_PREVENT_FIRMWARE_BUILD=y 235CONFIG_PREVENT_FIRMWARE_BUILD=y
200# CONFIG_FW_LOADER is not set 236# CONFIG_FW_LOADER is not set
201# CONFIG_DEBUG_DRIVER is not set 237# CONFIG_DEBUG_DRIVER is not set
238# CONFIG_DEBUG_DEVRES is not set
239# CONFIG_SYS_HYPERVISOR is not set
202 240
203# 241#
204# Networking 242# Networking
205# 243#
244CONFIG_NET=y
206 245
207# 246#
208# Networking options 247# Networking options
209# 248#
210# CONFIG_NETDEBUG is not set
211CONFIG_PACKET=y 249CONFIG_PACKET=y
212CONFIG_PACKET_MMAP=y 250CONFIG_PACKET_MMAP=y
213CONFIG_UNIX=y 251CONFIG_UNIX=y
252CONFIG_XFRM=y
253# CONFIG_XFRM_USER is not set
254# CONFIG_XFRM_SUB_POLICY is not set
255# CONFIG_XFRM_MIGRATE is not set
256# CONFIG_XFRM_STATISTICS is not set
214# CONFIG_NET_KEY is not set 257# CONFIG_NET_KEY is not set
215CONFIG_INET=y 258CONFIG_INET=y
216# CONFIG_IP_MULTICAST is not set 259# CONFIG_IP_MULTICAST is not set
@@ -226,28 +269,23 @@ CONFIG_IP_FIB_HASH=y
226# CONFIG_INET_IPCOMP is not set 269# CONFIG_INET_IPCOMP is not set
227# CONFIG_INET_XFRM_TUNNEL is not set 270# CONFIG_INET_XFRM_TUNNEL is not set
228# CONFIG_INET_TUNNEL is not set 271# CONFIG_INET_TUNNEL is not set
272CONFIG_INET_XFRM_MODE_TRANSPORT=y
273CONFIG_INET_XFRM_MODE_TUNNEL=y
274CONFIG_INET_XFRM_MODE_BEET=y
275# CONFIG_INET_LRO is not set
229CONFIG_INET_DIAG=y 276CONFIG_INET_DIAG=y
230CONFIG_INET_TCP_DIAG=y 277CONFIG_INET_TCP_DIAG=y
231# CONFIG_TCP_CONG_ADVANCED is not set 278# CONFIG_TCP_CONG_ADVANCED is not set
232CONFIG_TCP_CONG_BIC=y 279CONFIG_TCP_CONG_CUBIC=y
280CONFIG_DEFAULT_TCP_CONG="cubic"
281# CONFIG_TCP_MD5SIG is not set
233# CONFIG_IPV6 is not set 282# CONFIG_IPV6 is not set
234# CONFIG_INET6_XFRM_TUNNEL is not set 283# CONFIG_INET6_XFRM_TUNNEL is not set
235# CONFIG_INET6_TUNNEL is not set 284# CONFIG_INET6_TUNNEL is not set
285# CONFIG_NETWORK_SECMARK is not set
236# CONFIG_NETFILTER is not set 286# CONFIG_NETFILTER is not set
237
238#
239# DCCP Configuration (EXPERIMENTAL)
240#
241# CONFIG_IP_DCCP is not set 287# CONFIG_IP_DCCP is not set
242
243#
244# SCTP Configuration (EXPERIMENTAL)
245#
246# CONFIG_IP_SCTP is not set 288# CONFIG_IP_SCTP is not set
247
248#
249# TIPC Configuration (EXPERIMENTAL)
250#
251# CONFIG_TIPC is not set 289# CONFIG_TIPC is not set
252# CONFIG_ATM is not set 290# CONFIG_ATM is not set
253# CONFIG_BRIDGE is not set 291# CONFIG_BRIDGE is not set
@@ -258,13 +296,8 @@ CONFIG_TCP_CONG_BIC=y
258# CONFIG_ATALK is not set 296# CONFIG_ATALK is not set
259# CONFIG_X25 is not set 297# CONFIG_X25 is not set
260# CONFIG_LAPB is not set 298# CONFIG_LAPB is not set
261# CONFIG_NET_DIVERT is not set
262# CONFIG_ECONET is not set 299# CONFIG_ECONET is not set
263# CONFIG_WAN_ROUTER is not set 300# CONFIG_WAN_ROUTER is not set
264
265#
266# QoS and/or fair queueing
267#
268# CONFIG_NET_SCHED is not set 301# CONFIG_NET_SCHED is not set
269 302
270# 303#
@@ -272,9 +305,20 @@ CONFIG_TCP_CONG_BIC=y
272# 305#
273# CONFIG_NET_PKTGEN is not set 306# CONFIG_NET_PKTGEN is not set
274# CONFIG_HAMRADIO is not set 307# CONFIG_HAMRADIO is not set
308# CONFIG_CAN is not set
275# CONFIG_IRDA is not set 309# CONFIG_IRDA is not set
276# CONFIG_BT is not set 310# CONFIG_BT is not set
311# CONFIG_AF_RXRPC is not set
312
313#
314# Wireless
315#
316# CONFIG_CFG80211 is not set
317# CONFIG_WIRELESS_EXT is not set
318# CONFIG_MAC80211 is not set
277# CONFIG_IEEE80211 is not set 319# CONFIG_IEEE80211 is not set
320# CONFIG_RFKILL is not set
321# CONFIG_NET_9P is not set
278 322
279# 323#
280# UML Network Devices 324# UML Network Devices
@@ -284,31 +328,24 @@ CONFIG_UML_NET_ETHERTAP=y
284CONFIG_UML_NET_TUNTAP=y 328CONFIG_UML_NET_TUNTAP=y
285CONFIG_UML_NET_SLIP=y 329CONFIG_UML_NET_SLIP=y
286CONFIG_UML_NET_DAEMON=y 330CONFIG_UML_NET_DAEMON=y
331# CONFIG_UML_NET_VDE is not set
287CONFIG_UML_NET_MCAST=y 332CONFIG_UML_NET_MCAST=y
288# CONFIG_UML_NET_PCAP is not set 333# CONFIG_UML_NET_PCAP is not set
289CONFIG_UML_NET_SLIRP=y 334CONFIG_UML_NET_SLIRP=y
290
291#
292# Network device support
293#
294CONFIG_NETDEVICES=y 335CONFIG_NETDEVICES=y
336# CONFIG_NETDEVICES_MULTIQUEUE is not set
295CONFIG_DUMMY=m 337CONFIG_DUMMY=m
296# CONFIG_BONDING is not set 338# CONFIG_BONDING is not set
339# CONFIG_MACVLAN is not set
297# CONFIG_EQUALIZER is not set 340# CONFIG_EQUALIZER is not set
298CONFIG_TUN=m 341CONFIG_TUN=m
342# CONFIG_VETH is not set
299 343
300# 344#
301# PHY device support 345# Wireless LAN
302#
303
304#
305# Wireless LAN (non-hamradio)
306#
307# CONFIG_NET_RADIO is not set
308
309#
310# Wan interfaces
311# 346#
347# CONFIG_WLAN_PRE80211 is not set
348# CONFIG_WLAN_80211 is not set
312# CONFIG_WAN is not set 349# CONFIG_WAN is not set
313CONFIG_PPP=m 350CONFIG_PPP=m
314# CONFIG_PPP_MULTILINK is not set 351# CONFIG_PPP_MULTILINK is not set
@@ -319,18 +356,15 @@ CONFIG_PPP=m
319# CONFIG_PPP_BSDCOMP is not set 356# CONFIG_PPP_BSDCOMP is not set
320# CONFIG_PPP_MPPE is not set 357# CONFIG_PPP_MPPE is not set
321# CONFIG_PPPOE is not set 358# CONFIG_PPPOE is not set
359# CONFIG_PPPOL2TP is not set
322CONFIG_SLIP=m 360CONFIG_SLIP=m
323# CONFIG_SLIP_COMPRESSED is not set 361# CONFIG_SLIP_COMPRESSED is not set
362CONFIG_SLHC=m
324# CONFIG_SLIP_SMART is not set 363# CONFIG_SLIP_SMART is not set
325# CONFIG_SLIP_MODE_SLIP6 is not set 364# CONFIG_SLIP_MODE_SLIP6 is not set
326# CONFIG_SHAPER is not set
327# CONFIG_NETCONSOLE is not set 365# CONFIG_NETCONSOLE is not set
328# CONFIG_NETPOLL is not set 366# CONFIG_NETPOLL is not set
329# CONFIG_NET_POLL_CONTROLLER is not set 367# CONFIG_NET_POLL_CONTROLLER is not set
330
331#
332# Connector - unified userspace <-> kernelspace linker
333#
334# CONFIG_CONNECTOR is not set 368# CONFIG_CONNECTOR is not set
335 369
336# 370#
@@ -341,8 +375,8 @@ CONFIG_EXT2_FS=y
341# CONFIG_EXT2_FS_XIP is not set 375# CONFIG_EXT2_FS_XIP is not set
342CONFIG_EXT3_FS=y 376CONFIG_EXT3_FS=y
343# CONFIG_EXT3_FS_XATTR is not set 377# CONFIG_EXT3_FS_XATTR is not set
378# CONFIG_EXT4DEV_FS is not set
344CONFIG_JBD=y 379CONFIG_JBD=y
345# CONFIG_JBD_DEBUG is not set
346CONFIG_REISERFS_FS=y 380CONFIG_REISERFS_FS=y
347# CONFIG_REISERFS_CHECK is not set 381# CONFIG_REISERFS_CHECK is not set
348# CONFIG_REISERFS_PROC_INFO is not set 382# CONFIG_REISERFS_PROC_INFO is not set
@@ -350,11 +384,15 @@ CONFIG_REISERFS_FS=y
350# CONFIG_JFS_FS is not set 384# CONFIG_JFS_FS is not set
351# CONFIG_FS_POSIX_ACL is not set 385# CONFIG_FS_POSIX_ACL is not set
352# CONFIG_XFS_FS is not set 386# CONFIG_XFS_FS is not set
387# CONFIG_GFS2_FS is not set
353# CONFIG_OCFS2_FS is not set 388# CONFIG_OCFS2_FS is not set
354# CONFIG_MINIX_FS is not set 389# CONFIG_MINIX_FS is not set
355# CONFIG_ROMFS_FS is not set 390# CONFIG_ROMFS_FS is not set
356CONFIG_INOTIFY=y 391CONFIG_INOTIFY=y
392CONFIG_INOTIFY_USER=y
357CONFIG_QUOTA=y 393CONFIG_QUOTA=y
394# CONFIG_QUOTA_NETLINK_INTERFACE is not set
395CONFIG_PRINT_QUOTA_WARNING=y
358# CONFIG_QFMT_V1 is not set 396# CONFIG_QFMT_V1 is not set
359# CONFIG_QFMT_V2 is not set 397# CONFIG_QFMT_V2 is not set
360CONFIG_QUOTACTL=y 398CONFIG_QUOTACTL=y
@@ -383,10 +421,11 @@ CONFIG_JOLIET=y
383# 421#
384CONFIG_PROC_FS=y 422CONFIG_PROC_FS=y
385CONFIG_PROC_KCORE=y 423CONFIG_PROC_KCORE=y
424CONFIG_PROC_SYSCTL=y
386CONFIG_SYSFS=y 425CONFIG_SYSFS=y
387CONFIG_TMPFS=y 426CONFIG_TMPFS=y
427# CONFIG_TMPFS_POSIX_ACL is not set
388# CONFIG_HUGETLB_PAGE is not set 428# CONFIG_HUGETLB_PAGE is not set
389CONFIG_RAMFS=y
390# CONFIG_CONFIGFS_FS is not set 429# CONFIG_CONFIGFS_FS is not set
391 430
392# 431#
@@ -405,10 +444,7 @@ CONFIG_RAMFS=y
405# CONFIG_QNX4FS_FS is not set 444# CONFIG_QNX4FS_FS is not set
406# CONFIG_SYSV_FS is not set 445# CONFIG_SYSV_FS is not set
407# CONFIG_UFS_FS is not set 446# CONFIG_UFS_FS is not set
408 447CONFIG_NETWORK_FILESYSTEMS=y
409#
410# Network File Systems
411#
412# CONFIG_NFS_FS is not set 448# CONFIG_NFS_FS is not set
413# CONFIG_NFSD is not set 449# CONFIG_NFSD is not set
414# CONFIG_SMB_FS is not set 450# CONFIG_SMB_FS is not set
@@ -416,17 +452,12 @@ CONFIG_RAMFS=y
416# CONFIG_NCP_FS is not set 452# CONFIG_NCP_FS is not set
417# CONFIG_CODA_FS is not set 453# CONFIG_CODA_FS is not set
418# CONFIG_AFS_FS is not set 454# CONFIG_AFS_FS is not set
419# CONFIG_9P_FS is not set
420 455
421# 456#
422# Partition Types 457# Partition Types
423# 458#
424# CONFIG_PARTITION_ADVANCED is not set 459# CONFIG_PARTITION_ADVANCED is not set
425CONFIG_MSDOS_PARTITION=y 460CONFIG_MSDOS_PARTITION=y
426
427#
428# Native Language Support
429#
430CONFIG_NLS=y 461CONFIG_NLS=y
431CONFIG_NLS_DEFAULT="iso8859-1" 462CONFIG_NLS_DEFAULT="iso8859-1"
432# CONFIG_NLS_CODEPAGE_437 is not set 463# CONFIG_NLS_CODEPAGE_437 is not set
@@ -467,33 +498,83 @@ CONFIG_NLS_DEFAULT="iso8859-1"
467# CONFIG_NLS_KOI8_R is not set 498# CONFIG_NLS_KOI8_R is not set
468# CONFIG_NLS_KOI8_U is not set 499# CONFIG_NLS_KOI8_U is not set
469# CONFIG_NLS_UTF8 is not set 500# CONFIG_NLS_UTF8 is not set
501# CONFIG_DLM is not set
470 502
471# 503#
472# Security options 504# Security options
473# 505#
474# CONFIG_KEYS is not set 506# CONFIG_KEYS is not set
475# CONFIG_SECURITY is not set 507# CONFIG_SECURITY is not set
476 508# CONFIG_SECURITY_FILE_CAPABILITIES is not set
477# 509CONFIG_CRYPTO=y
478# Cryptographic options 510# CONFIG_CRYPTO_SEQIV is not set
479# 511# CONFIG_CRYPTO_MANAGER is not set
480# CONFIG_CRYPTO is not set 512# CONFIG_CRYPTO_HMAC is not set
481 513# CONFIG_CRYPTO_XCBC is not set
482# 514# CONFIG_CRYPTO_NULL is not set
483# Hardware crypto devices 515# CONFIG_CRYPTO_MD4 is not set
484# 516# CONFIG_CRYPTO_MD5 is not set
517# CONFIG_CRYPTO_SHA1 is not set
518# CONFIG_CRYPTO_SHA256 is not set
519# CONFIG_CRYPTO_SHA512 is not set
520# CONFIG_CRYPTO_WP512 is not set
521# CONFIG_CRYPTO_TGR192 is not set
522# CONFIG_CRYPTO_GF128MUL is not set
523# CONFIG_CRYPTO_ECB is not set
524# CONFIG_CRYPTO_CBC is not set
525# CONFIG_CRYPTO_PCBC is not set
526# CONFIG_CRYPTO_LRW is not set
527# CONFIG_CRYPTO_XTS is not set
528# CONFIG_CRYPTO_CTR is not set
529# CONFIG_CRYPTO_GCM is not set
530# CONFIG_CRYPTO_CCM is not set
531# CONFIG_CRYPTO_CRYPTD is not set
532# CONFIG_CRYPTO_DES is not set
533# CONFIG_CRYPTO_FCRYPT is not set
534# CONFIG_CRYPTO_BLOWFISH is not set
535# CONFIG_CRYPTO_TWOFISH is not set
536# CONFIG_CRYPTO_TWOFISH_586 is not set
537# CONFIG_CRYPTO_SERPENT is not set
538# CONFIG_CRYPTO_AES is not set
539# CONFIG_CRYPTO_AES_586 is not set
540# CONFIG_CRYPTO_CAST5 is not set
541# CONFIG_CRYPTO_CAST6 is not set
542# CONFIG_CRYPTO_TEA is not set
543# CONFIG_CRYPTO_ARC4 is not set
544# CONFIG_CRYPTO_KHAZAD is not set
545# CONFIG_CRYPTO_ANUBIS is not set
546# CONFIG_CRYPTO_SEED is not set
547# CONFIG_CRYPTO_SALSA20 is not set
548# CONFIG_CRYPTO_SALSA20_586 is not set
549# CONFIG_CRYPTO_DEFLATE is not set
550# CONFIG_CRYPTO_MICHAEL_MIC is not set
551# CONFIG_CRYPTO_CRC32C is not set
552# CONFIG_CRYPTO_CAMELLIA is not set
553# CONFIG_CRYPTO_TEST is not set
554# CONFIG_CRYPTO_AUTHENC is not set
555# CONFIG_CRYPTO_LZO is not set
556CONFIG_CRYPTO_HW=y
485 557
486# 558#
487# Library routines 559# Library routines
488# 560#
561CONFIG_BITREVERSE=m
489# CONFIG_CRC_CCITT is not set 562# CONFIG_CRC_CCITT is not set
490# CONFIG_CRC16 is not set 563# CONFIG_CRC16 is not set
564# CONFIG_CRC_ITU_T is not set
491CONFIG_CRC32=m 565CONFIG_CRC32=m
566# CONFIG_CRC7 is not set
492# CONFIG_LIBCRC32C is not set 567# CONFIG_LIBCRC32C is not set
568CONFIG_PLIST=y
569CONFIG_HAS_DMA=y
493 570
494# 571#
495# Multi-device support (RAID and LVM) 572# SCSI device support
496# 573#
574# CONFIG_RAID_ATTRS is not set
575# CONFIG_SCSI is not set
576# CONFIG_SCSI_DMA is not set
577# CONFIG_SCSI_NETLINK is not set
497# CONFIG_MD is not set 578# CONFIG_MD is not set
498# CONFIG_INPUT is not set 579# CONFIG_INPUT is not set
499 580
@@ -501,23 +582,36 @@ CONFIG_CRC32=m
501# Kernel hacking 582# Kernel hacking
502# 583#
503# CONFIG_PRINTK_TIME is not set 584# CONFIG_PRINTK_TIME is not set
585CONFIG_ENABLE_WARN_DEPRECATED=y
586CONFIG_ENABLE_MUST_CHECK=y
587# CONFIG_UNUSED_SYMBOLS is not set
588# CONFIG_DEBUG_FS is not set
504CONFIG_DEBUG_KERNEL=y 589CONFIG_DEBUG_KERNEL=y
505CONFIG_LOG_BUF_SHIFT=14 590# CONFIG_DEBUG_SHIRQ is not set
506CONFIG_DETECT_SOFTLOCKUP=y 591CONFIG_DETECT_SOFTLOCKUP=y
592CONFIG_SCHED_DEBUG=y
507# CONFIG_SCHEDSTATS is not set 593# CONFIG_SCHEDSTATS is not set
594# CONFIG_TIMER_STATS is not set
508# CONFIG_DEBUG_SLAB is not set 595# CONFIG_DEBUG_SLAB is not set
509# CONFIG_DEBUG_SLAB_LEAK is not set 596# CONFIG_DEBUG_RT_MUTEXES is not set
510# CONFIG_DEBUG_MUTEXES is not set 597# CONFIG_RT_MUTEX_TESTER is not set
511# CONFIG_DEBUG_SPINLOCK is not set 598# CONFIG_DEBUG_SPINLOCK is not set
599# CONFIG_DEBUG_MUTEXES is not set
512# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 600# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
601# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
513# CONFIG_DEBUG_KOBJECT is not set 602# CONFIG_DEBUG_KOBJECT is not set
603CONFIG_DEBUG_BUGVERBOSE=y
514CONFIG_DEBUG_INFO=y 604CONFIG_DEBUG_INFO=y
515# CONFIG_DEBUG_FS is not set
516# CONFIG_DEBUG_VM is not set 605# CONFIG_DEBUG_VM is not set
606# CONFIG_DEBUG_LIST is not set
607# CONFIG_DEBUG_SG is not set
517CONFIG_FRAME_POINTER=y 608CONFIG_FRAME_POINTER=y
518# CONFIG_UNWIND_INFO is not set
519CONFIG_FORCED_INLINING=y 609CONFIG_FORCED_INLINING=y
610# CONFIG_BOOT_PRINTK_DELAY is not set
520# CONFIG_RCU_TORTURE_TEST is not set 611# CONFIG_RCU_TORTURE_TEST is not set
612# CONFIG_BACKTRACE_SELF_TEST is not set
613# CONFIG_FAULT_INJECTION is not set
614# CONFIG_SAMPLES is not set
521# CONFIG_GPROF is not set 615# CONFIG_GPROF is not set
522# CONFIG_GCOV is not set 616# CONFIG_GCOV is not set
523# CONFIG_DEBUG_STACK_USAGE is not set 617# CONFIG_DEBUG_STACK_USAGE is not set
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c
index 448ba59207a1..b56f8e0196a9 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
@@ -79,14 +79,14 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
79 n = read(in_fds[0], &c, sizeof(c)); 79 n = read(in_fds[0], &c, sizeof(c));
80 if (n == 0) { 80 if (n == 0) {
81 printk("harddog_open - EOF on watchdog pipe\n"); 81 printk("harddog_open - EOF on watchdog pipe\n");
82 helper_wait(pid, 1, NULL); 82 helper_wait(pid);
83 err = -EIO; 83 err = -EIO;
84 goto out_close_out; 84 goto out_close_out;
85 } 85 }
86 else if (n < 0) { 86 else if (n < 0) {
87 printk("harddog_open - read of watchdog pipe failed, " 87 printk("harddog_open - read of watchdog pipe failed, "
88 "err = %d\n", errno); 88 "err = %d\n", errno);
89 helper_wait(pid, 1, NULL); 89 helper_wait(pid);
90 err = n; 90 err = n;
91 goto out_close_out; 91 goto out_close_out;
92 } 92 }
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index ebb265c07e4d..19d579d74d27 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -145,8 +145,8 @@ void mconsole_proc(struct mc_request *req)
145 } 145 }
146 up_write(&super->s_umount); 146 up_write(&super->s_umount);
147 147
148 nd.dentry = super->s_root; 148 nd.path.dentry = super->s_root;
149 nd.mnt = NULL; 149 nd.path.mnt = NULL;
150 nd.flags = O_RDONLY + 1; 150 nd.flags = O_RDONLY + 1;
151 nd.last_type = LAST_ROOT; 151 nd.last_type = LAST_ROOT;
152 152
@@ -159,7 +159,7 @@ void mconsole_proc(struct mc_request *req)
159 goto out_kill; 159 goto out_kill;
160 } 160 }
161 161
162 file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); 162 file = dentry_open(nd.path.dentry, nd.path.mnt, O_RDONLY);
163 if (IS_ERR(file)) { 163 if (IS_ERR(file)) {
164 mconsole_reply(req, "Failed to open file", 1, 0); 164 mconsole_reply(req, "Failed to open file", 1, 0);
165 goto out_kill; 165 goto out_kill;
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h
index 9ea1ae3c8f46..b0b4589e0ebc 100644
--- a/arch/um/include/registers.h
+++ b/arch/um/include/registers.h
@@ -18,5 +18,7 @@ extern int restore_registers(int pid, struct uml_pt_regs *regs);
18extern int init_registers(int pid); 18extern int init_registers(int pid);
19extern void get_safe_registers(unsigned long *regs); 19extern void get_safe_registers(unsigned long *regs);
20extern unsigned long get_thread_reg(int reg, jmp_buf *buf); 20extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
21extern int get_fp_registers(int pid, unsigned long *regs);
22extern int put_fp_registers(int pid, unsigned long *regs);
21 23
22#endif 24#endif
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h
index 899aa4b2a78d..75650723c38f 100644
--- a/arch/um/include/sysdep-i386/ptrace_user.h
+++ b/arch/um/include/sysdep-i386/ptrace_user.h
@@ -9,6 +9,7 @@
9#include <sys/ptrace.h> 9#include <sys/ptrace.h>
10#include <linux/ptrace.h> 10#include <linux/ptrace.h>
11#include <asm/ptrace.h> 11#include <asm/ptrace.h>
12#include "user_constants.h"
12 13
13#define PT_OFFSET(r) ((r) * sizeof(long)) 14#define PT_OFFSET(r) ((r) * sizeof(long))
14 15
@@ -40,6 +41,8 @@
40#define PT_SP_OFFSET PT_OFFSET(UESP) 41#define PT_SP_OFFSET PT_OFFSET(UESP)
41#define PT_SP(regs) ((regs)[UESP]) 42#define PT_SP(regs) ((regs)[UESP])
42 43
44#define FP_SIZE ((HOST_XFP_SIZE > HOST_FP_SIZE) ? HOST_XFP_SIZE : HOST_FP_SIZE)
45
43#ifndef FRAME_SIZE 46#ifndef FRAME_SIZE
44#define FRAME_SIZE (17) 47#define FRAME_SIZE (17)
45#endif 48#endif
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/include/sysdep-x86_64/ptrace_user.h
index 4cd61a852fab..45c0bd881cb3 100644
--- a/arch/um/include/sysdep-x86_64/ptrace_user.h
+++ b/arch/um/include/sysdep-x86_64/ptrace_user.h
@@ -12,6 +12,7 @@
12#include <linux/ptrace.h> 12#include <linux/ptrace.h>
13#include <asm/ptrace.h> 13#include <asm/ptrace.h>
14#undef __FRAME_OFFSETS 14#undef __FRAME_OFFSETS
15#include "user_constants.h"
15 16
16#define PT_INDEX(off) ((off) / sizeof(unsigned long)) 17#define PT_INDEX(off) ((off) / sizeof(unsigned long))
17 18
@@ -69,6 +70,8 @@
69#define REGS_IP_INDEX PT_INDEX(RIP) 70#define REGS_IP_INDEX PT_INDEX(RIP)
70#define REGS_SP_INDEX PT_INDEX(RSP) 71#define REGS_SP_INDEX PT_INDEX(RSP)
71 72
73#define FP_SIZE (HOST_FP_SIZE)
74
72#endif 75#endif
73 76
74/* 77/*
diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c
index fa015565001b..d386c75c88eb 100644
--- a/arch/um/kernel/initrd.c
+++ b/arch/um/kernel/initrd.c
@@ -32,7 +32,7 @@ static int __init read_initrd(void)
32 * ask for no memory. 32 * ask for no memory.
33 */ 33 */
34 if (size == 0) { 34 if (size == 0) {
35 printk(KERN_ERR "\"%\" is a zero-size initrd\n"); 35 printk(KERN_ERR "\"%s\" is a zero-size initrd\n", initrd);
36 return 0; 36 return 0;
37 } 37 }
38 38
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 2627ce82e918..2eea1ff235e6 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -299,7 +299,7 @@ void show_mem(void)
299{ 299{
300 int pfn, total = 0, reserved = 0; 300 int pfn, total = 0, reserved = 0;
301 int shared = 0, cached = 0; 301 int shared = 0, cached = 0;
302 int highmem = 0; 302 int high_mem = 0;
303 struct page *page; 303 struct page *page;
304 304
305 printk(KERN_INFO "Mem-info:\n"); 305 printk(KERN_INFO "Mem-info:\n");
@@ -311,7 +311,7 @@ void show_mem(void)
311 page = pfn_to_page(pfn); 311 page = pfn_to_page(pfn);
312 total++; 312 total++;
313 if (PageHighMem(page)) 313 if (PageHighMem(page))
314 highmem++; 314 high_mem++;
315 if (PageReserved(page)) 315 if (PageReserved(page))
316 reserved++; 316 reserved++;
317 else if (PageSwapCache(page)) 317 else if (PageSwapCache(page))
@@ -320,7 +320,7 @@ void show_mem(void)
320 shared += page_count(page) - 1; 320 shared += page_count(page) - 1;
321 } 321 }
322 printk(KERN_INFO "%d pages of RAM\n", total); 322 printk(KERN_INFO "%d pages of RAM\n", total);
323 printk(KERN_INFO "%d pages of HIGHMEM\n", highmem); 323 printk(KERN_INFO "%d pages of HIGHMEM\n", high_mem);
324 printk(KERN_INFO "%d reserved pages\n", reserved); 324 printk(KERN_INFO "%d reserved pages\n", reserved);
325 printk(KERN_INFO "%d pages shared\n", shared); 325 printk(KERN_INFO "%d pages shared\n", shared);
326 printk(KERN_INFO "%d pages swap cached\n", cached); 326 printk(KERN_INFO "%d pages swap cached\n", cached);
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index b14829469fae..1e8cba6550a9 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -115,6 +115,14 @@ void get_skas_faultinfo(int pid, struct faultinfo * fi)
115 sizeof(struct ptrace_faultinfo)); 115 sizeof(struct ptrace_faultinfo));
116 } 116 }
117 else { 117 else {
118 unsigned long fpregs[FP_SIZE];
119
120 err = get_fp_registers(pid, fpregs);
121 if (err < 0) {
122 printk(UM_KERN_ERR "save_fp_registers returned %d\n",
123 err);
124 fatal_sigsegv();
125 }
118 err = ptrace(PTRACE_CONT, pid, 0, SIGSEGV); 126 err = ptrace(PTRACE_CONT, pid, 0, SIGSEGV);
119 if (err) { 127 if (err) {
120 printk(UM_KERN_ERR "Failed to continue stub, pid = %d, " 128 printk(UM_KERN_ERR "Failed to continue stub, pid = %d, "
@@ -128,6 +136,13 @@ void get_skas_faultinfo(int pid, struct faultinfo * fi)
128 * the stub stack page. We just have to copy it. 136 * the stub stack page. We just have to copy it.
129 */ 137 */
130 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi)); 138 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi));
139
140 err = put_fp_registers(pid, fpregs);
141 if (err < 0) {
142 printk(UM_KERN_ERR "put_fp_registers returned %d\n",
143 err);
144 fatal_sigsegv();
145 }
131 } 146 }
132} 147}
133 148
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index f74d853a0ee0..b613473b3ec1 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -56,6 +56,22 @@ unsigned long get_thread_reg(int reg, jmp_buf *buf)
56 56
57int have_fpx_regs = 1; 57int have_fpx_regs = 1;
58 58
59int get_fp_registers(int pid, unsigned long *regs)
60{
61 if (have_fpx_regs)
62 return save_fpx_registers(pid, regs);
63 else
64 return save_fp_registers(pid, regs);
65}
66
67int put_fp_registers(int pid, unsigned long *regs)
68{
69 if (have_fpx_regs)
70 return restore_fpx_registers(pid, regs);
71 else
72 return restore_fp_registers(pid, regs);
73}
74
59void arch_init_registers(int pid) 75void arch_init_registers(int pid)
60{ 76{
61 unsigned long fpx_regs[HOST_XFP_SIZE]; 77 unsigned long fpx_regs[HOST_XFP_SIZE];
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index a375853337a7..594d97ad02b3 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -40,3 +40,13 @@ unsigned long get_thread_reg(int reg, jmp_buf *buf)
40 return 0; 40 return 0;
41 } 41 }
42} 42}
43
44int get_fp_registers(int pid, unsigned long *regs)
45{
46 return save_fp_registers(pid, regs);
47}
48
49int put_fp_registers(int pid, unsigned long *regs)
50{
51 return restore_fp_registers(pid, regs);
52}
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 514241526a1b..39bd32bf84f0 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -17,36 +17,9 @@
17 17
18void foo(void) 18void foo(void)
19{ 19{
20 OFFSET(HOST_SC_IP, sigcontext, eip);
21 OFFSET(HOST_SC_SP, sigcontext, esp);
22 OFFSET(HOST_SC_FS, sigcontext, fs);
23 OFFSET(HOST_SC_GS, sigcontext, gs);
24 OFFSET(HOST_SC_DS, sigcontext, ds);
25 OFFSET(HOST_SC_ES, sigcontext, es);
26 OFFSET(HOST_SC_SS, sigcontext, ss);
27 OFFSET(HOST_SC_CS, sigcontext, cs);
28 OFFSET(HOST_SC_EFLAGS, sigcontext, eflags);
29 OFFSET(HOST_SC_EAX, sigcontext, eax);
30 OFFSET(HOST_SC_EBX, sigcontext, ebx);
31 OFFSET(HOST_SC_ECX, sigcontext, ecx);
32 OFFSET(HOST_SC_EDX, sigcontext, edx);
33 OFFSET(HOST_SC_EDI, sigcontext, edi);
34 OFFSET(HOST_SC_ESI, sigcontext, esi);
35 OFFSET(HOST_SC_EBP, sigcontext, ebp);
36 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); 20 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
37 OFFSET(HOST_SC_ERR, sigcontext, err); 21 OFFSET(HOST_SC_ERR, sigcontext, err);
38 OFFSET(HOST_SC_CR2, sigcontext, cr2); 22 OFFSET(HOST_SC_CR2, sigcontext, cr2);
39 OFFSET(HOST_SC_FPSTATE, sigcontext, fpstate);
40 OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask);
41 OFFSET(HOST_SC_FP_CW, _fpstate, cw);
42 OFFSET(HOST_SC_FP_SW, _fpstate, sw);
43 OFFSET(HOST_SC_FP_TAG, _fpstate, tag);
44 OFFSET(HOST_SC_FP_IPOFF, _fpstate, ipoff);
45 OFFSET(HOST_SC_FP_CSSEL, _fpstate, cssel);
46 OFFSET(HOST_SC_FP_DATAOFF, _fpstate, dataoff);
47 OFFSET(HOST_SC_FP_DATASEL, _fpstate, datasel);
48 OFFSET(HOST_SC_FP_ST, _fpstate, _st);
49 OFFSET(HOST_SC_FXSR_ENV, _fpstate, _fxsr_env);
50 23
51 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct)); 24 DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct));
52 DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fpxregs_struct)); 25 DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fpxregs_struct));
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index f1ef2a8dfbc6..2f3443c6e859 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -19,37 +19,9 @@
19 19
20void foo(void) 20void foo(void)
21{ 21{
22 OFFSET(HOST_SC_RBX, sigcontext, rbx);
23 OFFSET(HOST_SC_RCX, sigcontext, rcx);
24 OFFSET(HOST_SC_RDX, sigcontext, rdx);
25 OFFSET(HOST_SC_RSI, sigcontext, rsi);
26 OFFSET(HOST_SC_RDI, sigcontext, rdi);
27 OFFSET(HOST_SC_RBP, sigcontext, rbp);
28 OFFSET(HOST_SC_RAX, sigcontext, rax);
29 OFFSET(HOST_SC_R8, sigcontext, r8);
30 OFFSET(HOST_SC_R9, sigcontext, r9);
31 OFFSET(HOST_SC_R10, sigcontext, r10);
32 OFFSET(HOST_SC_R11, sigcontext, r11);
33 OFFSET(HOST_SC_R12, sigcontext, r12);
34 OFFSET(HOST_SC_R13, sigcontext, r13);
35 OFFSET(HOST_SC_R14, sigcontext, r14);
36 OFFSET(HOST_SC_R15, sigcontext, r15);
37 OFFSET(HOST_SC_IP, sigcontext, rip);
38 OFFSET(HOST_SC_SP, sigcontext, rsp);
39 OFFSET(HOST_SC_CR2, sigcontext, cr2); 22 OFFSET(HOST_SC_CR2, sigcontext, cr2);
40 OFFSET(HOST_SC_ERR, sigcontext, err); 23 OFFSET(HOST_SC_ERR, sigcontext, err);
41 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); 24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
42 OFFSET(HOST_SC_CS, sigcontext, cs);
43 OFFSET(HOST_SC_FS, sigcontext, fs);
44 OFFSET(HOST_SC_GS, sigcontext, gs);
45 OFFSET(HOST_SC_EFLAGS, sigcontext, eflags);
46 OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask);
47#if 0
48 OFFSET(HOST_SC_ORIG_RAX, sigcontext, orig_rax);
49 OFFSET(HOST_SC_DS, sigcontext, ds);
50 OFFSET(HOST_SC_ES, sigcontext, es);
51 OFFSET(HOST_SC_SS, sigcontext, ss);
52#endif
53 25
54 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); 26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
55 DEFINE(HOST_XFP_SIZE, 0); 27 DEFINE(HOST_XFP_SIZE, 0);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index aaed1a3b92d6..4a88cf7695b4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -21,6 +21,8 @@ config X86
21 select HAVE_IDE 21 select HAVE_IDE
22 select HAVE_OPROFILE 22 select HAVE_OPROFILE
23 select HAVE_KPROBES 23 select HAVE_KPROBES
24 select HAVE_KVM
25
24 26
25config GENERIC_LOCKBREAK 27config GENERIC_LOCKBREAK
26 def_bool n 28 def_bool n
@@ -119,8 +121,6 @@ config ARCH_HAS_CPU_RELAX
119config HAVE_SETUP_PER_CPU_AREA 121config HAVE_SETUP_PER_CPU_AREA
120 def_bool X86_64 122 def_bool X86_64
121 123
122select HAVE_KVM
123
124config ARCH_HIBERNATION_POSSIBLE 124config ARCH_HIBERNATION_POSSIBLE
125 def_bool y 125 def_bool y
126 depends on !SMP || !X86_VOYAGER 126 depends on !SMP || !X86_VOYAGER
@@ -1054,7 +1054,7 @@ config SECCOMP
1054 1054
1055config CC_STACKPROTECTOR 1055config CC_STACKPROTECTOR
1056 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)" 1056 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
1057 depends on X86_64 && EXPERIMENTAL 1057 depends on X86_64 && EXPERIMENTAL && BROKEN
1058 help 1058 help
1059 This option turns on the -fstack-protector GCC feature. This 1059 This option turns on the -fstack-protector GCC feature. This
1060 feature puts, at the beginning of critical functions, a canary 1060 feature puts, at the beginning of critical functions, a canary
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 864affc9a7b0..702eb39901ca 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -156,7 +156,7 @@ config IO_DELAY_TYPE_NONE
156 156
157choice 157choice
158 prompt "IO delay type" 158 prompt "IO delay type"
159 default IO_DELAY_0XED 159 default IO_DELAY_0X80
160 160
161config IO_DELAY_0X80 161config IO_DELAY_0X80
162 bool "port 0x80 based port-IO delay [recommended]" 162 bool "port 0x80 based port-IO delay [recommended]"
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 204af43535c5..f1e739a43d41 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -229,7 +229,7 @@ zdisk bzdisk: vmlinux
229fdimage fdimage144 fdimage288 isoimage: vmlinux 229fdimage fdimage144 fdimage288 isoimage: vmlinux
230 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ 230 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
231 231
232install: vdso_install 232install:
233 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install 233 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
234 234
235PHONY += vdso_install 235PHONY += vdso_install
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 76ec0f8f138a..4eb5ce841106 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -6,7 +6,15 @@ extra-y := head_$(BITS).o init_task.o vmlinux.lds
6extra-$(CONFIG_X86_64) += head64.o 6extra-$(CONFIG_X86_64) += head64.o
7 7
8CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) 8CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
9CFLAGS_vsyscall_64.o := $(PROFILING) -g0 9
10#
11# vsyscalls (which work on the user stack) should have
12# no stack-protector checks:
13#
14nostackp := $(call cc-option, -fno-stack-protector)
15CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp)
16CFLAGS_hpet.o := $(nostackp)
17CFLAGS_tsc_64.o := $(nostackp)
10 18
11obj-y := process_$(BITS).o signal_$(BITS).o entry_$(BITS).o 19obj-y := process_$(BITS).o signal_$(BITS).o entry_$(BITS).o
12obj-y += traps_$(BITS).o irq_$(BITS).o 20obj-y += traps_$(BITS).o irq_$(BITS).o
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 680b7300a489..2cdc9de9371d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -72,7 +72,8 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return
72#define PREFIX "ACPI: " 72#define PREFIX "ACPI: "
73 73
74int acpi_noirq; /* skip ACPI IRQ initialization */ 74int acpi_noirq; /* skip ACPI IRQ initialization */
75int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */ 75int acpi_pci_disabled; /* skip ACPI PCI scan and IRQ initialization */
76EXPORT_SYMBOL(acpi_pci_disabled);
76int acpi_ht __initdata = 1; /* enable HT */ 77int acpi_ht __initdata = 1; /* enable HT */
77 78
78int acpi_lapic; 79int acpi_lapic;
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 10b67170b133..8ca3557a6d59 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -126,6 +126,8 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
126 printk(KERN_DEBUG "Monitor-Mwait will be used to enter C-%d " 126 printk(KERN_DEBUG "Monitor-Mwait will be used to enter C-%d "
127 "state\n", cx->type); 127 "state\n", cx->type);
128 } 128 }
129 snprintf(cx->desc, ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
130 cx->address);
129 131
130out: 132out:
131 set_cpus_allowed(current, saved_mask); 133 set_cpus_allowed(current, saved_mask);
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index afd84463b712..a33d53017997 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -20,10 +20,8 @@
20 20
21#include <xen/interface/xen.h> 21#include <xen/interface/xen.h>
22 22
23#ifdef CONFIG_LGUEST_GUEST
24#include <linux/lguest.h> 23#include <linux/lguest.h>
25#include "../../../drivers/lguest/lg.h" 24#include "../../../drivers/lguest/lg.h"
26#endif
27 25
28#define DEFINE(sym, val) \ 26#define DEFINE(sym, val) \
29 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 27 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -134,6 +132,10 @@ void foo(void)
134 BLANK(); 132 BLANK();
135 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled); 133 OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
136 OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir); 134 OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
135#endif
136
137#ifdef CONFIG_LGUEST
138 BLANK();
137 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc); 139 OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
138 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc); 140 OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
139 OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3); 141 OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 9b95edcfc6ae..027e5c003b16 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -25,14 +25,6 @@ static int __init no_halt(char *s)
25 25
26__setup("no-hlt", no_halt); 26__setup("no-hlt", no_halt);
27 27
28static int __init mca_pentium(char *s)
29{
30 mca_pentium_flag = 1;
31 return 1;
32}
33
34__setup("mca-pentium", mca_pentium);
35
36static int __init no_387(char *s) 28static int __init no_387(char *s)
37{ 29{
38 boot_cpu_data.hard_math = 0; 30 boot_cpu_data.hard_math = 0;
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index 32dd62b36ff7..759e02bec070 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -54,7 +54,7 @@ EXPORT_SYMBOL(efi);
54 54
55struct efi_memory_map memmap; 55struct efi_memory_map memmap;
56 56
57struct efi efi_phys __initdata; 57static struct efi efi_phys __initdata;
58static efi_system_table_t efi_systab __initdata; 58static efi_system_table_t efi_systab __initdata;
59 59
60static int __init setup_noefi(char *arg) 60static int __init setup_noefi(char *arg)
@@ -384,9 +384,6 @@ static void __init runtime_code_page_mkexec(void)
384 efi_memory_desc_t *md; 384 efi_memory_desc_t *md;
385 void *p; 385 void *p;
386 386
387 if (!(__supported_pte_mask & _PAGE_NX))
388 return;
389
390 /* Make EFI runtime service code area executable */ 387 /* Make EFI runtime service code area executable */
391 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 388 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
392 md = p; 389 md = p;
@@ -394,7 +391,7 @@ static void __init runtime_code_page_mkexec(void)
394 if (md->type != EFI_RUNTIME_SERVICES_CODE) 391 if (md->type != EFI_RUNTIME_SERVICES_CODE)
395 continue; 392 continue;
396 393
397 set_memory_x(md->virt_addr, md->num_pages << EFI_PAGE_SHIFT); 394 set_memory_x(md->virt_addr, md->num_pages);
398 } 395 }
399} 396}
400 397
@@ -428,9 +425,6 @@ void __init efi_enter_virtual_mode(void)
428 else 425 else
429 va = efi_ioremap(md->phys_addr, size); 426 va = efi_ioremap(md->phys_addr, size);
430 427
431 if (md->attribute & EFI_MEMORY_WB)
432 set_memory_uc(md->virt_addr, size);
433
434 md->virt_addr = (u64) (unsigned long) va; 428 md->virt_addr = (u64) (unsigned long) va;
435 429
436 if (!va) { 430 if (!va) {
@@ -439,6 +433,9 @@ void __init efi_enter_virtual_mode(void)
439 continue; 433 continue;
440 } 434 }
441 435
436 if (!(md->attribute & EFI_MEMORY_WB))
437 set_memory_uc(md->virt_addr, md->num_pages);
438
442 systab = (u64) (unsigned long) efi_phys.systab; 439 systab = (u64) (unsigned long) efi_phys.systab;
443 if (md->phys_addr <= systab && systab < end) { 440 if (md->phys_addr <= systab && systab < end) {
444 systab += md->virt_addr - md->phys_addr; 441 systab += md->virt_addr - md->phys_addr;
@@ -476,7 +473,8 @@ void __init efi_enter_virtual_mode(void)
476 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count; 473 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count;
477 efi.reset_system = virt_efi_reset_system; 474 efi.reset_system = virt_efi_reset_system;
478 efi.set_virtual_address_map = virt_efi_set_virtual_address_map; 475 efi.set_virtual_address_map = virt_efi_set_virtual_address_map;
479 runtime_code_page_mkexec(); 476 if (__supported_pte_mask & _PAGE_NX)
477 runtime_code_page_mkexec();
480 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); 478 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
481 memmap.map = NULL; 479 memmap.map = NULL;
482} 480}
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c
index cb91f985b4a1..5d23d85624d4 100644
--- a/arch/x86/kernel/efi_32.c
+++ b/arch/x86/kernel/efi_32.c
@@ -28,6 +28,7 @@
28#include <asm/page.h> 28#include <asm/page.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/tlbflush.h> 30#include <asm/tlbflush.h>
31#include <asm/efi.h>
31 32
32/* 33/*
33 * To make EFI call EFI runtime service in physical addressing mode we need 34 * To make EFI call EFI runtime service in physical addressing mode we need
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c
index 09d5c2330934..d143a1e76b30 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/kernel/efi_64.c
@@ -35,6 +35,7 @@
35#include <asm/tlbflush.h> 35#include <asm/tlbflush.h>
36#include <asm/proto.h> 36#include <asm/proto.h>
37#include <asm/efi.h> 37#include <asm/efi.h>
38#include <asm/cacheflush.h>
38 39
39static pgd_t save_pgd __initdata; 40static pgd_t save_pgd __initdata;
40static unsigned long efi_flags __initdata; 41static unsigned long efi_flags __initdata;
@@ -43,22 +44,15 @@ static void __init early_mapping_set_exec(unsigned long start,
43 unsigned long end, 44 unsigned long end,
44 int executable) 45 int executable)
45{ 46{
46 pte_t *kpte; 47 unsigned long num_pages;
47 unsigned int level; 48
48 49 start &= PMD_MASK;
49 while (start < end) { 50 end = (end + PMD_SIZE - 1) & PMD_MASK;
50 kpte = lookup_address((unsigned long)__va(start), &level); 51 num_pages = (end - start) >> PAGE_SHIFT;
51 BUG_ON(!kpte); 52 if (executable)
52 if (executable) 53 set_memory_x((unsigned long)__va(start), num_pages);
53 set_pte(kpte, pte_mkexec(*kpte)); 54 else
54 else 55 set_memory_nx((unsigned long)__va(start), num_pages);
55 set_pte(kpte, __pte((pte_val(*kpte) | _PAGE_NX) & \
56 __supported_pte_mask));
57 if (level == PG_LEVEL_4K)
58 start = (start + PAGE_SIZE) & PAGE_MASK;
59 else
60 start = (start + PMD_SIZE) & PMD_MASK;
61 }
62} 56}
63 57
64static void __init early_runtime_code_mapping_set_exec(int executable) 58static void __init early_runtime_code_mapping_set_exec(int executable)
@@ -74,7 +68,7 @@ static void __init early_runtime_code_mapping_set_exec(int executable)
74 md = p; 68 md = p;
75 if (md->type == EFI_RUNTIME_SERVICES_CODE) { 69 if (md->type == EFI_RUNTIME_SERVICES_CODE) {
76 unsigned long end; 70 unsigned long end;
77 end = md->phys_addr + (md->num_pages << PAGE_SHIFT); 71 end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
78 early_mapping_set_exec(md->phys_addr, end, executable); 72 early_mapping_set_exec(md->phys_addr, end, executable);
79 } 73 }
80 } 74 }
@@ -84,8 +78,8 @@ void __init efi_call_phys_prelog(void)
84{ 78{
85 unsigned long vaddress; 79 unsigned long vaddress;
86 80
87 local_irq_save(efi_flags);
88 early_runtime_code_mapping_set_exec(1); 81 early_runtime_code_mapping_set_exec(1);
82 local_irq_save(efi_flags);
89 vaddress = (unsigned long)__va(0x0UL); 83 vaddress = (unsigned long)__va(0x0UL);
90 save_pgd = *pgd_offset_k(0x0UL); 84 save_pgd = *pgd_offset_k(0x0UL);
91 set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress)); 85 set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress));
@@ -98,9 +92,9 @@ void __init efi_call_phys_epilog(void)
98 * After the lock is released, the original page table is restored. 92 * After the lock is released, the original page table is restored.
99 */ 93 */
100 set_pgd(pgd_offset_k(0x0UL), save_pgd); 94 set_pgd(pgd_offset_k(0x0UL), save_pgd);
101 early_runtime_code_mapping_set_exec(0);
102 __flush_tlb_all(); 95 __flush_tlb_all();
103 local_irq_restore(efi_flags); 96 local_irq_restore(efi_flags);
97 early_runtime_code_mapping_set_exec(0);
104} 98}
105 99
106void __init efi_reserve_bootmem(void) 100void __init efi_reserve_bootmem(void)
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 824e21b80aad..4b87c32b639f 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -409,7 +409,7 @@ restore_nocheck_notrace:
409 RESTORE_REGS 409 RESTORE_REGS
410 addl $4, %esp # skip orig_eax/error_code 410 addl $4, %esp # skip orig_eax/error_code
411 CFI_ADJUST_CFA_OFFSET -4 411 CFI_ADJUST_CFA_OFFSET -4
412ENTRY(irq_return) 412irq_return:
413 INTERRUPT_RETURN 413 INTERRUPT_RETURN
414.section .fixup,"ax" 414.section .fixup,"ax"
415iret_exc: 415iret_exc:
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 6be39a387c5a..2ad9a1bc6a73 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -583,7 +583,7 @@ retint_restore_args: /* return to kernel space */
583restore_args: 583restore_args:
584 RESTORE_ARGS 0,8,0 584 RESTORE_ARGS 0,8,0
585 585
586ENTRY(irq_return) 586irq_return:
587 INTERRUPT_RETURN 587 INTERRUPT_RETURN
588 588
589 .section __ex_table, "a" 589 .section __ex_table, "a"
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 24dbf56928d7..ad2440832de0 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -88,6 +88,9 @@ void __init x86_64_start_kernel(char * real_mode_data)
88 /* Make NULL pointers segfault */ 88 /* Make NULL pointers segfault */
89 zap_identity_mappings(); 89 zap_identity_mappings();
90 90
91 /* Cleanup the over mapped high alias */
92 cleanup_highmap();
93
91 for (i = 0; i < IDT_ENTRIES; i++) { 94 for (i = 0; i < IDT_ENTRIES; i++) {
92#ifdef CONFIG_EARLY_PRINTK 95#ifdef CONFIG_EARLY_PRINTK
93 set_intr_gate(i, &early_idt_handlers[i]); 96 set_intr_gate(i, &early_idt_handlers[i]);
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 74ef4a41f224..25eb98540a41 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -612,7 +612,7 @@ ENTRY(swapper_pg_pmd)
612ENTRY(swapper_pg_dir) 612ENTRY(swapper_pg_dir)
613 .fill 1024,4,0 613 .fill 1024,4,0
614#endif 614#endif
615ENTRY(swapper_pg_fixmap) 615swapper_pg_fixmap:
616 .fill 1024,4,0 616 .fill 1024,4,0
617ENTRY(empty_zero_page) 617ENTRY(empty_zero_page)
618 .fill 4096,1,0 618 .fill 4096,1,0
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 09b38d539b09..eb415043a929 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -107,8 +107,13 @@ startup_64:
107 movq %rdx, 0(%rbx, %rax, 8) 107 movq %rdx, 0(%rbx, %rax, 8)
108ident_complete: 108ident_complete:
109 109
110 /* Fixup the kernel text+data virtual addresses 110 /*
111 * Fixup the kernel text+data virtual addresses. Note that
112 * we might write invalid pmds, when the kernel is relocated
113 * cleanup_highmap() fixes this up along with the mappings
114 * beyond _end.
111 */ 115 */
116
112 leaq level2_kernel_pgt(%rip), %rdi 117 leaq level2_kernel_pgt(%rip), %rdi
113 leaq 4096(%rdi), %r8 118 leaq 4096(%rdi), %r8
114 /* See if it is a valid page table entry */ 119 /* See if it is a valid page table entry */
@@ -250,7 +255,7 @@ ENTRY(secondary_startup_64)
250 lretq 255 lretq
251 256
252 /* SMP bootup changes these two */ 257 /* SMP bootup changes these two */
253 __CPUINITDATA 258 __REFDATA
254 .align 8 259 .align 8
255 ENTRY(initial_code) 260 ENTRY(initial_code)
256 .quad x86_64_start_kernel 261 .quad x86_64_start_kernel
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 26719bd2c77c..763dfc407232 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -39,7 +39,7 @@
39#define HAVE_HWFP 1 39#define HAVE_HWFP 1
40#endif 40#endif
41 41
42unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu; 42static unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu;
43 43
44void mxcsr_feature_mask_init(void) 44void mxcsr_feature_mask_init(void)
45{ 45{
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index ef62b07b2b48..8540abe86ade 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -95,7 +95,7 @@ static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
95 * registered. This mechanism replaces the previous #ifdef LOCAL_APIC - 95 * registered. This mechanism replaces the previous #ifdef LOCAL_APIC -
96 * !using_apic_timer decisions in do_timer_interrupt_hook() 96 * !using_apic_timer decisions in do_timer_interrupt_hook()
97 */ 97 */
98struct clock_event_device pit_clockevent = { 98static struct clock_event_device pit_clockevent = {
99 .name = "pit", 99 .name = "pit",
100 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 100 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
101 .set_mode = init_pit_timer, 101 .set_mode = init_pit_timer,
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c
index 2d25b77102fe..fe631967d625 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -26,8 +26,6 @@
26 * present in the majority of PC/AT boxes. 26 * present in the majority of PC/AT boxes.
27 * plus some generic x86 specific things if generic specifics makes 27 * plus some generic x86 specific things if generic specifics makes
28 * any sense at all. 28 * any sense at all.
29 * this file should become arch/i386/kernel/irq.c when the old irq.c
30 * moves to arch independent land
31 */ 29 */
32 30
33static int i8259A_auto_eoi; 31static int i8259A_auto_eoi;
@@ -362,23 +360,12 @@ void __init init_ISA_irqs (void)
362#endif 360#endif
363 init_8259A(0); 361 init_8259A(0);
364 362
365 for (i = 0; i < NR_IRQS; i++) { 363 /*
366 irq_desc[i].status = IRQ_DISABLED; 364 * 16 old-style INTA-cycle interrupts:
367 irq_desc[i].action = NULL; 365 */
368 irq_desc[i].depth = 1; 366 for (i = 0; i < 16; i++) {
369 367 set_irq_chip_and_handler_name(i, &i8259A_chip,
370 if (i < 16) { 368 handle_level_irq, "XT");
371 /*
372 * 16 old-style INTA-cycle interrupts:
373 */
374 set_irq_chip_and_handler_name(i, &i8259A_chip,
375 handle_level_irq, "XT");
376 } else {
377 /*
378 * 'high' PCI IRQs filled in on demand
379 */
380 irq_desc[i].chip = &no_irq_chip;
381 }
382 } 369 }
383} 370}
384 371
diff --git a/arch/x86/kernel/io_delay.c b/arch/x86/kernel/io_delay.c
index bd49321034db..c706a3061553 100644
--- a/arch/x86/kernel/io_delay.c
+++ b/arch/x86/kernel/io_delay.c
@@ -13,7 +13,6 @@
13#include <asm/io.h> 13#include <asm/io.h>
14 14
15int io_delay_type __read_mostly = CONFIG_DEFAULT_IO_DELAY_TYPE; 15int io_delay_type __read_mostly = CONFIG_DEFAULT_IO_DELAY_TYPE;
16EXPORT_SYMBOL_GPL(io_delay_type);
17 16
18static int __initdata io_delay_override; 17static int __initdata io_delay_override;
19 18
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index a99e764fd66a..34a591283f5d 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -581,7 +581,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
581 * When a retprobed function returns, this code saves registers and 581 * When a retprobed function returns, this code saves registers and
582 * calls trampoline_handler() runs, which calls the kretprobe's handler. 582 * calls trampoline_handler() runs, which calls the kretprobe's handler.
583 */ 583 */
584void __kprobes kretprobe_trampoline_holder(void) 584static void __used __kprobes kretprobe_trampoline_holder(void)
585{ 585{
586 asm volatile ( 586 asm volatile (
587 ".global kretprobe_trampoline\n" 587 ".global kretprobe_trampoline\n"
@@ -673,7 +673,7 @@ void __kprobes kretprobe_trampoline_holder(void)
673/* 673/*
674 * Called from kretprobe_trampoline 674 * Called from kretprobe_trampoline
675 */ 675 */
676void * __kprobes trampoline_handler(struct pt_regs *regs) 676static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
677{ 677{
678 struct kretprobe_instance *ri = NULL; 678 struct kretprobe_instance *ri = NULL;
679 struct hlist_head *head, empty_rp; 679 struct hlist_head *head, empty_rp;
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index edd413650b3b..6a0aa7038685 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -46,9 +46,6 @@ static unsigned int nmi_hz = HZ;
46 46
47static DEFINE_PER_CPU(short, wd_enabled); 47static DEFINE_PER_CPU(short, wd_enabled);
48 48
49/* local prototypes */
50static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
51
52static int endflag __initdata = 0; 49static int endflag __initdata = 0;
53 50
54#ifdef CONFIG_SMP 51#ifdef CONFIG_SMP
@@ -391,15 +388,6 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
391 return rc; 388 return rc;
392} 389}
393 390
394int do_nmi_callback(struct pt_regs * regs, int cpu)
395{
396#ifdef CONFIG_SYSCTL
397 if (unknown_nmi_panic)
398 return unknown_nmi_panic_callback(regs, cpu);
399#endif
400 return 0;
401}
402
403#ifdef CONFIG_SYSCTL 391#ifdef CONFIG_SYSCTL
404 392
405static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu) 393static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
@@ -453,6 +441,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
453 441
454#endif 442#endif
455 443
444int do_nmi_callback(struct pt_regs *regs, int cpu)
445{
446#ifdef CONFIG_SYSCTL
447 if (unknown_nmi_panic)
448 return unknown_nmi_panic_callback(regs, cpu);
449#endif
450 return 0;
451}
452
456void __trigger_all_cpu_backtrace(void) 453void __trigger_all_cpu_backtrace(void)
457{ 454{
458 int i; 455 int i;
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index fb99484d21cf..9a4fde74bee1 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -46,9 +46,6 @@ static unsigned int nmi_hz = HZ;
46 46
47static DEFINE_PER_CPU(short, wd_enabled); 47static DEFINE_PER_CPU(short, wd_enabled);
48 48
49/* local prototypes */
50static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);
51
52/* Run after command line and cpu_init init, but before all other checks */ 49/* Run after command line and cpu_init init, but before all other checks */
53void nmi_watchdog_default(void) 50void nmi_watchdog_default(void)
54{ 51{
@@ -394,15 +391,6 @@ asmlinkage __kprobes void do_nmi(struct pt_regs * regs, long error_code)
394 nmi_exit(); 391 nmi_exit();
395} 392}
396 393
397int do_nmi_callback(struct pt_regs * regs, int cpu)
398{
399#ifdef CONFIG_SYSCTL
400 if (unknown_nmi_panic)
401 return unknown_nmi_panic_callback(regs, cpu);
402#endif
403 return 0;
404}
405
406void stop_nmi(void) 394void stop_nmi(void)
407{ 395{
408 acpi_nmi_disable(); 396 acpi_nmi_disable();
@@ -464,6 +452,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
464 452
465#endif 453#endif
466 454
455int do_nmi_callback(struct pt_regs *regs, int cpu)
456{
457#ifdef CONFIG_SYSCTL
458 if (unknown_nmi_panic)
459 return unknown_nmi_panic_callback(regs, cpu);
460#endif
461 return 0;
462}
463
467void __trigger_all_cpu_backtrace(void) 464void __trigger_all_cpu_backtrace(void)
468{ 465{
469 int i; 466 int i;
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 65f6acb025c8..faf3229f8fb3 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -749,6 +749,15 @@ void __init gart_iommu_init(void)
749 */ 749 */
750 set_memory_np((unsigned long)__va(iommu_bus_base), 750 set_memory_np((unsigned long)__va(iommu_bus_base),
751 iommu_size >> PAGE_SHIFT); 751 iommu_size >> PAGE_SHIFT);
752 /*
753 * Tricky. The GART table remaps the physical memory range,
754 * so the CPU wont notice potential aliases and if the memory
755 * is remapped to UC later on, we might surprise the PCI devices
756 * with a stray writeout of a cacheline. So play it sure and
757 * do an explicit, full-scale wbinvd() _after_ having marked all
758 * the pages as Not-Present:
759 */
760 wbinvd();
752 761
753 /* 762 /*
754 * Try to workaround a bug (thanks to BenH) 763 * Try to workaround a bug (thanks to BenH)
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 702c33efea84..d862e396b099 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1160,7 +1160,7 @@ static int genregs32_set(struct task_struct *target,
1160 if (kbuf) { 1160 if (kbuf) {
1161 const compat_ulong_t *k = kbuf; 1161 const compat_ulong_t *k = kbuf;
1162 while (count > 0 && !ret) { 1162 while (count > 0 && !ret) {
1163 ret = putreg(target, pos, *k++); 1163 ret = putreg32(target, pos, *k++);
1164 count -= sizeof(*k); 1164 count -= sizeof(*k);
1165 pos += sizeof(*k); 1165 pos += sizeof(*k);
1166 } 1166 }
@@ -1171,7 +1171,7 @@ static int genregs32_set(struct task_struct *target,
1171 ret = __get_user(word, u++); 1171 ret = __get_user(word, u++);
1172 if (ret) 1172 if (ret)
1173 break; 1173 break;
1174 ret = putreg(target, pos, word); 1174 ret = putreg32(target, pos, word);
1175 count -= sizeof(*u); 1175 count -= sizeof(*u);
1176 pos += sizeof(*u); 1176 pos += sizeof(*u);
1177 } 1177 }
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 5818dc28167d..7fd6ac43e4a1 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -326,7 +326,7 @@ static inline void kb_wait(void)
326 } 326 }
327} 327}
328 328
329void machine_emergency_restart(void) 329static void native_machine_emergency_restart(void)
330{ 330{
331 int i; 331 int i;
332 332
@@ -376,7 +376,7 @@ void machine_emergency_restart(void)
376 } 376 }
377} 377}
378 378
379void machine_shutdown(void) 379static void native_machine_shutdown(void)
380{ 380{
381 /* Stop the cpus and apics */ 381 /* Stop the cpus and apics */
382#ifdef CONFIG_SMP 382#ifdef CONFIG_SMP
@@ -420,7 +420,7 @@ void machine_shutdown(void)
420#endif 420#endif
421} 421}
422 422
423void machine_restart(char *__unused) 423static void native_machine_restart(char *__unused)
424{ 424{
425 printk("machine restart\n"); 425 printk("machine restart\n");
426 426
@@ -429,11 +429,11 @@ void machine_restart(char *__unused)
429 machine_emergency_restart(); 429 machine_emergency_restart();
430} 430}
431 431
432void machine_halt(void) 432static void native_machine_halt(void)
433{ 433{
434} 434}
435 435
436void machine_power_off(void) 436static void native_machine_power_off(void)
437{ 437{
438 if (pm_power_off) { 438 if (pm_power_off) {
439 if (!reboot_force) 439 if (!reboot_force)
@@ -443,9 +443,35 @@ void machine_power_off(void)
443} 443}
444 444
445struct machine_ops machine_ops = { 445struct machine_ops machine_ops = {
446 .power_off = machine_power_off, 446 .power_off = native_machine_power_off,
447 .shutdown = machine_shutdown, 447 .shutdown = native_machine_shutdown,
448 .emergency_restart = machine_emergency_restart, 448 .emergency_restart = native_machine_emergency_restart,
449 .restart = machine_restart, 449 .restart = native_machine_restart,
450 .halt = machine_halt 450 .halt = native_machine_halt
451}; 451};
452
453void machine_power_off(void)
454{
455 machine_ops.power_off();
456}
457
458void machine_shutdown(void)
459{
460 machine_ops.shutdown();
461}
462
463void machine_emergency_restart(void)
464{
465 machine_ops.emergency_restart();
466}
467
468void machine_restart(char *cmd)
469{
470 machine_ops.restart(cmd);
471}
472
473void machine_halt(void)
474{
475 machine_ops.halt();
476}
477
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 691ab4cb167b..a1d7071a51c9 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -164,7 +164,6 @@ unsigned long mmu_cr4_features = X86_CR4_PAE;
164unsigned int machine_id; 164unsigned int machine_id;
165unsigned int machine_submodel_id; 165unsigned int machine_submodel_id;
166unsigned int BIOS_revision; 166unsigned int BIOS_revision;
167unsigned int mca_pentium_flag;
168 167
169/* Boot loader ID as an integer, for the benefit of proc_dointvec */ 168/* Boot loader ID as an integer, for the benefit of proc_dointvec */
170int bootloader_type; 169int bootloader_type;
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index c0d8208af12a..6fd804f07821 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -518,7 +518,7 @@ static void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
518} 518}
519 519
520#ifdef CONFIG_NUMA 520#ifdef CONFIG_NUMA
521static int nearby_node(int apicid) 521static int __cpuinit nearby_node(int apicid)
522{ 522{
523 int i, node; 523 int i, node;
524 524
@@ -791,7 +791,7 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
791 return 1; 791 return 1;
792} 792}
793 793
794static void srat_detect_node(void) 794static void __cpuinit srat_detect_node(void)
795{ 795{
796#ifdef CONFIG_NUMA 796#ifdef CONFIG_NUMA
797 unsigned node; 797 unsigned node;
@@ -1046,7 +1046,7 @@ __setup("noclflush", setup_noclflush);
1046void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) 1046void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
1047{ 1047{
1048 if (c->x86_model_id[0]) 1048 if (c->x86_model_id[0])
1049 printk(KERN_INFO "%s", c->x86_model_id); 1049 printk(KERN_CONT "%s", c->x86_model_id);
1050 1050
1051 if (c->x86_mask || c->cpuid_level >= 0) 1051 if (c->x86_mask || c->cpuid_level >= 0)
1052 printk(KERN_CONT " stepping %02x\n", c->x86_mask); 1052 printk(KERN_CONT " stepping %02x\n", c->x86_mask);
diff --git a/arch/x86/kernel/test_rodata.c b/arch/x86/kernel/test_rodata.c
index 4c163772000e..c29e235792af 100644
--- a/arch/x86/kernel/test_rodata.c
+++ b/arch/x86/kernel/test_rodata.c
@@ -10,8 +10,8 @@
10 * of the License. 10 * of the License.
11 */ 11 */
12#include <linux/module.h> 12#include <linux/module.h>
13#include <asm/cacheflush.h>
13#include <asm/sections.h> 14#include <asm/sections.h>
14extern int rodata_test_data;
15 15
16int rodata_test(void) 16int rodata_test(void)
17{ 17{
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index a40051b71d9b..0fcc95a354f7 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -34,7 +34,7 @@
34static DEFINE_PER_CPU(struct x86_cpu, cpu_devices); 34static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
35 35
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37int arch_register_cpu(int num) 37int __ref arch_register_cpu(int num)
38{ 38{
39 /* 39 /*
40 * CPU0 cannot be offlined due to several 40 * CPU0 cannot be offlined due to several
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index efc66df728b6..045466681911 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -84,7 +84,7 @@ static inline void conditional_sti(struct pt_regs *regs)
84 84
85static inline void preempt_conditional_sti(struct pt_regs *regs) 85static inline void preempt_conditional_sti(struct pt_regs *regs)
86{ 86{
87 preempt_disable(); 87 inc_preempt_count();
88 if (regs->flags & X86_EFLAGS_IF) 88 if (regs->flags & X86_EFLAGS_IF)
89 local_irq_enable(); 89 local_irq_enable();
90} 90}
@@ -95,7 +95,7 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
95 local_irq_disable(); 95 local_irq_disable();
96 /* Make sure to not schedule here because we could be running 96 /* Make sure to not schedule here because we could be running
97 on an exception stack. */ 97 on an exception stack. */
98 preempt_enable_no_resched(); 98 dec_preempt_count();
99} 99}
100 100
101int kstack_depth_to_print = 12; 101int kstack_depth_to_print = 12;
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index f1148ac8abe3..2ffa9656fe7a 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -38,7 +38,7 @@ SECTIONS
38 38
39 /* read-only */ 39 /* read-only */
40 .text : AT(ADDR(.text) - LOAD_OFFSET) { 40 .text : AT(ADDR(.text) - LOAD_OFFSET) {
41 . = ALIGN(4096); /* not really needed, already page aligned */ 41 . = ALIGN(PAGE_SIZE); /* not really needed, already page aligned */
42 *(.text.page_aligned) 42 *(.text.page_aligned)
43 TEXT_TEXT 43 TEXT_TEXT
44 SCHED_TEXT 44 SCHED_TEXT
@@ -70,21 +70,21 @@ SECTIONS
70 RODATA 70 RODATA
71 71
72 /* writeable */ 72 /* writeable */
73 . = ALIGN(4096); 73 . = ALIGN(PAGE_SIZE);
74 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ 74 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
75 DATA_DATA 75 DATA_DATA
76 CONSTRUCTORS 76 CONSTRUCTORS
77 } :data 77 } :data
78 78
79 . = ALIGN(4096); 79 . = ALIGN(PAGE_SIZE);
80 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { 80 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
81 __nosave_begin = .; 81 __nosave_begin = .;
82 *(.data.nosave) 82 *(.data.nosave)
83 . = ALIGN(4096); 83 . = ALIGN(PAGE_SIZE);
84 __nosave_end = .; 84 __nosave_end = .;
85 } 85 }
86 86
87 . = ALIGN(4096); 87 . = ALIGN(PAGE_SIZE);
88 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { 88 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
89 *(.data.page_aligned) 89 *(.data.page_aligned)
90 *(.data.idt) 90 *(.data.idt)
@@ -108,7 +108,7 @@ SECTIONS
108 } 108 }
109 109
110 /* might get freed after init */ 110 /* might get freed after init */
111 . = ALIGN(4096); 111 . = ALIGN(PAGE_SIZE);
112 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 112 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
113 __smp_locks = .; 113 __smp_locks = .;
114 *(.smp_locks) 114 *(.smp_locks)
@@ -120,10 +120,10 @@ SECTIONS
120 * after boot. Always make sure that ALIGN() directive is present after 120 * after boot. Always make sure that ALIGN() directive is present after
121 * the section which contains __smp_alt_end. 121 * the section which contains __smp_alt_end.
122 */ 122 */
123 . = ALIGN(4096); 123 . = ALIGN(PAGE_SIZE);
124 124
125 /* will be freed after init */ 125 /* will be freed after init */
126 . = ALIGN(4096); /* Init code and data */ 126 . = ALIGN(PAGE_SIZE); /* Init code and data */
127 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 127 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
128 __init_begin = .; 128 __init_begin = .;
129 _sinittext = .; 129 _sinittext = .;
@@ -174,23 +174,23 @@ SECTIONS
174 EXIT_DATA 174 EXIT_DATA
175 } 175 }
176#if defined(CONFIG_BLK_DEV_INITRD) 176#if defined(CONFIG_BLK_DEV_INITRD)
177 . = ALIGN(4096); 177 . = ALIGN(PAGE_SIZE);
178 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { 178 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
179 __initramfs_start = .; 179 __initramfs_start = .;
180 *(.init.ramfs) 180 *(.init.ramfs)
181 __initramfs_end = .; 181 __initramfs_end = .;
182 } 182 }
183#endif 183#endif
184 . = ALIGN(4096); 184 . = ALIGN(PAGE_SIZE);
185 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { 185 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
186 __per_cpu_start = .; 186 __per_cpu_start = .;
187 *(.data.percpu) 187 *(.data.percpu)
188 *(.data.percpu.shared_aligned) 188 *(.data.percpu.shared_aligned)
189 __per_cpu_end = .; 189 __per_cpu_end = .;
190 } 190 }
191 . = ALIGN(4096); 191 . = ALIGN(PAGE_SIZE);
192 /* freed after init ends here */ 192 /* freed after init ends here */
193 193
194 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { 194 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
195 __init_end = .; 195 __init_end = .;
196 __bss_start = .; /* BSS */ 196 __bss_start = .; /* BSS */
@@ -200,7 +200,7 @@ SECTIONS
200 __bss_stop = .; 200 __bss_stop = .;
201 _end = . ; 201 _end = . ;
202 /* This is where the kernel creates the early boot page tables */ 202 /* This is where the kernel creates the early boot page tables */
203 . = ALIGN(4096); 203 . = ALIGN(PAGE_SIZE);
204 pg0 = . ; 204 pg0 = . ;
205 } 205 }
206 206
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index 0992b9946c6f..fab132299735 100644
--- a/arch/x86/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
@@ -37,7 +37,7 @@ SECTIONS
37 KPROBES_TEXT 37 KPROBES_TEXT
38 *(.fixup) 38 *(.fixup)
39 *(.gnu.warning) 39 *(.gnu.warning)
40 _etext = .; /* End of text section */ 40 _etext = .; /* End of text section */
41 } :text = 0x9090 41 } :text = 0x9090
42 42
43 . = ALIGN(16); /* Exception table */ 43 . = ALIGN(16); /* Exception table */
@@ -60,7 +60,7 @@ SECTIONS
60 __tracedata_end = .; 60 __tracedata_end = .;
61 } 61 }
62 62
63 . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ 63 . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */
64 /* Data */ 64 /* Data */
65 .data : AT(ADDR(.data) - LOAD_OFFSET) { 65 .data : AT(ADDR(.data) - LOAD_OFFSET) {
66 DATA_DATA 66 DATA_DATA
@@ -119,7 +119,7 @@ SECTIONS
119 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) 119 .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3))
120 { *(.vsyscall_3) } 120 { *(.vsyscall_3) }
121 121
122 . = VSYSCALL_VIRT_ADDR + 4096; 122 . = VSYSCALL_VIRT_ADDR + PAGE_SIZE;
123 123
124#undef VSYSCALL_ADDR 124#undef VSYSCALL_ADDR
125#undef VSYSCALL_PHYS_ADDR 125#undef VSYSCALL_PHYS_ADDR
@@ -129,28 +129,28 @@ SECTIONS
129#undef VVIRT_OFFSET 129#undef VVIRT_OFFSET
130#undef VVIRT 130#undef VVIRT
131 131
132 . = ALIGN(8192); /* init_task */ 132 . = ALIGN(THREAD_SIZE); /* init_task */
133 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { 133 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
134 *(.data.init_task) 134 *(.data.init_task)
135 }:data.init 135 }:data.init
136 136
137 . = ALIGN(4096); 137 . = ALIGN(PAGE_SIZE);
138 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { 138 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
139 *(.data.page_aligned) 139 *(.data.page_aligned)
140 } 140 }
141 141
142 /* might get freed after init */ 142 /* might get freed after init */
143 . = ALIGN(4096); 143 . = ALIGN(PAGE_SIZE);
144 __smp_alt_begin = .; 144 __smp_alt_begin = .;
145 __smp_locks = .; 145 __smp_locks = .;
146 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 146 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
147 *(.smp_locks) 147 *(.smp_locks)
148 } 148 }
149 __smp_locks_end = .; 149 __smp_locks_end = .;
150 . = ALIGN(4096); 150 . = ALIGN(PAGE_SIZE);
151 __smp_alt_end = .; 151 __smp_alt_end = .;
152 152
153 . = ALIGN(4096); /* Init code and data */ 153 . = ALIGN(PAGE_SIZE); /* Init code and data */
154 __init_begin = .; 154 __init_begin = .;
155 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 155 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
156 _sinittext = .; 156 _sinittext = .;
@@ -191,7 +191,7 @@ SECTIONS
191 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { 191 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
192 *(.altinstructions) 192 *(.altinstructions)
193 } 193 }
194 __alt_instructions_end = .; 194 __alt_instructions_end = .;
195 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { 195 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
196 *(.altinstr_replacement) 196 *(.altinstr_replacement)
197 } 197 }
@@ -207,25 +207,25 @@ SECTIONS
207/* vdso blob that is mapped into user space */ 207/* vdso blob that is mapped into user space */
208 vdso_start = . ; 208 vdso_start = . ;
209 .vdso : AT(ADDR(.vdso) - LOAD_OFFSET) { *(.vdso) } 209 .vdso : AT(ADDR(.vdso) - LOAD_OFFSET) { *(.vdso) }
210 . = ALIGN(4096); 210 . = ALIGN(PAGE_SIZE);
211 vdso_end = .; 211 vdso_end = .;
212 212
213#ifdef CONFIG_BLK_DEV_INITRD 213#ifdef CONFIG_BLK_DEV_INITRD
214 . = ALIGN(4096); 214 . = ALIGN(PAGE_SIZE);
215 __initramfs_start = .; 215 __initramfs_start = .;
216 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } 216 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
217 __initramfs_end = .; 217 __initramfs_end = .;
218#endif 218#endif
219 219
220 PERCPU(4096) 220 PERCPU(PAGE_SIZE)
221 221
222 . = ALIGN(4096); 222 . = ALIGN(PAGE_SIZE);
223 __init_end = .; 223 __init_end = .;
224 224
225 . = ALIGN(4096); 225 . = ALIGN(PAGE_SIZE);
226 __nosave_begin = .; 226 __nosave_begin = .;
227 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) } 227 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
228 . = ALIGN(4096); 228 . = ALIGN(PAGE_SIZE);
229 __nosave_end = .; 229 __nosave_end = .;
230 230
231 __bss_start = .; /* BSS */ 231 __bss_start = .; /* BSS */
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c
index fd42a4a095fc..459b58a8a15c 100644
--- a/arch/x86/lib/csum-wrappers_64.c
+++ b/arch/x86/lib/csum-wrappers_64.c
@@ -1,117 +1,129 @@
1/* Copyright 2002,2003 Andi Kleen, SuSE Labs. 1/*
2 * Copyright 2002, 2003 Andi Kleen, SuSE Labs.
2 * Subject to the GNU Public License v.2 3 * Subject to the GNU Public License v.2
3 * 4 *
4 * Wrappers of assembly checksum functions for x86-64. 5 * Wrappers of assembly checksum functions for x86-64.
5 */ 6 */
6
7#include <asm/checksum.h> 7#include <asm/checksum.h>
8#include <linux/module.h> 8#include <linux/module.h>
9 9
10/** 10/**
11 * csum_partial_copy_from_user - Copy and checksum from user space. 11 * csum_partial_copy_from_user - Copy and checksum from user space.
12 * @src: source address (user space) 12 * @src: source address (user space)
13 * @dst: destination address 13 * @dst: destination address
14 * @len: number of bytes to be copied. 14 * @len: number of bytes to be copied.
15 * @isum: initial sum that is added into the result (32bit unfolded) 15 * @isum: initial sum that is added into the result (32bit unfolded)
16 * @errp: set to -EFAULT for an bad source address. 16 * @errp: set to -EFAULT for an bad source address.
17 * 17 *
18 * Returns an 32bit unfolded checksum of the buffer. 18 * Returns an 32bit unfolded checksum of the buffer.
19 * src and dst are best aligned to 64bits. 19 * src and dst are best aligned to 64bits.
20 */ 20 */
21__wsum 21__wsum
22csum_partial_copy_from_user(const void __user *src, void *dst, 22csum_partial_copy_from_user(const void __user *src, void *dst,
23 int len, __wsum isum, int *errp) 23 int len, __wsum isum, int *errp)
24{ 24{
25 might_sleep(); 25 might_sleep();
26 *errp = 0; 26 *errp = 0;
27 if (likely(access_ok(VERIFY_READ,src, len))) { 27
28 /* Why 6, not 7? To handle odd addresses aligned we 28 if (!likely(access_ok(VERIFY_READ, src, len)))
29 would need to do considerable complications to fix the 29 goto out_err;
30 checksum which is defined as an 16bit accumulator. The 30
31 fix alignment code is primarily for performance 31 /*
32 compatibility with 32bit and that will handle odd 32 * Why 6, not 7? To handle odd addresses aligned we
33 addresses slowly too. */ 33 * would need to do considerable complications to fix the
34 if (unlikely((unsigned long)src & 6)) { 34 * checksum which is defined as an 16bit accumulator. The
35 while (((unsigned long)src & 6) && len >= 2) { 35 * fix alignment code is primarily for performance
36 __u16 val16; 36 * compatibility with 32bit and that will handle odd
37 *errp = __get_user(val16, (const __u16 __user *)src); 37 * addresses slowly too.
38 if (*errp) 38 */
39 return isum; 39 if (unlikely((unsigned long)src & 6)) {
40 *(__u16 *)dst = val16; 40 while (((unsigned long)src & 6) && len >= 2) {
41 isum = (__force __wsum)add32_with_carry( 41 __u16 val16;
42 (__force unsigned)isum, val16); 42
43 src += 2; 43 *errp = __get_user(val16, (const __u16 __user *)src);
44 dst += 2; 44 if (*errp)
45 len -= 2; 45 return isum;
46 } 46
47 *(__u16 *)dst = val16;
48 isum = (__force __wsum)add32_with_carry(
49 (__force unsigned)isum, val16);
50 src += 2;
51 dst += 2;
52 len -= 2;
47 } 53 }
48 isum = csum_partial_copy_generic((__force const void *)src, 54 }
49 dst, len, isum, errp, NULL); 55 isum = csum_partial_copy_generic((__force const void *)src,
50 if (likely(*errp == 0)) 56 dst, len, isum, errp, NULL);
51 return isum; 57 if (unlikely(*errp))
52 } 58 goto out_err;
59
60 return isum;
61
62out_err:
53 *errp = -EFAULT; 63 *errp = -EFAULT;
54 memset(dst,0,len); 64 memset(dst, 0, len);
55 return isum;
56}
57 65
66 return isum;
67}
58EXPORT_SYMBOL(csum_partial_copy_from_user); 68EXPORT_SYMBOL(csum_partial_copy_from_user);
59 69
60/** 70/**
61 * csum_partial_copy_to_user - Copy and checksum to user space. 71 * csum_partial_copy_to_user - Copy and checksum to user space.
62 * @src: source address 72 * @src: source address
63 * @dst: destination address (user space) 73 * @dst: destination address (user space)
64 * @len: number of bytes to be copied. 74 * @len: number of bytes to be copied.
65 * @isum: initial sum that is added into the result (32bit unfolded) 75 * @isum: initial sum that is added into the result (32bit unfolded)
66 * @errp: set to -EFAULT for an bad destination address. 76 * @errp: set to -EFAULT for an bad destination address.
67 * 77 *
68 * Returns an 32bit unfolded checksum of the buffer. 78 * Returns an 32bit unfolded checksum of the buffer.
69 * src and dst are best aligned to 64bits. 79 * src and dst are best aligned to 64bits.
70 */ 80 */
71__wsum 81__wsum
72csum_partial_copy_to_user(const void *src, void __user *dst, 82csum_partial_copy_to_user(const void *src, void __user *dst,
73 int len, __wsum isum, int *errp) 83 int len, __wsum isum, int *errp)
74{ 84{
75 might_sleep(); 85 might_sleep();
86
76 if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) { 87 if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) {
77 *errp = -EFAULT; 88 *errp = -EFAULT;
78 return 0; 89 return 0;
79 } 90 }
80 91
81 if (unlikely((unsigned long)dst & 6)) { 92 if (unlikely((unsigned long)dst & 6)) {
82 while (((unsigned long)dst & 6) && len >= 2) { 93 while (((unsigned long)dst & 6) && len >= 2) {
83 __u16 val16 = *(__u16 *)src; 94 __u16 val16 = *(__u16 *)src;
95
84 isum = (__force __wsum)add32_with_carry( 96 isum = (__force __wsum)add32_with_carry(
85 (__force unsigned)isum, val16); 97 (__force unsigned)isum, val16);
86 *errp = __put_user(val16, (__u16 __user *)dst); 98 *errp = __put_user(val16, (__u16 __user *)dst);
87 if (*errp) 99 if (*errp)
88 return isum; 100 return isum;
89 src += 2; 101 src += 2;
90 dst += 2; 102 dst += 2;
91 len -= 2; 103 len -= 2;
92 } 104 }
93 } 105 }
94 106
95 *errp = 0; 107 *errp = 0;
96 return csum_partial_copy_generic(src, (void __force *)dst,len,isum,NULL,errp); 108 return csum_partial_copy_generic(src, (void __force *)dst,
97} 109 len, isum, NULL, errp);
98 110}
99EXPORT_SYMBOL(csum_partial_copy_to_user); 111EXPORT_SYMBOL(csum_partial_copy_to_user);
100 112
101/** 113/**
102 * csum_partial_copy_nocheck - Copy and checksum. 114 * csum_partial_copy_nocheck - Copy and checksum.
103 * @src: source address 115 * @src: source address
104 * @dst: destination address 116 * @dst: destination address
105 * @len: number of bytes to be copied. 117 * @len: number of bytes to be copied.
106 * @isum: initial sum that is added into the result (32bit unfolded) 118 * @isum: initial sum that is added into the result (32bit unfolded)
107 * 119 *
108 * Returns an 32bit unfolded checksum of the buffer. 120 * Returns an 32bit unfolded checksum of the buffer.
109 */ 121 */
110__wsum 122__wsum
111csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) 123csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
112{ 124{
113 return csum_partial_copy_generic(src,dst,len,sum,NULL,NULL); 125 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
114} 126}
115EXPORT_SYMBOL(csum_partial_copy_nocheck); 127EXPORT_SYMBOL(csum_partial_copy_nocheck);
116 128
117__sum16 csum_ipv6_magic(const struct in6_addr *saddr, 129__sum16 csum_ipv6_magic(const struct in6_addr *saddr,
@@ -119,17 +131,20 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
119 __u32 len, unsigned short proto, __wsum sum) 131 __u32 len, unsigned short proto, __wsum sum)
120{ 132{
121 __u64 rest, sum64; 133 __u64 rest, sum64;
122 134
123 rest = (__force __u64)htonl(len) + (__force __u64)htons(proto) + 135 rest = (__force __u64)htonl(len) + (__force __u64)htons(proto) +
124 (__force __u64)sum; 136 (__force __u64)sum;
125 asm(" addq (%[saddr]),%[sum]\n"
126 " adcq 8(%[saddr]),%[sum]\n"
127 " adcq (%[daddr]),%[sum]\n"
128 " adcq 8(%[daddr]),%[sum]\n"
129 " adcq $0,%[sum]\n"
130 : [sum] "=r" (sum64)
131 : "[sum]" (rest),[saddr] "r" (saddr), [daddr] "r" (daddr));
132 return csum_fold((__force __wsum)add32_with_carry(sum64 & 0xffffffff, sum64>>32));
133}
134 137
138 asm(" addq (%[saddr]),%[sum]\n"
139 " adcq 8(%[saddr]),%[sum]\n"
140 " adcq (%[daddr]),%[sum]\n"
141 " adcq 8(%[daddr]),%[sum]\n"
142 " adcq $0,%[sum]\n"
143
144 : [sum] "=r" (sum64)
145 : "[sum]" (rest), [saddr] "r" (saddr), [daddr] "r" (daddr));
146
147 return csum_fold(
148 (__force __wsum)add32_with_carry(sum64 & 0xffffffff, sum64>>32));
149}
135EXPORT_SYMBOL(csum_ipv6_magic); 150EXPORT_SYMBOL(csum_ipv6_magic);
diff --git a/arch/x86/lib/io_64.c b/arch/x86/lib/io_64.c
index 87b4a4e18039..3f1eb59b5f08 100644
--- a/arch/x86/lib/io_64.c
+++ b/arch/x86/lib/io_64.c
@@ -1,23 +1,25 @@
1#include <linux/string.h> 1#include <linux/string.h>
2#include <asm/io.h>
3#include <linux/module.h> 2#include <linux/module.h>
3#include <asm/io.h>
4 4
5void __memcpy_toio(unsigned long dst,const void*src,unsigned len) 5void __memcpy_toio(unsigned long dst, const void *src, unsigned len)
6{ 6{
7 __inline_memcpy((void *) dst,src,len); 7 __inline_memcpy((void *)dst, src, len);
8} 8}
9EXPORT_SYMBOL(__memcpy_toio); 9EXPORT_SYMBOL(__memcpy_toio);
10 10
11void __memcpy_fromio(void *dst,unsigned long src,unsigned len) 11void __memcpy_fromio(void *dst, unsigned long src, unsigned len)
12{ 12{
13 __inline_memcpy(dst,(const void *) src,len); 13 __inline_memcpy(dst, (const void *)src, len);
14} 14}
15EXPORT_SYMBOL(__memcpy_fromio); 15EXPORT_SYMBOL(__memcpy_fromio);
16 16
17void memset_io(volatile void __iomem *a, int b, size_t c) 17void memset_io(volatile void __iomem *a, int b, size_t c)
18{ 18{
19 /* XXX: memset can mangle the IO patterns quite a bit. 19 /*
20 perhaps it would be better to use a dumb one */ 20 * TODO: memset can mangle the IO patterns quite a bit.
21 memset((void *)a,b,c); 21 * perhaps it would be better to use a dumb one:
22 */
23 memset((void *)a, b, c);
22} 24}
23EXPORT_SYMBOL(memset_io); 25EXPORT_SYMBOL(memset_io);
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 621afb6343dc..fdc667422df9 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -186,7 +186,7 @@ static int bad_address(void *p)
186} 186}
187#endif 187#endif
188 188
189void dump_pagetable(unsigned long address) 189static void dump_pagetable(unsigned long address)
190{ 190{
191#ifdef CONFIG_X86_32 191#ifdef CONFIG_X86_32
192 __typeof__(pte_val(__pte(0))) page; 192 __typeof__(pte_val(__pte(0))) page;
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 8106bba41ecb..ee1091a46964 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -47,6 +47,7 @@
47#include <asm/sections.h> 47#include <asm/sections.h>
48#include <asm/paravirt.h> 48#include <asm/paravirt.h>
49#include <asm/setup.h> 49#include <asm/setup.h>
50#include <asm/cacheflush.h>
50 51
51unsigned int __VMALLOC_RESERVE = 128 << 20; 52unsigned int __VMALLOC_RESERVE = 128 << 20;
52 53
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index b59fc238151f..bb652f5a93fb 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -45,6 +45,7 @@
45#include <asm/sections.h> 45#include <asm/sections.h>
46#include <asm/kdebug.h> 46#include <asm/kdebug.h>
47#include <asm/numa.h> 47#include <asm/numa.h>
48#include <asm/cacheflush.h>
48 49
49const struct dma_mapping_ops *dma_ops; 50const struct dma_mapping_ops *dma_ops;
50EXPORT_SYMBOL(dma_ops); 51EXPORT_SYMBOL(dma_ops);
@@ -170,6 +171,33 @@ set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot)
170 __flush_tlb_one(vaddr); 171 __flush_tlb_one(vaddr);
171} 172}
172 173
174/*
175 * The head.S code sets up the kernel high mapping from:
176 * __START_KERNEL_map to __START_KERNEL_map + KERNEL_TEXT_SIZE
177 *
178 * phys_addr holds the negative offset to the kernel, which is added
179 * to the compile time generated pmds. This results in invalid pmds up
180 * to the point where we hit the physaddr 0 mapping.
181 *
182 * We limit the mappings to the region from _text to _end. _end is
183 * rounded up to the 2MB boundary. This catches the invalid pmds as
184 * well, as they are located before _text:
185 */
186void __init cleanup_highmap(void)
187{
188 unsigned long vaddr = __START_KERNEL_map;
189 unsigned long end = round_up((unsigned long)_end, PMD_SIZE) - 1;
190 pmd_t *pmd = level2_kernel_pgt;
191 pmd_t *last_pmd = pmd + PTRS_PER_PMD;
192
193 for (; pmd < last_pmd; pmd++, vaddr += PMD_SIZE) {
194 if (!pmd_present(*pmd))
195 continue;
196 if (vaddr < (unsigned long) _text || vaddr > end)
197 set_pmd(pmd, __pmd(0));
198 }
199}
200
173/* NOTE: this is meant to be run only at boot */ 201/* NOTE: this is meant to be run only at boot */
174void __init 202void __init
175__set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot) 203__set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot)
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index a4897a85268a..882328efc3db 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -42,6 +42,22 @@ int page_is_ram(unsigned long pagenr)
42 unsigned long addr, end; 42 unsigned long addr, end;
43 int i; 43 int i;
44 44
45 /*
46 * A special case is the first 4Kb of memory;
47 * This is a BIOS owned area, not kernel ram, but generally
48 * not listed as such in the E820 table.
49 */
50 if (pagenr == 0)
51 return 0;
52
53 /*
54 * Second special case: Some BIOSen report the PC BIOS
55 * area (640->1Mb) as ram even though it is not.
56 */
57 if (pagenr >= (BIOS_BEGIN >> PAGE_SHIFT) &&
58 pagenr < (BIOS_END >> PAGE_SHIFT))
59 return 0;
60
45 for (i = 0; i < e820.nr_map; i++) { 61 for (i = 0; i < e820.nr_map; i++) {
46 /* 62 /*
47 * Not usable memory: 63 * Not usable memory:
@@ -51,14 +67,6 @@ int page_is_ram(unsigned long pagenr)
51 addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT; 67 addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT;
52 end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; 68 end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT;
53 69
54 /*
55 * Sanity check: Some BIOSen report areas as RAM that
56 * are not. Notably the 640->1Mb area, which is the
57 * PCI BIOS area.
58 */
59 if (addr >= (BIOS_BEGIN >> PAGE_SHIFT) &&
60 end < (BIOS_END >> PAGE_SHIFT))
61 continue;
62 70
63 if ((pagenr >= addr) && (pagenr < end)) 71 if ((pagenr >= addr) && (pagenr < end))
64 return 1; 72 return 1;
@@ -126,6 +134,8 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
126 return NULL; 134 return NULL;
127 } 135 }
128 136
137 WARN_ON_ONCE(page_is_ram(pfn));
138
129 switch (mode) { 139 switch (mode) {
130 case IOR_MODE_UNCACHED: 140 case IOR_MODE_UNCACHED:
131 default: 141 default:
@@ -265,7 +275,9 @@ static __initdata pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)]
265 275
266static inline pmd_t * __init early_ioremap_pmd(unsigned long addr) 276static inline pmd_t * __init early_ioremap_pmd(unsigned long addr)
267{ 277{
268 pgd_t *pgd = &swapper_pg_dir[pgd_index(addr)]; 278 /* Don't assume we're using swapper_pg_dir at this point */
279 pgd_t *base = __va(read_cr3());
280 pgd_t *pgd = &base[pgd_index(addr)];
269 pud_t *pud = pud_offset(pgd, addr); 281 pud_t *pud = pud_offset(pgd, addr);
270 pmd_t *pmd = pmd_offset(pud, addr); 282 pmd_t *pmd = pmd_offset(pud, addr);
271 283
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 1aecc658cd7d..59898fb0a4aa 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -494,11 +494,13 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
494 int i; 494 int i;
495 495
496 nodes_clear(node_possible_map); 496 nodes_clear(node_possible_map);
497 nodes_clear(node_online_map);
497 498
498#ifdef CONFIG_NUMA_EMU 499#ifdef CONFIG_NUMA_EMU
499 if (cmdline && !numa_emulation(start_pfn, end_pfn)) 500 if (cmdline && !numa_emulation(start_pfn, end_pfn))
500 return; 501 return;
501 nodes_clear(node_possible_map); 502 nodes_clear(node_possible_map);
503 nodes_clear(node_online_map);
502#endif 504#endif
503 505
504#ifdef CONFIG_ACPI_NUMA 506#ifdef CONFIG_ACPI_NUMA
@@ -506,6 +508,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
506 end_pfn << PAGE_SHIFT)) 508 end_pfn << PAGE_SHIFT))
507 return; 509 return;
508 nodes_clear(node_possible_map); 510 nodes_clear(node_possible_map);
511 nodes_clear(node_online_map);
509#endif 512#endif
510 513
511#ifdef CONFIG_K8_NUMA 514#ifdef CONFIG_K8_NUMA
@@ -513,6 +516,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
513 end_pfn<<PAGE_SHIFT)) 516 end_pfn<<PAGE_SHIFT))
514 return; 517 return;
515 nodes_clear(node_possible_map); 518 nodes_clear(node_possible_map);
519 nodes_clear(node_online_map);
516#endif 520#endif
517 printk(KERN_INFO "%s\n", 521 printk(KERN_INFO "%s\n",
518 numa_off ? "NUMA turned off" : "No NUMA configuration found"); 522 numa_off ? "NUMA turned off" : "No NUMA configuration found");
@@ -524,7 +528,6 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
524 memnode_shift = 63; 528 memnode_shift = 63;
525 memnodemap = memnode.embedded_map; 529 memnodemap = memnode.embedded_map;
526 memnodemap[0] = 0; 530 memnodemap[0] = 0;
527 nodes_clear(node_online_map);
528 node_set_online(0); 531 node_set_online(0);
529 node_set(0, node_possible_map); 532 node_set(0, node_possible_map);
530 for (i = 0; i < NR_CPUS; i++) 533 for (i = 0; i < NR_CPUS; i++)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 440210a2277d..464d8fc21ce6 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -16,6 +16,7 @@
16#include <asm/sections.h> 16#include <asm/sections.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/pgalloc.h> 18#include <asm/pgalloc.h>
19#include <asm/proto.h>
19 20
20/* 21/*
21 * The current flushing context - we pass it instead of 5 arguments: 22 * The current flushing context - we pass it instead of 5 arguments:
@@ -26,8 +27,23 @@ struct cpa_data {
26 pgprot_t mask_clr; 27 pgprot_t mask_clr;
27 int numpages; 28 int numpages;
28 int flushtlb; 29 int flushtlb;
30 unsigned long pfn;
29}; 31};
30 32
33#ifdef CONFIG_X86_64
34
35static inline unsigned long highmap_start_pfn(void)
36{
37 return __pa(_text) >> PAGE_SHIFT;
38}
39
40static inline unsigned long highmap_end_pfn(void)
41{
42 return __pa(round_up((unsigned long)_end, PMD_SIZE)) >> PAGE_SHIFT;
43}
44
45#endif
46
31static inline int 47static inline int
32within(unsigned long addr, unsigned long start, unsigned long end) 48within(unsigned long addr, unsigned long start, unsigned long end)
33{ 49{
@@ -123,29 +139,14 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
123 } 139 }
124} 140}
125 141
126#define HIGH_MAP_START __START_KERNEL_map
127#define HIGH_MAP_END (__START_KERNEL_map + KERNEL_TEXT_SIZE)
128
129
130/*
131 * Converts a virtual address to a X86-64 highmap address
132 */
133static unsigned long virt_to_highmap(void *address)
134{
135#ifdef CONFIG_X86_64
136 return __pa((unsigned long)address) + HIGH_MAP_START - phys_base;
137#else
138 return (unsigned long)address;
139#endif
140}
141
142/* 142/*
143 * Certain areas of memory on x86 require very specific protection flags, 143 * Certain areas of memory on x86 require very specific protection flags,
144 * for example the BIOS area or kernel text. Callers don't always get this 144 * for example the BIOS area or kernel text. Callers don't always get this
145 * right (again, ioremap() on BIOS memory is not uncommon) so this function 145 * right (again, ioremap() on BIOS memory is not uncommon) so this function
146 * checks and fixes these known static required protection bits. 146 * checks and fixes these known static required protection bits.
147 */ 147 */
148static inline pgprot_t static_protections(pgprot_t prot, unsigned long address) 148static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
149 unsigned long pfn)
149{ 150{
150 pgprot_t forbidden = __pgprot(0); 151 pgprot_t forbidden = __pgprot(0);
151 152
@@ -153,30 +154,23 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address)
153 * The BIOS area between 640k and 1Mb needs to be executable for 154 * The BIOS area between 640k and 1Mb needs to be executable for
154 * PCI BIOS based config access (CONFIG_PCI_GOBIOS) support. 155 * PCI BIOS based config access (CONFIG_PCI_GOBIOS) support.
155 */ 156 */
156 if (within(__pa(address), BIOS_BEGIN, BIOS_END)) 157 if (within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
157 pgprot_val(forbidden) |= _PAGE_NX; 158 pgprot_val(forbidden) |= _PAGE_NX;
158 159
159 /* 160 /*
160 * The kernel text needs to be executable for obvious reasons 161 * The kernel text needs to be executable for obvious reasons
161 * Does not cover __inittext since that is gone later on 162 * Does not cover __inittext since that is gone later on. On
163 * 64bit we do not enforce !NX on the low mapping
162 */ 164 */
163 if (within(address, (unsigned long)_text, (unsigned long)_etext)) 165 if (within(address, (unsigned long)_text, (unsigned long)_etext))
164 pgprot_val(forbidden) |= _PAGE_NX; 166 pgprot_val(forbidden) |= _PAGE_NX;
165 /*
166 * Do the same for the x86-64 high kernel mapping
167 */
168 if (within(address, virt_to_highmap(_text), virt_to_highmap(_etext)))
169 pgprot_val(forbidden) |= _PAGE_NX;
170 167
171 /* The .rodata section needs to be read-only */
172 if (within(address, (unsigned long)__start_rodata,
173 (unsigned long)__end_rodata))
174 pgprot_val(forbidden) |= _PAGE_RW;
175 /* 168 /*
176 * Do the same for the x86-64 high kernel mapping 169 * The .rodata section needs to be read-only. Using the pfn
170 * catches all aliases.
177 */ 171 */
178 if (within(address, virt_to_highmap(__start_rodata), 172 if (within(pfn, __pa((unsigned long)__start_rodata) >> PAGE_SHIFT,
179 virt_to_highmap(__end_rodata))) 173 __pa((unsigned long)__end_rodata) >> PAGE_SHIFT))
180 pgprot_val(forbidden) |= _PAGE_RW; 174 pgprot_val(forbidden) |= _PAGE_RW;
181 175
182 prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden)); 176 prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden));
@@ -253,7 +247,7 @@ static int
253try_preserve_large_page(pte_t *kpte, unsigned long address, 247try_preserve_large_page(pte_t *kpte, unsigned long address,
254 struct cpa_data *cpa) 248 struct cpa_data *cpa)
255{ 249{
256 unsigned long nextpage_addr, numpages, pmask, psize, flags, addr; 250 unsigned long nextpage_addr, numpages, pmask, psize, flags, addr, pfn;
257 pte_t new_pte, old_pte, *tmp; 251 pte_t new_pte, old_pte, *tmp;
258 pgprot_t old_prot, new_prot; 252 pgprot_t old_prot, new_prot;
259 int i, do_split = 1; 253 int i, do_split = 1;
@@ -275,8 +269,8 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
275 break; 269 break;
276#ifdef CONFIG_X86_64 270#ifdef CONFIG_X86_64
277 case PG_LEVEL_1G: 271 case PG_LEVEL_1G:
278 psize = PMD_PAGE_SIZE; 272 psize = PUD_PAGE_SIZE;
279 pmask = PMD_PAGE_MASK; 273 pmask = PUD_PAGE_MASK;
280 break; 274 break;
281#endif 275#endif
282 default: 276 default:
@@ -301,7 +295,15 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
301 295
302 pgprot_val(new_prot) &= ~pgprot_val(cpa->mask_clr); 296 pgprot_val(new_prot) &= ~pgprot_val(cpa->mask_clr);
303 pgprot_val(new_prot) |= pgprot_val(cpa->mask_set); 297 pgprot_val(new_prot) |= pgprot_val(cpa->mask_set);
304 new_prot = static_protections(new_prot, address); 298
299 /*
300 * old_pte points to the large page base address. So we need
301 * to add the offset of the virtual address:
302 */
303 pfn = pte_pfn(old_pte) + ((address & (psize - 1)) >> PAGE_SHIFT);
304 cpa->pfn = pfn;
305
306 new_prot = static_protections(new_prot, address, pfn);
305 307
306 /* 308 /*
307 * We need to check the full range, whether 309 * We need to check the full range, whether
@@ -309,8 +311,9 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
309 * the pages in the range we try to preserve: 311 * the pages in the range we try to preserve:
310 */ 312 */
311 addr = address + PAGE_SIZE; 313 addr = address + PAGE_SIZE;
312 for (i = 1; i < cpa->numpages; i++, addr += PAGE_SIZE) { 314 pfn++;
313 pgprot_t chk_prot = static_protections(new_prot, addr); 315 for (i = 1; i < cpa->numpages; i++, addr += PAGE_SIZE, pfn++) {
316 pgprot_t chk_prot = static_protections(new_prot, addr, pfn);
314 317
315 if (pgprot_val(chk_prot) != pgprot_val(new_prot)) 318 if (pgprot_val(chk_prot) != pgprot_val(new_prot))
316 goto out_unlock; 319 goto out_unlock;
@@ -505,46 +508,46 @@ out_unlock:
505 return 0; 508 return 0;
506} 509}
507 510
508static int __change_page_attr(unsigned long address, struct cpa_data *cpa) 511static int __change_page_attr(struct cpa_data *cpa, int primary)
509{ 512{
513 unsigned long address = cpa->vaddr;
510 int do_split, err; 514 int do_split, err;
511 unsigned int level; 515 unsigned int level;
512 struct page *kpte_page; 516 pte_t *kpte, old_pte;
513 pte_t *kpte;
514 517
515repeat: 518repeat:
516 kpte = lookup_address(address, &level); 519 kpte = lookup_address(address, &level);
517 if (!kpte) 520 if (!kpte)
518 return -EINVAL; 521 return primary ? -EINVAL : 0;
519 522
520 kpte_page = virt_to_page(kpte); 523 old_pte = *kpte;
521 BUG_ON(PageLRU(kpte_page)); 524 if (!pte_val(old_pte)) {
522 BUG_ON(PageCompound(kpte_page)); 525 if (!primary)
526 return 0;
527 printk(KERN_WARNING "CPA: called for zero pte. "
528 "vaddr = %lx cpa->vaddr = %lx\n", address,
529 cpa->vaddr);
530 WARN_ON(1);
531 return -EINVAL;
532 }
523 533
524 if (level == PG_LEVEL_4K) { 534 if (level == PG_LEVEL_4K) {
525 pte_t new_pte, old_pte = *kpte; 535 pte_t new_pte;
526 pgprot_t new_prot = pte_pgprot(old_pte); 536 pgprot_t new_prot = pte_pgprot(old_pte);
527 537 unsigned long pfn = pte_pfn(old_pte);
528 if(!pte_val(old_pte)) {
529 printk(KERN_WARNING "CPA: called for zero pte. "
530 "vaddr = %lx cpa->vaddr = %lx\n", address,
531 cpa->vaddr);
532 WARN_ON(1);
533 return -EINVAL;
534 }
535 538
536 pgprot_val(new_prot) &= ~pgprot_val(cpa->mask_clr); 539 pgprot_val(new_prot) &= ~pgprot_val(cpa->mask_clr);
537 pgprot_val(new_prot) |= pgprot_val(cpa->mask_set); 540 pgprot_val(new_prot) |= pgprot_val(cpa->mask_set);
538 541
539 new_prot = static_protections(new_prot, address); 542 new_prot = static_protections(new_prot, address, pfn);
540 543
541 /* 544 /*
542 * We need to keep the pfn from the existing PTE, 545 * We need to keep the pfn from the existing PTE,
543 * after all we're only going to change it's attributes 546 * after all we're only going to change it's attributes
544 * not the memory it points to 547 * not the memory it points to
545 */ 548 */
546 new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot)); 549 new_pte = pfn_pte(pfn, canon_pgprot(new_prot));
547 550 cpa->pfn = pfn;
548 /* 551 /*
549 * Do we really change anything ? 552 * Do we really change anything ?
550 */ 553 */
@@ -581,67 +584,59 @@ repeat:
581 return err; 584 return err;
582} 585}
583 586
584/** 587static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias);
585 * change_page_attr_addr - Change page table attributes in linear mapping 588
586 * @address: Virtual address in linear mapping. 589static int cpa_process_alias(struct cpa_data *cpa)
587 * @prot: New page table attribute (PAGE_*)
588 *
589 * Change page attributes of a page in the direct mapping. This is a variant
590 * of change_page_attr() that also works on memory holes that do not have
591 * mem_map entry (pfn_valid() is false).
592 *
593 * See change_page_attr() documentation for more details.
594 *
595 * Modules and drivers should use the set_memory_* APIs instead.
596 */
597static int change_page_attr_addr(struct cpa_data *cpa)
598{ 590{
599 int err; 591 struct cpa_data alias_cpa;
600 unsigned long address = cpa->vaddr; 592 int ret = 0;
601 593
602#ifdef CONFIG_X86_64 594 if (cpa->pfn > max_pfn_mapped)
603 unsigned long phys_addr = __pa(address); 595 return 0;
604 596
605 /* 597 /*
606 * If we are inside the high mapped kernel range, then we 598 * No need to redo, when the primary call touched the direct
607 * fixup the low mapping first. __va() returns the virtual 599 * mapping already:
608 * address in the linear mapping:
609 */ 600 */
610 if (within(address, HIGH_MAP_START, HIGH_MAP_END)) 601 if (!within(cpa->vaddr, PAGE_OFFSET,
611 address = (unsigned long) __va(phys_addr); 602 PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))) {
612#endif
613 603
614 err = __change_page_attr(address, cpa); 604 alias_cpa = *cpa;
615 if (err) 605 alias_cpa.vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT);
616 return err; 606
607 ret = __change_page_attr_set_clr(&alias_cpa, 0);
608 }
617 609
618#ifdef CONFIG_X86_64 610#ifdef CONFIG_X86_64
611 if (ret)
612 return ret;
613 /*
614 * No need to redo, when the primary call touched the high
615 * mapping already:
616 */
617 if (within(cpa->vaddr, (unsigned long) _text, (unsigned long) _end))
618 return 0;
619
619 /* 620 /*
620 * If the physical address is inside the kernel map, we need 621 * If the physical address is inside the kernel map, we need
621 * to touch the high mapped kernel as well: 622 * to touch the high mapped kernel as well:
622 */ 623 */
623 if (within(phys_addr, 0, KERNEL_TEXT_SIZE)) { 624 if (!within(cpa->pfn, highmap_start_pfn(), highmap_end_pfn()))
624 /* 625 return 0;
625 * Calc the high mapping address. See __phys_addr()
626 * for the non obvious details.
627 *
628 * Note that NX and other required permissions are
629 * checked in static_protections().
630 */
631 address = phys_addr + HIGH_MAP_START - phys_base;
632 626
633 /* 627 alias_cpa = *cpa;
634 * Our high aliases are imprecise, because we check 628 alias_cpa.vaddr =
635 * everything between 0 and KERNEL_TEXT_SIZE, so do 629 (cpa->pfn << PAGE_SHIFT) + __START_KERNEL_map - phys_base;
636 * not propagate lookup failures back to users: 630
637 */ 631 /*
638 __change_page_attr(address, cpa); 632 * The high mapping range is imprecise, so ignore the return value.
639 } 633 */
634 __change_page_attr_set_clr(&alias_cpa, 0);
640#endif 635#endif
641 return err; 636 return ret;
642} 637}
643 638
644static int __change_page_attr_set_clr(struct cpa_data *cpa) 639static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
645{ 640{
646 int ret, numpages = cpa->numpages; 641 int ret, numpages = cpa->numpages;
647 642
@@ -651,10 +646,17 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa)
651 * preservation check. 646 * preservation check.
652 */ 647 */
653 cpa->numpages = numpages; 648 cpa->numpages = numpages;
654 ret = change_page_attr_addr(cpa); 649
650 ret = __change_page_attr(cpa, checkalias);
655 if (ret) 651 if (ret)
656 return ret; 652 return ret;
657 653
654 if (checkalias) {
655 ret = cpa_process_alias(cpa);
656 if (ret)
657 return ret;
658 }
659
658 /* 660 /*
659 * Adjust the number of pages with the result of the 661 * Adjust the number of pages with the result of the
660 * CPA operation. Either a large page has been 662 * CPA operation. Either a large page has been
@@ -677,7 +679,7 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
677 pgprot_t mask_set, pgprot_t mask_clr) 679 pgprot_t mask_set, pgprot_t mask_clr)
678{ 680{
679 struct cpa_data cpa; 681 struct cpa_data cpa;
680 int ret, cache; 682 int ret, cache, checkalias;
681 683
682 /* 684 /*
683 * Check, if we are requested to change a not supported 685 * Check, if we are requested to change a not supported
@@ -688,13 +690,25 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
688 if (!pgprot_val(mask_set) && !pgprot_val(mask_clr)) 690 if (!pgprot_val(mask_set) && !pgprot_val(mask_clr))
689 return 0; 691 return 0;
690 692
693 /* Ensure we are PAGE_SIZE aligned */
694 if (addr & ~PAGE_MASK) {
695 addr &= PAGE_MASK;
696 /*
697 * People should not be passing in unaligned addresses:
698 */
699 WARN_ON_ONCE(1);
700 }
701
691 cpa.vaddr = addr; 702 cpa.vaddr = addr;
692 cpa.numpages = numpages; 703 cpa.numpages = numpages;
693 cpa.mask_set = mask_set; 704 cpa.mask_set = mask_set;
694 cpa.mask_clr = mask_clr; 705 cpa.mask_clr = mask_clr;
695 cpa.flushtlb = 0; 706 cpa.flushtlb = 0;
696 707
697 ret = __change_page_attr_set_clr(&cpa); 708 /* No alias checking for _NX bit modifications */
709 checkalias = (pgprot_val(mask_set) | pgprot_val(mask_clr)) != _PAGE_NX;
710
711 ret = __change_page_attr_set_clr(&cpa, checkalias);
698 712
699 /* 713 /*
700 * Check whether we really changed something: 714 * Check whether we really changed something:
@@ -832,7 +846,7 @@ static int __set_pages_p(struct page *page, int numpages)
832 .mask_set = __pgprot(_PAGE_PRESENT | _PAGE_RW), 846 .mask_set = __pgprot(_PAGE_PRESENT | _PAGE_RW),
833 .mask_clr = __pgprot(0)}; 847 .mask_clr = __pgprot(0)};
834 848
835 return __change_page_attr_set_clr(&cpa); 849 return __change_page_attr_set_clr(&cpa, 1);
836} 850}
837 851
838static int __set_pages_np(struct page *page, int numpages) 852static int __set_pages_np(struct page *page, int numpages)
@@ -842,7 +856,7 @@ static int __set_pages_np(struct page *page, int numpages)
842 .mask_set = __pgprot(0), 856 .mask_set = __pgprot(0),
843 .mask_clr = __pgprot(_PAGE_PRESENT | _PAGE_RW)}; 857 .mask_clr = __pgprot(_PAGE_PRESENT | _PAGE_RW)};
844 858
845 return __change_page_attr_set_clr(&cpa); 859 return __change_page_attr_set_clr(&cpa, 1);
846} 860}
847 861
848void kernel_map_pages(struct page *page, int numpages, int enable) 862void kernel_map_pages(struct page *page, int numpages, int enable)
@@ -861,8 +875,12 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
861 return; 875 return;
862 876
863 /* 877 /*
864 * The return value is ignored - the calls cannot fail, 878 * The return value is ignored as the calls cannot fail.
865 * large pages are disabled at boot time: 879 * Large pages are kept enabled at boot time, and are
880 * split up quickly with DEBUG_PAGEALLOC. If a splitup
881 * fails here (due to temporary memory shortage) no damage
882 * is done because we just keep the largepage intact up
883 * to the next attempt when it will likely be split up:
866 */ 884 */
867 if (enable) 885 if (enable)
868 __set_pages_p(page, numpages); 886 __set_pages_p(page, numpages);
@@ -881,7 +899,24 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
881 */ 899 */
882 cpa_fill_pool(); 900 cpa_fill_pool();
883} 901}
884#endif 902
903#ifdef CONFIG_HIBERNATION
904
905bool kernel_page_present(struct page *page)
906{
907 unsigned int level;
908 pte_t *pte;
909
910 if (PageHighMem(page))
911 return false;
912
913 pte = lookup_address((unsigned long)page_address(page), &level);
914 return (pte_val(*pte) & _PAGE_PRESENT);
915}
916
917#endif /* CONFIG_HIBERNATION */
918
919#endif /* CONFIG_DEBUG_PAGEALLOC */
885 920
886/* 921/*
887 * The testcases use internal knowledge of the implementation that shouldn't 922 * The testcases use internal knowledge of the implementation that shouldn't
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index ecd91ea8a8ae..845001c617cc 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -166,7 +166,8 @@ static inline int save_add_info(void) {return 0;}
166 * Both SPARSE and RESERVE need nodes_add information. 166 * Both SPARSE and RESERVE need nodes_add information.
167 * This code supports one contiguous hot add area per node. 167 * This code supports one contiguous hot add area per node.
168 */ 168 */
169static int reserve_hotadd(int node, unsigned long start, unsigned long end) 169static int __init
170reserve_hotadd(int node, unsigned long start, unsigned long end)
170{ 171{
171 unsigned long s_pfn = start >> PAGE_SHIFT; 172 unsigned long s_pfn = start >> PAGE_SHIFT;
172 unsigned long e_pfn = end >> PAGE_SHIFT; 173 unsigned long e_pfn = end >> PAGE_SHIFT;
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index b7c67a187b6b..7b6e3bb9b28c 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -541,7 +541,7 @@ void pcibios_disable_device (struct pci_dev *dev)
541 pcibios_disable_irq(dev); 541 pcibios_disable_irq(dev);
542} 542}
543 543
544struct pci_bus *pci_scan_bus_with_sysdata(int busno) 544struct pci_bus *__devinit pci_scan_bus_with_sysdata(int busno)
545{ 545{
546 struct pci_bus *bus = NULL; 546 struct pci_bus *bus = NULL;
547 struct pci_sysdata *sd; 547 struct pci_sysdata *sd;
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index ed07ce6c171b..a8715861877e 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -583,6 +583,10 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
583 case PCI_DEVICE_ID_INTEL_ICH9_4: 583 case PCI_DEVICE_ID_INTEL_ICH9_4:
584 case PCI_DEVICE_ID_INTEL_ICH9_5: 584 case PCI_DEVICE_ID_INTEL_ICH9_5:
585 case PCI_DEVICE_ID_INTEL_TOLAPAI_0: 585 case PCI_DEVICE_ID_INTEL_TOLAPAI_0:
586 case PCI_DEVICE_ID_INTEL_ICH10_0:
587 case PCI_DEVICE_ID_INTEL_ICH10_1:
588 case PCI_DEVICE_ID_INTEL_ICH10_2:
589 case PCI_DEVICE_ID_INTEL_ICH10_3:
586 r->name = "PIIX/ICH"; 590 r->name = "PIIX/ICH";
587 r->get = pirq_piix_get; 591 r->get = pirq_piix_get;
588 r->set = pirq_piix_set; 592 r->set = pirq_piix_set;
diff --git a/arch/x86/power/hibernate_asm_64.S b/arch/x86/power/hibernate_asm_64.S
index 1deb3244b99b..000415947d93 100644
--- a/arch/x86/power/hibernate_asm_64.S
+++ b/arch/x86/power/hibernate_asm_64.S
@@ -20,6 +20,7 @@
20#include <asm/segment.h> 20#include <asm/segment.h>
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/asm-offsets.h> 22#include <asm/asm-offsets.h>
23#include <asm/processor-flags.h>
23 24
24ENTRY(swsusp_arch_suspend) 25ENTRY(swsusp_arch_suspend)
25 movq $saved_context, %rax 26 movq $saved_context, %rax
@@ -60,7 +61,7 @@ ENTRY(restore_image)
60 /* Flush TLB */ 61 /* Flush TLB */
61 movq mmu_cr4_features(%rip), %rax 62 movq mmu_cr4_features(%rip), %rax
62 movq %rax, %rdx 63 movq %rax, %rdx
63 andq $~(1<<7), %rdx # PGE 64 andq $~(X86_CR4_PGE), %rdx
64 movq %rdx, %cr4; # turn off PGE 65 movq %rdx, %cr4; # turn off PGE
65 movq %cr3, %rcx; # flush TLB 66 movq %cr3, %rcx; # flush TLB
66 movq %rcx, %cr3; 67 movq %rcx, %cr3;
@@ -112,7 +113,7 @@ ENTRY(restore_registers)
112 /* Flush TLB, including "global" things (vmalloc) */ 113 /* Flush TLB, including "global" things (vmalloc) */
113 movq mmu_cr4_features(%rip), %rax 114 movq mmu_cr4_features(%rip), %rax
114 movq %rax, %rdx 115 movq %rax, %rdx
115 andq $~(1<<7), %rdx; # PGE 116 andq $~(X86_CR4_PGE), %rdx
116 movq %rdx, %cr4; # turn off PGE 117 movq %rdx, %cr4; # turn off PGE
117 movq %cr3, %rcx; # flush TLB 118 movq %cr3, %rcx; # flush TLB
118 movq %rcx, %cr3 119 movq %rcx, %cr3
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index de647bc6e74d..49e5358f481a 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -798,6 +798,10 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
798 * added to the table can be prepared properly for Xen. 798 * added to the table can be prepared properly for Xen.
799 */ 799 */
800 xen_write_cr3(__pa(base)); 800 xen_write_cr3(__pa(base));
801
802 /* Unpin initial Xen pagetable */
803 pin_pagetable_pfn(MMUEXT_UNPIN_TABLE,
804 PFN_DOWN(__pa(xen_start_info->pt_base)));
801} 805}
802 806
803static __init void xen_pagetable_setup_done(pgd_t *base) 807static __init void xen_pagetable_setup_done(pgd_t *base)
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 56685a883347..4bd1e14c6b90 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -59,7 +59,7 @@ LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
59head-y := arch/xtensa/kernel/head.o 59head-y := arch/xtensa/kernel/head.o
60core-y += arch/xtensa/kernel/ arch/xtensa/mm/ 60core-y += arch/xtensa/kernel/ arch/xtensa/mm/
61ifneq ($(PLATFORM),) 61ifneq ($(PLATFORM),)
62core-y += arch/xtensa/platform-$(PLATFORM)/ 62core-y += arch/xtensa/platforms/$(PLATFORM)/
63endif 63endif
64libs-y += arch/xtensa/lib/ $(LIBGCC) 64libs-y += arch/xtensa/lib/ $(LIBGCC)
65 65
diff --git a/arch/xtensa/boot/boot-elf/Makefile b/arch/xtensa/boot/boot-elf/Makefile
index 734db7f76583..08e8814f8c71 100644
--- a/arch/xtensa/boot/boot-elf/Makefile
+++ b/arch/xtensa/boot/boot-elf/Makefile
@@ -14,25 +14,26 @@ OBJCOPY_ARGS := -O elf32-xtensa-le
14endif 14endif
15 15
16export OBJCOPY_ARGS 16export OBJCOPY_ARGS
17export CPPFLAGS_boot.lds += -P -C
17 18
18boot-y := bootstrap.o 19boot-y := bootstrap.o
19 20
20OBJS := $(addprefix $(obj)/,$(boot-y)) 21OBJS := $(addprefix $(obj)/,$(boot-y))
21 22
22Image: vmlinux $(OBJS) 23Image: vmlinux $(OBJS) arch/$(ARCH)/boot/boot-elf/boot.lds
23 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ 24 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
24 vmlinux vmlinux.tmp 25 vmlinux vmlinux.tmp
25 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ 26 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
26 --add-section image=vmlinux.tmp \ 27 --add-section image=vmlinux.tmp \
27 --set-section-flags image=contents,alloc,load,load,data \ 28 --set-section-flags image=contents,alloc,load,load,data \
28 $(OBJS) $@.tmp 29 $(OBJS) $@.tmp
29 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ 30 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
30 -T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \ 31 -T arch/$(ARCH)/boot/boot-elf/boot.lds \
31 -o arch/$(ARCH)/boot/$@.elf $@.tmp 32 -o arch/$(ARCH)/boot/$@.elf $@.tmp
32 rm -f $@.tmp vmlinux.tmp 33 rm -f $@.tmp vmlinux.tmp
33 34
34Image.initrd: vmlinux $(OBJS) 35Image.initrd: vmlinux $(OBJS)
35 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ 36 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
36 --add-section .initrd=arch/$(ARCH)/boot/ramdisk \ 37 --add-section .initrd=arch/$(ARCH)/boot/ramdisk \
37 --set-section-flags .initrd=contents,alloc,load,load,data \ 38 --set-section-flags .initrd=contents,alloc,load,load,data \
38 vmlinux vmlinux.tmp 39 vmlinux vmlinux.tmp
diff --git a/arch/xtensa/boot/boot-elf/boot.ld b/arch/xtensa/boot/boot-elf/boot.lds.S
index 4ab06a0a7a6b..849dfcafd518 100644
--- a/arch/xtensa/boot/boot-elf/boot.ld
+++ b/arch/xtensa/boot/boot-elf/boot.lds.S
@@ -1,4 +1,6 @@
1#include <asm/variant/core.h>
1OUTPUT_ARCH(xtensa) 2OUTPUT_ARCH(xtensa)
3ENTRY(_ResetVector)
2 4
3SECTIONS 5SECTIONS
4{ 6{
@@ -61,7 +63,7 @@ SECTIONS
61 _end = .; 63 _end = .;
62 _param_start = .; 64 _param_start = .;
63 65
64 .ResetVector.text 0xfe000020 : 66 .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
65 { 67 {
66 *(.ResetVector.text) 68 *(.ResetVector.text)
67 } 69 }
diff --git a/arch/xtensa/boot/boot-redboot/Makefile b/arch/xtensa/boot/boot-redboot/Makefile
index 74d15d08077b..872029b84435 100644
--- a/arch/xtensa/boot/boot-redboot/Makefile
+++ b/arch/xtensa/boot/boot-redboot/Makefile
@@ -22,7 +22,7 @@ LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
22LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 22LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
23 23
24zImage: vmlinux $(OBJS) $(LIBS) 24zImage: vmlinux $(OBJS) $(LIBS)
25 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ 25 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
26 vmlinux vmlinux.tmp 26 vmlinux vmlinux.tmp
27 gzip -vf9 vmlinux.tmp 27 gzip -vf9 vmlinux.tmp
28 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ 28 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
diff --git a/arch/xtensa/boot/boot-redboot/boot.ld b/arch/xtensa/boot/boot-redboot/boot.ld
index 65b726410e8a..774db20d11f7 100644
--- a/arch/xtensa/boot/boot-redboot/boot.ld
+++ b/arch/xtensa/boot/boot-redboot/boot.ld
@@ -2,7 +2,7 @@ OUTPUT_ARCH(xtensa)
2 2
3SECTIONS 3SECTIONS
4{ 4{
5 .start 0xD0200000 : { *(.start) } 5 .start 0xD1000000 : { *(.start) }
6 6
7 .text : 7 .text :
8 { 8 {
diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c
index d5ffe7b6443e..ef63adadf7f4 100644
--- a/arch/xtensa/kernel/asm-offsets.c
+++ b/arch/xtensa/kernel/asm-offsets.c
@@ -21,7 +21,6 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22 22
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/processor.h>
25#include <asm/uaccess.h> 24#include <asm/uaccess.h>
26 25
27#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 26#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -64,6 +63,8 @@ int main(void)
64 DEFINE(PT_SIZE, sizeof(struct pt_regs)); 63 DEFINE(PT_SIZE, sizeof(struct pt_regs));
65 DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS])); 64 DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS]));
66 DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS])); 65 DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS]));
66 DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt));
67 DEFINE(XTREGS_OPT_SIZE, sizeof(xtregs_opt_t));
67 68
68 /* struct task_struct */ 69 /* struct task_struct */
69 DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace)); 70 DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace));
@@ -77,7 +78,19 @@ int main(void)
77 /* struct thread_info (offset from start_struct) */ 78 /* struct thread_info (offset from start_struct) */
78 DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra)); 79 DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra));
79 DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp)); 80 DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp));
80 DEFINE(THREAD_CP_SAVE, offsetof (struct task_struct, thread.cp_save)); 81 DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable));
82#if XTENSA_HAVE_COPROCESSORS
83 DEFINE(THREAD_XTREGS_CP0, offsetof (struct thread_info, xtregs_cp));
84 DEFINE(THREAD_XTREGS_CP1, offsetof (struct thread_info, xtregs_cp));
85 DEFINE(THREAD_XTREGS_CP2, offsetof (struct thread_info, xtregs_cp));
86 DEFINE(THREAD_XTREGS_CP3, offsetof (struct thread_info, xtregs_cp));
87 DEFINE(THREAD_XTREGS_CP4, offsetof (struct thread_info, xtregs_cp));
88 DEFINE(THREAD_XTREGS_CP5, offsetof (struct thread_info, xtregs_cp));
89 DEFINE(THREAD_XTREGS_CP6, offsetof (struct thread_info, xtregs_cp));
90 DEFINE(THREAD_XTREGS_CP7, offsetof (struct thread_info, xtregs_cp));
91#endif
92 DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user));
93 DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t));
81 DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, thread.current_ds)); 94 DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, thread.current_ds));
82 95
83 /* struct mm_struct */ 96 /* struct mm_struct */
diff --git a/arch/xtensa/kernel/coprocessor.S b/arch/xtensa/kernel/coprocessor.S
index 01bcb9fcfcbd..2bc1e145c0a4 100644
--- a/arch/xtensa/kernel/coprocessor.S
+++ b/arch/xtensa/kernel/coprocessor.S
@@ -8,193 +8,328 @@
8 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 9 * for more details.
10 * 10 *
11 * Copyright (C) 2003 - 2005 Tensilica Inc. 11 * Copyright (C) 2003 - 2007 Tensilica Inc.
12 *
13 * Marc Gauthier <marc@tensilica.com> <marc@alumni.uwaterloo.ca>
14 */ 12 */
15 13
16/*
17 * This module contains a table that describes the layout of the various
18 * custom registers and states associated with each coprocessor, as well
19 * as those not associated with any coprocessor ("extra state").
20 * This table is included with core dumps and is available via the ptrace
21 * interface, allowing the layout of such register/state information to
22 * be modified in the kernel without affecting the debugger. Each
23 * register or state is identified using a 32-bit "libdb target number"
24 * assigned when the Xtensa processor is generated.
25 */
26 14
27#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <asm/asm-offsets.h>
28#include <asm/processor.h> 17#include <asm/processor.h>
18#include <asm/coprocessor.h>
19#include <asm/thread_info.h>
20#include <asm/uaccess.h>
21#include <asm/unistd.h>
22#include <asm/ptrace.h>
23#include <asm/current.h>
24#include <asm/pgtable.h>
25#include <asm/page.h>
26#include <asm/signal.h>
27#include <asm/tlbflush.h>
29 28
30#if XCHAL_HAVE_CP 29/*
30 * Entry condition:
31 *
32 * a0: trashed, original value saved on stack (PT_AREG0)
33 * a1: a1
34 * a2: new stack pointer, original in DEPC
35 * a3: dispatch table
36 * depc: a2, original value saved on stack (PT_DEPC)
37 * excsave_1: a3
38 *
39 * PT_DEPC >= VALID_DOUBLE_EXCEPTION_ADDRESS: double exception, DEPC
40 * < VALID_DOUBLE_EXCEPTION_ADDRESS: regular exception
41 */
31 42
32#define CP_LAST ((XCHAL_CP_MAX - 1) * COPROCESSOR_INFO_SIZE) 43/* IO protection is currently unsupported. */
33 44
34ENTRY(release_coprocessors) 45ENTRY(fast_io_protect)
46 wsr a0, EXCSAVE_1
47 movi a0, unrecoverable_exception
48 callx0 a0
35 49
36 entry a1, 16 50#if XTENSA_HAVE_COPROCESSORS
37 # a2: task
38 movi a3, 1 << XCHAL_CP_MAX # a3: coprocessor-bit
39 movi a4, coprocessor_info+CP_LAST # a4: owner-table
40 # a5: tmp
41 movi a6, 0 # a6: 0
42 rsil a7, LOCKLEVEL # a7: PS
43 51
441: /* Check if task is coprocessor owner of coprocessor[i]. */ 52/*
53 * Macros for lazy context switch.
54 */
45 55
46 l32i a5, a4, COPROCESSOR_INFO_OWNER 56#define SAVE_CP_REGS(x) \
47 srli a3, a3, 1 57 .align 4; \
48 beqz a3, 1f 58 .Lsave_cp_regs_cp##x: \
49 addi a4, a4, -8 59 .if XTENSA_HAVE_COPROCESSOR(x); \
50 beq a2, a5, 1b 60 xchal_cp##x##_store a2 a4 a5 a6 a7; \
61 .endif; \
62 jx a0
51 63
52 /* Found an entry: Clear entry CPENABLE bit to disable CP. */ 64#define SAVE_CP_REGS_TAB(x) \
65 .if XTENSA_HAVE_COPROCESSOR(x); \
66 .long .Lsave_cp_regs_cp##x - .Lsave_cp_regs_jump_table; \
67 .else; \
68 .long 0; \
69 .endif; \
70 .long THREAD_XTREGS_CP##x
53 71
54 rsr a5, CPENABLE
55 s32i a6, a4, COPROCESSOR_INFO_OWNER
56 xor a5, a3, a5
57 wsr a5, CPENABLE
58 72
59 bnez a3, 1b 73#define LOAD_CP_REGS(x) \
74 .align 4; \
75 .Lload_cp_regs_cp##x: \
76 .if XTENSA_HAVE_COPROCESSOR(x); \
77 xchal_cp##x##_load a2 a4 a5 a6 a7; \
78 .endif; \
79 jx a0
60 80
611: wsr a7, PS 81#define LOAD_CP_REGS_TAB(x) \
62 rsync 82 .if XTENSA_HAVE_COPROCESSOR(x); \
63 retw 83 .long .Lload_cp_regs_cp##x - .Lload_cp_regs_jump_table; \
84 .else; \
85 .long 0; \
86 .endif; \
87 .long THREAD_XTREGS_CP##x
64 88
89 SAVE_CP_REGS(0)
90 SAVE_CP_REGS(1)
91 SAVE_CP_REGS(2)
92 SAVE_CP_REGS(3)
93 SAVE_CP_REGS(4)
94 SAVE_CP_REGS(5)
95 SAVE_CP_REGS(6)
96 SAVE_CP_REGS(7)
65 97
66ENTRY(disable_coprocessor) 98 LOAD_CP_REGS(0)
67 entry sp, 16 99 LOAD_CP_REGS(1)
68 rsil a7, LOCKLEVEL 100 LOAD_CP_REGS(2)
69 rsr a3, CPENABLE 101 LOAD_CP_REGS(3)
70 movi a4, 1 102 LOAD_CP_REGS(4)
71 ssl a2 103 LOAD_CP_REGS(5)
72 sll a4, a4 104 LOAD_CP_REGS(6)
73 and a4, a3, a4 105 LOAD_CP_REGS(7)
74 xor a3, a3, a4
75 wsr a3, CPENABLE
76 wsr a7, PS
77 rsync
78 retw
79 106
80ENTRY(enable_coprocessor) 107 .align 4
81 entry sp, 16 108.Lsave_cp_regs_jump_table:
82 rsil a7, LOCKLEVEL 109 SAVE_CP_REGS_TAB(0)
83 rsr a3, CPENABLE 110 SAVE_CP_REGS_TAB(1)
84 movi a4, 1 111 SAVE_CP_REGS_TAB(2)
85 ssl a2 112 SAVE_CP_REGS_TAB(3)
86 sll a4, a4 113 SAVE_CP_REGS_TAB(4)
87 or a3, a3, a4 114 SAVE_CP_REGS_TAB(5)
88 wsr a3, CPENABLE 115 SAVE_CP_REGS_TAB(6)
89 wsr a7, PS 116 SAVE_CP_REGS_TAB(7)
90 rsync
91 retw
92 117
118.Lload_cp_regs_jump_table:
119 LOAD_CP_REGS_TAB(0)
120 LOAD_CP_REGS_TAB(1)
121 LOAD_CP_REGS_TAB(2)
122 LOAD_CP_REGS_TAB(3)
123 LOAD_CP_REGS_TAB(4)
124 LOAD_CP_REGS_TAB(5)
125 LOAD_CP_REGS_TAB(6)
126 LOAD_CP_REGS_TAB(7)
93 127
94ENTRY(save_coprocessor_extra) 128/*
95 entry sp, 16 129 * coprocessor_save(buffer, index)
96 xchal_extra_store_funcbody 130 * a2 a3
97 retw 131 * coprocessor_load(buffer, index)
132 * a2 a3
133 *
134 * Save or load coprocessor registers for coprocessor 'index'.
135 * The register values are saved to or loaded from them 'buffer' address.
136 *
137 * Note that these functions don't update the coprocessor_owner information!
138 *
139 */
98 140
99ENTRY(restore_coprocessor_extra) 141ENTRY(coprocessor_save)
100 entry sp, 16 142 entry a1, 32
101 xchal_extra_load_funcbody 143 s32i a0, a1, 0
144 movi a0, .Lsave_cp_regs_jump_table
145 addx8 a3, a3, a0
146 l32i a3, a3, 0
147 beqz a3, 1f
148 add a0, a0, a3
149 callx0 a0
1501: l32i a0, a1, 0
102 retw 151 retw
103 152
104ENTRY(save_coprocessor_registers) 153ENTRY(coprocessor_load)
105 entry sp, 16 154 entry a1, 32
106 xchal_cpi_store_funcbody 155 s32i a0, a1, 0
156 movi a0, .Lload_cp_regs_jump_table
157 addx4 a3, a3, a0
158 l32i a3, a3, 0
159 beqz a3, 1f
160 add a0, a0, a3
161 callx0 a0
1621: l32i a0, a1, 0
107 retw 163 retw
108 164
109ENTRY(restore_coprocessor_registers) 165/*
110 entry sp, 16 166 * coprocessor_flush(struct task_info*, index)
111 xchal_cpi_load_funcbody 167 * a2 a3
168 * coprocessor_restore(struct task_info*, index)
169 * a2 a3
170 *
171 * Save or load coprocessor registers for coprocessor 'index'.
172 * The register values are saved to or loaded from the coprocessor area
173 * inside the task_info structure.
174 *
175 * Note that these functions don't update the coprocessor_owner information!
176 *
177 */
178
179
180ENTRY(coprocessor_flush)
181 entry a1, 32
182 s32i a0, a1, 0
183 movi a0, .Lsave_cp_regs_jump_table
184 addx8 a3, a3, a0
185 l32i a4, a3, 4
186 l32i a3, a3, 0
187 add a2, a2, a4
188 beqz a3, 1f
189 add a0, a0, a3
190 callx0 a0
1911: l32i a0, a1, 0
112 retw 192 retw
113 193
194ENTRY(coprocessor_restore)
195 entry a1, 32
196 s32i a0, a1, 0
197 movi a0, .Lload_cp_regs_jump_table
198 addx4 a3, a3, a0
199 l32i a4, a3, 4
200 l32i a3, a3, 0
201 add a2, a2, a4
202 beqz a3, 1f
203 add a0, a0, a3
204 callx0 a0
2051: l32i a0, a1, 0
206 retw
114 207
115/* 208/*
116 * The Xtensa compile-time HAL (core.h) XCHAL_*_SA_CONTENTS_LIBDB macros 209 * Entry condition:
117 * describe the contents of coprocessor & extra save areas in terms of
118 * undefined CONTENTS_LIBDB_{SREG,UREG,REGF} macros. We define these
119 * latter macros here; they expand into a table of the format we want.
120 * The general format is:
121 * 210 *
122 * CONTENTS_LIBDB_SREG(libdbnum, offset, size, align, rsv1, name, sregnum, 211 * a0: trashed, original value saved on stack (PT_AREG0)
123 * bitmask, rsv2, rsv3) 212 * a1: a1
124 * CONTENTS_LIBDB_UREG(libdbnum, offset, size, align, rsv1, name, uregnum, 213 * a2: new stack pointer, original in DEPC
125 * bitmask, rsv2, rsv3) 214 * a3: dispatch table
126 * CONTENTS_LIBDB_REGF(libdbnum, offset, size, align, rsv1, name, index, 215 * depc: a2, original value saved on stack (PT_DEPC)
127 * numentries, contentsize, regname_base, 216 * excsave_1: a3
128 * regfile_name, rsv2, rsv3)
129 * 217 *
130 * For this table, we only care about the <libdbnum>, <offset> and <size> 218 * PT_DEPC >= VALID_DOUBLE_EXCEPTION_ADDRESS: double exception, DEPC
131 * fields. 219 * < VALID_DOUBLE_EXCEPTION_ADDRESS: regular exception
132 */ 220 */
133 221
134/* Map all XCHAL CONTENTS macros to the reg_entry asm macro defined below: */ 222ENTRY(fast_coprocessor_double)
135 223 wsr a0, EXCSAVE_1
136#define CONTENTS_LIBDB_SREG(libdbnum,offset,size,align,rsv1,name,sregnum, \ 224 movi a0, unrecoverable_exception
137 bitmask, rsv2, rsv3) \ 225 callx0 a0
138 reg_entry libdbnum, offset, size ;
139#define CONTENTS_LIBDB_UREG(libdbnum,offset,size,align,rsv1,name,uregnum, \
140 bitmask, rsv2, rsv3) \
141 reg_entry libdbnum, offset, size ;
142#define CONTENTS_LIBDB_REGF(libdbnum, offset, size, align, rsv1, name, index, \
143 numentries, contentsize, regname_base, \
144 regfile_name, rsv2, rsv3) \
145 reg_entry libdbnum, offset, size ;
146
147/* A single table entry: */
148 .macro reg_entry libdbnum, offset, size
149 .ifne (__last_offset-(__last_group_offset+\offset))
150 /* padding entry */
151 .word (0xFC000000+__last_offset-(__last_group_offset+\offset))
152 .endif
153 .word \libdbnum /* actual entry */
154 .set __last_offset, __last_group_offset+\offset+\size
155 .endm /* reg_entry */
156
157
158/* Table entry that marks the beginning of a group (coprocessor or "extra"): */
159 .macro reg_group cpnum, num_entries, align
160 .set __last_group_offset, (__last_offset + \align- 1) & -\align
161 .ifne \num_entries
162 .word 0xFD000000+(\cpnum<<16)+\num_entries
163 .endif
164 .endm /* reg_group */
165 226
166/*
167 * Register info tables.
168 */
169 227
170 .section .rodata, "a" 228ENTRY(fast_coprocessor)
171 .globl _xtensa_reginfo_tables 229
172 .globl _xtensa_reginfo_table_size 230 /* Save remaining registers a1-a3 and SAR */
173 .align 4 231
174_xtensa_reginfo_table_size: 232 xsr a3, EXCSAVE_1
175 .word _xtensa_reginfo_table_end - _xtensa_reginfo_tables 233 s32i a3, a2, PT_AREG3
176 234 rsr a3, SAR
177_xtensa_reginfo_tables: 235 s32i a1, a2, PT_AREG1
178 .set __last_offset, 0 236 s32i a3, a2, PT_SAR
179 reg_group 0xFF, XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM, XCHAL_EXTRA_SA_ALIGN 237 mov a1, a2
180 XCHAL_EXTRA_SA_CONTENTS_LIBDB 238 rsr a2, DEPC
181 reg_group 0, XCHAL_CP0_SA_CONTENTS_LIBDB_NUM, XCHAL_CP0_SA_ALIGN 239 s32i a2, a1, PT_AREG2
182 XCHAL_CP0_SA_CONTENTS_LIBDB 240
183 reg_group 1, XCHAL_CP1_SA_CONTENTS_LIBDB_NUM, XCHAL_CP1_SA_ALIGN 241 /*
184 XCHAL_CP1_SA_CONTENTS_LIBDB 242 * The hal macros require up to 4 temporary registers. We use a3..a6.
185 reg_group 2, XCHAL_CP2_SA_CONTENTS_LIBDB_NUM, XCHAL_CP2_SA_ALIGN 243 */
186 XCHAL_CP2_SA_CONTENTS_LIBDB 244
187 reg_group 3, XCHAL_CP3_SA_CONTENTS_LIBDB_NUM, XCHAL_CP3_SA_ALIGN 245 s32i a4, a1, PT_AREG4
188 XCHAL_CP3_SA_CONTENTS_LIBDB 246 s32i a5, a1, PT_AREG5
189 reg_group 4, XCHAL_CP4_SA_CONTENTS_LIBDB_NUM, XCHAL_CP4_SA_ALIGN 247 s32i a6, a1, PT_AREG6
190 XCHAL_CP4_SA_CONTENTS_LIBDB 248
191 reg_group 5, XCHAL_CP5_SA_CONTENTS_LIBDB_NUM, XCHAL_CP5_SA_ALIGN 249 /* Find coprocessor number. Subtract first CP EXCCAUSE from EXCCAUSE */
192 XCHAL_CP5_SA_CONTENTS_LIBDB 250
193 reg_group 6, XCHAL_CP6_SA_CONTENTS_LIBDB_NUM, XCHAL_CP6_SA_ALIGN 251 rsr a3, EXCCAUSE
194 XCHAL_CP6_SA_CONTENTS_LIBDB 252 addi a3, a3, -EXCCAUSE_COPROCESSOR0_DISABLED
195 reg_group 7, XCHAL_CP7_SA_CONTENTS_LIBDB_NUM, XCHAL_CP7_SA_ALIGN 253
196 XCHAL_CP7_SA_CONTENTS_LIBDB 254 /* Set corresponding CPENABLE bit -> (sar:cp-index, a3: 1<<cp-index)*/
197 .word 0xFC000000 /* invalid register number,marks end of table*/ 255
198_xtensa_reginfo_table_end: 256 ssl a3 # SAR: 32 - coprocessor_number
199#endif 257 movi a2, 1
258 rsr a0, CPENABLE
259 sll a2, a2
260 or a0, a0, a2
261 wsr a0, CPENABLE
262 rsync
263
264 /* Retrieve previous owner. (a3 still holds CP number) */
265
266 movi a0, coprocessor_owner # list of owners
267 addx4 a0, a3, a0 # entry for CP
268 l32i a4, a0, 0
269
270 beqz a4, 1f # skip 'save' if no previous owner
271
272 /* Disable coprocessor for previous owner. (a2 = 1 << CP number) */
273
274 l32i a5, a4, THREAD_CPENABLE
275 xor a5, a5, a2 # (1 << cp-id) still in a2
276 s32i a5, a4, THREAD_CPENABLE
277
278 /*
279 * Get context save area and 'call' save routine.
280 * (a4 still holds previous owner (thread_info), a3 CP number)
281 */
282
283 movi a5, .Lsave_cp_regs_jump_table
284 movi a0, 2f # a0: 'return' address
285 addx8 a3, a3, a5 # a3: coprocessor number
286 l32i a2, a3, 4 # a2: xtregs offset
287 l32i a3, a3, 0 # a3: jump offset
288 add a2, a2, a4
289 add a4, a3, a5 # a4: address of save routine
290 jx a4
291
292 /* Note that only a0 and a1 were preserved. */
293
2942: rsr a3, EXCCAUSE
295 addi a3, a3, -EXCCAUSE_COPROCESSOR0_DISABLED
296 movi a0, coprocessor_owner
297 addx4 a0, a3, a0
298
299 /* Set new 'owner' (a0 points to the CP owner, a3 contains the CP nr) */
300
3011: GET_THREAD_INFO (a4, a1)
302 s32i a4, a0, 0
303
304 /* Get context save area and 'call' load routine. */
305
306 movi a5, .Lload_cp_regs_jump_table
307 movi a0, 1f
308 addx8 a3, a3, a5
309 l32i a2, a3, 4 # a2: xtregs offset
310 l32i a3, a3, 0 # a3: jump offset
311 add a2, a2, a4
312 add a4, a3, a5
313 jx a4
314
315 /* Restore all registers and return from exception handler. */
316
3171: l32i a6, a1, PT_AREG6
318 l32i a5, a1, PT_AREG5
319 l32i a4, a1, PT_AREG4
320
321 l32i a0, a1, PT_SAR
322 l32i a3, a1, PT_AREG3
323 l32i a2, a1, PT_AREG2
324 wsr a0, SAR
325 l32i a0, a1, PT_AREG0
326 l32i a1, a1, PT_AREG1
327
328 rfe
329
330 .data
331ENTRY(coprocessor_owner)
332 .fill XCHAL_CP_MAX, 4, 0
333
334#endif /* XTENSA_HAVE_COPROCESSORS */
200 335
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 91a689eca43d..dfd35dcc1cb5 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -25,10 +25,10 @@
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/signal.h> 26#include <asm/signal.h>
27#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
28#include <asm/variant/tie-asm.h>
28 29
29/* Unimplemented features. */ 30/* Unimplemented features. */
30 31
31#undef SIGNAL_HANDLING_IN_DOUBLE_EXCEPTION
32#undef KERNEL_STACK_OVERFLOW_CHECK 32#undef KERNEL_STACK_OVERFLOW_CHECK
33#undef PREEMPTIBLE_KERNEL 33#undef PREEMPTIBLE_KERNEL
34#undef ALLOCA_EXCEPTION_IN_IRAM 34#undef ALLOCA_EXCEPTION_IN_IRAM
@@ -214,19 +214,7 @@ _user_exception:
214 214
215 /* We are back to the original stack pointer (a1) */ 215 /* We are back to the original stack pointer (a1) */
216 216
2172: 2172: /* Now, jump to the common exception handler. */
218#if XCHAL_EXTRA_SA_SIZE
219
220 /* For user exceptions, save the extra state into the user's TCB.
221 * Note: We must assume that xchal_extra_store_funcbody destroys a2..a15
222 */
223
224 GET_CURRENT(a2,a1)
225 addi a2, a2, THREAD_CP_SAVE
226 xchal_extra_store_funcbody
227#endif
228
229 /* Now, jump to the common exception handler. */
230 218
231 j common_exception 219 j common_exception
232 220
@@ -382,6 +370,10 @@ common_exception:
382 s32i a2, a1, PT_LBEG 370 s32i a2, a1, PT_LBEG
383 s32i a3, a1, PT_LEND 371 s32i a3, a1, PT_LEND
384 372
373 /* Save optional registers. */
374
375 save_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT
376
385 /* Go to second-level dispatcher. Set up parameters to pass to the 377 /* Go to second-level dispatcher. Set up parameters to pass to the
386 * exception handler and call the exception handler. 378 * exception handler and call the exception handler.
387 */ 379 */
@@ -403,74 +395,49 @@ common_exception_return:
403 /* Jump if we are returning from kernel exceptions. */ 395 /* Jump if we are returning from kernel exceptions. */
404 396
4051: l32i a3, a1, PT_PS 3971: l32i a3, a1, PT_PS
406 _bbsi.l a3, PS_UM_BIT, 2f 398 _bbci.l a3, PS_UM_BIT, 4f
407 j kernel_exception_exit
408 399
409 /* Specific to a user exception exit: 400 /* Specific to a user exception exit:
410 * We need to check some flags for signal handling and rescheduling, 401 * We need to check some flags for signal handling and rescheduling,
411 * and have to restore WB and WS, extra states, and all registers 402 * and have to restore WB and WS, extra states, and all registers
412 * in the register file that were in use in the user task. 403 * in the register file that were in use in the user task.
413 */ 404 * Note that we don't disable interrupts here.
414
4152: wsr a3, PS /* disable interrupts */
416
417 /* Check for signals (keep interrupts disabled while we read TI_FLAGS)
418 * Note: PS.INTLEVEL = 0, PS.EXCM = 1
419 */ 405 */
420 406
421 GET_THREAD_INFO(a2,a1) 407 GET_THREAD_INFO(a2,a1)
422 l32i a4, a2, TI_FLAGS 408 l32i a4, a2, TI_FLAGS
423 409
424 /* Enable interrupts again.
425 * Note: When we get here, we certainly have handled any interrupts.
426 * (Hint: There is only one user exception frame on stack)
427 */
428
429 movi a3, 1 << PS_WOE_BIT
430
431 _bbsi.l a4, TIF_NEED_RESCHED, 3f 410 _bbsi.l a4, TIF_NEED_RESCHED, 3f
432 _bbci.l a4, TIF_SIGPENDING, 4f 411 _bbci.l a4, TIF_SIGPENDING, 4f
433 412
434#ifndef SIGNAL_HANDLING_IN_DOUBLE_EXCEPTION
435 l32i a4, a1, PT_DEPC 413 l32i a4, a1, PT_DEPC
436 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f 414 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f
437#endif
438 415
439 /* Reenable interrupts and call do_signal() */ 416 /* Call do_signal() */
440 417
441 wsr a3, PS
442 movi a4, do_signal # int do_signal(struct pt_regs*, sigset_t*) 418 movi a4, do_signal # int do_signal(struct pt_regs*, sigset_t*)
443 mov a6, a1 419 mov a6, a1
444 movi a7, 0 420 movi a7, 0
445 callx4 a4 421 callx4 a4
446 j 1b 422 j 1b
447 423
4483: /* Reenable interrupts and reschedule */ 4243: /* Reschedule */
449 425
450 wsr a3, PS
451 movi a4, schedule # void schedule (void) 426 movi a4, schedule # void schedule (void)
452 callx4 a4 427 callx4 a4
453 j 1b 428 j 1b
454 429
455 /* Restore the state of the task and return from the exception. */ 4304: /* Restore optional registers. */
456
4574: /* a2 holds GET_CURRENT(a2,a1) */
458
459#if XCHAL_EXTRA_SA_SIZE
460 431
461 /* For user exceptions, restore the extra state from the user's TCB. */ 432 load_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT
462 433
463 /* Note: a2 still contains GET_CURRENT(a2,a1) */ 434 wsr a3, PS /* disable interrupts */
464 addi a2, a2, THREAD_CP_SAVE
465 xchal_extra_load_funcbody
466 435
467 /* We must assume that xchal_extra_store_funcbody destroys 436 _bbci.l a3, PS_UM_BIT, kernel_exception_exit
468 * registers a2..a15. FIXME, this list can eventually be
469 * reduced once real register requirements of the macro are
470 * finalized. */
471 437
472#endif /* XCHAL_EXTRA_SA_SIZE */ 438user_exception_exit:
473 439
440 /* Restore the state of the task and return from the exception. */
474 441
475 /* Switch to the user thread WINDOWBASE. Save SP temporarily in DEPC */ 442 /* Switch to the user thread WINDOWBASE. Save SP temporarily in DEPC */
476 443
@@ -536,10 +503,6 @@ common_exception_return:
536 503
537kernel_exception_exit: 504kernel_exception_exit:
538 505
539 /* Disable interrupts (a3 holds PT_PS) */
540
541 wsr a3, PS
542
543#ifdef PREEMPTIBLE_KERNEL 506#ifdef PREEMPTIBLE_KERNEL
544 507
545#ifdef CONFIG_PREEMPT 508#ifdef CONFIG_PREEMPT
@@ -618,6 +581,8 @@ kernel_exception_exit:
618 581
619common_exception_exit: 582common_exception_exit:
620 583
584 /* Restore address registers. */
585
621 _bbsi.l a2, 1, 1f 586 _bbsi.l a2, 1, 1f
622 l32i a4, a1, PT_AREG4 587 l32i a4, a1, PT_AREG4
623 l32i a5, a1, PT_AREG5 588 l32i a5, a1, PT_AREG5
@@ -1150,7 +1115,6 @@ CATCH
1150 * excsave_1: a3 1115 * excsave_1: a3
1151 * 1116 *
1152 * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler. 1117 * Note: We assume the stack pointer is EXC_TABLE_KSTK in the fixup handler.
1153 * Note: We don't need to save a2 in depc (return value)
1154 */ 1118 */
1155 1119
1156ENTRY(fast_syscall_spill_registers) 1120ENTRY(fast_syscall_spill_registers)
@@ -1166,29 +1130,31 @@ ENTRY(fast_syscall_spill_registers)
1166 1130
1167 rsr a0, SAR 1131 rsr a0, SAR
1168 xsr a3, EXCSAVE_1 # restore a3 and excsave_1 1132 xsr a3, EXCSAVE_1 # restore a3 and excsave_1
1169 s32i a0, a2, PT_AREG4 # store SAR to PT_AREG4
1170 s32i a3, a2, PT_AREG3 1133 s32i a3, a2, PT_AREG3
1134 s32i a4, a2, PT_AREG4
1135 s32i a0, a2, PT_AREG5 # store SAR to PT_AREG5
1171 1136
1172 /* The spill routine might clobber a7, a11, and a15. */ 1137 /* The spill routine might clobber a7, a11, and a15. */
1173 1138
1174 s32i a7, a2, PT_AREG5 1139 s32i a7, a2, PT_AREG7
1175 s32i a11, a2, PT_AREG6 1140 s32i a11, a2, PT_AREG11
1176 s32i a15, a2, PT_AREG7 1141 s32i a15, a2, PT_AREG15
1177 1142
1178 call0 _spill_registers # destroys a3, DEPC, and SAR 1143 call0 _spill_registers # destroys a3, a4, and SAR
1179 1144
1180 /* Advance PC, restore registers and SAR, and return from exception. */ 1145 /* Advance PC, restore registers and SAR, and return from exception. */
1181 1146
1182 l32i a3, a2, PT_AREG4 1147 l32i a3, a2, PT_AREG5
1148 l32i a4, a2, PT_AREG4
1183 l32i a0, a2, PT_AREG0 1149 l32i a0, a2, PT_AREG0
1184 wsr a3, SAR 1150 wsr a3, SAR
1185 l32i a3, a2, PT_AREG3 1151 l32i a3, a2, PT_AREG3
1186 1152
1187 /* Restore clobbered registers. */ 1153 /* Restore clobbered registers. */
1188 1154
1189 l32i a7, a2, PT_AREG5 1155 l32i a7, a2, PT_AREG7
1190 l32i a11, a2, PT_AREG6 1156 l32i a11, a2, PT_AREG11
1191 l32i a15, a2, PT_AREG7 1157 l32i a15, a2, PT_AREG15
1192 1158
1193 movi a2, 0 1159 movi a2, 0
1194 rfe 1160 rfe
@@ -1247,16 +1213,6 @@ fast_syscall_spill_registers_fixup:
1247 * Note: This frame might be the same as above. 1213 * Note: This frame might be the same as above.
1248 */ 1214 */
1249 1215
1250#ifdef SIGNAL_HANDLING_IN_DOUBLE_EXCEPTION
1251 /* Restore registers we precautiously saved.
1252 * We have the value of the 'right' a3
1253 */
1254
1255 l32i a7, a2, PT_AREG5
1256 l32i a11, a2, PT_AREG6
1257 l32i a15, a2, PT_AREG7
1258#endif
1259
1260 /* Setup stack pointer. */ 1216 /* Setup stack pointer. */
1261 1217
1262 addi a2, a2, -PT_USER_SIZE 1218 addi a2, a2, -PT_USER_SIZE
@@ -1271,9 +1227,9 @@ fast_syscall_spill_registers_fixup:
1271 1227
1272 movi a3, exc_table 1228 movi a3, exc_table
1273 rsr a0, EXCCAUSE 1229 rsr a0, EXCCAUSE
1274 addx4 a0, a0, a3 # find entry in table 1230 addx4 a0, a0, a3 # find entry in table
1275 l32i a0, a0, EXC_TABLE_FAST_USER # load handler 1231 l32i a0, a0, EXC_TABLE_FAST_USER # load handler
1276 jx a0 1232 jx a0
1277 1233
1278fast_syscall_spill_registers_fixup_return: 1234fast_syscall_spill_registers_fixup_return:
1279 1235
@@ -1290,14 +1246,6 @@ fast_syscall_spill_registers_fixup_return:
1290 s32i a2, a3, EXC_TABLE_PARAM 1246 s32i a2, a3, EXC_TABLE_PARAM
1291 l32i a2, a3, EXC_TABLE_KSTK 1247 l32i a2, a3, EXC_TABLE_KSTK
1292 1248
1293#ifdef SIGNAL_HANDLING_IN_DOUBLE_EXCEPTION
1294 /* Save registers again that might be clobbered. */
1295
1296 s32i a7, a2, PT_AREG5
1297 s32i a11, a2, PT_AREG6
1298 s32i a15, a2, PT_AREG7
1299#endif
1300
1301 /* Load WB at the time the exception occurred. */ 1249 /* Load WB at the time the exception occurred. */
1302 1250
1303 rsr a3, SAR # WB is still in SAR 1251 rsr a3, SAR # WB is still in SAR
@@ -1319,7 +1267,7 @@ fast_syscall_spill_registers_fixup_return:
1319 * This is not a real function. The following conditions must be met: 1267 * This is not a real function. The following conditions must be met:
1320 * 1268 *
1321 * - must be called with call0. 1269 * - must be called with call0.
1322 * - uses DEPC, a3 and SAR. 1270 * - uses a3, a4 and SAR.
1323 * - the last 'valid' register of each frame are clobbered. 1271 * - the last 'valid' register of each frame are clobbered.
1324 * - the caller must have registered a fixup handler 1272 * - the caller must have registered a fixup handler
1325 * (or be inside a critical section) 1273 * (or be inside a critical section)
@@ -1331,41 +1279,39 @@ ENTRY(_spill_registers)
1331 /* 1279 /*
1332 * Rotate ws so that the current windowbase is at bit 0. 1280 * Rotate ws so that the current windowbase is at bit 0.
1333 * Assume ws = xxxwww1yy (www1 current window frame). 1281 * Assume ws = xxxwww1yy (www1 current window frame).
1334 * Rotate ws right so that a2 = yyxxxwww1. 1282 * Rotate ws right so that a4 = yyxxxwww1.
1335 */ 1283 */
1336 1284
1337 wsr a2, DEPC # preserve a2 1285 rsr a4, WINDOWBASE
1338 rsr a2, WINDOWBASE 1286 rsr a3, WINDOWSTART # a3 = xxxwww1yy
1339 rsr a3, WINDOWSTART 1287 ssr a4 # holds WB
1340 ssr a2 # holds WB 1288 slli a4, a3, WSBITS
1341 slli a2, a3, WSBITS 1289 or a3, a3, a4 # a3 = xxxwww1yyxxxwww1yy
1342 or a3, a3, a2 # a2 = xxxwww1yyxxxwww1yy 1290 srl a3, a3 # a3 = 00xxxwww1yyxxxwww1
1343 srl a3, a3
1344 1291
1345 /* We are done if there are no more than the current register frame. */ 1292 /* We are done if there are no more than the current register frame. */
1346 1293
1347 extui a3, a3, 1, WSBITS-2 # a3 = 0yyxxxwww 1294 extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww
1348 movi a2, (1 << (WSBITS-1)) 1295 movi a4, (1 << (WSBITS-1))
1349 _beqz a3, .Lnospill # only one active frame? jump 1296 _beqz a3, .Lnospill # only one active frame? jump
1350 1297
1351 /* We want 1 at the top, so that we return to the current windowbase */ 1298 /* We want 1 at the top, so that we return to the current windowbase */
1352 1299
1353 or a3, a3, a2 # 1yyxxxwww 1300 or a3, a3, a4 # 1yyxxxwww
1354 1301
1355 /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */ 1302 /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */
1356 1303
1357 wsr a3, WINDOWSTART # save shifted windowstart 1304 wsr a3, WINDOWSTART # save shifted windowstart
1358 neg a2, a3 1305 neg a4, a3
1359 and a3, a2, a3 # first bit set from right: 000010000 1306 and a3, a4, a3 # first bit set from right: 000010000
1360 1307
1361 ffs_ws a2, a3 # a2: shifts to skip empty frames 1308 ffs_ws a4, a3 # a4: shifts to skip empty frames
1362 movi a3, WSBITS 1309 movi a3, WSBITS
1363 sub a2, a3, a2 # WSBITS-a2:number of 0-bits from right 1310 sub a4, a3, a4 # WSBITS-a4:number of 0-bits from right
1364 ssr a2 # save in SAR for later. 1311 ssr a4 # save in SAR for later.
1365 1312
1366 rsr a3, WINDOWBASE 1313 rsr a3, WINDOWBASE
1367 add a3, a3, a2 1314 add a3, a3, a4
1368 rsr a2, DEPC # restore a2
1369 wsr a3, WINDOWBASE 1315 wsr a3, WINDOWBASE
1370 rsync 1316 rsync
1371 1317
@@ -1394,6 +1340,9 @@ ENTRY(_spill_registers)
1394 l32e a4, a1, -16 1340 l32e a4, a1, -16
1395 j .Lc12c 1341 j .Lc12c
1396 1342
1343.Lnospill:
1344 ret
1345
1397.Lloop: _bbsi.l a3, 1, .Lc4 1346.Lloop: _bbsi.l a3, 1, .Lc4
1398 _bbci.l a3, 2, .Lc12 1347 _bbci.l a3, 2, .Lc12
1399 1348
@@ -1419,9 +1368,7 @@ ENTRY(_spill_registers)
1419 movi a3, 1 1368 movi a3, 1
1420 sll a3, a3 1369 sll a3, a3
1421 wsr a3, WINDOWSTART 1370 wsr a3, WINDOWSTART
1422 1371 ret
1423.Lnospill:
1424 jx a0
1425 1372
1426.Lc4: s32e a4, a9, -16 1373.Lc4: s32e a4, a9, -16
1427 s32e a5, a9, -12 1374 s32e a5, a9, -12
@@ -1830,154 +1777,6 @@ ENTRY(fast_store_prohibited)
18301: j _user_exception 17771: j _user_exception
1831 1778
1832 1779
1833#if XCHAL_EXTRA_SA_SIZE
1834
1835#warning fast_coprocessor untested
1836
1837/*
1838 * Entry condition:
1839 *
1840 * a0: trashed, original value saved on stack (PT_AREG0)
1841 * a1: a1
1842 * a2: new stack pointer, original in DEPC
1843 * a3: dispatch table
1844 * depc: a2, original value saved on stack (PT_DEPC)
1845 * excsave_1: a3
1846 *
1847 * PT_DEPC >= VALID_DOUBLE_EXCEPTION_ADDRESS: double exception, DEPC
1848 * < VALID_DOUBLE_EXCEPTION_ADDRESS: regular exception
1849 */
1850
1851ENTRY(fast_coprocessor_double)
1852 wsr a0, EXCSAVE_1
1853 movi a0, unrecoverable_exception
1854 callx0 a0
1855
1856ENTRY(fast_coprocessor)
1857
1858 /* Fatal if we are in a double exception. */
1859
1860 l32i a0, a2, PT_DEPC
1861 _bgeui a0, VALID_DOUBLE_EXCEPTION_ADDRESS, fast_coprocessor_double
1862
1863 /* Save some registers a1, a3, a4, SAR */
1864
1865 xsr a3, EXCSAVE_1
1866 s32i a3, a2, PT_AREG3
1867 rsr a3, SAR
1868 s32i a4, a2, PT_AREG4
1869 s32i a1, a2, PT_AREG1
1870 s32i a5, a1, PT_AREG5
1871 s32i a3, a2, PT_SAR
1872 mov a1, a2
1873
1874 /* Currently, the HAL macros only guarantee saving a0 and a1.
1875 * These can and will be refined in the future, but for now,
1876 * just save the remaining registers of a2...a15.
1877 */
1878 s32i a6, a1, PT_AREG6
1879 s32i a7, a1, PT_AREG7
1880 s32i a8, a1, PT_AREG8
1881 s32i a9, a1, PT_AREG9
1882 s32i a10, a1, PT_AREG10
1883 s32i a11, a1, PT_AREG11
1884 s32i a12, a1, PT_AREG12
1885 s32i a13, a1, PT_AREG13
1886 s32i a14, a1, PT_AREG14
1887 s32i a15, a1, PT_AREG15
1888
1889 /* Find coprocessor number. Subtract first CP EXCCAUSE from EXCCAUSE */
1890
1891 rsr a0, EXCCAUSE
1892 addi a3, a0, -XCHAL_EXCCAUSE_COPROCESSOR0_DISABLED
1893
1894 /* Set corresponding CPENABLE bit */
1895
1896 movi a4, 1
1897 ssl a3 # SAR: 32 - coprocessor_number
1898 rsr a5, CPENABLE
1899 sll a4, a4
1900 or a4, a5, a4
1901 wsr a4, CPENABLE
1902 rsync
1903 movi a5, coprocessor_info # list of owner and offset into cp_save
1904 addx8 a0, a4, a5 # entry for CP
1905
1906 bne a4, a5, .Lload # bit wasn't set before, cp not in use
1907
1908 /* Now compare the current task with the owner of the coprocessor.
1909 * If they are the same, there is no reason to save or restore any
1910 * coprocessor state. Having already enabled the coprocessor,
1911 * branch ahead to return.
1912 */
1913 GET_CURRENT(a5,a1)
1914 l32i a4, a0, COPROCESSOR_INFO_OWNER # a4: current owner for this CP
1915 beq a4, a5, .Ldone
1916
1917 /* Find location to dump current coprocessor state:
1918 * task_struct->task_cp_save_offset + coprocessor_offset[coprocessor]
1919 *
1920 * Note: a0 pointer to the entry in the coprocessor owner table,
1921 * a3 coprocessor number,
1922 * a4 current owner of coprocessor.
1923 */
1924 l32i a5, a0, COPROCESSOR_INFO_OFFSET
1925 addi a2, a4, THREAD_CP_SAVE
1926 add a2, a2, a5
1927
1928 /* Store current coprocessor states. (a5 still has CP number) */
1929
1930 xchal_cpi_store_funcbody
1931
1932 /* The macro might have destroyed a3 (coprocessor number), but
1933 * SAR still has 32 - coprocessor_number!
1934 */
1935 movi a3, 32
1936 rsr a4, SAR
1937 sub a3, a3, a4
1938
1939.Lload: /* A new task now owns the corpocessors. Save its TCB pointer into
1940 * the coprocessor owner table.
1941 *
1942 * Note: a0 pointer to the entry in the coprocessor owner table,
1943 * a3 coprocessor number.
1944 */
1945 GET_CURRENT(a4,a1)
1946 s32i a4, a0, 0
1947
1948 /* Find location from where to restore the current coprocessor state.*/
1949
1950 l32i a5, a0, COPROCESSOR_INFO_OFFSET
1951 addi a2, a4, THREAD_CP_SAVE
1952 add a2, a2, a4
1953
1954 xchal_cpi_load_funcbody
1955
1956 /* We must assume that the xchal_cpi_store_funcbody macro destroyed
1957 * registers a2..a15.
1958 */
1959
1960.Ldone: l32i a15, a1, PT_AREG15
1961 l32i a14, a1, PT_AREG14
1962 l32i a13, a1, PT_AREG13
1963 l32i a12, a1, PT_AREG12
1964 l32i a11, a1, PT_AREG11
1965 l32i a10, a1, PT_AREG10
1966 l32i a9, a1, PT_AREG9
1967 l32i a8, a1, PT_AREG8
1968 l32i a7, a1, PT_AREG7
1969 l32i a6, a1, PT_AREG6
1970 l32i a5, a1, PT_AREG5
1971 l32i a4, a1, PT_AREG4
1972 l32i a3, a1, PT_AREG3
1973 l32i a2, a1, PT_AREG2
1974 l32i a0, a1, PT_AREG0
1975 l32i a1, a1, PT_AREG1
1976
1977 rfe
1978
1979#endif /* XCHAL_EXTRA_SA_SIZE */
1980
1981/* 1780/*
1982 * System Calls. 1781 * System Calls.
1983 * 1782 *
@@ -2086,20 +1885,36 @@ ENTRY(_switch_to)
2086 1885
2087 entry a1, 16 1886 entry a1, 16
2088 1887
2089 mov a4, a3 # preserve a3 1888 mov a12, a2 # preserve 'prev' (a2)
1889 mov a13, a3 # and 'next' (a3)
1890
1891 l32i a4, a2, TASK_THREAD_INFO
1892 l32i a5, a3, TASK_THREAD_INFO
1893
1894 save_xtregs_user a4 a6 a8 a9 a10 a11 THREAD_XTREGS_USER
2090 1895
2091 s32i a0, a2, THREAD_RA # save return address 1896 s32i a0, a12, THREAD_RA # save return address
2092 s32i a1, a2, THREAD_SP # save stack pointer 1897 s32i a1, a12, THREAD_SP # save stack pointer
2093 1898
2094 /* Disable ints while we manipulate the stack pointer; spill regs. */ 1899 /* Disable ints while we manipulate the stack pointer. */
2095 1900
2096 movi a5, (1 << PS_EXCM_BIT) | LOCKLEVEL 1901 movi a14, (1 << PS_EXCM_BIT) | LOCKLEVEL
2097 xsr a5, PS 1902 xsr a14, PS
2098 rsr a3, EXCSAVE_1 1903 rsr a3, EXCSAVE_1
2099 rsync 1904 rsync
2100 s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */ 1905 s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */
2101 1906
2102 call0 _spill_registers 1907 /* Switch CPENABLE */
1908
1909#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
1910 l32i a3, a5, THREAD_CPENABLE
1911 xsr a3, CPENABLE
1912 s32i a3, a4, THREAD_CPENABLE
1913#endif
1914
1915 /* Flush register file. */
1916
1917 call0 _spill_registers # destroys a3, a4, and SAR
2103 1918
2104 /* Set kernel stack (and leave critical section) 1919 /* Set kernel stack (and leave critical section)
2105 * Note: It's save to set it here. The stack will not be overwritten 1920 * Note: It's save to set it here. The stack will not be overwritten
@@ -2107,19 +1922,21 @@ ENTRY(_switch_to)
2107 * we return from kernel space. 1922 * we return from kernel space.
2108 */ 1923 */
2109 1924
2110 l32i a0, a4, TASK_THREAD_INFO
2111 rsr a3, EXCSAVE_1 # exc_table 1925 rsr a3, EXCSAVE_1 # exc_table
2112 movi a1, 0 1926 movi a6, 0
2113 addi a0, a0, PT_REGS_OFFSET 1927 addi a7, a5, PT_REGS_OFFSET
2114 s32i a1, a3, EXC_TABLE_FIXUP 1928 s32i a6, a3, EXC_TABLE_FIXUP
2115 s32i a0, a3, EXC_TABLE_KSTK 1929 s32i a7, a3, EXC_TABLE_KSTK
2116 1930
2117 /* restore context of the task that 'next' addresses */ 1931 /* restore context of the task that 'next' addresses */
2118 1932
2119 l32i a0, a4, THREAD_RA /* restore return address */ 1933 l32i a0, a13, THREAD_RA # restore return address
2120 l32i a1, a4, THREAD_SP /* restore stack pointer */ 1934 l32i a1, a13, THREAD_SP # restore stack pointer
1935
1936 load_xtregs_user a5 a6 a8 a9 a10 a11 THREAD_XTREGS_USER
2121 1937
2122 wsr a5, PS 1938 wsr a14, PS
1939 mov a2, a12 # return 'prev'
2123 rsync 1940 rsync
2124 1941
2125 retw 1942 retw
diff --git a/arch/xtensa/kernel/module.c b/arch/xtensa/kernel/module.c
index ddf14dcf2ad9..3981a466c779 100644
--- a/arch/xtensa/kernel/module.c
+++ b/arch/xtensa/kernel/module.c
@@ -28,7 +28,7 @@ void *module_alloc(unsigned long size)
28{ 28{
29 if (size == 0) 29 if (size == 0)
30 return NULL; 30 return NULL;
31 return vmalloc(size); 31 return vmalloc_exec(size);
32} 32}
33 33
34void module_free(struct module *mod, void *module_region) 34void module_free(struct module *mod, void *module_region)
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index f53d7bd9dfb2..9185597eb6a0 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -52,6 +52,55 @@ void (*pm_power_off)(void) = NULL;
52EXPORT_SYMBOL(pm_power_off); 52EXPORT_SYMBOL(pm_power_off);
53 53
54 54
55#if XTENSA_HAVE_COPROCESSORS
56
57void coprocessor_release_all(struct thread_info *ti)
58{
59 unsigned long cpenable;
60 int i;
61
62 /* Make sure we don't switch tasks during this operation. */
63
64 preempt_disable();
65
66 /* Walk through all cp owners and release it for the requested one. */
67
68 cpenable = ti->cpenable;
69
70 for (i = 0; i < XCHAL_CP_MAX; i++) {
71 if (coprocessor_owner[i] == ti) {
72 coprocessor_owner[i] = 0;
73 cpenable &= ~(1 << i);
74 }
75 }
76
77 ti->cpenable = cpenable;
78 coprocessor_clear_cpenable();
79
80 preempt_enable();
81}
82
83void coprocessor_flush_all(struct thread_info *ti)
84{
85 unsigned long cpenable;
86 int i;
87
88 preempt_disable();
89
90 cpenable = ti->cpenable;
91
92 for (i = 0; i < XCHAL_CP_MAX; i++) {
93 if ((cpenable & 1) != 0 && coprocessor_owner[i] == ti)
94 coprocessor_flush(ti, i);
95 cpenable >>= 1;
96 }
97
98 preempt_enable();
99}
100
101#endif
102
103
55/* 104/*
56 * Powermanagement idle function, if any is provided by the platform. 105 * Powermanagement idle function, if any is provided by the platform.
57 */ 106 */
@@ -71,15 +120,36 @@ void cpu_idle(void)
71} 120}
72 121
73/* 122/*
74 * Free current thread data structures etc.. 123 * This is called when the thread calls exit().
75 */ 124 */
76
77void exit_thread(void) 125void exit_thread(void)
78{ 126{
127#if XTENSA_HAVE_COPROCESSORS
128 coprocessor_release_all(current_thread_info());
129#endif
79} 130}
80 131
132/*
133 * Flush thread state. This is called when a thread does an execve()
134 * Note that we flush coprocessor registers for the case execve fails.
135 */
81void flush_thread(void) 136void flush_thread(void)
82{ 137{
138#if XTENSA_HAVE_COPROCESSORS
139 struct thread_info *ti = current_thread_info();
140 coprocessor_flush_all(ti);
141 coprocessor_release_all(ti);
142#endif
143}
144
145/*
146 * This is called before the thread is copied.
147 */
148void prepare_to_copy(struct task_struct *tsk)
149{
150#if XTENSA_HAVE_COPROCESSORS
151 coprocessor_flush_all(task_thread_info(tsk));
152#endif
83} 153}
84 154
85/* 155/*
@@ -107,6 +177,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
107 struct task_struct * p, struct pt_regs * regs) 177 struct task_struct * p, struct pt_regs * regs)
108{ 178{
109 struct pt_regs *childregs; 179 struct pt_regs *childregs;
180 struct thread_info *ti;
110 unsigned long tos; 181 unsigned long tos;
111 int user_mode = user_mode(regs); 182 int user_mode = user_mode(regs);
112 183
@@ -128,13 +199,14 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
128 p->set_child_tid = p->clear_child_tid = NULL; 199 p->set_child_tid = p->clear_child_tid = NULL;
129 p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1); 200 p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1);
130 p->thread.sp = (unsigned long)childregs; 201 p->thread.sp = (unsigned long)childregs;
202
131 if (user_mode(regs)) { 203 if (user_mode(regs)) {
132 204
133 int len = childregs->wmask & ~0xf; 205 int len = childregs->wmask & ~0xf;
134 childregs->areg[1] = usp; 206 childregs->areg[1] = usp;
135 memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4], 207 memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4],
136 &regs->areg[XCHAL_NUM_AREGS - len/4], len); 208 &regs->areg[XCHAL_NUM_AREGS - len/4], len);
137 209// FIXME: we need to set THREADPTR in thread_info...
138 if (clone_flags & CLONE_SETTLS) 210 if (clone_flags & CLONE_SETTLS)
139 childregs->areg[2] = childregs->areg[6]; 211 childregs->areg[2] = childregs->areg[6];
140 212
@@ -142,6 +214,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
142 /* In kernel space, we start a new thread with a new stack. */ 214 /* In kernel space, we start a new thread with a new stack. */
143 childregs->wmask = 1; 215 childregs->wmask = 1;
144 } 216 }
217
218#if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
219 ti = task_thread_info(p);
220 ti->cpenable = 0;
221#endif
222
145 return 0; 223 return 0;
146} 224}
147 225
@@ -179,10 +257,6 @@ unsigned long get_wchan(struct task_struct *p)
179} 257}
180 258
181/* 259/*
182 * do_copy_regs() gathers information from 'struct pt_regs' and
183 * 'current->thread.areg[]' to fill in the xtensa_gregset_t
184 * structure.
185 *
186 * xtensa_gregset_t and 'struct pt_regs' are vastly different formats 260 * xtensa_gregset_t and 'struct pt_regs' are vastly different formats
187 * of processor registers. Besides different ordering, 261 * of processor registers. Besides different ordering,
188 * xtensa_gregset_t contains non-live register information that 262 * xtensa_gregset_t contains non-live register information that
@@ -191,18 +265,19 @@ unsigned long get_wchan(struct task_struct *p)
191 * 265 *
192 */ 266 */
193 267
194void do_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs, 268void xtensa_elf_core_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs)
195 struct task_struct *tsk)
196{ 269{
197 int i, n, wb_offset; 270 unsigned long wb, ws, wm;
271 int live, last;
198 272
199 elfregs->xchal_config_id0 = XCHAL_HW_CONFIGID0; 273 wb = regs->windowbase;
200 elfregs->xchal_config_id1 = XCHAL_HW_CONFIGID1; 274 ws = regs->windowstart;
275 wm = regs->wmask;
276 ws = ((ws >> wb) | (ws << (WSBITS - wb))) & ((1 << WSBITS) - 1);
201 277
202 __asm__ __volatile__ ("rsr %0, 176\n" : "=a" (i)); 278 /* Don't leak any random bits. */
203 elfregs->cpux = i; 279
204 __asm__ __volatile__ ("rsr %0, 208\n" : "=a" (i)); 280 memset(elfregs, 0, sizeof (elfregs));
205 elfregs->cpuy = i;
206 281
207 /* Note: PS.EXCM is not set while user task is running; its 282 /* Note: PS.EXCM is not set while user task is running; its
208 * being set in regs->ps is for exception handling convenience. 283 * being set in regs->ps is for exception handling convenience.
@@ -210,204 +285,22 @@ void do_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs,
210 285
211 elfregs->pc = regs->pc; 286 elfregs->pc = regs->pc;
212 elfregs->ps = (regs->ps & ~(1 << PS_EXCM_BIT)); 287 elfregs->ps = (regs->ps & ~(1 << PS_EXCM_BIT));
213 elfregs->exccause = regs->exccause;
214 elfregs->excvaddr = regs->excvaddr;
215 elfregs->windowbase = regs->windowbase;
216 elfregs->windowstart = regs->windowstart;
217 elfregs->lbeg = regs->lbeg; 288 elfregs->lbeg = regs->lbeg;
218 elfregs->lend = regs->lend; 289 elfregs->lend = regs->lend;
219 elfregs->lcount = regs->lcount; 290 elfregs->lcount = regs->lcount;
220 elfregs->sar = regs->sar; 291 elfregs->sar = regs->sar;
221 elfregs->syscall = regs->syscall; 292 elfregs->windowstart = ws;
222
223 /* Copy register file.
224 * The layout looks like this:
225 *
226 * | a0 ... a15 | Z ... Z | arX ... arY |
227 * current window unused saved frames
228 */
229
230 memset (elfregs->ar, 0, sizeof(elfregs->ar));
231 293
232 wb_offset = regs->windowbase * 4; 294 live = (wm & 2) ? 4 : (wm & 4) ? 8 : (wm & 8) ? 12 : 16;
233 n = (regs->wmask&1)? 4 : (regs->wmask&2)? 8 : (regs->wmask&4)? 12 : 16; 295 last = XCHAL_NUM_AREGS - (wm >> 4) * 4;
234 296 memcpy(elfregs->a, regs->areg, live * 4);
235 for (i = 0; i < n; i++) 297 memcpy(elfregs->a + last, regs->areg + last, (wm >> 4) * 16);
236 elfregs->ar[(wb_offset + i) % XCHAL_NUM_AREGS] = regs->areg[i];
237
238 n = (regs->wmask >> 4) * 4;
239
240 for (i = XCHAL_NUM_AREGS - n; n > 0; i++, n--)
241 elfregs->ar[(wb_offset + i) % XCHAL_NUM_AREGS] = regs->areg[i];
242} 298}
243 299
244void xtensa_elf_core_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs) 300int dump_fpu(void)
245{ 301{
246 do_copy_regs ((xtensa_gregset_t *)elfregs, regs, current);
247}
248
249
250/* The inverse of do_copy_regs(). No error or sanity checking. */
251
252void do_restore_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs,
253 struct task_struct *tsk)
254{
255 int i, n, wb_offset;
256
257 /* Note: PS.EXCM is not set while user task is running; it
258 * needs to be set in regs->ps is for exception handling convenience.
259 */
260
261 regs->pc = elfregs->pc;
262 regs->ps = (elfregs->ps | (1 << PS_EXCM_BIT));
263 regs->exccause = elfregs->exccause;
264 regs->excvaddr = elfregs->excvaddr;
265 regs->windowbase = elfregs->windowbase;
266 regs->windowstart = elfregs->windowstart;
267 regs->lbeg = elfregs->lbeg;
268 regs->lend = elfregs->lend;
269 regs->lcount = elfregs->lcount;
270 regs->sar = elfregs->sar;
271 regs->syscall = elfregs->syscall;
272
273 /* Clear everything. */
274
275 memset (regs->areg, 0, sizeof(regs->areg));
276
277 /* Copy regs from live window frame. */
278
279 wb_offset = regs->windowbase * 4;
280 n = (regs->wmask&1)? 4 : (regs->wmask&2)? 8 : (regs->wmask&4)? 12 : 16;
281
282 for (i = 0; i < n; i++)
283 regs->areg[(wb_offset+i) % XCHAL_NUM_AREGS] = elfregs->ar[i];
284
285 n = (regs->wmask >> 4) * 4;
286
287 for (i = XCHAL_NUM_AREGS - n; n > 0; i++, n--)
288 regs->areg[(wb_offset+i) % XCHAL_NUM_AREGS] = elfregs->ar[i];
289}
290
291/*
292 * do_save_fpregs() gathers information from 'struct pt_regs' and
293 * 'current->thread' to fill in the elf_fpregset_t structure.
294 *
295 * Core files and ptrace use elf_fpregset_t.
296 */
297
298void do_save_fpregs (elf_fpregset_t *fpregs, struct pt_regs *regs,
299 struct task_struct *tsk)
300{
301#if XCHAL_HAVE_CP
302
303 extern unsigned char _xtensa_reginfo_tables[];
304 extern unsigned _xtensa_reginfo_table_size;
305 int i;
306 unsigned long flags;
307
308 /* Before dumping coprocessor state from memory,
309 * ensure any live coprocessor contents for this
310 * task are first saved to memory:
311 */
312 local_irq_save(flags);
313
314 for (i = 0; i < XCHAL_CP_MAX; i++) {
315 if (tsk == coprocessor_info[i].owner) {
316 enable_coprocessor(i);
317 save_coprocessor_registers(
318 tsk->thread.cp_save+coprocessor_info[i].offset,i);
319 disable_coprocessor(i);
320 }
321 }
322
323 local_irq_restore(flags);
324
325 /* Now dump coprocessor & extra state: */
326 memcpy((unsigned char*)fpregs,
327 _xtensa_reginfo_tables, _xtensa_reginfo_table_size);
328 memcpy((unsigned char*)fpregs + _xtensa_reginfo_table_size,
329 tsk->thread.cp_save, XTENSA_CP_EXTRA_SIZE);
330#endif
331}
332
333/*
334 * The inverse of do_save_fpregs().
335 * Copies coprocessor and extra state from fpregs into regs and tsk->thread.
336 * Returns 0 on success, non-zero if layout doesn't match.
337 */
338
339int do_restore_fpregs (elf_fpregset_t *fpregs, struct pt_regs *regs,
340 struct task_struct *tsk)
341{
342#if XCHAL_HAVE_CP
343
344 extern unsigned char _xtensa_reginfo_tables[];
345 extern unsigned _xtensa_reginfo_table_size;
346 int i;
347 unsigned long flags;
348
349 /* Make sure save area layouts match.
350 * FIXME: in the future we could allow restoring from
351 * a different layout of the same registers, by comparing
352 * fpregs' table with _xtensa_reginfo_tables and matching
353 * entries and copying registers one at a time.
354 * Not too sure yet whether that's very useful.
355 */
356
357 if( memcmp((unsigned char*)fpregs,
358 _xtensa_reginfo_tables, _xtensa_reginfo_table_size) ) {
359 return -1;
360 }
361
362 /* Before restoring coprocessor state from memory,
363 * ensure any live coprocessor contents for this
364 * task are first invalidated.
365 */
366
367 local_irq_save(flags);
368
369 for (i = 0; i < XCHAL_CP_MAX; i++) {
370 if (tsk == coprocessor_info[i].owner) {
371 enable_coprocessor(i);
372 save_coprocessor_registers(
373 tsk->thread.cp_save+coprocessor_info[i].offset,i);
374 coprocessor_info[i].owner = 0;
375 disable_coprocessor(i);
376 }
377 }
378
379 local_irq_restore(flags);
380
381 /* Now restore coprocessor & extra state: */
382
383 memcpy(tsk->thread.cp_save,
384 (unsigned char*)fpregs + _xtensa_reginfo_table_size,
385 XTENSA_CP_EXTRA_SIZE);
386#endif
387 return 0; 302 return 0;
388} 303}
389/*
390 * Fill in the CP structure for a core dump for a particular task.
391 */
392
393int
394dump_task_fpu(struct pt_regs *regs, struct task_struct *task, elf_fpregset_t *r)
395{
396 return 0; /* no coprocessors active on this processor */
397}
398
399/*
400 * Fill in the CP structure for a core dump.
401 * This includes any FPU coprocessor.
402 * Here, we dump all coprocessors, and other ("extra") custom state.
403 *
404 * This function is called by elf_core_dump() in fs/binfmt_elf.c
405 * (in which case 'regs' comes from calls to do_coredump, see signals.c).
406 */
407int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
408{
409 return dump_task_fpu(regs, current, r);
410}
411 304
412asmlinkage 305asmlinkage
413long xtensa_clone(unsigned long clone_flags, unsigned long newsp, 306long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
@@ -421,8 +314,8 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
421} 314}
422 315
423/* 316/*
424 * * xtensa_execve() executes a new program. 317 * xtensa_execve() executes a new program.
425 * */ 318 */
426 319
427asmlinkage 320asmlinkage
428long xtensa_execve(char __user *name, char __user * __user *argv, 321long xtensa_execve(char __user *name, char __user * __user *argv,
@@ -437,7 +330,6 @@ long xtensa_execve(char __user *name, char __user * __user *argv,
437 error = PTR_ERR(filename); 330 error = PTR_ERR(filename);
438 if (IS_ERR(filename)) 331 if (IS_ERR(filename))
439 goto out; 332 goto out;
440 // FIXME: release coprocessor??
441 error = do_execve(filename, argv, envp, regs); 333 error = do_execve(filename, argv, envp, regs);
442 if (error == 0) { 334 if (error == 0) {
443 task_lock(current); 335 task_lock(current);
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 5533c7850d53..9486882ef0af 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -4,7 +4,7 @@
4 * License. See the file "COPYING" in the main directory of this archive 4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details. 5 * for more details.
6 * 6 *
7 * Copyright (C) 2001 - 2005 Tensilica Inc. 7 * Copyright (C) 2001 - 2007 Tensilica Inc.
8 * 8 *
9 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com> 9 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
10 * Chris Zankel <chris@zankel.net> 10 * Chris Zankel <chris@zankel.net>
@@ -28,14 +28,10 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/ptrace.h> 29#include <asm/ptrace.h>
30#include <asm/elf.h> 30#include <asm/elf.h>
31 31#include <asm/coprocessor.h>
32#define TEST_KERNEL // verify kernel operations FIXME: remove
33
34 32
35/* 33/*
36 * Called by kernel/ptrace.c when detaching.. 34 * Called by kernel/ptrace.c when detaching to disable single stepping.
37 *
38 * Make sure single step bits etc are not set.
39 */ 35 */
40 36
41void ptrace_disable(struct task_struct *child) 37void ptrace_disable(struct task_struct *child)
@@ -43,136 +39,237 @@ void ptrace_disable(struct task_struct *child)
43 /* Nothing to do.. */ 39 /* Nothing to do.. */
44} 40}
45 41
46long arch_ptrace(struct task_struct *child, long request, long addr, long data) 42int ptrace_getregs(struct task_struct *child, void __user *uregs)
47{ 43{
48 int ret = -EPERM; 44 struct pt_regs *regs = task_pt_regs(child);
45 xtensa_gregset_t __user *gregset = uregs;
46 unsigned long wm = regs->wmask;
47 unsigned long wb = regs->windowbase;
48 int live, i;
49
50 if (!access_ok(VERIFY_WRITE, uregs, sizeof(xtensa_gregset_t)))
51 return -EIO;
52
53 __put_user(regs->pc, &gregset->pc);
54 __put_user(regs->ps & ~(1 << PS_EXCM_BIT), &gregset->ps);
55 __put_user(regs->lbeg, &gregset->lbeg);
56 __put_user(regs->lend, &gregset->lend);
57 __put_user(regs->lcount, &gregset->lcount);
58 __put_user(regs->windowstart, &gregset->windowstart);
59 __put_user(regs->windowbase, &gregset->windowbase);
60
61 live = (wm & 2) ? 4 : (wm & 4) ? 8 : (wm & 8) ? 12 : 16;
62
63 for (i = 0; i < live; i++)
64 __put_user(regs->areg[i],gregset->a+((wb*4+i)%XCHAL_NUM_AREGS));
65 for (i = XCHAL_NUM_AREGS - (wm >> 4) * 4; i < XCHAL_NUM_AREGS; i++)
66 __put_user(regs->areg[i],gregset->a+((wb*4+i)%XCHAL_NUM_AREGS));
67
68 return 0;
69}
49 70
50 switch (request) { 71int ptrace_setregs(struct task_struct *child, void __user *uregs)
51 case PTRACE_PEEKTEXT: /* read word at location addr. */ 72{
52 case PTRACE_PEEKDATA: 73 struct pt_regs *regs = task_pt_regs(child);
53 ret = generic_ptrace_peekdata(child, addr, data); 74 xtensa_gregset_t *gregset = uregs;
54 goto out; 75 const unsigned long ps_mask = PS_CALLINC_MASK | PS_OWB_MASK;
76 unsigned long ps;
77 unsigned long wb;
55 78
56 /* Read the word at location addr in the USER area. */ 79 if (!access_ok(VERIFY_WRITE, uregs, sizeof(xtensa_gregset_t)))
80 return -EIO;
57 81
58 case PTRACE_PEEKUSR: 82 __get_user(regs->pc, &gregset->pc);
59 { 83 __get_user(ps, &gregset->ps);
60 struct pt_regs *regs; 84 __get_user(regs->lbeg, &gregset->lbeg);
61 unsigned long tmp; 85 __get_user(regs->lend, &gregset->lend);
86 __get_user(regs->lcount, &gregset->lcount);
87 __get_user(regs->windowstart, &gregset->windowstart);
88 __get_user(wb, &gregset->windowbase);
89
90 regs->ps = (regs->ps & ~ps_mask) | (ps & ps_mask) | (1 << PS_EXCM_BIT);
91
92 if (wb >= XCHAL_NUM_AREGS / 4)
93 return -EFAULT;
94
95 regs->windowbase = wb;
96
97 if (wb != 0 && __copy_from_user(regs->areg + XCHAL_NUM_AREGS - wb * 4,
98 gregset->a, wb * 16))
99 return -EFAULT;
100
101 if (__copy_from_user(regs->areg, gregset->a + wb*4, (WSBITS-wb) * 16))
102 return -EFAULT;
103
104 return 0;
105}
106
107
108int ptrace_getxregs(struct task_struct *child, void __user *uregs)
109{
110 struct pt_regs *regs = task_pt_regs(child);
111 struct thread_info *ti = task_thread_info(child);
112 elf_xtregs_t __user *xtregs = uregs;
113 int ret = 0;
114
115 if (!access_ok(VERIFY_WRITE, uregs, sizeof(elf_xtregs_t)))
116 return -EIO;
117
118#if XTENSA_HAVE_COPROCESSORS
119 /* Flush all coprocessor registers to memory. */
120 coprocessor_flush_all(ti);
121 ret |= __copy_to_user(&xtregs->cp0, &ti->xtregs_cp,
122 sizeof(xtregs_coprocessor_t));
123#endif
124 ret |= __copy_to_user(&xtregs->opt, &regs->xtregs_opt,
125 sizeof(xtregs->opt));
126 ret |= __copy_to_user(&xtregs->user,&ti->xtregs_user,
127 sizeof(xtregs->user));
128
129 return ret ? -EFAULT : 0;
130}
131
132int ptrace_setxregs(struct task_struct *child, void __user *uregs)
133{
134 struct thread_info *ti = task_thread_info(child);
135 struct pt_regs *regs = task_pt_regs(child);
136 elf_xtregs_t *xtregs = uregs;
137 int ret = 0;
138
139#if XTENSA_HAVE_COPROCESSORS
140 /* Flush all coprocessors before we overwrite them. */
141 coprocessor_flush_all(ti);
142 coprocessor_release_all(ti);
143
144 ret |= __copy_from_user(&ti->xtregs_cp, &xtregs->cp0,
145 sizeof(xtregs_coprocessor_t));
146#endif
147 ret |= __copy_from_user(&regs->xtregs_opt, &xtregs->opt,
148 sizeof(xtregs->opt));
149 ret |= __copy_from_user(&ti->xtregs_user, &xtregs->user,
150 sizeof(xtregs->user));
151
152 return ret ? -EFAULT : 0;
153}
154
155int ptrace_peekusr(struct task_struct *child, long regno, long __user *ret)
156{
157 struct pt_regs *regs;
158 unsigned long tmp;
62 159
63 regs = task_pt_regs(child); 160 regs = task_pt_regs(child);
64 tmp = 0; /* Default return value. */ 161 tmp = 0; /* Default return value. */
65 162
66 switch(addr) { 163 switch(regno) {
67 164
68 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1: 165 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1:
69 { 166 tmp = regs->areg[regno - REG_AR_BASE];
70 int ar = addr - REG_AR_BASE - regs->windowbase * 4;
71 ar &= (XCHAL_NUM_AREGS - 1);
72 if (ar < 16 && ar + (regs->wmask >> 4) * 4 >= 0)
73 tmp = regs->areg[ar];
74 else
75 ret = -EIO;
76 break; 167 break;
77 } 168
78 case REG_A_BASE ... REG_A_BASE + 15: 169 case REG_A_BASE ... REG_A_BASE + 15:
79 tmp = regs->areg[addr - REG_A_BASE]; 170 tmp = regs->areg[regno - REG_A_BASE];
80 break; 171 break;
172
81 case REG_PC: 173 case REG_PC:
82 tmp = regs->pc; 174 tmp = regs->pc;
83 break; 175 break;
176
84 case REG_PS: 177 case REG_PS:
85 /* Note: PS.EXCM is not set while user task is running; 178 /* Note: PS.EXCM is not set while user task is running;
86 * its being set in regs is for exception handling 179 * its being set in regs is for exception handling
87 * convenience. */ 180 * convenience. */
88 tmp = (regs->ps & ~(1 << PS_EXCM_BIT)); 181 tmp = (regs->ps & ~(1 << PS_EXCM_BIT));
89 break; 182 break;
183
90 case REG_WB: 184 case REG_WB:
91 tmp = regs->windowbase; 185 break; /* tmp = 0 */
92 break; 186
93 case REG_WS: 187 case REG_WS:
94 tmp = regs->windowstart; 188 {
189 unsigned long wb = regs->windowbase;
190 unsigned long ws = regs->windowstart;
191 tmp = ((ws>>wb) | (ws<<(WSBITS-wb))) & ((1<<WSBITS)-1);
95 break; 192 break;
193 }
96 case REG_LBEG: 194 case REG_LBEG:
97 tmp = regs->lbeg; 195 tmp = regs->lbeg;
98 break; 196 break;
197
99 case REG_LEND: 198 case REG_LEND:
100 tmp = regs->lend; 199 tmp = regs->lend;
101 break; 200 break;
201
102 case REG_LCOUNT: 202 case REG_LCOUNT:
103 tmp = regs->lcount; 203 tmp = regs->lcount;
104 break; 204 break;
205
105 case REG_SAR: 206 case REG_SAR:
106 tmp = regs->sar; 207 tmp = regs->sar;
107 break; 208 break;
108 case REG_DEPC: 209
109 tmp = regs->depc;
110 break;
111 case REG_EXCCAUSE:
112 tmp = regs->exccause;
113 break;
114 case REG_EXCVADDR:
115 tmp = regs->excvaddr;
116 break;
117 case SYSCALL_NR: 210 case SYSCALL_NR:
118 tmp = regs->syscall; 211 tmp = regs->syscall;
119 break; 212 break;
120 default:
121 tmp = 0;
122 ret = -EIO;
123 goto out;
124 }
125 ret = put_user(tmp, (unsigned long *) data);
126 goto out;
127 }
128 213
129 case PTRACE_POKETEXT: /* write the word at location addr. */ 214 default:
130 case PTRACE_POKEDATA: 215 return -EIO;
131 ret = generic_ptrace_pokedata(child, addr, data); 216 }
132 goto out; 217 return put_user(tmp, ret);
218}
133 219
134 case PTRACE_POKEUSR: 220int ptrace_pokeusr(struct task_struct *child, long regno, long val)
135 { 221{
136 struct pt_regs *regs; 222 struct pt_regs *regs;
137 regs = task_pt_regs(child); 223 regs = task_pt_regs(child);
138 224
139 switch (addr) { 225 switch (regno) {
140 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1: 226 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1:
141 { 227 regs->areg[regno - REG_AR_BASE] = val;
142 int ar = addr - REG_AR_BASE - regs->windowbase * 4;
143 if (ar < 16 && ar + (regs->wmask >> 4) * 4 >= 0)
144 regs->areg[ar & (XCHAL_NUM_AREGS - 1)] = data;
145 else
146 ret = -EIO;
147 break; 228 break;
148 } 229
149 case REG_A_BASE ... REG_A_BASE + 15: 230 case REG_A_BASE ... REG_A_BASE + 15:
150 regs->areg[addr - REG_A_BASE] = data; 231 regs->areg[regno - REG_A_BASE] = val;
151 break; 232 break;
233
152 case REG_PC: 234 case REG_PC:
153 regs->pc = data; 235 regs->pc = val;
154 break; 236 break;
237
155 case SYSCALL_NR: 238 case SYSCALL_NR:
156 regs->syscall = data; 239 regs->syscall = val;
157 break;
158#ifdef TEST_KERNEL
159 case REG_WB:
160 regs->windowbase = data;
161 break;
162 case REG_WS:
163 regs->windowstart = data;
164 break; 240 break;
165#endif
166 241
167 default: 242 default:
168 /* The rest are not allowed. */ 243 return -EIO;
169 ret = -EIO; 244 }
170 break; 245 return 0;
171 } 246}
247
248long arch_ptrace(struct task_struct *child, long request, long addr, long data)
249{
250 int ret = -EPERM;
251
252 switch (request) {
253 case PTRACE_PEEKTEXT: /* read word at location addr. */
254 case PTRACE_PEEKDATA:
255 ret = generic_ptrace_peekdata(child, addr, data);
256 break;
257
258 case PTRACE_PEEKUSR: /* read register specified by addr. */
259 ret = ptrace_peekusr(child, addr, (void __user *) data);
260 break;
261
262 case PTRACE_POKETEXT: /* write the word at location addr. */
263 case PTRACE_POKEDATA:
264 ret = generic_ptrace_pokedata(child, addr, data);
265 break;
266
267 case PTRACE_POKEUSR: /* write register specified by addr. */
268 ret = ptrace_pokeusr(child, addr, data);
172 break; 269 break;
173 }
174 270
175 /* continue and stop at next (return from) syscall */ 271 /* continue and stop at next (return from) syscall */
272
176 case PTRACE_SYSCALL: 273 case PTRACE_SYSCALL:
177 case PTRACE_CONT: /* restart after signal. */ 274 case PTRACE_CONT: /* restart after signal. */
178 { 275 {
@@ -217,98 +314,26 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
217 break; 314 break;
218 315
219 case PTRACE_GETREGS: 316 case PTRACE_GETREGS:
220 { 317 ret = ptrace_getregs(child, (void __user *) data);
221 /* 'data' points to user memory in which to write.
222 * Mainly due to the non-live register values, we
223 * reformat the register values into something more
224 * standard. For convenience, we use the handy
225 * elf_gregset_t format. */
226
227 xtensa_gregset_t format;
228 struct pt_regs *regs = task_pt_regs(child);
229
230 do_copy_regs (&format, regs, child);
231
232 /* Now, copy to user space nice and easy... */
233 ret = 0;
234 if (copy_to_user((void *)data, &format, sizeof(elf_gregset_t)))
235 ret = -EFAULT;
236 break; 318 break;
237 }
238 319
239 case PTRACE_SETREGS: 320 case PTRACE_SETREGS:
240 { 321 ret = ptrace_setregs(child, (void __user *) data);
241 /* 'data' points to user memory that contains the new
242 * values in the elf_gregset_t format. */
243
244 xtensa_gregset_t format;
245 struct pt_regs *regs = task_pt_regs(child);
246
247 if (copy_from_user(&format,(void *)data,sizeof(elf_gregset_t))){
248 ret = -EFAULT;
249 break;
250 }
251
252 /* FIXME: Perhaps we want some sanity checks on
253 * these user-space values? See ARM version. Are
254 * debuggers a security concern? */
255
256 do_restore_regs (&format, regs, child);
257
258 ret = 0;
259 break;
260 }
261
262 case PTRACE_GETFPREGS:
263 {
264 /* 'data' points to user memory in which to write.
265 * For convenience, we use the handy
266 * elf_fpregset_t format. */
267
268 elf_fpregset_t fpregs;
269 struct pt_regs *regs = task_pt_regs(child);
270
271 do_save_fpregs (&fpregs, regs, child);
272
273 /* Now, copy to user space nice and easy... */
274 ret = 0;
275 if (copy_to_user((void *)data, &fpregs, sizeof(elf_fpregset_t)))
276 ret = -EFAULT;
277
278 break; 322 break;
279 }
280
281 case PTRACE_SETFPREGS:
282 {
283 /* 'data' points to user memory that contains the new
284 * values in the elf_fpregset_t format.
285 */
286 elf_fpregset_t fpregs;
287 struct pt_regs *regs = task_pt_regs(child);
288 323
289 ret = 0; 324 case PTRACE_GETXTREGS:
290 if (copy_from_user(&fpregs, (void *)data, sizeof(elf_fpregset_t))) { 325 ret = ptrace_getxregs(child, (void __user *) data);
291 ret = -EFAULT;
292 break;
293 }
294
295 if (do_restore_fpregs (&fpregs, regs, child))
296 ret = -EIO;
297 break; 326 break;
298 }
299 327
300 case PTRACE_GETFPREGSIZE: 328 case PTRACE_SETXTREGS:
301 /* 'data' points to 'unsigned long' set to the size 329 ret = ptrace_setxregs(child, (void __user *) data);
302 * of elf_fpregset_t
303 */
304 ret = put_user(sizeof(elf_fpregset_t), (unsigned long *) data);
305 break; 330 break;
306 331
307 default: 332 default:
308 ret = ptrace_request(child, request, addr, data); 333 ret = ptrace_request(child, request, addr, data);
309 goto out; 334 break;
310 } 335 }
311 out: 336
312 return ret; 337 return ret;
313} 338}
314 339
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index b80f2cb1b4fb..5e6d75c9f92b 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -60,11 +60,6 @@ struct ide_ops *ide_ops;
60extern struct rtc_ops no_rtc_ops; 60extern struct rtc_ops no_rtc_ops;
61struct rtc_ops *rtc_ops; 61struct rtc_ops *rtc_ops;
62 62
63#ifdef CONFIG_PC_KEYB
64extern struct kbd_ops no_kbd_ops;
65struct kbd_ops *kbd_ops;
66#endif
67
68#ifdef CONFIG_BLK_DEV_INITRD 63#ifdef CONFIG_BLK_DEV_INITRD
69extern void *initrd_start; 64extern void *initrd_start;
70extern void *initrd_end; 65extern void *initrd_end;
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index 033aae0336d2..f2220b5bdce6 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -35,13 +35,17 @@ asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
35 35
36extern struct task_struct *coproc_owners[]; 36extern struct task_struct *coproc_owners[];
37 37
38extern void release_all_cp (struct task_struct *);
39
40struct rt_sigframe 38struct rt_sigframe
41{ 39{
42 struct siginfo info; 40 struct siginfo info;
43 struct ucontext uc; 41 struct ucontext uc;
44 cp_state_t cpstate; 42 struct {
43 xtregs_opt_t opt;
44 xtregs_user_t user;
45#if XTENSA_HAVE_COPROCESSORS
46 xtregs_coprocessor_t cp;
47#endif
48 } xtregs;
45 unsigned char retcode[6]; 49 unsigned char retcode[6];
46 unsigned int window[4]; 50 unsigned int window[4];
47}; 51};
@@ -49,8 +53,6 @@ struct rt_sigframe
49/* 53/*
50 * Flush register windows stored in pt_regs to stack. 54 * Flush register windows stored in pt_regs to stack.
51 * Returns 1 for errors. 55 * Returns 1 for errors.
52 *
53 * Note that windowbase, windowstart, and wmask are not updated!
54 */ 56 */
55 57
56int 58int
@@ -116,6 +118,9 @@ flush_window_regs_user(struct pt_regs *regs)
116 base += inc; 118 base += inc;
117 } 119 }
118 120
121 regs->wmask = 1;
122 regs->windowstart = 1 << wb;
123
119 return 0; 124 return 0;
120 125
121errout: 126errout:
@@ -131,9 +136,10 @@ errout:
131 */ 136 */
132 137
133static int 138static int
134setup_sigcontext(struct sigcontext __user *sc, cp_state_t *cpstate, 139setup_sigcontext(struct rt_sigframe __user *frame, struct pt_regs *regs)
135 struct pt_regs *regs, unsigned long mask)
136{ 140{
141 struct sigcontext __user *sc = &frame->uc.uc_mcontext;
142 struct thread_info *ti = current_thread_info();
137 int err = 0; 143 int err = 0;
138 144
139#define COPY(x) err |= __put_user(regs->x, &sc->sc_##x) 145#define COPY(x) err |= __put_user(regs->x, &sc->sc_##x)
@@ -147,23 +153,32 @@ setup_sigcontext(struct sigcontext __user *sc, cp_state_t *cpstate,
147 153
148 err |= flush_window_regs_user(regs); 154 err |= flush_window_regs_user(regs);
149 err |= __copy_to_user (sc->sc_a, regs->areg, 16 * 4); 155 err |= __copy_to_user (sc->sc_a, regs->areg, 16 * 4);
156 err |= __put_user(0, &sc->sc_xtregs);
150 157
151 // err |= __copy_to_user (sc->sc_a, regs->areg, XCHAL_NUM_AREGS * 4) 158 if (err)
159 return err;
152 160
153#if XCHAL_HAVE_CP 161#if XTENSA_HAVE_COPROCESSORS
154# error Coprocessors unsupported 162 coprocessor_flush_all(ti);
155 err |= save_cpextra(cpstate); 163 coprocessor_release_all(ti);
156 err |= __put_user(err ? NULL : cpstate, &sc->sc_cpstate); 164 err |= __copy_to_user(&frame->xtregs.cp, &ti->xtregs_cp,
165 sizeof (frame->xtregs.cp));
157#endif 166#endif
158 /* non-iBCS2 extensions.. */ 167 err |= __copy_to_user(&frame->xtregs.opt, &regs->xtregs_opt,
159 err |= __put_user(mask, &sc->oldmask); 168 sizeof (xtregs_opt_t));
169 err |= __copy_to_user(&frame->xtregs.user, &ti->xtregs_user,
170 sizeof (xtregs_user_t));
171
172 err |= __put_user(err ? NULL : &frame->xtregs, &sc->sc_xtregs);
160 173
161 return err; 174 return err;
162} 175}
163 176
164static int 177static int
165restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) 178restore_sigcontext(struct pt_regs *regs, struct rt_sigframe __user *frame)
166{ 179{
180 struct sigcontext __user *sc = &frame->uc.uc_mcontext;
181 struct thread_info *ti = current_thread_info();
167 unsigned int err = 0; 182 unsigned int err = 0;
168 unsigned long ps; 183 unsigned long ps;
169 184
@@ -181,6 +196,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
181 regs->windowbase = 0; 196 regs->windowbase = 0;
182 regs->windowstart = 1; 197 regs->windowstart = 1;
183 198
199 regs->syscall = -1; /* disable syscall checks */
200
184 /* For PS, restore only PS.CALLINC. 201 /* For PS, restore only PS.CALLINC.
185 * Assume that all other bits are either the same as for the signal 202 * Assume that all other bits are either the same as for the signal
186 * handler, or the user mode value doesn't matter (e.g. PS.OWB). 203 * handler, or the user mode value doesn't matter (e.g. PS.OWB).
@@ -196,8 +213,9 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
196 213
197 err |= __copy_from_user(regs->areg, sc->sc_a, 16 * 4); 214 err |= __copy_from_user(regs->areg, sc->sc_a, 16 * 4);
198 215
199#if XCHAL_HAVE_CP 216 if (err)
200# error Coprocessors unsupported 217 return err;
218
201 /* The signal handler may have used coprocessors in which 219 /* The signal handler may have used coprocessors in which
202 * case they are still enabled. We disable them to force a 220 * case they are still enabled. We disable them to force a
203 * reloading of the original task's CP state by the lazy 221 * reloading of the original task's CP state by the lazy
@@ -205,20 +223,20 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
205 * Also, we essentially discard any coprocessor state that the 223 * Also, we essentially discard any coprocessor state that the
206 * signal handler created. */ 224 * signal handler created. */
207 225
208 if (!err) { 226#if XTENSA_HAVE_COPROCESSORS
209 struct task_struct *tsk = current; 227 coprocessor_release_all(ti);
210 release_all_cp(tsk); 228 err |= __copy_from_user(&ti->xtregs_cp, &frame->xtregs.cp,
211 err |= __copy_from_user(tsk->thread.cpextra, sc->sc_cpstate, 229 sizeof (frame->xtregs.cp));
212 XTENSA_CP_EXTRA_SIZE);
213 }
214#endif 230#endif
231 err |= __copy_from_user(&ti->xtregs_user, &frame->xtregs.user,
232 sizeof (xtregs_user_t));
233 err |= __copy_from_user(&regs->xtregs_opt, &frame->xtregs.opt,
234 sizeof (xtregs_opt_t));
215 235
216 regs->syscall = -1; /* disable syscall checks */
217 return err; 236 return err;
218} 237}
219 238
220 239
221
222/* 240/*
223 * Do a signal return; undo the signal stack. 241 * Do a signal return; undo the signal stack.
224 */ 242 */
@@ -247,7 +265,7 @@ asmlinkage long xtensa_rt_sigreturn(long a0, long a1, long a2, long a3,
247 recalc_sigpending(); 265 recalc_sigpending();
248 spin_unlock_irq(&current->sighand->siglock); 266 spin_unlock_irq(&current->sighand->siglock);
249 267
250 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 268 if (restore_sigcontext(regs, frame))
251 goto badframe; 269 goto badframe;
252 270
253 ret = regs->areg[2]; 271 ret = regs->areg[2];
@@ -360,18 +378,22 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
360 err |= __put_user(sas_ss_flags(regs->areg[1]), 378 err |= __put_user(sas_ss_flags(regs->areg[1]),
361 &frame->uc.uc_stack.ss_flags); 379 &frame->uc.uc_stack.ss_flags);
362 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); 380 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
363 err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->cpstate, 381 err |= setup_sigcontext(frame, regs);
364 regs, set->sig[0]);
365 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 382 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
366 383
367 /* Create sys_rt_sigreturn syscall in stack frame */ 384 if (ka->sa.sa_flags & SA_RESTORER) {
385 ra = (unsigned long)ka->sa.sa_restorer;
386 } else {
368 387
369 err |= gen_return_code(frame->retcode); 388 /* Create sys_rt_sigreturn syscall in stack frame */
370 389
371 if (err) { 390 err |= gen_return_code(frame->retcode);
372 goto give_sigsegv; 391
392 if (err) {
393 goto give_sigsegv;
394 }
395 ra = (unsigned long) frame->retcode;
373 } 396 }
374
375 397
376 /* 398 /*
377 * Create signal handler execution context. 399 * Create signal handler execution context.
@@ -385,7 +407,6 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
385 /* Set up a stack frame for a call4 407 /* Set up a stack frame for a call4
386 * Note: PS.CALLINC is set to one by start_thread 408 * Note: PS.CALLINC is set to one by start_thread
387 */ 409 */
388 ra = (unsigned long) frame->retcode;
389 regs->areg[4] = (((unsigned long) ra) & 0x3fffffff) | 0x40000000; 410 regs->areg[4] = (((unsigned long) ra) & 0x3fffffff) | 0x40000000;
390 regs->areg[6] = (unsigned long) signal; 411 regs->areg[6] = (unsigned long) signal;
391 regs->areg[7] = (unsigned long) &frame->info; 412 regs->areg[7] = (unsigned long) &frame->info;
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 397bcd6ad08d..c7a021d9f696 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -118,28 +118,28 @@ static dispatch_init_table_t __initdata dispatch_init_table[] = {
118{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, 0, do_page_fault }, 118{ EXCCAUSE_STORE_CACHE_ATTRIBUTE, 0, do_page_fault },
119{ EXCCAUSE_LOAD_CACHE_ATTRIBUTE, 0, do_page_fault }, 119{ EXCCAUSE_LOAD_CACHE_ATTRIBUTE, 0, do_page_fault },
120/* XCCHAL_EXCCAUSE_FLOATING_POINT unhandled */ 120/* XCCHAL_EXCCAUSE_FLOATING_POINT unhandled */
121#if (XCHAL_CP_MASK & 1) 121#if XTENSA_HAVE_COPROCESSOR(0)
122COPROCESSOR(0), 122COPROCESSOR(0),
123#endif 123#endif
124#if (XCHAL_CP_MASK & 2) 124#if XTENSA_HAVE_COPROCESSOR(1)
125COPROCESSOR(1), 125COPROCESSOR(1),
126#endif 126#endif
127#if (XCHAL_CP_MASK & 4) 127#if XTENSA_HAVE_COPROCESSOR(2)
128COPROCESSOR(2), 128COPROCESSOR(2),
129#endif 129#endif
130#if (XCHAL_CP_MASK & 8) 130#if XTENSA_HAVE_COPROCESSOR(3)
131COPROCESSOR(3), 131COPROCESSOR(3),
132#endif 132#endif
133#if (XCHAL_CP_MASK & 16) 133#if XTENSA_HAVE_COPROCESSOR(4)
134COPROCESSOR(4), 134COPROCESSOR(4),
135#endif 135#endif
136#if (XCHAL_CP_MASK & 32) 136#if XTENSA_HAVE_COPROCESSOR(5)
137COPROCESSOR(5), 137COPROCESSOR(5),
138#endif 138#endif
139#if (XCHAL_CP_MASK & 64) 139#if XTENSA_HAVE_COPROCESSOR(6)
140COPROCESSOR(6), 140COPROCESSOR(6),
141#endif 141#endif
142#if (XCHAL_CP_MASK & 128) 142#if XTENSA_HAVE_COPROCESSOR(7)
143COPROCESSOR(7), 143COPROCESSOR(7),
144#endif 144#endif
145{ EXCCAUSE_MAPPED_DEBUG, 0, do_debug }, 145{ EXCCAUSE_MAPPED_DEBUG, 0, do_debug },
@@ -349,9 +349,7 @@ void show_regs(struct pt_regs * regs)
349 349
350 wmask = regs->wmask & ~1; 350 wmask = regs->wmask & ~1;
351 351
352 for (i = 0; i < 32; i++) { 352 for (i = 0; i < 16; i++) {
353 if (wmask & (1 << (i / 4)))
354 break;
355 if ((i % 8) == 0) 353 if ((i % 8) == 0)
356 printk ("\n" KERN_INFO "a%02d: ", i); 354 printk ("\n" KERN_INFO "a%02d: ", i);
357 printk("%08lx ", regs->areg[i]); 355 printk("%08lx ", regs->areg[i]);
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 7d0f55a4982d..51f4fb6f16f9 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -136,7 +136,9 @@ SECTIONS
136 __init_begin = .; 136 __init_begin = .;
137 .init.text : { 137 .init.text : {
138 _sinittext = .; 138 _sinittext = .;
139 *(.init.literal) INIT_TEXT 139 *(.init.literal) *(.cpuinit.literal)
140 *(.devinit.literal) *(.meminit.literal)
141 INIT_TEXT
140 _einittext = .; 142 _einittext = .;
141 } 143 }
142 144
@@ -161,6 +163,8 @@ SECTIONS
161 .DoubleExceptionVector.literal); 163 .DoubleExceptionVector.literal);
162 RELOCATE_ENTRY(_DoubleExceptionVector_text, 164 RELOCATE_ENTRY(_DoubleExceptionVector_text,
163 .DoubleExceptionVector.text); 165 .DoubleExceptionVector.text);
166 RELOCATE_ENTRY(_DebugInterruptVector_text,
167 .DebugInterruptVector.text);
164 168
165 __boot_reloc_table_end = ABSOLUTE(.) ; 169 __boot_reloc_table_end = ABSOLUTE(.) ;
166 } 170 }
diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c
index 9a1fa9478ae7..3ba990c67676 100644
--- a/arch/xtensa/mm/cache.c
+++ b/arch/xtensa/mm/cache.c
@@ -25,7 +25,6 @@
25#include <linux/swap.h> 25#include <linux/swap.h>
26#include <linux/pagemap.h> 26#include <linux/pagemap.h>
27 27
28#include <asm/pgtable.h>
29#include <asm/bootparam.h> 28#include <asm/bootparam.h>
30#include <asm/mmu_context.h> 29#include <asm/mmu_context.h>
31#include <asm/tlb.h> 30#include <asm/tlb.h>
@@ -181,9 +180,9 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t pte)
181#else 180#else
182 if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags) 181 if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags)
183 && (vma->vm_flags & VM_EXEC) != 0) { 182 && (vma->vm_flags & VM_EXEC) != 0) {
184 unsigned long vaddr = addr & PAGE_MASK; 183 unsigned long paddr = (unsigned long) page_address(page);
185 __flush_dcache_page(vaddr); 184 __flush_dcache_page(paddr);
186 __invalidate_icache_page(vaddr); 185 __invalidate_icache_page(paddr);
187 set_bit(PG_arch_1, &page->flags); 186 set_bit(PG_arch_1, &page->flags);
188 } 187 }
189#endif 188#endif
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index b3086f34a8e7..81d0560eaea2 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -309,7 +309,7 @@ void show_mem(void)
309 309
310struct kmem_cache *pgtable_cache __read_mostly; 310struct kmem_cache *pgtable_cache __read_mostly;
311 311
312static void pgd_ctor(void *addr, struct kmem_cache *cache, unsigned long flags) 312static void pgd_ctor(struct kmem_cache *cache, void* addr)
313{ 313{
314 pte_t* ptep = (pte_t*)addr; 314 pte_t* ptep = (pte_t*)addr;
315 int i; 315 int i;
diff --git a/arch/xtensa/mm/misc.S b/arch/xtensa/mm/misc.S
index e1f880368e32..c885664211d1 100644
--- a/arch/xtensa/mm/misc.S
+++ b/arch/xtensa/mm/misc.S
@@ -295,7 +295,7 @@ ENTRY(__tlbtemp_mapping_itlb)
295ENTRY(__invalidate_icache_page_alias) 295ENTRY(__invalidate_icache_page_alias)
296 entry sp, 16 296 entry sp, 16
297 297
298 addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE) 298 addi a6, a3, (PAGE_KERNEL_EXEC | _PAGE_HW_WRITE)
299 mov a4, a2 299 mov a4, a2
300 witlb a6, a2 300 witlb a6, a2
301 isync 301 isync
diff --git a/arch/xtensa/platform-iss/Makefile b/arch/xtensa/platforms/iss/Makefile
index af96e314d71f..af96e314d71f 100644
--- a/arch/xtensa/platform-iss/Makefile
+++ b/arch/xtensa/platforms/iss/Makefile
diff --git a/arch/xtensa/platform-iss/console.c b/arch/xtensa/platforms/iss/console.c
index 854677d0c3f6..9141e3690731 100644
--- a/arch/xtensa/platform-iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -43,6 +43,7 @@ static DEFINE_SPINLOCK(timer_lock);
43 43
44int errno; 44int errno;
45 45
46static int __simc (int a, int b, int c, int d, int e, int f) __attribute__((__noinline__));
46static int __simc (int a, int b, int c, int d, int e, int f) 47static int __simc (int a, int b, int c, int d, int e, int f)
47{ 48{
48 int ret; 49 int ret;
diff --git a/arch/xtensa/platform-iss/io.c b/arch/xtensa/platforms/iss/io.c
index 5b161a5cb65f..5b161a5cb65f 100644
--- a/arch/xtensa/platform-iss/io.c
+++ b/arch/xtensa/platforms/iss/io.c
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platforms/iss/network.c
index f21b9b0899a8..a2e252217428 100644
--- a/arch/xtensa/platform-iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -31,7 +31,6 @@
31#include <linux/bootmem.h> 31#include <linux/bootmem.h>
32#include <linux/ethtool.h> 32#include <linux/ethtool.h>
33#include <linux/rtnetlink.h> 33#include <linux/rtnetlink.h>
34#include <linux/timer.h>
35#include <linux/platform_device.h> 34#include <linux/platform_device.h>
36 35
37#include <asm/platform/simcall.h> 36#include <asm/platform/simcall.h>
@@ -108,6 +107,7 @@ struct iss_net_private {
108 107
109static int errno; 108static int errno;
110 109
110static int __simc (int a, int b, int c, int d, int e, int f) __attribute__((__noinline__));
111static int __simc (int a, int b, int c, int d, int e, int f) 111static int __simc (int a, int b, int c, int d, int e, int f)
112{ 112{
113 int ret; 113 int ret;
diff --git a/arch/xtensa/platform-iss/setup.c b/arch/xtensa/platforms/iss/setup.c
index f60c8cf6dfbe..f60c8cf6dfbe 100644
--- a/arch/xtensa/platform-iss/setup.c
+++ b/arch/xtensa/platforms/iss/setup.c
diff --git a/block/blk-core.c b/block/blk-core.c
index e9754dc98ec4..775c8516abf5 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -38,7 +38,7 @@ static int __make_request(struct request_queue *q, struct bio *bio);
38/* 38/*
39 * For the allocated request tables 39 * For the allocated request tables
40 */ 40 */
41struct kmem_cache *request_cachep; 41static struct kmem_cache *request_cachep;
42 42
43/* 43/*
44 * For queue allocation 44 * For queue allocation
@@ -127,6 +127,7 @@ void rq_init(struct request_queue *q, struct request *rq)
127 rq->nr_hw_segments = 0; 127 rq->nr_hw_segments = 0;
128 rq->ioprio = 0; 128 rq->ioprio = 0;
129 rq->special = NULL; 129 rq->special = NULL;
130 rq->raw_data_len = 0;
130 rq->buffer = NULL; 131 rq->buffer = NULL;
131 rq->tag = -1; 132 rq->tag = -1;
132 rq->errors = 0; 133 rq->errors = 0;
@@ -2015,6 +2016,7 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
2015 rq->hard_cur_sectors = rq->current_nr_sectors; 2016 rq->hard_cur_sectors = rq->current_nr_sectors;
2016 rq->hard_nr_sectors = rq->nr_sectors = bio_sectors(bio); 2017 rq->hard_nr_sectors = rq->nr_sectors = bio_sectors(bio);
2017 rq->buffer = bio_data(bio); 2018 rq->buffer = bio_data(bio);
2019 rq->raw_data_len = bio->bi_size;
2018 rq->data_len = bio->bi_size; 2020 rq->data_len = bio->bi_size;
2019 2021
2020 rq->bio = rq->biotail = bio; 2022 rq->bio = rq->biotail = bio;
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 80245dc30c75..e34df7c9fc36 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -17,17 +17,13 @@ static struct kmem_cache *iocontext_cachep;
17 17
18static void cfq_dtor(struct io_context *ioc) 18static void cfq_dtor(struct io_context *ioc)
19{ 19{
20 struct cfq_io_context *cic[1]; 20 if (!hlist_empty(&ioc->cic_list)) {
21 int r; 21 struct cfq_io_context *cic;
22 22
23 /* 23 cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
24 * We don't have a specific key to lookup with, so use the gang 24 cic_list);
25 * lookup to just retrieve the first item stored. The cfq exit 25 cic->dtor(ioc);
26 * function will iterate the full tree, so any member will do. 26 }
27 */
28 r = radix_tree_gang_lookup(&ioc->radix_root, (void **) cic, 0, 1);
29 if (r > 0)
30 cic[0]->dtor(ioc);
31} 27}
32 28
33/* 29/*
@@ -57,18 +53,16 @@ EXPORT_SYMBOL(put_io_context);
57 53
58static void cfq_exit(struct io_context *ioc) 54static void cfq_exit(struct io_context *ioc)
59{ 55{
60 struct cfq_io_context *cic[1];
61 int r;
62
63 rcu_read_lock(); 56 rcu_read_lock();
64 /*
65 * See comment for cfq_dtor()
66 */
67 r = radix_tree_gang_lookup(&ioc->radix_root, (void **) cic, 0, 1);
68 rcu_read_unlock();
69 57
70 if (r > 0) 58 if (!hlist_empty(&ioc->cic_list)) {
71 cic[0]->exit(ioc); 59 struct cfq_io_context *cic;
60
61 cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
62 cic_list);
63 cic->exit(ioc);
64 }
65 rcu_read_unlock();
72} 66}
73 67
74/* Called by the exitting task */ 68/* Called by the exitting task */
@@ -105,6 +99,7 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
105 ret->nr_batch_requests = 0; /* because this is 0 */ 99 ret->nr_batch_requests = 0; /* because this is 0 */
106 ret->aic = NULL; 100 ret->aic = NULL;
107 INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); 101 INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH);
102 INIT_HLIST_HEAD(&ret->cic_list);
108 ret->ioc_data = NULL; 103 ret->ioc_data = NULL;
109 } 104 }
110 105
@@ -176,7 +171,7 @@ void copy_io_context(struct io_context **pdst, struct io_context **psrc)
176} 171}
177EXPORT_SYMBOL(copy_io_context); 172EXPORT_SYMBOL(copy_io_context);
178 173
179int __init blk_ioc_init(void) 174static int __init blk_ioc_init(void)
180{ 175{
181 iocontext_cachep = kmem_cache_create("blkdev_ioc", 176 iocontext_cachep = kmem_cache_create("blkdev_ioc",
182 sizeof(struct io_context), 0, SLAB_PANIC, NULL); 177 sizeof(struct io_context), 0, SLAB_PANIC, NULL);
diff --git a/block/blk-map.c b/block/blk-map.c
index 955d75c1a58f..09f7fd0bcb73 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -19,6 +19,7 @@ int blk_rq_append_bio(struct request_queue *q, struct request *rq,
19 rq->biotail->bi_next = bio; 19 rq->biotail->bi_next = bio;
20 rq->biotail = bio; 20 rq->biotail = bio;
21 21
22 rq->raw_data_len += bio->bi_size;
22 rq->data_len += bio->bi_size; 23 rq->data_len += bio->bi_size;
23 } 24 }
24 return 0; 25 return 0;
@@ -139,10 +140,29 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
139 ubuf += ret; 140 ubuf += ret;
140 } 141 }
141 142
143 /*
144 * __blk_rq_map_user() copies the buffers if starting address
145 * or length isn't aligned. As the copied buffer is always
146 * page aligned, we know that there's enough room for padding.
147 * Extend the last bio and update rq->data_len accordingly.
148 *
149 * On unmap, bio_uncopy_user() will use unmodified
150 * bio_map_data pointed to by bio->bi_private.
151 */
152 if (len & queue_dma_alignment(q)) {
153 unsigned int pad_len = (queue_dma_alignment(q) & ~len) + 1;
154 struct bio *bio = rq->biotail;
155
156 bio->bi_io_vec[bio->bi_vcnt - 1].bv_len += pad_len;
157 bio->bi_size += pad_len;
158 rq->data_len += pad_len;
159 }
160
142 rq->buffer = rq->data = NULL; 161 rq->buffer = rq->data = NULL;
143 return 0; 162 return 0;
144unmap_rq: 163unmap_rq:
145 blk_rq_unmap_user(bio); 164 blk_rq_unmap_user(bio);
165 rq->bio = NULL;
146 return ret; 166 return ret;
147} 167}
148EXPORT_SYMBOL(blk_rq_map_user); 168EXPORT_SYMBOL(blk_rq_map_user);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index d3b84bbb776a..7506c4fe0264 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -220,7 +220,10 @@ new_segment:
220 bvprv = bvec; 220 bvprv = bvec;
221 } /* segments in rq */ 221 } /* segments in rq */
222 222
223 if (q->dma_drain_size) { 223 if (q->dma_drain_size && q->dma_drain_needed(rq)) {
224 if (rq->cmd_flags & REQ_RW)
225 memset(q->dma_drain_buffer, 0, q->dma_drain_size);
226
224 sg->page_link &= ~0x02; 227 sg->page_link &= ~0x02;
225 sg = sg_next(sg); 228 sg = sg_next(sg);
226 sg_set_page(sg, virt_to_page(q->dma_drain_buffer), 229 sg_set_page(sg, virt_to_page(q->dma_drain_buffer),
@@ -228,6 +231,7 @@ new_segment:
228 ((unsigned long)q->dma_drain_buffer) & 231 ((unsigned long)q->dma_drain_buffer) &
229 (PAGE_SIZE - 1)); 232 (PAGE_SIZE - 1));
230 nsegs++; 233 nsegs++;
234 rq->data_len += q->dma_drain_size;
231 } 235 }
232 236
233 if (sg) 237 if (sg)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index c8d0c5724098..9a8ffdd0ce3d 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -296,6 +296,7 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
296 * blk_queue_dma_drain - Set up a drain buffer for excess dma. 296 * blk_queue_dma_drain - Set up a drain buffer for excess dma.
297 * 297 *
298 * @q: the request queue for the device 298 * @q: the request queue for the device
299 * @dma_drain_needed: fn which returns non-zero if drain is necessary
299 * @buf: physically contiguous buffer 300 * @buf: physically contiguous buffer
300 * @size: size of the buffer in bytes 301 * @size: size of the buffer in bytes
301 * 302 *
@@ -315,14 +316,16 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
315 * device can support otherwise there won't be room for the drain 316 * device can support otherwise there won't be room for the drain
316 * buffer. 317 * buffer.
317 */ 318 */
318int blk_queue_dma_drain(struct request_queue *q, void *buf, 319extern int blk_queue_dma_drain(struct request_queue *q,
319 unsigned int size) 320 dma_drain_needed_fn *dma_drain_needed,
321 void *buf, unsigned int size)
320{ 322{
321 if (q->max_hw_segments < 2 || q->max_phys_segments < 2) 323 if (q->max_hw_segments < 2 || q->max_phys_segments < 2)
322 return -EINVAL; 324 return -EINVAL;
323 /* make room for appending the drain */ 325 /* make room for appending the drain */
324 --q->max_hw_segments; 326 --q->max_hw_segments;
325 --q->max_phys_segments; 327 --q->max_phys_segments;
328 q->dma_drain_needed = dma_drain_needed;
326 q->dma_drain_buffer = buf; 329 q->dma_drain_buffer = buf;
327 q->dma_drain_size = size; 330 q->dma_drain_size = size;
328 331
@@ -386,7 +389,7 @@ void blk_queue_update_dma_alignment(struct request_queue *q, int mask)
386} 389}
387EXPORT_SYMBOL(blk_queue_update_dma_alignment); 390EXPORT_SYMBOL(blk_queue_update_dma_alignment);
388 391
389int __init blk_settings_init(void) 392static int __init blk_settings_init(void)
390{ 393{
391 blk_max_low_pfn = max_low_pfn - 1; 394 blk_max_low_pfn = max_low_pfn - 1;
392 blk_max_pfn = max_pfn - 1; 395 blk_max_pfn = max_pfn - 1;
diff --git a/block/bsg.c b/block/bsg.c
index 8917c5174dc2..7f3c09549e4b 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -437,14 +437,14 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
437 } 437 }
438 438
439 if (rq->next_rq) { 439 if (rq->next_rq) {
440 hdr->dout_resid = rq->data_len; 440 hdr->dout_resid = rq->raw_data_len;
441 hdr->din_resid = rq->next_rq->data_len; 441 hdr->din_resid = rq->next_rq->raw_data_len;
442 blk_rq_unmap_user(bidi_bio); 442 blk_rq_unmap_user(bidi_bio);
443 blk_put_request(rq->next_rq); 443 blk_put_request(rq->next_rq);
444 } else if (rq_data_dir(rq) == READ) 444 } else if (rq_data_dir(rq) == READ)
445 hdr->din_resid = rq->data_len; 445 hdr->din_resid = rq->raw_data_len;
446 else 446 else
447 hdr->dout_resid = rq->data_len; 447 hdr->dout_resid = rq->raw_data_len;
448 448
449 /* 449 /*
450 * If the request generated a negative error number, return it 450 * If the request generated a negative error number, return it
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index ca198e61fa65..0f962ecae91f 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1145,38 +1145,19 @@ static void cfq_put_queue(struct cfq_queue *cfqq)
1145/* 1145/*
1146 * Call func for each cic attached to this ioc. Returns number of cic's seen. 1146 * Call func for each cic attached to this ioc. Returns number of cic's seen.
1147 */ 1147 */
1148#define CIC_GANG_NR 16
1149static unsigned int 1148static unsigned int
1150call_for_each_cic(struct io_context *ioc, 1149call_for_each_cic(struct io_context *ioc,
1151 void (*func)(struct io_context *, struct cfq_io_context *)) 1150 void (*func)(struct io_context *, struct cfq_io_context *))
1152{ 1151{
1153 struct cfq_io_context *cics[CIC_GANG_NR]; 1152 struct cfq_io_context *cic;
1154 unsigned long index = 0; 1153 struct hlist_node *n;
1155 unsigned int called = 0; 1154 int called = 0;
1156 int nr;
1157 1155
1158 rcu_read_lock(); 1156 rcu_read_lock();
1159 1157 hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) {
1160 do { 1158 func(ioc, cic);
1161 int i; 1159 called++;
1162 1160 }
1163 /*
1164 * Perhaps there's a better way - this just gang lookups from
1165 * 0 to the end, restarting after each CIC_GANG_NR from the
1166 * last key + 1.
1167 */
1168 nr = radix_tree_gang_lookup(&ioc->radix_root, (void **) cics,
1169 index, CIC_GANG_NR);
1170 if (!nr)
1171 break;
1172
1173 called += nr;
1174 index = 1 + (unsigned long) cics[nr - 1]->key;
1175
1176 for (i = 0; i < nr; i++)
1177 func(ioc, cics[i]);
1178 } while (nr == CIC_GANG_NR);
1179
1180 rcu_read_unlock(); 1161 rcu_read_unlock();
1181 1162
1182 return called; 1163 return called;
@@ -1190,6 +1171,7 @@ static void cic_free_func(struct io_context *ioc, struct cfq_io_context *cic)
1190 1171
1191 spin_lock_irqsave(&ioc->lock, flags); 1172 spin_lock_irqsave(&ioc->lock, flags);
1192 radix_tree_delete(&ioc->radix_root, cic->dead_key); 1173 radix_tree_delete(&ioc->radix_root, cic->dead_key);
1174 hlist_del_rcu(&cic->cic_list);
1193 spin_unlock_irqrestore(&ioc->lock, flags); 1175 spin_unlock_irqrestore(&ioc->lock, flags);
1194 1176
1195 kmem_cache_free(cfq_ioc_pool, cic); 1177 kmem_cache_free(cfq_ioc_pool, cic);
@@ -1280,6 +1262,7 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1280 if (cic) { 1262 if (cic) {
1281 cic->last_end_request = jiffies; 1263 cic->last_end_request = jiffies;
1282 INIT_LIST_HEAD(&cic->queue_list); 1264 INIT_LIST_HEAD(&cic->queue_list);
1265 INIT_HLIST_NODE(&cic->cic_list);
1283 cic->dtor = cfq_free_io_context; 1266 cic->dtor = cfq_free_io_context;
1284 cic->exit = cfq_exit_io_context; 1267 cic->exit = cfq_exit_io_context;
1285 elv_ioc_count_inc(ioc_count); 1268 elv_ioc_count_inc(ioc_count);
@@ -1501,6 +1484,7 @@ cfq_drop_dead_cic(struct cfq_data *cfqd, struct io_context *ioc,
1501 rcu_assign_pointer(ioc->ioc_data, NULL); 1484 rcu_assign_pointer(ioc->ioc_data, NULL);
1502 1485
1503 radix_tree_delete(&ioc->radix_root, (unsigned long) cfqd); 1486 radix_tree_delete(&ioc->radix_root, (unsigned long) cfqd);
1487 hlist_del_rcu(&cic->cic_list);
1504 spin_unlock_irqrestore(&ioc->lock, flags); 1488 spin_unlock_irqrestore(&ioc->lock, flags);
1505 1489
1506 cfq_cic_free(cic); 1490 cfq_cic_free(cic);
@@ -1561,6 +1545,8 @@ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc,
1561 spin_lock_irqsave(&ioc->lock, flags); 1545 spin_lock_irqsave(&ioc->lock, flags);
1562 ret = radix_tree_insert(&ioc->radix_root, 1546 ret = radix_tree_insert(&ioc->radix_root,
1563 (unsigned long) cfqd, cic); 1547 (unsigned long) cfqd, cic);
1548 if (!ret)
1549 hlist_add_head_rcu(&cic->cic_list, &ioc->cic_list);
1564 spin_unlock_irqrestore(&ioc->lock, flags); 1550 spin_unlock_irqrestore(&ioc->lock, flags);
1565 1551
1566 radix_tree_preload_end(); 1552 radix_tree_preload_end();
diff --git a/block/elevator.c b/block/elevator.c
index bafbae0344d3..88318c383608 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -134,6 +134,21 @@ static struct elevator_type *elevator_get(const char *name)
134 spin_lock(&elv_list_lock); 134 spin_lock(&elv_list_lock);
135 135
136 e = elevator_find(name); 136 e = elevator_find(name);
137 if (!e) {
138 char elv[ELV_NAME_MAX + strlen("-iosched")];
139
140 spin_unlock(&elv_list_lock);
141
142 if (!strcmp(name, "anticipatory"))
143 sprintf(elv, "as-iosched");
144 else
145 sprintf(elv, "%s-iosched", name);
146
147 request_module(elv);
148 spin_lock(&elv_list_lock);
149 e = elevator_find(name);
150 }
151
137 if (e && !try_module_get(e->elevator_owner)) 152 if (e && !try_module_get(e->elevator_owner))
138 e = NULL; 153 e = NULL;
139 154
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 9675b34638d4..e993cac4911d 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -266,7 +266,7 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
266 hdr->info = 0; 266 hdr->info = 0;
267 if (hdr->masked_status || hdr->host_status || hdr->driver_status) 267 if (hdr->masked_status || hdr->host_status || hdr->driver_status)
268 hdr->info |= SG_INFO_CHECK; 268 hdr->info |= SG_INFO_CHECK;
269 hdr->resid = rq->data_len; 269 hdr->resid = rq->raw_data_len;
270 hdr->sb_len_wr = 0; 270 hdr->sb_len_wr = 0;
271 271
272 if (rq->sense_len && hdr->sbp) { 272 if (rq->sense_len && hdr->sbp) {
@@ -528,6 +528,7 @@ static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk,
528 rq = blk_get_request(q, WRITE, __GFP_WAIT); 528 rq = blk_get_request(q, WRITE, __GFP_WAIT);
529 rq->cmd_type = REQ_TYPE_BLOCK_PC; 529 rq->cmd_type = REQ_TYPE_BLOCK_PC;
530 rq->data = NULL; 530 rq->data = NULL;
531 rq->raw_data_len = 0;
531 rq->data_len = 0; 532 rq->data_len = 0;
532 rq->timeout = BLK_DEFAULT_SG_TIMEOUT; 533 rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
533 memset(rq->cmd, 0, sizeof(rq->cmd)); 534 memset(rq->cmd, 0, sizeof(rq->cmd));
diff --git a/crypto/Kconfig b/crypto/Kconfig
index c3166a1a5bb6..898acc5c1967 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -74,6 +74,7 @@ config CRYPTO_XCBC
74config CRYPTO_NULL 74config CRYPTO_NULL
75 tristate "Null algorithms" 75 tristate "Null algorithms"
76 select CRYPTO_ALGAPI 76 select CRYPTO_ALGAPI
77 select CRYPTO_BLKCIPHER
77 help 78 help
78 These are 'Null' algorithms, used by IPsec, which do nothing. 79 These are 'Null' algorithms, used by IPsec, which do nothing.
79 80
@@ -567,6 +568,7 @@ config CRYPTO_TEST
567 depends on m 568 depends on m
568 select CRYPTO_ALGAPI 569 select CRYPTO_ALGAPI
569 select CRYPTO_AEAD 570 select CRYPTO_AEAD
571 select CRYPTO_BLKCIPHER
570 help 572 help
571 Quick & dirty crypto test module. 573 Quick & dirty crypto test module.
572 574
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 9ce983ed60f0..ea92bac42c53 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -186,6 +186,12 @@ static int __init dmi_unknown_osi_linux(const struct dmi_system_id *d)
186 acpi_dmi_osi_linux(-1, d); /* unknown */ 186 acpi_dmi_osi_linux(-1, d); /* unknown */
187 return 0; 187 return 0;
188} 188}
189static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
190{
191 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
192 acpi_osi_setup("!Windows 2006");
193 return 0;
194}
189 195
190/* 196/*
191 * Most BIOS that invoke OSI(Linux) do nothing with it. 197 * Most BIOS that invoke OSI(Linux) do nothing with it.
@@ -228,10 +234,10 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
228 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5520"), 234 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5520"),
229 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 6460"), 235 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 6460"),
230 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 7510"), 236 * DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 7510"),
231 * DMI_MATCH(DMI_PRODUCT_NAME, "Extensa 5220"),
232 * 237 *
233 * _OSI(Linux) is a NOP: 238 * _OSI(Linux) is a NOP:
234 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5315"), 239 * DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5315"),
240 * DMI_MATCH(DMI_PRODUCT_NAME, "Extensa 5220"),
235 */ 241 */
236 { 242 {
237 .callback = dmi_disable_osi_linux, 243 .callback = dmi_disable_osi_linux,
@@ -327,12 +333,20 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
327 }, 333 },
328 { /* OSI(Linux) effect unknown */ 334 { /* OSI(Linux) effect unknown */
329 .callback = dmi_unknown_osi_linux, 335 .callback = dmi_unknown_osi_linux,
330 .ident = "Dell OP GX620", 336 .ident = "Dell OptiPlex GX620",
331 .matches = { 337 .matches = {
332 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 338 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
333 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX620"), 339 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX620"),
334 }, 340 },
335 }, 341 },
342 { /* OSI(Linux) causes some USB initialization to not run */
343 .callback = dmi_unknown_osi_linux,
344 .ident = "Dell OptiPlex 755",
345 .matches = {
346 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
347 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 755"),
348 },
349 },
336 { /* OSI(Linux) effect unknown */ 350 { /* OSI(Linux) effect unknown */
337 .callback = dmi_unknown_osi_linux, 351 .callback = dmi_unknown_osi_linux,
338 .ident = "Dell PE 1900", 352 .ident = "Dell PE 1900",
@@ -342,6 +356,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
342 }, 356 },
343 }, 357 },
344 { /* OSI(Linux) is a NOP */ 358 { /* OSI(Linux) is a NOP */
359 .callback = dmi_unknown_osi_linux,
360 .ident = "Dell PE 1950",
361 .matches = {
362 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
363 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1950"),
364 },
365 },
366 { /* OSI(Linux) is a NOP */
345 .callback = dmi_disable_osi_linux, 367 .callback = dmi_disable_osi_linux,
346 .ident = "Dell PE R200", 368 .ident = "Dell PE R200",
347 .matches = { 369 .matches = {
@@ -357,6 +379,22 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
357 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation 390"), 379 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation 390"),
358 }, 380 },
359 }, 381 },
382 { /* OSI(Linux) touches USB */
383 .callback = dmi_unknown_osi_linux,
384 .ident = "Dell PR 390",
385 .matches = {
386 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
387 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation 690"),
388 },
389 },
390 { /* OSI(Linux) unknown - ASL looks benign, but may effect dock/SMM */
391 .callback = dmi_unknown_osi_linux,
392 .ident = "Dell PR M4300",
393 .matches = {
394 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
395 DMI_MATCH(DMI_PRODUCT_NAME, "Precision M4300"),
396 },
397 },
360 { /* OSI(Linux) is a NOP */ 398 { /* OSI(Linux) is a NOP */
361 .callback = dmi_disable_osi_linux, 399 .callback = dmi_disable_osi_linux,
362 .ident = "Dell Vostro 1000", 400 .ident = "Dell Vostro 1000",
@@ -390,10 +428,10 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
390 * DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pi 1536"), 428 * DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pi 1536"),
391 * DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pi 1556"), 429 * DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pi 1556"),
392 * DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xi 1546"), 430 * DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xi 1546"),
431 * DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
393 * _OSI(Linux) unknown effect: 432 * _OSI(Linux) unknown effect:
394 * DMI_MATCH(DMI_PRODUCT_NAME, "Amilo M1425"), 433 * DMI_MATCH(DMI_PRODUCT_NAME, "Amilo M1425"),
395 * DMI_MATCH(DMI_PRODUCT_NAME, "Amilo Si 1520"), 434 * DMI_MATCH(DMI_PRODUCT_NAME, "Amilo Si 1520"),
396 * DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
397 */ 435 */
398 { 436 {
399 .callback = dmi_disable_osi_linux, 437 .callback = dmi_disable_osi_linux,
@@ -402,6 +440,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
402 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 440 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
403 }, 441 },
404 }, 442 },
443 {
444 .callback = dmi_disable_osi_vista,
445 .ident = "Fujitsu Siemens",
446 .matches = {
447 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
448 DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
449 },
450 },
405 /* 451 /*
406 * Disable OSI(Linux) warnings on all "Hewlett-Packard" 452 * Disable OSI(Linux) warnings on all "Hewlett-Packard"
407 * 453 *
@@ -443,10 +489,11 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
443 * _OSI(Linux) helps sound 489 * _OSI(Linux) helps sound
444 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"), 490 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
445 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"), 491 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
492 * _OSI(Linux) has Linux specific hooks
493 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
446 * _OSI(Linux) is a NOP: 494 * _OSI(Linux) is a NOP:
447 * DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"), 495 * DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"),
448 * _OSI(Linux) effect unknown 496 * DMI_MATCH(DMI_PRODUCT_VERSION, "LENOVO3000 V100"),
449 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
450 */ 497 */
451 { 498 {
452 .callback = dmi_enable_osi_linux, 499 .callback = dmi_enable_osi_linux,
@@ -465,7 +512,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
465 }, 512 },
466 }, 513 },
467 { 514 {
468 .callback = dmi_unknown_osi_linux, 515 .callback = dmi_enable_osi_linux,
469 .ident = "Lenovo ThinkPad X61", 516 .ident = "Lenovo ThinkPad X61",
470 .matches = { 517 .matches = {
471 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 518 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@@ -473,7 +520,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
473 }, 520 },
474 }, 521 },
475 { 522 {
476 .callback = dmi_unknown_osi_linux, 523 .callback = dmi_disable_osi_linux,
477 .ident = "Lenovo 3000 V100", 524 .ident = "Lenovo 3000 V100",
478 .matches = { 525 .matches = {
479 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 526 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
@@ -543,8 +590,9 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
543 * Disable OSI(Linux) warnings on all "Sony Corporation" 590 * Disable OSI(Linux) warnings on all "Sony Corporation"
544 * 591 *
545 * _OSI(Linux) is a NOP: 592 * _OSI(Linux) is a NOP:
546 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SZ650N"), 593 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NR11S_S"),
547 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SZ38GP_C"), 594 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SZ38GP_C"),
595 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SZ650N"),
548 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-TZ21MN_N"), 596 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-TZ21MN_N"),
549 * _OSI(Linux) unknown effect: 597 * _OSI(Linux) unknown effect:
550 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ11M"), 598 * DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ11M"),
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 7222a18a0319..caf873c14bfb 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -943,7 +943,11 @@ int __init acpi_ec_ecdt_probe(void)
943 boot_ec->command_addr = ecdt_ptr->control.address; 943 boot_ec->command_addr = ecdt_ptr->control.address;
944 boot_ec->data_addr = ecdt_ptr->data.address; 944 boot_ec->data_addr = ecdt_ptr->data.address;
945 boot_ec->gpe = ecdt_ptr->gpe; 945 boot_ec->gpe = ecdt_ptr->gpe;
946 boot_ec->handle = ACPI_ROOT_OBJECT; 946 if (ACPI_FAILURE(acpi_get_handle(NULL, ecdt_ptr->id,
947 &boot_ec->handle))) {
948 pr_info("Failed to locate handle for boot EC\n");
949 boot_ec->handle = ACPI_ROOT_OBJECT;
950 }
947 } else { 951 } else {
948 /* This workaround is needed only on some broken machines, 952 /* This workaround is needed only on some broken machines,
949 * which require early EC, but fail to provide ECDT */ 953 * which require early EC, but fail to provide ECDT */
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index 5479dc0eeeec..abec1ca94cf4 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -110,7 +110,7 @@ static const struct file_operations acpi_system_event_ops = {
110#endif /* CONFIG_ACPI_PROC_EVENT */ 110#endif /* CONFIG_ACPI_PROC_EVENT */
111 111
112/* ACPI notifier chain */ 112/* ACPI notifier chain */
113BLOCKING_NOTIFIER_HEAD(acpi_chain_head); 113static BLOCKING_NOTIFIER_HEAD(acpi_chain_head);
114 114
115int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data) 115int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data)
116{ 116{
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c
index 2e9ce94798c7..3f51b7e84a17 100644
--- a/drivers/acpi/executer/exregion.c
+++ b/drivers/acpi/executer/exregion.c
@@ -338,6 +338,7 @@ acpi_ex_pci_config_space_handler(u32 function,
338 acpi_status status = AE_OK; 338 acpi_status status = AE_OK;
339 struct acpi_pci_id *pci_id; 339 struct acpi_pci_id *pci_id;
340 u16 pci_register; 340 u16 pci_register;
341 u32 value32;
341 342
342 ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); 343 ACPI_FUNCTION_TRACE(ex_pci_config_space_handler);
343 344
@@ -364,9 +365,9 @@ acpi_ex_pci_config_space_handler(u32 function,
364 switch (function) { 365 switch (function) {
365 case ACPI_READ: 366 case ACPI_READ:
366 367
367 *value = 0;
368 status = acpi_os_read_pci_configuration(pci_id, pci_register, 368 status = acpi_os_read_pci_configuration(pci_id, pci_register,
369 value, bit_width); 369 &value32, bit_width);
370 *value = value32;
370 break; 371 break;
371 372
372 case ACPI_WRITE: 373 case ACPI_WRITE:
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 48cb705b274a..c8e3cba423ef 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -256,22 +256,28 @@ static int acpi_fan_add(struct acpi_device *device)
256 256
257 cdev = thermal_cooling_device_register("Fan", device, 257 cdev = thermal_cooling_device_register("Fan", device,
258 &fan_cooling_ops); 258 &fan_cooling_ops);
259 if (cdev) 259 if (IS_ERR(cdev)) {
260 result = PTR_ERR(cdev);
261 goto end;
262 }
263 if (cdev) {
260 printk(KERN_INFO PREFIX 264 printk(KERN_INFO PREFIX
261 "%s is registered as cooling_device%d\n", 265 "%s is registered as cooling_device%d\n",
262 device->dev.bus_id, cdev->id); 266 device->dev.bus_id, cdev->id);
263 else
264 goto end;
265 acpi_driver_data(device) = cdev;
266 result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj,
267 "thermal_cooling");
268 if (result)
269 return result;
270 267
271 result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj, 268 acpi_driver_data(device) = cdev;
272 "device"); 269 result = sysfs_create_link(&device->dev.kobj,
273 if (result) 270 &cdev->device.kobj,
274 return result; 271 "thermal_cooling");
272 if (result)
273 return result;
274
275 result = sysfs_create_link(&cdev->device.kobj,
276 &device->dev.kobj,
277 "device");
278 if (result)
279 return result;
280 }
275 281
276 result = acpi_fan_add_fs(device); 282 result = acpi_fan_add_fs(device);
277 if (result) 283 if (result)
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 058d0be5cbe2..4290e0193097 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -616,6 +616,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
616 return_ACPI_STATUS(status); 616 return_ACPI_STATUS(status);
617 } 617 }
618 618
619 arg.integer.value = sleep_state;
619 status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL); 620 status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
620 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 621 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
621 ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK")); 622 ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK"));
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 34b3386dedca..8edba7b678eb 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -325,7 +325,7 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
325} 325}
326 326
327#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD 327#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
328struct acpi_table_header *acpi_find_dsdt_initrd(void) 328static struct acpi_table_header *acpi_find_dsdt_initrd(void)
329{ 329{
330 struct file *firmware_file; 330 struct file *firmware_file;
331 mm_segment_t oldfs; 331 mm_segment_t oldfs;
@@ -419,7 +419,7 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
419} 419}
420 420
421#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD 421#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
422int __init acpi_no_initrd_override_setup(char *s) 422static int __init acpi_no_initrd_override_setup(char *s)
423{ 423{
424 acpi_no_initrd_override = 1; 424 acpi_no_initrd_override = 1;
425 return 1; 425 return 1;
@@ -623,7 +623,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
623 623
624acpi_status 624acpi_status
625acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, 625acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
626 void *value, u32 width) 626 u32 *value, u32 width)
627{ 627{
628 int result, size; 628 int result, size;
629 629
@@ -689,7 +689,6 @@ static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
689 acpi_status status; 689 acpi_status status;
690 unsigned long temp; 690 unsigned long temp;
691 acpi_object_type type; 691 acpi_object_type type;
692 u8 tu8;
693 692
694 acpi_get_parent(chandle, &handle); 693 acpi_get_parent(chandle, &handle);
695 if (handle != rhandle) { 694 if (handle != rhandle) {
@@ -704,6 +703,7 @@ static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
704 acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, 703 acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
705 &temp); 704 &temp);
706 if (ACPI_SUCCESS(status)) { 705 if (ACPI_SUCCESS(status)) {
706 u32 val;
707 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); 707 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp));
708 pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); 708 pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp));
709 709
@@ -712,24 +712,24 @@ static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
712 712
713 /* any nicer way to get bus number of bridge ? */ 713 /* any nicer way to get bus number of bridge ? */
714 status = 714 status =
715 acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, 715 acpi_os_read_pci_configuration(pci_id, 0x0e, &val,
716 8); 716 8);
717 if (ACPI_SUCCESS(status) 717 if (ACPI_SUCCESS(status)
718 && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) { 718 && ((val & 0x7f) == 1 || (val & 0x7f) == 2)) {
719 status = 719 status =
720 acpi_os_read_pci_configuration(pci_id, 0x18, 720 acpi_os_read_pci_configuration(pci_id, 0x18,
721 &tu8, 8); 721 &val, 8);
722 if (!ACPI_SUCCESS(status)) { 722 if (!ACPI_SUCCESS(status)) {
723 /* Certainly broken... FIX ME */ 723 /* Certainly broken... FIX ME */
724 return; 724 return;
725 } 725 }
726 *is_bridge = 1; 726 *is_bridge = 1;
727 pci_id->bus = tu8; 727 pci_id->bus = val;
728 status = 728 status =
729 acpi_os_read_pci_configuration(pci_id, 0x19, 729 acpi_os_read_pci_configuration(pci_id, 0x19,
730 &tu8, 8); 730 &val, 8);
731 if (ACPI_SUCCESS(status)) { 731 if (ACPI_SUCCESS(status)) {
732 *bus_number = tu8; 732 *bus_number = val;
733 } 733 }
734 } else 734 } else
735 *is_bridge = 0; 735 *is_bridge = 0;
@@ -1109,7 +1109,7 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
1109 * string starting with '!' disables that string 1109 * string starting with '!' disables that string
1110 * otherwise string is added to list, augmenting built-in strings 1110 * otherwise string is added to list, augmenting built-in strings
1111 */ 1111 */
1112static int __init acpi_osi_setup(char *str) 1112int __init acpi_osi_setup(char *str)
1113{ 1113{
1114 if (str == NULL || *str == '\0') { 1114 if (str == NULL || *str == '\0') {
1115 printk(KERN_INFO PREFIX "_OSI method disabled\n"); 1115 printk(KERN_INFO PREFIX "_OSI method disabled\n");
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 75ccf5d18bf4..a3cc8a98255c 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
670 670
671 pr->cdev = thermal_cooling_device_register("Processor", device, 671 pr->cdev = thermal_cooling_device_register("Processor", device,
672 &processor_cooling_ops); 672 &processor_cooling_ops);
673 if (pr->cdev) 673 if (IS_ERR(pr->cdev)) {
674 result = PTR_ERR(pr->cdev);
675 goto end;
676 }
677 if (pr->cdev) {
674 printk(KERN_INFO PREFIX 678 printk(KERN_INFO PREFIX
675 "%s is registered as cooling_device%d\n", 679 "%s is registered as cooling_device%d\n",
676 device->dev.bus_id, pr->cdev->id); 680 device->dev.bus_id, pr->cdev->id);
677 else
678 goto end;
679 681
680 result = sysfs_create_link(&device->dev.kobj, &pr->cdev->device.kobj, 682 result = sysfs_create_link(&device->dev.kobj,
681 "thermal_cooling"); 683 &pr->cdev->device.kobj,
682 if (result) 684 "thermal_cooling");
683 return result; 685 if (result)
684 result = sysfs_create_link(&pr->cdev->device.kobj, &device->dev.kobj, 686 return result;
685 "device"); 687 result = sysfs_create_link(&pr->cdev->device.kobj,
686 if (result) 688 &device->dev.kobj,
687 return result; 689 "device");
690 if (result)
691 return result;
692 }
688 693
689 if (pr->flags.throttling) { 694 if (pr->flags.throttling) {
690 printk(KERN_INFO PREFIX "%s [%s] (supports", 695 printk(KERN_INFO PREFIX "%s [%s] (supports",
@@ -809,10 +814,12 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
809 814
810 acpi_processor_remove_fs(device); 815 acpi_processor_remove_fs(device);
811 816
812 sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); 817 if (pr->cdev) {
813 sysfs_remove_link(&pr->cdev->device.kobj, "device"); 818 sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
814 thermal_cooling_device_unregister(pr->cdev); 819 sysfs_remove_link(&pr->cdev->device.kobj, "device");
815 pr->cdev = NULL; 820 thermal_cooling_device_unregister(pr->cdev);
821 pr->cdev = NULL;
822 }
816 823
817 processors[pr->id] = NULL; 824 processors[pr->id] = NULL;
818 825
@@ -826,8 +833,6 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
826 * Acpi processor hotplug support * 833 * Acpi processor hotplug support *
827 ****************************************************************************/ 834 ****************************************************************************/
828 835
829static int is_processor_present(acpi_handle handle);
830
831static int is_processor_present(acpi_handle handle) 836static int is_processor_present(acpi_handle handle)
832{ 837{
833 acpi_status status; 838 acpi_status status;
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 32003fdc91e8..6f3b217699e9 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -364,7 +364,7 @@ int acpi_processor_resume(struct acpi_device * device)
364 return 0; 364 return 0;
365} 365}
366 366
367#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) 367#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
368static int tsc_halts_in_c(int state) 368static int tsc_halts_in_c(int state)
369{ 369{
370 switch (boot_cpu_data.x86_vendor) { 370 switch (boot_cpu_data.x86_vendor) {
@@ -544,7 +544,7 @@ static void acpi_processor_idle(void)
544 /* Get end time (ticks) */ 544 /* Get end time (ticks) */
545 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 545 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
546 546
547#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) 547#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
548 /* TSC halts in C2, so notify users */ 548 /* TSC halts in C2, so notify users */
549 if (tsc_halts_in_c(ACPI_STATE_C2)) 549 if (tsc_halts_in_c(ACPI_STATE_C2))
550 mark_tsc_unstable("possible TSC halt in C2"); 550 mark_tsc_unstable("possible TSC halt in C2");
@@ -609,7 +609,7 @@ static void acpi_processor_idle(void)
609 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); 609 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
610 } 610 }
611 611
612#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) 612#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
613 /* TSC halts in C3, so notify users */ 613 /* TSC halts in C3, so notify users */
614 if (tsc_halts_in_c(ACPI_STATE_C3)) 614 if (tsc_halts_in_c(ACPI_STATE_C3))
615 mark_tsc_unstable("TSC halts in C3"); 615 mark_tsc_unstable("TSC halts in C3");
@@ -945,11 +945,16 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
945 * Otherwise, ignore this info and continue. 945 * Otherwise, ignore this info and continue.
946 */ 946 */
947 cx.entry_method = ACPI_CSTATE_HALT; 947 cx.entry_method = ACPI_CSTATE_HALT;
948 snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT");
948 } else { 949 } else {
949 continue; 950 continue;
950 } 951 }
952 } else {
953 snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x",
954 cx.address);
951 } 955 }
952 956
957
953 obj = &(element->package.elements[2]); 958 obj = &(element->package.elements[2]);
954 if (obj->type != ACPI_TYPE_INTEGER) 959 if (obj->type != ACPI_TYPE_INTEGER)
955 continue; 960 continue;
@@ -1420,6 +1425,14 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
1420 return 0; 1425 return 0;
1421 1426
1422 local_irq_disable(); 1427 local_irq_disable();
1428
1429 /* Do not access any ACPI IO ports in suspend path */
1430 if (acpi_idle_suspend) {
1431 acpi_safe_halt();
1432 local_irq_enable();
1433 return 0;
1434 }
1435
1423 if (pr->flags.bm_check) 1436 if (pr->flags.bm_check)
1424 acpi_idle_update_bm_rld(pr, cx); 1437 acpi_idle_update_bm_rld(pr, cx);
1425 1438
@@ -1487,7 +1500,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1487 acpi_idle_do_entry(cx); 1500 acpi_idle_do_entry(cx);
1488 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1501 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1489 1502
1490#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) 1503#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
1491 /* TSC could halt in idle, so notify users */ 1504 /* TSC could halt in idle, so notify users */
1492 if (tsc_halts_in_c(cx->type)) 1505 if (tsc_halts_in_c(cx->type))
1493 mark_tsc_unstable("TSC halts in idle");; 1506 mark_tsc_unstable("TSC halts in idle");;
@@ -1601,7 +1614,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1601 spin_unlock(&c3_lock); 1614 spin_unlock(&c3_lock);
1602 } 1615 }
1603 1616
1604#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) 1617#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
1605 /* TSC could halt in idle, so notify users */ 1618 /* TSC could halt in idle, so notify users */
1606 if (tsc_halts_in_c(ACPI_STATE_C3)) 1619 if (tsc_halts_in_c(ACPI_STATE_C3))
1607 mark_tsc_unstable("TSC halts in idle"); 1620 mark_tsc_unstable("TSC halts in idle");
@@ -1643,6 +1656,11 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1643 return -EINVAL; 1656 return -EINVAL;
1644 } 1657 }
1645 1658
1659 for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
1660 dev->states[i].name[0] = '\0';
1661 dev->states[i].desc[0] = '\0';
1662 }
1663
1646 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { 1664 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
1647 cx = &pr->power.states[i]; 1665 cx = &pr->power.states[i];
1648 state = &dev->states[count]; 1666 state = &dev->states[count];
@@ -1659,6 +1677,7 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1659 cpuidle_set_statedata(state, cx); 1677 cpuidle_set_statedata(state, cx);
1660 1678
1661 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); 1679 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
1680 strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
1662 state->exit_latency = cx->latency; 1681 state->exit_latency = cx->latency;
1663 state->target_residency = cx->latency * latency_factor; 1682 state->target_residency = cx->latency * latency_factor;
1664 state->power_usage = cx->power; 1683 state->power_usage = cx->power;
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 34f157571080..eba55b7d6c95 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -36,16 +36,20 @@ ACPI_MODULE_NAME("utils");
36/* -------------------------------------------------------------------------- 36/* --------------------------------------------------------------------------
37 Object Evaluation Helpers 37 Object Evaluation Helpers
38 -------------------------------------------------------------------------- */ 38 -------------------------------------------------------------------------- */
39static void
40acpi_util_eval_error(acpi_handle h, acpi_string p, acpi_status s)
41{
39#ifdef ACPI_DEBUG_OUTPUT 42#ifdef ACPI_DEBUG_OUTPUT
40#define acpi_util_eval_error(h,p,s) {\ 43 char prefix[80] = {'\0'};
41 char prefix[80] = {'\0'};\ 44 struct acpi_buffer buffer = {sizeof(prefix), prefix};
42 struct acpi_buffer buffer = {sizeof(prefix), prefix};\ 45 acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer);
43 acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer);\ 46 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate [%s.%s]: %s\n",
44 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate [%s.%s]: %s\n",\ 47 (char *) prefix, p, acpi_format_exception(s)));
45 (char *) prefix, p, acpi_format_exception(s))); }
46#else 48#else
47#define acpi_util_eval_error(h,p,s) 49 return;
48#endif 50#endif
51}
52
49acpi_status 53acpi_status
50acpi_extract_package(union acpi_object *package, 54acpi_extract_package(union acpi_object *package,
51 struct acpi_buffer *format, struct acpi_buffer *buffer) 55 struct acpi_buffer *format, struct acpi_buffer *buffer)
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 7f714fa2a454..12cce69b5441 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -731,6 +731,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
731 731
732 device->cdev = thermal_cooling_device_register("LCD", 732 device->cdev = thermal_cooling_device_register("LCD",
733 device->dev, &video_cooling_ops); 733 device->dev, &video_cooling_ops);
734 if (IS_ERR(device->cdev))
735 return;
736
734 if (device->cdev) { 737 if (device->cdev) {
735 printk(KERN_INFO PREFIX 738 printk(KERN_INFO PREFIX
736 "%s is registered as cooling_device%d\n", 739 "%s is registered as cooling_device%d\n",
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c
index 457ed3d3f51c..efacc9f8bfe3 100644
--- a/drivers/acpi/wmi.c
+++ b/drivers/acpi/wmi.c
@@ -247,7 +247,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
247 block = &wblock->gblock; 247 block = &wblock->gblock;
248 handle = wblock->handle; 248 handle = wblock->handle;
249 249
250 if (!block->flags & ACPI_WMI_METHOD) 250 if (!(block->flags & ACPI_WMI_METHOD))
251 return AE_BAD_DATA; 251 return AE_BAD_DATA;
252 252
253 if (block->instance_count < instance) 253 if (block->instance_count < instance)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 29e71bddd6ff..6dd12f7019a0 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1932,7 +1932,7 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
1932 void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; 1932 void __iomem *mmio = host->iomap[AHCI_PCI_BAR];
1933 u32 ctl; 1933 u32 ctl;
1934 1934
1935 if (mesg.event == PM_EVENT_SUSPEND) { 1935 if (mesg.event & PM_EVENT_SLEEP) {
1936 /* AHCI spec rev1.1 section 8.3.3: 1936 /* AHCI spec rev1.1 section 8.3.3:
1937 * Software must disable interrupts prior to requesting a 1937 * Software must disable interrupts prior to requesting a
1938 * transition of the HBA to D3 state. 1938 * transition of the HBA to D3 state.
@@ -1975,16 +1975,11 @@ static int ahci_port_start(struct ata_port *ap)
1975 struct ahci_port_priv *pp; 1975 struct ahci_port_priv *pp;
1976 void *mem; 1976 void *mem;
1977 dma_addr_t mem_dma; 1977 dma_addr_t mem_dma;
1978 int rc;
1979 1978
1980 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); 1979 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
1981 if (!pp) 1980 if (!pp)
1982 return -ENOMEM; 1981 return -ENOMEM;
1983 1982
1984 rc = ata_pad_alloc(ap, dev);
1985 if (rc)
1986 return rc;
1987
1988 mem = dmam_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, 1983 mem = dmam_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma,
1989 GFP_KERNEL); 1984 GFP_KERNEL);
1990 if (!mem) 1985 if (!mem)
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 9c2515f67de5..fae8404254c0 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1339,7 +1339,7 @@ static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
1339 * cycles and power trying to do something to the sleeping 1339 * cycles and power trying to do something to the sleeping
1340 * beauty. 1340 * beauty.
1341 */ 1341 */
1342 if (piix_broken_suspend() && mesg.event == PM_EVENT_SUSPEND) { 1342 if (piix_broken_suspend() && (mesg.event & PM_EVENT_SLEEP)) {
1343 pci_save_state(pdev); 1343 pci_save_state(pdev);
1344 1344
1345 /* mark its power state as "unknown", since we don't 1345 /* mark its power state as "unknown", since we don't
@@ -1652,7 +1652,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
1652 u8 tmp; 1652 u8 tmp;
1653 pci_read_config_byte(pdev, PIIX_SCC, &tmp); 1653 pci_read_config_byte(pdev, PIIX_SCC, &tmp);
1654 if (tmp == PIIX_AHCI_DEVICE) { 1654 if (tmp == PIIX_AHCI_DEVICE) {
1655 int rc = piix_disable_ahci(pdev); 1655 rc = piix_disable_ahci(pdev);
1656 if (rc) 1656 if (rc)
1657 return rc; 1657 return rc;
1658 } 1658 }
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 004dae4ea5bc..4cf8662df99e 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -87,6 +87,28 @@ static struct workqueue_struct *ata_wq;
87 87
88struct workqueue_struct *ata_aux_wq; 88struct workqueue_struct *ata_aux_wq;
89 89
90struct ata_force_param {
91 const char *name;
92 unsigned int cbl;
93 int spd_limit;
94 unsigned long xfer_mask;
95 unsigned int horkage_on;
96 unsigned int horkage_off;
97};
98
99struct ata_force_ent {
100 int port;
101 int device;
102 struct ata_force_param param;
103};
104
105static struct ata_force_ent *ata_force_tbl;
106static int ata_force_tbl_size;
107
108static char ata_force_param_buf[PAGE_SIZE] __initdata;
109module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0444);
110MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)");
111
90int atapi_enabled = 1; 112int atapi_enabled = 1;
91module_param(atapi_enabled, int, 0444); 113module_param(atapi_enabled, int, 0444);
92MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); 114MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)");
@@ -130,6 +152,179 @@ MODULE_VERSION(DRV_VERSION);
130 152
131 153
132/** 154/**
155 * ata_force_cbl - force cable type according to libata.force
156 * @link: ATA link of interest
157 *
158 * Force cable type according to libata.force and whine about it.
159 * The last entry which has matching port number is used, so it
160 * can be specified as part of device force parameters. For
161 * example, both "a:40c,1.00:udma4" and "1.00:40c,udma4" have the
162 * same effect.
163 *
164 * LOCKING:
165 * EH context.
166 */
167void ata_force_cbl(struct ata_port *ap)
168{
169 int i;
170
171 for (i = ata_force_tbl_size - 1; i >= 0; i--) {
172 const struct ata_force_ent *fe = &ata_force_tbl[i];
173
174 if (fe->port != -1 && fe->port != ap->print_id)
175 continue;
176
177 if (fe->param.cbl == ATA_CBL_NONE)
178 continue;
179
180 ap->cbl = fe->param.cbl;
181 ata_port_printk(ap, KERN_NOTICE,
182 "FORCE: cable set to %s\n", fe->param.name);
183 return;
184 }
185}
186
187/**
188 * ata_force_spd_limit - force SATA spd limit according to libata.force
189 * @link: ATA link of interest
190 *
191 * Force SATA spd limit according to libata.force and whine about
192 * it. When only the port part is specified (e.g. 1:), the limit
193 * applies to all links connected to both the host link and all
194 * fan-out ports connected via PMP. If the device part is
195 * specified as 0 (e.g. 1.00:), it specifies the first fan-out
196 * link not the host link. Device number 15 always points to the
197 * host link whether PMP is attached or not.
198 *
199 * LOCKING:
200 * EH context.
201 */
202static void ata_force_spd_limit(struct ata_link *link)
203{
204 int linkno, i;
205
206 if (ata_is_host_link(link))
207 linkno = 15;
208 else
209 linkno = link->pmp;
210
211 for (i = ata_force_tbl_size - 1; i >= 0; i--) {
212 const struct ata_force_ent *fe = &ata_force_tbl[i];
213
214 if (fe->port != -1 && fe->port != link->ap->print_id)
215 continue;
216
217 if (fe->device != -1 && fe->device != linkno)
218 continue;
219
220 if (!fe->param.spd_limit)
221 continue;
222
223 link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1;
224 ata_link_printk(link, KERN_NOTICE,
225 "FORCE: PHY spd limit set to %s\n", fe->param.name);
226 return;
227 }
228}
229
230/**
231 * ata_force_xfermask - force xfermask according to libata.force
232 * @dev: ATA device of interest
233 *
234 * Force xfer_mask according to libata.force and whine about it.
235 * For consistency with link selection, device number 15 selects
236 * the first device connected to the host link.
237 *
238 * LOCKING:
239 * EH context.
240 */
241static void ata_force_xfermask(struct ata_device *dev)
242{
243 int devno = dev->link->pmp + dev->devno;
244 int alt_devno = devno;
245 int i;
246
247 /* allow n.15 for the first device attached to host port */
248 if (ata_is_host_link(dev->link) && devno == 0)
249 alt_devno = 15;
250
251 for (i = ata_force_tbl_size - 1; i >= 0; i--) {
252 const struct ata_force_ent *fe = &ata_force_tbl[i];
253 unsigned long pio_mask, mwdma_mask, udma_mask;
254
255 if (fe->port != -1 && fe->port != dev->link->ap->print_id)
256 continue;
257
258 if (fe->device != -1 && fe->device != devno &&
259 fe->device != alt_devno)
260 continue;
261
262 if (!fe->param.xfer_mask)
263 continue;
264
265 ata_unpack_xfermask(fe->param.xfer_mask,
266 &pio_mask, &mwdma_mask, &udma_mask);
267 if (udma_mask)
268 dev->udma_mask = udma_mask;
269 else if (mwdma_mask) {
270 dev->udma_mask = 0;
271 dev->mwdma_mask = mwdma_mask;
272 } else {
273 dev->udma_mask = 0;
274 dev->mwdma_mask = 0;
275 dev->pio_mask = pio_mask;
276 }
277
278 ata_dev_printk(dev, KERN_NOTICE,
279 "FORCE: xfer_mask set to %s\n", fe->param.name);
280 return;
281 }
282}
283
284/**
285 * ata_force_horkage - force horkage according to libata.force
286 * @dev: ATA device of interest
287 *
288 * Force horkage according to libata.force and whine about it.
289 * For consistency with link selection, device number 15 selects
290 * the first device connected to the host link.
291 *
292 * LOCKING:
293 * EH context.
294 */
295static void ata_force_horkage(struct ata_device *dev)
296{
297 int devno = dev->link->pmp + dev->devno;
298 int alt_devno = devno;
299 int i;
300
301 /* allow n.15 for the first device attached to host port */
302 if (ata_is_host_link(dev->link) && devno == 0)
303 alt_devno = 15;
304
305 for (i = 0; i < ata_force_tbl_size; i++) {
306 const struct ata_force_ent *fe = &ata_force_tbl[i];
307
308 if (fe->port != -1 && fe->port != dev->link->ap->print_id)
309 continue;
310
311 if (fe->device != -1 && fe->device != devno &&
312 fe->device != alt_devno)
313 continue;
314
315 if (!(~dev->horkage & fe->param.horkage_on) &&
316 !(dev->horkage & fe->param.horkage_off))
317 continue;
318
319 dev->horkage |= fe->param.horkage_on;
320 dev->horkage &= ~fe->param.horkage_off;
321
322 ata_dev_printk(dev, KERN_NOTICE,
323 "FORCE: horkage modified (%s)\n", fe->param.name);
324 }
325}
326
327/**
133 * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure 328 * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure
134 * @tf: Taskfile to convert 329 * @tf: Taskfile to convert
135 * @pmp: Port multiplier port 330 * @pmp: Port multiplier port
@@ -2067,6 +2262,7 @@ int ata_dev_configure(struct ata_device *dev)
2067 2262
2068 /* set horkage */ 2263 /* set horkage */
2069 dev->horkage |= ata_dev_blacklisted(dev); 2264 dev->horkage |= ata_dev_blacklisted(dev);
2265 ata_force_horkage(dev);
2070 2266
2071 /* let ACPI work its magic */ 2267 /* let ACPI work its magic */
2072 rc = ata_acpi_on_devcfg(dev); 2268 rc = ata_acpi_on_devcfg(dev);
@@ -3150,6 +3346,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
3150 mode_mask = ATA_DMA_MASK_CFA; 3346 mode_mask = ATA_DMA_MASK_CFA;
3151 3347
3152 ata_dev_xfermask(dev); 3348 ata_dev_xfermask(dev);
3349 ata_force_xfermask(dev);
3153 3350
3154 pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0); 3351 pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0);
3155 dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask); 3352 dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask);
@@ -4190,6 +4387,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4190 /* Devices which report 1 sector over size HPA */ 4387 /* Devices which report 1 sector over size HPA */
4191 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4388 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, },
4192 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4389 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, },
4390 { "ST310211A", NULL, ATA_HORKAGE_HPA_SIZE, },
4193 4391
4194 /* Devices which get the IVB wrong */ 4392 /* Devices which get the IVB wrong */
4195 { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, }, 4393 { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, },
@@ -4492,30 +4690,13 @@ void ata_sg_clean(struct ata_queued_cmd *qc)
4492 struct ata_port *ap = qc->ap; 4690 struct ata_port *ap = qc->ap;
4493 struct scatterlist *sg = qc->sg; 4691 struct scatterlist *sg = qc->sg;
4494 int dir = qc->dma_dir; 4692 int dir = qc->dma_dir;
4495 void *pad_buf = NULL;
4496 4693
4497 WARN_ON(sg == NULL); 4694 WARN_ON(sg == NULL);
4498 4695
4499 VPRINTK("unmapping %u sg elements\n", qc->mapped_n_elem); 4696 VPRINTK("unmapping %u sg elements\n", qc->n_elem);
4500 4697
4501 /* if we padded the buffer out to 32-bit bound, and data 4698 if (qc->n_elem)
4502 * xfer direction is from-device, we must copy from the 4699 dma_unmap_sg(ap->dev, sg, qc->n_elem, dir);
4503 * pad buffer back into the supplied buffer
4504 */
4505 if (qc->pad_len && !(qc->tf.flags & ATA_TFLAG_WRITE))
4506 pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ);
4507
4508 if (qc->mapped_n_elem)
4509 dma_unmap_sg(ap->dev, sg, qc->mapped_n_elem, dir);
4510 /* restore last sg */
4511 if (qc->last_sg)
4512 *qc->last_sg = qc->saved_last_sg;
4513 if (pad_buf) {
4514 struct scatterlist *psg = &qc->extra_sg[1];
4515 void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
4516 memcpy(addr + psg->offset, pad_buf, qc->pad_len);
4517 kunmap_atomic(addr, KM_IRQ0);
4518 }
4519 4700
4520 qc->flags &= ~ATA_QCFLAG_DMAMAP; 4701 qc->flags &= ~ATA_QCFLAG_DMAMAP;
4521 qc->sg = NULL; 4702 qc->sg = NULL;
@@ -4658,43 +4839,6 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
4658} 4839}
4659 4840
4660/** 4841/**
4661 * atapi_qc_may_overflow - Check whether data transfer may overflow
4662 * @qc: ATA command in question
4663 *
4664 * ATAPI commands which transfer variable length data to host
4665 * might overflow due to application error or hardare bug. This
4666 * function checks whether overflow should be drained and ignored
4667 * for @qc.
4668 *
4669 * LOCKING:
4670 * None.
4671 *
4672 * RETURNS:
4673 * 1 if @qc may overflow; otherwise, 0.
4674 */
4675static int atapi_qc_may_overflow(struct ata_queued_cmd *qc)
4676{
4677 if (qc->tf.protocol != ATAPI_PROT_PIO &&
4678 qc->tf.protocol != ATAPI_PROT_DMA)
4679 return 0;
4680
4681 if (qc->tf.flags & ATA_TFLAG_WRITE)
4682 return 0;
4683
4684 switch (qc->cdb[0]) {
4685 case READ_10:
4686 case READ_12:
4687 case WRITE_10:
4688 case WRITE_12:
4689 case GPCMD_READ_CD:
4690 case GPCMD_READ_CD_MSF:
4691 return 0;
4692 }
4693
4694 return 1;
4695}
4696
4697/**
4698 * ata_std_qc_defer - Check whether a qc needs to be deferred 4842 * ata_std_qc_defer - Check whether a qc needs to be deferred
4699 * @qc: ATA command in question 4843 * @qc: ATA command in question
4700 * 4844 *
@@ -4781,97 +4925,6 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
4781 qc->cursg = qc->sg; 4925 qc->cursg = qc->sg;
4782} 4926}
4783 4927
4784static unsigned int ata_sg_setup_extra(struct ata_queued_cmd *qc,
4785 unsigned int *n_elem_extra,
4786 unsigned int *nbytes_extra)
4787{
4788 struct ata_port *ap = qc->ap;
4789 unsigned int n_elem = qc->n_elem;
4790 struct scatterlist *lsg, *copy_lsg = NULL, *tsg = NULL, *esg = NULL;
4791
4792 *n_elem_extra = 0;
4793 *nbytes_extra = 0;
4794
4795 /* needs padding? */
4796 qc->pad_len = qc->nbytes & 3;
4797
4798 if (likely(!qc->pad_len))
4799 return n_elem;
4800
4801 /* locate last sg and save it */
4802 lsg = sg_last(qc->sg, n_elem);
4803 qc->last_sg = lsg;
4804 qc->saved_last_sg = *lsg;
4805
4806 sg_init_table(qc->extra_sg, ARRAY_SIZE(qc->extra_sg));
4807
4808 if (qc->pad_len) {
4809 struct scatterlist *psg = &qc->extra_sg[1];
4810 void *pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ);
4811 unsigned int offset;
4812
4813 WARN_ON(qc->dev->class != ATA_DEV_ATAPI);
4814
4815 memset(pad_buf, 0, ATA_DMA_PAD_SZ);
4816
4817 /* psg->page/offset are used to copy to-be-written
4818 * data in this function or read data in ata_sg_clean.
4819 */
4820 offset = lsg->offset + lsg->length - qc->pad_len;
4821 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
4822 qc->pad_len, offset_in_page(offset));
4823
4824 if (qc->tf.flags & ATA_TFLAG_WRITE) {
4825 void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
4826 memcpy(pad_buf, addr + psg->offset, qc->pad_len);
4827 kunmap_atomic(addr, KM_IRQ0);
4828 }
4829
4830 sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ);
4831 sg_dma_len(psg) = ATA_DMA_PAD_SZ;
4832
4833 /* Trim the last sg entry and chain the original and
4834 * padding sg lists.
4835 *
4836 * Because chaining consumes one sg entry, one extra
4837 * sg entry is allocated and the last sg entry is
4838 * copied to it if the length isn't zero after padded
4839 * amount is removed.
4840 *
4841 * If the last sg entry is completely replaced by
4842 * padding sg entry, the first sg entry is skipped
4843 * while chaining.
4844 */
4845 lsg->length -= qc->pad_len;
4846 if (lsg->length) {
4847 copy_lsg = &qc->extra_sg[0];
4848 tsg = &qc->extra_sg[0];
4849 } else {
4850 n_elem--;
4851 tsg = &qc->extra_sg[1];
4852 }
4853
4854 esg = &qc->extra_sg[1];
4855
4856 (*n_elem_extra)++;
4857 (*nbytes_extra) += 4 - qc->pad_len;
4858 }
4859
4860 if (copy_lsg)
4861 sg_set_page(copy_lsg, sg_page(lsg), lsg->length, lsg->offset);
4862
4863 sg_chain(lsg, 1, tsg);
4864 sg_mark_end(esg);
4865
4866 /* sglist can't start with chaining sg entry, fast forward */
4867 if (qc->sg == lsg) {
4868 qc->sg = tsg;
4869 qc->cursg = tsg;
4870 }
4871
4872 return n_elem;
4873}
4874
4875/** 4928/**
4876 * ata_sg_setup - DMA-map the scatter-gather table associated with a command. 4929 * ata_sg_setup - DMA-map the scatter-gather table associated with a command.
4877 * @qc: Command with scatter-gather table to be mapped. 4930 * @qc: Command with scatter-gather table to be mapped.
@@ -4888,26 +4941,17 @@ static unsigned int ata_sg_setup_extra(struct ata_queued_cmd *qc,
4888static int ata_sg_setup(struct ata_queued_cmd *qc) 4941static int ata_sg_setup(struct ata_queued_cmd *qc)
4889{ 4942{
4890 struct ata_port *ap = qc->ap; 4943 struct ata_port *ap = qc->ap;
4891 unsigned int n_elem, n_elem_extra, nbytes_extra; 4944 unsigned int n_elem;
4892 4945
4893 VPRINTK("ENTER, ata%u\n", ap->print_id); 4946 VPRINTK("ENTER, ata%u\n", ap->print_id);
4894 4947
4895 n_elem = ata_sg_setup_extra(qc, &n_elem_extra, &nbytes_extra); 4948 n_elem = dma_map_sg(ap->dev, qc->sg, qc->n_elem, qc->dma_dir);
4949 if (n_elem < 1)
4950 return -1;
4896 4951
4897 if (n_elem) { 4952 DPRINTK("%d sg elements mapped\n", n_elem);
4898 n_elem = dma_map_sg(ap->dev, qc->sg, n_elem, qc->dma_dir);
4899 if (n_elem < 1) {
4900 /* restore last sg */
4901 if (qc->last_sg)
4902 *qc->last_sg = qc->saved_last_sg;
4903 return -1;
4904 }
4905 DPRINTK("%d sg elements mapped\n", n_elem);
4906 }
4907 4953
4908 qc->n_elem = qc->mapped_n_elem = n_elem; 4954 qc->n_elem = n_elem;
4909 qc->n_elem += n_elem_extra;
4910 qc->nbytes += nbytes_extra;
4911 qc->flags |= ATA_QCFLAG_DMAMAP; 4955 qc->flags |= ATA_QCFLAG_DMAMAP;
4912 4956
4913 return 0; 4957 return 0;
@@ -5145,46 +5189,22 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
5145 */ 5189 */
5146static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) 5190static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
5147{ 5191{
5148 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); 5192 int rw = (qc->tf.flags & ATA_TFLAG_WRITE) ? WRITE : READ;
5149 struct ata_port *ap = qc->ap; 5193 struct ata_port *ap = qc->ap;
5150 struct ata_eh_info *ehi = &qc->dev->link->eh_info; 5194 struct ata_device *dev = qc->dev;
5195 struct ata_eh_info *ehi = &dev->link->eh_info;
5151 struct scatterlist *sg; 5196 struct scatterlist *sg;
5152 struct page *page; 5197 struct page *page;
5153 unsigned char *buf; 5198 unsigned char *buf;
5154 unsigned int offset, count; 5199 unsigned int offset, count, consumed;
5155 5200
5156next_sg: 5201next_sg:
5157 sg = qc->cursg; 5202 sg = qc->cursg;
5158 if (unlikely(!sg)) { 5203 if (unlikely(!sg)) {
5159 /* 5204 ata_ehi_push_desc(ehi, "unexpected or too much trailing data "
5160 * The end of qc->sg is reached and the device expects 5205 "buf=%u cur=%u bytes=%u",
5161 * more data to transfer. In order not to overrun qc->sg 5206 qc->nbytes, qc->curbytes, bytes);
5162 * and fulfill length specified in the byte count register, 5207 return -1;
5163 * - for read case, discard trailing data from the device
5164 * - for write case, padding zero data to the device
5165 */
5166 u16 pad_buf[1] = { 0 };
5167 unsigned int i;
5168
5169 if (bytes > qc->curbytes - qc->nbytes + ATAPI_MAX_DRAIN) {
5170 ata_ehi_push_desc(ehi, "too much trailing data "
5171 "buf=%u cur=%u bytes=%u",
5172 qc->nbytes, qc->curbytes, bytes);
5173 return -1;
5174 }
5175
5176 /* overflow is exptected for misc ATAPI commands */
5177 if (bytes && !atapi_qc_may_overflow(qc))
5178 ata_dev_printk(qc->dev, KERN_WARNING, "ATAPI %u bytes "
5179 "trailing data (cdb=%02x nbytes=%u)\n",
5180 bytes, qc->cdb[0], qc->nbytes);
5181
5182 for (i = 0; i < (bytes + 1) / 2; i++)
5183 ap->ops->data_xfer(qc->dev, (unsigned char *)pad_buf, 2, do_write);
5184
5185 qc->curbytes += bytes;
5186
5187 return 0;
5188 } 5208 }
5189 5209
5190 page = sg_page(sg); 5210 page = sg_page(sg);
@@ -5210,18 +5230,16 @@ next_sg:
5210 buf = kmap_atomic(page, KM_IRQ0); 5230 buf = kmap_atomic(page, KM_IRQ0);
5211 5231
5212 /* do the actual data transfer */ 5232 /* do the actual data transfer */
5213 ap->ops->data_xfer(qc->dev, buf + offset, count, do_write); 5233 consumed = ap->ops->data_xfer(dev, buf + offset, count, rw);
5214 5234
5215 kunmap_atomic(buf, KM_IRQ0); 5235 kunmap_atomic(buf, KM_IRQ0);
5216 local_irq_restore(flags); 5236 local_irq_restore(flags);
5217 } else { 5237 } else {
5218 buf = page_address(page); 5238 buf = page_address(page);
5219 ap->ops->data_xfer(qc->dev, buf + offset, count, do_write); 5239 consumed = ap->ops->data_xfer(dev, buf + offset, count, rw);
5220 } 5240 }
5221 5241
5222 bytes -= count; 5242 bytes -= min(bytes, consumed);
5223 if ((count & 1) && bytes)
5224 bytes--;
5225 qc->curbytes += count; 5243 qc->curbytes += count;
5226 qc->cursg_ofs += count; 5244 qc->cursg_ofs += count;
5227 5245
@@ -5230,9 +5248,11 @@ next_sg:
5230 qc->cursg_ofs = 0; 5248 qc->cursg_ofs = 0;
5231 } 5249 }
5232 5250
5251 /* consumed can be larger than count only for the last transfer */
5252 WARN_ON(qc->cursg && count != consumed);
5253
5233 if (bytes) 5254 if (bytes)
5234 goto next_sg; 5255 goto next_sg;
5235
5236 return 0; 5256 return 0;
5237} 5257}
5238 5258
@@ -5250,6 +5270,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
5250{ 5270{
5251 struct ata_port *ap = qc->ap; 5271 struct ata_port *ap = qc->ap;
5252 struct ata_device *dev = qc->dev; 5272 struct ata_device *dev = qc->dev;
5273 struct ata_eh_info *ehi = &dev->link->eh_info;
5253 unsigned int ireason, bc_lo, bc_hi, bytes; 5274 unsigned int ireason, bc_lo, bc_hi, bytes;
5254 int i_write, do_write = (qc->tf.flags & ATA_TFLAG_WRITE) ? 1 : 0; 5275 int i_write, do_write = (qc->tf.flags & ATA_TFLAG_WRITE) ? 1 : 0;
5255 5276
@@ -5267,26 +5288,28 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
5267 5288
5268 /* shall be cleared to zero, indicating xfer of data */ 5289 /* shall be cleared to zero, indicating xfer of data */
5269 if (unlikely(ireason & (1 << 0))) 5290 if (unlikely(ireason & (1 << 0)))
5270 goto err_out; 5291 goto atapi_check;
5271 5292
5272 /* make sure transfer direction matches expected */ 5293 /* make sure transfer direction matches expected */
5273 i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0; 5294 i_write = ((ireason & (1 << 1)) == 0) ? 1 : 0;
5274 if (unlikely(do_write != i_write)) 5295 if (unlikely(do_write != i_write))
5275 goto err_out; 5296 goto atapi_check;
5276 5297
5277 if (unlikely(!bytes)) 5298 if (unlikely(!bytes))
5278 goto err_out; 5299 goto atapi_check;
5279 5300
5280 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes); 5301 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);
5281 5302
5282 if (__atapi_pio_bytes(qc, bytes)) 5303 if (unlikely(__atapi_pio_bytes(qc, bytes)))
5283 goto err_out; 5304 goto err_out;
5284 ata_altstatus(ap); /* flush */ 5305 ata_altstatus(ap); /* flush */
5285 5306
5286 return; 5307 return;
5287 5308
5288err_out: 5309 atapi_check:
5289 ata_dev_printk(dev, KERN_INFO, "ATAPI check failed\n"); 5310 ata_ehi_push_desc(ehi, "ATAPI check failed (ireason=0x%x bytes=%u)",
5311 ireason, bytes);
5312 err_out:
5290 qc->err_mask |= AC_ERR_HSM; 5313 qc->err_mask |= AC_ERR_HSM;
5291 ap->hsm_task_state = HSM_ST_ERR; 5314 ap->hsm_task_state = HSM_ST_ERR;
5292} 5315}
@@ -5971,9 +5994,6 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
5971 */ 5994 */
5972 BUG_ON(ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes)); 5995 BUG_ON(ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes));
5973 5996
5974 /* ata_sg_setup() may update nbytes */
5975 qc->raw_nbytes = qc->nbytes;
5976
5977 if (ata_is_dma(prot) || (ata_is_pio(prot) && 5997 if (ata_is_dma(prot) || (ata_is_pio(prot) &&
5978 (ap->flags & ATA_FLAG_PIO_DMA))) 5998 (ap->flags & ATA_FLAG_PIO_DMA)))
5979 if (ata_sg_setup(qc)) 5999 if (ata_sg_setup(qc))
@@ -6582,19 +6602,12 @@ void ata_host_resume(struct ata_host *host)
6582int ata_port_start(struct ata_port *ap) 6602int ata_port_start(struct ata_port *ap)
6583{ 6603{
6584 struct device *dev = ap->dev; 6604 struct device *dev = ap->dev;
6585 int rc;
6586 6605
6587 ap->prd = dmam_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, 6606 ap->prd = dmam_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma,
6588 GFP_KERNEL); 6607 GFP_KERNEL);
6589 if (!ap->prd) 6608 if (!ap->prd)
6590 return -ENOMEM; 6609 return -ENOMEM;
6591 6610
6592 rc = ata_pad_alloc(ap, dev);
6593 if (rc)
6594 return rc;
6595
6596 DPRINTK("prd alloc, virt %p, dma %llx\n", ap->prd,
6597 (unsigned long long)ap->prd_dma);
6598 return 0; 6611 return 0;
6599} 6612}
6600 6613
@@ -6681,7 +6694,8 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp)
6681 */ 6694 */
6682int sata_link_init_spd(struct ata_link *link) 6695int sata_link_init_spd(struct ata_link *link)
6683{ 6696{
6684 u32 scontrol, spd; 6697 u32 scontrol;
6698 u8 spd;
6685 int rc; 6699 int rc;
6686 6700
6687 rc = sata_scr_read(link, SCR_CONTROL, &scontrol); 6701 rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
@@ -6692,6 +6706,8 @@ int sata_link_init_spd(struct ata_link *link)
6692 if (spd) 6706 if (spd)
6693 link->hw_sata_spd_limit &= (1 << spd) - 1; 6707 link->hw_sata_spd_limit &= (1 << spd) - 1;
6694 6708
6709 ata_force_spd_limit(link);
6710
6695 link->sata_spd_limit = link->hw_sata_spd_limit; 6711 link->sata_spd_limit = link->hw_sata_spd_limit;
6696 6712
6697 return 0; 6713 return 0;
@@ -7086,7 +7102,6 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
7086 DPRINTK("probe begin\n"); 7102 DPRINTK("probe begin\n");
7087 for (i = 0; i < host->n_ports; i++) { 7103 for (i = 0; i < host->n_ports; i++) {
7088 struct ata_port *ap = host->ports[i]; 7104 struct ata_port *ap = host->ports[i];
7089 int rc;
7090 7105
7091 /* probe */ 7106 /* probe */
7092 if (ap->ops->error_handler) { 7107 if (ap->ops->error_handler) {
@@ -7353,7 +7368,7 @@ void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg)
7353 pci_save_state(pdev); 7368 pci_save_state(pdev);
7354 pci_disable_device(pdev); 7369 pci_disable_device(pdev);
7355 7370
7356 if (mesg.event == PM_EVENT_SUSPEND) 7371 if (mesg.event & PM_EVENT_SLEEP)
7357 pci_set_power_state(pdev, PCI_D3hot); 7372 pci_set_power_state(pdev, PCI_D3hot);
7358} 7373}
7359 7374
@@ -7403,10 +7418,187 @@ int ata_pci_device_resume(struct pci_dev *pdev)
7403 7418
7404#endif /* CONFIG_PCI */ 7419#endif /* CONFIG_PCI */
7405 7420
7421static int __init ata_parse_force_one(char **cur,
7422 struct ata_force_ent *force_ent,
7423 const char **reason)
7424{
7425 /* FIXME: Currently, there's no way to tag init const data and
7426 * using __initdata causes build failure on some versions of
7427 * gcc. Once __initdataconst is implemented, add const to the
7428 * following structure.
7429 */
7430 static struct ata_force_param force_tbl[] __initdata = {
7431 { "40c", .cbl = ATA_CBL_PATA40 },
7432 { "80c", .cbl = ATA_CBL_PATA80 },
7433 { "short40c", .cbl = ATA_CBL_PATA40_SHORT },
7434 { "unk", .cbl = ATA_CBL_PATA_UNK },
7435 { "ign", .cbl = ATA_CBL_PATA_IGN },
7436 { "sata", .cbl = ATA_CBL_SATA },
7437 { "1.5Gbps", .spd_limit = 1 },
7438 { "3.0Gbps", .spd_limit = 2 },
7439 { "noncq", .horkage_on = ATA_HORKAGE_NONCQ },
7440 { "ncq", .horkage_off = ATA_HORKAGE_NONCQ },
7441 { "pio0", .xfer_mask = 1 << (ATA_SHIFT_PIO + 0) },
7442 { "pio1", .xfer_mask = 1 << (ATA_SHIFT_PIO + 1) },
7443 { "pio2", .xfer_mask = 1 << (ATA_SHIFT_PIO + 2) },
7444 { "pio3", .xfer_mask = 1 << (ATA_SHIFT_PIO + 3) },
7445 { "pio4", .xfer_mask = 1 << (ATA_SHIFT_PIO + 4) },
7446 { "pio5", .xfer_mask = 1 << (ATA_SHIFT_PIO + 5) },
7447 { "pio6", .xfer_mask = 1 << (ATA_SHIFT_PIO + 6) },
7448 { "mwdma0", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 0) },
7449 { "mwdma1", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 1) },
7450 { "mwdma2", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 2) },
7451 { "mwdma3", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 3) },
7452 { "mwdma4", .xfer_mask = 1 << (ATA_SHIFT_MWDMA + 4) },
7453 { "udma0", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 0) },
7454 { "udma16", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 0) },
7455 { "udma/16", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 0) },
7456 { "udma1", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 1) },
7457 { "udma25", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 1) },
7458 { "udma/25", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 1) },
7459 { "udma2", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 2) },
7460 { "udma33", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 2) },
7461 { "udma/33", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 2) },
7462 { "udma3", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 3) },
7463 { "udma44", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 3) },
7464 { "udma/44", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 3) },
7465 { "udma4", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 4) },
7466 { "udma66", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 4) },
7467 { "udma/66", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 4) },
7468 { "udma5", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 5) },
7469 { "udma100", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 5) },
7470 { "udma/100", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 5) },
7471 { "udma6", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) },
7472 { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) },
7473 { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) },
7474 { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) },
7475 };
7476 char *start = *cur, *p = *cur;
7477 char *id, *val, *endp;
7478 const struct ata_force_param *match_fp = NULL;
7479 int nr_matches = 0, i;
7480
7481 /* find where this param ends and update *cur */
7482 while (*p != '\0' && *p != ',')
7483 p++;
7484
7485 if (*p == '\0')
7486 *cur = p;
7487 else
7488 *cur = p + 1;
7489
7490 *p = '\0';
7491
7492 /* parse */
7493 p = strchr(start, ':');
7494 if (!p) {
7495 val = strstrip(start);
7496 goto parse_val;
7497 }
7498 *p = '\0';
7499
7500 id = strstrip(start);
7501 val = strstrip(p + 1);
7502
7503 /* parse id */
7504 p = strchr(id, '.');
7505 if (p) {
7506 *p++ = '\0';
7507 force_ent->device = simple_strtoul(p, &endp, 10);
7508 if (p == endp || *endp != '\0') {
7509 *reason = "invalid device";
7510 return -EINVAL;
7511 }
7512 }
7513
7514 force_ent->port = simple_strtoul(id, &endp, 10);
7515 if (p == endp || *endp != '\0') {
7516 *reason = "invalid port/link";
7517 return -EINVAL;
7518 }
7519
7520 parse_val:
7521 /* parse val, allow shortcuts so that both 1.5 and 1.5Gbps work */
7522 for (i = 0; i < ARRAY_SIZE(force_tbl); i++) {
7523 const struct ata_force_param *fp = &force_tbl[i];
7524
7525 if (strncasecmp(val, fp->name, strlen(val)))
7526 continue;
7527
7528 nr_matches++;
7529 match_fp = fp;
7530
7531 if (strcasecmp(val, fp->name) == 0) {
7532 nr_matches = 1;
7533 break;
7534 }
7535 }
7536
7537 if (!nr_matches) {
7538 *reason = "unknown value";
7539 return -EINVAL;
7540 }
7541 if (nr_matches > 1) {
7542 *reason = "ambigious value";
7543 return -EINVAL;
7544 }
7545
7546 force_ent->param = *match_fp;
7547
7548 return 0;
7549}
7550
7551static void __init ata_parse_force_param(void)
7552{
7553 int idx = 0, size = 1;
7554 int last_port = -1, last_device = -1;
7555 char *p, *cur, *next;
7556
7557 /* calculate maximum number of params and allocate force_tbl */
7558 for (p = ata_force_param_buf; *p; p++)
7559 if (*p == ',')
7560 size++;
7561
7562 ata_force_tbl = kzalloc(sizeof(ata_force_tbl[0]) * size, GFP_KERNEL);
7563 if (!ata_force_tbl) {
7564 printk(KERN_WARNING "ata: failed to extend force table, "
7565 "libata.force ignored\n");
7566 return;
7567 }
7568
7569 /* parse and populate the table */
7570 for (cur = ata_force_param_buf; *cur != '\0'; cur = next) {
7571 const char *reason = "";
7572 struct ata_force_ent te = { .port = -1, .device = -1 };
7573
7574 next = cur;
7575 if (ata_parse_force_one(&next, &te, &reason)) {
7576 printk(KERN_WARNING "ata: failed to parse force "
7577 "parameter \"%s\" (%s)\n",
7578 cur, reason);
7579 continue;
7580 }
7581
7582 if (te.port == -1) {
7583 te.port = last_port;
7584 te.device = last_device;
7585 }
7586
7587 ata_force_tbl[idx++] = te;
7588
7589 last_port = te.port;
7590 last_device = te.device;
7591 }
7592
7593 ata_force_tbl_size = idx;
7594}
7406 7595
7407static int __init ata_init(void) 7596static int __init ata_init(void)
7408{ 7597{
7409 ata_probe_timeout *= HZ; 7598 ata_probe_timeout *= HZ;
7599
7600 ata_parse_force_param();
7601
7410 ata_wq = create_workqueue("ata"); 7602 ata_wq = create_workqueue("ata");
7411 if (!ata_wq) 7603 if (!ata_wq)
7412 return -ENOMEM; 7604 return -ENOMEM;
@@ -7423,6 +7615,7 @@ static int __init ata_init(void)
7423 7615
7424static void __exit ata_exit(void) 7616static void __exit ata_exit(void)
7425{ 7617{
7618 kfree(ata_force_tbl);
7426 destroy_workqueue(ata_wq); 7619 destroy_workqueue(ata_wq);
7427 destroy_workqueue(ata_aux_wq); 7620 destroy_workqueue(ata_aux_wq);
7428} 7621}
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 4e31071acc02..698ce2cea52c 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2393,9 +2393,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2393 } 2393 }
2394 2394
2395 /* PDIAG- should have been released, ask cable type if post-reset */ 2395 /* PDIAG- should have been released, ask cable type if post-reset */
2396 if (ata_is_host_link(link) && ap->ops->cable_detect && 2396 if ((ehc->i.flags & ATA_EHI_DID_RESET) && ata_is_host_link(link)) {
2397 (ehc->i.flags & ATA_EHI_DID_RESET)) 2397 if (ap->ops->cable_detect)
2398 ap->cbl = ap->ops->cable_detect(ap); 2398 ap->cbl = ap->ops->cable_detect(ap);
2399 ata_force_cbl(ap);
2400 }
2399 2401
2400 /* Configure new devices forward such that user doesn't see 2402 /* Configure new devices forward such that user doesn't see
2401 * device detection messages backwards. 2403 * device detection messages backwards.
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index c02c490122dc..f888babc8283 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -826,30 +826,61 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev)
826 sdev->max_device_blocked = 1; 826 sdev->max_device_blocked = 1;
827} 827}
828 828
829static void ata_scsi_dev_config(struct scsi_device *sdev, 829/**
830 struct ata_device *dev) 830 * atapi_drain_needed - Check whether data transfer may overflow
831 * @rq: request to be checked
832 *
833 * ATAPI commands which transfer variable length data to host
834 * might overflow due to application error or hardare bug. This
835 * function checks whether overflow should be drained and ignored
836 * for @request.
837 *
838 * LOCKING:
839 * None.
840 *
841 * RETURNS:
842 * 1 if ; otherwise, 0.
843 */
844static int atapi_drain_needed(struct request *rq)
845{
846 if (likely(!blk_pc_request(rq)))
847 return 0;
848
849 if (!rq->data_len || (rq->cmd_flags & REQ_RW))
850 return 0;
851
852 return atapi_cmd_type(rq->cmd[0]) == ATAPI_MISC;
853}
854
855static int ata_scsi_dev_config(struct scsi_device *sdev,
856 struct ata_device *dev)
831{ 857{
832 /* configure max sectors */ 858 /* configure max sectors */
833 blk_queue_max_sectors(sdev->request_queue, dev->max_sectors); 859 blk_queue_max_sectors(sdev->request_queue, dev->max_sectors);
834 860
835 /* SATA DMA transfers must be multiples of 4 byte, so
836 * we need to pad ATAPI transfers using an extra sg.
837 * Decrement max hw segments accordingly.
838 */
839 if (dev->class == ATA_DEV_ATAPI) { 861 if (dev->class == ATA_DEV_ATAPI) {
840 struct request_queue *q = sdev->request_queue; 862 struct request_queue *q = sdev->request_queue;
841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1); 863 void *buf;
842 864
843 /* set the min alignment */ 865 /* set the min alignment */
844 blk_queue_update_dma_alignment(sdev->request_queue, 866 blk_queue_update_dma_alignment(sdev->request_queue,
845 ATA_DMA_PAD_SZ - 1); 867 ATA_DMA_PAD_SZ - 1);
846 } else 868
869 /* configure draining */
870 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
871 if (!buf) {
872 ata_dev_printk(dev, KERN_ERR,
873 "drain buffer allocation failed\n");
874 return -ENOMEM;
875 }
876
877 blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
878 } else {
847 /* ATA devices must be sector aligned */ 879 /* ATA devices must be sector aligned */
848 blk_queue_update_dma_alignment(sdev->request_queue, 880 blk_queue_update_dma_alignment(sdev->request_queue,
849 ATA_SECT_SIZE - 1); 881 ATA_SECT_SIZE - 1);
850
851 if (dev->class == ATA_DEV_ATA)
852 sdev->manage_start_stop = 1; 882 sdev->manage_start_stop = 1;
883 }
853 884
854 if (dev->flags & ATA_DFLAG_AN) 885 if (dev->flags & ATA_DFLAG_AN)
855 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); 886 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
@@ -861,6 +892,8 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
861 depth = min(ATA_MAX_QUEUE - 1, depth); 892 depth = min(ATA_MAX_QUEUE - 1, depth);
862 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); 893 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth);
863 } 894 }
895
896 return 0;
864} 897}
865 898
866/** 899/**
@@ -879,13 +912,14 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
879{ 912{
880 struct ata_port *ap = ata_shost_to_port(sdev->host); 913 struct ata_port *ap = ata_shost_to_port(sdev->host);
881 struct ata_device *dev = __ata_scsi_find_dev(ap, sdev); 914 struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
915 int rc = 0;
882 916
883 ata_scsi_sdev_config(sdev); 917 ata_scsi_sdev_config(sdev);
884 918
885 if (dev) 919 if (dev)
886 ata_scsi_dev_config(sdev, dev); 920 rc = ata_scsi_dev_config(sdev, dev);
887 921
888 return 0; 922 return rc;
889} 923}
890 924
891/** 925/**
@@ -905,6 +939,7 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
905void ata_scsi_slave_destroy(struct scsi_device *sdev) 939void ata_scsi_slave_destroy(struct scsi_device *sdev)
906{ 940{
907 struct ata_port *ap = ata_shost_to_port(sdev->host); 941 struct ata_port *ap = ata_shost_to_port(sdev->host);
942 struct request_queue *q = sdev->request_queue;
908 unsigned long flags; 943 unsigned long flags;
909 struct ata_device *dev; 944 struct ata_device *dev;
910 945
@@ -920,6 +955,10 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
920 ata_port_schedule_eh(ap); 955 ata_port_schedule_eh(ap);
921 } 956 }
922 spin_unlock_irqrestore(ap->lock, flags); 957 spin_unlock_irqrestore(ap->lock, flags);
958
959 kfree(q->dma_drain_buffer);
960 q->dma_drain_buffer = NULL;
961 q->dma_drain_size = 0;
923} 962}
924 963
925/** 964/**
@@ -1862,7 +1901,7 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
1862 * spin_lock_irqsave(host lock) 1901 * spin_lock_irqsave(host lock)
1863 */ 1902 */
1864 1903
1865unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, 1904static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf,
1866 unsigned int buflen) 1905 unsigned int buflen)
1867{ 1906{
1868 u8 pbuf[60]; 1907 u8 pbuf[60];
@@ -2500,7 +2539,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2500 * want to set it properly, and for DMA where it is 2539 * want to set it properly, and for DMA where it is
2501 * effectively meaningless. 2540 * effectively meaningless.
2502 */ 2541 */
2503 nbytes = min(qc->nbytes, (unsigned int)63 * 1024); 2542 nbytes = min(scmd->request->raw_data_len, (unsigned int)63 * 1024);
2504 2543
2505 /* Most ATAPI devices which honor transfer chunk size don't 2544 /* Most ATAPI devices which honor transfer chunk size don't
2506 * behave according to the spec when odd chunk size which 2545 * behave according to the spec when odd chunk size which
@@ -3555,7 +3594,7 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
3555 * @ap: Port to initialize 3594 * @ap: Port to initialize
3556 * 3595 *
3557 * Called just after data structures for each port are 3596 * Called just after data structures for each port are
3558 * initialized. Allocates DMA pad. 3597 * initialized.
3559 * 3598 *
3560 * May be used as the port_start() entry in ata_port_operations. 3599 * May be used as the port_start() entry in ata_port_operations.
3561 * 3600 *
@@ -3564,7 +3603,7 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
3564 */ 3603 */
3565int ata_sas_port_start(struct ata_port *ap) 3604int ata_sas_port_start(struct ata_port *ap)
3566{ 3605{
3567 return ata_pad_alloc(ap, ap->dev); 3606 return 0;
3568} 3607}
3569EXPORT_SYMBOL_GPL(ata_sas_port_start); 3608EXPORT_SYMBOL_GPL(ata_sas_port_start);
3570 3609
@@ -3572,8 +3611,6 @@ EXPORT_SYMBOL_GPL(ata_sas_port_start);
3572 * ata_port_stop - Undo ata_sas_port_start() 3611 * ata_port_stop - Undo ata_sas_port_start()
3573 * @ap: Port to shut down 3612 * @ap: Port to shut down
3574 * 3613 *
3575 * Frees the DMA pad.
3576 *
3577 * May be used as the port_stop() entry in ata_port_operations. 3614 * May be used as the port_stop() entry in ata_port_operations.
3578 * 3615 *
3579 * LOCKING: 3616 * LOCKING:
@@ -3582,7 +3619,6 @@ EXPORT_SYMBOL_GPL(ata_sas_port_start);
3582 3619
3583void ata_sas_port_stop(struct ata_port *ap) 3620void ata_sas_port_stop(struct ata_port *ap)
3584{ 3621{
3585 ata_pad_free(ap, ap->dev);
3586} 3622}
3587EXPORT_SYMBOL_GPL(ata_sas_port_stop); 3623EXPORT_SYMBOL_GPL(ata_sas_port_stop);
3588 3624
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 409ffb9af163..6036dedfe377 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -61,6 +61,7 @@ extern int atapi_passthru16;
61extern int libata_fua; 61extern int libata_fua;
62extern int libata_noacpi; 62extern int libata_noacpi;
63extern int libata_allow_tpm; 63extern int libata_allow_tpm;
64extern void ata_force_cbl(struct ata_port *ap);
64extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); 65extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
65extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, 66extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
66 u64 block, u32 n_block, unsigned int tf_flags, 67 u64 block, u32 n_block, unsigned int tf_flags,
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index 244098a80ce4..bdc3b9d7395c 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -77,8 +77,8 @@ static int pacpi_cable_detect(struct ata_port *ap)
77 77
78static void pacpi_error_handler(struct ata_port *ap) 78static void pacpi_error_handler(struct ata_port *ap)
79{ 79{
80 return ata_bmdma_drive_eh(ap, pacpi_pre_reset, ata_std_softreset, 80 ata_bmdma_drive_eh(ap, pacpi_pre_reset, ata_std_softreset, NULL,
81 NULL, ata_std_postreset); 81 ata_std_postreset);
82} 82}
83 83
84/** 84/**
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index ea567e2b1703..4b8d9b592ca4 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -146,9 +146,8 @@ static int amd_pre_reset(struct ata_link *link, unsigned long deadline)
146 146
147static void amd_error_handler(struct ata_port *ap) 147static void amd_error_handler(struct ata_port *ap)
148{ 148{
149 return ata_bmdma_drive_eh(ap, amd_pre_reset, 149 ata_bmdma_drive_eh(ap, amd_pre_reset, ata_std_softreset, NULL,
150 ata_std_softreset, NULL, 150 ata_std_postreset);
151 ata_std_postreset);
152} 151}
153 152
154static int amd_cable_detect(struct ata_port *ap) 153static int amd_cable_detect(struct ata_port *ap)
@@ -506,7 +505,6 @@ static struct ata_port_operations amd133_port_ops = {
506static struct ata_port_operations nv100_port_ops = { 505static struct ata_port_operations nv100_port_ops = {
507 .set_piomode = nv100_set_piomode, 506 .set_piomode = nv100_set_piomode,
508 .set_dmamode = nv100_set_dmamode, 507 .set_dmamode = nv100_set_dmamode,
509 .mode_filter = ata_pci_default_filter,
510 .tf_load = ata_tf_load, 508 .tf_load = ata_tf_load,
511 .tf_read = ata_tf_read, 509 .tf_read = ata_tf_read,
512 .check_status = ata_check_status, 510 .check_status = ata_check_status,
@@ -541,7 +539,6 @@ static struct ata_port_operations nv100_port_ops = {
541static struct ata_port_operations nv133_port_ops = { 539static struct ata_port_operations nv133_port_ops = {
542 .set_piomode = nv133_set_piomode, 540 .set_piomode = nv133_set_piomode,
543 .set_dmamode = nv133_set_dmamode, 541 .set_dmamode = nv133_set_dmamode,
544 .mode_filter = ata_pci_default_filter,
545 .tf_load = ata_tf_load, 542 .tf_load = ata_tf_load,
546 .tf_read = ata_tf_read, 543 .tf_read = ata_tf_read,
547 .check_status = ata_check_status, 544 .check_status = ata_check_status,
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index d753e568588e..1c4ff9b52b5c 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -40,7 +40,7 @@
40#include <asm/msr.h> 40#include <asm/msr.h>
41 41
42#define DRV_NAME "pata_cs5536" 42#define DRV_NAME "pata_cs5536"
43#define DRV_VERSION "0.0.6" 43#define DRV_VERSION "0.0.7"
44 44
45enum { 45enum {
46 CFG = 0, 46 CFG = 0,
@@ -85,7 +85,7 @@ static const u8 pci_reg[4] = {
85 PCI_IDE_CFG, PCI_IDE_DTC, PCI_IDE_CAST, PCI_IDE_ETC, 85 PCI_IDE_CFG, PCI_IDE_DTC, PCI_IDE_CAST, PCI_IDE_ETC,
86}; 86};
87 87
88static inline int cs5536_read(struct pci_dev *pdev, int reg, int *val) 88static inline int cs5536_read(struct pci_dev *pdev, int reg, u32 *val)
89{ 89{
90 if (unlikely(use_msr)) { 90 if (unlikely(use_msr)) {
91 u32 dummy; 91 u32 dummy;
@@ -153,8 +153,8 @@ static void cs5536_set_piomode(struct ata_port *ap, struct ata_device *adev)
153 struct ata_device *pair = ata_dev_pair(adev); 153 struct ata_device *pair = ata_dev_pair(adev);
154 int mode = adev->pio_mode - XFER_PIO_0; 154 int mode = adev->pio_mode - XFER_PIO_0;
155 int cmdmode = mode; 155 int cmdmode = mode;
156 int dshift = ap->port_no ? IDE_D1_SHIFT : IDE_D0_SHIFT; 156 int dshift = adev->devno ? IDE_D1_SHIFT : IDE_D0_SHIFT;
157 int cshift = ap->port_no ? IDE_CAST_D1_SHIFT : IDE_CAST_D0_SHIFT; 157 int cshift = adev->devno ? IDE_CAST_D1_SHIFT : IDE_CAST_D0_SHIFT;
158 u32 dtc, cast, etc; 158 u32 dtc, cast, etc;
159 159
160 if (pair) 160 if (pair)
@@ -201,7 +201,7 @@ static void cs5536_set_dmamode(struct ata_port *ap, struct ata_device *adev)
201 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 201 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
202 u32 dtc, etc; 202 u32 dtc, etc;
203 int mode = adev->dma_mode; 203 int mode = adev->dma_mode;
204 int dshift = ap->port_no ? IDE_D1_SHIFT : IDE_D0_SHIFT; 204 int dshift = adev->devno ? IDE_D1_SHIFT : IDE_D0_SHIFT;
205 205
206 if (mode >= XFER_UDMA_0) { 206 if (mode >= XFER_UDMA_0) {
207 cs5536_read(pdev, ETC, &etc); 207 cs5536_read(pdev, ETC, &etc);
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 5b8586dac63b..f97068be2d79 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -304,12 +304,6 @@ static int icside_dma_init(struct pata_icside_info *info)
304} 304}
305 305
306 306
307static int pata_icside_port_start(struct ata_port *ap)
308{
309 /* No PRD to alloc */
310 return ata_pad_alloc(ap, ap->dev);
311}
312
313static struct scsi_host_template pata_icside_sht = { 307static struct scsi_host_template pata_icside_sht = {
314 .module = THIS_MODULE, 308 .module = THIS_MODULE,
315 .name = DRV_NAME, 309 .name = DRV_NAME,
@@ -389,8 +383,6 @@ static struct ata_port_operations pata_icside_port_ops = {
389 .irq_clear = ata_dummy_noret, 383 .irq_clear = ata_dummy_noret,
390 .irq_on = ata_irq_on, 384 .irq_on = ata_irq_on,
391 385
392 .port_start = pata_icside_port_start,
393
394 .bmdma_stop = pata_icside_bmdma_stop, 386 .bmdma_stop = pata_icside_bmdma_stop,
395 .bmdma_status = pata_icside_bmdma_status, 387 .bmdma_status = pata_icside_bmdma_status,
396}; 388};
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 5b8174d94067..00bbbbd50e97 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -115,7 +115,8 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
115 115
116static void jmicron_error_handler(struct ata_port *ap) 116static void jmicron_error_handler(struct ata_port *ap)
117{ 117{
118 return ata_bmdma_drive_eh(ap, jmicron_pre_reset, ata_std_softreset, NULL, ata_std_postreset); 118 ata_bmdma_drive_eh(ap, jmicron_pre_reset, ata_std_softreset, NULL,
119 ata_std_postreset);
119} 120}
120 121
121/* No PIO or DMA methods needed for this device */ 122/* No PIO or DMA methods needed for this device */
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 6c59969fd50b..50fe08ebe23c 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -774,14 +774,14 @@ static struct ata_port_operations opti82c46x_port_ops = {
774static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) 774static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
775{ 775{
776 struct ata_timing t; 776 struct ata_timing t;
777 struct legacy_data *qdi = ap->host->private_data; 777 struct legacy_data *ld_qdi = ap->host->private_data;
778 int active, recovery; 778 int active, recovery;
779 u8 timing; 779 u8 timing;
780 780
781 /* Get the timing data in cycles */ 781 /* Get the timing data in cycles */
782 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 782 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
783 783
784 if (qdi->fast) { 784 if (ld_qdi->fast) {
785 active = 8 - FIT(t.active, 1, 8); 785 active = 8 - FIT(t.active, 1, 8);
786 recovery = 18 - FIT(t.recover, 3, 18); 786 recovery = 18 - FIT(t.recover, 3, 18);
787 } else { 787 } else {
@@ -790,9 +790,9 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
790 } 790 }
791 timing = (recovery << 4) | active | 0x08; 791 timing = (recovery << 4) | active | 0x08;
792 792
793 qdi->clock[adev->devno] = timing; 793 ld_qdi->clock[adev->devno] = timing;
794 794
795 outb(timing, qdi->timing); 795 outb(timing, ld_qdi->timing);
796} 796}
797 797
798/** 798/**
@@ -808,14 +808,14 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev)
808static void qdi6580dp_set_piomode(struct ata_port *ap, struct ata_device *adev) 808static void qdi6580dp_set_piomode(struct ata_port *ap, struct ata_device *adev)
809{ 809{
810 struct ata_timing t; 810 struct ata_timing t;
811 struct legacy_data *qdi = ap->host->private_data; 811 struct legacy_data *ld_qdi = ap->host->private_data;
812 int active, recovery; 812 int active, recovery;
813 u8 timing; 813 u8 timing;
814 814
815 /* Get the timing data in cycles */ 815 /* Get the timing data in cycles */
816 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 816 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
817 817
818 if (qdi->fast) { 818 if (ld_qdi->fast) {
819 active = 8 - FIT(t.active, 1, 8); 819 active = 8 - FIT(t.active, 1, 8);
820 recovery = 18 - FIT(t.recover, 3, 18); 820 recovery = 18 - FIT(t.recover, 3, 18);
821 } else { 821 } else {
@@ -824,12 +824,12 @@ static void qdi6580dp_set_piomode(struct ata_port *ap, struct ata_device *adev)
824 } 824 }
825 timing = (recovery << 4) | active | 0x08; 825 timing = (recovery << 4) | active | 0x08;
826 826
827 qdi->clock[adev->devno] = timing; 827 ld_qdi->clock[adev->devno] = timing;
828 828
829 outb(timing, qdi->timing + 2 * ap->port_no); 829 outb(timing, ld_qdi->timing + 2 * ap->port_no);
830 /* Clear the FIFO */ 830 /* Clear the FIFO */
831 if (adev->class != ATA_DEV_ATA) 831 if (adev->class != ATA_DEV_ATA)
832 outb(0x5F, qdi->timing + 3); 832 outb(0x5F, ld_qdi->timing + 3);
833} 833}
834 834
835/** 835/**
@@ -845,14 +845,14 @@ static void qdi6580dp_set_piomode(struct ata_port *ap, struct ata_device *adev)
845static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) 845static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
846{ 846{
847 struct ata_timing t; 847 struct ata_timing t;
848 struct legacy_data *qdi = ap->host->private_data; 848 struct legacy_data *ld_qdi = ap->host->private_data;
849 int active, recovery; 849 int active, recovery;
850 u8 timing; 850 u8 timing;
851 851
852 /* Get the timing data in cycles */ 852 /* Get the timing data in cycles */
853 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); 853 ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000);
854 854
855 if (qdi->fast) { 855 if (ld_qdi->fast) {
856 active = 8 - FIT(t.active, 1, 8); 856 active = 8 - FIT(t.active, 1, 8);
857 recovery = 18 - FIT(t.recover, 3, 18); 857 recovery = 18 - FIT(t.recover, 3, 18);
858 } else { 858 } else {
@@ -860,11 +860,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev)
860 recovery = 15 - FIT(t.recover, 0, 15); 860 recovery = 15 - FIT(t.recover, 0, 15);
861 } 861 }
862 timing = (recovery << 4) | active | 0x08; 862 timing = (recovery << 4) | active | 0x08;
863 qdi->clock[adev->devno] = timing; 863 ld_qdi->clock[adev->devno] = timing;
864 outb(timing, qdi->timing + 2 * adev->devno); 864 outb(timing, ld_qdi->timing + 2 * adev->devno);
865 /* Clear the FIFO */ 865 /* Clear the FIFO */
866 if (adev->class != ATA_DEV_ATA) 866 if (adev->class != ATA_DEV_ATA)
867 outb(0x5F, qdi->timing + 3); 867 outb(0x5F, ld_qdi->timing + 3);
868} 868}
869 869
870/** 870/**
@@ -879,12 +879,12 @@ static unsigned int qdi_qc_issue_prot(struct ata_queued_cmd *qc)
879{ 879{
880 struct ata_port *ap = qc->ap; 880 struct ata_port *ap = qc->ap;
881 struct ata_device *adev = qc->dev; 881 struct ata_device *adev = qc->dev;
882 struct legacy_data *qdi = ap->host->private_data; 882 struct legacy_data *ld_qdi = ap->host->private_data;
883 883
884 if (qdi->clock[adev->devno] != qdi->last) { 884 if (ld_qdi->clock[adev->devno] != ld_qdi->last) {
885 if (adev->pio_mode) { 885 if (adev->pio_mode) {
886 qdi->last = qdi->clock[adev->devno]; 886 ld_qdi->last = ld_qdi->clock[adev->devno];
887 outb(qdi->clock[adev->devno], qdi->timing + 887 outb(ld_qdi->clock[adev->devno], ld_qdi->timing +
888 2 * ap->port_no); 888 2 * ap->port_no);
889 } 889 }
890 } 890 }
@@ -1037,12 +1037,12 @@ static u8 winbond_readcfg(unsigned long port, u8 reg)
1037static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) 1037static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev)
1038{ 1038{
1039 struct ata_timing t; 1039 struct ata_timing t;
1040 struct legacy_data *winbond = ap->host->private_data; 1040 struct legacy_data *ld_winbond = ap->host->private_data;
1041 int active, recovery; 1041 int active, recovery;
1042 u8 reg; 1042 u8 reg;
1043 int timing = 0x88 + (ap->port_no * 4) + (adev->devno * 2); 1043 int timing = 0x88 + (ap->port_no * 4) + (adev->devno * 2);
1044 1044
1045 reg = winbond_readcfg(winbond->timing, 0x81); 1045 reg = winbond_readcfg(ld_winbond->timing, 0x81);
1046 1046
1047 /* Get the timing data in cycles */ 1047 /* Get the timing data in cycles */
1048 if (reg & 0x40) /* Fast VLB bus, assume 50MHz */ 1048 if (reg & 0x40) /* Fast VLB bus, assume 50MHz */
@@ -1053,7 +1053,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev)
1053 active = (FIT(t.active, 3, 17) - 1) & 0x0F; 1053 active = (FIT(t.active, 3, 17) - 1) & 0x0F;
1054 recovery = (FIT(t.recover, 1, 15) + 1) & 0x0F; 1054 recovery = (FIT(t.recover, 1, 15) + 1) & 0x0F;
1055 timing = (active << 4) | recovery; 1055 timing = (active << 4) | recovery;
1056 winbond_writecfg(winbond->timing, timing, reg); 1056 winbond_writecfg(ld_winbond->timing, timing, reg);
1057 1057
1058 /* Load the setup timing */ 1058 /* Load the setup timing */
1059 1059
@@ -1063,7 +1063,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev)
1063 if (!ata_pio_need_iordy(adev)) 1063 if (!ata_pio_need_iordy(adev))
1064 reg |= 0x02; /* IORDY off */ 1064 reg |= 0x02; /* IORDY off */
1065 reg |= (FIT(t.setup, 0, 3) << 6); 1065 reg |= (FIT(t.setup, 0, 3) << 6);
1066 winbond_writecfg(winbond->timing, timing + 1, reg); 1066 winbond_writecfg(ld_winbond->timing, timing + 1, reg);
1067} 1067}
1068 1068
1069static int winbond_port(struct platform_device *dev, 1069static int winbond_port(struct platform_device *dev,
@@ -1278,8 +1278,6 @@ static __init int legacy_init_one(struct legacy_probe *probe)
1278 } 1278 }
1279 } 1279 }
1280fail: 1280fail:
1281 if (host)
1282 ata_host_detach(host);
1283 platform_device_unregister(pdev); 1281 platform_device_unregister(pdev);
1284 return ret; 1282 return ret;
1285} 1283}
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 9afc8a32b226..a81f25d87235 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -85,8 +85,8 @@ static int marvell_cable_detect(struct ata_port *ap)
85 85
86static void marvell_error_handler(struct ata_port *ap) 86static void marvell_error_handler(struct ata_port *ap)
87{ 87{
88 return ata_bmdma_drive_eh(ap, marvell_pre_reset, ata_std_softreset, 88 ata_bmdma_drive_eh(ap, marvell_pre_reset, ata_std_softreset, NULL,
89 NULL, ata_std_postreset); 89 ata_std_postreset);
90} 90}
91 91
92/* No PIO or DMA methods needed for this device */ 92/* No PIO or DMA methods needed for this device */
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 55055b27524c..6c016deeaed8 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -1007,6 +1007,8 @@ static const struct ata_port_operations scc_pata_ops = {
1007 .qc_issue = ata_qc_issue_prot, 1007 .qc_issue = ata_qc_issue_prot,
1008 1008
1009 .freeze = scc_bmdma_freeze, 1009 .freeze = scc_bmdma_freeze,
1010 .thaw = ata_bmdma_thaw,
1011
1010 .error_handler = scc_error_handler, 1012 .error_handler = scc_error_handler,
1011 .post_internal_cmd = scc_bmdma_stop, 1013 .post_internal_cmd = scc_bmdma_stop,
1012 1014
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index efcb66b6ccef..9323dd0c7d8d 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -601,21 +601,9 @@ static int sata_fsl_port_start(struct ata_port *ap)
601 if (!pp) 601 if (!pp)
602 return -ENOMEM; 602 return -ENOMEM;
603 603
604 /*
605 * allocate per command dma alignment pad buffer, which is used
606 * internally by libATA to ensure that all transfers ending on
607 * unaligned boundaries are padded, to align on Dword boundaries
608 */
609 retval = ata_pad_alloc(ap, dev);
610 if (retval) {
611 kfree(pp);
612 return retval;
613 }
614
615 mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma, 604 mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma,
616 GFP_KERNEL); 605 GFP_KERNEL);
617 if (!mem) { 606 if (!mem) {
618 ata_pad_free(ap, dev);
619 kfree(pp); 607 kfree(pp);
620 return -ENOMEM; 608 return -ENOMEM;
621 } 609 }
@@ -694,7 +682,6 @@ static void sata_fsl_port_stop(struct ata_port *ap)
694 dma_free_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, 682 dma_free_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ,
695 pp->cmdslot, pp->cmdslot_paddr); 683 pp->cmdslot, pp->cmdslot_paddr);
696 684
697 ata_pad_free(ap, dev);
698 kfree(pp); 685 kfree(pp);
699} 686}
700 687
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 04b571764aff..6ebebde8454a 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -870,7 +870,7 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio,
870 struct mv_host_priv *hpriv = ap->host->private_data; 870 struct mv_host_priv *hpriv = ap->host->private_data;
871 int hard_port = mv_hardport_from_port(ap->port_no); 871 int hard_port = mv_hardport_from_port(ap->port_no);
872 void __iomem *hc_mmio = mv_hc_base_from_port( 872 void __iomem *hc_mmio = mv_hc_base_from_port(
873 ap->host->iomap[MV_PRIMARY_BAR], hard_port); 873 mv_host_base(ap->host), hard_port);
874 u32 hc_irq_cause, ipending; 874 u32 hc_irq_cause, ipending;
875 875
876 /* clear EDMA event indicators, if any */ 876 /* clear EDMA event indicators, if any */
@@ -1158,17 +1158,13 @@ static int mv_port_start(struct ata_port *ap)
1158 struct mv_port_priv *pp; 1158 struct mv_port_priv *pp;
1159 void __iomem *port_mmio = mv_ap_base(ap); 1159 void __iomem *port_mmio = mv_ap_base(ap);
1160 unsigned long flags; 1160 unsigned long flags;
1161 int tag, rc; 1161 int tag;
1162 1162
1163 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); 1163 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
1164 if (!pp) 1164 if (!pp)
1165 return -ENOMEM; 1165 return -ENOMEM;
1166 ap->private_data = pp; 1166 ap->private_data = pp;
1167 1167
1168 rc = ata_pad_alloc(ap, dev);
1169 if (rc)
1170 return rc;
1171
1172 pp->crqb = dma_pool_alloc(hpriv->crqb_pool, GFP_KERNEL, &pp->crqb_dma); 1168 pp->crqb = dma_pool_alloc(hpriv->crqb_pool, GFP_KERNEL, &pp->crqb_dma);
1173 if (!pp->crqb) 1169 if (!pp->crqb)
1174 return -ENOMEM; 1170 return -ENOMEM;
@@ -1542,7 +1538,7 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
1542 eh_freeze_mask = EDMA_EH_FREEZE_5; 1538 eh_freeze_mask = EDMA_EH_FREEZE_5;
1543 1539
1544 if (edma_err_cause & EDMA_ERR_SELF_DIS_5) { 1540 if (edma_err_cause & EDMA_ERR_SELF_DIS_5) {
1545 struct mv_port_priv *pp = ap->private_data; 1541 pp = ap->private_data;
1546 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; 1542 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN;
1547 ata_ehi_push_desc(ehi, "EDMA self-disable"); 1543 ata_ehi_push_desc(ehi, "EDMA self-disable");
1548 } 1544 }
@@ -1550,7 +1546,7 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
1550 eh_freeze_mask = EDMA_EH_FREEZE; 1546 eh_freeze_mask = EDMA_EH_FREEZE;
1551 1547
1552 if (edma_err_cause & EDMA_ERR_SELF_DIS) { 1548 if (edma_err_cause & EDMA_ERR_SELF_DIS) {
1553 struct mv_port_priv *pp = ap->private_data; 1549 pp = ap->private_data;
1554 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; 1550 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN;
1555 ata_ehi_push_desc(ehi, "EDMA self-disable"); 1551 ata_ehi_push_desc(ehi, "EDMA self-disable");
1556 } 1552 }
@@ -2951,7 +2947,8 @@ static int mv_platform_probe(struct platform_device *pdev)
2951 hpriv->n_ports = n_ports; 2947 hpriv->n_ports = n_ports;
2952 2948
2953 host->iomap = NULL; 2949 host->iomap = NULL;
2954 hpriv->base = ioremap(res->start, res->end - res->start + 1); 2950 hpriv->base = devm_ioremap(&pdev->dev, res->start,
2951 res->end - res->start + 1);
2955 hpriv->base -= MV_SATAHC0_REG_BASE; 2952 hpriv->base -= MV_SATAHC0_REG_BASE;
2956 2953
2957 rc = mv_create_dma_pools(hpriv, &pdev->dev); 2954 rc = mv_create_dma_pools(hpriv, &pdev->dev);
@@ -2983,11 +2980,8 @@ static int __devexit mv_platform_remove(struct platform_device *pdev)
2983{ 2980{
2984 struct device *dev = &pdev->dev; 2981 struct device *dev = &pdev->dev;
2985 struct ata_host *host = dev_get_drvdata(dev); 2982 struct ata_host *host = dev_get_drvdata(dev);
2986 struct mv_host_priv *hpriv = host->private_data;
2987 void __iomem *base = hpriv->base;
2988 2983
2989 ata_host_detach(host); 2984 ata_host_detach(host);
2990 iounmap(base);
2991 return 0; 2985 return 0;
2992} 2986}
2993 2987
@@ -3198,6 +3192,7 @@ MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers");
3198MODULE_LICENSE("GPL"); 3192MODULE_LICENSE("GPL");
3199MODULE_DEVICE_TABLE(pci, mv_pci_tbl); 3193MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
3200MODULE_VERSION(DRV_VERSION); 3194MODULE_VERSION(DRV_VERSION);
3195MODULE_ALIAS("platform:sata_mv");
3201 3196
3202#ifdef CONFIG_PCI 3197#ifdef CONFIG_PCI
3203module_param(msi, int, 0444); 3198module_param(msi, int, 0444);
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index a07d319f6e8c..f251a5f569d5 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -543,7 +543,7 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
543 idx = 0; 543 idx = 0;
544 for_each_sg(qc->sg, sg, qc->n_elem, si) { 544 for_each_sg(qc->sg, sg, qc->n_elem, si) {
545 u32 addr, offset; 545 u32 addr, offset;
546 u32 sg_len, len; 546 u32 sg_len;
547 547
548 /* determine if physical DMA addr spans 64K boundary. 548 /* determine if physical DMA addr spans 64K boundary.
549 * Note h/w doesn't support 64-bit, so we unconditionally 549 * Note h/w doesn't support 64-bit, so we unconditionally
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index b4b1f91ea693..df7988df7908 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1234,7 +1234,6 @@ static int sil24_port_start(struct ata_port *ap)
1234 union sil24_cmd_block *cb; 1234 union sil24_cmd_block *cb;
1235 size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS; 1235 size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS;
1236 dma_addr_t cb_dma; 1236 dma_addr_t cb_dma;
1237 int rc;
1238 1237
1239 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); 1238 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
1240 if (!pp) 1239 if (!pp)
@@ -1247,10 +1246,6 @@ static int sil24_port_start(struct ata_port *ap)
1247 return -ENOMEM; 1246 return -ENOMEM;
1248 memset(cb, 0, cb_size); 1247 memset(cb, 0, cb_size);
1249 1248
1250 rc = ata_pad_alloc(ap, dev);
1251 if (rc)
1252 return rc;
1253
1254 pp->cmd_block = cb; 1249 pp->cmd_block = cb;
1255 pp->cmd_block_dma = cb_dma; 1250 pp->cmd_block_dma = cb_dma;
1256 1251
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 30caa0337190..0d03f44824fb 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -333,8 +333,8 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
333 333
334static void vt6420_error_handler(struct ata_port *ap) 334static void vt6420_error_handler(struct ata_port *ap)
335{ 335{
336 return ata_bmdma_drive_eh(ap, vt6420_prereset, ata_std_softreset, 336 ata_bmdma_drive_eh(ap, vt6420_prereset, ata_std_softreset, NULL,
337 NULL, ata_std_postreset); 337 ata_std_postreset);
338} 338}
339 339
340static int vt6421_pata_cable_detect(struct ata_port *ap) 340static int vt6421_pata_cable_detect(struct ata_port *ap)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 055989e94799..2d207ad30336 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -658,9 +658,10 @@ int bus_add_driver(struct device_driver *drv)
658 pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name); 658 pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name);
659 659
660 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 660 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
661 if (!priv) 661 if (!priv) {
662 return -ENOMEM; 662 error = -ENOMEM;
663 663 goto out_put_bus;
664 }
664 klist_init(&priv->klist_devices, NULL, NULL); 665 klist_init(&priv->klist_devices, NULL, NULL);
665 priv->driver = drv; 666 priv->driver = drv;
666 drv->p = priv; 667 drv->p = priv;
@@ -668,7 +669,7 @@ int bus_add_driver(struct device_driver *drv)
668 error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL, 669 error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL,
669 "%s", drv->name); 670 "%s", drv->name);
670 if (error) 671 if (error)
671 goto out_put_bus; 672 goto out_unregister;
672 673
673 if (drv->bus->p->drivers_autoprobe) { 674 if (drv->bus->p->drivers_autoprobe) {
674 error = driver_attach(drv); 675 error = driver_attach(drv);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index ba75184c653c..bf31a0170a48 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -120,6 +120,9 @@ EXPORT_SYMBOL_GPL(driver_remove_file);
120 120
121/** 121/**
122 * driver_add_kobj - add a kobject below the specified driver 122 * driver_add_kobj - add a kobject below the specified driver
123 * @drv: requesting device driver
124 * @kobj: kobject to add below this driver
125 * @fmt: format string that names the kobject
123 * 126 *
124 * You really don't want to do this, this is only here due to one looney 127 * You really don't want to do this, this is only here due to one looney
125 * iseries driver, go poke those developers if you are annoyed about 128 * iseries driver, go poke those developers if you are annoyed about
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index bdc03f7e8424..ee9d1c8db0d6 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -415,7 +415,7 @@ EXPORT_SYMBOL_GPL(device_power_down);
415 * @dev: Device. 415 * @dev: Device.
416 * @state: Power state device is entering. 416 * @state: Power state device is entering.
417 */ 417 */
418int suspend_device(struct device *dev, pm_message_t state) 418static int suspend_device(struct device *dev, pm_message_t state)
419{ 419{
420 int error = 0; 420 int error = 0;
421 421
@@ -479,7 +479,6 @@ static int dpm_suspend(pm_message_t state)
479 mutex_lock(&dpm_list_mtx); 479 mutex_lock(&dpm_list_mtx);
480 if (list_empty(&dev->power.entry)) 480 if (list_empty(&dev->power.entry))
481 list_add(&dev->power.entry, &dpm_locked); 481 list_add(&dev->power.entry, &dpm_locked);
482 mutex_unlock(&dpm_list_mtx);
483 break; 482 break;
484 } 483 }
485 mutex_lock(&dpm_list_mtx); 484 mutex_lock(&dpm_list_mtx);
@@ -523,6 +522,7 @@ static void lock_all_devices(void)
523 522
524/** 523/**
525 * device_suspend - Save state and stop all devices in system. 524 * device_suspend - Save state and stop all devices in system.
525 * @state: new power management state
526 * 526 *
527 * Prevent new devices from being registered, then lock all devices 527 * Prevent new devices from being registered, then lock all devices
528 * and suspend them. 528 * and suspend them.
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 018753c59b8e..b53fdb0a282c 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -655,6 +655,7 @@ static int __init nbd_init(void)
655 655
656 for (i = 0; i < nbds_max; i++) { 656 for (i = 0; i < nbds_max; i++) {
657 struct gendisk *disk = alloc_disk(1); 657 struct gendisk *disk = alloc_disk(1);
658 elevator_t *old_e;
658 if (!disk) 659 if (!disk)
659 goto out; 660 goto out;
660 nbd_dev[i].disk = disk; 661 nbd_dev[i].disk = disk;
@@ -668,6 +669,11 @@ static int __init nbd_init(void)
668 put_disk(disk); 669 put_disk(disk);
669 goto out; 670 goto out;
670 } 671 }
672 old_e = disk->queue->elevator;
673 if (elevator_init(disk->queue, "deadline") == 0 ||
674 elevator_init(disk->queue, "noop") == 0) {
675 elevator_exit(old_e);
676 }
671 } 677 }
672 678
673 if (register_blkdev(NBD_MAJOR, "nbd")) { 679 if (register_blkdev(NBD_MAJOR, "nbd")) {
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index b4e462f154ea..730ccea78e45 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -251,10 +251,6 @@ static int floppy_release(struct inode *inode, struct file *filp);
251static int floppy_check_change(struct gendisk *disk); 251static int floppy_check_change(struct gendisk *disk);
252static int floppy_revalidate(struct gendisk *disk); 252static int floppy_revalidate(struct gendisk *disk);
253 253
254#ifndef CONFIG_PMAC_MEDIABAY
255#define check_media_bay(which, what) 1
256#endif
257
258static void swim3_select(struct floppy_state *fs, int sel) 254static void swim3_select(struct floppy_state *fs, int sel)
259{ 255{
260 struct swim3 __iomem *sw = fs->swim3; 256 struct swim3 __iomem *sw = fs->swim3;
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 8afce67c0aa5..9c6f3f99208d 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -37,6 +37,7 @@
37 37
38#include <linux/interrupt.h> 38#include <linux/interrupt.h>
39#include <linux/blkdev.h> 39#include <linux/blkdev.h>
40#include <linux/hdreg.h>
40#include <linux/module.h> 41#include <linux/module.h>
41 42
42#include <xen/xenbus.h> 43#include <xen/xenbus.h>
@@ -135,6 +136,22 @@ static void blkif_restart_queue_callback(void *arg)
135 schedule_work(&info->work); 136 schedule_work(&info->work);
136} 137}
137 138
139int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
140{
141 /* We don't have real geometry info, but let's at least return
142 values consistent with the size of the device */
143 sector_t nsect = get_capacity(bd->bd_disk);
144 sector_t cylinders = nsect;
145
146 hg->heads = 0xff;
147 hg->sectors = 0x3f;
148 sector_div(cylinders, hg->heads * hg->sectors);
149 hg->cylinders = cylinders;
150 if ((sector_t)(hg->cylinders + 1) * hg->heads * hg->sectors < nsect)
151 hg->cylinders = 0xffff;
152 return 0;
153}
154
138/* 155/*
139 * blkif_queue_request 156 * blkif_queue_request
140 * 157 *
@@ -937,6 +954,7 @@ static struct block_device_operations xlvbd_block_fops =
937 .owner = THIS_MODULE, 954 .owner = THIS_MODULE,
938 .open = blkif_open, 955 .open = blkif_open,
939 .release = blkif_release, 956 .release = blkif_release,
957 .getgeo = blkif_getgeo,
940}; 958};
941 959
942 960
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 87be46406daf..d28669992147 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -41,6 +41,7 @@ static int amd_create_page_map(struct amd_page_map *page_map)
41 if (page_map->real == NULL) 41 if (page_map->real == NULL)
42 return -ENOMEM; 42 return -ENOMEM;
43 43
44#ifndef CONFIG_X86
44 SetPageReserved(virt_to_page(page_map->real)); 45 SetPageReserved(virt_to_page(page_map->real));
45 global_cache_flush(); 46 global_cache_flush();
46 page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), 47 page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real),
@@ -52,6 +53,10 @@ static int amd_create_page_map(struct amd_page_map *page_map)
52 return -ENOMEM; 53 return -ENOMEM;
53 } 54 }
54 global_cache_flush(); 55 global_cache_flush();
56#else
57 set_memory_uc((unsigned long)page_map->real, 1);
58 page_map->remapped = page_map->real;
59#endif
55 60
56 for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { 61 for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) {
57 writel(agp_bridge->scratch_page, page_map->remapped+i); 62 writel(agp_bridge->scratch_page, page_map->remapped+i);
@@ -63,8 +68,12 @@ static int amd_create_page_map(struct amd_page_map *page_map)
63 68
64static void amd_free_page_map(struct amd_page_map *page_map) 69static void amd_free_page_map(struct amd_page_map *page_map)
65{ 70{
71#ifndef CONFIG_X86
66 iounmap(page_map->remapped); 72 iounmap(page_map->remapped);
67 ClearPageReserved(virt_to_page(page_map->real)); 73 ClearPageReserved(virt_to_page(page_map->real));
74#else
75 set_memory_wb((unsigned long)page_map->real, 1);
76#endif
68 free_page((unsigned long) page_map->real); 77 free_page((unsigned long) page_map->real);
69} 78}
70 79
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 2d46b713c8f2..55c97f623242 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -60,18 +60,9 @@ static int ati_create_page_map(struct ati_page_map *page_map)
60 if (page_map->real == NULL) 60 if (page_map->real == NULL)
61 return -ENOMEM; 61 return -ENOMEM;
62 62
63 SetPageReserved(virt_to_page(page_map->real)); 63 set_memory_uc((unsigned long)page_map->real, 1);
64 err = map_page_into_agp(virt_to_page(page_map->real)); 64 err = map_page_into_agp(virt_to_page(page_map->real));
65 page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), 65 page_map->remapped = page_map->real;
66 PAGE_SIZE);
67 if (page_map->remapped == NULL || err) {
68 ClearPageReserved(virt_to_page(page_map->real));
69 free_page((unsigned long) page_map->real);
70 page_map->real = NULL;
71 return -ENOMEM;
72 }
73 /*CACHE_FLUSH();*/
74 global_cache_flush();
75 66
76 for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { 67 for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) {
77 writel(agp_bridge->scratch_page, page_map->remapped+i); 68 writel(agp_bridge->scratch_page, page_map->remapped+i);
@@ -85,8 +76,7 @@ static int ati_create_page_map(struct ati_page_map *page_map)
85static void ati_free_page_map(struct ati_page_map *page_map) 76static void ati_free_page_map(struct ati_page_map *page_map)
86{ 77{
87 unmap_page_from_agp(virt_to_page(page_map->real)); 78 unmap_page_from_agp(virt_to_page(page_map->real));
88 iounmap(page_map->remapped); 79 set_memory_wb((unsigned long)page_map->real, 1);
89 ClearPageReserved(virt_to_page(page_map->real));
90 free_page((unsigned long) page_map->real); 80 free_page((unsigned long) page_map->real);
91} 81}
92 82
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 7484bc759c4c..7fc0c99a3a58 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -932,9 +932,14 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
932 agp_gatt_table = (void *)table; 932 agp_gatt_table = (void *)table;
933 933
934 bridge->driver->cache_flush(); 934 bridge->driver->cache_flush();
935#ifdef CONFIG_X86
936 set_memory_uc((unsigned long)table, 1 << page_order);
937 bridge->gatt_table = (void *)table;
938#else
935 bridge->gatt_table = ioremap_nocache(virt_to_gart(table), 939 bridge->gatt_table = ioremap_nocache(virt_to_gart(table),
936 (PAGE_SIZE * (1 << page_order))); 940 (PAGE_SIZE * (1 << page_order)));
937 bridge->driver->cache_flush(); 941 bridge->driver->cache_flush();
942#endif
938 943
939 if (bridge->gatt_table == NULL) { 944 if (bridge->gatt_table == NULL) {
940 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++) 945 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
@@ -991,7 +996,11 @@ int agp_generic_free_gatt_table(struct agp_bridge_data *bridge)
991 * called, then all agp memory is deallocated and removed 996 * called, then all agp memory is deallocated and removed
992 * from the table. */ 997 * from the table. */
993 998
999#ifdef CONFIG_X86
1000 set_memory_wb((unsigned long)bridge->gatt_table, 1 << page_order);
1001#else
994 iounmap(bridge->gatt_table); 1002 iounmap(bridge->gatt_table);
1003#endif
995 table = (char *) bridge->gatt_table_real; 1004 table = (char *) bridge->gatt_table_real;
996 table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1); 1005 table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
997 1006
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index eb1a1c738190..b6791846809f 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -14,6 +14,9 @@
14#define SIS_TLBCNTRL 0x97 14#define SIS_TLBCNTRL 0x97
15#define SIS_TLBFLUSH 0x98 15#define SIS_TLBFLUSH 0x98
16 16
17#define PCI_DEVICE_ID_SI_662 0x0662
18#define PCI_DEVICE_ID_SI_671 0x0671
19
17static int __devinitdata agp_sis_force_delay = 0; 20static int __devinitdata agp_sis_force_delay = 0;
18static int __devinitdata agp_sis_agp_spec = -1; 21static int __devinitdata agp_sis_agp_spec = -1;
19 22
@@ -27,8 +30,8 @@ static int sis_fetch_size(void)
27 values = A_SIZE_8(agp_bridge->driver->aperture_sizes); 30 values = A_SIZE_8(agp_bridge->driver->aperture_sizes);
28 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { 31 for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
29 if ((temp_size == values[i].size_value) || 32 if ((temp_size == values[i].size_value) ||
30 ((temp_size & ~(0x03)) == 33 ((temp_size & ~(0x07)) ==
31 (values[i].size_value & ~(0x03)))) { 34 (values[i].size_value & ~(0x07)))) {
32 agp_bridge->previous_size = 35 agp_bridge->previous_size =
33 agp_bridge->current_size = (void *) (values + i); 36 agp_bridge->current_size = (void *) (values + i);
34 37
@@ -214,6 +217,26 @@ static void __devexit agp_sis_remove(struct pci_dev *pdev)
214 agp_put_bridge(bridge); 217 agp_put_bridge(bridge);
215} 218}
216 219
220#ifdef CONFIG_PM
221
222static int agp_sis_suspend(struct pci_dev *pdev, pm_message_t state)
223{
224 pci_save_state(pdev);
225 pci_set_power_state(pdev, pci_choose_state(pdev, state));
226
227 return 0;
228}
229
230static int agp_sis_resume(struct pci_dev *pdev)
231{
232 pci_set_power_state(pdev, PCI_D0);
233 pci_restore_state(pdev);
234
235 return sis_driver.configure();
236}
237
238#endif /* CONFIG_PM */
239
217static struct pci_device_id agp_sis_pci_table[] = { 240static struct pci_device_id agp_sis_pci_table[] = {
218 { 241 {
219 .class = (PCI_CLASS_BRIDGE_HOST << 8), 242 .class = (PCI_CLASS_BRIDGE_HOST << 8),
@@ -331,6 +354,22 @@ static struct pci_device_id agp_sis_pci_table[] = {
331 .class = (PCI_CLASS_BRIDGE_HOST << 8), 354 .class = (PCI_CLASS_BRIDGE_HOST << 8),
332 .class_mask = ~0, 355 .class_mask = ~0,
333 .vendor = PCI_VENDOR_ID_SI, 356 .vendor = PCI_VENDOR_ID_SI,
357 .device = PCI_DEVICE_ID_SI_662,
358 .subvendor = PCI_ANY_ID,
359 .subdevice = PCI_ANY_ID,
360 },
361 {
362 .class = (PCI_CLASS_BRIDGE_HOST << 8),
363 .class_mask = ~0,
364 .vendor = PCI_VENDOR_ID_SI,
365 .device = PCI_DEVICE_ID_SI_671,
366 .subvendor = PCI_ANY_ID,
367 .subdevice = PCI_ANY_ID,
368 },
369 {
370 .class = (PCI_CLASS_BRIDGE_HOST << 8),
371 .class_mask = ~0,
372 .vendor = PCI_VENDOR_ID_SI,
334 .device = PCI_DEVICE_ID_SI_730, 373 .device = PCI_DEVICE_ID_SI_730,
335 .subvendor = PCI_ANY_ID, 374 .subvendor = PCI_ANY_ID,
336 .subdevice = PCI_ANY_ID, 375 .subdevice = PCI_ANY_ID,
@@ -393,6 +432,10 @@ static struct pci_driver agp_sis_pci_driver = {
393 .id_table = agp_sis_pci_table, 432 .id_table = agp_sis_pci_table,
394 .probe = agp_sis_probe, 433 .probe = agp_sis_probe,
395 .remove = agp_sis_remove, 434 .remove = agp_sis_remove,
435#ifdef CONFIG_PM
436 .suspend = agp_sis_suspend,
437 .resume = agp_sis_resume,
438#endif
396}; 439};
397 440
398static int __init agp_sis_init(void) 441static int __init agp_sis_init(void)
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 551ef25063ef..e08934e58f32 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -52,28 +52,20 @@ static int serverworks_create_page_map(struct serverworks_page_map *page_map)
52 if (page_map->real == NULL) { 52 if (page_map->real == NULL) {
53 return -ENOMEM; 53 return -ENOMEM;
54 } 54 }
55 SetPageReserved(virt_to_page(page_map->real)); 55
56 global_cache_flush(); 56 set_memory_uc((unsigned long)page_map->real, 1);
57 page_map->remapped = ioremap_nocache(virt_to_gart(page_map->real), 57 page_map->remapped = page_map->real;
58 PAGE_SIZE);
59 if (page_map->remapped == NULL) {
60 ClearPageReserved(virt_to_page(page_map->real));
61 free_page((unsigned long) page_map->real);
62 page_map->real = NULL;
63 return -ENOMEM;
64 }
65 global_cache_flush();
66 58
67 for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) 59 for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++)
68 writel(agp_bridge->scratch_page, page_map->remapped+i); 60 writel(agp_bridge->scratch_page, page_map->remapped+i);
61 /* Red Pen: Everyone else does pci posting flush here */
69 62
70 return 0; 63 return 0;
71} 64}
72 65
73static void serverworks_free_page_map(struct serverworks_page_map *page_map) 66static void serverworks_free_page_map(struct serverworks_page_map *page_map)
74{ 67{
75 iounmap(page_map->remapped); 68 set_memory_wb((unsigned long)page_map->real, 1);
76 ClearPageReserved(virt_to_page(page_map->real));
77 free_page((unsigned long) page_map->real); 69 free_page((unsigned long) page_map->real);
78} 70}
79 71
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 19d3be5c4b2d..a6789f25009b 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -568,7 +568,7 @@ struct drm_driver {
568 void (*postclose) (struct drm_device *, struct drm_file *); 568 void (*postclose) (struct drm_device *, struct drm_file *);
569 void (*lastclose) (struct drm_device *); 569 void (*lastclose) (struct drm_device *);
570 int (*unload) (struct drm_device *); 570 int (*unload) (struct drm_device *);
571 int (*suspend) (struct drm_device *); 571 int (*suspend) (struct drm_device *, pm_message_t state);
572 int (*resume) (struct drm_device *); 572 int (*resume) (struct drm_device *);
573 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); 573 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
574 void (*dma_ready) (struct drm_device *); 574 void (*dma_ready) (struct drm_device *);
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
index f52468843678..715b361f0c2b 100644
--- a/drivers/char/drm/drm_pciids.h
+++ b/drivers/char/drm/drm_pciids.h
@@ -83,6 +83,7 @@
83 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 83 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
84 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 84 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
85 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 85 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
86 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
86 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 87 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \
87 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 88 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \
88 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 89 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \
@@ -236,6 +237,7 @@
236 {0x1002, 0x7297, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \ 237 {0x1002, 0x7297, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
237 {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \ 238 {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
238 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
239 {0, 0, 0} 241 {0, 0, 0}
240 242
241#define r128_PCI_IDS \ 243#define r128_PCI_IDS \
@@ -313,6 +315,7 @@
313 {0x1039, 0x5300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 315 {0x1039, 0x5300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
314 {0x1039, 0x6300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 316 {0x1039, 0x6300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
315 {0x1039, 0x6330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \ 317 {0x1039, 0x6330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \
318 {0x1039, 0x6351, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
316 {0x1039, 0x7300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 319 {0x1039, 0x7300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
317 {0x18CA, 0x0040, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \ 320 {0x18CA, 0x0040, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \
318 {0x18CA, 0x0042, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \ 321 {0x18CA, 0x0042, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_CHIP_315}, \
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index fa36153619e8..05ed5043254f 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -36,7 +36,7 @@ static int drm_sysfs_suspend(struct device *dev, pm_message_t state)
36 printk(KERN_ERR "%s\n", __FUNCTION__); 36 printk(KERN_ERR "%s\n", __FUNCTION__);
37 37
38 if (drm_dev->driver->suspend) 38 if (drm_dev->driver->suspend)
39 return drm_dev->driver->suspend(drm_dev); 39 return drm_dev->driver->suspend(drm_dev, state);
40 40
41 return 0; 41 return 0;
42} 42}
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index cea4105374b2..3d65c4dcd0c6 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -66,7 +66,7 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
66} 66}
67 67
68/** 68/**
69 * \c nopage method for AGP virtual memory. 69 * \c fault method for AGP virtual memory.
70 * 70 *
71 * \param vma virtual memory area. 71 * \param vma virtual memory area.
72 * \param address access address. 72 * \param address access address.
@@ -76,8 +76,7 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
76 * map, get the page, increment the use count and return it. 76 * map, get the page, increment the use count and return it.
77 */ 77 */
78#if __OS_HAS_AGP 78#if __OS_HAS_AGP
79static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, 79static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
80 unsigned long address)
81{ 80{
82 struct drm_file *priv = vma->vm_file->private_data; 81 struct drm_file *priv = vma->vm_file->private_data;
83 struct drm_device *dev = priv->head->dev; 82 struct drm_device *dev = priv->head->dev;
@@ -89,19 +88,24 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
89 * Find the right map 88 * Find the right map
90 */ 89 */
91 if (!drm_core_has_AGP(dev)) 90 if (!drm_core_has_AGP(dev))
92 goto vm_nopage_error; 91 goto vm_fault_error;
93 92
94 if (!dev->agp || !dev->agp->cant_use_aperture) 93 if (!dev->agp || !dev->agp->cant_use_aperture)
95 goto vm_nopage_error; 94 goto vm_fault_error;
96 95
97 if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) 96 if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash))
98 goto vm_nopage_error; 97 goto vm_fault_error;
99 98
100 r_list = drm_hash_entry(hash, struct drm_map_list, hash); 99 r_list = drm_hash_entry(hash, struct drm_map_list, hash);
101 map = r_list->map; 100 map = r_list->map;
102 101
103 if (map && map->type == _DRM_AGP) { 102 if (map && map->type == _DRM_AGP) {
104 unsigned long offset = address - vma->vm_start; 103 /*
104 * Using vm_pgoff as a selector forces us to use this unusual
105 * addressing scheme.
106 */
107 unsigned long offset = (unsigned long)vmf->virtual_address -
108 vma->vm_start;
105 unsigned long baddr = map->offset + offset; 109 unsigned long baddr = map->offset + offset;
106 struct drm_agp_mem *agpmem; 110 struct drm_agp_mem *agpmem;
107 struct page *page; 111 struct page *page;
@@ -123,7 +127,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
123 } 127 }
124 128
125 if (!agpmem) 129 if (!agpmem)
126 goto vm_nopage_error; 130 goto vm_fault_error;
127 131
128 /* 132 /*
129 * Get the page, inc the use count, and return it 133 * Get the page, inc the use count, and return it
@@ -131,22 +135,21 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
131 offset = (baddr - agpmem->bound) >> PAGE_SHIFT; 135 offset = (baddr - agpmem->bound) >> PAGE_SHIFT;
132 page = virt_to_page(__va(agpmem->memory->memory[offset])); 136 page = virt_to_page(__va(agpmem->memory->memory[offset]));
133 get_page(page); 137 get_page(page);
138 vmf->page = page;
134 139
135 DRM_DEBUG 140 DRM_DEBUG
136 ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", 141 ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n",
137 baddr, __va(agpmem->memory->memory[offset]), offset, 142 baddr, __va(agpmem->memory->memory[offset]), offset,
138 page_count(page)); 143 page_count(page));
139 144 return 0;
140 return page;
141 } 145 }
142 vm_nopage_error: 146vm_fault_error:
143 return NOPAGE_SIGBUS; /* Disallow mremap */ 147 return VM_FAULT_SIGBUS; /* Disallow mremap */
144} 148}
145#else /* __OS_HAS_AGP */ 149#else /* __OS_HAS_AGP */
146static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, 150static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
147 unsigned long address)
148{ 151{
149 return NOPAGE_SIGBUS; 152 return VM_FAULT_SIGBUS;
150} 153}
151#endif /* __OS_HAS_AGP */ 154#endif /* __OS_HAS_AGP */
152 155
@@ -160,28 +163,26 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
160 * Get the mapping, find the real physical page to map, get the page, and 163 * Get the mapping, find the real physical page to map, get the page, and
161 * return it. 164 * return it.
162 */ 165 */
163static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, 166static int drm_do_vm_shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
164 unsigned long address)
165{ 167{
166 struct drm_map *map = (struct drm_map *) vma->vm_private_data; 168 struct drm_map *map = (struct drm_map *) vma->vm_private_data;
167 unsigned long offset; 169 unsigned long offset;
168 unsigned long i; 170 unsigned long i;
169 struct page *page; 171 struct page *page;
170 172
171 if (address > vma->vm_end)
172 return NOPAGE_SIGBUS; /* Disallow mremap */
173 if (!map) 173 if (!map)
174 return NOPAGE_SIGBUS; /* Nothing allocated */ 174 return VM_FAULT_SIGBUS; /* Nothing allocated */
175 175
176 offset = address - vma->vm_start; 176 offset = (unsigned long)vmf->virtual_address - vma->vm_start;
177 i = (unsigned long)map->handle + offset; 177 i = (unsigned long)map->handle + offset;
178 page = vmalloc_to_page((void *)i); 178 page = vmalloc_to_page((void *)i);
179 if (!page) 179 if (!page)
180 return NOPAGE_SIGBUS; 180 return VM_FAULT_SIGBUS;
181 get_page(page); 181 get_page(page);
182 vmf->page = page;
182 183
183 DRM_DEBUG("0x%lx\n", address); 184 DRM_DEBUG("shm_fault 0x%lx\n", offset);
184 return page; 185 return 0;
185} 186}
186 187
187/** 188/**
@@ -263,7 +264,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
263} 264}
264 265
265/** 266/**
266 * \c nopage method for DMA virtual memory. 267 * \c fault method for DMA virtual memory.
267 * 268 *
268 * \param vma virtual memory area. 269 * \param vma virtual memory area.
269 * \param address access address. 270 * \param address access address.
@@ -271,8 +272,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
271 * 272 *
272 * Determine the page number from the page offset and get it from drm_device_dma::pagelist. 273 * Determine the page number from the page offset and get it from drm_device_dma::pagelist.
273 */ 274 */
274static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, 275static int drm_do_vm_dma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
275 unsigned long address)
276{ 276{
277 struct drm_file *priv = vma->vm_file->private_data; 277 struct drm_file *priv = vma->vm_file->private_data;
278 struct drm_device *dev = priv->head->dev; 278 struct drm_device *dev = priv->head->dev;
@@ -282,24 +282,23 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
282 struct page *page; 282 struct page *page;
283 283
284 if (!dma) 284 if (!dma)
285 return NOPAGE_SIGBUS; /* Error */ 285 return VM_FAULT_SIGBUS; /* Error */
286 if (address > vma->vm_end)
287 return NOPAGE_SIGBUS; /* Disallow mremap */
288 if (!dma->pagelist) 286 if (!dma->pagelist)
289 return NOPAGE_SIGBUS; /* Nothing allocated */ 287 return VM_FAULT_SIGBUS; /* Nothing allocated */
290 288
291 offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ 289 offset = (unsigned long)vmf->virtual_address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
292 page_nr = offset >> PAGE_SHIFT; 290 page_nr = offset >> PAGE_SHIFT; /* page_nr could just be vmf->pgoff */
293 page = virt_to_page((dma->pagelist[page_nr] + (offset & (~PAGE_MASK)))); 291 page = virt_to_page((dma->pagelist[page_nr] + (offset & (~PAGE_MASK))));
294 292
295 get_page(page); 293 get_page(page);
294 vmf->page = page;
296 295
297 DRM_DEBUG("0x%lx (page %lu)\n", address, page_nr); 296 DRM_DEBUG("dma_fault 0x%lx (page %lu)\n", offset, page_nr);
298 return page; 297 return 0;
299} 298}
300 299
301/** 300/**
302 * \c nopage method for scatter-gather virtual memory. 301 * \c fault method for scatter-gather virtual memory.
303 * 302 *
304 * \param vma virtual memory area. 303 * \param vma virtual memory area.
305 * \param address access address. 304 * \param address access address.
@@ -307,8 +306,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
307 * 306 *
308 * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist. 307 * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist.
309 */ 308 */
310static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, 309static int drm_do_vm_sg_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
311 unsigned long address)
312{ 310{
313 struct drm_map *map = (struct drm_map *) vma->vm_private_data; 311 struct drm_map *map = (struct drm_map *) vma->vm_private_data;
314 struct drm_file *priv = vma->vm_file->private_data; 312 struct drm_file *priv = vma->vm_file->private_data;
@@ -320,77 +318,64 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
320 struct page *page; 318 struct page *page;
321 319
322 if (!entry) 320 if (!entry)
323 return NOPAGE_SIGBUS; /* Error */ 321 return VM_FAULT_SIGBUS; /* Error */
324 if (address > vma->vm_end)
325 return NOPAGE_SIGBUS; /* Disallow mremap */
326 if (!entry->pagelist) 322 if (!entry->pagelist)
327 return NOPAGE_SIGBUS; /* Nothing allocated */ 323 return VM_FAULT_SIGBUS; /* Nothing allocated */
328 324
329 offset = address - vma->vm_start; 325 offset = (unsigned long)vmf->virtual_address - vma->vm_start;
330 map_offset = map->offset - (unsigned long)dev->sg->virtual; 326 map_offset = map->offset - (unsigned long)dev->sg->virtual;
331 page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT); 327 page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
332 page = entry->pagelist[page_offset]; 328 page = entry->pagelist[page_offset];
333 get_page(page); 329 get_page(page);
330 vmf->page = page;
334 331
335 return page; 332 return 0;
336} 333}
337 334
338static struct page *drm_vm_nopage(struct vm_area_struct *vma, 335static int drm_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
339 unsigned long address, int *type)
340{ 336{
341 if (type) 337 return drm_do_vm_fault(vma, vmf);
342 *type = VM_FAULT_MINOR;
343 return drm_do_vm_nopage(vma, address);
344} 338}
345 339
346static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, 340static int drm_vm_shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
347 unsigned long address, int *type)
348{ 341{
349 if (type) 342 return drm_do_vm_shm_fault(vma, vmf);
350 *type = VM_FAULT_MINOR;
351 return drm_do_vm_shm_nopage(vma, address);
352} 343}
353 344
354static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, 345static int drm_vm_dma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
355 unsigned long address, int *type)
356{ 346{
357 if (type) 347 return drm_do_vm_dma_fault(vma, vmf);
358 *type = VM_FAULT_MINOR;
359 return drm_do_vm_dma_nopage(vma, address);
360} 348}
361 349
362static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma, 350static int drm_vm_sg_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
363 unsigned long address, int *type)
364{ 351{
365 if (type) 352 return drm_do_vm_sg_fault(vma, vmf);
366 *type = VM_FAULT_MINOR;
367 return drm_do_vm_sg_nopage(vma, address);
368} 353}
369 354
370/** AGP virtual memory operations */ 355/** AGP virtual memory operations */
371static struct vm_operations_struct drm_vm_ops = { 356static struct vm_operations_struct drm_vm_ops = {
372 .nopage = drm_vm_nopage, 357 .fault = drm_vm_fault,
373 .open = drm_vm_open, 358 .open = drm_vm_open,
374 .close = drm_vm_close, 359 .close = drm_vm_close,
375}; 360};
376 361
377/** Shared virtual memory operations */ 362/** Shared virtual memory operations */
378static struct vm_operations_struct drm_vm_shm_ops = { 363static struct vm_operations_struct drm_vm_shm_ops = {
379 .nopage = drm_vm_shm_nopage, 364 .fault = drm_vm_shm_fault,
380 .open = drm_vm_open, 365 .open = drm_vm_open,
381 .close = drm_vm_shm_close, 366 .close = drm_vm_shm_close,
382}; 367};
383 368
384/** DMA virtual memory operations */ 369/** DMA virtual memory operations */
385static struct vm_operations_struct drm_vm_dma_ops = { 370static struct vm_operations_struct drm_vm_dma_ops = {
386 .nopage = drm_vm_dma_nopage, 371 .fault = drm_vm_dma_fault,
387 .open = drm_vm_open, 372 .open = drm_vm_open,
388 .close = drm_vm_close, 373 .close = drm_vm_close,
389}; 374};
390 375
391/** Scatter-gather virtual memory operations */ 376/** Scatter-gather virtual memory operations */
392static struct vm_operations_struct drm_vm_sg_ops = { 377static struct vm_operations_struct drm_vm_sg_ops = {
393 .nopage = drm_vm_sg_nopage, 378 .fault = drm_vm_sg_fault,
394 .open = drm_vm_open, 379 .open = drm_vm_open,
395 .close = drm_vm_close, 380 .close = drm_vm_close,
396}; 381};
@@ -604,7 +589,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
604 /* 589 /*
605 * On some platforms we can't talk to bus dma address from the CPU, so for 590 * On some platforms we can't talk to bus dma address from the CPU, so for
606 * memory of type DRM_AGP, we'll deal with sorting out the real physical 591 * memory of type DRM_AGP, we'll deal with sorting out the real physical
607 * pages and mappings in nopage() 592 * pages and mappings in fault()
608 */ 593 */
609#if defined(__powerpc__) 594#if defined(__powerpc__)
610 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; 595 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
@@ -634,7 +619,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
634 break; 619 break;
635 case _DRM_CONSISTENT: 620 case _DRM_CONSISTENT:
636 /* Consistent memory is really like shared memory. But 621 /* Consistent memory is really like shared memory. But
637 * it's allocated in a different way, so avoid nopage */ 622 * it's allocated in a different way, so avoid fault */
638 if (remap_pfn_range(vma, vma->vm_start, 623 if (remap_pfn_range(vma, vma->vm_start,
639 page_to_pfn(virt_to_page(map->handle)), 624 page_to_pfn(virt_to_page(map->handle)),
640 vma->vm_end - vma->vm_start, vma->vm_page_prot)) 625 vma->vm_end - vma->vm_start, vma->vm_page_prot))
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
index 379cbdad4921..9df08105f4f3 100644
--- a/drivers/char/drm/i830_dma.c
+++ b/drivers/char/drm/i830_dma.c
@@ -36,7 +36,7 @@
36#include "i830_drm.h" 36#include "i830_drm.h"
37#include "i830_drv.h" 37#include "i830_drv.h"
38#include <linux/interrupt.h> /* For task queue support */ 38#include <linux/interrupt.h> /* For task queue support */
39#include <linux/pagemap.h> /* For FASTCALL on unlock_page() */ 39#include <linux/pagemap.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <asm/uaccess.h> 41#include <asm/uaccess.h>
42 42
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index 43986d81ae34..e9d6663bec73 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -171,7 +171,7 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
171 dev_priv->allow_batchbuffer = 1; 171 dev_priv->allow_batchbuffer = 1;
172 172
173 /* Program Hardware Status Page */ 173 /* Program Hardware Status Page */
174 if (!IS_G33(dev)) { 174 if (!I915_NEED_GFX_HWS(dev)) {
175 dev_priv->status_page_dmah = 175 dev_priv->status_page_dmah =
176 drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff); 176 drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
177 177
@@ -720,6 +720,9 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
720 drm_i915_private_t *dev_priv = dev->dev_private; 720 drm_i915_private_t *dev_priv = dev->dev_private;
721 drm_i915_hws_addr_t *hws = data; 721 drm_i915_hws_addr_t *hws = data;
722 722
723 if (!I915_NEED_GFX_HWS(dev))
724 return -EINVAL;
725
723 if (!dev_priv) { 726 if (!dev_priv) {
724 DRM_ERROR("called with no initialization\n"); 727 DRM_ERROR("called with no initialization\n");
725 return -EINVAL; 728 return -EINVAL;
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 52e51033d32c..b2b451dc4460 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -160,6 +160,7 @@ static void i915_save_vga(struct drm_device *dev)
160 dev_priv->saveAR[i] = i915_read_ar(st01, i, 0); 160 dev_priv->saveAR[i] = i915_read_ar(st01, i, 0);
161 inb(st01); 161 inb(st01);
162 outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX); 162 outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX);
163 inb(st01);
163 164
164 /* Graphics controller registers */ 165 /* Graphics controller registers */
165 for (i = 0; i < 9; i++) 166 for (i = 0; i < 9; i++)
@@ -221,10 +222,12 @@ static void i915_restore_vga(struct drm_device *dev)
221 dev_priv->saveGR[0x18]); 222 dev_priv->saveGR[0x18]);
222 223
223 /* Attribute controller registers */ 224 /* Attribute controller registers */
225 inb(st01);
224 for (i = 0; i < 20; i++) 226 for (i = 0; i < 20; i++)
225 i915_write_ar(st01, i, dev_priv->saveAR[i], 0); 227 i915_write_ar(st01, i, dev_priv->saveAR[i], 0);
226 inb(st01); /* switch back to index mode */ 228 inb(st01); /* switch back to index mode */
227 outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX); 229 outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX);
230 inb(st01);
228 231
229 /* VGA color palette registers */ 232 /* VGA color palette registers */
230 outb(dev_priv->saveDACMASK, VGA_DACMASK); 233 outb(dev_priv->saveDACMASK, VGA_DACMASK);
@@ -236,7 +239,7 @@ static void i915_restore_vga(struct drm_device *dev)
236 239
237} 240}
238 241
239static int i915_suspend(struct drm_device *dev) 242static int i915_suspend(struct drm_device *dev, pm_message_t state)
240{ 243{
241 struct drm_i915_private *dev_priv = dev->dev_private; 244 struct drm_i915_private *dev_priv = dev->dev_private;
242 int i; 245 int i;
@@ -247,6 +250,9 @@ static int i915_suspend(struct drm_device *dev)
247 return -ENODEV; 250 return -ENODEV;
248 } 251 }
249 252
253 if (state.event == PM_EVENT_PRETHAW)
254 return 0;
255
250 pci_save_state(dev->pdev); 256 pci_save_state(dev->pdev);
251 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); 257 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
252 258
@@ -276,6 +282,7 @@ static int i915_suspend(struct drm_device *dev)
276 dev_priv->saveDSPATILEOFF = I915_READ(DSPATILEOFF); 282 dev_priv->saveDSPATILEOFF = I915_READ(DSPATILEOFF);
277 } 283 }
278 i915_save_palette(dev, PIPE_A); 284 i915_save_palette(dev, PIPE_A);
285 dev_priv->savePIPEASTAT = I915_READ(I915REG_PIPEASTAT);
279 286
280 /* Pipe & plane B info */ 287 /* Pipe & plane B info */
281 dev_priv->savePIPEBCONF = I915_READ(PIPEBCONF); 288 dev_priv->savePIPEBCONF = I915_READ(PIPEBCONF);
@@ -303,6 +310,7 @@ static int i915_suspend(struct drm_device *dev)
303 dev_priv->saveDSPBTILEOFF = I915_READ(DSPBTILEOFF); 310 dev_priv->saveDSPBTILEOFF = I915_READ(DSPBTILEOFF);
304 } 311 }
305 i915_save_palette(dev, PIPE_B); 312 i915_save_palette(dev, PIPE_B);
313 dev_priv->savePIPEBSTAT = I915_READ(I915REG_PIPEBSTAT);
306 314
307 /* CRT state */ 315 /* CRT state */
308 dev_priv->saveADPA = I915_READ(ADPA); 316 dev_priv->saveADPA = I915_READ(ADPA);
@@ -329,12 +337,26 @@ static int i915_suspend(struct drm_device *dev)
329 dev_priv->saveFBC_CONTROL2 = I915_READ(FBC_CONTROL2); 337 dev_priv->saveFBC_CONTROL2 = I915_READ(FBC_CONTROL2);
330 dev_priv->saveFBC_CONTROL = I915_READ(FBC_CONTROL); 338 dev_priv->saveFBC_CONTROL = I915_READ(FBC_CONTROL);
331 339
340 /* Interrupt state */
341 dev_priv->saveIIR = I915_READ(I915REG_INT_IDENTITY_R);
342 dev_priv->saveIER = I915_READ(I915REG_INT_ENABLE_R);
343 dev_priv->saveIMR = I915_READ(I915REG_INT_MASK_R);
344
332 /* VGA state */ 345 /* VGA state */
333 dev_priv->saveVCLK_DIVISOR_VGA0 = I915_READ(VCLK_DIVISOR_VGA0); 346 dev_priv->saveVCLK_DIVISOR_VGA0 = I915_READ(VCLK_DIVISOR_VGA0);
334 dev_priv->saveVCLK_DIVISOR_VGA1 = I915_READ(VCLK_DIVISOR_VGA1); 347 dev_priv->saveVCLK_DIVISOR_VGA1 = I915_READ(VCLK_DIVISOR_VGA1);
335 dev_priv->saveVCLK_POST_DIV = I915_READ(VCLK_POST_DIV); 348 dev_priv->saveVCLK_POST_DIV = I915_READ(VCLK_POST_DIV);
336 dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); 349 dev_priv->saveVGACNTRL = I915_READ(VGACNTRL);
337 350
351 /* Clock gating state */
352 dev_priv->saveDSPCLK_GATE_D = I915_READ(DSPCLK_GATE_D);
353
354 /* Cache mode state */
355 dev_priv->saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
356
357 /* Memory Arbitration state */
358 dev_priv->saveMI_ARB_STATE = I915_READ(MI_ARB_STATE);
359
338 /* Scratch space */ 360 /* Scratch space */
339 for (i = 0; i < 16; i++) { 361 for (i = 0; i < 16; i++) {
340 dev_priv->saveSWF0[i] = I915_READ(SWF0 + (i << 2)); 362 dev_priv->saveSWF0[i] = I915_READ(SWF0 + (i << 2));
@@ -345,9 +367,11 @@ static int i915_suspend(struct drm_device *dev)
345 367
346 i915_save_vga(dev); 368 i915_save_vga(dev);
347 369
348 /* Shut down the device */ 370 if (state.event == PM_EVENT_SUSPEND) {
349 pci_disable_device(dev->pdev); 371 /* Shut down the device */
350 pci_set_power_state(dev->pdev, PCI_D3hot); 372 pci_disable_device(dev->pdev);
373 pci_set_power_state(dev->pdev, PCI_D3hot);
374 }
351 375
352 return 0; 376 return 0;
353} 377}
@@ -400,9 +424,7 @@ static int i915_resume(struct drm_device *dev)
400 I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); 424 I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF);
401 } 425 }
402 426
403 if ((dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) && 427 I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF);
404 (dev_priv->saveDPLL_A & DPLL_VGA_MODE_DIS))
405 I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF);
406 428
407 i915_restore_palette(dev, PIPE_A); 429 i915_restore_palette(dev, PIPE_A);
408 /* Enable the plane */ 430 /* Enable the plane */
@@ -444,10 +466,9 @@ static int i915_resume(struct drm_device *dev)
444 I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); 466 I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF);
445 } 467 }
446 468
447 if ((dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) && 469 I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF);
448 (dev_priv->saveDPLL_B & DPLL_VGA_MODE_DIS)) 470
449 I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF); 471 i915_restore_palette(dev, PIPE_B);
450 i915_restore_palette(dev, PIPE_A);
451 /* Enable the plane */ 472 /* Enable the plane */
452 I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); 473 I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR);
453 I915_WRITE(DSPBBASE, I915_READ(DSPBBASE)); 474 I915_WRITE(DSPBBASE, I915_READ(DSPBBASE));
@@ -485,6 +506,15 @@ static int i915_resume(struct drm_device *dev)
485 I915_WRITE(VCLK_POST_DIV, dev_priv->saveVCLK_POST_DIV); 506 I915_WRITE(VCLK_POST_DIV, dev_priv->saveVCLK_POST_DIV);
486 udelay(150); 507 udelay(150);
487 508
509 /* Clock gating state */
510 I915_WRITE (DSPCLK_GATE_D, dev_priv->saveDSPCLK_GATE_D);
511
512 /* Cache mode state */
513 I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000);
514
515 /* Memory arbitration state */
516 I915_WRITE (MI_ARB_STATE, dev_priv->saveMI_ARB_STATE | 0xffff0000);
517
488 for (i = 0; i < 16; i++) { 518 for (i = 0; i < 16; i++) {
489 I915_WRITE(SWF0 + (i << 2), dev_priv->saveSWF0[i]); 519 I915_WRITE(SWF0 + (i << 2), dev_priv->saveSWF0[i]);
490 I915_WRITE(SWF10 + (i << 2), dev_priv->saveSWF1[i+7]); 520 I915_WRITE(SWF10 + (i << 2), dev_priv->saveSWF1[i+7]);
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index f8308bfb2613..c10d128e34db 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -134,6 +134,7 @@ typedef struct drm_i915_private {
134 u32 saveVBLANK_A; 134 u32 saveVBLANK_A;
135 u32 saveVSYNC_A; 135 u32 saveVSYNC_A;
136 u32 saveBCLRPAT_A; 136 u32 saveBCLRPAT_A;
137 u32 savePIPEASTAT;
137 u32 saveDSPASTRIDE; 138 u32 saveDSPASTRIDE;
138 u32 saveDSPASIZE; 139 u32 saveDSPASIZE;
139 u32 saveDSPAPOS; 140 u32 saveDSPAPOS;
@@ -154,6 +155,7 @@ typedef struct drm_i915_private {
154 u32 saveVBLANK_B; 155 u32 saveVBLANK_B;
155 u32 saveVSYNC_B; 156 u32 saveVSYNC_B;
156 u32 saveBCLRPAT_B; 157 u32 saveBCLRPAT_B;
158 u32 savePIPEBSTAT;
157 u32 saveDSPBSTRIDE; 159 u32 saveDSPBSTRIDE;
158 u32 saveDSPBSIZE; 160 u32 saveDSPBSIZE;
159 u32 saveDSPBPOS; 161 u32 saveDSPBPOS;
@@ -182,6 +184,12 @@ typedef struct drm_i915_private {
182 u32 saveFBC_LL_BASE; 184 u32 saveFBC_LL_BASE;
183 u32 saveFBC_CONTROL; 185 u32 saveFBC_CONTROL;
184 u32 saveFBC_CONTROL2; 186 u32 saveFBC_CONTROL2;
187 u32 saveIER;
188 u32 saveIIR;
189 u32 saveIMR;
190 u32 saveCACHE_MODE_0;
191 u32 saveDSPCLK_GATE_D;
192 u32 saveMI_ARB_STATE;
185 u32 saveSWF0[16]; 193 u32 saveSWF0[16];
186 u32 saveSWF1[16]; 194 u32 saveSWF1[16];
187 u32 saveSWF2[3]; 195 u32 saveSWF2[3];
@@ -450,6 +458,10 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
450 */ 458 */
451#define DMA_FADD_S 0x20d4 459#define DMA_FADD_S 0x20d4
452 460
461/* Memory Interface Arbitration State
462 */
463#define MI_ARB_STATE 0x20e4
464
453/* Cache mode 0 reg. 465/* Cache mode 0 reg.
454 * - Manipulating render cache behaviour is central 466 * - Manipulating render cache behaviour is central
455 * to the concept of zone rendering, tuning this reg can help avoid 467 * to the concept of zone rendering, tuning this reg can help avoid
@@ -460,6 +472,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
460 * bit of interest either set or cleared. EG: (BIT<<16) | BIT to set. 472 * bit of interest either set or cleared. EG: (BIT<<16) | BIT to set.
461 */ 473 */
462#define Cache_Mode_0 0x2120 474#define Cache_Mode_0 0x2120
475#define CACHE_MODE_0 0x2120
463#define CM0_MASK_SHIFT 16 476#define CM0_MASK_SHIFT 16
464#define CM0_IZ_OPT_DISABLE (1<<6) 477#define CM0_IZ_OPT_DISABLE (1<<6)
465#define CM0_ZR_OPT_DISABLE (1<<5) 478#define CM0_ZR_OPT_DISABLE (1<<5)
@@ -655,6 +668,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
655/** P1 value is 2 greater than this field */ 668/** P1 value is 2 greater than this field */
656# define VGA0_PD_P1_MASK (0x1f << 0) 669# define VGA0_PD_P1_MASK (0x1f << 0)
657 670
671#define DSPCLK_GATE_D 0x6200
672
658/* I830 CRTC registers */ 673/* I830 CRTC registers */
659#define HTOTAL_A 0x60000 674#define HTOTAL_A 0x60000
660#define HBLANK_A 0x60004 675#define HBLANK_A 0x60004
@@ -1101,6 +1116,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1101#define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \ 1116#define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \
1102 IS_I945GM(dev) || IS_I965GM(dev) || IS_IGD_GM(dev)) 1117 IS_I945GM(dev) || IS_I965GM(dev) || IS_IGD_GM(dev))
1103 1118
1119#define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_IGD_GM(dev))
1120
1104#define PRIMARY_RINGBUFFER_SIZE (128*1024) 1121#define PRIMARY_RINGBUFFER_SIZE (128*1024)
1105 1122
1106#endif 1123#endif
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 5dc799ab86b8..833abc7e55fb 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -825,11 +825,19 @@ static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
825 return ret; 825 return ret;
826} 826}
827 827
828static u32 RS690_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
829{
830 RADEON_WRITE(RS690_MC_INDEX, (addr & RS690_MC_INDEX_MASK));
831 return RADEON_READ(RS690_MC_DATA);
832}
833
828u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) 834u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
829{ 835{
830 836
831 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 837 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
832 return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION); 838 return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION);
839 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
840 return RS690_READ_MCIND(dev_priv, RS690_MC_FB_LOCATION);
833 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 841 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
834 return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION); 842 return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION);
835 else 843 else
@@ -840,6 +848,8 @@ static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
840{ 848{
841 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 849 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
842 RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc); 850 RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc);
851 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
852 RS690_WRITE_MCIND(RS690_MC_FB_LOCATION, fb_loc);
843 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 853 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
844 RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc); 854 RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc);
845 else 855 else
@@ -850,6 +860,8 @@ static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_lo
850{ 860{
851 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) 861 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
852 RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc); 862 RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc);
863 else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690)
864 RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, agp_loc);
853 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) 865 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
854 RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc); 866 RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc);
855 else 867 else
@@ -1362,6 +1374,70 @@ static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on)
1362 } 1374 }
1363} 1375}
1364 1376
1377/* Enable or disable RS690 GART on the chip */
1378static void radeon_set_rs690gart(drm_radeon_private_t *dev_priv, int on)
1379{
1380 u32 temp;
1381
1382 if (on) {
1383 DRM_DEBUG("programming rs690 gart %08X %08lX %08X\n",
1384 dev_priv->gart_vm_start,
1385 (long)dev_priv->gart_info.bus_addr,
1386 dev_priv->gart_size);
1387
1388 temp = RS690_READ_MCIND(dev_priv, RS690_MC_MISC_CNTL);
1389 RS690_WRITE_MCIND(RS690_MC_MISC_CNTL, 0x5000);
1390
1391 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE,
1392 RS690_MC_GART_EN | RS690_MC_AGP_SIZE_32MB);
1393
1394 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_FEATURE_ID);
1395 RS690_WRITE_MCIND(RS690_MC_GART_FEATURE_ID, 0x42040800);
1396
1397 RS690_WRITE_MCIND(RS690_MC_GART_BASE,
1398 dev_priv->gart_info.bus_addr);
1399
1400 temp = RS690_READ_MCIND(dev_priv, RS690_MC_AGP_MODE_CONTROL);
1401 RS690_WRITE_MCIND(RS690_MC_AGP_MODE_CONTROL, 0x01400000);
1402
1403 RS690_WRITE_MCIND(RS690_MC_AGP_BASE,
1404 (unsigned int)dev_priv->gart_vm_start);
1405
1406 dev_priv->gart_size = 32*1024*1024;
1407 temp = (((dev_priv->gart_vm_start - 1 + dev_priv->gart_size) &
1408 0xffff0000) | (dev_priv->gart_vm_start >> 16));
1409
1410 RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, temp);
1411
1412 temp = RS690_READ_MCIND(dev_priv, RS690_MC_AGP_SIZE);
1413 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE,
1414 RS690_MC_GART_EN | RS690_MC_AGP_SIZE_32MB);
1415
1416 do {
1417 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_CACHE_CNTL);
1418 if ((temp & RS690_MC_GART_CLEAR_STATUS) ==
1419 RS690_MC_GART_CLEAR_DONE)
1420 break;
1421 DRM_UDELAY(1);
1422 } while (1);
1423
1424 RS690_WRITE_MCIND(RS690_MC_GART_CACHE_CNTL,
1425 RS690_MC_GART_CC_CLEAR);
1426 do {
1427 temp = RS690_READ_MCIND(dev_priv, RS690_MC_GART_CACHE_CNTL);
1428 if ((temp & RS690_MC_GART_CLEAR_STATUS) ==
1429 RS690_MC_GART_CLEAR_DONE)
1430 break;
1431 DRM_UDELAY(1);
1432 } while (1);
1433
1434 RS690_WRITE_MCIND(RS690_MC_GART_CACHE_CNTL,
1435 RS690_MC_GART_CC_NO_CHANGE);
1436 } else {
1437 RS690_WRITE_MCIND(RS690_MC_AGP_SIZE, RS690_MC_GART_DIS);
1438 }
1439}
1440
1365static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on) 1441static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on)
1366{ 1442{
1367 u32 tmp = RADEON_READ_PCIE(dev_priv, RADEON_PCIE_TX_GART_CNTL); 1443 u32 tmp = RADEON_READ_PCIE(dev_priv, RADEON_PCIE_TX_GART_CNTL);
@@ -1396,6 +1472,11 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
1396{ 1472{
1397 u32 tmp; 1473 u32 tmp;
1398 1474
1475 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) {
1476 radeon_set_rs690gart(dev_priv, on);
1477 return;
1478 }
1479
1399 if (dev_priv->flags & RADEON_IS_IGPGART) { 1480 if (dev_priv->flags & RADEON_IS_IGPGART) {
1400 radeon_set_igpgart(dev_priv, on); 1481 radeon_set_igpgart(dev_priv, on);
1401 return; 1482 return;
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 4434332c79bc..173ae620223a 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -123,6 +123,7 @@ enum radeon_family {
123 CHIP_R420, 123 CHIP_R420,
124 CHIP_RV410, 124 CHIP_RV410,
125 CHIP_RS400, 125 CHIP_RS400,
126 CHIP_RS690,
126 CHIP_RV515, 127 CHIP_RV515,
127 CHIP_R520, 128 CHIP_R520,
128 CHIP_RV530, 129 CHIP_RV530,
@@ -467,6 +468,36 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev,
467#define RADEON_IGPGART_ENABLE 0x38 468#define RADEON_IGPGART_ENABLE 0x38
468#define RADEON_IGPGART_UNK_39 0x39 469#define RADEON_IGPGART_UNK_39 0x39
469 470
471#define RS690_MC_INDEX 0x78
472# define RS690_MC_INDEX_MASK 0x1ff
473# define RS690_MC_INDEX_WR_EN (1 << 9)
474# define RS690_MC_INDEX_WR_ACK 0x7f
475#define RS690_MC_DATA 0x7c
476
477#define RS690_MC_MISC_CNTL 0x18
478#define RS690_MC_GART_FEATURE_ID 0x2b
479#define RS690_MC_GART_BASE 0x2c
480#define RS690_MC_GART_CACHE_CNTL 0x2e
481# define RS690_MC_GART_CC_NO_CHANGE 0x0
482# define RS690_MC_GART_CC_CLEAR 0x1
483# define RS690_MC_GART_CLEAR_STATUS (1 << 1)
484# define RS690_MC_GART_CLEAR_DONE (0 << 1)
485# define RS690_MC_GART_CLEAR_PENDING (1 << 1)
486#define RS690_MC_AGP_SIZE 0x38
487# define RS690_MC_GART_DIS 0x0
488# define RS690_MC_GART_EN 0x1
489# define RS690_MC_AGP_SIZE_32MB (0 << 1)
490# define RS690_MC_AGP_SIZE_64MB (1 << 1)
491# define RS690_MC_AGP_SIZE_128MB (2 << 1)
492# define RS690_MC_AGP_SIZE_256MB (3 << 1)
493# define RS690_MC_AGP_SIZE_512MB (4 << 1)
494# define RS690_MC_AGP_SIZE_1GB (5 << 1)
495# define RS690_MC_AGP_SIZE_2GB (6 << 1)
496#define RS690_MC_AGP_MODE_CONTROL 0x39
497#define RS690_MC_FB_LOCATION 0x100
498#define RS690_MC_AGP_LOCATION 0x101
499#define RS690_MC_AGP_BASE 0x102
500
470#define R520_MC_IND_INDEX 0x70 501#define R520_MC_IND_INDEX 0x70
471#define R520_MC_IND_WR_EN (1<<24) 502#define R520_MC_IND_WR_EN (1<<24)
472#define R520_MC_IND_DATA 0x74 503#define R520_MC_IND_DATA 0x74
@@ -1076,6 +1107,13 @@ do { \
1076 RADEON_WRITE(R520_MC_IND_INDEX, 0); \ 1107 RADEON_WRITE(R520_MC_IND_INDEX, 0); \
1077 } while (0) 1108 } while (0)
1078 1109
1110#define RS690_WRITE_MCIND( addr, val ) \
1111do { \
1112 RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_EN | ((addr) & RS690_MC_INDEX_MASK)); \
1113 RADEON_WRITE(RS690_MC_DATA, val); \
1114 RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); \
1115} while (0)
1116
1079#define CP_PACKET0( reg, n ) \ 1117#define CP_PACKET0( reg, n ) \
1080 (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) 1118 (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
1081#define CP_PACKET0_TABLE( reg, n ) \ 1119#define CP_PACKET0_TABLE( reg, n ) \
diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c
index bb09413d5a21..88590d040046 100644
--- a/drivers/char/hvc_rtas.c
+++ b/drivers/char/hvc_rtas.c
@@ -76,7 +76,7 @@ static struct hv_ops hvc_rtas_get_put_ops = {
76 .put_chars = hvc_rtas_write_console, 76 .put_chars = hvc_rtas_write_console,
77}; 77};
78 78
79static int hvc_rtas_init(void) 79static int __init hvc_rtas_init(void)
80{ 80{
81 struct hvc_struct *hp; 81 struct hvc_struct *hp;
82 82
diff --git a/drivers/char/pcmcia/Kconfig b/drivers/char/pcmcia/Kconfig
index 00b8a84b0319..ffa0efce0aed 100644
--- a/drivers/char/pcmcia/Kconfig
+++ b/drivers/char/pcmcia/Kconfig
@@ -45,7 +45,7 @@ config CARDMAN_4040
45 45
46config IPWIRELESS 46config IPWIRELESS
47 tristate "IPWireless 3G UMTS PCMCIA card support" 47 tristate "IPWireless 3G UMTS PCMCIA card support"
48 depends on PCMCIA 48 depends on PCMCIA && NETDEVICES
49 select PPP 49 select PPP
50 help 50 help
51 This is a driver for 3G UMTS PCMCIA card from IPWireless company. In 51 This is a driver for 3G UMTS PCMCIA card from IPWireless company. In
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 64926aa990db..89a29cd93783 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1006,14 +1006,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
1006 } 1006 }
1007#endif 1007#endif
1008 1008
1009
1010 if (!kobject_get(&data->kobj)) {
1011 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1012 cpufreq_debug_enable_ratelimit();
1013 unlock_policy_rwsem_write(cpu);
1014 return -EFAULT;
1015 }
1016
1017#ifdef CONFIG_SMP 1009#ifdef CONFIG_SMP
1018 1010
1019#ifdef CONFIG_HOTPLUG_CPU 1011#ifdef CONFIG_HOTPLUG_CPU
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 60f71e6345e3..d73663a52324 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -219,7 +219,8 @@ static void poll_idle_init(struct cpuidle_device *dev)
219 219
220 cpuidle_set_statedata(state, NULL); 220 cpuidle_set_statedata(state, NULL);
221 221
222 snprintf(state->name, CPUIDLE_NAME_LEN, "C0 (poll idle)"); 222 snprintf(state->name, CPUIDLE_NAME_LEN, "C0");
223 snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE");
223 state->exit_latency = 0; 224 state->exit_latency = 0;
224 state->target_residency = 0; 225 state->target_residency = 0;
225 state->power_usage = -1; 226 state->power_usage = -1;
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 088ea74edd34..69102ca05685 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -218,16 +218,23 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
218 return sprintf(buf, "%u\n", state->_name);\ 218 return sprintf(buf, "%u\n", state->_name);\
219} 219}
220 220
221static ssize_t show_state_name(struct cpuidle_state *state, char *buf) 221#define define_show_state_str_function(_name) \
222{ 222static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
223 return sprintf(buf, "%s\n", state->name); 223{ \
224 if (state->_name[0] == '\0')\
225 return sprintf(buf, "<null>\n");\
226 return sprintf(buf, "%s\n", state->_name);\
224} 227}
225 228
226define_show_state_function(exit_latency) 229define_show_state_function(exit_latency)
227define_show_state_function(power_usage) 230define_show_state_function(power_usage)
228define_show_state_function(usage) 231define_show_state_function(usage)
229define_show_state_function(time) 232define_show_state_function(time)
233define_show_state_str_function(name)
234define_show_state_str_function(desc)
235
230define_one_state_ro(name, show_state_name); 236define_one_state_ro(name, show_state_name);
237define_one_state_ro(desc, show_state_desc);
231define_one_state_ro(latency, show_state_exit_latency); 238define_one_state_ro(latency, show_state_exit_latency);
232define_one_state_ro(power, show_state_power_usage); 239define_one_state_ro(power, show_state_power_usage);
233define_one_state_ro(usage, show_state_usage); 240define_one_state_ro(usage, show_state_usage);
@@ -235,6 +242,7 @@ define_one_state_ro(time, show_state_time);
235 242
236static struct attribute *cpuidle_state_default_attrs[] = { 243static struct attribute *cpuidle_state_default_attrs[] = {
237 &attr_name.attr, 244 &attr_name.attr,
245 &attr_desc.attr,
238 &attr_latency.attr, 246 &attr_latency.attr,
239 &attr_power.attr, 247 &attr_power.attr,
240 &attr_usage.attr, 248 &attr_usage.attr,
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index dfbf24c4033c..3110bf7014f7 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -463,7 +463,7 @@ struct hifn_device
463 463
464 unsigned int pk_clk_freq; 464 unsigned int pk_clk_freq;
465 465
466#ifdef CRYPTO_DEV_HIFN_795X_RNG 466#ifdef CONFIG_CRYPTO_DEV_HIFN_795X_RNG
467 unsigned int rng_wait_time; 467 unsigned int rng_wait_time;
468 ktime_t rngtime; 468 ktime_t rngtime;
469 struct hwrng rng; 469 struct hwrng rng;
@@ -795,7 +795,7 @@ static struct pci2id {
795 } 795 }
796}; 796};
797 797
798#ifdef CRYPTO_DEV_HIFN_795X_RNG 798#ifdef CONFIG_CRYPTO_DEV_HIFN_795X_RNG
799static int hifn_rng_data_present(struct hwrng *rng, int wait) 799static int hifn_rng_data_present(struct hwrng *rng, int wait)
800{ 800{
801 struct hifn_device *dev = (struct hifn_device *)rng->priv; 801 struct hifn_device *dev = (struct hifn_device *)rng->priv;
@@ -880,7 +880,7 @@ static int hifn_init_pubrng(struct hifn_device *dev)
880 dprintk("Chip %s: RNG engine has been successfully initialised.\n", 880 dprintk("Chip %s: RNG engine has been successfully initialised.\n",
881 dev->name); 881 dev->name);
882 882
883#ifdef CRYPTO_DEV_HIFN_795X_RNG 883#ifdef CONFIG_CRYPTO_DEV_HIFN_795X_RNG
884 /* First value must be discarded */ 884 /* First value must be discarded */
885 hifn_read_1(dev, HIFN_1_RNG_DATA); 885 hifn_read_1(dev, HIFN_1_RNG_DATA);
886 dev->rngtime = ktime_get(); 886 dev->rngtime = ktime_get();
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 653265a40b7f..4072449ad1cd 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -10,10 +10,9 @@
10 10
11static char dmi_empty_string[] = " "; 11static char dmi_empty_string[] = " ";
12 12
13static char * __init dmi_string(const struct dmi_header *dm, u8 s) 13static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s)
14{ 14{
15 const u8 *bp = ((u8 *) dm) + dm->length; 15 const u8 *bp = ((u8 *) dm) + dm->length;
16 char *str = "";
17 16
18 if (s) { 17 if (s) {
19 s--; 18 s--;
@@ -28,14 +27,29 @@ static char * __init dmi_string(const struct dmi_header *dm, u8 s)
28 27
29 if (!memcmp(bp, dmi_empty_string, cmp_len)) 28 if (!memcmp(bp, dmi_empty_string, cmp_len))
30 return dmi_empty_string; 29 return dmi_empty_string;
31 str = dmi_alloc(len); 30 return bp;
32 if (str != NULL)
33 strcpy(str, bp);
34 else
35 printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
36 } 31 }
37 } 32 }
38 33
34 return "";
35}
36
37static char * __init dmi_string(const struct dmi_header *dm, u8 s)
38{
39 const char *bp = dmi_string_nosave(dm, s);
40 char *str;
41 size_t len;
42
43 if (bp == dmi_empty_string)
44 return dmi_empty_string;
45
46 len = strlen(bp) + 1;
47 str = dmi_alloc(len);
48 if (str != NULL)
49 strcpy(str, bp);
50 else
51 printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
52
39 return str; 53 return str;
40} 54}
41 55
@@ -167,10 +181,30 @@ static void __init dmi_save_type(const struct dmi_header *dm, int slot, int inde
167 dmi_ident[slot] = s; 181 dmi_ident[slot] = s;
168} 182}
169 183
184static void __init dmi_save_one_device(int type, const char *name)
185{
186 struct dmi_device *dev;
187
188 /* No duplicate device */
189 if (dmi_find_device(type, name, NULL))
190 return;
191
192 dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1);
193 if (!dev) {
194 printk(KERN_ERR "dmi_save_one_device: out of memory.\n");
195 return;
196 }
197
198 dev->type = type;
199 strcpy((char *)(dev + 1), name);
200 dev->name = (char *)(dev + 1);
201 dev->device_data = NULL;
202 list_add(&dev->list, &dmi_devices);
203}
204
170static void __init dmi_save_devices(const struct dmi_header *dm) 205static void __init dmi_save_devices(const struct dmi_header *dm)
171{ 206{
172 int i, count = (dm->length - sizeof(struct dmi_header)) / 2; 207 int i, count = (dm->length - sizeof(struct dmi_header)) / 2;
173 struct dmi_device *dev;
174 208
175 for (i = 0; i < count; i++) { 209 for (i = 0; i < count; i++) {
176 const char *d = (char *)(dm + 1) + (i * 2); 210 const char *d = (char *)(dm + 1) + (i * 2);
@@ -179,23 +213,10 @@ static void __init dmi_save_devices(const struct dmi_header *dm)
179 if ((*d & 0x80) == 0) 213 if ((*d & 0x80) == 0)
180 continue; 214 continue;
181 215
182 dev = dmi_alloc(sizeof(*dev)); 216 dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d + 1)));
183 if (!dev) {
184 printk(KERN_ERR "dmi_save_devices: out of memory.\n");
185 break;
186 }
187
188 dev->type = *d++ & 0x7f;
189 dev->name = dmi_string(dm, *d);
190 dev->device_data = NULL;
191 list_add(&dev->list, &dmi_devices);
192 } 217 }
193} 218}
194 219
195static struct dmi_device empty_oem_string_dev = {
196 .name = dmi_empty_string,
197};
198
199static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm) 220static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
200{ 221{
201 int i, count = *(u8 *)(dm + 1); 222 int i, count = *(u8 *)(dm + 1);
@@ -204,10 +225,8 @@ static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
204 for (i = 1; i <= count; i++) { 225 for (i = 1; i <= count; i++) {
205 char *devname = dmi_string(dm, i); 226 char *devname = dmi_string(dm, i);
206 227
207 if (!strcmp(devname, dmi_empty_string)) { 228 if (devname == dmi_empty_string)
208 list_add(&empty_oem_string_dev.list, &dmi_devices);
209 continue; 229 continue;
210 }
211 230
212 dev = dmi_alloc(sizeof(*dev)); 231 dev = dmi_alloc(sizeof(*dev));
213 if (!dev) { 232 if (!dev) {
@@ -253,23 +272,12 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
253static void __init dmi_save_extended_devices(const struct dmi_header *dm) 272static void __init dmi_save_extended_devices(const struct dmi_header *dm)
254{ 273{
255 const u8 *d = (u8*) dm + 5; 274 const u8 *d = (u8*) dm + 5;
256 struct dmi_device *dev;
257 275
258 /* Skip disabled device */ 276 /* Skip disabled device */
259 if ((*d & 0x80) == 0) 277 if ((*d & 0x80) == 0)
260 return; 278 return;
261 279
262 dev = dmi_alloc(sizeof(*dev)); 280 dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
263 if (!dev) {
264 printk(KERN_ERR "dmi_save_extended_devices: out of memory.\n");
265 return;
266 }
267
268 dev->type = *d-- & 0x7f;
269 dev->name = dmi_string(dm, *d);
270 dev->device_data = NULL;
271
272 list_add(&dev->list, &dmi_devices);
273} 281}
274 282
275/* 283/*
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index a870ba58faa3..dceadd0c1419 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -352,7 +352,7 @@ int hidinput_mapping_quirks(struct hid_usage *usage,
352 return 0; 352 return 0;
353} 353}
354 354
355void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) 355int hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value)
356{ 356{
357 struct input_dev *input; 357 struct input_dev *input;
358 358
@@ -362,34 +362,34 @@ void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, stru
362 || ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) { 362 || ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_7) && (usage->hid == 0x00090007))) {
363 if (value) hid->quirks |= HID_QUIRK_2WHEEL_MOUSE_HACK_ON; 363 if (value) hid->quirks |= HID_QUIRK_2WHEEL_MOUSE_HACK_ON;
364 else hid->quirks &= ~HID_QUIRK_2WHEEL_MOUSE_HACK_ON; 364 else hid->quirks &= ~HID_QUIRK_2WHEEL_MOUSE_HACK_ON;
365 return; 365 return 1;
366 } 366 }
367 367
368 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) && 368 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) &&
369 (usage->type == EV_REL) && 369 (usage->type == EV_REL) &&
370 (usage->code == REL_WHEEL)) { 370 (usage->code == REL_WHEEL)) {
371 hid->delayed_value = value; 371 hid->delayed_value = value;
372 return; 372 return 1;
373 } 373 }
374 374
375 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) && 375 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_B8) &&
376 (usage->hid == 0x000100b8)) { 376 (usage->hid == 0x000100b8)) {
377 input_event(input, EV_REL, value ? REL_HWHEEL : REL_WHEEL, hid->delayed_value); 377 input_event(input, EV_REL, value ? REL_HWHEEL : REL_WHEEL, hid->delayed_value);
378 return; 378 return 1;
379 } 379 }
380 380
381 if ((hid->quirks & HID_QUIRK_INVERT_HWHEEL) && (usage->code == REL_HWHEEL)) { 381 if ((hid->quirks & HID_QUIRK_INVERT_HWHEEL) && (usage->code == REL_HWHEEL)) {
382 input_event(input, usage->type, usage->code, -value); 382 input_event(input, usage->type, usage->code, -value);
383 return; 383 return 1;
384 } 384 }
385 385
386 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_ON) && (usage->code == REL_WHEEL)) { 386 if ((hid->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_ON) && (usage->code == REL_WHEEL)) {
387 input_event(input, usage->type, REL_HWHEEL, value); 387 input_event(input, usage->type, REL_HWHEEL, value);
388 return; 388 return 1;
389 } 389 }
390 390
391 if ((hid->quirks & HID_QUIRK_APPLE_HAS_FN) && hidinput_apple_event(hid, input, usage, value)) 391 if ((hid->quirks & HID_QUIRK_APPLE_HAS_FN) && hidinput_apple_event(hid, input, usage, value))
392 return; 392 return 1;
393 393
394 /* Handling MS keyboards special buttons */ 394 /* Handling MS keyboards special buttons */
395 if (hid->quirks & HID_QUIRK_MICROSOFT_KEYS && 395 if (hid->quirks & HID_QUIRK_MICROSOFT_KEYS &&
@@ -416,8 +416,9 @@ void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, stru
416 if (hid->quirks & HID_QUIRK_HWHEEL_WHEEL_INVERT && 416 if (hid->quirks & HID_QUIRK_HWHEEL_WHEEL_INVERT &&
417 usage->type == EV_REL && usage->code == REL_HWHEEL) { 417 usage->type == EV_REL && usage->code == REL_HWHEEL) {
418 input_event(input, usage->type, REL_WHEEL, -value); 418 input_event(input, usage->type, REL_WHEEL, -value);
419 return; 419 return 1;
420 } 420 }
421 return 0;
421} 422}
422 423
423 424
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 5325d98b4328..5a38fb27d69f 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -97,6 +97,7 @@ struct hidinput_key_translation {
97#define APPLE_FLAG_FKEY 0x01 97#define APPLE_FLAG_FKEY 0x01
98 98
99static struct hidinput_key_translation apple_fn_keys[] = { 99static struct hidinput_key_translation apple_fn_keys[] = {
100 { KEY_BACKSPACE, KEY_DELETE },
100 { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, 101 { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
101 { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, 102 { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
102 { KEY_F3, KEY_CYCLEWINDOWS, APPLE_FLAG_FKEY }, /* Exposé */ 103 { KEY_F3, KEY_CYCLEWINDOWS, APPLE_FLAG_FKEY }, /* Exposé */
@@ -109,6 +110,10 @@ static struct hidinput_key_translation apple_fn_keys[] = {
109 { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, 110 { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY },
110 { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, 111 { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
111 { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, 112 { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
113 { KEY_UP, KEY_PAGEUP },
114 { KEY_DOWN, KEY_PAGEDOWN },
115 { KEY_LEFT, KEY_HOME },
116 { KEY_RIGHT, KEY_END },
112 { } 117 { }
113}; 118};
114 119
@@ -854,7 +859,8 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
854 return; 859 return;
855 860
856 /* handle input events for quirky devices */ 861 /* handle input events for quirky devices */
857 hidinput_event_quirks(hid, field, usage, value); 862 if (hidinput_event_quirks(hid, field, usage, value))
863 return;
858 864
859 if (usage->hat_min < usage->hat_max || usage->hat_dir) { 865 if (usage->hat_min < usage->hat_max || usage->hat_dir) {
860 int hat_dir = usage->hat_dir; 866 int hat_dir = usage->hat_dir;
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index b77b61e0cd7b..e6d05f6b1c1c 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -66,6 +66,12 @@
66#define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220 66#define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220
67#define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221 67#define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221
68#define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222 68#define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222
69#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI 0x0229
70#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a
71#define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b
72#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
73#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
74#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e
69#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a 75#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
70#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b 76#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
71#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 77#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
@@ -193,6 +199,17 @@
193#define USB_DEVICE_ID_GTCO_502 0x0502 199#define USB_DEVICE_ID_GTCO_502 0x0502
194#define USB_DEVICE_ID_GTCO_503 0x0503 200#define USB_DEVICE_ID_GTCO_503 0x0503
195#define USB_DEVICE_ID_GTCO_504 0x0504 201#define USB_DEVICE_ID_GTCO_504 0x0504
202#define USB_DEVICE_ID_GTCO_600 0x0600
203#define USB_DEVICE_ID_GTCO_601 0x0601
204#define USB_DEVICE_ID_GTCO_602 0x0602
205#define USB_DEVICE_ID_GTCO_603 0x0603
206#define USB_DEVICE_ID_GTCO_604 0x0604
207#define USB_DEVICE_ID_GTCO_605 0x0605
208#define USB_DEVICE_ID_GTCO_606 0x0606
209#define USB_DEVICE_ID_GTCO_607 0x0607
210#define USB_DEVICE_ID_GTCO_608 0x0608
211#define USB_DEVICE_ID_GTCO_609 0x0609
212#define USB_DEVICE_ID_GTCO_609 0x0609
196#define USB_DEVICE_ID_GTCO_1000 0x1000 213#define USB_DEVICE_ID_GTCO_1000 0x1000
197#define USB_DEVICE_ID_GTCO_1001 0x1001 214#define USB_DEVICE_ID_GTCO_1001 0x1001
198#define USB_DEVICE_ID_GTCO_1002 0x1002 215#define USB_DEVICE_ID_GTCO_1002 0x1002
@@ -200,7 +217,7 @@
200#define USB_DEVICE_ID_GTCO_1004 0x1004 217#define USB_DEVICE_ID_GTCO_1004 0x1004
201#define USB_DEVICE_ID_GTCO_1005 0x1005 218#define USB_DEVICE_ID_GTCO_1005 0x1005
202#define USB_DEVICE_ID_GTCO_1006 0x1006 219#define USB_DEVICE_ID_GTCO_1006 0x1006
203 220#define USB_DEVICE_ID_GTCO_1007 0x1007
204#define USB_VENDOR_ID_HAPP 0x078b 221#define USB_VENDOR_ID_HAPP 0x078b
205#define USB_DEVICE_ID_UGCI_DRIVING 0x0010 222#define USB_DEVICE_ID_UGCI_DRIVING 0x0010
206#define USB_DEVICE_ID_UGCI_FLYING 0x0020 223#define USB_DEVICE_ID_UGCI_FLYING 0x0020
@@ -368,6 +385,7 @@
368#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 385#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002
369#define USB_DEVICE_ID_VERNIER_SKIP 0x0003 386#define USB_DEVICE_ID_VERNIER_SKIP 0x0003
370#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 387#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
388#define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
371 389
372#define USB_VENDOR_ID_WACOM 0x056a 390#define USB_VENDOR_ID_WACOM 0x056a
373 391
@@ -496,6 +514,16 @@ static const struct hid_blacklist {
496 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502, HID_QUIRK_IGNORE }, 514 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_502, HID_QUIRK_IGNORE },
497 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503, HID_QUIRK_IGNORE }, 515 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_503, HID_QUIRK_IGNORE },
498 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504, HID_QUIRK_IGNORE }, 516 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_504, HID_QUIRK_IGNORE },
517 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_600, HID_QUIRK_IGNORE },
518 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_601, HID_QUIRK_IGNORE },
519 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_602, HID_QUIRK_IGNORE },
520 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_603, HID_QUIRK_IGNORE },
521 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_604, HID_QUIRK_IGNORE },
522 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_605, HID_QUIRK_IGNORE },
523 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_606, HID_QUIRK_IGNORE },
524 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_607, HID_QUIRK_IGNORE },
525 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_608, HID_QUIRK_IGNORE },
526 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_609, HID_QUIRK_IGNORE },
499 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000, HID_QUIRK_IGNORE }, 527 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1000, HID_QUIRK_IGNORE },
500 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001, HID_QUIRK_IGNORE }, 528 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1001, HID_QUIRK_IGNORE },
501 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002, HID_QUIRK_IGNORE }, 529 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1002, HID_QUIRK_IGNORE },
@@ -503,6 +531,7 @@ static const struct hid_blacklist {
503 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE }, 531 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE },
504 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE }, 532 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE },
505 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE }, 533 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE },
534 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007, HID_QUIRK_IGNORE },
506 { USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA, HID_QUIRK_IGNORE }, 535 { USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA, HID_QUIRK_IGNORE },
507 { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, 536 { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE },
508 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE }, 537 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY, HID_QUIRK_IGNORE },
@@ -541,6 +570,7 @@ static const struct hid_blacklist {
541 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, 570 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE },
542 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, 571 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE },
543 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE }, 572 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS, HID_QUIRK_IGNORE },
573 { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC, HID_QUIRK_IGNORE },
544 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, 574 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE },
545 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, 575 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE },
546 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT, HID_QUIRK_IGNORE }, 576 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT, HID_QUIRK_IGNORE },
@@ -593,6 +623,12 @@ static const struct hid_blacklist {
593 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, 623 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN },
594 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, 624 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
595 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, 625 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN },
626 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
627 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD },
628 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
629 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN },
630 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
631 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_HAS_FN },
596 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 632 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
597 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, 633 { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
598 634
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 410ffe4e9d80..368879ff5d8c 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -143,6 +143,16 @@ config SENSORS_ADT7470
143 This driver can also be built as a module. If so, the module 143 This driver can also be built as a module. If so, the module
144 will be called adt7470. 144 will be called adt7470.
145 145
146config SENSORS_ADT7473
147 tristate "Analog Devices ADT7473"
148 depends on I2C && EXPERIMENTAL
149 help
150 If you say yes here you get support for the Analog Devices
151 ADT7473 temperature monitoring chips.
152
153 This driver can also be built as a module. If so, the module
154 will be called adt7473.
155
146config SENSORS_K8TEMP 156config SENSORS_K8TEMP
147 tristate "AMD Athlon64/FX or Opteron temperature sensor" 157 tristate "AMD Athlon64/FX or Opteron temperature sensor"
148 depends on X86 && PCI && EXPERIMENTAL 158 depends on X86 && PCI && EXPERIMENTAL
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 824161337f1c..3bdb05a5cbd7 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o
24obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o 24obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o
25obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o 25obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o
26obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o 26obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o
27obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o
27obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o 28obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o
28obj-$(CONFIG_SENSORS_AMS) += ams/ 29obj-$(CONFIG_SENSORS_AMS) += ams/
29obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o 30obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c
index fcd7fe78f3f9..466b9ee92797 100644
--- a/drivers/hwmon/ad7418.c
+++ b/drivers/hwmon/ad7418.c
@@ -26,7 +26,7 @@
26#define DRV_VERSION "0.3" 26#define DRV_VERSION "0.3"
27 27
28/* Addresses to scan */ 28/* Addresses to scan */
29static unsigned short normal_i2c[] = { 0x28, I2C_CLIENT_END }; 29static const unsigned short normal_i2c[] = { 0x28, I2C_CLIENT_END };
30/* Insmod parameters */ 30/* Insmod parameters */
31I2C_CLIENT_INSMOD_3(ad7416, ad7417, ad7418); 31I2C_CLIENT_INSMOD_3(ad7416, ad7417, ad7418);
32 32
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index b96be772e498..ecbf69484bf5 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -31,10 +31,8 @@
31 31
32 32
33/* Addresses to scan */ 33/* Addresses to scan */
34static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, 34static const unsigned short normal_i2c[] = {
35 0x29, 0x2a, 0x2b, 35 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
36 0x4c, 0x4d, 0x4e,
37 I2C_CLIENT_END };
38 36
39/* Insmod parameters */ 37/* Insmod parameters */
40I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, 38I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm,
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
index e96c3725203d..1d76de7d75c7 100644
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -62,7 +62,7 @@
62 * NE1619 has two possible addresses: 0x2c and 0x2d. 62 * NE1619 has two possible addresses: 0x2c and 0x2d.
63 */ 63 */
64 64
65static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 65static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
66 66
67/* 67/*
68 * Insmod parameters 68 * Insmod parameters
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 8002f68240c4..904c6ce9d83f 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -35,7 +35,7 @@
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36 36
37/* Addresses to scan */ 37/* Addresses to scan */
38static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 38static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
39 39
40/* Insmod parameters */ 40/* Insmod parameters */
41I2C_CLIENT_INSMOD_1(adm1026); 41I2C_CLIENT_INSMOD_1(adm1026);
@@ -1624,6 +1624,7 @@ static struct attribute *adm1026_attributes_temp3[] = {
1624 &dev_attr_temp3_crit_enable.attr, 1624 &dev_attr_temp3_crit_enable.attr,
1625 &dev_attr_temp3_auto_point1_pwm.attr, 1625 &dev_attr_temp3_auto_point1_pwm.attr,
1626 &dev_attr_temp3_auto_point2_pwm.attr, 1626 &dev_attr_temp3_auto_point2_pwm.attr,
1627 NULL
1627}; 1628};
1628 1629
1629static const struct attribute_group adm1026_group_temp3 = { 1630static const struct attribute_group adm1026_group_temp3 = {
@@ -1639,6 +1640,7 @@ static struct attribute *adm1026_attributes_in8_9[] = {
1639 &sensor_dev_attr_in9_max.dev_attr.attr, 1640 &sensor_dev_attr_in9_max.dev_attr.attr,
1640 &sensor_dev_attr_in9_min.dev_attr.attr, 1641 &sensor_dev_attr_in9_min.dev_attr.attr,
1641 &sensor_dev_attr_in9_alarm.dev_attr.attr, 1642 &sensor_dev_attr_in9_alarm.dev_attr.attr,
1643 NULL
1642}; 1644};
1643 1645
1644static const struct attribute_group adm1026_group_in8_9 = { 1646static const struct attribute_group adm1026_group_in8_9 = {
diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
index 0bc897dffa27..2c6608d453c2 100644
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -39,10 +39,8 @@
39 * Addresses to scan 39 * Addresses to scan
40 */ 40 */
41 41
42static unsigned short normal_i2c[] = { 42static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
43 0x28, 0x29, 0x2a, 43 0x2e, 0x2f, I2C_CLIENT_END
44 0x2b, 0x2c, 0x2d,
45 0x2e, 0x2f, I2C_CLIENT_END
46}; 44};
47 45
48/* 46/*
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 5aaad3636c98..2bffcab7dc9f 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -61,7 +61,7 @@
61#define ADM1031_CONF2_TEMP_ENABLE(chan) (0x10 << (chan)) 61#define ADM1031_CONF2_TEMP_ENABLE(chan) (0x10 << (chan))
62 62
63/* Addresses to scan */ 63/* Addresses to scan */
64static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 64static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
65 65
66/* Insmod parameters */ 66/* Insmod parameters */
67I2C_CLIENT_INSMOD_2(adm1030, adm1031); 67I2C_CLIENT_INSMOD_2(adm1030, adm1031);
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index 7671d2bf7800..149ef25252e7 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -52,7 +52,7 @@
52#include <linux/mutex.h> 52#include <linux/mutex.h>
53 53
54/* Addresses to scan */ 54/* Addresses to scan */
55static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, 55static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
56 I2C_CLIENT_END }; 56 I2C_CLIENT_END };
57 57
58/* Insmod parameters */ 58/* Insmod parameters */
diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c
index 6b8a73ef404c..ed71a8bc70dc 100644
--- a/drivers/hwmon/ads7828.c
+++ b/drivers/hwmon/ads7828.c
@@ -44,7 +44,7 @@
44#define ADS7828_INT_VREF_MV 2500 /* Internal vref is 2.5V, 2500mV */ 44#define ADS7828_INT_VREF_MV 2500 /* Internal vref is 2.5V, 2500mV */
45 45
46/* Addresses to scan */ 46/* Addresses to scan */
47static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 47static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
48 I2C_CLIENT_END }; 48 I2C_CLIENT_END };
49 49
50/* Insmod parameters */ 50/* Insmod parameters */
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index 747693ab2ff1..6b5325f33a2c 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -30,7 +30,7 @@
30#include <linux/log2.h> 30#include <linux/log2.h>
31 31
32/* Addresses to scan */ 32/* Addresses to scan */
33static unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; 33static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END };
34 34
35/* Insmod parameters */ 35/* Insmod parameters */
36I2C_CLIENT_INSMOD_1(adt7470); 36I2C_CLIENT_INSMOD_1(adt7470);
diff --git a/drivers/hwmon/adt7473.c b/drivers/hwmon/adt7473.c
new file mode 100644
index 000000000000..9587869bdba0
--- /dev/null
+++ b/drivers/hwmon/adt7473.c
@@ -0,0 +1,1157 @@
1/*
2 * A hwmon driver for the Analog Devices ADT7473
3 * Copyright (C) 2007 IBM
4 *
5 * Author: Darrick J. Wong <djwong@us.ibm.com>
6 *
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
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program 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 the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; 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/module.h>
23#include <linux/jiffies.h>
24#include <linux/i2c.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
32/* Addresses to scan */
33static const unsigned short normal_i2c[] = { 0x2C, 0x2D, 0x2E, I2C_CLIENT_END };
34
35/* Insmod parameters */
36I2C_CLIENT_INSMOD_1(adt7473);
37
38/* ADT7473 registers */
39#define ADT7473_REG_BASE_ADDR 0x20
40
41#define ADT7473_REG_VOLT_BASE_ADDR 0x21
42#define ADT7473_REG_VOLT_MAX_ADDR 0x22
43#define ADT7473_REG_VOLT_MIN_BASE_ADDR 0x46
44#define ADT7473_REG_VOLT_MIN_MAX_ADDR 0x49
45
46#define ADT7473_REG_TEMP_BASE_ADDR 0x25
47#define ADT7473_REG_TEMP_MAX_ADDR 0x27
48#define ADT7473_REG_TEMP_LIMITS_BASE_ADDR 0x4E
49#define ADT7473_REG_TEMP_LIMITS_MAX_ADDR 0x53
50#define ADT7473_REG_TEMP_TMIN_BASE_ADDR 0x67
51#define ADT7473_REG_TEMP_TMIN_MAX_ADDR 0x69
52#define ADT7473_REG_TEMP_TMAX_BASE_ADDR 0x6A
53#define ADT7473_REG_TEMP_TMAX_MAX_ADDR 0x6C
54
55#define ADT7473_REG_FAN_BASE_ADDR 0x28
56#define ADT7473_REG_FAN_MAX_ADDR 0x2F
57#define ADT7473_REG_FAN_MIN_BASE_ADDR 0x54
58#define ADT7473_REG_FAN_MIN_MAX_ADDR 0x5B
59
60#define ADT7473_REG_PWM_BASE_ADDR 0x30
61#define ADT7473_REG_PWM_MAX_ADDR 0x32
62#define ADT7473_REG_PWM_MIN_BASE_ADDR 0x64
63#define ADT7473_REG_PWM_MIN_MAX_ADDR 0x66
64#define ADT7473_REG_PWM_MAX_BASE_ADDR 0x38
65#define ADT7473_REG_PWM_MAX_MAX_ADDR 0x3A
66#define ADT7473_REG_PWM_BHVR_BASE_ADDR 0x5C
67#define ADT7473_REG_PWM_BHVR_MAX_ADDR 0x5E
68#define ADT7473_PWM_BHVR_MASK 0xE0
69#define ADT7473_PWM_BHVR_SHIFT 5
70
71#define ADT7473_REG_CFG1 0x40
72#define ADT7473_CFG1_START 0x01
73#define ADT7473_CFG1_READY 0x04
74#define ADT7473_REG_CFG2 0x73
75#define ADT7473_REG_CFG3 0x78
76#define ADT7473_REG_CFG4 0x7D
77#define ADT7473_CFG4_MAX_DUTY_AT_OVT 0x08
78#define ADT7473_REG_CFG5 0x7C
79#define ADT7473_CFG5_TEMP_TWOS 0x01
80#define ADT7473_CFG5_TEMP_OFFSET 0x02
81
82#define ADT7473_REG_DEVICE 0x3D
83#define ADT7473_VENDOR 0x41
84#define ADT7473_REG_VENDOR 0x3E
85#define ADT7473_DEVICE 0x73
86#define ADT7473_REG_REVISION 0x3F
87#define ADT7473_REV_68 0x68
88#define ADT7473_REV_69 0x69
89
90#define ADT7473_REG_ALARM1 0x41
91#define ADT7473_VCCP_ALARM 0x02
92#define ADT7473_VCC_ALARM 0x04
93#define ADT7473_R1T_ALARM 0x10
94#define ADT7473_LT_ALARM 0x20
95#define ADT7473_R2T_ALARM 0x40
96#define ADT7473_OOL 0x80
97#define ADT7473_REG_ALARM2 0x42
98#define ADT7473_OVT_ALARM 0x02
99#define ADT7473_FAN1_ALARM 0x04
100#define ADT7473_FAN2_ALARM 0x08
101#define ADT7473_FAN3_ALARM 0x10
102#define ADT7473_FAN4_ALARM 0x20
103#define ADT7473_R1T_SHORT 0x40
104#define ADT7473_R2T_SHORT 0x80
105#define ADT7473_REG_MAX_ADDR 0x80
106
107#define ALARM2(x) ((x) << 8)
108
109#define ADT7473_VOLT_COUNT 2
110#define ADT7473_REG_VOLT(x) (ADT7473_REG_VOLT_BASE_ADDR + (x))
111#define ADT7473_REG_VOLT_MIN(x) (ADT7473_REG_VOLT_MIN_BASE_ADDR + ((x) * 2))
112#define ADT7473_REG_VOLT_MAX(x) (ADT7473_REG_VOLT_MIN_BASE_ADDR + \
113 ((x) * 2) + 1)
114
115#define ADT7473_TEMP_COUNT 3
116#define ADT7473_REG_TEMP(x) (ADT7473_REG_TEMP_BASE_ADDR + (x))
117#define ADT7473_REG_TEMP_MIN(x) (ADT7473_REG_TEMP_LIMITS_BASE_ADDR + ((x) * 2))
118#define ADT7473_REG_TEMP_MAX(x) (ADT7473_REG_TEMP_LIMITS_BASE_ADDR + \
119 ((x) * 2) + 1)
120#define ADT7473_REG_TEMP_TMIN(x) (ADT7473_REG_TEMP_TMIN_BASE_ADDR + (x))
121#define ADT7473_REG_TEMP_TMAX(x) (ADT7473_REG_TEMP_TMAX_BASE_ADDR + (x))
122
123#define ADT7473_FAN_COUNT 4
124#define ADT7473_REG_FAN(x) (ADT7473_REG_FAN_BASE_ADDR + ((x) * 2))
125#define ADT7473_REG_FAN_MIN(x) (ADT7473_REG_FAN_MIN_BASE_ADDR + ((x) * 2))
126
127#define ADT7473_PWM_COUNT 3
128#define ADT7473_REG_PWM(x) (ADT7473_REG_PWM_BASE_ADDR + (x))
129#define ADT7473_REG_PWM_MAX(x) (ADT7473_REG_PWM_MAX_BASE_ADDR + (x))
130#define ADT7473_REG_PWM_MIN(x) (ADT7473_REG_PWM_MIN_BASE_ADDR + (x))
131#define ADT7473_REG_PWM_BHVR(x) (ADT7473_REG_PWM_BHVR_BASE_ADDR + (x))
132
133/* How often do we reread sensors values? (In jiffies) */
134#define SENSOR_REFRESH_INTERVAL (2 * HZ)
135
136/* How often do we reread sensor limit values? (In jiffies) */
137#define LIMIT_REFRESH_INTERVAL (60 * HZ)
138
139/* datasheet says to divide this number by the fan reading to get fan rpm */
140#define FAN_PERIOD_TO_RPM(x) ((90000 * 60) / (x))
141#define FAN_RPM_TO_PERIOD FAN_PERIOD_TO_RPM
142#define FAN_PERIOD_INVALID 65535
143#define FAN_DATA_VALID(x) ((x) && (x) != FAN_PERIOD_INVALID)
144
145struct adt7473_data {
146 struct i2c_client client;
147 struct device *hwmon_dev;
148 struct attribute_group attrs;
149 struct mutex lock;
150 char sensors_valid;
151 char limits_valid;
152 unsigned long sensors_last_updated; /* In jiffies */
153 unsigned long limits_last_updated; /* In jiffies */
154
155 u8 volt[ADT7473_VOLT_COUNT];
156 s8 volt_min[ADT7473_VOLT_COUNT];
157 s8 volt_max[ADT7473_VOLT_COUNT];
158
159 s8 temp[ADT7473_TEMP_COUNT];
160 s8 temp_min[ADT7473_TEMP_COUNT];
161 s8 temp_max[ADT7473_TEMP_COUNT];
162 s8 temp_tmin[ADT7473_TEMP_COUNT];
163 /* This is called the !THERM limit in the datasheet */
164 s8 temp_tmax[ADT7473_TEMP_COUNT];
165
166 u16 fan[ADT7473_FAN_COUNT];
167 u16 fan_min[ADT7473_FAN_COUNT];
168
169 u8 pwm[ADT7473_PWM_COUNT];
170 u8 pwm_max[ADT7473_PWM_COUNT];
171 u8 pwm_min[ADT7473_PWM_COUNT];
172 u8 pwm_behavior[ADT7473_PWM_COUNT];
173
174 u8 temp_twos_complement;
175 u8 temp_offset;
176
177 u16 alarm;
178 u8 max_duty_at_overheat;
179};
180
181static int adt7473_attach_adapter(struct i2c_adapter *adapter);
182static int adt7473_detect(struct i2c_adapter *adapter, int address, int kind);
183static int adt7473_detach_client(struct i2c_client *client);
184
185static struct i2c_driver adt7473_driver = {
186 .driver = {
187 .name = "adt7473",
188 },
189 .attach_adapter = adt7473_attach_adapter,
190 .detach_client = adt7473_detach_client,
191};
192
193/*
194 * 16-bit registers on the ADT7473 are low-byte first. The data sheet says
195 * that the low byte must be read before the high byte.
196 */
197static inline int adt7473_read_word_data(struct i2c_client *client, u8 reg)
198{
199 u16 foo;
200 foo = i2c_smbus_read_byte_data(client, reg);
201 foo |= ((u16)i2c_smbus_read_byte_data(client, reg + 1) << 8);
202 return foo;
203}
204
205static inline int adt7473_write_word_data(struct i2c_client *client, u8 reg,
206 u16 value)
207{
208 return i2c_smbus_write_byte_data(client, reg, value & 0xFF)
209 && i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
210}
211
212static void adt7473_init_client(struct i2c_client *client)
213{
214 int reg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG1);
215
216 if (!(reg & ADT7473_CFG1_READY)) {
217 dev_err(&client->dev, "Chip not ready.\n");
218 } else {
219 /* start monitoring */
220 i2c_smbus_write_byte_data(client, ADT7473_REG_CFG1,
221 reg | ADT7473_CFG1_START);
222 }
223}
224
225static struct adt7473_data *adt7473_update_device(struct device *dev)
226{
227 struct i2c_client *client = to_i2c_client(dev);
228 struct adt7473_data *data = i2c_get_clientdata(client);
229 unsigned long local_jiffies = jiffies;
230 u8 cfg;
231 int i;
232
233 mutex_lock(&data->lock);
234 if (time_before(local_jiffies, data->sensors_last_updated +
235 SENSOR_REFRESH_INTERVAL)
236 && data->sensors_valid)
237 goto no_sensor_update;
238
239 for (i = 0; i < ADT7473_VOLT_COUNT; i++)
240 data->volt[i] = i2c_smbus_read_byte_data(client,
241 ADT7473_REG_VOLT(i));
242
243 /* Determine temperature encoding */
244 cfg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG5);
245 data->temp_twos_complement = (cfg & ADT7473_CFG5_TEMP_TWOS);
246
247 /*
248 * What does this do? it implies a variable temperature sensor
249 * offset, but the datasheet doesn't say anything about this bit
250 * and other parts of the datasheet imply that "offset64" mode
251 * means that you shift temp values by -64 if the above bit was set.
252 */
253 data->temp_offset = (cfg & ADT7473_CFG5_TEMP_OFFSET);
254
255 for (i = 0; i < ADT7473_TEMP_COUNT; i++)
256 data->temp[i] = i2c_smbus_read_byte_data(client,
257 ADT7473_REG_TEMP(i));
258
259 for (i = 0; i < ADT7473_FAN_COUNT; i++)
260 data->fan[i] = adt7473_read_word_data(client,
261 ADT7473_REG_FAN(i));
262
263 for (i = 0; i < ADT7473_PWM_COUNT; i++)
264 data->pwm[i] = i2c_smbus_read_byte_data(client,
265 ADT7473_REG_PWM(i));
266
267 data->alarm = i2c_smbus_read_byte_data(client, ADT7473_REG_ALARM1);
268 if (data->alarm & ADT7473_OOL)
269 data->alarm |= ALARM2(i2c_smbus_read_byte_data(client,
270 ADT7473_REG_ALARM2));
271
272 data->sensors_last_updated = local_jiffies;
273 data->sensors_valid = 1;
274
275no_sensor_update:
276 if (time_before(local_jiffies, data->limits_last_updated +
277 LIMIT_REFRESH_INTERVAL)
278 && data->limits_valid)
279 goto out;
280
281 for (i = 0; i < ADT7473_VOLT_COUNT; i++) {
282 data->volt_min[i] = i2c_smbus_read_byte_data(client,
283 ADT7473_REG_VOLT_MIN(i));
284 data->volt_max[i] = i2c_smbus_read_byte_data(client,
285 ADT7473_REG_VOLT_MAX(i));
286 }
287
288 for (i = 0; i < ADT7473_TEMP_COUNT; i++) {
289 data->temp_min[i] = i2c_smbus_read_byte_data(client,
290 ADT7473_REG_TEMP_MIN(i));
291 data->temp_max[i] = i2c_smbus_read_byte_data(client,
292 ADT7473_REG_TEMP_MAX(i));
293 data->temp_tmin[i] = i2c_smbus_read_byte_data(client,
294 ADT7473_REG_TEMP_TMIN(i));
295 data->temp_tmax[i] = i2c_smbus_read_byte_data(client,
296 ADT7473_REG_TEMP_TMAX(i));
297 }
298
299 for (i = 0; i < ADT7473_FAN_COUNT; i++)
300 data->fan_min[i] = adt7473_read_word_data(client,
301 ADT7473_REG_FAN_MIN(i));
302
303 for (i = 0; i < ADT7473_PWM_COUNT; i++) {
304 data->pwm_max[i] = i2c_smbus_read_byte_data(client,
305 ADT7473_REG_PWM_MAX(i));
306 data->pwm_min[i] = i2c_smbus_read_byte_data(client,
307 ADT7473_REG_PWM_MIN(i));
308 data->pwm_behavior[i] = i2c_smbus_read_byte_data(client,
309 ADT7473_REG_PWM_BHVR(i));
310 }
311
312 data->limits_last_updated = local_jiffies;
313 data->limits_valid = 1;
314
315out:
316 mutex_unlock(&data->lock);
317 return data;
318}
319
320/*
321 * On this chip, voltages are given as a count of steps between a minimum
322 * and maximum voltage, not a direct voltage.
323 */
324static const int volt_convert_table[][2] = {
325 {2997, 3},
326 {4395, 4},
327};
328
329static int decode_volt(int volt_index, u8 raw)
330{
331 int cmax = volt_convert_table[volt_index][0];
332 int cmin = volt_convert_table[volt_index][1];
333 return ((raw * (cmax - cmin)) / 255) + cmin;
334}
335
336static u8 encode_volt(int volt_index, int cooked)
337{
338 int cmax = volt_convert_table[volt_index][0];
339 int cmin = volt_convert_table[volt_index][1];
340 u8 x;
341
342 if (cooked > cmax)
343 cooked = cmax;
344 else if (cooked < cmin)
345 cooked = cmin;
346
347 x = ((cooked - cmin) * 255) / (cmax - cmin);
348
349 return x;
350}
351
352static ssize_t show_volt_min(struct device *dev,
353 struct device_attribute *devattr,
354 char *buf)
355{
356 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
357 struct adt7473_data *data = adt7473_update_device(dev);
358 return sprintf(buf, "%d\n",
359 decode_volt(attr->index, data->volt_min[attr->index]));
360}
361
362static ssize_t set_volt_min(struct device *dev,
363 struct device_attribute *devattr,
364 const char *buf,
365 size_t count)
366{
367 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
368 struct i2c_client *client = to_i2c_client(dev);
369 struct adt7473_data *data = i2c_get_clientdata(client);
370 int volt = encode_volt(attr->index, simple_strtol(buf, NULL, 10));
371
372 mutex_lock(&data->lock);
373 data->volt_min[attr->index] = volt;
374 i2c_smbus_write_byte_data(client, ADT7473_REG_VOLT_MIN(attr->index),
375 volt);
376 mutex_unlock(&data->lock);
377
378 return count;
379}
380
381static ssize_t show_volt_max(struct device *dev,
382 struct device_attribute *devattr,
383 char *buf)
384{
385 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
386 struct adt7473_data *data = adt7473_update_device(dev);
387 return sprintf(buf, "%d\n",
388 decode_volt(attr->index, data->volt_max[attr->index]));
389}
390
391static ssize_t set_volt_max(struct device *dev,
392 struct device_attribute *devattr,
393 const char *buf,
394 size_t count)
395{
396 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
397 struct i2c_client *client = to_i2c_client(dev);
398 struct adt7473_data *data = i2c_get_clientdata(client);
399 int volt = encode_volt(attr->index, simple_strtol(buf, NULL, 10));
400
401 mutex_lock(&data->lock);
402 data->volt_max[attr->index] = volt;
403 i2c_smbus_write_byte_data(client, ADT7473_REG_VOLT_MAX(attr->index),
404 volt);
405 mutex_unlock(&data->lock);
406
407 return count;
408}
409
410static ssize_t show_volt(struct device *dev, struct device_attribute *devattr,
411 char *buf)
412{
413 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
414 struct adt7473_data *data = adt7473_update_device(dev);
415
416 return sprintf(buf, "%d\n",
417 decode_volt(attr->index, data->volt[attr->index]));
418}
419
420/*
421 * This chip can report temperature data either as a two's complement
422 * number in the range -128 to 127, or as an unsigned number that must
423 * be offset by 64.
424 */
425static int decode_temp(struct adt7473_data *data, u8 raw)
426{
427 if (data->temp_twos_complement)
428 return (s8)raw;
429 return raw - 64;
430}
431
432static u8 encode_temp(struct adt7473_data *data, int cooked)
433{
434 if (data->temp_twos_complement)
435 return (cooked & 0xFF);
436 return cooked + 64;
437}
438
439static ssize_t show_temp_min(struct device *dev,
440 struct device_attribute *devattr,
441 char *buf)
442{
443 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
444 struct adt7473_data *data = adt7473_update_device(dev);
445 return sprintf(buf, "%d\n",
446 1000 * decode_temp(data, data->temp_min[attr->index]));
447}
448
449static ssize_t set_temp_min(struct device *dev,
450 struct device_attribute *devattr,
451 const char *buf,
452 size_t count)
453{
454 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
455 struct i2c_client *client = to_i2c_client(dev);
456 struct adt7473_data *data = i2c_get_clientdata(client);
457 int temp = simple_strtol(buf, NULL, 10) / 1000;
458 temp = encode_temp(data, temp);
459
460 mutex_lock(&data->lock);
461 data->temp_min[attr->index] = temp;
462 i2c_smbus_write_byte_data(client, ADT7473_REG_TEMP_MIN(attr->index),
463 temp);
464 mutex_unlock(&data->lock);
465
466 return count;
467}
468
469static ssize_t show_temp_max(struct device *dev,
470 struct device_attribute *devattr,
471 char *buf)
472{
473 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
474 struct adt7473_data *data = adt7473_update_device(dev);
475 return sprintf(buf, "%d\n",
476 1000 * decode_temp(data, data->temp_max[attr->index]));
477}
478
479static ssize_t set_temp_max(struct device *dev,
480 struct device_attribute *devattr,
481 const char *buf,
482 size_t count)
483{
484 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
485 struct i2c_client *client = to_i2c_client(dev);
486 struct adt7473_data *data = i2c_get_clientdata(client);
487 int temp = simple_strtol(buf, NULL, 10) / 1000;
488 temp = encode_temp(data, temp);
489
490 mutex_lock(&data->lock);
491 data->temp_max[attr->index] = temp;
492 i2c_smbus_write_byte_data(client, ADT7473_REG_TEMP_MAX(attr->index),
493 temp);
494 mutex_unlock(&data->lock);
495
496 return count;
497}
498
499static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
500 char *buf)
501{
502 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
503 struct adt7473_data *data = adt7473_update_device(dev);
504 return sprintf(buf, "%d\n",
505 1000 * decode_temp(data, data->temp[attr->index]));
506}
507
508static ssize_t show_fan_min(struct device *dev,
509 struct device_attribute *devattr,
510 char *buf)
511{
512 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
513 struct adt7473_data *data = adt7473_update_device(dev);
514
515 if (FAN_DATA_VALID(data->fan_min[attr->index]))
516 return sprintf(buf, "%d\n",
517 FAN_PERIOD_TO_RPM(data->fan_min[attr->index]));
518 else
519 return sprintf(buf, "0\n");
520}
521
522static ssize_t set_fan_min(struct device *dev,
523 struct device_attribute *devattr,
524 const char *buf, size_t count)
525{
526 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
527 struct i2c_client *client = to_i2c_client(dev);
528 struct adt7473_data *data = i2c_get_clientdata(client);
529 int temp = simple_strtol(buf, NULL, 10);
530
531 if (!temp)
532 return -EINVAL;
533 temp = FAN_RPM_TO_PERIOD(temp);
534
535 mutex_lock(&data->lock);
536 data->fan_min[attr->index] = temp;
537 adt7473_write_word_data(client, ADT7473_REG_FAN_MIN(attr->index), temp);
538 mutex_unlock(&data->lock);
539
540 return count;
541}
542
543static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
544 char *buf)
545{
546 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
547 struct adt7473_data *data = adt7473_update_device(dev);
548
549 if (FAN_DATA_VALID(data->fan[attr->index]))
550 return sprintf(buf, "%d\n",
551 FAN_PERIOD_TO_RPM(data->fan[attr->index]));
552 else
553 return sprintf(buf, "0\n");
554}
555
556static ssize_t show_max_duty_at_crit(struct device *dev,
557 struct device_attribute *devattr,
558 char *buf)
559{
560 struct adt7473_data *data = adt7473_update_device(dev);
561 return sprintf(buf, "%d\n", data->max_duty_at_overheat);
562}
563
564static ssize_t set_max_duty_at_crit(struct device *dev,
565 struct device_attribute *devattr,
566 const char *buf,
567 size_t count)
568{
569 u8 reg;
570 struct i2c_client *client = to_i2c_client(dev);
571 struct adt7473_data *data = i2c_get_clientdata(client);
572 int temp = simple_strtol(buf, NULL, 10);
573 temp = temp && 0xFF;
574
575 mutex_lock(&data->lock);
576 data->max_duty_at_overheat = temp;
577 reg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG4);
578 if (temp)
579 reg |= ADT7473_CFG4_MAX_DUTY_AT_OVT;
580 else
581 reg &= ~ADT7473_CFG4_MAX_DUTY_AT_OVT;
582 i2c_smbus_write_byte_data(client, ADT7473_REG_CFG4, reg);
583 mutex_unlock(&data->lock);
584
585 return count;
586}
587
588static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr,
589 char *buf)
590{
591 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
592 struct adt7473_data *data = adt7473_update_device(dev);
593 return sprintf(buf, "%d\n", data->pwm[attr->index]);
594}
595
596static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr,
597 const char *buf, size_t count)
598{
599 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
600 struct i2c_client *client = to_i2c_client(dev);
601 struct adt7473_data *data = i2c_get_clientdata(client);
602 int temp = simple_strtol(buf, NULL, 10);
603
604 mutex_lock(&data->lock);
605 data->pwm[attr->index] = temp;
606 i2c_smbus_write_byte_data(client, ADT7473_REG_PWM(attr->index), temp);
607 mutex_unlock(&data->lock);
608
609 return count;
610}
611
612static ssize_t show_pwm_max(struct device *dev,
613 struct device_attribute *devattr,
614 char *buf)
615{
616 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
617 struct adt7473_data *data = adt7473_update_device(dev);
618 return sprintf(buf, "%d\n", data->pwm_max[attr->index]);
619}
620
621static ssize_t set_pwm_max(struct device *dev,
622 struct device_attribute *devattr,
623 const char *buf,
624 size_t count)
625{
626 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
627 struct i2c_client *client = to_i2c_client(dev);
628 struct adt7473_data *data = i2c_get_clientdata(client);
629 int temp = simple_strtol(buf, NULL, 10);
630
631 mutex_lock(&data->lock);
632 data->pwm_max[attr->index] = temp;
633 i2c_smbus_write_byte_data(client, ADT7473_REG_PWM_MAX(attr->index),
634 temp);
635 mutex_unlock(&data->lock);
636
637 return count;
638}
639
640static ssize_t show_pwm_min(struct device *dev,
641 struct device_attribute *devattr,
642 char *buf)
643{
644 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
645 struct adt7473_data *data = adt7473_update_device(dev);
646 return sprintf(buf, "%d\n", data->pwm_min[attr->index]);
647}
648
649static ssize_t set_pwm_min(struct device *dev,
650 struct device_attribute *devattr,
651 const char *buf,
652 size_t count)
653{
654 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
655 struct i2c_client *client = to_i2c_client(dev);
656 struct adt7473_data *data = i2c_get_clientdata(client);
657 int temp = simple_strtol(buf, NULL, 10);
658
659 mutex_lock(&data->lock);
660 data->pwm_min[attr->index] = temp;
661 i2c_smbus_write_byte_data(client, ADT7473_REG_PWM_MIN(attr->index),
662 temp);
663 mutex_unlock(&data->lock);
664
665 return count;
666}
667
668static ssize_t show_temp_tmax(struct device *dev,
669 struct device_attribute *devattr,
670 char *buf)
671{
672 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
673 struct adt7473_data *data = adt7473_update_device(dev);
674 return sprintf(buf, "%d\n",
675 1000 * decode_temp(data, data->temp_tmax[attr->index]));
676}
677
678static ssize_t set_temp_tmax(struct device *dev,
679 struct device_attribute *devattr,
680 const char *buf,
681 size_t count)
682{
683 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
684 struct i2c_client *client = to_i2c_client(dev);
685 struct adt7473_data *data = i2c_get_clientdata(client);
686 int temp = simple_strtol(buf, NULL, 10) / 1000;
687 temp = encode_temp(data, temp);
688
689 mutex_lock(&data->lock);
690 data->temp_tmax[attr->index] = temp;
691 i2c_smbus_write_byte_data(client, ADT7473_REG_TEMP_TMAX(attr->index),
692 temp);
693 mutex_unlock(&data->lock);
694
695 return count;
696}
697
698static ssize_t show_temp_tmin(struct device *dev,
699 struct device_attribute *devattr,
700 char *buf)
701{
702 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
703 struct adt7473_data *data = adt7473_update_device(dev);
704 return sprintf(buf, "%d\n",
705 1000 * decode_temp(data, data->temp_tmin[attr->index]));
706}
707
708static ssize_t set_temp_tmin(struct device *dev,
709 struct device_attribute *devattr,
710 const char *buf,
711 size_t count)
712{
713 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
714 struct i2c_client *client = to_i2c_client(dev);
715 struct adt7473_data *data = i2c_get_clientdata(client);
716 int temp = simple_strtol(buf, NULL, 10) / 1000;
717 temp = encode_temp(data, temp);
718
719 mutex_lock(&data->lock);
720 data->temp_tmin[attr->index] = temp;
721 i2c_smbus_write_byte_data(client, ADT7473_REG_TEMP_TMIN(attr->index),
722 temp);
723 mutex_unlock(&data->lock);
724
725 return count;
726}
727
728static ssize_t show_pwm_enable(struct device *dev,
729 struct device_attribute *devattr,
730 char *buf)
731{
732 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
733 struct adt7473_data *data = adt7473_update_device(dev);
734
735 switch (data->pwm_behavior[attr->index] >> ADT7473_PWM_BHVR_SHIFT) {
736 case 3:
737 return sprintf(buf, "0\n");
738 case 7:
739 return sprintf(buf, "1\n");
740 default:
741 return sprintf(buf, "2\n");
742 }
743}
744
745static ssize_t set_pwm_enable(struct device *dev,
746 struct device_attribute *devattr,
747 const char *buf,
748 size_t count)
749{
750 u8 reg;
751 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
752 struct i2c_client *client = to_i2c_client(dev);
753 struct adt7473_data *data = i2c_get_clientdata(client);
754 int temp = simple_strtol(buf, NULL, 10);
755
756 switch (temp) {
757 case 0:
758 temp = 3;
759 break;
760 case 1:
761 temp = 7;
762 break;
763 case 2:
764 /* Enter automatic mode with fans off */
765 temp = 4;
766 break;
767 default:
768 return -EINVAL;
769 }
770
771 mutex_lock(&data->lock);
772 reg = i2c_smbus_read_byte_data(client,
773 ADT7473_REG_PWM_BHVR(attr->index));
774 reg = (temp << ADT7473_PWM_BHVR_SHIFT) |
775 (reg & ~ADT7473_PWM_BHVR_MASK);
776 i2c_smbus_write_byte_data(client, ADT7473_REG_PWM_BHVR(attr->index),
777 reg);
778 data->pwm_behavior[attr->index] = reg;
779 mutex_unlock(&data->lock);
780
781 return count;
782}
783
784static ssize_t show_pwm_auto_temp(struct device *dev,
785 struct device_attribute *devattr,
786 char *buf)
787{
788 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
789 struct adt7473_data *data = adt7473_update_device(dev);
790 int bhvr = data->pwm_behavior[attr->index] >> ADT7473_PWM_BHVR_SHIFT;
791
792 switch (bhvr) {
793 case 3:
794 case 4:
795 case 7:
796 return sprintf(buf, "0\n");
797 case 0:
798 case 1:
799 case 5:
800 case 6:
801 return sprintf(buf, "%d\n", bhvr + 1);
802 case 2:
803 return sprintf(buf, "4\n");
804 }
805 /* shouldn't ever get here */
806 BUG();
807}
808
809static ssize_t set_pwm_auto_temp(struct device *dev,
810 struct device_attribute *devattr,
811 const char *buf,
812 size_t count)
813{
814 u8 reg;
815 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
816 struct i2c_client *client = to_i2c_client(dev);
817 struct adt7473_data *data = i2c_get_clientdata(client);
818 int temp = simple_strtol(buf, NULL, 10);
819
820 switch (temp) {
821 case 1:
822 case 2:
823 case 6:
824 case 7:
825 temp--;
826 break;
827 case 0:
828 temp = 4;
829 break;
830 default:
831 return -EINVAL;
832 }
833
834 mutex_lock(&data->lock);
835 reg = i2c_smbus_read_byte_data(client,
836 ADT7473_REG_PWM_BHVR(attr->index));
837 reg = (temp << ADT7473_PWM_BHVR_SHIFT) |
838 (reg & ~ADT7473_PWM_BHVR_MASK);
839 i2c_smbus_write_byte_data(client, ADT7473_REG_PWM_BHVR(attr->index),
840 reg);
841 data->pwm_behavior[attr->index] = reg;
842 mutex_unlock(&data->lock);
843
844 return count;
845}
846
847static ssize_t show_alarm(struct device *dev,
848 struct device_attribute *devattr,
849 char *buf)
850{
851 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
852 struct adt7473_data *data = adt7473_update_device(dev);
853
854 if (data->alarm & attr->index)
855 return sprintf(buf, "1\n");
856 else
857 return sprintf(buf, "0\n");
858}
859
860
861static SENSOR_DEVICE_ATTR(in1_max, S_IWUSR | S_IRUGO, show_volt_max,
862 set_volt_max, 0);
863static SENSOR_DEVICE_ATTR(in2_max, S_IWUSR | S_IRUGO, show_volt_max,
864 set_volt_max, 1);
865
866static SENSOR_DEVICE_ATTR(in1_min, S_IWUSR | S_IRUGO, show_volt_min,
867 set_volt_min, 0);
868static SENSOR_DEVICE_ATTR(in2_min, S_IWUSR | S_IRUGO, show_volt_min,
869 set_volt_min, 1);
870
871static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_volt, NULL, 0);
872static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_volt, NULL, 1);
873
874static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL,
875 ADT7473_VCCP_ALARM);
876static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL,
877 ADT7473_VCC_ALARM);
878
879static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max,
880 set_temp_max, 0);
881static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp_max,
882 set_temp_max, 1);
883static SENSOR_DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_temp_max,
884 set_temp_max, 2);
885
886static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp_min,
887 set_temp_min, 0);
888static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_min,
889 set_temp_min, 1);
890static SENSOR_DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_temp_min,
891 set_temp_min, 2);
892
893static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
894static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
895static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
896
897static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL,
898 ADT7473_R1T_ALARM | ALARM2(ADT7473_R1T_SHORT));
899static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL,
900 ADT7473_LT_ALARM);
901static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL,
902 ADT7473_R2T_ALARM | ALARM2(ADT7473_R2T_SHORT));
903
904static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min,
905 set_fan_min, 0);
906static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, show_fan_min,
907 set_fan_min, 1);
908static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, show_fan_min,
909 set_fan_min, 2);
910static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, show_fan_min,
911 set_fan_min, 3);
912
913static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0);
914static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1);
915static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2);
916static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3);
917
918static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL,
919 ALARM2(ADT7473_FAN1_ALARM));
920static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL,
921 ALARM2(ADT7473_FAN2_ALARM));
922static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL,
923 ALARM2(ADT7473_FAN3_ALARM));
924static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL,
925 ALARM2(ADT7473_FAN4_ALARM));
926
927static SENSOR_DEVICE_ATTR(pwm_use_point2_pwm_at_crit, S_IWUSR | S_IRUGO,
928 show_max_duty_at_crit, set_max_duty_at_crit, 0);
929
930static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0);
931static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1);
932static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2);
933
934static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IWUSR | S_IRUGO,
935 show_pwm_min, set_pwm_min, 0);
936static SENSOR_DEVICE_ATTR(pwm2_auto_point1_pwm, S_IWUSR | S_IRUGO,
937 show_pwm_min, set_pwm_min, 1);
938static SENSOR_DEVICE_ATTR(pwm3_auto_point1_pwm, S_IWUSR | S_IRUGO,
939 show_pwm_min, set_pwm_min, 2);
940
941static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IWUSR | S_IRUGO,
942 show_pwm_max, set_pwm_max, 0);
943static SENSOR_DEVICE_ATTR(pwm2_auto_point2_pwm, S_IWUSR | S_IRUGO,
944 show_pwm_max, set_pwm_max, 1);
945static SENSOR_DEVICE_ATTR(pwm3_auto_point2_pwm, S_IWUSR | S_IRUGO,
946 show_pwm_max, set_pwm_max, 2);
947
948static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp, S_IWUSR | S_IRUGO,
949 show_temp_tmin, set_temp_tmin, 0);
950static SENSOR_DEVICE_ATTR(temp2_auto_point1_temp, S_IWUSR | S_IRUGO,
951 show_temp_tmin, set_temp_tmin, 1);
952static SENSOR_DEVICE_ATTR(temp3_auto_point1_temp, S_IWUSR | S_IRUGO,
953 show_temp_tmin, set_temp_tmin, 2);
954
955static SENSOR_DEVICE_ATTR(temp1_auto_point2_temp, S_IWUSR | S_IRUGO,
956 show_temp_tmax, set_temp_tmax, 0);
957static SENSOR_DEVICE_ATTR(temp2_auto_point2_temp, S_IWUSR | S_IRUGO,
958 show_temp_tmax, set_temp_tmax, 1);
959static SENSOR_DEVICE_ATTR(temp3_auto_point2_temp, S_IWUSR | S_IRUGO,
960 show_temp_tmax, set_temp_tmax, 2);
961
962static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, show_pwm_enable,
963 set_pwm_enable, 0);
964static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, show_pwm_enable,
965 set_pwm_enable, 1);
966static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO, show_pwm_enable,
967 set_pwm_enable, 2);
968
969static SENSOR_DEVICE_ATTR(pwm1_auto_channels_temp, S_IWUSR | S_IRUGO,
970 show_pwm_auto_temp, set_pwm_auto_temp, 0);
971static SENSOR_DEVICE_ATTR(pwm2_auto_channels_temp, S_IWUSR | S_IRUGO,
972 show_pwm_auto_temp, set_pwm_auto_temp, 1);
973static SENSOR_DEVICE_ATTR(pwm3_auto_channels_temp, S_IWUSR | S_IRUGO,
974 show_pwm_auto_temp, set_pwm_auto_temp, 2);
975
976static struct attribute *adt7473_attr[] =
977{
978 &sensor_dev_attr_in1_max.dev_attr.attr,
979 &sensor_dev_attr_in2_max.dev_attr.attr,
980 &sensor_dev_attr_in1_min.dev_attr.attr,
981 &sensor_dev_attr_in2_min.dev_attr.attr,
982 &sensor_dev_attr_in1_input.dev_attr.attr,
983 &sensor_dev_attr_in2_input.dev_attr.attr,
984 &sensor_dev_attr_in1_alarm.dev_attr.attr,
985 &sensor_dev_attr_in2_alarm.dev_attr.attr,
986
987 &sensor_dev_attr_temp1_max.dev_attr.attr,
988 &sensor_dev_attr_temp2_max.dev_attr.attr,
989 &sensor_dev_attr_temp3_max.dev_attr.attr,
990 &sensor_dev_attr_temp1_min.dev_attr.attr,
991 &sensor_dev_attr_temp2_min.dev_attr.attr,
992 &sensor_dev_attr_temp3_min.dev_attr.attr,
993 &sensor_dev_attr_temp1_input.dev_attr.attr,
994 &sensor_dev_attr_temp2_input.dev_attr.attr,
995 &sensor_dev_attr_temp3_input.dev_attr.attr,
996 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
997 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
998 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
999 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
1000 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr,
1001 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr,
1002 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr,
1003 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr,
1004 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr,
1005
1006 &sensor_dev_attr_fan1_min.dev_attr.attr,
1007 &sensor_dev_attr_fan2_min.dev_attr.attr,
1008 &sensor_dev_attr_fan3_min.dev_attr.attr,
1009 &sensor_dev_attr_fan4_min.dev_attr.attr,
1010 &sensor_dev_attr_fan1_input.dev_attr.attr,
1011 &sensor_dev_attr_fan2_input.dev_attr.attr,
1012 &sensor_dev_attr_fan3_input.dev_attr.attr,
1013 &sensor_dev_attr_fan4_input.dev_attr.attr,
1014 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
1015 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
1016 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
1017 &sensor_dev_attr_fan4_alarm.dev_attr.attr,
1018
1019 &sensor_dev_attr_pwm_use_point2_pwm_at_crit.dev_attr.attr,
1020
1021 &sensor_dev_attr_pwm1.dev_attr.attr,
1022 &sensor_dev_attr_pwm2.dev_attr.attr,
1023 &sensor_dev_attr_pwm3.dev_attr.attr,
1024 &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
1025 &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
1026 &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
1027 &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr,
1028 &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr,
1029 &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr,
1030
1031 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
1032 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
1033 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
1034 &sensor_dev_attr_pwm1_auto_channels_temp.dev_attr.attr,
1035 &sensor_dev_attr_pwm2_auto_channels_temp.dev_attr.attr,
1036 &sensor_dev_attr_pwm3_auto_channels_temp.dev_attr.attr,
1037
1038 NULL
1039};
1040
1041static int adt7473_attach_adapter(struct i2c_adapter *adapter)
1042{
1043 if (!(adapter->class & I2C_CLASS_HWMON))
1044 return 0;
1045 return i2c_probe(adapter, &addr_data, adt7473_detect);
1046}
1047
1048static int adt7473_detect(struct i2c_adapter *adapter, int address, int kind)
1049{
1050 struct i2c_client *client;
1051 struct adt7473_data *data;
1052 int err = 0;
1053
1054 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1055 goto exit;
1056
1057 data = kzalloc(sizeof(struct adt7473_data), GFP_KERNEL);
1058 if (!data) {
1059 err = -ENOMEM;
1060 goto exit;
1061 }
1062
1063 client = &data->client;
1064 client->addr = address;
1065 client->adapter = adapter;
1066 client->driver = &adt7473_driver;
1067
1068 i2c_set_clientdata(client, data);
1069
1070 mutex_init(&data->lock);
1071
1072 if (kind <= 0) {
1073 int vendor, device, revision;
1074
1075 vendor = i2c_smbus_read_byte_data(client, ADT7473_REG_VENDOR);
1076 if (vendor != ADT7473_VENDOR) {
1077 err = -ENODEV;
1078 goto exit_free;
1079 }
1080
1081 device = i2c_smbus_read_byte_data(client, ADT7473_REG_DEVICE);
1082 if (device != ADT7473_DEVICE) {
1083 err = -ENODEV;
1084 goto exit_free;
1085 }
1086
1087 revision = i2c_smbus_read_byte_data(client,
1088 ADT7473_REG_REVISION);
1089 if (revision != ADT7473_REV_68 && revision != ADT7473_REV_69) {
1090 err = -ENODEV;
1091 goto exit_free;
1092 }
1093 } else
1094 dev_dbg(&adapter->dev, "detection forced\n");
1095
1096 strlcpy(client->name, "adt7473", I2C_NAME_SIZE);
1097
1098 err = i2c_attach_client(client);
1099 if (err)
1100 goto exit_free;
1101
1102 dev_info(&client->dev, "%s chip found\n", client->name);
1103
1104 /* Initialize the ADT7473 chip */
1105 adt7473_init_client(client);
1106
1107 /* Register sysfs hooks */
1108 data->attrs.attrs = adt7473_attr;
1109 err = sysfs_create_group(&client->dev.kobj, &data->attrs);
1110 if (err)
1111 goto exit_detach;
1112
1113 data->hwmon_dev = hwmon_device_register(&client->dev);
1114 if (IS_ERR(data->hwmon_dev)) {
1115 err = PTR_ERR(data->hwmon_dev);
1116 goto exit_remove;
1117 }
1118
1119 return 0;
1120
1121exit_remove:
1122 sysfs_remove_group(&client->dev.kobj, &data->attrs);
1123exit_detach:
1124 i2c_detach_client(client);
1125exit_free:
1126 kfree(data);
1127exit:
1128 return err;
1129}
1130
1131static int adt7473_detach_client(struct i2c_client *client)
1132{
1133 struct adt7473_data *data = i2c_get_clientdata(client);
1134
1135 hwmon_device_unregister(data->hwmon_dev);
1136 sysfs_remove_group(&client->dev.kobj, &data->attrs);
1137 i2c_detach_client(client);
1138 kfree(data);
1139 return 0;
1140}
1141
1142static int __init adt7473_init(void)
1143{
1144 return i2c_add_driver(&adt7473_driver);
1145}
1146
1147static void __exit adt7473_exit(void)
1148{
1149 i2c_del_driver(&adt7473_driver);
1150}
1151
1152MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
1153MODULE_DESCRIPTION("ADT7473 driver");
1154MODULE_LICENSE("GPL");
1155
1156module_init(adt7473_init);
1157module_exit(adt7473_exit);
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0c94770b7f83..aacc0c4b809c 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -84,12 +84,15 @@ static 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 },
87/* Set 1: Macbook set */ 87/* Set 1: Macbook2 set */
88 { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "TTF0", "Th0H",
89 "Th0S", "Th1H", NULL },
90/* Set 2: Macbook set */
88 { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", 91 { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
89 "Th1H", "Ts0P", NULL }, 92 "Th1H", "Ts0P", NULL },
90/* Set 2: Macmini set */ 93/* Set 3: Macmini set */
91 { "TC0D", "TC0P", NULL }, 94 { "TC0D", "TC0P", NULL },
92/* Set 3: Mac Pro (2 x Quad-Core) */ 95/* Set 4: Mac Pro (2 x Quad-Core) */
93 { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", 96 { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P",
94 "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P", 97 "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P",
95 "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", 98 "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S",
@@ -1212,12 +1215,14 @@ static void applesmc_release_accelerometer(void)
1212static __initdata struct dmi_match_data applesmc_dmi_data[] = { 1215static __initdata struct dmi_match_data applesmc_dmi_data[] = {
1213/* MacBook Pro: accelerometer, backlight and temperature set 0 */ 1216/* MacBook Pro: accelerometer, backlight and temperature set 0 */
1214 { .accelerometer = 1, .light = 1, .temperature_set = 0 }, 1217 { .accelerometer = 1, .light = 1, .temperature_set = 0 },
1215/* MacBook: accelerometer and temperature set 1 */ 1218/* MacBook2: accelerometer and temperature set 1 */
1216 { .accelerometer = 1, .light = 0, .temperature_set = 1 }, 1219 { .accelerometer = 1, .light = 0, .temperature_set = 1 },
1217/* MacMini: temperature set 2 */ 1220/* MacBook: accelerometer and temperature set 2 */
1218 { .accelerometer = 0, .light = 0, .temperature_set = 2 }, 1221 { .accelerometer = 1, .light = 0, .temperature_set = 2 },
1219/* MacPro: temperature set 3 */ 1222/* MacMini: temperature set 3 */
1220 { .accelerometer = 0, .light = 0, .temperature_set = 3 }, 1223 { .accelerometer = 0, .light = 0, .temperature_set = 3 },
1224/* MacPro: temperature set 4 */
1225 { .accelerometer = 0, .light = 0, .temperature_set = 4 },
1221}; 1226};
1222 1227
1223/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". 1228/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
@@ -1229,16 +1234,20 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
1229 (void*)&applesmc_dmi_data[0]}, 1234 (void*)&applesmc_dmi_data[0]},
1230 { applesmc_dmi_match, "Apple MacBook", { 1235 { applesmc_dmi_match, "Apple MacBook", {
1231 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1236 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1232 DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") }, 1237 DMI_MATCH(DMI_PRODUCT_NAME,"MacBook2") },
1233 (void*)&applesmc_dmi_data[1]}, 1238 (void*)&applesmc_dmi_data[1]},
1239 { applesmc_dmi_match, "Apple MacBook", {
1240 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1241 DMI_MATCH(DMI_PRODUCT_NAME,"MacBook") },
1242 (void*)&applesmc_dmi_data[2]},
1234 { applesmc_dmi_match, "Apple Macmini", { 1243 { applesmc_dmi_match, "Apple Macmini", {
1235 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1244 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1236 DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, 1245 DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") },
1237 (void*)&applesmc_dmi_data[2]}, 1246 (void*)&applesmc_dmi_data[3]},
1238 { applesmc_dmi_match, "Apple MacPro2", { 1247 { applesmc_dmi_match, "Apple MacPro2", {
1239 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1248 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
1240 DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, 1249 DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
1241 (void*)&applesmc_dmi_data[3]}, 1250 (void*)&applesmc_dmi_data[4]},
1242 { .ident = NULL } 1251 { .ident = NULL }
1243}; 1252};
1244 1253
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index 950cea8d1d65..84712a22acea 100644
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -49,7 +49,7 @@
49#include "lm75.h" 49#include "lm75.h"
50 50
51/* I2C addresses to scan */ 51/* I2C addresses to scan */
52static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; 52static const unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
53 53
54/* Insmod parameters */ 54/* Insmod parameters */
55I2C_CLIENT_INSMOD_1(asb100); 55I2C_CLIENT_INSMOD_1(asb100);
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c
index cce3350e539e..01c17e387f03 100644
--- a/drivers/hwmon/atxp1.c
+++ b/drivers/hwmon/atxp1.c
@@ -42,7 +42,7 @@ MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");
42#define ATXP1_VIDMASK 0x1f 42#define ATXP1_VIDMASK 0x1f
43#define ATXP1_GPIO1MASK 0x0f 43#define ATXP1_GPIO1MASK 0x0f
44 44
45static unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END }; 45static const unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END };
46 46
47I2C_CLIENT_INSMOD_1(atxp1); 47I2C_CLIENT_INSMOD_1(atxp1);
48 48
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 3ee60d26e3a2..70239acecc8e 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -38,7 +38,8 @@
38 38
39#define DRVNAME "coretemp" 39#define DRVNAME "coretemp"
40 40
41typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_LABEL, SHOW_NAME } SHOW; 41typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_TTARGET, SHOW_LABEL,
42 SHOW_NAME } SHOW;
42 43
43/* 44/*
44 * Functions declaration 45 * Functions declaration
@@ -55,6 +56,7 @@ struct coretemp_data {
55 unsigned long last_updated; /* in jiffies */ 56 unsigned long last_updated; /* in jiffies */
56 int temp; 57 int temp;
57 int tjmax; 58 int tjmax;
59 int ttarget;
58 u8 alarm; 60 u8 alarm;
59}; 61};
60 62
@@ -93,9 +95,10 @@ static ssize_t show_temp(struct device *dev,
93 95
94 if (attr->index == SHOW_TEMP) 96 if (attr->index == SHOW_TEMP)
95 err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN; 97 err = data->valid ? sprintf(buf, "%d\n", data->temp) : -EAGAIN;
96 else 98 else if (attr->index == SHOW_TJMAX)
97 err = sprintf(buf, "%d\n", data->tjmax); 99 err = sprintf(buf, "%d\n", data->tjmax);
98 100 else
101 err = sprintf(buf, "%d\n", data->ttarget);
99 return err; 102 return err;
100} 103}
101 104
@@ -103,6 +106,8 @@ static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL,
103 SHOW_TEMP); 106 SHOW_TEMP);
104static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL, 107static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp, NULL,
105 SHOW_TJMAX); 108 SHOW_TJMAX);
109static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp, NULL,
110 SHOW_TTARGET);
106static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL); 111static DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL);
107static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL); 112static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL);
108static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME); 113static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME);
@@ -147,6 +152,56 @@ static struct coretemp_data *coretemp_update_device(struct device *dev)
147 return data; 152 return data;
148} 153}
149 154
155static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
156{
157 /* The 100C is default for both mobile and non mobile CPUs */
158
159 int tjmax = 100000;
160 int ismobile = 1;
161 int err;
162 u32 eax, edx;
163
164 /* Early chips have no MSR for TjMax */
165
166 if ((c->x86_model == 0xf) && (c->x86_mask < 4)) {
167 ismobile = 0;
168 }
169
170 if ((c->x86_model > 0xe) && (ismobile)) {
171
172 /* Now we can detect the mobile CPU using Intel provided table
173 http://softwarecommunity.intel.com/Wiki/Mobility/720.htm
174 For Core2 cores, check MSR 0x17, bit 28 1 = Mobile CPU
175 */
176
177 err = rdmsr_safe_on_cpu(id, 0x17, &eax, &edx);
178 if (err) {
179 dev_warn(dev,
180 "Unable to access MSR 0x17, assuming desktop"
181 " CPU\n");
182 ismobile = 0;
183 } else if (!(eax & 0x10000000)) {
184 ismobile = 0;
185 }
186 }
187
188 if (ismobile) {
189
190 err = rdmsr_safe_on_cpu(id, 0xee, &eax, &edx);
191 if (err) {
192 dev_warn(dev,
193 "Unable to access MSR 0xEE, for Tjmax, left"
194 " at default");
195 } else if (eax & 0x40000000) {
196 tjmax = 85000;
197 }
198 } else {
199 dev_warn(dev, "Using relative temperature scale!\n");
200 }
201
202 return tjmax;
203}
204
150static int __devinit coretemp_probe(struct platform_device *pdev) 205static int __devinit coretemp_probe(struct platform_device *pdev)
151{ 206{
152 struct coretemp_data *data; 207 struct coretemp_data *data;
@@ -163,8 +218,6 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
163 data->id = pdev->id; 218 data->id = pdev->id;
164 data->name = "coretemp"; 219 data->name = "coretemp";
165 mutex_init(&data->update_lock); 220 mutex_init(&data->update_lock);
166 /* Tjmax default is 100 degrees C */
167 data->tjmax = 100000;
168 221
169 /* test if we can access the THERM_STATUS MSR */ 222 /* test if we can access the THERM_STATUS MSR */
170 err = rdmsr_safe_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx); 223 err = rdmsr_safe_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
@@ -191,40 +244,29 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
191 } 244 }
192 } 245 }
193 246
194 /* Some processors have Tjmax 85 following magic should detect it 247 data->tjmax = adjust_tjmax(c, data->id, &pdev->dev);
195 Intel won't disclose the information without signed NDA, but 248 platform_set_drvdata(pdev, data);
196 individuals cannot sign it. Catch(ed) 22.
197 */
198 249
199 if (((c->x86_model == 0xf) && (c->x86_mask > 3)) || 250 /* read the still undocumented IA32_TEMPERATURE_TARGET it exists
200 (c->x86_model == 0xe)) { 251 on older CPUs but not in this register */
201 err = rdmsr_safe_on_cpu(data->id, 0xee, &eax, &edx); 252
253 if (c->x86_model > 0xe) {
254 err = rdmsr_safe_on_cpu(data->id, 0x1a2, &eax, &edx);
202 if (err) { 255 if (err) {
203 dev_warn(&pdev->dev, 256 dev_warn(&pdev->dev, "Unable to read"
204 "Unable to access MSR 0xEE, Tjmax left at %d " 257 " IA32_TEMPERATURE_TARGET MSR\n");
205 "degrees C\n", data->tjmax/1000); 258 } else {
206 } else if (eax & 0x40000000) { 259 data->ttarget = data->tjmax -
207 data->tjmax = 85000; 260 (((eax >> 8) & 0xff) * 1000);
261 err = device_create_file(&pdev->dev,
262 &sensor_dev_attr_temp1_max.dev_attr);
263 if (err)
264 goto exit_free;
208 } 265 }
209 } 266 }
210 267
211 /* Intel says that above should not work for desktop Core2 processors,
212 but it seems to work. There is no other way how get the absolute
213 readings. Warn the user about this. First check if are desktop,
214 bit 50 of MSR_IA32_PLATFORM_ID should be 0.
215 */
216
217 rdmsr_safe_on_cpu(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx);
218
219 if ((c->x86_model == 0xf) && (!(edx & 0x00040000))) {
220 dev_warn(&pdev->dev, "Using undocumented features, absolute "
221 "temperature might be wrong!\n");
222 }
223
224 platform_set_drvdata(pdev, data);
225
226 if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) 268 if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group)))
227 goto exit_free; 269 goto exit_dev;
228 270
229 data->hwmon_dev = hwmon_device_register(&pdev->dev); 271 data->hwmon_dev = hwmon_device_register(&pdev->dev);
230 if (IS_ERR(data->hwmon_dev)) { 272 if (IS_ERR(data->hwmon_dev)) {
@@ -238,6 +280,8 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
238 280
239exit_class: 281exit_class:
240 sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); 282 sysfs_remove_group(&pdev->dev.kobj, &coretemp_group);
283exit_dev:
284 device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
241exit_free: 285exit_free:
242 kfree(data); 286 kfree(data);
243exit: 287exit:
@@ -250,6 +294,7 @@ static int __devexit coretemp_remove(struct platform_device *pdev)
250 294
251 hwmon_device_unregister(data->hwmon_dev); 295 hwmon_device_unregister(data->hwmon_dev);
252 sysfs_remove_group(&pdev->dev.kobj, &coretemp_group); 296 sysfs_remove_group(&pdev->dev.kobj, &coretemp_group);
297 device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr);
253 platform_set_drvdata(pdev, NULL); 298 platform_set_drvdata(pdev, NULL);
254 kfree(data); 299 kfree(data);
255 return 0; 300 return 0;
@@ -330,7 +375,7 @@ static void coretemp_device_remove(unsigned int cpu)
330 mutex_unlock(&pdev_list_mutex); 375 mutex_unlock(&pdev_list_mutex);
331} 376}
332 377
333static int coretemp_cpu_callback(struct notifier_block *nfb, 378static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb,
334 unsigned long action, void *hcpu) 379 unsigned long action, void *hcpu)
335{ 380{
336 unsigned int cpu = (unsigned long) hcpu; 381 unsigned int cpu = (unsigned long) hcpu;
@@ -347,7 +392,7 @@ static int coretemp_cpu_callback(struct notifier_block *nfb,
347 return NOTIFY_OK; 392 return NOTIFY_OK;
348} 393}
349 394
350static struct notifier_block coretemp_cpu_notifier = { 395static struct notifier_block coretemp_cpu_notifier __refdata = {
351 .notifier_call = coretemp_cpu_callback, 396 .notifier_call = coretemp_cpu_callback,
352}; 397};
353#endif /* !CONFIG_HOTPLUG_CPU */ 398#endif /* !CONFIG_HOTPLUG_CPU */
@@ -368,10 +413,10 @@ static int __init coretemp_init(void)
368 for_each_online_cpu(i) { 413 for_each_online_cpu(i) {
369 struct cpuinfo_x86 *c = &cpu_data(i); 414 struct cpuinfo_x86 *c = &cpu_data(i);
370 415
371 /* check if family 6, models e, f, 16 */ 416 /* check if family 6, models 0xe, 0xf, 0x16, 0x17 */
372 if ((c->cpuid_level < 0) || (c->x86 != 0x6) || 417 if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
373 !((c->x86_model == 0xe) || (c->x86_model == 0xf) || 418 !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
374 (c->x86_model == 0x16))) { 419 (c->x86_model == 0x16) || (c->x86_model == 0x17))) {
375 420
376 /* supported CPU not found, but report the unknown 421 /* supported CPU not found, but report the unknown
377 family 6 CPU */ 422 family 6 CPU */
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index ddddd9f34c19..7673f65877e1 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -49,7 +49,7 @@ module_param(force_id, ushort, 0);
49MODULE_PARM_DESC(force_id, "Override the detected device ID"); 49MODULE_PARM_DESC(force_id, "Override the detected device ID");
50 50
51/* Addresses to scan */ 51/* Addresses to scan */
52static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; 52static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
53 53
54/* Insmod parameters */ 54/* Insmod parameters */
55I2C_CLIENT_INSMOD_1(dme1737); 55I2C_CLIENT_INSMOD_1(dme1737);
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index 3f5163de13c1..5f300ffed657 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -34,7 +34,7 @@
34#include "lm75.h" 34#include "lm75.h"
35 35
36/* Addresses to scan */ 36/* Addresses to scan */
37static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, 37static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
38 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; 38 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
39 39
40/* Insmod parameters */ 40/* Insmod parameters */
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 6892f76fc18a..1464338e4e11 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -37,7 +37,7 @@
37#include <linux/f75375s.h> 37#include <linux/f75375s.h>
38 38
39/* Addresses to scan */ 39/* Addresses to scan */
40static unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; 40static const unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END };
41 41
42/* Insmod parameters */ 42/* Insmod parameters */
43I2C_CLIENT_INSMOD_2(f75373, f75375); 43I2C_CLIENT_INSMOD_2(f75373, f75375);
diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c
index 721c70177b17..ed26b66e0831 100644
--- a/drivers/hwmon/fscher.c
+++ b/drivers/hwmon/fscher.c
@@ -40,7 +40,7 @@
40 * Addresses to scan 40 * Addresses to scan
41 */ 41 */
42 42
43static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; 43static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
44 44
45/* 45/*
46 * Insmod parameters 46 * Insmod parameters
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
index b7c9eef0f928..bd89d270a5ed 100644
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -44,7 +44,7 @@
44#include <linux/dmi.h> 44#include <linux/dmi.h>
45 45
46/* Addresses to scan */ 46/* Addresses to scan */
47static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; 47static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
48 48
49/* Insmod parameters */ 49/* Insmod parameters */
50I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd); 50I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd);
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c
index 2f1075323a1e..00f48484e54b 100644
--- a/drivers/hwmon/fscpos.c
+++ b/drivers/hwmon/fscpos.c
@@ -43,7 +43,7 @@
43/* 43/*
44 * Addresses to scan 44 * Addresses to scan
45 */ 45 */
46static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; 46static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
47 47
48/* 48/*
49 * Insmod parameters 49 * Insmod parameters
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c
index 3b1ac48fce23..33e9e8a8d1ce 100644
--- a/drivers/hwmon/gl518sm.c
+++ b/drivers/hwmon/gl518sm.c
@@ -44,7 +44,7 @@
44#include <linux/sysfs.h> 44#include <linux/sysfs.h>
45 45
46/* Addresses to scan */ 46/* Addresses to scan */
47static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; 47static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
48 48
49/* Insmod parameters */ 49/* Insmod parameters */
50I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80); 50I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80);
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index 03ecdc334764..8984ef141627 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -39,7 +39,7 @@ module_param(extra_sensor_type, ushort, 0);
39MODULE_PARM_DESC(extra_sensor_type, "Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)"); 39MODULE_PARM_DESC(extra_sensor_type, "Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)");
40 40
41/* Addresses to scan */ 41/* Addresses to scan */
42static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; 42static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
43 43
44/* Insmod parameters */ 44/* Insmod parameters */
45I2C_CLIENT_INSMOD_1(gl520sm); 45I2C_CLIENT_INSMOD_1(gl520sm);
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
index 650b07d5b902..116287008083 100644
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -53,7 +53,7 @@
53 * Address is fully defined internally and cannot be changed. 53 * Address is fully defined internally and cannot be changed.
54 */ 54 */
55 55
56static unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; 56static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END };
57 57
58/* 58/*
59 * Insmod parameters 59 * Insmod parameters
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index e5c35a355a57..115f4090b98e 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -31,7 +31,7 @@
31 31
32 32
33/* Addresses to scan */ 33/* Addresses to scan */
34static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, 34static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
35 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; 35 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
36 36
37/* Insmod parameters */ 37/* Insmod parameters */
diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c
index 459b70ad6bee..36d5a8c3ad8c 100644
--- a/drivers/hwmon/lm77.c
+++ b/drivers/hwmon/lm77.c
@@ -36,7 +36,8 @@
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37 37
38/* Addresses to scan */ 38/* Addresses to scan */
39static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, I2C_CLIENT_END }; 39static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
40 I2C_CLIENT_END };
40 41
41/* Insmod parameters */ 42/* Insmod parameters */
42I2C_CLIENT_INSMOD_1(lm77); 43I2C_CLIENT_INSMOD_1(lm77);
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index 0a9eb1f6f4e4..ed7859f0e16a 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -37,8 +37,8 @@
37static struct platform_device *pdev; 37static struct platform_device *pdev;
38 38
39/* Addresses to scan */ 39/* Addresses to scan */
40static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 40static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
41 0x2e, 0x2f, I2C_CLIENT_END }; 41 0x2e, 0x2f, I2C_CLIENT_END };
42static unsigned short isa_address = 0x290; 42static unsigned short isa_address = 0x290;
43 43
44/* Insmod parameters */ 44/* Insmod parameters */
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
index a2ca055f3922..26c91c9d4769 100644
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -32,8 +32,8 @@
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33 33
34/* Addresses to scan */ 34/* Addresses to scan */
35static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 35static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
36 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; 36 0x2e, 0x2f, I2C_CLIENT_END };
37 37
38/* Insmod parameters */ 38/* Insmod parameters */
39I2C_CLIENT_INSMOD_1(lm80); 39I2C_CLIENT_INSMOD_1(lm80);
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c
index 6e8903a6e902..6a8642fa25fb 100644
--- a/drivers/hwmon/lm83.c
+++ b/drivers/hwmon/lm83.c
@@ -48,10 +48,8 @@
48 * addresses. 48 * addresses.
49 */ 49 */
50 50
51static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, 51static const unsigned short normal_i2c[] = {
52 0x29, 0x2a, 0x2b, 52 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
53 0x4c, 0x4d, 0x4e,
54 I2C_CLIENT_END };
55 53
56/* 54/*
57 * Insmod parameters 55 * Insmod parameters
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index 4bb0f291a6b8..182fe6a5605f 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -35,7 +35,7 @@
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36 36
37/* Addresses to scan */ 37/* Addresses to scan */
38static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 38static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
39 39
40/* Insmod parameters */ 40/* Insmod parameters */
41I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102); 41I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102);
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index 8ee07c5c97a1..e1c183f0aae0 100644
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -73,7 +73,7 @@
73 * LM87 has three possible addresses: 0x2c, 0x2d and 0x2e. 73 * LM87 has three possible addresses: 0x2c, 0x2d and 0x2e.
74 */ 74 */
75 75
76static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 76static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
77 77
78/* 78/*
79 * Insmod parameters 79 * Insmod parameters
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index f7ec95bedbf6..d1a3da3dd8e0 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -101,10 +101,8 @@
101 * 0x4c, 0x4d or 0x4e. 101 * 0x4c, 0x4d or 0x4e.
102 */ 102 */
103 103
104static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, 104static const unsigned short normal_i2c[] = {
105 0x29, 0x2a, 0x2b, 105 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
106 0x4c, 0x4d, 0x4e,
107 I2C_CLIENT_END };
108 106
109/* 107/*
110 * Insmod parameters 108 * Insmod parameters
diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c
index af5c77d568fe..c31942e08246 100644
--- a/drivers/hwmon/lm92.c
+++ b/drivers/hwmon/lm92.c
@@ -45,13 +45,14 @@
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <linux/i2c.h> 46#include <linux/i2c.h>
47#include <linux/hwmon.h> 47#include <linux/hwmon.h>
48#include <linux/hwmon-sysfs.h>
48#include <linux/err.h> 49#include <linux/err.h>
49#include <linux/mutex.h> 50#include <linux/mutex.h>
50 51
51/* The LM92 and MAX6635 have 2 two-state pins for address selection, 52/* The LM92 and MAX6635 have 2 two-state pins for address selection,
52 resulting in 4 possible addresses. */ 53 resulting in 4 possible addresses. */
53static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 54static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
54 I2C_CLIENT_END }; 55 I2C_CLIENT_END };
55 56
56/* Insmod parameters */ 57/* Insmod parameters */
57I2C_CLIENT_INSMOD_1(lm92); 58I2C_CLIENT_INSMOD_1(lm92);
@@ -209,6 +210,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
209 return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input)); 210 return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input));
210} 211}
211 212
213static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
214 char *buf)
215{
216 int bitnr = to_sensor_dev_attr(attr)->index;
217 struct lm92_data *data = lm92_update_device(dev);
218 return sprintf(buf, "%d\n", (data->temp1_input >> bitnr) & 1);
219}
220
212static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL); 221static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL);
213static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp1_crit, 222static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp1_crit,
214 set_temp1_crit); 223 set_temp1_crit);
@@ -221,6 +230,9 @@ static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp1_max,
221 set_temp1_max); 230 set_temp1_max);
222static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp1_max_hyst, NULL); 231static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, show_temp1_max_hyst, NULL);
223static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 232static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
233static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 2);
234static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 0);
235static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 1);
224 236
225 237
226/* 238/*
@@ -297,7 +309,9 @@ static struct attribute *lm92_attributes[] = {
297 &dev_attr_temp1_max.attr, 309 &dev_attr_temp1_max.attr,
298 &dev_attr_temp1_max_hyst.attr, 310 &dev_attr_temp1_max_hyst.attr,
299 &dev_attr_alarms.attr, 311 &dev_attr_alarms.attr,
300 312 &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
313 &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
314 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
301 NULL 315 NULL
302}; 316};
303 317
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c
index ea61946a4bf7..5e678f5c883d 100644
--- a/drivers/hwmon/lm93.c
+++ b/drivers/hwmon/lm93.c
@@ -142,7 +142,7 @@
142 I2C_FUNC_SMBUS_WORD_DATA) 142 I2C_FUNC_SMBUS_WORD_DATA)
143 143
144/* Addresses to scan */ 144/* Addresses to scan */
145static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 145static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
146 146
147/* Insmod parameters */ 147/* Insmod parameters */
148I2C_CLIENT_INSMOD_1(lm93); 148I2C_CLIENT_INSMOD_1(lm93);
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
index 38a44c3d6cee..7e7267a04544 100644
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -32,14 +32,13 @@
32#include <linux/jiffies.h> 32#include <linux/jiffies.h>
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/hwmon.h> 34#include <linux/hwmon.h>
35#include <linux/hwmon-sysfs.h>
35#include <linux/err.h> 36#include <linux/err.h>
36#include <linux/mutex.h> 37#include <linux/mutex.h>
37#include <linux/sysfs.h> 38#include <linux/sysfs.h>
38 39
39static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, 40static const unsigned short normal_i2c[] = {
40 0x29, 0x2a, 0x2b, 41 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
41 0x4c, 0x4d, 0x4e,
42 I2C_CLIENT_END };
43 42
44/* 43/*
45 * Insmod parameters 44 * Insmod parameters
@@ -161,6 +160,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
161 return sprintf(buf, "%d\n", data->alarms); 160 return sprintf(buf, "%d\n", data->alarms);
162} 161}
163 162
163static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
164 char *buf)
165{
166 int bitnr = to_sensor_dev_attr(attr)->index;
167 struct max1619_data *data = max1619_update_device(dev);
168 return sprintf(buf, "%d\n", (data->alarms >> bitnr) & 1);
169}
170
164static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL); 171static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL);
165static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL); 172static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL);
166static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2, 173static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2,
@@ -172,6 +179,10 @@ static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2,
172static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2, 179static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2,
173 set_temp_hyst2); 180 set_temp_hyst2);
174static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 181static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
182static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 1);
183static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2);
184static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3);
185static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4);
175 186
176static struct attribute *max1619_attributes[] = { 187static struct attribute *max1619_attributes[] = {
177 &dev_attr_temp1_input.attr, 188 &dev_attr_temp1_input.attr,
@@ -182,6 +193,10 @@ static struct attribute *max1619_attributes[] = {
182 &dev_attr_temp2_crit_hyst.attr, 193 &dev_attr_temp2_crit_hyst.attr,
183 194
184 &dev_attr_alarms.attr, 195 &dev_attr_alarms.attr,
196 &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr,
197 &sensor_dev_attr_temp2_fault.dev_attr.attr,
198 &sensor_dev_attr_temp2_min_alarm.dev_attr.attr,
199 &sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
185 NULL 200 NULL
186}; 201};
187 202
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index 755570c1f4eb..52d528b76cc3 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -44,7 +44,8 @@
44 * Addresses to scan. There are four disjoint possibilities, by pin config. 44 * Addresses to scan. There are four disjoint possibilities, by pin config.
45 */ 45 */
46 46
47static unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b, I2C_CLIENT_END}; 47static const unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b,
48 I2C_CLIENT_END};
48 49
49/* 50/*
50 * Insmod parameters 51 * Insmod parameters
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 0d7f0c4d06bb..d1b498548736 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -198,6 +198,14 @@ static ssize_t get_fan_div(struct device *dev, struct device_attribute
198 return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index])); 198 return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[attr->index]));
199} 199}
200 200
201static ssize_t get_fan_alarm(struct device *dev, struct device_attribute
202 *devattr, char *buf)
203{
204 int bitnr = to_sensor_dev_attr(devattr)->index;
205 struct smsc47m1_data *data = smsc47m1_update_device(dev, 0);
206 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
207}
208
201static ssize_t get_pwm(struct device *dev, struct device_attribute 209static ssize_t get_pwm(struct device *dev, struct device_attribute
202 *devattr, char *buf) 210 *devattr, char *buf)
203{ 211{
@@ -347,6 +355,8 @@ static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
347 get_fan_min, set_fan_min, offset - 1); \ 355 get_fan_min, set_fan_min, offset - 1); \
348static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ 356static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
349 get_fan_div, set_fan_div, offset - 1); \ 357 get_fan_div, set_fan_div, offset - 1); \
358static SENSOR_DEVICE_ATTR(fan##offset##_alarm, S_IRUGO, get_fan_alarm, \
359 NULL, offset - 1); \
350static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ 360static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \
351 get_pwm, set_pwm, offset - 1); \ 361 get_pwm, set_pwm, offset - 1); \
352static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ 362static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \
@@ -374,12 +384,15 @@ static struct attribute *smsc47m1_attributes[] = {
374 &sensor_dev_attr_fan1_input.dev_attr.attr, 384 &sensor_dev_attr_fan1_input.dev_attr.attr,
375 &sensor_dev_attr_fan1_min.dev_attr.attr, 385 &sensor_dev_attr_fan1_min.dev_attr.attr,
376 &sensor_dev_attr_fan1_div.dev_attr.attr, 386 &sensor_dev_attr_fan1_div.dev_attr.attr,
387 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
377 &sensor_dev_attr_fan2_input.dev_attr.attr, 388 &sensor_dev_attr_fan2_input.dev_attr.attr,
378 &sensor_dev_attr_fan2_min.dev_attr.attr, 389 &sensor_dev_attr_fan2_min.dev_attr.attr,
379 &sensor_dev_attr_fan2_div.dev_attr.attr, 390 &sensor_dev_attr_fan2_div.dev_attr.attr,
391 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
380 &sensor_dev_attr_fan3_input.dev_attr.attr, 392 &sensor_dev_attr_fan3_input.dev_attr.attr,
381 &sensor_dev_attr_fan3_min.dev_attr.attr, 393 &sensor_dev_attr_fan3_min.dev_attr.attr,
382 &sensor_dev_attr_fan3_div.dev_attr.attr, 394 &sensor_dev_attr_fan3_div.dev_attr.attr,
395 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
383 396
384 &sensor_dev_attr_pwm1.dev_attr.attr, 397 &sensor_dev_attr_pwm1.dev_attr.attr,
385 &sensor_dev_attr_pwm1_enable.dev_attr.attr, 398 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
@@ -533,7 +546,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
533 || (err = device_create_file(dev, 546 || (err = device_create_file(dev,
534 &sensor_dev_attr_fan1_min.dev_attr)) 547 &sensor_dev_attr_fan1_min.dev_attr))
535 || (err = device_create_file(dev, 548 || (err = device_create_file(dev,
536 &sensor_dev_attr_fan1_div.dev_attr))) 549 &sensor_dev_attr_fan1_div.dev_attr))
550 || (err = device_create_file(dev,
551 &sensor_dev_attr_fan1_alarm.dev_attr)))
537 goto error_remove_files; 552 goto error_remove_files;
538 } else 553 } else
539 dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n"); 554 dev_dbg(dev, "Fan 1 not enabled by hardware, skipping\n");
@@ -544,7 +559,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
544 || (err = device_create_file(dev, 559 || (err = device_create_file(dev,
545 &sensor_dev_attr_fan2_min.dev_attr)) 560 &sensor_dev_attr_fan2_min.dev_attr))
546 || (err = device_create_file(dev, 561 || (err = device_create_file(dev,
547 &sensor_dev_attr_fan2_div.dev_attr))) 562 &sensor_dev_attr_fan2_div.dev_attr))
563 || (err = device_create_file(dev,
564 &sensor_dev_attr_fan2_alarm.dev_attr)))
548 goto error_remove_files; 565 goto error_remove_files;
549 } else 566 } else
550 dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n"); 567 dev_dbg(dev, "Fan 2 not enabled by hardware, skipping\n");
@@ -555,7 +572,9 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
555 || (err = device_create_file(dev, 572 || (err = device_create_file(dev,
556 &sensor_dev_attr_fan3_min.dev_attr)) 573 &sensor_dev_attr_fan3_min.dev_attr))
557 || (err = device_create_file(dev, 574 || (err = device_create_file(dev,
558 &sensor_dev_attr_fan3_div.dev_attr))) 575 &sensor_dev_attr_fan3_div.dev_attr))
576 || (err = device_create_file(dev,
577 &sensor_dev_attr_fan3_alarm.dev_attr)))
559 goto error_remove_files; 578 goto error_remove_files;
560 } else if (data->type == smsc47m2) 579 } else if (data->type == smsc47m2)
561 dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n"); 580 dev_dbg(dev, "Fan 3 not enabled by hardware, skipping\n");
diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c
index 8b0c188e60f6..3c9db6598ba7 100644
--- a/drivers/hwmon/smsc47m192.c
+++ b/drivers/hwmon/smsc47m192.c
@@ -34,7 +34,7 @@
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35 35
36/* Addresses to scan */ 36/* Addresses to scan */
37static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; 37static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
38 38
39/* Insmod parameters */ 39/* Insmod parameters */
40I2C_CLIENT_INSMOD_1(smsc47m192); 40I2C_CLIENT_INSMOD_1(smsc47m192);
diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c
index 04dd7699b3ac..76a3859c3fbe 100644
--- a/drivers/hwmon/thmc50.c
+++ b/drivers/hwmon/thmc50.c
@@ -32,7 +32,7 @@
32MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
33 33
34/* Addresses to scan */ 34/* Addresses to scan */
35static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 35static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
36 36
37/* Insmod parameters */ 37/* Insmod parameters */
38I2C_CLIENT_INSMOD_2(thmc50, adm1022); 38I2C_CLIENT_INSMOD_2(thmc50, adm1022);
@@ -52,9 +52,9 @@ I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs "
52 */ 52 */
53#define THMC50_REG_INTR 0x41 53#define THMC50_REG_INTR 0x41
54 54
55const static u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 }; 55static const u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 };
56const static u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C }; 56static const u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C };
57const static u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B }; 57static const u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B };
58 58
59#define THMC50_REG_CONF_nFANOFF 0x20 59#define THMC50_REG_CONF_nFANOFF 0x20
60 60
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index 2635bba1e3fc..f1ee5e731968 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -533,6 +533,24 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch
533} 533}
534static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 534static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
535 535
536static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
537 char *buf)
538{
539 int bitnr = to_sensor_dev_attr(attr)->index;
540 struct via686a_data *data = via686a_update_device(dev);
541 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
542}
543static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0);
544static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1);
545static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2);
546static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3);
547static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8);
548static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4);
549static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 11);
550static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 15);
551static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6);
552static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7);
553
536static ssize_t show_name(struct device *dev, struct device_attribute 554static ssize_t show_name(struct device *dev, struct device_attribute
537 *devattr, char *buf) 555 *devattr, char *buf)
538{ 556{
@@ -557,6 +575,11 @@ static struct attribute *via686a_attributes[] = {
557 &sensor_dev_attr_in2_max.dev_attr.attr, 575 &sensor_dev_attr_in2_max.dev_attr.attr,
558 &sensor_dev_attr_in3_max.dev_attr.attr, 576 &sensor_dev_attr_in3_max.dev_attr.attr,
559 &sensor_dev_attr_in4_max.dev_attr.attr, 577 &sensor_dev_attr_in4_max.dev_attr.attr,
578 &sensor_dev_attr_in0_alarm.dev_attr.attr,
579 &sensor_dev_attr_in1_alarm.dev_attr.attr,
580 &sensor_dev_attr_in2_alarm.dev_attr.attr,
581 &sensor_dev_attr_in3_alarm.dev_attr.attr,
582 &sensor_dev_attr_in4_alarm.dev_attr.attr,
560 583
561 &sensor_dev_attr_temp1_input.dev_attr.attr, 584 &sensor_dev_attr_temp1_input.dev_attr.attr,
562 &sensor_dev_attr_temp2_input.dev_attr.attr, 585 &sensor_dev_attr_temp2_input.dev_attr.attr,
@@ -567,6 +590,9 @@ static struct attribute *via686a_attributes[] = {
567 &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, 590 &sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
568 &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, 591 &sensor_dev_attr_temp2_max_hyst.dev_attr.attr,
569 &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, 592 &sensor_dev_attr_temp3_max_hyst.dev_attr.attr,
593 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
594 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
595 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
570 596
571 &sensor_dev_attr_fan1_input.dev_attr.attr, 597 &sensor_dev_attr_fan1_input.dev_attr.attr,
572 &sensor_dev_attr_fan2_input.dev_attr.attr, 598 &sensor_dev_attr_fan2_input.dev_attr.attr,
@@ -574,6 +600,8 @@ static struct attribute *via686a_attributes[] = {
574 &sensor_dev_attr_fan2_min.dev_attr.attr, 600 &sensor_dev_attr_fan2_min.dev_attr.attr,
575 &sensor_dev_attr_fan1_div.dev_attr.attr, 601 &sensor_dev_attr_fan1_div.dev_attr.attr,
576 &sensor_dev_attr_fan2_div.dev_attr.attr, 602 &sensor_dev_attr_fan2_div.dev_attr.attr,
603 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
604 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
577 605
578 &dev_attr_alarms.attr, 606 &dev_attr_alarms.attr,
579 &dev_attr_name.attr, 607 &dev_attr_name.attr,
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index f87661775fe0..5bc57275cae8 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -2,7 +2,7 @@
2 vt8231.c - Part of lm_sensors, Linux kernel modules 2 vt8231.c - Part of lm_sensors, Linux kernel modules
3 for hardware monitoring 3 for hardware monitoring
4 4
5 Copyright (c) 2005 Roger Lucas <roger@planbit.co.uk> 5 Copyright (c) 2005 Roger Lucas <vt8231@hiddenengine.co.uk>
6 Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> 6 Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
7 Aaron M. Marsh <amarsh@sdf.lonestar.org> 7 Aaron M. Marsh <amarsh@sdf.lonestar.org>
8 8
@@ -541,6 +541,28 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr,
541} 541}
542static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 542static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
543 543
544static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
545 char *buf)
546{
547 int bitnr = to_sensor_dev_attr(attr)->index;
548 struct vt8231_data *data = vt8231_update_device(dev);
549 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
550}
551static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4);
552static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 11);
553static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 0);
554static SENSOR_DEVICE_ATTR(temp4_alarm, S_IRUGO, show_alarm, NULL, 1);
555static SENSOR_DEVICE_ATTR(temp5_alarm, S_IRUGO, show_alarm, NULL, 3);
556static SENSOR_DEVICE_ATTR(temp6_alarm, S_IRUGO, show_alarm, NULL, 8);
557static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 11);
558static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 0);
559static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 1);
560static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3);
561static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 8);
562static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 2);
563static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 6);
564static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 7);
565
544static ssize_t show_name(struct device *dev, struct device_attribute 566static ssize_t show_name(struct device *dev, struct device_attribute
545 *devattr, char *buf) 567 *devattr, char *buf)
546{ 568{
@@ -549,36 +571,42 @@ static ssize_t show_name(struct device *dev, struct device_attribute
549} 571}
550static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 572static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
551 573
552static struct attribute *vt8231_attributes_temps[6][4] = { 574static struct attribute *vt8231_attributes_temps[6][5] = {
553 { 575 {
554 &dev_attr_temp1_input.attr, 576 &dev_attr_temp1_input.attr,
555 &dev_attr_temp1_max_hyst.attr, 577 &dev_attr_temp1_max_hyst.attr,
556 &dev_attr_temp1_max.attr, 578 &dev_attr_temp1_max.attr,
579 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
557 NULL 580 NULL
558 }, { 581 }, {
559 &sensor_dev_attr_temp2_input.dev_attr.attr, 582 &sensor_dev_attr_temp2_input.dev_attr.attr,
560 &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, 583 &sensor_dev_attr_temp2_max_hyst.dev_attr.attr,
561 &sensor_dev_attr_temp2_max.dev_attr.attr, 584 &sensor_dev_attr_temp2_max.dev_attr.attr,
585 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
562 NULL 586 NULL
563 }, { 587 }, {
564 &sensor_dev_attr_temp3_input.dev_attr.attr, 588 &sensor_dev_attr_temp3_input.dev_attr.attr,
565 &sensor_dev_attr_temp3_max_hyst.dev_attr.attr, 589 &sensor_dev_attr_temp3_max_hyst.dev_attr.attr,
566 &sensor_dev_attr_temp3_max.dev_attr.attr, 590 &sensor_dev_attr_temp3_max.dev_attr.attr,
591 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
567 NULL 592 NULL
568 }, { 593 }, {
569 &sensor_dev_attr_temp4_input.dev_attr.attr, 594 &sensor_dev_attr_temp4_input.dev_attr.attr,
570 &sensor_dev_attr_temp4_max_hyst.dev_attr.attr, 595 &sensor_dev_attr_temp4_max_hyst.dev_attr.attr,
571 &sensor_dev_attr_temp4_max.dev_attr.attr, 596 &sensor_dev_attr_temp4_max.dev_attr.attr,
597 &sensor_dev_attr_temp4_alarm.dev_attr.attr,
572 NULL 598 NULL
573 }, { 599 }, {
574 &sensor_dev_attr_temp5_input.dev_attr.attr, 600 &sensor_dev_attr_temp5_input.dev_attr.attr,
575 &sensor_dev_attr_temp5_max_hyst.dev_attr.attr, 601 &sensor_dev_attr_temp5_max_hyst.dev_attr.attr,
576 &sensor_dev_attr_temp5_max.dev_attr.attr, 602 &sensor_dev_attr_temp5_max.dev_attr.attr,
603 &sensor_dev_attr_temp5_alarm.dev_attr.attr,
577 NULL 604 NULL
578 }, { 605 }, {
579 &sensor_dev_attr_temp6_input.dev_attr.attr, 606 &sensor_dev_attr_temp6_input.dev_attr.attr,
580 &sensor_dev_attr_temp6_max_hyst.dev_attr.attr, 607 &sensor_dev_attr_temp6_max_hyst.dev_attr.attr,
581 &sensor_dev_attr_temp6_max.dev_attr.attr, 608 &sensor_dev_attr_temp6_max.dev_attr.attr,
609 &sensor_dev_attr_temp6_alarm.dev_attr.attr,
582 NULL 610 NULL
583 } 611 }
584}; 612};
@@ -592,36 +620,42 @@ static const struct attribute_group vt8231_group_temps[6] = {
592 { .attrs = vt8231_attributes_temps[5] }, 620 { .attrs = vt8231_attributes_temps[5] },
593}; 621};
594 622
595static struct attribute *vt8231_attributes_volts[6][4] = { 623static struct attribute *vt8231_attributes_volts[6][5] = {
596 { 624 {
597 &sensor_dev_attr_in0_input.dev_attr.attr, 625 &sensor_dev_attr_in0_input.dev_attr.attr,
598 &sensor_dev_attr_in0_min.dev_attr.attr, 626 &sensor_dev_attr_in0_min.dev_attr.attr,
599 &sensor_dev_attr_in0_max.dev_attr.attr, 627 &sensor_dev_attr_in0_max.dev_attr.attr,
628 &sensor_dev_attr_in0_alarm.dev_attr.attr,
600 NULL 629 NULL
601 }, { 630 }, {
602 &sensor_dev_attr_in1_input.dev_attr.attr, 631 &sensor_dev_attr_in1_input.dev_attr.attr,
603 &sensor_dev_attr_in1_min.dev_attr.attr, 632 &sensor_dev_attr_in1_min.dev_attr.attr,
604 &sensor_dev_attr_in1_max.dev_attr.attr, 633 &sensor_dev_attr_in1_max.dev_attr.attr,
634 &sensor_dev_attr_in1_alarm.dev_attr.attr,
605 NULL 635 NULL
606 }, { 636 }, {
607 &sensor_dev_attr_in2_input.dev_attr.attr, 637 &sensor_dev_attr_in2_input.dev_attr.attr,
608 &sensor_dev_attr_in2_min.dev_attr.attr, 638 &sensor_dev_attr_in2_min.dev_attr.attr,
609 &sensor_dev_attr_in2_max.dev_attr.attr, 639 &sensor_dev_attr_in2_max.dev_attr.attr,
640 &sensor_dev_attr_in2_alarm.dev_attr.attr,
610 NULL 641 NULL
611 }, { 642 }, {
612 &sensor_dev_attr_in3_input.dev_attr.attr, 643 &sensor_dev_attr_in3_input.dev_attr.attr,
613 &sensor_dev_attr_in3_min.dev_attr.attr, 644 &sensor_dev_attr_in3_min.dev_attr.attr,
614 &sensor_dev_attr_in3_max.dev_attr.attr, 645 &sensor_dev_attr_in3_max.dev_attr.attr,
646 &sensor_dev_attr_in3_alarm.dev_attr.attr,
615 NULL 647 NULL
616 }, { 648 }, {
617 &sensor_dev_attr_in4_input.dev_attr.attr, 649 &sensor_dev_attr_in4_input.dev_attr.attr,
618 &sensor_dev_attr_in4_min.dev_attr.attr, 650 &sensor_dev_attr_in4_min.dev_attr.attr,
619 &sensor_dev_attr_in4_max.dev_attr.attr, 651 &sensor_dev_attr_in4_max.dev_attr.attr,
652 &sensor_dev_attr_in4_alarm.dev_attr.attr,
620 NULL 653 NULL
621 }, { 654 }, {
622 &dev_attr_in5_input.attr, 655 &dev_attr_in5_input.attr,
623 &dev_attr_in5_min.attr, 656 &dev_attr_in5_min.attr,
624 &dev_attr_in5_max.attr, 657 &dev_attr_in5_max.attr,
658 &sensor_dev_attr_in5_alarm.dev_attr.attr,
625 NULL 659 NULL
626 } 660 }
627}; 661};
@@ -642,6 +676,8 @@ static struct attribute *vt8231_attributes[] = {
642 &sensor_dev_attr_fan2_min.dev_attr.attr, 676 &sensor_dev_attr_fan2_min.dev_attr.attr,
643 &sensor_dev_attr_fan1_div.dev_attr.attr, 677 &sensor_dev_attr_fan1_div.dev_attr.attr,
644 &sensor_dev_attr_fan2_div.dev_attr.attr, 678 &sensor_dev_attr_fan2_div.dev_attr.attr,
679 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
680 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
645 &dev_attr_alarms.attr, 681 &dev_attr_alarms.attr,
646 &dev_attr_name.attr, 682 &dev_attr_name.attr,
647 NULL 683 NULL
@@ -963,7 +999,7 @@ static void __exit sm_vt8231_exit(void)
963 } 999 }
964} 1000}
965 1001
966MODULE_AUTHOR("Roger Lucas <roger@planbit.co.uk>"); 1002MODULE_AUTHOR("Roger Lucas <vt8231@hiddenengine.co.uk>");
967MODULE_DESCRIPTION("VT8231 sensors"); 1003MODULE_DESCRIPTION("VT8231 sensors");
968MODULE_LICENSE("GPL"); 1004MODULE_LICENSE("GPL");
969 1005
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index 7421f6ea53e1..5c85670e2d16 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -53,8 +53,8 @@
53static struct platform_device *pdev; 53static struct platform_device *pdev;
54 54
55/* Addresses to scan */ 55/* Addresses to scan */
56static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 56static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
57 0x2e, 0x2f, I2C_CLIENT_END }; 57 0x2e, 0x2f, I2C_CLIENT_END };
58static unsigned short isa_address = 0x290; 58static unsigned short isa_address = 0x290;
59 59
60/* Insmod parameters */ 60/* Insmod parameters */
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index 85bd21ee3298..85077c4c8039 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -47,7 +47,8 @@
47#define NUMBER_OF_TEMPIN 3 47#define NUMBER_OF_TEMPIN 3
48 48
49/* Addresses to scan */ 49/* Addresses to scan */
50static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; 50static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
51 I2C_CLIENT_END };
51 52
52/* Insmod parameters */ 53/* Insmod parameters */
53I2C_CLIENT_INSMOD_1(w83791d); 54I2C_CLIENT_INSMOD_1(w83791d);
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index 007449d3e16e..299629d47ed6 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -46,7 +46,8 @@
46#include <linux/sysfs.h> 46#include <linux/sysfs.h>
47 47
48/* Addresses to scan */ 48/* Addresses to scan */
49static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; 49static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
50 I2C_CLIENT_END };
50 51
51/* Insmod parameters */ 52/* Insmod parameters */
52I2C_CLIENT_INSMOD_1(w83792d); 53I2C_CLIENT_INSMOD_1(w83792d);
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index 3ba1d6b33473..ee35af93b574 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -37,7 +37,8 @@
37#include <linux/mutex.h> 37#include <linux/mutex.h>
38 38
39/* Addresses to scan */ 39/* Addresses to scan */
40static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; 40static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
41 I2C_CLIENT_END };
41 42
42/* Insmod parameters */ 43/* Insmod parameters */
43I2C_CLIENT_INSMOD_1(w83793); 44I2C_CLIENT_INSMOD_1(w83793);
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c
index 1d6259d29e74..77f2d482888b 100644
--- a/drivers/hwmon/w83l785ts.c
+++ b/drivers/hwmon/w83l785ts.c
@@ -49,7 +49,7 @@
49 * Address is fully defined internally and cannot be changed. 49 * Address is fully defined internally and cannot be changed.
50 */ 50 */
51 51
52static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END }; 52static const unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END };
53 53
54/* 54/*
55 * Insmod parameters 55 * Insmod parameters
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c
index 1dbee4fa23ad..41e22ddb568a 100644
--- a/drivers/hwmon/w83l786ng.c
+++ b/drivers/hwmon/w83l786ng.c
@@ -35,7 +35,7 @@
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36 36
37/* Addresses to scan */ 37/* Addresses to scan */
38static unsigned short normal_i2c[] = { 0x2e, 0x2f, I2C_CLIENT_END }; 38static const unsigned short normal_i2c[] = { 0x2e, 0x2f, I2C_CLIENT_END };
39 39
40/* Insmod parameters */ 40/* Insmod parameters */
41I2C_CLIENT_INSMOD_1(w83l786ng); 41I2C_CLIENT_INSMOD_1(w83l786ng);
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 2598d29fd7a4..2b557bfd7f70 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -138,11 +138,13 @@ static const struct bits icr_bits[] = {
138 PXA_BIT(ICR_UR, "UR", "ur"), 138 PXA_BIT(ICR_UR, "UR", "ur"),
139}; 139};
140 140
141#ifdef CONFIG_I2C_PXA_SLAVE
141static void decode_ICR(unsigned int val) 142static void decode_ICR(unsigned int val)
142{ 143{
143 decode_bits(KERN_DEBUG "ICR", icr_bits, ARRAY_SIZE(icr_bits), val); 144 decode_bits(KERN_DEBUG "ICR", icr_bits, ARRAY_SIZE(icr_bits), val);
144 printk("\n"); 145 printk("\n");
145} 146}
147#endif
146 148
147static unsigned int i2c_debug = DEBUG; 149static unsigned int i2c_debug = DEBUG;
148 150
@@ -1122,7 +1124,7 @@ static int __init i2c_adap_pxa_init(void)
1122 1124
1123static void i2c_adap_pxa_exit(void) 1125static void i2c_adap_pxa_exit(void)
1124{ 1126{
1125 return platform_driver_unregister(&i2c_pxa_driver); 1127 platform_driver_unregister(&i2c_pxa_driver);
1126} 1128}
1127 1129
1128MODULE_LICENSE("GPL"); 1130MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 354c91d06a6d..310e497b5838 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1207,9 +1207,13 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1207end_request: 1207end_request:
1208 if (blk_pc_request(rq)) { 1208 if (blk_pc_request(rq)) {
1209 unsigned long flags; 1209 unsigned long flags;
1210 unsigned int dlen = rq->data_len;
1211
1212 if (dma)
1213 rq->data_len = 0;
1210 1214
1211 spin_lock_irqsave(&ide_lock, flags); 1215 spin_lock_irqsave(&ide_lock, flags);
1212 if (__blk_end_request(rq, 0, rq->data_len)) 1216 if (__blk_end_request(rq, 0, dlen))
1213 BUG(); 1217 BUG();
1214 HWGROUP(drive)->rq = NULL; 1218 HWGROUP(drive)->rq = NULL;
1215 spin_unlock_irqrestore(&ide_lock, flags); 1219 spin_unlock_irqrestore(&ide_lock, flags);
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index aed8b31ca561..8f5bed471050 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -397,6 +397,7 @@ static inline int idedisk_supports_lba48(const struct hd_driveid *id)
397static const struct drive_list_entry hpa_list[] = { 397static const struct drive_list_entry hpa_list[] = {
398 { "ST340823A", NULL }, 398 { "ST340823A", NULL },
399 { "ST320413A", NULL }, 399 { "ST320413A", NULL },
400 { "ST310211A", NULL },
400 { NULL, NULL } 401 { NULL, NULL }
401}; 402};
402 403
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
index 709b9e4d2871..9ebec08eefd9 100644
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -17,9 +17,6 @@ static int __init ide_generic_init(void)
17 u8 idx[MAX_HWIFS]; 17 u8 idx[MAX_HWIFS];
18 int i; 18 int i;
19 19
20 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
21 ide_get_lock(NULL, NULL); /* for atari only */
22
23 for (i = 0; i < MAX_HWIFS; i++) { 20 for (i = 0; i < MAX_HWIFS; i++) {
24 ide_hwif_t *hwif = &ide_hwifs[i]; 21 ide_hwif_t *hwif = &ide_hwifs[i];
25 22
@@ -31,9 +28,6 @@ static int __init ide_generic_init(void)
31 28
32 ide_device_add_all(idx, NULL); 29 ide_device_add_all(idx, NULL);
33 30
34 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
35 ide_release_lock(); /* for atari only */
36
37 return 0; 31 return 0;
38} 32}
39 33
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 4a8952a6c3da..477833f0daf5 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1229,7 +1229,7 @@ static int __init ide_setup(char *s)
1229 if (!strcmp(s, "ide=reverse")) { 1229 if (!strcmp(s, "ide=reverse")) {
1230 ide_scan_direction = 1; 1230 ide_scan_direction = 1;
1231 printk(" : Enabled support for IDE inverse scan order.\n"); 1231 printk(" : Enabled support for IDE inverse scan order.\n");
1232 return 1; 1232 goto obsolete_option;
1233 } 1233 }
1234#endif 1234#endif
1235 1235
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index f044048903b3..8949ce71bddc 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -54,7 +54,7 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
54 for (i = 1; i < 8; i++) 54 for (i = 1; i < 8; i++)
55 hw->io_ports[i] = ATA_HD_BASE + 1 + i * 4; 55 hw->io_ports[i] = ATA_HD_BASE + 1 + i * 4;
56 56
57 hw->io_ports[IDE_CONTROL_OFFSET] = ATA_HD_CONTROL; 57 hw->io_ports[IDE_CONTROL_OFFSET] = ATA_HD_BASE + ATA_HD_CONTROL;
58 58
59 hw->irq = IRQ_MFP_IDE; 59 hw->irq = IRQ_MFP_IDE;
60 hw->ack_intr = NULL; 60 hw->ack_intr = NULL;
@@ -84,7 +84,9 @@ static int __init falconide_init(void)
84 ide_init_port_data(hwif, index); 84 ide_init_port_data(hwif, index);
85 ide_init_port_hw(hwif, &hw); 85 ide_init_port_hw(hwif, &hw);
86 86
87 ide_get_lock(NULL, NULL);
87 ide_device_add(idx, NULL); 88 ide_device_add(idx, NULL);
89 ide_release_lock();
88 } 90 }
89 91
90 return 0; 92 return 0;
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 02d12c74764a..78ca68e60f97 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -21,18 +21,21 @@
21 * "Prefetch" mode bit OFF for ide disks and 21 * "Prefetch" mode bit OFF for ide disks and
22 * ON for anything else. 22 * ON for anything else.
23 * 23 *
24 * Version 0.08 Need to force prefetch for CDs and other non-disk
25 * devices. (not sure which devices exactly need
26 * prefetch)
24 * 27 *
25 * HT-6560B EIDE-controller support 28 * HT-6560B EIDE-controller support
26 * To activate controller support use kernel parameter "ide0=ht6560b". 29 * To activate controller support use kernel parameter "ide0=ht6560b".
27 * Use hdparm utility to enable PIO mode support. 30 * Use hdparm utility to enable PIO mode support.
28 * 31 *
29 * Author: Mikko Ala-Fossi <maf@iki.fi> 32 * Author: Mikko Ala-Fossi <maf@iki.fi>
30 * Jan Evert van Grootheest <janevert@iae.nl> 33 * Jan Evert van Grootheest <janevert@caiway.nl>
31 * 34 *
32 * Try: http://www.maf.iki.fi/~maf/ht6560b/ 35 * Try: http://www.maf.iki.fi/~maf/ht6560b/
33 */ 36 */
34 37
35#define HT6560B_VERSION "v0.07" 38#define HT6560B_VERSION "v0.08"
36 39
37#include <linux/module.h> 40#include <linux/module.h>
38#include <linux/types.h> 41#include <linux/types.h>
@@ -130,15 +133,20 @@ static void ht6560b_selectproc (ide_drive_t *drive)
130 u8 select, timing; 133 u8 select, timing;
131 134
132 local_irq_save(flags); 135 local_irq_save(flags);
133 136
134 select = HT_CONFIG(drive); 137 select = HT_CONFIG(drive);
135 timing = HT_TIMING(drive); 138 timing = HT_TIMING(drive);
136 139
140 /*
141 * Need to enforce prefetch sometimes because otherwise
142 * it'll hang (hard).
143 */
144 if (drive->media != ide_disk || !drive->present)
145 select |= HT_PREFETCH_MODE;
146
137 if (select != current_select || timing != current_timing) { 147 if (select != current_select || timing != current_timing) {
138 current_select = select; 148 current_select = select;
139 current_timing = timing; 149 current_timing = timing;
140 if (drive->media != ide_disk || !drive->present)
141 select |= HT_PREFETCH_MODE;
142 (void)inb(HT_CONFIG_PORT); 150 (void)inb(HT_CONFIG_PORT);
143 (void)inb(HT_CONFIG_PORT); 151 (void)inb(HT_CONFIG_PORT);
144 (void)inb(HT_CONFIG_PORT); 152 (void)inb(HT_CONFIG_PORT);
@@ -188,11 +196,12 @@ static int __init try_to_init_ht6560b(void)
188 outb(HT_TIMING_DEFAULT, 0x1f6); /* IDE_SELECT_REG */ 196 outb(HT_TIMING_DEFAULT, 0x1f6); /* IDE_SELECT_REG */
189 (void) inb(0x1f7); /* IDE_STATUS_REG */ 197 (void) inb(0x1f7); /* IDE_STATUS_REG */
190 198
191 printk("\nht6560b " HT6560B_VERSION 199 printk("ht6560b " HT6560B_VERSION
192 ": chipset detected and initialized" 200 ": chipset detected and initialized"
193#ifdef DEBUG 201#ifdef DEBUG
194 " with debug enabled" 202 " with debug enabled"
195#endif 203#endif
204 "\n"
196 ); 205 );
197 return 1; 206 return 1;
198} 207}
@@ -323,7 +332,7 @@ static const struct ide_port_info ht6560b_port_info __initdata = {
323 IDE_HFLAG_NO_DMA | 332 IDE_HFLAG_NO_DMA |
324 IDE_HFLAG_NO_AUTOTUNE | 333 IDE_HFLAG_NO_AUTOTUNE |
325 IDE_HFLAG_ABUSE_PREFETCH, 334 IDE_HFLAG_ABUSE_PREFETCH,
326 .pio_mask = ATA_PIO5, 335 .pio_mask = ATA_PIO4,
327}; 336};
328 337
329static int __init ht6560b_init(void) 338static int __init ht6560b_init(void)
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index a61e60737dc7..9a79098d9eb4 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -74,7 +74,7 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base,
74 for (i = 0; i < 8; i++) 74 for (i = 0; i < 8; i++)
75 hw->io_ports[i] = base + i * 4; 75 hw->io_ports[i] = base + i * 4;
76 76
77 hw->io_ports[IDE_CONTROL_OFFSET] = IDE_CONTROL; 77 hw->io_ports[IDE_CONTROL_OFFSET] = base + IDE_CONTROL;
78 78
79 hw->irq = irq; 79 hw->irq = irq;
80 hw->ack_intr = ack_intr; 80 hw->ack_intr = ack_intr;
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index f3f79f805813..9004e7521889 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -479,6 +479,7 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
479static const struct pci_device_id via_pci_tbl[] = { 479static const struct pci_device_id via_pci_tbl[] = {
480 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1), 0 }, 480 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C576_1), 0 },
481 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C586_1), 0 }, 481 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C586_1), 0 },
482 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_CX700_IDE), 0 },
482 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_6410), 1 }, 483 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_6410), 1 },
483 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_SATA_EIDE), 1 }, 484 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_SATA_EIDE), 1 },
484 { 0, }, 485 { 0, },
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 12ac3bfb4f9a..78c9eeb85634 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1254,7 +1254,7 @@ pmac_ide_macio_suspend(struct macio_dev *mdev, pm_message_t mesg)
1254 int rc = 0; 1254 int rc = 0;
1255 1255
1256 if (mesg.event != mdev->ofdev.dev.power.power_state.event 1256 if (mesg.event != mdev->ofdev.dev.power.power_state.event
1257 && mesg.event == PM_EVENT_SUSPEND) { 1257 && (mesg.event & PM_EVENT_SLEEP)) {
1258 rc = pmac_ide_do_suspend(hwif); 1258 rc = pmac_ide_do_suspend(hwif);
1259 if (rc == 0) 1259 if (rc == 0)
1260 mdev->ofdev.dev.power.power_state = mesg; 1260 mdev->ofdev.dev.power.power_state = mesg;
@@ -1364,7 +1364,7 @@ pmac_ide_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
1364 int rc = 0; 1364 int rc = 0;
1365 1365
1366 if (mesg.event != pdev->dev.power.power_state.event 1366 if (mesg.event != pdev->dev.power.power_state.event
1367 && mesg.event == PM_EVENT_SUSPEND) { 1367 && (mesg.event & PM_EVENT_SLEEP)) {
1368 rc = pmac_ide_do_suspend(hwif); 1368 rc = pmac_ide_do_suspend(hwif);
1369 if (rc == 0) 1369 if (rc == 0)
1370 pdev->dev.power.power_state = mesg; 1370 pdev->dev.power.power_state = mesg;
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 638b727d42e0..b10ade92efed 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3587,8 +3587,6 @@ static void cm_release_port_obj(struct kobject *obj)
3587{ 3587{
3588 struct cm_port *cm_port; 3588 struct cm_port *cm_port;
3589 3589
3590 printk(KERN_ERR "free cm port\n");
3591
3592 cm_port = container_of(obj, struct cm_port, port_obj); 3590 cm_port = container_of(obj, struct cm_port, port_obj);
3593 kfree(cm_port); 3591 kfree(cm_port);
3594} 3592}
@@ -3601,8 +3599,6 @@ static void cm_release_dev_obj(struct kobject *obj)
3601{ 3599{
3602 struct cm_device *cm_dev; 3600 struct cm_device *cm_dev;
3603 3601
3604 printk(KERN_ERR "free cm dev\n");
3605
3606 cm_dev = container_of(obj, struct cm_device, dev_obj); 3602 cm_dev = container_of(obj, struct cm_device, dev_obj);
3607 kfree(cm_dev); 3603 kfree(cm_dev);
3608} 3604}
@@ -3616,18 +3612,12 @@ struct class cm_class = {
3616}; 3612};
3617EXPORT_SYMBOL(cm_class); 3613EXPORT_SYMBOL(cm_class);
3618 3614
3619static void cm_remove_fs_obj(struct kobject *obj)
3620{
3621 kobject_put(obj->parent);
3622 kobject_put(obj);
3623}
3624
3625static int cm_create_port_fs(struct cm_port *port) 3615static int cm_create_port_fs(struct cm_port *port)
3626{ 3616{
3627 int i, ret; 3617 int i, ret;
3628 3618
3629 ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, 3619 ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type,
3630 kobject_get(&port->cm_dev->dev_obj), 3620 &port->cm_dev->dev_obj,
3631 "%d", port->port_num); 3621 "%d", port->port_num);
3632 if (ret) { 3622 if (ret) {
3633 kfree(port); 3623 kfree(port);
@@ -3637,7 +3627,7 @@ static int cm_create_port_fs(struct cm_port *port)
3637 for (i = 0; i < CM_COUNTER_GROUPS; i++) { 3627 for (i = 0; i < CM_COUNTER_GROUPS; i++) {
3638 ret = kobject_init_and_add(&port->counter_group[i].obj, 3628 ret = kobject_init_and_add(&port->counter_group[i].obj,
3639 &cm_counter_obj_type, 3629 &cm_counter_obj_type,
3640 kobject_get(&port->port_obj), 3630 &port->port_obj,
3641 "%s", counter_group_names[i]); 3631 "%s", counter_group_names[i]);
3642 if (ret) 3632 if (ret)
3643 goto error; 3633 goto error;
@@ -3647,8 +3637,8 @@ static int cm_create_port_fs(struct cm_port *port)
3647 3637
3648error: 3638error:
3649 while (i--) 3639 while (i--)
3650 cm_remove_fs_obj(&port->counter_group[i].obj); 3640 kobject_put(&port->counter_group[i].obj);
3651 cm_remove_fs_obj(&port->port_obj); 3641 kobject_put(&port->port_obj);
3652 return ret; 3642 return ret;
3653 3643
3654} 3644}
@@ -3658,9 +3648,9 @@ static void cm_remove_port_fs(struct cm_port *port)
3658 int i; 3648 int i;
3659 3649
3660 for (i = 0; i < CM_COUNTER_GROUPS; i++) 3650 for (i = 0; i < CM_COUNTER_GROUPS; i++)
3661 cm_remove_fs_obj(&port->counter_group[i].obj); 3651 kobject_put(&port->counter_group[i].obj);
3662 3652
3663 cm_remove_fs_obj(&port->port_obj); 3653 kobject_put(&port->port_obj);
3664} 3654}
3665 3655
3666static void cm_add_one(struct ib_device *device) 3656static void cm_add_one(struct ib_device *device)
@@ -3744,7 +3734,7 @@ error1:
3744 ib_unregister_mad_agent(port->mad_agent); 3734 ib_unregister_mad_agent(port->mad_agent);
3745 cm_remove_port_fs(port); 3735 cm_remove_port_fs(port);
3746 } 3736 }
3747 cm_remove_fs_obj(&cm_dev->dev_obj); 3737 kobject_put(&cm_dev->dev_obj);
3748} 3738}
3749 3739
3750static void cm_remove_one(struct ib_device *device) 3740static void cm_remove_one(struct ib_device *device)
@@ -3771,7 +3761,7 @@ static void cm_remove_one(struct ib_device *device)
3771 ib_unregister_mad_agent(port->mad_agent); 3761 ib_unregister_mad_agent(port->mad_agent);
3772 cm_remove_port_fs(port); 3762 cm_remove_port_fs(port);
3773 } 3763 }
3774 cm_remove_fs_obj(&cm_dev->dev_obj); 3764 kobject_put(&cm_dev->dev_obj);
3775} 3765}
3776 3766
3777static int __init ib_cm_init(void) 3767static int __init ib_cm_init(void)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 1eff1b2c0e08..34507daaf9b6 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1107,7 +1107,6 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
1107 event.param.ud.private_data_len = 1107 event.param.ud.private_data_len =
1108 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE - offset; 1108 IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE - offset;
1109 } else { 1109 } else {
1110 ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
1111 conn_id = cma_new_conn_id(&listen_id->id, ib_event); 1110 conn_id = cma_new_conn_id(&listen_id->id, ib_event);
1112 cma_set_req_event_data(&event, &ib_event->param.req_rcvd, 1111 cma_set_req_event_data(&event, &ib_event->param.req_rcvd,
1113 ib_event->private_data, offset); 1112 ib_event->private_data, offset);
@@ -1130,6 +1129,15 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
1130 1129
1131 ret = conn_id->id.event_handler(&conn_id->id, &event); 1130 ret = conn_id->id.event_handler(&conn_id->id, &event);
1132 if (!ret) { 1131 if (!ret) {
1132 /*
1133 * Acquire mutex to prevent user executing rdma_destroy_id()
1134 * while we're accessing the cm_id.
1135 */
1136 mutex_lock(&lock);
1137 if (cma_comp(conn_id, CMA_CONNECT) &&
1138 !cma_is_ud_ps(conn_id->id.ps))
1139 ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
1140 mutex_unlock(&lock);
1133 cma_enable_remove(conn_id); 1141 cma_enable_remove(conn_id);
1134 goto out; 1142 goto out;
1135 } 1143 }
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index c864ef70fdf9..5a4b2e65534b 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -686,8 +686,10 @@ int ib_device_register_sysfs(struct ib_device *device)
686 686
687 device->ports_parent = kobject_create_and_add("ports", 687 device->ports_parent = kobject_create_and_add("ports",
688 kobject_get(&class_dev->kobj)); 688 kobject_get(&class_dev->kobj));
689 if (!device->ports_parent) 689 if (!device->ports_parent) {
690 ret = -ENOMEM;
690 goto err_put; 691 goto err_put;
692 }
691 693
692 if (device->node_type == RDMA_NODE_IB_SWITCH) { 694 if (device->node_type == RDMA_NODE_IB_SWITCH) {
693 ret = add_port(device, 0); 695 ret = add_port(device, 0);
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index e9a08fa3dffe..320f2b6ddee6 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -35,6 +35,7 @@
35#include <linux/skbuff.h> 35#include <linux/skbuff.h>
36#include <linux/timer.h> 36#include <linux/timer.h>
37#include <linux/notifier.h> 37#include <linux/notifier.h>
38#include <linux/inetdevice.h>
38 39
39#include <net/neighbour.h> 40#include <net/neighbour.h>
40#include <net/netevent.h> 41#include <net/netevent.h>
@@ -1784,6 +1785,17 @@ err:
1784 return err; 1785 return err;
1785} 1786}
1786 1787
1788static int is_loopback_dst(struct iw_cm_id *cm_id)
1789{
1790 struct net_device *dev;
1791
1792 dev = ip_dev_find(&init_net, cm_id->remote_addr.sin_addr.s_addr);
1793 if (!dev)
1794 return 0;
1795 dev_put(dev);
1796 return 1;
1797}
1798
1787int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) 1799int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1788{ 1800{
1789 int err = 0; 1801 int err = 0;
@@ -1791,6 +1803,11 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1791 struct iwch_ep *ep; 1803 struct iwch_ep *ep;
1792 struct rtable *rt; 1804 struct rtable *rt;
1793 1805
1806 if (is_loopback_dst(cm_id)) {
1807 err = -ENOSYS;
1808 goto out;
1809 }
1810
1794 ep = alloc_ep(sizeof(*ep), GFP_KERNEL); 1811 ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
1795 if (!ep) { 1812 if (!ep) {
1796 printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __FUNCTION__); 1813 printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __FUNCTION__);
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index 7dc91a3e712d..fe2c2e94a5f8 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -199,7 +199,7 @@ struct ib_fmr *mlx4_ib_fmr_alloc(struct ib_pd *pd, int acc,
199 if (err) 199 if (err)
200 goto err_free; 200 goto err_free;
201 201
202 err = mlx4_mr_enable(to_mdev(pd->device)->dev, &fmr->mfmr.mr); 202 err = mlx4_fmr_enable(to_mdev(pd->device)->dev, &fmr->mfmr);
203 if (err) 203 if (err)
204 goto err_mr; 204 goto err_mr;
205 205
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 6bd9f1393349..1e1e336d3ef9 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -473,7 +473,7 @@ static void handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq,
473 if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd)) 473 if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd))
474 return; 474 return;
475 475
476 cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd); 476 be16_add_cpu(&cqe->db_cnt, -dbd);
477 cqe->wqe = new_wqe; 477 cqe->wqe = new_wqe;
478 cqe->syndrome = SYNDROME_WR_FLUSH_ERR; 478 cqe->syndrome = SYNDROME_WR_FLUSH_ERR;
479 479
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
index 1f4d27d7c16d..252db0822f6c 100644
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -542,6 +542,7 @@ struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev)
542 for (i = 0; i < npages; ++i) { 542 for (i = 0; i < npages; ++i) {
543 db_tab->page[i].refcount = 0; 543 db_tab->page[i].refcount = 0;
544 db_tab->page[i].uvirt = 0; 544 db_tab->page[i].uvirt = 0;
545 sg_init_table(&db_tab->page[i].mem, 1);
545 } 546 }
546 547
547 return db_tab; 548 return db_tab;
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 3b6985557cb2..3538da16e3fe 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -686,7 +686,7 @@ err_out_table:
686 mthca_table_put(dev, dev->mr_table.mpt_table, key); 686 mthca_table_put(dev, dev->mr_table.mpt_table, key);
687 687
688err_out_mpt_free: 688err_out_mpt_free:
689 mthca_free(&dev->mr_table.mpt_alloc, mr->ibmr.lkey); 689 mthca_free(&dev->mr_table.mpt_alloc, key);
690 return err; 690 return err;
691} 691}
692 692
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index b6cc265aa9a4..eee77da61935 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -148,14 +148,15 @@ static int nes_netdev_open(struct net_device *netdev)
148 struct nes_device *nesdev = nesvnic->nesdev; 148 struct nes_device *nesdev = nesvnic->nesdev;
149 int ret; 149 int ret;
150 int i; 150 int i;
151 struct nes_vnic *first_nesvnic; 151 struct nes_vnic *first_nesvnic = NULL;
152 u32 nic_active_bit; 152 u32 nic_active_bit;
153 u32 nic_active; 153 u32 nic_active;
154 struct list_head *list_pos, *list_temp;
154 155
155 assert(nesdev != NULL); 156 assert(nesdev != NULL);
156 157
157 first_nesvnic = list_entry(nesdev->nesadapter->nesvnic_list[nesdev->mac_index].next, 158 if (nesvnic->netdev_open == 1)
158 struct nes_vnic, list); 159 return 0;
159 160
160 if (netif_msg_ifup(nesvnic)) 161 if (netif_msg_ifup(nesvnic))
161 printk(KERN_INFO PFX "%s: enabling interface\n", netdev->name); 162 printk(KERN_INFO PFX "%s: enabling interface\n", netdev->name);
@@ -225,7 +226,18 @@ static int nes_netdev_open(struct net_device *netdev)
225 nes_write32(nesdev->regs+NES_CQE_ALLOC, NES_CQE_ALLOC_NOTIFY_NEXT | 226 nes_write32(nesdev->regs+NES_CQE_ALLOC, NES_CQE_ALLOC_NOTIFY_NEXT |
226 nesvnic->nic_cq.cq_number); 227 nesvnic->nic_cq.cq_number);
227 nes_read32(nesdev->regs+NES_CQE_ALLOC); 228 nes_read32(nesdev->regs+NES_CQE_ALLOC);
228 229 list_for_each_safe(list_pos, list_temp, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]) {
230 first_nesvnic = container_of(list_pos, struct nes_vnic, list);
231 if (first_nesvnic->netdev_open == 1)
232 break;
233 }
234 if (first_nesvnic->netdev_open == 0) {
235 nes_debug(NES_DBG_INIT, "Setting up MAC interrupt mask.\n");
236 nes_write_indexed(nesdev, NES_IDX_MAC_INT_MASK + (0x200 * nesdev->mac_index),
237 ~(NES_MAC_INT_LINK_STAT_CHG | NES_MAC_INT_XGMII_EXT |
238 NES_MAC_INT_TX_UNDERFLOW | NES_MAC_INT_TX_ERROR));
239 first_nesvnic = nesvnic;
240 }
229 if (first_nesvnic->linkup) { 241 if (first_nesvnic->linkup) {
230 /* Enable network packets */ 242 /* Enable network packets */
231 nesvnic->linkup = 1; 243 nesvnic->linkup = 1;
@@ -248,6 +260,8 @@ static int nes_netdev_stop(struct net_device *netdev)
248 struct nes_device *nesdev = nesvnic->nesdev; 260 struct nes_device *nesdev = nesvnic->nesdev;
249 u32 nic_active_mask; 261 u32 nic_active_mask;
250 u32 nic_active; 262 u32 nic_active;
263 struct nes_vnic *first_nesvnic = NULL;
264 struct list_head *list_pos, *list_temp;
251 265
252 nes_debug(NES_DBG_SHUTDOWN, "nesvnic=%p, nesdev=%p, netdev=%p %s\n", 266 nes_debug(NES_DBG_SHUTDOWN, "nesvnic=%p, nesdev=%p, netdev=%p %s\n",
253 nesvnic, nesdev, netdev, netdev->name); 267 nesvnic, nesdev, netdev, netdev->name);
@@ -260,9 +274,20 @@ static int nes_netdev_stop(struct net_device *netdev)
260 /* Disable network packets */ 274 /* Disable network packets */
261 napi_disable(&nesvnic->napi); 275 napi_disable(&nesvnic->napi);
262 netif_stop_queue(netdev); 276 netif_stop_queue(netdev);
263 if ((nesdev->netdev[0] == netdev) & (nesvnic->logical_port == nesdev->mac_index)) { 277 list_for_each_safe(list_pos, list_temp, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]) {
264 nes_write_indexed(nesdev, 278 first_nesvnic = container_of(list_pos, struct nes_vnic, list);
265 NES_IDX_MAC_INT_MASK+(0x200*nesdev->mac_index), 0xffffffff); 279 if ((first_nesvnic->netdev_open == 1) && (first_nesvnic != nesvnic))
280 break;
281 }
282
283 if (first_nesvnic->netdev_open == 0)
284 nes_write_indexed(nesdev, NES_IDX_MAC_INT_MASK+(0x200*nesdev->mac_index), 0xffffffff);
285 else if ((first_nesvnic != nesvnic) &&
286 (PCI_FUNC(first_nesvnic->nesdev->pcidev->devfn) != PCI_FUNC(nesvnic->nesdev->pcidev->devfn))) {
287 nes_write_indexed(nesdev, NES_IDX_MAC_INT_MASK + (0x200 * nesdev->mac_index), 0xffffffff);
288 nes_write_indexed(first_nesvnic->nesdev, NES_IDX_MAC_INT_MASK + (0x200 * first_nesvnic->nesdev->mac_index),
289 ~(NES_MAC_INT_LINK_STAT_CHG | NES_MAC_INT_XGMII_EXT |
290 NES_MAC_INT_TX_UNDERFLOW | NES_MAC_INT_TX_ERROR));
266 } 291 }
267 292
268 nic_active_mask = ~((u32)(1 << nesvnic->nic_index)); 293 nic_active_mask = ~((u32)(1 << nesvnic->nic_index));
@@ -859,7 +884,6 @@ void nes_netdev_set_multicast_list(struct net_device *netdev)
859 for (mc_index=0; mc_index < NES_MULTICAST_PF_MAX; mc_index++) { 884 for (mc_index=0; mc_index < NES_MULTICAST_PF_MAX; mc_index++) {
860 while (multicast_addr && nesvnic->mcrq_mcast_filter && ((mc_nic_index = nesvnic->mcrq_mcast_filter(nesvnic, multicast_addr->dmi_addr)) == 0)) 885 while (multicast_addr && nesvnic->mcrq_mcast_filter && ((mc_nic_index = nesvnic->mcrq_mcast_filter(nesvnic, multicast_addr->dmi_addr)) == 0))
861 multicast_addr = multicast_addr->next; 886 multicast_addr = multicast_addr->next;
862
863 if (mc_nic_index < 0) 887 if (mc_nic_index < 0)
864 mc_nic_index = nesvnic->nic_index; 888 mc_nic_index = nesvnic->nic_index;
865 if (multicast_addr) { 889 if (multicast_addr) {
@@ -908,7 +932,7 @@ static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu)
908 return -EINVAL; 932 return -EINVAL;
909 933
910 netdev->mtu = new_mtu; 934 netdev->mtu = new_mtu;
911 nesvnic->max_frame_size = new_mtu+ETH_HLEN; 935 nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN;
912 936
913 if (netdev->mtu > 1500) { 937 if (netdev->mtu > 1500) {
914 jumbomode=1; 938 jumbomode=1;
@@ -1470,10 +1494,15 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g
1470{ 1494{
1471 struct nes_vnic *nesvnic = netdev_priv(netdev); 1495 struct nes_vnic *nesvnic = netdev_priv(netdev);
1472 struct nes_device *nesdev = nesvnic->nesdev; 1496 struct nes_device *nesdev = nesvnic->nesdev;
1497 struct nes_adapter *nesadapter = nesdev->nesadapter;
1473 u32 u32temp; 1498 u32 u32temp;
1499 unsigned long flags;
1474 1500
1501 spin_lock_irqsave(&nesadapter->phy_lock, flags);
1475 nesvnic->vlan_grp = grp; 1502 nesvnic->vlan_grp = grp;
1476 1503
1504 nes_debug(NES_DBG_NETDEV, "%s: %s\n", __func__, netdev->name);
1505
1477 /* Enable/Disable VLAN Stripping */ 1506 /* Enable/Disable VLAN Stripping */
1478 u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG); 1507 u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG);
1479 if (grp) 1508 if (grp)
@@ -1482,6 +1511,7 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g
1482 u32temp |= 0x02000000; 1511 u32temp |= 0x02000000;
1483 1512
1484 nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp); 1513 nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp);
1514 spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
1485} 1515}
1486 1516
1487 1517
@@ -1540,7 +1570,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1540 nesvnic->msg_enable = netif_msg_init(debug, default_msg); 1570 nesvnic->msg_enable = netif_msg_init(debug, default_msg);
1541 nesvnic->netdev_index = nesdev->netdev_count; 1571 nesvnic->netdev_index = nesdev->netdev_count;
1542 nesvnic->perfect_filter_index = nesdev->nesadapter->netdev_count; 1572 nesvnic->perfect_filter_index = nesdev->nesadapter->netdev_count;
1543 nesvnic->max_frame_size = netdev->mtu+netdev->hard_header_len; 1573 nesvnic->max_frame_size = netdev->mtu + netdev->hard_header_len + VLAN_HLEN;
1544 1574
1545 curr_qp_map = nic_qp_mapping_per_function[PCI_FUNC(nesdev->pcidev->devfn)]; 1575 curr_qp_map = nic_qp_mapping_per_function[PCI_FUNC(nesdev->pcidev->devfn)];
1546 nesvnic->nic.qp_id = curr_qp_map[nesdev->netdev_count].qpid; 1576 nesvnic->nic.qp_id = curr_qp_map[nesdev->netdev_count].qpid;
@@ -1610,7 +1640,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1610 list_add_tail(&nesvnic->list, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]); 1640 list_add_tail(&nesvnic->list, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]);
1611 1641
1612 if ((nesdev->netdev_count == 0) && 1642 if ((nesdev->netdev_count == 0) &&
1613 (PCI_FUNC(nesdev->pcidev->devfn) == nesdev->mac_index)) { 1643 (PCI_FUNC(nesdev->pcidev->devfn) == nesdev->mac_index)) {
1614 nes_debug(NES_DBG_INIT, "Setting up PHY interrupt mask. Using register index 0x%04X\n", 1644 nes_debug(NES_DBG_INIT, "Setting up PHY interrupt mask. Using register index 0x%04X\n",
1615 NES_IDX_PHY_PCS_CONTROL_STATUS0+(0x200*(nesvnic->logical_port&1))); 1645 NES_IDX_PHY_PCS_CONTROL_STATUS0+(0x200*(nesvnic->logical_port&1)));
1616 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + 1646 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 +
@@ -1648,18 +1678,14 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1648 nesvnic->linkup = 1; 1678 nesvnic->linkup = 1;
1649 } 1679 }
1650 } 1680 }
1651 nes_debug(NES_DBG_INIT, "Setting up MAC interrupt mask.\n");
1652 /* clear the MAC interrupt status, assumes direct logical to physical mapping */ 1681 /* clear the MAC interrupt status, assumes direct logical to physical mapping */
1653 u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS+(0x200*nesvnic->logical_port)); 1682 u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index));
1654 nes_debug(NES_DBG_INIT, "Phy interrupt status = 0x%X.\n", u32temp); 1683 nes_debug(NES_DBG_INIT, "Phy interrupt status = 0x%X.\n", u32temp);
1655 nes_write_indexed(nesdev, NES_IDX_MAC_INT_STATUS+(0x200*nesvnic->logical_port), u32temp); 1684 nes_write_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index), u32temp);
1656 1685
1657 if (nesdev->nesadapter->phy_type[nesvnic->logical_port] != NES_PHY_TYPE_IRIS) 1686 if (nesdev->nesadapter->phy_type[nesdev->mac_index] != NES_PHY_TYPE_IRIS)
1658 nes_init_phy(nesdev); 1687 nes_init_phy(nesdev);
1659 1688
1660 nes_write_indexed(nesdev, NES_IDX_MAC_INT_MASK+(0x200*nesvnic->logical_port),
1661 ~(NES_MAC_INT_LINK_STAT_CHG | NES_MAC_INT_XGMII_EXT |
1662 NES_MAC_INT_TX_UNDERFLOW | NES_MAC_INT_TX_ERROR));
1663 } 1689 }
1664 1690
1665 return netdev; 1691 return netdev;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index ffd4b425567f..4dafbe16e82a 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1337,7 +1337,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
1337 NES_MAX_USER_WQ_REGIONS, nes_ucontext->first_free_wq); 1337 NES_MAX_USER_WQ_REGIONS, nes_ucontext->first_free_wq);
1338 /* nes_debug(NES_DBG_QP, "find_first_zero_biton wqs returned %u\n", 1338 /* nes_debug(NES_DBG_QP, "find_first_zero_biton wqs returned %u\n",
1339 nespd->mmap_db_index); */ 1339 nespd->mmap_db_index); */
1340 if (nesqp->mmap_sq_db_index > NES_MAX_USER_WQ_REGIONS) { 1340 if (nesqp->mmap_sq_db_index >= NES_MAX_USER_WQ_REGIONS) {
1341 nes_debug(NES_DBG_QP, 1341 nes_debug(NES_DBG_QP,
1342 "db index > max user regions, failing create QP\n"); 1342 "db index > max user regions, failing create QP\n");
1343 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); 1343 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index f9b7caa54143..054fab8e27a0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -209,7 +209,6 @@ struct ipoib_cm_tx {
209 unsigned tx_tail; 209 unsigned tx_tail;
210 unsigned long flags; 210 unsigned long flags;
211 u32 mtu; 211 u32 mtu;
212 struct ib_wc ibwc[IPOIB_NUM_WC];
213}; 212};
214 213
215struct ipoib_cm_rx_buf { 214struct ipoib_cm_rx_buf {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 7dd2ec473d24..52b1bebfa744 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -824,7 +824,6 @@ void ipoib_cm_dev_stop(struct net_device *dev)
824 struct ipoib_dev_priv *priv = netdev_priv(dev); 824 struct ipoib_dev_priv *priv = netdev_priv(dev);
825 struct ipoib_cm_rx *p; 825 struct ipoib_cm_rx *p;
826 unsigned long begin; 826 unsigned long begin;
827 LIST_HEAD(list);
828 int ret; 827 int ret;
829 828
830 if (!IPOIB_CM_SUPPORTED(dev->dev_addr) || !priv->cm.id) 829 if (!IPOIB_CM_SUPPORTED(dev->dev_addr) || !priv->cm.id)
@@ -857,9 +856,12 @@ void ipoib_cm_dev_stop(struct net_device *dev)
857 /* 856 /*
858 * assume the HW is wedged and just free up everything. 857 * assume the HW is wedged and just free up everything.
859 */ 858 */
860 list_splice_init(&priv->cm.rx_flush_list, &list); 859 list_splice_init(&priv->cm.rx_flush_list,
861 list_splice_init(&priv->cm.rx_error_list, &list); 860 &priv->cm.rx_reap_list);
862 list_splice_init(&priv->cm.rx_drain_list, &list); 861 list_splice_init(&priv->cm.rx_error_list,
862 &priv->cm.rx_reap_list);
863 list_splice_init(&priv->cm.rx_drain_list,
864 &priv->cm.rx_reap_list);
863 break; 865 break;
864 } 866 }
865 spin_unlock_irq(&priv->lock); 867 spin_unlock_irq(&priv->lock);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 9d3e778dc56d..08c4396cf418 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -780,6 +780,7 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, int pkey_event)
780 if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { 780 if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) {
781 clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); 781 clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
782 ipoib_ib_dev_down(dev, 0); 782 ipoib_ib_dev_down(dev, 0);
783 ipoib_ib_dev_stop(dev, 0);
783 ipoib_pkey_dev_delay_open(dev); 784 ipoib_pkey_dev_delay_open(dev);
784 return; 785 return;
785 } 786 }
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 936788272a5f..bd8a1d14b45d 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -416,7 +416,6 @@ static void poll_media_bay(struct media_bay_info* bay)
416 } 416 }
417} 417}
418 418
419#ifdef CONFIG_MAC_FLOPPY
420int check_media_bay(struct device_node *which_bay, int what) 419int check_media_bay(struct device_node *which_bay, int what)
421{ 420{
422 int i; 421 int i;
@@ -431,7 +430,6 @@ int check_media_bay(struct device_node *which_bay, int what)
431 return -ENODEV; 430 return -ENODEV;
432} 431}
433EXPORT_SYMBOL(check_media_bay); 432EXPORT_SYMBOL(check_media_bay);
434#endif /* CONFIG_MAC_FLOPPY */
435 433
436#ifdef CONFIG_BLK_DEV_IDE_PMAC 434#ifdef CONFIG_BLK_DEV_IDE_PMAC
437int check_media_bay_by_base(unsigned long base, int what) 435int check_media_bay_by_base(unsigned long base, int what)
@@ -700,7 +698,8 @@ static int media_bay_suspend(struct macio_dev *mdev, pm_message_t state)
700{ 698{
701 struct media_bay_info *bay = macio_get_drvdata(mdev); 699 struct media_bay_info *bay = macio_get_drvdata(mdev);
702 700
703 if (state.event != mdev->ofdev.dev.power.power_state.event && state.event == PM_EVENT_SUSPEND) { 701 if (state.event != mdev->ofdev.dev.power.power_state.event
702 && (state.event & PM_EVENT_SLEEP)) {
704 down(&bay->lock); 703 down(&bay->lock);
705 bay->sleeping = 1; 704 bay->sleeping = 1;
706 set_mb_power(bay, 0); 705 set_mb_power(bay, 0);
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index a0585fb6da94..7aeceedcf7d4 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -206,16 +206,10 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page)
206/* copy the pathname of a file to a buffer */ 206/* copy the pathname of a file to a buffer */
207char *file_path(struct file *file, char *buf, int count) 207char *file_path(struct file *file, char *buf, int count)
208{ 208{
209 struct dentry *d;
210 struct vfsmount *v;
211
212 if (!buf) 209 if (!buf)
213 return NULL; 210 return NULL;
214 211
215 d = file->f_path.dentry; 212 buf = d_path(&file->f_path, buf, count);
216 v = file->f_path.mnt;
217
218 buf = d_path(d, v, buf, count);
219 213
220 return IS_ERR(buf) ? NULL : buf; 214 return IS_ERR(buf) ? NULL : buf;
221} 215}
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index edc057f5cdcc..51605870f898 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -124,7 +124,7 @@ enum dm_raid1_error {
124struct mirror { 124struct mirror {
125 struct mirror_set *ms; 125 struct mirror_set *ms;
126 atomic_t error_count; 126 atomic_t error_count;
127 uint32_t error_type; 127 unsigned long error_type;
128 struct dm_dev *dev; 128 struct dm_dev *dev;
129 sector_t offset; 129 sector_t offset;
130}; 130};
@@ -1695,14 +1695,15 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio,
1695 * information for a retry or there was no other 1695 * information for a retry or there was no other
1696 * mirror in-sync. 1696 * mirror in-sync.
1697 */ 1697 */
1698 DMERR_LIMIT("Mirror read failed from %s.", 1698 DMERR_LIMIT("Mirror read failed.");
1699 m->dev->name);
1700 return -EIO; 1699 return -EIO;
1701 } 1700 }
1701
1702 m = read_record->m;
1703
1702 DMERR("Mirror read failed from %s. Trying alternative device.", 1704 DMERR("Mirror read failed from %s. Trying alternative device.",
1703 m->dev->name); 1705 m->dev->name);
1704 1706
1705 m = read_record->m;
1706 fail_mirror(m, DM_RAID1_READ_ERROR); 1707 fail_mirror(m, DM_RAID1_READ_ERROR);
1707 1708
1708 /* 1709 /*
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index f16062982383..e75b1437b58b 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -361,7 +361,7 @@ static int lookup_device(const char *path, dev_t *dev)
361 if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd))) 361 if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd)))
362 return r; 362 return r;
363 363
364 inode = nd.dentry->d_inode; 364 inode = nd.path.dentry->d_inode;
365 if (!inode) { 365 if (!inode) {
366 r = -ENOENT; 366 r = -ENOENT;
367 goto out; 367 goto out;
@@ -375,7 +375,7 @@ static int lookup_device(const char *path, dev_t *dev)
375 *dev = inode->i_rdev; 375 *dev = inode->i_rdev;
376 376
377 out: 377 out:
378 path_release(&nd); 378 path_put(&nd.path);
379 return r; 379 return r;
380} 380}
381 381
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 5fc326d3970e..7da6ec244e15 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5197,8 +5197,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
5197 chunk_kb ? "KB" : "B"); 5197 chunk_kb ? "KB" : "B");
5198 if (bitmap->file) { 5198 if (bitmap->file) {
5199 seq_printf(seq, ", file: "); 5199 seq_printf(seq, ", file: ");
5200 seq_path(seq, bitmap->file->f_path.mnt, 5200 seq_path(seq, &bitmap->file->f_path, " \t\n");
5201 bitmap->file->f_path.dentry," \t\n");
5202 } 5201 }
5203 5202
5204 seq_printf(seq, "\n"); 5203 seq_printf(seq, "\n");
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 8f4a45346de7..11950698a2e7 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -25,11 +25,16 @@ config VIDEO_DEV
25 To compile this driver as a module, choose M here: the 25 To compile this driver as a module, choose M here: the
26 module will be called videodev. 26 module will be called videodev.
27 27
28config VIDEO_V4L2_COMMON
29 tristate
30 depends on (I2C || I2C=n) && VIDEO_DEV
31 default (I2C || I2C=n) && VIDEO_DEV
32
28config VIDEO_V4L1 33config VIDEO_V4L1
29 bool "Enable Video For Linux API 1 (DEPRECATED)" 34 bool "Enable Video For Linux API 1 (DEPRECATED)"
30 depends on VIDEO_DEV 35 depends on VIDEO_DEV && VIDEO_V4L2_COMMON
36 default VIDEO_DEV && VIDEO_V4L2_COMMON
31 select VIDEO_V4L1_COMPAT 37 select VIDEO_V4L1_COMPAT
32 default y
33 ---help--- 38 ---help---
34 Enables a compatibility API used by most V4L2 devices to allow 39 Enables a compatibility API used by most V4L2 devices to allow
35 its usage with legacy applications that supports only V4L1 api. 40 its usage with legacy applications that supports only V4L1 api.
@@ -39,7 +44,7 @@ config VIDEO_V4L1
39config VIDEO_V4L1_COMPAT 44config VIDEO_V4L1_COMPAT
40 bool "Enable Video For Linux API 1 compatible Layer" 45 bool "Enable Video For Linux API 1 compatible Layer"
41 depends on VIDEO_DEV 46 depends on VIDEO_DEV
42 default y 47 default VIDEO_DEV
43 ---help--- 48 ---help---
44 This api were developed to be used at Kernel 2.2 and 2.4, but 49 This api were developed to be used at Kernel 2.2 and 2.4, but
45 lacks support for several video standards. There are several 50 lacks support for several video standards. There are several
@@ -55,8 +60,8 @@ config VIDEO_V4L1_COMPAT
55 60
56config VIDEO_V4L2 61config VIDEO_V4L2
57 bool 62 bool
58 depends on VIDEO_DEV 63 depends on VIDEO_DEV && VIDEO_V4L2_COMMON
59 default y 64 default VIDEO_DEV && VIDEO_V4L2_COMMON
60 65
61source "drivers/media/video/Kconfig" 66source "drivers/media/video/Kconfig"
62 67
@@ -93,7 +98,7 @@ if VIDEO_TUNER_CUSTOMIZE
93 98
94config TUNER_XC2028 99config TUNER_XC2028
95 tristate "XCeive xc2028/xc3028 tuners" 100 tristate "XCeive xc2028/xc3028 tuners"
96 depends on I2C 101 depends on I2C && FW_LOADER
97 default m if VIDEO_TUNER_CUSTOMIZE 102 default m if VIDEO_TUNER_CUSTOMIZE
98 help 103 help
99 Say Y here to include support for the xc2028/xc3028 tuners. 104 Say Y here to include support for the xc2028/xc3028 tuners.
@@ -180,7 +185,6 @@ config VIDEO_TVEEPROM
180 185
181config DAB 186config DAB
182 boolean "DAB adapters" 187 boolean "DAB adapters"
183 default y
184 ---help--- 188 ---help---
185 Allow selecting support for for Digital Audio Broadcasting (DAB) 189 Allow selecting support for for Digital Audio Broadcasting (DAB)
186 Receiver adapters. 190 Receiver adapters.
diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig
index 06ca75911b7f..769c6f8142d2 100644
--- a/drivers/media/common/Kconfig
+++ b/drivers/media/common/Kconfig
@@ -4,6 +4,6 @@ config VIDEO_SAA7146
4 4
5config VIDEO_SAA7146_VV 5config VIDEO_SAA7146_VV
6 tristate 6 tristate
7 depends on VIDEO_DEV 7 depends on VIDEO_V4L2
8 select VIDEOBUF_DMA_SG 8 select VIDEOBUF_DMA_SG
9 select VIDEO_SAA7146 9 select VIDEO_SAA7146
diff --git a/drivers/media/common/ir-keymaps.c b/drivers/media/common/ir-keymaps.c
index a4a937c90534..2ab5a120470d 100644
--- a/drivers/media/common/ir-keymaps.c
+++ b/drivers/media/common/ir-keymaps.c
@@ -1987,3 +1987,49 @@ IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE] = {
1987}; 1987};
1988 1988
1989EXPORT_SYMBOL_GPL(ir_codes_behold); 1989EXPORT_SYMBOL_GPL(ir_codes_behold);
1990
1991/*
1992 * Remote control for the Genius TVGO A11MCE
1993 * Adrian Pardini <pardo.bsso@gmail.com>
1994 */
1995IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE] = {
1996 /* Keys 0 to 9 */
1997 [0x48] = KEY_0,
1998 [0x09] = KEY_1,
1999 [0x1d] = KEY_2,
2000 [0x1f] = KEY_3,
2001 [0x19] = KEY_4,
2002 [0x1b] = KEY_5,
2003 [0x11] = KEY_6,
2004 [0x17] = KEY_7,
2005 [0x12] = KEY_8,
2006 [0x16] = KEY_9,
2007
2008 [0x54] = KEY_RECORD, /* recording */
2009 [0x06] = KEY_MUTE, /* mute */
2010 [0x10] = KEY_POWER,
2011 [0x40] = KEY_LAST, /* recall */
2012 [0x4c] = KEY_CHANNELUP, /* channel / program + */
2013 [0x00] = KEY_CHANNELDOWN, /* channel / program - */
2014 [0x0d] = KEY_VOLUMEUP,
2015 [0x15] = KEY_VOLUMEDOWN,
2016 [0x4d] = KEY_OK, /* also labeled as Pause */
2017 [0x1c] = KEY_ZOOM, /* full screen and Stop*/
2018 [0x02] = KEY_MODE, /* AV Source or Rewind*/
2019 [0x04] = KEY_LIST, /* -/-- */
2020 /* small arrows above numbers */
2021 [0x1a] = KEY_NEXT, /* also Fast Forward */
2022 [0x0e] = KEY_PREVIOUS, /* also Rewind */
2023 /* these are in a rather non standard layout and have
2024 an alternate name written */
2025 [0x1e] = KEY_UP, /* Video Setting */
2026 [0x0a] = KEY_DOWN, /* Video Default */
2027 [0x05] = KEY_LEFT, /* Snapshot */
2028 [0x0c] = KEY_RIGHT, /* Hide Panel */
2029 /* Four buttons without label */
2030 [0x49] = KEY_RED,
2031 [0x0b] = KEY_GREEN,
2032 [0x13] = KEY_YELLOW,
2033 [0x50] = KEY_BLUE,
2034};
2035EXPORT_SYMBOL_GPL(ir_codes_genius_tvgo_a11mce);
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c
index c32dda973e92..bfbd5a841ebf 100644
--- a/drivers/media/common/saa7146_vbi.c
+++ b/drivers/media/common/saa7146_vbi.c
@@ -413,7 +413,6 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
413 V4L2_FIELD_SEQ_TB, // FIXME: does this really work? 413 V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
414 sizeof(struct saa7146_buf), 414 sizeof(struct saa7146_buf),
415 file); 415 file);
416 mutex_init(&fh->vbi_q.lock);
417 416
418 init_timer(&fh->vbi_read_timeout); 417 init_timer(&fh->vbi_read_timeout);
419 fh->vbi_read_timeout.function = vbi_read_timeout; 418 fh->vbi_read_timeout.function = vbi_read_timeout;
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index c31ab480d8e1..66fdbd0e6a6d 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -1417,8 +1417,6 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
1417 sizeof(struct saa7146_buf), 1417 sizeof(struct saa7146_buf),
1418 file); 1418 file);
1419 1419
1420 mutex_init(&fh->video_q.lock);
1421
1422 return 0; 1420 return 0;
1423} 1421}
1424 1422
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
index c7bbb40223f5..56d8fab688bb 100644
--- a/drivers/media/dvb/bt8xx/bt878.c
+++ b/drivers/media/dvb/bt8xx/bt878.c
@@ -75,7 +75,11 @@ EXPORT_SYMBOL(bt878);
75#if defined(dprintk) 75#if defined(dprintk)
76#undef dprintk 76#undef dprintk
77#endif 77#endif
78#define dprintk if(bt878_debug) printk 78#define dprintk(fmt, arg...) \
79 do { \
80 if (bt878_debug) \
81 printk(KERN_DEBUG fmt, ##arg); \
82 } while (0)
79 83
80static void bt878_mem_free(struct bt878 *bt) 84static void bt878_mem_free(struct bt878 *bt)
81{ 85{
@@ -154,7 +158,7 @@ static int bt878_make_risc(struct bt878 *bt)
154 } 158 }
155 159
156 if (bt->line_count > 255) { 160 if (bt->line_count > 255) {
157 printk("bt878: buffer size error!\n"); 161 printk(KERN_ERR "bt878: buffer size error!\n");
158 return -EINVAL; 162 return -EINVAL;
159 } 163 }
160 return 0; 164 return 0;
@@ -285,7 +289,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
285 289
286 if (astat & (BT878_ASCERR | BT878_AOCERR)) { 290 if (astat & (BT878_ASCERR | BT878_AOCERR)) {
287 if (bt878_verbose) { 291 if (bt878_verbose) {
288 printk("bt878(%d): irq%s%s risc_pc=%08x\n", 292 printk(KERN_INFO
293 "bt878(%d): irq%s%s risc_pc=%08x\n",
289 bt->nr, 294 bt->nr,
290 (astat & BT878_ASCERR) ? " SCERR" : 295 (astat & BT878_ASCERR) ? " SCERR" :
291 "", 296 "",
@@ -295,8 +300,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
295 } 300 }
296 if (astat & (BT878_APABORT | BT878_ARIPERR | BT878_APPERR)) { 301 if (astat & (BT878_APABORT | BT878_ARIPERR | BT878_APPERR)) {
297 if (bt878_verbose) { 302 if (bt878_verbose) {
298 printk 303 printk(KERN_INFO
299 ("bt878(%d): irq%s%s%s risc_pc=%08x\n", 304 "bt878(%d): irq%s%s%s risc_pc=%08x\n",
300 bt->nr, 305 bt->nr,
301 (astat & BT878_APABORT) ? " PABORT" : 306 (astat & BT878_APABORT) ? " PABORT" :
302 "", 307 "",
@@ -308,8 +313,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
308 } 313 }
309 if (astat & (BT878_AFDSR | BT878_AFTRGT | BT878_AFBUS)) { 314 if (astat & (BT878_AFDSR | BT878_AFTRGT | BT878_AFBUS)) {
310 if (bt878_verbose) { 315 if (bt878_verbose) {
311 printk 316 printk(KERN_INFO
312 ("bt878(%d): irq%s%s%s risc_pc=%08x\n", 317 "bt878(%d): irq%s%s%s risc_pc=%08x\n",
313 bt->nr, 318 bt->nr,
314 (astat & BT878_AFDSR) ? " FDSR" : "", 319 (astat & BT878_AFDSR) ? " FDSR" : "",
315 (astat & BT878_AFTRGT) ? " FTRGT" : 320 (astat & BT878_AFTRGT) ? " FTRGT" :
@@ -510,7 +515,7 @@ static int __devinit bt878_probe(struct pci_dev *dev,
510*/ 515*/
511 516
512 if ((result = bt878_mem_alloc(bt))) { 517 if ((result = bt878_mem_alloc(bt))) {
513 printk("bt878: failed to allocate memory!\n"); 518 printk(KERN_ERR "bt878: failed to allocate memory!\n");
514 goto fail2; 519 goto fail2;
515 } 520 }
516 521
@@ -536,7 +541,7 @@ static void __devexit bt878_remove(struct pci_dev *pci_dev)
536 struct bt878 *bt = pci_get_drvdata(pci_dev); 541 struct bt878 *bt = pci_get_drvdata(pci_dev);
537 542
538 if (bt878_verbose) 543 if (bt878_verbose)
539 printk("bt878(%d): unloading\n", bt->nr); 544 printk(KERN_INFO "bt878(%d): unloading\n", bt->nr);
540 545
541 /* turn off all capturing, DMA and IRQs */ 546 /* turn off all capturing, DMA and IRQs */
542 btand(~0x13, BT878_AGPIO_DMA_CTL); 547 btand(~0x13, BT878_AGPIO_DMA_CTL);
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c
index 88dc4367a2e3..3b9da9c25c6e 100644
--- a/drivers/media/dvb/dvb-usb/ttusb2.c
+++ b/drivers/media/dvb/dvb-usb/ttusb2.c
@@ -144,6 +144,7 @@ static int ttusb2_power_ctrl(struct dvb_usb_device *d, int onoff)
144static struct tda10086_config tda10086_config = { 144static struct tda10086_config tda10086_config = {
145 .demod_address = 0x0e, 145 .demod_address = 0x0e,
146 .invert = 0, 146 .invert = 0,
147 .diseqc_tone = 1,
147}; 148};
148 149
149static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) 150static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap)
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c
index 9d26ace65151..0d2b69a99ad4 100644
--- a/drivers/media/dvb/frontends/tda10086.c
+++ b/drivers/media/dvb/frontends/tda10086.c
@@ -106,9 +106,12 @@ static int tda10086_write_mask(struct tda10086_state *state, int reg, int mask,
106static int tda10086_init(struct dvb_frontend* fe) 106static int tda10086_init(struct dvb_frontend* fe)
107{ 107{
108 struct tda10086_state* state = fe->demodulator_priv; 108 struct tda10086_state* state = fe->demodulator_priv;
109 u8 t22k_off = 0x80;
109 110
110 dprintk ("%s\n", __FUNCTION__); 111 dprintk ("%s\n", __FUNCTION__);
111 112
113 if (state->config->diseqc_tone)
114 t22k_off = 0;
112 // reset 115 // reset
113 tda10086_write_byte(state, 0x00, 0x00); 116 tda10086_write_byte(state, 0x00, 0x00);
114 msleep(10); 117 msleep(10);
@@ -158,7 +161,7 @@ static int tda10086_init(struct dvb_frontend* fe)
158 tda10086_write_byte(state, 0x3d, 0x80); 161 tda10086_write_byte(state, 0x3d, 0x80);
159 162
160 // setup SEC 163 // setup SEC
161 tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone 164 tda10086_write_byte(state, 0x36, t22k_off); // all SEC off, 22k tone
162 tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency 165 tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency
163 tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } 166 tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // }
164 167
@@ -180,16 +183,20 @@ static void tda10086_diseqc_wait(struct tda10086_state *state)
180static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) 183static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
181{ 184{
182 struct tda10086_state* state = fe->demodulator_priv; 185 struct tda10086_state* state = fe->demodulator_priv;
186 u8 t22k_off = 0x80;
183 187
184 dprintk ("%s\n", __FUNCTION__); 188 dprintk ("%s\n", __FUNCTION__);
185 189
190 if (state->config->diseqc_tone)
191 t22k_off = 0;
192
186 switch (tone) { 193 switch (tone) {
187 case SEC_TONE_OFF: 194 case SEC_TONE_OFF:
188 tda10086_write_byte(state, 0x36, 0x80); 195 tda10086_write_byte(state, 0x36, t22k_off);
189 break; 196 break;
190 197
191 case SEC_TONE_ON: 198 case SEC_TONE_ON:
192 tda10086_write_byte(state, 0x36, 0x81); 199 tda10086_write_byte(state, 0x36, 0x01 + t22k_off);
193 break; 200 break;
194 } 201 }
195 202
@@ -202,9 +209,13 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
202 struct tda10086_state* state = fe->demodulator_priv; 209 struct tda10086_state* state = fe->demodulator_priv;
203 int i; 210 int i;
204 u8 oldval; 211 u8 oldval;
212 u8 t22k_off = 0x80;
205 213
206 dprintk ("%s\n", __FUNCTION__); 214 dprintk ("%s\n", __FUNCTION__);
207 215
216 if (state->config->diseqc_tone)
217 t22k_off = 0;
218
208 if (cmd->msg_len > 6) 219 if (cmd->msg_len > 6)
209 return -EINVAL; 220 return -EINVAL;
210 oldval = tda10086_read_byte(state, 0x36); 221 oldval = tda10086_read_byte(state, 0x36);
@@ -212,7 +223,8 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
212 for(i=0; i< cmd->msg_len; i++) { 223 for(i=0; i< cmd->msg_len; i++) {
213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]); 224 tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
214 } 225 }
215 tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4)); 226 tda10086_write_byte(state, 0x36, (0x08 + t22k_off)
227 | ((cmd->msg_len - 1) << 4));
216 228
217 tda10086_diseqc_wait(state); 229 tda10086_diseqc_wait(state);
218 230
@@ -225,16 +237,20 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic
225{ 237{
226 struct tda10086_state* state = fe->demodulator_priv; 238 struct tda10086_state* state = fe->demodulator_priv;
227 u8 oldval = tda10086_read_byte(state, 0x36); 239 u8 oldval = tda10086_read_byte(state, 0x36);
240 u8 t22k_off = 0x80;
228 241
229 dprintk ("%s\n", __FUNCTION__); 242 dprintk ("%s\n", __FUNCTION__);
230 243
244 if (state->config->diseqc_tone)
245 t22k_off = 0;
246
231 switch(minicmd) { 247 switch(minicmd) {
232 case SEC_MINI_A: 248 case SEC_MINI_A:
233 tda10086_write_byte(state, 0x36, 0x84); 249 tda10086_write_byte(state, 0x36, 0x04 + t22k_off);
234 break; 250 break;
235 251
236 case SEC_MINI_B: 252 case SEC_MINI_B:
237 tda10086_write_byte(state, 0x36, 0x86); 253 tda10086_write_byte(state, 0x36, 0x06 + t22k_off);
238 break; 254 break;
239 } 255 }
240 256
diff --git a/drivers/media/dvb/frontends/tda10086.h b/drivers/media/dvb/frontends/tda10086.h
index ed584a8f4a89..eeceaeee78ff 100644
--- a/drivers/media/dvb/frontends/tda10086.h
+++ b/drivers/media/dvb/frontends/tda10086.h
@@ -33,6 +33,9 @@ struct tda10086_config
33 33
34 /* does the "inversion" need inverted? */ 34 /* does the "inversion" need inverted? */
35 u8 invert; 35 u8 invert;
36
37 /* do we need the diseqc signal with carrier? */
38 u8 diseqc_tone;
36}; 39};
37 40
38#if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) 41#if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE))
diff --git a/drivers/media/dvb/frontends/tda18271-common.c b/drivers/media/dvb/frontends/tda18271-common.c
index cebb6b90b7e0..bca570990613 100644
--- a/drivers/media/dvb/frontends/tda18271-common.c
+++ b/drivers/media/dvb/frontends/tda18271-common.c
@@ -171,7 +171,7 @@ int tda18271_read_extended(struct dvb_frontend *fe)
171 if (ret != 2) 171 if (ret != 2)
172 tda_err("ERROR: i2c_transfer returned: %d\n", ret); 172 tda_err("ERROR: i2c_transfer returned: %d\n", ret);
173 173
174 for (i = 0; i <= TDA18271_NUM_REGS; i++) { 174 for (i = 0; i < TDA18271_NUM_REGS; i++) {
175 /* don't update write-only registers */ 175 /* don't update write-only registers */
176 if ((i != R_EB9) && 176 if ((i != R_EB9) &&
177 (i != R_EB16) && 177 (i != R_EB16) &&
diff --git a/drivers/media/dvb/frontends/xc5000.h b/drivers/media/dvb/frontends/xc5000.h
index e0e84562aed1..32a5f1c86a16 100644
--- a/drivers/media/dvb/frontends/xc5000.h
+++ b/drivers/media/dvb/frontends/xc5000.h
@@ -45,7 +45,8 @@ struct xc5000_config {
45/* xc5000 callback command */ 45/* xc5000 callback command */
46#define XC5000_TUNER_RESET 0 46#define XC5000_TUNER_RESET 0
47 47
48#if defined(CONFIG_DVB_TUNER_XC5000) || defined(CONFIG_DVB_TUNER_XC5000_MODULE) 48#if defined(CONFIG_DVB_TUNER_XC5000) || \
49 (defined(CONFIG_DVB_TUNER_XC5000_MODULE) && defined(MODULE))
49extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, 50extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe,
50 struct i2c_adapter *i2c, 51 struct i2c_adapter *i2c,
51 struct xc5000_config *cfg); 52 struct xc5000_config *cfg);
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c
index aef6e36d7c5c..3e6b650fbb81 100644
--- a/drivers/media/dvb/ttpci/av7110_av.c
+++ b/drivers/media/dvb/ttpci/av7110_av.c
@@ -966,6 +966,7 @@ static u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x
966static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock) 966static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock)
967{ 967{
968 int i, n; 968 int i, n;
969 int progressive = 0;
969 970
970 dprintk(2, "av7110:%p, \n", av7110); 971 dprintk(2, "av7110:%p, \n", av7110);
971 972
@@ -974,6 +975,14 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
974 return -EBUSY; 975 return -EBUSY;
975 } 976 }
976 977
978 for (i = 0; i < len - 5; i++) {
979 /* get progressive flag from picture extension */
980 if (buf[i] == 0x00 && buf[i+1] == 0x00 &&
981 buf[i+2] == 0x01 && (unsigned char)buf[i+3] == 0xb5 &&
982 (buf[i+4] & 0xf0) == 0x10)
983 progressive = buf[i+5] & 0x08;
984 }
985
977 /* setting n always > 1, fixes problems when playing stillframes 986 /* setting n always > 1, fixes problems when playing stillframes
978 consisting of I- and P-Frames */ 987 consisting of I- and P-Frames */
979 n = MIN_IFRAME / len + 1; 988 n = MIN_IFRAME / len + 1;
@@ -985,7 +994,11 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
985 dvb_play(av7110, buf, len, 0, 1); 994 dvb_play(av7110, buf, len, 0, 1);
986 995
987 av7110_ipack_flush(&av7110->ipack[1]); 996 av7110_ipack_flush(&av7110->ipack[1]);
988 return 0; 997
998 if (progressive)
999 return vidcom(av7110, AV_VIDEO_CMD_FREEZE, 1);
1000 else
1001 return 0;
989} 1002}
990 1003
991 1004
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 3439c9864f67..2d64d557b977 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -896,6 +896,7 @@ static u8 read_pwm(struct budget_av *budget_av)
896#define SUBID_DVBS_CINERGY1200 0x1154 896#define SUBID_DVBS_CINERGY1200 0x1154
897#define SUBID_DVBS_CYNERGY1200N 0x1155 897#define SUBID_DVBS_CYNERGY1200N 0x1155
898#define SUBID_DVBS_TV_STAR 0x0014 898#define SUBID_DVBS_TV_STAR 0x0014
899#define SUBID_DVBS_TV_STAR_PLUS_X4 0x0015
899#define SUBID_DVBS_TV_STAR_CI 0x0016 900#define SUBID_DVBS_TV_STAR_CI 0x0016
900#define SUBID_DVBS_EASYWATCH_1 0x001a 901#define SUBID_DVBS_EASYWATCH_1 0x001a
901#define SUBID_DVBS_EASYWATCH_2 0x001b 902#define SUBID_DVBS_EASYWATCH_2 0x001b
@@ -910,6 +911,7 @@ static u8 read_pwm(struct budget_av *budget_av)
910#define SUBID_DVBC_CINERGY1200 0x1156 911#define SUBID_DVBC_CINERGY1200 0x1156
911#define SUBID_DVBC_CINERGY1200_MK3 0x1176 912#define SUBID_DVBC_CINERGY1200_MK3 0x1176
912 913
914#define SUBID_DVBT_EASYWATCH 0x003a
913#define SUBID_DVBT_KNC1_PLUS 0x0031 915#define SUBID_DVBT_KNC1_PLUS 0x0031
914#define SUBID_DVBT_KNC1 0x0030 916#define SUBID_DVBT_KNC1 0x0030
915#define SUBID_DVBT_CINERGY1200 0x1157 917#define SUBID_DVBT_CINERGY1200 0x1157
@@ -957,6 +959,7 @@ static void frontend_init(struct budget_av *budget_av)
957 break; 959 break;
958 960
959 case SUBID_DVBS_TV_STAR: 961 case SUBID_DVBS_TV_STAR:
962 case SUBID_DVBS_TV_STAR_PLUS_X4:
960 case SUBID_DVBS_TV_STAR_CI: 963 case SUBID_DVBS_TV_STAR_CI:
961 case SUBID_DVBS_CYNERGY1200N: 964 case SUBID_DVBS_CYNERGY1200N:
962 case SUBID_DVBS_EASYWATCH: 965 case SUBID_DVBS_EASYWATCH:
@@ -1018,6 +1021,7 @@ static void frontend_init(struct budget_av *budget_av)
1018 } 1021 }
1019 break; 1022 break;
1020 1023
1024 case SUBID_DVBT_EASYWATCH:
1021 case SUBID_DVBT_KNC1: 1025 case SUBID_DVBT_KNC1:
1022 case SUBID_DVBT_KNC1_PLUS: 1026 case SUBID_DVBT_KNC1_PLUS:
1023 case SUBID_DVBT_CINERGY1200: 1027 case SUBID_DVBT_CINERGY1200:
@@ -1248,7 +1252,9 @@ MAKE_BUDGET_INFO(satewpls1, "Satelco EasyWatch DVB-S light", BUDGET_KNC1S);
1248MAKE_BUDGET_INFO(satewps, "Satelco EasyWatch DVB-S", BUDGET_KNC1S); 1252MAKE_BUDGET_INFO(satewps, "Satelco EasyWatch DVB-S", BUDGET_KNC1S);
1249MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP); 1253MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP);
1250MAKE_BUDGET_INFO(satewcmk3, "Satelco EasyWatch DVB-C MK3", BUDGET_KNC1C_MK3); 1254MAKE_BUDGET_INFO(satewcmk3, "Satelco EasyWatch DVB-C MK3", BUDGET_KNC1C_MK3);
1255MAKE_BUDGET_INFO(satewt, "Satelco EasyWatch DVB-T", BUDGET_KNC1T);
1251MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); 1256MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP);
1257MAKE_BUDGET_INFO(knc1spx4, "KNC1 DVB-S Plus X4", BUDGET_KNC1SP);
1252MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); 1258MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP);
1253MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3); 1259MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3);
1254MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3); 1260MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3);
@@ -1266,12 +1272,14 @@ static struct pci_device_id pci_tbl[] = {
1266 MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011), 1272 MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011),
1267 MAKE_EXTENSION_PCI(knc1sp, 0x1894, 0x0011), 1273 MAKE_EXTENSION_PCI(knc1sp, 0x1894, 0x0011),
1268 MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014), 1274 MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014),
1275 MAKE_EXTENSION_PCI(knc1spx4, 0x1894, 0x0015),
1269 MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016), 1276 MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016),
1270 MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e), 1277 MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e),
1271 MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a), 1278 MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a),
1272 MAKE_EXTENSION_PCI(satewps, 0x1894, 0x001b), 1279 MAKE_EXTENSION_PCI(satewps, 0x1894, 0x001b),
1273 MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a), 1280 MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a),
1274 MAKE_EXTENSION_PCI(satewcmk3, 0x1894, 0x002c), 1281 MAKE_EXTENSION_PCI(satewcmk3, 0x1894, 0x002c),
1282 MAKE_EXTENSION_PCI(satewt, 0x1894, 0x003a),
1275 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), 1283 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020),
1276 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), 1284 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021),
1277 MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022), 1285 MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022),
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 9268a82bada6..14b00f57b5de 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -351,6 +351,7 @@ static struct s5h1420_config s5h1420_config = {
351static struct tda10086_config tda10086_config = { 351static struct tda10086_config tda10086_config = {
352 .demod_address = 0x0e, 352 .demod_address = 0x0e,
353 .invert = 0, 353 .invert = 0,
354 .diseqc_tone = 1,
354}; 355};
355 356
356static u8 read_pwm(struct budget* budget) 357static u8 read_pwm(struct budget* budget)
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 8d5214f18cf0..1b41b3f77cf9 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -4,12 +4,12 @@
4 4
5menuconfig RADIO_ADAPTERS 5menuconfig RADIO_ADAPTERS
6 bool "Radio Adapters" 6 bool "Radio Adapters"
7 depends on VIDEO_DEV 7 depends on VIDEO_V4L2
8 default y 8 default y
9 ---help--- 9 ---help---
10 Say Y here to enable selecting AM/FM radio adapters. 10 Say Y here to enable selecting AM/FM radio adapters.
11 11
12if RADIO_ADAPTERS && VIDEO_DEV 12if RADIO_ADAPTERS && VIDEO_V4L2
13 13
14config RADIO_CADET 14config RADIO_CADET
15 tristate "ADS Cadet AM/FM Tuner" 15 tristate "ADS Cadet AM/FM Tuner"
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index 3118bdab3183..53e114857377 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -361,6 +361,7 @@ static int __init fmi_init(void)
361 } 361 }
362 if (!request_region(io, 2, "radio-sf16fmi")) { 362 if (!request_region(io, 2, "radio-sf16fmi")) {
363 printk(KERN_ERR "radio-sf16fmi: port 0x%x already in use\n", io); 363 printk(KERN_ERR "radio-sf16fmi: port 0x%x already in use\n", io);
364 pnp_device_detach(dev);
364 return -EBUSY; 365 return -EBUSY;
365 } 366 }
366 367
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index f7c8b000404f..ebc5fbbc38bb 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -470,9 +470,8 @@ static int __init fmr2_init(void)
470 470
471 mutex_init(&lock); 471 mutex_init(&lock);
472 472
473 if (request_region(io, 2, "sf16fmr2")) 473 if (!request_region(io, 2, "sf16fmr2")) {
474 { 474 printk(KERN_ERR "radio-sf16fmr2: request_region failed!\n");
475 printk(KERN_ERR "fmr2: port 0x%x already in use\n", io);
476 return -EBUSY; 475 return -EBUSY;
477 } 476 }
478 477
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c
index 8e4bd4769048..649f14d2c013 100644
--- a/drivers/media/radio/radio-si470x.c
+++ b/drivers/media/radio/radio-si470x.c
@@ -62,6 +62,29 @@
62 * - code cleaned of unnecessary rds_commands 62 * - code cleaned of unnecessary rds_commands
63 * - USB Vendor/Product ID for ADS/Tech FM Radio Receiver verified 63 * - USB Vendor/Product ID for ADS/Tech FM Radio Receiver verified
64 * (thanks to Guillaume RAMOUSSE) 64 * (thanks to Guillaume RAMOUSSE)
65 * 2008-01-27 Tobias Lorenz <tobias.lorenz@gmx.net>
66 * Version 1.0.5
67 * - number of seek_retries changed to tune_timeout
68 * - fixed problem with incomplete tune operations by own buffers
69 * - optimization of variables and printf types
70 * - improved error logging
71 * 2008-01-31 Tobias Lorenz <tobias.lorenz@gmx.net>
72 * Oliver Neukum <oliver@neukum.org>
73 * Version 1.0.6
74 * - fixed coverity checker warnings in *_usb_driver_disconnect
75 * - probe()/open() race by correct ordering in probe()
76 * - DMA coherency rules by separate allocation of all buffers
77 * - use of endianness macros
78 * - abuse of spinlock, replaced by mutex
79 * - racy handling of timer in disconnect,
80 * replaced by delayed_work
81 * - racy interruptible_sleep_on(),
82 * replaced with wait_event_interruptible()
83 * - handle signals in read()
84 * 2008-02-08 Tobias Lorenz <tobias.lorenz@gmx.net>
85 * Oliver Neukum <oliver@neukum.org>
86 * Version 1.0.7
87 * - usb autosuspend support
65 * 88 *
66 * ToDo: 89 * ToDo:
67 * - add seeking support 90 * - add seeking support
@@ -74,9 +97,10 @@
74/* driver definitions */ 97/* driver definitions */
75#define DRIVER_AUTHOR "Tobias Lorenz <tobias.lorenz@gmx.net>" 98#define DRIVER_AUTHOR "Tobias Lorenz <tobias.lorenz@gmx.net>"
76#define DRIVER_NAME "radio-si470x" 99#define DRIVER_NAME "radio-si470x"
77#define DRIVER_VERSION KERNEL_VERSION(1, 0, 4) 100#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 6)
78#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" 101#define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver"
79#define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers" 102#define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers"
103#define DRIVER_VERSION "1.0.6"
80 104
81 105
82/* kernel includes */ 106/* kernel includes */
@@ -89,8 +113,10 @@
89#include <linux/hid.h> 113#include <linux/hid.h>
90#include <linux/version.h> 114#include <linux/version.h>
91#include <linux/videodev2.h> 115#include <linux/videodev2.h>
116#include <linux/mutex.h>
92#include <media/v4l2-common.h> 117#include <media/v4l2-common.h>
93#include <media/rds.h> 118#include <media/rds.h>
119#include <asm/unaligned.h>
94 120
95 121
96/* USB Device ID List */ 122/* USB Device ID List */
@@ -119,56 +145,56 @@ MODULE_PARM_DESC(radio_nr, "Radio Nr");
119/* 0: 200 kHz (USA, Australia) */ 145/* 0: 200 kHz (USA, Australia) */
120/* 1: 100 kHz (Europe, Japan) */ 146/* 1: 100 kHz (Europe, Japan) */
121/* 2: 50 kHz */ 147/* 2: 50 kHz */
122static int space = 2; 148static unsigned short space = 2;
123module_param(space, int, 0); 149module_param(space, ushort, 0);
124MODULE_PARM_DESC(radio_nr, "Spacing: 0=200kHz 1=100kHz *2=50kHz*"); 150MODULE_PARM_DESC(radio_nr, "Spacing: 0=200kHz 1=100kHz *2=50kHz*");
125 151
126/* Bottom of Band (MHz) */ 152/* Bottom of Band (MHz) */
127/* 0: 87.5 - 108 MHz (USA, Europe)*/ 153/* 0: 87.5 - 108 MHz (USA, Europe)*/
128/* 1: 76 - 108 MHz (Japan wide band) */ 154/* 1: 76 - 108 MHz (Japan wide band) */
129/* 2: 76 - 90 MHz (Japan) */ 155/* 2: 76 - 90 MHz (Japan) */
130static int band = 1; 156static unsigned short band = 1;
131module_param(band, int, 0); 157module_param(band, ushort, 0);
132MODULE_PARM_DESC(radio_nr, "Band: 0=87.5..108MHz *1=76..108MHz* 2=76..90MHz"); 158MODULE_PARM_DESC(radio_nr, "Band: 0=87.5..108MHz *1=76..108MHz* 2=76..90MHz");
133 159
134/* De-emphasis */ 160/* De-emphasis */
135/* 0: 75 us (USA) */ 161/* 0: 75 us (USA) */
136/* 1: 50 us (Europe, Australia, Japan) */ 162/* 1: 50 us (Europe, Australia, Japan) */
137static int de = 1; 163static unsigned short de = 1;
138module_param(de, int, 0); 164module_param(de, ushort, 0);
139MODULE_PARM_DESC(radio_nr, "De-emphasis: 0=75us *1=50us*"); 165MODULE_PARM_DESC(radio_nr, "De-emphasis: 0=75us *1=50us*");
140 166
141/* USB timeout */ 167/* USB timeout */
142static int usb_timeout = 500; 168static unsigned int usb_timeout = 500;
143module_param(usb_timeout, int, 0); 169module_param(usb_timeout, uint, 0);
144MODULE_PARM_DESC(usb_timeout, "USB timeout (ms): *500*"); 170MODULE_PARM_DESC(usb_timeout, "USB timeout (ms): *500*");
145 171
146/* Seek retries */ 172/* Tune timeout */
147static int seek_retries = 100; 173static unsigned int tune_timeout = 3000;
148module_param(seek_retries, int, 0); 174module_param(tune_timeout, uint, 0);
149MODULE_PARM_DESC(seek_retries, "Seek retries: *100*"); 175MODULE_PARM_DESC(tune_timeout, "Tune timeout: *3000*");
150 176
151/* RDS buffer blocks */ 177/* RDS buffer blocks */
152static int rds_buf = 100; 178static unsigned int rds_buf = 100;
153module_param(rds_buf, int, 0); 179module_param(rds_buf, uint, 0);
154MODULE_PARM_DESC(rds_buf, "RDS buffer entries: *100*"); 180MODULE_PARM_DESC(rds_buf, "RDS buffer entries: *100*");
155 181
156/* RDS maximum block errors */ 182/* RDS maximum block errors */
157static int max_rds_errors = 1; 183static unsigned short max_rds_errors = 1;
158/* 0 means 0 errors requiring correction */ 184/* 0 means 0 errors requiring correction */
159/* 1 means 1-2 errors requiring correction (used by original USBRadio.exe) */ 185/* 1 means 1-2 errors requiring correction (used by original USBRadio.exe) */
160/* 2 means 3-5 errors requiring correction */ 186/* 2 means 3-5 errors requiring correction */
161/* 3 means 6+ errors or errors in checkword, correction not possible */ 187/* 3 means 6+ errors or errors in checkword, correction not possible */
162module_param(max_rds_errors, int, 0); 188module_param(max_rds_errors, ushort, 0);
163MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*"); 189MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*");
164 190
165/* RDS poll frequency */ 191/* RDS poll frequency */
166static int rds_poll_time = 40; 192static unsigned int rds_poll_time = 40;
167/* 40 is used by the original USBRadio.exe */ 193/* 40 is used by the original USBRadio.exe */
168/* 50 is used by radio-cadet */ 194/* 50 is used by radio-cadet */
169/* 75 should be okay */ 195/* 75 should be okay */
170/* 80 is the usual RDS receive interval */ 196/* 80 is the usual RDS receive interval */
171module_param(rds_poll_time, int, 0); 197module_param(rds_poll_time, uint, 0);
172MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*"); 198MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*");
173 199
174 200
@@ -393,22 +419,19 @@ MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*");
393struct si470x_device { 419struct si470x_device {
394 /* reference to USB and video device */ 420 /* reference to USB and video device */
395 struct usb_device *usbdev; 421 struct usb_device *usbdev;
422 struct usb_interface *intf;
396 struct video_device *videodev; 423 struct video_device *videodev;
397 424
398 /* are these really necessary ? */ 425 /* driver management */
399 int users; 426 unsigned int users;
400
401 /* report buffer (maximum 64 bytes) */
402 unsigned char buf[64];
403 427
404 /* Silabs internal registers (0..15) */ 428 /* Silabs internal registers (0..15) */
405 unsigned short registers[RADIO_REGISTER_NUM]; 429 unsigned short registers[RADIO_REGISTER_NUM];
406 430
407 /* RDS receive buffer */ 431 /* RDS receive buffer */
408 struct work_struct work; 432 struct delayed_work work;
409 wait_queue_head_t read_queue; 433 wait_queue_head_t read_queue;
410 struct timer_list timer; 434 struct mutex lock; /* buffer locking */
411 spinlock_t lock; /* buffer locking */
412 unsigned char *buffer; /* size is always multiple of three */ 435 unsigned char *buffer; /* size is always multiple of three */
413 unsigned int buf_size; 436 unsigned int buf_size;
414 unsigned int rd_index; 437 unsigned int rd_index;
@@ -434,28 +457,46 @@ struct si470x_device {
434/* 457/*
435 * si470x_get_report - receive a HID report 458 * si470x_get_report - receive a HID report
436 */ 459 */
437static int si470x_get_report(struct si470x_device *radio, int size) 460static int si470x_get_report(struct si470x_device *radio, void *buf, int size)
438{ 461{
439 return usb_control_msg(radio->usbdev, 462 unsigned char *report = (unsigned char *) buf;
463 int retval;
464
465 retval = usb_control_msg(radio->usbdev,
440 usb_rcvctrlpipe(radio->usbdev, 0), 466 usb_rcvctrlpipe(radio->usbdev, 0),
441 HID_REQ_GET_REPORT, 467 HID_REQ_GET_REPORT,
442 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 468 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
443 radio->buf[0], 2, 469 report[0], 2,
444 radio->buf, size, usb_timeout); 470 buf, size, usb_timeout);
471 if (retval < 0)
472 printk(KERN_WARNING DRIVER_NAME
473 ": si470x_get_report: usb_control_msg returned %d\n",
474 retval);
475
476 return retval;
445} 477}
446 478
447 479
448/* 480/*
449 * si470x_set_report - send a HID report 481 * si470x_set_report - send a HID report
450 */ 482 */
451static int si470x_set_report(struct si470x_device *radio, int size) 483static int si470x_set_report(struct si470x_device *radio, void *buf, int size)
452{ 484{
453 return usb_control_msg(radio->usbdev, 485 unsigned char *report = (unsigned char *) buf;
486 int retval;
487
488 retval = usb_control_msg(radio->usbdev,
454 usb_sndctrlpipe(radio->usbdev, 0), 489 usb_sndctrlpipe(radio->usbdev, 0),
455 HID_REQ_SET_REPORT, 490 HID_REQ_SET_REPORT,
456 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, 491 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
457 radio->buf[0], 2, 492 report[0], 2,
458 radio->buf, size, usb_timeout); 493 buf, size, usb_timeout);
494 if (retval < 0)
495 printk(KERN_WARNING DRIVER_NAME
496 ": si470x_set_report: usb_control_msg returned %d\n",
497 retval);
498
499 return retval;
459} 500}
460 501
461 502
@@ -464,13 +505,16 @@ static int si470x_set_report(struct si470x_device *radio, int size)
464 */ 505 */
465static int si470x_get_register(struct si470x_device *radio, int regnr) 506static int si470x_get_register(struct si470x_device *radio, int regnr)
466{ 507{
508 unsigned char buf[REGISTER_REPORT_SIZE];
467 int retval; 509 int retval;
468 510
469 radio->buf[0] = REGISTER_REPORT(regnr); 511 buf[0] = REGISTER_REPORT(regnr);
512
513 retval = si470x_get_report(radio, (void *) &buf, sizeof(buf));
470 514
471 retval = si470x_get_report(radio, REGISTER_REPORT_SIZE);
472 if (retval >= 0) 515 if (retval >= 0)
473 radio->registers[regnr] = (radio->buf[1] << 8) | radio->buf[2]; 516 radio->registers[regnr] = be16_to_cpu(get_unaligned(
517 (unsigned short *) &buf[1]));
474 518
475 return (retval < 0) ? -EINVAL : 0; 519 return (retval < 0) ? -EINVAL : 0;
476} 520}
@@ -481,13 +525,14 @@ static int si470x_get_register(struct si470x_device *radio, int regnr)
481 */ 525 */
482static int si470x_set_register(struct si470x_device *radio, int regnr) 526static int si470x_set_register(struct si470x_device *radio, int regnr)
483{ 527{
528 unsigned char buf[REGISTER_REPORT_SIZE];
484 int retval; 529 int retval;
485 530
486 radio->buf[0] = REGISTER_REPORT(regnr); 531 buf[0] = REGISTER_REPORT(regnr);
487 radio->buf[1] = (radio->registers[regnr] & 0xff00) >> 8; 532 put_unaligned(cpu_to_be16(radio->registers[regnr]),
488 radio->buf[2] = (radio->registers[regnr] & 0x00ff); 533 (unsigned short *) &buf[1]);
489 534
490 retval = si470x_set_report(radio, REGISTER_REPORT_SIZE); 535 retval = si470x_set_report(radio, (void *) &buf, sizeof(buf));
491 536
492 return (retval < 0) ? -EINVAL : 0; 537 return (retval < 0) ? -EINVAL : 0;
493} 538}
@@ -498,18 +543,19 @@ static int si470x_set_register(struct si470x_device *radio, int regnr)
498 */ 543 */
499static int si470x_get_all_registers(struct si470x_device *radio) 544static int si470x_get_all_registers(struct si470x_device *radio)
500{ 545{
546 unsigned char buf[ENTIRE_REPORT_SIZE];
501 int retval; 547 int retval;
502 int regnr; 548 unsigned char regnr;
503 549
504 radio->buf[0] = ENTIRE_REPORT; 550 buf[0] = ENTIRE_REPORT;
505 551
506 retval = si470x_get_report(radio, ENTIRE_REPORT_SIZE); 552 retval = si470x_get_report(radio, (void *) &buf, sizeof(buf));
507 553
508 if (retval >= 0) 554 if (retval >= 0)
509 for (regnr = 0; regnr < RADIO_REGISTER_NUM; regnr++) 555 for (regnr = 0; regnr < RADIO_REGISTER_NUM; regnr++)
510 radio->registers[regnr] = 556 radio->registers[regnr] = be16_to_cpu(get_unaligned(
511 (radio->buf[regnr * RADIO_REGISTER_SIZE + 1] << 8) | 557 (unsigned short *)
512 radio->buf[regnr * RADIO_REGISTER_SIZE + 2]; 558 &buf[regnr * RADIO_REGISTER_SIZE + 1]));
513 559
514 return (retval < 0) ? -EINVAL : 0; 560 return (retval < 0) ? -EINVAL : 0;
515} 561}
@@ -520,21 +566,28 @@ static int si470x_get_all_registers(struct si470x_device *radio)
520 */ 566 */
521static int si470x_get_rds_registers(struct si470x_device *radio) 567static int si470x_get_rds_registers(struct si470x_device *radio)
522{ 568{
569 unsigned char buf[RDS_REPORT_SIZE];
523 int retval; 570 int retval;
524 int regnr;
525 int size; 571 int size;
572 unsigned char regnr;
526 573
527 radio->buf[0] = RDS_REPORT; 574 buf[0] = RDS_REPORT;
528 575
529 retval = usb_interrupt_msg(radio->usbdev, 576 retval = usb_interrupt_msg(radio->usbdev,
530 usb_rcvctrlpipe(radio->usbdev, 1), 577 usb_rcvintpipe(radio->usbdev, 1),
531 radio->buf, RDS_REPORT_SIZE, &size, usb_timeout); 578 (void *) &buf, sizeof(buf), &size, usb_timeout);
579 if (size != sizeof(buf))
580 printk(KERN_WARNING DRIVER_NAME ": si470x_get_rds_register: "
581 "return size differs: %d != %zu\n", size, sizeof(buf));
582 if (retval < 0)
583 printk(KERN_WARNING DRIVER_NAME ": si470x_get_rds_registers: "
584 "usb_interrupt_msg returned %d\n", retval);
532 585
533 if (retval >= 0) 586 if (retval >= 0)
534 for (regnr = 0; regnr < RDS_REGISTER_NUM; regnr++) 587 for (regnr = 0; regnr < RDS_REGISTER_NUM; regnr++)
535 radio->registers[STATUSRSSI + regnr] = 588 radio->registers[STATUSRSSI + regnr] =
536 (radio->buf[regnr * RADIO_REGISTER_SIZE + 1] << 8) | 589 be16_to_cpu(get_unaligned((unsigned short *)
537 radio->buf[regnr * RADIO_REGISTER_SIZE + 2]; 590 &buf[regnr * RADIO_REGISTER_SIZE + 1]));
538 591
539 return (retval < 0) ? -EINVAL : 0; 592 return (retval < 0) ? -EINVAL : 0;
540} 593}
@@ -543,9 +596,11 @@ static int si470x_get_rds_registers(struct si470x_device *radio)
543/* 596/*
544 * si470x_set_chan - set the channel 597 * si470x_set_chan - set the channel
545 */ 598 */
546static int si470x_set_chan(struct si470x_device *radio, int chan) 599static int si470x_set_chan(struct si470x_device *radio, unsigned short chan)
547{ 600{
548 int retval, i; 601 int retval;
602 unsigned long timeout;
603 bool timed_out = 0;
549 604
550 /* start tuning */ 605 /* start tuning */
551 radio->registers[CHANNEL] &= ~CHANNEL_CHAN; 606 radio->registers[CHANNEL] &= ~CHANNEL_CHAN;
@@ -555,16 +610,17 @@ static int si470x_set_chan(struct si470x_device *radio, int chan)
555 return retval; 610 return retval;
556 611
557 /* wait till seek operation has completed */ 612 /* wait till seek operation has completed */
558 i = 0; 613 timeout = jiffies + msecs_to_jiffies(tune_timeout);
559 do { 614 do {
560 retval = si470x_get_register(radio, STATUSRSSI); 615 retval = si470x_get_register(radio, STATUSRSSI);
561 if (retval < 0) 616 if (retval < 0)
562 return retval; 617 return retval;
563 } while ((radio->registers[STATUSRSSI] & STATUSRSSI_STC) && 618 timed_out = time_after(jiffies, timeout);
564 (++i < seek_retries)); 619 } while (((radio->registers[STATUSRSSI] & STATUSRSSI_STC) == 0) &&
565 if (i >= seek_retries) 620 (!timed_out));
621 if (timed_out)
566 printk(KERN_WARNING DRIVER_NAME 622 printk(KERN_WARNING DRIVER_NAME
567 ": seek does not finish after %d tries\n", i); 623 ": seek does not finish after %u ms\n", tune_timeout);
568 624
569 /* stop tuning */ 625 /* stop tuning */
570 radio->registers[CHANNEL] &= ~CHANNEL_TUNE; 626 radio->registers[CHANNEL] &= ~CHANNEL_TUNE;
@@ -575,9 +631,10 @@ static int si470x_set_chan(struct si470x_device *radio, int chan)
575/* 631/*
576 * si470x_get_freq - get the frequency 632 * si470x_get_freq - get the frequency
577 */ 633 */
578static int si470x_get_freq(struct si470x_device *radio) 634static unsigned int si470x_get_freq(struct si470x_device *radio)
579{ 635{
580 int spacing, band_bottom, chan, freq; 636 unsigned int spacing, band_bottom, freq;
637 unsigned short chan;
581 int retval; 638 int retval;
582 639
583 /* Spacing (kHz) */ 640 /* Spacing (kHz) */
@@ -616,9 +673,10 @@ static int si470x_get_freq(struct si470x_device *radio)
616/* 673/*
617 * si470x_set_freq - set the frequency 674 * si470x_set_freq - set the frequency
618 */ 675 */
619static int si470x_set_freq(struct si470x_device *radio, int freq) 676static int si470x_set_freq(struct si470x_device *radio, unsigned int freq)
620{ 677{
621 int spacing, band_bottom, chan; 678 unsigned int spacing, band_bottom;
679 unsigned short chan;
622 680
623 /* Spacing (kHz) */ 681 /* Spacing (kHz) */
624 switch (space) { 682 switch (space) {
@@ -709,9 +767,17 @@ static int si470x_stop(struct si470x_device *radio)
709 */ 767 */
710static int si470x_rds_on(struct si470x_device *radio) 768static int si470x_rds_on(struct si470x_device *radio)
711{ 769{
770 int retval;
771
712 /* sysconfig 1 */ 772 /* sysconfig 1 */
773 mutex_lock(&radio->lock);
713 radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDS; 774 radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDS;
714 return si470x_set_register(radio, SYSCONFIG1); 775 retval = si470x_set_register(radio, SYSCONFIG1);
776 if (retval < 0)
777 radio->registers[SYSCONFIG1] &= ~SYSCONFIG1_RDS;
778 mutex_unlock(&radio->lock);
779
780 return retval;
715} 781}
716 782
717 783
@@ -725,11 +791,10 @@ static int si470x_rds_on(struct si470x_device *radio)
725 */ 791 */
726static void si470x_rds(struct si470x_device *radio) 792static void si470x_rds(struct si470x_device *radio)
727{ 793{
728 unsigned char tmpbuf[3];
729 unsigned char blocknum; 794 unsigned char blocknum;
730 unsigned char bler; /* rds block errors */ 795 unsigned short bler; /* rds block errors */
731 unsigned short rds; 796 unsigned short rds;
732 unsigned int i; 797 unsigned char tmpbuf[3];
733 798
734 /* get rds blocks */ 799 /* get rds blocks */
735 if (si470x_get_rds_registers(radio) < 0) 800 if (si470x_get_rds_registers(radio) < 0)
@@ -743,63 +808,58 @@ static void si470x_rds(struct si470x_device *radio)
743 return; 808 return;
744 } 809 }
745 810
746 /* copy four RDS blocks to internal buffer */ 811 /* copy all four RDS blocks to internal buffer */
747 if (spin_trylock(&radio->lock)) { 812 mutex_lock(&radio->lock);
748 /* process each rds block */ 813 for (blocknum = 0; blocknum < 4; blocknum++) {
749 for (blocknum = 0; blocknum < 4; blocknum++) { 814 switch (blocknum) {
750 switch (blocknum) { 815 default:
751 default: 816 bler = (radio->registers[STATUSRSSI] &
752 bler = (radio->registers[STATUSRSSI] & 817 STATUSRSSI_BLERA) >> 9;
753 STATUSRSSI_BLERA) >> 9; 818 rds = radio->registers[RDSA];
754 rds = radio->registers[RDSA]; 819 break;
755 break; 820 case 1:
756 case 1: 821 bler = (radio->registers[READCHAN] &
757 bler = (radio->registers[READCHAN] & 822 READCHAN_BLERB) >> 14;
758 READCHAN_BLERB) >> 14; 823 rds = radio->registers[RDSB];
759 rds = radio->registers[RDSB]; 824 break;
760 break; 825 case 2:
761 case 2: 826 bler = (radio->registers[READCHAN] &
762 bler = (radio->registers[READCHAN] & 827 READCHAN_BLERC) >> 12;
763 READCHAN_BLERC) >> 12; 828 rds = radio->registers[RDSC];
764 rds = radio->registers[RDSC]; 829 break;
765 break; 830 case 3:
766 case 3: 831 bler = (radio->registers[READCHAN] &
767 bler = (radio->registers[READCHAN] & 832 READCHAN_BLERD) >> 10;
768 READCHAN_BLERD) >> 10; 833 rds = radio->registers[RDSD];
769 rds = radio->registers[RDSD]; 834 break;
770 break; 835 };
771 }; 836
772 837 /* Fill the V4L2 RDS buffer */
773 /* Fill the V4L2 RDS buffer */ 838 put_unaligned(cpu_to_le16(rds), (unsigned short *) &tmpbuf);
774 tmpbuf[0] = rds & 0x00ff; /* LSB */ 839 tmpbuf[2] = blocknum; /* offset name */
775 tmpbuf[1] = (rds & 0xff00) >> 8;/* MSB */ 840 tmpbuf[2] |= blocknum << 3; /* received offset */
776 tmpbuf[2] = blocknum; /* offset name */ 841 if (bler > max_rds_errors)
777 tmpbuf[2] |= blocknum << 3; /* received offset */ 842 tmpbuf[2] |= 0x80; /* uncorrectable errors */
778 if (bler > max_rds_errors) 843 else if (bler > 0)
779 tmpbuf[2] |= 0x80; /* uncorrectable errors */ 844 tmpbuf[2] |= 0x40; /* corrected error(s) */
780 else if (bler > 0) 845
781 tmpbuf[2] |= 0x40; /* corrected error(s) */ 846 /* copy RDS block to internal buffer */
782 847 memcpy(&radio->buffer[radio->wr_index], &tmpbuf, 3);
783 /* copy RDS block to internal buffer */ 848 radio->wr_index += 3;
784 for (i = 0; i < 3; i++) { 849
785 radio->buffer[radio->wr_index] = tmpbuf[i]; 850 /* wrap write pointer */
786 radio->wr_index++; 851 if (radio->wr_index >= radio->buf_size)
787 } 852 radio->wr_index = 0;
788 853
789 /* wrap write pointer */ 854 /* check for overflow */
790 if (radio->wr_index >= radio->buf_size) 855 if (radio->wr_index == radio->rd_index) {
791 radio->wr_index = 0; 856 /* increment and wrap read pointer */
792 857 radio->rd_index += 3;
793 /* check for overflow */ 858 if (radio->rd_index >= radio->buf_size)
794 if (radio->wr_index == radio->rd_index) { 859 radio->rd_index = 0;
795 /* increment and wrap read pointer */
796 radio->rd_index += 3;
797 if (radio->rd_index >= radio->buf_size)
798 radio->rd_index = 0;
799 }
800 } 860 }
801 spin_unlock(&radio->lock);
802 } 861 }
862 mutex_unlock(&radio->lock);
803 863
804 /* wake up read queue */ 864 /* wake up read queue */
805 if (radio->wr_index != radio->rd_index) 865 if (radio->wr_index != radio->rd_index)
@@ -808,29 +868,18 @@ static void si470x_rds(struct si470x_device *radio)
808 868
809 869
810/* 870/*
811 * si470x_timer - rds timer function
812 */
813static void si470x_timer(unsigned long data)
814{
815 struct si470x_device *radio = (struct si470x_device *) data;
816
817 schedule_work(&radio->work);
818}
819
820
821/*
822 * si470x_work - rds work function 871 * si470x_work - rds work function
823 */ 872 */
824static void si470x_work(struct work_struct *work) 873static void si470x_work(struct work_struct *work)
825{ 874{
826 struct si470x_device *radio = container_of(work, struct si470x_device, 875 struct si470x_device *radio = container_of(work, struct si470x_device,
827 work); 876 work.work);
828 877
829 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) 878 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0)
830 return; 879 return;
831 880
832 si470x_rds(radio); 881 si470x_rds(radio);
833 mod_timer(&radio->timer, jiffies + msecs_to_jiffies(rds_poll_time)); 882 schedule_delayed_work(&radio->work, msecs_to_jiffies(rds_poll_time));
834} 883}
835 884
836 885
@@ -852,44 +901,44 @@ static ssize_t si470x_fops_read(struct file *file, char __user *buf,
852 /* switch on rds reception */ 901 /* switch on rds reception */
853 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) { 902 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) {
854 si470x_rds_on(radio); 903 si470x_rds_on(radio);
855 schedule_work(&radio->work); 904 schedule_delayed_work(&radio->work,
905 msecs_to_jiffies(rds_poll_time));
856 } 906 }
857 907
858 /* block if no new data available */ 908 /* block if no new data available */
859 while (radio->wr_index == radio->rd_index) { 909 while (radio->wr_index == radio->rd_index) {
860 if (file->f_flags & O_NONBLOCK) 910 if (file->f_flags & O_NONBLOCK)
861 return -EWOULDBLOCK; 911 return -EWOULDBLOCK;
862 interruptible_sleep_on(&radio->read_queue); 912 if (wait_event_interruptible(radio->read_queue,
913 radio->wr_index != radio->rd_index) < 0)
914 return -EINTR;
863 } 915 }
864 916
865 /* calculate block count from byte count */ 917 /* calculate block count from byte count */
866 count /= 3; 918 count /= 3;
867 919
868 /* copy RDS block out of internal buffer and to user buffer */ 920 /* copy RDS block out of internal buffer and to user buffer */
869 if (spin_trylock(&radio->lock)) { 921 mutex_lock(&radio->lock);
870 while (block_count < count) { 922 while (block_count < count) {
871 if (radio->rd_index == radio->wr_index) 923 if (radio->rd_index == radio->wr_index)
872 break; 924 break;
873 925
874 /* always transfer rds complete blocks */ 926 /* always transfer rds complete blocks */
875 if (copy_to_user(buf, 927 if (copy_to_user(buf, &radio->buffer[radio->rd_index], 3))
876 &radio->buffer[radio->rd_index], 3)) 928 /* retval = -EFAULT; */
877 /* retval = -EFAULT; */ 929 break;
878 break; 930
879 931 /* increment and wrap read pointer */
880 /* increment and wrap read pointer */ 932 radio->rd_index += 3;
881 radio->rd_index += 3; 933 if (radio->rd_index >= radio->buf_size)
882 if (radio->rd_index >= radio->buf_size) 934 radio->rd_index = 0;
883 radio->rd_index = 0; 935
884 936 /* increment counters */
885 /* increment counters */ 937 block_count++;
886 block_count++; 938 buf += 3;
887 buf += 3; 939 retval += 3;
888 retval += 3;
889 }
890
891 spin_unlock(&radio->lock);
892 } 940 }
941 mutex_unlock(&radio->lock);
893 942
894 return retval; 943 return retval;
895} 944}
@@ -906,7 +955,8 @@ static unsigned int si470x_fops_poll(struct file *file,
906 /* switch on rds reception */ 955 /* switch on rds reception */
907 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) { 956 if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) {
908 si470x_rds_on(radio); 957 si470x_rds_on(radio);
909 schedule_work(&radio->work); 958 schedule_delayed_work(&radio->work,
959 msecs_to_jiffies(rds_poll_time));
910 } 960 }
911 961
912 poll_wait(file, &radio->read_queue, pts); 962 poll_wait(file, &radio->read_queue, pts);
@@ -924,10 +974,22 @@ static unsigned int si470x_fops_poll(struct file *file,
924static int si470x_fops_open(struct inode *inode, struct file *file) 974static int si470x_fops_open(struct inode *inode, struct file *file)
925{ 975{
926 struct si470x_device *radio = video_get_drvdata(video_devdata(file)); 976 struct si470x_device *radio = video_get_drvdata(video_devdata(file));
977 int retval;
927 978
928 radio->users++; 979 radio->users++;
929 if (radio->users == 1) 980
930 return si470x_start(radio); 981 retval = usb_autopm_get_interface(radio->intf);
982 if (retval < 0) {
983 radio->users--;
984 return -EIO;
985 }
986
987 if (radio->users == 1) {
988 retval = si470x_start(radio);
989 if (retval < 0)
990 usb_autopm_put_interface(radio->intf);
991 return retval;
992 }
931 993
932 return 0; 994 return 0;
933} 995}
@@ -939,6 +1001,7 @@ static int si470x_fops_open(struct inode *inode, struct file *file)
939static int si470x_fops_release(struct inode *inode, struct file *file) 1001static int si470x_fops_release(struct inode *inode, struct file *file)
940{ 1002{
941 struct si470x_device *radio = video_get_drvdata(video_devdata(file)); 1003 struct si470x_device *radio = video_get_drvdata(video_devdata(file));
1004 int retval;
942 1005
943 if (!radio) 1006 if (!radio)
944 return -ENODEV; 1007 return -ENODEV;
@@ -946,13 +1009,14 @@ static int si470x_fops_release(struct inode *inode, struct file *file)
946 radio->users--; 1009 radio->users--;
947 if (radio->users == 0) { 1010 if (radio->users == 0) {
948 /* stop rds reception */ 1011 /* stop rds reception */
949 del_timer_sync(&radio->timer); 1012 cancel_delayed_work_sync(&radio->work);
950 flush_scheduled_work();
951 1013
952 /* cancel read processes */ 1014 /* cancel read processes */
953 wake_up_interruptible(&radio->read_queue); 1015 wake_up_interruptible(&radio->read_queue);
954 1016
955 return si470x_stop(radio); 1017 retval = si470x_stop(radio);
1018 usb_autopm_put_interface(radio->intf);
1019 return retval;
956 } 1020 }
957 1021
958 return 0; 1022 return 0;
@@ -1030,7 +1094,7 @@ static int si470x_vidioc_querycap(struct file *file, void *priv,
1030 strlcpy(capability->driver, DRIVER_NAME, sizeof(capability->driver)); 1094 strlcpy(capability->driver, DRIVER_NAME, sizeof(capability->driver));
1031 strlcpy(capability->card, DRIVER_CARD, sizeof(capability->card)); 1095 strlcpy(capability->card, DRIVER_CARD, sizeof(capability->card));
1032 sprintf(capability->bus_info, "USB"); 1096 sprintf(capability->bus_info, "USB");
1033 capability->version = DRIVER_VERSION; 1097 capability->version = DRIVER_KERNEL_VERSION;
1034 capability->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; 1098 capability->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
1035 1099
1036 return 0; 1100 return 0;
@@ -1067,16 +1131,21 @@ static int si470x_vidioc_s_input(struct file *filp, void *priv, unsigned int i)
1067static int si470x_vidioc_queryctrl(struct file *file, void *priv, 1131static int si470x_vidioc_queryctrl(struct file *file, void *priv,
1068 struct v4l2_queryctrl *qc) 1132 struct v4l2_queryctrl *qc)
1069{ 1133{
1070 int i; 1134 unsigned char i;
1135 int retval = -EINVAL;
1071 1136
1072 for (i = 0; i < ARRAY_SIZE(si470x_v4l2_queryctrl); i++) { 1137 for (i = 0; i < ARRAY_SIZE(si470x_v4l2_queryctrl); i++) {
1073 if (qc->id && qc->id == si470x_v4l2_queryctrl[i].id) { 1138 if (qc->id && qc->id == si470x_v4l2_queryctrl[i].id) {
1074 memcpy(qc, &(si470x_v4l2_queryctrl[i]), sizeof(*qc)); 1139 memcpy(qc, &(si470x_v4l2_queryctrl[i]), sizeof(*qc));
1075 return 0; 1140 retval = 0;
1141 break;
1076 } 1142 }
1077 } 1143 }
1144 if (retval < 0)
1145 printk(KERN_WARNING DRIVER_NAME
1146 ": query control failed with %d\n", retval);
1078 1147
1079 return -EINVAL; 1148 return retval;
1080} 1149}
1081 1150
1082 1151
@@ -1110,21 +1179,29 @@ static int si470x_vidioc_s_ctrl(struct file *file, void *priv,
1110 struct v4l2_control *ctrl) 1179 struct v4l2_control *ctrl)
1111{ 1180{
1112 struct si470x_device *radio = video_get_drvdata(video_devdata(file)); 1181 struct si470x_device *radio = video_get_drvdata(video_devdata(file));
1182 int retval;
1113 1183
1114 switch (ctrl->id) { 1184 switch (ctrl->id) {
1115 case V4L2_CID_AUDIO_VOLUME: 1185 case V4L2_CID_AUDIO_VOLUME:
1116 radio->registers[SYSCONFIG2] &= ~SYSCONFIG2_VOLUME; 1186 radio->registers[SYSCONFIG2] &= ~SYSCONFIG2_VOLUME;
1117 radio->registers[SYSCONFIG2] |= ctrl->value; 1187 radio->registers[SYSCONFIG2] |= ctrl->value;
1118 return si470x_set_register(radio, SYSCONFIG2); 1188 retval = si470x_set_register(radio, SYSCONFIG2);
1189 break;
1119 case V4L2_CID_AUDIO_MUTE: 1190 case V4L2_CID_AUDIO_MUTE:
1120 if (ctrl->value == 1) 1191 if (ctrl->value == 1)
1121 radio->registers[POWERCFG] &= ~POWERCFG_DMUTE; 1192 radio->registers[POWERCFG] &= ~POWERCFG_DMUTE;
1122 else 1193 else
1123 radio->registers[POWERCFG] |= POWERCFG_DMUTE; 1194 radio->registers[POWERCFG] |= POWERCFG_DMUTE;
1124 return si470x_set_register(radio, POWERCFG); 1195 retval = si470x_set_register(radio, POWERCFG);
1196 break;
1197 default:
1198 retval = -EINVAL;
1125 } 1199 }
1200 if (retval < 0)
1201 printk(KERN_WARNING DRIVER_NAME
1202 ": set control failed with %d\n", retval);
1126 1203
1127 return -EINVAL; 1204 return retval;
1128} 1205}
1129 1206
1130 1207
@@ -1163,8 +1240,8 @@ static int si470x_vidioc_s_audio(struct file *file, void *priv,
1163static int si470x_vidioc_g_tuner(struct file *file, void *priv, 1240static int si470x_vidioc_g_tuner(struct file *file, void *priv,
1164 struct v4l2_tuner *tuner) 1241 struct v4l2_tuner *tuner)
1165{ 1242{
1166 int retval;
1167 struct si470x_device *radio = video_get_drvdata(video_devdata(file)); 1243 struct si470x_device *radio = video_get_drvdata(video_devdata(file));
1244 int retval;
1168 1245
1169 if (tuner->index > 0) 1246 if (tuner->index > 0)
1170 return -EINVAL; 1247 return -EINVAL;
@@ -1220,6 +1297,7 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv,
1220 struct v4l2_tuner *tuner) 1297 struct v4l2_tuner *tuner)
1221{ 1298{
1222 struct si470x_device *radio = video_get_drvdata(video_devdata(file)); 1299 struct si470x_device *radio = video_get_drvdata(video_devdata(file));
1300 int retval;
1223 1301
1224 if (tuner->index > 0) 1302 if (tuner->index > 0)
1225 return -EINVAL; 1303 return -EINVAL;
@@ -1229,7 +1307,12 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv,
1229 else 1307 else
1230 radio->registers[POWERCFG] &= ~POWERCFG_MONO; /* try stereo */ 1308 radio->registers[POWERCFG] &= ~POWERCFG_MONO; /* try stereo */
1231 1309
1232 return si470x_set_register(radio, POWERCFG); 1310 retval = si470x_set_register(radio, POWERCFG);
1311 if (retval < 0)
1312 printk(KERN_WARNING DRIVER_NAME
1313 ": set tuner failed with %d\n", retval);
1314
1315 return retval;
1233} 1316}
1234 1317
1235 1318
@@ -1255,11 +1338,17 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv,
1255 struct v4l2_frequency *freq) 1338 struct v4l2_frequency *freq)
1256{ 1339{
1257 struct si470x_device *radio = video_get_drvdata(video_devdata(file)); 1340 struct si470x_device *radio = video_get_drvdata(video_devdata(file));
1341 int retval;
1258 1342
1259 if (freq->type != V4L2_TUNER_RADIO) 1343 if (freq->type != V4L2_TUNER_RADIO)
1260 return -EINVAL; 1344 return -EINVAL;
1261 1345
1262 return si470x_set_freq(radio, freq->frequency); 1346 retval = si470x_set_freq(radio, freq->frequency);
1347 if (retval < 0)
1348 printk(KERN_WARNING DRIVER_NAME
1349 ": set frequency failed with %d\n", retval);
1350
1351 return 0;
1263} 1352}
1264 1353
1265 1354
@@ -1299,71 +1388,116 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
1299 const struct usb_device_id *id) 1388 const struct usb_device_id *id)
1300{ 1389{
1301 struct si470x_device *radio; 1390 struct si470x_device *radio;
1391 int retval = -ENOMEM;
1302 1392
1303 /* memory and interface allocations */ 1393 /* private data allocation */
1304 radio = kmalloc(sizeof(struct si470x_device), GFP_KERNEL); 1394 radio = kzalloc(sizeof(struct si470x_device), GFP_KERNEL);
1305 if (!radio) 1395 if (!radio)
1306 return -ENOMEM; 1396 goto err_initial;
1397
1398 /* video device allocation */
1307 radio->videodev = video_device_alloc(); 1399 radio->videodev = video_device_alloc();
1308 if (!radio->videodev) { 1400 if (!radio->videodev)
1309 kfree(radio); 1401 goto err_radio;
1310 return -ENOMEM; 1402
1311 } 1403 /* initial configuration */
1312 memcpy(radio->videodev, &si470x_viddev_template, 1404 memcpy(radio->videodev, &si470x_viddev_template,
1313 sizeof(si470x_viddev_template)); 1405 sizeof(si470x_viddev_template));
1314 radio->users = 0; 1406 radio->users = 0;
1315 radio->usbdev = interface_to_usbdev(intf); 1407 radio->usbdev = interface_to_usbdev(intf);
1408 radio->intf = intf;
1409 mutex_init(&radio->lock);
1316 video_set_drvdata(radio->videodev, radio); 1410 video_set_drvdata(radio->videodev, radio);
1317 if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr)) {
1318 printk(KERN_WARNING DRIVER_NAME
1319 ": Could not register video device\n");
1320 video_device_release(radio->videodev);
1321 kfree(radio);
1322 return -EIO;
1323 }
1324 usb_set_intfdata(intf, radio);
1325 1411
1326 /* show some infos about the specific device */ 1412 /* show some infos about the specific device */
1327 if (si470x_get_all_registers(radio) < 0) { 1413 retval = -EIO;
1328 video_device_release(radio->videodev); 1414 if (si470x_get_all_registers(radio) < 0)
1329 kfree(radio); 1415 goto err_all;
1330 return -EIO; 1416 printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4hx ChipID=0x%4.4hx\n",
1331 }
1332 printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4x ChipID=0x%4.4x\n",
1333 radio->registers[DEVICEID], radio->registers[CHIPID]); 1417 radio->registers[DEVICEID], radio->registers[CHIPID]);
1334 1418
1335 /* check if firmware is current */ 1419 /* check if firmware is current */
1336 if ((radio->registers[CHIPID] & CHIPID_FIRMWARE) 1420 if ((radio->registers[CHIPID] & CHIPID_FIRMWARE)
1337 < RADIO_SW_VERSION_CURRENT) 1421 < RADIO_SW_VERSION_CURRENT) {
1422 printk(KERN_WARNING DRIVER_NAME
1423 ": This driver is known to work with "
1424 "firmware version %hu,\n", RADIO_SW_VERSION_CURRENT);
1425 printk(KERN_WARNING DRIVER_NAME
1426 ": but the device has firmware version %hu.\n",
1427 radio->registers[CHIPID] & CHIPID_FIRMWARE);
1428 printk(KERN_WARNING DRIVER_NAME
1429 ": If you have some trouble using this driver,\n");
1338 printk(KERN_WARNING DRIVER_NAME 1430 printk(KERN_WARNING DRIVER_NAME
1339 ": This driver is known to work with chip version %d, " 1431 ": please report to V4L ML at "
1340 "but the device has firmware %d.\n" 1432 "video4linux-list@redhat.com\n");
1341 DRIVER_NAME 1433 }
1342 "If you have some trouble using this driver, please "
1343 "report to V4L ML at video4linux-list@redhat.com\n",
1344 radio->registers[CHIPID] & CHIPID_FIRMWARE,
1345 RADIO_SW_VERSION_CURRENT);
1346 1434
1347 /* set initial frequency */ 1435 /* set initial frequency */
1348 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ 1436 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
1349 1437
1350 /* rds initialization */ 1438 /* rds buffer allocation */
1351 radio->buf_size = rds_buf * 3; 1439 radio->buf_size = rds_buf * 3;
1352 radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); 1440 radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL);
1353 if (!radio->buffer) { 1441 if (!radio->buffer)
1354 video_device_release(radio->videodev); 1442 goto err_all;
1355 kfree(radio); 1443
1356 return -ENOMEM; 1444 /* rds buffer configuration */
1357 }
1358 radio->wr_index = 0; 1445 radio->wr_index = 0;
1359 radio->rd_index = 0; 1446 radio->rd_index = 0;
1360 init_waitqueue_head(&radio->read_queue); 1447 init_waitqueue_head(&radio->read_queue);
1361 1448
1362 /* prepare polling via eventd */ 1449 /* prepare rds work function */
1363 INIT_WORK(&radio->work, si470x_work); 1450 INIT_DELAYED_WORK(&radio->work, si470x_work);
1364 init_timer(&radio->timer); 1451
1365 radio->timer.function = si470x_timer; 1452 /* register video device */
1366 radio->timer.data = (unsigned long) radio; 1453 if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr)) {
1454 printk(KERN_WARNING DRIVER_NAME
1455 ": Could not register video device\n");
1456 goto err_all;
1457 }
1458 usb_set_intfdata(intf, radio);
1459
1460 return 0;
1461err_all:
1462 video_device_release(radio->videodev);
1463 kfree(radio->buffer);
1464err_radio:
1465 kfree(radio);
1466err_initial:
1467 return retval;
1468}
1469
1470
1471/*
1472 * si470x_usb_driver_suspend - suspend the device
1473 */
1474static int si470x_usb_driver_suspend(struct usb_interface *intf,
1475 pm_message_t message)
1476{
1477 struct si470x_device *radio = usb_get_intfdata(intf);
1478
1479 printk(KERN_INFO DRIVER_NAME ": suspending now...\n");
1480
1481 cancel_delayed_work_sync(&radio->work);
1482
1483 return 0;
1484}
1485
1486
1487/*
1488 * si470x_usb_driver_resume - resume the device
1489 */
1490static int si470x_usb_driver_resume(struct usb_interface *intf)
1491{
1492 struct si470x_device *radio = usb_get_intfdata(intf);
1493
1494 printk(KERN_INFO DRIVER_NAME ": resuming now...\n");
1495
1496 mutex_lock(&radio->lock);
1497 if (radio->users && radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS)
1498 schedule_delayed_work(&radio->work,
1499 msecs_to_jiffies(rds_poll_time));
1500 mutex_unlock(&radio->lock);
1367 1501
1368 return 0; 1502 return 0;
1369} 1503}
@@ -1376,15 +1510,11 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
1376{ 1510{
1377 struct si470x_device *radio = usb_get_intfdata(intf); 1511 struct si470x_device *radio = usb_get_intfdata(intf);
1378 1512
1379 del_timer_sync(&radio->timer); 1513 cancel_delayed_work_sync(&radio->work);
1380 flush_scheduled_work();
1381
1382 usb_set_intfdata(intf, NULL); 1514 usb_set_intfdata(intf, NULL);
1383 if (radio) { 1515 video_unregister_device(radio->videodev);
1384 video_unregister_device(radio->videodev); 1516 kfree(radio->buffer);
1385 kfree(radio->buffer); 1517 kfree(radio);
1386 kfree(radio);
1387 }
1388} 1518}
1389 1519
1390 1520
@@ -1392,10 +1522,13 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
1392 * si470x_usb_driver - usb driver interface 1522 * si470x_usb_driver - usb driver interface
1393 */ 1523 */
1394static struct usb_driver si470x_usb_driver = { 1524static struct usb_driver si470x_usb_driver = {
1395 .name = DRIVER_NAME, 1525 .name = DRIVER_NAME,
1396 .probe = si470x_usb_driver_probe, 1526 .probe = si470x_usb_driver_probe,
1397 .disconnect = si470x_usb_driver_disconnect, 1527 .disconnect = si470x_usb_driver_disconnect,
1398 .id_table = si470x_usb_driver_id_table, 1528 .suspend = si470x_usb_driver_suspend,
1529 .resume = si470x_usb_driver_resume,
1530 .id_table = si470x_usb_driver_id_table,
1531 .supports_autosuspend = 1,
1399}; 1532};
1400 1533
1401 1534
@@ -1409,7 +1542,7 @@ static struct usb_driver si470x_usb_driver = {
1409 */ 1542 */
1410static int __init si470x_module_init(void) 1543static int __init si470x_module_init(void)
1411{ 1544{
1412 printk(KERN_INFO DRIVER_DESC "\n"); 1545 printk(KERN_INFO DRIVER_DESC ", Version " DRIVER_VERSION "\n");
1413 return usb_register(&si470x_usb_driver); 1546 return usb_register(&si470x_usb_driver);
1414} 1547}
1415 1548
@@ -1429,4 +1562,4 @@ module_exit(si470x_module_exit);
1429MODULE_LICENSE("GPL"); 1562MODULE_LICENSE("GPL");
1430MODULE_AUTHOR(DRIVER_AUTHOR); 1563MODULE_AUTHOR(DRIVER_AUTHOR);
1431MODULE_DESCRIPTION(DRIVER_DESC); 1564MODULE_DESCRIPTION(DRIVER_DESC);
1432MODULE_VERSION("1.0.4"); 1565MODULE_VERSION(DRIVER_VERSION);
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index a2e8987a6195..37072a21d8c9 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -4,14 +4,14 @@
4 4
5menuconfig VIDEO_CAPTURE_DRIVERS 5menuconfig VIDEO_CAPTURE_DRIVERS
6 bool "Video capture adapters" 6 bool "Video capture adapters"
7 depends on VIDEO_DEV 7 depends on VIDEO_V4L2
8 default y 8 default y
9 ---help--- 9 ---help---
10 Say Y here to enable selecting the video adapters for 10 Say Y here to enable selecting the video adapters for
11 webcams, analog TV, and hybrid analog/digital TV. 11 webcams, analog TV, and hybrid analog/digital TV.
12 Some of those devices also supports FM radio. 12 Some of those devices also supports FM radio.
13 13
14if VIDEO_CAPTURE_DRIVERS && VIDEO_DEV 14if VIDEO_CAPTURE_DRIVERS && VIDEO_V4L2
15 15
16config VIDEO_ADV_DEBUG 16config VIDEO_ADV_DEBUG
17 bool "Enable advanced debug functionality" 17 bool "Enable advanced debug functionality"
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 850b8c6f4577..3f209b32eeac 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -10,8 +10,9 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o
10 10
11stkwebcam-objs := stk-webcam.o stk-sensor.o 11stkwebcam-objs := stk-webcam.o stk-sensor.o
12 12
13obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o compat_ioctl32.o \ 13obj-$(CONFIG_VIDEO_DEV) += videodev.o compat_ioctl32.o v4l2-int-device.o
14 v4l2-int-device.o 14
15obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o
15 16
16ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) 17ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y)
17 obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o 18 obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 907dc62c1783..5404fcc5276d 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2354,8 +2354,8 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
2354 BUG(); 2354 BUG();
2355 } 2355 }
2356 2356
2357 mutex_lock(&fh->cap.lock); 2357 mutex_lock(&fh->cap.vb_lock);
2358 kfree(fh->ov.clips); 2358 kfree(fh->ov.clips);
2359 fh->ov.clips = clips; 2359 fh->ov.clips = clips;
2360 fh->ov.nclips = n; 2360 fh->ov.nclips = n;
2361 2361
@@ -2376,7 +2376,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
2376 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); 2376 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
2377 retval = bttv_switch_overlay(btv,fh,new); 2377 retval = bttv_switch_overlay(btv,fh,new);
2378 } 2378 }
2379 mutex_unlock(&fh->cap.lock); 2379 mutex_unlock(&fh->cap.vb_lock);
2380 return retval; 2380 return retval;
2381} 2381}
2382 2382
@@ -2576,7 +2576,7 @@ static int bttv_s_fmt_cap(struct file *file, void *priv,
2576 fmt = format_by_fourcc(f->fmt.pix.pixelformat); 2576 fmt = format_by_fourcc(f->fmt.pix.pixelformat);
2577 2577
2578 /* update our state informations */ 2578 /* update our state informations */
2579 mutex_lock(&fh->cap.lock); 2579 mutex_lock(&fh->cap.vb_lock);
2580 fh->fmt = fmt; 2580 fh->fmt = fmt;
2581 fh->cap.field = f->fmt.pix.field; 2581 fh->cap.field = f->fmt.pix.field;
2582 fh->cap.last = V4L2_FIELD_NONE; 2582 fh->cap.last = V4L2_FIELD_NONE;
@@ -2585,7 +2585,7 @@ static int bttv_s_fmt_cap(struct file *file, void *priv,
2585 btv->init.fmt = fmt; 2585 btv->init.fmt = fmt;
2586 btv->init.width = f->fmt.pix.width; 2586 btv->init.width = f->fmt.pix.width;
2587 btv->init.height = f->fmt.pix.height; 2587 btv->init.height = f->fmt.pix.height;
2588 mutex_unlock(&fh->cap.lock); 2588 mutex_unlock(&fh->cap.vb_lock);
2589 2589
2590 return 0; 2590 return 0;
2591} 2591}
@@ -2611,11 +2611,11 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
2611 unsigned int i; 2611 unsigned int i;
2612 struct bttv_fh *fh = priv; 2612 struct bttv_fh *fh = priv;
2613 2613
2614 mutex_lock(&fh->cap.lock); 2614 mutex_lock(&fh->cap.vb_lock);
2615 retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, 2615 retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize,
2616 V4L2_MEMORY_MMAP); 2616 V4L2_MEMORY_MMAP);
2617 if (retval < 0) { 2617 if (retval < 0) {
2618 mutex_unlock(&fh->cap.lock); 2618 mutex_unlock(&fh->cap.vb_lock);
2619 return retval; 2619 return retval;
2620 } 2620 }
2621 2621
@@ -2627,7 +2627,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
2627 for (i = 0; i < gbuffers; i++) 2627 for (i = 0; i < gbuffers; i++)
2628 mbuf->offsets[i] = i * gbufsize; 2628 mbuf->offsets[i] = i * gbufsize;
2629 2629
2630 mutex_unlock(&fh->cap.lock); 2630 mutex_unlock(&fh->cap.vb_lock);
2631 return 0; 2631 return 0;
2632} 2632}
2633#endif 2633#endif
@@ -2756,10 +2756,11 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on)
2756 if (!check_alloc_btres(btv, fh, RESOURCE_OVERLAY)) 2756 if (!check_alloc_btres(btv, fh, RESOURCE_OVERLAY))
2757 return -EBUSY; 2757 return -EBUSY;
2758 2758
2759 mutex_lock(&fh->cap.lock); 2759 mutex_lock(&fh->cap.vb_lock);
2760 if (on) { 2760 if (on) {
2761 fh->ov.tvnorm = btv->tvnorm; 2761 fh->ov.tvnorm = btv->tvnorm;
2762 new = videobuf_pci_alloc(sizeof(*new)); 2762 new = videobuf_pci_alloc(sizeof(*new));
2763 new->crop = btv->crop[!!fh->do_crop].rect;
2763 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); 2764 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
2764 } else { 2765 } else {
2765 new = NULL; 2766 new = NULL;
@@ -2767,7 +2768,7 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on)
2767 2768
2768 /* switch over */ 2769 /* switch over */
2769 retval = bttv_switch_overlay(btv, fh, new); 2770 retval = bttv_switch_overlay(btv, fh, new);
2770 mutex_unlock(&fh->cap.lock); 2771 mutex_unlock(&fh->cap.vb_lock);
2771 return retval; 2772 return retval;
2772} 2773}
2773 2774
@@ -2806,7 +2807,7 @@ static int bttv_s_fbuf(struct file *file, void *f,
2806 } 2807 }
2807 2808
2808 /* ok, accept it */ 2809 /* ok, accept it */
2809 mutex_lock(&fh->cap.lock); 2810 mutex_lock(&fh->cap.vb_lock);
2810 btv->fbuf.base = fb->base; 2811 btv->fbuf.base = fb->base;
2811 btv->fbuf.fmt.width = fb->fmt.width; 2812 btv->fbuf.fmt.width = fb->fmt.width;
2812 btv->fbuf.fmt.height = fb->fmt.height; 2813 btv->fbuf.fmt.height = fb->fmt.height;
@@ -2838,7 +2839,7 @@ static int bttv_s_fbuf(struct file *file, void *f,
2838 retval = bttv_switch_overlay(btv, fh, new); 2839 retval = bttv_switch_overlay(btv, fh, new);
2839 } 2840 }
2840 } 2841 }
2841 mutex_unlock(&fh->cap.lock); 2842 mutex_unlock(&fh->cap.vb_lock);
2842 return retval; 2843 return retval;
2843} 2844}
2844 2845
@@ -3090,7 +3091,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop)
3090 3091
3091 fh->do_crop = 1; 3092 fh->do_crop = 1;
3092 3093
3093 mutex_lock(&fh->cap.lock); 3094 mutex_lock(&fh->cap.vb_lock);
3094 3095
3095 if (fh->width < c.min_scaled_width) { 3096 if (fh->width < c.min_scaled_width) {
3096 fh->width = c.min_scaled_width; 3097 fh->width = c.min_scaled_width;
@@ -3108,7 +3109,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop)
3108 btv->init.height = c.max_scaled_height; 3109 btv->init.height = c.max_scaled_height;
3109 } 3110 }
3110 3111
3111 mutex_unlock(&fh->cap.lock); 3112 mutex_unlock(&fh->cap.vb_lock);
3112 3113
3113 return 0; 3114 return 0;
3114} 3115}
@@ -3177,30 +3178,25 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
3177 buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); 3178 buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
3178 } else { 3179 } else {
3179 /* read() capture */ 3180 /* read() capture */
3180 mutex_lock(&fh->cap.lock); 3181 mutex_lock(&fh->cap.vb_lock);
3181 if (NULL == fh->cap.read_buf) { 3182 if (NULL == fh->cap.read_buf) {
3182 /* need to capture a new frame */ 3183 /* need to capture a new frame */
3183 if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) { 3184 if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM))
3184 mutex_unlock(&fh->cap.lock); 3185 goto err;
3185 return POLLERR;
3186 }
3187 fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize); 3186 fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize);
3188 if (NULL == fh->cap.read_buf) { 3187 if (NULL == fh->cap.read_buf)
3189 mutex_unlock(&fh->cap.lock); 3188 goto err;
3190 return POLLERR;
3191 }
3192 fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; 3189 fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR;
3193 field = videobuf_next_field(&fh->cap); 3190 field = videobuf_next_field(&fh->cap);
3194 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { 3191 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) {
3195 kfree (fh->cap.read_buf); 3192 kfree (fh->cap.read_buf);
3196 fh->cap.read_buf = NULL; 3193 fh->cap.read_buf = NULL;
3197 mutex_unlock(&fh->cap.lock); 3194 goto err;
3198 return POLLERR;
3199 } 3195 }
3200 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); 3196 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
3201 fh->cap.read_off = 0; 3197 fh->cap.read_off = 0;
3202 } 3198 }
3203 mutex_unlock(&fh->cap.lock); 3199 mutex_unlock(&fh->cap.vb_lock);
3204 buf = (struct bttv_buffer*)fh->cap.read_buf; 3200 buf = (struct bttv_buffer*)fh->cap.read_buf;
3205 } 3201 }
3206 3202
@@ -3209,6 +3205,9 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
3209 buf->vb.state == VIDEOBUF_ERROR) 3205 buf->vb.state == VIDEOBUF_ERROR)
3210 return POLLIN|POLLRDNORM; 3206 return POLLIN|POLLRDNORM;
3211 return 0; 3207 return 0;
3208err:
3209 mutex_unlock(&fh->cap.vb_lock);
3210 return POLLERR;
3212} 3211}
3213 3212
3214static int bttv_open(struct inode *inode, struct file *file) 3213static int bttv_open(struct inode *inode, struct file *file)
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c
index 1f0cc79e2a33..75fa82c7c735 100644
--- a/drivers/media/video/bt8xx/bttv-vbi.c
+++ b/drivers/media/video/bt8xx/bttv-vbi.c
@@ -352,13 +352,13 @@ int bttv_s_fmt_vbi(struct file *file, void *f, struct v4l2_format *frt)
352 because vbi_fmt.end counts field lines times two. */ 352 because vbi_fmt.end counts field lines times two. */
353 end = max(frt->fmt.vbi.start[0], start1) * 2 + 2; 353 end = max(frt->fmt.vbi.start[0], start1) * 2 + 2;
354 354
355 mutex_lock(&fh->vbi.lock); 355 mutex_lock(&fh->vbi.vb_lock);
356 356
357 fh->vbi_fmt.fmt = frt->fmt.vbi; 357 fh->vbi_fmt.fmt = frt->fmt.vbi;
358 fh->vbi_fmt.tvnorm = tvnorm; 358 fh->vbi_fmt.tvnorm = tvnorm;
359 fh->vbi_fmt.end = end; 359 fh->vbi_fmt.end = end;
360 360
361 mutex_unlock(&fh->vbi.lock); 361 mutex_unlock(&fh->vbi.vb_lock);
362 362
363 rc = 0; 363 rc = 0;
364 364
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index 0aedbeaf94cd..e357f415db06 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -609,13 +609,19 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
609 struct cx88_core *core = drv->core; 609 struct cx88_core *core = drv->core;
610 610
611 /* Fail a request for hardware if the device is busy. */ 611 /* Fail a request for hardware if the device is busy. */
612 if (core->active_type_id != CX88_BOARD_NONE) 612 if (core->active_type_id != CX88_BOARD_NONE &&
613 core->active_type_id != drv->type_id)
613 return -EBUSY; 614 return -EBUSY;
614 615
615 if (drv->advise_acquire) 616 if (drv->advise_acquire)
616 { 617 {
617 core->active_type_id = drv->type_id; 618 mutex_lock(&drv->core->lock);
618 drv->advise_acquire(drv); 619 core->active_ref++;
620 if (core->active_type_id == CX88_BOARD_NONE) {
621 core->active_type_id = drv->type_id;
622 drv->advise_acquire(drv);
623 }
624 mutex_unlock(&drv->core->lock);
619 625
620 mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); 626 mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO));
621 } 627 }
@@ -628,12 +634,14 @@ static int cx8802_request_release(struct cx8802_driver *drv)
628{ 634{
629 struct cx88_core *core = drv->core; 635 struct cx88_core *core = drv->core;
630 636
631 if (drv->advise_release) 637 mutex_lock(&drv->core->lock);
638 if (drv->advise_release && --core->active_ref == 0)
632 { 639 {
633 drv->advise_release(drv); 640 drv->advise_release(drv);
634 core->active_type_id = CX88_BOARD_NONE; 641 core->active_type_id = CX88_BOARD_NONE;
635 mpeg_dbg(1,"%s() Post release GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); 642 mpeg_dbg(1,"%s() Post release GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO));
636 } 643 }
644 mutex_unlock(&drv->core->lock);
637 645
638 return 0; 646 return 0;
639} 647}
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 4e823f2a539a..37e6d2e4002f 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -336,6 +336,7 @@ struct cx88_core {
336 /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ 336 /* cx88-video needs to access cx8802 for hybrid tuner pll access. */
337 struct cx8802_dev *dvbdev; 337 struct cx8802_dev *dvbdev;
338 enum cx88_board_type active_type_id; 338 enum cx88_board_type active_type_id;
339 int active_ref;
339}; 340};
340 341
341struct cx8800_dev; 342struct cx8800_dev;
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 941357c4f3f5..8c67f678266a 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -35,7 +35,6 @@
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36#include <linux/proc_fs.h> 36#include <linux/proc_fs.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <sound/driver.h>
39#include <sound/core.h> 38#include <sound/core.h>
40#include <sound/pcm.h> 39#include <sound/pcm.h>
41#include <sound/pcm_params.h> 40#include <sound/pcm_params.h>
@@ -270,8 +269,11 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
270 dprintk("opening device and trying to acquire exclusive lock\n"); 269 dprintk("opening device and trying to acquire exclusive lock\n");
271 270
272 /* Sets volume, mute, etc */ 271 /* Sets volume, mute, etc */
272
273 dev->mute = 0; 273 dev->mute = 0;
274 mutex_lock(&dev->lock);
274 ret = em28xx_audio_analog_set(dev); 275 ret = em28xx_audio_analog_set(dev);
276 mutex_unlock(&dev->lock);
275 if (ret < 0) 277 if (ret < 0)
276 goto err; 278 goto err;
277 279
@@ -303,7 +305,9 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream)
303 dprintk("closing device\n"); 305 dprintk("closing device\n");
304 306
305 dev->mute = 1; 307 dev->mute = 1;
308 mutex_lock(&dev->lock);
306 em28xx_audio_analog_set(dev); 309 em28xx_audio_analog_set(dev);
310 mutex_unlock(&dev->lock);
307 311
308 if (dev->adev->users == 0 && dev->adev->shutdown == 1) { 312 if (dev->adev->users == 0 && dev->adev->shutdown == 1) {
309 dprintk("audio users: %d\n", dev->adev->users); 313 dprintk("audio users: %d\n", dev->adev->users);
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 2159d0160df2..aae7753fef11 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -393,15 +393,15 @@ struct em28xx_board em28xx_boards[] = {
393 .input = { { 393 .input = { {
394 .type = EM28XX_VMUX_TELEVISION, 394 .type = EM28XX_VMUX_TELEVISION,
395 .vmux = SAA7115_COMPOSITE2, 395 .vmux = SAA7115_COMPOSITE2,
396 .amux = 1, 396 .amux = EM28XX_AMUX_LINE_IN,
397 }, { 397 }, {
398 .type = EM28XX_VMUX_COMPOSITE1, 398 .type = EM28XX_VMUX_COMPOSITE1,
399 .vmux = SAA7115_COMPOSITE0, 399 .vmux = SAA7115_COMPOSITE0,
400 .amux = 1, 400 .amux = EM28XX_AMUX_LINE_IN,
401 }, { 401 }, {
402 .type = EM28XX_VMUX_SVIDEO, 402 .type = EM28XX_VMUX_SVIDEO,
403 .vmux = SAA7115_SVIDEO3, 403 .vmux = SAA7115_SVIDEO3,
404 .amux = 1, 404 .amux = EM28XX_AMUX_LINE_IN,
405 } }, 405 } },
406 }, 406 },
407}; 407};
@@ -441,6 +441,8 @@ struct usb_device_id em28xx_id_table [] = {
441 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, 441 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
442 { USB_DEVICE(0x2040, 0x6500), 442 { USB_DEVICE(0x2040, 0x6500),
443 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 }, 443 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
444 { USB_DEVICE(0x2040, 0x6502),
445 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
444 { USB_DEVICE(0x2040, 0x6513), 446 { USB_DEVICE(0x2040, 0x6513),
445 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 }, 447 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 },
446 { USB_DEVICE(0x0ccd, 0x0042), 448 { USB_DEVICE(0x0ccd, 0x0042),
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index f6b78357f0e5..7d1537cab867 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -72,7 +72,8 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count)
72 const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ 72 const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */
73 void *buff = NULL; 73 void *buff = NULL;
74 u32 i; 74 u32 i;
75 em28xx_coredbg("requested %i buffers with size %zi", count, imagesize); 75 em28xx_coredbg("requested %i buffers with size %zi\n",
76 count, imagesize);
76 if (count > EM28XX_NUM_FRAMES) 77 if (count > EM28XX_NUM_FRAMES)
77 count = EM28XX_NUM_FRAMES; 78 count = EM28XX_NUM_FRAMES;
78 79
@@ -150,7 +151,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
150 if (reg_debug){ 151 if (reg_debug){
151 printk(ret < 0 ? " failed!\n" : "%02x values: ", ret); 152 printk(ret < 0 ? " failed!\n" : "%02x values: ", ret);
152 for (byte = 0; byte < len; byte++) { 153 for (byte = 0; byte < len; byte++) {
153 printk(" %02x", buf[byte]); 154 printk(" %02x", (unsigned char)buf[byte]);
154 } 155 }
155 printk("\n"); 156 printk("\n");
156 } 157 }
@@ -177,7 +178,8 @@ int em28xx_read_reg_req(struct em28xx *dev, u8 req, u16 reg)
177 0x0000, reg, &val, 1, HZ); 178 0x0000, reg, &val, 1, HZ);
178 179
179 if (reg_debug) 180 if (reg_debug)
180 printk(ret < 0 ? " failed!\n" : "%02x\n", val); 181 printk(ret < 0 ? " failed!\n" :
182 "%02x\n", (unsigned char) val);
181 183
182 if (ret < 0) 184 if (ret < 0)
183 return ret; 185 return ret;
@@ -237,7 +239,7 @@ int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len)
237 * sets only some bits (specified by bitmask) of a register, by first reading 239 * sets only some bits (specified by bitmask) of a register, by first reading
238 * the actual value 240 * the actual value
239 */ 241 */
240int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, 242static int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
241 u8 bitmask) 243 u8 bitmask)
242{ 244{
243 int oldval; 245 int oldval;
@@ -254,26 +256,31 @@ int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
254 */ 256 */
255static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val) 257static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
256{ 258{
257 int ret; 259 int ret, i;
258 u8 addr = reg & 0x7f; 260 u8 addr = reg & 0x7f;
259 if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0) 261 if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0)
260 return ret; 262 return ret;
261 if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0) 263 if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0)
262 return ret; 264 return ret;
263 if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) 265
264 return ret; 266 /* Wait up to 50 ms for AC97 command to complete */
265 else if (((u8) ret) & 0x01) { 267 for (i = 0; i < 10; i++) {
266 em28xx_warn ("AC97 command still being executed: not handled properly!\n"); 268 if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0)
269 return ret;
270 if (!((u8) ret) & 0x01)
271 return 0;
272 msleep(5);
267 } 273 }
274 em28xx_warn ("AC97 command still being executed: not handled properly!\n");
268 return 0; 275 return 0;
269} 276}
270 277
271int em28xx_set_audio_source(struct em28xx *dev) 278static int em28xx_set_audio_source(struct em28xx *dev)
272{ 279{
273 static char *enable = "\x08\x08"; 280 static char *enable = "\x08\x08";
274 static char *disable = "\x08\x88"; 281 static char *disable = "\x08\x88";
275 char *video = enable, *line = disable; 282 char *video = enable, *line = disable;
276 int ret, no_ac97; 283 int ret;
277 u8 input; 284 u8 input;
278 285
279 if (dev->is_em2800) { 286 if (dev->is_em2800) {
@@ -293,11 +300,9 @@ int em28xx_set_audio_source(struct em28xx *dev)
293 switch (dev->ctl_ainput) { 300 switch (dev->ctl_ainput) {
294 case EM28XX_AMUX_VIDEO: 301 case EM28XX_AMUX_VIDEO:
295 input = EM28XX_AUDIO_SRC_TUNER; 302 input = EM28XX_AUDIO_SRC_TUNER;
296 no_ac97 = 1;
297 break; 303 break;
298 case EM28XX_AMUX_LINE_IN: 304 case EM28XX_AMUX_LINE_IN:
299 input = EM28XX_AUDIO_SRC_LINE; 305 input = EM28XX_AUDIO_SRC_LINE;
300 no_ac97 = 1;
301 break; 306 break;
302 case EM28XX_AMUX_AC97_VIDEO: 307 case EM28XX_AMUX_AC97_VIDEO:
303 input = EM28XX_AUDIO_SRC_LINE; 308 input = EM28XX_AUDIO_SRC_LINE;
@@ -313,12 +318,11 @@ int em28xx_set_audio_source(struct em28xx *dev)
313 ret = em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0); 318 ret = em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0);
314 if (ret < 0) 319 if (ret < 0)
315 return ret; 320 return ret;
321 msleep(5);
316 322
317 if (no_ac97) 323 /* Sets AC97 mixer registers
318 return 0; 324 This is seems to be needed, even for non-ac97 configs
319 325 */
320 /* Sets AC97 mixer registers */
321
322 ret = em28xx_write_ac97(dev, VIDEO_AC97, video); 326 ret = em28xx_write_ac97(dev, VIDEO_AC97, video);
323 if (ret < 0) 327 if (ret < 0)
324 return ret; 328 return ret;
@@ -337,9 +341,10 @@ int em28xx_audio_analog_set(struct em28xx *dev)
337 s[0] |= 0x1f - dev->volume; 341 s[0] |= 0x1f - dev->volume;
338 s[1] |= 0x1f - dev->volume; 342 s[1] |= 0x1f - dev->volume;
339 343
340 if (dev->mute) 344 /* Mute */
341 s[1] |= 0x80; 345 s[1] |= 0x80;
342 ret = em28xx_write_ac97(dev, MASTER_AC97, s); 346 ret = em28xx_write_ac97(dev, MASTER_AC97, s);
347
343 if (ret < 0) 348 if (ret < 0)
344 return ret; 349 return ret;
345 350
@@ -357,6 +362,11 @@ int em28xx_audio_analog_set(struct em28xx *dev)
357 /* Selects the proper audio input */ 362 /* Selects the proper audio input */
358 ret = em28xx_set_audio_source(dev); 363 ret = em28xx_set_audio_source(dev);
359 364
365 /* Unmute device */
366 if (!dev->mute)
367 s[1] &= ~0x80;
368 ret = em28xx_write_ac97(dev, MASTER_AC97, s);
369
360 return ret; 370 return ret;
361} 371}
362EXPORT_SYMBOL_GPL(em28xx_audio_analog_set); 372EXPORT_SYMBOL_GPL(em28xx_audio_analog_set);
@@ -667,7 +677,7 @@ static void em28xx_isocIrq(struct urb *urb)
667 continue; 677 continue;
668 } 678 }
669 if (urb->iso_frame_desc[i].actual_length > 679 if (urb->iso_frame_desc[i].actual_length >
670 dev->max_pkt_size) { 680 urb->iso_frame_desc[i].length) {
671 em28xx_isocdbg("packet bigger than packet size"); 681 em28xx_isocdbg("packet bigger than packet size");
672 continue; 682 continue;
673 } 683 }
@@ -713,8 +723,11 @@ void em28xx_uninit_isoc(struct em28xx *dev)
713 for (i = 0; i < EM28XX_NUM_BUFS; i++) { 723 for (i = 0; i < EM28XX_NUM_BUFS; i++) {
714 if (dev->urb[i]) { 724 if (dev->urb[i]) {
715 usb_kill_urb(dev->urb[i]); 725 usb_kill_urb(dev->urb[i]);
716 if (dev->transfer_buffer[i]){ 726 if (dev->transfer_buffer[i]) {
717 usb_buffer_free(dev->udev,(EM28XX_NUM_PACKETS*dev->max_pkt_size),dev->transfer_buffer[i],dev->urb[i]->transfer_dma); 727 usb_buffer_free(dev->udev,
728 dev->urb[i]->transfer_buffer_length,
729 dev->transfer_buffer[i],
730 dev->urb[i]->transfer_dma);
718 } 731 }
719 usb_free_urb(dev->urb[i]); 732 usb_free_urb(dev->urb[i]);
720 } 733 }
@@ -732,7 +745,10 @@ int em28xx_init_isoc(struct em28xx *dev)
732{ 745{
733 /* change interface to 3 which allows the biggest packet sizes */ 746 /* change interface to 3 which allows the biggest packet sizes */
734 int i, errCode; 747 int i, errCode;
735 const int sb_size = EM28XX_NUM_PACKETS * dev->max_pkt_size; 748 int sb_size;
749
750 em28xx_set_alternate(dev);
751 sb_size = EM28XX_NUM_PACKETS * dev->max_pkt_size;
736 752
737 /* reset streaming vars */ 753 /* reset streaming vars */
738 dev->frame_current = NULL; 754 dev->frame_current = NULL;
@@ -741,7 +757,7 @@ int em28xx_init_isoc(struct em28xx *dev)
741 /* allocate urbs */ 757 /* allocate urbs */
742 for (i = 0; i < EM28XX_NUM_BUFS; i++) { 758 for (i = 0; i < EM28XX_NUM_BUFS; i++) {
743 struct urb *urb; 759 struct urb *urb;
744 int j, k; 760 int j;
745 /* allocate transfer buffer */ 761 /* allocate transfer buffer */
746 urb = usb_alloc_urb(EM28XX_NUM_PACKETS, GFP_KERNEL); 762 urb = usb_alloc_urb(EM28XX_NUM_PACKETS, GFP_KERNEL);
747 if (!urb){ 763 if (!urb){
@@ -749,7 +765,9 @@ int em28xx_init_isoc(struct em28xx *dev)
749 em28xx_uninit_isoc(dev); 765 em28xx_uninit_isoc(dev);
750 return -ENOMEM; 766 return -ENOMEM;
751 } 767 }
752 dev->transfer_buffer[i] = usb_buffer_alloc(dev->udev, sb_size, GFP_KERNEL,&urb->transfer_dma); 768 dev->transfer_buffer[i] = usb_buffer_alloc(dev->udev, sb_size,
769 GFP_KERNEL,
770 &urb->transfer_dma);
753 if (!dev->transfer_buffer[i]) { 771 if (!dev->transfer_buffer[i]) {
754 em28xx_errdev 772 em28xx_errdev
755 ("unable to allocate %i bytes for transfer buffer %i\n", 773 ("unable to allocate %i bytes for transfer buffer %i\n",
@@ -762,22 +780,22 @@ int em28xx_init_isoc(struct em28xx *dev)
762 urb->dev = dev->udev; 780 urb->dev = dev->udev;
763 urb->context = dev; 781 urb->context = dev;
764 urb->pipe = usb_rcvisocpipe(dev->udev, 0x82); 782 urb->pipe = usb_rcvisocpipe(dev->udev, 0x82);
765 urb->transfer_flags = URB_ISO_ASAP; 783 urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
766 urb->interval = 1; 784 urb->interval = 1;
767 urb->transfer_buffer = dev->transfer_buffer[i]; 785 urb->transfer_buffer = dev->transfer_buffer[i];
768 urb->complete = em28xx_isocIrq; 786 urb->complete = em28xx_isocIrq;
769 urb->number_of_packets = EM28XX_NUM_PACKETS; 787 urb->number_of_packets = EM28XX_NUM_PACKETS;
770 urb->transfer_buffer_length = sb_size; 788 urb->transfer_buffer_length = sb_size;
771 for (j = k = 0; j < EM28XX_NUM_PACKETS; 789 for (j = 0; j < EM28XX_NUM_PACKETS; j++) {
772 j++, k += dev->max_pkt_size) { 790 urb->iso_frame_desc[j].offset = j * dev->max_pkt_size;
773 urb->iso_frame_desc[j].offset = k; 791 urb->iso_frame_desc[j].length = dev->max_pkt_size;
774 urb->iso_frame_desc[j].length =
775 dev->max_pkt_size;
776 } 792 }
777 dev->urb[i] = urb; 793 dev->urb[i] = urb;
778 } 794 }
779 795
780 /* submit urbs */ 796 /* submit urbs */
797 em28xx_coredbg("Submitting %d urbs of %d packets (%d each)\n",
798 EM28XX_NUM_BUFS, EM28XX_NUM_PACKETS, dev->max_pkt_size);
781 for (i = 0; i < EM28XX_NUM_BUFS; i++) { 799 for (i = 0; i < EM28XX_NUM_BUFS; i++) {
782 errCode = usb_submit_urb(dev->urb[i], GFP_KERNEL); 800 errCode = usb_submit_urb(dev->urb[i], GFP_KERNEL);
783 if (errCode) { 801 if (errCode) {
@@ -794,22 +812,31 @@ int em28xx_init_isoc(struct em28xx *dev)
794int em28xx_set_alternate(struct em28xx *dev) 812int em28xx_set_alternate(struct em28xx *dev)
795{ 813{
796 int errCode, prev_alt = dev->alt; 814 int errCode, prev_alt = dev->alt;
797 dev->alt = alt; 815 int i;
798 if (dev->alt == 0) { 816 unsigned int min_pkt_size = dev->bytesperline+4;
799 int i; 817
800 for(i=0;i< dev->num_alt; i++) 818 /* When image size is bigger than a ceirtain value,
801 if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->alt]) 819 the frame size should be increased, otherwise, only
802 dev->alt=i; 820 green screen will be received.
803 } 821 */
822 if (dev->frame_size > 720*240*2)
823 min_pkt_size *= 2;
824
825 for (i = 0; i < dev->num_alt; i++)
826 if (dev->alt_max_pkt_size[i] >= min_pkt_size)
827 break;
828 dev->alt = i;
804 829
805 if (dev->alt != prev_alt) { 830 if (dev->alt != prev_alt) {
831 em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n",
832 min_pkt_size, dev->alt);
806 dev->max_pkt_size = dev->alt_max_pkt_size[dev->alt]; 833 dev->max_pkt_size = dev->alt_max_pkt_size[dev->alt];
807 em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n", dev->alt, 834 em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n",
808 dev->max_pkt_size); 835 dev->alt, dev->max_pkt_size);
809 errCode = usb_set_interface(dev->udev, 0, dev->alt); 836 errCode = usb_set_interface(dev->udev, 0, dev->alt);
810 if (errCode < 0) { 837 if (errCode < 0) {
811 em28xx_errdev ("cannot change alternate number to %d (error=%i)\n", 838 em28xx_errdev ("cannot change alternate number to %d (error=%i)\n",
812 dev->alt, errCode); 839 dev->alt, errCode);
813 return errCode; 840 return errCode;
814 } 841 }
815 } 842 }
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index a0c334672488..4abe6701a770 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -189,7 +189,7 @@ static void video_mux(struct em28xx *dev, int index)
189 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route); 189 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route);
190 } 190 }
191 191
192 em28xx_set_audio_source(dev); 192 em28xx_audio_analog_set(dev);
193} 193}
194 194
195/* Usage lock check functions */ 195/* Usage lock check functions */
@@ -830,6 +830,63 @@ static int vidioc_s_frequency(struct file *file, void *priv,
830 return 0; 830 return 0;
831} 831}
832 832
833#ifdef CONFIG_VIDEO_ADV_DEBUG
834static int em28xx_reg_len(int reg)
835{
836 switch (reg) {
837 case AC97LSB_REG:
838 case HSCALELOW_REG:
839 case VSCALELOW_REG:
840 return 2;
841 default:
842 return 1;
843 }
844}
845
846static int vidioc_g_register(struct file *file, void *priv,
847 struct v4l2_register *reg)
848{
849 struct em28xx_fh *fh = priv;
850 struct em28xx *dev = fh->dev;
851 int ret;
852
853 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
854 return -EINVAL;
855
856 if (em28xx_reg_len(reg->reg) == 1) {
857 ret = em28xx_read_reg(dev, reg->reg);
858 if (ret < 0)
859 return ret;
860
861 reg->val = ret;
862 } else {
863 u64 val = 0;
864 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS,
865 reg->reg, (char *)&val, 2);
866 if (ret < 0)
867 return ret;
868
869 reg->val = cpu_to_le64((__u64)val);
870 }
871
872 return 0;
873}
874
875static int vidioc_s_register(struct file *file, void *priv,
876 struct v4l2_register *reg)
877{
878 struct em28xx_fh *fh = priv;
879 struct em28xx *dev = fh->dev;
880 u64 buf;
881
882 buf = le64_to_cpu((__u64)reg->val);
883
884 return em28xx_write_regs(dev, reg->reg, (char *)&buf,
885 em28xx_reg_len(reg->reg));
886}
887#endif
888
889
833static int vidioc_cropcap(struct file *file, void *priv, 890static int vidioc_cropcap(struct file *file, void *priv,
834 struct v4l2_cropcap *cc) 891 struct v4l2_cropcap *cc)
835{ 892{
@@ -1295,8 +1352,6 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
1295 filp->private_data = fh; 1352 filp->private_data = fh;
1296 1353
1297 if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { 1354 if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) {
1298 em28xx_set_alternate(dev);
1299
1300 dev->width = norm_maxw(dev); 1355 dev->width = norm_maxw(dev);
1301 dev->height = norm_maxh(dev); 1356 dev->height = norm_maxh(dev);
1302 dev->frame_size = dev->width * dev->height * 2; 1357 dev->frame_size = dev->width * dev->height * 2;
@@ -1305,6 +1360,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
1305 dev->hscale = 0; 1360 dev->hscale = 0;
1306 dev->vscale = 0; 1361 dev->vscale = 0;
1307 1362
1363 em28xx_set_alternate(dev);
1308 em28xx_capture_start(dev, 1); 1364 em28xx_capture_start(dev, 1);
1309 em28xx_resolution_set(dev); 1365 em28xx_resolution_set(dev);
1310 1366
@@ -1730,6 +1786,10 @@ static const struct video_device em28xx_video_template = {
1730 .vidioc_s_tuner = vidioc_s_tuner, 1786 .vidioc_s_tuner = vidioc_s_tuner,
1731 .vidioc_g_frequency = vidioc_g_frequency, 1787 .vidioc_g_frequency = vidioc_g_frequency,
1732 .vidioc_s_frequency = vidioc_s_frequency, 1788 .vidioc_s_frequency = vidioc_s_frequency,
1789#ifdef CONFIG_VIDEO_ADV_DEBUG
1790 .vidioc_g_register = vidioc_g_register,
1791 .vidioc_s_register = vidioc_s_register,
1792#endif
1733 1793
1734 .tvnorms = V4L2_STD_ALL, 1794 .tvnorms = V4L2_STD_ALL,
1735 .current_norm = V4L2_STD_PAL, 1795 .current_norm = V4L2_STD_PAL,
@@ -1752,6 +1812,10 @@ static struct video_device em28xx_radio_template = {
1752 .vidioc_s_ctrl = vidioc_s_ctrl, 1812 .vidioc_s_ctrl = vidioc_s_ctrl,
1753 .vidioc_g_frequency = vidioc_g_frequency, 1813 .vidioc_g_frequency = vidioc_g_frequency,
1754 .vidioc_s_frequency = vidioc_s_frequency, 1814 .vidioc_s_frequency = vidioc_s_frequency,
1815#ifdef CONFIG_VIDEO_ADV_DEBUG
1816 .vidioc_g_register = vidioc_g_register,
1817 .vidioc_s_register = vidioc_s_register,
1818#endif
1755}; 1819};
1756 1820
1757/******************************** usb interface *****************************************/ 1821/******************************** usb interface *****************************************/
@@ -1796,10 +1860,10 @@ void em28xx_unregister_extension(struct em28xx_ops *ops)
1796} 1860}
1797EXPORT_SYMBOL(em28xx_unregister_extension); 1861EXPORT_SYMBOL(em28xx_unregister_extension);
1798 1862
1799struct video_device *em28xx_vdev_init(struct em28xx *dev, 1863static struct video_device *em28xx_vdev_init(struct em28xx *dev,
1800 const struct video_device *template, 1864 const struct video_device *template,
1801 const int type, 1865 const int type,
1802 const char *type_name) 1866 const char *type_name)
1803{ 1867{
1804 struct video_device *vfd; 1868 struct video_device *vfd;
1805 1869
@@ -2064,6 +2128,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
2064 snprintf(dev->name, 29, "em28xx #%d", nr); 2128 snprintf(dev->name, 29, "em28xx #%d", nr);
2065 dev->devno = nr; 2129 dev->devno = nr;
2066 dev->model = id->driver_info; 2130 dev->model = id->driver_info;
2131 dev->alt = -1;
2067 2132
2068 /* Checks if audio is provided by some interface */ 2133 /* Checks if audio is provided by some interface */
2069 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) { 2134 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index f3bad0c1c517..04e0e48ecabe 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -33,7 +33,7 @@
33#define UNSET -1 33#define UNSET -1
34 34
35/* maximum number of em28xx boards */ 35/* maximum number of em28xx boards */
36#define EM28XX_MAXBOARDS 1 /*FIXME: should be bigger */ 36#define EM28XX_MAXBOARDS 4 /*FIXME: should be bigger */
37 37
38/* maximum number of frames that can be queued */ 38/* maximum number of frames that can be queued */
39#define EM28XX_NUM_FRAMES 5 39#define EM28XX_NUM_FRAMES 5
@@ -345,9 +345,6 @@ int em28xx_read_reg(struct em28xx *dev, u16 reg);
345int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, 345int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
346 int len); 346 int len);
347int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len); 347int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len);
348int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
349 u8 bitmask);
350int em28xx_set_audio_source(struct em28xx *dev);
351int em28xx_audio_analog_set(struct em28xx *dev); 348int em28xx_audio_analog_set(struct em28xx *dev);
352 349
353int em28xx_colorlevels_set_default(struct em28xx *dev); 350int em28xx_colorlevels_set_default(struct em28xx *dev);
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 7d7f383b404f..262830da08c8 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -928,27 +928,38 @@ struct saa7134_board saa7134_boards[] = {
928 .tuner_addr = ADDR_UNSET, 928 .tuner_addr = ADDR_UNSET,
929 .radio_addr = ADDR_UNSET, 929 .radio_addr = ADDR_UNSET,
930 .tda9887_conf = TDA9887_PRESENT, 930 .tda9887_conf = TDA9887_PRESENT,
931 .gpiomask = 0x03,
931 .inputs = {{ 932 .inputs = {{
932 .name = name_tv, 933 .name = name_tv,
933 .vmux = 1, 934 .vmux = 1,
934 .amux = TV, 935 .amux = TV,
935 .tv = 1, 936 .tv = 1,
936 },{ 937 .gpio = 0x00,
938 }, {
937 .name = name_comp1, 939 .name = name_comp1,
938 .vmux = 0,
939 .amux = LINE2,
940 },{
941 .name = name_comp2,
942 .vmux = 3, 940 .vmux = 3,
943 .amux = LINE2, 941 .amux = LINE1,
944 },{ 942 .gpio = 0x02,
943 }, {
944 .name = name_comp2,
945 .vmux = 0,
946 .amux = LINE1,
947 .gpio = 0x02,
948 }, {
945 .name = name_svideo, 949 .name = name_svideo,
946 .vmux = 8, 950 .vmux = 8,
947 .amux = LINE2, 951 .amux = LINE1,
948 }}, 952 .gpio = 0x02,
953 } },
949 .radio = { 954 .radio = {
950 .name = name_radio, 955 .name = name_radio,
951 .amux = LINE2, 956 .amux = LINE1,
957 .gpio = 0x01,
958 },
959 .mute = {
960 .name = name_mute,
961 .amux = TV,
962 .gpio = 0x00,
952 }, 963 },
953 }, 964 },
954 [SAA7134_BOARD_BMK_MPEX_TUNER] = { 965 [SAA7134_BOARD_BMK_MPEX_TUNER] = {
@@ -3912,6 +3923,74 @@ struct saa7134_board saa7134_boards[] = {
3912 }, 3923 },
3913 .mpeg = SAA7134_MPEG_EMPRESS, 3924 .mpeg = SAA7134_MPEG_EMPRESS,
3914 }, 3925 },
3926 [SAA7134_BOARD_TWINHAN_DTV_DVB_3056] = {
3927 .name = "Twinhan Hybrid DTV-DVB 3056 PCI",
3928 .audio_clock = 0x00187de7,
3929 .tuner_type = TUNER_PHILIPS_TDA8290,
3930 .radio_type = UNSET,
3931 .tuner_addr = ADDR_UNSET,
3932 .radio_addr = ADDR_UNSET,
3933 .tuner_config = 2,
3934 .mpeg = SAA7134_MPEG_DVB,
3935 .gpiomask = 0x0200000,
3936 .inputs = {{
3937 .name = name_tv,
3938 .vmux = 1,
3939 .amux = TV,
3940 .tv = 1,
3941 }, {
3942 .name = name_comp1,
3943 .vmux = 3,
3944 .amux = LINE1,
3945 }, {
3946 .name = name_svideo,
3947 .vmux = 8, /* untested */
3948 .amux = LINE1,
3949 } },
3950 .radio = {
3951 .name = name_radio,
3952 .amux = TV,
3953 .gpio = 0x0200000,
3954 },
3955 },
3956 [SAA7134_BOARD_GENIUS_TVGO_A11MCE] = {
3957 /* Adrian Pardini <pardo.bsso@gmail.com> */
3958 .name = "Genius TVGO AM11MCE",
3959 .audio_clock = 0x00200000,
3960 .tuner_type = TUNER_TNF_5335MF,
3961 .radio_type = UNSET,
3962 .tuner_addr = ADDR_UNSET,
3963 .radio_addr = ADDR_UNSET,
3964 .gpiomask = 0xf000,
3965 .inputs = {{
3966 .name = name_tv_mono,
3967 .vmux = 1,
3968 .amux = LINE2,
3969 .gpio = 0x0000,
3970 .tv = 1,
3971 }, {
3972 .name = name_comp1,
3973 .vmux = 3,
3974 .amux = LINE1,
3975 .gpio = 0x2000,
3976 .tv = 1
3977 }, {
3978 .name = name_svideo,
3979 .vmux = 8,
3980 .amux = LINE1,
3981 .gpio = 0x2000,
3982 } },
3983 .radio = {
3984 .name = name_radio,
3985 .amux = LINE2,
3986 .gpio = 0x1000,
3987 },
3988 .mute = {
3989 .name = name_mute,
3990 .amux = LINE2,
3991 .gpio = 0x6000,
3992 },
3993 },
3915}; 3994};
3916 3995
3917const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); 3996const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -4511,6 +4590,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
4511 },{ 4590 },{
4512 .vendor = PCI_VENDOR_ID_PHILIPS, 4591 .vendor = PCI_VENDOR_ID_PHILIPS,
4513 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 4592 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
4593 .subvendor = 0x5168,
4594 .subdevice = 0x3307, /* FlyDVB-T Hybrid Mini PCI */
4595 .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS,
4596 }, {
4597 .vendor = PCI_VENDOR_ID_PHILIPS,
4598 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
4514 .subvendor = 0x16be, 4599 .subvendor = 0x16be,
4515 .subdevice = 0x0007, 4600 .subdevice = 0x0007,
4516 .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO, 4601 .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO,
@@ -4523,6 +4608,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
4523 },{ 4608 },{
4524 .vendor = PCI_VENDOR_ID_PHILIPS, 4609 .vendor = PCI_VENDOR_ID_PHILIPS,
4525 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 4610 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
4611 .subvendor = 0x16be,
4612 .subdevice = 0x000d, /* triple CTX948_V1.1.1 */
4613 .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO,
4614 }, {
4615 .vendor = PCI_VENDOR_ID_PHILIPS,
4616 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
4526 .subvendor = 0x1461, 4617 .subvendor = 0x1461,
4527 .subdevice = 0x2c05, 4618 .subdevice = 0x2c05,
4528 .driver_data = SAA7134_BOARD_AVERMEDIA_777, 4619 .driver_data = SAA7134_BOARD_AVERMEDIA_777,
@@ -4843,7 +4934,13 @@ struct pci_device_id saa7134_pci_tbl[] = {
4843 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 4934 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
4844 .subvendor = 0x4e42, 4935 .subvendor = 0x4e42,
4845 .subdevice = 0x3502, 4936 .subdevice = 0x3502,
4846 .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS 4937 .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS,
4938 }, {
4939 .vendor = PCI_VENDOR_ID_PHILIPS,
4940 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
4941 .subvendor = 0x1822, /*Twinhan Technology Co. Ltd*/
4942 .subdevice = 0x0022,
4943 .driver_data = SAA7134_BOARD_TWINHAN_DTV_DVB_3056,
4847 },{ 4944 },{
4848 /* --- boards without eeprom + subsystem ID --- */ 4945 /* --- boards without eeprom + subsystem ID --- */
4849 .vendor = PCI_VENDOR_ID_PHILIPS, 4946 .vendor = PCI_VENDOR_ID_PHILIPS,
@@ -4995,6 +5092,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
4995 case SAA7134_BOARD_BEHOLD_409: 5092 case SAA7134_BOARD_BEHOLD_409:
4996 case SAA7134_BOARD_BEHOLD_505FM: 5093 case SAA7134_BOARD_BEHOLD_505FM:
4997 case SAA7134_BOARD_BEHOLD_507_9FM: 5094 case SAA7134_BOARD_BEHOLD_507_9FM:
5095 case SAA7134_BOARD_GENIUS_TVGO_A11MCE:
4998 dev->has_remote = SAA7134_REMOTE_GPIO; 5096 dev->has_remote = SAA7134_REMOTE_GPIO;
4999 break; 5097 break;
5000 case SAA7134_BOARD_FLYDVBS_LR300: 5098 case SAA7134_BOARD_FLYDVBS_LR300:
@@ -5232,7 +5330,8 @@ int saa7134_board_init2(struct saa7134_dev *dev)
5232 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 5330 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
5233 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: 5331 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
5234 case SAA7134_BOARD_MEDION_MD8800_QUADRO: 5332 case SAA7134_BOARD_MEDION_MD8800_QUADRO:
5235 case SAA7134_BOARD_AVERMEDIA_SUPER_007: 5333 case SAA7134_BOARD_AVERMEDIA_SUPER_007:
5334 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:
5236 /* this is a hybrid board, initialize to analog mode 5335 /* this is a hybrid board, initialize to analog mode
5237 * and configure firmware eeprom address 5336 * and configure firmware eeprom address
5238 */ 5337 */
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index a9ca5730826f..ea2be9eceeb8 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -779,6 +779,21 @@ static struct tda1004x_config avermedia_super_007_config = {
779 .request_firmware = philips_tda1004x_request_firmware 779 .request_firmware = philips_tda1004x_request_firmware
780}; 780};
781 781
782static struct tda1004x_config twinhan_dtv_dvb_3056_config = {
783 .demod_address = 0x08,
784 .invert = 1,
785 .invert_oclk = 0,
786 .xtal_freq = TDA10046_XTAL_16M,
787 .agc_config = TDA10046_AGC_TDA827X,
788 .gpio_config = TDA10046_GP01_I,
789 .if_freq = TDA10046_FREQ_045,
790 .i2c_gate = 0x42,
791 .tuner_address = 0x61,
792 .tuner_config = 2,
793 .antenna_switch = 1,
794 .request_firmware = philips_tda1004x_request_firmware
795};
796
782/* ------------------------------------------------------------------ 797/* ------------------------------------------------------------------
783 * special case: this card uses saa713x GPIO22 for the mode switch 798 * special case: this card uses saa713x GPIO22 for the mode switch
784 */ 799 */
@@ -826,6 +841,7 @@ static struct tda1004x_config ads_tech_duo_config = {
826static struct tda10086_config flydvbs = { 841static struct tda10086_config flydvbs = {
827 .demod_address = 0x0e, 842 .demod_address = 0x0e,
828 .invert = 0, 843 .invert = 0,
844 .diseqc_tone = 0,
829}; 845};
830 846
831/* ================================================================== 847/* ==================================================================
@@ -940,9 +956,9 @@ static int dvb_init(struct saa7134_dev *dev)
940 configure_tda827x_fe(dev, &tda827x_lifeview_config); 956 configure_tda827x_fe(dev, &tda827x_lifeview_config);
941 break; 957 break;
942 case SAA7134_BOARD_FLYDVB_TRIO: 958 case SAA7134_BOARD_FLYDVB_TRIO:
943 if(! use_frontend) { //terrestrial 959 if(! use_frontend) { /* terrestrial */
944 configure_tda827x_fe(dev, &lifeview_trio_config); 960 configure_tda827x_fe(dev, &lifeview_trio_config);
945 } else { //satellite 961 } else { /* satellite */
946 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); 962 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
947 if (dev->dvb.frontend) { 963 if (dev->dvb.frontend) {
948 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, 964 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63,
@@ -1007,8 +1023,9 @@ static int dvb_init(struct saa7134_dev *dev)
1007 } 1023 }
1008 break; 1024 break;
1009 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: 1025 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID:
1010 dev->dvb.frontend = tda10046_attach(&medion_cardbus, 1026 dev->dvb.frontend = dvb_attach(tda10046_attach,
1011 &dev->i2c_adap); 1027 &medion_cardbus,
1028 &dev->i2c_adap);
1012 if (dev->dvb.frontend) { 1029 if (dev->dvb.frontend) {
1013 dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; 1030 dev->original_demod_sleep = dev->dvb.frontend->ops.sleep;
1014 dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; 1031 dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
@@ -1044,6 +1061,9 @@ static int dvb_init(struct saa7134_dev *dev)
1044 case SAA7134_BOARD_AVERMEDIA_SUPER_007: 1061 case SAA7134_BOARD_AVERMEDIA_SUPER_007:
1045 configure_tda827x_fe(dev, &avermedia_super_007_config); 1062 configure_tda827x_fe(dev, &avermedia_super_007_config);
1046 break; 1063 break;
1064 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:
1065 configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config);
1066 break;
1047 default: 1067 default:
1048 wprintk("Huh? unknown DVB card?\n"); 1068 wprintk("Huh? unknown DVB card?\n");
1049 break; 1069 break;
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index b1b01fa86720..3d2ec30de227 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -87,7 +87,7 @@ static int ts_open(struct inode *inode, struct file *file)
87 87
88 dprintk("open minor=%d\n",minor); 88 dprintk("open minor=%d\n",minor);
89 err = -EBUSY; 89 err = -EBUSY;
90 if (!mutex_trylock(&dev->empress_tsq.lock)) 90 if (!mutex_trylock(&dev->empress_tsq.vb_lock))
91 goto done; 91 goto done;
92 if (dev->empress_users) 92 if (dev->empress_users)
93 goto done_up; 93 goto done_up;
@@ -101,7 +101,7 @@ static int ts_open(struct inode *inode, struct file *file)
101 err = 0; 101 err = 0;
102 102
103done_up: 103done_up:
104 mutex_unlock(&dev->empress_tsq.lock); 104 mutex_unlock(&dev->empress_tsq.vb_lock);
105done: 105done:
106 return err; 106 return err;
107} 107}
@@ -110,7 +110,6 @@ static int ts_release(struct inode *inode, struct file *file)
110{ 110{
111 struct saa7134_dev *dev = file->private_data; 111 struct saa7134_dev *dev = file->private_data;
112 112
113 mutex_lock(&dev->empress_tsq.lock);
114 videobuf_stop(&dev->empress_tsq); 113 videobuf_stop(&dev->empress_tsq);
115 videobuf_mmap_free(&dev->empress_tsq); 114 videobuf_mmap_free(&dev->empress_tsq);
116 dev->empress_users--; 115 dev->empress_users--;
@@ -122,7 +121,6 @@ static int ts_release(struct inode *inode, struct file *file)
122 saa_writeb(SAA7134_AUDIO_MUTE_CTRL, 121 saa_writeb(SAA7134_AUDIO_MUTE_CTRL,
123 saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); 122 saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6));
124 123
125 mutex_unlock(&dev->empress_tsq.lock);
126 return 0; 124 return 0;
127} 125}
128 126
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 0db955c2d9b9..b4188819782f 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -406,6 +406,12 @@ int saa7134_input_init1(struct saa7134_dev *dev)
406 mask_keyup = 0x8000000; 406 mask_keyup = 0x8000000;
407 polling = 50; //ms 407 polling = 50; //ms
408 break; 408 break;
409 case SAA7134_BOARD_GENIUS_TVGO_A11MCE:
410 ir_codes = ir_codes_genius_tvgo_a11mce;
411 mask_keycode = 0xff;
412 mask_keydown = 0xf00000;
413 polling = 50; /* ms */
414 break;
409 } 415 }
410 if (NULL == ir_codes) { 416 if (NULL == ir_codes) {
411 printk("%s: Oops: IR config error [card=%d]\n", 417 printk("%s: Oops: IR config error [card=%d]\n",
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 1184d359e848..39c41ad97d0e 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1414,21 +1414,17 @@ video_poll(struct file *file, struct poll_table_struct *wait)
1414 if (!list_empty(&fh->cap.stream)) 1414 if (!list_empty(&fh->cap.stream))
1415 buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream); 1415 buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream);
1416 } else { 1416 } else {
1417 mutex_lock(&fh->cap.lock); 1417 mutex_lock(&fh->cap.vb_lock);
1418 if (UNSET == fh->cap.read_off) { 1418 if (UNSET == fh->cap.read_off) {
1419 /* need to capture a new frame */ 1419 /* need to capture a new frame */
1420 if (res_locked(fh->dev,RESOURCE_VIDEO)) { 1420 if (res_locked(fh->dev,RESOURCE_VIDEO))
1421 mutex_unlock(&fh->cap.lock); 1421 goto err;
1422 return POLLERR; 1422 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field))
1423 } 1423 goto err;
1424 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) {
1425 mutex_unlock(&fh->cap.lock);
1426 return POLLERR;
1427 }
1428 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); 1424 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
1429 fh->cap.read_off = 0; 1425 fh->cap.read_off = 0;
1430 } 1426 }
1431 mutex_unlock(&fh->cap.lock); 1427 mutex_unlock(&fh->cap.vb_lock);
1432 buf = fh->cap.read_buf; 1428 buf = fh->cap.read_buf;
1433 } 1429 }
1434 1430
@@ -1440,6 +1436,10 @@ video_poll(struct file *file, struct poll_table_struct *wait)
1440 buf->state == VIDEOBUF_ERROR) 1436 buf->state == VIDEOBUF_ERROR)
1441 return POLLIN|POLLRDNORM; 1437 return POLLIN|POLLRDNORM;
1442 return 0; 1438 return 0;
1439
1440err:
1441 mutex_unlock(&fh->cap.vb_lock);
1442 return POLLERR;
1443} 1443}
1444 1444
1445static int video_release(struct inode *inode, struct file *file) 1445static int video_release(struct inode *inode, struct file *file)
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index b88ca995fafb..f940d0254798 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -252,6 +252,8 @@ struct saa7134_format {
252#define SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM 128 252#define SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM 128
253#define SAA7134_BOARD_BEHOLD_607_9FM 129 253#define SAA7134_BOARD_BEHOLD_607_9FM 129
254#define SAA7134_BOARD_BEHOLD_M6 130 254#define SAA7134_BOARD_BEHOLD_M6 130
255#define SAA7134_BOARD_TWINHAN_DTV_DVB_3056 131
256#define SAA7134_BOARD_GENIUS_TVGO_A11MCE 132
255 257
256#define SAA7134_MAXBOARDS 8 258#define SAA7134_MAXBOARDS 8
257#define SAA7134_INPUT_MAX 8 259#define SAA7134_INPUT_MAX 8
diff --git a/drivers/media/video/stk-sensor.c b/drivers/media/video/stk-sensor.c
index 4a9a0b62efa3..e546b014d7ad 100644
--- a/drivers/media/video/stk-sensor.c
+++ b/drivers/media/video/stk-sensor.c
@@ -225,7 +225,7 @@
225 225
226 226
227/* Returns 0 if OK */ 227/* Returns 0 if OK */
228int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val) 228static int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val)
229{ 229{
230 int i = 0; 230 int i = 0;
231 int tmpval = 0; 231 int tmpval = 0;
@@ -250,7 +250,7 @@ int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val)
250 return 0; 250 return 0;
251} 251}
252 252
253int stk_sensor_inb(struct stk_camera *dev, u8 reg, u8 *val) 253static int stk_sensor_inb(struct stk_camera *dev, u8 reg, u8 *val)
254{ 254{
255 int i = 0; 255 int i = 0;
256 int tmpval = 0; 256 int tmpval = 0;
@@ -380,7 +380,7 @@ int stk_sensor_init(struct stk_camera *dev)
380 STK_ERROR("Strange error reading sensor ID\n"); 380 STK_ERROR("Strange error reading sensor ID\n");
381 return -ENODEV; 381 return -ENODEV;
382 } 382 }
383 if (idh != 0x7F || idl != 0xA2) { 383 if (idh != 0x7f || idl != 0xa2) {
384 STK_ERROR("Huh? you don't have a sensor from ovt\n"); 384 STK_ERROR("Huh? you don't have a sensor from ovt\n");
385 return -ENODEV; 385 return -ENODEV;
386 } 386 }
@@ -409,6 +409,19 @@ static struct regval ov_fmt_uyvy[] = {
409 {REG_COM15, COM15_R00FF }, 409 {REG_COM15, COM15_R00FF },
410 {0xff, 0xff}, /* END MARKER */ 410 {0xff, 0xff}, /* END MARKER */
411}; 411};
412/* V4L2_PIX_FMT_YUYV */
413static struct regval ov_fmt_yuyv[] = {
414 {REG_TSLB, 0 },
415 { 0x4f, 0x80 }, /* "matrix coefficient 1" */
416 { 0x50, 0x80 }, /* "matrix coefficient 2" */
417 { 0x51, 0 }, /* vb */
418 { 0x52, 0x22 }, /* "matrix coefficient 4" */
419 { 0x53, 0x5e }, /* "matrix coefficient 5" */
420 { 0x54, 0x80 }, /* "matrix coefficient 6" */
421 {REG_COM13, COM13_UVSAT|COM13_CMATRIX},
422 {REG_COM15, COM15_R00FF },
423 {0xff, 0xff}, /* END MARKER */
424};
412 425
413/* V4L2_PIX_FMT_RGB565X rrrrrggg gggbbbbb */ 426/* V4L2_PIX_FMT_RGB565X rrrrrggg gggbbbbb */
414static struct regval ov_fmt_rgbr[] = { 427static struct regval ov_fmt_rgbr[] = {
@@ -519,6 +532,10 @@ int stk_sensor_configure(struct stk_camera *dev)
519 com7 |= COM7_YUV; 532 com7 |= COM7_YUV;
520 rv = ov_fmt_uyvy; 533 rv = ov_fmt_uyvy;
521 break; 534 break;
535 case V4L2_PIX_FMT_YUYV:
536 com7 |= COM7_YUV;
537 rv = ov_fmt_yuyv;
538 break;
522 case V4L2_PIX_FMT_RGB565: 539 case V4L2_PIX_FMT_RGB565:
523 com7 |= COM7_RGB; 540 com7 |= COM7_RGB;
524 rv = ov_fmt_rgbp; 541 rv = ov_fmt_rgbp;
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index d37e5e2594b4..ceba45ad0294 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -63,7 +63,7 @@ static struct usb_device_id stkwebcam_table[] = {
63}; 63};
64MODULE_DEVICE_TABLE(usb, stkwebcam_table); 64MODULE_DEVICE_TABLE(usb, stkwebcam_table);
65 65
66void stk_camera_cleanup(struct kref *kref) 66static void stk_camera_cleanup(struct kref *kref)
67{ 67{
68 struct stk_camera *dev = to_stk_camera(kref); 68 struct stk_camera *dev = to_stk_camera(kref);
69 69
@@ -682,6 +682,7 @@ static int v4l_stk_open(struct inode *inode, struct file *fp)
682 return -ENXIO; 682 return -ENXIO;
683 fp->private_data = vdev; 683 fp->private_data = vdev;
684 kref_get(&dev->kref); 684 kref_get(&dev->kref);
685 usb_autopm_get_interface(dev->interface);
685 686
686 return 0; 687 return 0;
687} 688}
@@ -703,6 +704,7 @@ static int v4l_stk_release(struct inode *inode, struct file *fp)
703 } 704 }
704 705
705 if (dev->owner != fp) { 706 if (dev->owner != fp) {
707 usb_autopm_put_interface(dev->interface);
706 kref_put(&dev->kref, stk_camera_cleanup); 708 kref_put(&dev->kref, stk_camera_cleanup);
707 return 0; 709 return 0;
708 } 710 }
@@ -713,6 +715,7 @@ static int v4l_stk_release(struct inode *inode, struct file *fp)
713 715
714 dev->owner = NULL; 716 dev->owner = NULL;
715 717
718 usb_autopm_put_interface(dev->interface);
716 kref_put(&dev->kref, stk_camera_cleanup); 719 kref_put(&dev->kref, stk_camera_cleanup);
717 720
718 return 0; 721 return 0;
@@ -993,6 +996,10 @@ static int stk_vidioc_enum_fmt_cap(struct file *filp,
993 fmtd->pixelformat = V4L2_PIX_FMT_SBGGR8; 996 fmtd->pixelformat = V4L2_PIX_FMT_SBGGR8;
994 strcpy(fmtd->description, "Raw bayer"); 997 strcpy(fmtd->description, "Raw bayer");
995 break; 998 break;
999 case 4:
1000 fmtd->pixelformat = V4L2_PIX_FMT_YUYV;
1001 strcpy(fmtd->description, "yuv4:2:2");
1002 break;
996 default: 1003 default:
997 return -EINVAL; 1004 return -EINVAL;
998 } 1005 }
@@ -1048,6 +1055,7 @@ static int stk_vidioc_try_fmt_cap(struct file *filp,
1048 case V4L2_PIX_FMT_RGB565: 1055 case V4L2_PIX_FMT_RGB565:
1049 case V4L2_PIX_FMT_RGB565X: 1056 case V4L2_PIX_FMT_RGB565X:
1050 case V4L2_PIX_FMT_UYVY: 1057 case V4L2_PIX_FMT_UYVY:
1058 case V4L2_PIX_FMT_YUYV:
1051 case V4L2_PIX_FMT_SBGGR8: 1059 case V4L2_PIX_FMT_SBGGR8:
1052 break; 1060 break;
1053 default: 1061 default:
@@ -1080,6 +1088,42 @@ static int stk_vidioc_try_fmt_cap(struct file *filp,
1080 return 0; 1088 return 0;
1081} 1089}
1082 1090
1091static int stk_setup_format(struct stk_camera *dev)
1092{
1093 int i = 0;
1094 int depth;
1095 if (dev->vsettings.palette == V4L2_PIX_FMT_SBGGR8)
1096 depth = 1;
1097 else
1098 depth = 2;
1099 while (stk_sizes[i].m != dev->vsettings.mode
1100 && i < ARRAY_SIZE(stk_sizes))
1101 i++;
1102 if (i == ARRAY_SIZE(stk_sizes)) {
1103 STK_ERROR("Something is broken in %s\n", __FUNCTION__);
1104 return -EFAULT;
1105 }
1106 /* This registers controls some timings, not sure of what. */
1107 stk_camera_write_reg(dev, 0x001b, 0x0e);
1108 if (dev->vsettings.mode == MODE_SXGA)
1109 stk_camera_write_reg(dev, 0x001c, 0x0e);
1110 else
1111 stk_camera_write_reg(dev, 0x001c, 0x46);
1112 /*
1113 * Registers 0x0115 0x0114 are the size of each line (bytes),
1114 * regs 0x0117 0x0116 are the heigth of the image.
1115 */
1116 stk_camera_write_reg(dev, 0x0115,
1117 ((stk_sizes[i].w * depth) >> 8) & 0xff);
1118 stk_camera_write_reg(dev, 0x0114,
1119 (stk_sizes[i].w * depth) & 0xff);
1120 stk_camera_write_reg(dev, 0x0117,
1121 (stk_sizes[i].h >> 8) & 0xff);
1122 stk_camera_write_reg(dev, 0x0116,
1123 stk_sizes[i].h & 0xff);
1124 return stk_sensor_configure(dev);
1125}
1126
1083static int stk_vidioc_s_fmt_cap(struct file *filp, 1127static int stk_vidioc_s_fmt_cap(struct file *filp,
1084 void *priv, struct v4l2_format *fmtd) 1128 void *priv, struct v4l2_format *fmtd)
1085{ 1129{
@@ -1094,10 +1138,10 @@ static int stk_vidioc_s_fmt_cap(struct file *filp,
1094 return -EBUSY; 1138 return -EBUSY;
1095 if (dev->owner && dev->owner != filp) 1139 if (dev->owner && dev->owner != filp)
1096 return -EBUSY; 1140 return -EBUSY;
1097 dev->owner = filp;
1098 ret = stk_vidioc_try_fmt_cap(filp, priv, fmtd); 1141 ret = stk_vidioc_try_fmt_cap(filp, priv, fmtd);
1099 if (ret) 1142 if (ret)
1100 return ret; 1143 return ret;
1144 dev->owner = filp;
1101 1145
1102 dev->vsettings.palette = fmtd->fmt.pix.pixelformat; 1146 dev->vsettings.palette = fmtd->fmt.pix.pixelformat;
1103 stk_free_buffers(dev); 1147 stk_free_buffers(dev);
@@ -1105,25 +1149,7 @@ static int stk_vidioc_s_fmt_cap(struct file *filp,
1105 dev->vsettings.mode = stk_sizes[fmtd->fmt.pix.priv].m; 1149 dev->vsettings.mode = stk_sizes[fmtd->fmt.pix.priv].m;
1106 1150
1107 stk_initialise(dev); 1151 stk_initialise(dev);
1108 /* This registers controls some timings, not sure of what. */ 1152 return stk_setup_format(dev);
1109 stk_camera_write_reg(dev, 0x001b, 0x0e);
1110 if (dev->vsettings.mode == MODE_SXGA)
1111 stk_camera_write_reg(dev, 0x001c, 0x0e);
1112 else
1113 stk_camera_write_reg(dev, 0x001c, 0x46);
1114 /*
1115 * Registers 0x0115 0x0114 are the size of each line (bytes),
1116 * regs 0x0117 0x0116 are the heigth of the image.
1117 */
1118 stk_camera_write_reg(dev, 0x0115,
1119 (fmtd->fmt.pix.bytesperline >> 8) & 0xff);
1120 stk_camera_write_reg(dev, 0x0114,
1121 fmtd->fmt.pix.bytesperline & 0xff);
1122 stk_camera_write_reg(dev, 0x0117,
1123 (fmtd->fmt.pix.height >> 8) & 0xff);
1124 stk_camera_write_reg(dev, 0x0116,
1125 fmtd->fmt.pix.height & 0xff);
1126 return stk_sensor_configure(dev);
1127} 1153}
1128 1154
1129static int stk_vidioc_reqbufs(struct file *filp, 1155static int stk_vidioc_reqbufs(struct file *filp,
@@ -1288,6 +1314,9 @@ static struct file_operations v4l_stk_fops = {
1288 .poll = v4l_stk_poll, 1314 .poll = v4l_stk_poll,
1289 .mmap = v4l_stk_mmap, 1315 .mmap = v4l_stk_mmap,
1290 .ioctl = video_ioctl2, 1316 .ioctl = video_ioctl2,
1317#ifdef CONFIG_COMPAT
1318 .compat_ioctl = v4l_compat_ioctl32,
1319#endif
1291 .llseek = no_llseek 1320 .llseek = no_llseek
1292}; 1321};
1293 1322
@@ -1403,7 +1432,7 @@ static int stk_camera_probe(struct usb_interface *interface,
1403 dev->vsettings.brightness = 0x7fff; 1432 dev->vsettings.brightness = 0x7fff;
1404 dev->vsettings.palette = V4L2_PIX_FMT_RGB565; 1433 dev->vsettings.palette = V4L2_PIX_FMT_RGB565;
1405 dev->vsettings.mode = MODE_VGA; 1434 dev->vsettings.mode = MODE_VGA;
1406 dev->frame_size = 640*480*2; 1435 dev->frame_size = 640 * 480 * 2;
1407 1436
1408 INIT_LIST_HEAD(&dev->sio_avail); 1437 INIT_LIST_HEAD(&dev->sio_avail);
1409 INIT_LIST_HEAD(&dev->sio_full); 1438 INIT_LIST_HEAD(&dev->sio_full);
@@ -1417,6 +1446,7 @@ static int stk_camera_probe(struct usb_interface *interface,
1417 } 1446 }
1418 1447
1419 stk_create_sysfs_files(&dev->vdev); 1448 stk_create_sysfs_files(&dev->vdev);
1449 usb_autopm_enable(dev->interface);
1420 1450
1421 return 0; 1451 return 0;
1422} 1452}
@@ -1434,11 +1464,41 @@ static void stk_camera_disconnect(struct usb_interface *interface)
1434 kref_put(&dev->kref, stk_camera_cleanup); 1464 kref_put(&dev->kref, stk_camera_cleanup);
1435} 1465}
1436 1466
1467#ifdef CONFIG_PM
1468int stk_camera_suspend(struct usb_interface *intf, pm_message_t message)
1469{
1470 struct stk_camera *dev = usb_get_intfdata(intf);
1471 if (is_streaming(dev)) {
1472 stk_stop_stream(dev);
1473 /* yes, this is ugly */
1474 set_streaming(dev);
1475 }
1476 return 0;
1477}
1478
1479int stk_camera_resume(struct usb_interface *intf)
1480{
1481 struct stk_camera *dev = usb_get_intfdata(intf);
1482 if (!is_initialised(dev))
1483 return 0;
1484 unset_initialised(dev);
1485 stk_initialise(dev);
1486 stk_setup_format(dev);
1487 if (is_streaming(dev))
1488 stk_start_stream(dev);
1489 return 0;
1490}
1491#endif
1492
1437static struct usb_driver stk_camera_driver = { 1493static struct usb_driver stk_camera_driver = {
1438 .name = "stkwebcam", 1494 .name = "stkwebcam",
1439 .probe = stk_camera_probe, 1495 .probe = stk_camera_probe,
1440 .disconnect = stk_camera_disconnect, 1496 .disconnect = stk_camera_disconnect,
1441 .id_table = stkwebcam_table, 1497 .id_table = stkwebcam_table,
1498#ifdef CONFIG_PM
1499 .suspend = stk_camera_suspend,
1500 .resume = stk_camera_resume,
1501#endif
1442}; 1502};
1443 1503
1444 1504
diff --git a/drivers/media/video/stk-webcam.h b/drivers/media/video/stk-webcam.h
index 7e989d1ac1e0..df4dfefc5327 100644
--- a/drivers/media/video/stk-webcam.h
+++ b/drivers/media/video/stk-webcam.h
@@ -79,6 +79,7 @@ enum stk_status {
79#define unset_present(dev) ((dev)->status &= \ 79#define unset_present(dev) ((dev)->status &= \
80 ~(S_PRESENT|S_INITIALISED|S_STREAMING)) 80 ~(S_PRESENT|S_INITIALISED|S_STREAMING))
81#define set_initialised(dev) ((dev)->status |= S_INITIALISED) 81#define set_initialised(dev) ((dev)->status |= S_INITIALISED)
82#define unset_initialised(dev) ((dev)->status &= ~S_INITIALISED)
82#define set_memallocd(dev) ((dev)->status |= S_MEMALLOCD) 83#define set_memallocd(dev) ((dev)->status |= S_MEMALLOCD)
83#define unset_memallocd(dev) ((dev)->status &= ~S_MEMALLOCD) 84#define unset_memallocd(dev) ((dev)->status &= ~S_MEMALLOCD)
84#define set_streaming(dev) ((dev)->status |= S_STREAMING) 85#define set_streaming(dev) ((dev)->status |= S_STREAMING)
@@ -127,8 +128,6 @@ void stk_camera_delete(struct kref *);
127int stk_camera_write_reg(struct stk_camera *, u16, u8); 128int stk_camera_write_reg(struct stk_camera *, u16, u8);
128int stk_camera_read_reg(struct stk_camera *, u16, int *); 129int stk_camera_read_reg(struct stk_camera *, u16, int *);
129 130
130int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val);
131int stk_sensor_inb(struct stk_camera *dev, u8 reg, u8 *val);
132int stk_sensor_init(struct stk_camera *); 131int stk_sensor_init(struct stk_camera *);
133int stk_sensor_configure(struct stk_camera *); 132int stk_sensor_configure(struct stk_camera *);
134int stk_sensor_sleep(struct stk_camera *dev); 133int stk_sensor_sleep(struct stk_camera *dev);
diff --git a/drivers/media/video/tcm825x.c b/drivers/media/video/tcm825x.c
index 41cd6a0b0485..fb895f6684a3 100644
--- a/drivers/media/video/tcm825x.c
+++ b/drivers/media/video/tcm825x.c
@@ -851,7 +851,7 @@ static int tcm825x_probe(struct i2c_client *client)
851 sensor->platform_data = client->dev.platform_data; 851 sensor->platform_data = client->dev.platform_data;
852 852
853 if (sensor->platform_data == NULL 853 if (sensor->platform_data == NULL
854 && !sensor->platform_data->is_okay()) 854 || !sensor->platform_data->is_okay())
855 return -ENODEV; 855 return -ENODEV;
856 856
857 sensor->v4l2_int_device = &tcm825x_int_device; 857 sensor->v4l2_int_device = &tcm825x_int_device;
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index ba538f6fbcc3..78a09a2a4857 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1038,7 +1038,7 @@ static int tuner_resume(struct i2c_client *c)
1038 1038
1039/* ---------------------------------------------------------------------- */ 1039/* ---------------------------------------------------------------------- */
1040 1040
1041LIST_HEAD(tuner_list); 1041static LIST_HEAD(tuner_list);
1042 1042
1043/* Search for existing radio and/or TV tuners on the given I2C adapter. 1043/* Search for existing radio and/or TV tuners on the given I2C adapter.
1044 Note that when this function is called from tuner_probe you can be 1044 Note that when this function is called from tuner_probe you can be
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c
index f191f6a48070..50cf876f020f 100644
--- a/drivers/media/video/tuner-xc2028.c
+++ b/drivers/media/video/tuner-xc2028.c
@@ -754,6 +754,9 @@ skip_std_specific:
754 goto check_device; 754 goto check_device;
755 } 755 }
756 756
757 if (new_fw.type & FM)
758 goto check_device;
759
757 /* Load SCODE firmware, if exists */ 760 /* Load SCODE firmware, if exists */
758 tuner_dbg("Trying to load scode %d\n", new_fw.scode_nr); 761 tuner_dbg("Trying to load scode %d\n", new_fw.scode_nr);
759 762
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index a75560540e79..01ebcec040c4 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1571,14 +1571,14 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
1571 ctrl->value=chip->muted; 1571 ctrl->value=chip->muted;
1572 return 0; 1572 return 0;
1573 case V4L2_CID_AUDIO_VOLUME: 1573 case V4L2_CID_AUDIO_VOLUME:
1574 if (!desc->flags & CHIP_HAS_VOLUME) 1574 if (!(desc->flags & CHIP_HAS_VOLUME))
1575 break; 1575 break;
1576 ctrl->value = max(chip->left,chip->right); 1576 ctrl->value = max(chip->left,chip->right);
1577 return 0; 1577 return 0;
1578 case V4L2_CID_AUDIO_BALANCE: 1578 case V4L2_CID_AUDIO_BALANCE:
1579 { 1579 {
1580 int volume; 1580 int volume;
1581 if (!desc->flags & CHIP_HAS_VOLUME) 1581 if (!(desc->flags & CHIP_HAS_VOLUME))
1582 break; 1582 break;
1583 volume = max(chip->left,chip->right); 1583 volume = max(chip->left,chip->right);
1584 if (volume) 1584 if (volume)
@@ -1621,7 +1621,7 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
1621 { 1621 {
1622 int volume,balance; 1622 int volume,balance;
1623 1623
1624 if (!desc->flags & CHIP_HAS_VOLUME) 1624 if (!(desc->flags & CHIP_HAS_VOLUME))
1625 break; 1625 break;
1626 1626
1627 volume = max(chip->left,chip->right); 1627 volume = max(chip->left,chip->right);
@@ -1642,7 +1642,7 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
1642 case V4L2_CID_AUDIO_BALANCE: 1642 case V4L2_CID_AUDIO_BALANCE:
1643 { 1643 {
1644 int volume, balance; 1644 int volume, balance;
1645 if (!desc->flags & CHIP_HAS_VOLUME) 1645 if (!(desc->flags & CHIP_HAS_VOLUME))
1646 break; 1646 break;
1647 1647
1648 volume = max(chip->left,chip->right); 1648 volume = max(chip->left,chip->right);
@@ -1702,7 +1702,7 @@ static int chip_command(struct i2c_client *client,
1702 break; 1702 break;
1703 case V4L2_CID_AUDIO_VOLUME: 1703 case V4L2_CID_AUDIO_VOLUME:
1704 case V4L2_CID_AUDIO_BALANCE: 1704 case V4L2_CID_AUDIO_BALANCE:
1705 if (!desc->flags & CHIP_HAS_VOLUME) 1705 if (!(desc->flags & CHIP_HAS_VOLUME))
1706 return -EINVAL; 1706 return -EINVAL;
1707 break; 1707 break;
1708 case V4L2_CID_AUDIO_BASS: 1708 case V4L2_CID_AUDIO_BASS:
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 0b8fbad3c721..dc0da44a5af6 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -242,7 +242,7 @@ hauppauge_tuner[] =
242 { TUNER_ABSENT, "TCL M2523_3DBH_E"}, 242 { TUNER_ABSENT, "TCL M2523_3DBH_E"},
243 { TUNER_ABSENT, "TCL M2523_3DIH_E"}, 243 { TUNER_ABSENT, "TCL M2523_3DIH_E"},
244 { TUNER_ABSENT, "TCL MFPE05_2_U"}, 244 { TUNER_ABSENT, "TCL MFPE05_2_U"},
245 { TUNER_ABSENT, "Philips FMD1216MEX"}, 245 { TUNER_PHILIPS_FMD1216ME_MK3, "Philips FMD1216MEX"},
246 { TUNER_ABSENT, "Philips FRH2036B"}, 246 { TUNER_ABSENT, "Philips FRH2036B"},
247 { TUNER_ABSENT, "Panasonic ENGF75_01GF"}, 247 { TUNER_ABSENT, "Panasonic ENGF75_01GF"},
248 { TUNER_ABSENT, "MaxLinear MXL5005"}, 248 { TUNER_ABSENT, "MaxLinear MXL5005"},
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index c056ff6d810c..34deb68ae568 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -56,7 +56,6 @@
56#include <asm/pgtable.h> 56#include <asm/pgtable.h>
57#include <asm/io.h> 57#include <asm/io.h>
58#include <asm/div64.h> 58#include <asm/div64.h>
59#include <linux/video_decoder.h>
60#define __OLD_VIDIOC_ /* To allow fixing old calls*/ 59#define __OLD_VIDIOC_ /* To allow fixing old calls*/
61#include <media/v4l2-common.h> 60#include <media/v4l2-common.h>
62#include <media/v4l2-chip-ident.h> 61#include <media/v4l2-chip-ident.h>
@@ -82,108 +81,6 @@ MODULE_LICENSE("GPL");
82 */ 81 */
83 82
84 83
85char *v4l2_norm_to_name(v4l2_std_id id)
86{
87 char *name;
88 u32 myid = id;
89
90 /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
91 64 bit comparations. So, on that architecture, with some gcc variants,
92 compilation fails. Currently, the max value is 30bit wide.
93 */
94 BUG_ON(myid != id);
95
96 switch (myid) {
97 case V4L2_STD_PAL:
98 name="PAL"; break;
99 case V4L2_STD_PAL_BG:
100 name="PAL-BG"; break;
101 case V4L2_STD_PAL_DK:
102 name="PAL-DK"; break;
103 case V4L2_STD_PAL_B:
104 name="PAL-B"; break;
105 case V4L2_STD_PAL_B1:
106 name="PAL-B1"; break;
107 case V4L2_STD_PAL_G:
108 name="PAL-G"; break;
109 case V4L2_STD_PAL_H:
110 name="PAL-H"; break;
111 case V4L2_STD_PAL_I:
112 name="PAL-I"; break;
113 case V4L2_STD_PAL_D:
114 name="PAL-D"; break;
115 case V4L2_STD_PAL_D1:
116 name="PAL-D1"; break;
117 case V4L2_STD_PAL_K:
118 name="PAL-K"; break;
119 case V4L2_STD_PAL_M:
120 name="PAL-M"; break;
121 case V4L2_STD_PAL_N:
122 name="PAL-N"; break;
123 case V4L2_STD_PAL_Nc:
124 name="PAL-Nc"; break;
125 case V4L2_STD_PAL_60:
126 name="PAL-60"; break;
127 case V4L2_STD_NTSC:
128 name="NTSC"; break;
129 case V4L2_STD_NTSC_M:
130 name="NTSC-M"; break;
131 case V4L2_STD_NTSC_M_JP:
132 name="NTSC-M-JP"; break;
133 case V4L2_STD_NTSC_443:
134 name="NTSC-443"; break;
135 case V4L2_STD_NTSC_M_KR:
136 name="NTSC-M-KR"; break;
137 case V4L2_STD_SECAM:
138 name="SECAM"; break;
139 case V4L2_STD_SECAM_DK:
140 name="SECAM-DK"; break;
141 case V4L2_STD_SECAM_B:
142 name="SECAM-B"; break;
143 case V4L2_STD_SECAM_D:
144 name="SECAM-D"; break;
145 case V4L2_STD_SECAM_G:
146 name="SECAM-G"; break;
147 case V4L2_STD_SECAM_H:
148 name="SECAM-H"; break;
149 case V4L2_STD_SECAM_K:
150 name="SECAM-K"; break;
151 case V4L2_STD_SECAM_K1:
152 name="SECAM-K1"; break;
153 case V4L2_STD_SECAM_L:
154 name="SECAM-L"; break;
155 case V4L2_STD_SECAM_LC:
156 name="SECAM-LC"; break;
157 default:
158 name="Unknown"; break;
159 }
160
161 return name;
162}
163
164/* Fill in the fields of a v4l2_standard structure according to the
165 'id' and 'transmission' parameters. Returns negative on error. */
166int v4l2_video_std_construct(struct v4l2_standard *vs,
167 int id, char *name)
168{
169 u32 index = vs->index;
170
171 memset(vs, 0, sizeof(struct v4l2_standard));
172 vs->index = index;
173 vs->id = id;
174 if (id & V4L2_STD_525_60) {
175 vs->frameperiod.numerator = 1001;
176 vs->frameperiod.denominator = 30000;
177 vs->framelines = 525;
178 } else {
179 vs->frameperiod.numerator = 1;
180 vs->frameperiod.denominator = 25;
181 vs->framelines = 625;
182 }
183 strlcpy(vs->name,name,sizeof(vs->name));
184 return 0;
185}
186
187/* ----------------------------------------------------------------- */ 84/* ----------------------------------------------------------------- */
188/* priority handling */ 85/* priority handling */
189 86
@@ -196,6 +93,7 @@ int v4l2_prio_init(struct v4l2_prio_state *global)
196 memset(global,0,sizeof(*global)); 93 memset(global,0,sizeof(*global));
197 return 0; 94 return 0;
198} 95}
96EXPORT_SYMBOL(v4l2_prio_init);
199 97
200int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, 98int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
201 enum v4l2_priority new) 99 enum v4l2_priority new)
@@ -211,11 +109,13 @@ int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
211 *local = new; 109 *local = new;
212 return 0; 110 return 0;
213} 111}
112EXPORT_SYMBOL(v4l2_prio_change);
214 113
215int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local) 114int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local)
216{ 115{
217 return v4l2_prio_change(global,local,V4L2_PRIORITY_DEFAULT); 116 return v4l2_prio_change(global,local,V4L2_PRIORITY_DEFAULT);
218} 117}
118EXPORT_SYMBOL(v4l2_prio_open);
219 119
220int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local) 120int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local)
221{ 121{
@@ -223,6 +123,7 @@ int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local)
223 atomic_dec(&global->prios[*local]); 123 atomic_dec(&global->prios[*local]);
224 return 0; 124 return 0;
225} 125}
126EXPORT_SYMBOL(v4l2_prio_close);
226 127
227enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global) 128enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
228{ 129{
@@ -234,6 +135,7 @@ enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
234 return V4L2_PRIORITY_BACKGROUND; 135 return V4L2_PRIORITY_BACKGROUND;
235 return V4L2_PRIORITY_UNSET; 136 return V4L2_PRIORITY_UNSET;
236} 137}
138EXPORT_SYMBOL(v4l2_prio_max);
237 139
238int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local) 140int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local)
239{ 141{
@@ -241,225 +143,7 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local)
241 return -EBUSY; 143 return -EBUSY;
242 return 0; 144 return 0;
243} 145}
244 146EXPORT_SYMBOL(v4l2_prio_check);
245
246/* ----------------------------------------------------------------- */
247/* some arrays for pretty-printing debug messages of enum types */
248
249char *v4l2_field_names[] = {
250 [V4L2_FIELD_ANY] = "any",
251 [V4L2_FIELD_NONE] = "none",
252 [V4L2_FIELD_TOP] = "top",
253 [V4L2_FIELD_BOTTOM] = "bottom",
254 [V4L2_FIELD_INTERLACED] = "interlaced",
255 [V4L2_FIELD_SEQ_TB] = "seq-tb",
256 [V4L2_FIELD_SEQ_BT] = "seq-bt",
257 [V4L2_FIELD_ALTERNATE] = "alternate",
258 [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
259 [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
260};
261
262char *v4l2_type_names[] = {
263 [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap",
264 [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over",
265 [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out",
266 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
267 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
268 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
269 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
270 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
271};
272
273
274#define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown"
275
276/* ------------------------------------------------------------------ */
277/* debug help functions */
278
279#ifdef CONFIG_VIDEO_V4L1_COMPAT
280static const char *v4l1_ioctls[] = {
281 [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP",
282 [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN",
283 [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN",
284 [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER",
285 [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER",
286 [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT",
287 [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT",
288 [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE",
289 [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN",
290 [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN",
291 [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF",
292 [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF",
293 [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY",
294 [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ",
295 [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ",
296 [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO",
297 [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO",
298 [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC",
299 [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE",
300 [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF",
301 [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT",
302 [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE",
303 [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE",
304 [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE",
305 [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE",
306 [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO",
307 [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE",
308 [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT",
309 [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT"
310};
311#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
312#endif
313
314static const char *v4l2_ioctls[] = {
315 [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP",
316 [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED",
317 [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT",
318 [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT",
319 [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT",
320 [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS",
321 [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF",
322 [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF",
323 [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF",
324 [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY",
325 [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF",
326 [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF",
327 [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON",
328 [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF",
329 [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM",
330 [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM",
331 [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD",
332 [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD",
333 [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD",
334 [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT",
335 [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL",
336 [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL",
337 [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER",
338 [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER",
339 [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO",
340 [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO",
341 [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL",
342 [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU",
343 [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT",
344 [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT",
345 [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT",
346 [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT",
347 [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT",
348 [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT",
349 [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT",
350 [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR",
351 [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR",
352 [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY",
353 [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY",
354 [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP",
355 [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP",
356 [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP",
357 [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP",
358 [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP",
359 [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD",
360 [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT",
361 [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO",
362 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT",
363 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY",
364 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY",
365 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
366 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS",
367 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS",
368 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS",
369 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS",
370#if 1
371 [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES",
372 [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
373 [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX",
374 [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD",
375 [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD",
376
377 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
378 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
379
380 [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT",
381#endif
382};
383#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
384
385static const char *v4l2_int_ioctls[] = {
386#ifdef CONFIG_VIDEO_V4L1_COMPAT
387 [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES",
388 [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS",
389 [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM",
390 [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT",
391 [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT",
392 [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT",
393 [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE",
394 [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO",
395 [_IOC_NR(DECODER_INIT)] = "DECODER_INIT",
396 [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS",
397 [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP",
398#endif
399 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO",
400
401 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR",
402 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
403 [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG",
404
405 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE",
406 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET",
407 [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ",
408 [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE",
409 [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA",
410 [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA",
411 [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ",
412 [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY",
413 [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING",
414 [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING",
415 [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING",
416 [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING",
417 [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ",
418 [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT",
419 [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT",
420 [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT",
421};
422#define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls)
423
424
425/* Common ioctl debug function. This function can be used by
426 external ioctl messages as well as internal V4L ioctl */
427void v4l_printk_ioctl(unsigned int cmd)
428{
429 char *dir;
430
431 switch (_IOC_DIR(cmd)) {
432 case _IOC_NONE: dir = "--"; break;
433 case _IOC_READ: dir = "r-"; break;
434 case _IOC_WRITE: dir = "-w"; break;
435 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
436 default: dir = "*ERR*"; break;
437 }
438 switch (_IOC_TYPE(cmd)) {
439 case 'd':
440 printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n",
441 (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ?
442 v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
443 break;
444#ifdef CONFIG_VIDEO_V4L1_COMPAT
445 case 'v':
446 printk("v4l1 ioctl %s, dir=%s (0x%08x)\n",
447 (_IOC_NR(cmd) < V4L1_IOCTLS) ?
448 v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
449 break;
450#endif
451 case 'V':
452 printk("v4l2 ioctl %s, dir=%s (0x%08x)\n",
453 (_IOC_NR(cmd) < V4L2_IOCTLS) ?
454 v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
455 break;
456
457 default:
458 printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n",
459 _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
460 }
461}
462
463 147
464/* ----------------------------------------------------------------- */ 148/* ----------------------------------------------------------------- */
465 149
@@ -488,6 +172,7 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
488 } 172 }
489 return 0; 173 return 0;
490} 174}
175EXPORT_SYMBOL(v4l2_ctrl_check);
491 176
492/* Returns NULL or a character pointer array containing the menu for 177/* Returns NULL or a character pointer array containing the menu for
493 the given control ID. The pointer array ends with a NULL pointer. 178 the given control ID. The pointer array ends with a NULL pointer.
@@ -648,6 +333,7 @@ const char **v4l2_ctrl_get_menu(u32 id)
648 return NULL; 333 return NULL;
649 } 334 }
650} 335}
336EXPORT_SYMBOL(v4l2_ctrl_get_menu);
651 337
652/* Fill in a struct v4l2_queryctrl */ 338/* Fill in a struct v4l2_queryctrl */
653int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def) 339int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def)
@@ -770,6 +456,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
770 snprintf(qctrl->name, sizeof(qctrl->name), name); 456 snprintf(qctrl->name, sizeof(qctrl->name), name);
771 return 0; 457 return 0;
772} 458}
459EXPORT_SYMBOL(v4l2_ctrl_query_fill);
773 460
774/* Fill in a struct v4l2_queryctrl with standard values based on 461/* Fill in a struct v4l2_queryctrl with standard values based on
775 the control ID. */ 462 the control ID. */
@@ -904,6 +591,7 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl)
904 return -EINVAL; 591 return -EINVAL;
905 } 592 }
906} 593}
594EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
907 595
908/* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and 596/* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and
909 the menu. The qctrl pointer may be NULL, in which case it is ignored. */ 597 the menu. The qctrl pointer may be NULL, in which case it is ignored. */
@@ -922,6 +610,7 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qc
922 qmenu->reserved = 0; 610 qmenu->reserved = 0;
923 return 0; 611 return 0;
924} 612}
613EXPORT_SYMBOL(v4l2_ctrl_query_menu);
925 614
926/* ctrl_classes points to an array of u32 pointers, the last element is 615/* ctrl_classes points to an array of u32 pointers, the last element is
927 a NULL pointer. Each u32 array is a 0-terminated array of control IDs. 616 a NULL pointer. Each u32 array is a 0-terminated array of control IDs.
@@ -972,7 +661,20 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
972 return 0; 661 return 0;
973 return **ctrl_classes; 662 return **ctrl_classes;
974} 663}
664EXPORT_SYMBOL(v4l2_ctrl_next);
975 665
666int v4l2_chip_match_host(u32 match_type, u32 match_chip)
667{
668 switch (match_type) {
669 case V4L2_CHIP_MATCH_HOST:
670 return match_chip == 0;
671 default:
672 return 0;
673 }
674}
675EXPORT_SYMBOL(v4l2_chip_match_host);
676
677#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
976int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) 678int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip)
977{ 679{
978 switch (match_type) { 680 switch (match_type) {
@@ -984,6 +686,7 @@ int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_c
984 return 0; 686 return 0;
985 } 687 }
986} 688}
689EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
987 690
988int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, 691int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip,
989 u32 ident, u32 revision) 692 u32 ident, u32 revision)
@@ -1000,16 +703,7 @@ int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chi
1000 } 703 }
1001 return 0; 704 return 0;
1002} 705}
1003 706EXPORT_SYMBOL(v4l2_chip_ident_i2c_client);
1004int v4l2_chip_match_host(u32 match_type, u32 match_chip)
1005{
1006 switch (match_type) {
1007 case V4L2_CHIP_MATCH_HOST:
1008 return match_chip == 0;
1009 default:
1010 return 0;
1011 }
1012}
1013 707
1014/* ----------------------------------------------------------------- */ 708/* ----------------------------------------------------------------- */
1015 709
@@ -1038,38 +732,5 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver
1038 } 732 }
1039 return err != -ENOMEM ? 0 : err; 733 return err != -ENOMEM ? 0 : err;
1040} 734}
1041
1042/* ----------------------------------------------------------------- */
1043
1044EXPORT_SYMBOL(v4l2_norm_to_name);
1045EXPORT_SYMBOL(v4l2_video_std_construct);
1046
1047EXPORT_SYMBOL(v4l2_prio_init);
1048EXPORT_SYMBOL(v4l2_prio_change);
1049EXPORT_SYMBOL(v4l2_prio_open);
1050EXPORT_SYMBOL(v4l2_prio_close);
1051EXPORT_SYMBOL(v4l2_prio_max);
1052EXPORT_SYMBOL(v4l2_prio_check);
1053
1054EXPORT_SYMBOL(v4l2_field_names);
1055EXPORT_SYMBOL(v4l2_type_names);
1056EXPORT_SYMBOL(v4l_printk_ioctl);
1057
1058EXPORT_SYMBOL(v4l2_ctrl_next);
1059EXPORT_SYMBOL(v4l2_ctrl_check);
1060EXPORT_SYMBOL(v4l2_ctrl_get_menu);
1061EXPORT_SYMBOL(v4l2_ctrl_query_menu);
1062EXPORT_SYMBOL(v4l2_ctrl_query_fill);
1063EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
1064
1065EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
1066EXPORT_SYMBOL(v4l2_chip_ident_i2c_client);
1067EXPORT_SYMBOL(v4l2_chip_match_host);
1068
1069EXPORT_SYMBOL(v4l2_i2c_attach); 735EXPORT_SYMBOL(v4l2_i2c_attach);
1070 736#endif
1071/*
1072 * Local variables:
1073 * c-basic-offset: 8
1074 * End:
1075 */
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index 80a14da9acef..eab79ffdf56a 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -147,7 +147,7 @@ void videobuf_queue_core_init(struct videobuf_queue *q,
147 /* Having implementations for abstract methods are mandatory */ 147 /* Having implementations for abstract methods are mandatory */
148 BUG_ON(!q->int_ops); 148 BUG_ON(!q->int_ops);
149 149
150 mutex_init(&q->lock); 150 mutex_init(&q->vb_lock);
151 INIT_LIST_HEAD(&q->stream); 151 INIT_LIST_HEAD(&q->stream);
152} 152}
153 153
@@ -189,7 +189,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q)
189 return 0; 189 return 0;
190} 190}
191 191
192/* Locking: Caller holds q->lock */ 192/* Locking: Caller holds q->vb_lock */
193void videobuf_queue_cancel(struct videobuf_queue *q) 193void videobuf_queue_cancel(struct videobuf_queue *q)
194{ 194{
195 unsigned long flags = 0; 195 unsigned long flags = 0;
@@ -220,7 +220,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q)
220 220
221/* --------------------------------------------------------------------- */ 221/* --------------------------------------------------------------------- */
222 222
223/* Locking: Caller holds q->lock */ 223/* Locking: Caller holds q->vb_lock */
224enum v4l2_field videobuf_next_field(struct videobuf_queue *q) 224enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
225{ 225{
226 enum v4l2_field field = q->field; 226 enum v4l2_field field = q->field;
@@ -239,7 +239,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
239 return field; 239 return field;
240} 240}
241 241
242/* Locking: Caller holds q->lock */ 242/* Locking: Caller holds q->vb_lock */
243static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, 243static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
244 struct videobuf_buffer *vb, enum v4l2_buf_type type) 244 struct videobuf_buffer *vb, enum v4l2_buf_type type)
245{ 245{
@@ -295,7 +295,7 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
295 b->sequence = vb->field_count >> 1; 295 b->sequence = vb->field_count >> 1;
296} 296}
297 297
298/* Locking: Caller holds q->lock */ 298/* Locking: Caller holds q->vb_lock */
299static int __videobuf_mmap_free(struct videobuf_queue *q) 299static int __videobuf_mmap_free(struct videobuf_queue *q)
300{ 300{
301 int i; 301 int i;
@@ -328,13 +328,13 @@ static int __videobuf_mmap_free(struct videobuf_queue *q)
328int videobuf_mmap_free(struct videobuf_queue *q) 328int videobuf_mmap_free(struct videobuf_queue *q)
329{ 329{
330 int ret; 330 int ret;
331 mutex_lock(&q->lock); 331 mutex_lock(&q->vb_lock);
332 ret = __videobuf_mmap_free(q); 332 ret = __videobuf_mmap_free(q);
333 mutex_unlock(&q->lock); 333 mutex_unlock(&q->vb_lock);
334 return ret; 334 return ret;
335} 335}
336 336
337/* Locking: Caller holds q->lock */ 337/* Locking: Caller holds q->vb_lock */
338static int __videobuf_mmap_setup(struct videobuf_queue *q, 338static int __videobuf_mmap_setup(struct videobuf_queue *q,
339 unsigned int bcount, unsigned int bsize, 339 unsigned int bcount, unsigned int bsize,
340 enum v4l2_memory memory) 340 enum v4l2_memory memory)
@@ -384,9 +384,9 @@ int videobuf_mmap_setup(struct videobuf_queue *q,
384 enum v4l2_memory memory) 384 enum v4l2_memory memory)
385{ 385{
386 int ret; 386 int ret;
387 mutex_lock(&q->lock); 387 mutex_lock(&q->vb_lock);
388 ret = __videobuf_mmap_setup(q, bcount, bsize, memory); 388 ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
389 mutex_unlock(&q->lock); 389 mutex_unlock(&q->vb_lock);
390 return ret; 390 return ret;
391} 391}
392 392
@@ -408,7 +408,7 @@ int videobuf_reqbufs(struct videobuf_queue *q,
408 return -EINVAL; 408 return -EINVAL;
409 } 409 }
410 410
411 mutex_lock(&q->lock); 411 mutex_lock(&q->vb_lock);
412 if (req->type != q->type) { 412 if (req->type != q->type) {
413 dprintk(1, "reqbufs: queue type invalid\n"); 413 dprintk(1, "reqbufs: queue type invalid\n");
414 retval = -EINVAL; 414 retval = -EINVAL;
@@ -444,7 +444,7 @@ int videobuf_reqbufs(struct videobuf_queue *q,
444 req->count = retval; 444 req->count = retval;
445 445
446 done: 446 done:
447 mutex_unlock(&q->lock); 447 mutex_unlock(&q->vb_lock);
448 return retval; 448 return retval;
449} 449}
450 450
@@ -452,7 +452,7 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
452{ 452{
453 int ret = -EINVAL; 453 int ret = -EINVAL;
454 454
455 mutex_lock(&q->lock); 455 mutex_lock(&q->vb_lock);
456 if (unlikely(b->type != q->type)) { 456 if (unlikely(b->type != q->type)) {
457 dprintk(1, "querybuf: Wrong type.\n"); 457 dprintk(1, "querybuf: Wrong type.\n");
458 goto done; 458 goto done;
@@ -470,7 +470,7 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
470 470
471 ret = 0; 471 ret = 0;
472done: 472done:
473 mutex_unlock(&q->lock); 473 mutex_unlock(&q->vb_lock);
474 return ret; 474 return ret;
475} 475}
476 476
@@ -487,7 +487,7 @@ int videobuf_qbuf(struct videobuf_queue *q,
487 if (b->memory == V4L2_MEMORY_MMAP) 487 if (b->memory == V4L2_MEMORY_MMAP)
488 down_read(&current->mm->mmap_sem); 488 down_read(&current->mm->mmap_sem);
489 489
490 mutex_lock(&q->lock); 490 mutex_lock(&q->vb_lock);
491 retval = -EBUSY; 491 retval = -EBUSY;
492 if (q->reading) { 492 if (q->reading) {
493 dprintk(1, "qbuf: Reading running...\n"); 493 dprintk(1, "qbuf: Reading running...\n");
@@ -573,7 +573,7 @@ int videobuf_qbuf(struct videobuf_queue *q,
573 retval = 0; 573 retval = 0;
574 574
575 done: 575 done:
576 mutex_unlock(&q->lock); 576 mutex_unlock(&q->vb_lock);
577 577
578 if (b->memory == V4L2_MEMORY_MMAP) 578 if (b->memory == V4L2_MEMORY_MMAP)
579 up_read(&current->mm->mmap_sem); 579 up_read(&current->mm->mmap_sem);
@@ -589,7 +589,7 @@ int videobuf_dqbuf(struct videobuf_queue *q,
589 589
590 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); 590 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
591 591
592 mutex_lock(&q->lock); 592 mutex_lock(&q->vb_lock);
593 retval = -EBUSY; 593 retval = -EBUSY;
594 if (q->reading) { 594 if (q->reading) {
595 dprintk(1, "dqbuf: Reading running...\n"); 595 dprintk(1, "dqbuf: Reading running...\n");
@@ -632,7 +632,7 @@ int videobuf_dqbuf(struct videobuf_queue *q,
632 videobuf_status(q, b, buf, q->type); 632 videobuf_status(q, b, buf, q->type);
633 633
634 done: 634 done:
635 mutex_unlock(&q->lock); 635 mutex_unlock(&q->vb_lock);
636 return retval; 636 return retval;
637} 637}
638 638
@@ -642,7 +642,7 @@ int videobuf_streamon(struct videobuf_queue *q)
642 unsigned long flags = 0; 642 unsigned long flags = 0;
643 int retval; 643 int retval;
644 644
645 mutex_lock(&q->lock); 645 mutex_lock(&q->vb_lock);
646 retval = -EBUSY; 646 retval = -EBUSY;
647 if (q->reading) 647 if (q->reading)
648 goto done; 648 goto done;
@@ -659,11 +659,11 @@ int videobuf_streamon(struct videobuf_queue *q)
659 spin_unlock_irqrestore(q->irqlock, flags); 659 spin_unlock_irqrestore(q->irqlock, flags);
660 660
661 done: 661 done:
662 mutex_unlock(&q->lock); 662 mutex_unlock(&q->vb_lock);
663 return retval; 663 return retval;
664} 664}
665 665
666/* Locking: Caller holds q->lock */ 666/* Locking: Caller holds q->vb_lock */
667static int __videobuf_streamoff(struct videobuf_queue *q) 667static int __videobuf_streamoff(struct videobuf_queue *q)
668{ 668{
669 if (!q->streaming) 669 if (!q->streaming)
@@ -679,14 +679,14 @@ int videobuf_streamoff(struct videobuf_queue *q)
679{ 679{
680 int retval; 680 int retval;
681 681
682 mutex_lock(&q->lock); 682 mutex_lock(&q->vb_lock);
683 retval = __videobuf_streamoff(q); 683 retval = __videobuf_streamoff(q);
684 mutex_unlock(&q->lock); 684 mutex_unlock(&q->vb_lock);
685 685
686 return retval; 686 return retval;
687} 687}
688 688
689/* Locking: Caller holds q->lock */ 689/* Locking: Caller holds q->vb_lock */
690static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, 690static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q,
691 char __user *data, 691 char __user *data,
692 size_t count, loff_t *ppos) 692 size_t count, loff_t *ppos)
@@ -745,7 +745,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q,
745 745
746 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); 746 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
747 747
748 mutex_lock(&q->lock); 748 mutex_lock(&q->vb_lock);
749 749
750 nbufs = 1; size = 0; 750 nbufs = 1; size = 0;
751 q->ops->buf_setup(q, &nbufs, &size); 751 q->ops->buf_setup(q, &nbufs, &size);
@@ -817,11 +817,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q,
817 } 817 }
818 818
819 done: 819 done:
820 mutex_unlock(&q->lock); 820 mutex_unlock(&q->vb_lock);
821 return retval; 821 return retval;
822} 822}
823 823
824/* Locking: Caller holds q->lock */ 824/* Locking: Caller holds q->vb_lock */
825static int __videobuf_read_start(struct videobuf_queue *q) 825static int __videobuf_read_start(struct videobuf_queue *q)
826{ 826{
827 enum v4l2_field field; 827 enum v4l2_field field;
@@ -882,23 +882,23 @@ int videobuf_read_start(struct videobuf_queue *q)
882{ 882{
883 int rc; 883 int rc;
884 884
885 mutex_lock(&q->lock); 885 mutex_lock(&q->vb_lock);
886 rc = __videobuf_read_start(q); 886 rc = __videobuf_read_start(q);
887 mutex_unlock(&q->lock); 887 mutex_unlock(&q->vb_lock);
888 888
889 return rc; 889 return rc;
890} 890}
891 891
892void videobuf_read_stop(struct videobuf_queue *q) 892void videobuf_read_stop(struct videobuf_queue *q)
893{ 893{
894 mutex_lock(&q->lock); 894 mutex_lock(&q->vb_lock);
895 __videobuf_read_stop(q); 895 __videobuf_read_stop(q);
896 mutex_unlock(&q->lock); 896 mutex_unlock(&q->vb_lock);
897} 897}
898 898
899void videobuf_stop(struct videobuf_queue *q) 899void videobuf_stop(struct videobuf_queue *q)
900{ 900{
901 mutex_lock(&q->lock); 901 mutex_lock(&q->vb_lock);
902 902
903 if (q->streaming) 903 if (q->streaming)
904 __videobuf_streamoff(q); 904 __videobuf_streamoff(q);
@@ -906,7 +906,7 @@ void videobuf_stop(struct videobuf_queue *q)
906 if (q->reading) 906 if (q->reading)
907 __videobuf_read_stop(q); 907 __videobuf_read_stop(q);
908 908
909 mutex_unlock(&q->lock); 909 mutex_unlock(&q->vb_lock);
910} 910}
911 911
912 912
@@ -920,7 +920,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q,
920 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); 920 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
921 921
922 dprintk(2, "%s\n", __FUNCTION__); 922 dprintk(2, "%s\n", __FUNCTION__);
923 mutex_lock(&q->lock); 923 mutex_lock(&q->vb_lock);
924 retval = -EBUSY; 924 retval = -EBUSY;
925 if (q->streaming) 925 if (q->streaming)
926 goto done; 926 goto done;
@@ -980,7 +980,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q,
980 } 980 }
981 981
982 done: 982 done:
983 mutex_unlock(&q->lock); 983 mutex_unlock(&q->vb_lock);
984 return retval; 984 return retval;
985} 985}
986 986
@@ -991,7 +991,7 @@ unsigned int videobuf_poll_stream(struct file *file,
991 struct videobuf_buffer *buf = NULL; 991 struct videobuf_buffer *buf = NULL;
992 unsigned int rc = 0; 992 unsigned int rc = 0;
993 993
994 mutex_lock(&q->lock); 994 mutex_lock(&q->vb_lock);
995 if (q->streaming) { 995 if (q->streaming) {
996 if (!list_empty(&q->stream)) 996 if (!list_empty(&q->stream))
997 buf = list_entry(q->stream.next, 997 buf = list_entry(q->stream.next,
@@ -1019,7 +1019,7 @@ unsigned int videobuf_poll_stream(struct file *file,
1019 buf->state == VIDEOBUF_ERROR) 1019 buf->state == VIDEOBUF_ERROR)
1020 rc = POLLIN|POLLRDNORM; 1020 rc = POLLIN|POLLRDNORM;
1021 } 1021 }
1022 mutex_unlock(&q->lock); 1022 mutex_unlock(&q->vb_lock);
1023 return rc; 1023 return rc;
1024} 1024}
1025 1025
@@ -1030,10 +1030,10 @@ int videobuf_mmap_mapper(struct videobuf_queue *q,
1030 1030
1031 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); 1031 MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
1032 1032
1033 mutex_lock(&q->lock); 1033 mutex_lock(&q->vb_lock);
1034 retval = CALL(q, mmap_mapper, q, vma); 1034 retval = CALL(q, mmap_mapper, q, vma);
1035 q->is_mmapped = 1; 1035 q->is_mmapped = 1;
1036 mutex_unlock(&q->lock); 1036 mutex_unlock(&q->vb_lock);
1037 1037
1038 return retval; 1038 return retval;
1039} 1039}
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index 98efd7ab1f50..53fed4b74ce9 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -356,7 +356,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
356 map->count--; 356 map->count--;
357 if (0 == map->count) { 357 if (0 == map->count) {
358 dprintk(1,"munmap %p q=%p\n",map,q); 358 dprintk(1,"munmap %p q=%p\n",map,q);
359 mutex_lock(&q->lock); 359 mutex_lock(&q->vb_lock);
360 for (i = 0; i < VIDEO_MAX_FRAME; i++) { 360 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
361 if (NULL == q->bufs[i]) 361 if (NULL == q->bufs[i])
362 continue; 362 continue;
@@ -373,7 +373,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
373 q->bufs[i]->baddr = 0; 373 q->bufs[i]->baddr = 0;
374 q->ops->buf_release(q,q->bufs[i]); 374 q->ops->buf_release(q,q->bufs[i]);
375 } 375 }
376 mutex_unlock(&q->lock); 376 mutex_unlock(&q->vb_lock);
377 kfree(map); 377 kfree(map);
378 } 378 }
379 return; 379 return;
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c
index 9b3898347ca5..5266ecc91dab 100644
--- a/drivers/media/video/videobuf-vmalloc.c
+++ b/drivers/media/video/videobuf-vmalloc.c
@@ -70,7 +70,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
70 map->count--; 70 map->count--;
71 if (0 == map->count) { 71 if (0 == map->count) {
72 dprintk(1,"munmap %p q=%p\n",map,q); 72 dprintk(1,"munmap %p q=%p\n",map,q);
73 mutex_lock(&q->lock); 73 mutex_lock(&q->vb_lock);
74 for (i = 0; i < VIDEO_MAX_FRAME; i++) { 74 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
75 if (NULL == q->bufs[i]) 75 if (NULL == q->bufs[i])
76 continue; 76 continue;
@@ -83,7 +83,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
83 q->bufs[i]->map = NULL; 83 q->bufs[i]->map = NULL;
84 q->bufs[i]->baddr = 0; 84 q->bufs[i]->baddr = 0;
85 } 85 }
86 mutex_unlock(&q->lock); 86 mutex_unlock(&q->vb_lock);
87 kfree(map); 87 kfree(map);
88 } 88 }
89 return; 89 return;
@@ -107,7 +107,7 @@ static struct vm_operations_struct videobuf_vm_ops =
107 107
108static void *__videobuf_alloc(size_t size) 108static void *__videobuf_alloc(size_t size)
109{ 109{
110 struct videbuf_vmalloc_memory *mem; 110 struct videobuf_vmalloc_memory *mem;
111 struct videobuf_buffer *vb; 111 struct videobuf_buffer *vb;
112 112
113 vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); 113 vb = kzalloc(size+sizeof(*mem),GFP_KERNEL);
@@ -127,9 +127,7 @@ static int __videobuf_iolock (struct videobuf_queue* q,
127 struct v4l2_framebuffer *fbuf) 127 struct v4l2_framebuffer *fbuf)
128{ 128{
129 int pages; 129 int pages;
130 130 struct videobuf_vmalloc_memory *mem=vb->priv;
131 struct videbuf_vmalloc_memory *mem=vb->priv;
132
133 131
134 BUG_ON(!mem); 132 BUG_ON(!mem);
135 133
@@ -195,7 +193,7 @@ static int __videobuf_mmap_free(struct videobuf_queue *q)
195static int __videobuf_mmap_mapper(struct videobuf_queue *q, 193static int __videobuf_mmap_mapper(struct videobuf_queue *q,
196 struct vm_area_struct *vma) 194 struct vm_area_struct *vma)
197{ 195{
198 struct videbuf_vmalloc_memory *mem; 196 struct videobuf_vmalloc_memory *mem;
199 struct videobuf_mapping *map; 197 struct videobuf_mapping *map;
200 unsigned int first; 198 unsigned int first;
201 int retval; 199 int retval;
@@ -267,7 +265,7 @@ static int __videobuf_copy_to_user ( struct videobuf_queue *q,
267 char __user *data, size_t count, 265 char __user *data, size_t count,
268 int nonblocking ) 266 int nonblocking )
269{ 267{
270 struct videbuf_vmalloc_memory *mem=q->read_buf->priv; 268 struct videobuf_vmalloc_memory *mem=q->read_buf->priv;
271 BUG_ON (!mem); 269 BUG_ON (!mem);
272 MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); 270 MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM);
273 271
@@ -288,7 +286,7 @@ static int __videobuf_copy_stream ( struct videobuf_queue *q,
288 int vbihack, int nonblocking ) 286 int vbihack, int nonblocking )
289{ 287{
290 unsigned int *fc; 288 unsigned int *fc;
291 struct videbuf_vmalloc_memory *mem=q->read_buf->priv; 289 struct videobuf_vmalloc_memory *mem=q->read_buf->priv;
292 BUG_ON (!mem); 290 BUG_ON (!mem);
293 MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); 291 MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM);
294 292
@@ -341,7 +339,7 @@ EXPORT_SYMBOL_GPL(videobuf_queue_vmalloc_init);
341 339
342void *videobuf_to_vmalloc (struct videobuf_buffer *buf) 340void *videobuf_to_vmalloc (struct videobuf_buffer *buf)
343{ 341{
344 struct videbuf_vmalloc_memory *mem=buf->priv; 342 struct videobuf_vmalloc_memory *mem=buf->priv;
345 BUG_ON (!mem); 343 BUG_ON (!mem);
346 MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); 344 MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM);
347 345
@@ -351,7 +349,7 @@ EXPORT_SYMBOL_GPL(videobuf_to_vmalloc);
351 349
352void videobuf_vmalloc_free (struct videobuf_buffer *buf) 350void videobuf_vmalloc_free (struct videobuf_buffer *buf)
353{ 351{
354 struct videbuf_vmalloc_memory *mem=buf->priv; 352 struct videobuf_vmalloc_memory *mem=buf->priv;
355 BUG_ON (!mem); 353 BUG_ON (!mem);
356 354
357 MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); 355 MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM);
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 28655f8983c6..0d9b63762a48 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -46,10 +46,373 @@
46#include <linux/videodev.h> 46#include <linux/videodev.h>
47#endif 47#endif
48#include <media/v4l2-common.h> 48#include <media/v4l2-common.h>
49#include <linux/video_decoder.h>
49 50
50#define VIDEO_NUM_DEVICES 256 51#define VIDEO_NUM_DEVICES 256
51#define VIDEO_NAME "video4linux" 52#define VIDEO_NAME "video4linux"
52 53
54/* video4linux standard ID conversion to standard name
55 */
56char *v4l2_norm_to_name(v4l2_std_id id)
57{
58 char *name;
59 u32 myid = id;
60
61 /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
62 64 bit comparations. So, on that architecture, with some gcc
63 variants, compilation fails. Currently, the max value is 30bit wide.
64 */
65 BUG_ON(myid != id);
66
67 switch (myid) {
68 case V4L2_STD_PAL:
69 name = "PAL";
70 break;
71 case V4L2_STD_PAL_BG:
72 name = "PAL-BG";
73 break;
74 case V4L2_STD_PAL_DK:
75 name = "PAL-DK";
76 break;
77 case V4L2_STD_PAL_B:
78 name = "PAL-B";
79 break;
80 case V4L2_STD_PAL_B1:
81 name = "PAL-B1";
82 break;
83 case V4L2_STD_PAL_G:
84 name = "PAL-G";
85 break;
86 case V4L2_STD_PAL_H:
87 name = "PAL-H";
88 break;
89 case V4L2_STD_PAL_I:
90 name = "PAL-I";
91 break;
92 case V4L2_STD_PAL_D:
93 name = "PAL-D";
94 break;
95 case V4L2_STD_PAL_D1:
96 name = "PAL-D1";
97 break;
98 case V4L2_STD_PAL_K:
99 name = "PAL-K";
100 break;
101 case V4L2_STD_PAL_M:
102 name = "PAL-M";
103 break;
104 case V4L2_STD_PAL_N:
105 name = "PAL-N";
106 break;
107 case V4L2_STD_PAL_Nc:
108 name = "PAL-Nc";
109 break;
110 case V4L2_STD_PAL_60:
111 name = "PAL-60";
112 break;
113 case V4L2_STD_NTSC:
114 name = "NTSC";
115 break;
116 case V4L2_STD_NTSC_M:
117 name = "NTSC-M";
118 break;
119 case V4L2_STD_NTSC_M_JP:
120 name = "NTSC-M-JP";
121 break;
122 case V4L2_STD_NTSC_443:
123 name = "NTSC-443";
124 break;
125 case V4L2_STD_NTSC_M_KR:
126 name = "NTSC-M-KR";
127 break;
128 case V4L2_STD_SECAM:
129 name = "SECAM";
130 break;
131 case V4L2_STD_SECAM_DK:
132 name = "SECAM-DK";
133 break;
134 case V4L2_STD_SECAM_B:
135 name = "SECAM-B";
136 break;
137 case V4L2_STD_SECAM_D:
138 name = "SECAM-D";
139 break;
140 case V4L2_STD_SECAM_G:
141 name = "SECAM-G";
142 break;
143 case V4L2_STD_SECAM_H:
144 name = "SECAM-H";
145 break;
146 case V4L2_STD_SECAM_K:
147 name = "SECAM-K";
148 break;
149 case V4L2_STD_SECAM_K1:
150 name = "SECAM-K1";
151 break;
152 case V4L2_STD_SECAM_L:
153 name = "SECAM-L";
154 break;
155 case V4L2_STD_SECAM_LC:
156 name = "SECAM-LC";
157 break;
158 default:
159 name = "Unknown";
160 break;
161 }
162
163 return name;
164}
165EXPORT_SYMBOL(v4l2_norm_to_name);
166
167/* Fill in the fields of a v4l2_standard structure according to the
168 'id' and 'transmission' parameters. Returns negative on error. */
169int v4l2_video_std_construct(struct v4l2_standard *vs,
170 int id, char *name)
171{
172 u32 index = vs->index;
173
174 memset(vs, 0, sizeof(struct v4l2_standard));
175 vs->index = index;
176 vs->id = id;
177 if (id & V4L2_STD_525_60) {
178 vs->frameperiod.numerator = 1001;
179 vs->frameperiod.denominator = 30000;
180 vs->framelines = 525;
181 } else {
182 vs->frameperiod.numerator = 1;
183 vs->frameperiod.denominator = 25;
184 vs->framelines = 625;
185 }
186 strlcpy(vs->name, name, sizeof(vs->name));
187 return 0;
188}
189EXPORT_SYMBOL(v4l2_video_std_construct);
190
191/* ----------------------------------------------------------------- */
192/* some arrays for pretty-printing debug messages of enum types */
193
194char *v4l2_field_names[] = {
195 [V4L2_FIELD_ANY] = "any",
196 [V4L2_FIELD_NONE] = "none",
197 [V4L2_FIELD_TOP] = "top",
198 [V4L2_FIELD_BOTTOM] = "bottom",
199 [V4L2_FIELD_INTERLACED] = "interlaced",
200 [V4L2_FIELD_SEQ_TB] = "seq-tb",
201 [V4L2_FIELD_SEQ_BT] = "seq-bt",
202 [V4L2_FIELD_ALTERNATE] = "alternate",
203 [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
204 [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
205};
206EXPORT_SYMBOL(v4l2_field_names);
207
208char *v4l2_type_names[] = {
209 [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap",
210 [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over",
211 [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out",
212 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
213 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
214 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
215 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
216 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
217};
218EXPORT_SYMBOL(v4l2_type_names);
219
220static char *v4l2_memory_names[] = {
221 [V4L2_MEMORY_MMAP] = "mmap",
222 [V4L2_MEMORY_USERPTR] = "userptr",
223 [V4L2_MEMORY_OVERLAY] = "overlay",
224};
225
226#define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \
227 arr[a] : "unknown")
228
229/* ------------------------------------------------------------------ */
230/* debug help functions */
231
232#ifdef CONFIG_VIDEO_V4L1_COMPAT
233static const char *v4l1_ioctls[] = {
234 [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP",
235 [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN",
236 [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN",
237 [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER",
238 [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER",
239 [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT",
240 [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT",
241 [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE",
242 [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN",
243 [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN",
244 [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF",
245 [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF",
246 [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY",
247 [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ",
248 [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ",
249 [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO",
250 [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO",
251 [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC",
252 [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE",
253 [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF",
254 [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT",
255 [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE",
256 [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE",
257 [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE",
258 [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE",
259 [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO",
260 [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE",
261 [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT",
262 [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT"
263};
264#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
265#endif
266
267static const char *v4l2_ioctls[] = {
268 [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP",
269 [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED",
270 [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT",
271 [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT",
272 [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT",
273 [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS",
274 [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF",
275 [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF",
276 [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF",
277 [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY",
278 [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF",
279 [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF",
280 [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON",
281 [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF",
282 [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM",
283 [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM",
284 [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD",
285 [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD",
286 [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD",
287 [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT",
288 [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL",
289 [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL",
290 [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER",
291 [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER",
292 [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO",
293 [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO",
294 [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL",
295 [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU",
296 [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT",
297 [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT",
298 [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT",
299 [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT",
300 [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT",
301 [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT",
302 [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT",
303 [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR",
304 [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR",
305 [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY",
306 [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY",
307 [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP",
308 [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP",
309 [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP",
310 [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP",
311 [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP",
312 [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD",
313 [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT",
314 [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO",
315 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT",
316 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY",
317 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY",
318 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
319 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS",
320 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS",
321 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS",
322 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS",
323#if 1
324 [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES",
325 [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
326 [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX",
327 [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD",
328 [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD",
329
330 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
331 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
332
333 [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT",
334#endif
335};
336#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
337
338static const char *v4l2_int_ioctls[] = {
339#ifdef CONFIG_VIDEO_V4L1_COMPAT
340 [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES",
341 [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS",
342 [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM",
343 [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT",
344 [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT",
345 [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT",
346 [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE",
347 [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO",
348 [_IOC_NR(DECODER_INIT)] = "DECODER_INIT",
349 [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS",
350 [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP",
351#endif
352 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO",
353
354 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR",
355 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
356 [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG",
357
358 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE",
359 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET",
360 [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ",
361 [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE",
362 [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA",
363 [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA",
364 [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ",
365 [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY",
366 [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING",
367 [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING",
368 [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING",
369 [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING",
370 [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ",
371 [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT",
372 [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT",
373 [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT",
374};
375#define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls)
376
377/* Common ioctl debug function. This function can be used by
378 external ioctl messages as well as internal V4L ioctl */
379void v4l_printk_ioctl(unsigned int cmd)
380{
381 char *dir;
382
383 switch (_IOC_DIR(cmd)) {
384 case _IOC_NONE: dir = "--"; break;
385 case _IOC_READ: dir = "r-"; break;
386 case _IOC_WRITE: dir = "-w"; break;
387 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
388 default: dir = "*ERR*"; break;
389 }
390 switch (_IOC_TYPE(cmd)) {
391 case 'd':
392 printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n",
393 (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ?
394 v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
395 break;
396#ifdef CONFIG_VIDEO_V4L1_COMPAT
397 case 'v':
398 printk("v4l1 ioctl %s, dir=%s (0x%08x)\n",
399 (_IOC_NR(cmd) < V4L1_IOCTLS) ?
400 v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
401 break;
402#endif
403 case 'V':
404 printk("v4l2 ioctl %s, dir=%s (0x%08x)\n",
405 (_IOC_NR(cmd) < V4L2_IOCTLS) ?
406 v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
407 break;
408
409 default:
410 printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n",
411 _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
412 }
413}
414EXPORT_SYMBOL(v4l_printk_ioctl);
415
53/* 416/*
54 * sysfs stuff 417 * sysfs stuff
55 */ 418 */
@@ -69,11 +432,13 @@ struct video_device *video_device_alloc(void)
69 vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); 432 vfd = kzalloc(sizeof(*vfd),GFP_KERNEL);
70 return vfd; 433 return vfd;
71} 434}
435EXPORT_SYMBOL(video_device_alloc);
72 436
73void video_device_release(struct video_device *vfd) 437void video_device_release(struct video_device *vfd)
74{ 438{
75 kfree(vfd); 439 kfree(vfd);
76} 440}
441EXPORT_SYMBOL(video_device_release);
77 442
78static void video_release(struct device *cd) 443static void video_release(struct device *cd)
79{ 444{
@@ -110,6 +475,7 @@ struct video_device* video_devdata(struct file *file)
110{ 475{
111 return video_device[iminor(file->f_path.dentry->d_inode)]; 476 return video_device[iminor(file->f_path.dentry->d_inode)];
112} 477}
478EXPORT_SYMBOL(video_devdata);
113 479
114/* 480/*
115 * Open a video device - FIXME: Obsoleted 481 * Open a video device - FIXME: Obsoleted
@@ -278,6 +644,7 @@ out:
278 kfree(mbuf); 644 kfree(mbuf);
279 return err; 645 return err;
280} 646}
647EXPORT_SYMBOL(video_usercopy);
281 648
282/* 649/*
283 * open/release helper functions -- handle exclusive opens 650 * open/release helper functions -- handle exclusive opens
@@ -297,6 +664,7 @@ int video_exclusive_open(struct inode *inode, struct file *file)
297 mutex_unlock(&vfl->lock); 664 mutex_unlock(&vfl->lock);
298 return retval; 665 return retval;
299} 666}
667EXPORT_SYMBOL(video_exclusive_open);
300 668
301int video_exclusive_release(struct inode *inode, struct file *file) 669int video_exclusive_release(struct inode *inode, struct file *file)
302{ 670{
@@ -305,41 +673,7 @@ int video_exclusive_release(struct inode *inode, struct file *file)
305 vfl->users--; 673 vfl->users--;
306 return 0; 674 return 0;
307} 675}
308 676EXPORT_SYMBOL(video_exclusive_release);
309static char *v4l2_memory_names[] = {
310 [V4L2_MEMORY_MMAP] = "mmap",
311 [V4L2_MEMORY_USERPTR] = "userptr",
312 [V4L2_MEMORY_OVERLAY] = "overlay",
313};
314
315
316/* FIXME: Those stuff are replicated also on v4l2-common.c */
317static char *v4l2_type_names_FIXME[] = {
318 [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap",
319 [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over",
320 [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out",
321 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
322 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
323 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
324 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-capture",
325 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
326 [V4L2_BUF_TYPE_PRIVATE] = "private",
327};
328
329static char *v4l2_field_names_FIXME[] = {
330 [V4L2_FIELD_ANY] = "any",
331 [V4L2_FIELD_NONE] = "none",
332 [V4L2_FIELD_TOP] = "top",
333 [V4L2_FIELD_BOTTOM] = "bottom",
334 [V4L2_FIELD_INTERLACED] = "interlaced",
335 [V4L2_FIELD_SEQ_TB] = "seq-tb",
336 [V4L2_FIELD_SEQ_BT] = "seq-bt",
337 [V4L2_FIELD_ALTERNATE] = "alternate",
338 [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
339 [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
340};
341
342#define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown"
343 677
344static void dbgbuf(unsigned int cmd, struct video_device *vfd, 678static void dbgbuf(unsigned int cmd, struct video_device *vfd,
345 struct v4l2_buffer *p) 679 struct v4l2_buffer *p)
@@ -354,10 +688,10 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd,
354 (int)(p->timestamp.tv_sec%60), 688 (int)(p->timestamp.tv_sec%60),
355 p->timestamp.tv_usec, 689 p->timestamp.tv_usec,
356 p->index, 690 p->index,
357 prt_names(p->type,v4l2_type_names_FIXME), 691 prt_names(p->type, v4l2_type_names),
358 p->bytesused,p->flags, 692 p->bytesused, p->flags,
359 p->field,p->sequence, 693 p->field, p->sequence,
360 prt_names(p->memory,v4l2_memory_names), 694 prt_names(p->memory, v4l2_memory_names),
361 p->m.userptr, p->length); 695 p->m.userptr, p->length);
362 dbgarg2 ("timecode= %02d:%02d:%02d type=%d, " 696 dbgarg2 ("timecode= %02d:%02d:%02d type=%d, "
363 "flags=0x%08d, frames=%d, userbits=0x%08x\n", 697 "flags=0x%08d, frames=%d, userbits=0x%08x\n",
@@ -382,8 +716,8 @@ static inline void v4l_print_pix_fmt (struct video_device *vfd,
382 (fmt->pixelformat >> 8) & 0xff, 716 (fmt->pixelformat >> 8) & 0xff,
383 (fmt->pixelformat >> 16) & 0xff, 717 (fmt->pixelformat >> 16) & 0xff,
384 (fmt->pixelformat >> 24) & 0xff, 718 (fmt->pixelformat >> 24) & 0xff,
385 prt_names(fmt->field,v4l2_field_names_FIXME), 719 prt_names(fmt->field, v4l2_field_names),
386 fmt->bytesperline,fmt->sizeimage,fmt->colorspace); 720 fmt->bytesperline, fmt->sizeimage, fmt->colorspace);
387}; 721};
388 722
389 723
@@ -597,7 +931,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
597 931
598 /* FIXME: Should be one dump per type */ 932 /* FIXME: Should be one dump per type */
599 dbgarg (cmd, "type=%s\n", prt_names(type, 933 dbgarg (cmd, "type=%s\n", prt_names(type,
600 v4l2_type_names_FIXME)); 934 v4l2_type_names));
601 935
602 switch (type) { 936 switch (type) {
603 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 937 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
@@ -650,7 +984,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
650 984
651 /* FIXME: Should be one dump per type */ 985 /* FIXME: Should be one dump per type */
652 dbgarg (cmd, "type=%s\n", prt_names(f->type, 986 dbgarg (cmd, "type=%s\n", prt_names(f->type,
653 v4l2_type_names_FIXME)); 987 v4l2_type_names));
654 988
655 switch (f->type) { 989 switch (f->type) {
656 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 990 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
@@ -702,7 +1036,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
702 1036
703 /* FIXME: Should be one dump per type */ 1037 /* FIXME: Should be one dump per type */
704 dbgarg (cmd, "type=%s\n", prt_names(f->type, 1038 dbgarg (cmd, "type=%s\n", prt_names(f->type,
705 v4l2_type_names_FIXME)); 1039 v4l2_type_names));
706 switch (f->type) { 1040 switch (f->type) {
707 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 1041 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
708 if (vfd->vidioc_try_fmt_cap) 1042 if (vfd->vidioc_try_fmt_cap)
@@ -768,8 +1102,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
768 ret=vfd->vidioc_reqbufs(file, fh, p); 1102 ret=vfd->vidioc_reqbufs(file, fh, p);
769 dbgarg (cmd, "count=%d, type=%s, memory=%s\n", 1103 dbgarg (cmd, "count=%d, type=%s, memory=%s\n",
770 p->count, 1104 p->count,
771 prt_names(p->type,v4l2_type_names_FIXME), 1105 prt_names(p->type, v4l2_type_names),
772 prt_names(p->memory,v4l2_memory_names)); 1106 prt_names(p->memory, v4l2_memory_names));
773 break; 1107 break;
774 } 1108 }
775 case VIDIOC_QUERYBUF: 1109 case VIDIOC_QUERYBUF:
@@ -858,7 +1192,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
858 enum v4l2_buf_type i = *(int *)arg; 1192 enum v4l2_buf_type i = *(int *)arg;
859 if (!vfd->vidioc_streamon) 1193 if (!vfd->vidioc_streamon)
860 break; 1194 break;
861 dbgarg (cmd, "type=%s\n", prt_names(i,v4l2_type_names_FIXME)); 1195 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
862 ret=vfd->vidioc_streamon(file, fh,i); 1196 ret=vfd->vidioc_streamon(file, fh,i);
863 break; 1197 break;
864 } 1198 }
@@ -868,7 +1202,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
868 1202
869 if (!vfd->vidioc_streamoff) 1203 if (!vfd->vidioc_streamoff)
870 break; 1204 break;
871 dbgarg (cmd, "type=%s\n", prt_names(i,v4l2_type_names_FIXME)); 1205 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
872 ret=vfd->vidioc_streamoff(file, fh, i); 1206 ret=vfd->vidioc_streamoff(file, fh, i);
873 break; 1207 break;
874 } 1208 }
@@ -1624,7 +1958,7 @@ out:
1624 kfree(mbuf); 1958 kfree(mbuf);
1625 return err; 1959 return err;
1626} 1960}
1627 1961EXPORT_SYMBOL(video_ioctl2);
1628 1962
1629static const struct file_operations video_fops; 1963static const struct file_operations video_fops;
1630 1964
@@ -1743,6 +2077,7 @@ fail_minor:
1743 mutex_unlock(&videodev_lock); 2077 mutex_unlock(&videodev_lock);
1744 return ret; 2078 return ret;
1745} 2079}
2080EXPORT_SYMBOL(video_register_device);
1746 2081
1747/** 2082/**
1748 * video_unregister_device - unregister a video4linux device 2083 * video_unregister_device - unregister a video4linux device
@@ -1762,6 +2097,7 @@ void video_unregister_device(struct video_device *vfd)
1762 device_unregister(&vfd->class_dev); 2097 device_unregister(&vfd->class_dev);
1763 mutex_unlock(&videodev_lock); 2098 mutex_unlock(&videodev_lock);
1764} 2099}
2100EXPORT_SYMBOL(video_unregister_device);
1765 2101
1766/* 2102/*
1767 * Video fs operations 2103 * Video fs operations
@@ -1806,16 +2142,6 @@ static void __exit videodev_exit(void)
1806module_init(videodev_init) 2142module_init(videodev_init)
1807module_exit(videodev_exit) 2143module_exit(videodev_exit)
1808 2144
1809EXPORT_SYMBOL(video_register_device);
1810EXPORT_SYMBOL(video_unregister_device);
1811EXPORT_SYMBOL(video_devdata);
1812EXPORT_SYMBOL(video_usercopy);
1813EXPORT_SYMBOL(video_exclusive_open);
1814EXPORT_SYMBOL(video_exclusive_release);
1815EXPORT_SYMBOL(video_ioctl2);
1816EXPORT_SYMBOL(video_device_alloc);
1817EXPORT_SYMBOL(video_device_release);
1818
1819MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>"); 2145MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>");
1820MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2"); 2146MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2");
1821MODULE_LICENSE("GPL"); 2147MODULE_LICENSE("GPL");
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h
index 937c4a616c0e..498a43c1f2b1 100644
--- a/drivers/media/video/zoran.h
+++ b/drivers/media/video/zoran.h
@@ -221,15 +221,15 @@ enum zoran_map_mode {
221}; 221};
222 222
223enum gpio_type { 223enum gpio_type {
224 GPIO_JPEG_SLEEP = 0, 224 ZR_GPIO_JPEG_SLEEP = 0,
225 GPIO_JPEG_RESET, 225 ZR_GPIO_JPEG_RESET,
226 GPIO_JPEG_FRAME, 226 ZR_GPIO_JPEG_FRAME,
227 GPIO_VID_DIR, 227 ZR_GPIO_VID_DIR,
228 GPIO_VID_EN, 228 ZR_GPIO_VID_EN,
229 GPIO_VID_RESET, 229 ZR_GPIO_VID_RESET,
230 GPIO_CLK_SEL1, 230 ZR_GPIO_CLK_SEL1,
231 GPIO_CLK_SEL2, 231 ZR_GPIO_CLK_SEL2,
232 GPIO_MAX, 232 ZR_GPIO_MAX,
233}; 233};
234 234
235enum gpcs_type { 235enum gpcs_type {
@@ -378,11 +378,11 @@ struct card_info {
378 378
379 u32 jpeg_int; /* JPEG interrupt */ 379 u32 jpeg_int; /* JPEG interrupt */
380 u32 vsync_int; /* VSYNC interrupt */ 380 u32 vsync_int; /* VSYNC interrupt */
381 s8 gpio[GPIO_MAX]; 381 s8 gpio[ZR_GPIO_MAX];
382 u8 gpcs[GPCS_MAX]; 382 u8 gpcs[GPCS_MAX];
383 383
384 struct vfe_polarity vfe_pol; 384 struct vfe_polarity vfe_pol;
385 u8 gpio_pol[GPIO_MAX]; 385 u8 gpio_pol[ZR_GPIO_MAX];
386 386
387 /* is the /GWS line conected? */ 387 /* is the /GWS line conected? */
388 u8 gws_not_connected; 388 u8 gws_not_connected;
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c
index 68c7c505587e..f97c20692057 100644
--- a/drivers/media/video/zoran_device.c
+++ b/drivers/media/video/zoran_device.c
@@ -250,7 +250,7 @@ void
250jpeg_codec_sleep (struct zoran *zr, 250jpeg_codec_sleep (struct zoran *zr,
251 int sleep) 251 int sleep)
252{ 252{
253 GPIO(zr, zr->card.gpio[GPIO_JPEG_SLEEP], !sleep); 253 GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_SLEEP], !sleep);
254 if (!sleep) { 254 if (!sleep) {
255 dprintk(3, 255 dprintk(3,
256 KERN_DEBUG 256 KERN_DEBUG
@@ -277,9 +277,9 @@ jpeg_codec_reset (struct zoran *zr)
277 0); 277 0);
278 udelay(2); 278 udelay(2);
279 } else { 279 } else {
280 GPIO(zr, zr->card.gpio[GPIO_JPEG_RESET], 0); 280 GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_RESET], 0);
281 udelay(2); 281 udelay(2);
282 GPIO(zr, zr->card.gpio[GPIO_JPEG_RESET], 1); 282 GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_RESET], 1);
283 udelay(2); 283 udelay(2);
284 } 284 }
285 285
@@ -688,7 +688,7 @@ static inline void
688set_frame (struct zoran *zr, 688set_frame (struct zoran *zr,
689 int val) 689 int val)
690{ 690{
691 GPIO(zr, zr->card.gpio[GPIO_JPEG_FRAME], val); 691 GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_FRAME], val);
692} 692}
693 693
694static void 694static void
@@ -704,8 +704,8 @@ set_videobus_dir (struct zoran *zr,
704 GPIO(zr, 5, 1); 704 GPIO(zr, 5, 1);
705 break; 705 break;
706 default: 706 default:
707 GPIO(zr, zr->card.gpio[GPIO_VID_DIR], 707 GPIO(zr, zr->card.gpio[ZR_GPIO_VID_DIR],
708 zr->card.gpio_pol[GPIO_VID_DIR] ? !val : val); 708 zr->card.gpio_pol[ZR_GPIO_VID_DIR] ? !val : val);
709 break; 709 break;
710 } 710 }
711} 711}
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c
index 1fdbb46de7f3..1b44784d0efb 100644
--- a/drivers/media/video/zr364xx.c
+++ b/drivers/media/video/zr364xx.c
@@ -93,6 +93,8 @@ static struct usb_device_id device_table[] = {
93 {USB_DEVICE(0x06d6, 0x0034), .driver_info = METHOD0 }, 93 {USB_DEVICE(0x06d6, 0x0034), .driver_info = METHOD0 },
94 {USB_DEVICE(0x0a17, 0x0062), .driver_info = METHOD2 }, 94 {USB_DEVICE(0x0a17, 0x0062), .driver_info = METHOD2 },
95 {USB_DEVICE(0x06d6, 0x003b), .driver_info = METHOD0 }, 95 {USB_DEVICE(0x06d6, 0x003b), .driver_info = METHOD0 },
96 {USB_DEVICE(0x0a17, 0x004e), .driver_info = METHOD2 },
97 {USB_DEVICE(0x041e, 0x405d), .driver_info = METHOD2 },
96 {} /* Terminating entry */ 98 {} /* Terminating entry */
97}; 99};
98 100
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
index f55b71a4337d..4fb24215bd95 100644
--- a/drivers/memstick/host/tifm_ms.c
+++ b/drivers/memstick/host/tifm_ms.c
@@ -282,7 +282,7 @@ static int tifm_ms_issue_cmd(struct tifm_ms *host)
282 282
283 writel(TIFM_MS_SYS_LATCH 283 writel(TIFM_MS_SYS_LATCH
284 | readl(sock->addr + SOCK_MS_SYSTEM), 284 | readl(sock->addr + SOCK_MS_SYSTEM),
285 sock + SOCK_MS_SYSTEM); 285 sock->addr + SOCK_MS_SYSTEM);
286 writel(0, sock->addr + SOCK_MS_DATA); 286 writel(0, sock->addr + SOCK_MS_DATA);
287 dev_dbg(&sock->dev, "writing %x\n", 0); 287 dev_dbg(&sock->dev, "writing %x\n", 0);
288 288
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 425f60c21fdd..0c303c84b37b 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1470,9 +1470,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1470 if (mpt_debug_level) 1470 if (mpt_debug_level)
1471 printk(KERN_INFO MYNAM ": mpt_debug_level=%xh\n", mpt_debug_level); 1471 printk(KERN_INFO MYNAM ": mpt_debug_level=%xh\n", mpt_debug_level);
1472 1472
1473 if (pci_enable_device(pdev))
1474 return r;
1475
1476 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); 1473 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC);
1477 if (ioc == NULL) { 1474 if (ioc == NULL) {
1478 printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); 1475 printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n");
@@ -1482,6 +1479,20 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1482 ioc->id = mpt_ids++; 1479 ioc->id = mpt_ids++;
1483 sprintf(ioc->name, "ioc%d", ioc->id); 1480 sprintf(ioc->name, "ioc%d", ioc->id);
1484 1481
1482 ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
1483 if (pci_enable_device_mem(pdev)) {
1484 printk(MYIOC_s_ERR_FMT "pci_enable_device_mem() "
1485 "failed\n", ioc->name);
1486 kfree(ioc);
1487 return r;
1488 }
1489 if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) {
1490 printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with "
1491 "MEM failed\n", ioc->name);
1492 kfree(ioc);
1493 return r;
1494 }
1495
1485 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": mpt_adapter_install\n", ioc->name)); 1496 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": mpt_adapter_install\n", ioc->name));
1486 1497
1487 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { 1498 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
@@ -1658,6 +1669,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1658 ioc->active = 0; 1669 ioc->active = 0;
1659 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); 1670 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
1660 1671
1672 /* Set IOC ptr in the pcidev's driver data. */
1673 pci_set_drvdata(ioc->pcidev, ioc);
1674
1661 /* Set lookup ptr. */ 1675 /* Set lookup ptr. */
1662 list_add_tail(&ioc->list, &ioc_list); 1676 list_add_tail(&ioc->list, &ioc_list);
1663 1677
@@ -1791,6 +1805,7 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state)
1791 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); 1805 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
1792 1806
1793 pci_disable_device(pdev); 1807 pci_disable_device(pdev);
1808 pci_release_selected_regions(pdev, ioc->bars);
1794 pci_set_power_state(pdev, device_state); 1809 pci_set_power_state(pdev, device_state);
1795 1810
1796 return 0; 1811 return 0;
@@ -1807,7 +1822,6 @@ mpt_resume(struct pci_dev *pdev)
1807 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1822 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
1808 u32 device_state = pdev->current_state; 1823 u32 device_state = pdev->current_state;
1809 int recovery_state; 1824 int recovery_state;
1810 int err;
1811 1825
1812 printk(MYIOC_s_INFO_FMT 1826 printk(MYIOC_s_INFO_FMT
1813 "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", 1827 "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n",
@@ -1815,9 +1829,18 @@ mpt_resume(struct pci_dev *pdev)
1815 1829
1816 pci_set_power_state(pdev, 0); 1830 pci_set_power_state(pdev, 0);
1817 pci_restore_state(pdev); 1831 pci_restore_state(pdev);
1818 err = pci_enable_device(pdev); 1832 if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) {
1819 if (err) 1833 ioc->bars = pci_select_bars(ioc->pcidev, IORESOURCE_MEM |
1820 return err; 1834 IORESOURCE_IO);
1835 if (pci_enable_device(pdev))
1836 return 0;
1837 } else {
1838 ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM);
1839 if (pci_enable_device_mem(pdev))
1840 return 0;
1841 }
1842 if (pci_request_selected_regions(pdev, ioc->bars, "mpt"))
1843 return 0;
1821 1844
1822 /* enable interrupts */ 1845 /* enable interrupts */
1823 CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM); 1846 CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM);
@@ -1878,6 +1901,7 @@ mpt_signal_reset(u8 index, MPT_ADAPTER *ioc, int reset_phase)
1878 * -2 if READY but IOCFacts Failed 1901 * -2 if READY but IOCFacts Failed
1879 * -3 if READY but PrimeIOCFifos Failed 1902 * -3 if READY but PrimeIOCFifos Failed
1880 * -4 if READY but IOCInit Failed 1903 * -4 if READY but IOCInit Failed
1904 * -5 if failed to enable_device and/or request_selected_regions
1881 */ 1905 */
1882static int 1906static int
1883mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) 1907mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
@@ -1976,6 +2000,18 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1976 } 2000 }
1977 } 2001 }
1978 2002
2003 if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP) &&
2004 (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT)) {
2005 pci_release_selected_regions(ioc->pcidev, ioc->bars);
2006 ioc->bars = pci_select_bars(ioc->pcidev, IORESOURCE_MEM |
2007 IORESOURCE_IO);
2008 if (pci_enable_device(ioc->pcidev))
2009 return -5;
2010 if (pci_request_selected_regions(ioc->pcidev, ioc->bars,
2011 "mpt"))
2012 return -5;
2013 }
2014
1979 /* 2015 /*
1980 * Device is reset now. It must have de-asserted the interrupt line 2016 * Device is reset now. It must have de-asserted the interrupt line
1981 * (if it was asserted) and it should be safe to register for the 2017 * (if it was asserted) and it should be safe to register for the
@@ -1999,7 +2035,6 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1999 irq_allocated = 1; 2035 irq_allocated = 1;
2000 ioc->pci_irq = ioc->pcidev->irq; 2036 ioc->pci_irq = ioc->pcidev->irq;
2001 pci_set_master(ioc->pcidev); /* ?? */ 2037 pci_set_master(ioc->pcidev); /* ?? */
2002 pci_set_drvdata(ioc->pcidev, ioc);
2003 dprintk(ioc, printk(MYIOC_s_INFO_FMT "installed at interrupt " 2038 dprintk(ioc, printk(MYIOC_s_INFO_FMT "installed at interrupt "
2004 "%d\n", ioc->name, ioc->pcidev->irq)); 2039 "%d\n", ioc->name, ioc->pcidev->irq));
2005 } 2040 }
@@ -2381,6 +2416,9 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
2381 ioc->memmap = NULL; 2416 ioc->memmap = NULL;
2382 } 2417 }
2383 2418
2419 pci_disable_device(ioc->pcidev);
2420 pci_release_selected_regions(ioc->pcidev, ioc->bars);
2421
2384#if defined(CONFIG_MTRR) && 0 2422#if defined(CONFIG_MTRR) && 0
2385 if (ioc->mtrr_reg > 0) { 2423 if (ioc->mtrr_reg > 0) {
2386 mtrr_del(ioc->mtrr_reg, 0, 0); 2424 mtrr_del(ioc->mtrr_reg, 0, 0);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index b49b706c0020..caadc68c3000 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -629,6 +629,7 @@ typedef struct _MPT_ADAPTER
629 dma_addr_t HostPageBuffer_dma; 629 dma_addr_t HostPageBuffer_dma;
630 int mtrr_reg; 630 int mtrr_reg;
631 struct pci_dev *pcidev; /* struct pci_dev pointer */ 631 struct pci_dev *pcidev; /* struct pci_dev pointer */
632 int bars; /* bitmask of BAR's that must be configured */
632 u8 __iomem *memmap; /* mmap address */ 633 u8 __iomem *memmap; /* mmap address */
633 struct Scsi_Host *sh; /* Scsi Host pointer */ 634 struct Scsi_Host *sh; /* Scsi Host pointer */
634 SpiCfgData spi_data; /* Scsi config. data */ 635 SpiCfgData spi_data; /* Scsi config. data */
@@ -922,7 +923,7 @@ extern struct proc_dir_entry *mpt_proc_root_dir;
922/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 923/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
923#endif /* } __KERNEL__ */ 924#endif /* } __KERNEL__ */
924 925
925#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__) || defined(__x86_64__) || defined(__powerpc__) 926#ifdef CONFIG_64BIT
926#define CAST_U32_TO_PTR(x) ((void *)(u64)x) 927#define CAST_U32_TO_PTR(x) ((void *)(u64)x)
927#define CAST_PTR_TO_U32(x) ((u32)(u64)x) 928#define CAST_PTR_TO_U32(x) ((u32)(u64)x)
928#else 929#else
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 1abc95ca9dfa..982e27b86d10 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -258,6 +258,23 @@ config THINKPAD_ACPI_BAY
258 258
259 If you are not sure, say Y here. 259 If you are not sure, say Y here.
260 260
261config THINKPAD_ACPI_VIDEO
262 bool "Video output control support"
263 depends on THINKPAD_ACPI
264 default y
265 ---help---
266 Allows the thinkpad_acpi driver to provide an interface to control
267 the various video output ports.
268
269 This feature often won't work well, depending on ThinkPad model,
270 display state, video output devices in use, whether there is a X
271 server running, phase of the moon, and the current mood of
272 Schroedinger's cat. If you can use X.org's RandR to control
273 your ThinkPad's video output ports instead of this feature,
274 don't think twice: do it and say N here to save some memory.
275
276 If you are not sure, say Y here.
277
261config THINKPAD_ACPI_HOTKEY_POLL 278config THINKPAD_ACPI_HOTKEY_POLL
262 bool "Suport NVRAM polling for hot keys" 279 bool "Suport NVRAM polling for hot keys"
263 depends on THINKPAD_ACPI 280 depends on THINKPAD_ACPI
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c
index d7aea93081f2..74d12b4a3abd 100644
--- a/drivers/misc/acer-wmi.c
+++ b/drivers/misc/acer-wmi.c
@@ -273,6 +273,15 @@ static struct dmi_system_id acer_quirks[] = {
273 }, 273 },
274 { 274 {
275 .callback = dmi_matched, 275 .callback = dmi_matched,
276 .ident = "Acer TravelMate 4200",
277 .matches = {
278 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
279 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4200"),
280 },
281 .driver_data = &quirk_acer_travelmate_2490,
282 },
283 {
284 .callback = dmi_matched,
276 .ident = "Medion MD 98300", 285 .ident = "Medion MD 98300",
277 .matches = { 286 .matches = {
278 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), 287 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c
index f70984ab1e1b..de16e88eb8d3 100644
--- a/drivers/misc/intel_menlow.c
+++ b/drivers/misc/intel_menlow.c
@@ -170,10 +170,13 @@ static int intel_menlow_memory_add(struct acpi_device *device)
170 170
171 cdev = thermal_cooling_device_register("Memory controller", device, 171 cdev = thermal_cooling_device_register("Memory controller", device,
172 &memory_cooling_ops); 172 &memory_cooling_ops);
173 acpi_driver_data(device) = cdev; 173 if (IS_ERR(cdev)) {
174 if (!cdev) 174 result = PTR_ERR(cdev);
175 result = -ENODEV; 175 goto end;
176 else { 176 }
177
178 if (cdev) {
179 acpi_driver_data(device) = cdev;
177 result = sysfs_create_link(&device->dev.kobj, 180 result = sysfs_create_link(&device->dev.kobj,
178 &cdev->device.kobj, "thermal_cooling"); 181 &cdev->device.kobj, "thermal_cooling");
179 if (result) 182 if (result)
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 7ba1acad5402..bb269d0c677e 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -221,6 +221,7 @@ static struct {
221 u32 hotkey:1; 221 u32 hotkey:1;
222 u32 hotkey_mask:1; 222 u32 hotkey_mask:1;
223 u32 hotkey_wlsw:1; 223 u32 hotkey_wlsw:1;
224 u32 hotkey_tablet:1;
224 u32 light:1; 225 u32 light:1;
225 u32 light_status:1; 226 u32 light_status:1;
226 u32 bright_16levels:1; 227 u32 bright_16levels:1;
@@ -301,6 +302,13 @@ TPACPI_HANDLE(hkey, ec, "\\_SB.HKEY", /* 600e/x, 770e, 770x */
301 "HKEY", /* all others */ 302 "HKEY", /* all others */
302 ); /* 570 */ 303 ); /* 570 */
303 304
305TPACPI_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA", /* 570 */
306 "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */
307 "\\_SB.PCI0.VID0", /* 770e */
308 "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */
309 "\\_SB.PCI0.AGP.VID", /* all others */
310 ); /* R30, R31 */
311
304 312
305/************************************************************************* 313/*************************************************************************
306 * ACPI helpers 314 * ACPI helpers
@@ -1053,6 +1061,9 @@ static struct attribute_set *hotkey_dev_attributes;
1053#define HOTKEY_CONFIG_CRITICAL_END 1061#define HOTKEY_CONFIG_CRITICAL_END
1054#endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 1062#endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */
1055 1063
1064/* HKEY.MHKG() return bits */
1065#define TP_HOTKEY_TABLET_MASK (1 << 3)
1066
1056static int hotkey_get_wlsw(int *status) 1067static int hotkey_get_wlsw(int *status)
1057{ 1068{
1058 if (!acpi_evalf(hkey_handle, status, "WLSW", "d")) 1069 if (!acpi_evalf(hkey_handle, status, "WLSW", "d"))
@@ -1060,6 +1071,16 @@ static int hotkey_get_wlsw(int *status)
1060 return 0; 1071 return 0;
1061} 1072}
1062 1073
1074static int hotkey_get_tablet_mode(int *status)
1075{
1076 int s;
1077
1078 if (!acpi_evalf(hkey_handle, &s, "MHKG", "d"))
1079 return -EIO;
1080
1081 return ((s & TP_HOTKEY_TABLET_MASK) != 0);
1082}
1083
1063/* 1084/*
1064 * Call with hotkey_mutex held 1085 * Call with hotkey_mutex held
1065 */ 1086 */
@@ -1154,15 +1175,31 @@ static void tpacpi_input_send_radiosw(void)
1154{ 1175{
1155 int wlsw; 1176 int wlsw;
1156 1177
1157 mutex_lock(&tpacpi_inputdev_send_mutex);
1158
1159 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { 1178 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
1179 mutex_lock(&tpacpi_inputdev_send_mutex);
1180
1160 input_report_switch(tpacpi_inputdev, 1181 input_report_switch(tpacpi_inputdev,
1161 SW_RADIO, !!wlsw); 1182 SW_RADIO, !!wlsw);
1162 input_sync(tpacpi_inputdev); 1183 input_sync(tpacpi_inputdev);
1184
1185 mutex_unlock(&tpacpi_inputdev_send_mutex);
1163 } 1186 }
1187}
1188
1189static void tpacpi_input_send_tabletsw(void)
1190{
1191 int state;
1192
1193 if (tp_features.hotkey_tablet &&
1194 !hotkey_get_tablet_mode(&state)) {
1195 mutex_lock(&tpacpi_inputdev_send_mutex);
1164 1196
1165 mutex_unlock(&tpacpi_inputdev_send_mutex); 1197 input_report_switch(tpacpi_inputdev,
1198 SW_TABLET_MODE, !!state);
1199 input_sync(tpacpi_inputdev);
1200
1201 mutex_unlock(&tpacpi_inputdev_send_mutex);
1202 }
1166} 1203}
1167 1204
1168static void tpacpi_input_send_key(unsigned int scancode) 1205static void tpacpi_input_send_key(unsigned int scancode)
@@ -1417,6 +1454,14 @@ static void hotkey_poll_setup_safe(int may_warn)
1417 mutex_unlock(&hotkey_mutex); 1454 mutex_unlock(&hotkey_mutex);
1418} 1455}
1419 1456
1457#else /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */
1458
1459static void hotkey_poll_setup_safe(int __unused)
1460{
1461}
1462
1463#endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */
1464
1420static int hotkey_inputdev_open(struct input_dev *dev) 1465static int hotkey_inputdev_open(struct input_dev *dev)
1421{ 1466{
1422 switch (tpacpi_lifecycle) { 1467 switch (tpacpi_lifecycle) {
@@ -1444,7 +1489,6 @@ static void hotkey_inputdev_close(struct input_dev *dev)
1444 if (tpacpi_lifecycle == TPACPI_LIFE_RUNNING) 1489 if (tpacpi_lifecycle == TPACPI_LIFE_RUNNING)
1445 hotkey_poll_setup_safe(0); 1490 hotkey_poll_setup_safe(0);
1446} 1491}
1447#endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */
1448 1492
1449/* sysfs hotkey enable ------------------------------------------------- */ 1493/* sysfs hotkey enable ------------------------------------------------- */
1450static ssize_t hotkey_enable_show(struct device *dev, 1494static ssize_t hotkey_enable_show(struct device *dev,
@@ -1666,6 +1710,29 @@ static void hotkey_radio_sw_notify_change(void)
1666 "hotkey_radio_sw"); 1710 "hotkey_radio_sw");
1667} 1711}
1668 1712
1713/* sysfs hotkey tablet mode (pollable) --------------------------------- */
1714static ssize_t hotkey_tablet_mode_show(struct device *dev,
1715 struct device_attribute *attr,
1716 char *buf)
1717{
1718 int res, s;
1719 res = hotkey_get_tablet_mode(&s);
1720 if (res < 0)
1721 return res;
1722
1723 return snprintf(buf, PAGE_SIZE, "%d\n", !!s);
1724}
1725
1726static struct device_attribute dev_attr_hotkey_tablet_mode =
1727 __ATTR(hotkey_tablet_mode, S_IRUGO, hotkey_tablet_mode_show, NULL);
1728
1729static void hotkey_tablet_mode_notify_change(void)
1730{
1731 if (tp_features.hotkey_tablet)
1732 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL,
1733 "hotkey_tablet_mode");
1734}
1735
1669/* sysfs hotkey report_mode -------------------------------------------- */ 1736/* sysfs hotkey report_mode -------------------------------------------- */
1670static ssize_t hotkey_report_mode_show(struct device *dev, 1737static ssize_t hotkey_report_mode_show(struct device *dev,
1671 struct device_attribute *attr, 1738 struct device_attribute *attr,
@@ -1689,7 +1756,7 @@ static ssize_t hotkey_wakeup_reason_show(struct device *dev,
1689static struct device_attribute dev_attr_hotkey_wakeup_reason = 1756static struct device_attribute dev_attr_hotkey_wakeup_reason =
1690 __ATTR(wakeup_reason, S_IRUGO, hotkey_wakeup_reason_show, NULL); 1757 __ATTR(wakeup_reason, S_IRUGO, hotkey_wakeup_reason_show, NULL);
1691 1758
1692void hotkey_wakeup_reason_notify_change(void) 1759static void hotkey_wakeup_reason_notify_change(void)
1693{ 1760{
1694 if (tp_features.hotkey_mask) 1761 if (tp_features.hotkey_mask)
1695 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, 1762 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL,
@@ -1708,7 +1775,7 @@ static struct device_attribute dev_attr_hotkey_wakeup_hotunplug_complete =
1708 __ATTR(wakeup_hotunplug_complete, S_IRUGO, 1775 __ATTR(wakeup_hotunplug_complete, S_IRUGO,
1709 hotkey_wakeup_hotunplug_complete_show, NULL); 1776 hotkey_wakeup_hotunplug_complete_show, NULL);
1710 1777
1711void hotkey_wakeup_hotunplug_complete_notify_change(void) 1778static void hotkey_wakeup_hotunplug_complete_notify_change(void)
1712{ 1779{
1713 if (tp_features.hotkey_mask) 1780 if (tp_features.hotkey_mask)
1714 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, 1781 sysfs_notify(&tpacpi_pdev->dev.kobj, NULL,
@@ -1878,7 +1945,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
1878 str_supported(tp_features.hotkey)); 1945 str_supported(tp_features.hotkey));
1879 1946
1880 if (tp_features.hotkey) { 1947 if (tp_features.hotkey) {
1881 hotkey_dev_attributes = create_attr_set(12, NULL); 1948 hotkey_dev_attributes = create_attr_set(13, NULL);
1882 if (!hotkey_dev_attributes) 1949 if (!hotkey_dev_attributes)
1883 return -ENOMEM; 1950 return -ENOMEM;
1884 res = add_many_to_attr_set(hotkey_dev_attributes, 1951 res = add_many_to_attr_set(hotkey_dev_attributes,
@@ -1957,6 +2024,18 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
1957 &dev_attr_hotkey_radio_sw.attr); 2024 &dev_attr_hotkey_radio_sw.attr);
1958 } 2025 }
1959 2026
2027 /* For X41t, X60t, X61t Tablets... */
2028 if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) {
2029 tp_features.hotkey_tablet = 1;
2030 printk(TPACPI_INFO
2031 "possible tablet mode switch found; "
2032 "ThinkPad in %s mode\n",
2033 (status & TP_HOTKEY_TABLET_MASK)?
2034 "tablet" : "laptop");
2035 res = add_to_attr_set(hotkey_dev_attributes,
2036 &dev_attr_hotkey_tablet_mode.attr);
2037 }
2038
1960 if (!res) 2039 if (!res)
1961 res = register_attr_set_with_sysfs( 2040 res = register_attr_set_with_sysfs(
1962 hotkey_dev_attributes, 2041 hotkey_dev_attributes,
@@ -2006,6 +2085,10 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
2006 set_bit(EV_SW, tpacpi_inputdev->evbit); 2085 set_bit(EV_SW, tpacpi_inputdev->evbit);
2007 set_bit(SW_RADIO, tpacpi_inputdev->swbit); 2086 set_bit(SW_RADIO, tpacpi_inputdev->swbit);
2008 } 2087 }
2088 if (tp_features.hotkey_tablet) {
2089 set_bit(EV_SW, tpacpi_inputdev->evbit);
2090 set_bit(SW_TABLET_MODE, tpacpi_inputdev->swbit);
2091 }
2009 2092
2010 dbg_printk(TPACPI_DBG_INIT, 2093 dbg_printk(TPACPI_DBG_INIT,
2011 "enabling hot key handling\n"); 2094 "enabling hot key handling\n");
@@ -2023,12 +2106,12 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
2023 (hotkey_report_mode < 2) ? 2106 (hotkey_report_mode < 2) ?
2024 "enabled" : "disabled"); 2107 "enabled" : "disabled");
2025 2108
2026#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
2027 tpacpi_inputdev->open = &hotkey_inputdev_open; 2109 tpacpi_inputdev->open = &hotkey_inputdev_open;
2028 tpacpi_inputdev->close = &hotkey_inputdev_close; 2110 tpacpi_inputdev->close = &hotkey_inputdev_close;
2029 2111
2030 hotkey_poll_setup_safe(1); 2112 hotkey_poll_setup_safe(1);
2031#endif 2113 tpacpi_input_send_radiosw();
2114 tpacpi_input_send_tabletsw();
2032 } 2115 }
2033 2116
2034 return (tp_features.hotkey)? 0 : 1; 2117 return (tp_features.hotkey)? 0 : 1;
@@ -2156,11 +2239,15 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2156 /* 0x5000-0x5FFF: human interface helpers */ 2239 /* 0x5000-0x5FFF: human interface helpers */
2157 switch (hkey) { 2240 switch (hkey) {
2158 case 0x5010: /* Lenovo new BIOS: brightness changed */ 2241 case 0x5010: /* Lenovo new BIOS: brightness changed */
2159 case 0x5009: /* X61t: swivel up (tablet mode) */
2160 case 0x500a: /* X61t: swivel down (normal mode) */
2161 case 0x500b: /* X61t: tablet pen inserted into bay */ 2242 case 0x500b: /* X61t: tablet pen inserted into bay */
2162 case 0x500c: /* X61t: tablet pen removed from bay */ 2243 case 0x500c: /* X61t: tablet pen removed from bay */
2163 break; 2244 break;
2245 case 0x5009: /* X41t-X61t: swivel up (tablet mode) */
2246 case 0x500a: /* X41t-X61t: swivel down (normal mode) */
2247 tpacpi_input_send_tabletsw();
2248 hotkey_tablet_mode_notify_change();
2249 send_acpi_ev = 0;
2250 break;
2164 case 0x5001: 2251 case 0x5001:
2165 case 0x5002: 2252 case 0x5002:
2166 /* LID switch events. Do not propagate */ 2253 /* LID switch events. Do not propagate */
@@ -2219,11 +2306,10 @@ static void hotkey_resume(void)
2219 "from firmware\n"); 2306 "from firmware\n");
2220 tpacpi_input_send_radiosw(); 2307 tpacpi_input_send_radiosw();
2221 hotkey_radio_sw_notify_change(); 2308 hotkey_radio_sw_notify_change();
2309 hotkey_tablet_mode_notify_change();
2222 hotkey_wakeup_reason_notify_change(); 2310 hotkey_wakeup_reason_notify_change();
2223 hotkey_wakeup_hotunplug_complete_notify_change(); 2311 hotkey_wakeup_hotunplug_complete_notify_change();
2224#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
2225 hotkey_poll_setup_safe(0); 2312 hotkey_poll_setup_safe(0);
2226#endif
2227} 2313}
2228 2314
2229/* procfs -------------------------------------------------------------- */ 2315/* procfs -------------------------------------------------------------- */
@@ -2676,6 +2762,8 @@ static struct ibm_struct wan_driver_data = {
2676 * Video subdriver 2762 * Video subdriver
2677 */ 2763 */
2678 2764
2765#ifdef CONFIG_THINKPAD_ACPI_VIDEO
2766
2679enum video_access_mode { 2767enum video_access_mode {
2680 TPACPI_VIDEO_NONE = 0, 2768 TPACPI_VIDEO_NONE = 0,
2681 TPACPI_VIDEO_570, /* 570 */ 2769 TPACPI_VIDEO_570, /* 570 */
@@ -2703,13 +2791,6 @@ static int video_orig_autosw;
2703static int video_autosw_get(void); 2791static int video_autosw_get(void);
2704static int video_autosw_set(int enable); 2792static int video_autosw_set(int enable);
2705 2793
2706TPACPI_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA", /* 570 */
2707 "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */
2708 "\\_SB.PCI0.VID0", /* 770e */
2709 "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */
2710 "\\_SB.PCI0.AGP.VID", /* all others */
2711 ); /* R30, R31 */
2712
2713TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */ 2794TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */
2714 2795
2715static int __init video_init(struct ibm_init_struct *iibm) 2796static int __init video_init(struct ibm_init_struct *iibm)
@@ -3019,6 +3100,8 @@ static struct ibm_struct video_driver_data = {
3019 .exit = video_exit, 3100 .exit = video_exit,
3020}; 3101};
3021 3102
3103#endif /* CONFIG_THINKPAD_ACPI_VIDEO */
3104
3022/************************************************************************* 3105/*************************************************************************
3023 * Light (thinklight) subdriver 3106 * Light (thinklight) subdriver
3024 */ 3107 */
@@ -5803,10 +5886,12 @@ static struct ibm_init_struct ibms_init[] __initdata = {
5803 .init = wan_init, 5886 .init = wan_init,
5804 .data = &wan_driver_data, 5887 .data = &wan_driver_data,
5805 }, 5888 },
5889#ifdef CONFIG_THINKPAD_ACPI_VIDEO
5806 { 5890 {
5807 .init = video_init, 5891 .init = video_init,
5808 .data = &video_driver_data, 5892 .data = &video_driver_data,
5809 }, 5893 },
5894#endif
5810 { 5895 {
5811 .init = light_init, 5896 .init = light_init,
5812 .data = &light_driver_data, 5897 .data = &light_driver_data,
@@ -5918,7 +6003,7 @@ MODULE_PARM_DESC(hotkey_report_mode,
5918 6003
5919#define TPACPI_PARAM(feature) \ 6004#define TPACPI_PARAM(feature) \
5920 module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ 6005 module_param_call(feature, set_ibm_param, NULL, NULL, 0); \
5921 MODULE_PARM_DESC(feature, "Simulates thinkpad-aci procfs command " \ 6006 MODULE_PARM_DESC(feature, "Simulates thinkpad-acpi procfs command " \
5922 "at module load, see documentation") 6007 "at module load, see documentation")
5923 6008
5924TPACPI_PARAM(hotkey); 6009TPACPI_PARAM(hotkey);
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index 9b430f20b640..28cc6787a800 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -184,26 +184,26 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
184 ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd); 184 ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
185 185
186 DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n", 186 DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n",
187 ret, nd.dentry ? nd.dentry->d_inode : NULL); 187 ret, nd.path.dentry ? nd.path.dentry->d_inode : NULL);
188 188
189 if (ret) 189 if (ret)
190 return ret; 190 return ret;
191 191
192 ret = -EINVAL; 192 ret = -EINVAL;
193 193
194 if (!S_ISBLK(nd.dentry->d_inode->i_mode)) 194 if (!S_ISBLK(nd.path.dentry->d_inode->i_mode))
195 goto out; 195 goto out;
196 196
197 if (nd.mnt->mnt_flags & MNT_NODEV) { 197 if (nd.path.mnt->mnt_flags & MNT_NODEV) {
198 ret = -EACCES; 198 ret = -EACCES;
199 goto out; 199 goto out;
200 } 200 }
201 201
202 if (imajor(nd.dentry->d_inode) != MTD_BLOCK_MAJOR) 202 if (imajor(nd.path.dentry->d_inode) != MTD_BLOCK_MAJOR)
203 goto not_an_MTD_device; 203 goto not_an_MTD_device;
204 204
205 mtdnr = iminor(nd.dentry->d_inode); 205 mtdnr = iminor(nd.path.dentry->d_inode);
206 path_release(&nd); 206 path_put(&nd.path);
207 207
208 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, 208 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
209 mnt); 209 mnt);
@@ -214,7 +214,7 @@ not_an_MTD_device:
214 "MTD: Attempt to mount non-MTD device \"%s\"\n", 214 "MTD: Attempt to mount non-MTD device \"%s\"\n",
215 dev_name); 215 dev_name);
216out: 216out:
217 path_release(&nd); 217 path_put(&nd.path);
218 return ret; 218 return ret;
219 219
220} 220}
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c
index 9bc1132fa788..5757788227be 100644
--- a/drivers/net/ibm_newemac/rgmii.c
+++ b/drivers/net/ibm_newemac/rgmii.c
@@ -302,7 +302,6 @@ static int __devexit rgmii_remove(struct of_device *ofdev)
302static struct of_device_id rgmii_match[] = 302static struct of_device_id rgmii_match[] =
303{ 303{
304 { 304 {
305 .type = "rgmii-interface",
306 .compatible = "ibm,rgmii", 305 .compatible = "ibm,rgmii",
307 }, 306 },
308 { 307 {
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
index 679dfdb6807f..79b317b88c86 100644
--- a/drivers/net/mlx4/mr.c
+++ b/drivers/net/mlx4/mr.c
@@ -578,13 +578,6 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
578 goto err_free; 578 goto err_free;
579 } 579 }
580 580
581 fmr->mpt = mlx4_table_find(&priv->mr_table.dmpt_table,
582 key_to_hw_index(fmr->mr.key), NULL);
583 if (!fmr->mpt) {
584 err = -ENOMEM;
585 goto err_free;
586 }
587
588 return 0; 581 return 0;
589 582
590err_free: 583err_free:
@@ -595,7 +588,19 @@ EXPORT_SYMBOL_GPL(mlx4_fmr_alloc);
595 588
596int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr) 589int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
597{ 590{
598 return mlx4_mr_enable(dev, &fmr->mr); 591 struct mlx4_priv *priv = mlx4_priv(dev);
592 int err;
593
594 err = mlx4_mr_enable(dev, &fmr->mr);
595 if (err)
596 return err;
597
598 fmr->mpt = mlx4_table_find(&priv->mr_table.dmpt_table,
599 key_to_hw_index(fmr->mr.key), NULL);
600 if (!fmr->mpt)
601 return -ENOMEM;
602
603 return 0;
599} 604}
600EXPORT_SYMBOL_GPL(mlx4_fmr_enable); 605EXPORT_SYMBOL_GPL(mlx4_fmr_enable);
601 606
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index 8134c7e198a5..b07ba2a14119 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -187,23 +187,22 @@ void sync_stop(void)
187 end_sync(); 187 end_sync();
188} 188}
189 189
190 190
191/* Optimisation. We can manage without taking the dcookie sem 191/* Optimisation. We can manage without taking the dcookie sem
192 * because we cannot reach this code without at least one 192 * because we cannot reach this code without at least one
193 * dcookie user still being registered (namely, the reader 193 * dcookie user still being registered (namely, the reader
194 * of the event buffer). */ 194 * of the event buffer). */
195static inline unsigned long fast_get_dcookie(struct dentry * dentry, 195static inline unsigned long fast_get_dcookie(struct path *path)
196 struct vfsmount * vfsmnt)
197{ 196{
198 unsigned long cookie; 197 unsigned long cookie;
199 198
200 if (dentry->d_cookie) 199 if (path->dentry->d_cookie)
201 return (unsigned long)dentry; 200 return (unsigned long)path->dentry;
202 get_dcookie(dentry, vfsmnt, &cookie); 201 get_dcookie(path, &cookie);
203 return cookie; 202 return cookie;
204} 203}
205 204
206 205
207/* Look up the dcookie for the task's first VM_EXECUTABLE mapping, 206/* Look up the dcookie for the task's first VM_EXECUTABLE mapping,
208 * which corresponds loosely to "application name". This is 207 * which corresponds loosely to "application name". This is
209 * not strictly necessary but allows oprofile to associate 208 * not strictly necessary but allows oprofile to associate
@@ -222,8 +221,7 @@ static unsigned long get_exec_dcookie(struct mm_struct * mm)
222 continue; 221 continue;
223 if (!(vma->vm_flags & VM_EXECUTABLE)) 222 if (!(vma->vm_flags & VM_EXECUTABLE))
224 continue; 223 continue;
225 cookie = fast_get_dcookie(vma->vm_file->f_path.dentry, 224 cookie = fast_get_dcookie(&vma->vm_file->f_path);
226 vma->vm_file->f_path.mnt);
227 break; 225 break;
228 } 226 }
229 227
@@ -248,8 +246,7 @@ static unsigned long lookup_dcookie(struct mm_struct * mm, unsigned long addr, o
248 continue; 246 continue;
249 247
250 if (vma->vm_file) { 248 if (vma->vm_file) {
251 cookie = fast_get_dcookie(vma->vm_file->f_path.dentry, 249 cookie = fast_get_dcookie(&vma->vm_file->f_path);
252 vma->vm_file->f_path.mnt);
253 *offset = (vma->vm_pgoff << PAGE_SHIFT) + addr - 250 *offset = (vma->vm_pgoff << PAGE_SHIFT) + addr -
254 vma->vm_start; 251 vma->vm_start;
255 } else { 252 } else {
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 238628d3a854..d76d37bcb9cc 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1768,7 +1768,7 @@ static int parport_PS2_supported(struct parport *pb)
1768} 1768}
1769 1769
1770#ifdef CONFIG_PARPORT_PC_FIFO 1770#ifdef CONFIG_PARPORT_PC_FIFO
1771static int __devinit parport_ECP_supported(struct parport *pb) 1771static int parport_ECP_supported(struct parport *pb)
1772{ 1772{
1773 int i; 1773 int i;
1774 int config, configb; 1774 int config, configb;
@@ -1992,7 +1992,7 @@ static int parport_ECPEPP_supported(struct parport *pb)
1992/* Don't bother probing for modes we know we won't use. */ 1992/* Don't bother probing for modes we know we won't use. */
1993static int __devinit parport_PS2_supported(struct parport *pb) { return 0; } 1993static int __devinit parport_PS2_supported(struct parport *pb) { return 0; }
1994#ifdef CONFIG_PARPORT_PC_FIFO 1994#ifdef CONFIG_PARPORT_PC_FIFO
1995static int __devinit parport_ECP_supported(struct parport *pb) { return 0; } 1995static int parport_ECP_supported(struct parport *pb) { return 0; }
1996#endif 1996#endif
1997static int __devinit parport_EPP_supported(struct parport *pb) { return 0; } 1997static int __devinit parport_EPP_supported(struct parport *pb) { return 0; }
1998static int __devinit parport_ECPEPP_supported(struct parport *pb){return 0;} 1998static int __devinit parport_ECPEPP_supported(struct parport *pb){return 0;}
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index 8ed26480371f..f941f609dbf3 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -14,11 +14,12 @@
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA. 15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 * 16 *
17 * Copyright (C) Ashok Raj <ashok.raj@intel.com> 17 * Copyright (C) 2006-2008 Intel Corporation
18 * Copyright (C) Shaohua Li <shaohua.li@intel.com> 18 * Author: Ashok Raj <ashok.raj@intel.com>
19 * Copyright (C) Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 19 * Author: Shaohua Li <shaohua.li@intel.com>
20 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
20 * 21 *
21 * This file implements early detection/parsing of DMA Remapping Devices 22 * This file implements early detection/parsing of DMA Remapping Devices
22 * reported to OS through BIOS via DMA remapping reporting (DMAR) ACPI 23 * reported to OS through BIOS via DMA remapping reporting (DMAR) ACPI
23 * tables. 24 * tables.
24 */ 25 */
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index c8c263875c21..9279d5ba62e6 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -392,6 +392,9 @@ static int __init acpiphp_init(void)
392{ 392{
393 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 393 info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
394 394
395 if (acpi_pci_disabled)
396 return 0;
397
395 acpiphp_debug = debug; 398 acpiphp_debug = debug;
396 399
397 /* read all the ACPI info from the system */ 400 /* read all the ACPI info from the system */
@@ -401,6 +404,9 @@ static int __init acpiphp_init(void)
401 404
402static void __exit acpiphp_exit(void) 405static void __exit acpiphp_exit(void)
403{ 406{
407 if (acpi_pci_disabled)
408 return;
409
404 /* deallocate internal data structures etc. */ 410 /* deallocate internal data structures etc. */
405 acpiphp_glue_exit(); 411 acpiphp_glue_exit();
406} 412}
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 750ebd7a4c10..b0a22b92717e 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -395,33 +395,34 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
395{ 395{
396 acpi_handle *phandle = (acpi_handle *)context; 396 acpi_handle *phandle = (acpi_handle *)context;
397 acpi_status status; 397 acpi_status status;
398 struct acpi_device_info info; 398 struct acpi_device_info *info;
399 struct acpi_buffer info_buffer = { 399 struct acpi_buffer info_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
400 .length = sizeof(struct acpi_device_info), 400 int retval = 0;
401 .pointer = &info,
402 };
403 401
404 status = acpi_get_object_info(handle, &info_buffer); 402 status = acpi_get_object_info(handle, &info_buffer);
405 if (ACPI_FAILURE(status)) { 403 if (ACPI_FAILURE(status)) {
406 err("%s: Failed to get device information\n", __FUNCTION__); 404 err("%s: Failed to get device information status=0x%x\n",
407 return 0; 405 __FUNCTION__, status);
406 return retval;
408 } 407 }
409 info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0'; 408 info = info_buffer.pointer;
410 409 info->hardware_id.value[sizeof(info->hardware_id.value) - 1] = '\0';
411 if (info.current_status && (info.valid & ACPI_VALID_HID) && 410
412 (!strcmp(info.hardware_id.value, IBM_HARDWARE_ID1) || 411 if (info->current_status && (info->valid & ACPI_VALID_HID) &&
413 !strcmp(info.hardware_id.value, IBM_HARDWARE_ID2))) { 412 (!strcmp(info->hardware_id.value, IBM_HARDWARE_ID1) ||
414 dbg("found hardware: %s, handle: %p\n", info.hardware_id.value, 413 !strcmp(info->hardware_id.value, IBM_HARDWARE_ID2))) {
415 handle); 414 dbg("found hardware: %s, handle: %p\n",
415 info->hardware_id.value, handle);
416 *phandle = handle; 416 *phandle = handle;
417 /* returning non-zero causes the search to stop 417 /* returning non-zero causes the search to stop
418 * and returns this value to the caller of 418 * and returns this value to the caller of
419 * acpi_walk_namespace, but it also causes some warnings 419 * acpi_walk_namespace, but it also causes some warnings
420 * in the acpi debug code to print... 420 * in the acpi debug code to print...
421 */ 421 */
422 return FOUND_APCI; 422 retval = FOUND_APCI;
423 } 423 }
424 return 0; 424 kfree(info);
425 return retval;
425} 426}
426 427
427static int __init ibm_acpiphp_init(void) 428static int __init ibm_acpiphp_init(void)
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index a4c3089f892a..977d29b32295 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -14,9 +14,10 @@
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA. 15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 * 16 *
17 * Copyright (C) Ashok Raj <ashok.raj@intel.com> 17 * Copyright (C) 2006-2008 Intel Corporation
18 * Copyright (C) Shaohua Li <shaohua.li@intel.com> 18 * Author: Ashok Raj <ashok.raj@intel.com>
19 * Copyright (C) Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 19 * Author: Shaohua Li <shaohua.li@intel.com>
20 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
20 */ 21 */
21 22
22#include <linux/init.h> 23#include <linux/init.h>
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h
index 07f5f6353bda..afc0ad96122e 100644
--- a/drivers/pci/intel-iommu.h
+++ b/drivers/pci/intel-iommu.h
@@ -14,8 +14,9 @@
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA. 15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 * 16 *
17 * Copyright (C) Ashok Raj <ashok.raj@intel.com> 17 * Copyright (C) 2006-2008 Intel Corporation
18 * Copyright (C) Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 18 * Author: Ashok Raj <ashok.raj@intel.com>
19 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
19 */ 20 */
20 21
21#ifndef _INTEL_IOMMU_H_ 22#ifndef _INTEL_IOMMU_H_
diff --git a/drivers/pci/iova.c b/drivers/pci/iova.c
index 8de7ab6c6d0c..dbcdd6bfa63a 100644
--- a/drivers/pci/iova.c
+++ b/drivers/pci/iova.c
@@ -3,7 +3,8 @@
3 * 3 *
4 * This file is released under the GPLv2. 4 * This file is released under the GPLv2.
5 * 5 *
6 * Copyright (C) 2006 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 6 * Copyright (C) 2006-2008 Intel Corporation
7 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
7 */ 8 */
8 9
9#include "iova.h" 10#include "iova.h"
diff --git a/drivers/pci/iova.h b/drivers/pci/iova.h
index d521b5b7319c..228f6c94b69c 100644
--- a/drivers/pci/iova.h
+++ b/drivers/pci/iova.h
@@ -3,7 +3,8 @@
3 * 3 *
4 * This file is released under the GPLv2. 4 * This file is released under the GPLv2.
5 * 5 *
6 * Copyright (C) 2006 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 6 * Copyright (C) 2006-2008 Intel Corporation
7 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
7 * 8 *
8 */ 9 */
9 10
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index e569645d59e2..4a23654184fc 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -158,6 +158,7 @@ run_osc_out:
158/** 158/**
159 * __pci_osc_support_set - register OS support to Firmware 159 * __pci_osc_support_set - register OS support to Firmware
160 * @flags: OS support bits 160 * @flags: OS support bits
161 * @hid: hardware ID
161 * 162 *
162 * Update OS support fields and doing a _OSC Query to obtain an update 163 * Update OS support fields and doing a _OSC Query to obtain an update
163 * from Firmware on supported control bits. 164 * from Firmware on supported control bits.
@@ -241,8 +242,6 @@ EXPORT_SYMBOL(pci_osc_control_set);
241 * choose from highest power _SxD to lowest power _SxW 242 * choose from highest power _SxD to lowest power _SxW
242 * else // no _PRW at S-state x 243 * else // no _PRW at S-state x
243 * choose highest power _SxD or any lower power 244 * choose highest power _SxD or any lower power
244 *
245 * currently we simply return _SxD, if present.
246 */ 245 */
247 246
248static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev, 247static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ae3df46eaabf..183fddaa38b7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -554,6 +554,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
554 case PM_EVENT_PRETHAW: 554 case PM_EVENT_PRETHAW:
555 /* REVISIT both freeze and pre-thaw "should" use D0 */ 555 /* REVISIT both freeze and pre-thaw "should" use D0 */
556 case PM_EVENT_SUSPEND: 556 case PM_EVENT_SUSPEND:
557 case PM_EVENT_HIBERNATE:
557 return PCI_D3hot; 558 return PCI_D3hot;
558 default: 559 default:
559 printk("Unrecognized suspend event %d\n", state.event); 560 printk("Unrecognized suspend event %d\n", state.event);
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 68aeeb7206de..ef18fcd641e2 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -422,7 +422,7 @@ int pci_proc_detach_device(struct pci_dev *dev)
422 struct proc_dir_entry *e; 422 struct proc_dir_entry *e;
423 423
424 if ((e = dev->procent)) { 424 if ((e = dev->procent)) {
425 if (atomic_read(&e->count)) 425 if (atomic_read(&e->count) > 1)
426 return -EBUSY; 426 return -EBUSY;
427 remove_proc_entry(e->name, dev->bus->procdir); 427 remove_proc_entry(e->name, dev->bus->procdir);
428 dev->procent = NULL; 428 dev->procent = NULL;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 0a953d43b9a2..bbad4a9f264f 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -867,13 +867,13 @@ static void quirk_disable_pxb(struct pci_dev *pdev)
867DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb); 867DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb);
868DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb); 868DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb);
869 869
870 870static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev)
871static void __devinit quirk_sb600_sata(struct pci_dev *pdev)
872{ 871{
873 /* set sb600 sata to ahci mode */ 872 /* set sb600/sb700/sb800 sata to ahci mode */
874 if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { 873 u8 tmp;
875 u8 tmp;
876 874
875 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp);
876 if (tmp == 0x01) {
877 pci_read_config_byte(pdev, 0x40, &tmp); 877 pci_read_config_byte(pdev, 0x40, &tmp);
878 pci_write_config_byte(pdev, 0x40, tmp|1); 878 pci_write_config_byte(pdev, 0x40, tmp|1);
879 pci_write_config_byte(pdev, 0x9, 1); 879 pci_write_config_byte(pdev, 0x9, 1);
@@ -881,10 +881,13 @@ static void __devinit quirk_sb600_sata(struct pci_dev *pdev)
881 pci_write_config_byte(pdev, 0x40, tmp); 881 pci_write_config_byte(pdev, 0x40, tmp);
882 882
883 pdev->class = PCI_CLASS_STORAGE_SATA_AHCI; 883 pdev->class = PCI_CLASS_STORAGE_SATA_AHCI;
884 dev_info(&pdev->dev, "set SATA to AHCI mode\n");
884 } 885 }
885} 886}
886DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_sb600_sata); 887DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode);
887DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_sb600_sata); 888DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode);
889DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
890DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
888 891
889/* 892/*
890 * Serverworks CSB5 IDE does not fully support native mode 893 * Serverworks CSB5 IDE does not fully support native mode
@@ -1775,6 +1778,68 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1775DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, 1778DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1776 quirk_nvidia_ck804_msi_ht_cap); 1779 quirk_nvidia_ck804_msi_ht_cap);
1777 1780
1781/*
1782 * Force enable MSI mapping capability on HT bridges */
1783static inline void ht_enable_msi_mapping(struct pci_dev *dev)
1784{
1785 int pos, ttl = 48;
1786
1787 pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
1788 while (pos && ttl--) {
1789 u8 flags;
1790
1791 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
1792 &flags) == 0) {
1793 dev_info(&dev->dev, "Enabling HT MSI Mapping\n");
1794
1795 pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
1796 flags | HT_MSI_FLAGS_ENABLE);
1797 }
1798 pos = pci_find_next_ht_capability(dev, pos,
1799 HT_CAPTYPE_MSI_MAPPING);
1800 }
1801}
1802
1803static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
1804{
1805 struct pci_dev *host_bridge;
1806 int pos, ttl = 48;
1807
1808 /*
1809 * HT MSI mapping should be disabled on devices that are below
1810 * a non-Hypertransport host bridge. Locate the host bridge...
1811 */
1812 host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
1813 if (host_bridge == NULL) {
1814 dev_warn(&dev->dev,
1815 "nv_msi_ht_cap_quirk didn't locate host bridge\n");
1816 return;
1817 }
1818
1819 pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
1820 if (pos != 0) {
1821 /* Host bridge is to HT */
1822 ht_enable_msi_mapping(dev);
1823 return;
1824 }
1825
1826 /* Host bridge is not to HT, disable HT MSI mapping on this device */
1827 pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
1828 while (pos && ttl--) {
1829 u8 flags;
1830
1831 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
1832 &flags) == 0) {
1833 dev_info(&dev->dev, "Quirk disabling HT MSI mapping");
1834 pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
1835 flags & ~HT_MSI_FLAGS_ENABLE);
1836 }
1837 pos = pci_find_next_ht_capability(dev, pos,
1838 HT_CAPTYPE_MSI_MAPPING);
1839 }
1840}
1841DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk);
1842
1778static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev) 1843static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
1779{ 1844{
1780 dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG; 1845 dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 262b0439abe9..125e7b7f34ff 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -206,10 +206,8 @@ pci_setup_bridge(struct pci_bus *bus)
206 if (bus->resource[2]->flags & IORESOURCE_PREFETCH) { 206 if (bus->resource[2]->flags & IORESOURCE_PREFETCH) {
207 l = (region.start >> 16) & 0xfff0; 207 l = (region.start >> 16) & 0xfff0;
208 l |= region.end & 0xfff00000; 208 l |= region.end & 0xfff00000;
209#ifdef CONFIG_RESOURCES_64BIT 209 bu = upper_32_bits(region.start);
210 bu = region.start >> 32; 210 lu = upper_32_bits(region.end);
211 lu = region.end >> 32;
212#endif
213 DBG(KERN_INFO " PREFETCH window: 0x%016llx-0x%016llx\n", 211 DBG(KERN_INFO " PREFETCH window: 0x%016llx-0x%016llx\n",
214 (unsigned long long)region.start, 212 (unsigned long long)region.start,
215 (unsigned long long)region.end); 213 (unsigned long long)region.end);
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index 749515534cc0..e54ecc580d9e 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -647,7 +647,12 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
647 if ( (mem->card_start > 0x3ffffff) || (region.start > region.end) || 647 if ( (mem->card_start > 0x3ffffff) || (region.start > region.end) ||
648 (mem->speed > 1000) ) { 648 (mem->speed > 1000) ) {
649 leave("i82092aa_set_mem_map: invalid address / speed"); 649 leave("i82092aa_set_mem_map: invalid address / speed");
650 printk("invalid mem map for socket %i : %lx to %lx with a start of %x \n",sock,region.start, region.end, mem->card_start); 650 printk("invalid mem map for socket %i: %llx to %llx with a "
651 "start of %x\n",
652 sock,
653 (unsigned long long)region.start,
654 (unsigned long long)region.end,
655 mem->card_start);
651 return -EINVAL; 656 return -EINVAL;
652 } 657 }
653 658
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 662b4c279cfc..c283a9a70d83 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -36,7 +36,7 @@ static int num = 0;
36 * have irqs (PIC, Timer) because we call acpi_register_gsi. 36 * have irqs (PIC, Timer) because we call acpi_register_gsi.
37 * Finally, only devices that have a CRS method need to be in this list. 37 * Finally, only devices that have a CRS method need to be in this list.
38 */ 38 */
39static struct __initdata acpi_device_id excluded_id_list[] = { 39static struct acpi_device_id excluded_id_list[] __initdata = {
40 {"PNP0C09", 0}, /* EC */ 40 {"PNP0C09", 0}, /* EC */
41 {"PNP0C0F", 0}, /* Link device */ 41 {"PNP0C0F", 0}, /* Link device */
42 {"PNP0000", 0}, /* PIC */ 42 {"PNP0000", 0}, /* PIC */
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index f7e67197a568..a8a51500e1e9 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -105,8 +105,6 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
105 char *argv[3], **envp, *buf, *scratch; 105 char *argv[3], **envp, *buf, *scratch;
106 int i = 0, value; 106 int i = 0, value;
107 107
108 if (!current->fs->root)
109 return -EAGAIN;
110 if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL))) 108 if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL)))
111 return -ENOMEM; 109 return -ENOMEM;
112 if (!(buf = kzalloc(256, GFP_KERNEL))) { 110 if (!(buf = kzalloc(256, GFP_KERNEL))) {
diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c
index 4c066545d176..6c9592ce4996 100644
--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -76,7 +76,6 @@
76 * 76 *
77 * @pm_control: Shadow of the processor's pm_control register. 77 * @pm_control: Shadow of the processor's pm_control register.
78 * @pm_start_stop: Shadow of the processor's pm_start_stop register. 78 * @pm_start_stop: Shadow of the processor's pm_start_stop register.
79 * @pm_interval: Shadow of the processor's pm_interval register.
80 * @group_control: Shadow of the processor's group_control register. 79 * @group_control: Shadow of the processor's group_control register.
81 * @debug_bus_control: Shadow of the processor's debug_bus_control register. 80 * @debug_bus_control: Shadow of the processor's debug_bus_control register.
82 * 81 *
@@ -91,7 +90,6 @@
91struct ps3_lpm_shadow_regs { 90struct ps3_lpm_shadow_regs {
92 u64 pm_control; 91 u64 pm_control;
93 u64 pm_start_stop; 92 u64 pm_start_stop;
94 u64 pm_interval;
95 u64 group_control; 93 u64 group_control;
96 u64 debug_bus_control; 94 u64 debug_bus_control;
97}; 95};
@@ -181,9 +179,9 @@ void ps3_set_bookmark(u64 bookmark)
181 * includes cycles before the call. 179 * includes cycles before the call.
182 */ 180 */
183 181
184 asm volatile("or 29, 29, 29;"); /* db10cyc */ 182 asm volatile("nop;nop;nop;nop;nop;nop;nop;nop;nop;");
185 mtspr(SPRN_BKMK, bookmark); 183 mtspr(SPRN_BKMK, bookmark);
186 asm volatile("or 29, 29, 29;"); /* db10cyc */ 184 asm volatile("nop;nop;nop;nop;nop;nop;nop;nop;nop;");
187} 185}
188EXPORT_SYMBOL_GPL(ps3_set_bookmark); 186EXPORT_SYMBOL_GPL(ps3_set_bookmark);
189 187
@@ -408,7 +406,14 @@ u32 ps3_read_pm(u32 cpu, enum pm_reg_name reg)
408 case pm_start_stop: 406 case pm_start_stop:
409 return lpm_priv->shadow.pm_start_stop; 407 return lpm_priv->shadow.pm_start_stop;
410 case pm_interval: 408 case pm_interval:
411 return lpm_priv->shadow.pm_interval; 409 result = lv1_set_lpm_interval(lpm_priv->lpm_id, 0, 0, &val);
410 if (result) {
411 val = 0;
412 dev_dbg(sbd_core(), "%s:%u: lv1 set_inteval failed: "
413 "reg %u, %s\n", __func__, __LINE__, reg,
414 ps3_result(result));
415 }
416 return (u32)val;
412 case group_control: 417 case group_control:
413 return lpm_priv->shadow.group_control; 418 return lpm_priv->shadow.group_control;
414 case debug_bus_control: 419 case debug_bus_control:
@@ -475,10 +480,8 @@ void ps3_write_pm(u32 cpu, enum pm_reg_name reg, u32 val)
475 lpm_priv->shadow.pm_control = val; 480 lpm_priv->shadow.pm_control = val;
476 break; 481 break;
477 case pm_interval: 482 case pm_interval:
478 if (val != lpm_priv->shadow.pm_interval) 483 result = lv1_set_lpm_interval(lpm_priv->lpm_id, val,
479 result = lv1_set_lpm_interval(lpm_priv->lpm_id, val, 484 PS3_WRITE_PM_MASK, &dummy);
480 PS3_WRITE_PM_MASK, &dummy);
481 lpm_priv->shadow.pm_interval = val;
482 break; 485 break;
483 case pm_start_stop: 486 case pm_start_stop:
484 if (val != lpm_priv->shadow.pm_start_stop) 487 if (val != lpm_priv->shadow.pm_start_stop)
@@ -1140,7 +1143,6 @@ int ps3_lpm_open(enum ps3_lpm_tb_type tb_type, void *tb_cache,
1140 1143
1141 lpm_priv->shadow.pm_control = PS3_LPM_SHADOW_REG_INIT; 1144 lpm_priv->shadow.pm_control = PS3_LPM_SHADOW_REG_INIT;
1142 lpm_priv->shadow.pm_start_stop = PS3_LPM_SHADOW_REG_INIT; 1145 lpm_priv->shadow.pm_start_stop = PS3_LPM_SHADOW_REG_INIT;
1143 lpm_priv->shadow.pm_interval = PS3_LPM_SHADOW_REG_INIT;
1144 lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT; 1146 lpm_priv->shadow.group_control = PS3_LPM_SHADOW_REG_INIT;
1145 lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT; 1147 lpm_priv->shadow.debug_bus_control = PS3_LPM_SHADOW_REG_INIT;
1146 1148
diff --git a/drivers/ps3/ps3-sys-manager.c b/drivers/ps3/ps3-sys-manager.c
index c3c3aba3ffce..d4f6f960dd18 100644
--- a/drivers/ps3/ps3-sys-manager.c
+++ b/drivers/ps3/ps3-sys-manager.c
@@ -28,10 +28,6 @@
28 28
29#include "vuart.h" 29#include "vuart.h"
30 30
31MODULE_AUTHOR("Sony Corporation");
32MODULE_LICENSE("GPL v2");
33MODULE_DESCRIPTION("PS3 System Manager");
34
35/** 31/**
36 * ps3_sys_manager - PS3 system manager driver. 32 * ps3_sys_manager - PS3 system manager driver.
37 * 33 *
@@ -142,9 +138,11 @@ enum ps3_sys_manager_attr {
142 138
143/** 139/**
144 * enum ps3_sys_manager_event - External event type, reported by system manager. 140 * enum ps3_sys_manager_event - External event type, reported by system manager.
145 * @PS3_SM_EVENT_POWER_PRESSED: payload.value not used. 141 * @PS3_SM_EVENT_POWER_PRESSED: payload.value =
142 * enum ps3_sys_manager_button_event.
146 * @PS3_SM_EVENT_POWER_RELEASED: payload.value = time pressed in millisec. 143 * @PS3_SM_EVENT_POWER_RELEASED: payload.value = time pressed in millisec.
147 * @PS3_SM_EVENT_RESET_PRESSED: payload.value not used. 144 * @PS3_SM_EVENT_RESET_PRESSED: payload.value =
145 * enum ps3_sys_manager_button_event.
148 * @PS3_SM_EVENT_RESET_RELEASED: payload.value = time pressed in millisec. 146 * @PS3_SM_EVENT_RESET_RELEASED: payload.value = time pressed in millisec.
149 * @PS3_SM_EVENT_THERMAL_ALERT: payload.value = thermal zone id. 147 * @PS3_SM_EVENT_THERMAL_ALERT: payload.value = thermal zone id.
150 * @PS3_SM_EVENT_THERMAL_CLEARED: payload.value = thermal zone id. 148 * @PS3_SM_EVENT_THERMAL_CLEARED: payload.value = thermal zone id.
@@ -162,6 +160,17 @@ enum ps3_sys_manager_event {
162}; 160};
163 161
164/** 162/**
163 * enum ps3_sys_manager_button_event - Button event payload values.
164 * @PS3_SM_BUTTON_EVENT_HARD: Hardware generated event.
165 * @PS3_SM_BUTTON_EVENT_SOFT: Software generated event.
166 */
167
168enum ps3_sys_manager_button_event {
169 PS3_SM_BUTTON_EVENT_HARD = 0,
170 PS3_SM_BUTTON_EVENT_SOFT = 1,
171};
172
173/**
165 * enum ps3_sys_manager_next_op - Operation to perform after lpar is destroyed. 174 * enum ps3_sys_manager_next_op - Operation to perform after lpar is destroyed.
166 */ 175 */
167 176
@@ -181,7 +190,9 @@ enum ps3_sys_manager_next_op {
181 * @PS3_SM_WAKE_P_O_R: Power on reset. 190 * @PS3_SM_WAKE_P_O_R: Power on reset.
182 * 191 *
183 * Additional wakeup sources when specifying PS3_SM_NEXT_OP_SYS_SHUTDOWN. 192 * Additional wakeup sources when specifying PS3_SM_NEXT_OP_SYS_SHUTDOWN.
184 * System will always wake from the PS3_SM_WAKE_DEFAULT sources. 193 * The system will always wake from the PS3_SM_WAKE_DEFAULT sources.
194 * Sources listed here are the only ones available to guests in the
195 * other-os lpar.
185 */ 196 */
186 197
187enum ps3_sys_manager_wake_source { 198enum ps3_sys_manager_wake_source {
@@ -189,7 +200,7 @@ enum ps3_sys_manager_wake_source {
189 PS3_SM_WAKE_DEFAULT = 0, 200 PS3_SM_WAKE_DEFAULT = 0,
190 PS3_SM_WAKE_RTC = 0x00000040, 201 PS3_SM_WAKE_RTC = 0x00000040,
191 PS3_SM_WAKE_RTC_ERROR = 0x00000080, 202 PS3_SM_WAKE_RTC_ERROR = 0x00000080,
192 PS3_SM_WAKE_P_O_R = 0x10000000, 203 PS3_SM_WAKE_P_O_R = 0x80000000,
193}; 204};
194 205
195/** 206/**
@@ -418,8 +429,10 @@ static int ps3_sys_manager_handle_event(struct ps3_system_bus_device *dev)
418 429
419 switch (event.type) { 430 switch (event.type) {
420 case PS3_SM_EVENT_POWER_PRESSED: 431 case PS3_SM_EVENT_POWER_PRESSED:
421 dev_dbg(&dev->core, "%s:%d: POWER_PRESSED\n", 432 dev_dbg(&dev->core, "%s:%d: POWER_PRESSED (%s)\n",
422 __func__, __LINE__); 433 __func__, __LINE__,
434 (event.value == PS3_SM_BUTTON_EVENT_SOFT ? "soft"
435 : "hard"));
423 ps3_sm_force_power_off = 1; 436 ps3_sm_force_power_off = 1;
424 /* 437 /*
425 * A memory barrier is use here to sync memory since 438 * A memory barrier is use here to sync memory since
@@ -434,8 +447,10 @@ static int ps3_sys_manager_handle_event(struct ps3_system_bus_device *dev)
434 __func__, __LINE__, event.value); 447 __func__, __LINE__, event.value);
435 break; 448 break;
436 case PS3_SM_EVENT_RESET_PRESSED: 449 case PS3_SM_EVENT_RESET_PRESSED:
437 dev_dbg(&dev->core, "%s:%d: RESET_PRESSED\n", 450 dev_dbg(&dev->core, "%s:%d: RESET_PRESSED (%s)\n",
438 __func__, __LINE__); 451 __func__, __LINE__,
452 (event.value == PS3_SM_BUTTON_EVENT_SOFT ? "soft"
453 : "hard"));
439 ps3_sm_force_power_off = 0; 454 ps3_sm_force_power_off = 0;
440 /* 455 /*
441 * A memory barrier is use here to sync memory since 456 * A memory barrier is use here to sync memory since
@@ -622,7 +637,7 @@ static void ps3_sys_manager_final_restart(struct ps3_system_bus_device *dev)
622 ps3_vuart_cancel_async(dev); 637 ps3_vuart_cancel_async(dev);
623 638
624 ps3_sys_manager_send_attr(dev, 0); 639 ps3_sys_manager_send_attr(dev, 0);
625 ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_LPAR_REBOOT, 640 ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_REBOOT,
626 PS3_SM_WAKE_DEFAULT); 641 PS3_SM_WAKE_DEFAULT);
627 ps3_sys_manager_send_request_shutdown(dev); 642 ps3_sys_manager_send_request_shutdown(dev);
628 643
@@ -699,4 +714,7 @@ static int __init ps3_sys_manager_init(void)
699module_init(ps3_sys_manager_init); 714module_init(ps3_sys_manager_init);
700/* Module remove not supported. */ 715/* Module remove not supported. */
701 716
717MODULE_AUTHOR("Sony Corporation");
718MODULE_LICENSE("GPL v2");
719MODULE_DESCRIPTION("PS3 System Manager");
702MODULE_ALIAS(PS3_MODULE_ALIAS_SYSTEM_MANAGER); 720MODULE_ALIAS(PS3_MODULE_ALIAS_SYSTEM_MANAGER);
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index e059f94c79eb..f3ee2ad566b4 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -388,6 +388,7 @@ static int cmos_procfs(struct device *dev, struct seq_file *seq)
388 return seq_printf(seq, 388 return seq_printf(seq,
389 "periodic_IRQ\t: %s\n" 389 "periodic_IRQ\t: %s\n"
390 "update_IRQ\t: %s\n" 390 "update_IRQ\t: %s\n"
391 "HPET_emulated\t: %s\n"
391 // "square_wave\t: %s\n" 392 // "square_wave\t: %s\n"
392 // "BCD\t\t: %s\n" 393 // "BCD\t\t: %s\n"
393 "DST_enable\t: %s\n" 394 "DST_enable\t: %s\n"
@@ -395,6 +396,7 @@ static int cmos_procfs(struct device *dev, struct seq_file *seq)
395 "batt_status\t: %s\n", 396 "batt_status\t: %s\n",
396 (rtc_control & RTC_PIE) ? "yes" : "no", 397 (rtc_control & RTC_PIE) ? "yes" : "no",
397 (rtc_control & RTC_UIE) ? "yes" : "no", 398 (rtc_control & RTC_UIE) ? "yes" : "no",
399 is_hpet_enabled() ? "yes" : "no",
398 // (rtc_control & RTC_SQWE) ? "yes" : "no", 400 // (rtc_control & RTC_SQWE) ? "yes" : "no",
399 // (rtc_control & RTC_DM_BINARY) ? "no" : "yes", 401 // (rtc_control & RTC_DM_BINARY) ? "no" : "yes",
400 (rtc_control & RTC_DST_EN) ? "yes" : "no", 402 (rtc_control & RTC_DST_EN) ? "yes" : "no",
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index d984e0fae630..ccf46c96adb4 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1149,12 +1149,14 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
1149{ 1149{
1150 struct list_head *l, *n; 1150 struct list_head *l, *n;
1151 struct dasd_ccw_req *cqr; 1151 struct dasd_ccw_req *cqr;
1152 struct dasd_block *block;
1152 1153
1153 list_for_each_safe(l, n, final_queue) { 1154 list_for_each_safe(l, n, final_queue) {
1154 cqr = list_entry(l, struct dasd_ccw_req, devlist); 1155 cqr = list_entry(l, struct dasd_ccw_req, devlist);
1155 list_del_init(&cqr->devlist); 1156 list_del_init(&cqr->devlist);
1156 if (cqr->block) 1157 block = cqr->block;
1157 spin_lock_bh(&cqr->block->queue_lock); 1158 if (block)
1159 spin_lock_bh(&block->queue_lock);
1158 switch (cqr->status) { 1160 switch (cqr->status) {
1159 case DASD_CQR_SUCCESS: 1161 case DASD_CQR_SUCCESS:
1160 cqr->status = DASD_CQR_DONE; 1162 cqr->status = DASD_CQR_DONE;
@@ -1172,15 +1174,13 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
1172 cqr, cqr->status); 1174 cqr, cqr->status);
1173 BUG(); 1175 BUG();
1174 } 1176 }
1175 if (cqr->block)
1176 spin_unlock_bh(&cqr->block->queue_lock);
1177 if (cqr->callback != NULL) 1177 if (cqr->callback != NULL)
1178 (cqr->callback)(cqr, cqr->callback_data); 1178 (cqr->callback)(cqr, cqr->callback_data);
1179 if (block)
1180 spin_unlock_bh(&block->queue_lock);
1179 } 1181 }
1180} 1182}
1181 1183
1182
1183
1184/* 1184/*
1185 * Take a look at the first request on the ccw queue and check 1185 * Take a look at the first request on the ccw queue and check
1186 * if it reached its expire time. If so, terminate the IO. 1186 * if it reached its expire time. If so, terminate the IO.
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 3faf0538b328..e6c94dbfdeaa 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -666,7 +666,7 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio)
666 page_addr = (unsigned long) 666 page_addr = (unsigned long)
667 page_address(bvec->bv_page) + bvec->bv_offset; 667 page_address(bvec->bv_page) + bvec->bv_offset;
668 source_addr = dev_info->start + (index<<12) + bytes_done; 668 source_addr = dev_info->start + (index<<12) + bytes_done;
669 if (unlikely(page_addr & 4095) != 0 || (bvec->bv_len & 4095) != 0) 669 if (unlikely((page_addr & 4095) != 0) || (bvec->bv_len & 4095) != 0)
670 // More paranoia. 670 // More paranoia.
671 goto fail; 671 goto fail;
672 if (bio_data_dir(bio) == READ) { 672 if (bio_data_dir(bio) == READ) {
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index 25629b92dec3..2c7a1ee6b041 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -29,10 +29,10 @@ static ext_int_info_t ext_int_info_hwc;
29/* Lock to protect internal data consistency. */ 29/* Lock to protect internal data consistency. */
30static DEFINE_SPINLOCK(sclp_lock); 30static DEFINE_SPINLOCK(sclp_lock);
31 31
32/* Mask of events that we can receive from the sclp interface. */ 32/* Mask of events that we can send to the sclp interface. */
33static sccb_mask_t sclp_receive_mask; 33static sccb_mask_t sclp_receive_mask;
34 34
35/* Mask of events that we can send to the sclp interface. */ 35/* Mask of events that we can receive from the sclp interface. */
36static sccb_mask_t sclp_send_mask; 36static sccb_mask_t sclp_send_mask;
37 37
38/* List of registered event listeners and senders. */ 38/* List of registered event listeners and senders. */
@@ -380,7 +380,7 @@ sclp_interrupt_handler(__u16 code)
380 } 380 }
381 sclp_running_state = sclp_running_state_idle; 381 sclp_running_state = sclp_running_state_idle;
382 } 382 }
383 if (evbuf_pending && sclp_receive_mask != 0 && 383 if (evbuf_pending &&
384 sclp_activation_state == sclp_activation_state_active) 384 sclp_activation_state == sclp_activation_state_active)
385 __sclp_queue_read_req(); 385 __sclp_queue_read_req();
386 spin_unlock(&sclp_lock); 386 spin_unlock(&sclp_lock);
@@ -459,8 +459,8 @@ sclp_dispatch_state_change(void)
459 reg = NULL; 459 reg = NULL;
460 list_for_each(l, &sclp_reg_list) { 460 list_for_each(l, &sclp_reg_list) {
461 reg = list_entry(l, struct sclp_register, list); 461 reg = list_entry(l, struct sclp_register, list);
462 receive_mask = reg->receive_mask & sclp_receive_mask; 462 receive_mask = reg->send_mask & sclp_receive_mask;
463 send_mask = reg->send_mask & sclp_send_mask; 463 send_mask = reg->receive_mask & sclp_send_mask;
464 if (reg->sclp_receive_mask != receive_mask || 464 if (reg->sclp_receive_mask != receive_mask ||
465 reg->sclp_send_mask != send_mask) { 465 reg->sclp_send_mask != send_mask) {
466 reg->sclp_receive_mask = receive_mask; 466 reg->sclp_receive_mask = receive_mask;
@@ -615,8 +615,8 @@ struct init_sccb {
615 u16 mask_length; 615 u16 mask_length;
616 sccb_mask_t receive_mask; 616 sccb_mask_t receive_mask;
617 sccb_mask_t send_mask; 617 sccb_mask_t send_mask;
618 sccb_mask_t sclp_send_mask;
619 sccb_mask_t sclp_receive_mask; 618 sccb_mask_t sclp_receive_mask;
619 sccb_mask_t sclp_send_mask;
620} __attribute__((packed)); 620} __attribute__((packed));
621 621
622/* Prepare init mask request. Called while sclp_lock is locked. */ 622/* Prepare init mask request. Called while sclp_lock is locked. */
diff --git a/drivers/s390/char/sclp.h b/drivers/s390/char/sclp.h
index aa8186d18aee..bac80e856f97 100644
--- a/drivers/s390/char/sclp.h
+++ b/drivers/s390/char/sclp.h
@@ -122,11 +122,13 @@ struct sclp_req {
122/* of some routines it wants to be called from the low level driver */ 122/* of some routines it wants to be called from the low level driver */
123struct sclp_register { 123struct sclp_register {
124 struct list_head list; 124 struct list_head list;
125 /* event masks this user is registered for */ 125 /* User wants to receive: */
126 sccb_mask_t receive_mask; 126 sccb_mask_t receive_mask;
127 /* User wants to send: */
127 sccb_mask_t send_mask; 128 sccb_mask_t send_mask;
128 /* actually present events */ 129 /* H/W can receive: */
129 sccb_mask_t sclp_receive_mask; 130 sccb_mask_t sclp_receive_mask;
131 /* H/W can send: */
130 sccb_mask_t sclp_send_mask; 132 sccb_mask_t sclp_send_mask;
131 /* called if event type availability changes */ 133 /* called if event type availability changes */
132 void (*state_change_fn)(struct sclp_register *); 134 void (*state_change_fn)(struct sclp_register *);
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c
index 9dc77f14fa52..b8f35bc52b7b 100644
--- a/drivers/s390/char/sclp_config.c
+++ b/drivers/s390/char/sclp_config.c
@@ -64,7 +64,7 @@ static int __init sclp_conf_init(void)
64 return rc; 64 return rc;
65 } 65 }
66 66
67 if (!(sclp_conf_register.sclp_receive_mask & EVTYP_CONFMGMDATA_MASK)) { 67 if (!(sclp_conf_register.sclp_send_mask & EVTYP_CONFMGMDATA_MASK)) {
68 printk(KERN_WARNING TAG "no configuration management.\n"); 68 printk(KERN_WARNING TAG "no configuration management.\n");
69 sclp_unregister(&sclp_conf_register); 69 sclp_unregister(&sclp_conf_register);
70 rc = -ENOSYS; 70 rc = -ENOSYS;
diff --git a/drivers/s390/char/sclp_cpi_sys.c b/drivers/s390/char/sclp_cpi_sys.c
index 41617032afdc..9f37456222e9 100644
--- a/drivers/s390/char/sclp_cpi_sys.c
+++ b/drivers/s390/char/sclp_cpi_sys.c
@@ -129,7 +129,7 @@ static int cpi_req(void)
129 "to hardware console.\n"); 129 "to hardware console.\n");
130 goto out; 130 goto out;
131 } 131 }
132 if (!(sclp_cpi_event.sclp_send_mask & EVTYP_CTLPROGIDENT_MASK)) { 132 if (!(sclp_cpi_event.sclp_receive_mask & EVTYP_CTLPROGIDENT_MASK)) {
133 printk(KERN_WARNING "cpi: no control program " 133 printk(KERN_WARNING "cpi: no control program "
134 "identification support\n"); 134 "identification support\n");
135 rc = -EOPNOTSUPP; 135 rc = -EOPNOTSUPP;
diff --git a/drivers/s390/char/sclp_rw.c b/drivers/s390/char/sclp_rw.c
index ad7195d3de0c..da09781b32f7 100644
--- a/drivers/s390/char/sclp_rw.c
+++ b/drivers/s390/char/sclp_rw.c
@@ -452,10 +452,10 @@ sclp_emit_buffer(struct sclp_buffer *buffer,
452 return -EIO; 452 return -EIO;
453 453
454 sccb = buffer->sccb; 454 sccb = buffer->sccb;
455 if (sclp_rw_event.sclp_send_mask & EVTYP_MSG_MASK) 455 if (sclp_rw_event.sclp_receive_mask & EVTYP_MSG_MASK)
456 /* Use normal write message */ 456 /* Use normal write message */
457 sccb->msg_buf.header.type = EVTYP_MSG; 457 sccb->msg_buf.header.type = EVTYP_MSG;
458 else if (sclp_rw_event.sclp_send_mask & EVTYP_PMSGCMD_MASK) 458 else if (sclp_rw_event.sclp_receive_mask & EVTYP_PMSGCMD_MASK)
459 /* Use write priority message */ 459 /* Use write priority message */
460 sccb->msg_buf.header.type = EVTYP_PMSGCMD; 460 sccb->msg_buf.header.type = EVTYP_PMSGCMD;
461 else 461 else
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index f47f4a768be5..92f527201792 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -202,7 +202,7 @@ sclp_vt220_callback(struct sclp_req *request, void *data)
202static int 202static int
203__sclp_vt220_emit(struct sclp_vt220_request *request) 203__sclp_vt220_emit(struct sclp_vt220_request *request)
204{ 204{
205 if (!(sclp_vt220_register.sclp_send_mask & EVTYP_VT220MSG_MASK)) { 205 if (!(sclp_vt220_register.sclp_receive_mask & EVTYP_VT220MSG_MASK)) {
206 request->sclp_req.status = SCLP_REQ_FAILED; 206 request->sclp_req.status = SCLP_REQ_FAILED;
207 return -EIO; 207 return -EIO;
208 } 208 }
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index d35dc3f25d06..fec004f62bcf 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -32,7 +32,7 @@
32#include "io_sch.h" 32#include "io_sch.h"
33 33
34static struct timer_list recovery_timer; 34static struct timer_list recovery_timer;
35static spinlock_t recovery_lock; 35static DEFINE_SPINLOCK(recovery_lock);
36static int recovery_phase; 36static int recovery_phase;
37static const unsigned long recovery_delay[] = { 3, 30, 300 }; 37static const unsigned long recovery_delay[] = { 3, 30, 300 };
38 38
@@ -1535,7 +1535,7 @@ static int recovery_check(struct device *dev, void *data)
1535 return 0; 1535 return 0;
1536} 1536}
1537 1537
1538static void recovery_func(unsigned long data) 1538static void recovery_work_func(struct work_struct *unused)
1539{ 1539{
1540 int redo = 0; 1540 int redo = 0;
1541 1541
@@ -1553,6 +1553,17 @@ static void recovery_func(unsigned long data)
1553 CIO_MSG_EVENT(2, "recovery: end\n"); 1553 CIO_MSG_EVENT(2, "recovery: end\n");
1554} 1554}
1555 1555
1556static DECLARE_WORK(recovery_work, recovery_work_func);
1557
1558static void recovery_func(unsigned long data)
1559{
1560 /*
1561 * We can't do our recovery in softirq context and it's not
1562 * performance critical, so we schedule it.
1563 */
1564 schedule_work(&recovery_work);
1565}
1566
1556void ccw_device_schedule_recovery(void) 1567void ccw_device_schedule_recovery(void)
1557{ 1568{
1558 unsigned long flags; 1569 unsigned long flags;
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 097fc0967e9d..2b5bfb7c69e5 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -32,7 +32,7 @@
32 32
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/init.h> 34#include <linux/init.h>
35 35#include <linux/delay.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
@@ -1215,9 +1215,6 @@ tiqdio_is_inbound_q_done(struct qdio_q *q)
1215 1215
1216 if (!no_used) 1216 if (!no_used)
1217 return 1; 1217 return 1;
1218 if (!q->siga_sync && !irq->is_qebsm)
1219 /* we'll check for more primed buffers in qeth_stop_polling */
1220 return 0;
1221 if (irq->is_qebsm) { 1218 if (irq->is_qebsm) {
1222 count = 1; 1219 count = 1;
1223 start_buf = q->first_to_check; 1220 start_buf = q->first_to_check;
@@ -3332,13 +3329,7 @@ qdio_activate(struct ccw_device *cdev, int flags)
3332 } 3329 }
3333 } 3330 }
3334 3331
3335 wait_event_interruptible_timeout(cdev->private->wait_q, 3332 msleep(QDIO_ACTIVATE_TIMEOUT);
3336 ((irq_ptr->state ==
3337 QDIO_IRQ_STATE_STOPPED) ||
3338 (irq_ptr->state ==
3339 QDIO_IRQ_STATE_ERR)),
3340 QDIO_ACTIVATE_TIMEOUT);
3341
3342 switch (irq_ptr->state) { 3333 switch (irq_ptr->state) {
3343 case QDIO_IRQ_STATE_STOPPED: 3334 case QDIO_IRQ_STATE_STOPPED:
3344 case QDIO_IRQ_STATE_ERR: 3335 case QDIO_IRQ_STATE_ERR:
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index 37870e4e938e..da8a272fd75b 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -57,10 +57,10 @@
57 of the queue to 0 */ 57 of the queue to 0 */
58 58
59#define QDIO_ESTABLISH_TIMEOUT (1*HZ) 59#define QDIO_ESTABLISH_TIMEOUT (1*HZ)
60#define QDIO_ACTIVATE_TIMEOUT (5*HZ)
61#define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ) 60#define QDIO_CLEANUP_CLEAR_TIMEOUT (20*HZ)
62#define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ) 61#define QDIO_CLEANUP_HALT_TIMEOUT (10*HZ)
63#define QDIO_FORCE_CHECK_TIMEOUT (10*HZ) 62#define QDIO_FORCE_CHECK_TIMEOUT (10*HZ)
63#define QDIO_ACTIVATE_TIMEOUT (5) /* 5 ms */
64 64
65enum qdio_irq_states { 65enum qdio_irq_states {
66 QDIO_IRQ_STATE_INACTIVE, 66 QDIO_IRQ_STATE_INACTIVE,
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a5f0aaaf0dd4..c46666a24809 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -722,7 +722,7 @@ config SCSI_FD_MCS
722 722
723config SCSI_GDTH 723config SCSI_GDTH
724 tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" 724 tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support"
725 depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API && PCI_LEGACY 725 depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API
726 ---help--- 726 ---help---
727 Formerly called GDT SCSI Disk Array Controller Support. 727 Formerly called GDT SCSI Disk Array Controller Support.
728 728
@@ -992,6 +992,16 @@ config SCSI_IZIP_SLOW_CTR
992 992
993 Generally, saying N is fine. 993 Generally, saying N is fine.
994 994
995config SCSI_MVSAS
996 tristate "Marvell 88SE6440 SAS/SATA support"
997 depends on PCI && SCSI
998 select SCSI_SAS_LIBSAS
999 help
1000 This driver supports Marvell SAS/SATA PCI devices.
1001
1002 To compiler this driver as a module, choose M here: the module
1003 will be called mvsas.
1004
995config SCSI_NCR53C406A 1005config SCSI_NCR53C406A
996 tristate "NCR53c406a SCSI support" 1006 tristate "NCR53c406a SCSI support"
997 depends on ISA && SCSI 1007 depends on ISA && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 925c26b4fff9..23e6ecbd4778 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -119,6 +119,7 @@ obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsi/
119obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvscsi/ 119obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvscsi/
120obj-$(CONFIG_SCSI_HPTIOP) += hptiop.o 120obj-$(CONFIG_SCSI_HPTIOP) += hptiop.o
121obj-$(CONFIG_SCSI_STEX) += stex.o 121obj-$(CONFIG_SCSI_STEX) += stex.o
122obj-$(CONFIG_SCSI_MVSAS) += mvsas.o
122obj-$(CONFIG_PS3_ROM) += ps3rom.o 123obj-$(CONFIG_PS3_ROM) += ps3rom.o
123 124
124obj-$(CONFIG_ARM) += arm/ 125obj-$(CONFIG_ARM) += arm/
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index bfd0e64964ac..c05092fd3a9d 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -144,51 +144,77 @@ static char *aac_get_status_string(u32 status);
144 */ 144 */
145 145
146static int nondasd = -1; 146static int nondasd = -1;
147static int aac_cache = 0; 147static int aac_cache;
148static int dacmode = -1; 148static int dacmode = -1;
149 149int aac_msi;
150int aac_commit = -1; 150int aac_commit = -1;
151int startup_timeout = 180; 151int startup_timeout = 180;
152int aif_timeout = 120; 152int aif_timeout = 120;
153 153
154module_param(nondasd, int, S_IRUGO|S_IWUSR); 154module_param(nondasd, int, S_IRUGO|S_IWUSR);
155MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); 155MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices."
156 " 0=off, 1=on");
156module_param_named(cache, aac_cache, int, S_IRUGO|S_IWUSR); 157module_param_named(cache, aac_cache, int, S_IRUGO|S_IWUSR);
157MODULE_PARM_DESC(cache, "Disable Queue Flush commands:\n\tbit 0 - Disable FUA in WRITE SCSI commands\n\tbit 1 - Disable SYNCHRONIZE_CACHE SCSI command\n\tbit 2 - Disable only if Battery not protecting Cache"); 158MODULE_PARM_DESC(cache, "Disable Queue Flush commands:\n"
159 "\tbit 0 - Disable FUA in WRITE SCSI commands\n"
160 "\tbit 1 - Disable SYNCHRONIZE_CACHE SCSI command\n"
161 "\tbit 2 - Disable only if Battery not protecting Cache");
158module_param(dacmode, int, S_IRUGO|S_IWUSR); 162module_param(dacmode, int, S_IRUGO|S_IWUSR);
159MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); 163MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC."
164 " 0=off, 1=on");
160module_param_named(commit, aac_commit, int, S_IRUGO|S_IWUSR); 165module_param_named(commit, aac_commit, int, S_IRUGO|S_IWUSR);
161MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); 166MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the"
167 " adapter for foreign arrays.\n"
168 "This is typically needed in systems that do not have a BIOS."
169 " 0=off, 1=on");
170module_param_named(msi, aac_msi, int, S_IRUGO|S_IWUSR);
171MODULE_PARM_DESC(msi, "IRQ handling."
172 " 0=PIC(default), 1=MSI, 2=MSI-X(unsupported, uses MSI)");
162module_param(startup_timeout, int, S_IRUGO|S_IWUSR); 173module_param(startup_timeout, int, S_IRUGO|S_IWUSR);
163MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS."); 174MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for"
175 " adapter to have it's kernel up and\n"
176 "running. This is typically adjusted for large systems that do not"
177 " have a BIOS.");
164module_param(aif_timeout, int, S_IRUGO|S_IWUSR); 178module_param(aif_timeout, int, S_IRUGO|S_IWUSR);
165MODULE_PARM_DESC(aif_timeout, "The duration of time in seconds to wait for applications to pick up AIFs before\nderegistering them. This is typically adjusted for heavily burdened systems."); 179MODULE_PARM_DESC(aif_timeout, "The duration of time in seconds to wait for"
180 " applications to pick up AIFs before\n"
181 "deregistering them. This is typically adjusted for heavily burdened"
182 " systems.");
166 183
167int numacb = -1; 184int numacb = -1;
168module_param(numacb, int, S_IRUGO|S_IWUSR); 185module_param(numacb, int, S_IRUGO|S_IWUSR);
169MODULE_PARM_DESC(numacb, "Request a limit to the number of adapter control blocks (FIB) allocated. Valid values are 512 and down. Default is to use suggestion from Firmware."); 186MODULE_PARM_DESC(numacb, "Request a limit to the number of adapter control"
187 " blocks (FIB) allocated. Valid values are 512 and down. Default is"
188 " to use suggestion from Firmware.");
170 189
171int acbsize = -1; 190int acbsize = -1;
172module_param(acbsize, int, S_IRUGO|S_IWUSR); 191module_param(acbsize, int, S_IRUGO|S_IWUSR);
173MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size. Valid values are 512, 2048, 4096 and 8192. Default is to use suggestion from Firmware."); 192MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB)"
193 " size. Valid values are 512, 2048, 4096 and 8192. Default is to use"
194 " suggestion from Firmware.");
174 195
175int update_interval = 30 * 60; 196int update_interval = 30 * 60;
176module_param(update_interval, int, S_IRUGO|S_IWUSR); 197module_param(update_interval, int, S_IRUGO|S_IWUSR);
177MODULE_PARM_DESC(update_interval, "Interval in seconds between time sync updates issued to adapter."); 198MODULE_PARM_DESC(update_interval, "Interval in seconds between time sync"
199 " updates issued to adapter.");
178 200
179int check_interval = 24 * 60 * 60; 201int check_interval = 24 * 60 * 60;
180module_param(check_interval, int, S_IRUGO|S_IWUSR); 202module_param(check_interval, int, S_IRUGO|S_IWUSR);
181MODULE_PARM_DESC(check_interval, "Interval in seconds between adapter health checks."); 203MODULE_PARM_DESC(check_interval, "Interval in seconds between adapter health"
204 " checks.");
182 205
183int aac_check_reset = 1; 206int aac_check_reset = 1;
184module_param_named(check_reset, aac_check_reset, int, S_IRUGO|S_IWUSR); 207module_param_named(check_reset, aac_check_reset, int, S_IRUGO|S_IWUSR);
185MODULE_PARM_DESC(aac_check_reset, "If adapter fails health check, reset the adapter. a value of -1 forces the reset to adapters programmed to ignore it."); 208MODULE_PARM_DESC(aac_check_reset, "If adapter fails health check, reset the"
209 " adapter. a value of -1 forces the reset to adapters programmed to"
210 " ignore it.");
186 211
187int expose_physicals = -1; 212int expose_physicals = -1;
188module_param(expose_physicals, int, S_IRUGO|S_IWUSR); 213module_param(expose_physicals, int, S_IRUGO|S_IWUSR);
189MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); 214MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays."
215 " -1=protect 0=off, 1=on");
190 216
191int aac_reset_devices = 0; 217int aac_reset_devices;
192module_param_named(reset_devices, aac_reset_devices, int, S_IRUGO|S_IWUSR); 218module_param_named(reset_devices, aac_reset_devices, int, S_IRUGO|S_IWUSR);
193MODULE_PARM_DESC(reset_devices, "Force an adapter reset at initialization."); 219MODULE_PARM_DESC(reset_devices, "Force an adapter reset at initialization.");
194 220
@@ -1315,7 +1341,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
1315 (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid), 1341 (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid),
1316 dev->supplement_adapter_info.VpdInfo.Tsid); 1342 dev->supplement_adapter_info.VpdInfo.Tsid);
1317 } 1343 }
1318 if (!aac_check_reset || ((aac_check_reset != 1) && 1344 if (!aac_check_reset || ((aac_check_reset == 1) &&
1319 (dev->supplement_adapter_info.SupportedOptions2 & 1345 (dev->supplement_adapter_info.SupportedOptions2 &
1320 AAC_OPTION_IGNORE_RESET))) { 1346 AAC_OPTION_IGNORE_RESET))) {
1321 printk(KERN_INFO "%s%d: Reset Adapter Ignored\n", 1347 printk(KERN_INFO "%s%d: Reset Adapter Ignored\n",
@@ -1353,13 +1379,14 @@ int aac_get_adapter_info(struct aac_dev* dev)
1353 1379
1354 if (nondasd != -1) 1380 if (nondasd != -1)
1355 dev->nondasd_support = (nondasd!=0); 1381 dev->nondasd_support = (nondasd!=0);
1356 if(dev->nondasd_support != 0) { 1382 if (dev->nondasd_support && !dev->in_reset)
1357 printk(KERN_INFO "%s%d: Non-DASD support enabled.\n",dev->name, dev->id); 1383 printk(KERN_INFO "%s%d: Non-DASD support enabled.\n",dev->name, dev->id);
1358 }
1359 1384
1360 dev->dac_support = 0; 1385 dev->dac_support = 0;
1361 if( (sizeof(dma_addr_t) > 4) && (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64)){ 1386 if( (sizeof(dma_addr_t) > 4) && (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64)){
1362 printk(KERN_INFO "%s%d: 64bit support enabled.\n", dev->name, dev->id); 1387 if (!dev->in_reset)
1388 printk(KERN_INFO "%s%d: 64bit support enabled.\n",
1389 dev->name, dev->id);
1363 dev->dac_support = 1; 1390 dev->dac_support = 1;
1364 } 1391 }
1365 1392
@@ -1369,8 +1396,9 @@ int aac_get_adapter_info(struct aac_dev* dev)
1369 if(dev->dac_support != 0) { 1396 if(dev->dac_support != 0) {
1370 if (!pci_set_dma_mask(dev->pdev, DMA_64BIT_MASK) && 1397 if (!pci_set_dma_mask(dev->pdev, DMA_64BIT_MASK) &&
1371 !pci_set_consistent_dma_mask(dev->pdev, DMA_64BIT_MASK)) { 1398 !pci_set_consistent_dma_mask(dev->pdev, DMA_64BIT_MASK)) {
1372 printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n", 1399 if (!dev->in_reset)
1373 dev->name, dev->id); 1400 printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n",
1401 dev->name, dev->id);
1374 } else if (!pci_set_dma_mask(dev->pdev, DMA_32BIT_MASK) && 1402 } else if (!pci_set_dma_mask(dev->pdev, DMA_32BIT_MASK) &&
1375 !pci_set_consistent_dma_mask(dev->pdev, DMA_32BIT_MASK)) { 1403 !pci_set_consistent_dma_mask(dev->pdev, DMA_32BIT_MASK)) {
1376 printk(KERN_INFO"%s%d: DMA mask set failed, 64 Bit DAC disabled\n", 1404 printk(KERN_INFO"%s%d: DMA mask set failed, 64 Bit DAC disabled\n",
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 3195d29f2177..ace0b751c131 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1026,6 +1026,7 @@ struct aac_dev
1026 u8 raw_io_64; 1026 u8 raw_io_64;
1027 u8 printf_enabled; 1027 u8 printf_enabled;
1028 u8 in_reset; 1028 u8 in_reset;
1029 u8 msi;
1029}; 1030};
1030 1031
1031#define aac_adapter_interrupt(dev) \ 1032#define aac_adapter_interrupt(dev) \
@@ -1881,6 +1882,7 @@ extern int startup_timeout;
1881extern int aif_timeout; 1882extern int aif_timeout;
1882extern int expose_physicals; 1883extern int expose_physicals;
1883extern int aac_reset_devices; 1884extern int aac_reset_devices;
1885extern int aac_msi;
1884extern int aac_commit; 1886extern int aac_commit;
1885extern int update_interval; 1887extern int update_interval;
1886extern int check_interval; 1888extern int check_interval;
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 81b36923e0ef..47434499e82b 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1458,7 +1458,7 @@ int aac_check_health(struct aac_dev * aac)
1458 1458
1459 printk(KERN_ERR "%s: Host adapter BLINK LED 0x%x\n", aac->name, BlinkLED); 1459 printk(KERN_ERR "%s: Host adapter BLINK LED 0x%x\n", aac->name, BlinkLED);
1460 1460
1461 if (!aac_check_reset || ((aac_check_reset != 1) && 1461 if (!aac_check_reset || ((aac_check_reset == 1) &&
1462 (aac->supplement_adapter_info.SupportedOptions2 & 1462 (aac->supplement_adapter_info.SupportedOptions2 &
1463 AAC_OPTION_IGNORE_RESET))) 1463 AAC_OPTION_IGNORE_RESET)))
1464 goto out; 1464 goto out;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index e80d2a0c46af..ae5f74fb62d5 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -275,9 +275,9 @@ static const char *aac_info(struct Scsi_Host *shost)
275 275
276/** 276/**
277 * aac_get_driver_ident 277 * aac_get_driver_ident
278 * @devtype: index into lookup table 278 * @devtype: index into lookup table
279 * 279 *
280 * Returns a pointer to the entry in the driver lookup table. 280 * Returns a pointer to the entry in the driver lookup table.
281 */ 281 */
282 282
283struct aac_driver_ident* aac_get_driver_ident(int devtype) 283struct aac_driver_ident* aac_get_driver_ident(int devtype)
@@ -494,13 +494,14 @@ static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
494 494
495static ssize_t aac_show_raid_level(struct device *dev, struct device_attribute *attr, char *buf) 495static ssize_t aac_show_raid_level(struct device *dev, struct device_attribute *attr, char *buf)
496{ 496{
497 struct scsi_device * sdev = to_scsi_device(dev); 497 struct scsi_device *sdev = to_scsi_device(dev);
498 struct aac_dev *aac = (struct aac_dev *)(sdev->host->hostdata);
498 if (sdev_channel(sdev) != CONTAINER_CHANNEL) 499 if (sdev_channel(sdev) != CONTAINER_CHANNEL)
499 return snprintf(buf, PAGE_SIZE, sdev->no_uld_attach 500 return snprintf(buf, PAGE_SIZE, sdev->no_uld_attach
500 ? "Hidden\n" : "JBOD"); 501 ? "Hidden\n" :
502 ((aac->jbod && (sdev->type == TYPE_DISK)) ? "JBOD\n" : ""));
501 return snprintf(buf, PAGE_SIZE, "%s\n", 503 return snprintf(buf, PAGE_SIZE, "%s\n",
502 get_container_type(((struct aac_dev *)(sdev->host->hostdata)) 504 get_container_type(aac->fsa_dev[sdev_id(sdev)].type));
503 ->fsa_dev[sdev_id(sdev)].type));
504} 505}
505 506
506static struct device_attribute aac_raid_level_attr = { 507static struct device_attribute aac_raid_level_attr = {
@@ -641,7 +642,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
641 AAC_OPTION_MU_RESET) && 642 AAC_OPTION_MU_RESET) &&
642 aac_check_reset && 643 aac_check_reset &&
643 ((aac_check_reset != 1) || 644 ((aac_check_reset != 1) ||
644 (aac->supplement_adapter_info.SupportedOptions2 & 645 !(aac->supplement_adapter_info.SupportedOptions2 &
645 AAC_OPTION_IGNORE_RESET))) 646 AAC_OPTION_IGNORE_RESET)))
646 aac_reset_adapter(aac, 2); /* Bypass wait for command quiesce */ 647 aac_reset_adapter(aac, 2); /* Bypass wait for command quiesce */
647 return SUCCESS; /* Cause an immediate retry of the command with a ten second delay after successful tur */ 648 return SUCCESS; /* Cause an immediate retry of the command with a ten second delay after successful tur */
@@ -860,8 +861,8 @@ ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf)
860 le32_to_cpu(dev->adapter_info.serial[0])); 861 le32_to_cpu(dev->adapter_info.serial[0]));
861 if (len && 862 if (len &&
862 !memcmp(&dev->supplement_adapter_info.MfgPcbaSerialNo[ 863 !memcmp(&dev->supplement_adapter_info.MfgPcbaSerialNo[
863 sizeof(dev->supplement_adapter_info.MfgPcbaSerialNo)+2-len], 864 sizeof(dev->supplement_adapter_info.MfgPcbaSerialNo)-len],
864 buf, len)) 865 buf, len-1))
865 len = snprintf(buf, PAGE_SIZE, "%.*s\n", 866 len = snprintf(buf, PAGE_SIZE, "%.*s\n",
866 (int)sizeof(dev->supplement_adapter_info.MfgPcbaSerialNo), 867 (int)sizeof(dev->supplement_adapter_info.MfgPcbaSerialNo),
867 dev->supplement_adapter_info.MfgPcbaSerialNo); 868 dev->supplement_adapter_info.MfgPcbaSerialNo);
@@ -1004,32 +1005,32 @@ static const struct file_operations aac_cfg_fops = {
1004 1005
1005static struct scsi_host_template aac_driver_template = { 1006static struct scsi_host_template aac_driver_template = {
1006 .module = THIS_MODULE, 1007 .module = THIS_MODULE,
1007 .name = "AAC", 1008 .name = "AAC",
1008 .proc_name = AAC_DRIVERNAME, 1009 .proc_name = AAC_DRIVERNAME,
1009 .info = aac_info, 1010 .info = aac_info,
1010 .ioctl = aac_ioctl, 1011 .ioctl = aac_ioctl,
1011#ifdef CONFIG_COMPAT 1012#ifdef CONFIG_COMPAT
1012 .compat_ioctl = aac_compat_ioctl, 1013 .compat_ioctl = aac_compat_ioctl,
1013#endif 1014#endif
1014 .queuecommand = aac_queuecommand, 1015 .queuecommand = aac_queuecommand,
1015 .bios_param = aac_biosparm, 1016 .bios_param = aac_biosparm,
1016 .shost_attrs = aac_attrs, 1017 .shost_attrs = aac_attrs,
1017 .slave_configure = aac_slave_configure, 1018 .slave_configure = aac_slave_configure,
1018 .change_queue_depth = aac_change_queue_depth, 1019 .change_queue_depth = aac_change_queue_depth,
1019 .sdev_attrs = aac_dev_attrs, 1020 .sdev_attrs = aac_dev_attrs,
1020 .eh_abort_handler = aac_eh_abort, 1021 .eh_abort_handler = aac_eh_abort,
1021 .eh_host_reset_handler = aac_eh_reset, 1022 .eh_host_reset_handler = aac_eh_reset,
1022 .can_queue = AAC_NUM_IO_FIB, 1023 .can_queue = AAC_NUM_IO_FIB,
1023 .this_id = MAXIMUM_NUM_CONTAINERS, 1024 .this_id = MAXIMUM_NUM_CONTAINERS,
1024 .sg_tablesize = 16, 1025 .sg_tablesize = 16,
1025 .max_sectors = 128, 1026 .max_sectors = 128,
1026#if (AAC_NUM_IO_FIB > 256) 1027#if (AAC_NUM_IO_FIB > 256)
1027 .cmd_per_lun = 256, 1028 .cmd_per_lun = 256,
1028#else 1029#else
1029 .cmd_per_lun = AAC_NUM_IO_FIB, 1030 .cmd_per_lun = AAC_NUM_IO_FIB,
1030#endif 1031#endif
1031 .use_clustering = ENABLE_CLUSTERING, 1032 .use_clustering = ENABLE_CLUSTERING,
1032 .emulated = 1, 1033 .emulated = 1,
1033}; 1034};
1034 1035
1035static void __aac_shutdown(struct aac_dev * aac) 1036static void __aac_shutdown(struct aac_dev * aac)
@@ -1039,6 +1040,8 @@ static void __aac_shutdown(struct aac_dev * aac)
1039 aac_send_shutdown(aac); 1040 aac_send_shutdown(aac);
1040 aac_adapter_disable_int(aac); 1041 aac_adapter_disable_int(aac);
1041 free_irq(aac->pdev->irq, aac); 1042 free_irq(aac->pdev->irq, aac);
1043 if (aac->msi)
1044 pci_disable_msi(aac->pdev);
1042} 1045}
1043 1046
1044static int __devinit aac_probe_one(struct pci_dev *pdev, 1047static int __devinit aac_probe_one(struct pci_dev *pdev,
@@ -1254,7 +1257,7 @@ static struct pci_driver aac_pci_driver = {
1254 .id_table = aac_pci_tbl, 1257 .id_table = aac_pci_tbl,
1255 .probe = aac_probe_one, 1258 .probe = aac_probe_one,
1256 .remove = __devexit_p(aac_remove_one), 1259 .remove = __devexit_p(aac_remove_one),
1257 .shutdown = aac_shutdown, 1260 .shutdown = aac_shutdown,
1258}; 1261};
1259 1262
1260static int __init aac_init(void) 1263static int __init aac_init(void)
@@ -1271,7 +1274,7 @@ static int __init aac_init(void)
1271 aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops); 1274 aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops);
1272 if (aac_cfg_major < 0) { 1275 if (aac_cfg_major < 0) {
1273 printk(KERN_WARNING 1276 printk(KERN_WARNING
1274 "aacraid: unable to register \"aac\" device.\n"); 1277 "aacraid: unable to register \"aac\" device.\n");
1275 } 1278 }
1276 1279
1277 return 0; 1280 return 0;
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index a08bbf1fd76c..1f18b83e1e02 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -625,8 +625,11 @@ int _aac_rx_init(struct aac_dev *dev)
625 if (aac_init_adapter(dev) == NULL) 625 if (aac_init_adapter(dev) == NULL)
626 goto error_iounmap; 626 goto error_iounmap;
627 aac_adapter_comm(dev, dev->comm_interface); 627 aac_adapter_comm(dev, dev->comm_interface);
628 if (request_irq(dev->scsi_host_ptr->irq, dev->a_ops.adapter_intr, 628 dev->msi = aac_msi && !pci_enable_msi(dev->pdev);
629 if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
629 IRQF_SHARED|IRQF_DISABLED, "aacraid", dev) < 0) { 630 IRQF_SHARED|IRQF_DISABLED, "aacraid", dev) < 0) {
631 if (dev->msi)
632 pci_disable_msi(dev->pdev);
630 printk(KERN_ERR "%s%d: Interrupt unavailable.\n", 633 printk(KERN_ERR "%s%d: Interrupt unavailable.\n",
631 name, instance); 634 name, instance);
632 goto error_iounmap; 635 goto error_iounmap;
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index 85b91bc578c9..cfc3410ec073 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -31,6 +31,7 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/pci.h>
34#include <linux/spinlock.h> 35#include <linux/spinlock.h>
35#include <linux/slab.h> 36#include <linux/slab.h>
36#include <linux/blkdev.h> 37#include <linux/blkdev.h>
@@ -385,7 +386,7 @@ int aac_sa_init(struct aac_dev *dev)
385 386
386 if(aac_init_adapter(dev) == NULL) 387 if(aac_init_adapter(dev) == NULL)
387 goto error_irq; 388 goto error_irq;
388 if (request_irq(dev->scsi_host_ptr->irq, dev->a_ops.adapter_intr, 389 if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr,
389 IRQF_SHARED|IRQF_DISABLED, 390 IRQF_SHARED|IRQF_DISABLED,
390 "aacraid", (void *)dev ) < 0) { 391 "aacraid", (void *)dev ) < 0) {
391 printk(KERN_WARNING "%s%d: Interrupt unavailable.\n", 392 printk(KERN_WARNING "%s%d: Interrupt unavailable.\n",
@@ -403,7 +404,7 @@ int aac_sa_init(struct aac_dev *dev)
403 404
404error_irq: 405error_irq:
405 aac_sa_disable_interrupt(dev); 406 aac_sa_disable_interrupt(dev);
406 free_irq(dev->scsi_host_ptr->irq, (void *)dev); 407 free_irq(dev->pdev->irq, (void *)dev);
407 408
408error_iounmap: 409error_iounmap:
409 410
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index ccef891d642f..3c2d6888bb8c 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -566,7 +566,7 @@ typedef struct asc_dvc_var {
566 ASC_SCSI_BIT_ID_TYPE unit_not_ready; 566 ASC_SCSI_BIT_ID_TYPE unit_not_ready;
567 ASC_SCSI_BIT_ID_TYPE queue_full_or_busy; 567 ASC_SCSI_BIT_ID_TYPE queue_full_or_busy;
568 ASC_SCSI_BIT_ID_TYPE start_motor; 568 ASC_SCSI_BIT_ID_TYPE start_motor;
569 uchar overrun_buf[ASC_OVERRUN_BSIZE] __aligned(8); 569 uchar *overrun_buf;
570 dma_addr_t overrun_dma; 570 dma_addr_t overrun_dma;
571 uchar scsi_reset_wait; 571 uchar scsi_reset_wait;
572 uchar chip_no; 572 uchar chip_no;
@@ -13833,6 +13833,12 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13833 */ 13833 */
13834 if (ASC_NARROW_BOARD(boardp)) { 13834 if (ASC_NARROW_BOARD(boardp)) {
13835 ASC_DBG(2, "AscInitAsc1000Driver()\n"); 13835 ASC_DBG(2, "AscInitAsc1000Driver()\n");
13836
13837 asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL);
13838 if (!asc_dvc_varp->overrun_buf) {
13839 ret = -ENOMEM;
13840 goto err_free_wide_mem;
13841 }
13836 warn_code = AscInitAsc1000Driver(asc_dvc_varp); 13842 warn_code = AscInitAsc1000Driver(asc_dvc_varp);
13837 13843
13838 if (warn_code || asc_dvc_varp->err_code) { 13844 if (warn_code || asc_dvc_varp->err_code) {
@@ -13840,8 +13846,10 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
13840 "warn 0x%x, error 0x%x\n", 13846 "warn 0x%x, error 0x%x\n",
13841 asc_dvc_varp->init_state, warn_code, 13847 asc_dvc_varp->init_state, warn_code,
13842 asc_dvc_varp->err_code); 13848 asc_dvc_varp->err_code);
13843 if (asc_dvc_varp->err_code) 13849 if (asc_dvc_varp->err_code) {
13844 ret = -ENODEV; 13850 ret = -ENODEV;
13851 kfree(asc_dvc_varp->overrun_buf);
13852 }
13845 } 13853 }
13846 } else { 13854 } else {
13847 if (advansys_wide_init_chip(shost)) 13855 if (advansys_wide_init_chip(shost))
@@ -13894,6 +13902,7 @@ static int advansys_release(struct Scsi_Host *shost)
13894 dma_unmap_single(board->dev, 13902 dma_unmap_single(board->dev,
13895 board->dvc_var.asc_dvc_var.overrun_dma, 13903 board->dvc_var.asc_dvc_var.overrun_dma,
13896 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE); 13904 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
13905 kfree(board->dvc_var.asc_dvc_var.overrun_buf);
13897 } else { 13906 } else {
13898 iounmap(board->ioremap_addr); 13907 iounmap(board->ioremap_addr);
13899 advansys_wide_free_mem(board); 13908 advansys_wide_free_mem(board);
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
index 4150c8a8fdc2..dfaaae5e73ae 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
@@ -89,7 +89,7 @@ ahd_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg)
89 pci_save_state(pdev); 89 pci_save_state(pdev);
90 pci_disable_device(pdev); 90 pci_disable_device(pdev);
91 91
92 if (mesg.event == PM_EVENT_SUSPEND) 92 if (mesg.event & PM_EVENT_SLEEP)
93 pci_set_power_state(pdev, PCI_D3hot); 93 pci_set_power_state(pdev, PCI_D3hot);
94 94
95 return rc; 95 return rc;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 6d2ae641273c..64e62ce59c15 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -695,15 +695,16 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
695 scb_index = ahc_inb(ahc, SCB_TAG); 695 scb_index = ahc_inb(ahc, SCB_TAG);
696 scb = ahc_lookup_scb(ahc, scb_index); 696 scb = ahc_lookup_scb(ahc, scb_index);
697 if (devinfo.role == ROLE_INITIATOR) { 697 if (devinfo.role == ROLE_INITIATOR) {
698 if (scb == NULL) 698 if (bus_phase == P_MESGOUT) {
699 panic("HOST_MSG_LOOP with " 699 if (scb == NULL)
700 "invalid SCB %x\n", scb_index); 700 panic("HOST_MSG_LOOP with "
701 "invalid SCB %x\n",
702 scb_index);
701 703
702 if (bus_phase == P_MESGOUT)
703 ahc_setup_initiator_msgout(ahc, 704 ahc_setup_initiator_msgout(ahc,
704 &devinfo, 705 &devinfo,
705 scb); 706 scb);
706 else { 707 } else {
707 ahc->msg_type = 708 ahc->msg_type =
708 MSG_TYPE_INITIATOR_MSGIN; 709 MSG_TYPE_INITIATOR_MSGIN;
709 ahc->msgin_index = 0; 710 ahc->msgin_index = 0;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index dd6e21d6f1dd..3d3eaef65fb3 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -134,7 +134,7 @@ ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg)
134 pci_save_state(pdev); 134 pci_save_state(pdev);
135 pci_disable_device(pdev); 135 pci_disable_device(pdev);
136 136
137 if (mesg.event == PM_EVENT_SUSPEND) 137 if (mesg.event & PM_EVENT_SLEEP)
138 pci_set_power_state(pdev, PCI_D3hot); 138 pci_set_power_state(pdev, PCI_D3hot);
139 139
140 return rc; 140 return rc;
diff --git a/drivers/scsi/aic94xx/aic94xx_sas.h b/drivers/scsi/aic94xx/aic94xx_sas.h
index fa7c5290257d..912e6b755f74 100644
--- a/drivers/scsi/aic94xx/aic94xx_sas.h
+++ b/drivers/scsi/aic94xx/aic94xx_sas.h
@@ -292,7 +292,7 @@ struct scb_header {
292#define INITIATE_SSP_TASK 0x00 292#define INITIATE_SSP_TASK 0x00
293#define INITIATE_LONG_SSP_TASK 0x01 293#define INITIATE_LONG_SSP_TASK 0x01
294#define INITIATE_BIDIR_SSP_TASK 0x02 294#define INITIATE_BIDIR_SSP_TASK 0x02
295#define ABORT_TASK 0x03 295#define SCB_ABORT_TASK 0x03
296#define INITIATE_SSP_TMF 0x04 296#define INITIATE_SSP_TMF 0x04
297#define SSP_TARG_GET_DATA 0x05 297#define SSP_TARG_GET_DATA 0x05
298#define SSP_TARG_GET_DATA_GOOD 0x06 298#define SSP_TARG_GET_DATA_GOOD 0x06
diff --git a/drivers/scsi/aic94xx/aic94xx_scb.c b/drivers/scsi/aic94xx/aic94xx_scb.c
index 0febad4dd75f..ab350504ca5a 100644
--- a/drivers/scsi/aic94xx/aic94xx_scb.c
+++ b/drivers/scsi/aic94xx/aic94xx_scb.c
@@ -458,13 +458,19 @@ static void escb_tasklet_complete(struct asd_ascb *ascb,
458 tc_abort = le16_to_cpu(tc_abort); 458 tc_abort = le16_to_cpu(tc_abort);
459 459
460 list_for_each_entry_safe(a, b, &asd_ha->seq.pend_q, list) { 460 list_for_each_entry_safe(a, b, &asd_ha->seq.pend_q, list) {
461 struct sas_task *task = ascb->uldd_task; 461 struct sas_task *task = a->uldd_task;
462
463 if (a->tc_index != tc_abort)
464 continue;
462 465
463 if (task && a->tc_index == tc_abort) { 466 if (task) {
464 failed_dev = task->dev; 467 failed_dev = task->dev;
465 sas_task_abort(task); 468 sas_task_abort(task);
466 break; 469 } else {
470 ASD_DPRINTK("R_T_A for non TASK scb 0x%x\n",
471 a->scb->header.opcode);
467 } 472 }
473 break;
468 } 474 }
469 475
470 if (!failed_dev) { 476 if (!failed_dev) {
@@ -478,7 +484,7 @@ static void escb_tasklet_complete(struct asd_ascb *ascb,
478 * that the EH will wake up and do something. 484 * that the EH will wake up and do something.
479 */ 485 */
480 list_for_each_entry_safe(a, b, &asd_ha->seq.pend_q, list) { 486 list_for_each_entry_safe(a, b, &asd_ha->seq.pend_q, list) {
481 struct sas_task *task = ascb->uldd_task; 487 struct sas_task *task = a->uldd_task;
482 488
483 if (task && 489 if (task &&
484 task->dev == failed_dev && 490 task->dev == failed_dev &&
diff --git a/drivers/scsi/aic94xx/aic94xx_tmf.c b/drivers/scsi/aic94xx/aic94xx_tmf.c
index 87b2f6e6adfe..144f5ad20453 100644
--- a/drivers/scsi/aic94xx/aic94xx_tmf.c
+++ b/drivers/scsi/aic94xx/aic94xx_tmf.c
@@ -151,8 +151,6 @@ static int asd_clear_nexus_I_T(struct domain_device *dev)
151 CLEAR_NEXUS_PRE; 151 CLEAR_NEXUS_PRE;
152 scb->clear_nexus.nexus = NEXUS_I_T; 152 scb->clear_nexus.nexus = NEXUS_I_T;
153 scb->clear_nexus.flags = SEND_Q | EXEC_Q | NOTINQ; 153 scb->clear_nexus.flags = SEND_Q | EXEC_Q | NOTINQ;
154 if (dev->tproto)
155 scb->clear_nexus.flags |= SUSPEND_TX;
156 scb->clear_nexus.conn_handle = cpu_to_le16((u16)(unsigned long) 154 scb->clear_nexus.conn_handle = cpu_to_le16((u16)(unsigned long)
157 dev->lldd_dev); 155 dev->lldd_dev);
158 CLEAR_NEXUS_POST; 156 CLEAR_NEXUS_POST;
@@ -169,8 +167,6 @@ static int asd_clear_nexus_I_T_L(struct domain_device *dev, u8 *lun)
169 CLEAR_NEXUS_PRE; 167 CLEAR_NEXUS_PRE;
170 scb->clear_nexus.nexus = NEXUS_I_T_L; 168 scb->clear_nexus.nexus = NEXUS_I_T_L;
171 scb->clear_nexus.flags = SEND_Q | EXEC_Q | NOTINQ; 169 scb->clear_nexus.flags = SEND_Q | EXEC_Q | NOTINQ;
172 if (dev->tproto)
173 scb->clear_nexus.flags |= SUSPEND_TX;
174 memcpy(scb->clear_nexus.ssp_task.lun, lun, 8); 170 memcpy(scb->clear_nexus.ssp_task.lun, lun, 8);
175 scb->clear_nexus.conn_handle = cpu_to_le16((u16)(unsigned long) 171 scb->clear_nexus.conn_handle = cpu_to_le16((u16)(unsigned long)
176 dev->lldd_dev); 172 dev->lldd_dev);
@@ -369,7 +365,7 @@ int asd_abort_task(struct sas_task *task)
369 return -ENOMEM; 365 return -ENOMEM;
370 scb = ascb->scb; 366 scb = ascb->scb;
371 367
372 scb->header.opcode = ABORT_TASK; 368 scb->header.opcode = SCB_ABORT_TASK;
373 369
374 switch (task->task_proto) { 370 switch (task->task_proto) {
375 case SAS_PROTOCOL_SATA: 371 case SAS_PROTOCOL_SATA:
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 4f9ff32cfed0..f91f79c8007d 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1387,18 +1387,16 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \
1387 switch(controlcode) { 1387 switch(controlcode) {
1388 1388
1389 case ARCMSR_MESSAGE_READ_RQBUFFER: { 1389 case ARCMSR_MESSAGE_READ_RQBUFFER: {
1390 unsigned long *ver_addr; 1390 unsigned char *ver_addr;
1391 uint8_t *pQbuffer, *ptmpQbuffer; 1391 uint8_t *pQbuffer, *ptmpQbuffer;
1392 int32_t allxfer_len = 0; 1392 int32_t allxfer_len = 0;
1393 void *tmp;
1394 1393
1395 tmp = kmalloc(1032, GFP_KERNEL|GFP_DMA); 1394 ver_addr = kmalloc(1032, GFP_ATOMIC);
1396 ver_addr = (unsigned long *)tmp; 1395 if (!ver_addr) {
1397 if (!tmp) {
1398 retvalue = ARCMSR_MESSAGE_FAIL; 1396 retvalue = ARCMSR_MESSAGE_FAIL;
1399 goto message_out; 1397 goto message_out;
1400 } 1398 }
1401 ptmpQbuffer = (uint8_t *) ver_addr; 1399 ptmpQbuffer = ver_addr;
1402 while ((acb->rqbuf_firstindex != acb->rqbuf_lastindex) 1400 while ((acb->rqbuf_firstindex != acb->rqbuf_lastindex)
1403 && (allxfer_len < 1031)) { 1401 && (allxfer_len < 1031)) {
1404 pQbuffer = &acb->rqbuffer[acb->rqbuf_firstindex]; 1402 pQbuffer = &acb->rqbuffer[acb->rqbuf_firstindex];
@@ -1427,26 +1425,24 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \
1427 } 1425 }
1428 arcmsr_iop_message_read(acb); 1426 arcmsr_iop_message_read(acb);
1429 } 1427 }
1430 memcpy(pcmdmessagefld->messagedatabuffer, (uint8_t *)ver_addr, allxfer_len); 1428 memcpy(pcmdmessagefld->messagedatabuffer, ver_addr, allxfer_len);
1431 pcmdmessagefld->cmdmessage.Length = allxfer_len; 1429 pcmdmessagefld->cmdmessage.Length = allxfer_len;
1432 pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK; 1430 pcmdmessagefld->cmdmessage.ReturnCode = ARCMSR_MESSAGE_RETURNCODE_OK;
1433 kfree(tmp); 1431 kfree(ver_addr);
1434 } 1432 }
1435 break; 1433 break;
1436 1434
1437 case ARCMSR_MESSAGE_WRITE_WQBUFFER: { 1435 case ARCMSR_MESSAGE_WRITE_WQBUFFER: {
1438 unsigned long *ver_addr; 1436 unsigned char *ver_addr;
1439 int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex; 1437 int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex;
1440 uint8_t *pQbuffer, *ptmpuserbuffer; 1438 uint8_t *pQbuffer, *ptmpuserbuffer;
1441 void *tmp;
1442 1439
1443 tmp = kmalloc(1032, GFP_KERNEL|GFP_DMA); 1440 ver_addr = kmalloc(1032, GFP_ATOMIC);
1444 ver_addr = (unsigned long *)tmp; 1441 if (!ver_addr) {
1445 if (!tmp) {
1446 retvalue = ARCMSR_MESSAGE_FAIL; 1442 retvalue = ARCMSR_MESSAGE_FAIL;
1447 goto message_out; 1443 goto message_out;
1448 } 1444 }
1449 ptmpuserbuffer = (uint8_t *)ver_addr; 1445 ptmpuserbuffer = ver_addr;
1450 user_len = pcmdmessagefld->cmdmessage.Length; 1446 user_len = pcmdmessagefld->cmdmessage.Length;
1451 memcpy(ptmpuserbuffer, pcmdmessagefld->messagedatabuffer, user_len); 1447 memcpy(ptmpuserbuffer, pcmdmessagefld->messagedatabuffer, user_len);
1452 wqbuf_lastindex = acb->wqbuf_lastindex; 1448 wqbuf_lastindex = acb->wqbuf_lastindex;
@@ -1492,7 +1488,7 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \
1492 retvalue = ARCMSR_MESSAGE_FAIL; 1488 retvalue = ARCMSR_MESSAGE_FAIL;
1493 } 1489 }
1494 } 1490 }
1495 kfree(tmp); 1491 kfree(ver_addr);
1496 } 1492 }
1497 break; 1493 break;
1498 1494
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index fb5f20284389..a715632e19d4 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2018,6 +2018,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,
2018 * the upper layers to process. This would have been set 2018 * the upper layers to process. This would have been set
2019 * correctly by fas216_std_done. 2019 * correctly by fas216_std_done.
2020 */ 2020 */
2021 scsi_eh_restore_cmnd(SCpnt, &info->ses);
2021 SCpnt->scsi_done(SCpnt); 2022 SCpnt->scsi_done(SCpnt);
2022} 2023}
2023 2024
@@ -2103,23 +2104,12 @@ request_sense:
2103 if (SCpnt->cmnd[0] == REQUEST_SENSE) 2104 if (SCpnt->cmnd[0] == REQUEST_SENSE)
2104 goto done; 2105 goto done;
2105 2106
2107 scsi_eh_prep_cmnd(SCpnt, &info->ses, NULL, 0, ~0);
2106 fas216_log_target(info, LOG_CONNECT, SCpnt->device->id, 2108 fas216_log_target(info, LOG_CONNECT, SCpnt->device->id,
2107 "requesting sense"); 2109 "requesting sense");
2108 memset(SCpnt->cmnd, 0, sizeof (SCpnt->cmnd)); 2110 init_SCp(SCpnt);
2109 SCpnt->cmnd[0] = REQUEST_SENSE;
2110 SCpnt->cmnd[1] = SCpnt->device->lun << 5;
2111 SCpnt->cmnd[4] = sizeof(SCpnt->sense_buffer);
2112 SCpnt->cmd_len = COMMAND_SIZE(SCpnt->cmnd[0]);
2113 SCpnt->SCp.buffer = NULL;
2114 SCpnt->SCp.buffers_residual = 0;
2115 SCpnt->SCp.ptr = (char *)SCpnt->sense_buffer;
2116 SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer);
2117 SCpnt->SCp.phase = sizeof(SCpnt->sense_buffer);
2118 SCpnt->SCp.Message = 0; 2111 SCpnt->SCp.Message = 0;
2119 SCpnt->SCp.Status = 0; 2112 SCpnt->SCp.Status = 0;
2120 SCpnt->request_bufflen = sizeof(SCpnt->sense_buffer);
2121 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
2122 SCpnt->use_sg = 0;
2123 SCpnt->tag = 0; 2113 SCpnt->tag = 0;
2124 SCpnt->host_scribble = (void *)fas216_rq_sns_done; 2114 SCpnt->host_scribble = (void *)fas216_rq_sns_done;
2125 2115
diff --git a/drivers/scsi/arm/fas216.h b/drivers/scsi/arm/fas216.h
index 00e5f055afdc..b65f4cf0eec9 100644
--- a/drivers/scsi/arm/fas216.h
+++ b/drivers/scsi/arm/fas216.h
@@ -16,6 +16,8 @@
16#define NO_IRQ 255 16#define NO_IRQ 255
17#endif 17#endif
18 18
19#include <scsi/scsi_eh.h>
20
19#include "queue.h" 21#include "queue.h"
20#include "msgqueue.h" 22#include "msgqueue.h"
21 23
@@ -311,6 +313,7 @@ typedef struct {
311 313
312 /* miscellaneous */ 314 /* miscellaneous */
313 int internal_done; /* flag to indicate request done */ 315 int internal_done; /* flag to indicate request done */
316 struct scsi_eh_save ses; /* holds request sense restore info */
314 unsigned long magic_end; 317 unsigned long magic_end;
315} FAS216_Info; 318} FAS216_Info;
316 319
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index c82523908c2e..6d67f5c0eb8e 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -642,12 +642,15 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
642 *cnt, vendor, device)); 642 *cnt, vendor, device));
643 643
644 pdev = NULL; 644 pdev = NULL;
645 while ((pdev = pci_find_device(vendor, device, pdev)) 645 while ((pdev = pci_get_device(vendor, device, pdev))
646 != NULL) { 646 != NULL) {
647 if (pci_enable_device(pdev)) 647 if (pci_enable_device(pdev))
648 continue; 648 continue;
649 if (*cnt >= MAXHA) 649 if (*cnt >= MAXHA) {
650 pci_dev_put(pdev);
650 return; 651 return;
652 }
653
651 /* GDT PCI controller found, resources are already in pdev */ 654 /* GDT PCI controller found, resources are already in pdev */
652 pcistr[*cnt].pdev = pdev; 655 pcistr[*cnt].pdev = pdev;
653 pcistr[*cnt].irq = pdev->irq; 656 pcistr[*cnt].irq = pdev->irq;
@@ -4836,6 +4839,9 @@ static int __init gdth_isa_probe_one(ulong32 isa_bios)
4836 if (error) 4839 if (error)
4837 goto out_free_coal_stat; 4840 goto out_free_coal_stat;
4838 list_add_tail(&ha->list, &gdth_instances); 4841 list_add_tail(&ha->list, &gdth_instances);
4842
4843 scsi_scan_host(shp);
4844
4839 return 0; 4845 return 0;
4840 4846
4841 out_free_coal_stat: 4847 out_free_coal_stat:
@@ -4963,6 +4969,9 @@ static int __init gdth_eisa_probe_one(ushort eisa_slot)
4963 if (error) 4969 if (error)
4964 goto out_free_coal_stat; 4970 goto out_free_coal_stat;
4965 list_add_tail(&ha->list, &gdth_instances); 4971 list_add_tail(&ha->list, &gdth_instances);
4972
4973 scsi_scan_host(shp);
4974
4966 return 0; 4975 return 0;
4967 4976
4968 out_free_ccb_phys: 4977 out_free_ccb_phys:
@@ -5100,6 +5109,9 @@ static int __init gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr)
5100 if (error) 5109 if (error)
5101 goto out_free_coal_stat; 5110 goto out_free_coal_stat;
5102 list_add_tail(&ha->list, &gdth_instances); 5111 list_add_tail(&ha->list, &gdth_instances);
5112
5113 scsi_scan_host(shp);
5114
5103 return 0; 5115 return 0;
5104 5116
5105 out_free_coal_stat: 5117 out_free_coal_stat:
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index de5773443c62..ce0228e26aec 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -694,15 +694,13 @@ static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr)
694{ 694{
695 ulong flags; 695 ulong flags;
696 696
697 spin_lock_irqsave(&ha->smp_lock, flags);
698
699 if (buf == ha->pscratch) { 697 if (buf == ha->pscratch) {
698 spin_lock_irqsave(&ha->smp_lock, flags);
700 ha->scratch_busy = FALSE; 699 ha->scratch_busy = FALSE;
700 spin_unlock_irqrestore(&ha->smp_lock, flags);
701 } else { 701 } else {
702 pci_free_consistent(ha->pdev, size, buf, paddr); 702 pci_free_consistent(ha->pdev, size, buf, paddr);
703 } 703 }
704
705 spin_unlock_irqrestore(&ha->smp_lock, flags);
706} 704}
707 705
708#ifdef GDTH_IOCTL_PROC 706#ifdef GDTH_IOCTL_PROC
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 2074701f7e76..c72014a3e7d4 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5140,7 +5140,7 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5140 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 5140 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
5141 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; 5141 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
5142 struct ipr_ioadl_desc *last_ioadl = NULL; 5142 struct ipr_ioadl_desc *last_ioadl = NULL;
5143 int len = qc->nbytes + qc->pad_len; 5143 int len = qc->nbytes;
5144 struct scatterlist *sg; 5144 struct scatterlist *sg;
5145 unsigned int si; 5145 unsigned int si;
5146 5146
@@ -5206,7 +5206,7 @@ static unsigned int ipr_qc_issue(struct ata_queued_cmd *qc)
5206 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_ATA_PASSTHRU; 5206 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_ATA_PASSTHRU;
5207 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_LINK_DESC; 5207 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_LINK_DESC;
5208 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK; 5208 ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK;
5209 ipr_cmd->dma_use_sg = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; 5209 ipr_cmd->dma_use_sg = qc->n_elem;
5210 5210
5211 ipr_build_ata_ioadl(ipr_cmd, qc); 5211 ipr_build_ata_ioadl(ipr_cmd, qc);
5212 regs->flags |= IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION; 5212 regs->flags |= IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index bb152fb9fec7..7ed568f180ae 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -1576,7 +1576,7 @@ ips_make_passthru(ips_ha_t *ha, struct scsi_cmnd *SC, ips_scb_t *scb, int intr)
1576 METHOD_TRACE("ips_make_passthru", 1); 1576 METHOD_TRACE("ips_make_passthru", 1);
1577 1577
1578 scsi_for_each_sg(SC, sg, scsi_sg_count(SC), i) 1578 scsi_for_each_sg(SC, sg, scsi_sg_count(SC), i)
1579 length += sg[i].length; 1579 length += sg->length;
1580 1580
1581 if (length < sizeof (ips_passthru_t)) { 1581 if (length < sizeof (ips_passthru_t)) {
1582 /* wrong size */ 1582 /* wrong size */
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 0996f866f14c..7cd05b599a12 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -178,8 +178,8 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
178 task->uldd_task = qc; 178 task->uldd_task = qc;
179 if (ata_is_atapi(qc->tf.protocol)) { 179 if (ata_is_atapi(qc->tf.protocol)) {
180 memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); 180 memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len);
181 task->total_xfer_len = qc->nbytes + qc->pad_len; 181 task->total_xfer_len = qc->nbytes;
182 task->num_scatter = qc->pad_len ? qc->n_elem + 1 : qc->n_elem; 182 task->num_scatter = qc->n_elem;
183 } else { 183 } else {
184 for_each_sg(qc->sg, sg, qc->n_elem, si) 184 for_each_sg(qc->sg, sg, qc->n_elem, si)
185 xfer += sg->length; 185 xfer += sg->length;
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index f869fba86807..704ea06a6e50 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -51,10 +51,14 @@ static void sas_scsi_task_done(struct sas_task *task)
51{ 51{
52 struct task_status_struct *ts = &task->task_status; 52 struct task_status_struct *ts = &task->task_status;
53 struct scsi_cmnd *sc = task->uldd_task; 53 struct scsi_cmnd *sc = task->uldd_task;
54 struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(sc->device->host);
55 unsigned ts_flags = task->task_state_flags;
56 int hs = 0, stat = 0; 54 int hs = 0, stat = 0;
57 55
56 if (unlikely(task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
57 /* Aborted tasks will be completed by the error handler */
58 SAS_DPRINTK("task done but aborted\n");
59 return;
60 }
61
58 if (unlikely(!sc)) { 62 if (unlikely(!sc)) {
59 SAS_DPRINTK("task_done called with non existing SCSI cmnd!\n"); 63 SAS_DPRINTK("task_done called with non existing SCSI cmnd!\n");
60 list_del_init(&task->list); 64 list_del_init(&task->list);
@@ -120,11 +124,7 @@ static void sas_scsi_task_done(struct sas_task *task)
120 sc->result = (hs << 16) | stat; 124 sc->result = (hs << 16) | stat;
121 list_del_init(&task->list); 125 list_del_init(&task->list);
122 sas_free_task(task); 126 sas_free_task(task);
123 /* This is very ugly but this is how SCSI Core works. */ 127 sc->scsi_done(sc);
124 if (ts_flags & SAS_TASK_STATE_ABORTED)
125 scsi_eh_finish_cmd(sc, &sas_ha->eh_done_q);
126 else
127 sc->scsi_done(sc);
128} 128}
129 129
130static enum task_attribute sas_scsi_get_task_attr(struct scsi_cmnd *cmd) 130static enum task_attribute sas_scsi_get_task_attr(struct scsi_cmnd *cmd)
@@ -255,13 +255,34 @@ out:
255 return res; 255 return res;
256} 256}
257 257
258static void sas_eh_finish_cmd(struct scsi_cmnd *cmd)
259{
260 struct sas_task *task = TO_SAS_TASK(cmd);
261 struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(cmd->device->host);
262
263 /* remove the aborted task flag to allow the task to be
264 * completed now. At this point, we only get called following
265 * an actual abort of the task, so we should be guaranteed not
266 * to be racing with any completions from the LLD (hence we
267 * don't need the task state lock to clear the flag) */
268 task->task_state_flags &= ~SAS_TASK_STATE_ABORTED;
269 /* Now call task_done. However, task will be free'd after
270 * this */
271 task->task_done(task);
272 /* now finish the command and move it on to the error
273 * handler done list, this also takes it off the
274 * error handler pending list */
275 scsi_eh_finish_cmd(cmd, &sas_ha->eh_done_q);
276}
277
258static void sas_scsi_clear_queue_lu(struct list_head *error_q, struct scsi_cmnd *my_cmd) 278static void sas_scsi_clear_queue_lu(struct list_head *error_q, struct scsi_cmnd *my_cmd)
259{ 279{
260 struct scsi_cmnd *cmd, *n; 280 struct scsi_cmnd *cmd, *n;
261 281
262 list_for_each_entry_safe(cmd, n, error_q, eh_entry) { 282 list_for_each_entry_safe(cmd, n, error_q, eh_entry) {
263 if (cmd == my_cmd) 283 if (cmd->device->sdev_target == my_cmd->device->sdev_target &&
264 list_del_init(&cmd->eh_entry); 284 cmd->device->lun == my_cmd->device->lun)
285 sas_eh_finish_cmd(cmd);
265 } 286 }
266} 287}
267 288
@@ -274,7 +295,7 @@ static void sas_scsi_clear_queue_I_T(struct list_head *error_q,
274 struct domain_device *x = cmd_to_domain_dev(cmd); 295 struct domain_device *x = cmd_to_domain_dev(cmd);
275 296
276 if (x == dev) 297 if (x == dev)
277 list_del_init(&cmd->eh_entry); 298 sas_eh_finish_cmd(cmd);
278 } 299 }
279} 300}
280 301
@@ -288,7 +309,7 @@ static void sas_scsi_clear_queue_port(struct list_head *error_q,
288 struct asd_sas_port *x = dev->port; 309 struct asd_sas_port *x = dev->port;
289 310
290 if (x == port) 311 if (x == port)
291 list_del_init(&cmd->eh_entry); 312 sas_eh_finish_cmd(cmd);
292 } 313 }
293} 314}
294 315
@@ -528,14 +549,14 @@ Again:
528 case TASK_IS_DONE: 549 case TASK_IS_DONE:
529 SAS_DPRINTK("%s: task 0x%p is done\n", __FUNCTION__, 550 SAS_DPRINTK("%s: task 0x%p is done\n", __FUNCTION__,
530 task); 551 task);
531 task->task_done(task); 552 sas_eh_finish_cmd(cmd);
532 if (need_reset) 553 if (need_reset)
533 try_to_reset_cmd_device(shost, cmd); 554 try_to_reset_cmd_device(shost, cmd);
534 continue; 555 continue;
535 case TASK_IS_ABORTED: 556 case TASK_IS_ABORTED:
536 SAS_DPRINTK("%s: task 0x%p is aborted\n", 557 SAS_DPRINTK("%s: task 0x%p is aborted\n",
537 __FUNCTION__, task); 558 __FUNCTION__, task);
538 task->task_done(task); 559 sas_eh_finish_cmd(cmd);
539 if (need_reset) 560 if (need_reset)
540 try_to_reset_cmd_device(shost, cmd); 561 try_to_reset_cmd_device(shost, cmd);
541 continue; 562 continue;
@@ -547,7 +568,7 @@ Again:
547 "recovered\n", 568 "recovered\n",
548 SAS_ADDR(task->dev), 569 SAS_ADDR(task->dev),
549 cmd->device->lun); 570 cmd->device->lun);
550 task->task_done(task); 571 sas_eh_finish_cmd(cmd);
551 if (need_reset) 572 if (need_reset)
552 try_to_reset_cmd_device(shost, cmd); 573 try_to_reset_cmd_device(shost, cmd);
553 sas_scsi_clear_queue_lu(work_q, cmd); 574 sas_scsi_clear_queue_lu(work_q, cmd);
@@ -562,7 +583,7 @@ Again:
562 if (tmf_resp == TMF_RESP_FUNC_COMPLETE) { 583 if (tmf_resp == TMF_RESP_FUNC_COMPLETE) {
563 SAS_DPRINTK("I_T %016llx recovered\n", 584 SAS_DPRINTK("I_T %016llx recovered\n",
564 SAS_ADDR(task->dev->sas_addr)); 585 SAS_ADDR(task->dev->sas_addr));
565 task->task_done(task); 586 sas_eh_finish_cmd(cmd);
566 if (need_reset) 587 if (need_reset)
567 try_to_reset_cmd_device(shost, cmd); 588 try_to_reset_cmd_device(shost, cmd);
568 sas_scsi_clear_queue_I_T(work_q, task->dev); 589 sas_scsi_clear_queue_I_T(work_q, task->dev);
@@ -577,7 +598,7 @@ Again:
577 if (res == TMF_RESP_FUNC_COMPLETE) { 598 if (res == TMF_RESP_FUNC_COMPLETE) {
578 SAS_DPRINTK("clear nexus port:%d " 599 SAS_DPRINTK("clear nexus port:%d "
579 "succeeded\n", port->id); 600 "succeeded\n", port->id);
580 task->task_done(task); 601 sas_eh_finish_cmd(cmd);
581 if (need_reset) 602 if (need_reset)
582 try_to_reset_cmd_device(shost, cmd); 603 try_to_reset_cmd_device(shost, cmd);
583 sas_scsi_clear_queue_port(work_q, 604 sas_scsi_clear_queue_port(work_q,
@@ -591,10 +612,10 @@ Again:
591 if (res == TMF_RESP_FUNC_COMPLETE) { 612 if (res == TMF_RESP_FUNC_COMPLETE) {
592 SAS_DPRINTK("clear nexus ha " 613 SAS_DPRINTK("clear nexus ha "
593 "succeeded\n"); 614 "succeeded\n");
594 task->task_done(task); 615 sas_eh_finish_cmd(cmd);
595 if (need_reset) 616 if (need_reset)
596 try_to_reset_cmd_device(shost, cmd); 617 try_to_reset_cmd_device(shost, cmd);
597 goto out; 618 goto clear_q;
598 } 619 }
599 } 620 }
600 /* If we are here -- this means that no amount 621 /* If we are here -- this means that no amount
@@ -606,21 +627,18 @@ Again:
606 SAS_ADDR(task->dev->sas_addr), 627 SAS_ADDR(task->dev->sas_addr),
607 cmd->device->lun); 628 cmd->device->lun);
608 629
609 task->task_done(task); 630 sas_eh_finish_cmd(cmd);
610 if (need_reset) 631 if (need_reset)
611 try_to_reset_cmd_device(shost, cmd); 632 try_to_reset_cmd_device(shost, cmd);
612 goto clear_q; 633 goto clear_q;
613 } 634 }
614 } 635 }
615out:
616 return list_empty(work_q); 636 return list_empty(work_q);
617clear_q: 637clear_q:
618 SAS_DPRINTK("--- Exit %s -- clear_q\n", __FUNCTION__); 638 SAS_DPRINTK("--- Exit %s -- clear_q\n", __FUNCTION__);
619 list_for_each_entry_safe(cmd, n, work_q, eh_entry) { 639 list_for_each_entry_safe(cmd, n, work_q, eh_entry)
620 struct sas_task *task = TO_SAS_TASK(cmd); 640 sas_eh_finish_cmd(cmd);
621 list_del_init(&cmd->eh_entry); 641
622 task->task_done(task);
623 }
624 return list_empty(work_q); 642 return list_empty(work_q);
625} 643}
626 644
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 83567b9755b4..2ab2d24dcc15 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -307,6 +307,7 @@ struct lpfc_vport {
307 307
308 uint32_t fc_nlp_cnt; /* outstanding NODELIST requests */ 308 uint32_t fc_nlp_cnt; /* outstanding NODELIST requests */
309 uint32_t fc_rscn_id_cnt; /* count of RSCNs payloads in list */ 309 uint32_t fc_rscn_id_cnt; /* count of RSCNs payloads in list */
310 uint32_t fc_rscn_flush; /* flag use of fc_rscn_id_list */
310 struct lpfc_dmabuf *fc_rscn_id_list[FC_MAX_HOLD_RSCN]; 311 struct lpfc_dmabuf *fc_rscn_id_list[FC_MAX_HOLD_RSCN];
311 struct lpfc_name fc_nodename; /* fc nodename */ 312 struct lpfc_name fc_nodename; /* fc nodename */
312 struct lpfc_name fc_portname; /* fc portname */ 313 struct lpfc_name fc_portname; /* fc portname */
@@ -392,6 +393,13 @@ enum hba_temp_state {
392 HBA_OVER_TEMP 393 HBA_OVER_TEMP
393}; 394};
394 395
396enum intr_type_t {
397 NONE = 0,
398 INTx,
399 MSI,
400 MSIX,
401};
402
395struct lpfc_hba { 403struct lpfc_hba {
396 struct lpfc_sli sli; 404 struct lpfc_sli sli;
397 uint32_t sli_rev; /* SLI2 or SLI3 */ 405 uint32_t sli_rev; /* SLI2 or SLI3 */
@@ -409,7 +417,7 @@ struct lpfc_hba {
409 /* This flag is set while issuing */ 417 /* This flag is set while issuing */
410 /* INIT_LINK mailbox command */ 418 /* INIT_LINK mailbox command */
411#define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */ 419#define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */
412#define LS_IGNORE_ERATT 0x3 /* intr handler should ignore ERATT */ 420#define LS_IGNORE_ERATT 0x4 /* intr handler should ignore ERATT */
413 421
414 struct lpfc_sli2_slim *slim2p; 422 struct lpfc_sli2_slim *slim2p;
415 struct lpfc_dmabuf hbqslimp; 423 struct lpfc_dmabuf hbqslimp;
@@ -487,6 +495,8 @@ struct lpfc_hba {
487 wait_queue_head_t *work_wait; 495 wait_queue_head_t *work_wait;
488 struct task_struct *worker_thread; 496 struct task_struct *worker_thread;
489 497
498 uint32_t hbq_in_use; /* HBQs in use flag */
499 struct list_head hbqbuf_in_list; /* in-fly hbq buffer list */
490 uint32_t hbq_count; /* Count of configured HBQs */ 500 uint32_t hbq_count; /* Count of configured HBQs */
491 struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */ 501 struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies */
492 502
@@ -555,7 +565,8 @@ struct lpfc_hba {
555 mempool_t *nlp_mem_pool; 565 mempool_t *nlp_mem_pool;
556 566
557 struct fc_host_statistics link_stats; 567 struct fc_host_statistics link_stats;
558 uint8_t using_msi; 568 enum intr_type_t intr_type;
569 struct msix_entry msix_entries[1];
559 570
560 struct list_head port_list; 571 struct list_head port_list;
561 struct lpfc_vport *pport; /* physical lpfc_vport pointer */ 572 struct lpfc_vport *pport; /* physical lpfc_vport pointer */
@@ -595,6 +606,8 @@ struct lpfc_hba {
595 unsigned long last_completion_time; 606 unsigned long last_completion_time;
596 struct timer_list hb_tmofunc; 607 struct timer_list hb_tmofunc;
597 uint8_t hb_outstanding; 608 uint8_t hb_outstanding;
609 /* ndlp reference management */
610 spinlock_t ndlp_lock;
598 /* 611 /*
599 * Following bit will be set for all buffer tags which are not 612 * Following bit will be set for all buffer tags which are not
600 * associated with any HBQ. 613 * associated with any HBQ.
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 4bae4a2ed2f1..b12a841703ca 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -1191,7 +1191,7 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)
1191 shost = lpfc_shost_from_vport(vport); 1191 shost = lpfc_shost_from_vport(vport);
1192 spin_lock_irq(shost->host_lock); 1192 spin_lock_irq(shost->host_lock);
1193 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) 1193 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp)
1194 if (ndlp->rport) 1194 if (NLP_CHK_NODE_ACT(ndlp) && ndlp->rport)
1195 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; 1195 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo;
1196 spin_unlock_irq(shost->host_lock); 1196 spin_unlock_irq(shost->host_lock);
1197} 1197}
@@ -1592,9 +1592,11 @@ LPFC_ATTR_RW(poll_tmo, 10, 1, 255,
1592# support this feature 1592# support this feature
1593# 0 = MSI disabled (default) 1593# 0 = MSI disabled (default)
1594# 1 = MSI enabled 1594# 1 = MSI enabled
1595# Value range is [0,1]. Default value is 0. 1595# 2 = MSI-X enabled
1596# Value range is [0,2]. Default value is 0.
1596*/ 1597*/
1597LPFC_ATTR_R(use_msi, 0, 0, 1, "Use Message Signaled Interrupts, if possible"); 1598LPFC_ATTR_R(use_msi, 0, 0, 2, "Use Message Signaled Interrupts (1) or "
1599 "MSI-X (2), if possible");
1598 1600
1599/* 1601/*
1600# lpfc_enable_hba_reset: Allow or prevent HBA resets to the hardware. 1602# lpfc_enable_hba_reset: Allow or prevent HBA resets to the hardware.
@@ -1946,11 +1948,13 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
1946 } 1948 }
1947 1949
1948 /* If HBA encountered an error attention, allow only DUMP 1950 /* If HBA encountered an error attention, allow only DUMP
1949 * mailbox command until the HBA is restarted. 1951 * or RESTART mailbox commands until the HBA is restarted.
1950 */ 1952 */
1951 if ((phba->pport->stopped) && 1953 if ((phba->pport->stopped) &&
1952 (phba->sysfs_mbox.mbox->mb.mbxCommand 1954 (phba->sysfs_mbox.mbox->mb.mbxCommand !=
1953 != MBX_DUMP_MEMORY)) { 1955 MBX_DUMP_MEMORY &&
1956 phba->sysfs_mbox.mbox->mb.mbxCommand !=
1957 MBX_RESTART)) {
1954 sysfs_mbox_idle(phba); 1958 sysfs_mbox_idle(phba);
1955 spin_unlock_irq(&phba->hbalock); 1959 spin_unlock_irq(&phba->hbalock);
1956 return -EPERM; 1960 return -EPERM;
@@ -2384,7 +2388,8 @@ lpfc_get_node_by_target(struct scsi_target *starget)
2384 spin_lock_irq(shost->host_lock); 2388 spin_lock_irq(shost->host_lock);
2385 /* Search for this, mapped, target ID */ 2389 /* Search for this, mapped, target ID */
2386 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { 2390 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
2387 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && 2391 if (NLP_CHK_NODE_ACT(ndlp) &&
2392 ndlp->nlp_state == NLP_STE_MAPPED_NODE &&
2388 starget->id == ndlp->nlp_sid) { 2393 starget->id == ndlp->nlp_sid) {
2389 spin_unlock_irq(shost->host_lock); 2394 spin_unlock_irq(shost->host_lock);
2390 return ndlp; 2395 return ndlp;
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index 50fcb7c930bc..0819f5f39de5 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -53,7 +53,10 @@ void lpfc_mbx_cmpl_dflt_rpi(struct lpfc_hba *, LPFC_MBOXQ_t *);
53void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); 53void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
54void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); 54void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
55void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); 55void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
56void lpfc_enqueue_node(struct lpfc_vport *, struct lpfc_nodelist *);
56void lpfc_dequeue_node(struct lpfc_vport *, struct lpfc_nodelist *); 57void lpfc_dequeue_node(struct lpfc_vport *, struct lpfc_nodelist *);
58struct lpfc_nodelist *lpfc_enable_node(struct lpfc_vport *,
59 struct lpfc_nodelist *, int);
57void lpfc_nlp_set_state(struct lpfc_vport *, struct lpfc_nodelist *, int); 60void lpfc_nlp_set_state(struct lpfc_vport *, struct lpfc_nodelist *, int);
58void lpfc_drop_node(struct lpfc_vport *, struct lpfc_nodelist *); 61void lpfc_drop_node(struct lpfc_vport *, struct lpfc_nodelist *);
59void lpfc_set_disctmo(struct lpfc_vport *); 62void lpfc_set_disctmo(struct lpfc_vport *);
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index 92441ce610ed..3d0ccd9b341d 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -294,7 +294,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,
294 /* Save for completion so we can release these resources */ 294 /* Save for completion so we can release these resources */
295 geniocb->context1 = (uint8_t *) inp; 295 geniocb->context1 = (uint8_t *) inp;
296 geniocb->context2 = (uint8_t *) outp; 296 geniocb->context2 = (uint8_t *) outp;
297 geniocb->context_un.ndlp = ndlp; 297 geniocb->context_un.ndlp = lpfc_nlp_get(ndlp);
298 298
299 /* Fill in payload, bp points to frame payload */ 299 /* Fill in payload, bp points to frame payload */
300 icmd->ulpCommand = CMD_GEN_REQUEST64_CR; 300 icmd->ulpCommand = CMD_GEN_REQUEST64_CR;
@@ -489,8 +489,10 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
489 */ 489 */
490 ndlp = lpfc_findnode_did(vport, 490 ndlp = lpfc_findnode_did(vport,
491 Did); 491 Did);
492 if (ndlp && (ndlp->nlp_type & 492 if (ndlp &&
493 NLP_FCP_TARGET)) 493 NLP_CHK_NODE_ACT(ndlp)
494 && (ndlp->nlp_type &
495 NLP_FCP_TARGET))
494 lpfc_setup_disc_node 496 lpfc_setup_disc_node
495 (vport, Did); 497 (vport, Did);
496 else if (lpfc_ns_cmd(vport, 498 else if (lpfc_ns_cmd(vport,
@@ -773,7 +775,7 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
773 "0267 NameServer GFF Rsp " 775 "0267 NameServer GFF Rsp "
774 "x%x Error (%d %d) Data: x%x x%x\n", 776 "x%x Error (%d %d) Data: x%x x%x\n",
775 did, irsp->ulpStatus, irsp->un.ulpWord[4], 777 did, irsp->ulpStatus, irsp->un.ulpWord[4],
776 vport->fc_flag, vport->fc_rscn_id_cnt) 778 vport->fc_flag, vport->fc_rscn_id_cnt);
777 } 779 }
778 780
779 /* This is a target port, unregistered port, or the GFF_ID failed */ 781 /* This is a target port, unregistered port, or the GFF_ID failed */
@@ -1064,7 +1066,8 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1064 int rc = 0; 1066 int rc = 0;
1065 1067
1066 ndlp = lpfc_findnode_did(vport, NameServer_DID); 1068 ndlp = lpfc_findnode_did(vport, NameServer_DID);
1067 if (ndlp == NULL || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) { 1069 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)
1070 || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) {
1068 rc=1; 1071 rc=1;
1069 goto ns_cmd_exit; 1072 goto ns_cmd_exit;
1070 } 1073 }
@@ -1213,8 +1216,9 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1213 cmpl = lpfc_cmpl_ct_cmd_rff_id; 1216 cmpl = lpfc_cmpl_ct_cmd_rff_id;
1214 break; 1217 break;
1215 } 1218 }
1216 lpfc_nlp_get(ndlp); 1219 /* The lpfc_ct_cmd/lpfc_get_req shall increment ndlp reference count
1217 1220 * to hold ndlp reference for the corresponding callback function.
1221 */
1218 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) { 1222 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) {
1219 /* On success, The cmpl function will free the buffers */ 1223 /* On success, The cmpl function will free the buffers */
1220 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT, 1224 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT,
@@ -1222,9 +1226,13 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1222 cmdcode, ndlp->nlp_DID, 0); 1226 cmdcode, ndlp->nlp_DID, 0);
1223 return 0; 1227 return 0;
1224 } 1228 }
1225
1226 rc=6; 1229 rc=6;
1230
1231 /* Decrement ndlp reference count to release ndlp reference held
1232 * for the failed command's callback function.
1233 */
1227 lpfc_nlp_put(ndlp); 1234 lpfc_nlp_put(ndlp);
1235
1228 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); 1236 lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
1229ns_cmd_free_bmp: 1237ns_cmd_free_bmp:
1230 kfree(bmp); 1238 kfree(bmp);
@@ -1271,6 +1279,9 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1271 } 1279 }
1272 1280
1273 ndlp = lpfc_findnode_did(vport, FDMI_DID); 1281 ndlp = lpfc_findnode_did(vport, FDMI_DID);
1282 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp))
1283 goto fail_out;
1284
1274 if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { 1285 if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) {
1275 /* FDMI rsp failed */ 1286 /* FDMI rsp failed */
1276 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 1287 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
@@ -1294,6 +1305,8 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1294 lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_RHBA); 1305 lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_RHBA);
1295 break; 1306 break;
1296 } 1307 }
1308
1309fail_out:
1297 lpfc_ct_free_iocb(phba, cmdiocb); 1310 lpfc_ct_free_iocb(phba, cmdiocb);
1298 return; 1311 return;
1299} 1312}
@@ -1650,12 +1663,18 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
1650 bpl->tus.w = le32_to_cpu(bpl->tus.w); 1663 bpl->tus.w = le32_to_cpu(bpl->tus.w);
1651 1664
1652 cmpl = lpfc_cmpl_ct_cmd_fdmi; 1665 cmpl = lpfc_cmpl_ct_cmd_fdmi;
1653 lpfc_nlp_get(ndlp);
1654 1666
1667 /* The lpfc_ct_cmd/lpfc_get_req shall increment ndlp reference count
1668 * to hold ndlp reference for the corresponding callback function.
1669 */
1655 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0)) 1670 if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0))
1656 return 0; 1671 return 0;
1657 1672
1673 /* Decrement ndlp reference count to release ndlp reference held
1674 * for the failed command's callback function.
1675 */
1658 lpfc_nlp_put(ndlp); 1676 lpfc_nlp_put(ndlp);
1677
1659 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); 1678 lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
1660fdmi_cmd_free_bmp: 1679fdmi_cmd_free_bmp:
1661 kfree(bmp); 1680 kfree(bmp);
@@ -1698,7 +1717,7 @@ lpfc_fdmi_timeout_handler(struct lpfc_vport *vport)
1698 struct lpfc_nodelist *ndlp; 1717 struct lpfc_nodelist *ndlp;
1699 1718
1700 ndlp = lpfc_findnode_did(vport, FDMI_DID); 1719 ndlp = lpfc_findnode_did(vport, FDMI_DID);
1701 if (ndlp) { 1720 if (ndlp && NLP_CHK_NODE_ACT(ndlp)) {
1702 if (init_utsname()->nodename[0] != '\0') 1721 if (init_utsname()->nodename[0] != '\0')
1703 lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); 1722 lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA);
1704 else 1723 else
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
index cfe81c50529a..2db0b74b6fad 100644
--- a/drivers/scsi/lpfc/lpfc_disc.h
+++ b/drivers/scsi/lpfc/lpfc_disc.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -73,6 +73,12 @@ struct lpfc_nodelist {
73 uint8_t nlp_fcp_info; /* class info, bits 0-3 */ 73 uint8_t nlp_fcp_info; /* class info, bits 0-3 */
74#define NLP_FCP_2_DEVICE 0x10 /* FCP-2 device */ 74#define NLP_FCP_2_DEVICE 0x10 /* FCP-2 device */
75 75
76 uint16_t nlp_usg_map; /* ndlp management usage bitmap */
77#define NLP_USG_NODE_ACT_BIT 0x1 /* Indicate ndlp is actively used */
78#define NLP_USG_IACT_REQ_BIT 0x2 /* Request to inactivate ndlp */
79#define NLP_USG_FREE_REQ_BIT 0x4 /* Request to invoke ndlp memory free */
80#define NLP_USG_FREE_ACK_BIT 0x8 /* Indicate ndlp memory free invoked */
81
76 struct timer_list nlp_delayfunc; /* Used for delayed ELS cmds */ 82 struct timer_list nlp_delayfunc; /* Used for delayed ELS cmds */
77 struct fc_rport *rport; /* Corresponding FC transport 83 struct fc_rport *rport; /* Corresponding FC transport
78 port structure */ 84 port structure */
@@ -85,25 +91,51 @@ struct lpfc_nodelist {
85}; 91};
86 92
87/* Defines for nlp_flag (uint32) */ 93/* Defines for nlp_flag (uint32) */
88#define NLP_PLOGI_SND 0x20 /* sent PLOGI request for this entry */ 94#define NLP_PLOGI_SND 0x00000020 /* sent PLOGI request for this entry */
89#define NLP_PRLI_SND 0x40 /* sent PRLI request for this entry */ 95#define NLP_PRLI_SND 0x00000040 /* sent PRLI request for this entry */
90#define NLP_ADISC_SND 0x80 /* sent ADISC request for this entry */ 96#define NLP_ADISC_SND 0x00000080 /* sent ADISC request for this entry */
91#define NLP_LOGO_SND 0x100 /* sent LOGO request for this entry */ 97#define NLP_LOGO_SND 0x00000100 /* sent LOGO request for this entry */
92#define NLP_RNID_SND 0x400 /* sent RNID request for this entry */ 98#define NLP_RNID_SND 0x00000400 /* sent RNID request for this entry */
93#define NLP_ELS_SND_MASK 0x7e0 /* sent ELS request for this entry */ 99#define NLP_ELS_SND_MASK 0x000007e0 /* sent ELS request for this entry */
94#define NLP_DEFER_RM 0x10000 /* Remove this ndlp if no longer used */ 100#define NLP_DEFER_RM 0x00010000 /* Remove this ndlp if no longer used */
95#define NLP_DELAY_TMO 0x20000 /* delay timeout is running for node */ 101#define NLP_DELAY_TMO 0x00020000 /* delay timeout is running for node */
96#define NLP_NPR_2B_DISC 0x40000 /* node is included in num_disc_nodes */ 102#define NLP_NPR_2B_DISC 0x00040000 /* node is included in num_disc_nodes */
97#define NLP_RCV_PLOGI 0x80000 /* Rcv'ed PLOGI from remote system */ 103#define NLP_RCV_PLOGI 0x00080000 /* Rcv'ed PLOGI from remote system */
98#define NLP_LOGO_ACC 0x100000 /* Process LOGO after ACC completes */ 104#define NLP_LOGO_ACC 0x00100000 /* Process LOGO after ACC completes */
99#define NLP_TGT_NO_SCSIID 0x200000 /* good PRLI but no binding for scsid */ 105#define NLP_TGT_NO_SCSIID 0x00200000 /* good PRLI but no binding for scsid */
100#define NLP_ACC_REGLOGIN 0x1000000 /* Issue Reg Login after successful 106#define NLP_ACC_REGLOGIN 0x01000000 /* Issue Reg Login after successful
101 ACC */ 107 ACC */
102#define NLP_NPR_ADISC 0x2000000 /* Issue ADISC when dq'ed from 108#define NLP_NPR_ADISC 0x02000000 /* Issue ADISC when dq'ed from
103 NPR list */ 109 NPR list */
104#define NLP_RM_DFLT_RPI 0x4000000 /* need to remove leftover dflt RPI */ 110#define NLP_RM_DFLT_RPI 0x04000000 /* need to remove leftover dflt RPI */
105#define NLP_NODEV_REMOVE 0x8000000 /* Defer removal till discovery ends */ 111#define NLP_NODEV_REMOVE 0x08000000 /* Defer removal till discovery ends */
106#define NLP_TARGET_REMOVE 0x10000000 /* Target remove in process */ 112#define NLP_TARGET_REMOVE 0x10000000 /* Target remove in process */
113#define NLP_SC_REQ 0x20000000 /* Target requires authentication */
114
115/* ndlp usage management macros */
116#define NLP_CHK_NODE_ACT(ndlp) (((ndlp)->nlp_usg_map \
117 & NLP_USG_NODE_ACT_BIT) \
118 && \
119 !((ndlp)->nlp_usg_map \
120 & NLP_USG_FREE_ACK_BIT))
121#define NLP_SET_NODE_ACT(ndlp) ((ndlp)->nlp_usg_map \
122 |= NLP_USG_NODE_ACT_BIT)
123#define NLP_INT_NODE_ACT(ndlp) ((ndlp)->nlp_usg_map \
124 = NLP_USG_NODE_ACT_BIT)
125#define NLP_CLR_NODE_ACT(ndlp) ((ndlp)->nlp_usg_map \
126 &= ~NLP_USG_NODE_ACT_BIT)
127#define NLP_CHK_IACT_REQ(ndlp) ((ndlp)->nlp_usg_map \
128 & NLP_USG_IACT_REQ_BIT)
129#define NLP_SET_IACT_REQ(ndlp) ((ndlp)->nlp_usg_map \
130 |= NLP_USG_IACT_REQ_BIT)
131#define NLP_CHK_FREE_REQ(ndlp) ((ndlp)->nlp_usg_map \
132 & NLP_USG_FREE_REQ_BIT)
133#define NLP_SET_FREE_REQ(ndlp) ((ndlp)->nlp_usg_map \
134 |= NLP_USG_FREE_REQ_BIT)
135#define NLP_CHK_FREE_ACK(ndlp) ((ndlp)->nlp_usg_map \
136 & NLP_USG_FREE_ACK_BIT)
137#define NLP_SET_FREE_ACK(ndlp) ((ndlp)->nlp_usg_map \
138 |= NLP_USG_FREE_ACK_BIT)
107 139
108/* There are 4 different double linked lists nodelist entries can reside on. 140/* There are 4 different double linked lists nodelist entries can reside on.
109 * The Port Login (PLOGI) list and Address Discovery (ADISC) list are used 141 * The Port Login (PLOGI) list and Address Discovery (ADISC) list are used
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index c6b739dc6bc3..cbb68a942255 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -113,6 +113,7 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
113 113
114 if (elsiocb == NULL) 114 if (elsiocb == NULL)
115 return NULL; 115 return NULL;
116
116 icmd = &elsiocb->iocb; 117 icmd = &elsiocb->iocb;
117 118
118 /* fill in BDEs for command */ 119 /* fill in BDEs for command */
@@ -134,9 +135,8 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
134 if (!prsp || !prsp->virt) 135 if (!prsp || !prsp->virt)
135 goto els_iocb_free_prsp_exit; 136 goto els_iocb_free_prsp_exit;
136 INIT_LIST_HEAD(&prsp->list); 137 INIT_LIST_HEAD(&prsp->list);
137 } else { 138 } else
138 prsp = NULL; 139 prsp = NULL;
139 }
140 140
141 /* Allocate buffer for Buffer ptr list */ 141 /* Allocate buffer for Buffer ptr list */
142 pbuflist = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL); 142 pbuflist = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
@@ -246,7 +246,7 @@ lpfc_issue_fabric_reglogin(struct lpfc_vport *vport)
246 246
247 sp = &phba->fc_fabparam; 247 sp = &phba->fc_fabparam;
248 ndlp = lpfc_findnode_did(vport, Fabric_DID); 248 ndlp = lpfc_findnode_did(vport, Fabric_DID);
249 if (!ndlp) { 249 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) {
250 err = 1; 250 err = 1;
251 goto fail; 251 goto fail;
252 } 252 }
@@ -282,6 +282,9 @@ lpfc_issue_fabric_reglogin(struct lpfc_vport *vport)
282 282
283 mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; 283 mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login;
284 mbox->vport = vport; 284 mbox->vport = vport;
285 /* increment the reference count on ndlp to hold reference
286 * for the callback routine.
287 */
285 mbox->context2 = lpfc_nlp_get(ndlp); 288 mbox->context2 = lpfc_nlp_get(ndlp);
286 289
287 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); 290 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
@@ -293,6 +296,9 @@ lpfc_issue_fabric_reglogin(struct lpfc_vport *vport)
293 return 0; 296 return 0;
294 297
295fail_issue_reg_login: 298fail_issue_reg_login:
299 /* decrement the reference count on ndlp just incremented
300 * for the failed mbox command.
301 */
296 lpfc_nlp_put(ndlp); 302 lpfc_nlp_put(ndlp);
297 mp = (struct lpfc_dmabuf *) mbox->context1; 303 mp = (struct lpfc_dmabuf *) mbox->context1;
298 lpfc_mbuf_free(phba, mp->virt, mp->phys); 304 lpfc_mbuf_free(phba, mp->virt, mp->phys);
@@ -381,6 +387,8 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
381 */ 387 */
382 list_for_each_entry_safe(np, next_np, 388 list_for_each_entry_safe(np, next_np,
383 &vport->fc_nodes, nlp_listp) { 389 &vport->fc_nodes, nlp_listp) {
390 if (!NLP_CHK_NODE_ACT(ndlp))
391 continue;
384 if ((np->nlp_state != NLP_STE_NPR_NODE) || 392 if ((np->nlp_state != NLP_STE_NPR_NODE) ||
385 !(np->nlp_flag & NLP_NPR_ADISC)) 393 !(np->nlp_flag & NLP_NPR_ADISC))
386 continue; 394 continue;
@@ -456,6 +464,9 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
456 mempool_free(mbox, phba->mbox_mem_pool); 464 mempool_free(mbox, phba->mbox_mem_pool);
457 goto fail; 465 goto fail;
458 } 466 }
467 /* Decrement ndlp reference count indicating that ndlp can be
468 * safely released when other references to it are done.
469 */
459 lpfc_nlp_put(ndlp); 470 lpfc_nlp_put(ndlp);
460 471
461 ndlp = lpfc_findnode_did(vport, PT2PT_RemoteID); 472 ndlp = lpfc_findnode_did(vport, PT2PT_RemoteID);
@@ -467,22 +478,29 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
467 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); 478 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
468 if (!ndlp) 479 if (!ndlp)
469 goto fail; 480 goto fail;
470
471 lpfc_nlp_init(vport, ndlp, PT2PT_RemoteID); 481 lpfc_nlp_init(vport, ndlp, PT2PT_RemoteID);
482 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
483 ndlp = lpfc_enable_node(vport, ndlp,
484 NLP_STE_UNUSED_NODE);
485 if(!ndlp)
486 goto fail;
472 } 487 }
473 488
474 memcpy(&ndlp->nlp_portname, &sp->portName, 489 memcpy(&ndlp->nlp_portname, &sp->portName,
475 sizeof(struct lpfc_name)); 490 sizeof(struct lpfc_name));
476 memcpy(&ndlp->nlp_nodename, &sp->nodeName, 491 memcpy(&ndlp->nlp_nodename, &sp->nodeName,
477 sizeof(struct lpfc_name)); 492 sizeof(struct lpfc_name));
493 /* Set state will put ndlp onto node list if not already done */
478 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 494 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
479 spin_lock_irq(shost->host_lock); 495 spin_lock_irq(shost->host_lock);
480 ndlp->nlp_flag |= NLP_NPR_2B_DISC; 496 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
481 spin_unlock_irq(shost->host_lock); 497 spin_unlock_irq(shost->host_lock);
482 } else { 498 } else
483 /* This side will wait for the PLOGI */ 499 /* This side will wait for the PLOGI, decrement ndlp reference
500 * count indicating that ndlp can be released when other
501 * references to it are done.
502 */
484 lpfc_nlp_put(ndlp); 503 lpfc_nlp_put(ndlp);
485 }
486 504
487 /* If we are pt2pt with another NPort, force NPIV off! */ 505 /* If we are pt2pt with another NPort, force NPIV off! */
488 phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED; 506 phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED;
@@ -728,16 +746,21 @@ lpfc_initial_flogi(struct lpfc_vport *vport)
728 if (!ndlp) 746 if (!ndlp)
729 return 0; 747 return 0;
730 lpfc_nlp_init(vport, ndlp, Fabric_DID); 748 lpfc_nlp_init(vport, ndlp, Fabric_DID);
731 } else { 749 /* Put ndlp onto node list */
732 lpfc_dequeue_node(vport, ndlp); 750 lpfc_enqueue_node(vport, ndlp);
751 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
752 /* re-setup ndlp without removing from node list */
753 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
754 if (!ndlp)
755 return 0;
733 } 756 }
734 757
735 if (lpfc_issue_els_flogi(vport, ndlp, 0)) { 758 if (lpfc_issue_els_flogi(vport, ndlp, 0))
736 /* This decrement of reference count to node shall kick off 759 /* This decrement of reference count to node shall kick off
737 * the release of the node. 760 * the release of the node.
738 */ 761 */
739 lpfc_nlp_put(ndlp); 762 lpfc_nlp_put(ndlp);
740 } 763
741 return 1; 764 return 1;
742} 765}
743 766
@@ -755,9 +778,15 @@ lpfc_initial_fdisc(struct lpfc_vport *vport)
755 if (!ndlp) 778 if (!ndlp)
756 return 0; 779 return 0;
757 lpfc_nlp_init(vport, ndlp, Fabric_DID); 780 lpfc_nlp_init(vport, ndlp, Fabric_DID);
758 } else { 781 /* Put ndlp onto node list */
759 lpfc_dequeue_node(vport, ndlp); 782 lpfc_enqueue_node(vport, ndlp);
783 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
784 /* re-setup ndlp without removing from node list */
785 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
786 if (!ndlp)
787 return 0;
760 } 788 }
789
761 if (lpfc_issue_els_fdisc(vport, ndlp, 0)) { 790 if (lpfc_issue_els_fdisc(vport, ndlp, 0)) {
762 /* decrement node reference count to trigger the release of 791 /* decrement node reference count to trigger the release of
763 * the node. 792 * the node.
@@ -816,7 +845,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
816 */ 845 */
817 new_ndlp = lpfc_findnode_wwpn(vport, &sp->portName); 846 new_ndlp = lpfc_findnode_wwpn(vport, &sp->portName);
818 847
819 if (new_ndlp == ndlp) 848 if (new_ndlp == ndlp && NLP_CHK_NODE_ACT(new_ndlp))
820 return ndlp; 849 return ndlp;
821 850
822 if (!new_ndlp) { 851 if (!new_ndlp) {
@@ -827,8 +856,12 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
827 new_ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_ATOMIC); 856 new_ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_ATOMIC);
828 if (!new_ndlp) 857 if (!new_ndlp)
829 return ndlp; 858 return ndlp;
830
831 lpfc_nlp_init(vport, new_ndlp, ndlp->nlp_DID); 859 lpfc_nlp_init(vport, new_ndlp, ndlp->nlp_DID);
860 } else if (!NLP_CHK_NODE_ACT(new_ndlp)) {
861 new_ndlp = lpfc_enable_node(vport, new_ndlp,
862 NLP_STE_UNUSED_NODE);
863 if (!new_ndlp)
864 return ndlp;
832 } 865 }
833 866
834 lpfc_unreg_rpi(vport, new_ndlp); 867 lpfc_unreg_rpi(vport, new_ndlp);
@@ -839,6 +872,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
839 new_ndlp->nlp_flag |= NLP_NPR_2B_DISC; 872 new_ndlp->nlp_flag |= NLP_NPR_2B_DISC;
840 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 873 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
841 874
875 /* Set state will put new_ndlp on to node list if not already done */
842 lpfc_nlp_set_state(vport, new_ndlp, ndlp->nlp_state); 876 lpfc_nlp_set_state(vport, new_ndlp, ndlp->nlp_state);
843 877
844 /* Move this back to NPR state */ 878 /* Move this back to NPR state */
@@ -912,7 +946,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
912 irsp->un.elsreq64.remoteID); 946 irsp->un.elsreq64.remoteID);
913 947
914 ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID); 948 ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID);
915 if (!ndlp) { 949 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) {
916 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, 950 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
917 "0136 PLOGI completes to NPort x%x " 951 "0136 PLOGI completes to NPort x%x "
918 "with no ndlp. Data: x%x x%x x%x\n", 952 "with no ndlp. Data: x%x x%x x%x\n",
@@ -962,12 +996,11 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
962 } 996 }
963 /* PLOGI failed */ 997 /* PLOGI failed */
964 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ 998 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */
965 if (lpfc_error_lost_link(irsp)) { 999 if (lpfc_error_lost_link(irsp))
966 rc = NLP_STE_FREED_NODE; 1000 rc = NLP_STE_FREED_NODE;
967 } else { 1001 else
968 rc = lpfc_disc_state_machine(vport, ndlp, cmdiocb, 1002 rc = lpfc_disc_state_machine(vport, ndlp, cmdiocb,
969 NLP_EVT_CMPL_PLOGI); 1003 NLP_EVT_CMPL_PLOGI);
970 }
971 } else { 1004 } else {
972 /* Good status, call state machine */ 1005 /* Good status, call state machine */
973 prsp = list_entry(((struct lpfc_dmabuf *) 1006 prsp = list_entry(((struct lpfc_dmabuf *)
@@ -1015,8 +1048,10 @@ lpfc_issue_els_plogi(struct lpfc_vport *vport, uint32_t did, uint8_t retry)
1015 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */ 1048 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */
1016 1049
1017 ndlp = lpfc_findnode_did(vport, did); 1050 ndlp = lpfc_findnode_did(vport, did);
1018 /* If ndlp if not NULL, we will bump the reference count on it */ 1051 if (ndlp && !NLP_CHK_NODE_ACT(ndlp))
1052 ndlp = NULL;
1019 1053
1054 /* If ndlp is not NULL, we will bump the reference count on it */
1020 cmdsize = (sizeof(uint32_t) + sizeof(struct serv_parm)); 1055 cmdsize = (sizeof(uint32_t) + sizeof(struct serv_parm));
1021 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, did, 1056 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, did,
1022 ELS_CMD_PLOGI); 1057 ELS_CMD_PLOGI);
@@ -1097,18 +1132,15 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1097 } 1132 }
1098 /* PRLI failed */ 1133 /* PRLI failed */
1099 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ 1134 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */
1100 if (lpfc_error_lost_link(irsp)) { 1135 if (lpfc_error_lost_link(irsp))
1101 goto out; 1136 goto out;
1102 } else { 1137 else
1103 lpfc_disc_state_machine(vport, ndlp, cmdiocb, 1138 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
1104 NLP_EVT_CMPL_PRLI); 1139 NLP_EVT_CMPL_PRLI);
1105 } 1140 } else
1106 } else {
1107 /* Good status, call state machine */ 1141 /* Good status, call state machine */
1108 lpfc_disc_state_machine(vport, ndlp, cmdiocb, 1142 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
1109 NLP_EVT_CMPL_PRLI); 1143 NLP_EVT_CMPL_PRLI);
1110 }
1111
1112out: 1144out:
1113 lpfc_els_free_iocb(phba, cmdiocb); 1145 lpfc_els_free_iocb(phba, cmdiocb);
1114 return; 1146 return;
@@ -1275,15 +1307,13 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1275 } 1307 }
1276 /* ADISC failed */ 1308 /* ADISC failed */
1277 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */ 1309 /* Do not call DSM for lpfc_els_abort'ed ELS cmds */
1278 if (!lpfc_error_lost_link(irsp)) { 1310 if (!lpfc_error_lost_link(irsp))
1279 lpfc_disc_state_machine(vport, ndlp, cmdiocb, 1311 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
1280 NLP_EVT_CMPL_ADISC); 1312 NLP_EVT_CMPL_ADISC);
1281 } 1313 } else
1282 } else {
1283 /* Good status, call state machine */ 1314 /* Good status, call state machine */
1284 lpfc_disc_state_machine(vport, ndlp, cmdiocb, 1315 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
1285 NLP_EVT_CMPL_ADISC); 1316 NLP_EVT_CMPL_ADISC);
1286 }
1287 1317
1288 if (disc && vport->num_disc_nodes) { 1318 if (disc && vport->num_disc_nodes) {
1289 /* Check to see if there are more ADISCs to be sent */ 1319 /* Check to see if there are more ADISCs to be sent */
@@ -1443,14 +1473,12 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1443 else 1473 else
1444 lpfc_disc_state_machine(vport, ndlp, cmdiocb, 1474 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
1445 NLP_EVT_CMPL_LOGO); 1475 NLP_EVT_CMPL_LOGO);
1446 } else { 1476 } else
1447 /* Good status, call state machine. 1477 /* Good status, call state machine.
1448 * This will unregister the rpi if needed. 1478 * This will unregister the rpi if needed.
1449 */ 1479 */
1450 lpfc_disc_state_machine(vport, ndlp, cmdiocb, 1480 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
1451 NLP_EVT_CMPL_LOGO); 1481 NLP_EVT_CMPL_LOGO);
1452 }
1453
1454out: 1482out:
1455 lpfc_els_free_iocb(phba, cmdiocb); 1483 lpfc_els_free_iocb(phba, cmdiocb);
1456 return; 1484 return;
@@ -1556,11 +1584,19 @@ lpfc_issue_els_scr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)
1556 psli = &phba->sli; 1584 psli = &phba->sli;
1557 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */ 1585 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */
1558 cmdsize = (sizeof(uint32_t) + sizeof(SCR)); 1586 cmdsize = (sizeof(uint32_t) + sizeof(SCR));
1559 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
1560 if (!ndlp)
1561 return 1;
1562 1587
1563 lpfc_nlp_init(vport, ndlp, nportid); 1588 ndlp = lpfc_findnode_did(vport, nportid);
1589 if (!ndlp) {
1590 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
1591 if (!ndlp)
1592 return 1;
1593 lpfc_nlp_init(vport, ndlp, nportid);
1594 lpfc_enqueue_node(vport, ndlp);
1595 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
1596 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
1597 if (!ndlp)
1598 return 1;
1599 }
1564 1600
1565 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, 1601 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
1566 ndlp->nlp_DID, ELS_CMD_SCR); 1602 ndlp->nlp_DID, ELS_CMD_SCR);
@@ -1623,11 +1659,19 @@ lpfc_issue_els_farpr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)
1623 psli = &phba->sli; 1659 psli = &phba->sli;
1624 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */ 1660 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */
1625 cmdsize = (sizeof(uint32_t) + sizeof(FARP)); 1661 cmdsize = (sizeof(uint32_t) + sizeof(FARP));
1626 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
1627 if (!ndlp)
1628 return 1;
1629 1662
1630 lpfc_nlp_init(vport, ndlp, nportid); 1663 ndlp = lpfc_findnode_did(vport, nportid);
1664 if (!ndlp) {
1665 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
1666 if (!ndlp)
1667 return 1;
1668 lpfc_nlp_init(vport, ndlp, nportid);
1669 lpfc_enqueue_node(vport, ndlp);
1670 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
1671 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
1672 if (!ndlp)
1673 return 1;
1674 }
1631 1675
1632 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, 1676 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
1633 ndlp->nlp_DID, ELS_CMD_RNID); 1677 ndlp->nlp_DID, ELS_CMD_RNID);
@@ -1657,7 +1701,7 @@ lpfc_issue_els_farpr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)
1657 memcpy(&fp->RportName, &vport->fc_portname, sizeof(struct lpfc_name)); 1701 memcpy(&fp->RportName, &vport->fc_portname, sizeof(struct lpfc_name));
1658 memcpy(&fp->RnodeName, &vport->fc_nodename, sizeof(struct lpfc_name)); 1702 memcpy(&fp->RnodeName, &vport->fc_nodename, sizeof(struct lpfc_name));
1659 ondlp = lpfc_findnode_did(vport, nportid); 1703 ondlp = lpfc_findnode_did(vport, nportid);
1660 if (ondlp) { 1704 if (ondlp && NLP_CHK_NODE_ACT(ondlp)) {
1661 memcpy(&fp->OportName, &ondlp->nlp_portname, 1705 memcpy(&fp->OportName, &ondlp->nlp_portname,
1662 sizeof(struct lpfc_name)); 1706 sizeof(struct lpfc_name));
1663 memcpy(&fp->OnodeName, &ondlp->nlp_nodename, 1707 memcpy(&fp->OnodeName, &ondlp->nlp_nodename,
@@ -1690,6 +1734,7 @@ void
1690lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp) 1734lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp)
1691{ 1735{
1692 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 1736 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1737 struct lpfc_work_evt *evtp;
1693 1738
1694 spin_lock_irq(shost->host_lock); 1739 spin_lock_irq(shost->host_lock);
1695 nlp->nlp_flag &= ~NLP_DELAY_TMO; 1740 nlp->nlp_flag &= ~NLP_DELAY_TMO;
@@ -1697,8 +1742,12 @@ lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp)
1697 del_timer_sync(&nlp->nlp_delayfunc); 1742 del_timer_sync(&nlp->nlp_delayfunc);
1698 nlp->nlp_last_elscmd = 0; 1743 nlp->nlp_last_elscmd = 0;
1699 1744
1700 if (!list_empty(&nlp->els_retry_evt.evt_listp)) 1745 if (!list_empty(&nlp->els_retry_evt.evt_listp)) {
1701 list_del_init(&nlp->els_retry_evt.evt_listp); 1746 list_del_init(&nlp->els_retry_evt.evt_listp);
1747 /* Decrement nlp reference count held for the delayed retry */
1748 evtp = &nlp->els_retry_evt;
1749 lpfc_nlp_put((struct lpfc_nodelist *)evtp->evt_arg1);
1750 }
1702 1751
1703 if (nlp->nlp_flag & NLP_NPR_2B_DISC) { 1752 if (nlp->nlp_flag & NLP_NPR_2B_DISC) {
1704 spin_lock_irq(shost->host_lock); 1753 spin_lock_irq(shost->host_lock);
@@ -1842,13 +1891,14 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1842 cmd = *elscmd++; 1891 cmd = *elscmd++;
1843 } 1892 }
1844 1893
1845 if (ndlp) 1894 if (ndlp && NLP_CHK_NODE_ACT(ndlp))
1846 did = ndlp->nlp_DID; 1895 did = ndlp->nlp_DID;
1847 else { 1896 else {
1848 /* We should only hit this case for retrying PLOGI */ 1897 /* We should only hit this case for retrying PLOGI */
1849 did = irsp->un.elsreq64.remoteID; 1898 did = irsp->un.elsreq64.remoteID;
1850 ndlp = lpfc_findnode_did(vport, did); 1899 ndlp = lpfc_findnode_did(vport, did);
1851 if (!ndlp && (cmd != ELS_CMD_PLOGI)) 1900 if ((!ndlp || !NLP_CHK_NODE_ACT(ndlp))
1901 && (cmd != ELS_CMD_PLOGI))
1852 return 1; 1902 return 1;
1853 } 1903 }
1854 1904
@@ -1870,18 +1920,15 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1870 break; 1920 break;
1871 1921
1872 case IOERR_ILLEGAL_COMMAND: 1922 case IOERR_ILLEGAL_COMMAND:
1873 if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) && 1923 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
1874 (cmd == ELS_CMD_FDISC)) { 1924 "0124 Retry illegal cmd x%x "
1875 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, 1925 "retry:x%x delay:x%x\n",
1876 "0124 FDISC failed (3/6) " 1926 cmd, cmdiocb->retry, delay);
1877 "retrying...\n"); 1927 retry = 1;
1878 lpfc_mbx_unreg_vpi(vport); 1928 /* All command's retry policy */
1879 retry = 1; 1929 maxretry = 8;
1880 /* FDISC retry policy */ 1930 if (cmdiocb->retry > 2)
1881 maxretry = 48; 1931 delay = 1000;
1882 if (cmdiocb->retry >= 32)
1883 delay = 1000;
1884 }
1885 break; 1932 break;
1886 1933
1887 case IOERR_NO_RESOURCES: 1934 case IOERR_NO_RESOURCES:
@@ -1967,6 +2014,17 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1967 break; 2014 break;
1968 2015
1969 case LSRJT_LOGICAL_ERR: 2016 case LSRJT_LOGICAL_ERR:
2017 /* There are some cases where switches return this
2018 * error when they are not ready and should be returning
2019 * Logical Busy. We should delay every time.
2020 */
2021 if (cmd == ELS_CMD_FDISC &&
2022 stat.un.b.lsRjtRsnCodeExp == LSEXP_PORT_LOGIN_REQ) {
2023 maxretry = 3;
2024 delay = 1000;
2025 retry = 1;
2026 break;
2027 }
1970 case LSRJT_PROTOCOL_ERR: 2028 case LSRJT_PROTOCOL_ERR:
1971 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && 2029 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
1972 (cmd == ELS_CMD_FDISC) && 2030 (cmd == ELS_CMD_FDISC) &&
@@ -1996,7 +2054,8 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1996 retry = 1; 2054 retry = 1;
1997 2055
1998 if ((cmd == ELS_CMD_FLOGI) && 2056 if ((cmd == ELS_CMD_FLOGI) &&
1999 (phba->fc_topology != TOPOLOGY_LOOP)) { 2057 (phba->fc_topology != TOPOLOGY_LOOP) &&
2058 !lpfc_error_lost_link(irsp)) {
2000 /* FLOGI retry policy */ 2059 /* FLOGI retry policy */
2001 retry = 1; 2060 retry = 1;
2002 maxretry = 48; 2061 maxretry = 48;
@@ -2322,6 +2381,9 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2322 if ((rspiocb->iocb.ulpStatus == 0) 2381 if ((rspiocb->iocb.ulpStatus == 0)
2323 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { 2382 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) {
2324 lpfc_unreg_rpi(vport, ndlp); 2383 lpfc_unreg_rpi(vport, ndlp);
2384 /* Increment reference count to ndlp to hold the
2385 * reference to ndlp for the callback function.
2386 */
2325 mbox->context2 = lpfc_nlp_get(ndlp); 2387 mbox->context2 = lpfc_nlp_get(ndlp);
2326 mbox->vport = vport; 2388 mbox->vport = vport;
2327 if (ndlp->nlp_flag & NLP_RM_DFLT_RPI) { 2389 if (ndlp->nlp_flag & NLP_RM_DFLT_RPI) {
@@ -2335,9 +2397,13 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2335 NLP_STE_REG_LOGIN_ISSUE); 2397 NLP_STE_REG_LOGIN_ISSUE);
2336 } 2398 }
2337 if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) 2399 if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT)
2338 != MBX_NOT_FINISHED) { 2400 != MBX_NOT_FINISHED)
2339 goto out; 2401 goto out;
2340 } 2402 else
2403 /* Decrement the ndlp reference count we
2404 * set for this failed mailbox command.
2405 */
2406 lpfc_nlp_put(ndlp);
2341 2407
2342 /* ELS rsp: Cannot issue reg_login for <NPortid> */ 2408 /* ELS rsp: Cannot issue reg_login for <NPortid> */
2343 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, 2409 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
@@ -2796,6 +2862,8 @@ lpfc_els_disc_adisc(struct lpfc_vport *vport)
2796 2862
2797 /* go thru NPR nodes and issue any remaining ELS ADISCs */ 2863 /* go thru NPR nodes and issue any remaining ELS ADISCs */
2798 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 2864 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
2865 if (!NLP_CHK_NODE_ACT(ndlp))
2866 continue;
2799 if (ndlp->nlp_state == NLP_STE_NPR_NODE && 2867 if (ndlp->nlp_state == NLP_STE_NPR_NODE &&
2800 (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && 2868 (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 &&
2801 (ndlp->nlp_flag & NLP_NPR_ADISC) != 0) { 2869 (ndlp->nlp_flag & NLP_NPR_ADISC) != 0) {
@@ -2833,6 +2901,8 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport)
2833 2901
2834 /* go thru NPR nodes and issue any remaining ELS PLOGIs */ 2902 /* go thru NPR nodes and issue any remaining ELS PLOGIs */
2835 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 2903 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
2904 if (!NLP_CHK_NODE_ACT(ndlp))
2905 continue;
2836 if (ndlp->nlp_state == NLP_STE_NPR_NODE && 2906 if (ndlp->nlp_state == NLP_STE_NPR_NODE &&
2837 (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && 2907 (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 &&
2838 (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 && 2908 (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 &&
@@ -2869,6 +2939,16 @@ lpfc_els_flush_rscn(struct lpfc_vport *vport)
2869 struct lpfc_hba *phba = vport->phba; 2939 struct lpfc_hba *phba = vport->phba;
2870 int i; 2940 int i;
2871 2941
2942 spin_lock_irq(shost->host_lock);
2943 if (vport->fc_rscn_flush) {
2944 /* Another thread is walking fc_rscn_id_list on this vport */
2945 spin_unlock_irq(shost->host_lock);
2946 return;
2947 }
2948 /* Indicate we are walking lpfc_els_flush_rscn on this vport */
2949 vport->fc_rscn_flush = 1;
2950 spin_unlock_irq(shost->host_lock);
2951
2872 for (i = 0; i < vport->fc_rscn_id_cnt; i++) { 2952 for (i = 0; i < vport->fc_rscn_id_cnt; i++) {
2873 lpfc_in_buf_free(phba, vport->fc_rscn_id_list[i]); 2953 lpfc_in_buf_free(phba, vport->fc_rscn_id_list[i]);
2874 vport->fc_rscn_id_list[i] = NULL; 2954 vport->fc_rscn_id_list[i] = NULL;
@@ -2878,6 +2958,8 @@ lpfc_els_flush_rscn(struct lpfc_vport *vport)
2878 vport->fc_flag &= ~(FC_RSCN_MODE | FC_RSCN_DISCOVERY); 2958 vport->fc_flag &= ~(FC_RSCN_MODE | FC_RSCN_DISCOVERY);
2879 spin_unlock_irq(shost->host_lock); 2959 spin_unlock_irq(shost->host_lock);
2880 lpfc_can_disctmo(vport); 2960 lpfc_can_disctmo(vport);
2961 /* Indicate we are done walking this fc_rscn_id_list */
2962 vport->fc_rscn_flush = 0;
2881} 2963}
2882 2964
2883int 2965int
@@ -2887,6 +2969,7 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)
2887 D_ID rscn_did; 2969 D_ID rscn_did;
2888 uint32_t *lp; 2970 uint32_t *lp;
2889 uint32_t payload_len, i; 2971 uint32_t payload_len, i;
2972 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
2890 2973
2891 ns_did.un.word = did; 2974 ns_did.un.word = did;
2892 2975
@@ -2898,6 +2981,15 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)
2898 if (vport->fc_flag & FC_RSCN_DISCOVERY) 2981 if (vport->fc_flag & FC_RSCN_DISCOVERY)
2899 return did; 2982 return did;
2900 2983
2984 spin_lock_irq(shost->host_lock);
2985 if (vport->fc_rscn_flush) {
2986 /* Another thread is walking fc_rscn_id_list on this vport */
2987 spin_unlock_irq(shost->host_lock);
2988 return 0;
2989 }
2990 /* Indicate we are walking fc_rscn_id_list on this vport */
2991 vport->fc_rscn_flush = 1;
2992 spin_unlock_irq(shost->host_lock);
2901 for (i = 0; i < vport->fc_rscn_id_cnt; i++) { 2993 for (i = 0; i < vport->fc_rscn_id_cnt; i++) {
2902 lp = vport->fc_rscn_id_list[i]->virt; 2994 lp = vport->fc_rscn_id_list[i]->virt;
2903 payload_len = be32_to_cpu(*lp++ & ~ELS_CMD_MASK); 2995 payload_len = be32_to_cpu(*lp++ & ~ELS_CMD_MASK);
@@ -2908,16 +3000,16 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)
2908 switch (rscn_did.un.b.resv) { 3000 switch (rscn_did.un.b.resv) {
2909 case 0: /* Single N_Port ID effected */ 3001 case 0: /* Single N_Port ID effected */
2910 if (ns_did.un.word == rscn_did.un.word) 3002 if (ns_did.un.word == rscn_did.un.word)
2911 return did; 3003 goto return_did_out;
2912 break; 3004 break;
2913 case 1: /* Whole N_Port Area effected */ 3005 case 1: /* Whole N_Port Area effected */
2914 if ((ns_did.un.b.domain == rscn_did.un.b.domain) 3006 if ((ns_did.un.b.domain == rscn_did.un.b.domain)
2915 && (ns_did.un.b.area == rscn_did.un.b.area)) 3007 && (ns_did.un.b.area == rscn_did.un.b.area))
2916 return did; 3008 goto return_did_out;
2917 break; 3009 break;
2918 case 2: /* Whole N_Port Domain effected */ 3010 case 2: /* Whole N_Port Domain effected */
2919 if (ns_did.un.b.domain == rscn_did.un.b.domain) 3011 if (ns_did.un.b.domain == rscn_did.un.b.domain)
2920 return did; 3012 goto return_did_out;
2921 break; 3013 break;
2922 default: 3014 default:
2923 /* Unknown Identifier in RSCN node */ 3015 /* Unknown Identifier in RSCN node */
@@ -2926,11 +3018,17 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)
2926 "RSCN payload Data: x%x\n", 3018 "RSCN payload Data: x%x\n",
2927 rscn_did.un.word); 3019 rscn_did.un.word);
2928 case 3: /* Whole Fabric effected */ 3020 case 3: /* Whole Fabric effected */
2929 return did; 3021 goto return_did_out;
2930 } 3022 }
2931 } 3023 }
2932 } 3024 }
3025 /* Indicate we are done with walking fc_rscn_id_list on this vport */
3026 vport->fc_rscn_flush = 0;
2933 return 0; 3027 return 0;
3028return_did_out:
3029 /* Indicate we are done with walking fc_rscn_id_list on this vport */
3030 vport->fc_rscn_flush = 0;
3031 return did;
2934} 3032}
2935 3033
2936static int 3034static int
@@ -2943,7 +3041,8 @@ lpfc_rscn_recovery_check(struct lpfc_vport *vport)
2943 */ 3041 */
2944 3042
2945 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { 3043 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
2946 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE || 3044 if (!NLP_CHK_NODE_ACT(ndlp) ||
3045 ndlp->nlp_state == NLP_STE_UNUSED_NODE ||
2947 lpfc_rscn_payload_check(vport, ndlp->nlp_DID) == 0) 3046 lpfc_rscn_payload_check(vport, ndlp->nlp_DID) == 0)
2948 continue; 3047 continue;
2949 3048
@@ -2971,7 +3070,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2971 uint32_t *lp, *datap; 3070 uint32_t *lp, *datap;
2972 IOCB_t *icmd; 3071 IOCB_t *icmd;
2973 uint32_t payload_len, length, nportid, *cmd; 3072 uint32_t payload_len, length, nportid, *cmd;
2974 int rscn_cnt = vport->fc_rscn_id_cnt; 3073 int rscn_cnt;
2975 int rscn_id = 0, hba_id = 0; 3074 int rscn_id = 0, hba_id = 0;
2976 int i; 3075 int i;
2977 3076
@@ -2984,7 +3083,8 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2984 /* RSCN received */ 3083 /* RSCN received */
2985 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 3084 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2986 "0214 RSCN received Data: x%x x%x x%x x%x\n", 3085 "0214 RSCN received Data: x%x x%x x%x x%x\n",
2987 vport->fc_flag, payload_len, *lp, rscn_cnt); 3086 vport->fc_flag, payload_len, *lp,
3087 vport->fc_rscn_id_cnt);
2988 for (i = 0; i < payload_len/sizeof(uint32_t); i++) 3088 for (i = 0; i < payload_len/sizeof(uint32_t); i++)
2989 fc_host_post_event(shost, fc_get_event_number(), 3089 fc_host_post_event(shost, fc_get_event_number(),
2990 FCH_EVT_RSCN, lp[i]); 3090 FCH_EVT_RSCN, lp[i]);
@@ -3022,7 +3122,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3022 "0214 Ignore RSCN " 3122 "0214 Ignore RSCN "
3023 "Data: x%x x%x x%x x%x\n", 3123 "Data: x%x x%x x%x x%x\n",
3024 vport->fc_flag, payload_len, 3124 vport->fc_flag, payload_len,
3025 *lp, rscn_cnt); 3125 *lp, vport->fc_rscn_id_cnt);
3026 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 3126 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
3027 "RCV RSCN vport: did:x%x/ste:x%x flg:x%x", 3127 "RCV RSCN vport: did:x%x/ste:x%x flg:x%x",
3028 ndlp->nlp_DID, vport->port_state, 3128 ndlp->nlp_DID, vport->port_state,
@@ -3034,6 +3134,18 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3034 } 3134 }
3035 } 3135 }
3036 3136
3137 spin_lock_irq(shost->host_lock);
3138 if (vport->fc_rscn_flush) {
3139 /* Another thread is walking fc_rscn_id_list on this vport */
3140 spin_unlock_irq(shost->host_lock);
3141 vport->fc_flag |= FC_RSCN_DISCOVERY;
3142 return 0;
3143 }
3144 /* Indicate we are walking fc_rscn_id_list on this vport */
3145 vport->fc_rscn_flush = 1;
3146 spin_unlock_irq(shost->host_lock);
3147 /* Get the array count after sucessfully have the token */
3148 rscn_cnt = vport->fc_rscn_id_cnt;
3037 /* If we are already processing an RSCN, save the received 3149 /* If we are already processing an RSCN, save the received
3038 * RSCN payload buffer, cmdiocb->context2 to process later. 3150 * RSCN payload buffer, cmdiocb->context2 to process later.
3039 */ 3151 */
@@ -3055,7 +3167,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3055 if ((rscn_cnt) && 3167 if ((rscn_cnt) &&
3056 (payload_len + length <= LPFC_BPL_SIZE)) { 3168 (payload_len + length <= LPFC_BPL_SIZE)) {
3057 *cmd &= ELS_CMD_MASK; 3169 *cmd &= ELS_CMD_MASK;
3058 *cmd |= be32_to_cpu(payload_len + length); 3170 *cmd |= cpu_to_be32(payload_len + length);
3059 memcpy(((uint8_t *)cmd) + length, lp, 3171 memcpy(((uint8_t *)cmd) + length, lp,
3060 payload_len); 3172 payload_len);
3061 } else { 3173 } else {
@@ -3066,7 +3178,6 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3066 */ 3178 */
3067 cmdiocb->context2 = NULL; 3179 cmdiocb->context2 = NULL;
3068 } 3180 }
3069
3070 /* Deferred RSCN */ 3181 /* Deferred RSCN */
3071 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 3182 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
3072 "0235 Deferred RSCN " 3183 "0235 Deferred RSCN "
@@ -3083,9 +3194,10 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3083 vport->fc_rscn_id_cnt, vport->fc_flag, 3194 vport->fc_rscn_id_cnt, vport->fc_flag,
3084 vport->port_state); 3195 vport->port_state);
3085 } 3196 }
3197 /* Indicate we are done walking fc_rscn_id_list on this vport */
3198 vport->fc_rscn_flush = 0;
3086 /* Send back ACC */ 3199 /* Send back ACC */
3087 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); 3200 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
3088
3089 /* send RECOVERY event for ALL nodes that match RSCN payload */ 3201 /* send RECOVERY event for ALL nodes that match RSCN payload */
3090 lpfc_rscn_recovery_check(vport); 3202 lpfc_rscn_recovery_check(vport);
3091 spin_lock_irq(shost->host_lock); 3203 spin_lock_irq(shost->host_lock);
@@ -3093,7 +3205,6 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3093 spin_unlock_irq(shost->host_lock); 3205 spin_unlock_irq(shost->host_lock);
3094 return 0; 3206 return 0;
3095 } 3207 }
3096
3097 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL, 3208 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
3098 "RCV RSCN: did:x%x/ste:x%x flg:x%x", 3209 "RCV RSCN: did:x%x/ste:x%x flg:x%x",
3099 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag); 3210 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
@@ -3102,20 +3213,18 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3102 vport->fc_flag |= FC_RSCN_MODE; 3213 vport->fc_flag |= FC_RSCN_MODE;
3103 spin_unlock_irq(shost->host_lock); 3214 spin_unlock_irq(shost->host_lock);
3104 vport->fc_rscn_id_list[vport->fc_rscn_id_cnt++] = pcmd; 3215 vport->fc_rscn_id_list[vport->fc_rscn_id_cnt++] = pcmd;
3216 /* Indicate we are done walking fc_rscn_id_list on this vport */
3217 vport->fc_rscn_flush = 0;
3105 /* 3218 /*
3106 * If we zero, cmdiocb->context2, the calling routine will 3219 * If we zero, cmdiocb->context2, the calling routine will
3107 * not try to free it. 3220 * not try to free it.
3108 */ 3221 */
3109 cmdiocb->context2 = NULL; 3222 cmdiocb->context2 = NULL;
3110
3111 lpfc_set_disctmo(vport); 3223 lpfc_set_disctmo(vport);
3112
3113 /* Send back ACC */ 3224 /* Send back ACC */
3114 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); 3225 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
3115
3116 /* send RECOVERY event for ALL nodes that match RSCN payload */ 3226 /* send RECOVERY event for ALL nodes that match RSCN payload */
3117 lpfc_rscn_recovery_check(vport); 3227 lpfc_rscn_recovery_check(vport);
3118
3119 return lpfc_els_handle_rscn(vport); 3228 return lpfc_els_handle_rscn(vport);
3120} 3229}
3121 3230
@@ -3145,7 +3254,8 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport)
3145 vport->num_disc_nodes = 0; 3254 vport->num_disc_nodes = 0;
3146 3255
3147 ndlp = lpfc_findnode_did(vport, NameServer_DID); 3256 ndlp = lpfc_findnode_did(vport, NameServer_DID);
3148 if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { 3257 if (ndlp && NLP_CHK_NODE_ACT(ndlp)
3258 && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) {
3149 /* Good ndlp, issue CT Request to NameServer */ 3259 /* Good ndlp, issue CT Request to NameServer */
3150 if (lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, 0, 0) == 0) 3260 if (lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, 0, 0) == 0)
3151 /* Wait for NameServer query cmpl before we can 3261 /* Wait for NameServer query cmpl before we can
@@ -3155,25 +3265,35 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport)
3155 /* If login to NameServer does not exist, issue one */ 3265 /* If login to NameServer does not exist, issue one */
3156 /* Good status, issue PLOGI to NameServer */ 3266 /* Good status, issue PLOGI to NameServer */
3157 ndlp = lpfc_findnode_did(vport, NameServer_DID); 3267 ndlp = lpfc_findnode_did(vport, NameServer_DID);
3158 if (ndlp) 3268 if (ndlp && NLP_CHK_NODE_ACT(ndlp))
3159 /* Wait for NameServer login cmpl before we can 3269 /* Wait for NameServer login cmpl before we can
3160 continue */ 3270 continue */
3161 return 1; 3271 return 1;
3162 3272
3163 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); 3273 if (ndlp) {
3164 if (!ndlp) { 3274 ndlp = lpfc_enable_node(vport, ndlp,
3165 lpfc_els_flush_rscn(vport); 3275 NLP_STE_PLOGI_ISSUE);
3166 return 0; 3276 if (!ndlp) {
3277 lpfc_els_flush_rscn(vport);
3278 return 0;
3279 }
3280 ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE;
3167 } else { 3281 } else {
3282 ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
3283 if (!ndlp) {
3284 lpfc_els_flush_rscn(vport);
3285 return 0;
3286 }
3168 lpfc_nlp_init(vport, ndlp, NameServer_DID); 3287 lpfc_nlp_init(vport, ndlp, NameServer_DID);
3169 ndlp->nlp_type |= NLP_FABRIC;
3170 ndlp->nlp_prev_state = ndlp->nlp_state; 3288 ndlp->nlp_prev_state = ndlp->nlp_state;
3171 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); 3289 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
3172 lpfc_issue_els_plogi(vport, NameServer_DID, 0);
3173 /* Wait for NameServer login cmpl before we can
3174 continue */
3175 return 1;
3176 } 3290 }
3291 ndlp->nlp_type |= NLP_FABRIC;
3292 lpfc_issue_els_plogi(vport, NameServer_DID, 0);
3293 /* Wait for NameServer login cmpl before we can
3294 * continue
3295 */
3296 return 1;
3177 } 3297 }
3178 3298
3179 lpfc_els_flush_rscn(vport); 3299 lpfc_els_flush_rscn(vport);
@@ -3672,6 +3792,8 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3672 3792
3673 list_for_each_entry_safe(ndlp, next_ndlp, 3793 list_for_each_entry_safe(ndlp, next_ndlp,
3674 &vport->fc_nodes, nlp_listp) { 3794 &vport->fc_nodes, nlp_listp) {
3795 if (!NLP_CHK_NODE_ACT(ndlp))
3796 continue;
3675 if (ndlp->nlp_state != NLP_STE_NPR_NODE) 3797 if (ndlp->nlp_state != NLP_STE_NPR_NODE)
3676 continue; 3798 continue;
3677 if (ndlp->nlp_type & NLP_FABRIC) { 3799 if (ndlp->nlp_type & NLP_FABRIC) {
@@ -3697,6 +3819,8 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
3697 */ 3819 */
3698 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, 3820 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes,
3699 nlp_listp) { 3821 nlp_listp) {
3822 if (!NLP_CHK_NODE_ACT(ndlp))
3823 continue;
3700 if (ndlp->nlp_state != NLP_STE_NPR_NODE) 3824 if (ndlp->nlp_state != NLP_STE_NPR_NODE)
3701 continue; 3825 continue;
3702 3826
@@ -3936,7 +4060,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3936 uint32_t cmd, did, newnode, rjt_err = 0; 4060 uint32_t cmd, did, newnode, rjt_err = 0;
3937 IOCB_t *icmd = &elsiocb->iocb; 4061 IOCB_t *icmd = &elsiocb->iocb;
3938 4062
3939 if (vport == NULL || elsiocb->context2 == NULL) 4063 if (!vport || !(elsiocb->context2))
3940 goto dropit; 4064 goto dropit;
3941 4065
3942 newnode = 0; 4066 newnode = 0;
@@ -3971,14 +4095,20 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3971 lpfc_nlp_init(vport, ndlp, did); 4095 lpfc_nlp_init(vport, ndlp, did);
3972 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 4096 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
3973 newnode = 1; 4097 newnode = 1;
3974 if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { 4098 if ((did & Fabric_DID_MASK) == Fabric_DID_MASK)
3975 ndlp->nlp_type |= NLP_FABRIC; 4099 ndlp->nlp_type |= NLP_FABRIC;
4100 } else {
4101 if (!NLP_CHK_NODE_ACT(ndlp)) {
4102 ndlp = lpfc_enable_node(vport, ndlp,
4103 NLP_STE_UNUSED_NODE);
4104 if (!ndlp)
4105 goto dropit;
3976 } 4106 }
3977 }
3978 else {
3979 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) { 4107 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) {
3980 /* This is simular to the new node path */ 4108 /* This is simular to the new node path */
3981 lpfc_nlp_get(ndlp); 4109 ndlp = lpfc_nlp_get(ndlp);
4110 if (!ndlp)
4111 goto dropit;
3982 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 4112 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
3983 newnode = 1; 4113 newnode = 1;
3984 } 4114 }
@@ -3987,6 +4117,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3987 phba->fc_stat.elsRcvFrame++; 4117 phba->fc_stat.elsRcvFrame++;
3988 if (elsiocb->context1) 4118 if (elsiocb->context1)
3989 lpfc_nlp_put(elsiocb->context1); 4119 lpfc_nlp_put(elsiocb->context1);
4120
3990 elsiocb->context1 = lpfc_nlp_get(ndlp); 4121 elsiocb->context1 = lpfc_nlp_get(ndlp);
3991 elsiocb->vport = vport; 4122 elsiocb->vport = vport;
3992 4123
@@ -4007,8 +4138,15 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
4007 ndlp = lpfc_plogi_confirm_nport(phba, payload, ndlp); 4138 ndlp = lpfc_plogi_confirm_nport(phba, payload, ndlp);
4008 4139
4009 if (vport->port_state < LPFC_DISC_AUTH) { 4140 if (vport->port_state < LPFC_DISC_AUTH) {
4010 rjt_err = LSRJT_UNABLE_TPC; 4141 if (!(phba->pport->fc_flag & FC_PT2PT) ||
4011 break; 4142 (phba->pport->fc_flag & FC_PT2PT_PLOGI)) {
4143 rjt_err = LSRJT_UNABLE_TPC;
4144 break;
4145 }
4146 /* We get here, and drop thru, if we are PT2PT with
4147 * another NPort and the other side has initiated
4148 * the PLOGI before responding to our FLOGI.
4149 */
4012 } 4150 }
4013 4151
4014 shost = lpfc_shost_from_vport(vport); 4152 shost = lpfc_shost_from_vport(vport);
@@ -4251,15 +4389,15 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
4251 vport = lpfc_find_vport_by_vpid(phba, vpi); 4389 vport = lpfc_find_vport_by_vpid(phba, vpi);
4252 } 4390 }
4253 } 4391 }
4254 /* If there are no BDEs associated 4392 /* If there are no BDEs associated
4255 * with this IOCB, there is nothing to do. 4393 * with this IOCB, there is nothing to do.
4256 */ 4394 */
4257 if (icmd->ulpBdeCount == 0) 4395 if (icmd->ulpBdeCount == 0)
4258 return; 4396 return;
4259 4397
4260 /* type of ELS cmd is first 32bit word 4398 /* type of ELS cmd is first 32bit word
4261 * in packet 4399 * in packet
4262 */ 4400 */
4263 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { 4401 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
4264 elsiocb->context2 = bdeBuf1; 4402 elsiocb->context2 = bdeBuf1;
4265 } else { 4403 } else {
@@ -4314,6 +4452,18 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
4314 } 4452 }
4315 lpfc_nlp_init(vport, ndlp, NameServer_DID); 4453 lpfc_nlp_init(vport, ndlp, NameServer_DID);
4316 ndlp->nlp_type |= NLP_FABRIC; 4454 ndlp->nlp_type |= NLP_FABRIC;
4455 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
4456 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
4457 if (!ndlp) {
4458 if (phba->fc_topology == TOPOLOGY_LOOP) {
4459 lpfc_disc_start(vport);
4460 return;
4461 }
4462 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4463 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
4464 "0348 NameServer login: node freed\n");
4465 return;
4466 }
4317 } 4467 }
4318 4468
4319 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); 4469 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
@@ -4360,6 +4510,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
4360 switch (mb->mbxStatus) { 4510 switch (mb->mbxStatus) {
4361 case 0x11: /* unsupported feature */ 4511 case 0x11: /* unsupported feature */
4362 case 0x9603: /* max_vpi exceeded */ 4512 case 0x9603: /* max_vpi exceeded */
4513 case 0x9602: /* Link event since CLEAR_LA */
4363 /* giving up on vport registration */ 4514 /* giving up on vport registration */
4364 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4515 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4365 spin_lock_irq(shost->host_lock); 4516 spin_lock_irq(shost->host_lock);
@@ -4373,7 +4524,10 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
4373 spin_lock_irq(shost->host_lock); 4524 spin_lock_irq(shost->host_lock);
4374 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; 4525 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
4375 spin_unlock_irq(shost->host_lock); 4526 spin_unlock_irq(shost->host_lock);
4376 lpfc_initial_fdisc(vport); 4527 if (vport->port_type == LPFC_PHYSICAL_PORT)
4528 lpfc_initial_flogi(vport);
4529 else
4530 lpfc_initial_fdisc(vport);
4377 break; 4531 break;
4378 } 4532 }
4379 4533
@@ -4471,7 +4625,6 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4471 irsp->ulpStatus, irsp->un.ulpWord[4]); 4625 irsp->ulpStatus, irsp->un.ulpWord[4]);
4472 if (vport->fc_vport->vport_state == FC_VPORT_INITIALIZING) 4626 if (vport->fc_vport->vport_state == FC_VPORT_INITIALIZING)
4473 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 4627 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
4474
4475 lpfc_nlp_put(ndlp); 4628 lpfc_nlp_put(ndlp);
4476 /* giving up on FDISC. Cancel discovery timer */ 4629 /* giving up on FDISC. Cancel discovery timer */
4477 lpfc_can_disctmo(vport); 4630 lpfc_can_disctmo(vport);
@@ -4492,8 +4645,9 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4492 */ 4645 */
4493 list_for_each_entry_safe(np, next_np, 4646 list_for_each_entry_safe(np, next_np,
4494 &vport->fc_nodes, nlp_listp) { 4647 &vport->fc_nodes, nlp_listp) {
4495 if (np->nlp_state != NLP_STE_NPR_NODE 4648 if (!NLP_CHK_NODE_ACT(ndlp) ||
4496 || !(np->nlp_flag & NLP_NPR_ADISC)) 4649 (np->nlp_state != NLP_STE_NPR_NODE) ||
4650 !(np->nlp_flag & NLP_NPR_ADISC))
4497 continue; 4651 continue;
4498 spin_lock_irq(shost->host_lock); 4652 spin_lock_irq(shost->host_lock);
4499 np->nlp_flag &= ~NLP_NPR_ADISC; 4653 np->nlp_flag &= ~NLP_NPR_ADISC;
@@ -4599,6 +4753,8 @@ lpfc_cmpl_els_npiv_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4599{ 4753{
4600 struct lpfc_vport *vport = cmdiocb->vport; 4754 struct lpfc_vport *vport = cmdiocb->vport;
4601 IOCB_t *irsp; 4755 IOCB_t *irsp;
4756 struct lpfc_nodelist *ndlp;
4757 ndlp = (struct lpfc_nodelist *)cmdiocb->context1;
4602 4758
4603 irsp = &rspiocb->iocb; 4759 irsp = &rspiocb->iocb;
4604 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, 4760 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
@@ -4607,6 +4763,9 @@ lpfc_cmpl_els_npiv_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4607 4763
4608 lpfc_els_free_iocb(phba, cmdiocb); 4764 lpfc_els_free_iocb(phba, cmdiocb);
4609 vport->unreg_vpi_cmpl = VPORT_ERROR; 4765 vport->unreg_vpi_cmpl = VPORT_ERROR;
4766
4767 /* Trigger the release of the ndlp after logo */
4768 lpfc_nlp_put(ndlp);
4610} 4769}
4611 4770
4612int 4771int
@@ -4686,11 +4845,12 @@ lpfc_resume_fabric_iocbs(struct lpfc_hba *phba)
4686repeat: 4845repeat:
4687 iocb = NULL; 4846 iocb = NULL;
4688 spin_lock_irqsave(&phba->hbalock, iflags); 4847 spin_lock_irqsave(&phba->hbalock, iflags);
4689 /* Post any pending iocb to the SLI layer */ 4848 /* Post any pending iocb to the SLI layer */
4690 if (atomic_read(&phba->fabric_iocb_count) == 0) { 4849 if (atomic_read(&phba->fabric_iocb_count) == 0) {
4691 list_remove_head(&phba->fabric_iocb_list, iocb, typeof(*iocb), 4850 list_remove_head(&phba->fabric_iocb_list, iocb, typeof(*iocb),
4692 list); 4851 list);
4693 if (iocb) 4852 if (iocb)
4853 /* Increment fabric iocb count to hold the position */
4694 atomic_inc(&phba->fabric_iocb_count); 4854 atomic_inc(&phba->fabric_iocb_count);
4695 } 4855 }
4696 spin_unlock_irqrestore(&phba->hbalock, iflags); 4856 spin_unlock_irqrestore(&phba->hbalock, iflags);
@@ -4737,9 +4897,7 @@ lpfc_block_fabric_iocbs(struct lpfc_hba *phba)
4737 int blocked; 4897 int blocked;
4738 4898
4739 blocked = test_and_set_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags); 4899 blocked = test_and_set_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags);
4740 /* Start a timer to unblock fabric 4900 /* Start a timer to unblock fabric iocbs after 100ms */
4741 * iocbs after 100ms
4742 */
4743 if (!blocked) 4901 if (!blocked)
4744 mod_timer(&phba->fabric_block_timer, jiffies + HZ/10 ); 4902 mod_timer(&phba->fabric_block_timer, jiffies + HZ/10 );
4745 4903
@@ -4787,8 +4945,8 @@ lpfc_cmpl_fabric_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4787 4945
4788 atomic_dec(&phba->fabric_iocb_count); 4946 atomic_dec(&phba->fabric_iocb_count);
4789 if (!test_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags)) { 4947 if (!test_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags)) {
4790 /* Post any pending iocbs to HBA */ 4948 /* Post any pending iocbs to HBA */
4791 lpfc_resume_fabric_iocbs(phba); 4949 lpfc_resume_fabric_iocbs(phba);
4792 } 4950 }
4793} 4951}
4794 4952
@@ -4807,6 +4965,9 @@ lpfc_issue_fabric_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *iocb)
4807 ready = atomic_read(&phba->fabric_iocb_count) == 0 && 4965 ready = atomic_read(&phba->fabric_iocb_count) == 0 &&
4808 !test_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags); 4966 !test_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags);
4809 4967
4968 if (ready)
4969 /* Increment fabric iocb count to hold the position */
4970 atomic_inc(&phba->fabric_iocb_count);
4810 spin_unlock_irqrestore(&phba->hbalock, iflags); 4971 spin_unlock_irqrestore(&phba->hbalock, iflags);
4811 if (ready) { 4972 if (ready) {
4812 iocb->fabric_iocb_cmpl = iocb->iocb_cmpl; 4973 iocb->fabric_iocb_cmpl = iocb->iocb_cmpl;
@@ -4817,7 +4978,6 @@ lpfc_issue_fabric_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *iocb)
4817 "Fabric sched2: ste:x%x", 4978 "Fabric sched2: ste:x%x",
4818 iocb->vport->port_state, 0, 0); 4979 iocb->vport->port_state, 0, 0);
4819 4980
4820 atomic_inc(&phba->fabric_iocb_count);
4821 ret = lpfc_sli_issue_iocb(phba, pring, iocb, 0); 4981 ret = lpfc_sli_issue_iocb(phba, pring, iocb, 0);
4822 4982
4823 if (ret == IOCB_ERROR) { 4983 if (ret == IOCB_ERROR) {
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index dc042bd97baa..976653440fba 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -272,9 +272,8 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
272 if (!(vport->load_flag & FC_UNLOADING) && 272 if (!(vport->load_flag & FC_UNLOADING) &&
273 !(ndlp->nlp_flag & NLP_DELAY_TMO) && 273 !(ndlp->nlp_flag & NLP_DELAY_TMO) &&
274 !(ndlp->nlp_flag & NLP_NPR_2B_DISC) && 274 !(ndlp->nlp_flag & NLP_NPR_2B_DISC) &&
275 (ndlp->nlp_state != NLP_STE_UNMAPPED_NODE)) { 275 (ndlp->nlp_state != NLP_STE_UNMAPPED_NODE))
276 lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM); 276 lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
277 }
278} 277}
279 278
280 279
@@ -566,9 +565,10 @@ lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove)
566 int rc; 565 int rc;
567 566
568 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 567 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
568 if (!NLP_CHK_NODE_ACT(ndlp))
569 continue;
569 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) 570 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
570 continue; 571 continue;
571
572 if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) || 572 if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) ||
573 ((vport->port_type == LPFC_NPIV_PORT) && 573 ((vport->port_type == LPFC_NPIV_PORT) &&
574 (ndlp->nlp_DID == NameServer_DID))) 574 (ndlp->nlp_DID == NameServer_DID)))
@@ -629,9 +629,8 @@ lpfc_linkdown(struct lpfc_hba *phba)
629 LPFC_MBOXQ_t *mb; 629 LPFC_MBOXQ_t *mb;
630 int i; 630 int i;
631 631
632 if (phba->link_state == LPFC_LINK_DOWN) { 632 if (phba->link_state == LPFC_LINK_DOWN)
633 return 0; 633 return 0;
634 }
635 spin_lock_irq(&phba->hbalock); 634 spin_lock_irq(&phba->hbalock);
636 if (phba->link_state > LPFC_LINK_DOWN) { 635 if (phba->link_state > LPFC_LINK_DOWN) {
637 phba->link_state = LPFC_LINK_DOWN; 636 phba->link_state = LPFC_LINK_DOWN;
@@ -684,20 +683,21 @@ lpfc_linkup_cleanup_nodes(struct lpfc_vport *vport)
684 struct lpfc_nodelist *ndlp; 683 struct lpfc_nodelist *ndlp;
685 684
686 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { 685 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
686 if (!NLP_CHK_NODE_ACT(ndlp))
687 continue;
687 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) 688 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
688 continue; 689 continue;
689
690 if (ndlp->nlp_type & NLP_FABRIC) { 690 if (ndlp->nlp_type & NLP_FABRIC) {
691 /* On Linkup its safe to clean up the ndlp 691 /* On Linkup its safe to clean up the ndlp
692 * from Fabric connections. 692 * from Fabric connections.
693 */ 693 */
694 if (ndlp->nlp_DID != Fabric_DID) 694 if (ndlp->nlp_DID != Fabric_DID)
695 lpfc_unreg_rpi(vport, ndlp); 695 lpfc_unreg_rpi(vport, ndlp);
696 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); 696 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
697 } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { 697 } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) {
698 /* Fail outstanding IO now since device is 698 /* Fail outstanding IO now since device is
699 * marked for PLOGI. 699 * marked for PLOGI.
700 */ 700 */
701 lpfc_unreg_rpi(vport, ndlp); 701 lpfc_unreg_rpi(vport, ndlp);
702 } 702 }
703 } 703 }
@@ -799,21 +799,9 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
799 writel(control, phba->HCregaddr); 799 writel(control, phba->HCregaddr);
800 readl(phba->HCregaddr); /* flush */ 800 readl(phba->HCregaddr); /* flush */
801 spin_unlock_irq(&phba->hbalock); 801 spin_unlock_irq(&phba->hbalock);
802 mempool_free(pmb, phba->mbox_mem_pool);
802 return; 803 return;
803 804
804 vport->num_disc_nodes = 0;
805 /* go thru NPR nodes and issue ELS PLOGIs */
806 if (vport->fc_npr_cnt)
807 lpfc_els_disc_plogi(vport);
808
809 if (!vport->num_disc_nodes) {
810 spin_lock_irq(shost->host_lock);
811 vport->fc_flag &= ~FC_NDISC_ACTIVE;
812 spin_unlock_irq(shost->host_lock);
813 }
814
815 vport->port_state = LPFC_VPORT_READY;
816
817out: 805out:
818 /* Device Discovery completes */ 806 /* Device Discovery completes */
819 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 807 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
@@ -1133,7 +1121,7 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1133 if (la->attType == AT_LINK_UP) { 1121 if (la->attType == AT_LINK_UP) {
1134 phba->fc_stat.LinkUp++; 1122 phba->fc_stat.LinkUp++;
1135 if (phba->link_flag & LS_LOOPBACK_MODE) { 1123 if (phba->link_flag & LS_LOOPBACK_MODE) {
1136 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, 1124 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
1137 "1306 Link Up Event in loop back mode " 1125 "1306 Link Up Event in loop back mode "
1138 "x%x received Data: x%x x%x x%x x%x\n", 1126 "x%x received Data: x%x x%x x%x x%x\n",
1139 la->eventTag, phba->fc_eventTag, 1127 la->eventTag, phba->fc_eventTag,
@@ -1150,11 +1138,21 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1150 lpfc_mbx_process_link_up(phba, la); 1138 lpfc_mbx_process_link_up(phba, la);
1151 } else { 1139 } else {
1152 phba->fc_stat.LinkDown++; 1140 phba->fc_stat.LinkDown++;
1153 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, 1141 if (phba->link_flag & LS_LOOPBACK_MODE) {
1142 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
1143 "1308 Link Down Event in loop back mode "
1144 "x%x received "
1145 "Data: x%x x%x x%x\n",
1146 la->eventTag, phba->fc_eventTag,
1147 phba->pport->port_state, vport->fc_flag);
1148 }
1149 else {
1150 lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
1154 "1305 Link Down Event x%x received " 1151 "1305 Link Down Event x%x received "
1155 "Data: x%x x%x x%x\n", 1152 "Data: x%x x%x x%x\n",
1156 la->eventTag, phba->fc_eventTag, 1153 la->eventTag, phba->fc_eventTag,
1157 phba->pport->port_state, vport->fc_flag); 1154 phba->pport->port_state, vport->fc_flag);
1155 }
1158 lpfc_mbx_issue_link_down(phba); 1156 lpfc_mbx_issue_link_down(phba);
1159 } 1157 }
1160 1158
@@ -1305,7 +1303,6 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1305 lpfc_mbuf_free(phba, mp->virt, mp->phys); 1303 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1306 kfree(mp); 1304 kfree(mp);
1307 mempool_free(pmb, phba->mbox_mem_pool); 1305 mempool_free(pmb, phba->mbox_mem_pool);
1308 lpfc_nlp_put(ndlp);
1309 1306
1310 if (phba->fc_topology == TOPOLOGY_LOOP) { 1307 if (phba->fc_topology == TOPOLOGY_LOOP) {
1311 /* FLOGI failed, use loop map to make discovery list */ 1308 /* FLOGI failed, use loop map to make discovery list */
@@ -1313,6 +1310,10 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1313 1310
1314 /* Start discovery */ 1311 /* Start discovery */
1315 lpfc_disc_start(vport); 1312 lpfc_disc_start(vport);
1313 /* Decrement the reference count to ndlp after the
1314 * reference to the ndlp are done.
1315 */
1316 lpfc_nlp_put(ndlp);
1316 return; 1317 return;
1317 } 1318 }
1318 1319
@@ -1320,6 +1321,10 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1320 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX, 1321 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
1321 "0258 Register Fabric login error: 0x%x\n", 1322 "0258 Register Fabric login error: 0x%x\n",
1322 mb->mbxStatus); 1323 mb->mbxStatus);
1324 /* Decrement the reference count to ndlp after the reference
1325 * to the ndlp are done.
1326 */
1327 lpfc_nlp_put(ndlp);
1323 return; 1328 return;
1324 } 1329 }
1325 1330
@@ -1327,8 +1332,6 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1327 ndlp->nlp_type |= NLP_FABRIC; 1332 ndlp->nlp_type |= NLP_FABRIC;
1328 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); 1333 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
1329 1334
1330 lpfc_nlp_put(ndlp); /* Drop the reference from the mbox */
1331
1332 if (vport->port_state == LPFC_FABRIC_CFG_LINK) { 1335 if (vport->port_state == LPFC_FABRIC_CFG_LINK) {
1333 vports = lpfc_create_vport_work_array(phba); 1336 vports = lpfc_create_vport_work_array(phba);
1334 if (vports != NULL) 1337 if (vports != NULL)
@@ -1356,6 +1359,11 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1356 lpfc_mbuf_free(phba, mp->virt, mp->phys); 1359 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1357 kfree(mp); 1360 kfree(mp);
1358 mempool_free(pmb, phba->mbox_mem_pool); 1361 mempool_free(pmb, phba->mbox_mem_pool);
1362
1363 /* Drop the reference count from the mbox at the end after
1364 * all the current reference to the ndlp have been done.
1365 */
1366 lpfc_nlp_put(ndlp);
1359 return; 1367 return;
1360} 1368}
1361 1369
@@ -1463,9 +1471,8 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1463 * registered the port. 1471 * registered the port.
1464 */ 1472 */
1465 if (ndlp->rport && ndlp->rport->dd_data && 1473 if (ndlp->rport && ndlp->rport->dd_data &&
1466 ((struct lpfc_rport_data *) ndlp->rport->dd_data)->pnode == ndlp) { 1474 ((struct lpfc_rport_data *) ndlp->rport->dd_data)->pnode == ndlp)
1467 lpfc_nlp_put(ndlp); 1475 lpfc_nlp_put(ndlp);
1468 }
1469 1476
1470 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, 1477 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT,
1471 "rport add: did:x%x flg:x%x type x%x", 1478 "rport add: did:x%x flg:x%x type x%x",
@@ -1660,6 +1667,18 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1660} 1667}
1661 1668
1662void 1669void
1670lpfc_enqueue_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1671{
1672 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
1673
1674 if (list_empty(&ndlp->nlp_listp)) {
1675 spin_lock_irq(shost->host_lock);
1676 list_add_tail(&ndlp->nlp_listp, &vport->fc_nodes);
1677 spin_unlock_irq(shost->host_lock);
1678 }
1679}
1680
1681void
1663lpfc_dequeue_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) 1682lpfc_dequeue_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1664{ 1683{
1665 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 1684 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
@@ -1672,7 +1691,80 @@ lpfc_dequeue_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1672 list_del_init(&ndlp->nlp_listp); 1691 list_del_init(&ndlp->nlp_listp);
1673 spin_unlock_irq(shost->host_lock); 1692 spin_unlock_irq(shost->host_lock);
1674 lpfc_nlp_state_cleanup(vport, ndlp, ndlp->nlp_state, 1693 lpfc_nlp_state_cleanup(vport, ndlp, ndlp->nlp_state,
1675 NLP_STE_UNUSED_NODE); 1694 NLP_STE_UNUSED_NODE);
1695}
1696
1697static void
1698lpfc_disable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1699{
1700 if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0)
1701 lpfc_cancel_retry_delay_tmo(vport, ndlp);
1702 if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp))
1703 lpfc_nlp_counters(vport, ndlp->nlp_state, -1);
1704 lpfc_nlp_state_cleanup(vport, ndlp, ndlp->nlp_state,
1705 NLP_STE_UNUSED_NODE);
1706}
1707
1708struct lpfc_nodelist *
1709lpfc_enable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1710 int state)
1711{
1712 struct lpfc_hba *phba = vport->phba;
1713 uint32_t did;
1714 unsigned long flags;
1715
1716 if (!ndlp)
1717 return NULL;
1718
1719 spin_lock_irqsave(&phba->ndlp_lock, flags);
1720 /* The ndlp should not be in memory free mode */
1721 if (NLP_CHK_FREE_REQ(ndlp)) {
1722 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
1723 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
1724 "0277 lpfc_enable_node: ndlp:x%p "
1725 "usgmap:x%x refcnt:%d\n",
1726 (void *)ndlp, ndlp->nlp_usg_map,
1727 atomic_read(&ndlp->kref.refcount));
1728 return NULL;
1729 }
1730 /* The ndlp should not already be in active mode */
1731 if (NLP_CHK_NODE_ACT(ndlp)) {
1732 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
1733 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
1734 "0278 lpfc_enable_node: ndlp:x%p "
1735 "usgmap:x%x refcnt:%d\n",
1736 (void *)ndlp, ndlp->nlp_usg_map,
1737 atomic_read(&ndlp->kref.refcount));
1738 return NULL;
1739 }
1740
1741 /* Keep the original DID */
1742 did = ndlp->nlp_DID;
1743
1744 /* re-initialize ndlp except of ndlp linked list pointer */
1745 memset((((char *)ndlp) + sizeof (struct list_head)), 0,
1746 sizeof (struct lpfc_nodelist) - sizeof (struct list_head));
1747 INIT_LIST_HEAD(&ndlp->els_retry_evt.evt_listp);
1748 INIT_LIST_HEAD(&ndlp->dev_loss_evt.evt_listp);
1749 init_timer(&ndlp->nlp_delayfunc);
1750 ndlp->nlp_delayfunc.function = lpfc_els_retry_delay;
1751 ndlp->nlp_delayfunc.data = (unsigned long)ndlp;
1752 ndlp->nlp_DID = did;
1753 ndlp->vport = vport;
1754 ndlp->nlp_sid = NLP_NO_SID;
1755 /* ndlp management re-initialize */
1756 kref_init(&ndlp->kref);
1757 NLP_INT_NODE_ACT(ndlp);
1758
1759 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
1760
1761 if (state != NLP_STE_UNUSED_NODE)
1762 lpfc_nlp_set_state(vport, ndlp, state);
1763
1764 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE,
1765 "node enable: did:x%x",
1766 ndlp->nlp_DID, 0, 0);
1767 return ndlp;
1676} 1768}
1677 1769
1678void 1770void
@@ -1972,7 +2064,21 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1972 "Data: x%x x%x x%x\n", 2064 "Data: x%x x%x x%x\n",
1973 ndlp->nlp_DID, ndlp->nlp_flag, 2065 ndlp->nlp_DID, ndlp->nlp_flag,
1974 ndlp->nlp_state, ndlp->nlp_rpi); 2066 ndlp->nlp_state, ndlp->nlp_rpi);
1975 lpfc_dequeue_node(vport, ndlp); 2067 if (NLP_CHK_FREE_REQ(ndlp)) {
2068 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
2069 "0280 lpfc_cleanup_node: ndlp:x%p "
2070 "usgmap:x%x refcnt:%d\n",
2071 (void *)ndlp, ndlp->nlp_usg_map,
2072 atomic_read(&ndlp->kref.refcount));
2073 lpfc_dequeue_node(vport, ndlp);
2074 } else {
2075 lpfc_printf_vlog(vport, KERN_WARNING, LOG_NODE,
2076 "0281 lpfc_cleanup_node: ndlp:x%p "
2077 "usgmap:x%x refcnt:%d\n",
2078 (void *)ndlp, ndlp->nlp_usg_map,
2079 atomic_read(&ndlp->kref.refcount));
2080 lpfc_disable_node(vport, ndlp);
2081 }
1976 2082
1977 /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ 2083 /* cleanup any ndlp on mbox q waiting for reglogin cmpl */
1978 if ((mb = phba->sli.mbox_active)) { 2084 if ((mb = phba->sli.mbox_active)) {
@@ -1994,12 +2100,16 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1994 } 2100 }
1995 list_del(&mb->list); 2101 list_del(&mb->list);
1996 mempool_free(mb, phba->mbox_mem_pool); 2102 mempool_free(mb, phba->mbox_mem_pool);
1997 lpfc_nlp_put(ndlp); 2103 /* We shall not invoke the lpfc_nlp_put to decrement
2104 * the ndlp reference count as we are in the process
2105 * of lpfc_nlp_release.
2106 */
1998 } 2107 }
1999 } 2108 }
2000 spin_unlock_irq(&phba->hbalock); 2109 spin_unlock_irq(&phba->hbalock);
2001 2110
2002 lpfc_els_abort(phba,ndlp); 2111 lpfc_els_abort(phba, ndlp);
2112
2003 spin_lock_irq(shost->host_lock); 2113 spin_lock_irq(shost->host_lock);
2004 ndlp->nlp_flag &= ~NLP_DELAY_TMO; 2114 ndlp->nlp_flag &= ~NLP_DELAY_TMO;
2005 spin_unlock_irq(shost->host_lock); 2115 spin_unlock_irq(shost->host_lock);
@@ -2057,7 +2167,6 @@ lpfc_nlp_remove(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
2057 } 2167 }
2058 } 2168 }
2059 } 2169 }
2060
2061 lpfc_cleanup_node(vport, ndlp); 2170 lpfc_cleanup_node(vport, ndlp);
2062 2171
2063 /* 2172 /*
@@ -2182,7 +2291,16 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
2182 ndlp->nlp_flag |= NLP_NPR_2B_DISC; 2291 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2183 spin_unlock_irq(shost->host_lock); 2292 spin_unlock_irq(shost->host_lock);
2184 return ndlp; 2293 return ndlp;
2294 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
2295 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_NPR_NODE);
2296 if (!ndlp)
2297 return NULL;
2298 spin_lock_irq(shost->host_lock);
2299 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2300 spin_unlock_irq(shost->host_lock);
2301 return ndlp;
2185 } 2302 }
2303
2186 if (vport->fc_flag & FC_RSCN_MODE) { 2304 if (vport->fc_flag & FC_RSCN_MODE) {
2187 if (lpfc_rscn_payload_check(vport, did)) { 2305 if (lpfc_rscn_payload_check(vport, did)) {
2188 /* If we've already recieved a PLOGI from this NPort 2306 /* If we've already recieved a PLOGI from this NPort
@@ -2363,6 +2481,7 @@ lpfc_disc_start(struct lpfc_vport *vport)
2363 * continue discovery. 2481 * continue discovery.
2364 */ 2482 */
2365 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) && 2483 if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
2484 !(vport->fc_flag & FC_PT2PT) &&
2366 !(vport->fc_flag & FC_RSCN_MODE)) { 2485 !(vport->fc_flag & FC_RSCN_MODE)) {
2367 lpfc_issue_reg_vpi(phba, vport); 2486 lpfc_issue_reg_vpi(phba, vport);
2368 return; 2487 return;
@@ -2485,6 +2604,8 @@ lpfc_disc_flush_list(struct lpfc_vport *vport)
2485 if (vport->fc_plogi_cnt || vport->fc_adisc_cnt) { 2604 if (vport->fc_plogi_cnt || vport->fc_adisc_cnt) {
2486 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, 2605 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes,
2487 nlp_listp) { 2606 nlp_listp) {
2607 if (!NLP_CHK_NODE_ACT(ndlp))
2608 continue;
2488 if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || 2609 if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE ||
2489 ndlp->nlp_state == NLP_STE_ADISC_ISSUE) { 2610 ndlp->nlp_state == NLP_STE_ADISC_ISSUE) {
2490 lpfc_free_tx(phba, ndlp); 2611 lpfc_free_tx(phba, ndlp);
@@ -2572,6 +2693,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2572 /* Start discovery by sending FLOGI, clean up old rpis */ 2693 /* Start discovery by sending FLOGI, clean up old rpis */
2573 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, 2694 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes,
2574 nlp_listp) { 2695 nlp_listp) {
2696 if (!NLP_CHK_NODE_ACT(ndlp))
2697 continue;
2575 if (ndlp->nlp_state != NLP_STE_NPR_NODE) 2698 if (ndlp->nlp_state != NLP_STE_NPR_NODE)
2576 continue; 2699 continue;
2577 if (ndlp->nlp_type & NLP_FABRIC) { 2700 if (ndlp->nlp_type & NLP_FABRIC) {
@@ -2618,7 +2741,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
2618 "NameServer login\n"); 2741 "NameServer login\n");
2619 /* Next look for NameServer ndlp */ 2742 /* Next look for NameServer ndlp */
2620 ndlp = lpfc_findnode_did(vport, NameServer_DID); 2743 ndlp = lpfc_findnode_did(vport, NameServer_DID);
2621 if (ndlp) 2744 if (ndlp && NLP_CHK_NODE_ACT(ndlp))
2622 lpfc_els_abort(phba, ndlp); 2745 lpfc_els_abort(phba, ndlp);
2623 2746
2624 /* ReStart discovery */ 2747 /* ReStart discovery */
@@ -2897,6 +3020,7 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2897 ndlp->nlp_sid = NLP_NO_SID; 3020 ndlp->nlp_sid = NLP_NO_SID;
2898 INIT_LIST_HEAD(&ndlp->nlp_listp); 3021 INIT_LIST_HEAD(&ndlp->nlp_listp);
2899 kref_init(&ndlp->kref); 3022 kref_init(&ndlp->kref);
3023 NLP_INT_NODE_ACT(ndlp);
2900 3024
2901 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE, 3025 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE,
2902 "node init: did:x%x", 3026 "node init: did:x%x",
@@ -2911,6 +3035,8 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2911static void 3035static void
2912lpfc_nlp_release(struct kref *kref) 3036lpfc_nlp_release(struct kref *kref)
2913{ 3037{
3038 struct lpfc_hba *phba;
3039 unsigned long flags;
2914 struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist, 3040 struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist,
2915 kref); 3041 kref);
2916 3042
@@ -2918,8 +3044,24 @@ lpfc_nlp_release(struct kref *kref)
2918 "node release: did:x%x flg:x%x type:x%x", 3044 "node release: did:x%x flg:x%x type:x%x",
2919 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); 3045 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type);
2920 3046
3047 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
3048 "0279 lpfc_nlp_release: ndlp:x%p "
3049 "usgmap:x%x refcnt:%d\n",
3050 (void *)ndlp, ndlp->nlp_usg_map,
3051 atomic_read(&ndlp->kref.refcount));
3052
3053 /* remove ndlp from action. */
2921 lpfc_nlp_remove(ndlp->vport, ndlp); 3054 lpfc_nlp_remove(ndlp->vport, ndlp);
2922 mempool_free(ndlp, ndlp->vport->phba->nlp_mem_pool); 3055
3056 /* clear the ndlp active flag for all release cases */
3057 phba = ndlp->vport->phba;
3058 spin_lock_irqsave(&phba->ndlp_lock, flags);
3059 NLP_CLR_NODE_ACT(ndlp);
3060 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
3061
3062 /* free ndlp memory for final ndlp release */
3063 if (NLP_CHK_FREE_REQ(ndlp))
3064 mempool_free(ndlp, ndlp->vport->phba->nlp_mem_pool);
2923} 3065}
2924 3066
2925/* This routine bumps the reference count for a ndlp structure to ensure 3067/* This routine bumps the reference count for a ndlp structure to ensure
@@ -2929,37 +3071,108 @@ lpfc_nlp_release(struct kref *kref)
2929struct lpfc_nodelist * 3071struct lpfc_nodelist *
2930lpfc_nlp_get(struct lpfc_nodelist *ndlp) 3072lpfc_nlp_get(struct lpfc_nodelist *ndlp)
2931{ 3073{
3074 struct lpfc_hba *phba;
3075 unsigned long flags;
3076
2932 if (ndlp) { 3077 if (ndlp) {
2933 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, 3078 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE,
2934 "node get: did:x%x flg:x%x refcnt:x%x", 3079 "node get: did:x%x flg:x%x refcnt:x%x",
2935 ndlp->nlp_DID, ndlp->nlp_flag, 3080 ndlp->nlp_DID, ndlp->nlp_flag,
2936 atomic_read(&ndlp->kref.refcount)); 3081 atomic_read(&ndlp->kref.refcount));
2937 kref_get(&ndlp->kref); 3082 /* The check of ndlp usage to prevent incrementing the
3083 * ndlp reference count that is in the process of being
3084 * released.
3085 */
3086 phba = ndlp->vport->phba;
3087 spin_lock_irqsave(&phba->ndlp_lock, flags);
3088 if (!NLP_CHK_NODE_ACT(ndlp) || NLP_CHK_FREE_ACK(ndlp)) {
3089 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
3090 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_NODE,
3091 "0276 lpfc_nlp_get: ndlp:x%p "
3092 "usgmap:x%x refcnt:%d\n",
3093 (void *)ndlp, ndlp->nlp_usg_map,
3094 atomic_read(&ndlp->kref.refcount));
3095 return NULL;
3096 } else
3097 kref_get(&ndlp->kref);
3098 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
2938 } 3099 }
2939 return ndlp; 3100 return ndlp;
2940} 3101}
2941 3102
2942
2943/* This routine decrements the reference count for a ndlp structure. If the 3103/* This routine decrements the reference count for a ndlp structure. If the
2944 * count goes to 0, this indicates the the associated nodelist should be freed. 3104 * count goes to 0, this indicates the the associated nodelist should be
3105 * freed. Returning 1 indicates the ndlp resource has been released; on the
3106 * other hand, returning 0 indicates the ndlp resource has not been released
3107 * yet.
2945 */ 3108 */
2946int 3109int
2947lpfc_nlp_put(struct lpfc_nodelist *ndlp) 3110lpfc_nlp_put(struct lpfc_nodelist *ndlp)
2948{ 3111{
2949 if (ndlp) { 3112 struct lpfc_hba *phba;
2950 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, 3113 unsigned long flags;
2951 "node put: did:x%x flg:x%x refcnt:x%x", 3114
2952 ndlp->nlp_DID, ndlp->nlp_flag, 3115 if (!ndlp)
2953 atomic_read(&ndlp->kref.refcount)); 3116 return 1;
3117
3118 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE,
3119 "node put: did:x%x flg:x%x refcnt:x%x",
3120 ndlp->nlp_DID, ndlp->nlp_flag,
3121 atomic_read(&ndlp->kref.refcount));
3122 phba = ndlp->vport->phba;
3123 spin_lock_irqsave(&phba->ndlp_lock, flags);
3124 /* Check the ndlp memory free acknowledge flag to avoid the
3125 * possible race condition that kref_put got invoked again
3126 * after previous one has done ndlp memory free.
3127 */
3128 if (NLP_CHK_FREE_ACK(ndlp)) {
3129 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
3130 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_NODE,
3131 "0274 lpfc_nlp_put: ndlp:x%p "
3132 "usgmap:x%x refcnt:%d\n",
3133 (void *)ndlp, ndlp->nlp_usg_map,
3134 atomic_read(&ndlp->kref.refcount));
3135 return 1;
2954 } 3136 }
2955 return ndlp ? kref_put(&ndlp->kref, lpfc_nlp_release) : 0; 3137 /* Check the ndlp inactivate log flag to avoid the possible
3138 * race condition that kref_put got invoked again after ndlp
3139 * is already in inactivating state.
3140 */
3141 if (NLP_CHK_IACT_REQ(ndlp)) {
3142 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
3143 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_NODE,
3144 "0275 lpfc_nlp_put: ndlp:x%p "
3145 "usgmap:x%x refcnt:%d\n",
3146 (void *)ndlp, ndlp->nlp_usg_map,
3147 atomic_read(&ndlp->kref.refcount));
3148 return 1;
3149 }
3150 /* For last put, mark the ndlp usage flags to make sure no
3151 * other kref_get and kref_put on the same ndlp shall get
3152 * in between the process when the final kref_put has been
3153 * invoked on this ndlp.
3154 */
3155 if (atomic_read(&ndlp->kref.refcount) == 1) {
3156 /* Indicate ndlp is put to inactive state. */
3157 NLP_SET_IACT_REQ(ndlp);
3158 /* Acknowledge ndlp memory free has been seen. */
3159 if (NLP_CHK_FREE_REQ(ndlp))
3160 NLP_SET_FREE_ACK(ndlp);
3161 }
3162 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
3163 /* Note, the kref_put returns 1 when decrementing a reference
3164 * count that was 1, it invokes the release callback function,
3165 * but it still left the reference count as 1 (not actually
3166 * performs the last decrementation). Otherwise, it actually
3167 * decrements the reference count and returns 0.
3168 */
3169 return kref_put(&ndlp->kref, lpfc_nlp_release);
2956} 3170}
2957 3171
2958/* This routine free's the specified nodelist if it is not in use 3172/* This routine free's the specified nodelist if it is not in use
2959 * by any other discovery thread. This routine returns 1 if the ndlp 3173 * by any other discovery thread. This routine returns 1 if the
2960 * is not being used by anyone and has been freed. A return value of 3174 * ndlp has been freed. A return value of 0 indicates the ndlp is
2961 * 0 indicates it is being used by another discovery thread and the 3175 * not yet been released.
2962 * refcount is left unchanged.
2963 */ 3176 */
2964int 3177int
2965lpfc_nlp_not_used(struct lpfc_nodelist *ndlp) 3178lpfc_nlp_not_used(struct lpfc_nodelist *ndlp)
@@ -2968,11 +3181,8 @@ lpfc_nlp_not_used(struct lpfc_nodelist *ndlp)
2968 "node not used: did:x%x flg:x%x refcnt:x%x", 3181 "node not used: did:x%x flg:x%x refcnt:x%x",
2969 ndlp->nlp_DID, ndlp->nlp_flag, 3182 ndlp->nlp_DID, ndlp->nlp_flag,
2970 atomic_read(&ndlp->kref.refcount)); 3183 atomic_read(&ndlp->kref.refcount));
2971 3184 if (atomic_read(&ndlp->kref.refcount) == 1)
2972 if (atomic_read(&ndlp->kref.refcount) == 1) { 3185 if (lpfc_nlp_put(ndlp))
2973 lpfc_nlp_put(ndlp); 3186 return 1;
2974 return 1;
2975 }
2976 return 0; 3187 return 0;
2977} 3188}
2978
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 041f83e7634a..7773b949aa7c 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -581,6 +581,7 @@ struct ls_rjt { /* Structure is in Big Endian format */
581#define LSEXP_INVALID_O_SID 0x15 581#define LSEXP_INVALID_O_SID 0x15
582#define LSEXP_INVALID_OX_RX 0x17 582#define LSEXP_INVALID_OX_RX 0x17
583#define LSEXP_CMD_IN_PROGRESS 0x19 583#define LSEXP_CMD_IN_PROGRESS 0x19
584#define LSEXP_PORT_LOGIN_REQ 0x1E
584#define LSEXP_INVALID_NPORT_ID 0x1F 585#define LSEXP_INVALID_NPORT_ID 0x1F
585#define LSEXP_INVALID_SEQ_ID 0x21 586#define LSEXP_INVALID_SEQ_ID 0x21
586#define LSEXP_INVALID_XCHG 0x23 587#define LSEXP_INVALID_XCHG 0x23
@@ -1376,11 +1377,26 @@ typedef struct { /* FireFly BIU registers */
1376#define CMD_QUE_XRI64_CX 0xB3 1377#define CMD_QUE_XRI64_CX 0xB3
1377#define CMD_IOCB_RCV_SEQ64_CX 0xB5 1378#define CMD_IOCB_RCV_SEQ64_CX 0xB5
1378#define CMD_IOCB_RCV_ELS64_CX 0xB7 1379#define CMD_IOCB_RCV_ELS64_CX 0xB7
1380#define CMD_IOCB_RET_XRI64_CX 0xB9
1379#define CMD_IOCB_RCV_CONT64_CX 0xBB 1381#define CMD_IOCB_RCV_CONT64_CX 0xBB
1380 1382
1381#define CMD_GEN_REQUEST64_CR 0xC2 1383#define CMD_GEN_REQUEST64_CR 0xC2
1382#define CMD_GEN_REQUEST64_CX 0xC3 1384#define CMD_GEN_REQUEST64_CX 0xC3
1383 1385
1386/* Unhandled SLI-3 Commands */
1387#define CMD_IOCB_XMIT_MSEQ64_CR 0xB0
1388#define CMD_IOCB_XMIT_MSEQ64_CX 0xB1
1389#define CMD_IOCB_RCV_SEQ_LIST64_CX 0xC1
1390#define CMD_IOCB_RCV_ELS_LIST64_CX 0xCD
1391#define CMD_IOCB_CLOSE_EXTENDED_CN 0xB6
1392#define CMD_IOCB_ABORT_EXTENDED_CN 0xBA
1393#define CMD_IOCB_RET_HBQE64_CN 0xCA
1394#define CMD_IOCB_FCP_IBIDIR64_CR 0xAC
1395#define CMD_IOCB_FCP_IBIDIR64_CX 0xAD
1396#define CMD_IOCB_FCP_ITASKMGT64_CX 0xAF
1397#define CMD_IOCB_LOGENTRY_CN 0x94
1398#define CMD_IOCB_LOGENTRY_ASYNC_CN 0x96
1399
1384#define CMD_MAX_IOCB_CMD 0xE6 1400#define CMD_MAX_IOCB_CMD 0xE6
1385#define CMD_IOCB_MASK 0xff 1401#define CMD_IOCB_MASK 0xff
1386 1402
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 6cfeba7454d4..22843751c2ca 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -461,11 +461,21 @@ lpfc_config_port_post(struct lpfc_hba *phba)
461int 461int
462lpfc_hba_down_prep(struct lpfc_hba *phba) 462lpfc_hba_down_prep(struct lpfc_hba *phba)
463{ 463{
464 struct lpfc_vport **vports;
465 int i;
464 /* Disable interrupts */ 466 /* Disable interrupts */
465 writel(0, phba->HCregaddr); 467 writel(0, phba->HCregaddr);
466 readl(phba->HCregaddr); /* flush */ 468 readl(phba->HCregaddr); /* flush */
467 469
468 lpfc_cleanup_discovery_resources(phba->pport); 470 if (phba->pport->load_flag & FC_UNLOADING)
471 lpfc_cleanup_discovery_resources(phba->pport);
472 else {
473 vports = lpfc_create_vport_work_array(phba);
474 if (vports != NULL)
475 for(i = 0; i <= phba->max_vpi && vports[i] != NULL; i++)
476 lpfc_cleanup_discovery_resources(vports[i]);
477 lpfc_destroy_vport_work_array(phba, vports);
478 }
469 return 0; 479 return 0;
470} 480}
471 481
@@ -1422,9 +1432,32 @@ lpfc_cleanup(struct lpfc_vport *vport)
1422 lpfc_port_link_failure(vport); 1432 lpfc_port_link_failure(vport);
1423 1433
1424 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 1434 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
1435 if (!NLP_CHK_NODE_ACT(ndlp)) {
1436 ndlp = lpfc_enable_node(vport, ndlp,
1437 NLP_STE_UNUSED_NODE);
1438 if (!ndlp)
1439 continue;
1440 spin_lock_irq(&phba->ndlp_lock);
1441 NLP_SET_FREE_REQ(ndlp);
1442 spin_unlock_irq(&phba->ndlp_lock);
1443 /* Trigger the release of the ndlp memory */
1444 lpfc_nlp_put(ndlp);
1445 continue;
1446 }
1447 spin_lock_irq(&phba->ndlp_lock);
1448 if (NLP_CHK_FREE_REQ(ndlp)) {
1449 /* The ndlp should not be in memory free mode already */
1450 spin_unlock_irq(&phba->ndlp_lock);
1451 continue;
1452 } else
1453 /* Indicate request for freeing ndlp memory */
1454 NLP_SET_FREE_REQ(ndlp);
1455 spin_unlock_irq(&phba->ndlp_lock);
1456
1425 if (ndlp->nlp_type & NLP_FABRIC) 1457 if (ndlp->nlp_type & NLP_FABRIC)
1426 lpfc_disc_state_machine(vport, ndlp, NULL, 1458 lpfc_disc_state_machine(vport, ndlp, NULL,
1427 NLP_EVT_DEVICE_RECOVERY); 1459 NLP_EVT_DEVICE_RECOVERY);
1460
1428 lpfc_disc_state_machine(vport, ndlp, NULL, 1461 lpfc_disc_state_machine(vport, ndlp, NULL,
1429 NLP_EVT_DEVICE_RM); 1462 NLP_EVT_DEVICE_RM);
1430 } 1463 }
@@ -1438,6 +1471,17 @@ lpfc_cleanup(struct lpfc_vport *vport)
1438 if (i++ > 3000) { 1471 if (i++ > 3000) {
1439 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, 1472 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
1440 "0233 Nodelist not empty\n"); 1473 "0233 Nodelist not empty\n");
1474 list_for_each_entry_safe(ndlp, next_ndlp,
1475 &vport->fc_nodes, nlp_listp) {
1476 lpfc_printf_vlog(ndlp->vport, KERN_ERR,
1477 LOG_NODE,
1478 "0282: did:x%x ndlp:x%p "
1479 "usgmap:x%x refcnt:%d\n",
1480 ndlp->nlp_DID, (void *)ndlp,
1481 ndlp->nlp_usg_map,
1482 atomic_read(
1483 &ndlp->kref.refcount));
1484 }
1441 break; 1485 break;
1442 } 1486 }
1443 1487
@@ -1586,6 +1630,8 @@ lpfc_offline_prep(struct lpfc_hba * phba)
1586 list_for_each_entry_safe(ndlp, next_ndlp, 1630 list_for_each_entry_safe(ndlp, next_ndlp,
1587 &vports[i]->fc_nodes, 1631 &vports[i]->fc_nodes,
1588 nlp_listp) { 1632 nlp_listp) {
1633 if (!NLP_CHK_NODE_ACT(ndlp))
1634 continue;
1589 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) 1635 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
1590 continue; 1636 continue;
1591 if (ndlp->nlp_type & NLP_FABRIC) { 1637 if (ndlp->nlp_type & NLP_FABRIC) {
@@ -1695,9 +1741,9 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
1695 1741
1696 vport = (struct lpfc_vport *) shost->hostdata; 1742 vport = (struct lpfc_vport *) shost->hostdata;
1697 vport->phba = phba; 1743 vport->phba = phba;
1698
1699 vport->load_flag |= FC_LOADING; 1744 vport->load_flag |= FC_LOADING;
1700 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; 1745 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
1746 vport->fc_rscn_flush = 0;
1701 1747
1702 lpfc_get_vport_cfgparam(vport); 1748 lpfc_get_vport_cfgparam(vport);
1703 shost->unique_id = instance; 1749 shost->unique_id = instance;
@@ -1879,6 +1925,42 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost)
1879 spin_unlock_irq(shost->host_lock); 1925 spin_unlock_irq(shost->host_lock);
1880} 1926}
1881 1927
1928static int
1929lpfc_enable_msix(struct lpfc_hba *phba)
1930{
1931 int error;
1932
1933 phba->msix_entries[0].entry = 0;
1934 phba->msix_entries[0].vector = 0;
1935
1936 error = pci_enable_msix(phba->pcidev, phba->msix_entries,
1937 ARRAY_SIZE(phba->msix_entries));
1938 if (error) {
1939 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
1940 "0420 Enable MSI-X failed (%d), continuing "
1941 "with MSI\n", error);
1942 pci_disable_msix(phba->pcidev);
1943 return error;
1944 }
1945
1946 error = request_irq(phba->msix_entries[0].vector, lpfc_intr_handler, 0,
1947 LPFC_DRIVER_NAME, phba);
1948 if (error) {
1949 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1950 "0421 MSI-X request_irq failed (%d), "
1951 "continuing with MSI\n", error);
1952 pci_disable_msix(phba->pcidev);
1953 }
1954 return error;
1955}
1956
1957static void
1958lpfc_disable_msix(struct lpfc_hba *phba)
1959{
1960 free_irq(phba->msix_entries[0].vector, phba);
1961 pci_disable_msix(phba->pcidev);
1962}
1963
1882static int __devinit 1964static int __devinit
1883lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) 1965lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1884{ 1966{
@@ -1905,6 +1987,9 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1905 1987
1906 spin_lock_init(&phba->hbalock); 1988 spin_lock_init(&phba->hbalock);
1907 1989
1990 /* Initialize ndlp management spinlock */
1991 spin_lock_init(&phba->ndlp_lock);
1992
1908 phba->pcidev = pdev; 1993 phba->pcidev = pdev;
1909 1994
1910 /* Assign an unused board number */ 1995 /* Assign an unused board number */
@@ -2002,6 +2087,8 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
2002 2087
2003 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size()); 2088 memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size());
2004 2089
2090 INIT_LIST_HEAD(&phba->hbqbuf_in_list);
2091
2005 /* Initialize the SLI Layer to run with lpfc HBAs. */ 2092 /* Initialize the SLI Layer to run with lpfc HBAs. */
2006 lpfc_sli_setup(phba); 2093 lpfc_sli_setup(phba);
2007 lpfc_sli_queue_setup(phba); 2094 lpfc_sli_queue_setup(phba);
@@ -2077,24 +2164,36 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
2077 lpfc_debugfs_initialize(vport); 2164 lpfc_debugfs_initialize(vport);
2078 2165
2079 pci_set_drvdata(pdev, shost); 2166 pci_set_drvdata(pdev, shost);
2167 phba->intr_type = NONE;
2080 2168
2081 if (phba->cfg_use_msi) { 2169 if (phba->cfg_use_msi == 2) {
2170 error = lpfc_enable_msix(phba);
2171 if (!error)
2172 phba->intr_type = MSIX;
2173 }
2174
2175 /* Fallback to MSI if MSI-X initialization failed */
2176 if (phba->cfg_use_msi >= 1 && phba->intr_type == NONE) {
2082 retval = pci_enable_msi(phba->pcidev); 2177 retval = pci_enable_msi(phba->pcidev);
2083 if (!retval) 2178 if (!retval)
2084 phba->using_msi = 1; 2179 phba->intr_type = MSI;
2085 else 2180 else
2086 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 2181 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
2087 "0452 Enable MSI failed, continuing " 2182 "0452 Enable MSI failed, continuing "
2088 "with IRQ\n"); 2183 "with IRQ\n");
2089 } 2184 }
2090 2185
2091 retval = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, 2186 /* MSI-X is the only case the doesn't need to call request_irq */
2092 LPFC_DRIVER_NAME, phba); 2187 if (phba->intr_type != MSIX) {
2093 if (retval) { 2188 retval = request_irq(phba->pcidev->irq, lpfc_intr_handler,
2094 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2189 IRQF_SHARED, LPFC_DRIVER_NAME, phba);
2095 "0451 Enable interrupt handler failed\n"); 2190 if (retval) {
2096 error = retval; 2191 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0451 Enable "
2097 goto out_disable_msi; 2192 "interrupt handler failed\n");
2193 error = retval;
2194 goto out_disable_msi;
2195 } else if (phba->intr_type != MSI)
2196 phba->intr_type = INTx;
2098 } 2197 }
2099 2198
2100 phba->MBslimaddr = phba->slim_memmap_p; 2199 phba->MBslimaddr = phba->slim_memmap_p;
@@ -2139,9 +2238,14 @@ out_remove_device:
2139out_free_irq: 2238out_free_irq:
2140 lpfc_stop_phba_timers(phba); 2239 lpfc_stop_phba_timers(phba);
2141 phba->pport->work_port_events = 0; 2240 phba->pport->work_port_events = 0;
2142 free_irq(phba->pcidev->irq, phba); 2241
2242 if (phba->intr_type == MSIX)
2243 lpfc_disable_msix(phba);
2244 else
2245 free_irq(phba->pcidev->irq, phba);
2246
2143out_disable_msi: 2247out_disable_msi:
2144 if (phba->using_msi) 2248 if (phba->intr_type == MSI)
2145 pci_disable_msi(phba->pcidev); 2249 pci_disable_msi(phba->pcidev);
2146 destroy_port(vport); 2250 destroy_port(vport);
2147out_kthread_stop: 2251out_kthread_stop:
@@ -2214,10 +2318,13 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
2214 2318
2215 lpfc_debugfs_terminate(vport); 2319 lpfc_debugfs_terminate(vport);
2216 2320
2217 /* Release the irq reservation */ 2321 if (phba->intr_type == MSIX)
2218 free_irq(phba->pcidev->irq, phba); 2322 lpfc_disable_msix(phba);
2219 if (phba->using_msi) 2323 else {
2220 pci_disable_msi(phba->pcidev); 2324 free_irq(phba->pcidev->irq, phba);
2325 if (phba->intr_type == MSI)
2326 pci_disable_msi(phba->pcidev);
2327 }
2221 2328
2222 pci_set_drvdata(pdev, NULL); 2329 pci_set_drvdata(pdev, NULL);
2223 scsi_host_put(shost); 2330 scsi_host_put(shost);
@@ -2276,10 +2383,13 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
2276 pring = &psli->ring[psli->fcp_ring]; 2383 pring = &psli->ring[psli->fcp_ring];
2277 lpfc_sli_abort_iocb_ring(phba, pring); 2384 lpfc_sli_abort_iocb_ring(phba, pring);
2278 2385
2279 /* Release the irq reservation */ 2386 if (phba->intr_type == MSIX)
2280 free_irq(phba->pcidev->irq, phba); 2387 lpfc_disable_msix(phba);
2281 if (phba->using_msi) 2388 else {
2282 pci_disable_msi(phba->pcidev); 2389 free_irq(phba->pcidev->irq, phba);
2390 if (phba->intr_type == MSI)
2391 pci_disable_msi(phba->pcidev);
2392 }
2283 2393
2284 /* Request a slot reset. */ 2394 /* Request a slot reset. */
2285 return PCI_ERS_RESULT_NEED_RESET; 2395 return PCI_ERS_RESULT_NEED_RESET;
diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h
index c5841d7565f7..39fd2b843bec 100644
--- a/drivers/scsi/lpfc/lpfc_logmsg.h
+++ b/drivers/scsi/lpfc/lpfc_logmsg.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2005 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -35,11 +35,15 @@
35#define LOG_ALL_MSG 0xffff /* LOG all messages */ 35#define LOG_ALL_MSG 0xffff /* LOG all messages */
36 36
37#define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \ 37#define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
38 do { \
38 { if (((mask) &(vport)->cfg_log_verbose) || (level[1] <= '3')) \ 39 { if (((mask) &(vport)->cfg_log_verbose) || (level[1] <= '3')) \
39 dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \ 40 dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
40 fmt, (vport)->phba->brd_no, vport->vpi, ##arg); } 41 fmt, (vport)->phba->brd_no, vport->vpi, ##arg); } \
42 } while (0)
41 43
42#define lpfc_printf_log(phba, level, mask, fmt, arg...) \ 44#define lpfc_printf_log(phba, level, mask, fmt, arg...) \
45 do { \
43 { if (((mask) &(phba)->pport->cfg_log_verbose) || (level[1] <= '3')) \ 46 { if (((mask) &(phba)->pport->cfg_log_verbose) || (level[1] <= '3')) \
44 dev_printk(level, &((phba)->pcidev)->dev, "%d:" \ 47 dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
45 fmt, phba->brd_no, ##arg); } 48 fmt, phba->brd_no, ##arg); } \
49 } while (0)
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 6dc5ab8d6716..3c0cebc71800 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -264,19 +264,30 @@ void
264lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) 264lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp)
265{ 265{
266 struct hbq_dmabuf *hbq_entry; 266 struct hbq_dmabuf *hbq_entry;
267 unsigned long flags;
268
269 if (!mp)
270 return;
267 271
268 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { 272 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
273 /* Check whether HBQ is still in use */
274 spin_lock_irqsave(&phba->hbalock, flags);
275 if (!phba->hbq_in_use) {
276 spin_unlock_irqrestore(&phba->hbalock, flags);
277 return;
278 }
269 hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf); 279 hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf);
280 list_del(&hbq_entry->dbuf.list);
270 if (hbq_entry->tag == -1) { 281 if (hbq_entry->tag == -1) {
271 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer) 282 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer)
272 (phba, hbq_entry); 283 (phba, hbq_entry);
273 } else { 284 } else {
274 lpfc_sli_free_hbq(phba, hbq_entry); 285 lpfc_sli_free_hbq(phba, hbq_entry);
275 } 286 }
287 spin_unlock_irqrestore(&phba->hbalock, flags);
276 } else { 288 } else {
277 lpfc_mbuf_free(phba, mp->virt, mp->phys); 289 lpfc_mbuf_free(phba, mp->virt, mp->phys);
278 kfree(mp); 290 kfree(mp);
279 } 291 }
280 return; 292 return;
281} 293}
282
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 4a0e3406e37a..d513813f6697 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -1,7 +1,7 @@
1 /******************************************************************* 1 /*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -249,6 +249,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
249 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 249 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
250 struct lpfc_hba *phba = vport->phba; 250 struct lpfc_hba *phba = vport->phba;
251 struct lpfc_dmabuf *pcmd; 251 struct lpfc_dmabuf *pcmd;
252 struct lpfc_work_evt *evtp;
252 uint32_t *lp; 253 uint32_t *lp;
253 IOCB_t *icmd; 254 IOCB_t *icmd;
254 struct serv_parm *sp; 255 struct serv_parm *sp;
@@ -435,8 +436,14 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
435 del_timer_sync(&ndlp->nlp_delayfunc); 436 del_timer_sync(&ndlp->nlp_delayfunc);
436 ndlp->nlp_last_elscmd = 0; 437 ndlp->nlp_last_elscmd = 0;
437 438
438 if (!list_empty(&ndlp->els_retry_evt.evt_listp)) 439 if (!list_empty(&ndlp->els_retry_evt.evt_listp)) {
439 list_del_init(&ndlp->els_retry_evt.evt_listp); 440 list_del_init(&ndlp->els_retry_evt.evt_listp);
441 /* Decrement ndlp reference count held for the
442 * delayed retry
443 */
444 evtp = &ndlp->els_retry_evt;
445 lpfc_nlp_put((struct lpfc_nodelist *)evtp->evt_arg1);
446 }
440 447
441 if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { 448 if (ndlp->nlp_flag & NLP_NPR_2B_DISC) {
442 spin_lock_irq(shost->host_lock); 449 spin_lock_irq(shost->host_lock);
@@ -638,13 +645,15 @@ lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
638 return 0; 645 return 0;
639 } 646 }
640 647
641 /* Check config parameter use-adisc or FCP-2 */ 648 if (!(vport->fc_flag & FC_PT2PT)) {
642 if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) || 649 /* Check config parameter use-adisc or FCP-2 */
643 ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { 650 if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) ||
644 spin_lock_irq(shost->host_lock); 651 ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) {
645 ndlp->nlp_flag |= NLP_NPR_ADISC; 652 spin_lock_irq(shost->host_lock);
646 spin_unlock_irq(shost->host_lock); 653 ndlp->nlp_flag |= NLP_NPR_ADISC;
647 return 1; 654 spin_unlock_irq(shost->host_lock);
655 return 1;
656 }
648 } 657 }
649 ndlp->nlp_flag &= ~NLP_NPR_ADISC; 658 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
650 lpfc_unreg_rpi(vport, ndlp); 659 lpfc_unreg_rpi(vport, ndlp);
@@ -656,7 +665,7 @@ lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
656 void *arg, uint32_t evt) 665 void *arg, uint32_t evt)
657{ 666{
658 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, 667 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
659 "0253 Illegal State Transition: node x%x " 668 "0271 Illegal State Transition: node x%x "
660 "event x%x, state x%x Data: x%x x%x\n", 669 "event x%x, state x%x Data: x%x x%x\n",
661 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, 670 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi,
662 ndlp->nlp_flag); 671 ndlp->nlp_flag);
@@ -674,7 +683,7 @@ lpfc_cmpl_plogi_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
674 */ 683 */
675 if (!(ndlp->nlp_flag & NLP_RCV_PLOGI)) { 684 if (!(ndlp->nlp_flag & NLP_RCV_PLOGI)) {
676 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, 685 lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
677 "0253 Illegal State Transition: node x%x " 686 "0272 Illegal State Transition: node x%x "
678 "event x%x, state x%x Data: x%x x%x\n", 687 "event x%x, state x%x Data: x%x x%x\n",
679 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, 688 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi,
680 ndlp->nlp_flag); 689 ndlp->nlp_flag);
@@ -2144,8 +2153,11 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2144 uint32_t cur_state, rc; 2153 uint32_t cur_state, rc;
2145 uint32_t(*func) (struct lpfc_vport *, struct lpfc_nodelist *, void *, 2154 uint32_t(*func) (struct lpfc_vport *, struct lpfc_nodelist *, void *,
2146 uint32_t); 2155 uint32_t);
2156 uint32_t got_ndlp = 0;
2157
2158 if (lpfc_nlp_get(ndlp))
2159 got_ndlp = 1;
2147 2160
2148 lpfc_nlp_get(ndlp);
2149 cur_state = ndlp->nlp_state; 2161 cur_state = ndlp->nlp_state;
2150 2162
2151 /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ 2163 /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */
@@ -2162,15 +2174,24 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2162 rc = (func) (vport, ndlp, arg, evt); 2174 rc = (func) (vport, ndlp, arg, evt);
2163 2175
2164 /* DSM out state <rc> on NPort <nlp_DID> */ 2176 /* DSM out state <rc> on NPort <nlp_DID> */
2165 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, 2177 if (got_ndlp) {
2178 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2166 "0212 DSM out state %d on NPort x%x Data: x%x\n", 2179 "0212 DSM out state %d on NPort x%x Data: x%x\n",
2167 rc, ndlp->nlp_DID, ndlp->nlp_flag); 2180 rc, ndlp->nlp_DID, ndlp->nlp_flag);
2168 2181
2169 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, 2182 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM,
2170 "DSM out: ste:%d did:x%x flg:x%x", 2183 "DSM out: ste:%d did:x%x flg:x%x",
2171 rc, ndlp->nlp_DID, ndlp->nlp_flag); 2184 rc, ndlp->nlp_DID, ndlp->nlp_flag);
2185 /* Decrement the ndlp reference count held for this function */
2186 lpfc_nlp_put(ndlp);
2187 } else {
2188 lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
2189 "0212 DSM out state %d on NPort free\n", rc);
2172 2190
2173 lpfc_nlp_put(ndlp); 2191 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM,
2192 "DSM out: ste:%d did:x%x flg:x%x",
2193 rc, 0, 0);
2194 }
2174 2195
2175 return rc; 2196 return rc;
2176} 2197}
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index fc5c3a42b05a..70255c11d3ad 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -1283,6 +1283,8 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
1283 match = 0; 1283 match = 0;
1284 spin_lock_irq(shost->host_lock); 1284 spin_lock_irq(shost->host_lock);
1285 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { 1285 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
1286 if (!NLP_CHK_NODE_ACT(ndlp))
1287 continue;
1286 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && 1288 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE &&
1287 i == ndlp->nlp_sid && 1289 i == ndlp->nlp_sid &&
1288 ndlp->rport) { 1290 ndlp->rport) {
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index fdd01e384e36..fc0d9501aba6 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2007 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -203,8 +203,25 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
203 case CMD_IOCB_RCV_SEQ64_CX: 203 case CMD_IOCB_RCV_SEQ64_CX:
204 case CMD_IOCB_RCV_ELS64_CX: 204 case CMD_IOCB_RCV_ELS64_CX:
205 case CMD_IOCB_RCV_CONT64_CX: 205 case CMD_IOCB_RCV_CONT64_CX:
206 case CMD_IOCB_RET_XRI64_CX:
206 type = LPFC_UNSOL_IOCB; 207 type = LPFC_UNSOL_IOCB;
207 break; 208 break;
209 case CMD_IOCB_XMIT_MSEQ64_CR:
210 case CMD_IOCB_XMIT_MSEQ64_CX:
211 case CMD_IOCB_RCV_SEQ_LIST64_CX:
212 case CMD_IOCB_RCV_ELS_LIST64_CX:
213 case CMD_IOCB_CLOSE_EXTENDED_CN:
214 case CMD_IOCB_ABORT_EXTENDED_CN:
215 case CMD_IOCB_RET_HBQE64_CN:
216 case CMD_IOCB_FCP_IBIDIR64_CR:
217 case CMD_IOCB_FCP_IBIDIR64_CX:
218 case CMD_IOCB_FCP_ITASKMGT64_CX:
219 case CMD_IOCB_LOGENTRY_CN:
220 case CMD_IOCB_LOGENTRY_ASYNC_CN:
221 printk("%s - Unhandled SLI-3 Command x%x\n",
222 __FUNCTION__, iocb_cmnd);
223 type = LPFC_UNKNOWN_IOCB;
224 break;
208 default: 225 default:
209 type = LPFC_UNKNOWN_IOCB; 226 type = LPFC_UNKNOWN_IOCB;
210 break; 227 break;
@@ -529,10 +546,13 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba)
529{ 546{
530 struct lpfc_dmabuf *dmabuf, *next_dmabuf; 547 struct lpfc_dmabuf *dmabuf, *next_dmabuf;
531 struct hbq_dmabuf *hbq_buf; 548 struct hbq_dmabuf *hbq_buf;
549 unsigned long flags;
532 int i, hbq_count; 550 int i, hbq_count;
551 uint32_t hbqno;
533 552
534 hbq_count = lpfc_sli_hbq_count(); 553 hbq_count = lpfc_sli_hbq_count();
535 /* Return all memory used by all HBQs */ 554 /* Return all memory used by all HBQs */
555 spin_lock_irqsave(&phba->hbalock, flags);
536 for (i = 0; i < hbq_count; ++i) { 556 for (i = 0; i < hbq_count; ++i) {
537 list_for_each_entry_safe(dmabuf, next_dmabuf, 557 list_for_each_entry_safe(dmabuf, next_dmabuf,
538 &phba->hbqs[i].hbq_buffer_list, list) { 558 &phba->hbqs[i].hbq_buffer_list, list) {
@@ -542,6 +562,28 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba)
542 } 562 }
543 phba->hbqs[i].buffer_count = 0; 563 phba->hbqs[i].buffer_count = 0;
544 } 564 }
565 /* Return all HBQ buffer that are in-fly */
566 list_for_each_entry_safe(dmabuf, next_dmabuf,
567 &phba->hbqbuf_in_list, list) {
568 hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf);
569 list_del(&hbq_buf->dbuf.list);
570 if (hbq_buf->tag == -1) {
571 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer)
572 (phba, hbq_buf);
573 } else {
574 hbqno = hbq_buf->tag >> 16;
575 if (hbqno >= LPFC_MAX_HBQS)
576 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer)
577 (phba, hbq_buf);
578 else
579 (phba->hbqs[hbqno].hbq_free_buffer)(phba,
580 hbq_buf);
581 }
582 }
583
584 /* Mark the HBQs not in use */
585 phba->hbq_in_use = 0;
586 spin_unlock_irqrestore(&phba->hbalock, flags);
545} 587}
546 588
547static struct lpfc_hbq_entry * 589static struct lpfc_hbq_entry *
@@ -603,30 +645,40 @@ static int
603lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) 645lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
604{ 646{
605 uint32_t i, start, end; 647 uint32_t i, start, end;
648 unsigned long flags;
606 struct hbq_dmabuf *hbq_buffer; 649 struct hbq_dmabuf *hbq_buffer;
607 650
608 if (!phba->hbqs[hbqno].hbq_alloc_buffer) { 651 if (!phba->hbqs[hbqno].hbq_alloc_buffer)
609 return 0; 652 return 0;
610 }
611 653
612 start = phba->hbqs[hbqno].buffer_count; 654 start = phba->hbqs[hbqno].buffer_count;
613 end = count + start; 655 end = count + start;
614 if (end > lpfc_hbq_defs[hbqno]->entry_count) { 656 if (end > lpfc_hbq_defs[hbqno]->entry_count)
615 end = lpfc_hbq_defs[hbqno]->entry_count; 657 end = lpfc_hbq_defs[hbqno]->entry_count;
616 } 658
659 /* Check whether HBQ is still in use */
660 spin_lock_irqsave(&phba->hbalock, flags);
661 if (!phba->hbq_in_use)
662 goto out;
617 663
618 /* Populate HBQ entries */ 664 /* Populate HBQ entries */
619 for (i = start; i < end; i++) { 665 for (i = start; i < end; i++) {
620 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); 666 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
621 if (!hbq_buffer) 667 if (!hbq_buffer)
622 return 1; 668 goto err;
623 hbq_buffer->tag = (i | (hbqno << 16)); 669 hbq_buffer->tag = (i | (hbqno << 16));
624 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) 670 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
625 phba->hbqs[hbqno].buffer_count++; 671 phba->hbqs[hbqno].buffer_count++;
626 else 672 else
627 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); 673 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
628 } 674 }
675
676 out:
677 spin_unlock_irqrestore(&phba->hbalock, flags);
629 return 0; 678 return 0;
679 err:
680 spin_unlock_irqrestore(&phba->hbalock, flags);
681 return 1;
630} 682}
631 683
632int 684int
@@ -910,16 +962,29 @@ lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag)
910 uint32_t hbqno; 962 uint32_t hbqno;
911 void *virt; /* virtual address ptr */ 963 void *virt; /* virtual address ptr */
912 dma_addr_t phys; /* mapped address */ 964 dma_addr_t phys; /* mapped address */
965 unsigned long flags;
966
967 /* Check whether HBQ is still in use */
968 spin_lock_irqsave(&phba->hbalock, flags);
969 if (!phba->hbq_in_use) {
970 spin_unlock_irqrestore(&phba->hbalock, flags);
971 return NULL;
972 }
913 973
914 hbq_entry = lpfc_sli_hbqbuf_find(phba, tag); 974 hbq_entry = lpfc_sli_hbqbuf_find(phba, tag);
915 if (hbq_entry == NULL) 975 if (hbq_entry == NULL) {
976 spin_unlock_irqrestore(&phba->hbalock, flags);
916 return NULL; 977 return NULL;
978 }
917 list_del(&hbq_entry->dbuf.list); 979 list_del(&hbq_entry->dbuf.list);
918 980
919 hbqno = tag >> 16; 981 hbqno = tag >> 16;
920 new_hbq_entry = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); 982 new_hbq_entry = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
921 if (new_hbq_entry == NULL) 983 if (new_hbq_entry == NULL) {
984 list_add_tail(&hbq_entry->dbuf.list, &phba->hbqbuf_in_list);
985 spin_unlock_irqrestore(&phba->hbalock, flags);
922 return &hbq_entry->dbuf; 986 return &hbq_entry->dbuf;
987 }
923 new_hbq_entry->tag = -1; 988 new_hbq_entry->tag = -1;
924 phys = new_hbq_entry->dbuf.phys; 989 phys = new_hbq_entry->dbuf.phys;
925 virt = new_hbq_entry->dbuf.virt; 990 virt = new_hbq_entry->dbuf.virt;
@@ -928,6 +993,9 @@ lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag)
928 hbq_entry->dbuf.phys = phys; 993 hbq_entry->dbuf.phys = phys;
929 hbq_entry->dbuf.virt = virt; 994 hbq_entry->dbuf.virt = virt;
930 lpfc_sli_free_hbq(phba, hbq_entry); 995 lpfc_sli_free_hbq(phba, hbq_entry);
996 list_add_tail(&new_hbq_entry->dbuf.list, &phba->hbqbuf_in_list);
997 spin_unlock_irqrestore(&phba->hbalock, flags);
998
931 return &new_hbq_entry->dbuf; 999 return &new_hbq_entry->dbuf;
932} 1000}
933 1001
@@ -951,6 +1019,7 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
951 uint32_t Rctl, Type; 1019 uint32_t Rctl, Type;
952 uint32_t match, i; 1020 uint32_t match, i;
953 struct lpfc_iocbq *iocbq; 1021 struct lpfc_iocbq *iocbq;
1022 struct lpfc_dmabuf *dmzbuf;
954 1023
955 match = 0; 1024 match = 0;
956 irsp = &(saveq->iocb); 1025 irsp = &(saveq->iocb);
@@ -972,6 +1041,29 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
972 return 1; 1041 return 1;
973 } 1042 }
974 1043
1044 if ((irsp->ulpCommand == CMD_IOCB_RET_XRI64_CX) &&
1045 (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)) {
1046 if (irsp->ulpBdeCount > 0) {
1047 dmzbuf = lpfc_sli_get_buff(phba, pring,
1048 irsp->un.ulpWord[3]);
1049 lpfc_in_buf_free(phba, dmzbuf);
1050 }
1051
1052 if (irsp->ulpBdeCount > 1) {
1053 dmzbuf = lpfc_sli_get_buff(phba, pring,
1054 irsp->unsli3.sli3Words[3]);
1055 lpfc_in_buf_free(phba, dmzbuf);
1056 }
1057
1058 if (irsp->ulpBdeCount > 2) {
1059 dmzbuf = lpfc_sli_get_buff(phba, pring,
1060 irsp->unsli3.sli3Words[7]);
1061 lpfc_in_buf_free(phba, dmzbuf);
1062 }
1063
1064 return 1;
1065 }
1066
975 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { 1067 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
976 if (irsp->ulpBdeCount != 0) { 1068 if (irsp->ulpBdeCount != 0) {
977 saveq->context2 = lpfc_sli_get_buff(phba, pring, 1069 saveq->context2 = lpfc_sli_get_buff(phba, pring,
@@ -2293,6 +2385,7 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba)
2293 2385
2294 /* Initialize the struct lpfc_sli_hbq structure for each hbq */ 2386 /* Initialize the struct lpfc_sli_hbq structure for each hbq */
2295 phba->link_state = LPFC_INIT_MBX_CMDS; 2387 phba->link_state = LPFC_INIT_MBX_CMDS;
2388 phba->hbq_in_use = 1;
2296 2389
2297 hbq_entry_index = 0; 2390 hbq_entry_index = 0;
2298 for (hbqno = 0; hbqno < hbq_count; ++hbqno) { 2391 for (hbqno = 0; hbqno < hbq_count; ++hbqno) {
@@ -2404,9 +2497,7 @@ lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode)
2404 if ((pmb->mb.un.varCfgPort.sli_mode == 3) && 2497 if ((pmb->mb.un.varCfgPort.sli_mode == 3) &&
2405 (!pmb->mb.un.varCfgPort.cMA)) { 2498 (!pmb->mb.un.varCfgPort.cMA)) {
2406 rc = -ENXIO; 2499 rc = -ENXIO;
2407 goto do_prep_failed;
2408 } 2500 }
2409 return rc;
2410 2501
2411do_prep_failed: 2502do_prep_failed:
2412 mempool_free(pmb, phba->mbox_mem_pool); 2503 mempool_free(pmb, phba->mbox_mem_pool);
@@ -2625,14 +2716,14 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
2625 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); 2716 spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
2626 2717
2627 /* Mbox command <mbxCommand> cannot issue */ 2718 /* Mbox command <mbxCommand> cannot issue */
2628 LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag) 2719 LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag);
2629 return MBX_NOT_FINISHED; 2720 return MBX_NOT_FINISHED;
2630 } 2721 }
2631 2722
2632 if (mb->mbxCommand != MBX_KILL_BOARD && flag & MBX_NOWAIT && 2723 if (mb->mbxCommand != MBX_KILL_BOARD && flag & MBX_NOWAIT &&
2633 !(readl(phba->HCregaddr) & HC_MBINT_ENA)) { 2724 !(readl(phba->HCregaddr) & HC_MBINT_ENA)) {
2634 spin_unlock_irqrestore(&phba->hbalock, drvr_flag); 2725 spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
2635 LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag) 2726 LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag);
2636 return MBX_NOT_FINISHED; 2727 return MBX_NOT_FINISHED;
2637 } 2728 }
2638 2729
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index 4b633d39a82a..ca540d1d041e 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,7 +18,7 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define LPFC_DRIVER_VERSION "8.2.4" 21#define LPFC_DRIVER_VERSION "8.2.5"
22 22
23#define LPFC_DRIVER_NAME "lpfc" 23#define LPFC_DRIVER_NAME "lpfc"
24 24
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 9fad7663c117..86d05beb00b8 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2006 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig * 7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
@@ -327,7 +327,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
327 * up and ready to FDISC. 327 * up and ready to FDISC.
328 */ 328 */
329 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); 329 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
330 if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { 330 if (ndlp && NLP_CHK_NODE_ACT(ndlp) &&
331 ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) {
331 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) { 332 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) {
332 lpfc_set_disctmo(vport); 333 lpfc_set_disctmo(vport);
333 lpfc_initial_fdisc(vport); 334 lpfc_initial_fdisc(vport);
@@ -358,7 +359,8 @@ disable_vport(struct fc_vport *fc_vport)
358 long timeout; 359 long timeout;
359 360
360 ndlp = lpfc_findnode_did(vport, Fabric_DID); 361 ndlp = lpfc_findnode_did(vport, Fabric_DID);
361 if (ndlp && phba->link_state >= LPFC_LINK_UP) { 362 if (ndlp && NLP_CHK_NODE_ACT(ndlp)
363 && phba->link_state >= LPFC_LINK_UP) {
362 vport->unreg_vpi_cmpl = VPORT_INVAL; 364 vport->unreg_vpi_cmpl = VPORT_INVAL;
363 timeout = msecs_to_jiffies(phba->fc_ratov * 2000); 365 timeout = msecs_to_jiffies(phba->fc_ratov * 2000);
364 if (!lpfc_issue_els_npiv_logo(vport, ndlp)) 366 if (!lpfc_issue_els_npiv_logo(vport, ndlp))
@@ -372,6 +374,8 @@ disable_vport(struct fc_vport *fc_vport)
372 * calling lpfc_cleanup_rpis(vport, 1) 374 * calling lpfc_cleanup_rpis(vport, 1)
373 */ 375 */
374 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { 376 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
377 if (!NLP_CHK_NODE_ACT(ndlp))
378 continue;
375 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) 379 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
376 continue; 380 continue;
377 lpfc_disc_state_machine(vport, ndlp, NULL, 381 lpfc_disc_state_machine(vport, ndlp, NULL,
@@ -414,7 +418,8 @@ enable_vport(struct fc_vport *fc_vport)
414 * up and ready to FDISC. 418 * up and ready to FDISC.
415 */ 419 */
416 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); 420 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
417 if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { 421 if (ndlp && NLP_CHK_NODE_ACT(ndlp)
422 && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) {
418 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) { 423 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) {
419 lpfc_set_disctmo(vport); 424 lpfc_set_disctmo(vport);
420 lpfc_initial_fdisc(vport); 425 lpfc_initial_fdisc(vport);
@@ -498,7 +503,41 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
498 scsi_remove_host(lpfc_shost_from_vport(vport)); 503 scsi_remove_host(lpfc_shost_from_vport(vport));
499 504
500 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); 505 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
501 if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE && 506
507 /* In case of driver unload, we shall not perform fabric logo as the
508 * worker thread already stopped at this stage and, in this case, we
509 * can safely skip the fabric logo.
510 */
511 if (phba->pport->load_flag & FC_UNLOADING) {
512 if (ndlp && NLP_CHK_NODE_ACT(ndlp) &&
513 ndlp->nlp_state == NLP_STE_UNMAPPED_NODE &&
514 phba->link_state >= LPFC_LINK_UP) {
515 /* First look for the Fabric ndlp */
516 ndlp = lpfc_findnode_did(vport, Fabric_DID);
517 if (!ndlp)
518 goto skip_logo;
519 else if (!NLP_CHK_NODE_ACT(ndlp)) {
520 ndlp = lpfc_enable_node(vport, ndlp,
521 NLP_STE_UNUSED_NODE);
522 if (!ndlp)
523 goto skip_logo;
524 }
525 /* Remove ndlp from vport npld list */
526 lpfc_dequeue_node(vport, ndlp);
527
528 /* Indicate free memory when release */
529 spin_lock_irq(&phba->ndlp_lock);
530 NLP_SET_FREE_REQ(ndlp);
531 spin_unlock_irq(&phba->ndlp_lock);
532 /* Kick off release ndlp when it can be safely done */
533 lpfc_nlp_put(ndlp);
534 }
535 goto skip_logo;
536 }
537
538 /* Otherwise, we will perform fabric logo as needed */
539 if (ndlp && NLP_CHK_NODE_ACT(ndlp) &&
540 ndlp->nlp_state == NLP_STE_UNMAPPED_NODE &&
502 phba->link_state >= LPFC_LINK_UP) { 541 phba->link_state >= LPFC_LINK_UP) {
503 if (vport->cfg_enable_da_id) { 542 if (vport->cfg_enable_da_id) {
504 timeout = msecs_to_jiffies(phba->fc_ratov * 2000); 543 timeout = msecs_to_jiffies(phba->fc_ratov * 2000);
@@ -519,8 +558,27 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
519 if (!ndlp) 558 if (!ndlp)
520 goto skip_logo; 559 goto skip_logo;
521 lpfc_nlp_init(vport, ndlp, Fabric_DID); 560 lpfc_nlp_init(vport, ndlp, Fabric_DID);
561 /* Indicate free memory when release */
562 NLP_SET_FREE_REQ(ndlp);
522 } else { 563 } else {
564 if (!NLP_CHK_NODE_ACT(ndlp))
565 ndlp = lpfc_enable_node(vport, ndlp,
566 NLP_STE_UNUSED_NODE);
567 if (!ndlp)
568 goto skip_logo;
569
570 /* Remove ndlp from vport npld list */
523 lpfc_dequeue_node(vport, ndlp); 571 lpfc_dequeue_node(vport, ndlp);
572 spin_lock_irq(&phba->ndlp_lock);
573 if (!NLP_CHK_FREE_REQ(ndlp))
574 /* Indicate free memory when release */
575 NLP_SET_FREE_REQ(ndlp);
576 else {
577 /* Skip this if ndlp is already in free mode */
578 spin_unlock_irq(&phba->ndlp_lock);
579 goto skip_logo;
580 }
581 spin_unlock_irq(&phba->ndlp_lock);
524 } 582 }
525 vport->unreg_vpi_cmpl = VPORT_INVAL; 583 vport->unreg_vpi_cmpl = VPORT_INVAL;
526 timeout = msecs_to_jiffies(phba->fc_ratov * 2000); 584 timeout = msecs_to_jiffies(phba->fc_ratov * 2000);
@@ -534,9 +592,9 @@ skip_logo:
534 lpfc_sli_host_down(vport); 592 lpfc_sli_host_down(vport);
535 593
536 lpfc_stop_vport_timers(vport); 594 lpfc_stop_vport_timers(vport);
537 lpfc_unreg_all_rpis(vport);
538 595
539 if (!(phba->pport->load_flag & FC_UNLOADING)) { 596 if (!(phba->pport->load_flag & FC_UNLOADING)) {
597 lpfc_unreg_all_rpis(vport);
540 lpfc_unreg_default_rpis(vport); 598 lpfc_unreg_default_rpis(vport);
541 /* 599 /*
542 * Completion of unreg_vpi (lpfc_mbx_cmpl_unreg_vpi) 600 * Completion of unreg_vpi (lpfc_mbx_cmpl_unreg_vpi)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 4d59ae8491a4..b135a1ed4b2c 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -151,19 +151,19 @@ mega_setup_mailbox(adapter_t *adapter)
151 */ 151 */
152 if( adapter->flag & BOARD_IOMAP ) { 152 if( adapter->flag & BOARD_IOMAP ) {
153 153
154 outb_p(adapter->mbox_dma & 0xFF, 154 outb(adapter->mbox_dma & 0xFF,
155 adapter->host->io_port + MBOX_PORT0); 155 adapter->host->io_port + MBOX_PORT0);
156 156
157 outb_p((adapter->mbox_dma >> 8) & 0xFF, 157 outb((adapter->mbox_dma >> 8) & 0xFF,
158 adapter->host->io_port + MBOX_PORT1); 158 adapter->host->io_port + MBOX_PORT1);
159 159
160 outb_p((adapter->mbox_dma >> 16) & 0xFF, 160 outb((adapter->mbox_dma >> 16) & 0xFF,
161 adapter->host->io_port + MBOX_PORT2); 161 adapter->host->io_port + MBOX_PORT2);
162 162
163 outb_p((adapter->mbox_dma >> 24) & 0xFF, 163 outb((adapter->mbox_dma >> 24) & 0xFF,
164 adapter->host->io_port + MBOX_PORT3); 164 adapter->host->io_port + MBOX_PORT3);
165 165
166 outb_p(ENABLE_MBOX_BYTE, 166 outb(ENABLE_MBOX_BYTE,
167 adapter->host->io_port + ENABLE_MBOX_REGION); 167 adapter->host->io_port + ENABLE_MBOX_REGION);
168 168
169 irq_ack(adapter); 169 irq_ack(adapter);
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index b6587a6d8486..0ad215e27b83 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -59,7 +59,6 @@ EXPORT_SYMBOL(mraid_mm_register_adp);
59EXPORT_SYMBOL(mraid_mm_unregister_adp); 59EXPORT_SYMBOL(mraid_mm_unregister_adp);
60EXPORT_SYMBOL(mraid_mm_adapter_app_handle); 60EXPORT_SYMBOL(mraid_mm_adapter_app_handle);
61 61
62static int majorno;
63static uint32_t drvr_ver = 0x02200207; 62static uint32_t drvr_ver = 0x02200207;
64 63
65static int adapters_count_g; 64static int adapters_count_g;
@@ -76,6 +75,12 @@ static const struct file_operations lsi_fops = {
76 .owner = THIS_MODULE, 75 .owner = THIS_MODULE,
77}; 76};
78 77
78static struct miscdevice megaraid_mm_dev = {
79 .minor = MISC_DYNAMIC_MINOR,
80 .name = "megadev0",
81 .fops = &lsi_fops,
82};
83
79/** 84/**
80 * mraid_mm_open - open routine for char node interface 85 * mraid_mm_open - open routine for char node interface
81 * @inode : unused 86 * @inode : unused
@@ -1184,15 +1189,16 @@ mraid_mm_teardown_dma_pools(mraid_mmadp_t *adp)
1184static int __init 1189static int __init
1185mraid_mm_init(void) 1190mraid_mm_init(void)
1186{ 1191{
1192 int err;
1193
1187 // Announce the driver version 1194 // Announce the driver version
1188 con_log(CL_ANN, (KERN_INFO "megaraid cmm: %s %s\n", 1195 con_log(CL_ANN, (KERN_INFO "megaraid cmm: %s %s\n",
1189 LSI_COMMON_MOD_VERSION, LSI_COMMON_MOD_EXT_VERSION)); 1196 LSI_COMMON_MOD_VERSION, LSI_COMMON_MOD_EXT_VERSION));
1190 1197
1191 majorno = register_chrdev(0, "megadev", &lsi_fops); 1198 err = misc_register(&megaraid_mm_dev);
1192 1199 if (err < 0) {
1193 if (majorno < 0) { 1200 con_log(CL_ANN, ("megaraid cmm: cannot register misc device\n"));
1194 con_log(CL_ANN, ("megaraid cmm: cannot get major\n")); 1201 return err;
1195 return majorno;
1196 } 1202 }
1197 1203
1198 init_waitqueue_head(&wait_q); 1204 init_waitqueue_head(&wait_q);
@@ -1230,7 +1236,7 @@ mraid_mm_exit(void)
1230{ 1236{
1231 con_log(CL_DLEVEL1 , ("exiting common mod\n")); 1237 con_log(CL_DLEVEL1 , ("exiting common mod\n"));
1232 1238
1233 unregister_chrdev(majorno, "megadev"); 1239 misc_deregister(&megaraid_mm_dev);
1234} 1240}
1235 1241
1236module_init(mraid_mm_init); 1242module_init(mraid_mm_init);
diff --git a/drivers/scsi/megaraid/megaraid_mm.h b/drivers/scsi/megaraid/megaraid_mm.h
index c8762b2b8ed1..55b425c0a654 100644
--- a/drivers/scsi/megaraid/megaraid_mm.h
+++ b/drivers/scsi/megaraid/megaraid_mm.h
@@ -22,6 +22,7 @@
22#include <linux/moduleparam.h> 22#include <linux/moduleparam.h>
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/miscdevice.h>
25 26
26#include "mbox_defs.h" 27#include "mbox_defs.h"
27#include "megaraid_ioctl.h" 28#include "megaraid_ioctl.h"
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index 651d09b08f2a..fd63b06d9ef1 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1759,6 +1759,7 @@ static int mesh_suspend(struct macio_dev *mdev, pm_message_t mesg)
1759 1759
1760 switch (mesg.event) { 1760 switch (mesg.event) {
1761 case PM_EVENT_SUSPEND: 1761 case PM_EVENT_SUSPEND:
1762 case PM_EVENT_HIBERNATE:
1762 case PM_EVENT_FREEZE: 1763 case PM_EVENT_FREEZE:
1763 break; 1764 break;
1764 default: 1765 default:
diff --git a/drivers/scsi/mvsas.c b/drivers/scsi/mvsas.c
new file mode 100644
index 000000000000..d4a6ac3c9c47
--- /dev/null
+++ b/drivers/scsi/mvsas.c
@@ -0,0 +1,2970 @@
1/*
2 mvsas.c - Marvell 88SE6440 SAS/SATA support
3
4 Copyright 2007 Red Hat, Inc.
5 Copyright 2008 Marvell. <kewei@marvell.com>
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2,
10 or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty
14 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public
18 License along with this program; see the file COPYING. If not,
19 write to the Free Software Foundation, 675 Mass Ave, Cambridge,
20 MA 02139, USA.
21
22 ---------------------------------------------------------------
23
24 Random notes:
25 * hardware supports controlling the endian-ness of data
26 structures. this permits elimination of all the le32_to_cpu()
27 and cpu_to_le32() conversions.
28
29 */
30
31#include <linux/kernel.h>
32#include <linux/module.h>
33#include <linux/pci.h>
34#include <linux/interrupt.h>
35#include <linux/spinlock.h>
36#include <linux/delay.h>
37#include <linux/dma-mapping.h>
38#include <linux/ctype.h>
39#include <scsi/libsas.h>
40#include <asm/io.h>
41
42#define DRV_NAME "mvsas"
43#define DRV_VERSION "0.5"
44#define _MV_DUMP 0
45#define MVS_DISABLE_NVRAM
46#define MVS_DISABLE_MSI
47
48#define mr32(reg) readl(regs + MVS_##reg)
49#define mw32(reg,val) writel((val), regs + MVS_##reg)
50#define mw32_f(reg,val) do { \
51 writel((val), regs + MVS_##reg); \
52 readl(regs + MVS_##reg); \
53 } while (0)
54
55#define MVS_ID_NOT_MAPPED 0xff
56#define MVS_CHIP_SLOT_SZ (1U << mvi->chip->slot_width)
57
58/* offset for D2H FIS in the Received FIS List Structure */
59#define SATA_RECEIVED_D2H_FIS(reg_set) \
60 ((void *) mvi->rx_fis + 0x400 + 0x100 * reg_set + 0x40)
61#define SATA_RECEIVED_PIO_FIS(reg_set) \
62 ((void *) mvi->rx_fis + 0x400 + 0x100 * reg_set + 0x20)
63#define UNASSOC_D2H_FIS(id) \
64 ((void *) mvi->rx_fis + 0x100 * id)
65
66#define for_each_phy(__lseq_mask, __mc, __lseq, __rest) \
67 for ((__mc) = (__lseq_mask), (__lseq) = 0; \
68 (__mc) != 0 && __rest; \
69 (++__lseq), (__mc) >>= 1)
70
71/* driver compile-time configuration */
72enum driver_configuration {
73 MVS_TX_RING_SZ = 1024, /* TX ring size (12-bit) */
74 MVS_RX_RING_SZ = 1024, /* RX ring size (12-bit) */
75 /* software requires power-of-2
76 ring size */
77
78 MVS_SLOTS = 512, /* command slots */
79 MVS_SLOT_BUF_SZ = 8192, /* cmd tbl + IU + status + PRD */
80 MVS_SSP_CMD_SZ = 64, /* SSP command table buffer size */
81 MVS_ATA_CMD_SZ = 96, /* SATA command table buffer size */
82 MVS_OAF_SZ = 64, /* Open address frame buffer size */
83
84 MVS_RX_FIS_COUNT = 17, /* Optional rx'd FISs (max 17) */
85
86 MVS_QUEUE_SIZE = 30, /* Support Queue depth */
87};
88
89/* unchangeable hardware details */
90enum hardware_details {
91 MVS_MAX_PHYS = 8, /* max. possible phys */
92 MVS_MAX_PORTS = 8, /* max. possible ports */
93 MVS_RX_FISL_SZ = 0x400 + (MVS_RX_FIS_COUNT * 0x100),
94};
95
96/* peripheral registers (BAR2) */
97enum peripheral_registers {
98 SPI_CTL = 0x10, /* EEPROM control */
99 SPI_CMD = 0x14, /* EEPROM command */
100 SPI_DATA = 0x18, /* EEPROM data */
101};
102
103enum peripheral_register_bits {
104 TWSI_RDY = (1U << 7), /* EEPROM interface ready */
105 TWSI_RD = (1U << 4), /* EEPROM read access */
106
107 SPI_ADDR_MASK = 0x3ffff, /* bits 17:0 */
108};
109
110/* enhanced mode registers (BAR4) */
111enum hw_registers {
112 MVS_GBL_CTL = 0x04, /* global control */
113 MVS_GBL_INT_STAT = 0x08, /* global irq status */
114 MVS_GBL_PI = 0x0C, /* ports implemented bitmask */
115 MVS_GBL_PORT_TYPE = 0xa0, /* port type */
116
117 MVS_CTL = 0x100, /* SAS/SATA port configuration */
118 MVS_PCS = 0x104, /* SAS/SATA port control/status */
119 MVS_CMD_LIST_LO = 0x108, /* cmd list addr */
120 MVS_CMD_LIST_HI = 0x10C,
121 MVS_RX_FIS_LO = 0x110, /* RX FIS list addr */
122 MVS_RX_FIS_HI = 0x114,
123
124 MVS_TX_CFG = 0x120, /* TX configuration */
125 MVS_TX_LO = 0x124, /* TX (delivery) ring addr */
126 MVS_TX_HI = 0x128,
127
128 MVS_TX_PROD_IDX = 0x12C, /* TX producer pointer */
129 MVS_TX_CONS_IDX = 0x130, /* TX consumer pointer (RO) */
130 MVS_RX_CFG = 0x134, /* RX configuration */
131 MVS_RX_LO = 0x138, /* RX (completion) ring addr */
132 MVS_RX_HI = 0x13C,
133 MVS_RX_CONS_IDX = 0x140, /* RX consumer pointer (RO) */
134
135 MVS_INT_COAL = 0x148, /* Int coalescing config */
136 MVS_INT_COAL_TMOUT = 0x14C, /* Int coalescing timeout */
137 MVS_INT_STAT = 0x150, /* Central int status */
138 MVS_INT_MASK = 0x154, /* Central int enable */
139 MVS_INT_STAT_SRS = 0x158, /* SATA register set status */
140 MVS_INT_MASK_SRS = 0x15C,
141
142 /* ports 1-3 follow after this */
143 MVS_P0_INT_STAT = 0x160, /* port0 interrupt status */
144 MVS_P0_INT_MASK = 0x164, /* port0 interrupt mask */
145 MVS_P4_INT_STAT = 0x200, /* Port 4 interrupt status */
146 MVS_P4_INT_MASK = 0x204, /* Port 4 interrupt enable mask */
147
148 /* ports 1-3 follow after this */
149 MVS_P0_SER_CTLSTAT = 0x180, /* port0 serial control/status */
150 MVS_P4_SER_CTLSTAT = 0x220, /* port4 serial control/status */
151
152 MVS_CMD_ADDR = 0x1B8, /* Command register port (addr) */
153 MVS_CMD_DATA = 0x1BC, /* Command register port (data) */
154
155 /* ports 1-3 follow after this */
156 MVS_P0_CFG_ADDR = 0x1C0, /* port0 phy register address */
157 MVS_P0_CFG_DATA = 0x1C4, /* port0 phy register data */
158 MVS_P4_CFG_ADDR = 0x230, /* Port 4 config address */
159 MVS_P4_CFG_DATA = 0x234, /* Port 4 config data */
160
161 /* ports 1-3 follow after this */
162 MVS_P0_VSR_ADDR = 0x1E0, /* port0 VSR address */
163 MVS_P0_VSR_DATA = 0x1E4, /* port0 VSR data */
164 MVS_P4_VSR_ADDR = 0x250, /* port 4 VSR addr */
165 MVS_P4_VSR_DATA = 0x254, /* port 4 VSR data */
166};
167
168enum hw_register_bits {
169 /* MVS_GBL_CTL */
170 INT_EN = (1U << 1), /* Global int enable */
171 HBA_RST = (1U << 0), /* HBA reset */
172
173 /* MVS_GBL_INT_STAT */
174 INT_XOR = (1U << 4), /* XOR engine event */
175 INT_SAS_SATA = (1U << 0), /* SAS/SATA event */
176
177 /* MVS_GBL_PORT_TYPE */ /* shl for ports 1-3 */
178 SATA_TARGET = (1U << 16), /* port0 SATA target enable */
179 MODE_AUTO_DET_PORT7 = (1U << 15), /* port0 SAS/SATA autodetect */
180 MODE_AUTO_DET_PORT6 = (1U << 14),
181 MODE_AUTO_DET_PORT5 = (1U << 13),
182 MODE_AUTO_DET_PORT4 = (1U << 12),
183 MODE_AUTO_DET_PORT3 = (1U << 11),
184 MODE_AUTO_DET_PORT2 = (1U << 10),
185 MODE_AUTO_DET_PORT1 = (1U << 9),
186 MODE_AUTO_DET_PORT0 = (1U << 8),
187 MODE_AUTO_DET_EN = MODE_AUTO_DET_PORT0 | MODE_AUTO_DET_PORT1 |
188 MODE_AUTO_DET_PORT2 | MODE_AUTO_DET_PORT3 |
189 MODE_AUTO_DET_PORT4 | MODE_AUTO_DET_PORT5 |
190 MODE_AUTO_DET_PORT6 | MODE_AUTO_DET_PORT7,
191 MODE_SAS_PORT7_MASK = (1U << 7), /* port0 SAS(1), SATA(0) mode */
192 MODE_SAS_PORT6_MASK = (1U << 6),
193 MODE_SAS_PORT5_MASK = (1U << 5),
194 MODE_SAS_PORT4_MASK = (1U << 4),
195 MODE_SAS_PORT3_MASK = (1U << 3),
196 MODE_SAS_PORT2_MASK = (1U << 2),
197 MODE_SAS_PORT1_MASK = (1U << 1),
198 MODE_SAS_PORT0_MASK = (1U << 0),
199 MODE_SAS_SATA = MODE_SAS_PORT0_MASK | MODE_SAS_PORT1_MASK |
200 MODE_SAS_PORT2_MASK | MODE_SAS_PORT3_MASK |
201 MODE_SAS_PORT4_MASK | MODE_SAS_PORT5_MASK |
202 MODE_SAS_PORT6_MASK | MODE_SAS_PORT7_MASK,
203
204 /* SAS_MODE value may be
205 * dictated (in hw) by values
206 * of SATA_TARGET & AUTO_DET
207 */
208
209 /* MVS_TX_CFG */
210 TX_EN = (1U << 16), /* Enable TX */
211 TX_RING_SZ_MASK = 0xfff, /* TX ring size, bits 11:0 */
212
213 /* MVS_RX_CFG */
214 RX_EN = (1U << 16), /* Enable RX */
215 RX_RING_SZ_MASK = 0xfff, /* RX ring size, bits 11:0 */
216
217 /* MVS_INT_COAL */
218 COAL_EN = (1U << 16), /* Enable int coalescing */
219
220 /* MVS_INT_STAT, MVS_INT_MASK */
221 CINT_I2C = (1U << 31), /* I2C event */
222 CINT_SW0 = (1U << 30), /* software event 0 */
223 CINT_SW1 = (1U << 29), /* software event 1 */
224 CINT_PRD_BC = (1U << 28), /* PRD BC err for read cmd */
225 CINT_DMA_PCIE = (1U << 27), /* DMA to PCIE timeout */
226 CINT_MEM = (1U << 26), /* int mem parity err */
227 CINT_I2C_SLAVE = (1U << 25), /* slave I2C event */
228 CINT_SRS = (1U << 3), /* SRS event */
229 CINT_CI_STOP = (1U << 1), /* cmd issue stopped */
230 CINT_DONE = (1U << 0), /* cmd completion */
231
232 /* shl for ports 1-3 */
233 CINT_PORT_STOPPED = (1U << 16), /* port0 stopped */
234 CINT_PORT = (1U << 8), /* port0 event */
235 CINT_PORT_MASK_OFFSET = 8,
236 CINT_PORT_MASK = (0xFF << CINT_PORT_MASK_OFFSET),
237
238 /* TX (delivery) ring bits */
239 TXQ_CMD_SHIFT = 29,
240 TXQ_CMD_SSP = 1, /* SSP protocol */
241 TXQ_CMD_SMP = 2, /* SMP protocol */
242 TXQ_CMD_STP = 3, /* STP/SATA protocol */
243 TXQ_CMD_SSP_FREE_LIST = 4, /* add to SSP targ free list */
244 TXQ_CMD_SLOT_RESET = 7, /* reset command slot */
245 TXQ_MODE_I = (1U << 28), /* mode: 0=target,1=initiator */
246 TXQ_PRIO_HI = (1U << 27), /* priority: 0=normal, 1=high */
247 TXQ_SRS_SHIFT = 20, /* SATA register set */
248 TXQ_SRS_MASK = 0x7f,
249 TXQ_PHY_SHIFT = 12, /* PHY bitmap */
250 TXQ_PHY_MASK = 0xff,
251 TXQ_SLOT_MASK = 0xfff, /* slot number */
252
253 /* RX (completion) ring bits */
254 RXQ_GOOD = (1U << 23), /* Response good */
255 RXQ_SLOT_RESET = (1U << 21), /* Slot reset complete */
256 RXQ_CMD_RX = (1U << 20), /* target cmd received */
257 RXQ_ATTN = (1U << 19), /* attention */
258 RXQ_RSP = (1U << 18), /* response frame xfer'd */
259 RXQ_ERR = (1U << 17), /* err info rec xfer'd */
260 RXQ_DONE = (1U << 16), /* cmd complete */
261 RXQ_SLOT_MASK = 0xfff, /* slot number */
262
263 /* mvs_cmd_hdr bits */
264 MCH_PRD_LEN_SHIFT = 16, /* 16-bit PRD table len */
265 MCH_SSP_FR_TYPE_SHIFT = 13, /* SSP frame type */
266
267 /* SSP initiator only */
268 MCH_SSP_FR_CMD = 0x0, /* COMMAND frame */
269
270 /* SSP initiator or target */
271 MCH_SSP_FR_TASK = 0x1, /* TASK frame */
272
273 /* SSP target only */
274 MCH_SSP_FR_XFER_RDY = 0x4, /* XFER_RDY frame */
275 MCH_SSP_FR_RESP = 0x5, /* RESPONSE frame */
276 MCH_SSP_FR_READ = 0x6, /* Read DATA frame(s) */
277 MCH_SSP_FR_READ_RESP = 0x7, /* ditto, plus RESPONSE */
278
279 MCH_PASSTHRU = (1U << 12), /* pass-through (SSP) */
280 MCH_FBURST = (1U << 11), /* first burst (SSP) */
281 MCH_CHK_LEN = (1U << 10), /* chk xfer len (SSP) */
282 MCH_RETRY = (1U << 9), /* tport layer retry (SSP) */
283 MCH_PROTECTION = (1U << 8), /* protection info rec (SSP) */
284 MCH_RESET = (1U << 7), /* Reset (STP/SATA) */
285 MCH_FPDMA = (1U << 6), /* First party DMA (STP/SATA) */
286 MCH_ATAPI = (1U << 5), /* ATAPI (STP/SATA) */
287 MCH_BIST = (1U << 4), /* BIST activate (STP/SATA) */
288 MCH_PMP_MASK = 0xf, /* PMP from cmd FIS (STP/SATA)*/
289
290 CCTL_RST = (1U << 5), /* port logic reset */
291
292 /* 0(LSB first), 1(MSB first) */
293 CCTL_ENDIAN_DATA = (1U << 3), /* PRD data */
294 CCTL_ENDIAN_RSP = (1U << 2), /* response frame */
295 CCTL_ENDIAN_OPEN = (1U << 1), /* open address frame */
296 CCTL_ENDIAN_CMD = (1U << 0), /* command table */
297
298 /* MVS_Px_SER_CTLSTAT (per-phy control) */
299 PHY_SSP_RST = (1U << 3), /* reset SSP link layer */
300 PHY_BCAST_CHG = (1U << 2), /* broadcast(change) notif */
301 PHY_RST_HARD = (1U << 1), /* hard reset + phy reset */
302 PHY_RST = (1U << 0), /* phy reset */
303 PHY_MIN_SPP_PHYS_LINK_RATE_MASK = (0xF << 8),
304 PHY_MAX_SPP_PHYS_LINK_RATE_MASK = (0xF << 12),
305 PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET = (16),
306 PHY_NEG_SPP_PHYS_LINK_RATE_MASK =
307 (0xF << PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET),
308 PHY_READY_MASK = (1U << 20),
309
310 /* MVS_Px_INT_STAT, MVS_Px_INT_MASK (per-phy events) */
311 PHYEV_DEC_ERR = (1U << 24), /* Phy Decoding Error */
312 PHYEV_UNASSOC_FIS = (1U << 19), /* unassociated FIS rx'd */
313 PHYEV_AN = (1U << 18), /* SATA async notification */
314 PHYEV_BIST_ACT = (1U << 17), /* BIST activate FIS */
315 PHYEV_SIG_FIS = (1U << 16), /* signature FIS */
316 PHYEV_POOF = (1U << 12), /* phy ready from 1 -> 0 */
317 PHYEV_IU_BIG = (1U << 11), /* IU too long err */
318 PHYEV_IU_SMALL = (1U << 10), /* IU too short err */
319 PHYEV_UNK_TAG = (1U << 9), /* unknown tag */
320 PHYEV_BROAD_CH = (1U << 8), /* broadcast(CHANGE) */
321 PHYEV_COMWAKE = (1U << 7), /* COMWAKE rx'd */
322 PHYEV_PORT_SEL = (1U << 6), /* port selector present */
323 PHYEV_HARD_RST = (1U << 5), /* hard reset rx'd */
324 PHYEV_ID_TMOUT = (1U << 4), /* identify timeout */
325 PHYEV_ID_FAIL = (1U << 3), /* identify failed */
326 PHYEV_ID_DONE = (1U << 2), /* identify done */
327 PHYEV_HARD_RST_DONE = (1U << 1), /* hard reset done */
328 PHYEV_RDY_CH = (1U << 0), /* phy ready changed state */
329
330 /* MVS_PCS */
331 PCS_EN_SATA_REG_SHIFT = (16), /* Enable SATA Register Set */
332 PCS_EN_PORT_XMT_SHIFT = (12), /* Enable Port Transmit */
333 PCS_EN_PORT_XMT_SHIFT2 = (8), /* For 6480 */
334 PCS_SATA_RETRY = (1U << 8), /* retry ctl FIS on R_ERR */
335 PCS_RSP_RX_EN = (1U << 7), /* raw response rx */
336 PCS_SELF_CLEAR = (1U << 5), /* self-clearing int mode */
337 PCS_FIS_RX_EN = (1U << 4), /* FIS rx enable */
338 PCS_CMD_STOP_ERR = (1U << 3), /* cmd stop-on-err enable */
339 PCS_CMD_RST = (1U << 1), /* reset cmd issue */
340 PCS_CMD_EN = (1U << 0), /* enable cmd issue */
341
342 /* Port n Attached Device Info */
343 PORT_DEV_SSP_TRGT = (1U << 19),
344 PORT_DEV_SMP_TRGT = (1U << 18),
345 PORT_DEV_STP_TRGT = (1U << 17),
346 PORT_DEV_SSP_INIT = (1U << 11),
347 PORT_DEV_SMP_INIT = (1U << 10),
348 PORT_DEV_STP_INIT = (1U << 9),
349 PORT_PHY_ID_MASK = (0xFFU << 24),
350 PORT_DEV_TRGT_MASK = (0x7U << 17),
351 PORT_DEV_INIT_MASK = (0x7U << 9),
352 PORT_DEV_TYPE_MASK = (0x7U << 0),
353
354 /* Port n PHY Status */
355 PHY_RDY = (1U << 2),
356 PHY_DW_SYNC = (1U << 1),
357 PHY_OOB_DTCTD = (1U << 0),
358
359 /* VSR */
360 /* PHYMODE 6 (CDB) */
361 PHY_MODE6_DTL_SPEED = (1U << 27),
362};
363
364enum mvs_info_flags {
365 MVF_MSI = (1U << 0), /* MSI is enabled */
366 MVF_PHY_PWR_FIX = (1U << 1), /* bug workaround */
367};
368
369enum sas_cmd_port_registers {
370 CMD_CMRST_OOB_DET = 0x100, /* COMRESET OOB detect register */
371 CMD_CMWK_OOB_DET = 0x104, /* COMWAKE OOB detect register */
372 CMD_CMSAS_OOB_DET = 0x108, /* COMSAS OOB detect register */
373 CMD_BRST_OOB_DET = 0x10c, /* burst OOB detect register */
374 CMD_OOB_SPACE = 0x110, /* OOB space control register */
375 CMD_OOB_BURST = 0x114, /* OOB burst control register */
376 CMD_PHY_TIMER = 0x118, /* PHY timer control register */
377 CMD_PHY_CONFIG0 = 0x11c, /* PHY config register 0 */
378 CMD_PHY_CONFIG1 = 0x120, /* PHY config register 1 */
379 CMD_SAS_CTL0 = 0x124, /* SAS control register 0 */
380 CMD_SAS_CTL1 = 0x128, /* SAS control register 1 */
381 CMD_SAS_CTL2 = 0x12c, /* SAS control register 2 */
382 CMD_SAS_CTL3 = 0x130, /* SAS control register 3 */
383 CMD_ID_TEST = 0x134, /* ID test register */
384 CMD_PL_TIMER = 0x138, /* PL timer register */
385 CMD_WD_TIMER = 0x13c, /* WD timer register */
386 CMD_PORT_SEL_COUNT = 0x140, /* port selector count register */
387 CMD_APP_MEM_CTL = 0x144, /* Application Memory Control */
388 CMD_XOR_MEM_CTL = 0x148, /* XOR Block Memory Control */
389 CMD_DMA_MEM_CTL = 0x14c, /* DMA Block Memory Control */
390 CMD_PORT_MEM_CTL0 = 0x150, /* Port Memory Control 0 */
391 CMD_PORT_MEM_CTL1 = 0x154, /* Port Memory Control 1 */
392 CMD_SATA_PORT_MEM_CTL0 = 0x158, /* SATA Port Memory Control 0 */
393 CMD_SATA_PORT_MEM_CTL1 = 0x15c, /* SATA Port Memory Control 1 */
394 CMD_XOR_MEM_BIST_CTL = 0x160, /* XOR Memory BIST Control */
395 CMD_XOR_MEM_BIST_STAT = 0x164, /* XOR Memroy BIST Status */
396 CMD_DMA_MEM_BIST_CTL = 0x168, /* DMA Memory BIST Control */
397 CMD_DMA_MEM_BIST_STAT = 0x16c, /* DMA Memory BIST Status */
398 CMD_PORT_MEM_BIST_CTL = 0x170, /* Port Memory BIST Control */
399 CMD_PORT_MEM_BIST_STAT0 = 0x174, /* Port Memory BIST Status 0 */
400 CMD_PORT_MEM_BIST_STAT1 = 0x178, /* Port Memory BIST Status 1 */
401 CMD_STP_MEM_BIST_CTL = 0x17c, /* STP Memory BIST Control */
402 CMD_STP_MEM_BIST_STAT0 = 0x180, /* STP Memory BIST Status 0 */
403 CMD_STP_MEM_BIST_STAT1 = 0x184, /* STP Memory BIST Status 1 */
404 CMD_RESET_COUNT = 0x188, /* Reset Count */
405 CMD_MONTR_DATA_SEL = 0x18C, /* Monitor Data/Select */
406 CMD_PLL_PHY_CONFIG = 0x190, /* PLL/PHY Configuration */
407 CMD_PHY_CTL = 0x194, /* PHY Control and Status */
408 CMD_PHY_TEST_COUNT0 = 0x198, /* Phy Test Count 0 */
409 CMD_PHY_TEST_COUNT1 = 0x19C, /* Phy Test Count 1 */
410 CMD_PHY_TEST_COUNT2 = 0x1A0, /* Phy Test Count 2 */
411 CMD_APP_ERR_CONFIG = 0x1A4, /* Application Error Configuration */
412 CMD_PND_FIFO_CTL0 = 0x1A8, /* Pending FIFO Control 0 */
413 CMD_HOST_CTL = 0x1AC, /* Host Control Status */
414 CMD_HOST_WR_DATA = 0x1B0, /* Host Write Data */
415 CMD_HOST_RD_DATA = 0x1B4, /* Host Read Data */
416 CMD_PHY_MODE_21 = 0x1B8, /* Phy Mode 21 */
417 CMD_SL_MODE0 = 0x1BC, /* SL Mode 0 */
418 CMD_SL_MODE1 = 0x1C0, /* SL Mode 1 */
419 CMD_PND_FIFO_CTL1 = 0x1C4, /* Pending FIFO Control 1 */
420};
421
422/* SAS/SATA configuration port registers, aka phy registers */
423enum sas_sata_config_port_regs {
424 PHYR_IDENTIFY = 0x00, /* info for IDENTIFY frame */
425 PHYR_ADDR_LO = 0x04, /* my SAS address (low) */
426 PHYR_ADDR_HI = 0x08, /* my SAS address (high) */
427 PHYR_ATT_DEV_INFO = 0x0C, /* attached device info */
428 PHYR_ATT_ADDR_LO = 0x10, /* attached dev SAS addr (low) */
429 PHYR_ATT_ADDR_HI = 0x14, /* attached dev SAS addr (high) */
430 PHYR_SATA_CTL = 0x18, /* SATA control */
431 PHYR_PHY_STAT = 0x1C, /* PHY status */
432 PHYR_SATA_SIG0 = 0x20, /*port SATA signature FIS(Byte 0-3) */
433 PHYR_SATA_SIG1 = 0x24, /*port SATA signature FIS(Byte 4-7) */
434 PHYR_SATA_SIG2 = 0x28, /*port SATA signature FIS(Byte 8-11) */
435 PHYR_SATA_SIG3 = 0x2c, /*port SATA signature FIS(Byte 12-15) */
436 PHYR_R_ERR_COUNT = 0x30, /* port R_ERR count register */
437 PHYR_CRC_ERR_COUNT = 0x34, /* port CRC error count register */
438 PHYR_WIDE_PORT = 0x38, /* wide port participating */
439 PHYR_CURRENT0 = 0x80, /* current connection info 0 */
440 PHYR_CURRENT1 = 0x84, /* current connection info 1 */
441 PHYR_CURRENT2 = 0x88, /* current connection info 2 */
442};
443
444/* SAS/SATA Vendor Specific Port Registers */
445enum sas_sata_vsp_regs {
446 VSR_PHY_STAT = 0x00, /* Phy Status */
447 VSR_PHY_MODE1 = 0x01, /* phy tx */
448 VSR_PHY_MODE2 = 0x02, /* tx scc */
449 VSR_PHY_MODE3 = 0x03, /* pll */
450 VSR_PHY_MODE4 = 0x04, /* VCO */
451 VSR_PHY_MODE5 = 0x05, /* Rx */
452 VSR_PHY_MODE6 = 0x06, /* CDR */
453 VSR_PHY_MODE7 = 0x07, /* Impedance */
454 VSR_PHY_MODE8 = 0x08, /* Voltage */
455 VSR_PHY_MODE9 = 0x09, /* Test */
456 VSR_PHY_MODE10 = 0x0A, /* Power */
457 VSR_PHY_MODE11 = 0x0B, /* Phy Mode */
458 VSR_PHY_VS0 = 0x0C, /* Vednor Specific 0 */
459 VSR_PHY_VS1 = 0x0D, /* Vednor Specific 1 */
460};
461
462enum pci_cfg_registers {
463 PCR_PHY_CTL = 0x40,
464 PCR_PHY_CTL2 = 0x90,
465 PCR_DEV_CTRL = 0xE8,
466};
467
468enum pci_cfg_register_bits {
469 PCTL_PWR_ON = (0xFU << 24),
470 PCTL_OFF = (0xFU << 12),
471 PRD_REQ_SIZE = (0x4000),
472 PRD_REQ_MASK = (0x00007000),
473};
474
475enum nvram_layout_offsets {
476 NVR_SIG = 0x00, /* 0xAA, 0x55 */
477 NVR_SAS_ADDR = 0x02, /* 8-byte SAS address */
478};
479
480enum chip_flavors {
481 chip_6320,
482 chip_6440,
483 chip_6480,
484};
485
486enum port_type {
487 PORT_TYPE_SAS = (1L << 1),
488 PORT_TYPE_SATA = (1L << 0),
489};
490
491/* Command Table Format */
492enum ct_format {
493 /* SSP */
494 SSP_F_H = 0x00,
495 SSP_F_IU = 0x18,
496 SSP_F_MAX = 0x4D,
497 /* STP */
498 STP_CMD_FIS = 0x00,
499 STP_ATAPI_CMD = 0x40,
500 STP_F_MAX = 0x10,
501 /* SMP */
502 SMP_F_T = 0x00,
503 SMP_F_DEP = 0x01,
504 SMP_F_MAX = 0x101,
505};
506
507enum status_buffer {
508 SB_EIR_OFF = 0x00, /* Error Information Record */
509 SB_RFB_OFF = 0x08, /* Response Frame Buffer */
510 SB_RFB_MAX = 0x400, /* RFB size*/
511};
512
513enum error_info_rec {
514 CMD_ISS_STPD = (1U << 31), /* Cmd Issue Stopped */
515};
516
517struct mvs_chip_info {
518 u32 n_phy;
519 u32 srs_sz;
520 u32 slot_width;
521};
522
523struct mvs_err_info {
524 __le32 flags;
525 __le32 flags2;
526};
527
528struct mvs_prd {
529 __le64 addr; /* 64-bit buffer address */
530 __le32 reserved;
531 __le32 len; /* 16-bit length */
532};
533
534struct mvs_cmd_hdr {
535 __le32 flags; /* PRD tbl len; SAS, SATA ctl */
536 __le32 lens; /* cmd, max resp frame len */
537 __le32 tags; /* targ port xfer tag; tag */
538 __le32 data_len; /* data xfer len */
539 __le64 cmd_tbl; /* command table address */
540 __le64 open_frame; /* open addr frame address */
541 __le64 status_buf; /* status buffer address */
542 __le64 prd_tbl; /* PRD tbl address */
543 __le32 reserved[4];
544};
545
546struct mvs_slot_info {
547 struct sas_task *task;
548 u32 n_elem;
549 u32 tx;
550
551 /* DMA buffer for storing cmd tbl, open addr frame, status buffer,
552 * and PRD table
553 */
554 void *buf;
555 dma_addr_t buf_dma;
556#if _MV_DUMP
557 u32 cmd_size;
558#endif
559
560 void *response;
561};
562
563struct mvs_port {
564 struct asd_sas_port sas_port;
565 u8 port_attached;
566 u8 taskfileset;
567 u8 wide_port_phymap;
568};
569
570struct mvs_phy {
571 struct mvs_port *port;
572 struct asd_sas_phy sas_phy;
573 struct sas_identify identify;
574 struct scsi_device *sdev;
575 u64 dev_sas_addr;
576 u64 att_dev_sas_addr;
577 u32 att_dev_info;
578 u32 dev_info;
579 u32 phy_type;
580 u32 phy_status;
581 u32 irq_status;
582 u32 frame_rcvd_size;
583 u8 frame_rcvd[32];
584 u8 phy_attached;
585};
586
587struct mvs_info {
588 unsigned long flags;
589
590 spinlock_t lock; /* host-wide lock */
591 struct pci_dev *pdev; /* our device */
592 void __iomem *regs; /* enhanced mode registers */
593 void __iomem *peri_regs; /* peripheral registers */
594
595 u8 sas_addr[SAS_ADDR_SIZE];
596 struct sas_ha_struct sas; /* SCSI/SAS glue */
597 struct Scsi_Host *shost;
598
599 __le32 *tx; /* TX (delivery) DMA ring */
600 dma_addr_t tx_dma;
601 u32 tx_prod; /* cached next-producer idx */
602
603 __le32 *rx; /* RX (completion) DMA ring */
604 dma_addr_t rx_dma;
605 u32 rx_cons; /* RX consumer idx */
606
607 __le32 *rx_fis; /* RX'd FIS area */
608 dma_addr_t rx_fis_dma;
609
610 struct mvs_cmd_hdr *slot; /* DMA command header slots */
611 dma_addr_t slot_dma;
612
613 const struct mvs_chip_info *chip;
614
615 unsigned long tags[MVS_SLOTS];
616 struct mvs_slot_info slot_info[MVS_SLOTS];
617 /* further per-slot information */
618 struct mvs_phy phy[MVS_MAX_PHYS];
619 struct mvs_port port[MVS_MAX_PHYS];
620
621 u32 can_queue; /* per adapter */
622 u32 tag_out; /*Get*/
623 u32 tag_in; /*Give*/
624};
625
626struct mvs_queue_task {
627 struct list_head list;
628
629 void *uldd_task;
630};
631
632static int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
633 void *funcdata);
634static u32 mvs_read_phy_ctl(struct mvs_info *mvi, u32 port);
635static void mvs_write_phy_ctl(struct mvs_info *mvi, u32 port, u32 val);
636static u32 mvs_read_port_irq_stat(struct mvs_info *mvi, u32 port);
637static void mvs_write_port_irq_stat(struct mvs_info *mvi, u32 port, u32 val);
638static void mvs_write_port_irq_mask(struct mvs_info *mvi, u32 port, u32 val);
639static u32 mvs_read_port_irq_mask(struct mvs_info *mvi, u32 port);
640
641static u32 mvs_is_phy_ready(struct mvs_info *mvi, int i);
642static void mvs_detect_porttype(struct mvs_info *mvi, int i);
643static void mvs_update_phyinfo(struct mvs_info *mvi, int i, int get_st);
644
645static int mvs_scan_finished(struct Scsi_Host *, unsigned long);
646static void mvs_scan_start(struct Scsi_Host *);
647static int mvs_sas_slave_alloc(struct scsi_device *scsi_dev);
648
649static struct scsi_transport_template *mvs_stt;
650
651static const struct mvs_chip_info mvs_chips[] = {
652 [chip_6320] = { 2, 16, 9 },
653 [chip_6440] = { 4, 16, 9 },
654 [chip_6480] = { 8, 32, 10 },
655};
656
657static struct scsi_host_template mvs_sht = {
658 .module = THIS_MODULE,
659 .name = DRV_NAME,
660 .queuecommand = sas_queuecommand,
661 .target_alloc = sas_target_alloc,
662 .slave_configure = sas_slave_configure,
663 .slave_destroy = sas_slave_destroy,
664 .scan_finished = mvs_scan_finished,
665 .scan_start = mvs_scan_start,
666 .change_queue_depth = sas_change_queue_depth,
667 .change_queue_type = sas_change_queue_type,
668 .bios_param = sas_bios_param,
669 .can_queue = 1,
670 .cmd_per_lun = 1,
671 .this_id = -1,
672 .sg_tablesize = SG_ALL,
673 .max_sectors = SCSI_DEFAULT_MAX_SECTORS,
674 .use_clustering = ENABLE_CLUSTERING,
675 .eh_device_reset_handler = sas_eh_device_reset_handler,
676 .eh_bus_reset_handler = sas_eh_bus_reset_handler,
677 .slave_alloc = mvs_sas_slave_alloc,
678 .target_destroy = sas_target_destroy,
679 .ioctl = sas_ioctl,
680};
681
682static void mvs_hexdump(u32 size, u8 *data, u32 baseaddr)
683{
684 u32 i;
685 u32 run;
686 u32 offset;
687
688 offset = 0;
689 while (size) {
690 printk("%08X : ", baseaddr + offset);
691 if (size >= 16)
692 run = 16;
693 else
694 run = size;
695 size -= run;
696 for (i = 0; i < 16; i++) {
697 if (i < run)
698 printk("%02X ", (u32)data[i]);
699 else
700 printk(" ");
701 }
702 printk(": ");
703 for (i = 0; i < run; i++)
704 printk("%c", isalnum(data[i]) ? data[i] : '.');
705 printk("\n");
706 data = &data[16];
707 offset += run;
708 }
709 printk("\n");
710}
711
712static void mvs_hba_sb_dump(struct mvs_info *mvi, u32 tag,
713 enum sas_protocol proto)
714{
715#if _MV_DUMP
716 u32 offset;
717 struct pci_dev *pdev = mvi->pdev;
718 struct mvs_slot_info *slot = &mvi->slot_info[tag];
719
720 offset = slot->cmd_size + MVS_OAF_SZ +
721 sizeof(struct mvs_prd) * slot->n_elem;
722 dev_printk(KERN_DEBUG, &pdev->dev, "+---->Status buffer[%d] :\n",
723 tag);
724 mvs_hexdump(32, (u8 *) slot->response,
725 (u32) slot->buf_dma + offset);
726#endif
727}
728
729static void mvs_hba_memory_dump(struct mvs_info *mvi, u32 tag,
730 enum sas_protocol proto)
731{
732#if _MV_DUMP
733 u32 sz, w_ptr, r_ptr;
734 u64 addr;
735 void __iomem *regs = mvi->regs;
736 struct pci_dev *pdev = mvi->pdev;
737 struct mvs_slot_info *slot = &mvi->slot_info[tag];
738
739 /*Delivery Queue */
740 sz = mr32(TX_CFG) & TX_RING_SZ_MASK;
741 w_ptr = mr32(TX_PROD_IDX) & TX_RING_SZ_MASK;
742 r_ptr = mr32(TX_CONS_IDX) & TX_RING_SZ_MASK;
743 addr = mr32(TX_HI) << 16 << 16 | mr32(TX_LO);
744 dev_printk(KERN_DEBUG, &pdev->dev,
745 "Delivery Queue Size=%04d , WRT_PTR=%04X , RD_PTR=%04X\n",
746 sz, w_ptr, r_ptr);
747 dev_printk(KERN_DEBUG, &pdev->dev,
748 "Delivery Queue Base Address=0x%llX (PA)"
749 "(tx_dma=0x%llX), Entry=%04d\n",
750 addr, mvi->tx_dma, w_ptr);
751 mvs_hexdump(sizeof(u32), (u8 *)(&mvi->tx[mvi->tx_prod]),
752 (u32) mvi->tx_dma + sizeof(u32) * w_ptr);
753 /*Command List */
754 addr = mr32(CMD_LIST_HI) << 16 << 16 | mr32(CMD_LIST_LO);
755 dev_printk(KERN_DEBUG, &pdev->dev,
756 "Command List Base Address=0x%llX (PA)"
757 "(slot_dma=0x%llX), Header=%03d\n",
758 addr, mvi->slot_dma, tag);
759 dev_printk(KERN_DEBUG, &pdev->dev, "Command Header[%03d]:\n", tag);
760 /*mvs_cmd_hdr */
761 mvs_hexdump(sizeof(struct mvs_cmd_hdr), (u8 *)(&mvi->slot[tag]),
762 (u32) mvi->slot_dma + tag * sizeof(struct mvs_cmd_hdr));
763 /*1.command table area */
764 dev_printk(KERN_DEBUG, &pdev->dev, "+---->Command Table :\n");
765 mvs_hexdump(slot->cmd_size, (u8 *) slot->buf, (u32) slot->buf_dma);
766 /*2.open address frame area */
767 dev_printk(KERN_DEBUG, &pdev->dev, "+---->Open Address Frame :\n");
768 mvs_hexdump(MVS_OAF_SZ, (u8 *) slot->buf + slot->cmd_size,
769 (u32) slot->buf_dma + slot->cmd_size);
770 /*3.status buffer */
771 mvs_hba_sb_dump(mvi, tag, proto);
772 /*4.PRD table */
773 dev_printk(KERN_DEBUG, &pdev->dev, "+---->PRD table :\n");
774 mvs_hexdump(sizeof(struct mvs_prd) * slot->n_elem,
775 (u8 *) slot->buf + slot->cmd_size + MVS_OAF_SZ,
776 (u32) slot->buf_dma + slot->cmd_size + MVS_OAF_SZ);
777#endif
778}
779
780static void mvs_hba_cq_dump(struct mvs_info *mvi)
781{
782#if _MV_DUMP
783 u64 addr;
784 void __iomem *regs = mvi->regs;
785 struct pci_dev *pdev = mvi->pdev;
786 u32 entry = mvi->rx_cons + 1;
787 u32 rx_desc = le32_to_cpu(mvi->rx[entry]);
788
789 /*Completion Queue */
790 addr = mr32(RX_HI) << 16 << 16 | mr32(RX_LO);
791 dev_printk(KERN_DEBUG, &pdev->dev, "Completion Task = 0x%08X\n",
792 (u32) mvi->slot_info[rx_desc & RXQ_SLOT_MASK].task);
793 dev_printk(KERN_DEBUG, &pdev->dev,
794 "Completion List Base Address=0x%llX (PA), "
795 "CQ_Entry=%04d, CQ_WP=0x%08X\n",
796 addr, entry - 1, mvi->rx[0]);
797 mvs_hexdump(sizeof(u32), (u8 *)(&rx_desc),
798 mvi->rx_dma + sizeof(u32) * entry);
799#endif
800}
801
802static void mvs_hba_interrupt_enable(struct mvs_info *mvi)
803{
804 void __iomem *regs = mvi->regs;
805 u32 tmp;
806
807 tmp = mr32(GBL_CTL);
808
809 mw32(GBL_CTL, tmp | INT_EN);
810}
811
812static void mvs_hba_interrupt_disable(struct mvs_info *mvi)
813{
814 void __iomem *regs = mvi->regs;
815 u32 tmp;
816
817 tmp = mr32(GBL_CTL);
818
819 mw32(GBL_CTL, tmp & ~INT_EN);
820}
821
822static int mvs_int_rx(struct mvs_info *mvi, bool self_clear);
823
824/* move to PCI layer or libata core? */
825static int pci_go_64(struct pci_dev *pdev)
826{
827 int rc;
828
829 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
830 rc = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
831 if (rc) {
832 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
833 if (rc) {
834 dev_printk(KERN_ERR, &pdev->dev,
835 "64-bit DMA enable failed\n");
836 return rc;
837 }
838 }
839 } else {
840 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
841 if (rc) {
842 dev_printk(KERN_ERR, &pdev->dev,
843 "32-bit DMA enable failed\n");
844 return rc;
845 }
846 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
847 if (rc) {
848 dev_printk(KERN_ERR, &pdev->dev,
849 "32-bit consistent DMA enable failed\n");
850 return rc;
851 }
852 }
853
854 return rc;
855}
856
857static void mvs_tag_clear(struct mvs_info *mvi, u32 tag)
858{
859 mvi->tag_in = (mvi->tag_in + 1) & (MVS_SLOTS - 1);
860 mvi->tags[mvi->tag_in] = tag;
861}
862
863static void mvs_tag_free(struct mvs_info *mvi, u32 tag)
864{
865 mvi->tag_out = (mvi->tag_out - 1) & (MVS_SLOTS - 1);
866}
867
868static int mvs_tag_alloc(struct mvs_info *mvi, u32 *tag_out)
869{
870 if (mvi->tag_out != mvi->tag_in) {
871 *tag_out = mvi->tags[mvi->tag_out];
872 mvi->tag_out = (mvi->tag_out + 1) & (MVS_SLOTS - 1);
873 return 0;
874 }
875 return -EBUSY;
876}
877
878static void mvs_tag_init(struct mvs_info *mvi)
879{
880 int i;
881 for (i = 0; i < MVS_SLOTS; ++i)
882 mvi->tags[i] = i;
883 mvi->tag_out = 0;
884 mvi->tag_in = MVS_SLOTS - 1;
885}
886
887#ifndef MVS_DISABLE_NVRAM
888static int mvs_eep_read(void __iomem *regs, u32 addr, u32 *data)
889{
890 int timeout = 1000;
891
892 if (addr & ~SPI_ADDR_MASK)
893 return -EINVAL;
894
895 writel(addr, regs + SPI_CMD);
896 writel(TWSI_RD, regs + SPI_CTL);
897
898 while (timeout-- > 0) {
899 if (readl(regs + SPI_CTL) & TWSI_RDY) {
900 *data = readl(regs + SPI_DATA);
901 return 0;
902 }
903
904 udelay(10);
905 }
906
907 return -EBUSY;
908}
909
910static int mvs_eep_read_buf(void __iomem *regs, u32 addr,
911 void *buf, u32 buflen)
912{
913 u32 addr_end, tmp_addr, i, j;
914 u32 tmp = 0;
915 int rc;
916 u8 *tmp8, *buf8 = buf;
917
918 addr_end = addr + buflen;
919 tmp_addr = ALIGN(addr, 4);
920 if (addr > 0xff)
921 return -EINVAL;
922
923 j = addr & 0x3;
924 if (j) {
925 rc = mvs_eep_read(regs, tmp_addr, &tmp);
926 if (rc)
927 return rc;
928
929 tmp8 = (u8 *)&tmp;
930 for (i = j; i < 4; i++)
931 *buf8++ = tmp8[i];
932
933 tmp_addr += 4;
934 }
935
936 for (j = ALIGN(addr_end, 4); tmp_addr < j; tmp_addr += 4) {
937 rc = mvs_eep_read(regs, tmp_addr, &tmp);
938 if (rc)
939 return rc;
940
941 memcpy(buf8, &tmp, 4);
942 buf8 += 4;
943 }
944
945 if (tmp_addr < addr_end) {
946 rc = mvs_eep_read(regs, tmp_addr, &tmp);
947 if (rc)
948 return rc;
949
950 tmp8 = (u8 *)&tmp;
951 j = addr_end - tmp_addr;
952 for (i = 0; i < j; i++)
953 *buf8++ = tmp8[i];
954
955 tmp_addr += 4;
956 }
957
958 return 0;
959}
960#endif
961
962static int mvs_nvram_read(struct mvs_info *mvi, u32 addr,
963 void *buf, u32 buflen)
964{
965#ifndef MVS_DISABLE_NVRAM
966 void __iomem *regs = mvi->regs;
967 int rc, i;
968 u32 sum;
969 u8 hdr[2], *tmp;
970 const char *msg;
971
972 rc = mvs_eep_read_buf(regs, addr, &hdr, 2);
973 if (rc) {
974 msg = "nvram hdr read failed";
975 goto err_out;
976 }
977 rc = mvs_eep_read_buf(regs, addr + 2, buf, buflen);
978 if (rc) {
979 msg = "nvram read failed";
980 goto err_out;
981 }
982
983 if (hdr[0] != 0x5A) {
984 /* entry id */
985 msg = "invalid nvram entry id";
986 rc = -ENOENT;
987 goto err_out;
988 }
989
990 tmp = buf;
991 sum = ((u32)hdr[0]) + ((u32)hdr[1]);
992 for (i = 0; i < buflen; i++)
993 sum += ((u32)tmp[i]);
994
995 if (sum) {
996 msg = "nvram checksum failure";
997 rc = -EILSEQ;
998 goto err_out;
999 }
1000
1001 return 0;
1002
1003err_out:
1004 dev_printk(KERN_ERR, &mvi->pdev->dev, "%s", msg);
1005 return rc;
1006#else
1007 /* FIXME , For SAS target mode */
1008 memcpy(buf, "\x00\x00\xab\x11\x30\x04\x05\x50", 8);
1009 return 0;
1010#endif
1011}
1012
1013static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)
1014{
1015 struct mvs_phy *phy = &mvi->phy[i];
1016
1017 if (!phy->phy_attached)
1018 return;
1019
1020 if (phy->phy_type & PORT_TYPE_SAS) {
1021 struct sas_identify_frame *id;
1022
1023 id = (struct sas_identify_frame *)phy->frame_rcvd;
1024 id->dev_type = phy->identify.device_type;
1025 id->initiator_bits = SAS_PROTOCOL_ALL;
1026 id->target_bits = phy->identify.target_port_protocols;
1027 } else if (phy->phy_type & PORT_TYPE_SATA) {
1028 /* TODO */
1029 }
1030 mvi->sas.sas_phy[i]->frame_rcvd_size = phy->frame_rcvd_size;
1031 mvi->sas.notify_port_event(mvi->sas.sas_phy[i],
1032 PORTE_BYTES_DMAED);
1033}
1034
1035static int mvs_scan_finished(struct Scsi_Host *shost, unsigned long time)
1036{
1037 /* give the phy enabling interrupt event time to come in (1s
1038 * is empirically about all it takes) */
1039 if (time < HZ)
1040 return 0;
1041 /* Wait for discovery to finish */
1042 scsi_flush_work(shost);
1043 return 1;
1044}
1045
1046static void mvs_scan_start(struct Scsi_Host *shost)
1047{
1048 int i;
1049 struct mvs_info *mvi = SHOST_TO_SAS_HA(shost)->lldd_ha;
1050
1051 for (i = 0; i < mvi->chip->n_phy; ++i) {
1052 mvs_bytes_dmaed(mvi, i);
1053 }
1054}
1055
1056static int mvs_sas_slave_alloc(struct scsi_device *scsi_dev)
1057{
1058 int rc;
1059
1060 rc = sas_slave_alloc(scsi_dev);
1061
1062 return rc;
1063}
1064
1065static void mvs_int_port(struct mvs_info *mvi, int port_no, u32 events)
1066{
1067 struct pci_dev *pdev = mvi->pdev;
1068 struct sas_ha_struct *sas_ha = &mvi->sas;
1069 struct mvs_phy *phy = &mvi->phy[port_no];
1070 struct asd_sas_phy *sas_phy = &phy->sas_phy;
1071
1072 phy->irq_status = mvs_read_port_irq_stat(mvi, port_no);
1073 /*
1074 * events is port event now ,
1075 * we need check the interrupt status which belongs to per port.
1076 */
1077 dev_printk(KERN_DEBUG, &pdev->dev,
1078 "Port %d Event = %X\n",
1079 port_no, phy->irq_status);
1080
1081 if (phy->irq_status & (PHYEV_POOF | PHYEV_DEC_ERR)) {
1082 if (!mvs_is_phy_ready(mvi, port_no)) {
1083 sas_phy_disconnected(sas_phy);
1084 sas_ha->notify_phy_event(sas_phy, PHYE_LOSS_OF_SIGNAL);
1085 } else
1086 mvs_phy_control(sas_phy, PHY_FUNC_LINK_RESET, NULL);
1087 }
1088 if (!(phy->irq_status & PHYEV_DEC_ERR)) {
1089 if (phy->irq_status & PHYEV_COMWAKE) {
1090 u32 tmp = mvs_read_port_irq_mask(mvi, port_no);
1091 mvs_write_port_irq_mask(mvi, port_no,
1092 tmp | PHYEV_SIG_FIS);
1093 }
1094 if (phy->irq_status & (PHYEV_SIG_FIS | PHYEV_ID_DONE)) {
1095 phy->phy_status = mvs_is_phy_ready(mvi, port_no);
1096 if (phy->phy_status) {
1097 mvs_detect_porttype(mvi, port_no);
1098
1099 if (phy->phy_type & PORT_TYPE_SATA) {
1100 u32 tmp = mvs_read_port_irq_mask(mvi,
1101 port_no);
1102 tmp &= ~PHYEV_SIG_FIS;
1103 mvs_write_port_irq_mask(mvi,
1104 port_no, tmp);
1105 }
1106
1107 mvs_update_phyinfo(mvi, port_no, 0);
1108 sas_ha->notify_phy_event(sas_phy,
1109 PHYE_OOB_DONE);
1110 mvs_bytes_dmaed(mvi, port_no);
1111 } else {
1112 dev_printk(KERN_DEBUG, &pdev->dev,
1113 "plugin interrupt but phy is gone\n");
1114 mvs_phy_control(sas_phy, PHY_FUNC_LINK_RESET,
1115 NULL);
1116 }
1117 } else if (phy->irq_status & PHYEV_BROAD_CH)
1118 sas_ha->notify_port_event(sas_phy,
1119 PORTE_BROADCAST_RCVD);
1120 }
1121 mvs_write_port_irq_stat(mvi, port_no, phy->irq_status);
1122}
1123
1124static void mvs_int_sata(struct mvs_info *mvi)
1125{
1126 /* FIXME */
1127}
1128
1129static void mvs_slot_free(struct mvs_info *mvi, struct sas_task *task,
1130 struct mvs_slot_info *slot, u32 slot_idx)
1131{
1132 if (!sas_protocol_ata(task->task_proto))
1133 if (slot->n_elem)
1134 pci_unmap_sg(mvi->pdev, task->scatter,
1135 slot->n_elem, task->data_dir);
1136
1137 switch (task->task_proto) {
1138 case SAS_PROTOCOL_SMP:
1139 pci_unmap_sg(mvi->pdev, &task->smp_task.smp_resp, 1,
1140 PCI_DMA_FROMDEVICE);
1141 pci_unmap_sg(mvi->pdev, &task->smp_task.smp_req, 1,
1142 PCI_DMA_TODEVICE);
1143 break;
1144
1145 case SAS_PROTOCOL_SATA:
1146 case SAS_PROTOCOL_STP:
1147 case SAS_PROTOCOL_SSP:
1148 default:
1149 /* do nothing */
1150 break;
1151 }
1152
1153 slot->task = NULL;
1154 mvs_tag_clear(mvi, slot_idx);
1155}
1156
1157static void mvs_slot_err(struct mvs_info *mvi, struct sas_task *task,
1158 u32 slot_idx)
1159{
1160 struct mvs_slot_info *slot = &mvi->slot_info[slot_idx];
1161 u64 err_dw0 = *(u32 *) slot->response;
1162 void __iomem *regs = mvi->regs;
1163 u32 tmp;
1164
1165 if (err_dw0 & CMD_ISS_STPD)
1166 if (sas_protocol_ata(task->task_proto)) {
1167 tmp = mr32(INT_STAT_SRS);
1168 mw32(INT_STAT_SRS, tmp & 0xFFFF);
1169 }
1170
1171 mvs_hba_sb_dump(mvi, slot_idx, task->task_proto);
1172}
1173
1174static int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc)
1175{
1176 u32 slot_idx = rx_desc & RXQ_SLOT_MASK;
1177 struct mvs_slot_info *slot = &mvi->slot_info[slot_idx];
1178 struct sas_task *task = slot->task;
1179 struct task_status_struct *tstat = &task->task_status;
1180 struct mvs_port *port = &mvi->port[task->dev->port->id];
1181 bool aborted;
1182 void *to;
1183
1184 spin_lock(&task->task_state_lock);
1185 aborted = task->task_state_flags & SAS_TASK_STATE_ABORTED;
1186 if (!aborted) {
1187 task->task_state_flags &=
1188 ~(SAS_TASK_STATE_PENDING | SAS_TASK_AT_INITIATOR);
1189 task->task_state_flags |= SAS_TASK_STATE_DONE;
1190 }
1191 spin_unlock(&task->task_state_lock);
1192
1193 if (aborted)
1194 return -1;
1195
1196 memset(tstat, 0, sizeof(*tstat));
1197 tstat->resp = SAS_TASK_COMPLETE;
1198
1199
1200 if (unlikely(!port->port_attached)) {
1201 tstat->stat = SAS_PHY_DOWN;
1202 goto out;
1203 }
1204
1205 /* error info record present */
1206 if ((rx_desc & RXQ_ERR) && (*(u64 *) slot->response)) {
1207 tstat->stat = SAM_CHECK_COND;
1208 mvs_slot_err(mvi, task, slot_idx);
1209 goto out;
1210 }
1211
1212 switch (task->task_proto) {
1213 case SAS_PROTOCOL_SSP:
1214 /* hw says status == 0, datapres == 0 */
1215 if (rx_desc & RXQ_GOOD) {
1216 tstat->stat = SAM_GOOD;
1217 tstat->resp = SAS_TASK_COMPLETE;
1218 }
1219 /* response frame present */
1220 else if (rx_desc & RXQ_RSP) {
1221 struct ssp_response_iu *iu =
1222 slot->response + sizeof(struct mvs_err_info);
1223 sas_ssp_task_response(&mvi->pdev->dev, task, iu);
1224 }
1225
1226 /* should never happen? */
1227 else
1228 tstat->stat = SAM_CHECK_COND;
1229 break;
1230
1231 case SAS_PROTOCOL_SMP: {
1232 struct scatterlist *sg_resp = &task->smp_task.smp_resp;
1233 tstat->stat = SAM_GOOD;
1234 to = kmap_atomic(sg_page(sg_resp), KM_IRQ0);
1235 memcpy(to + sg_resp->offset,
1236 slot->response + sizeof(struct mvs_err_info),
1237 sg_dma_len(sg_resp));
1238 kunmap_atomic(to, KM_IRQ0);
1239 break;
1240 }
1241
1242 case SAS_PROTOCOL_SATA:
1243 case SAS_PROTOCOL_STP:
1244 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: {
1245 struct ata_task_resp *resp =
1246 (struct ata_task_resp *)tstat->buf;
1247
1248 if ((rx_desc & (RXQ_DONE | RXQ_ERR | RXQ_ATTN)) ==
1249 RXQ_DONE)
1250 tstat->stat = SAM_GOOD;
1251 else
1252 tstat->stat = SAM_CHECK_COND;
1253
1254 resp->frame_len = sizeof(struct dev_to_host_fis);
1255 memcpy(&resp->ending_fis[0],
1256 SATA_RECEIVED_D2H_FIS(port->taskfileset),
1257 sizeof(struct dev_to_host_fis));
1258 if (resp->ending_fis[2] & ATA_ERR)
1259 mvs_hexdump(16, resp->ending_fis, 0);
1260 break;
1261 }
1262
1263 default:
1264 tstat->stat = SAM_CHECK_COND;
1265 break;
1266 }
1267
1268out:
1269 mvs_slot_free(mvi, task, slot, slot_idx);
1270 task->task_done(task);
1271 return tstat->stat;
1272}
1273
1274static void mvs_int_full(struct mvs_info *mvi)
1275{
1276 void __iomem *regs = mvi->regs;
1277 u32 tmp, stat;
1278 int i;
1279
1280 stat = mr32(INT_STAT);
1281
1282 mvs_int_rx(mvi, false);
1283
1284 for (i = 0; i < MVS_MAX_PORTS; i++) {
1285 tmp = (stat >> i) & (CINT_PORT | CINT_PORT_STOPPED);
1286 if (tmp)
1287 mvs_int_port(mvi, i, tmp);
1288 }
1289
1290 if (stat & CINT_SRS)
1291 mvs_int_sata(mvi);
1292
1293 mw32(INT_STAT, stat);
1294}
1295
1296static int mvs_int_rx(struct mvs_info *mvi, bool self_clear)
1297{
1298 void __iomem *regs = mvi->regs;
1299 u32 rx_prod_idx, rx_desc;
1300 bool attn = false;
1301 struct pci_dev *pdev = mvi->pdev;
1302
1303 /* the first dword in the RX ring is special: it contains
1304 * a mirror of the hardware's RX producer index, so that
1305 * we don't have to stall the CPU reading that register.
1306 * The actual RX ring is offset by one dword, due to this.
1307 */
1308 rx_prod_idx = mr32(RX_CONS_IDX) & RX_RING_SZ_MASK;
1309 if (rx_prod_idx == 0xfff) { /* h/w hasn't touched RX ring yet */
1310 mvi->rx_cons = 0xfff;
1311 return 0;
1312 }
1313
1314 /* The CMPL_Q may come late, read from register and try again
1315 * note: if coalescing is enabled,
1316 * it will need to read from register every time for sure
1317 */
1318 if (mvi->rx_cons == rx_prod_idx)
1319 return 0;
1320
1321 if (mvi->rx_cons == 0xfff)
1322 mvi->rx_cons = MVS_RX_RING_SZ - 1;
1323
1324 while (mvi->rx_cons != rx_prod_idx) {
1325
1326 /* increment our internal RX consumer pointer */
1327 mvi->rx_cons = (mvi->rx_cons + 1) & (MVS_RX_RING_SZ - 1);
1328
1329 rx_desc = le32_to_cpu(mvi->rx[mvi->rx_cons + 1]);
1330
1331 mvs_hba_cq_dump(mvi);
1332
1333 if (unlikely(rx_desc & RXQ_DONE))
1334 mvs_slot_complete(mvi, rx_desc);
1335 if (rx_desc & RXQ_ATTN) {
1336 attn = true;
1337 dev_printk(KERN_DEBUG, &pdev->dev, "ATTN %X\n",
1338 rx_desc);
1339 } else if (rx_desc & RXQ_ERR) {
1340 dev_printk(KERN_DEBUG, &pdev->dev, "RXQ_ERR %X\n",
1341 rx_desc);
1342 }
1343 }
1344
1345 if (attn && self_clear)
1346 mvs_int_full(mvi);
1347
1348 return 0;
1349}
1350
1351static irqreturn_t mvs_interrupt(int irq, void *opaque)
1352{
1353 struct mvs_info *mvi = opaque;
1354 void __iomem *regs = mvi->regs;
1355 u32 stat;
1356
1357 stat = mr32(GBL_INT_STAT);
1358
1359 /* clear CMD_CMPLT ASAP */
1360 mw32_f(INT_STAT, CINT_DONE);
1361
1362 if (stat == 0 || stat == 0xffffffff)
1363 return IRQ_NONE;
1364
1365 spin_lock(&mvi->lock);
1366
1367 mvs_int_full(mvi);
1368
1369 spin_unlock(&mvi->lock);
1370
1371 return IRQ_HANDLED;
1372}
1373
1374#ifndef MVS_DISABLE_MSI
1375static irqreturn_t mvs_msi_interrupt(int irq, void *opaque)
1376{
1377 struct mvs_info *mvi = opaque;
1378
1379 spin_lock(&mvi->lock);
1380
1381 mvs_int_rx(mvi, true);
1382
1383 spin_unlock(&mvi->lock);
1384
1385 return IRQ_HANDLED;
1386}
1387#endif
1388
1389struct mvs_task_exec_info {
1390 struct sas_task *task;
1391 struct mvs_cmd_hdr *hdr;
1392 struct mvs_port *port;
1393 u32 tag;
1394 int n_elem;
1395};
1396
1397static int mvs_task_prep_smp(struct mvs_info *mvi,
1398 struct mvs_task_exec_info *tei)
1399{
1400 int elem, rc, i;
1401 struct sas_task *task = tei->task;
1402 struct mvs_cmd_hdr *hdr = tei->hdr;
1403 struct scatterlist *sg_req, *sg_resp;
1404 u32 req_len, resp_len, tag = tei->tag;
1405 void *buf_tmp;
1406 u8 *buf_oaf;
1407 dma_addr_t buf_tmp_dma;
1408 struct mvs_prd *buf_prd;
1409 struct scatterlist *sg;
1410 struct mvs_slot_info *slot = &mvi->slot_info[tag];
1411 struct asd_sas_port *sas_port = task->dev->port;
1412 u32 flags = (tei->n_elem << MCH_PRD_LEN_SHIFT);
1413#if _MV_DUMP
1414 u8 *buf_cmd;
1415 void *from;
1416#endif
1417 /*
1418 * DMA-map SMP request, response buffers
1419 */
1420 sg_req = &task->smp_task.smp_req;
1421 elem = pci_map_sg(mvi->pdev, sg_req, 1, PCI_DMA_TODEVICE);
1422 if (!elem)
1423 return -ENOMEM;
1424 req_len = sg_dma_len(sg_req);
1425
1426 sg_resp = &task->smp_task.smp_resp;
1427 elem = pci_map_sg(mvi->pdev, sg_resp, 1, PCI_DMA_FROMDEVICE);
1428 if (!elem) {
1429 rc = -ENOMEM;
1430 goto err_out;
1431 }
1432 resp_len = sg_dma_len(sg_resp);
1433
1434 /* must be in dwords */
1435 if ((req_len & 0x3) || (resp_len & 0x3)) {
1436 rc = -EINVAL;
1437 goto err_out_2;
1438 }
1439
1440 /*
1441 * arrange MVS_SLOT_BUF_SZ-sized DMA buffer according to our needs
1442 */
1443
1444 /* region 1: command table area (MVS_SSP_CMD_SZ bytes) ************** */
1445 buf_tmp = slot->buf;
1446 buf_tmp_dma = slot->buf_dma;
1447
1448#if _MV_DUMP
1449 buf_cmd = buf_tmp;
1450 hdr->cmd_tbl = cpu_to_le64(buf_tmp_dma);
1451 buf_tmp += req_len;
1452 buf_tmp_dma += req_len;
1453 slot->cmd_size = req_len;
1454#else
1455 hdr->cmd_tbl = cpu_to_le64(sg_dma_address(sg_req));
1456#endif
1457
1458 /* region 2: open address frame area (MVS_OAF_SZ bytes) ********* */
1459 buf_oaf = buf_tmp;
1460 hdr->open_frame = cpu_to_le64(buf_tmp_dma);
1461
1462 buf_tmp += MVS_OAF_SZ;
1463 buf_tmp_dma += MVS_OAF_SZ;
1464
1465 /* region 3: PRD table ********************************************* */
1466 buf_prd = buf_tmp;
1467 if (tei->n_elem)
1468 hdr->prd_tbl = cpu_to_le64(buf_tmp_dma);
1469 else
1470 hdr->prd_tbl = 0;
1471
1472 i = sizeof(struct mvs_prd) * tei->n_elem;
1473 buf_tmp += i;
1474 buf_tmp_dma += i;
1475
1476 /* region 4: status buffer (larger the PRD, smaller this buf) ****** */
1477 slot->response = buf_tmp;
1478 hdr->status_buf = cpu_to_le64(buf_tmp_dma);
1479
1480 /*
1481 * Fill in TX ring and command slot header
1482 */
1483 slot->tx = mvi->tx_prod;
1484 mvi->tx[mvi->tx_prod] = cpu_to_le32((TXQ_CMD_SMP << TXQ_CMD_SHIFT) |
1485 TXQ_MODE_I | tag |
1486 (sas_port->phy_mask << TXQ_PHY_SHIFT));
1487
1488 hdr->flags |= flags;
1489 hdr->lens = cpu_to_le32(((resp_len / 4) << 16) | ((req_len - 4) / 4));
1490 hdr->tags = cpu_to_le32(tag);
1491 hdr->data_len = 0;
1492
1493 /* generate open address frame hdr (first 12 bytes) */
1494 buf_oaf[0] = (1 << 7) | (0 << 4) | 0x01; /* initiator, SMP, ftype 1h */
1495 buf_oaf[1] = task->dev->linkrate & 0xf;
1496 *(u16 *)(buf_oaf + 2) = 0xFFFF; /* SAS SPEC */
1497 memcpy(buf_oaf + 4, task->dev->sas_addr, SAS_ADDR_SIZE);
1498
1499 /* fill in PRD (scatter/gather) table, if any */
1500 for_each_sg(task->scatter, sg, tei->n_elem, i) {
1501 buf_prd->addr = cpu_to_le64(sg_dma_address(sg));
1502 buf_prd->len = cpu_to_le32(sg_dma_len(sg));
1503 buf_prd++;
1504 }
1505
1506#if _MV_DUMP
1507 /* copy cmd table */
1508 from = kmap_atomic(sg_page(sg_req), KM_IRQ0);
1509 memcpy(buf_cmd, from + sg_req->offset, req_len);
1510 kunmap_atomic(from, KM_IRQ0);
1511#endif
1512 return 0;
1513
1514err_out_2:
1515 pci_unmap_sg(mvi->pdev, &tei->task->smp_task.smp_resp, 1,
1516 PCI_DMA_FROMDEVICE);
1517err_out:
1518 pci_unmap_sg(mvi->pdev, &tei->task->smp_task.smp_req, 1,
1519 PCI_DMA_TODEVICE);
1520 return rc;
1521}
1522
1523static void mvs_free_reg_set(struct mvs_info *mvi, struct mvs_port *port)
1524{
1525 void __iomem *regs = mvi->regs;
1526 u32 tmp, offs;
1527 u8 *tfs = &port->taskfileset;
1528
1529 if (*tfs == MVS_ID_NOT_MAPPED)
1530 return;
1531
1532 offs = 1U << ((*tfs & 0x0f) + PCS_EN_SATA_REG_SHIFT);
1533 if (*tfs < 16) {
1534 tmp = mr32(PCS);
1535 mw32(PCS, tmp & ~offs);
1536 } else {
1537 tmp = mr32(CTL);
1538 mw32(CTL, tmp & ~offs);
1539 }
1540
1541 tmp = mr32(INT_STAT_SRS) & (1U << *tfs);
1542 if (tmp)
1543 mw32(INT_STAT_SRS, tmp);
1544
1545 *tfs = MVS_ID_NOT_MAPPED;
1546}
1547
1548static u8 mvs_assign_reg_set(struct mvs_info *mvi, struct mvs_port *port)
1549{
1550 int i;
1551 u32 tmp, offs;
1552 void __iomem *regs = mvi->regs;
1553
1554 if (port->taskfileset != MVS_ID_NOT_MAPPED)
1555 return 0;
1556
1557 tmp = mr32(PCS);
1558
1559 for (i = 0; i < mvi->chip->srs_sz; i++) {
1560 if (i == 16)
1561 tmp = mr32(CTL);
1562 offs = 1U << ((i & 0x0f) + PCS_EN_SATA_REG_SHIFT);
1563 if (!(tmp & offs)) {
1564 port->taskfileset = i;
1565
1566 if (i < 16)
1567 mw32(PCS, tmp | offs);
1568 else
1569 mw32(CTL, tmp | offs);
1570 tmp = mr32(INT_STAT_SRS) & (1U << i);
1571 if (tmp)
1572 mw32(INT_STAT_SRS, tmp);
1573 return 0;
1574 }
1575 }
1576 return MVS_ID_NOT_MAPPED;
1577}
1578
1579static u32 mvs_get_ncq_tag(struct sas_task *task)
1580{
1581 u32 tag = 0;
1582 struct ata_queued_cmd *qc = task->uldd_task;
1583
1584 if (qc)
1585 tag = qc->tag;
1586
1587 return tag;
1588}
1589
1590static int mvs_task_prep_ata(struct mvs_info *mvi,
1591 struct mvs_task_exec_info *tei)
1592{
1593 struct sas_task *task = tei->task;
1594 struct domain_device *dev = task->dev;
1595 struct mvs_cmd_hdr *hdr = tei->hdr;
1596 struct asd_sas_port *sas_port = dev->port;
1597 struct mvs_slot_info *slot;
1598 struct scatterlist *sg;
1599 struct mvs_prd *buf_prd;
1600 struct mvs_port *port = tei->port;
1601 u32 tag = tei->tag;
1602 u32 flags = (tei->n_elem << MCH_PRD_LEN_SHIFT);
1603 void *buf_tmp;
1604 u8 *buf_cmd, *buf_oaf;
1605 dma_addr_t buf_tmp_dma;
1606 u32 i, req_len, resp_len;
1607 const u32 max_resp_len = SB_RFB_MAX;
1608
1609 if (mvs_assign_reg_set(mvi, port) == MVS_ID_NOT_MAPPED)
1610 return -EBUSY;
1611
1612 slot = &mvi->slot_info[tag];
1613 slot->tx = mvi->tx_prod;
1614 mvi->tx[mvi->tx_prod] = cpu_to_le32(TXQ_MODE_I | tag |
1615 (TXQ_CMD_STP << TXQ_CMD_SHIFT) |
1616 (sas_port->phy_mask << TXQ_PHY_SHIFT) |
1617 (port->taskfileset << TXQ_SRS_SHIFT));
1618
1619 if (task->ata_task.use_ncq)
1620 flags |= MCH_FPDMA;
1621 if (dev->sata_dev.command_set == ATAPI_COMMAND_SET) {
1622 if (task->ata_task.fis.command != ATA_CMD_ID_ATAPI)
1623 flags |= MCH_ATAPI;
1624 }
1625
1626 /* FIXME: fill in port multiplier number */
1627
1628 hdr->flags = cpu_to_le32(flags);
1629
1630 /* FIXME: the low order order 5 bits for the TAG if enable NCQ */
1631 if (task->ata_task.use_ncq) {
1632 hdr->tags = cpu_to_le32(mvs_get_ncq_tag(task));
1633 /*Fill in task file */
1634 task->ata_task.fis.sector_count = hdr->tags << 3;
1635 } else
1636 hdr->tags = cpu_to_le32(tag);
1637 hdr->data_len = cpu_to_le32(task->total_xfer_len);
1638
1639 /*
1640 * arrange MVS_SLOT_BUF_SZ-sized DMA buffer according to our needs
1641 */
1642
1643 /* region 1: command table area (MVS_ATA_CMD_SZ bytes) ************** */
1644 buf_cmd = buf_tmp = slot->buf;
1645 buf_tmp_dma = slot->buf_dma;
1646
1647 hdr->cmd_tbl = cpu_to_le64(buf_tmp_dma);
1648
1649 buf_tmp += MVS_ATA_CMD_SZ;
1650 buf_tmp_dma += MVS_ATA_CMD_SZ;
1651#if _MV_DUMP
1652 slot->cmd_size = MVS_ATA_CMD_SZ;
1653#endif
1654
1655 /* region 2: open address frame area (MVS_OAF_SZ bytes) ********* */
1656 /* used for STP. unused for SATA? */
1657 buf_oaf = buf_tmp;
1658 hdr->open_frame = cpu_to_le64(buf_tmp_dma);
1659
1660 buf_tmp += MVS_OAF_SZ;
1661 buf_tmp_dma += MVS_OAF_SZ;
1662
1663 /* region 3: PRD table ********************************************* */
1664 buf_prd = buf_tmp;
1665 if (tei->n_elem)
1666 hdr->prd_tbl = cpu_to_le64(buf_tmp_dma);
1667 else
1668 hdr->prd_tbl = 0;
1669
1670 i = sizeof(struct mvs_prd) * tei->n_elem;
1671 buf_tmp += i;
1672 buf_tmp_dma += i;
1673
1674 /* region 4: status buffer (larger the PRD, smaller this buf) ****** */
1675 /* FIXME: probably unused, for SATA. kept here just in case
1676 * we get a STP/SATA error information record
1677 */
1678 slot->response = buf_tmp;
1679 hdr->status_buf = cpu_to_le64(buf_tmp_dma);
1680
1681 req_len = sizeof(struct host_to_dev_fis);
1682 resp_len = MVS_SLOT_BUF_SZ - MVS_ATA_CMD_SZ -
1683 sizeof(struct mvs_err_info) - i;
1684
1685 /* request, response lengths */
1686 resp_len = min(resp_len, max_resp_len);
1687 hdr->lens = cpu_to_le32(((resp_len / 4) << 16) | (req_len / 4));
1688
1689 task->ata_task.fis.flags |= 0x80; /* C=1: update ATA cmd reg */
1690 /* fill in command FIS and ATAPI CDB */
1691 memcpy(buf_cmd, &task->ata_task.fis, sizeof(struct host_to_dev_fis));
1692 if (dev->sata_dev.command_set == ATAPI_COMMAND_SET)
1693 memcpy(buf_cmd + STP_ATAPI_CMD,
1694 task->ata_task.atapi_packet, 16);
1695
1696 /* generate open address frame hdr (first 12 bytes) */
1697 buf_oaf[0] = (1 << 7) | (2 << 4) | 0x1; /* initiator, STP, ftype 1h */
1698 buf_oaf[1] = task->dev->linkrate & 0xf;
1699 *(u16 *)(buf_oaf + 2) = cpu_to_be16(tag);
1700 memcpy(buf_oaf + 4, task->dev->sas_addr, SAS_ADDR_SIZE);
1701
1702 /* fill in PRD (scatter/gather) table, if any */
1703 for_each_sg(task->scatter, sg, tei->n_elem, i) {
1704 buf_prd->addr = cpu_to_le64(sg_dma_address(sg));
1705 buf_prd->len = cpu_to_le32(sg_dma_len(sg));
1706 buf_prd++;
1707 }
1708
1709 return 0;
1710}
1711
1712static int mvs_task_prep_ssp(struct mvs_info *mvi,
1713 struct mvs_task_exec_info *tei)
1714{
1715 struct sas_task *task = tei->task;
1716 struct mvs_cmd_hdr *hdr = tei->hdr;
1717 struct mvs_port *port = tei->port;
1718 struct mvs_slot_info *slot;
1719 struct scatterlist *sg;
1720 struct mvs_prd *buf_prd;
1721 struct ssp_frame_hdr *ssp_hdr;
1722 void *buf_tmp;
1723 u8 *buf_cmd, *buf_oaf, fburst = 0;
1724 dma_addr_t buf_tmp_dma;
1725 u32 flags;
1726 u32 resp_len, req_len, i, tag = tei->tag;
1727 const u32 max_resp_len = SB_RFB_MAX;
1728
1729 slot = &mvi->slot_info[tag];
1730
1731 slot->tx = mvi->tx_prod;
1732 mvi->tx[mvi->tx_prod] = cpu_to_le32(TXQ_MODE_I | tag |
1733 (TXQ_CMD_SSP << TXQ_CMD_SHIFT) |
1734 (port->wide_port_phymap << TXQ_PHY_SHIFT));
1735
1736 flags = MCH_RETRY;
1737 if (task->ssp_task.enable_first_burst) {
1738 flags |= MCH_FBURST;
1739 fburst = (1 << 7);
1740 }
1741 hdr->flags = cpu_to_le32(flags |
1742 (tei->n_elem << MCH_PRD_LEN_SHIFT) |
1743 (MCH_SSP_FR_CMD << MCH_SSP_FR_TYPE_SHIFT));
1744
1745 hdr->tags = cpu_to_le32(tag);
1746 hdr->data_len = cpu_to_le32(task->total_xfer_len);
1747
1748 /*
1749 * arrange MVS_SLOT_BUF_SZ-sized DMA buffer according to our needs
1750 */
1751
1752 /* region 1: command table area (MVS_SSP_CMD_SZ bytes) ************** */
1753 buf_cmd = buf_tmp = slot->buf;
1754 buf_tmp_dma = slot->buf_dma;
1755
1756 hdr->cmd_tbl = cpu_to_le64(buf_tmp_dma);
1757
1758 buf_tmp += MVS_SSP_CMD_SZ;
1759 buf_tmp_dma += MVS_SSP_CMD_SZ;
1760#if _MV_DUMP
1761 slot->cmd_size = MVS_SSP_CMD_SZ;
1762#endif
1763
1764 /* region 2: open address frame area (MVS_OAF_SZ bytes) ********* */
1765 buf_oaf = buf_tmp;
1766 hdr->open_frame = cpu_to_le64(buf_tmp_dma);
1767
1768 buf_tmp += MVS_OAF_SZ;
1769 buf_tmp_dma += MVS_OAF_SZ;
1770
1771 /* region 3: PRD table ********************************************* */
1772 buf_prd = buf_tmp;
1773 if (tei->n_elem)
1774 hdr->prd_tbl = cpu_to_le64(buf_tmp_dma);
1775 else
1776 hdr->prd_tbl = 0;
1777
1778 i = sizeof(struct mvs_prd) * tei->n_elem;
1779 buf_tmp += i;
1780 buf_tmp_dma += i;
1781
1782 /* region 4: status buffer (larger the PRD, smaller this buf) ****** */
1783 slot->response = buf_tmp;
1784 hdr->status_buf = cpu_to_le64(buf_tmp_dma);
1785
1786 resp_len = MVS_SLOT_BUF_SZ - MVS_SSP_CMD_SZ - MVS_OAF_SZ -
1787 sizeof(struct mvs_err_info) - i;
1788 resp_len = min(resp_len, max_resp_len);
1789
1790 req_len = sizeof(struct ssp_frame_hdr) + 28;
1791
1792 /* request, response lengths */
1793 hdr->lens = cpu_to_le32(((resp_len / 4) << 16) | (req_len / 4));
1794
1795 /* generate open address frame hdr (first 12 bytes) */
1796 buf_oaf[0] = (1 << 7) | (1 << 4) | 0x1; /* initiator, SSP, ftype 1h */
1797 buf_oaf[1] = task->dev->linkrate & 0xf;
1798 *(u16 *)(buf_oaf + 2) = cpu_to_be16(tag);
1799 memcpy(buf_oaf + 4, task->dev->sas_addr, SAS_ADDR_SIZE);
1800
1801 /* fill in SSP frame header (Command Table.SSP frame header) */
1802 ssp_hdr = (struct ssp_frame_hdr *)buf_cmd;
1803 ssp_hdr->frame_type = SSP_COMMAND;
1804 memcpy(ssp_hdr->hashed_dest_addr, task->dev->hashed_sas_addr,
1805 HASHED_SAS_ADDR_SIZE);
1806 memcpy(ssp_hdr->hashed_src_addr,
1807 task->dev->port->ha->hashed_sas_addr, HASHED_SAS_ADDR_SIZE);
1808 ssp_hdr->tag = cpu_to_be16(tag);
1809
1810 /* fill in command frame IU */
1811 buf_cmd += sizeof(*ssp_hdr);
1812 memcpy(buf_cmd, &task->ssp_task.LUN, 8);
1813 buf_cmd[9] = fburst | task->ssp_task.task_attr |
1814 (task->ssp_task.task_prio << 3);
1815 memcpy(buf_cmd + 12, &task->ssp_task.cdb, 16);
1816
1817 /* fill in PRD (scatter/gather) table, if any */
1818 for_each_sg(task->scatter, sg, tei->n_elem, i) {
1819 buf_prd->addr = cpu_to_le64(sg_dma_address(sg));
1820 buf_prd->len = cpu_to_le32(sg_dma_len(sg));
1821 buf_prd++;
1822 }
1823
1824 return 0;
1825}
1826
1827static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags)
1828{
1829 struct domain_device *dev = task->dev;
1830 struct mvs_info *mvi = dev->port->ha->lldd_ha;
1831 struct pci_dev *pdev = mvi->pdev;
1832 void __iomem *regs = mvi->regs;
1833 struct mvs_task_exec_info tei;
1834 struct sas_task *t = task;
1835 u32 tag = 0xdeadbeef, rc, n_elem = 0;
1836 unsigned long flags;
1837 u32 n = num, pass = 0;
1838
1839 spin_lock_irqsave(&mvi->lock, flags);
1840
1841 do {
1842 tei.port = &mvi->port[dev->port->id];
1843
1844 if (!tei.port->port_attached) {
1845 struct task_status_struct *ts = &t->task_status;
1846 ts->stat = SAS_PHY_DOWN;
1847 t->task_done(t);
1848 rc = 0;
1849 goto exec_exit;
1850 }
1851 if (!sas_protocol_ata(t->task_proto)) {
1852 if (t->num_scatter) {
1853 n_elem = pci_map_sg(mvi->pdev, t->scatter,
1854 t->num_scatter,
1855 t->data_dir);
1856 if (!n_elem) {
1857 rc = -ENOMEM;
1858 goto err_out;
1859 }
1860 }
1861 } else {
1862 n_elem = t->num_scatter;
1863 }
1864
1865 rc = mvs_tag_alloc(mvi, &tag);
1866 if (rc)
1867 goto err_out;
1868
1869 mvi->slot_info[tag].task = t;
1870 mvi->slot_info[tag].n_elem = n_elem;
1871 memset(mvi->slot_info[tag].buf, 0, MVS_SLOT_BUF_SZ);
1872 tei.task = t;
1873 tei.hdr = &mvi->slot[tag];
1874 tei.tag = tag;
1875 tei.n_elem = n_elem;
1876
1877 switch (t->task_proto) {
1878 case SAS_PROTOCOL_SMP:
1879 rc = mvs_task_prep_smp(mvi, &tei);
1880 break;
1881 case SAS_PROTOCOL_SSP:
1882 rc = mvs_task_prep_ssp(mvi, &tei);
1883 break;
1884 case SAS_PROTOCOL_SATA:
1885 case SAS_PROTOCOL_STP:
1886 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:
1887 rc = mvs_task_prep_ata(mvi, &tei);
1888 break;
1889 default:
1890 dev_printk(KERN_ERR, &pdev->dev,
1891 "unknown sas_task proto: 0x%x\n",
1892 t->task_proto);
1893 rc = -EINVAL;
1894 break;
1895 }
1896
1897 if (rc)
1898 goto err_out_tag;
1899
1900 /* TODO: select normal or high priority */
1901
1902 spin_lock(&t->task_state_lock);
1903 t->task_state_flags |= SAS_TASK_AT_INITIATOR;
1904 spin_unlock(&t->task_state_lock);
1905
1906 if (n == 1) {
1907 spin_unlock_irqrestore(&mvi->lock, flags);
1908 mw32(TX_PROD_IDX, mvi->tx_prod);
1909 }
1910 mvs_hba_memory_dump(mvi, tag, t->task_proto);
1911
1912 ++pass;
1913 mvi->tx_prod = (mvi->tx_prod + 1) & (MVS_CHIP_SLOT_SZ - 1);
1914
1915 if (n == 1)
1916 break;
1917
1918 t = list_entry(t->list.next, struct sas_task, list);
1919 } while (--n);
1920
1921 return 0;
1922
1923err_out_tag:
1924 mvs_tag_free(mvi, tag);
1925err_out:
1926 dev_printk(KERN_ERR, &pdev->dev, "mvsas exec failed[%d]!\n", rc);
1927 if (!sas_protocol_ata(t->task_proto))
1928 if (n_elem)
1929 pci_unmap_sg(mvi->pdev, t->scatter, n_elem,
1930 t->data_dir);
1931exec_exit:
1932 if (pass)
1933 mw32(TX_PROD_IDX, (mvi->tx_prod - 1) & (MVS_CHIP_SLOT_SZ - 1));
1934 spin_unlock_irqrestore(&mvi->lock, flags);
1935 return rc;
1936}
1937
1938static int mvs_task_abort(struct sas_task *task)
1939{
1940 int rc = 1;
1941 unsigned long flags;
1942 struct mvs_info *mvi = task->dev->port->ha->lldd_ha;
1943 struct pci_dev *pdev = mvi->pdev;
1944
1945 spin_lock_irqsave(&task->task_state_lock, flags);
1946 if (task->task_state_flags & SAS_TASK_STATE_DONE) {
1947 rc = TMF_RESP_FUNC_COMPLETE;
1948 goto out_done;
1949 }
1950 spin_unlock_irqrestore(&task->task_state_lock, flags);
1951
1952 /*FIXME*/
1953 rc = TMF_RESP_FUNC_COMPLETE;
1954
1955 switch (task->task_proto) {
1956 case SAS_PROTOCOL_SMP:
1957 dev_printk(KERN_DEBUG, &pdev->dev, "SMP Abort! ");
1958 break;
1959 case SAS_PROTOCOL_SSP:
1960 dev_printk(KERN_DEBUG, &pdev->dev, "SSP Abort! ");
1961 break;
1962 case SAS_PROTOCOL_SATA:
1963 case SAS_PROTOCOL_STP:
1964 case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:{
1965 dev_printk(KERN_DEBUG, &pdev->dev, "STP Abort! "
1966 "Dump D2H FIS: \n");
1967 mvs_hexdump(sizeof(struct host_to_dev_fis),
1968 (void *)&task->ata_task.fis, 0);
1969 dev_printk(KERN_DEBUG, &pdev->dev, "Dump ATAPI Cmd : \n");
1970 mvs_hexdump(16, task->ata_task.atapi_packet, 0);
1971 break;
1972 }
1973 default:
1974 break;
1975 }
1976out_done:
1977 return rc;
1978}
1979
1980static void mvs_free(struct mvs_info *mvi)
1981{
1982 int i;
1983
1984 if (!mvi)
1985 return;
1986
1987 for (i = 0; i < MVS_SLOTS; i++) {
1988 struct mvs_slot_info *slot = &mvi->slot_info[i];
1989
1990 if (slot->buf)
1991 dma_free_coherent(&mvi->pdev->dev, MVS_SLOT_BUF_SZ,
1992 slot->buf, slot->buf_dma);
1993 }
1994
1995 if (mvi->tx)
1996 dma_free_coherent(&mvi->pdev->dev,
1997 sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ,
1998 mvi->tx, mvi->tx_dma);
1999 if (mvi->rx_fis)
2000 dma_free_coherent(&mvi->pdev->dev, MVS_RX_FISL_SZ,
2001 mvi->rx_fis, mvi->rx_fis_dma);
2002 if (mvi->rx)
2003 dma_free_coherent(&mvi->pdev->dev,
2004 sizeof(*mvi->rx) * MVS_RX_RING_SZ,
2005 mvi->rx, mvi->rx_dma);
2006 if (mvi->slot)
2007 dma_free_coherent(&mvi->pdev->dev,
2008 sizeof(*mvi->slot) * MVS_SLOTS,
2009 mvi->slot, mvi->slot_dma);
2010#ifdef MVS_ENABLE_PERI
2011 if (mvi->peri_regs)
2012 iounmap(mvi->peri_regs);
2013#endif
2014 if (mvi->regs)
2015 iounmap(mvi->regs);
2016 if (mvi->shost)
2017 scsi_host_put(mvi->shost);
2018 kfree(mvi->sas.sas_port);
2019 kfree(mvi->sas.sas_phy);
2020 kfree(mvi);
2021}
2022
2023/* FIXME: locking? */
2024static int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
2025 void *funcdata)
2026{
2027 struct mvs_info *mvi = sas_phy->ha->lldd_ha;
2028 int rc = 0, phy_id = sas_phy->id;
2029 u32 tmp;
2030
2031 tmp = mvs_read_phy_ctl(mvi, phy_id);
2032
2033 switch (func) {
2034 case PHY_FUNC_SET_LINK_RATE:{
2035 struct sas_phy_linkrates *rates = funcdata;
2036 u32 lrmin = 0, lrmax = 0;
2037
2038 lrmin = (rates->minimum_linkrate << 8);
2039 lrmax = (rates->maximum_linkrate << 12);
2040
2041 if (lrmin) {
2042 tmp &= ~(0xf << 8);
2043 tmp |= lrmin;
2044 }
2045 if (lrmax) {
2046 tmp &= ~(0xf << 12);
2047 tmp |= lrmax;
2048 }
2049 mvs_write_phy_ctl(mvi, phy_id, tmp);
2050 break;
2051 }
2052
2053 case PHY_FUNC_HARD_RESET:
2054 if (tmp & PHY_RST_HARD)
2055 break;
2056 mvs_write_phy_ctl(mvi, phy_id, tmp | PHY_RST_HARD);
2057 break;
2058
2059 case PHY_FUNC_LINK_RESET:
2060 mvs_write_phy_ctl(mvi, phy_id, tmp | PHY_RST);
2061 break;
2062
2063 case PHY_FUNC_DISABLE:
2064 case PHY_FUNC_RELEASE_SPINUP_HOLD:
2065 default:
2066 rc = -EOPNOTSUPP;
2067 }
2068
2069 return rc;
2070}
2071
2072static void __devinit mvs_phy_init(struct mvs_info *mvi, int phy_id)
2073{
2074 struct mvs_phy *phy = &mvi->phy[phy_id];
2075 struct asd_sas_phy *sas_phy = &phy->sas_phy;
2076
2077 sas_phy->enabled = (phy_id < mvi->chip->n_phy) ? 1 : 0;
2078 sas_phy->class = SAS;
2079 sas_phy->iproto = SAS_PROTOCOL_ALL;
2080 sas_phy->tproto = 0;
2081 sas_phy->type = PHY_TYPE_PHYSICAL;
2082 sas_phy->role = PHY_ROLE_INITIATOR;
2083 sas_phy->oob_mode = OOB_NOT_CONNECTED;
2084 sas_phy->linkrate = SAS_LINK_RATE_UNKNOWN;
2085
2086 sas_phy->id = phy_id;
2087 sas_phy->sas_addr = &mvi->sas_addr[0];
2088 sas_phy->frame_rcvd = &phy->frame_rcvd[0];
2089 sas_phy->ha = &mvi->sas;
2090 sas_phy->lldd_phy = phy;
2091}
2092
2093static struct mvs_info *__devinit mvs_alloc(struct pci_dev *pdev,
2094 const struct pci_device_id *ent)
2095{
2096 struct mvs_info *mvi;
2097 unsigned long res_start, res_len, res_flag;
2098 struct asd_sas_phy **arr_phy;
2099 struct asd_sas_port **arr_port;
2100 const struct mvs_chip_info *chip = &mvs_chips[ent->driver_data];
2101 int i;
2102
2103 /*
2104 * alloc and init our per-HBA mvs_info struct
2105 */
2106
2107 mvi = kzalloc(sizeof(*mvi), GFP_KERNEL);
2108 if (!mvi)
2109 return NULL;
2110
2111 spin_lock_init(&mvi->lock);
2112 mvi->pdev = pdev;
2113 mvi->chip = chip;
2114
2115 if (pdev->device == 0x6440 && pdev->revision == 0)
2116 mvi->flags |= MVF_PHY_PWR_FIX;
2117
2118 /*
2119 * alloc and init SCSI, SAS glue
2120 */
2121
2122 mvi->shost = scsi_host_alloc(&mvs_sht, sizeof(void *));
2123 if (!mvi->shost)
2124 goto err_out;
2125
2126 arr_phy = kcalloc(MVS_MAX_PHYS, sizeof(void *), GFP_KERNEL);
2127 arr_port = kcalloc(MVS_MAX_PHYS, sizeof(void *), GFP_KERNEL);
2128 if (!arr_phy || !arr_port)
2129 goto err_out;
2130
2131 for (i = 0; i < MVS_MAX_PHYS; i++) {
2132 mvs_phy_init(mvi, i);
2133 arr_phy[i] = &mvi->phy[i].sas_phy;
2134 arr_port[i] = &mvi->port[i].sas_port;
2135 }
2136
2137 SHOST_TO_SAS_HA(mvi->shost) = &mvi->sas;
2138 mvi->shost->transportt = mvs_stt;
2139 mvi->shost->max_id = 21;
2140 mvi->shost->max_lun = ~0;
2141 mvi->shost->max_channel = 0;
2142 mvi->shost->max_cmd_len = 16;
2143
2144 mvi->sas.sas_ha_name = DRV_NAME;
2145 mvi->sas.dev = &pdev->dev;
2146 mvi->sas.lldd_module = THIS_MODULE;
2147 mvi->sas.sas_addr = &mvi->sas_addr[0];
2148 mvi->sas.sas_phy = arr_phy;
2149 mvi->sas.sas_port = arr_port;
2150 mvi->sas.num_phys = chip->n_phy;
2151 mvi->sas.lldd_max_execute_num = MVS_CHIP_SLOT_SZ - 1;
2152 mvi->sas.lldd_queue_size = MVS_QUEUE_SIZE;
2153 mvi->can_queue = (MVS_CHIP_SLOT_SZ >> 1) - 1;
2154 mvi->sas.lldd_ha = mvi;
2155 mvi->sas.core.shost = mvi->shost;
2156
2157 mvs_tag_init(mvi);
2158
2159 /*
2160 * ioremap main and peripheral registers
2161 */
2162
2163#ifdef MVS_ENABLE_PERI
2164 res_start = pci_resource_start(pdev, 2);
2165 res_len = pci_resource_len(pdev, 2);
2166 if (!res_start || !res_len)
2167 goto err_out;
2168
2169 mvi->peri_regs = ioremap_nocache(res_start, res_len);
2170 if (!mvi->peri_regs)
2171 goto err_out;
2172#endif
2173
2174 res_start = pci_resource_start(pdev, 4);
2175 res_len = pci_resource_len(pdev, 4);
2176 if (!res_start || !res_len)
2177 goto err_out;
2178
2179 res_flag = pci_resource_flags(pdev, 4);
2180 if (res_flag & IORESOURCE_CACHEABLE)
2181 mvi->regs = ioremap(res_start, res_len);
2182 else
2183 mvi->regs = ioremap_nocache(res_start, res_len);
2184
2185 if (!mvi->regs)
2186 goto err_out;
2187
2188 /*
2189 * alloc and init our DMA areas
2190 */
2191
2192 mvi->tx = dma_alloc_coherent(&pdev->dev,
2193 sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ,
2194 &mvi->tx_dma, GFP_KERNEL);
2195 if (!mvi->tx)
2196 goto err_out;
2197 memset(mvi->tx, 0, sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ);
2198
2199 mvi->rx_fis = dma_alloc_coherent(&pdev->dev, MVS_RX_FISL_SZ,
2200 &mvi->rx_fis_dma, GFP_KERNEL);
2201 if (!mvi->rx_fis)
2202 goto err_out;
2203 memset(mvi->rx_fis, 0, MVS_RX_FISL_SZ);
2204
2205 mvi->rx = dma_alloc_coherent(&pdev->dev,
2206 sizeof(*mvi->rx) * MVS_RX_RING_SZ,
2207 &mvi->rx_dma, GFP_KERNEL);
2208 if (!mvi->rx)
2209 goto err_out;
2210 memset(mvi->rx, 0, sizeof(*mvi->rx) * MVS_RX_RING_SZ);
2211
2212 mvi->rx[0] = cpu_to_le32(0xfff);
2213 mvi->rx_cons = 0xfff;
2214
2215 mvi->slot = dma_alloc_coherent(&pdev->dev,
2216 sizeof(*mvi->slot) * MVS_SLOTS,
2217 &mvi->slot_dma, GFP_KERNEL);
2218 if (!mvi->slot)
2219 goto err_out;
2220 memset(mvi->slot, 0, sizeof(*mvi->slot) * MVS_SLOTS);
2221
2222 for (i = 0; i < MVS_SLOTS; i++) {
2223 struct mvs_slot_info *slot = &mvi->slot_info[i];
2224
2225 slot->buf = dma_alloc_coherent(&pdev->dev, MVS_SLOT_BUF_SZ,
2226 &slot->buf_dma, GFP_KERNEL);
2227 if (!slot->buf)
2228 goto err_out;
2229 memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
2230 }
2231
2232 /* finally, read NVRAM to get our SAS address */
2233 if (mvs_nvram_read(mvi, NVR_SAS_ADDR, &mvi->sas_addr, 8))
2234 goto err_out;
2235 return mvi;
2236
2237err_out:
2238 mvs_free(mvi);
2239 return NULL;
2240}
2241
2242static u32 mvs_cr32(void __iomem *regs, u32 addr)
2243{
2244 mw32(CMD_ADDR, addr);
2245 return mr32(CMD_DATA);
2246}
2247
2248static void mvs_cw32(void __iomem *regs, u32 addr, u32 val)
2249{
2250 mw32(CMD_ADDR, addr);
2251 mw32(CMD_DATA, val);
2252}
2253
2254static u32 mvs_read_phy_ctl(struct mvs_info *mvi, u32 port)
2255{
2256 void __iomem *regs = mvi->regs;
2257 return (port < 4)?mr32(P0_SER_CTLSTAT + port * 4):
2258 mr32(P4_SER_CTLSTAT + (port - 4) * 4);
2259}
2260
2261static void mvs_write_phy_ctl(struct mvs_info *mvi, u32 port, u32 val)
2262{
2263 void __iomem *regs = mvi->regs;
2264 if (port < 4)
2265 mw32(P0_SER_CTLSTAT + port * 4, val);
2266 else
2267 mw32(P4_SER_CTLSTAT + (port - 4) * 4, val);
2268}
2269
2270static u32 mvs_read_port(struct mvs_info *mvi, u32 off, u32 off2, u32 port)
2271{
2272 void __iomem *regs = mvi->regs + off;
2273 void __iomem *regs2 = mvi->regs + off2;
2274 return (port < 4)?readl(regs + port * 8):
2275 readl(regs2 + (port - 4) * 8);
2276}
2277
2278static void mvs_write_port(struct mvs_info *mvi, u32 off, u32 off2,
2279 u32 port, u32 val)
2280{
2281 void __iomem *regs = mvi->regs + off;
2282 void __iomem *regs2 = mvi->regs + off2;
2283 if (port < 4)
2284 writel(val, regs + port * 8);
2285 else
2286 writel(val, regs2 + (port - 4) * 8);
2287}
2288
2289static u32 mvs_read_port_cfg_data(struct mvs_info *mvi, u32 port)
2290{
2291 return mvs_read_port(mvi, MVS_P0_CFG_DATA, MVS_P4_CFG_DATA, port);
2292}
2293
2294static void mvs_write_port_cfg_data(struct mvs_info *mvi, u32 port, u32 val)
2295{
2296 mvs_write_port(mvi, MVS_P0_CFG_DATA, MVS_P4_CFG_DATA, port, val);
2297}
2298
2299static void mvs_write_port_cfg_addr(struct mvs_info *mvi, u32 port, u32 addr)
2300{
2301 mvs_write_port(mvi, MVS_P0_CFG_ADDR, MVS_P4_CFG_ADDR, port, addr);
2302}
2303
2304static u32 mvs_read_port_vsr_data(struct mvs_info *mvi, u32 port)
2305{
2306 return mvs_read_port(mvi, MVS_P0_VSR_DATA, MVS_P4_VSR_DATA, port);
2307}
2308
2309static void mvs_write_port_vsr_data(struct mvs_info *mvi, u32 port, u32 val)
2310{
2311 mvs_write_port(mvi, MVS_P0_VSR_DATA, MVS_P4_VSR_DATA, port, val);
2312}
2313
2314static void mvs_write_port_vsr_addr(struct mvs_info *mvi, u32 port, u32 addr)
2315{
2316 mvs_write_port(mvi, MVS_P0_VSR_ADDR, MVS_P4_VSR_ADDR, port, addr);
2317}
2318
2319static u32 mvs_read_port_irq_stat(struct mvs_info *mvi, u32 port)
2320{
2321 return mvs_read_port(mvi, MVS_P0_INT_STAT, MVS_P4_INT_STAT, port);
2322}
2323
2324static void mvs_write_port_irq_stat(struct mvs_info *mvi, u32 port, u32 val)
2325{
2326 mvs_write_port(mvi, MVS_P0_INT_STAT, MVS_P4_INT_STAT, port, val);
2327}
2328
2329static u32 mvs_read_port_irq_mask(struct mvs_info *mvi, u32 port)
2330{
2331 return mvs_read_port(mvi, MVS_P0_INT_MASK, MVS_P4_INT_MASK, port);
2332}
2333
2334static void mvs_write_port_irq_mask(struct mvs_info *mvi, u32 port, u32 val)
2335{
2336 mvs_write_port(mvi, MVS_P0_INT_MASK, MVS_P4_INT_MASK, port, val);
2337}
2338
2339static void __devinit mvs_phy_hacks(struct mvs_info *mvi)
2340{
2341 void __iomem *regs = mvi->regs;
2342 u32 tmp;
2343
2344 /* workaround for SATA R-ERR, to ignore phy glitch */
2345 tmp = mvs_cr32(regs, CMD_PHY_TIMER);
2346 tmp &= ~(1 << 9);
2347 tmp |= (1 << 10);
2348 mvs_cw32(regs, CMD_PHY_TIMER, tmp);
2349
2350 /* enable retry 127 times */
2351 mvs_cw32(regs, CMD_SAS_CTL1, 0x7f7f);
2352
2353 /* extend open frame timeout to max */
2354 tmp = mvs_cr32(regs, CMD_SAS_CTL0);
2355 tmp &= ~0xffff;
2356 tmp |= 0x3fff;
2357 mvs_cw32(regs, CMD_SAS_CTL0, tmp);
2358
2359 /* workaround for WDTIMEOUT , set to 550 ms */
2360 mvs_cw32(regs, CMD_WD_TIMER, 0xffffff);
2361
2362 /* not to halt for different port op during wideport link change */
2363 mvs_cw32(regs, CMD_APP_ERR_CONFIG, 0xffefbf7d);
2364
2365 /* workaround for Seagate disk not-found OOB sequence, recv
2366 * COMINIT before sending out COMWAKE */
2367 tmp = mvs_cr32(regs, CMD_PHY_MODE_21);
2368 tmp &= 0x0000ffff;
2369 tmp |= 0x00fa0000;
2370 mvs_cw32(regs, CMD_PHY_MODE_21, tmp);
2371
2372 tmp = mvs_cr32(regs, CMD_PHY_TIMER);
2373 tmp &= 0x1fffffff;
2374 tmp |= (2U << 29); /* 8 ms retry */
2375 mvs_cw32(regs, CMD_PHY_TIMER, tmp);
2376
2377 /* TEST - for phy decoding error, adjust voltage levels */
2378 mw32(P0_VSR_ADDR + 0, 0x8);
2379 mw32(P0_VSR_DATA + 0, 0x2F0);
2380
2381 mw32(P0_VSR_ADDR + 8, 0x8);
2382 mw32(P0_VSR_DATA + 8, 0x2F0);
2383
2384 mw32(P0_VSR_ADDR + 16, 0x8);
2385 mw32(P0_VSR_DATA + 16, 0x2F0);
2386
2387 mw32(P0_VSR_ADDR + 24, 0x8);
2388 mw32(P0_VSR_DATA + 24, 0x2F0);
2389
2390}
2391
2392static void mvs_enable_xmt(struct mvs_info *mvi, int PhyId)
2393{
2394 void __iomem *regs = mvi->regs;
2395 u32 tmp;
2396
2397 tmp = mr32(PCS);
2398 if (mvi->chip->n_phy <= 4)
2399 tmp |= 1 << (PhyId + PCS_EN_PORT_XMT_SHIFT);
2400 else
2401 tmp |= 1 << (PhyId + PCS_EN_PORT_XMT_SHIFT2);
2402 mw32(PCS, tmp);
2403}
2404
2405static void mvs_detect_porttype(struct mvs_info *mvi, int i)
2406{
2407 void __iomem *regs = mvi->regs;
2408 u32 reg;
2409 struct mvs_phy *phy = &mvi->phy[i];
2410
2411 /* TODO check & save device type */
2412 reg = mr32(GBL_PORT_TYPE);
2413
2414 if (reg & MODE_SAS_SATA & (1 << i))
2415 phy->phy_type |= PORT_TYPE_SAS;
2416 else
2417 phy->phy_type |= PORT_TYPE_SATA;
2418}
2419
2420static void *mvs_get_d2h_reg(struct mvs_info *mvi, int i, void *buf)
2421{
2422 u32 *s = (u32 *) buf;
2423
2424 if (!s)
2425 return NULL;
2426
2427 mvs_write_port_cfg_addr(mvi, i, PHYR_SATA_SIG3);
2428 s[3] = mvs_read_port_cfg_data(mvi, i);
2429
2430 mvs_write_port_cfg_addr(mvi, i, PHYR_SATA_SIG2);
2431 s[2] = mvs_read_port_cfg_data(mvi, i);
2432
2433 mvs_write_port_cfg_addr(mvi, i, PHYR_SATA_SIG1);
2434 s[1] = mvs_read_port_cfg_data(mvi, i);
2435
2436 mvs_write_port_cfg_addr(mvi, i, PHYR_SATA_SIG0);
2437 s[0] = mvs_read_port_cfg_data(mvi, i);
2438
2439 return (void *)s;
2440}
2441
2442static u32 mvs_is_sig_fis_received(u32 irq_status)
2443{
2444 return irq_status & PHYEV_SIG_FIS;
2445}
2446
2447static void mvs_update_wideport(struct mvs_info *mvi, int i)
2448{
2449 struct mvs_phy *phy = &mvi->phy[i];
2450 struct mvs_port *port = phy->port;
2451 int j, no;
2452
2453 for_each_phy(port->wide_port_phymap, no, j, mvi->chip->n_phy)
2454 if (no & 1) {
2455 mvs_write_port_cfg_addr(mvi, no, PHYR_WIDE_PORT);
2456 mvs_write_port_cfg_data(mvi, no,
2457 port->wide_port_phymap);
2458 } else {
2459 mvs_write_port_cfg_addr(mvi, no, PHYR_WIDE_PORT);
2460 mvs_write_port_cfg_data(mvi, no, 0);
2461 }
2462}
2463
2464static u32 mvs_is_phy_ready(struct mvs_info *mvi, int i)
2465{
2466 u32 tmp;
2467 struct mvs_phy *phy = &mvi->phy[i];
2468 struct mvs_port *port;
2469
2470 tmp = mvs_read_phy_ctl(mvi, i);
2471
2472 if ((tmp & PHY_READY_MASK) && !(phy->irq_status & PHYEV_POOF)) {
2473 if (!phy->port)
2474 phy->phy_attached = 1;
2475 return tmp;
2476 }
2477
2478 port = phy->port;
2479 if (port) {
2480 if (phy->phy_type & PORT_TYPE_SAS) {
2481 port->wide_port_phymap &= ~(1U << i);
2482 if (!port->wide_port_phymap)
2483 port->port_attached = 0;
2484 mvs_update_wideport(mvi, i);
2485 } else if (phy->phy_type & PORT_TYPE_SATA)
2486 port->port_attached = 0;
2487 mvs_free_reg_set(mvi, phy->port);
2488 phy->port = NULL;
2489 phy->phy_attached = 0;
2490 phy->phy_type &= ~(PORT_TYPE_SAS | PORT_TYPE_SATA);
2491 }
2492 return 0;
2493}
2494
2495static void mvs_update_phyinfo(struct mvs_info *mvi, int i,
2496 int get_st)
2497{
2498 struct mvs_phy *phy = &mvi->phy[i];
2499 struct pci_dev *pdev = mvi->pdev;
2500 u32 tmp, j;
2501 u64 tmp64;
2502
2503 mvs_write_port_cfg_addr(mvi, i, PHYR_IDENTIFY);
2504 phy->dev_info = mvs_read_port_cfg_data(mvi, i);
2505
2506 mvs_write_port_cfg_addr(mvi, i, PHYR_ADDR_HI);
2507 phy->dev_sas_addr = (u64) mvs_read_port_cfg_data(mvi, i) << 32;
2508
2509 mvs_write_port_cfg_addr(mvi, i, PHYR_ADDR_LO);
2510 phy->dev_sas_addr |= mvs_read_port_cfg_data(mvi, i);
2511
2512 if (get_st) {
2513 phy->irq_status = mvs_read_port_irq_stat(mvi, i);
2514 phy->phy_status = mvs_is_phy_ready(mvi, i);
2515 }
2516
2517 if (phy->phy_status) {
2518 u32 phy_st;
2519 struct asd_sas_phy *sas_phy = mvi->sas.sas_phy[i];
2520
2521 mvs_write_port_cfg_addr(mvi, i, PHYR_PHY_STAT);
2522 phy_st = mvs_read_port_cfg_data(mvi, i);
2523
2524 sas_phy->linkrate =
2525 (phy->phy_status & PHY_NEG_SPP_PHYS_LINK_RATE_MASK) >>
2526 PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET;
2527
2528 /* Updated attached_sas_addr */
2529 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_ADDR_HI);
2530 phy->att_dev_sas_addr =
2531 (u64) mvs_read_port_cfg_data(mvi, i) << 32;
2532
2533 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_ADDR_LO);
2534 phy->att_dev_sas_addr |= mvs_read_port_cfg_data(mvi, i);
2535
2536 dev_printk(KERN_DEBUG, &pdev->dev,
2537 "phy[%d] Get Attached Address 0x%llX ,"
2538 " SAS Address 0x%llX\n",
2539 i, phy->att_dev_sas_addr, phy->dev_sas_addr);
2540 dev_printk(KERN_DEBUG, &pdev->dev,
2541 "Rate = %x , type = %d\n",
2542 sas_phy->linkrate, phy->phy_type);
2543
2544#if 1
2545 /*
2546 * If the device is capable of supporting a wide port
2547 * on its phys, it may configure the phys as a wide port.
2548 */
2549 if (phy->phy_type & PORT_TYPE_SAS)
2550 for (j = 0; j < mvi->chip->n_phy && j != i; ++j) {
2551 if ((mvi->phy[j].phy_attached) &&
2552 (mvi->phy[j].phy_type & PORT_TYPE_SAS))
2553 if (phy->att_dev_sas_addr ==
2554 mvi->phy[j].att_dev_sas_addr - 1) {
2555 phy->att_dev_sas_addr =
2556 mvi->phy[j].att_dev_sas_addr;
2557 break;
2558 }
2559 }
2560
2561#endif
2562
2563 tmp64 = cpu_to_be64(phy->att_dev_sas_addr);
2564 memcpy(sas_phy->attached_sas_addr, &tmp64, SAS_ADDR_SIZE);
2565
2566 if (phy->phy_type & PORT_TYPE_SAS) {
2567 mvs_write_port_cfg_addr(mvi, i, PHYR_ATT_DEV_INFO);
2568 phy->att_dev_info = mvs_read_port_cfg_data(mvi, i);
2569 phy->identify.device_type =
2570 phy->att_dev_info & PORT_DEV_TYPE_MASK;
2571
2572 if (phy->identify.device_type == SAS_END_DEV)
2573 phy->identify.target_port_protocols =
2574 SAS_PROTOCOL_SSP;
2575 else if (phy->identify.device_type != NO_DEVICE)
2576 phy->identify.target_port_protocols =
2577 SAS_PROTOCOL_SMP;
2578 if (phy_st & PHY_OOB_DTCTD)
2579 sas_phy->oob_mode = SAS_OOB_MODE;
2580 phy->frame_rcvd_size =
2581 sizeof(struct sas_identify_frame);
2582 } else if (phy->phy_type & PORT_TYPE_SATA) {
2583 phy->identify.target_port_protocols = SAS_PROTOCOL_STP;
2584 if (mvs_is_sig_fis_received(phy->irq_status)) {
2585 if (phy_st & PHY_OOB_DTCTD)
2586 sas_phy->oob_mode = SATA_OOB_MODE;
2587 phy->frame_rcvd_size =
2588 sizeof(struct dev_to_host_fis);
2589 mvs_get_d2h_reg(mvi, i,
2590 (void *)sas_phy->frame_rcvd);
2591 } else {
2592 dev_printk(KERN_DEBUG, &pdev->dev,
2593 "No sig fis\n");
2594 }
2595 }
2596 /* workaround for HW phy decoding error on 1.5g disk drive */
2597 mvs_write_port_vsr_addr(mvi, i, VSR_PHY_MODE6);
2598 tmp = mvs_read_port_vsr_data(mvi, i);
2599 if (((phy->phy_status & PHY_NEG_SPP_PHYS_LINK_RATE_MASK) >>
2600 PHY_NEG_SPP_PHYS_LINK_RATE_MASK_OFFSET) ==
2601 SAS_LINK_RATE_1_5_GBPS)
2602 tmp &= ~PHY_MODE6_DTL_SPEED;
2603 else
2604 tmp |= PHY_MODE6_DTL_SPEED;
2605 mvs_write_port_vsr_data(mvi, i, tmp);
2606
2607 }
2608 if (get_st)
2609 mvs_write_port_irq_stat(mvi, i, phy->irq_status);
2610}
2611
2612static void mvs_port_formed(struct asd_sas_phy *sas_phy)
2613{
2614 struct sas_ha_struct *sas_ha = sas_phy->ha;
2615 struct mvs_info *mvi = sas_ha->lldd_ha;
2616 struct asd_sas_port *sas_port = sas_phy->port;
2617 struct mvs_phy *phy = sas_phy->lldd_phy;
2618 struct mvs_port *port = &mvi->port[sas_port->id];
2619 unsigned long flags;
2620
2621 spin_lock_irqsave(&mvi->lock, flags);
2622 port->port_attached = 1;
2623 phy->port = port;
2624 port->taskfileset = MVS_ID_NOT_MAPPED;
2625 if (phy->phy_type & PORT_TYPE_SAS) {
2626 port->wide_port_phymap = sas_port->phy_mask;
2627 mvs_update_wideport(mvi, sas_phy->id);
2628 }
2629 spin_unlock_irqrestore(&mvi->lock, flags);
2630}
2631
2632static int __devinit mvs_hw_init(struct mvs_info *mvi)
2633{
2634 void __iomem *regs = mvi->regs;
2635 int i;
2636 u32 tmp, cctl;
2637
2638 /* make sure interrupts are masked immediately (paranoia) */
2639 mw32(GBL_CTL, 0);
2640 tmp = mr32(GBL_CTL);
2641
2642 /* Reset Controller */
2643 if (!(tmp & HBA_RST)) {
2644 if (mvi->flags & MVF_PHY_PWR_FIX) {
2645 pci_read_config_dword(mvi->pdev, PCR_PHY_CTL, &tmp);
2646 tmp &= ~PCTL_PWR_ON;
2647 tmp |= PCTL_OFF;
2648 pci_write_config_dword(mvi->pdev, PCR_PHY_CTL, tmp);
2649
2650 pci_read_config_dword(mvi->pdev, PCR_PHY_CTL2, &tmp);
2651 tmp &= ~PCTL_PWR_ON;
2652 tmp |= PCTL_OFF;
2653 pci_write_config_dword(mvi->pdev, PCR_PHY_CTL2, tmp);
2654 }
2655
2656 /* global reset, incl. COMRESET/H_RESET_N (self-clearing) */
2657 mw32_f(GBL_CTL, HBA_RST);
2658 }
2659
2660 /* wait for reset to finish; timeout is just a guess */
2661 i = 1000;
2662 while (i-- > 0) {
2663 msleep(10);
2664
2665 if (!(mr32(GBL_CTL) & HBA_RST))
2666 break;
2667 }
2668 if (mr32(GBL_CTL) & HBA_RST) {
2669 dev_printk(KERN_ERR, &mvi->pdev->dev, "HBA reset failed\n");
2670 return -EBUSY;
2671 }
2672
2673 /* Init Chip */
2674 /* make sure RST is set; HBA_RST /should/ have done that for us */
2675 cctl = mr32(CTL);
2676 if (cctl & CCTL_RST)
2677 cctl &= ~CCTL_RST;
2678 else
2679 mw32_f(CTL, cctl | CCTL_RST);
2680
2681 /* write to device control _AND_ device status register? - A.C. */
2682 pci_read_config_dword(mvi->pdev, PCR_DEV_CTRL, &tmp);
2683 tmp &= ~PRD_REQ_MASK;
2684 tmp |= PRD_REQ_SIZE;
2685 pci_write_config_dword(mvi->pdev, PCR_DEV_CTRL, tmp);
2686
2687 pci_read_config_dword(mvi->pdev, PCR_PHY_CTL, &tmp);
2688 tmp |= PCTL_PWR_ON;
2689 tmp &= ~PCTL_OFF;
2690 pci_write_config_dword(mvi->pdev, PCR_PHY_CTL, tmp);
2691
2692 pci_read_config_dword(mvi->pdev, PCR_PHY_CTL2, &tmp);
2693 tmp |= PCTL_PWR_ON;
2694 tmp &= ~PCTL_OFF;
2695 pci_write_config_dword(mvi->pdev, PCR_PHY_CTL2, tmp);
2696
2697 mw32_f(CTL, cctl);
2698
2699 /* reset control */
2700 mw32(PCS, 0); /*MVS_PCS */
2701
2702 mvs_phy_hacks(mvi);
2703
2704 mw32(CMD_LIST_LO, mvi->slot_dma);
2705 mw32(CMD_LIST_HI, (mvi->slot_dma >> 16) >> 16);
2706
2707 mw32(RX_FIS_LO, mvi->rx_fis_dma);
2708 mw32(RX_FIS_HI, (mvi->rx_fis_dma >> 16) >> 16);
2709
2710 mw32(TX_CFG, MVS_CHIP_SLOT_SZ);
2711 mw32(TX_LO, mvi->tx_dma);
2712 mw32(TX_HI, (mvi->tx_dma >> 16) >> 16);
2713
2714 mw32(RX_CFG, MVS_RX_RING_SZ);
2715 mw32(RX_LO, mvi->rx_dma);
2716 mw32(RX_HI, (mvi->rx_dma >> 16) >> 16);
2717
2718 /* enable auto port detection */
2719 mw32(GBL_PORT_TYPE, MODE_AUTO_DET_EN);
2720 msleep(100);
2721 /* init and reset phys */
2722 for (i = 0; i < mvi->chip->n_phy; i++) {
2723 /* FIXME: is this the correct dword order? */
2724 u32 lo = *((u32 *)&mvi->sas_addr[0]);
2725 u32 hi = *((u32 *)&mvi->sas_addr[4]);
2726
2727 mvs_detect_porttype(mvi, i);
2728
2729 /* set phy local SAS address */
2730 mvs_write_port_cfg_addr(mvi, i, PHYR_ADDR_LO);
2731 mvs_write_port_cfg_data(mvi, i, lo);
2732 mvs_write_port_cfg_addr(mvi, i, PHYR_ADDR_HI);
2733 mvs_write_port_cfg_data(mvi, i, hi);
2734
2735 /* reset phy */
2736 tmp = mvs_read_phy_ctl(mvi, i);
2737 tmp |= PHY_RST;
2738 mvs_write_phy_ctl(mvi, i, tmp);
2739 }
2740
2741 msleep(100);
2742
2743 for (i = 0; i < mvi->chip->n_phy; i++) {
2744 /* clear phy int status */
2745 tmp = mvs_read_port_irq_stat(mvi, i);
2746 tmp &= ~PHYEV_SIG_FIS;
2747 mvs_write_port_irq_stat(mvi, i, tmp);
2748
2749 /* set phy int mask */
2750 tmp = PHYEV_RDY_CH | PHYEV_BROAD_CH | PHYEV_UNASSOC_FIS |
2751 PHYEV_ID_DONE | PHYEV_DEC_ERR;
2752 mvs_write_port_irq_mask(mvi, i, tmp);
2753
2754 msleep(100);
2755 mvs_update_phyinfo(mvi, i, 1);
2756 mvs_enable_xmt(mvi, i);
2757 }
2758
2759 /* FIXME: update wide port bitmaps */
2760
2761 /* little endian for open address and command table, etc. */
2762 /* A.C.
2763 * it seems that ( from the spec ) turning on big-endian won't
2764 * do us any good on big-endian machines, need further confirmation
2765 */
2766 cctl = mr32(CTL);
2767 cctl |= CCTL_ENDIAN_CMD;
2768 cctl |= CCTL_ENDIAN_DATA;
2769 cctl &= ~CCTL_ENDIAN_OPEN;
2770 cctl |= CCTL_ENDIAN_RSP;
2771 mw32_f(CTL, cctl);
2772
2773 /* reset CMD queue */
2774 tmp = mr32(PCS);
2775 tmp |= PCS_CMD_RST;
2776 mw32(PCS, tmp);
2777 /* interrupt coalescing may cause missing HW interrput in some case,
2778 * and the max count is 0x1ff, while our max slot is 0x200,
2779 * it will make count 0.
2780 */
2781 tmp = 0;
2782 mw32(INT_COAL, tmp);
2783
2784 tmp = 0x100;
2785 mw32(INT_COAL_TMOUT, tmp);
2786
2787 /* ladies and gentlemen, start your engines */
2788 mw32(TX_CFG, 0);
2789 mw32(TX_CFG, MVS_CHIP_SLOT_SZ | TX_EN);
2790 mw32(RX_CFG, MVS_RX_RING_SZ | RX_EN);
2791 /* enable CMD/CMPL_Q/RESP mode */
2792 mw32(PCS, PCS_SATA_RETRY | PCS_FIS_RX_EN | PCS_CMD_EN);
2793
2794 /* re-enable interrupts globally */
2795 mvs_hba_interrupt_enable(mvi);
2796
2797 /* enable completion queue interrupt */
2798 tmp = (CINT_PORT_MASK | CINT_DONE | CINT_MEM);
2799 mw32(INT_MASK, tmp);
2800
2801 return 0;
2802}
2803
2804static void __devinit mvs_print_info(struct mvs_info *mvi)
2805{
2806 struct pci_dev *pdev = mvi->pdev;
2807 static int printed_version;
2808
2809 if (!printed_version++)
2810 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
2811
2812 dev_printk(KERN_INFO, &pdev->dev, "%u phys, addr %llx\n",
2813 mvi->chip->n_phy, SAS_ADDR(mvi->sas_addr));
2814}
2815
2816static int __devinit mvs_pci_init(struct pci_dev *pdev,
2817 const struct pci_device_id *ent)
2818{
2819 int rc;
2820 struct mvs_info *mvi;
2821 irq_handler_t irq_handler = mvs_interrupt;
2822
2823 rc = pci_enable_device(pdev);
2824 if (rc)
2825 return rc;
2826
2827 pci_set_master(pdev);
2828
2829 rc = pci_request_regions(pdev, DRV_NAME);
2830 if (rc)
2831 goto err_out_disable;
2832
2833 rc = pci_go_64(pdev);
2834 if (rc)
2835 goto err_out_regions;
2836
2837 mvi = mvs_alloc(pdev, ent);
2838 if (!mvi) {
2839 rc = -ENOMEM;
2840 goto err_out_regions;
2841 }
2842
2843 rc = mvs_hw_init(mvi);
2844 if (rc)
2845 goto err_out_mvi;
2846
2847#ifndef MVS_DISABLE_MSI
2848 if (!pci_enable_msi(pdev)) {
2849 u32 tmp;
2850 void __iomem *regs = mvi->regs;
2851 mvi->flags |= MVF_MSI;
2852 irq_handler = mvs_msi_interrupt;
2853 tmp = mr32(PCS);
2854 mw32(PCS, tmp | PCS_SELF_CLEAR);
2855 }
2856#endif
2857
2858 rc = request_irq(pdev->irq, irq_handler, IRQF_SHARED, DRV_NAME, mvi);
2859 if (rc)
2860 goto err_out_msi;
2861
2862 rc = scsi_add_host(mvi->shost, &pdev->dev);
2863 if (rc)
2864 goto err_out_irq;
2865
2866 rc = sas_register_ha(&mvi->sas);
2867 if (rc)
2868 goto err_out_shost;
2869
2870 pci_set_drvdata(pdev, mvi);
2871
2872 mvs_print_info(mvi);
2873
2874 scsi_scan_host(mvi->shost);
2875
2876 return 0;
2877
2878err_out_shost:
2879 scsi_remove_host(mvi->shost);
2880err_out_irq:
2881 free_irq(pdev->irq, mvi);
2882err_out_msi:
2883 if (mvi->flags |= MVF_MSI)
2884 pci_disable_msi(pdev);
2885err_out_mvi:
2886 mvs_free(mvi);
2887err_out_regions:
2888 pci_release_regions(pdev);
2889err_out_disable:
2890 pci_disable_device(pdev);
2891 return rc;
2892}
2893
2894static void __devexit mvs_pci_remove(struct pci_dev *pdev)
2895{
2896 struct mvs_info *mvi = pci_get_drvdata(pdev);
2897
2898 pci_set_drvdata(pdev, NULL);
2899
2900 if (mvi) {
2901 sas_unregister_ha(&mvi->sas);
2902 mvs_hba_interrupt_disable(mvi);
2903 sas_remove_host(mvi->shost);
2904 scsi_remove_host(mvi->shost);
2905
2906 free_irq(pdev->irq, mvi);
2907 if (mvi->flags & MVF_MSI)
2908 pci_disable_msi(pdev);
2909 mvs_free(mvi);
2910 pci_release_regions(pdev);
2911 }
2912 pci_disable_device(pdev);
2913}
2914
2915static struct sas_domain_function_template mvs_transport_ops = {
2916 .lldd_execute_task = mvs_task_exec,
2917 .lldd_control_phy = mvs_phy_control,
2918 .lldd_abort_task = mvs_task_abort,
2919 .lldd_port_formed = mvs_port_formed
2920};
2921
2922static struct pci_device_id __devinitdata mvs_pci_table[] = {
2923 { PCI_VDEVICE(MARVELL, 0x6320), chip_6320 },
2924 { PCI_VDEVICE(MARVELL, 0x6340), chip_6440 },
2925 { PCI_VDEVICE(MARVELL, 0x6440), chip_6440 },
2926 { PCI_VDEVICE(MARVELL, 0x6480), chip_6480 },
2927
2928 { } /* terminate list */
2929};
2930
2931static struct pci_driver mvs_pci_driver = {
2932 .name = DRV_NAME,
2933 .id_table = mvs_pci_table,
2934 .probe = mvs_pci_init,
2935 .remove = __devexit_p(mvs_pci_remove),
2936};
2937
2938static int __init mvs_init(void)
2939{
2940 int rc;
2941
2942 mvs_stt = sas_domain_attach_transport(&mvs_transport_ops);
2943 if (!mvs_stt)
2944 return -ENOMEM;
2945
2946 rc = pci_register_driver(&mvs_pci_driver);
2947 if (rc)
2948 goto err_out;
2949
2950 return 0;
2951
2952err_out:
2953 sas_release_transport(mvs_stt);
2954 return rc;
2955}
2956
2957static void __exit mvs_exit(void)
2958{
2959 pci_unregister_driver(&mvs_pci_driver);
2960 sas_release_transport(mvs_stt);
2961}
2962
2963module_init(mvs_init);
2964module_exit(mvs_exit);
2965
2966MODULE_AUTHOR("Jeff Garzik <jgarzik@pobox.com>");
2967MODULE_DESCRIPTION("Marvell 88SE6440 SAS/SATA controller driver");
2968MODULE_VERSION(DRV_VERSION);
2969MODULE_LICENSE("GPL");
2970MODULE_DEVICE_TABLE(pci, mvs_pci_table);
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 1479c60441c8..2cd899bfe84b 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -23,7 +23,7 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
23 mutex_lock(&ha->fce_mutex); 23 mutex_lock(&ha->fce_mutex);
24 24
25 seq_printf(s, "FCE Trace Buffer\n"); 25 seq_printf(s, "FCE Trace Buffer\n");
26 seq_printf(s, "In Pointer = %llx\n\n", ha->fce_wr); 26 seq_printf(s, "In Pointer = %llx\n\n", (unsigned long long)ha->fce_wr);
27 seq_printf(s, "Base = %llx\n\n", (unsigned long long) ha->fce_dma); 27 seq_printf(s, "Base = %llx\n\n", (unsigned long long) ha->fce_dma);
28 seq_printf(s, "FCE Enable Registers\n"); 28 seq_printf(s, "FCE Enable Registers\n");
29 seq_printf(s, "%08x %08x %08x %08x %08x %08x\n", 29 seq_printf(s, "%08x %08x %08x %08x %08x %08x\n",
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 0f029d0d7315..fc84db4069f4 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -100,8 +100,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
100 100
101 if (sts_entry->iscsiFlags &ISCSI_FLAG_RESIDUAL_UNDER) { 101 if (sts_entry->iscsiFlags &ISCSI_FLAG_RESIDUAL_UNDER) {
102 scsi_set_resid(cmd, residual); 102 scsi_set_resid(cmd, residual);
103 if (!scsi_status && ((scsi_bufflen(cmd) - residual) < 103 if ((scsi_bufflen(cmd) - residual) < cmd->underflow) {
104 cmd->underflow)) {
105 104
106 cmd->result = DID_ERROR << 16; 105 cmd->result = DID_ERROR << 16;
107 106
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 65455ab1f3b9..4a1cf6377f6c 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -651,7 +651,7 @@ static int qlogicpti_verify_tmon(struct qlogicpti *qpti)
651 651
652static irqreturn_t qpti_intr(int irq, void *dev_id); 652static irqreturn_t qpti_intr(int irq, void *dev_id);
653 653
654static void __init qpti_chain_add(struct qlogicpti *qpti) 654static void __devinit qpti_chain_add(struct qlogicpti *qpti)
655{ 655{
656 spin_lock_irq(&qptichain_lock); 656 spin_lock_irq(&qptichain_lock);
657 if (qptichain != NULL) { 657 if (qptichain != NULL) {
@@ -667,7 +667,7 @@ static void __init qpti_chain_add(struct qlogicpti *qpti)
667 spin_unlock_irq(&qptichain_lock); 667 spin_unlock_irq(&qptichain_lock);
668} 668}
669 669
670static void __init qpti_chain_del(struct qlogicpti *qpti) 670static void __devexit qpti_chain_del(struct qlogicpti *qpti)
671{ 671{
672 spin_lock_irq(&qptichain_lock); 672 spin_lock_irq(&qptichain_lock);
673 if (qptichain == qpti) { 673 if (qptichain == qpti) {
@@ -682,7 +682,7 @@ static void __init qpti_chain_del(struct qlogicpti *qpti)
682 spin_unlock_irq(&qptichain_lock); 682 spin_unlock_irq(&qptichain_lock);
683} 683}
684 684
685static int __init qpti_map_regs(struct qlogicpti *qpti) 685static int __devinit qpti_map_regs(struct qlogicpti *qpti)
686{ 686{
687 struct sbus_dev *sdev = qpti->sdev; 687 struct sbus_dev *sdev = qpti->sdev;
688 688
@@ -705,7 +705,7 @@ static int __init qpti_map_regs(struct qlogicpti *qpti)
705 return 0; 705 return 0;
706} 706}
707 707
708static int __init qpti_register_irq(struct qlogicpti *qpti) 708static int __devinit qpti_register_irq(struct qlogicpti *qpti)
709{ 709{
710 struct sbus_dev *sdev = qpti->sdev; 710 struct sbus_dev *sdev = qpti->sdev;
711 711
@@ -730,7 +730,7 @@ fail:
730 return -1; 730 return -1;
731} 731}
732 732
733static void __init qpti_get_scsi_id(struct qlogicpti *qpti) 733static void __devinit qpti_get_scsi_id(struct qlogicpti *qpti)
734{ 734{
735 qpti->scsi_id = prom_getintdefault(qpti->prom_node, 735 qpti->scsi_id = prom_getintdefault(qpti->prom_node,
736 "initiator-id", 736 "initiator-id",
@@ -783,7 +783,7 @@ static void qpti_get_clock(struct qlogicpti *qpti)
783/* The request and response queues must each be aligned 783/* The request and response queues must each be aligned
784 * on a page boundary. 784 * on a page boundary.
785 */ 785 */
786static int __init qpti_map_queues(struct qlogicpti *qpti) 786static int __devinit qpti_map_queues(struct qlogicpti *qpti)
787{ 787{
788 struct sbus_dev *sdev = qpti->sdev; 788 struct sbus_dev *sdev = qpti->sdev;
789 789
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 1541c174937a..d1777a9a9625 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -222,7 +222,7 @@ static struct scsi_host_template sdebug_driver_template = {
222 .cmd_per_lun = 16, 222 .cmd_per_lun = 16,
223 .max_sectors = 0xffff, 223 .max_sectors = 0xffff,
224 .unchecked_isa_dma = 0, 224 .unchecked_isa_dma = 0,
225 .use_clustering = ENABLE_CLUSTERING, 225 .use_clustering = DISABLE_CLUSTERING,
226 .module = THIS_MODULE, 226 .module = THIS_MODULE,
227}; 227};
228 228
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 135c1d054701..ba21d97d1855 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1014,10 +1014,6 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
1014 } 1014 }
1015 1015
1016 req->buffer = NULL; 1016 req->buffer = NULL;
1017 if (blk_pc_request(req))
1018 sdb->length = req->data_len;
1019 else
1020 sdb->length = req->nr_sectors << 9;
1021 1017
1022 /* 1018 /*
1023 * Next, walk the list, and fill in the addresses and sizes of 1019 * Next, walk the list, and fill in the addresses and sizes of
@@ -1026,6 +1022,10 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
1026 count = blk_rq_map_sg(req->q, req, sdb->table.sgl); 1022 count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
1027 BUG_ON(count > sdb->table.nents); 1023 BUG_ON(count > sdb->table.nents);
1028 sdb->table.nents = count; 1024 sdb->table.nents = count;
1025 if (blk_pc_request(req))
1026 sdb->length = req->data_len;
1027 else
1028 sdb->length = req->nr_sectors << 9;
1029 return BLKPREP_OK; 1029 return BLKPREP_OK;
1030} 1030}
1031 1031
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index fac7534f3ec4..9981682d5302 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -231,7 +231,7 @@ static struct {
231 { ISCSI_SESSION_FREE, "FREE" }, 231 { ISCSI_SESSION_FREE, "FREE" },
232}; 232};
233 233
234const char *iscsi_session_state_name(int state) 234static const char *iscsi_session_state_name(int state)
235{ 235{
236 int i; 236 int i;
237 char *name = NULL; 237 char *name = NULL;
@@ -373,7 +373,7 @@ static void session_recovery_timedout(struct work_struct *work)
373 scsi_target_unblock(&session->dev); 373 scsi_target_unblock(&session->dev);
374} 374}
375 375
376void __iscsi_unblock_session(struct iscsi_cls_session *session) 376static void __iscsi_unblock_session(struct iscsi_cls_session *session)
377{ 377{
378 if (!cancel_delayed_work(&session->recovery_work)) 378 if (!cancel_delayed_work(&session->recovery_work))
379 flush_workqueue(iscsi_eh_timer_workq); 379 flush_workqueue(iscsi_eh_timer_workq);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 37df8bbe7f46..7aee64dbfbeb 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1835,8 +1835,7 @@ static int sd_suspend(struct device *dev, pm_message_t mesg)
1835 goto done; 1835 goto done;
1836 } 1836 }
1837 1837
1838 if (mesg.event == PM_EVENT_SUSPEND && 1838 if ((mesg.event & PM_EVENT_SLEEP) && sdkp->device->manage_start_stop) {
1839 sdkp->device->manage_start_stop) {
1840 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); 1839 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
1841 ret = sd_start_stop_device(sdkp, 0); 1840 ret = sd_start_stop_device(sdkp, 0);
1842 } 1841 }
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 2a6e4f472eaa..a6d96694d0a5 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -33,9 +33,9 @@
33#include <scsi/scsi_host.h> 33#include <scsi/scsi_host.h>
34 34
35struct ses_device { 35struct ses_device {
36 char *page1; 36 unsigned char *page1;
37 char *page2; 37 unsigned char *page2;
38 char *page10; 38 unsigned char *page10;
39 short page1_len; 39 short page1_len;
40 short page2_len; 40 short page2_len;
41 short page10_len; 41 short page10_len;
@@ -67,7 +67,7 @@ static int ses_probe(struct device *dev)
67static int ses_recv_diag(struct scsi_device *sdev, int page_code, 67static int ses_recv_diag(struct scsi_device *sdev, int page_code,
68 void *buf, int bufflen) 68 void *buf, int bufflen)
69{ 69{
70 char cmd[] = { 70 unsigned char cmd[] = {
71 RECEIVE_DIAGNOSTIC, 71 RECEIVE_DIAGNOSTIC,
72 1, /* Set PCV bit */ 72 1, /* Set PCV bit */
73 page_code, 73 page_code,
@@ -85,7 +85,7 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code,
85{ 85{
86 u32 result; 86 u32 result;
87 87
88 char cmd[] = { 88 unsigned char cmd[] = {
89 SEND_DIAGNOSTIC, 89 SEND_DIAGNOSTIC,
90 0x10, /* Set PF bit */ 90 0x10, /* Set PF bit */
91 0, 91 0,
@@ -104,13 +104,13 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code,
104 104
105static int ses_set_page2_descriptor(struct enclosure_device *edev, 105static int ses_set_page2_descriptor(struct enclosure_device *edev,
106 struct enclosure_component *ecomp, 106 struct enclosure_component *ecomp,
107 char *desc) 107 unsigned char *desc)
108{ 108{
109 int i, j, count = 0, descriptor = ecomp->number; 109 int i, j, count = 0, descriptor = ecomp->number;
110 struct scsi_device *sdev = to_scsi_device(edev->cdev.dev); 110 struct scsi_device *sdev = to_scsi_device(edev->cdev.dev);
111 struct ses_device *ses_dev = edev->scratch; 111 struct ses_device *ses_dev = edev->scratch;
112 char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; 112 unsigned char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11];
113 char *desc_ptr = ses_dev->page2 + 8; 113 unsigned char *desc_ptr = ses_dev->page2 + 8;
114 114
115 /* Clear everything */ 115 /* Clear everything */
116 memset(desc_ptr, 0, ses_dev->page2_len - 8); 116 memset(desc_ptr, 0, ses_dev->page2_len - 8);
@@ -133,14 +133,14 @@ static int ses_set_page2_descriptor(struct enclosure_device *edev,
133 return ses_send_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len); 133 return ses_send_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len);
134} 134}
135 135
136static char *ses_get_page2_descriptor(struct enclosure_device *edev, 136static unsigned char *ses_get_page2_descriptor(struct enclosure_device *edev,
137 struct enclosure_component *ecomp) 137 struct enclosure_component *ecomp)
138{ 138{
139 int i, j, count = 0, descriptor = ecomp->number; 139 int i, j, count = 0, descriptor = ecomp->number;
140 struct scsi_device *sdev = to_scsi_device(edev->cdev.dev); 140 struct scsi_device *sdev = to_scsi_device(edev->cdev.dev);
141 struct ses_device *ses_dev = edev->scratch; 141 struct ses_device *ses_dev = edev->scratch;
142 char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; 142 unsigned char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11];
143 char *desc_ptr = ses_dev->page2 + 8; 143 unsigned char *desc_ptr = ses_dev->page2 + 8;
144 144
145 ses_recv_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len); 145 ses_recv_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len);
146 146
@@ -160,17 +160,18 @@ static char *ses_get_page2_descriptor(struct enclosure_device *edev,
160static void ses_get_fault(struct enclosure_device *edev, 160static void ses_get_fault(struct enclosure_device *edev,
161 struct enclosure_component *ecomp) 161 struct enclosure_component *ecomp)
162{ 162{
163 char *desc; 163 unsigned char *desc;
164 164
165 desc = ses_get_page2_descriptor(edev, ecomp); 165 desc = ses_get_page2_descriptor(edev, ecomp);
166 ecomp->fault = (desc[3] & 0x60) >> 4; 166 if (desc)
167 ecomp->fault = (desc[3] & 0x60) >> 4;
167} 168}
168 169
169static int ses_set_fault(struct enclosure_device *edev, 170static int ses_set_fault(struct enclosure_device *edev,
170 struct enclosure_component *ecomp, 171 struct enclosure_component *ecomp,
171 enum enclosure_component_setting val) 172 enum enclosure_component_setting val)
172{ 173{
173 char desc[4] = {0 }; 174 unsigned char desc[4] = {0 };
174 175
175 switch (val) { 176 switch (val) {
176 case ENCLOSURE_SETTING_DISABLED: 177 case ENCLOSURE_SETTING_DISABLED:
@@ -190,26 +191,28 @@ static int ses_set_fault(struct enclosure_device *edev,
190static void ses_get_status(struct enclosure_device *edev, 191static void ses_get_status(struct enclosure_device *edev,
191 struct enclosure_component *ecomp) 192 struct enclosure_component *ecomp)
192{ 193{
193 char *desc; 194 unsigned char *desc;
194 195
195 desc = ses_get_page2_descriptor(edev, ecomp); 196 desc = ses_get_page2_descriptor(edev, ecomp);
196 ecomp->status = (desc[0] & 0x0f); 197 if (desc)
198 ecomp->status = (desc[0] & 0x0f);
197} 199}
198 200
199static void ses_get_locate(struct enclosure_device *edev, 201static void ses_get_locate(struct enclosure_device *edev,
200 struct enclosure_component *ecomp) 202 struct enclosure_component *ecomp)
201{ 203{
202 char *desc; 204 unsigned char *desc;
203 205
204 desc = ses_get_page2_descriptor(edev, ecomp); 206 desc = ses_get_page2_descriptor(edev, ecomp);
205 ecomp->locate = (desc[2] & 0x02) ? 1 : 0; 207 if (desc)
208 ecomp->locate = (desc[2] & 0x02) ? 1 : 0;
206} 209}
207 210
208static int ses_set_locate(struct enclosure_device *edev, 211static int ses_set_locate(struct enclosure_device *edev,
209 struct enclosure_component *ecomp, 212 struct enclosure_component *ecomp,
210 enum enclosure_component_setting val) 213 enum enclosure_component_setting val)
211{ 214{
212 char desc[4] = {0 }; 215 unsigned char desc[4] = {0 };
213 216
214 switch (val) { 217 switch (val) {
215 case ENCLOSURE_SETTING_DISABLED: 218 case ENCLOSURE_SETTING_DISABLED:
@@ -229,7 +232,7 @@ static int ses_set_active(struct enclosure_device *edev,
229 struct enclosure_component *ecomp, 232 struct enclosure_component *ecomp,
230 enum enclosure_component_setting val) 233 enum enclosure_component_setting val)
231{ 234{
232 char desc[4] = {0 }; 235 unsigned char desc[4] = {0 };
233 236
234 switch (val) { 237 switch (val) {
235 case ENCLOSURE_SETTING_DISABLED: 238 case ENCLOSURE_SETTING_DISABLED:
@@ -409,18 +412,18 @@ static int ses_intf_add(struct class_device *cdev,
409{ 412{
410 struct scsi_device *sdev = to_scsi_device(cdev->dev); 413 struct scsi_device *sdev = to_scsi_device(cdev->dev);
411 struct scsi_device *tmp_sdev; 414 struct scsi_device *tmp_sdev;
412 unsigned char *buf = NULL, *hdr_buf, *type_ptr, *desc_ptr, 415 unsigned char *buf = NULL, *hdr_buf, *type_ptr, *desc_ptr = NULL,
413 *addl_desc_ptr; 416 *addl_desc_ptr = NULL;
414 struct ses_device *ses_dev; 417 struct ses_device *ses_dev;
415 u32 result; 418 u32 result;
416 int i, j, types, len, components = 0; 419 int i, j, types, len, page7_len = 0, components = 0;
417 int err = -ENOMEM; 420 int err = -ENOMEM;
418 struct enclosure_device *edev; 421 struct enclosure_device *edev;
419 struct ses_component *scomp; 422 struct ses_component *scomp = NULL;
420 423
421 if (!scsi_device_enclosure(sdev)) { 424 if (!scsi_device_enclosure(sdev)) {
422 /* not an enclosure, but might be in one */ 425 /* not an enclosure, but might be in one */
423 edev = enclosure_find(&sdev->host->shost_gendev); 426 edev = enclosure_find(&sdev->host->shost_gendev);
424 if (edev) { 427 if (edev) {
425 ses_match_to_enclosure(edev, sdev); 428 ses_match_to_enclosure(edev, sdev);
426 class_device_put(&edev->cdev); 429 class_device_put(&edev->cdev);
@@ -447,7 +450,7 @@ static int ses_intf_add(struct class_device *cdev,
447 * traversal routines more complex */ 450 * traversal routines more complex */
448 sdev_printk(KERN_ERR, sdev, 451 sdev_printk(KERN_ERR, sdev,
449 "FIXME driver has no support for subenclosures (%d)\n", 452 "FIXME driver has no support for subenclosures (%d)\n",
450 buf[1]); 453 hdr_buf[1]);
451 goto err_free; 454 goto err_free;
452 } 455 }
453 456
@@ -456,23 +459,22 @@ static int ses_intf_add(struct class_device *cdev,
456 if (!buf) 459 if (!buf)
457 goto err_free; 460 goto err_free;
458 461
459 ses_dev->page1 = buf;
460 ses_dev->page1_len = len;
461
462 result = ses_recv_diag(sdev, 1, buf, len); 462 result = ses_recv_diag(sdev, 1, buf, len);
463 if (result) 463 if (result)
464 goto recv_failed; 464 goto recv_failed;
465 465
466 types = buf[10]; 466 types = buf[10];
467 len = buf[11];
468 467
469 type_ptr = buf + 12 + len; 468 type_ptr = buf + 12 + buf[11];
470 469
471 for (i = 0; i < types; i++, type_ptr += 4) { 470 for (i = 0; i < types; i++, type_ptr += 4) {
472 if (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE || 471 if (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE ||
473 type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) 472 type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE)
474 components += type_ptr[1]; 473 components += type_ptr[1];
475 } 474 }
475 ses_dev->page1 = buf;
476 ses_dev->page1_len = len;
477 buf = NULL;
476 478
477 result = ses_recv_diag(sdev, 2, hdr_buf, INIT_ALLOC_SIZE); 479 result = ses_recv_diag(sdev, 2, hdr_buf, INIT_ALLOC_SIZE);
478 if (result) 480 if (result)
@@ -489,28 +491,29 @@ static int ses_intf_add(struct class_device *cdev,
489 goto recv_failed; 491 goto recv_failed;
490 ses_dev->page2 = buf; 492 ses_dev->page2 = buf;
491 ses_dev->page2_len = len; 493 ses_dev->page2_len = len;
494 buf = NULL;
492 495
493 /* The additional information page --- allows us 496 /* The additional information page --- allows us
494 * to match up the devices */ 497 * to match up the devices */
495 result = ses_recv_diag(sdev, 10, hdr_buf, INIT_ALLOC_SIZE); 498 result = ses_recv_diag(sdev, 10, hdr_buf, INIT_ALLOC_SIZE);
496 if (result) 499 if (!result) {
497 goto no_page10; 500
498 501 len = (hdr_buf[2] << 8) + hdr_buf[3] + 4;
499 len = (hdr_buf[2] << 8) + hdr_buf[3] + 4; 502 buf = kzalloc(len, GFP_KERNEL);
500 buf = kzalloc(len, GFP_KERNEL); 503 if (!buf)
501 if (!buf) 504 goto err_free;
502 goto err_free; 505
503 506 result = ses_recv_diag(sdev, 10, buf, len);
504 result = ses_recv_diag(sdev, 10, buf, len); 507 if (result)
505 if (result) 508 goto recv_failed;
506 goto recv_failed; 509 ses_dev->page10 = buf;
507 ses_dev->page10 = buf; 510 ses_dev->page10_len = len;
508 ses_dev->page10_len = len; 511 buf = NULL;
512 }
509 513
510 no_page10: 514 scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL);
511 scomp = kmalloc(sizeof(struct ses_component) * components, GFP_KERNEL);
512 if (!scomp) 515 if (!scomp)
513 goto err_free; 516 goto err_free;
514 517
515 edev = enclosure_register(cdev->dev, sdev->sdev_gendev.bus_id, 518 edev = enclosure_register(cdev->dev, sdev->sdev_gendev.bus_id,
516 components, &ses_enclosure_callbacks); 519 components, &ses_enclosure_callbacks);
@@ -521,17 +524,18 @@ static int ses_intf_add(struct class_device *cdev,
521 524
522 edev->scratch = ses_dev; 525 edev->scratch = ses_dev;
523 for (i = 0; i < components; i++) 526 for (i = 0; i < components; i++)
524 edev->component[i].scratch = scomp++; 527 edev->component[i].scratch = scomp + i;
525 528
526 /* Page 7 for the descriptors is optional */ 529 /* Page 7 for the descriptors is optional */
527 buf = NULL;
528 result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE); 530 result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE);
529 if (result) 531 if (result)
530 goto simple_populate; 532 goto simple_populate;
531 533
532 len = (hdr_buf[2] << 8) + hdr_buf[3] + 4; 534 page7_len = len = (hdr_buf[2] << 8) + hdr_buf[3] + 4;
533 /* add 1 for trailing '\0' we'll use */ 535 /* add 1 for trailing '\0' we'll use */
534 buf = kzalloc(len + 1, GFP_KERNEL); 536 buf = kzalloc(len + 1, GFP_KERNEL);
537 if (!buf)
538 goto simple_populate;
535 result = ses_recv_diag(sdev, 7, buf, len); 539 result = ses_recv_diag(sdev, 7, buf, len);
536 if (result) { 540 if (result) {
537 simple_populate: 541 simple_populate:
@@ -544,7 +548,8 @@ static int ses_intf_add(struct class_device *cdev,
544 len = (desc_ptr[2] << 8) + desc_ptr[3]; 548 len = (desc_ptr[2] << 8) + desc_ptr[3];
545 /* skip past overall descriptor */ 549 /* skip past overall descriptor */
546 desc_ptr += len + 4; 550 desc_ptr += len + 4;
547 addl_desc_ptr = ses_dev->page10 + 8; 551 if (ses_dev->page10)
552 addl_desc_ptr = ses_dev->page10 + 8;
548 } 553 }
549 type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; 554 type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11];
550 components = 0; 555 components = 0;
@@ -554,29 +559,35 @@ static int ses_intf_add(struct class_device *cdev,
554 struct enclosure_component *ecomp; 559 struct enclosure_component *ecomp;
555 560
556 if (desc_ptr) { 561 if (desc_ptr) {
557 len = (desc_ptr[2] << 8) + desc_ptr[3]; 562 if (desc_ptr >= buf + page7_len) {
558 desc_ptr += 4; 563 desc_ptr = NULL;
559 /* Add trailing zero - pushes into 564 } else {
560 * reserved space */ 565 len = (desc_ptr[2] << 8) + desc_ptr[3];
561 desc_ptr[len] = '\0'; 566 desc_ptr += 4;
562 name = desc_ptr; 567 /* Add trailing zero - pushes into
568 * reserved space */
569 desc_ptr[len] = '\0';
570 name = desc_ptr;
571 }
563 } 572 }
564 if (type_ptr[0] != ENCLOSURE_COMPONENT_DEVICE && 573 if (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE ||
565 type_ptr[0] != ENCLOSURE_COMPONENT_ARRAY_DEVICE) 574 type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) {
566 continue; 575
567 ecomp = enclosure_component_register(edev, 576 ecomp = enclosure_component_register(edev,
568 components++, 577 components++,
569 type_ptr[0], 578 type_ptr[0],
570 name); 579 name);
571 if (desc_ptr) { 580
572 desc_ptr += len; 581 if (!IS_ERR(ecomp) && addl_desc_ptr)
573 if (!IS_ERR(ecomp))
574 ses_process_descriptor(ecomp, 582 ses_process_descriptor(ecomp,
575 addl_desc_ptr); 583 addl_desc_ptr);
576
577 if (addl_desc_ptr)
578 addl_desc_ptr += addl_desc_ptr[1] + 2;
579 } 584 }
585 if (desc_ptr)
586 desc_ptr += len;
587
588 if (addl_desc_ptr)
589 addl_desc_ptr += addl_desc_ptr[1] + 2;
590
580 } 591 }
581 } 592 }
582 kfree(buf); 593 kfree(buf);
@@ -598,6 +609,7 @@ static int ses_intf_add(struct class_device *cdev,
598 err = -ENODEV; 609 err = -ENODEV;
599 err_free: 610 err_free:
600 kfree(buf); 611 kfree(buf);
612 kfree(scomp);
601 kfree(ses_dev->page10); 613 kfree(ses_dev->page10);
602 kfree(ses_dev->page2); 614 kfree(ses_dev->page2);
603 kfree(ses_dev->page1); 615 kfree(ses_dev->page1);
@@ -630,6 +642,7 @@ static void ses_intf_remove(struct class_device *cdev,
630 ses_dev = edev->scratch; 642 ses_dev = edev->scratch;
631 edev->scratch = NULL; 643 edev->scratch = NULL;
632 644
645 kfree(ses_dev->page10);
633 kfree(ses_dev->page1); 646 kfree(ses_dev->page1);
634 kfree(ses_dev->page2); 647 kfree(ses_dev->page2);
635 kfree(ses_dev); 648 kfree(ses_dev);
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 71952703125a..0a52d9d2da2c 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -17,7 +17,7 @@
17 Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support 17 Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
18 */ 18 */
19 19
20static const char *verstr = "20080117"; 20static const char *verstr = "20080221";
21 21
22#include <linux/module.h> 22#include <linux/module.h>
23 23
@@ -1172,7 +1172,7 @@ static int st_open(struct inode *inode, struct file *filp)
1172 STp->try_dio_now = STp->try_dio; 1172 STp->try_dio_now = STp->try_dio;
1173 STp->recover_count = 0; 1173 STp->recover_count = 0;
1174 DEB( STp->nbr_waits = STp->nbr_finished = 0; 1174 DEB( STp->nbr_waits = STp->nbr_finished = 0;
1175 STp->nbr_requests = STp->nbr_dio = STp->nbr_pages = STp->nbr_combinable = 0; ) 1175 STp->nbr_requests = STp->nbr_dio = STp->nbr_pages = 0; )
1176 1176
1177 retval = check_tape(STp, filp); 1177 retval = check_tape(STp, filp);
1178 if (retval < 0) 1178 if (retval < 0)
@@ -1226,8 +1226,8 @@ static int st_flush(struct file *filp, fl_owner_t id)
1226 } 1226 }
1227 1227
1228 DEBC( if (STp->nbr_requests) 1228 DEBC( if (STp->nbr_requests)
1229 printk(KERN_DEBUG "%s: Number of r/w requests %d, dio used in %d, pages %d (%d).\n", 1229 printk(KERN_DEBUG "%s: Number of r/w requests %d, dio used in %d, pages %d.\n",
1230 name, STp->nbr_requests, STp->nbr_dio, STp->nbr_pages, STp->nbr_combinable)); 1230 name, STp->nbr_requests, STp->nbr_dio, STp->nbr_pages));
1231 1231
1232 if (STps->rw == ST_WRITING && !STp->pos_unknown) { 1232 if (STps->rw == ST_WRITING && !STp->pos_unknown) {
1233 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; 1233 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
@@ -1422,9 +1422,6 @@ static int setup_buffering(struct scsi_tape *STp, const char __user *buf,
1422 if (STbp->do_dio) { 1422 if (STbp->do_dio) {
1423 STp->nbr_dio++; 1423 STp->nbr_dio++;
1424 STp->nbr_pages += STbp->do_dio; 1424 STp->nbr_pages += STbp->do_dio;
1425 for (i=1; i < STbp->do_dio; i++)
1426 if (page_to_pfn(STbp->sg[i].page) == page_to_pfn(STbp->sg[i-1].page) + 1)
1427 STp->nbr_combinable++;
1428 } 1425 }
1429 ) 1426 )
1430 } else 1427 } else
diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h
index 6c8075712974..5931726fcf93 100644
--- a/drivers/scsi/st.h
+++ b/drivers/scsi/st.h
@@ -164,7 +164,6 @@ struct scsi_tape {
164 int nbr_requests; 164 int nbr_requests;
165 int nbr_dio; 165 int nbr_dio;
166 int nbr_pages; 166 int nbr_pages;
167 int nbr_combinable;
168 unsigned char last_cmnd[6]; 167 unsigned char last_cmnd[6];
169 unsigned char last_sense[16]; 168 unsigned char last_sense[16];
170#endif 169#endif
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 72f6d8015358..654430edf74d 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -461,30 +461,14 @@ static void stex_internal_copy(struct scsi_cmnd *cmd,
461 } 461 }
462} 462}
463 463
464static int stex_direct_copy(struct scsi_cmnd *cmd,
465 const void *src, size_t count)
466{
467 size_t cp_len = count;
468 int n_elem = 0;
469
470 n_elem = scsi_dma_map(cmd);
471 if (n_elem < 0)
472 return 0;
473
474 stex_internal_copy(cmd, src, &cp_len, n_elem, ST_TO_CMD);
475
476 scsi_dma_unmap(cmd);
477
478 return cp_len == count;
479}
480
481static void stex_controller_info(struct st_hba *hba, struct st_ccb *ccb) 464static void stex_controller_info(struct st_hba *hba, struct st_ccb *ccb)
482{ 465{
483 struct st_frame *p; 466 struct st_frame *p;
484 size_t count = sizeof(struct st_frame); 467 size_t count = sizeof(struct st_frame);
485 468
486 p = hba->copy_buffer; 469 p = hba->copy_buffer;
487 stex_internal_copy(ccb->cmd, p, &count, ccb->sg_count, ST_FROM_CMD); 470 stex_internal_copy(ccb->cmd, p, &count, scsi_sg_count(ccb->cmd),
471 ST_FROM_CMD);
488 memset(p->base, 0, sizeof(u32)*6); 472 memset(p->base, 0, sizeof(u32)*6);
489 *(unsigned long *)(p->base) = pci_resource_start(hba->pdev, 0); 473 *(unsigned long *)(p->base) = pci_resource_start(hba->pdev, 0);
490 p->rom_addr = 0; 474 p->rom_addr = 0;
@@ -502,7 +486,8 @@ static void stex_controller_info(struct st_hba *hba, struct st_ccb *ccb)
502 p->subid = 486 p->subid =
503 hba->pdev->subsystem_vendor << 16 | hba->pdev->subsystem_device; 487 hba->pdev->subsystem_vendor << 16 | hba->pdev->subsystem_device;
504 488
505 stex_internal_copy(ccb->cmd, p, &count, ccb->sg_count, ST_TO_CMD); 489 stex_internal_copy(ccb->cmd, p, &count, scsi_sg_count(ccb->cmd),
490 ST_TO_CMD);
506} 491}
507 492
508static void 493static void
@@ -569,8 +554,10 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
569 unsigned char page; 554 unsigned char page;
570 page = cmd->cmnd[2] & 0x3f; 555 page = cmd->cmnd[2] & 0x3f;
571 if (page == 0x8 || page == 0x3f) { 556 if (page == 0x8 || page == 0x3f) {
572 stex_direct_copy(cmd, ms10_caching_page, 557 size_t cp_len = sizeof(ms10_caching_page);
573 sizeof(ms10_caching_page)); 558 stex_internal_copy(cmd, ms10_caching_page,
559 &cp_len, scsi_sg_count(cmd),
560 ST_TO_CMD);
574 cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; 561 cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
575 done(cmd); 562 done(cmd);
576 } else 563 } else
@@ -599,8 +586,10 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
599 if (id != host->max_id - 1) 586 if (id != host->max_id - 1)
600 break; 587 break;
601 if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { 588 if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {
602 stex_direct_copy(cmd, console_inq_page, 589 size_t cp_len = sizeof(console_inq_page);
603 sizeof(console_inq_page)); 590 stex_internal_copy(cmd, console_inq_page,
591 &cp_len, scsi_sg_count(cmd),
592 ST_TO_CMD);
604 cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; 593 cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
605 done(cmd); 594 done(cmd);
606 } else 595 } else
@@ -609,6 +598,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
609 case PASSTHRU_CMD: 598 case PASSTHRU_CMD:
610 if (cmd->cmnd[1] == PASSTHRU_GET_DRVVER) { 599 if (cmd->cmnd[1] == PASSTHRU_GET_DRVVER) {
611 struct st_drvver ver; 600 struct st_drvver ver;
601 size_t cp_len = sizeof(ver);
612 ver.major = ST_VER_MAJOR; 602 ver.major = ST_VER_MAJOR;
613 ver.minor = ST_VER_MINOR; 603 ver.minor = ST_VER_MINOR;
614 ver.oem = ST_OEM; 604 ver.oem = ST_OEM;
@@ -616,7 +606,9 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
616 ver.signature[0] = PASSTHRU_SIGNATURE; 606 ver.signature[0] = PASSTHRU_SIGNATURE;
617 ver.console_id = host->max_id - 1; 607 ver.console_id = host->max_id - 1;
618 ver.host_no = hba->host->host_no; 608 ver.host_no = hba->host->host_no;
619 cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? 609 stex_internal_copy(cmd, &ver, &cp_len,
610 scsi_sg_count(cmd), ST_TO_CMD);
611 cmd->result = sizeof(ver) == cp_len ?
620 DID_OK << 16 | COMMAND_COMPLETE << 8 : 612 DID_OK << 16 | COMMAND_COMPLETE << 8 :
621 DID_ERROR << 16 | COMMAND_COMPLETE << 8; 613 DID_ERROR << 16 | COMMAND_COMPLETE << 8;
622 done(cmd); 614 done(cmd);
@@ -709,7 +701,7 @@ static void stex_copy_data(struct st_ccb *ccb,
709 if (ccb->cmd == NULL) 701 if (ccb->cmd == NULL)
710 return; 702 return;
711 stex_internal_copy(ccb->cmd, 703 stex_internal_copy(ccb->cmd,
712 resp->variable, &count, ccb->sg_count, ST_TO_CMD); 704 resp->variable, &count, scsi_sg_count(ccb->cmd), ST_TO_CMD);
713} 705}
714 706
715static void stex_ys_commands(struct st_hba *hba, 707static void stex_ys_commands(struct st_hba *hba,
@@ -734,7 +726,7 @@ static void stex_ys_commands(struct st_hba *hba,
734 726
735 count = STEX_EXTRA_SIZE; 727 count = STEX_EXTRA_SIZE;
736 stex_internal_copy(ccb->cmd, hba->copy_buffer, 728 stex_internal_copy(ccb->cmd, hba->copy_buffer,
737 &count, ccb->sg_count, ST_FROM_CMD); 729 &count, scsi_sg_count(ccb->cmd), ST_FROM_CMD);
738 inq_data = (ST_INQ *)hba->copy_buffer; 730 inq_data = (ST_INQ *)hba->copy_buffer;
739 if (inq_data->DeviceTypeQualifier != 0) 731 if (inq_data->DeviceTypeQualifier != 0)
740 ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; 732 ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT;
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index 6325901e5093..f7d279542fa5 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -187,10 +187,10 @@
187#define sym53c416_base_2 sym53c416_2 187#define sym53c416_base_2 sym53c416_2
188#define sym53c416_base_3 sym53c416_3 188#define sym53c416_base_3 sym53c416_3
189 189
190static unsigned int sym53c416_base[2] = {0,0}; 190static unsigned int sym53c416_base[2];
191static unsigned int sym53c416_base_1[2] = {0,0}; 191static unsigned int sym53c416_base_1[2];
192static unsigned int sym53c416_base_2[2] = {0,0}; 192static unsigned int sym53c416_base_2[2];
193static unsigned int sym53c416_base_3[2] = {0,0}; 193static unsigned int sym53c416_base_3[2];
194 194
195#endif 195#endif
196 196
@@ -621,25 +621,25 @@ int __init sym53c416_detect(struct scsi_host_template *tpnt)
621 int ints[3]; 621 int ints[3];
622 622
623 ints[0] = 2; 623 ints[0] = 2;
624 if(sym53c416_base) 624 if(sym53c416_base[0])
625 { 625 {
626 ints[1] = sym53c416_base[0]; 626 ints[1] = sym53c416_base[0];
627 ints[2] = sym53c416_base[1]; 627 ints[2] = sym53c416_base[1];
628 sym53c416_setup(NULL, ints); 628 sym53c416_setup(NULL, ints);
629 } 629 }
630 if(sym53c416_base_1) 630 if(sym53c416_base_1[0])
631 { 631 {
632 ints[1] = sym53c416_base_1[0]; 632 ints[1] = sym53c416_base_1[0];
633 ints[2] = sym53c416_base_1[1]; 633 ints[2] = sym53c416_base_1[1];
634 sym53c416_setup(NULL, ints); 634 sym53c416_setup(NULL, ints);
635 } 635 }
636 if(sym53c416_base_2) 636 if(sym53c416_base_2[0])
637 { 637 {
638 ints[1] = sym53c416_base_2[0]; 638 ints[1] = sym53c416_base_2[0];
639 ints[2] = sym53c416_base_2[1]; 639 ints[2] = sym53c416_base_2[1];
640 sym53c416_setup(NULL, ints); 640 sym53c416_setup(NULL, ints);
641 } 641 }
642 if(sym53c416_base_3) 642 if(sym53c416_base_3[0])
643 { 643 {
644 ints[1] = sym53c416_base_3[0]; 644 ints[1] = sym53c416_base_3[0];
645 ints[2] = sym53c416_base_3[1]; 645 ints[2] = sym53c416_base_3[1];
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index fad245b064d6..d57bf3e708d8 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -549,7 +549,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id)
549 atmel_handle_transmit(port, pending); 549 atmel_handle_transmit(port, pending);
550 } while (pass_counter++ < ATMEL_ISR_PASS_LIMIT); 550 } while (pass_counter++ < ATMEL_ISR_PASS_LIMIT);
551 551
552 return IRQ_HANDLED; 552 return pass_counter ? IRQ_HANDLED : IRQ_NONE;
553} 553}
554 554
555/* 555/*
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index ddf639144538..9ce12cb2cebc 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -393,7 +393,7 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
393 if (cflag & CRTSCTS) { 393 if (cflag & CRTSCTS) {
394 fcr_val |= SCFCR_MCE; 394 fcr_val |= SCFCR_MCE;
395 } else { 395 } else {
396#ifdef CONFIG_CPU_SUBTYPE_SH7343 396#if defined(CONFIG_CPU_SUBTYPE_SH7343) || defined(CONFIG_CPU_SUBTYPE_SH7366)
397 /* Nothing */ 397 /* Nothing */
398#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \ 398#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
399 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 399 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index f5764ebcfe07..01a9dd715f5d 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -97,13 +97,18 @@
97# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 97# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
98# define SCIF_ONLY 98# define SCIF_ONLY
99# define PORT_PSCR 0xA405011E 99# define PORT_PSCR 0xA405011E
100#elif defined(CONFIG_CPU_SUBTYPE_SH7366)
101# define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */
102# define SCSPTR0 SCPDR0
103# define SCIF_ORER 0x0001 /* overrun error bit */
104# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
105# define SCIF_ONLY
100#elif defined(CONFIG_CPU_SUBTYPE_SH4_202) 106#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
101# define SCSPTR2 0xffe80020 /* 16 bit SCIF */ 107# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
102# define SCIF_ORER 0x0001 /* overrun error bit */ 108# define SCIF_ORER 0x0001 /* overrun error bit */
103# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 109# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
104# define SCIF_ONLY 110# define SCIF_ONLY
105#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) 111#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
106# include <asm/hardware.h>
107# define SCIF_BASE_ADDR 0x01030000 112# define SCIF_BASE_ADDR 0x01030000
108# define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR 113# define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR
109# define SCIF_PTR2_OFFS 0x0000020 114# define SCIF_PTR2_OFFS 0x0000020
@@ -577,7 +582,7 @@ static inline int sci_rxd_in(struct uart_port *port)
577 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 582 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
578 return 1; 583 return 1;
579} 584}
580#elif defined(CONFIG_CPU_SUBTYPE_SH7722) 585#elif defined(CONFIG_CPU_SUBTYPE_SH7722) || defined(CONFIG_CPU_SUBTYPE_SH7366)
581static inline int sci_rxd_in(struct uart_port *port) 586static inline int sci_rxd_in(struct uart_port *port)
582{ 587{
583 if (port->mapbase == 0xffe00000) 588 if (port->mapbase == 0xffe00000)
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index e52a6296ca46..9cfcfd8dad5e 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -31,6 +31,7 @@
31#include <asm/mach/dma.h> 31#include <asm/mach/dma.h>
32#include <asm/mach/sysasic.h> 32#include <asm/mach/sysasic.h>
33#include <asm/mach/maple.h> 33#include <asm/mach/maple.h>
34#include <linux/delay.h>
34 35
35MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin"); 36MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin");
36MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); 37MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
@@ -53,12 +54,12 @@ static struct device maple_bus;
53static int subdevice_map[MAPLE_PORTS]; 54static int subdevice_map[MAPLE_PORTS];
54static unsigned long *maple_sendbuf, *maple_sendptr, *maple_lastptr; 55static unsigned long *maple_sendbuf, *maple_sendptr, *maple_lastptr;
55static unsigned long maple_pnp_time; 56static unsigned long maple_pnp_time;
56static int started, scanning, liststatus; 57static int started, scanning, liststatus, realscan;
57static struct kmem_cache *maple_queue_cache; 58static struct kmem_cache *maple_queue_cache;
58 59
59struct maple_device_specify { 60struct maple_device_specify {
60 int port; 61 int port;
61 int unit; 62 int unit;
62}; 63};
63 64
64/** 65/**
@@ -68,22 +69,22 @@ struct maple_device_specify {
68 */ 69 */
69int maple_driver_register(struct device_driver *drv) 70int maple_driver_register(struct device_driver *drv)
70{ 71{
71 if (!drv) 72 if (!drv)
72 return -EINVAL; 73 return -EINVAL;
73 drv->bus = &maple_bus_type; 74 drv->bus = &maple_bus_type;
74 return driver_register(drv); 75 return driver_register(drv);
75} 76}
76EXPORT_SYMBOL_GPL(maple_driver_register); 77EXPORT_SYMBOL_GPL(maple_driver_register);
77 78
78/* set hardware registers to enable next round of dma */ 79/* set hardware registers to enable next round of dma */
79static void maplebus_dma_reset(void) 80static void maplebus_dma_reset(void)
80{ 81{
81 ctrl_outl(MAPLE_MAGIC, MAPLE_RESET); 82 ctrl_outl(MAPLE_MAGIC, MAPLE_RESET);
82 /* set trig type to 0 for software trigger, 1 for hardware (VBLANK) */ 83 /* set trig type to 0 for software trigger, 1 for hardware (VBLANK) */
83 ctrl_outl(1, MAPLE_TRIGTYPE); 84 ctrl_outl(1, MAPLE_TRIGTYPE);
84 ctrl_outl(MAPLE_2MBPS | MAPLE_TIMEOUT(50000), MAPLE_SPEED); 85 ctrl_outl(MAPLE_2MBPS | MAPLE_TIMEOUT(50000), MAPLE_SPEED);
85 ctrl_outl(PHYSADDR(maple_sendbuf), MAPLE_DMAADDR); 86 ctrl_outl(PHYSADDR(maple_sendbuf), MAPLE_DMAADDR);
86 ctrl_outl(1, MAPLE_ENABLE); 87 ctrl_outl(1, MAPLE_ENABLE);
87} 88}
88 89
89/** 90/**
@@ -94,27 +95,36 @@ static void maplebus_dma_reset(void)
94 * @function: the function code for the device 95 * @function: the function code for the device
95 */ 96 */
96void maple_getcond_callback(struct maple_device *dev, 97void maple_getcond_callback(struct maple_device *dev,
97 void (*callback) (struct mapleq * mq), 98 void (*callback) (struct mapleq *mq),
98 unsigned long interval, unsigned long function) 99 unsigned long interval, unsigned long function)
99{ 100{
100 dev->callback = callback; 101 dev->callback = callback;
101 dev->interval = interval; 102 dev->interval = interval;
102 dev->function = cpu_to_be32(function); 103 dev->function = cpu_to_be32(function);
103 dev->when = jiffies; 104 dev->when = jiffies;
104} 105}
105EXPORT_SYMBOL_GPL(maple_getcond_callback); 106EXPORT_SYMBOL_GPL(maple_getcond_callback);
106 107
107static int maple_dma_done(void) 108static int maple_dma_done(void)
108{ 109{
109 return (ctrl_inl(MAPLE_STATE) & 1) == 0; 110 return (ctrl_inl(MAPLE_STATE) & 1) == 0;
110} 111}
111 112
112static void maple_release_device(struct device *dev) 113static void maple_release_device(struct device *dev)
113{ 114{
114 if (dev->type) { 115 struct maple_device *mdev;
115 kfree(dev->type->name); 116 struct mapleq *mq;
116 kfree(dev->type); 117 if (!dev)
117 } 118 return;
119 mdev = to_maple_dev(dev);
120 mq = mdev->mq;
121 if (mq) {
122 if (mq->recvbufdcsp)
123 kmem_cache_free(maple_queue_cache, mq->recvbufdcsp);
124 kfree(mq);
125 mq = NULL;
126 }
127 kfree(mdev);
118} 128}
119 129
120/** 130/**
@@ -123,60 +133,64 @@ static void maple_release_device(struct device *dev)
123 */ 133 */
124void maple_add_packet(struct mapleq *mq) 134void maple_add_packet(struct mapleq *mq)
125{ 135{
126 mutex_lock(&maple_list_lock); 136 mutex_lock(&maple_list_lock);
127 list_add(&mq->list, &maple_waitq); 137 list_add(&mq->list, &maple_waitq);
128 mutex_unlock(&maple_list_lock); 138 mutex_unlock(&maple_list_lock);
129} 139}
130EXPORT_SYMBOL_GPL(maple_add_packet); 140EXPORT_SYMBOL_GPL(maple_add_packet);
131 141
132static struct mapleq *maple_allocq(struct maple_device *dev) 142static struct mapleq *maple_allocq(struct maple_device *mdev)
133{ 143{
134 struct mapleq *mq; 144 struct mapleq *mq;
135 145
136 mq = kmalloc(sizeof(*mq), GFP_KERNEL); 146 mq = kmalloc(sizeof(*mq), GFP_KERNEL);
137 if (!mq) 147 if (!mq)
138 return NULL; 148 return NULL;
139 149
140 mq->dev = dev; 150 mq->dev = mdev;
141 mq->recvbufdcsp = kmem_cache_zalloc(maple_queue_cache, GFP_KERNEL); 151 mq->recvbufdcsp = kmem_cache_zalloc(maple_queue_cache, GFP_KERNEL);
142 mq->recvbuf = (void *) P2SEGADDR(mq->recvbufdcsp); 152 mq->recvbuf = (void *) P2SEGADDR(mq->recvbufdcsp);
143 if (!mq->recvbuf) { 153 if (!mq->recvbuf) {
144 kfree(mq); 154 kfree(mq);
145 return NULL; 155 return NULL;
146 } 156 }
147 157
148 return mq; 158 return mq;
149} 159}
150 160
151static struct maple_device *maple_alloc_dev(int port, int unit) 161static struct maple_device *maple_alloc_dev(int port, int unit)
152{ 162{
153 struct maple_device *dev; 163 struct maple_device *mdev;
154 164
155 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 165 mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
156 if (!dev) 166 if (!mdev)
157 return NULL; 167 return NULL;
158 168
159 dev->port = port; 169 mdev->port = port;
160 dev->unit = unit; 170 mdev->unit = unit;
161 dev->mq = maple_allocq(dev); 171 mdev->mq = maple_allocq(mdev);
162 172
163 if (!dev->mq) { 173 if (!mdev->mq) {
164 kfree(dev); 174 kfree(mdev);
165 return NULL; 175 return NULL;
166 } 176 }
167 177 mdev->dev.bus = &maple_bus_type;
168 return dev; 178 mdev->dev.parent = &maple_bus;
179 mdev->function = 0;
180 return mdev;
169} 181}
170 182
171static void maple_free_dev(struct maple_device *mdev) 183static void maple_free_dev(struct maple_device *mdev)
172{ 184{
173 if (!mdev) 185 if (!mdev)
174 return; 186 return;
175 if (mdev->mq) { 187 if (mdev->mq) {
176 kmem_cache_free(maple_queue_cache, mdev->mq->recvbufdcsp); 188 if (mdev->mq->recvbufdcsp)
177 kfree(mdev->mq); 189 kmem_cache_free(maple_queue_cache,
178 } 190 mdev->mq->recvbufdcsp);
179 kfree(mdev); 191 kfree(mdev->mq);
192 }
193 kfree(mdev);
180} 194}
181 195
182/* process the command queue into a maple command block 196/* process the command queue into a maple command block
@@ -184,153 +198,162 @@ static void maple_free_dev(struct maple_device *mdev)
184 */ 198 */
185static void maple_build_block(struct mapleq *mq) 199static void maple_build_block(struct mapleq *mq)
186{ 200{
187 int port, unit, from, to, len; 201 int port, unit, from, to, len;
188 unsigned long *lsendbuf = mq->sendbuf; 202 unsigned long *lsendbuf = mq->sendbuf;
189 203
190 port = mq->dev->port & 3; 204 port = mq->dev->port & 3;
191 unit = mq->dev->unit; 205 unit = mq->dev->unit;
192 len = mq->length; 206 len = mq->length;
193 from = port << 6; 207 from = port << 6;
194 to = (port << 6) | (unit > 0 ? (1 << (unit - 1)) & 0x1f : 0x20); 208 to = (port << 6) | (unit > 0 ? (1 << (unit - 1)) & 0x1f : 0x20);
195 209
196 *maple_lastptr &= 0x7fffffff; 210 *maple_lastptr &= 0x7fffffff;
197 maple_lastptr = maple_sendptr; 211 maple_lastptr = maple_sendptr;
198 212
199 *maple_sendptr++ = (port << 16) | len | 0x80000000; 213 *maple_sendptr++ = (port << 16) | len | 0x80000000;
200 *maple_sendptr++ = PHYSADDR(mq->recvbuf); 214 *maple_sendptr++ = PHYSADDR(mq->recvbuf);
201 *maple_sendptr++ = 215 *maple_sendptr++ =
202 mq->command | (to << 8) | (from << 16) | (len << 24); 216 mq->command | (to << 8) | (from << 16) | (len << 24);
203 217
204 while (len-- > 0) 218 while (len-- > 0)
205 *maple_sendptr++ = *lsendbuf++; 219 *maple_sendptr++ = *lsendbuf++;
206} 220}
207 221
208/* build up command queue */ 222/* build up command queue */
209static void maple_send(void) 223static void maple_send(void)
210{ 224{
211 int i; 225 int i;
212 int maple_packets; 226 int maple_packets;
213 struct mapleq *mq, *nmq; 227 struct mapleq *mq, *nmq;
214 228
215 if (!list_empty(&maple_sentq)) 229 if (!list_empty(&maple_sentq))
216 return; 230 return;
217 if (list_empty(&maple_waitq) || !maple_dma_done()) 231 if (list_empty(&maple_waitq) || !maple_dma_done())
218 return; 232 return;
219 maple_packets = 0; 233 maple_packets = 0;
220 maple_sendptr = maple_lastptr = maple_sendbuf; 234 maple_sendptr = maple_lastptr = maple_sendbuf;
221 list_for_each_entry_safe(mq, nmq, &maple_waitq, list) { 235 list_for_each_entry_safe(mq, nmq, &maple_waitq, list) {
222 maple_build_block(mq); 236 maple_build_block(mq);
223 list_move(&mq->list, &maple_sentq); 237 list_move(&mq->list, &maple_sentq);
224 if (maple_packets++ > MAPLE_MAXPACKETS) 238 if (maple_packets++ > MAPLE_MAXPACKETS)
225 break; 239 break;
226 } 240 }
227 if (maple_packets > 0) { 241 if (maple_packets > 0) {
228 for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++) 242 for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
229 dma_cache_sync(0, maple_sendbuf + i * PAGE_SIZE, 243 dma_cache_sync(0, maple_sendbuf + i * PAGE_SIZE,
230 PAGE_SIZE, DMA_BIDIRECTIONAL); 244 PAGE_SIZE, DMA_BIDIRECTIONAL);
231 } 245 }
232} 246}
233 247
234static int attach_matching_maple_driver(struct device_driver *driver, 248static int attach_matching_maple_driver(struct device_driver *driver,
235 void *devptr) 249 void *devptr)
236{ 250{
237 struct maple_driver *maple_drv; 251 struct maple_driver *maple_drv;
238 struct maple_device *mdev; 252 struct maple_device *mdev;
239 253
240 mdev = devptr; 254 mdev = devptr;
241 maple_drv = to_maple_driver(driver); 255 maple_drv = to_maple_driver(driver);
242 if (mdev->devinfo.function & be32_to_cpu(maple_drv->function)) { 256 if (mdev->devinfo.function & be32_to_cpu(maple_drv->function)) {
243 if (maple_drv->connect(mdev) == 0) { 257 if (maple_drv->connect(mdev) == 0) {
244 mdev->driver = maple_drv; 258 mdev->driver = maple_drv;
245 return 1; 259 return 1;
246 } 260 }
247 } 261 }
248 return 0; 262 return 0;
249} 263}
250 264
251static void maple_detach_driver(struct maple_device *mdev) 265static void maple_detach_driver(struct maple_device *mdev)
252{ 266{
253 if (!mdev) 267 if (!mdev)
254 return; 268 return;
255 if (mdev->driver) { 269 if (mdev->driver) {
256 if (mdev->driver->disconnect) 270 if (mdev->driver->disconnect)
257 mdev->driver->disconnect(mdev); 271 mdev->driver->disconnect(mdev);
258 } 272 }
259 mdev->driver = NULL; 273 mdev->driver = NULL;
260 if (mdev->registered) { 274 device_unregister(&mdev->dev);
261 maple_release_device(&mdev->dev); 275 mdev = NULL;
262 device_unregister(&mdev->dev);
263 }
264 mdev->registered = 0;
265 maple_free_dev(mdev);
266} 276}
267 277
268/* process initial MAPLE_COMMAND_DEVINFO for each device or port */ 278/* process initial MAPLE_COMMAND_DEVINFO for each device or port */
269static void maple_attach_driver(struct maple_device *dev) 279static void maple_attach_driver(struct maple_device *mdev)
270{ 280{
271 char *p; 281 char *p, *recvbuf;
272 282 unsigned long function;
273 char *recvbuf; 283 int matched, retval;
274 unsigned long function; 284
275 int matched, retval; 285 recvbuf = mdev->mq->recvbuf;
276 286 /* copy the data as individual elements in
277 recvbuf = dev->mq->recvbuf; 287 * case of memory optimisation */
278 memcpy(&dev->devinfo, recvbuf + 4, sizeof(dev->devinfo)); 288 memcpy(&mdev->devinfo.function, recvbuf + 4, 4);
279 memcpy(dev->product_name, dev->devinfo.product_name, 30); 289 memcpy(&mdev->devinfo.function_data[0], recvbuf + 8, 12);
280 memcpy(dev->product_licence, dev->devinfo.product_licence, 60); 290 memcpy(&mdev->devinfo.area_code, recvbuf + 20, 1);
281 dev->product_name[30] = '\0'; 291 memcpy(&mdev->devinfo.connector_direction, recvbuf + 21, 1);
282 dev->product_licence[60] = '\0'; 292 memcpy(&mdev->devinfo.product_name[0], recvbuf + 22, 30);
283 293 memcpy(&mdev->devinfo.product_licence[0], recvbuf + 52, 60);
284 for (p = dev->product_name + 29; dev->product_name <= p; p--) 294 memcpy(&mdev->devinfo.standby_power, recvbuf + 112, 2);
285 if (*p == ' ') 295 memcpy(&mdev->devinfo.max_power, recvbuf + 114, 2);
286 *p = '\0'; 296 memcpy(mdev->product_name, mdev->devinfo.product_name, 30);
287 else 297 mdev->product_name[30] = '\0';
288 break; 298 memcpy(mdev->product_licence, mdev->devinfo.product_licence, 60);
289 299 mdev->product_licence[60] = '\0';
290 for (p = dev->product_licence + 59; dev->product_licence <= p; p--) 300
291 if (*p == ' ') 301 for (p = mdev->product_name + 29; mdev->product_name <= p; p--)
292 *p = '\0'; 302 if (*p == ' ')
293 else 303 *p = '\0';
294 break; 304 else
295 305 break;
296 function = be32_to_cpu(dev->devinfo.function); 306 for (p = mdev->product_licence + 59; mdev->product_licence <= p; p--)
297 307 if (*p == ' ')
298 if (function > 0x200) { 308 *p = '\0';
299 /* Do this silently - as not a real device */ 309 else
300 function = 0; 310 break;
301 dev->driver = &maple_dummy_driver; 311
302 sprintf(dev->dev.bus_id, "%d:0.port", dev->port); 312 if (realscan) {
303 } else { 313 printk(KERN_INFO "Maple device detected: %s\n",
304 printk(KERN_INFO 314 mdev->product_name);
305 "Maple bus at (%d, %d): Connected function 0x%lX\n", 315 printk(KERN_INFO "Maple device: %s\n", mdev->product_licence);
306 dev->port, dev->unit, function); 316 }
307 317
308 matched = 318 function = be32_to_cpu(mdev->devinfo.function);
309 bus_for_each_drv(&maple_bus_type, NULL, dev, 319
310 attach_matching_maple_driver); 320 if (function > 0x200) {
311 321 /* Do this silently - as not a real device */
312 if (matched == 0) { 322 function = 0;
313 /* Driver does not exist yet */ 323 mdev->driver = &maple_dummy_driver;
314 printk(KERN_INFO 324 sprintf(mdev->dev.bus_id, "%d:0.port", mdev->port);
315 "No maple driver found for this device\n"); 325 } else {
316 dev->driver = &maple_dummy_driver; 326 if (realscan)
317 } 327 printk(KERN_INFO
318 328 "Maple bus at (%d, %d): Function 0x%lX\n",
319 sprintf(dev->dev.bus_id, "%d:0%d.%lX", dev->port, 329 mdev->port, mdev->unit, function);
320 dev->unit, function); 330
321 } 331 matched =
322 dev->function = function; 332 bus_for_each_drv(&maple_bus_type, NULL, mdev,
323 dev->dev.bus = &maple_bus_type; 333 attach_matching_maple_driver);
324 dev->dev.parent = &maple_bus; 334
325 dev->dev.release = &maple_release_device; 335 if (matched == 0) {
326 retval = device_register(&dev->dev); 336 /* Driver does not exist yet */
327 if (retval) { 337 if (realscan)
328 printk(KERN_INFO 338 printk(KERN_INFO
329 "Maple bus: Attempt to register device (%x, %x) failed.\n", 339 "No maple driver found.\n");
330 dev->port, dev->unit); 340 mdev->driver = &maple_dummy_driver;
331 maple_free_dev(dev); 341 }
332 } 342 sprintf(mdev->dev.bus_id, "%d:0%d.%lX", mdev->port,
333 dev->registered = 1; 343 mdev->unit, function);
344 }
345 mdev->function = function;
346 mdev->dev.release = &maple_release_device;
347 retval = device_register(&mdev->dev);
348 if (retval) {
349 printk(KERN_INFO
350 "Maple bus: Attempt to register device"
351 " (%x, %x) failed.\n",
352 mdev->port, mdev->unit);
353 maple_free_dev(mdev);
354 mdev = NULL;
355 return;
356 }
334} 357}
335 358
336/* 359/*
@@ -340,270 +363,262 @@ static void maple_attach_driver(struct maple_device *dev)
340 */ 363 */
341static int detach_maple_device(struct device *device, void *portptr) 364static int detach_maple_device(struct device *device, void *portptr)
342{ 365{
343 struct maple_device_specify *ds; 366 struct maple_device_specify *ds;
344 struct maple_device *mdev; 367 struct maple_device *mdev;
345 368
346 ds = portptr; 369 ds = portptr;
347 mdev = to_maple_dev(device); 370 mdev = to_maple_dev(device);
348 if (mdev->port == ds->port && mdev->unit == ds->unit) 371 if (mdev->port == ds->port && mdev->unit == ds->unit)
349 return 1; 372 return 1;
350 return 0; 373 return 0;
351} 374}
352 375
353static int setup_maple_commands(struct device *device, void *ignored) 376static int setup_maple_commands(struct device *device, void *ignored)
354{ 377{
355 struct maple_device *maple_dev = to_maple_dev(device); 378 struct maple_device *maple_dev = to_maple_dev(device);
356 379
357 if ((maple_dev->interval > 0) 380 if ((maple_dev->interval > 0)
358 && time_after(jiffies, maple_dev->when)) { 381 && time_after(jiffies, maple_dev->when)) {
359 maple_dev->when = jiffies + maple_dev->interval; 382 maple_dev->when = jiffies + maple_dev->interval;
360 maple_dev->mq->command = MAPLE_COMMAND_GETCOND; 383 maple_dev->mq->command = MAPLE_COMMAND_GETCOND;
361 maple_dev->mq->sendbuf = &maple_dev->function; 384 maple_dev->mq->sendbuf = &maple_dev->function;
362 maple_dev->mq->length = 1; 385 maple_dev->mq->length = 1;
363 maple_add_packet(maple_dev->mq); 386 maple_add_packet(maple_dev->mq);
364 liststatus++; 387 liststatus++;
365 } else { 388 } else {
366 if (time_after(jiffies, maple_pnp_time)) { 389 if (time_after(jiffies, maple_pnp_time)) {
367 maple_dev->mq->command = MAPLE_COMMAND_DEVINFO; 390 maple_dev->mq->command = MAPLE_COMMAND_DEVINFO;
368 maple_dev->mq->length = 0; 391 maple_dev->mq->length = 0;
369 maple_add_packet(maple_dev->mq); 392 maple_add_packet(maple_dev->mq);
370 liststatus++; 393 liststatus++;
371 } 394 }
372 } 395 }
373 396
374 return 0; 397 return 0;
375} 398}
376 399
377/* VBLANK bottom half - implemented via workqueue */ 400/* VBLANK bottom half - implemented via workqueue */
378static void maple_vblank_handler(struct work_struct *work) 401static void maple_vblank_handler(struct work_struct *work)
379{ 402{
380 if (!maple_dma_done()) 403 if (!maple_dma_done())
381 return; 404 return;
382 if (!list_empty(&maple_sentq)) 405 if (!list_empty(&maple_sentq))
383 return; 406 return;
384 ctrl_outl(0, MAPLE_ENABLE); 407 ctrl_outl(0, MAPLE_ENABLE);
385 liststatus = 0; 408 liststatus = 0;
386 bus_for_each_dev(&maple_bus_type, NULL, NULL, 409 bus_for_each_dev(&maple_bus_type, NULL, NULL,
387 setup_maple_commands); 410 setup_maple_commands);
388 if (time_after(jiffies, maple_pnp_time)) 411 if (time_after(jiffies, maple_pnp_time))
389 maple_pnp_time = jiffies + MAPLE_PNP_INTERVAL; 412 maple_pnp_time = jiffies + MAPLE_PNP_INTERVAL;
390 if (liststatus && list_empty(&maple_sentq)) { 413 if (liststatus && list_empty(&maple_sentq)) {
391 INIT_LIST_HEAD(&maple_sentq); 414 INIT_LIST_HEAD(&maple_sentq);
392 maple_send(); 415 maple_send();
393 } 416 }
394 maplebus_dma_reset(); 417 maplebus_dma_reset();
395} 418}
396 419
397/* handle devices added via hotplugs - placing them on queue for DEVINFO*/ 420/* handle devices added via hotplugs - placing them on queue for DEVINFO*/
398static void maple_map_subunits(struct maple_device *mdev, int submask) 421static void maple_map_subunits(struct maple_device *mdev, int submask)
399{ 422{
400 int retval, k, devcheck; 423 int retval, k, devcheck;
401 struct maple_device *mdev_add; 424 struct maple_device *mdev_add;
402 struct maple_device_specify ds; 425 struct maple_device_specify ds;
403 426
404 for (k = 0; k < 5; k++) { 427 for (k = 0; k < 5; k++) {
405 ds.port = mdev->port; 428 ds.port = mdev->port;
406 ds.unit = k + 1; 429 ds.unit = k + 1;
407 retval = 430 retval =
408 bus_for_each_dev(&maple_bus_type, NULL, &ds, 431 bus_for_each_dev(&maple_bus_type, NULL, &ds,
409 detach_maple_device); 432 detach_maple_device);
410 if (retval) { 433 if (retval) {
411 submask = submask >> 1; 434 submask = submask >> 1;
412 continue; 435 continue;
413 } 436 }
414 devcheck = submask & 0x01; 437 devcheck = submask & 0x01;
415 if (devcheck) { 438 if (devcheck) {
416 mdev_add = maple_alloc_dev(mdev->port, k + 1); 439 mdev_add = maple_alloc_dev(mdev->port, k + 1);
417 if (!mdev_add) 440 if (!mdev_add)
418 return; 441 return;
419 mdev_add->mq->command = MAPLE_COMMAND_DEVINFO; 442 mdev_add->mq->command = MAPLE_COMMAND_DEVINFO;
420 mdev_add->mq->length = 0; 443 mdev_add->mq->length = 0;
421 maple_add_packet(mdev_add->mq); 444 maple_add_packet(mdev_add->mq);
422 scanning = 1; 445 scanning = 1;
423 } 446 }
424 submask = submask >> 1; 447 submask = submask >> 1;
425 } 448 }
426} 449}
427 450
428/* mark a device as removed */ 451/* mark a device as removed */
429static void maple_clean_submap(struct maple_device *mdev) 452static void maple_clean_submap(struct maple_device *mdev)
430{ 453{
431 int killbit; 454 int killbit;
432 455
433 killbit = (mdev->unit > 0 ? (1 << (mdev->unit - 1)) & 0x1f : 0x20); 456 killbit = (mdev->unit > 0 ? (1 << (mdev->unit - 1)) & 0x1f : 0x20);
434 killbit = ~killbit; 457 killbit = ~killbit;
435 killbit &= 0xFF; 458 killbit &= 0xFF;
436 subdevice_map[mdev->port] = subdevice_map[mdev->port] & killbit; 459 subdevice_map[mdev->port] = subdevice_map[mdev->port] & killbit;
437} 460}
438 461
439/* handle empty port or hotplug removal */ 462/* handle empty port or hotplug removal */
440static void maple_response_none(struct maple_device *mdev, 463static void maple_response_none(struct maple_device *mdev,
441 struct mapleq *mq) 464 struct mapleq *mq)
442{ 465{
443 if (mdev->unit != 0) { 466 if (mdev->unit != 0) {
444 list_del(&mq->list); 467 list_del(&mq->list);
445 maple_clean_submap(mdev); 468 maple_clean_submap(mdev);
446 printk(KERN_INFO 469 printk(KERN_INFO
447 "Maple bus device detaching at (%d, %d)\n", 470 "Maple bus device detaching at (%d, %d)\n",
448 mdev->port, mdev->unit); 471 mdev->port, mdev->unit);
449 maple_detach_driver(mdev); 472 maple_detach_driver(mdev);
450 return; 473 return;
451 } 474 }
452 if (!started) { 475 if (!started) {
453 printk(KERN_INFO "No maple devices attached to port %d\n", 476 printk(KERN_INFO "No maple devices attached to port %d\n",
454 mdev->port); 477 mdev->port);
455 return; 478 return;
456 } 479 }
457 maple_clean_submap(mdev); 480 maple_clean_submap(mdev);
458} 481}
459 482
460/* preprocess hotplugs or scans */ 483/* preprocess hotplugs or scans */
461static void maple_response_devinfo(struct maple_device *mdev, 484static void maple_response_devinfo(struct maple_device *mdev,
462 char *recvbuf) 485 char *recvbuf)
463{ 486{
464 char submask; 487 char submask;
465 if ((!started) || (scanning == 2)) { 488 if ((!started) || (scanning == 2)) {
466 maple_attach_driver(mdev); 489 maple_attach_driver(mdev);
467 return; 490 return;
468 } 491 }
469 if (mdev->unit == 0) { 492 if (mdev->unit == 0) {
470 submask = recvbuf[2] & 0x1F; 493 submask = recvbuf[2] & 0x1F;
471 if (submask ^ subdevice_map[mdev->port]) { 494 if (submask ^ subdevice_map[mdev->port]) {
472 maple_map_subunits(mdev, submask); 495 maple_map_subunits(mdev, submask);
473 subdevice_map[mdev->port] = submask; 496 subdevice_map[mdev->port] = submask;
474 } 497 }
475 } 498 }
476} 499}
477 500
478/* maple dma end bottom half - implemented via workqueue */ 501/* maple dma end bottom half - implemented via workqueue */
479static void maple_dma_handler(struct work_struct *work) 502static void maple_dma_handler(struct work_struct *work)
480{ 503{
481 struct mapleq *mq, *nmq; 504 struct mapleq *mq, *nmq;
482 struct maple_device *dev; 505 struct maple_device *dev;
483 char *recvbuf; 506 char *recvbuf;
484 enum maple_code code; 507 enum maple_code code;
485 508
486 if (!maple_dma_done()) 509 if (!maple_dma_done())
487 return; 510 return;
488 ctrl_outl(0, MAPLE_ENABLE); 511 ctrl_outl(0, MAPLE_ENABLE);
489 if (!list_empty(&maple_sentq)) { 512 if (!list_empty(&maple_sentq)) {
490 list_for_each_entry_safe(mq, nmq, &maple_sentq, list) { 513 list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
491 recvbuf = mq->recvbuf; 514 recvbuf = mq->recvbuf;
492 code = recvbuf[0]; 515 code = recvbuf[0];
493 dev = mq->dev; 516 dev = mq->dev;
494 switch (code) { 517 switch (code) {
495 case MAPLE_RESPONSE_NONE: 518 case MAPLE_RESPONSE_NONE:
496 maple_response_none(dev, mq); 519 maple_response_none(dev, mq);
497 break; 520 break;
498 521
499 case MAPLE_RESPONSE_DEVINFO: 522 case MAPLE_RESPONSE_DEVINFO:
500 maple_response_devinfo(dev, recvbuf); 523 maple_response_devinfo(dev, recvbuf);
501 break; 524 break;
502 525
503 case MAPLE_RESPONSE_DATATRF: 526 case MAPLE_RESPONSE_DATATRF:
504 if (dev->callback) 527 if (dev->callback)
505 dev->callback(mq); 528 dev->callback(mq);
506 break; 529 break;
507 530
508 case MAPLE_RESPONSE_FILEERR: 531 case MAPLE_RESPONSE_FILEERR:
509 case MAPLE_RESPONSE_AGAIN: 532 case MAPLE_RESPONSE_AGAIN:
510 case MAPLE_RESPONSE_BADCMD: 533 case MAPLE_RESPONSE_BADCMD:
511 case MAPLE_RESPONSE_BADFUNC: 534 case MAPLE_RESPONSE_BADFUNC:
512 printk(KERN_DEBUG 535 printk(KERN_DEBUG
513 "Maple non-fatal error 0x%X\n", 536 "Maple non-fatal error 0x%X\n",
514 code); 537 code);
515 break; 538 break;
516 539
517 case MAPLE_RESPONSE_ALLINFO: 540 case MAPLE_RESPONSE_ALLINFO:
518 printk(KERN_DEBUG 541 printk(KERN_DEBUG
519 "Maple - extended device information not supported\n"); 542 "Maple - extended device information"
520 break; 543 " not supported\n");
521 544 break;
522 case MAPLE_RESPONSE_OK: 545
523 break; 546 case MAPLE_RESPONSE_OK:
524 547 break;
525 default: 548
526 break; 549 default:
527 } 550 break;
528 } 551 }
529 INIT_LIST_HEAD(&maple_sentq); 552 }
530 if (scanning == 1) { 553 INIT_LIST_HEAD(&maple_sentq);
531 maple_send(); 554 if (scanning == 1) {
532 scanning = 2; 555 maple_send();
533 } else 556 scanning = 2;
534 scanning = 0; 557 } else
535 558 scanning = 0;
536 if (started == 0) 559
537 started = 1; 560 if (started == 0)
538 } 561 started = 1;
539 maplebus_dma_reset(); 562 }
563 maplebus_dma_reset();
540} 564}
541 565
542static irqreturn_t maplebus_dma_interrupt(int irq, void *dev_id) 566static irqreturn_t maplebus_dma_interrupt(int irq, void *dev_id)
543{ 567{
544 /* Load everything into the bottom half */ 568 /* Load everything into the bottom half */
545 schedule_work(&maple_dma_process); 569 schedule_work(&maple_dma_process);
546 return IRQ_HANDLED; 570 return IRQ_HANDLED;
547} 571}
548 572
549static irqreturn_t maplebus_vblank_interrupt(int irq, void *dev_id) 573static irqreturn_t maplebus_vblank_interrupt(int irq, void *dev_id)
550{ 574{
551 schedule_work(&maple_vblank_process); 575 schedule_work(&maple_vblank_process);
552 return IRQ_HANDLED; 576 return IRQ_HANDLED;
553} 577}
554 578
555static struct irqaction maple_dma_irq = {
556 .name = "maple bus DMA handler",
557 .handler = maplebus_dma_interrupt,
558 .flags = IRQF_SHARED,
559};
560
561static struct irqaction maple_vblank_irq = {
562 .name = "maple bus VBLANK handler",
563 .handler = maplebus_vblank_interrupt,
564 .flags = IRQF_SHARED,
565};
566
567static int maple_set_dma_interrupt_handler(void) 579static int maple_set_dma_interrupt_handler(void)
568{ 580{
569 return setup_irq(HW_EVENT_MAPLE_DMA, &maple_dma_irq); 581 return request_irq(HW_EVENT_MAPLE_DMA, maplebus_dma_interrupt,
582 IRQF_SHARED, "maple bus DMA", &maple_dummy_driver);
570} 583}
571 584
572static int maple_set_vblank_interrupt_handler(void) 585static int maple_set_vblank_interrupt_handler(void)
573{ 586{
574 return setup_irq(HW_EVENT_VSYNC, &maple_vblank_irq); 587 return request_irq(HW_EVENT_VSYNC, maplebus_vblank_interrupt,
588 IRQF_SHARED, "maple bus VBLANK", &maple_dummy_driver);
575} 589}
576 590
577static int maple_get_dma_buffer(void) 591static int maple_get_dma_buffer(void)
578{ 592{
579 maple_sendbuf = 593 maple_sendbuf =
580 (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO, 594 (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
581 MAPLE_DMA_PAGES); 595 MAPLE_DMA_PAGES);
582 if (!maple_sendbuf) 596 if (!maple_sendbuf)
583 return -ENOMEM; 597 return -ENOMEM;
584 return 0; 598 return 0;
585} 599}
586 600
587static int match_maple_bus_driver(struct device *devptr, 601static int match_maple_bus_driver(struct device *devptr,
588 struct device_driver *drvptr) 602 struct device_driver *drvptr)
589{ 603{
590 struct maple_driver *maple_drv; 604 struct maple_driver *maple_drv;
591 struct maple_device *maple_dev; 605 struct maple_device *maple_dev;
592 606
593 maple_drv = container_of(drvptr, struct maple_driver, drv); 607 maple_drv = container_of(drvptr, struct maple_driver, drv);
594 maple_dev = container_of(devptr, struct maple_device, dev); 608 maple_dev = container_of(devptr, struct maple_device, dev);
595 /* Trap empty port case */ 609 /* Trap empty port case */
596 if (maple_dev->devinfo.function == 0xFFFFFFFF) 610 if (maple_dev->devinfo.function == 0xFFFFFFFF)
597 return 0; 611 return 0;
598 else if (maple_dev->devinfo.function & 612 else if (maple_dev->devinfo.function &
599 be32_to_cpu(maple_drv->function)) 613 be32_to_cpu(maple_drv->function))
600 return 1; 614 return 1;
601 return 0; 615 return 0;
602} 616}
603 617
604static int maple_bus_uevent(struct device *dev, struct kobj_uevent_env *env) 618static int maple_bus_uevent(struct device *dev,
619 struct kobj_uevent_env *env)
605{ 620{
606 return 0; 621 return 0;
607} 622}
608 623
609static void maple_bus_release(struct device *dev) 624static void maple_bus_release(struct device *dev)
@@ -611,124 +626,122 @@ static void maple_bus_release(struct device *dev)
611} 626}
612 627
613static struct maple_driver maple_dummy_driver = { 628static struct maple_driver maple_dummy_driver = {
614 .drv = { 629 .drv = {
615 .name = "maple_dummy_driver", 630 .name = "maple_dummy_driver",
616 .bus = &maple_bus_type, 631 .bus = &maple_bus_type,
617 }, 632 },
618}; 633};
619 634
620struct bus_type maple_bus_type = { 635struct bus_type maple_bus_type = {
621 .name = "maple", 636 .name = "maple",
622 .match = match_maple_bus_driver, 637 .match = match_maple_bus_driver,
623 .uevent = maple_bus_uevent, 638 .uevent = maple_bus_uevent,
624}; 639};
625EXPORT_SYMBOL_GPL(maple_bus_type); 640EXPORT_SYMBOL_GPL(maple_bus_type);
626 641
627static struct device maple_bus = { 642static struct device maple_bus = {
628 .bus_id = "maple", 643 .bus_id = "maple",
629 .release = maple_bus_release, 644 .release = maple_bus_release,
630}; 645};
631 646
632static int __init maple_bus_init(void) 647static int __init maple_bus_init(void)
633{ 648{
634 int retval, i; 649 int retval, i;
635 struct maple_device *mdev[MAPLE_PORTS]; 650 struct maple_device *mdev[MAPLE_PORTS];
636 ctrl_outl(0, MAPLE_STATE); 651 ctrl_outl(0, MAPLE_STATE);
637 652
638 retval = device_register(&maple_bus); 653 retval = device_register(&maple_bus);
639 if (retval) 654 if (retval)
640 goto cleanup; 655 goto cleanup;
641 656
642 retval = bus_register(&maple_bus_type); 657 retval = bus_register(&maple_bus_type);
643 if (retval) 658 if (retval)
644 goto cleanup_device; 659 goto cleanup_device;
645 660
646 retval = driver_register(&maple_dummy_driver.drv); 661 retval = driver_register(&maple_dummy_driver.drv);
647 662 if (retval)
648 if (retval) 663 goto cleanup_bus;
649 goto cleanup_bus; 664
650 665 /* allocate memory for maple bus dma */
651 /* allocate memory for maple bus dma */ 666 retval = maple_get_dma_buffer();
652 retval = maple_get_dma_buffer(); 667 if (retval) {
653 if (retval) { 668 printk(KERN_INFO
654 printk(KERN_INFO 669 "Maple bus: Failed to allocate Maple DMA buffers\n");
655 "Maple bus: Failed to allocate Maple DMA buffers\n"); 670 goto cleanup_basic;
656 goto cleanup_basic; 671 }
657 } 672
658 673 /* set up DMA interrupt handler */
659 /* set up DMA interrupt handler */ 674 retval = maple_set_dma_interrupt_handler();
660 retval = maple_set_dma_interrupt_handler(); 675 if (retval) {
661 if (retval) { 676 printk(KERN_INFO
662 printk(KERN_INFO 677 "Maple bus: Failed to grab maple DMA IRQ\n");
663 "Maple bus: Failed to grab maple DMA IRQ\n"); 678 goto cleanup_dma;
664 goto cleanup_dma; 679 }
665 } 680
666 681 /* set up VBLANK interrupt handler */
667 /* set up VBLANK interrupt handler */ 682 retval = maple_set_vblank_interrupt_handler();
668 retval = maple_set_vblank_interrupt_handler(); 683 if (retval) {
669 if (retval) { 684 printk(KERN_INFO "Maple bus: Failed to grab VBLANK IRQ\n");
670 printk(KERN_INFO "Maple bus: Failed to grab VBLANK IRQ\n"); 685 goto cleanup_irq;
671 goto cleanup_irq; 686 }
672 } 687
673 688 maple_queue_cache =
674 maple_queue_cache = 689 kmem_cache_create("maple_queue_cache", 0x400, 0,
675 kmem_cache_create("maple_queue_cache", 0x400, 0, 690 SLAB_POISON|SLAB_HWCACHE_ALIGN, NULL);
676 SLAB_HWCACHE_ALIGN, NULL); 691
677 692 if (!maple_queue_cache)
678 if (!maple_queue_cache) 693 goto cleanup_bothirqs;
679 goto cleanup_bothirqs; 694
680 695 /* setup maple ports */
681 /* setup maple ports */ 696 for (i = 0; i < MAPLE_PORTS; i++) {
682 for (i = 0; i < MAPLE_PORTS; i++) { 697 mdev[i] = maple_alloc_dev(i, 0);
683 mdev[i] = maple_alloc_dev(i, 0); 698 if (!mdev[i]) {
684 if (!mdev[i]) { 699 while (i-- > 0)
685 while (i-- > 0) 700 maple_free_dev(mdev[i]);
686 maple_free_dev(mdev[i]); 701 goto cleanup_cache;
687 goto cleanup_cache; 702 }
688 } 703 mdev[i]->mq->command = MAPLE_COMMAND_DEVINFO;
689 mdev[i]->registered = 0; 704 mdev[i]->mq->length = 0;
690 mdev[i]->mq->command = MAPLE_COMMAND_DEVINFO; 705 maple_add_packet(mdev[i]->mq);
691 mdev[i]->mq->length = 0; 706 /* delay aids hardware detection */
692 maple_attach_driver(mdev[i]); 707 mdelay(5);
693 maple_add_packet(mdev[i]->mq); 708 subdevice_map[i] = 0;
694 subdevice_map[i] = 0; 709 }
695 } 710
696 711 realscan = 1;
697 /* setup maplebus hardware */ 712 /* setup maplebus hardware */
698 maplebus_dma_reset(); 713 maplebus_dma_reset();
699 714 /* initial detection */
700 /* initial detection */ 715 maple_send();
701 maple_send(); 716 maple_pnp_time = jiffies;
702 717 printk(KERN_INFO "Maple bus core now registered.\n");
703 maple_pnp_time = jiffies; 718
704 719 return 0;
705 printk(KERN_INFO "Maple bus core now registered.\n");
706
707 return 0;
708 720
709cleanup_cache: 721cleanup_cache:
710 kmem_cache_destroy(maple_queue_cache); 722 kmem_cache_destroy(maple_queue_cache);
711 723
712cleanup_bothirqs: 724cleanup_bothirqs:
713 free_irq(HW_EVENT_VSYNC, 0); 725 free_irq(HW_EVENT_VSYNC, 0);
714 726
715cleanup_irq: 727cleanup_irq:
716 free_irq(HW_EVENT_MAPLE_DMA, 0); 728 free_irq(HW_EVENT_MAPLE_DMA, 0);
717 729
718cleanup_dma: 730cleanup_dma:
719 free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES); 731 free_pages((unsigned long) maple_sendbuf, MAPLE_DMA_PAGES);
720 732
721cleanup_basic: 733cleanup_basic:
722 driver_unregister(&maple_dummy_driver.drv); 734 driver_unregister(&maple_dummy_driver.drv);
723 735
724cleanup_bus: 736cleanup_bus:
725 bus_unregister(&maple_bus_type); 737 bus_unregister(&maple_bus_type);
726 738
727cleanup_device: 739cleanup_device:
728 device_unregister(&maple_bus); 740 device_unregister(&maple_bus);
729 741
730cleanup: 742cleanup:
731 printk(KERN_INFO "Maple bus registration failed\n"); 743 printk(KERN_INFO "Maple bus registration failed\n");
732 return retval; 744 return retval;
733} 745}
734subsys_initcall(maple_bus_init); 746/* Push init to later to ensure hardware gets detected */
747fs_initcall(maple_bus_init);
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 293b7cab3e57..85687aaf9cab 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -87,6 +87,16 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
87 unsigned gpio = (unsigned) spi->controller_data; 87 unsigned gpio = (unsigned) spi->controller_data;
88 unsigned active = spi->mode & SPI_CS_HIGH; 88 unsigned active = spi->mode & SPI_CS_HIGH;
89 u32 mr; 89 u32 mr;
90 int i;
91 u32 csr;
92 u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
93
94 /* Make sure clock polarity is correct */
95 for (i = 0; i < spi->master->num_chipselect; i++) {
96 csr = spi_readl(as, CSR0 + 4 * i);
97 if ((csr ^ cpol) & SPI_BIT(CPOL))
98 spi_writel(as, CSR0 + 4 * i, csr ^ SPI_BIT(CPOL));
99 }
90 100
91 mr = spi_readl(as, MR); 101 mr = spi_readl(as, MR);
92 mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr); 102 mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr);
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 365e0e355aea..59deed79e0ab 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -51,13 +51,19 @@ MODULE_LICENSE("GPL");
51#define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK) 51#define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK)
52#define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) 52#define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0)
53 53
54/* for testing SSCR1 changes that require SSP restart, basically 54/*
55 * everything except the service and interrupt enables */ 55 * for testing SSCR1 changes that require SSP restart, basically
56#define SSCR1_CHANGE_MASK (SSCR1_TTELP | SSCR1_TTE | SSCR1_EBCEI | SSCR1_SCFR \ 56 * everything except the service and interrupt enables, the pxa270 developer
57 * manual says only SSCR1_SCFR, SSCR1_SPH, SSCR1_SPO need to be in this
58 * list, but the PXA255 dev man says all bits without really meaning the
59 * service and interrupt enables
60 */
61#define SSCR1_CHANGE_MASK (SSCR1_TTELP | SSCR1_TTE | SSCR1_SCFR \
57 | SSCR1_ECRA | SSCR1_ECRB | SSCR1_SCLKDIR \ 62 | SSCR1_ECRA | SSCR1_ECRB | SSCR1_SCLKDIR \
58 | SSCR1_RWOT | SSCR1_TRAIL | SSCR1_PINTE \ 63 | SSCR1_SFRMDIR | SSCR1_RWOT | SSCR1_TRAIL \
59 | SSCR1_STRF | SSCR1_EFWR |SSCR1_RFT \ 64 | SSCR1_IFS | SSCR1_STRF | SSCR1_EFWR \
60 | SSCR1_TFT | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) 65 | SSCR1_RFT | SSCR1_TFT | SSCR1_MWDS \
66 | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM)
61 67
62#define DEFINE_SSP_REG(reg, off) \ 68#define DEFINE_SSP_REG(reg, off) \
63static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \ 69static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \
@@ -973,9 +979,6 @@ static void pump_transfers(unsigned long data)
973 if (drv_data->ssp_type == PXA25x_SSP) 979 if (drv_data->ssp_type == PXA25x_SSP)
974 DCMD(drv_data->tx_channel) |= DCMD_ENDIRQEN; 980 DCMD(drv_data->tx_channel) |= DCMD_ENDIRQEN;
975 981
976 /* Fix me, need to handle cs polarity */
977 drv_data->cs_control(PXA2XX_CS_ASSERT);
978
979 /* Clear status and start DMA engine */ 982 /* Clear status and start DMA engine */
980 cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1; 983 cr1 = chip->cr1 | dma_thresh | drv_data->dma_cr1;
981 write_SSSR(drv_data->clear_sr, reg); 984 write_SSSR(drv_data->clear_sr, reg);
@@ -985,9 +988,6 @@ static void pump_transfers(unsigned long data)
985 /* Ensure we have the correct interrupt handler */ 988 /* Ensure we have the correct interrupt handler */
986 drv_data->transfer_handler = interrupt_transfer; 989 drv_data->transfer_handler = interrupt_transfer;
987 990
988 /* Fix me, need to handle cs polarity */
989 drv_data->cs_control(PXA2XX_CS_ASSERT);
990
991 /* Clear status */ 991 /* Clear status */
992 cr1 = chip->cr1 | chip->threshold | drv_data->int_cr1; 992 cr1 = chip->cr1 | chip->threshold | drv_data->int_cr1;
993 write_SSSR(drv_data->clear_sr, reg); 993 write_SSSR(drv_data->clear_sr, reg);
@@ -998,16 +998,29 @@ static void pump_transfers(unsigned long data)
998 || (read_SSCR1(reg) & SSCR1_CHANGE_MASK) != 998 || (read_SSCR1(reg) & SSCR1_CHANGE_MASK) !=
999 (cr1 & SSCR1_CHANGE_MASK)) { 999 (cr1 & SSCR1_CHANGE_MASK)) {
1000 1000
1001 /* stop the SSP, and update the other bits */
1001 write_SSCR0(cr0 & ~SSCR0_SSE, reg); 1002 write_SSCR0(cr0 & ~SSCR0_SSE, reg);
1002 if (drv_data->ssp_type != PXA25x_SSP) 1003 if (drv_data->ssp_type != PXA25x_SSP)
1003 write_SSTO(chip->timeout, reg); 1004 write_SSTO(chip->timeout, reg);
1004 write_SSCR1(cr1, reg); 1005 /* first set CR1 without interrupt and service enables */
1006 write_SSCR1(cr1 & SSCR1_CHANGE_MASK, reg);
1007 /* restart the SSP */
1005 write_SSCR0(cr0, reg); 1008 write_SSCR0(cr0, reg);
1009
1006 } else { 1010 } else {
1007 if (drv_data->ssp_type != PXA25x_SSP) 1011 if (drv_data->ssp_type != PXA25x_SSP)
1008 write_SSTO(chip->timeout, reg); 1012 write_SSTO(chip->timeout, reg);
1009 write_SSCR1(cr1, reg);
1010 } 1013 }
1014
1015 /* FIXME, need to handle cs polarity,
1016 * this driver uses struct pxa2xx_spi_chip.cs_control to
1017 * specify a CS handling function, and it ignores most
1018 * struct spi_device.mode[s], including SPI_CS_HIGH */
1019 drv_data->cs_control(PXA2XX_CS_ASSERT);
1020
1021 /* after chip select, release the data by enabling service
1022 * requests and interrupts, without changing any mode bits */
1023 write_SSCR1(cr1, reg);
1011} 1024}
1012 1025
1013static void pump_messages(struct work_struct *work) 1026static void pump_messages(struct work_struct *work)
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c
index e782b3e7fcdb..8b86e53ccf7a 100644
--- a/drivers/thermal/thermal.c
+++ b/drivers/thermal/thermal.c
@@ -306,12 +306,23 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
306{ 306{
307 struct thermal_cooling_device_instance *dev; 307 struct thermal_cooling_device_instance *dev;
308 struct thermal_cooling_device_instance *pos; 308 struct thermal_cooling_device_instance *pos;
309 struct thermal_zone_device *pos1;
310 struct thermal_cooling_device *pos2;
309 int result; 311 int result;
310 312
311 if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) 313 if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE))
312 return -EINVAL; 314 return -EINVAL;
313 315
314 if (!tz || !cdev) 316 list_for_each_entry(pos1, &thermal_tz_list, node) {
317 if (pos1 == tz)
318 break;
319 }
320 list_for_each_entry(pos2, &thermal_cdev_list, node) {
321 if (pos2 == cdev)
322 break;
323 }
324
325 if (tz != pos1 || cdev != pos2)
315 return -EINVAL; 326 return -EINVAL;
316 327
317 dev = 328 dev =
@@ -437,20 +448,20 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
437 int result; 448 int result;
438 449
439 if (strlen(type) >= THERMAL_NAME_LENGTH) 450 if (strlen(type) >= THERMAL_NAME_LENGTH)
440 return NULL; 451 return ERR_PTR(-EINVAL);
441 452
442 if (!ops || !ops->get_max_state || !ops->get_cur_state || 453 if (!ops || !ops->get_max_state || !ops->get_cur_state ||
443 !ops->set_cur_state) 454 !ops->set_cur_state)
444 return NULL; 455 return ERR_PTR(-EINVAL);
445 456
446 cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); 457 cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL);
447 if (!cdev) 458 if (!cdev)
448 return NULL; 459 return ERR_PTR(-ENOMEM);
449 460
450 result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id); 461 result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id);
451 if (result) { 462 if (result) {
452 kfree(cdev); 463 kfree(cdev);
453 return NULL; 464 return ERR_PTR(result);
454 } 465 }
455 466
456 strcpy(cdev->type, type); 467 strcpy(cdev->type, type);
@@ -462,7 +473,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
462 if (result) { 473 if (result) {
463 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); 474 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id);
464 kfree(cdev); 475 kfree(cdev);
465 return NULL; 476 return ERR_PTR(result);
466 } 477 }
467 478
468 /* sys I/F */ 479 /* sys I/F */
@@ -498,7 +509,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
498 unregister: 509 unregister:
499 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); 510 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id);
500 device_unregister(&cdev->device); 511 device_unregister(&cdev->device);
501 return NULL; 512 return ERR_PTR(result);
502} 513}
503 514
504EXPORT_SYMBOL(thermal_cooling_device_register); 515EXPORT_SYMBOL(thermal_cooling_device_register);
@@ -570,17 +581,17 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
570 int count; 581 int count;
571 582
572 if (strlen(type) >= THERMAL_NAME_LENGTH) 583 if (strlen(type) >= THERMAL_NAME_LENGTH)
573 return NULL; 584 return ERR_PTR(-EINVAL);
574 585
575 if (trips > THERMAL_MAX_TRIPS || trips < 0) 586 if (trips > THERMAL_MAX_TRIPS || trips < 0)
576 return NULL; 587 return ERR_PTR(-EINVAL);
577 588
578 if (!ops || !ops->get_temp) 589 if (!ops || !ops->get_temp)
579 return NULL; 590 return ERR_PTR(-EINVAL);
580 591
581 tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL); 592 tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL);
582 if (!tz) 593 if (!tz)
583 return NULL; 594 return ERR_PTR(-ENOMEM);
584 595
585 INIT_LIST_HEAD(&tz->cooling_devices); 596 INIT_LIST_HEAD(&tz->cooling_devices);
586 idr_init(&tz->idr); 597 idr_init(&tz->idr);
@@ -588,7 +599,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
588 result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id); 599 result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id);
589 if (result) { 600 if (result) {
590 kfree(tz); 601 kfree(tz);
591 return NULL; 602 return ERR_PTR(result);
592 } 603 }
593 604
594 strcpy(tz->type, type); 605 strcpy(tz->type, type);
@@ -601,7 +612,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
601 if (result) { 612 if (result) {
602 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); 613 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
603 kfree(tz); 614 kfree(tz);
604 return NULL; 615 return ERR_PTR(result);
605 } 616 }
606 617
607 /* sys I/F */ 618 /* sys I/F */
@@ -643,7 +654,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
643 unregister: 654 unregister:
644 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); 655 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
645 device_unregister(&tz->device); 656 device_unregister(&tz->device);
646 return NULL; 657 return ERR_PTR(result);
647} 658}
648 659
649EXPORT_SYMBOL(thermal_zone_device_register); 660EXPORT_SYMBOL(thermal_zone_device_register);
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 2a77e9d42c68..e8a01f264540 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -57,29 +57,29 @@ struct uio_map {
57}; 57};
58#define to_map(map) container_of(map, struct uio_map, kobj) 58#define to_map(map) container_of(map, struct uio_map, kobj)
59 59
60 60static ssize_t map_addr_show(struct uio_mem *mem, char *buf)
61static ssize_t map_attr_show(struct kobject *kobj, struct kobj_attribute *attr,
62 char *buf)
63{ 61{
64 struct uio_map *map = to_map(kobj); 62 return sprintf(buf, "0x%lx\n", mem->addr);
65 struct uio_mem *mem = map->mem; 63}
66
67 if (strncmp(attr->attr.name, "addr", 4) == 0)
68 return sprintf(buf, "0x%lx\n", mem->addr);
69
70 if (strncmp(attr->attr.name, "size", 4) == 0)
71 return sprintf(buf, "0x%lx\n", mem->size);
72 64
73 return -ENODEV; 65static ssize_t map_size_show(struct uio_mem *mem, char *buf)
66{
67 return sprintf(buf, "0x%lx\n", mem->size);
74} 68}
75 69
76static struct kobj_attribute attr_attribute = 70struct uio_sysfs_entry {
77 __ATTR(addr, S_IRUGO, map_attr_show, NULL); 71 struct attribute attr;
78static struct kobj_attribute size_attribute = 72 ssize_t (*show)(struct uio_mem *, char *);
79 __ATTR(size, S_IRUGO, map_attr_show, NULL); 73 ssize_t (*store)(struct uio_mem *, const char *, size_t);
74};
75
76static struct uio_sysfs_entry addr_attribute =
77 __ATTR(addr, S_IRUGO, map_addr_show, NULL);
78static struct uio_sysfs_entry size_attribute =
79 __ATTR(size, S_IRUGO, map_size_show, NULL);
80 80
81static struct attribute *attrs[] = { 81static struct attribute *attrs[] = {
82 &attr_attribute.attr, 82 &addr_attribute.attr,
83 &size_attribute.attr, 83 &size_attribute.attr,
84 NULL, /* need to NULL terminate the list of attributes */ 84 NULL, /* need to NULL terminate the list of attributes */
85}; 85};
@@ -90,8 +90,28 @@ static void map_release(struct kobject *kobj)
90 kfree(map); 90 kfree(map);
91} 91}
92 92
93static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,
94 char *buf)
95{
96 struct uio_map *map = to_map(kobj);
97 struct uio_mem *mem = map->mem;
98 struct uio_sysfs_entry *entry;
99
100 entry = container_of(attr, struct uio_sysfs_entry, attr);
101
102 if (!entry->show)
103 return -EIO;
104
105 return entry->show(mem, buf);
106}
107
108static struct sysfs_ops uio_sysfs_ops = {
109 .show = map_type_show,
110};
111
93static struct kobj_type map_attr_type = { 112static struct kobj_type map_attr_type = {
94 .release = map_release, 113 .release = map_release,
114 .sysfs_ops = &uio_sysfs_ops,
95 .default_attrs = attrs, 115 .default_attrs = attrs,
96}; 116};
97 117
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index bcc42136c93f..0147ea39340e 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -496,13 +496,10 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
496 otherwise it is scheduled, and with high data rates data can get lost. */ 496 otherwise it is scheduled, and with high data rates data can get lost. */
497 tty->low_latency = 1; 497 tty->low_latency = 1;
498 498
499 if (usb_autopm_get_interface(acm->control)) { 499 if (usb_autopm_get_interface(acm->control) < 0)
500 mutex_unlock(&open_mutex); 500 goto early_bail;
501 return -EIO;
502 }
503 501
504 mutex_lock(&acm->mutex); 502 mutex_lock(&acm->mutex);
505 mutex_unlock(&open_mutex);
506 if (acm->used++) { 503 if (acm->used++) {
507 usb_autopm_put_interface(acm->control); 504 usb_autopm_put_interface(acm->control);
508 goto done; 505 goto done;
@@ -536,6 +533,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
536done: 533done:
537err_out: 534err_out:
538 mutex_unlock(&acm->mutex); 535 mutex_unlock(&acm->mutex);
536 mutex_unlock(&open_mutex);
539 return rv; 537 return rv;
540 538
541full_bailout: 539full_bailout:
@@ -544,6 +542,8 @@ bail_out:
544 usb_autopm_put_interface(acm->control); 542 usb_autopm_put_interface(acm->control);
545 acm->used--; 543 acm->used--;
546 mutex_unlock(&acm->mutex); 544 mutex_unlock(&acm->mutex);
545early_bail:
546 mutex_unlock(&open_mutex);
547 return -EIO; 547 return -EIO;
548} 548}
549 549
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index ad632f2d6f94..0647164d36db 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -428,6 +428,7 @@ static int usblp_open(struct inode *inode, struct file *file)
428 usblp->rcomplete = 0; 428 usblp->rcomplete = 0;
429 429
430 if (handle_bidir(usblp) < 0) { 430 if (handle_bidir(usblp) < 0) {
431 usb_autopm_put_interface(intf);
431 usblp->used = 0; 432 usblp->used = 0;
432 file->private_data = NULL; 433 file->private_data = NULL;
433 retval = -EIO; 434 retval = -EIO;
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d42c561c75f1..f90ab5e94c58 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -28,11 +28,23 @@
28 * devices is broken... 28 * devices is broken...
29 */ 29 */
30static const struct usb_device_id usb_quirk_list[] = { 30static const struct usb_device_id usb_quirk_list[] = {
31 /* Action Semiconductor flash disk */
32 { USB_DEVICE(0x10d6, 0x2200), .driver_info = USB_QUIRK_STRING_FETCH_255},
33
31 /* CBM - Flash disk */ 34 /* CBM - Flash disk */
32 { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, 35 { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
33 /* HP 5300/5370C scanner */ 36 /* HP 5300/5370C scanner */
34 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, 37 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
35 38
39 /* Creative SB Audigy 2 NX */
40 { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
41
42 /* Roland SC-8820 */
43 { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME },
44
45 /* Edirol SD-20 */
46 { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME },
47
36 /* INTEL VALUE SSD */ 48 /* INTEL VALUE SSD */
37 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, 49 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
38 50
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index a70e255402b8..e99872308144 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1561,6 +1561,7 @@ done_set_intf:
1561 memcpy(req->buf, buf, n); 1561 memcpy(req->buf, buf, n);
1562 req->complete = rndis_response_complete; 1562 req->complete = rndis_response_complete;
1563 rndis_free_response(dev->rndis_config, buf); 1563 rndis_free_response(dev->rndis_config, buf);
1564 value = n;
1564 } 1565 }
1565 /* else stalls ... spec says to avoid that */ 1566 /* else stalls ... spec says to avoid that */
1566 } 1567 }
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index 3301167d4f2a..017a196d041f 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -3563,8 +3563,7 @@ static ssize_t show_file(struct device *dev, struct device_attribute *attr,
3563 3563
3564 down_read(&fsg->filesem); 3564 down_read(&fsg->filesem);
3565 if (backing_file_is_open(curlun)) { // Get the complete pathname 3565 if (backing_file_is_open(curlun)) { // Get the complete pathname
3566 p = d_path(curlun->filp->f_path.dentry, 3566 p = d_path(&curlun->filp->f_path, buf, PAGE_SIZE - 1);
3567 curlun->filp->f_path.mnt, buf, PAGE_SIZE - 1);
3568 if (IS_ERR(p)) 3567 if (IS_ERR(p))
3569 rc = PTR_ERR(p); 3568 rc = PTR_ERR(p);
3570 else { 3569 else {
@@ -3981,9 +3980,8 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3981 if (backing_file_is_open(curlun)) { 3980 if (backing_file_is_open(curlun)) {
3982 p = NULL; 3981 p = NULL;
3983 if (pathbuf) { 3982 if (pathbuf) {
3984 p = d_path(curlun->filp->f_path.dentry, 3983 p = d_path(&curlun->filp->f_path,
3985 curlun->filp->f_path.mnt, 3984 pathbuf, PATH_MAX);
3986 pathbuf, PATH_MAX);
3987 if (IS_ERR(p)) 3985 if (IS_ERR(p))
3988 p = NULL; 3986 p = NULL;
3989 } 3987 }
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 9fdabc8fcac4..4f6bfa100f2a 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -1299,7 +1299,7 @@ printer_unbind(struct usb_gadget *gadget)
1299 printer_req_free(dev->in_ep, req); 1299 printer_req_free(dev->in_ep, req);
1300 } 1300 }
1301 1301
1302 if (dev->current_rx_req != NULL); 1302 if (dev->current_rx_req != NULL)
1303 printer_req_free(dev->out_ep, dev->current_rx_req); 1303 printer_req_free(dev->out_ep, dev->current_rx_req);
1304 1304
1305 while (!list_empty(&dev->rx_reqs)) { 1305 while (!list_empty(&dev->rx_reqs)) {
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d97b16b52efa..bf8be2a41a4a 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -69,10 +69,9 @@ config USB_EHCI_BIG_ENDIAN_DESC
69 default y 69 default y
70 70
71config USB_EHCI_FSL 71config USB_EHCI_FSL
72 bool 72 bool "Support for Freescale on-chip EHCI USB controller"
73 depends on USB_EHCI_HCD 73 depends on USB_EHCI_HCD && FSL_SOC
74 select USB_EHCI_ROOT_HUB_TT 74 select USB_EHCI_ROOT_HUB_TT
75 default y if MPC834x || PPC_MPC831x
76 ---help--- 75 ---help---
77 Variation of ARC USB block used in some Freescale chips. 76 Variation of ARC USB block used in some Freescale chips.
78 77
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 4caa6a8b9a37..b8ad55aff842 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -862,18 +862,18 @@ static int ehci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
862 /* reschedule QH iff another request is queued */ 862 /* reschedule QH iff another request is queued */
863 if (!list_empty (&qh->qtd_list) 863 if (!list_empty (&qh->qtd_list)
864 && HC_IS_RUNNING (hcd->state)) { 864 && HC_IS_RUNNING (hcd->state)) {
865 int schedule_status; 865 rc = qh_schedule(ehci, qh);
866 866
867 schedule_status = qh_schedule (ehci, qh); 867 /* An error here likely indicates handshake failure
868 spin_unlock_irqrestore (&ehci->lock, flags); 868 * or no space left in the schedule. Neither fault
869 869 * should happen often ...
870 if (schedule_status != 0) { 870 *
871 // shouldn't happen often, but ... 871 * FIXME kill the now-dysfunctional queued urbs
872 // FIXME kill those tds' urbs 872 */
873 err ("can't reschedule qh %p, err %d", 873 if (rc != 0)
874 qh, schedule_status); 874 ehci_err(ehci,
875 } 875 "can't reschedule qh %p, err %d",
876 return status; 876 qh, rc);
877 } 877 }
878 break; 878 break;
879 879
@@ -1014,7 +1014,7 @@ MODULE_LICENSE ("GPL");
1014#endif 1014#endif
1015 1015
1016#if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ 1016#if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
1017 !defined(PS3_SYSTEM_BUS_DRIVER) 1017 !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER)
1018#error "missing bus glue for ehci-hcd" 1018#error "missing bus glue for ehci-hcd"
1019#endif 1019#endif
1020 1020
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index ba370c56172c..59be276ccd9d 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1766,6 +1766,7 @@ sl811h_suspend(struct platform_device *dev, pm_message_t state)
1766 retval = sl811h_bus_suspend(hcd); 1766 retval = sl811h_bus_suspend(hcd);
1767 break; 1767 break;
1768 case PM_EVENT_SUSPEND: 1768 case PM_EVENT_SUSPEND:
1769 case PM_EVENT_HIBERNATE:
1769 case PM_EVENT_PRETHAW: /* explicitly discard hw state */ 1770 case PM_EVENT_PRETHAW: /* explicitly discard hw state */
1770 port_power(sl811, 0); 1771 port_power(sl811, 0);
1771 break; 1772 break;
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index ac283b09a63f..3033d6945202 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -3213,15 +3213,20 @@ static int u132_suspend(struct platform_device *pdev, pm_message_t state)
3213 dev_err(&u132->platform_dev->dev, "device is being removed\n"); 3213 dev_err(&u132->platform_dev->dev, "device is being removed\n");
3214 return -ESHUTDOWN; 3214 return -ESHUTDOWN;
3215 } else { 3215 } else {
3216 int retval = 0; 3216 int retval = 0, ports;
3217 if (state.event == PM_EVENT_FREEZE) { 3217
3218 switch (state.event) {
3219 case PM_EVENT_FREEZE:
3218 retval = u132_bus_suspend(hcd); 3220 retval = u132_bus_suspend(hcd);
3219 } else if (state.event == PM_EVENT_SUSPEND) { 3221 break;
3220 int ports = MAX_U132_PORTS; 3222 case PM_EVENT_SUSPEND:
3223 case PM_EVENT_HIBERNATE:
3224 ports = MAX_U132_PORTS;
3221 while (ports-- > 0) { 3225 while (ports-- > 0) {
3222 port_power(u132, ports, 0); 3226 port_power(u132, ports, 0);
3223 } 3227 }
3224 } 3228 break;
3229 }
3225 if (retval == 0) 3230 if (retval == 0)
3226 pdev->dev.power.power_state = state; 3231 pdev->dev.power.power_state = state;
3227 return retval; 3232 return retval;
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 8208496dfc63..c730d20eec66 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -61,6 +61,7 @@
61#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 61#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002
62#define USB_DEVICE_ID_VERNIER_SKIP 0x0003 62#define USB_DEVICE_ID_VERNIER_SKIP 0x0003
63#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 63#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
64#define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
64 65
65#define USB_VENDOR_ID_MICROCHIP 0x04d8 66#define USB_VENDOR_ID_MICROCHIP 0x04d8
66#define USB_DEVICE_ID_PICDEM 0x000c 67#define USB_DEVICE_ID_PICDEM 0x000c
@@ -92,6 +93,7 @@ static struct usb_device_id ld_usb_table [] = {
92 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, 93 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
93 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, 94 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) },
94 { USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICDEM) }, 95 { USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICDEM) },
96 { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) },
95 { } /* Terminating entry */ 97 { } /* Terminating entry */
96}; 98};
97MODULE_DEVICE_TABLE(usb, ld_usb_table); 99MODULE_DEVICE_TABLE(usb, ld_usb_table);
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c
index 67e2fc20eeeb..03368edf3f22 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -59,13 +59,14 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr,
59{ 59{
60 struct usb_interface *intf = to_usb_interface(dev); 60 struct usb_interface *intf = to_usb_interface(dev);
61 struct trancevibrator *tv = usb_get_intfdata(intf); 61 struct trancevibrator *tv = usb_get_intfdata(intf);
62 int temp, retval; 62 int temp, retval, old;
63 63
64 temp = simple_strtoul(buf, NULL, 10); 64 temp = simple_strtoul(buf, NULL, 10);
65 if (temp > 255) 65 if (temp > 255)
66 temp = 255; 66 temp = 255;
67 else if (temp < 0) 67 else if (temp < 0)
68 temp = 0; 68 temp = 0;
69 old = tv->speed;
69 tv->speed = temp; 70 tv->speed = temp;
70 71
71 dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed); 72 dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed);
@@ -77,6 +78,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr,
77 tv->speed, /* speed value */ 78 tv->speed, /* speed value */
78 0, NULL, 0, USB_CTRL_GET_TIMEOUT); 79 0, NULL, 0, USB_CTRL_GET_TIMEOUT);
79 if (retval) { 80 if (retval) {
81 tv->speed = old;
80 dev_dbg(&tv->udev->dev, "retval = %d\n", retval); 82 dev_dbg(&tv->udev->dev, "retval = %d\n", retval);
81 return retval; 83 return retval;
82 } 84 }
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 90dcc625f70d..76db2fef4657 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -393,8 +393,8 @@ static const char *ftdi_chip_name[] = {
393#define FTDI_STATUS_B1_MASK (FTDI_RS_BI) 393#define FTDI_STATUS_B1_MASK (FTDI_RS_BI)
394/* End TIOCMIWAIT */ 394/* End TIOCMIWAIT */
395 395
396#define FTDI_IMPL_ASYNC_FLAGS = ( ASYNC_SPD_HI | ASYNC_SPD_VHI \ 396#define FTDI_IMPL_ASYNC_FLAGS = (ASYNC_SPD_HI | ASYNC_SPD_VHI \
397 ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP ) 397 | ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP)
398 398
399/* function prototypes for a FTDI serial converter */ 399/* function prototypes for a FTDI serial converter */
400static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); 400static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id);
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 5e8bf1bc1e50..af2674c57414 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -113,6 +113,9 @@ static int option_send_setup(struct usb_serial_port *port);
113#define NOVATELWIRELESS_VENDOR_ID 0x1410 113#define NOVATELWIRELESS_VENDOR_ID 0x1410
114#define DELL_VENDOR_ID 0x413C 114#define DELL_VENDOR_ID 0x413C
115 115
116#define KYOCERA_VENDOR_ID 0x0c88
117#define KYOCERA_PRODUCT_KPC680 0x180a
118
116#define ANYDATA_VENDOR_ID 0x16d5 119#define ANYDATA_VENDOR_ID 0x16d5
117#define ANYDATA_PRODUCT_ADU_E100A 0x6501 120#define ANYDATA_PRODUCT_ADU_E100A 0x6501
118#define ANYDATA_PRODUCT_ADU_500A 0x6502 121#define ANYDATA_PRODUCT_ADU_500A 0x6502
@@ -121,6 +124,8 @@ static int option_send_setup(struct usb_serial_port *port);
121#define BANDRICH_PRODUCT_C100_1 0x1002 124#define BANDRICH_PRODUCT_C100_1 0x1002
122#define BANDRICH_PRODUCT_C100_2 0x1003 125#define BANDRICH_PRODUCT_C100_2 0x1003
123 126
127#define QUALCOMM_VENDOR_ID 0x05C6
128
124static struct usb_device_id option_ids[] = { 129static struct usb_device_id option_ids[] = {
125 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 130 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
126 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 131 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -174,18 +179,23 @@ static struct usb_device_id option_ids[] = {
174 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ 179 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */
175 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4100) }, /* Novatel U727 */ 180 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4100) }, /* Novatel U727 */
176 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4400) }, /* Novatel MC950 */ 181 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4400) }, /* Novatel MC950 */
182 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x5010) }, /* Novatel U727 */
177 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ 183 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
178 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 184 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
179 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 185 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
180 { USB_DEVICE(DELL_VENDOR_ID, 0x8117) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */ 186 { USB_DEVICE(DELL_VENDOR_ID, 0x8117) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */
181 { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */ 187 { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */
182 { USB_DEVICE(DELL_VENDOR_ID, 0x8128) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */ 188 { USB_DEVICE(DELL_VENDOR_ID, 0x8128) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */
189 { USB_DEVICE(DELL_VENDOR_ID, 0x8129) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite ET620 CDMA/EV-DO */
190 { USB_DEVICE(DELL_VENDOR_ID, 0x8133) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
183 { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */ 191 { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
184 { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */ 192 { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */
185 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, 193 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
186 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 194 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
187 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, 195 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) },
188 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, 196 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) },
197 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
198 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
189 { } /* Terminating entry */ 199 { } /* Terminating entry */
190}; 200};
191MODULE_DEVICE_TABLE(usb, option_ids); 201MODULE_DEVICE_TABLE(usb, option_ids);
@@ -247,10 +257,10 @@ static int debug;
247struct option_port_private { 257struct option_port_private {
248 /* Input endpoints and buffer for this port */ 258 /* Input endpoints and buffer for this port */
249 struct urb *in_urbs[N_IN_URB]; 259 struct urb *in_urbs[N_IN_URB];
250 char in_buffer[N_IN_URB][IN_BUFLEN]; 260 u8 *in_buffer[N_IN_URB];
251 /* Output endpoints and buffer for this port */ 261 /* Output endpoints and buffer for this port */
252 struct urb *out_urbs[N_OUT_URB]; 262 struct urb *out_urbs[N_OUT_URB];
253 char out_buffer[N_OUT_URB][OUT_BUFLEN]; 263 u8 *out_buffer[N_OUT_URB];
254 unsigned long out_busy; /* Bit vector of URBs in use */ 264 unsigned long out_busy; /* Bit vector of URBs in use */
255 265
256 /* Settings for the port */ 266 /* Settings for the port */
@@ -737,9 +747,10 @@ static int option_send_setup(struct usb_serial_port *port)
737 747
738static int option_startup(struct usb_serial *serial) 748static int option_startup(struct usb_serial *serial)
739{ 749{
740 int i, err; 750 int i, j, err;
741 struct usb_serial_port *port; 751 struct usb_serial_port *port;
742 struct option_port_private *portdata; 752 struct option_port_private *portdata;
753 u8 *buffer;
743 754
744 dbg("%s", __FUNCTION__); 755 dbg("%s", __FUNCTION__);
745 756
@@ -753,6 +764,20 @@ static int option_startup(struct usb_serial *serial)
753 return (1); 764 return (1);
754 } 765 }
755 766
767 for (j = 0; j < N_IN_URB; j++) {
768 buffer = (u8 *)__get_free_page(GFP_KERNEL);
769 if (!buffer)
770 goto bail_out_error;
771 portdata->in_buffer[j] = buffer;
772 }
773
774 for (j = 0; j < N_OUT_URB; j++) {
775 buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
776 if (!buffer)
777 goto bail_out_error2;
778 portdata->out_buffer[j] = buffer;
779 }
780
756 usb_set_serial_port_data(port, portdata); 781 usb_set_serial_port_data(port, portdata);
757 782
758 if (! port->interrupt_in_urb) 783 if (! port->interrupt_in_urb)
@@ -766,6 +791,16 @@ static int option_startup(struct usb_serial *serial)
766 option_setup_urbs(serial); 791 option_setup_urbs(serial);
767 792
768 return (0); 793 return (0);
794
795bail_out_error2:
796 for (j = 0; j < N_OUT_URB; j++)
797 kfree(portdata->out_buffer[j]);
798bail_out_error:
799 for (j = 0; j < N_IN_URB; j++)
800 if (portdata->in_buffer[j])
801 free_page((unsigned long)portdata->in_buffer[j]);
802 kfree(portdata);
803 return 1;
769} 804}
770 805
771static void option_shutdown(struct usb_serial *serial) 806static void option_shutdown(struct usb_serial *serial)
@@ -794,12 +829,14 @@ static void option_shutdown(struct usb_serial *serial)
794 for (j = 0; j < N_IN_URB; j++) { 829 for (j = 0; j < N_IN_URB; j++) {
795 if (portdata->in_urbs[j]) { 830 if (portdata->in_urbs[j]) {
796 usb_free_urb(portdata->in_urbs[j]); 831 usb_free_urb(portdata->in_urbs[j]);
832 free_page((unsigned long)portdata->in_buffer[j]);
797 portdata->in_urbs[j] = NULL; 833 portdata->in_urbs[j] = NULL;
798 } 834 }
799 } 835 }
800 for (j = 0; j < N_OUT_URB; j++) { 836 for (j = 0; j < N_OUT_URB; j++) {
801 if (portdata->out_urbs[j]) { 837 if (portdata->out_urbs[j]) {
802 usb_free_urb(portdata->out_urbs[j]); 838 usb_free_urb(portdata->out_urbs[j]);
839 kfree(portdata->out_buffer[j]);
803 portdata->out_urbs[j] = NULL; 840 portdata->out_urbs[j] = NULL;
804 } 841 }
805 } 842 }
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 4c925e3e8a63..e3d44ae8d448 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -178,7 +178,6 @@ static struct usb_device_id id_table [] = {
178 178
179 { USB_DEVICE(0x1199, 0x0112), .driver_info = DEVICE_1_PORT }, /* Sierra Wireless AirCard 580 */ 179 { USB_DEVICE(0x1199, 0x0112), .driver_info = DEVICE_1_PORT }, /* Sierra Wireless AirCard 580 */
180 { USB_DEVICE(0x0F3D, 0x0112), .driver_info = DEVICE_1_PORT }, /* Airprime/Sierra PC 5220 */ 180 { USB_DEVICE(0x0F3D, 0x0112), .driver_info = DEVICE_1_PORT }, /* Airprime/Sierra PC 5220 */
181 { USB_DEVICE(0x05C6, 0x6613), .driver_info = DEVICE_1_PORT }, /* Onda H600/ZTE MF330 */
182 181
183 { USB_DEVICE(0x1199, 0x0FFF), .driver_info = DEVICE_INSTALLER}, 182 { USB_DEVICE(0x1199, 0x0FFF), .driver_info = DEVICE_INSTALLER},
184 { } 183 { }
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
index a41ce21c0697..958f5b17847c 100644
--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -150,13 +150,14 @@ void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,
150 150
151/* Copy a buffer of length buflen to/from the srb's transfer buffer. 151/* Copy a buffer of length buflen to/from the srb's transfer buffer.
152 * Update the **sgptr and *offset variables so that the next copy will 152 * Update the **sgptr and *offset variables so that the next copy will
153 * pick up from where this one left off. */ 153 * pick up from where this one left off.
154 154 */
155unsigned int usb_stor_access_xfer_buf(unsigned char *buffer, 155unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
156 unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **sgptr, 156 unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **sgptr,
157 unsigned int *offset, enum xfer_buf_dir dir) 157 unsigned int *offset, enum xfer_buf_dir dir)
158{ 158{
159 unsigned int cnt; 159 unsigned int cnt;
160 struct scatterlist *sg = *sgptr;
160 161
161 /* We have to go through the list one entry 162 /* We have to go through the list one entry
162 * at a time. Each s-g entry contains some number of pages, and 163 * at a time. Each s-g entry contains some number of pages, and
@@ -164,22 +165,23 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
164 * in kernel-addressable memory then kmap() will return its address. 165 * in kernel-addressable memory then kmap() will return its address.
165 * If the page is not directly accessible -- such as a user buffer 166 * If the page is not directly accessible -- such as a user buffer
166 * located in high memory -- then kmap() will map it to a temporary 167 * located in high memory -- then kmap() will map it to a temporary
167 * position in the kernel's virtual address space. */ 168 * position in the kernel's virtual address space.
168 struct scatterlist *sg = *sgptr; 169 */
169 170
170 if (!sg) 171 if (!sg)
171 sg = scsi_sglist(srb); 172 sg = scsi_sglist(srb);
173 buflen = min(buflen, scsi_bufflen(srb));
172 174
173 /* This loop handles a single s-g list entry, which may 175 /* This loop handles a single s-g list entry, which may
174 * include multiple pages. Find the initial page structure 176 * include multiple pages. Find the initial page structure
175 * and the starting offset within the page, and update 177 * and the starting offset within the page, and update
176 * the *offset and **sgptr values for the next loop. */ 178 * the *offset and **sgptr values for the next loop.
179 */
177 cnt = 0; 180 cnt = 0;
178 while (cnt < buflen) { 181 while (cnt < buflen && sg) {
179 struct page *page = sg_page(sg) + 182 struct page *page = sg_page(sg) +
180 ((sg->offset + *offset) >> PAGE_SHIFT); 183 ((sg->offset + *offset) >> PAGE_SHIFT);
181 unsigned int poff = 184 unsigned int poff = (sg->offset + *offset) & (PAGE_SIZE-1);
182 (sg->offset + *offset) & (PAGE_SIZE-1);
183 unsigned int sglen = sg->length - *offset; 185 unsigned int sglen = sg->length - *offset;
184 186
185 if (sglen > buflen - cnt) { 187 if (sglen > buflen - cnt) {
@@ -222,14 +224,15 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
222} 224}
223 225
224/* Store the contents of buffer into srb's transfer buffer and set the 226/* Store the contents of buffer into srb's transfer buffer and set the
225 * SCSI residue. */ 227 * SCSI residue.
228 */
226void usb_stor_set_xfer_buf(unsigned char *buffer, 229void usb_stor_set_xfer_buf(unsigned char *buffer,
227 unsigned int buflen, struct scsi_cmnd *srb) 230 unsigned int buflen, struct scsi_cmnd *srb)
228{ 231{
229 unsigned int offset = 0; 232 unsigned int offset = 0;
230 struct scatterlist *sg = NULL; 233 struct scatterlist *sg = NULL;
231 234
232 usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset, 235 buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
233 TO_XFER_BUF); 236 TO_XFER_BUF);
234 if (buflen < scsi_bufflen(srb)) 237 if (buflen < scsi_bufflen(srb))
235 scsi_set_resid(srb, scsi_bufflen(srb) - buflen); 238 scsi_set_resid(srb, scsi_bufflen(srb) - buflen);
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index d9f4912f873d..5780ed15f1ad 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -891,17 +891,6 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
891 if (result > 0) 891 if (result > 0)
892 return us->iobuf[0]; 892 return us->iobuf[0];
893 893
894 /*
895 * Some devices (i.e. Iomega Zip100) need this -- apparently
896 * the bulk pipes get STALLed when the GetMaxLUN request is
897 * processed. This is, in theory, harmless to all other devices
898 * (regardless of if they stall or not).
899 */
900 if (result == -EPIPE) {
901 usb_stor_clear_halt(us, us->recv_bulk_pipe);
902 usb_stor_clear_halt(us, us->send_bulk_pipe);
903 }
904
905 /* 894 /*
906 * Some devices don't like GetMaxLUN. They may STALL the control 895 * Some devices don't like GetMaxLUN. They may STALL the control
907 * pipe, they may return a zero-length result, they may do nothing at 896 * pipe, they may return a zero-length result, they may do nothing at
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index fe12737e0e2b..99679a8cfa02 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -357,7 +357,7 @@ UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
357 US_FL_FIX_CAPACITY), 357 US_FL_FIX_CAPACITY),
358 358
359/* Reported by Emil Larsson <emil@swip.net> */ 359/* Reported by Emil Larsson <emil@swip.net> */
360UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101, 360UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0110,
361 "NIKON", 361 "NIKON",
362 "NIKON DSC D80", 362 "NIKON DSC D80",
363 US_SC_DEVICE, US_PR_DEVICE, NULL, 363 US_SC_DEVICE, US_PR_DEVICE, NULL,
@@ -759,6 +759,18 @@ UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210,
759 "Digital Camera EX-20 DSC", 759 "Digital Camera EX-20 DSC",
760 US_SC_8070, US_PR_DEVICE, NULL, 0 ), 760 US_SC_8070, US_PR_DEVICE, NULL, 0 ),
761 761
762/* Reported by Andre Welter <a.r.welter@gmx.de>
763 * This antique device predates the release of the Bulk-only Transport
764 * spec, and if it gets a Get-Max-LUN then it requires the host to do a
765 * Clear-Halt on the bulk endpoints. The SINGLE_LUN flag will prevent
766 * us from sending the request.
767 */
768UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x0100,
769 "Iomega",
770 "ZIP 100",
771 US_SC_DEVICE, US_PR_DEVICE, NULL,
772 US_FL_SINGLE_LUN ),
773
762/* Reported by <Hendryk.Pfeiffer@gmx.de> */ 774/* Reported by <Hendryk.Pfeiffer@gmx.de> */
763UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, 775UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000,
764 "LaCie", 776 "LaCie",
@@ -1412,6 +1424,17 @@ UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103,
1412 US_SC_DEVICE, US_PR_DEVICE, NULL, 1424 US_SC_DEVICE, US_PR_DEVICE, NULL,
1413 US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64), 1425 US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64),
1414 1426
1427/* Patch by Leonid Petrov mail at lpetrov.net
1428 * Reported by Robert Spitzenpfeil <robert@spitzenpfeil.org>
1429 * http://www.qbik.ch/usb/devices/showdev.php?id=1705
1430 * Updated to 103 device by MJ Ray mjr at phonecoop.coop
1431 */
1432UNUSUAL_DEV( 0x0f19, 0x0103, 0x0100, 0x0100,
1433 "Oracom Co., Ltd",
1434 "ORC-200M",
1435 US_SC_DEVICE, US_PR_DEVICE, NULL,
1436 US_FL_IGNORE_RESIDUE ),
1437
1415/* David Kuehling <dvdkhlng@gmx.de>: 1438/* David Kuehling <dvdkhlng@gmx.de>:
1416 * for MP3-Player AVOX WSX-300ER (bought in Japan). Reports lots of SCSI 1439 * for MP3-Player AVOX WSX-300ER (bought in Japan). Reports lots of SCSI
1417 * errors when trying to write. 1440 * errors when trying to write.
@@ -1477,6 +1500,15 @@ UNUSUAL_DEV( 0x1019, 0x0c55, 0x0000, 0x0110,
1477 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, 1500 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init,
1478 0 ), 1501 0 ),
1479 1502
1503/* Reported by Fabio Venturi <f.venturi@tdnet.it>
1504 * The device reports a vendor-specific bDeviceClass.
1505 */
1506UNUSUAL_DEV( 0x10d6, 0x2200, 0x0100, 0x0100,
1507 "Actions Semiconductor",
1508 "Mtp device",
1509 US_SC_DEVICE, US_PR_DEVICE, NULL,
1510 0),
1511
1480/* Reported by Kevin Lloyd <linux@sierrawireless.com> 1512/* Reported by Kevin Lloyd <linux@sierrawireless.com>
1481 * Entry is needed for the initializer function override, 1513 * Entry is needed for the initializer function override,
1482 * which instructs the device to load as a modem 1514 * which instructs the device to load as a modem
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d775eb6590b6..62f9c6e387cc 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -1913,61 +1913,6 @@ static int atyfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
1913 par->mmaped = 1; 1913 par->mmaped = 1;
1914 return 0; 1914 return 0;
1915} 1915}
1916
1917static struct {
1918 u32 yoffset;
1919 u8 r[2][256];
1920 u8 g[2][256];
1921 u8 b[2][256];
1922} atyfb_save;
1923
1924static void atyfb_save_palette(struct atyfb_par *par, int enter)
1925{
1926 int i, tmp;
1927
1928 for (i = 0; i < 256; i++) {
1929 tmp = aty_ld_8(DAC_CNTL, par) & 0xfc;
1930 if (M64_HAS(EXTRA_BRIGHT))
1931 tmp |= 0x2;
1932 aty_st_8(DAC_CNTL, tmp, par);
1933 aty_st_8(DAC_MASK, 0xff, par);
1934
1935 aty_st_8(DAC_R_INDEX, i, par);
1936 atyfb_save.r[enter][i] = aty_ld_8(DAC_DATA, par);
1937 atyfb_save.g[enter][i] = aty_ld_8(DAC_DATA, par);
1938 atyfb_save.b[enter][i] = aty_ld_8(DAC_DATA, par);
1939 aty_st_8(DAC_W_INDEX, i, par);
1940 aty_st_8(DAC_DATA, atyfb_save.r[1 - enter][i], par);
1941 aty_st_8(DAC_DATA, atyfb_save.g[1 - enter][i], par);
1942 aty_st_8(DAC_DATA, atyfb_save.b[1 - enter][i], par);
1943 }
1944}
1945
1946static void atyfb_palette(int enter)
1947{
1948 struct atyfb_par *par;
1949 struct fb_info *info;
1950 int i;
1951
1952 for (i = 0; i < FB_MAX; i++) {
1953 info = registered_fb[i];
1954 if (info && info->fbops == &atyfb_ops) {
1955 par = (struct atyfb_par *) info->par;
1956
1957 atyfb_save_palette(par, enter);
1958 if (enter) {
1959 atyfb_save.yoffset = info->var.yoffset;
1960 info->var.yoffset = 0;
1961 set_off_pitch(par, info);
1962 } else {
1963 info->var.yoffset = atyfb_save.yoffset;
1964 set_off_pitch(par, info);
1965 }
1966 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par);
1967 break;
1968 }
1969 }
1970}
1971#endif /* __sparc__ */ 1916#endif /* __sparc__ */
1972 1917
1973 1918
@@ -2670,10 +2615,6 @@ static int __devinit aty_init(struct fb_info *info)
2670 goto aty_init_exit; 2615 goto aty_init_exit;
2671 } 2616 }
2672 2617
2673#ifdef __sparc__
2674 atyfb_save_palette(par, 0);
2675#endif
2676
2677#ifdef CONFIG_FB_ATY_CT 2618#ifdef CONFIG_FB_ATY_CT
2678 if (!noaccel && M64_HAS(INTEGRATED)) 2619 if (!noaccel && M64_HAS(INTEGRATED))
2679 aty_init_cursor(info); 2620 aty_init_cursor(info);
@@ -2900,8 +2841,6 @@ static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
2900 2841
2901#ifdef __sparc__ 2842#ifdef __sparc__
2902 2843
2903extern void (*prom_palette) (int);
2904
2905static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, 2844static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
2906 struct fb_info *info, unsigned long addr) 2845 struct fb_info *info, unsigned long addr)
2907{ 2846{
@@ -3536,9 +3475,6 @@ static int __devinit atyfb_pci_probe(struct pci_dev *pdev, const struct pci_devi
3536 goto err_release_io; 3475 goto err_release_io;
3537 3476
3538#ifdef __sparc__ 3477#ifdef __sparc__
3539 if (!prom_palette)
3540 prom_palette = atyfb_palette;
3541
3542 /* 3478 /*
3543 * Add /dev/fb mmap values. 3479 * Add /dev/fb mmap values.
3544 */ 3480 */
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index 41f6dbf61be7..fdc9f43ec30a 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/uaccess.h>
19 20
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/prom.h> 22#include <asm/prom.h>
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index 6796ba62c3c6..777389c40988 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -459,7 +459,7 @@ static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
459 459
460 if (state.event == pdev->dev.power.power_state.event) 460 if (state.event == pdev->dev.power.power_state.event)
461 return 0; 461 return 0;
462 if (state.event != PM_EVENT_SUSPEND) 462 if (!(state.event & PM_EVENT_SLEEP))
463 goto done; 463 goto done;
464 464
465 acquire_console_sem(); 465 acquire_console_sem();
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index 74517b1b26a6..596652d2831f 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -1066,7 +1066,7 @@ static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t mesg)
1066 acquire_console_sem(); 1066 acquire_console_sem();
1067 par->pm_state = mesg.event; 1067 par->pm_state = mesg.event;
1068 1068
1069 if (mesg.event == PM_EVENT_SUSPEND) { 1069 if (mesg.event & PM_EVENT_SLEEP) {
1070 fb_set_suspend(info, 1); 1070 fb_set_suspend(info, 1);
1071 nvidiafb_blank(FB_BLANK_POWERDOWN, info); 1071 nvidiafb_blank(FB_BLANK_POWERDOWN, info);
1072 nvidia_write_regs(par, &par->SavedReg); 1072 nvidia_write_regs(par, &par->SavedReg);
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 10f912df2dad..97facb121c73 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1046,7 +1046,7 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data)
1046 switch (val) { 1046 switch (val) {
1047 case CPUFREQ_ADJUST: 1047 case CPUFREQ_ADJUST:
1048 case CPUFREQ_INCOMPATIBLE: 1048 case CPUFREQ_INCOMPATIBLE:
1049 printk(KERN_DEBUG "min dma period: %d ps, " 1049 pr_debug("min dma period: %d ps, "
1050 "new clock %d kHz\n", pxafb_display_dma_period(var), 1050 "new clock %d kHz\n", pxafb_display_dma_period(var),
1051 policy->max); 1051 policy->max);
1052 // TODO: fill in min/max values 1052 // TODO: fill in min/max values
@@ -1361,7 +1361,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options)
1361} 1361}
1362#endif 1362#endif
1363 1363
1364int __init pxafb_probe(struct platform_device *dev) 1364static int __init pxafb_probe(struct platform_device *dev)
1365{ 1365{
1366 struct pxafb_info *fbi; 1366 struct pxafb_info *fbi;
1367 struct pxafb_mach_info *inf; 1367 struct pxafb_mach_info *inf;
@@ -1486,7 +1486,7 @@ static struct platform_driver pxafb_driver = {
1486}; 1486};
1487 1487
1488#ifndef MODULE 1488#ifndef MODULE
1489int __devinit pxafb_setup(char *options) 1489static int __devinit pxafb_setup(char *options)
1490{ 1490{
1491# ifdef CONFIG_FB_PXA_PARAMETERS 1491# ifdef CONFIG_FB_PXA_PARAMETERS
1492 if (options) 1492 if (options)
@@ -1501,7 +1501,7 @@ MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)");
1501# endif 1501# endif
1502#endif 1502#endif
1503 1503
1504int __devinit pxafb_init(void) 1504static int __devinit pxafb_init(void)
1505{ 1505{
1506#ifndef MODULE 1506#ifndef MODULE
1507 char *option = NULL; 1507 char *option = NULL;
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c
index 963a454b7074..4deaac05b938 100644
--- a/drivers/video/sbuslib.c
+++ b/drivers/video/sbuslib.c
@@ -9,6 +9,7 @@
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/fb.h> 10#include <linux/fb.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/uaccess.h>
12 13
13#include <asm/oplib.h> 14#include <asm/oplib.h>
14#include <asm/fbio.h> 15#include <asm/fbio.h>
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index be27b9c1ed72..93361656316c 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -44,7 +44,7 @@ static struct fb_fix_screeninfo uvesafb_fix __devinitdata = {
44 44
45static int mtrr __devinitdata = 3; /* enable mtrr by default */ 45static int mtrr __devinitdata = 3; /* enable mtrr by default */
46static int blank = 1; /* enable blanking by default */ 46static int blank = 1; /* enable blanking by default */
47static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */ 47static int ypan = 1; /* 0: scroll, 1: ypan, 2: ywrap */
48static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */ 48static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */
49static int nocrtc __devinitdata; /* ignore CRTC settings */ 49static int nocrtc __devinitdata; /* ignore CRTC settings */
50static int noedid __devinitdata; /* don't try DDC transfers */ 50static int noedid __devinitdata; /* don't try DDC transfers */
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index afcdc69e37d6..254d115cafab 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -402,6 +402,18 @@ config IT8712F_WDT
402 To compile this driver as a module, choose M here: the 402 To compile this driver as a module, choose M here: the
403 module will be called it8712f_wdt. 403 module will be called it8712f_wdt.
404 404
405config HP_WATCHDOG
406 tristate "HP Proliant iLO 2 Hardware Watchdog Timer"
407 depends on X86
408 help
409 A software monitoring watchdog and NMI sourcing driver. This driver
410 will detect lockups and provide stack trace. Also, when an NMI
411 occurs this driver will make the necessary BIOS calls to log
412 the cause of the NMI. This is a driver that will only load on a
413 HP ProLiant system with a minimum of iLO2 support.
414 To compile this driver as a module, choose M here: the
415 module will be called hpwdt.
416
405config SC1200_WDT 417config SC1200_WDT
406 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog" 418 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog"
407 depends on X86 419 depends on X86
@@ -633,6 +645,19 @@ config WDT_RM9K_GPI
633 To compile this driver as a module, choose M here: the 645 To compile this driver as a module, choose M here: the
634 module will be called rm9k_wdt. 646 module will be called rm9k_wdt.
635 647
648config SIBYTE_WDOG
649 tristate "Sibyte SoC hardware watchdog"
650 depends on CPU_SB1
651 help
652 Watchdog driver for the built in watchdog hardware in Sibyte
653 SoC processors. There are apparently two watchdog timers
654 on such processors; this driver supports only the first one,
655 because currently Linux only supports exporting one watchdog
656 to userspace.
657
658 To compile this driver as a loadable module, choose M here.
659 The module will be called sb_wdog.
660
636config AR7_WDT 661config AR7_WDT
637 tristate "TI AR7 Watchdog Timer" 662 tristate "TI AR7 Watchdog Timer"
638 depends on AR7 663 depends on AR7
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index ebc21146d40c..f3fb170fe5c6 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
67obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o 67obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o
68obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o 68obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o
69obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o 69obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o
70obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o
70obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o 71obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
71obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o 72obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
72obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o 73obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o
@@ -92,6 +93,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
92obj-$(CONFIG_INDYDOG) += indydog.o 93obj-$(CONFIG_INDYDOG) += indydog.o
93obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o 94obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
94obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o 95obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
96obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
95obj-$(CONFIG_AR7_WDT) += ar7_wdt.o 97obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
96obj-$(CONFIG_TXX9_WDT) += txx9wdt.o 98obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
97 99
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 472be10f0686..1237113dc14a 100644
--- a/drivers/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
@@ -29,6 +29,7 @@
29 29
30#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) 30#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
31#define stampit() stamp("here i am") 31#define stampit() stamp("here i am")
32#define pr_init(fmt, args...) ({ static const __initdata char __fmt[] = fmt; printk(__fmt, ## args); })
32 33
33#define WATCHDOG_NAME "bfin-wdt" 34#define WATCHDOG_NAME "bfin-wdt"
34#define PFX WATCHDOG_NAME ": " 35#define PFX WATCHDOG_NAME ": "
@@ -445,19 +446,19 @@ static int __init bfin_wdt_init(void)
445 446
446 ret = register_reboot_notifier(&bfin_wdt_notifier); 447 ret = register_reboot_notifier(&bfin_wdt_notifier);
447 if (ret) { 448 if (ret) {
448 printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); 449 pr_init(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret);
449 return ret; 450 return ret;
450 } 451 }
451 452
452 ret = misc_register(&bfin_wdt_miscdev); 453 ret = misc_register(&bfin_wdt_miscdev);
453 if (ret) { 454 if (ret) {
454 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", 455 pr_init(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
455 WATCHDOG_MINOR, ret); 456 WATCHDOG_MINOR, ret);
456 unregister_reboot_notifier(&bfin_wdt_notifier); 457 unregister_reboot_notifier(&bfin_wdt_notifier);
457 return ret; 458 return ret;
458 } 459 }
459 460
460 printk(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", 461 pr_init(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n",
461 timeout, nowayout); 462 timeout, nowayout);
462 463
463 return 0; 464 return 0;
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
new file mode 100644
index 000000000000..a2e174b09fe7
--- /dev/null
+++ b/drivers/watchdog/hpwdt.c
@@ -0,0 +1,926 @@
1/*
2 * HP WatchDog Driver
3 * based on
4 *
5 * SoftDog 0.05: A Software Watchdog Device
6 *
7 * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
8 * Thomas Mingarelli <thomas.mingarelli@hp.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation
13 *
14 */
15
16#include <linux/device.h>
17#include <linux/fs.h>
18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/io.h>
21#include <linux/irq.h>
22#include <linux/kernel.h>
23#include <linux/miscdevice.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/kdebug.h>
27#include <linux/moduleparam.h>
28#include <linux/notifier.h>
29#include <linux/pci.h>
30#include <linux/pci_ids.h>
31#include <linux/reboot.h>
32#include <linux/sched.h>
33#include <linux/timer.h>
34#include <linux/types.h>
35#include <linux/uaccess.h>
36#include <linux/watchdog.h>
37#include <linux/dmi.h>
38#include <linux/efi.h>
39#include <linux/string.h>
40#include <linux/bootmem.h>
41#include <linux/slab.h>
42#include <asm/dmi.h>
43#include <asm/desc.h>
44#include <asm/kdebug.h>
45
46#define PCI_BIOS32_SD_VALUE 0x5F32335F /* "_32_" */
47#define CRU_BIOS_SIGNATURE_VALUE 0x55524324
48#define PCI_BIOS32_PARAGRAPH_LEN 16
49#define PCI_ROM_BASE1 0x000F0000
50#define ROM_SIZE 0x10000
51
52struct bios32_service_dir {
53 u32 signature;
54 u32 entry_point;
55 u8 revision;
56 u8 length;
57 u8 checksum;
58 u8 reserved[5];
59};
60
61/*
62 * smbios_entry_point - defines SMBIOS entry point structure
63 *
64 * anchor[4] - anchor string (_SM_)
65 * checksum - checksum of the entry point structure
66 * length - length of the entry point structure
67 * major_ver - major version (02h for revision 2.1)
68 * minor_ver - minor version (01h for revision 2.1)
69 * max_struct_size - size of the largest SMBIOS structure
70 * revision - entry point structure revision implemented
71 * formatted_area[5] - reserved
72 * intermediate_anchor[5] - intermediate anchor string (_DMI_)
73 * intermediate_checksum - intermediate checksum
74 * table_length - structure table length
75 * table_address - structure table address
76 * table_num_structs - number of SMBIOS structures present
77 * bcd_revision - BCD revision
78 */
79struct smbios_entry_point {
80 u8 anchor[4];
81 u8 checksum;
82 u8 length;
83 u8 major_ver;
84 u8 minor_ver;
85 u16 max_struct_size;
86 u8 revision;
87 u8 formatted_area[5];
88 u8 intermediate_anchor[5];
89 u8 intermediate_checksum;
90 u16 table_length;
91 u64 table_address;
92 u16 table_num_structs;
93 u8 bcd_revision;
94};
95
96/* type 212 */
97struct smbios_cru64_info {
98 u8 type;
99 u8 byte_length;
100 u16 handle;
101 u32 signature;
102 u64 physical_address;
103 u32 double_length;
104 u32 double_offset;
105};
106#define SMBIOS_CRU64_INFORMATION 212
107
108struct cmn_registers {
109 union {
110 struct {
111 u8 ral;
112 u8 rah;
113 u16 rea2;
114 };
115 u32 reax;
116 } u1;
117 union {
118 struct {
119 u8 rbl;
120 u8 rbh;
121 u8 reb2l;
122 u8 reb2h;
123 };
124 u32 rebx;
125 } u2;
126 union {
127 struct {
128 u8 rcl;
129 u8 rch;
130 u16 rec2;
131 };
132 u32 recx;
133 } u3;
134 union {
135 struct {
136 u8 rdl;
137 u8 rdh;
138 u16 red2;
139 };
140 u32 redx;
141 } u4;
142
143 u32 resi;
144 u32 redi;
145 u16 rds;
146 u16 res;
147 u32 reflags;
148} __attribute__((packed));
149
150#define DEFAULT_MARGIN 30
151static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
152static unsigned int reload; /* the computed soft_margin */
153static int nowayout = WATCHDOG_NOWAYOUT;
154static char expect_release;
155static unsigned long hpwdt_is_open;
156
157static void __iomem *pci_mem_addr; /* the PCI-memory address */
158static unsigned long __iomem *hpwdt_timer_reg;
159static unsigned long __iomem *hpwdt_timer_con;
160
161static DEFINE_SPINLOCK(rom_lock);
162
163static void *cru_rom_addr;
164
165static struct cmn_registers cmn_regs;
166
167static struct pci_device_id hpwdt_devices[] = {
168 {
169 .vendor = PCI_VENDOR_ID_COMPAQ,
170 .device = 0xB203,
171 .subvendor = PCI_ANY_ID,
172 .subdevice = PCI_ANY_ID,
173 },
174 {0}, /* terminate list */
175};
176MODULE_DEVICE_TABLE(pci, hpwdt_devices);
177
178/*
179 * bios_checksum
180 */
181static int __devinit bios_checksum(const char __iomem *ptr, int len)
182{
183 char sum = 0;
184 int i;
185
186 /*
187 * calculate checksum of size bytes. This should add up
188 * to zero if we have a valid header.
189 */
190 for (i = 0; i < len; i++)
191 sum += ptr[i];
192
193 return ((sum == 0) && (len > 0));
194}
195
196#ifndef CONFIG_X86_64
197/* --32 Bit Bios------------------------------------------------------------ */
198
199#define HPWDT_ARCH 32
200
201asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
202 unsigned long *pRomEntry)
203{
204 asm("pushl %ebp \n\t"
205 "movl %esp, %ebp \n\t"
206 "pusha \n\t"
207 "pushf \n\t"
208 "push %es \n\t"
209 "push %ds \n\t"
210 "pop %es \n\t"
211 "movl 8(%ebp),%eax \n\t"
212 "movl 4(%eax),%ebx \n\t"
213 "movl 8(%eax),%ecx \n\t"
214 "movl 12(%eax),%edx \n\t"
215 "movl 16(%eax),%esi \n\t"
216 "movl 20(%eax),%edi \n\t"
217 "movl (%eax),%eax \n\t"
218 "push %cs \n\t"
219 "call *12(%ebp) \n\t"
220 "pushf \n\t"
221 "pushl %eax \n\t"
222 "movl 8(%ebp),%eax \n\t"
223 "movl %ebx,4(%eax) \n\t"
224 "movl %ecx,8(%eax) \n\t"
225 "movl %edx,12(%eax) \n\t"
226 "movl %esi,16(%eax) \n\t"
227 "movl %edi,20(%eax) \n\t"
228 "movw %ds,24(%eax) \n\t"
229 "movw %es,26(%eax) \n\t"
230 "popl %ebx \n\t"
231 "movl %ebx,(%eax) \n\t"
232 "popl %ebx \n\t"
233 "movl %ebx,28(%eax) \n\t"
234 "pop %es \n\t"
235 "popf \n\t"
236 "popa \n\t"
237 "leave \n\t" "ret");
238}
239
240/*
241 * cru_detect
242 *
243 * Routine Description:
244 * This function uses the 32-bit BIOS Service Directory record to
245 * search for a $CRU record.
246 *
247 * Return Value:
248 * 0 : SUCCESS
249 * <0 : FAILURE
250 */
251static int __devinit cru_detect(unsigned long map_entry,
252 unsigned long map_offset)
253{
254 void *bios32_map;
255 unsigned long *bios32_entrypoint;
256 unsigned long cru_physical_address;
257 unsigned long cru_length;
258 unsigned long physical_bios_base = 0;
259 unsigned long physical_bios_offset = 0;
260 int retval = -ENODEV;
261
262 bios32_map = ioremap(map_entry, (2 * PAGE_SIZE));
263
264 if (bios32_map == NULL)
265 return -ENODEV;
266
267 bios32_entrypoint = bios32_map + map_offset;
268
269 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE;
270
271 asminline_call(&cmn_regs, bios32_entrypoint);
272
273 if (cmn_regs.u1.ral != 0) {
274 printk(KERN_WARNING
275 "hpwdt: Call succeeded but with an error: 0x%x\n",
276 cmn_regs.u1.ral);
277 } else {
278 physical_bios_base = cmn_regs.u2.rebx;
279 physical_bios_offset = cmn_regs.u4.redx;
280 cru_length = cmn_regs.u3.recx;
281 cru_physical_address =
282 physical_bios_base + physical_bios_offset;
283
284 /* If the values look OK, then map it in. */
285 if ((physical_bios_base + physical_bios_offset)) {
286 cru_rom_addr =
287 ioremap(cru_physical_address, cru_length);
288 if (cru_rom_addr)
289 retval = 0;
290 }
291
292 printk(KERN_DEBUG "hpwdt: CRU Base Address: 0x%lx\n",
293 physical_bios_base);
294 printk(KERN_DEBUG "hpwdt: CRU Offset Address: 0x%lx\n",
295 physical_bios_offset);
296 printk(KERN_DEBUG "hpwdt: CRU Length: 0x%lx\n",
297 cru_length);
298 printk(KERN_DEBUG "hpwdt: CRU Mapped Address: 0x%x\n",
299 (unsigned int)&cru_rom_addr);
300 }
301 iounmap(bios32_map);
302 return retval;
303}
304
305/*
306 * bios32_present
307 *
308 * Routine Description:
309 * This function finds the 32-bit BIOS Service Directory
310 *
311 * Return Value:
312 * 0 : SUCCESS
313 * <0 : FAILURE
314 */
315static int __devinit bios32_present(const char __iomem *p)
316{
317 struct bios32_service_dir *bios_32_ptr;
318 int length;
319 unsigned long map_entry, map_offset;
320
321 bios_32_ptr = (struct bios32_service_dir *) p;
322
323 /*
324 * Search for signature by checking equal to the swizzled value
325 * instead of calling another routine to perform a strcmp.
326 */
327 if (bios_32_ptr->signature == PCI_BIOS32_SD_VALUE) {
328 length = bios_32_ptr->length * PCI_BIOS32_PARAGRAPH_LEN;
329 if (bios_checksum(p, length)) {
330 /*
331 * According to the spec, we're looking for the
332 * first 4KB-aligned address below the entrypoint
333 * listed in the header. The Service Directory code
334 * is guaranteed to occupy no more than 2 4KB pages.
335 */
336 map_entry = bios_32_ptr->entry_point & ~(PAGE_SIZE - 1);
337 map_offset = bios_32_ptr->entry_point - map_entry;
338
339 return cru_detect(map_entry, map_offset);
340 }
341 }
342 return -ENODEV;
343}
344
345static int __devinit detect_cru_service(void)
346{
347 char __iomem *p, *q;
348 int rc = -1;
349
350 /*
351 * Search from 0x0f0000 through 0x0fffff, inclusive.
352 */
353 p = ioremap(PCI_ROM_BASE1, ROM_SIZE);
354 if (p == NULL)
355 return -ENOMEM;
356
357 for (q = p; q < p + ROM_SIZE; q += 16) {
358 rc = bios32_present(q);
359 if (!rc)
360 break;
361 }
362 iounmap(p);
363 return rc;
364}
365
366#else
367/* --64 Bit Bios------------------------------------------------------------ */
368
369#define HPWDT_ARCH 64
370
371asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
372 unsigned long *pRomEntry)
373{
374 asm("pushq %rbp \n\t"
375 "movq %rsp, %rbp \n\t"
376 "pushq %rax \n\t"
377 "pushq %rbx \n\t"
378 "pushq %rdx \n\t"
379 "pushq %r12 \n\t"
380 "pushq %r9 \n\t"
381 "movq %rsi, %r12 \n\t"
382 "movq %rdi, %r9 \n\t"
383 "movl 4(%r9),%ebx \n\t"
384 "movl 8(%r9),%ecx \n\t"
385 "movl 12(%r9),%edx \n\t"
386 "movl 16(%r9),%esi \n\t"
387 "movl 20(%r9),%edi \n\t"
388 "movl (%r9),%eax \n\t"
389 "call *%r12 \n\t"
390 "pushfq \n\t"
391 "popq %r12 \n\t"
392 "popfq \n\t"
393 "movl %eax, (%r9) \n\t"
394 "movl %ebx, 4(%r9) \n\t"
395 "movl %ecx, 8(%r9) \n\t"
396 "movl %edx, 12(%r9) \n\t"
397 "movl %esi, 16(%r9) \n\t"
398 "movl %edi, 20(%r9) \n\t"
399 "movq %r12, %rax \n\t"
400 "movl %eax, 28(%r9) \n\t"
401 "popq %r9 \n\t"
402 "popq %r12 \n\t"
403 "popq %rdx \n\t"
404 "popq %rbx \n\t"
405 "popq %rax \n\t"
406 "leave \n\t" "ret");
407}
408
409/*
410 * dmi_find_cru
411 *
412 * Routine Description:
413 * This function checks wether or not a SMBIOS/DMI record is
414 * the 64bit CRU info or not
415 *
416 * Return Value:
417 * 0 : SUCCESS - if record found
418 * <0 : FAILURE - if record not found
419 */
420static void __devinit dmi_find_cru(const struct dmi_header *dm)
421{
422 struct smbios_cru64_info *smbios_cru64_ptr;
423 unsigned long cru_physical_address;
424
425 if (dm->type == SMBIOS_CRU64_INFORMATION) {
426 smbios_cru64_ptr = (struct smbios_cru64_info *) dm;
427 if (smbios_cru64_ptr->signature == CRU_BIOS_SIGNATURE_VALUE) {
428 cru_physical_address =
429 smbios_cru64_ptr->physical_address +
430 smbios_cru64_ptr->double_offset;
431 cru_rom_addr = ioremap(cru_physical_address,
432 smbios_cru64_ptr->double_length);
433 }
434 }
435}
436
437/*
438 * dmi_table
439 *
440 * Routine Description:
441 * Decode the SMBIOS/DMI table and check if we have a 64bit CRU record
442 * or not.
443 *
444 * We have to be cautious here. We have seen BIOSes with DMI pointers
445 * pointing to completely the wrong place for example
446 */
447static void __devinit dmi_table(u8 *buf, int len, int num,
448 void (*decode)(const struct dmi_header *))
449{
450 u8 *data = buf;
451 int i = 0;
452
453 /*
454 * Stop when we see all the items the table claimed to have
455 * OR we run off the end of the table (also happens)
456 */
457 while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) {
458 const struct dmi_header *dm = (const struct dmi_header *)data;
459
460 /*
461 * We want to know the total length (formated area and strings)
462 * before decoding to make sure we won't run off the table in
463 * dmi_decode or dmi_string
464 */
465 data += dm->length;
466 while ((data - buf < len - 1) && (data[0] || data[1]))
467 data++;
468 if (data - buf < len - 1)
469 decode(dm);
470 data += 2;
471 i++;
472 }
473}
474
475/*
476 * smbios_present
477 *
478 * Routine Description:
479 * This function parses the SMBIOS entry point table to retrieve
480 * the 64 bit CRU Service.
481 *
482 * Return Value:
483 * 0 : SUCCESS
484 * <0 : FAILURE
485 */
486static int __devinit smbios_present(const char __iomem *p)
487{
488 struct smbios_entry_point *eps =
489 (struct smbios_entry_point *) p;
490 int length;
491 u8 *buf;
492
493 /* check if we have indeed the SMBIOS table entry point */
494 if ((strncmp((char *)eps->anchor, "_SM_",
495 sizeof(eps->anchor))) == 0) {
496 length = eps->length;
497
498 /* SMBIOS v2.1 implementation might use 0x1e */
499 if ((length == 0x1e) &&
500 (eps->major_ver == 2) &&
501 (eps->minor_ver == 1))
502 length = 0x1f;
503
504 /*
505 * Now we will check:
506 * - SMBIOS checksum must be 0
507 * - intermediate anchor should be _DMI_
508 * - intermediate checksum should be 0
509 */
510 if ((bios_checksum(p, length)) &&
511 (strncmp((char *)eps->intermediate_anchor, "_DMI_",
512 sizeof(eps->intermediate_anchor)) == 0) &&
513 (bios_checksum(p+0x10, 15))) {
514 buf = ioremap(eps->table_address, eps->table_length);
515 if (buf == NULL)
516 return -ENODEV;
517
518
519 /* Scan the DMI table for the 64 bit CRU service */
520 dmi_table(buf, eps->table_length,
521 eps->table_num_structs, dmi_find_cru);
522
523 iounmap(buf);
524 return 0;
525 }
526 }
527
528 return -ENODEV;
529}
530
531static int __devinit smbios_scan_machine(void)
532{
533 char __iomem *p, *q;
534 int rc;
535
536 if (efi_enabled) {
537 if (efi.smbios == EFI_INVALID_TABLE_ADDR)
538 return -ENODEV;
539
540 p = ioremap(efi.smbios, 32);
541 if (p == NULL)
542 return -ENOMEM;
543
544 rc = smbios_present(p);
545 iounmap(p);
546 } else {
547 /*
548 * Search from 0x0f0000 through 0x0fffff, inclusive.
549 */
550 p = ioremap(PCI_ROM_BASE1, ROM_SIZE);
551 if (p == NULL)
552 return -ENOMEM;
553
554 for (q = p; q < p + ROM_SIZE; q += 16) {
555 rc = smbios_present(q);
556 if (!rc) {
557 break;
558 }
559 }
560 iounmap(p);
561 }
562}
563
564static int __devinit detect_cru_service(void)
565{
566 cru_rom_addr = NULL;
567
568 smbios_scan_machine(); /* will become dmi_walk(dmi_find_cru); */
569
570 /* if cru_rom_addr has been set then we found a CRU service */
571 return ((cru_rom_addr != NULL)? 0: -ENODEV);
572}
573
574/* ------------------------------------------------------------------------- */
575
576#endif
577
578/*
579 * NMI Handler
580 */
581static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
582 void *data)
583{
584 static unsigned long rom_pl;
585 static int die_nmi_called;
586
587 if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI)
588 return NOTIFY_OK;
589
590 spin_lock_irqsave(&rom_lock, rom_pl);
591 if (!die_nmi_called)
592 asminline_call(&cmn_regs, cru_rom_addr);
593 die_nmi_called = 1;
594 spin_unlock_irqrestore(&rom_lock, rom_pl);
595 if (cmn_regs.u1.ral == 0) {
596 printk(KERN_WARNING "hpwdt: An NMI occurred, "
597 "but unable to determine source.\n");
598 } else {
599 panic("An NMI occurred, please see the Integrated "
600 "Management Log for details.\n");
601 }
602
603 return NOTIFY_STOP;
604}
605
606/*
607 * Watchdog operations
608 */
609static void hpwdt_start(void)
610{
611 reload = (soft_margin * 1000) / 128;
612 iowrite16(reload, hpwdt_timer_reg);
613 iowrite16(0x85, hpwdt_timer_con);
614}
615
616static void hpwdt_stop(void)
617{
618 unsigned long data;
619
620 data = ioread16(hpwdt_timer_con);
621 data &= 0xFE;
622 iowrite16(data, hpwdt_timer_con);
623}
624
625static void hpwdt_ping(void)
626{
627 iowrite16(reload, hpwdt_timer_reg);
628}
629
630static int hpwdt_change_timer(int new_margin)
631{
632 /* Arbitrary, can't find the card's limits */
633 if (new_margin < 30 || new_margin > 600) {
634 printk(KERN_WARNING
635 "hpwdt: New value passed in is invalid: %d seconds.\n",
636 new_margin);
637 return -EINVAL;
638 }
639
640 soft_margin = new_margin;
641 printk(KERN_DEBUG
642 "hpwdt: New timer passed in is %d seconds.\n",
643 new_margin);
644 reload = (soft_margin * 1000) / 128;
645
646 return 0;
647}
648
649/*
650 * /dev/watchdog handling
651 */
652static int hpwdt_open(struct inode *inode, struct file *file)
653{
654 /* /dev/watchdog can only be opened once */
655 if (test_and_set_bit(0, &hpwdt_is_open))
656 return -EBUSY;
657
658 /* Start the watchdog */
659 hpwdt_start();
660 hpwdt_ping();
661
662 return nonseekable_open(inode, file);
663}
664
665static int hpwdt_release(struct inode *inode, struct file *file)
666{
667 /* Stop the watchdog */
668 if (expect_release == 42) {
669 hpwdt_stop();
670 } else {
671 printk(KERN_CRIT
672 "hpwdt: Unexpected close, not stopping watchdog!\n");
673 hpwdt_ping();
674 }
675
676 expect_release = 0;
677
678 /* /dev/watchdog is being closed, make sure it can be re-opened */
679 clear_bit(0, &hpwdt_is_open);
680
681 return 0;
682}
683
684static ssize_t hpwdt_write(struct file *file, const char __user *data,
685 size_t len, loff_t *ppos)
686{
687 /* See if we got the magic character 'V' and reload the timer */
688 if (len) {
689 if (!nowayout) {
690 size_t i;
691
692 /* note: just in case someone wrote the magic character
693 * five months ago... */
694 expect_release = 0;
695
696 /* scan to see whether or not we got the magic char. */
697 for (i = 0; i != len; i++) {
698 char c;
699 if (get_user(c, data+i))
700 return -EFAULT;
701 if (c == 'V')
702 expect_release = 42;
703 }
704 }
705
706 /* someone wrote to us, we should reload the timer */
707 hpwdt_ping();
708 }
709
710 return len;
711}
712
713static struct watchdog_info ident = {
714 .options = WDIOF_SETTIMEOUT |
715 WDIOF_KEEPALIVEPING |
716 WDIOF_MAGICCLOSE,
717 .identity = "HP iLO2 HW Watchdog Timer",
718};
719
720static long hpwdt_ioctl(struct file *file, unsigned int cmd,
721 unsigned long arg)
722{
723 void __user *argp = (void __user *)arg;
724 int __user *p = argp;
725 int new_margin;
726 int ret = -ENOTTY;
727
728 switch (cmd) {
729 case WDIOC_GETSUPPORT:
730 ret = 0;
731 if (copy_to_user(argp, &ident, sizeof(ident)))
732 ret = -EFAULT;
733 break;
734
735 case WDIOC_GETSTATUS:
736 case WDIOC_GETBOOTSTATUS:
737 ret = put_user(0, p);
738 break;
739
740 case WDIOC_KEEPALIVE:
741 hpwdt_ping();
742 ret = 0;
743 break;
744
745 case WDIOC_SETTIMEOUT:
746 ret = get_user(new_margin, p);
747 if (ret)
748 break;
749
750 ret = hpwdt_change_timer(new_margin);
751 if (ret)
752 break;
753
754 hpwdt_ping();
755 /* Fall */
756 case WDIOC_GETTIMEOUT:
757 ret = put_user(soft_margin, p);
758 break;
759 }
760 return ret;
761}
762
763/*
764 * Kernel interfaces
765 */
766static struct file_operations hpwdt_fops = {
767 .owner = THIS_MODULE,
768 .llseek = no_llseek,
769 .write = hpwdt_write,
770 .unlocked_ioctl = hpwdt_ioctl,
771 .open = hpwdt_open,
772 .release = hpwdt_release,
773};
774
775static struct miscdevice hpwdt_miscdev = {
776 .minor = WATCHDOG_MINOR,
777 .name = "watchdog",
778 .fops = &hpwdt_fops,
779};
780
781static struct notifier_block die_notifier = {
782 .notifier_call = hpwdt_pretimeout,
783 .priority = 0x7FFFFFFF,
784};
785
786/*
787 * Init & Exit
788 */
789
790static int __devinit hpwdt_init_one(struct pci_dev *dev,
791 const struct pci_device_id *ent)
792{
793 int retval;
794
795 /*
796 * First let's find out if we are on an iLO2 server. We will
797 * not run on a legacy ASM box.
798 */
799 if (dev->subsystem_vendor != PCI_VENDOR_ID_HP) {
800 dev_warn(&dev->dev,
801 "This server does not have an iLO2 ASIC.\n");
802 return -ENODEV;
803 }
804
805 if (pci_enable_device(dev)) {
806 dev_warn(&dev->dev,
807 "Not possible to enable PCI Device: 0x%x:0x%x.\n",
808 ent->vendor, ent->device);
809 return -ENODEV;
810 }
811
812 pci_mem_addr = pci_iomap(dev, 1, 0x80);
813 if (!pci_mem_addr) {
814 dev_warn(&dev->dev,
815 "Unable to detect the iLO2 server memory.\n");
816 retval = -ENOMEM;
817 goto error_pci_iomap;
818 }
819 hpwdt_timer_reg = pci_mem_addr + 0x70;
820 hpwdt_timer_con = pci_mem_addr + 0x72;
821
822 /* Make sure that we have a valid soft_margin */
823 if (hpwdt_change_timer(soft_margin))
824 hpwdt_change_timer(DEFAULT_MARGIN);
825
826 /*
827 * We need to map the ROM to get the CRU service.
828 * For 32 bit Operating Systems we need to go through the 32 Bit
829 * BIOS Service Directory
830 * For 64 bit Operating Systems we get that service through SMBIOS.
831 */
832 retval = detect_cru_service();
833 if (retval < 0) {
834 dev_warn(&dev->dev,
835 "Unable to detect the %d Bit CRU Service.\n",
836 HPWDT_ARCH);
837 goto error_get_cru;
838 }
839
840 /*
841 * We know this is the only CRU call we need to make so lets keep as
842 * few instructions as possible once the NMI comes in.
843 */
844 cmn_regs.u1.rah = 0x0D;
845 cmn_regs.u1.ral = 0x02;
846
847 retval = register_die_notifier(&die_notifier);
848 if (retval != 0) {
849 dev_warn(&dev->dev,
850 "Unable to register a die notifier (err=%d).\n",
851 retval);
852 goto error_die_notifier;
853 }
854
855 retval = misc_register(&hpwdt_miscdev);
856 if (retval < 0) {
857 dev_warn(&dev->dev,
858 "Unable to register miscdev on minor=%d (err=%d).\n",
859 WATCHDOG_MINOR, retval);
860 goto error_misc_register;
861 }
862
863 printk(KERN_INFO
864 "hp Watchdog Timer Driver: 1.00"
865 ", timer margin: %d seconds( nowayout=%d).\n",
866 soft_margin, nowayout);
867
868 return 0;
869
870error_misc_register:
871 unregister_die_notifier(&die_notifier);
872error_die_notifier:
873 if (cru_rom_addr)
874 iounmap(cru_rom_addr);
875error_get_cru:
876 pci_iounmap(dev, pci_mem_addr);
877error_pci_iomap:
878 pci_disable_device(dev);
879 return retval;
880}
881
882static void __devexit hpwdt_exit(struct pci_dev *dev)
883{
884 if (!nowayout)
885 hpwdt_stop();
886
887 misc_deregister(&hpwdt_miscdev);
888 unregister_die_notifier(&die_notifier);
889
890 if (cru_rom_addr)
891 iounmap(cru_rom_addr);
892 pci_iounmap(dev, pci_mem_addr);
893 pci_disable_device(dev);
894}
895
896static struct pci_driver hpwdt_driver = {
897 .name = "hpwdt",
898 .id_table = hpwdt_devices,
899 .probe = hpwdt_init_one,
900 .remove = __devexit_p(hpwdt_exit),
901};
902
903static void __exit hpwdt_cleanup(void)
904{
905 pci_unregister_driver(&hpwdt_driver);
906}
907
908static int __init hpwdt_init(void)
909{
910 return pci_register_driver(&hpwdt_driver);
911}
912
913MODULE_AUTHOR("Tom Mingarelli");
914MODULE_DESCRIPTION("hp watchdog driver");
915MODULE_LICENSE("GPL");
916MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
917
918module_param(soft_margin, int, 0);
919MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds");
920
921module_param(nowayout, int, 0);
922MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
923 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
924
925module_init(hpwdt_init);
926module_exit(hpwdt_cleanup);
diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
index 98451747d3cd..789831b3fa00 100644
--- a/drivers/watchdog/mtx-1_wdt.c
+++ b/drivers/watchdog/mtx-1_wdt.c
@@ -45,10 +45,13 @@
45#include <linux/completion.h> 45#include <linux/completion.h>
46#include <linux/jiffies.h> 46#include <linux/jiffies.h>
47#include <linux/watchdog.h> 47#include <linux/watchdog.h>
48#include <linux/platform_device.h>
49
48#include <asm/io.h> 50#include <asm/io.h>
49#include <asm/uaccess.h> 51#include <asm/uaccess.h>
50 52
51#include <asm/mach-au1x00/au1000.h> 53#include <asm/mach-au1x00/au1000.h>
54#include <asm/gpio.h>
52 55
53#define MTX1_WDT_INTERVAL (5 * HZ) 56#define MTX1_WDT_INTERVAL (5 * HZ)
54 57
@@ -61,6 +64,7 @@ static struct {
61 volatile int queue; 64 volatile int queue;
62 int default_ticks; 65 int default_ticks;
63 unsigned long inuse; 66 unsigned long inuse;
67 unsigned gpio;
64} mtx1_wdt_device; 68} mtx1_wdt_device;
65 69
66static void mtx1_wdt_trigger(unsigned long unused) 70static void mtx1_wdt_trigger(unsigned long unused)
@@ -73,7 +77,8 @@ static void mtx1_wdt_trigger(unsigned long unused)
73 * toggle GPIO2_15 77 * toggle GPIO2_15
74 */ 78 */
75 tmp = au_readl(GPIO2_DIR); 79 tmp = au_readl(GPIO2_DIR);
76 tmp = (tmp & ~(1<<15)) | ((~tmp) & (1<<15)); 80 tmp = (tmp & ~(1 << mtx1_wdt_device.gpio)) |
81 ((~tmp) & (1 << mtx1_wdt_device.gpio));
77 au_writel (tmp, GPIO2_DIR); 82 au_writel (tmp, GPIO2_DIR);
78 83
79 if (mtx1_wdt_device.queue && ticks) 84 if (mtx1_wdt_device.queue && ticks)
@@ -93,7 +98,7 @@ static void mtx1_wdt_start(void)
93{ 98{
94 if (!mtx1_wdt_device.queue) { 99 if (!mtx1_wdt_device.queue) {
95 mtx1_wdt_device.queue = 1; 100 mtx1_wdt_device.queue = 1;
96 au_writel (au_readl(GPIO2_DIR) | (u32)(1<<15), GPIO2_DIR); 101 gpio_set_value(mtx1_wdt_device.gpio, 1);
97 mod_timer(&mtx1_wdt_device.timer, jiffies + MTX1_WDT_INTERVAL); 102 mod_timer(&mtx1_wdt_device.timer, jiffies + MTX1_WDT_INTERVAL);
98 } 103 }
99 mtx1_wdt_device.running++; 104 mtx1_wdt_device.running++;
@@ -103,7 +108,7 @@ static int mtx1_wdt_stop(void)
103{ 108{
104 if (mtx1_wdt_device.queue) { 109 if (mtx1_wdt_device.queue) {
105 mtx1_wdt_device.queue = 0; 110 mtx1_wdt_device.queue = 0;
106 au_writel (au_readl(GPIO2_DIR) & ~((u32)(1<<15)), GPIO2_DIR); 111 gpio_set_value(mtx1_wdt_device.gpio, 0);
107 } 112 }
108 113
109 ticks = mtx1_wdt_device.default_ticks; 114 ticks = mtx1_wdt_device.default_ticks;
@@ -197,10 +202,12 @@ static struct miscdevice mtx1_wdt_misc = {
197}; 202};
198 203
199 204
200static int __init mtx1_wdt_init(void) 205static int mtx1_wdt_probe(struct platform_device *pdev)
201{ 206{
202 int ret; 207 int ret;
203 208
209 mtx1_wdt_device.gpio = pdev->resource[0].start;
210
204 if ((ret = misc_register(&mtx1_wdt_misc)) < 0) { 211 if ((ret = misc_register(&mtx1_wdt_misc)) < 0) {
205 printk(KERN_ERR " mtx-1_wdt : failed to register\n"); 212 printk(KERN_ERR " mtx-1_wdt : failed to register\n");
206 return ret; 213 return ret;
@@ -222,13 +229,30 @@ static int __init mtx1_wdt_init(void)
222 return 0; 229 return 0;
223} 230}
224 231
225static void __exit mtx1_wdt_exit(void) 232static int mtx1_wdt_remove(struct platform_device *pdev)
226{ 233{
227 if (mtx1_wdt_device.queue) { 234 if (mtx1_wdt_device.queue) {
228 mtx1_wdt_device.queue = 0; 235 mtx1_wdt_device.queue = 0;
229 wait_for_completion(&mtx1_wdt_device.stop); 236 wait_for_completion(&mtx1_wdt_device.stop);
230 } 237 }
231 misc_deregister(&mtx1_wdt_misc); 238 misc_deregister(&mtx1_wdt_misc);
239 return 0;
240}
241
242static struct platform_driver mtx1_wdt = {
243 .probe = mtx1_wdt_probe,
244 .remove = mtx1_wdt_remove,
245 .driver.name = "mtx1-wdt",
246};
247
248static int __init mtx1_wdt_init(void)
249{
250 return platform_driver_register(&mtx1_wdt);
251}
252
253static void __exit mtx1_wdt_exit(void)
254{
255 platform_driver_unregister(&mtx1_wdt);
232} 256}
233 257
234module_init(mtx1_wdt_init); 258module_init(mtx1_wdt_init);
@@ -237,3 +261,4 @@ module_exit(mtx1_wdt_exit);
237MODULE_AUTHOR("Michael Stickel, Florian Fainelli"); 261MODULE_AUTHOR("Michael Stickel, Florian Fainelli");
238MODULE_DESCRIPTION("Driver for the MTX-1 watchdog"); 262MODULE_DESCRIPTION("Driver for the MTX-1 watchdog");
239MODULE_LICENSE("GPL"); 263MODULE_LICENSE("GPL");
264MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
new file mode 100644
index 000000000000..b94431433695
--- /dev/null
+++ b/drivers/watchdog/sb_wdog.c
@@ -0,0 +1,353 @@
1/*
2 * Watchdog driver for SiByte SB1 SoCs
3 *
4 * Copyright (C) 2007 OnStor, Inc. * Andrew Sharp <andy.sharp@onstor.com>
5 *
6 * This driver is intended to make the second of two hardware watchdogs
7 * on the Sibyte 12XX and 11XX SoCs available to the user. There are two
8 * such devices available on the SoC, but it seems that there isn't an
9 * enumeration class for watchdogs in Linux like there is for RTCs.
10 * The second is used rather than the first because it uses IRQ 1,
11 * thereby avoiding all that IRQ 0 problematic nonsense.
12 *
13 * I have not tried this driver on a 1480 processor; it might work
14 * just well enough to really screw things up.
15 *
16 * It is a simple timer, and there is an interrupt that is raised the
17 * first time the timer expires. The second time it expires, the chip
18 * is reset and there is no way to redirect that NMI. Which could
19 * be problematic in some cases where this chip is sitting on the HT
20 * bus and has just taken responsibility for providing a cache block.
21 * Since the reset can't be redirected to the external reset pin, it is
22 * possible that other HT connected processors might hang and not reset.
23 * For Linux, a soft reset would probably be even worse than a hard reset.
24 * There you have it.
25 *
26 * The timer takes 23 bits of a 64 bit register (?) as a count value,
27 * and decrements the count every microsecond, for a max value of
28 * 0x7fffff usec or about 8.3ish seconds.
29 *
30 * This watchdog borrows some user semantics from the softdog driver,
31 * in that if you close the fd, it leaves the watchdog running, unless
32 * you previously wrote a 'V' to the fd, in which case it disables
33 * the watchdog when you close the fd like some other drivers.
34 *
35 * Based on various other watchdog drivers, which are probably all
36 * loosely based on something Alan Cox wrote years ago.
37 *
38 * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved.
39 * http://www.redhat.com
40 *
41 * This program is free software; you can redistribute it and/or
42 * modify it under the terms of the GNU General Public License
43 * version 1 or 2 as published by the Free Software Foundation.
44 *
45 */
46#include <linux/module.h>
47#include <linux/io.h>
48#include <linux/uaccess.h>
49#include <linux/fs.h>
50#include <linux/reboot.h>
51#include <linux/miscdevice.h>
52#include <linux/watchdog.h>
53#include <linux/interrupt.h>
54
55#include <asm/sibyte/sb1250.h>
56#include <asm/sibyte/sb1250_regs.h>
57#include <asm/sibyte/sb1250_int.h>
58#include <asm/sibyte/sb1250_scd.h>
59
60
61/*
62 * set the initial count value of a timer
63 *
64 * wdog is the iomem address of the cfg register
65 */
66void sbwdog_set(char __iomem *wdog, unsigned long t)
67{
68 __raw_writeb(0, wdog - 0x10);
69 __raw_writeq(t & 0x7fffffUL, wdog);
70}
71
72/*
73 * cause the timer to [re]load it's initial count and start counting
74 * all over again
75 *
76 * wdog is the iomem address of the cfg register
77 */
78void sbwdog_pet(char __iomem *wdog)
79{
80 __raw_writeb(__raw_readb(wdog) | 1, wdog);
81}
82
83static unsigned long sbwdog_gate; /* keeps it to one thread only */
84static char __iomem *kern_dog = (char __iomem *)(IO_BASE + (A_SCD_WDOG_CFG_0));
85static char __iomem *user_dog = (char __iomem *)(IO_BASE + (A_SCD_WDOG_CFG_1));
86static unsigned long timeout = 0x7fffffUL; /* useconds: 8.3ish secs. */
87static int expect_close;
88
89static struct watchdog_info ident = {
90 .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
91 .identity = "SiByte Watchdog",
92};
93
94/*
95 * Allow only a single thread to walk the dog
96 */
97static int sbwdog_open(struct inode *inode, struct file *file)
98{
99 nonseekable_open(inode, file);
100 if (test_and_set_bit(0, &sbwdog_gate)) {
101 return -EBUSY;
102 }
103 __module_get(THIS_MODULE);
104
105 /*
106 * Activate the timer
107 */
108 sbwdog_set(user_dog, timeout);
109 __raw_writeb(1, user_dog);
110
111 return 0;
112}
113
114/*
115 * Put the dog back in the kennel.
116 */
117static int sbwdog_release(struct inode *inode, struct file *file)
118{
119 if (expect_close == 42) {
120 __raw_writeb(0, user_dog);
121 module_put(THIS_MODULE);
122 } else {
123 printk(KERN_CRIT "%s: Unexpected close, not stopping watchdog!\n",
124 ident.identity);
125 sbwdog_pet(user_dog);
126 }
127 clear_bit(0, &sbwdog_gate);
128 expect_close = 0;
129
130 return 0;
131}
132
133/*
134 * 42 - the answer
135 */
136static ssize_t sbwdog_write(struct file *file, const char __user *data,
137 size_t len, loff_t *ppos)
138{
139 int i;
140
141 if (len) {
142 /*
143 * restart the timer
144 */
145 expect_close = 0;
146
147 for (i = 0; i != len; i++) {
148 char c;
149
150 if (get_user(c, data + i)) {
151 return -EFAULT;
152 }
153 if (c == 'V') {
154 expect_close = 42;
155 }
156 }
157 sbwdog_pet(user_dog);
158 }
159
160 return len;
161}
162
163static int sbwdog_ioctl(struct inode *inode, struct file *file,
164 unsigned int cmd, unsigned long arg)
165{
166 int ret = -ENOTTY;
167 unsigned long time;
168 void __user *argp = (void __user *)arg;
169 int __user *p = argp;
170
171 switch (cmd) {
172 case WDIOC_GETSUPPORT:
173 ret = copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
174 break;
175
176 case WDIOC_GETSTATUS:
177 case WDIOC_GETBOOTSTATUS:
178 ret = put_user(0, p);
179 break;
180
181 case WDIOC_SETTIMEOUT:
182 ret = get_user(time, p);
183 if (ret) {
184 break;
185 }
186
187 time *= 1000000;
188 if (time > 0x7fffffUL) {
189 ret = -EINVAL;
190 break;
191 }
192 timeout = time;
193 sbwdog_set(user_dog, timeout);
194 sbwdog_pet(user_dog);
195
196 case WDIOC_GETTIMEOUT:
197 /*
198 * get the remaining count from the ... count register
199 * which is 1*8 before the config register
200 */
201 ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
202 break;
203
204 case WDIOC_KEEPALIVE:
205 sbwdog_pet(user_dog);
206 ret = 0;
207 break;
208 }
209 return ret;
210}
211
212/*
213 * Notifier for system down
214 */
215static int
216sbwdog_notify_sys(struct notifier_block *this, unsigned long code, void *erf)
217{
218 if (code == SYS_DOWN || code == SYS_HALT) {
219 /*
220 * sit and sit
221 */
222 __raw_writeb(0, user_dog);
223 __raw_writeb(0, kern_dog);
224 }
225
226 return NOTIFY_DONE;
227}
228
229static const struct file_operations sbwdog_fops =
230{
231 .owner = THIS_MODULE,
232 .llseek = no_llseek,
233 .write = sbwdog_write,
234 .ioctl = sbwdog_ioctl,
235 .open = sbwdog_open,
236 .release = sbwdog_release,
237};
238
239static struct miscdevice sbwdog_miscdev =
240{
241 .minor = WATCHDOG_MINOR,
242 .name = "watchdog",
243 .fops = &sbwdog_fops,
244};
245
246static struct notifier_block sbwdog_notifier = {
247 .notifier_call = sbwdog_notify_sys,
248};
249
250/*
251 * interrupt handler
252 *
253 * doesn't do a whole lot for user, but oh so cleverly written so kernel
254 * code can use it to re-up the watchdog, thereby saving the kernel from
255 * having to create and maintain a timer, just to tickle another timer,
256 * which is just so wrong.
257 */
258irqreturn_t sbwdog_interrupt(int irq, void *addr)
259{
260 unsigned long wd_init;
261 char *wd_cfg_reg = (char *)addr;
262 u8 cfg;
263
264 cfg = __raw_readb(wd_cfg_reg);
265 wd_init = __raw_readq(wd_cfg_reg - 8) & 0x7fffff;
266
267 /*
268 * if it's the second watchdog timer, it's for those users
269 */
270 if (wd_cfg_reg == user_dog) {
271 printk(KERN_CRIT
272 "%s in danger of initiating system reset in %ld.%01ld seconds\n",
273 ident.identity, wd_init / 1000000, (wd_init / 100000) % 10);
274 } else {
275 cfg |= 1;
276 }
277
278 __raw_writeb(cfg, wd_cfg_reg);
279
280 return IRQ_HANDLED;
281}
282
283static int __init sbwdog_init(void)
284{
285 int ret;
286
287 /*
288 * register a reboot notifier
289 */
290 ret = register_reboot_notifier(&sbwdog_notifier);
291 if (ret) {
292 printk (KERN_ERR "%s: cannot register reboot notifier (err=%d)\n",
293 ident.identity, ret);
294 return ret;
295 }
296
297 /*
298 * get the resources
299 */
300 ret = misc_register(&sbwdog_miscdev);
301 if (ret == 0) {
302 printk(KERN_INFO "%s: timeout is %ld.%ld secs\n", ident.identity,
303 timeout / 1000000, (timeout / 100000) % 10);
304 }
305
306 ret = request_irq(1, sbwdog_interrupt, IRQF_DISABLED | IRQF_SHARED,
307 ident.identity, (void *)user_dog);
308 if (ret) {
309 printk(KERN_ERR "%s: failed to request irq 1 - %d\n", ident.identity,
310 ret);
311 misc_deregister(&sbwdog_miscdev);
312 }
313
314 return ret;
315}
316
317static void __exit sbwdog_exit(void)
318{
319 misc_deregister(&sbwdog_miscdev);
320}
321
322module_init(sbwdog_init);
323module_exit(sbwdog_exit);
324
325MODULE_AUTHOR("Andrew Sharp <andy.sharp@onstor.com>");
326MODULE_DESCRIPTION("SiByte Watchdog");
327
328module_param(timeout, ulong, 0);
329MODULE_PARM_DESC(timeout,
330 "Watchdog timeout in microseconds (max/default 8388607 or 8.3ish secs)");
331
332MODULE_LICENSE("GPL");
333MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
334
335/*
336 * example code that can be put in a platform code area to utilize the
337 * first watchdog timer for the kernels own purpose.
338
339 void
340platform_wd_setup(void)
341{
342 int ret;
343
344 ret = request_irq(0, sbwdog_interrupt, IRQF_DISABLED | IRQF_SHARED,
345 "Kernel Watchdog", IOADDR(A_SCD_WDOG_CFG_0));
346 if (ret) {
347 printk(KERN_CRIT "Watchdog IRQ zero(0) failed to be requested - %d\n",
348 ret);
349 }
350}
351
352
353 */
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 5ce43b63c60e..a3510b8ba3e7 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -218,16 +218,16 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
218 _enter("%p{%s},{%s:%p{%s},}", 218 _enter("%p{%s},{%s:%p{%s},}",
219 dentry, 219 dentry,
220 dentry->d_name.name, 220 dentry->d_name.name,
221 nd->mnt->mnt_devname, 221 nd->path.mnt->mnt_devname,
222 dentry, 222 dentry,
223 nd->dentry->d_name.name); 223 nd->path.dentry->d_name.name);
224 224
225 dput(nd->dentry); 225 dput(nd->path.dentry);
226 nd->dentry = dget(dentry); 226 nd->path.dentry = dget(dentry);
227 227
228 newmnt = afs_mntpt_do_automount(nd->dentry); 228 newmnt = afs_mntpt_do_automount(nd->path.dentry);
229 if (IS_ERR(newmnt)) { 229 if (IS_ERR(newmnt)) {
230 path_release(nd); 230 path_put(&nd->path);
231 return (void *)newmnt; 231 return (void *)newmnt;
232 } 232 }
233 233
@@ -235,17 +235,16 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
235 err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts); 235 err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts);
236 switch (err) { 236 switch (err) {
237 case 0: 237 case 0:
238 dput(nd->dentry); 238 path_put(&nd->path);
239 mntput(nd->mnt); 239 nd->path.mnt = newmnt;
240 nd->mnt = newmnt; 240 nd->path.dentry = dget(newmnt->mnt_root);
241 nd->dentry = dget(newmnt->mnt_root);
242 schedule_delayed_work(&afs_mntpt_expiry_timer, 241 schedule_delayed_work(&afs_mntpt_expiry_timer,
243 afs_mntpt_expiry_timeout * HZ); 242 afs_mntpt_expiry_timeout * HZ);
244 break; 243 break;
245 case -EBUSY: 244 case -EBUSY:
246 /* someone else made a mount here whilst we were busy */ 245 /* someone else made a mount here whilst we were busy */
247 while (d_mountpoint(nd->dentry) && 246 while (d_mountpoint(nd->path.dentry) &&
248 follow_down(&nd->mnt, &nd->dentry)) 247 follow_down(&nd->path.mnt, &nd->path.dentry))
249 ; 248 ;
250 err = 0; 249 err = 0;
251 default: 250 default:
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2bbcc8151dc3..a54a946a50ae 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -368,7 +368,8 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
368 * so we don't need to follow the mount. 368 * so we don't need to follow the mount.
369 */ 369 */
370 if (d_mountpoint(dentry)) { 370 if (d_mountpoint(dentry)) {
371 if (!autofs4_follow_mount(&nd->mnt, &nd->dentry)) { 371 if (!autofs4_follow_mount(&nd->path.mnt,
372 &nd->path.dentry)) {
372 status = -ENOENT; 373 status = -ENOENT;
373 goto out_error; 374 goto out_error;
374 } 375 }
@@ -382,7 +383,7 @@ done:
382 return NULL; 383 return NULL;
383 384
384out_error: 385out_error:
385 path_release(nd); 386 path_put(&nd->path);
386 return ERR_PTR(status); 387 return ERR_PTR(status);
387} 388}
388 389
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index d8a02f1e08cc..0498b181dd52 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -443,12 +443,12 @@ static int load_flat_file(struct linux_binprm * bprm,
443 443
444 if (strncmp(hdr->magic, "bFLT", 4)) { 444 if (strncmp(hdr->magic, "bFLT", 4)) {
445 /* 445 /*
446 * Previously, here was a printk to tell people
447 * "BINFMT_FLAT: bad header magic".
448 * But for the kernel which also use ELF FD-PIC format, this
449 * error message is confusing.
446 * because a lot of people do not manage to produce good 450 * because a lot of people do not manage to produce good
447 * flat binaries, we leave this printk to help them realise
448 * the problem. We only print the error if its not a script file
449 */ 451 */
450 if (strncmp(hdr->magic, "#!", 2))
451 printk("BINFMT_FLAT: bad header magic\n");
452 ret = -ENOEXEC; 452 ret = -ENOEXEC;
453 goto err; 453 goto err;
454 } 454 }
diff --git a/fs/bio.c b/fs/bio.c
index 242e409dab4b..3312fcc3c098 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -903,7 +903,7 @@ void bio_set_pages_dirty(struct bio *bio)
903 } 903 }
904} 904}
905 905
906void bio_release_pages(struct bio *bio) 906static void bio_release_pages(struct bio *bio)
907{ 907{
908 struct bio_vec *bvec = bio->bi_io_vec; 908 struct bio_vec *bvec = bio->bi_io_vec;
909 int i; 909 int i;
diff --git a/fs/block_dev.c b/fs/block_dev.c
index e63067d25cdb..7d822fae7765 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -31,6 +31,8 @@ struct bdev_inode {
31 struct inode vfs_inode; 31 struct inode vfs_inode;
32}; 32};
33 33
34static const struct address_space_operations def_blk_aops;
35
34static inline struct bdev_inode *BDEV_I(struct inode *inode) 36static inline struct bdev_inode *BDEV_I(struct inode *inode)
35{ 37{
36 return container_of(inode, struct bdev_inode, vfs_inode); 38 return container_of(inode, struct bdev_inode, vfs_inode);
@@ -171,203 +173,6 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
171 iov, offset, nr_segs, blkdev_get_blocks, NULL); 173 iov, offset, nr_segs, blkdev_get_blocks, NULL);
172} 174}
173 175
174#if 0
175static void blk_end_aio(struct bio *bio, int error)
176{
177 struct kiocb *iocb = bio->bi_private;
178 atomic_t *bio_count = &iocb->ki_bio_count;
179
180 if (bio_data_dir(bio) == READ)
181 bio_check_pages_dirty(bio);
182 else {
183 bio_release_pages(bio);
184 bio_put(bio);
185 }
186
187 /* iocb->ki_nbytes stores error code from LLDD */
188 if (error)
189 iocb->ki_nbytes = -EIO;
190
191 if (atomic_dec_and_test(bio_count)) {
192 if ((long)iocb->ki_nbytes < 0)
193 aio_complete(iocb, iocb->ki_nbytes, 0);
194 else
195 aio_complete(iocb, iocb->ki_left, 0);
196 }
197
198 return 0;
199}
200
201#define VEC_SIZE 16
202struct pvec {
203 unsigned short nr;
204 unsigned short idx;
205 struct page *page[VEC_SIZE];
206};
207
208#define PAGES_SPANNED(addr, len) \
209 (DIV_ROUND_UP((addr) + (len), PAGE_SIZE) - (addr) / PAGE_SIZE);
210
211/*
212 * get page pointer for user addr, we internally cache struct page array for
213 * (addr, count) range in pvec to avoid frequent call to get_user_pages. If
214 * internal page list is exhausted, a batch count of up to VEC_SIZE is used
215 * to get next set of page struct.
216 */
217static struct page *blk_get_page(unsigned long addr, size_t count, int rw,
218 struct pvec *pvec)
219{
220 int ret, nr_pages;
221 if (pvec->idx == pvec->nr) {
222 nr_pages = PAGES_SPANNED(addr, count);
223 nr_pages = min(nr_pages, VEC_SIZE);
224 down_read(&current->mm->mmap_sem);
225 ret = get_user_pages(current, current->mm, addr, nr_pages,
226 rw == READ, 0, pvec->page, NULL);
227 up_read(&current->mm->mmap_sem);
228 if (ret < 0)
229 return ERR_PTR(ret);
230 pvec->nr = ret;
231 pvec->idx = 0;
232 }
233 return pvec->page[pvec->idx++];
234}
235
236/* return a page back to pvec array */
237static void blk_unget_page(struct page *page, struct pvec *pvec)
238{
239 pvec->page[--pvec->idx] = page;
240}
241
242static ssize_t
243blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
244 loff_t pos, unsigned long nr_segs)
245{
246 struct inode *inode = iocb->ki_filp->f_mapping->host;
247 unsigned blkbits = blksize_bits(bdev_hardsect_size(I_BDEV(inode)));
248 unsigned blocksize_mask = (1 << blkbits) - 1;
249 unsigned long seg = 0; /* iov segment iterator */
250 unsigned long nvec; /* number of bio vec needed */
251 unsigned long cur_off; /* offset into current page */
252 unsigned long cur_len; /* I/O len of current page, up to PAGE_SIZE */
253
254 unsigned long addr; /* user iovec address */
255 size_t count; /* user iovec len */
256 size_t nbytes = iocb->ki_nbytes = iocb->ki_left; /* total xfer size */
257 loff_t size; /* size of block device */
258 struct bio *bio;
259 atomic_t *bio_count = &iocb->ki_bio_count;
260 struct page *page;
261 struct pvec pvec;
262
263 pvec.nr = 0;
264 pvec.idx = 0;
265
266 if (pos & blocksize_mask)
267 return -EINVAL;
268
269 size = i_size_read(inode);
270 if (pos + nbytes > size) {
271 nbytes = size - pos;
272 iocb->ki_left = nbytes;
273 }
274
275 /*
276 * check first non-zero iov alignment, the remaining
277 * iov alignment is checked inside bio loop below.
278 */
279 do {
280 addr = (unsigned long) iov[seg].iov_base;
281 count = min(iov[seg].iov_len, nbytes);
282 if (addr & blocksize_mask || count & blocksize_mask)
283 return -EINVAL;
284 } while (!count && ++seg < nr_segs);
285 atomic_set(bio_count, 1);
286
287 while (nbytes) {
288 /* roughly estimate number of bio vec needed */
289 nvec = (nbytes + PAGE_SIZE - 1) / PAGE_SIZE;
290 nvec = max(nvec, nr_segs - seg);
291 nvec = min(nvec, (unsigned long) BIO_MAX_PAGES);
292
293 /* bio_alloc should not fail with GFP_KERNEL flag */
294 bio = bio_alloc(GFP_KERNEL, nvec);
295 bio->bi_bdev = I_BDEV(inode);
296 bio->bi_end_io = blk_end_aio;
297 bio->bi_private = iocb;
298 bio->bi_sector = pos >> blkbits;
299same_bio:
300 cur_off = addr & ~PAGE_MASK;
301 cur_len = PAGE_SIZE - cur_off;
302 if (count < cur_len)
303 cur_len = count;
304
305 page = blk_get_page(addr, count, rw, &pvec);
306 if (unlikely(IS_ERR(page)))
307 goto backout;
308
309 if (bio_add_page(bio, page, cur_len, cur_off)) {
310 pos += cur_len;
311 addr += cur_len;
312 count -= cur_len;
313 nbytes -= cur_len;
314
315 if (count)
316 goto same_bio;
317 while (++seg < nr_segs) {
318 addr = (unsigned long) iov[seg].iov_base;
319 count = iov[seg].iov_len;
320 if (!count)
321 continue;
322 if (unlikely(addr & blocksize_mask ||
323 count & blocksize_mask)) {
324 page = ERR_PTR(-EINVAL);
325 goto backout;
326 }
327 count = min(count, nbytes);
328 goto same_bio;
329 }
330 } else {
331 blk_unget_page(page, &pvec);
332 }
333
334 /* bio is ready, submit it */
335 if (rw == READ)
336 bio_set_pages_dirty(bio);
337 atomic_inc(bio_count);
338 submit_bio(rw, bio);
339 }
340
341completion:
342 iocb->ki_left -= nbytes;
343 nbytes = iocb->ki_left;
344 iocb->ki_pos += nbytes;
345
346 blk_run_address_space(inode->i_mapping);
347 if (atomic_dec_and_test(bio_count))
348 aio_complete(iocb, nbytes, 0);
349
350 return -EIOCBQUEUED;
351
352backout:
353 /*
354 * back out nbytes count constructed so far for this bio,
355 * we will throw away current bio.
356 */
357 nbytes += bio->bi_size;
358 bio_release_pages(bio);
359 bio_put(bio);
360
361 /*
362 * if no bio was submmitted, return the error code.
363 * otherwise, proceed with pending I/O completion.
364 */
365 if (atomic_read(bio_count) == 1)
366 return PTR_ERR(page);
367 goto completion;
368}
369#endif
370
371static int blkdev_writepage(struct page *page, struct writeback_control *wbc) 176static int blkdev_writepage(struct page *page, struct writeback_control *wbc)
372{ 177{
373 return block_write_full_page(page, blkdev_get_block, wbc); 178 return block_write_full_page(page, blkdev_get_block, wbc);
@@ -1334,7 +1139,7 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
1334 return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); 1139 return blkdev_ioctl(file->f_mapping->host, file, cmd, arg);
1335} 1140}
1336 1141
1337const struct address_space_operations def_blk_aops = { 1142static const struct address_space_operations def_blk_aops = {
1338 .readpage = blkdev_readpage, 1143 .readpage = blkdev_readpage,
1339 .writepage = blkdev_writepage, 1144 .writepage = blkdev_writepage,
1340 .sync_page = block_sync_page, 1145 .sync_page = block_sync_page,
@@ -1397,19 +1202,19 @@ struct block_device *lookup_bdev(const char *path)
1397 if (error) 1202 if (error)
1398 return ERR_PTR(error); 1203 return ERR_PTR(error);
1399 1204
1400 inode = nd.dentry->d_inode; 1205 inode = nd.path.dentry->d_inode;
1401 error = -ENOTBLK; 1206 error = -ENOTBLK;
1402 if (!S_ISBLK(inode->i_mode)) 1207 if (!S_ISBLK(inode->i_mode))
1403 goto fail; 1208 goto fail;
1404 error = -EACCES; 1209 error = -EACCES;
1405 if (nd.mnt->mnt_flags & MNT_NODEV) 1210 if (nd.path.mnt->mnt_flags & MNT_NODEV)
1406 goto fail; 1211 goto fail;
1407 error = -ENOMEM; 1212 error = -ENOMEM;
1408 bdev = bd_acquire(inode); 1213 bdev = bd_acquire(inode);
1409 if (!bdev) 1214 if (!bdev)
1410 goto fail; 1215 goto fail;
1411out: 1216out:
1412 path_release(&nd); 1217 path_put(&nd.path);
1413 return bdev; 1218 return bdev;
1414fail: 1219fail:
1415 bdev = ERR_PTR(error); 1220 bdev = ERR_PTR(error);
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index 413ee2349d1a..6ad447529961 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -259,18 +259,18 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
259 int err; 259 int err;
260 260
261 mntget(newmnt); 261 mntget(newmnt);
262 err = do_add_mount(newmnt, nd, nd->mnt->mnt_flags, mntlist); 262 err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist);
263 switch (err) { 263 switch (err) {
264 case 0: 264 case 0:
265 dput(nd->dentry); 265 dput(nd->path.dentry);
266 mntput(nd->mnt); 266 mntput(nd->path.mnt);
267 nd->mnt = newmnt; 267 nd->path.mnt = newmnt;
268 nd->dentry = dget(newmnt->mnt_root); 268 nd->path.dentry = dget(newmnt->mnt_root);
269 break; 269 break;
270 case -EBUSY: 270 case -EBUSY:
271 /* someone else made a mount here whilst we were busy */ 271 /* someone else made a mount here whilst we were busy */
272 while (d_mountpoint(nd->dentry) && 272 while (d_mountpoint(nd->path.dentry) &&
273 follow_down(&nd->mnt, &nd->dentry)) 273 follow_down(&nd->path.mnt, &nd->path.dentry))
274 ; 274 ;
275 err = 0; 275 err = 0;
276 default: 276 default:
@@ -307,8 +307,8 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
307 307
308 xid = GetXid(); 308 xid = GetXid();
309 309
310 dput(nd->dentry); 310 dput(nd->path.dentry);
311 nd->dentry = dget(dentry); 311 nd->path.dentry = dget(dentry);
312 312
313 cifs_sb = CIFS_SB(dentry->d_inode->i_sb); 313 cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
314 ses = cifs_sb->tcon->ses; 314 ses = cifs_sb->tcon->ses;
@@ -340,7 +340,8 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
340 rc = -EINVAL; 340 rc = -EINVAL;
341 goto out_err; 341 goto out_err;
342 } 342 }
343 mnt = cifs_dfs_do_refmount(nd->mnt, nd->dentry, 343 mnt = cifs_dfs_do_refmount(nd->path.mnt,
344 nd->path.dentry,
344 referrals[i].node_name); 345 referrals[i].node_name);
345 cFYI(1, ("%s: cifs_dfs_do_refmount:%s , mnt:%p", 346 cFYI(1, ("%s: cifs_dfs_do_refmount:%s , mnt:%p",
346 __FUNCTION__, 347 __FUNCTION__,
@@ -357,7 +358,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
357 if (IS_ERR(mnt)) 358 if (IS_ERR(mnt))
358 goto out_err; 359 goto out_err;
359 360
360 nd->mnt->mnt_flags |= MNT_SHRINKABLE; 361 nd->path.mnt->mnt_flags |= MNT_SHRINKABLE;
361 rc = add_mount_helper(mnt, nd, &cifs_dfs_automount_list); 362 rc = add_mount_helper(mnt, nd, &cifs_dfs_automount_list);
362 363
363out: 364out:
@@ -367,7 +368,7 @@ out:
367 cFYI(1, ("leaving %s" , __FUNCTION__)); 368 cFYI(1, ("leaving %s" , __FUNCTION__));
368 return ERR_PTR(rc); 369 return ERR_PTR(rc);
369out_err: 370out_err:
370 path_release(nd); 371 path_put(&nd->path);
371 goto out; 372 goto out;
372} 373}
373 374
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 2bf3026adc80..c21a1f552a63 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -75,12 +75,12 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
75 if ( error ) { 75 if ( error ) {
76 return error; 76 return error;
77 } else { 77 } else {
78 target_inode = nd.dentry->d_inode; 78 target_inode = nd.path.dentry->d_inode;
79 } 79 }
80 80
81 /* return if it is not a Coda inode */ 81 /* return if it is not a Coda inode */
82 if ( target_inode->i_sb != inode->i_sb ) { 82 if ( target_inode->i_sb != inode->i_sb ) {
83 path_release(&nd); 83 path_put(&nd.path);
84 return -EINVAL; 84 return -EINVAL;
85 } 85 }
86 86
@@ -89,7 +89,7 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
89 89
90 error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data); 90 error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);
91 91
92 path_release(&nd); 92 path_put(&nd.path);
93 return error; 93 return error;
94} 94}
95 95
diff --git a/fs/compat.c b/fs/compat.c
index ee80ff341d37..2ce4456aad30 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -241,10 +241,10 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs
241 error = user_path_walk(path, &nd); 241 error = user_path_walk(path, &nd);
242 if (!error) { 242 if (!error) {
243 struct kstatfs tmp; 243 struct kstatfs tmp;
244 error = vfs_statfs(nd.dentry, &tmp); 244 error = vfs_statfs(nd.path.dentry, &tmp);
245 if (!error) 245 if (!error)
246 error = put_compat_statfs(buf, &tmp); 246 error = put_compat_statfs(buf, &tmp);
247 path_release(&nd); 247 path_put(&nd.path);
248 } 248 }
249 return error; 249 return error;
250} 250}
@@ -309,10 +309,10 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s
309 error = user_path_walk(path, &nd); 309 error = user_path_walk(path, &nd);
310 if (!error) { 310 if (!error) {
311 struct kstatfs tmp; 311 struct kstatfs tmp;
312 error = vfs_statfs(nd.dentry, &tmp); 312 error = vfs_statfs(nd.path.dentry, &tmp);
313 if (!error) 313 if (!error)
314 error = put_compat_statfs64(buf, &tmp); 314 error = put_compat_statfs64(buf, &tmp);
315 path_release(&nd); 315 path_put(&nd.path);
316 } 316 }
317 return error; 317 return error;
318} 318}
@@ -702,9 +702,6 @@ static int do_nfs4_super_data_conv(void *raw_data)
702 real->flags = raw->flags; 702 real->flags = raw->flags;
703 real->version = raw->version; 703 real->version = raw->version;
704 } 704 }
705 else {
706 return -EINVAL;
707 }
708 705
709 return 0; 706 return 0;
710} 707}
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index ee32c0eac7c1..c6e72aebd16b 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -2853,7 +2853,7 @@ static void compat_ioctl_error(struct file *filp, unsigned int fd,
2853 /* find the name of the device. */ 2853 /* find the name of the device. */
2854 path = (char *)__get_free_page(GFP_KERNEL); 2854 path = (char *)__get_free_page(GFP_KERNEL);
2855 if (path) { 2855 if (path) {
2856 fn = d_path(filp->f_path.dentry, filp->f_path.mnt, path, PAGE_SIZE); 2856 fn = d_path(&filp->f_path, path, PAGE_SIZE);
2857 if (IS_ERR(fn)) 2857 if (IS_ERR(fn))
2858 fn = "?"; 2858 fn = "?";
2859 } 2859 }
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index 22700d2857da..78929ea84ff2 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -99,11 +99,11 @@ static int get_target(const char *symname, struct nameidata *nd,
99 99
100 ret = path_lookup(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, nd); 100 ret = path_lookup(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, nd);
101 if (!ret) { 101 if (!ret) {
102 if (nd->dentry->d_sb == configfs_sb) { 102 if (nd->path.dentry->d_sb == configfs_sb) {
103 *target = configfs_get_config_item(nd->dentry); 103 *target = configfs_get_config_item(nd->path.dentry);
104 if (!*target) { 104 if (!*target) {
105 ret = -ENOENT; 105 ret = -ENOENT;
106 path_release(nd); 106 path_put(&nd->path);
107 } 107 }
108 } else 108 } else
109 ret = -EPERM; 109 ret = -EPERM;
@@ -141,7 +141,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
141 ret = create_link(parent_item, target_item, dentry); 141 ret = create_link(parent_item, target_item, dentry);
142 142
143 config_item_put(target_item); 143 config_item_put(target_item);
144 path_release(&nd); 144 path_put(&nd.path);
145 145
146out_put: 146out_put:
147 config_item_put(parent_item); 147 config_item_put(parent_item);
diff --git a/fs/dcache.c b/fs/dcache.c
index 44f6cf23b70e..43455776711e 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -95,6 +95,14 @@ static void d_free(struct dentry *dentry)
95 call_rcu(&dentry->d_u.d_rcu, d_callback); 95 call_rcu(&dentry->d_u.d_rcu, d_callback);
96} 96}
97 97
98static void dentry_lru_remove(struct dentry *dentry)
99{
100 if (!list_empty(&dentry->d_lru)) {
101 list_del_init(&dentry->d_lru);
102 dentry_stat.nr_unused--;
103 }
104}
105
98/* 106/*
99 * Release the dentry's inode, using the filesystem 107 * Release the dentry's inode, using the filesystem
100 * d_iput() operation if defined. 108 * d_iput() operation if defined.
@@ -211,13 +219,7 @@ repeat:
211unhash_it: 219unhash_it:
212 __d_drop(dentry); 220 __d_drop(dentry);
213kill_it: 221kill_it:
214 /* If dentry was on d_lru list 222 dentry_lru_remove(dentry);
215 * delete it from there
216 */
217 if (!list_empty(&dentry->d_lru)) {
218 list_del(&dentry->d_lru);
219 dentry_stat.nr_unused--;
220 }
221 dentry = d_kill(dentry); 223 dentry = d_kill(dentry);
222 if (dentry) 224 if (dentry)
223 goto repeat; 225 goto repeat;
@@ -285,10 +287,7 @@ int d_invalidate(struct dentry * dentry)
285static inline struct dentry * __dget_locked(struct dentry *dentry) 287static inline struct dentry * __dget_locked(struct dentry *dentry)
286{ 288{
287 atomic_inc(&dentry->d_count); 289 atomic_inc(&dentry->d_count);
288 if (!list_empty(&dentry->d_lru)) { 290 dentry_lru_remove(dentry);
289 dentry_stat.nr_unused--;
290 list_del_init(&dentry->d_lru);
291 }
292 return dentry; 291 return dentry;
293} 292}
294 293
@@ -404,10 +403,7 @@ static void prune_one_dentry(struct dentry * dentry)
404 403
405 if (dentry->d_op && dentry->d_op->d_delete) 404 if (dentry->d_op && dentry->d_op->d_delete)
406 dentry->d_op->d_delete(dentry); 405 dentry->d_op->d_delete(dentry);
407 if (!list_empty(&dentry->d_lru)) { 406 dentry_lru_remove(dentry);
408 list_del(&dentry->d_lru);
409 dentry_stat.nr_unused--;
410 }
411 __d_drop(dentry); 407 __d_drop(dentry);
412 dentry = d_kill(dentry); 408 dentry = d_kill(dentry);
413 spin_lock(&dcache_lock); 409 spin_lock(&dcache_lock);
@@ -596,10 +592,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
596 592
597 /* detach this root from the system */ 593 /* detach this root from the system */
598 spin_lock(&dcache_lock); 594 spin_lock(&dcache_lock);
599 if (!list_empty(&dentry->d_lru)) { 595 dentry_lru_remove(dentry);
600 dentry_stat.nr_unused--;
601 list_del_init(&dentry->d_lru);
602 }
603 __d_drop(dentry); 596 __d_drop(dentry);
604 spin_unlock(&dcache_lock); 597 spin_unlock(&dcache_lock);
605 598
@@ -613,11 +606,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
613 spin_lock(&dcache_lock); 606 spin_lock(&dcache_lock);
614 list_for_each_entry(loop, &dentry->d_subdirs, 607 list_for_each_entry(loop, &dentry->d_subdirs,
615 d_u.d_child) { 608 d_u.d_child) {
616 if (!list_empty(&loop->d_lru)) { 609 dentry_lru_remove(loop);
617 dentry_stat.nr_unused--;
618 list_del_init(&loop->d_lru);
619 }
620
621 __d_drop(loop); 610 __d_drop(loop);
622 cond_resched_lock(&dcache_lock); 611 cond_resched_lock(&dcache_lock);
623 } 612 }
@@ -799,10 +788,7 @@ resume:
799 struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); 788 struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child);
800 next = tmp->next; 789 next = tmp->next;
801 790
802 if (!list_empty(&dentry->d_lru)) { 791 dentry_lru_remove(dentry);
803 dentry_stat.nr_unused--;
804 list_del_init(&dentry->d_lru);
805 }
806 /* 792 /*
807 * move only zero ref count dentries to the end 793 * move only zero ref count dentries to the end
808 * of the unused list for prune_dcache 794 * of the unused list for prune_dcache
@@ -1776,9 +1762,8 @@ shouldnt_be_hashed:
1776 * 1762 *
1777 * "buflen" should be positive. Caller holds the dcache_lock. 1763 * "buflen" should be positive. Caller holds the dcache_lock.
1778 */ 1764 */
1779static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt, 1765static char *__d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
1780 struct dentry *root, struct vfsmount *rootmnt, 1766 struct path *root, char *buffer, int buflen)
1781 char *buffer, int buflen)
1782{ 1767{
1783 char * end = buffer+buflen; 1768 char * end = buffer+buflen;
1784 char * retval; 1769 char * retval;
@@ -1803,7 +1788,7 @@ static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
1803 for (;;) { 1788 for (;;) {
1804 struct dentry * parent; 1789 struct dentry * parent;
1805 1790
1806 if (dentry == root && vfsmnt == rootmnt) 1791 if (dentry == root->dentry && vfsmnt == root->mnt)
1807 break; 1792 break;
1808 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { 1793 if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
1809 /* Global root? */ 1794 /* Global root? */
@@ -1844,13 +1829,23 @@ Elong:
1844 return ERR_PTR(-ENAMETOOLONG); 1829 return ERR_PTR(-ENAMETOOLONG);
1845} 1830}
1846 1831
1847/* write full pathname into buffer and return start of pathname */ 1832/**
1848char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt, 1833 * d_path - return the path of a dentry
1849 char *buf, int buflen) 1834 * @path: path to report
1835 * @buf: buffer to return value in
1836 * @buflen: buffer length
1837 *
1838 * Convert a dentry into an ASCII path name. If the entry has been deleted
1839 * the string " (deleted)" is appended. Note that this is ambiguous.
1840 *
1841 * Returns the buffer or an error code if the path was too long.
1842 *
1843 * "buflen" should be positive. Caller holds the dcache_lock.
1844 */
1845char *d_path(struct path *path, char *buf, int buflen)
1850{ 1846{
1851 char *res; 1847 char *res;
1852 struct vfsmount *rootmnt; 1848 struct path root;
1853 struct dentry *root;
1854 1849
1855 /* 1850 /*
1856 * We have various synthetic filesystems that never get mounted. On 1851 * We have various synthetic filesystems that never get mounted. On
@@ -1859,18 +1854,17 @@ char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
1859 * user wants to identify the object in /proc/pid/fd/. The little hack 1854 * user wants to identify the object in /proc/pid/fd/. The little hack
1860 * below allows us to generate a name for these objects on demand: 1855 * below allows us to generate a name for these objects on demand:
1861 */ 1856 */
1862 if (dentry->d_op && dentry->d_op->d_dname) 1857 if (path->dentry->d_op && path->dentry->d_op->d_dname)
1863 return dentry->d_op->d_dname(dentry, buf, buflen); 1858 return path->dentry->d_op->d_dname(path->dentry, buf, buflen);
1864 1859
1865 read_lock(&current->fs->lock); 1860 read_lock(&current->fs->lock);
1866 rootmnt = mntget(current->fs->rootmnt); 1861 root = current->fs->root;
1867 root = dget(current->fs->root); 1862 path_get(&current->fs->root);
1868 read_unlock(&current->fs->lock); 1863 read_unlock(&current->fs->lock);
1869 spin_lock(&dcache_lock); 1864 spin_lock(&dcache_lock);
1870 res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen); 1865 res = __d_path(path->dentry, path->mnt, &root, buf, buflen);
1871 spin_unlock(&dcache_lock); 1866 spin_unlock(&dcache_lock);
1872 dput(root); 1867 path_put(&root);
1873 mntput(rootmnt);
1874 return res; 1868 return res;
1875} 1869}
1876 1870
@@ -1916,28 +1910,27 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen,
1916asmlinkage long sys_getcwd(char __user *buf, unsigned long size) 1910asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
1917{ 1911{
1918 int error; 1912 int error;
1919 struct vfsmount *pwdmnt, *rootmnt; 1913 struct path pwd, root;
1920 struct dentry *pwd, *root;
1921 char *page = (char *) __get_free_page(GFP_USER); 1914 char *page = (char *) __get_free_page(GFP_USER);
1922 1915
1923 if (!page) 1916 if (!page)
1924 return -ENOMEM; 1917 return -ENOMEM;
1925 1918
1926 read_lock(&current->fs->lock); 1919 read_lock(&current->fs->lock);
1927 pwdmnt = mntget(current->fs->pwdmnt); 1920 pwd = current->fs->pwd;
1928 pwd = dget(current->fs->pwd); 1921 path_get(&current->fs->pwd);
1929 rootmnt = mntget(current->fs->rootmnt); 1922 root = current->fs->root;
1930 root = dget(current->fs->root); 1923 path_get(&current->fs->root);
1931 read_unlock(&current->fs->lock); 1924 read_unlock(&current->fs->lock);
1932 1925
1933 error = -ENOENT; 1926 error = -ENOENT;
1934 /* Has the current directory has been unlinked? */ 1927 /* Has the current directory has been unlinked? */
1935 spin_lock(&dcache_lock); 1928 spin_lock(&dcache_lock);
1936 if (pwd->d_parent == pwd || !d_unhashed(pwd)) { 1929 if (pwd.dentry->d_parent == pwd.dentry || !d_unhashed(pwd.dentry)) {
1937 unsigned long len; 1930 unsigned long len;
1938 char * cwd; 1931 char * cwd;
1939 1932
1940 cwd = __d_path(pwd, pwdmnt, root, rootmnt, page, PAGE_SIZE); 1933 cwd = __d_path(pwd.dentry, pwd.mnt, &root, page, PAGE_SIZE);
1941 spin_unlock(&dcache_lock); 1934 spin_unlock(&dcache_lock);
1942 1935
1943 error = PTR_ERR(cwd); 1936 error = PTR_ERR(cwd);
@@ -1955,10 +1948,8 @@ asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
1955 spin_unlock(&dcache_lock); 1948 spin_unlock(&dcache_lock);
1956 1949
1957out: 1950out:
1958 dput(pwd); 1951 path_put(&pwd);
1959 mntput(pwdmnt); 1952 path_put(&root);
1960 dput(root);
1961 mntput(rootmnt);
1962 free_page((unsigned long) page); 1953 free_page((unsigned long) page);
1963 return error; 1954 return error;
1964} 1955}
diff --git a/fs/dcookies.c b/fs/dcookies.c
index 792cbf55fa95..855d4b1d619a 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -24,6 +24,7 @@
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/dcookies.h> 25#include <linux/dcookies.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/path.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28 29
29/* The dcookies are allocated from a kmem_cache and 30/* The dcookies are allocated from a kmem_cache and
@@ -31,8 +32,7 @@
31 * code here is particularly performance critical 32 * code here is particularly performance critical
32 */ 33 */
33struct dcookie_struct { 34struct dcookie_struct {
34 struct dentry * dentry; 35 struct path path;
35 struct vfsmount * vfsmnt;
36 struct list_head hash_list; 36 struct list_head hash_list;
37}; 37};
38 38
@@ -51,7 +51,7 @@ static inline int is_live(void)
51/* The dentry is locked, its address will do for the cookie */ 51/* The dentry is locked, its address will do for the cookie */
52static inline unsigned long dcookie_value(struct dcookie_struct * dcs) 52static inline unsigned long dcookie_value(struct dcookie_struct * dcs)
53{ 53{
54 return (unsigned long)dcs->dentry; 54 return (unsigned long)dcs->path.dentry;
55} 55}
56 56
57 57
@@ -89,19 +89,17 @@ static void hash_dcookie(struct dcookie_struct * dcs)
89} 89}
90 90
91 91
92static struct dcookie_struct * alloc_dcookie(struct dentry * dentry, 92static struct dcookie_struct *alloc_dcookie(struct path *path)
93 struct vfsmount * vfsmnt)
94{ 93{
95 struct dcookie_struct * dcs = kmem_cache_alloc(dcookie_cache, GFP_KERNEL); 94 struct dcookie_struct *dcs = kmem_cache_alloc(dcookie_cache,
95 GFP_KERNEL);
96 if (!dcs) 96 if (!dcs)
97 return NULL; 97 return NULL;
98 98
99 dentry->d_cookie = dcs; 99 path->dentry->d_cookie = dcs;
100 100 dcs->path = *path;
101 dcs->dentry = dget(dentry); 101 path_get(path);
102 dcs->vfsmnt = mntget(vfsmnt);
103 hash_dcookie(dcs); 102 hash_dcookie(dcs);
104
105 return dcs; 103 return dcs;
106} 104}
107 105
@@ -109,8 +107,7 @@ static struct dcookie_struct * alloc_dcookie(struct dentry * dentry,
109/* This is the main kernel-side routine that retrieves the cookie 107/* This is the main kernel-side routine that retrieves the cookie
110 * value for a dentry/vfsmnt pair. 108 * value for a dentry/vfsmnt pair.
111 */ 109 */
112int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, 110int get_dcookie(struct path *path, unsigned long *cookie)
113 unsigned long * cookie)
114{ 111{
115 int err = 0; 112 int err = 0;
116 struct dcookie_struct * dcs; 113 struct dcookie_struct * dcs;
@@ -122,10 +119,10 @@ int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt,
122 goto out; 119 goto out;
123 } 120 }
124 121
125 dcs = dentry->d_cookie; 122 dcs = path->dentry->d_cookie;
126 123
127 if (!dcs) 124 if (!dcs)
128 dcs = alloc_dcookie(dentry, vfsmnt); 125 dcs = alloc_dcookie(path);
129 126
130 if (!dcs) { 127 if (!dcs) {
131 err = -ENOMEM; 128 err = -ENOMEM;
@@ -174,7 +171,7 @@ asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len)
174 goto out; 171 goto out;
175 172
176 /* FIXME: (deleted) ? */ 173 /* FIXME: (deleted) ? */
177 path = d_path(dcs->dentry, dcs->vfsmnt, kbuf, PAGE_SIZE); 174 path = d_path(&dcs->path, kbuf, PAGE_SIZE);
178 175
179 if (IS_ERR(path)) { 176 if (IS_ERR(path)) {
180 err = PTR_ERR(path); 177 err = PTR_ERR(path);
@@ -254,9 +251,8 @@ out_kmem:
254 251
255static void free_dcookie(struct dcookie_struct * dcs) 252static void free_dcookie(struct dcookie_struct * dcs)
256{ 253{
257 dcs->dentry->d_cookie = NULL; 254 dcs->path.dentry->d_cookie = NULL;
258 dput(dcs->dentry); 255 path_put(&dcs->path);
259 mntput(dcs->vfsmnt);
260 kmem_cache_free(dcookie_cache, dcs); 256 kmem_cache_free(dcookie_cache, dcs);
261} 257}
262 258
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index 035e6f9990b0..67522c268c14 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -215,6 +215,8 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len)
215 ls->ls_recover_nodeid = nodeid; 215 ls->ls_recover_nodeid = nodeid;
216 216
217 if (nodeid == dlm_our_nodeid()) { 217 if (nodeid == dlm_our_nodeid()) {
218 ls->ls_recover_buf->rc_header.h_length =
219 dlm_config.ci_buffer_size;
218 dlm_copy_master_names(ls, last_name, last_len, 220 dlm_copy_master_names(ls, last_name, last_len,
219 ls->ls_recover_buf->rc_buf, 221 ls->ls_recover_buf->rc_buf,
220 max_size, nodeid); 222 max_size, nodeid);
diff --git a/fs/dquot.c b/fs/dquot.c
index def4e969df77..9c7feb62eed1 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1633,16 +1633,17 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path)
1633 error = path_lookup(path, LOOKUP_FOLLOW, &nd); 1633 error = path_lookup(path, LOOKUP_FOLLOW, &nd);
1634 if (error < 0) 1634 if (error < 0)
1635 return error; 1635 return error;
1636 error = security_quota_on(nd.dentry); 1636 error = security_quota_on(nd.path.dentry);
1637 if (error) 1637 if (error)
1638 goto out_path; 1638 goto out_path;
1639 /* Quota file not on the same filesystem? */ 1639 /* Quota file not on the same filesystem? */
1640 if (nd.mnt->mnt_sb != sb) 1640 if (nd.path.mnt->mnt_sb != sb)
1641 error = -EXDEV; 1641 error = -EXDEV;
1642 else 1642 else
1643 error = vfs_quota_on_inode(nd.dentry->d_inode, type, format_id); 1643 error = vfs_quota_on_inode(nd.path.dentry->d_inode, type,
1644 format_id);
1644out_path: 1645out_path:
1645 path_release(&nd); 1646 path_put(&nd.path);
1646 return error; 1647 return error;
1647} 1648}
1648 1649
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index cb20b964419f..841a032050a7 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -51,13 +51,13 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
51 51
52 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) 52 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate)
53 goto out; 53 goto out;
54 dentry_save = nd->dentry; 54 dentry_save = nd->path.dentry;
55 vfsmount_save = nd->mnt; 55 vfsmount_save = nd->path.mnt;
56 nd->dentry = lower_dentry; 56 nd->path.dentry = lower_dentry;
57 nd->mnt = lower_mnt; 57 nd->path.mnt = lower_mnt;
58 rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd); 58 rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd);
59 nd->dentry = dentry_save; 59 nd->path.dentry = dentry_save;
60 nd->mnt = vfsmount_save; 60 nd->path.mnt = vfsmount_save;
61 if (dentry->d_inode) { 61 if (dentry->d_inode) {
62 struct inode *lower_inode = 62 struct inode *lower_inode =
63 ecryptfs_inode_to_lower(dentry->d_inode); 63 ecryptfs_inode_to_lower(dentry->d_inode);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index edd1e44e9d47..e23861152101 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -77,13 +77,13 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode,
77 struct vfsmount *vfsmount_save; 77 struct vfsmount *vfsmount_save;
78 int rc; 78 int rc;
79 79
80 dentry_save = nd->dentry; 80 dentry_save = nd->path.dentry;
81 vfsmount_save = nd->mnt; 81 vfsmount_save = nd->path.mnt;
82 nd->dentry = lower_dentry; 82 nd->path.dentry = lower_dentry;
83 nd->mnt = lower_mnt; 83 nd->path.mnt = lower_mnt;
84 rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); 84 rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd);
85 nd->dentry = dentry_save; 85 nd->path.dentry = dentry_save;
86 nd->mnt = vfsmount_save; 86 nd->path.mnt = vfsmount_save;
87 return rc; 87 return rc;
88} 88}
89 89
@@ -819,14 +819,14 @@ ecryptfs_permission(struct inode *inode, int mask, struct nameidata *nd)
819 int rc; 819 int rc;
820 820
821 if (nd) { 821 if (nd) {
822 struct vfsmount *vfsmnt_save = nd->mnt; 822 struct vfsmount *vfsmnt_save = nd->path.mnt;
823 struct dentry *dentry_save = nd->dentry; 823 struct dentry *dentry_save = nd->path.dentry;
824 824
825 nd->mnt = ecryptfs_dentry_to_lower_mnt(nd->dentry); 825 nd->path.mnt = ecryptfs_dentry_to_lower_mnt(nd->path.dentry);
826 nd->dentry = ecryptfs_dentry_to_lower(nd->dentry); 826 nd->path.dentry = ecryptfs_dentry_to_lower(nd->path.dentry);
827 rc = permission(ecryptfs_inode_to_lower(inode), mask, nd); 827 rc = permission(ecryptfs_inode_to_lower(inode), mask, nd);
828 nd->mnt = vfsmnt_save; 828 nd->path.mnt = vfsmnt_save;
829 nd->dentry = dentry_save; 829 nd->path.dentry = dentry_save;
830 } else 830 } else
831 rc = permission(ecryptfs_inode_to_lower(inode), mask, NULL); 831 rc = permission(ecryptfs_inode_to_lower(inode), mask, NULL);
832 return rc; 832 return rc;
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 778c420e4cac..d25ac9500a92 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -513,8 +513,8 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
513 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n"); 513 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n");
514 goto out; 514 goto out;
515 } 515 }
516 lower_root = nd.dentry; 516 lower_root = nd.path.dentry;
517 lower_mnt = nd.mnt; 517 lower_mnt = nd.path.mnt;
518 ecryptfs_set_superblock_lower(sb, lower_root->d_sb); 518 ecryptfs_set_superblock_lower(sb, lower_root->d_sb);
519 sb->s_maxbytes = lower_root->d_sb->s_maxbytes; 519 sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
520 sb->s_blocksize = lower_root->d_sb->s_blocksize; 520 sb->s_blocksize = lower_root->d_sb->s_blocksize;
@@ -526,7 +526,7 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
526 rc = 0; 526 rc = 0;
527 goto out; 527 goto out;
528out_free: 528out_free:
529 path_release(&nd); 529 path_put(&nd.path);
530out: 530out:
531 return rc; 531 return rc;
532} 532}
diff --git a/fs/efs/dir.c b/fs/efs/dir.c
index dfb5cb400217..49308a29798a 100644
--- a/fs/efs/dir.c
+++ b/fs/efs/dir.c
@@ -5,8 +5,8 @@
5 */ 5 */
6 6
7#include <linux/buffer_head.h> 7#include <linux/buffer_head.h>
8#include <linux/efs_fs.h>
9#include <linux/smp_lock.h> 8#include <linux/smp_lock.h>
9#include "efs.h"
10 10
11static int efs_readdir(struct file *, void *, filldir_t); 11static int efs_readdir(struct file *, void *, filldir_t);
12 12
diff --git a/fs/efs/efs.h b/fs/efs/efs.h
new file mode 100644
index 000000000000..d8305b582ab0
--- /dev/null
+++ b/fs/efs/efs.h
@@ -0,0 +1,140 @@
1/*
2 * Copyright (c) 1999 Al Smith
3 *
4 * Portions derived from work (c) 1995,1996 Christian Vogelgsang.
5 * Portions derived from IRIX header files (c) 1988 Silicon Graphics
6 */
7#ifndef _EFS_EFS_H_
8#define _EFS_EFS_H_
9
10#include <linux/fs.h>
11#include <asm/uaccess.h>
12
13#define EFS_VERSION "1.0a"
14
15static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aeschi.ch.eu.org>";
16
17
18/* 1 block is 512 bytes */
19#define EFS_BLOCKSIZE_BITS 9
20#define EFS_BLOCKSIZE (1 << EFS_BLOCKSIZE_BITS)
21
22typedef int32_t efs_block_t;
23typedef uint32_t efs_ino_t;
24
25#define EFS_DIRECTEXTENTS 12
26
27/*
28 * layout of an extent, in memory and on disk. 8 bytes exactly.
29 */
30typedef union extent_u {
31 unsigned char raw[8];
32 struct extent_s {
33 unsigned int ex_magic:8; /* magic # (zero) */
34 unsigned int ex_bn:24; /* basic block */
35 unsigned int ex_length:8; /* numblocks in this extent */
36 unsigned int ex_offset:24; /* logical offset into file */
37 } cooked;
38} efs_extent;
39
40typedef struct edevs {
41 __be16 odev;
42 __be32 ndev;
43} efs_devs;
44
45/*
46 * extent based filesystem inode as it appears on disk. The efs inode
47 * is exactly 128 bytes long.
48 */
49struct efs_dinode {
50 __be16 di_mode; /* mode and type of file */
51 __be16 di_nlink; /* number of links to file */
52 __be16 di_uid; /* owner's user id */
53 __be16 di_gid; /* owner's group id */
54 __be32 di_size; /* number of bytes in file */
55 __be32 di_atime; /* time last accessed */
56 __be32 di_mtime; /* time last modified */
57 __be32 di_ctime; /* time created */
58 __be32 di_gen; /* generation number */
59 __be16 di_numextents; /* # of extents */
60 u_char di_version; /* version of inode */
61 u_char di_spare; /* spare - used by AFS */
62 union di_addr {
63 efs_extent di_extents[EFS_DIRECTEXTENTS];
64 efs_devs di_dev; /* device for IFCHR/IFBLK */
65 } di_u;
66};
67
68/* efs inode storage in memory */
69struct efs_inode_info {
70 int numextents;
71 int lastextent;
72
73 efs_extent extents[EFS_DIRECTEXTENTS];
74 struct inode vfs_inode;
75};
76
77#include <linux/efs_fs_sb.h>
78
79#define EFS_DIRBSIZE_BITS EFS_BLOCKSIZE_BITS
80#define EFS_DIRBSIZE (1 << EFS_DIRBSIZE_BITS)
81
82struct efs_dentry {
83 __be32 inode;
84 unsigned char namelen;
85 char name[3];
86};
87
88#define EFS_DENTSIZE (sizeof(struct efs_dentry) - 3 + 1)
89#define EFS_MAXNAMELEN ((1 << (sizeof(char) * 8)) - 1)
90
91#define EFS_DIRBLK_HEADERSIZE 4
92#define EFS_DIRBLK_MAGIC 0xbeef /* moo */
93
94struct efs_dir {
95 __be16 magic;
96 unsigned char firstused;
97 unsigned char slots;
98
99 unsigned char space[EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE];
100};
101
102#define EFS_MAXENTS \
103 ((EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE) / \
104 (EFS_DENTSIZE + sizeof(char)))
105
106#define EFS_SLOTAT(dir, slot) EFS_REALOFF((dir)->space[slot])
107
108#define EFS_REALOFF(offset) ((offset << 1))
109
110
111static inline struct efs_inode_info *INODE_INFO(struct inode *inode)
112{
113 return container_of(inode, struct efs_inode_info, vfs_inode);
114}
115
116static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
117{
118 return sb->s_fs_info;
119}
120
121struct statfs;
122struct fid;
123
124extern const struct inode_operations efs_dir_inode_operations;
125extern const struct file_operations efs_dir_operations;
126extern const struct address_space_operations efs_symlink_aops;
127
128extern struct inode *efs_iget(struct super_block *, unsigned long);
129extern efs_block_t efs_map_block(struct inode *, efs_block_t);
130extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int);
131
132extern struct dentry *efs_lookup(struct inode *, struct dentry *, struct nameidata *);
133extern struct dentry *efs_fh_to_dentry(struct super_block *sb, struct fid *fid,
134 int fh_len, int fh_type);
135extern struct dentry *efs_fh_to_parent(struct super_block *sb, struct fid *fid,
136 int fh_len, int fh_type);
137extern struct dentry *efs_get_parent(struct dentry *);
138extern int efs_bmap(struct inode *, int);
139
140#endif /* _EFS_EFS_H_ */
diff --git a/fs/efs/file.c b/fs/efs/file.c
index 5db20129681e..1ccb364ffa63 100644
--- a/fs/efs/file.c
+++ b/fs/efs/file.c
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include <linux/buffer_head.h> 9#include <linux/buffer_head.h>
10#include <linux/efs_fs.h> 10#include "efs.h"
11 11
12int efs_get_block(struct inode *inode, sector_t iblock, 12int efs_get_block(struct inode *inode, sector_t iblock,
13 struct buffer_head *bh_result, int create) 13 struct buffer_head *bh_result, int create)
diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index 627c3026946d..79e19e5958e1 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -7,11 +7,11 @@
7 * and from work (c) 1998 Mike Shaver. 7 * and from work (c) 1998 Mike Shaver.
8 */ 8 */
9 9
10#include <linux/efs_fs.h>
11#include <linux/efs_fs_sb.h>
12#include <linux/buffer_head.h> 10#include <linux/buffer_head.h>
13#include <linux/module.h> 11#include <linux/module.h>
14#include <linux/fs.h> 12#include <linux/fs.h>
13#include "efs.h"
14#include <linux/efs_fs_sb.h>
15 15
16static int efs_readpage(struct file *file, struct page *page) 16static int efs_readpage(struct file *file, struct page *page)
17{ 17{
diff --git a/fs/efs/namei.c b/fs/efs/namei.c
index e26704742d41..3a404e7fad53 100644
--- a/fs/efs/namei.c
+++ b/fs/efs/namei.c
@@ -8,9 +8,9 @@
8 8
9#include <linux/buffer_head.h> 9#include <linux/buffer_head.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/efs_fs.h>
12#include <linux/smp_lock.h> 11#include <linux/smp_lock.h>
13#include <linux/exportfs.h> 12#include <linux/exportfs.h>
13#include "efs.h"
14 14
15 15
16static efs_ino_t efs_find_entry(struct inode *inode, const char *name, int len) { 16static efs_ino_t efs_find_entry(struct inode *inode, const char *name, int len) {
diff --git a/fs/efs/super.c b/fs/efs/super.c
index 14082405cdd1..d733531b55e2 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -8,14 +8,15 @@
8 8
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/efs_fs.h>
12#include <linux/efs_vh.h>
13#include <linux/efs_fs_sb.h>
14#include <linux/exportfs.h> 11#include <linux/exportfs.h>
15#include <linux/slab.h> 12#include <linux/slab.h>
16#include <linux/buffer_head.h> 13#include <linux/buffer_head.h>
17#include <linux/vfs.h> 14#include <linux/vfs.h>
18 15
16#include "efs.h"
17#include <linux/efs_vh.h>
18#include <linux/efs_fs_sb.h>
19
19static int efs_statfs(struct dentry *dentry, struct kstatfs *buf); 20static int efs_statfs(struct dentry *dentry, struct kstatfs *buf);
20static int efs_fill_super(struct super_block *s, void *d, int silent); 21static int efs_fill_super(struct super_block *s, void *d, int silent);
21 22
diff --git a/fs/efs/symlink.c b/fs/efs/symlink.c
index 1d30d2ff440f..41911ec83aaf 100644
--- a/fs/efs/symlink.c
+++ b/fs/efs/symlink.c
@@ -7,10 +7,10 @@
7 */ 7 */
8 8
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/efs_fs.h>
11#include <linux/pagemap.h> 10#include <linux/pagemap.h>
12#include <linux/buffer_head.h> 11#include <linux/buffer_head.h>
13#include <linux/smp_lock.h> 12#include <linux/smp_lock.h>
13#include "efs.h"
14 14
15static int efs_symlink_readpage(struct file *file, struct page *page) 15static int efs_symlink_readpage(struct file *file, struct page *page)
16{ 16{
diff --git a/fs/exec.c b/fs/exec.c
index 9ff6069094d8..a44b142fb460 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -112,7 +112,7 @@ asmlinkage long sys_uselib(const char __user * library)
112 goto out; 112 goto out;
113 113
114 error = -EINVAL; 114 error = -EINVAL;
115 if (!S_ISREG(nd.dentry->d_inode->i_mode)) 115 if (!S_ISREG(nd.path.dentry->d_inode->i_mode))
116 goto exit; 116 goto exit;
117 117
118 error = vfs_permission(&nd, MAY_READ | MAY_EXEC); 118 error = vfs_permission(&nd, MAY_READ | MAY_EXEC);
@@ -148,7 +148,7 @@ out:
148 return error; 148 return error;
149exit: 149exit:
150 release_open_intent(&nd); 150 release_open_intent(&nd);
151 path_release(&nd); 151 path_put(&nd.path);
152 goto out; 152 goto out;
153} 153}
154 154
@@ -652,7 +652,7 @@ struct file *open_exec(const char *name)
652 file = ERR_PTR(err); 652 file = ERR_PTR(err);
653 653
654 if (!err) { 654 if (!err) {
655 struct inode *inode = nd.dentry->d_inode; 655 struct inode *inode = nd.path.dentry->d_inode;
656 file = ERR_PTR(-EACCES); 656 file = ERR_PTR(-EACCES);
657 if (S_ISREG(inode->i_mode)) { 657 if (S_ISREG(inode->i_mode)) {
658 int err = vfs_permission(&nd, MAY_EXEC); 658 int err = vfs_permission(&nd, MAY_EXEC);
@@ -672,7 +672,7 @@ out:
672 } 672 }
673 } 673 }
674 release_open_intent(&nd); 674 release_open_intent(&nd);
675 path_release(&nd); 675 path_put(&nd.path);
676 } 676 }
677 goto out; 677 goto out;
678} 678}
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 8e02cbfb1123..18769cc32377 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2758,16 +2758,16 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2758 if (err) 2758 if (err)
2759 return err; 2759 return err;
2760 /* Quotafile not on the same filesystem? */ 2760 /* Quotafile not on the same filesystem? */
2761 if (nd.mnt->mnt_sb != sb) { 2761 if (nd.path.mnt->mnt_sb != sb) {
2762 path_release(&nd); 2762 path_put(&nd.path);
2763 return -EXDEV; 2763 return -EXDEV;
2764 } 2764 }
2765 /* Quotafile not of fs root? */ 2765 /* Quotafile not of fs root? */
2766 if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) 2766 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
2767 printk(KERN_WARNING 2767 printk(KERN_WARNING
2768 "EXT3-fs: Quota file not on filesystem root. " 2768 "EXT3-fs: Quota file not on filesystem root. "
2769 "Journalled quota will not work.\n"); 2769 "Journalled quota will not work.\n");
2770 path_release(&nd); 2770 path_put(&nd.path);
2771 return vfs_quota_on(sb, type, format_id, path); 2771 return vfs_quota_on(sb, type, format_id, path);
2772} 2772}
2773 2773
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0072da75221f..13383ba18f1d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3158,16 +3158,16 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3158 if (err) 3158 if (err)
3159 return err; 3159 return err;
3160 /* Quotafile not on the same filesystem? */ 3160 /* Quotafile not on the same filesystem? */
3161 if (nd.mnt->mnt_sb != sb) { 3161 if (nd.path.mnt->mnt_sb != sb) {
3162 path_release(&nd); 3162 path_put(&nd.path);
3163 return -EXDEV; 3163 return -EXDEV;
3164 } 3164 }
3165 /* Quotafile not of fs root? */ 3165 /* Quotafile not of fs root? */
3166 if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) 3166 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
3167 printk(KERN_WARNING 3167 printk(KERN_WARNING
3168 "EXT4-fs: Quota file not on filesystem root. " 3168 "EXT4-fs: Quota file not on filesystem root. "
3169 "Journalled quota will not work.\n"); 3169 "Journalled quota will not work.\n");
3170 path_release(&nd); 3170 path_put(&nd.path);
3171 return vfs_quota_on(sb, type, format_id, path); 3171 return vfs_quota_on(sb, type, format_id, path);
3172} 3172}
3173 3173
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 7fb514b6d852..c4807b3fc8a3 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -906,7 +906,7 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
906 } 906 }
907 907
908 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) { 908 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
909 int err = generic_permission(inode, mask, NULL); 909 err = generic_permission(inode, mask, NULL);
910 910
911 /* If permission is denied, try to refresh file 911 /* If permission is denied, try to refresh file
912 attributes. This is also needed, because the root 912 attributes. This is also needed, because the root
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 43d511bba52d..4bee6aa845e4 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -884,12 +884,13 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
884 dev_name); 884 dev_name);
885 goto out; 885 goto out;
886 } 886 }
887 error = vfs_getattr(nd.mnt, nd.dentry, &stat); 887 error = vfs_getattr(nd.path.mnt, nd.path.dentry, &stat);
888 888
889 fstype = get_fs_type("gfs2"); 889 fstype = get_fs_type("gfs2");
890 list_for_each_entry(s, &fstype->fs_supers, s_instances) { 890 list_for_each_entry(s, &fstype->fs_supers, s_instances) {
891 if ((S_ISBLK(stat.mode) && s->s_dev == stat.rdev) || 891 if ((S_ISBLK(stat.mode) && s->s_dev == stat.rdev) ||
892 (S_ISDIR(stat.mode) && s == nd.dentry->d_inode->i_sb)) { 892 (S_ISDIR(stat.mode) &&
893 s == nd.path.dentry->d_inode->i_sb)) {
893 sb = s; 894 sb = s;
894 goto free_nd; 895 goto free_nd;
895 } 896 }
@@ -899,7 +900,7 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
899 "mount point %s\n", dev_name); 900 "mount point %s\n", dev_name);
900 901
901free_nd: 902free_nd:
902 path_release(&nd); 903 path_put(&nd.path);
903out: 904out:
904 return sb; 905 return sb;
905} 906}
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 3ab09a65c456..7b94a1e3c015 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -41,9 +41,9 @@ static struct kmem_cache *event_cachep __read_mostly;
41static struct vfsmount *inotify_mnt __read_mostly; 41static struct vfsmount *inotify_mnt __read_mostly;
42 42
43/* these are configurable via /proc/sys/fs/inotify/ */ 43/* these are configurable via /proc/sys/fs/inotify/ */
44int inotify_max_user_instances __read_mostly; 44static int inotify_max_user_instances __read_mostly;
45int inotify_max_user_watches __read_mostly; 45static int inotify_max_user_watches __read_mostly;
46int inotify_max_queued_events __read_mostly; 46static int inotify_max_queued_events __read_mostly;
47 47
48/* 48/*
49 * Lock ordering: 49 * Lock ordering:
@@ -367,7 +367,7 @@ static int find_inode(const char __user *dirname, struct nameidata *nd,
367 /* you can only watch an inode if you have read permissions on it */ 367 /* you can only watch an inode if you have read permissions on it */
368 error = vfs_permission(nd, MAY_READ); 368 error = vfs_permission(nd, MAY_READ);
369 if (error) 369 if (error)
370 path_release(nd); 370 path_put(&nd->path);
371 return error; 371 return error;
372} 372}
373 373
@@ -667,7 +667,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
667 goto fput_and_out; 667 goto fput_and_out;
668 668
669 /* inode held in place by reference to nd; dev by fget on fd */ 669 /* inode held in place by reference to nd; dev by fget on fd */
670 inode = nd.dentry->d_inode; 670 inode = nd.path.dentry->d_inode;
671 dev = filp->private_data; 671 dev = filp->private_data;
672 672
673 mutex_lock(&dev->up_mutex); 673 mutex_lock(&dev->up_mutex);
@@ -676,7 +676,7 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
676 ret = create_watch(dev, inode, mask); 676 ret = create_watch(dev, inode, mask);
677 mutex_unlock(&dev->up_mutex); 677 mutex_unlock(&dev->up_mutex);
678 678
679 path_release(&nd); 679 path_put(&nd.path);
680fput_and_out: 680fput_and_out:
681 fput_light(filp, fput_needed); 681 fput_light(filp, fput_needed);
682 return ret; 682 return ret;
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 08226464e563..1ed8bd4de941 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -153,7 +153,7 @@ lockd(struct svc_rqst *rqstp)
153 */ 153 */
154 while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) { 154 while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) {
155 long timeout = MAX_SCHEDULE_TIMEOUT; 155 long timeout = MAX_SCHEDULE_TIMEOUT;
156 char buf[RPC_MAX_ADDRBUFLEN]; 156 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
157 157
158 if (signalled()) { 158 if (signalled()) {
159 flush_signals(current); 159 flush_signals(current);
diff --git a/fs/namei.c b/fs/namei.c
index 52703986323a..941c8e8228c0 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -231,7 +231,7 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
231 struct vfsmount *mnt = NULL; 231 struct vfsmount *mnt = NULL;
232 232
233 if (nd) 233 if (nd)
234 mnt = nd->mnt; 234 mnt = nd->path.mnt;
235 235
236 if (mask & MAY_WRITE) { 236 if (mask & MAY_WRITE) {
237 umode_t mode = inode->i_mode; 237 umode_t mode = inode->i_mode;
@@ -296,7 +296,7 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
296 */ 296 */
297int vfs_permission(struct nameidata *nd, int mask) 297int vfs_permission(struct nameidata *nd, int mask)
298{ 298{
299 return permission(nd->dentry->d_inode, mask, nd); 299 return permission(nd->path.dentry->d_inode, mask, nd);
300} 300}
301 301
302/** 302/**
@@ -362,21 +362,31 @@ int deny_write_access(struct file * file)
362 return 0; 362 return 0;
363} 363}
364 364
365void path_release(struct nameidata *nd) 365/**
366 * path_get - get a reference to a path
367 * @path: path to get the reference to
368 *
369 * Given a path increment the reference count to the dentry and the vfsmount.
370 */
371void path_get(struct path *path)
366{ 372{
367 dput(nd->dentry); 373 mntget(path->mnt);
368 mntput(nd->mnt); 374 dget(path->dentry);
369} 375}
376EXPORT_SYMBOL(path_get);
370 377
371/* 378/**
372 * umount() mustn't call path_release()/mntput() as that would clear 379 * path_put - put a reference to a path
373 * mnt_expiry_mark 380 * @path: path to put the reference to
381 *
382 * Given a path decrement the reference count to the dentry and the vfsmount.
374 */ 383 */
375void path_release_on_umount(struct nameidata *nd) 384void path_put(struct path *path)
376{ 385{
377 dput(nd->dentry); 386 dput(path->dentry);
378 mntput_no_expire(nd->mnt); 387 mntput(path->mnt);
379} 388}
389EXPORT_SYMBOL(path_put);
380 390
381/** 391/**
382 * release_open_intent - free up open intent resources 392 * release_open_intent - free up open intent resources
@@ -539,16 +549,16 @@ walk_init_root(const char *name, struct nameidata *nd)
539 struct fs_struct *fs = current->fs; 549 struct fs_struct *fs = current->fs;
540 550
541 read_lock(&fs->lock); 551 read_lock(&fs->lock);
542 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { 552 if (fs->altroot.dentry && !(nd->flags & LOOKUP_NOALT)) {
543 nd->mnt = mntget(fs->altrootmnt); 553 nd->path = fs->altroot;
544 nd->dentry = dget(fs->altroot); 554 path_get(&fs->altroot);
545 read_unlock(&fs->lock); 555 read_unlock(&fs->lock);
546 if (__emul_lookup_dentry(name,nd)) 556 if (__emul_lookup_dentry(name,nd))
547 return 0; 557 return 0;
548 read_lock(&fs->lock); 558 read_lock(&fs->lock);
549 } 559 }
550 nd->mnt = mntget(fs->rootmnt); 560 nd->path = fs->root;
551 nd->dentry = dget(fs->root); 561 path_get(&fs->root);
552 read_unlock(&fs->lock); 562 read_unlock(&fs->lock);
553 return 1; 563 return 1;
554} 564}
@@ -561,7 +571,7 @@ static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *l
561 goto fail; 571 goto fail;
562 572
563 if (*link == '/') { 573 if (*link == '/') {
564 path_release(nd); 574 path_put(&nd->path);
565 if (!walk_init_root(link, nd)) 575 if (!walk_init_root(link, nd))
566 /* weird __emul_prefix() stuff did it */ 576 /* weird __emul_prefix() stuff did it */
567 goto out; 577 goto out;
@@ -577,31 +587,31 @@ out:
577 */ 587 */
578 name = __getname(); 588 name = __getname();
579 if (unlikely(!name)) { 589 if (unlikely(!name)) {
580 path_release(nd); 590 path_put(&nd->path);
581 return -ENOMEM; 591 return -ENOMEM;
582 } 592 }
583 strcpy(name, nd->last.name); 593 strcpy(name, nd->last.name);
584 nd->last.name = name; 594 nd->last.name = name;
585 return 0; 595 return 0;
586fail: 596fail:
587 path_release(nd); 597 path_put(&nd->path);
588 return PTR_ERR(link); 598 return PTR_ERR(link);
589} 599}
590 600
591static inline void dput_path(struct path *path, struct nameidata *nd) 601static void path_put_conditional(struct path *path, struct nameidata *nd)
592{ 602{
593 dput(path->dentry); 603 dput(path->dentry);
594 if (path->mnt != nd->mnt) 604 if (path->mnt != nd->path.mnt)
595 mntput(path->mnt); 605 mntput(path->mnt);
596} 606}
597 607
598static inline void path_to_nameidata(struct path *path, struct nameidata *nd) 608static inline void path_to_nameidata(struct path *path, struct nameidata *nd)
599{ 609{
600 dput(nd->dentry); 610 dput(nd->path.dentry);
601 if (nd->mnt != path->mnt) 611 if (nd->path.mnt != path->mnt)
602 mntput(nd->mnt); 612 mntput(nd->path.mnt);
603 nd->mnt = path->mnt; 613 nd->path.mnt = path->mnt;
604 nd->dentry = path->dentry; 614 nd->path.dentry = path->dentry;
605} 615}
606 616
607static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd) 617static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd)
@@ -613,7 +623,7 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
613 touch_atime(path->mnt, dentry); 623 touch_atime(path->mnt, dentry);
614 nd_set_link(nd, NULL); 624 nd_set_link(nd, NULL);
615 625
616 if (path->mnt != nd->mnt) { 626 if (path->mnt != nd->path.mnt) {
617 path_to_nameidata(path, nd); 627 path_to_nameidata(path, nd);
618 dget(dentry); 628 dget(dentry);
619 } 629 }
@@ -628,8 +638,7 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
628 if (dentry->d_inode->i_op->put_link) 638 if (dentry->d_inode->i_op->put_link)
629 dentry->d_inode->i_op->put_link(dentry, nd, cookie); 639 dentry->d_inode->i_op->put_link(dentry, nd, cookie);
630 } 640 }
631 dput(dentry); 641 path_put(path);
632 mntput(path->mnt);
633 642
634 return error; 643 return error;
635} 644}
@@ -661,8 +670,8 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
661 nd->depth--; 670 nd->depth--;
662 return err; 671 return err;
663loop: 672loop:
664 dput_path(path, nd); 673 path_put_conditional(path, nd);
665 path_release(nd); 674 path_put(&nd->path);
666 return err; 675 return err;
667} 676}
668 677
@@ -743,37 +752,37 @@ static __always_inline void follow_dotdot(struct nameidata *nd)
743 752
744 while(1) { 753 while(1) {
745 struct vfsmount *parent; 754 struct vfsmount *parent;
746 struct dentry *old = nd->dentry; 755 struct dentry *old = nd->path.dentry;
747 756
748 read_lock(&fs->lock); 757 read_lock(&fs->lock);
749 if (nd->dentry == fs->root && 758 if (nd->path.dentry == fs->root.dentry &&
750 nd->mnt == fs->rootmnt) { 759 nd->path.mnt == fs->root.mnt) {
751 read_unlock(&fs->lock); 760 read_unlock(&fs->lock);
752 break; 761 break;
753 } 762 }
754 read_unlock(&fs->lock); 763 read_unlock(&fs->lock);
755 spin_lock(&dcache_lock); 764 spin_lock(&dcache_lock);
756 if (nd->dentry != nd->mnt->mnt_root) { 765 if (nd->path.dentry != nd->path.mnt->mnt_root) {
757 nd->dentry = dget(nd->dentry->d_parent); 766 nd->path.dentry = dget(nd->path.dentry->d_parent);
758 spin_unlock(&dcache_lock); 767 spin_unlock(&dcache_lock);
759 dput(old); 768 dput(old);
760 break; 769 break;
761 } 770 }
762 spin_unlock(&dcache_lock); 771 spin_unlock(&dcache_lock);
763 spin_lock(&vfsmount_lock); 772 spin_lock(&vfsmount_lock);
764 parent = nd->mnt->mnt_parent; 773 parent = nd->path.mnt->mnt_parent;
765 if (parent == nd->mnt) { 774 if (parent == nd->path.mnt) {
766 spin_unlock(&vfsmount_lock); 775 spin_unlock(&vfsmount_lock);
767 break; 776 break;
768 } 777 }
769 mntget(parent); 778 mntget(parent);
770 nd->dentry = dget(nd->mnt->mnt_mountpoint); 779 nd->path.dentry = dget(nd->path.mnt->mnt_mountpoint);
771 spin_unlock(&vfsmount_lock); 780 spin_unlock(&vfsmount_lock);
772 dput(old); 781 dput(old);
773 mntput(nd->mnt); 782 mntput(nd->path.mnt);
774 nd->mnt = parent; 783 nd->path.mnt = parent;
775 } 784 }
776 follow_mount(&nd->mnt, &nd->dentry); 785 follow_mount(&nd->path.mnt, &nd->path.dentry);
777} 786}
778 787
779/* 788/*
@@ -784,8 +793,8 @@ static __always_inline void follow_dotdot(struct nameidata *nd)
784static int do_lookup(struct nameidata *nd, struct qstr *name, 793static int do_lookup(struct nameidata *nd, struct qstr *name,
785 struct path *path) 794 struct path *path)
786{ 795{
787 struct vfsmount *mnt = nd->mnt; 796 struct vfsmount *mnt = nd->path.mnt;
788 struct dentry *dentry = __d_lookup(nd->dentry, name); 797 struct dentry *dentry = __d_lookup(nd->path.dentry, name);
789 798
790 if (!dentry) 799 if (!dentry)
791 goto need_lookup; 800 goto need_lookup;
@@ -798,7 +807,7 @@ done:
798 return 0; 807 return 0;
799 808
800need_lookup: 809need_lookup:
801 dentry = real_lookup(nd->dentry, name, nd); 810 dentry = real_lookup(nd->path.dentry, name, nd);
802 if (IS_ERR(dentry)) 811 if (IS_ERR(dentry))
803 goto fail; 812 goto fail;
804 goto done; 813 goto done;
@@ -835,7 +844,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
835 if (!*name) 844 if (!*name)
836 goto return_reval; 845 goto return_reval;
837 846
838 inode = nd->dentry->d_inode; 847 inode = nd->path.dentry->d_inode;
839 if (nd->depth) 848 if (nd->depth)
840 lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE); 849 lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE);
841 850
@@ -883,7 +892,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
883 if (this.name[1] != '.') 892 if (this.name[1] != '.')
884 break; 893 break;
885 follow_dotdot(nd); 894 follow_dotdot(nd);
886 inode = nd->dentry->d_inode; 895 inode = nd->path.dentry->d_inode;
887 /* fallthrough */ 896 /* fallthrough */
888 case 1: 897 case 1:
889 continue; 898 continue;
@@ -892,8 +901,9 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
892 * See if the low-level filesystem might want 901 * See if the low-level filesystem might want
893 * to use its own hash.. 902 * to use its own hash..
894 */ 903 */
895 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { 904 if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) {
896 err = nd->dentry->d_op->d_hash(nd->dentry, &this); 905 err = nd->path.dentry->d_op->d_hash(nd->path.dentry,
906 &this);
897 if (err < 0) 907 if (err < 0)
898 break; 908 break;
899 } 909 }
@@ -915,7 +925,7 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
915 if (err) 925 if (err)
916 goto return_err; 926 goto return_err;
917 err = -ENOENT; 927 err = -ENOENT;
918 inode = nd->dentry->d_inode; 928 inode = nd->path.dentry->d_inode;
919 if (!inode) 929 if (!inode)
920 break; 930 break;
921 err = -ENOTDIR; 931 err = -ENOTDIR;
@@ -943,13 +953,14 @@ last_component:
943 if (this.name[1] != '.') 953 if (this.name[1] != '.')
944 break; 954 break;
945 follow_dotdot(nd); 955 follow_dotdot(nd);
946 inode = nd->dentry->d_inode; 956 inode = nd->path.dentry->d_inode;
947 /* fallthrough */ 957 /* fallthrough */
948 case 1: 958 case 1:
949 goto return_reval; 959 goto return_reval;
950 } 960 }
951 if (nd->dentry->d_op && nd->dentry->d_op->d_hash) { 961 if (nd->path.dentry->d_op && nd->path.dentry->d_op->d_hash) {
952 err = nd->dentry->d_op->d_hash(nd->dentry, &this); 962 err = nd->path.dentry->d_op->d_hash(nd->path.dentry,
963 &this);
953 if (err < 0) 964 if (err < 0)
954 break; 965 break;
955 } 966 }
@@ -962,7 +973,7 @@ last_component:
962 err = do_follow_link(&next, nd); 973 err = do_follow_link(&next, nd);
963 if (err) 974 if (err)
964 goto return_err; 975 goto return_err;
965 inode = nd->dentry->d_inode; 976 inode = nd->path.dentry->d_inode;
966 } else 977 } else
967 path_to_nameidata(&next, nd); 978 path_to_nameidata(&next, nd);
968 err = -ENOENT; 979 err = -ENOENT;
@@ -990,20 +1001,21 @@ return_reval:
990 * We bypassed the ordinary revalidation routines. 1001 * We bypassed the ordinary revalidation routines.
991 * We may need to check the cached dentry for staleness. 1002 * We may need to check the cached dentry for staleness.
992 */ 1003 */
993 if (nd->dentry && nd->dentry->d_sb && 1004 if (nd->path.dentry && nd->path.dentry->d_sb &&
994 (nd->dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) { 1005 (nd->path.dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT)) {
995 err = -ESTALE; 1006 err = -ESTALE;
996 /* Note: we do not d_invalidate() */ 1007 /* Note: we do not d_invalidate() */
997 if (!nd->dentry->d_op->d_revalidate(nd->dentry, nd)) 1008 if (!nd->path.dentry->d_op->d_revalidate(
1009 nd->path.dentry, nd))
998 break; 1010 break;
999 } 1011 }
1000return_base: 1012return_base:
1001 return 0; 1013 return 0;
1002out_dput: 1014out_dput:
1003 dput_path(&next, nd); 1015 path_put_conditional(&next, nd);
1004 break; 1016 break;
1005 } 1017 }
1006 path_release(nd); 1018 path_put(&nd->path);
1007return_err: 1019return_err:
1008 return err; 1020 return err;
1009} 1021}
@@ -1021,20 +1033,19 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1021 int result; 1033 int result;
1022 1034
1023 /* make sure the stuff we saved doesn't go away */ 1035 /* make sure the stuff we saved doesn't go away */
1024 dget(save.dentry); 1036 dget(save.path.dentry);
1025 mntget(save.mnt); 1037 mntget(save.path.mnt);
1026 1038
1027 result = __link_path_walk(name, nd); 1039 result = __link_path_walk(name, nd);
1028 if (result == -ESTALE) { 1040 if (result == -ESTALE) {
1029 *nd = save; 1041 *nd = save;
1030 dget(nd->dentry); 1042 dget(nd->path.dentry);
1031 mntget(nd->mnt); 1043 mntget(nd->path.mnt);
1032 nd->flags |= LOOKUP_REVAL; 1044 nd->flags |= LOOKUP_REVAL;
1033 result = __link_path_walk(name, nd); 1045 result = __link_path_walk(name, nd);
1034 } 1046 }
1035 1047
1036 dput(save.dentry); 1048 path_put(&save.path);
1037 mntput(save.mnt);
1038 1049
1039 return result; 1050 return result;
1040} 1051}
@@ -1054,9 +1065,9 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1054 if (path_walk(name, nd)) 1065 if (path_walk(name, nd))
1055 return 0; /* something went wrong... */ 1066 return 0; /* something went wrong... */
1056 1067
1057 if (!nd->dentry->d_inode || S_ISDIR(nd->dentry->d_inode->i_mode)) { 1068 if (!nd->path.dentry->d_inode ||
1058 struct dentry *old_dentry = nd->dentry; 1069 S_ISDIR(nd->path.dentry->d_inode->i_mode)) {
1059 struct vfsmount *old_mnt = nd->mnt; 1070 struct path old_path = nd->path;
1060 struct qstr last = nd->last; 1071 struct qstr last = nd->last;
1061 int last_type = nd->last_type; 1072 int last_type = nd->last_type;
1062 struct fs_struct *fs = current->fs; 1073 struct fs_struct *fs = current->fs;
@@ -1067,19 +1078,17 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
1067 */ 1078 */
1068 nd->last_type = LAST_ROOT; 1079 nd->last_type = LAST_ROOT;
1069 read_lock(&fs->lock); 1080 read_lock(&fs->lock);
1070 nd->mnt = mntget(fs->rootmnt); 1081 nd->path = fs->root;
1071 nd->dentry = dget(fs->root); 1082 path_get(&fs->root);
1072 read_unlock(&fs->lock); 1083 read_unlock(&fs->lock);
1073 if (path_walk(name, nd) == 0) { 1084 if (path_walk(name, nd) == 0) {
1074 if (nd->dentry->d_inode) { 1085 if (nd->path.dentry->d_inode) {
1075 dput(old_dentry); 1086 path_put(&old_path);
1076 mntput(old_mnt);
1077 return 1; 1087 return 1;
1078 } 1088 }
1079 path_release(nd); 1089 path_put(&nd->path);
1080 } 1090 }
1081 nd->dentry = old_dentry; 1091 nd->path = old_path;
1082 nd->mnt = old_mnt;
1083 nd->last = last; 1092 nd->last = last;
1084 nd->last_type = last_type; 1093 nd->last_type = last_type;
1085 } 1094 }
@@ -1090,29 +1099,22 @@ void set_fs_altroot(void)
1090{ 1099{
1091 char *emul = __emul_prefix(); 1100 char *emul = __emul_prefix();
1092 struct nameidata nd; 1101 struct nameidata nd;
1093 struct vfsmount *mnt = NULL, *oldmnt; 1102 struct path path = {}, old_path;
1094 struct dentry *dentry = NULL, *olddentry;
1095 int err; 1103 int err;
1096 struct fs_struct *fs = current->fs; 1104 struct fs_struct *fs = current->fs;
1097 1105
1098 if (!emul) 1106 if (!emul)
1099 goto set_it; 1107 goto set_it;
1100 err = path_lookup(emul, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_NOALT, &nd); 1108 err = path_lookup(emul, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_NOALT, &nd);
1101 if (!err) { 1109 if (!err)
1102 mnt = nd.mnt; 1110 path = nd.path;
1103 dentry = nd.dentry;
1104 }
1105set_it: 1111set_it:
1106 write_lock(&fs->lock); 1112 write_lock(&fs->lock);
1107 oldmnt = fs->altrootmnt; 1113 old_path = fs->altroot;
1108 olddentry = fs->altroot; 1114 fs->altroot = path;
1109 fs->altrootmnt = mnt;
1110 fs->altroot = dentry;
1111 write_unlock(&fs->lock); 1115 write_unlock(&fs->lock);
1112 if (olddentry) { 1116 if (old_path.dentry)
1113 dput(olddentry); 1117 path_put(&old_path);
1114 mntput(oldmnt);
1115 }
1116} 1118}
1117 1119
1118/* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ 1120/* Returns 0 and nd will be valid on success; Retuns error, otherwise. */
@@ -1130,21 +1132,21 @@ static int do_path_lookup(int dfd, const char *name,
1130 1132
1131 if (*name=='/') { 1133 if (*name=='/') {
1132 read_lock(&fs->lock); 1134 read_lock(&fs->lock);
1133 if (fs->altroot && !(nd->flags & LOOKUP_NOALT)) { 1135 if (fs->altroot.dentry && !(nd->flags & LOOKUP_NOALT)) {
1134 nd->mnt = mntget(fs->altrootmnt); 1136 nd->path = fs->altroot;
1135 nd->dentry = dget(fs->altroot); 1137 path_get(&fs->altroot);
1136 read_unlock(&fs->lock); 1138 read_unlock(&fs->lock);
1137 if (__emul_lookup_dentry(name,nd)) 1139 if (__emul_lookup_dentry(name,nd))
1138 goto out; /* found in altroot */ 1140 goto out; /* found in altroot */
1139 read_lock(&fs->lock); 1141 read_lock(&fs->lock);
1140 } 1142 }
1141 nd->mnt = mntget(fs->rootmnt); 1143 nd->path = fs->root;
1142 nd->dentry = dget(fs->root); 1144 path_get(&fs->root);
1143 read_unlock(&fs->lock); 1145 read_unlock(&fs->lock);
1144 } else if (dfd == AT_FDCWD) { 1146 } else if (dfd == AT_FDCWD) {
1145 read_lock(&fs->lock); 1147 read_lock(&fs->lock);
1146 nd->mnt = mntget(fs->pwdmnt); 1148 nd->path = fs->pwd;
1147 nd->dentry = dget(fs->pwd); 1149 path_get(&fs->pwd);
1148 read_unlock(&fs->lock); 1150 read_unlock(&fs->lock);
1149 } else { 1151 } else {
1150 struct dentry *dentry; 1152 struct dentry *dentry;
@@ -1164,17 +1166,17 @@ static int do_path_lookup(int dfd, const char *name,
1164 if (retval) 1166 if (retval)
1165 goto fput_fail; 1167 goto fput_fail;
1166 1168
1167 nd->mnt = mntget(file->f_path.mnt); 1169 nd->path = file->f_path;
1168 nd->dentry = dget(dentry); 1170 path_get(&file->f_path);
1169 1171
1170 fput_light(file, fput_needed); 1172 fput_light(file, fput_needed);
1171 } 1173 }
1172 1174
1173 retval = path_walk(name, nd); 1175 retval = path_walk(name, nd);
1174out: 1176out:
1175 if (unlikely(!retval && !audit_dummy_context() && nd->dentry && 1177 if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry &&
1176 nd->dentry->d_inode)) 1178 nd->path.dentry->d_inode))
1177 audit_inode(name, nd->dentry); 1179 audit_inode(name, nd->path.dentry);
1178out_fail: 1180out_fail:
1179 return retval; 1181 return retval;
1180 1182
@@ -1208,13 +1210,13 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
1208 nd->flags = flags; 1210 nd->flags = flags;
1209 nd->depth = 0; 1211 nd->depth = 0;
1210 1212
1211 nd->mnt = mntget(mnt); 1213 nd->path.mnt = mntget(mnt);
1212 nd->dentry = dget(dentry); 1214 nd->path.dentry = dget(dentry);
1213 1215
1214 retval = path_walk(name, nd); 1216 retval = path_walk(name, nd);
1215 if (unlikely(!retval && !audit_dummy_context() && nd->dentry && 1217 if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry &&
1216 nd->dentry->d_inode)) 1218 nd->path.dentry->d_inode))
1217 audit_inode(name, nd->dentry); 1219 audit_inode(name, nd->path.dentry);
1218 1220
1219 return retval; 1221 return retval;
1220 1222
@@ -1236,7 +1238,7 @@ static int __path_lookup_intent_open(int dfd, const char *name,
1236 if (IS_ERR(nd->intent.open.file)) { 1238 if (IS_ERR(nd->intent.open.file)) {
1237 if (err == 0) { 1239 if (err == 0) {
1238 err = PTR_ERR(nd->intent.open.file); 1240 err = PTR_ERR(nd->intent.open.file);
1239 path_release(nd); 1241 path_put(&nd->path);
1240 } 1242 }
1241 } else if (err != 0) 1243 } else if (err != 0)
1242 release_open_intent(nd); 1244 release_open_intent(nd);
@@ -1333,10 +1335,10 @@ static struct dentry *lookup_hash(struct nameidata *nd)
1333{ 1335{
1334 int err; 1336 int err;
1335 1337
1336 err = permission(nd->dentry->d_inode, MAY_EXEC, nd); 1338 err = permission(nd->path.dentry->d_inode, MAY_EXEC, nd);
1337 if (err) 1339 if (err)
1338 return ERR_PTR(err); 1340 return ERR_PTR(err);
1339 return __lookup_hash(&nd->last, nd->dentry, nd); 1341 return __lookup_hash(&nd->last, nd->path.dentry, nd);
1340} 1342}
1341 1343
1342static int __lookup_one_len(const char *name, struct qstr *this, 1344static int __lookup_one_len(const char *name, struct qstr *this,
@@ -1595,7 +1597,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
1595 1597
1596int may_open(struct nameidata *nd, int acc_mode, int flag) 1598int may_open(struct nameidata *nd, int acc_mode, int flag)
1597{ 1599{
1598 struct dentry *dentry = nd->dentry; 1600 struct dentry *dentry = nd->path.dentry;
1599 struct inode *inode = dentry->d_inode; 1601 struct inode *inode = dentry->d_inode;
1600 int error; 1602 int error;
1601 1603
@@ -1616,7 +1618,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1616 if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { 1618 if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
1617 flag &= ~O_TRUNC; 1619 flag &= ~O_TRUNC;
1618 } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { 1620 } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
1619 if (nd->mnt->mnt_flags & MNT_NODEV) 1621 if (nd->path.mnt->mnt_flags & MNT_NODEV)
1620 return -EACCES; 1622 return -EACCES;
1621 1623
1622 flag &= ~O_TRUNC; 1624 flag &= ~O_TRUNC;
@@ -1678,14 +1680,14 @@ static int open_namei_create(struct nameidata *nd, struct path *path,
1678 int flag, int mode) 1680 int flag, int mode)
1679{ 1681{
1680 int error; 1682 int error;
1681 struct dentry *dir = nd->dentry; 1683 struct dentry *dir = nd->path.dentry;
1682 1684
1683 if (!IS_POSIXACL(dir->d_inode)) 1685 if (!IS_POSIXACL(dir->d_inode))
1684 mode &= ~current->fs->umask; 1686 mode &= ~current->fs->umask;
1685 error = vfs_create(dir->d_inode, path->dentry, mode, nd); 1687 error = vfs_create(dir->d_inode, path->dentry, mode, nd);
1686 mutex_unlock(&dir->d_inode->i_mutex); 1688 mutex_unlock(&dir->d_inode->i_mutex);
1687 dput(nd->dentry); 1689 dput(nd->path.dentry);
1688 nd->dentry = path->dentry; 1690 nd->path.dentry = path->dentry;
1689 if (error) 1691 if (error)
1690 return error; 1692 return error;
1691 /* Don't check for write permission, don't truncate */ 1693 /* Don't check for write permission, don't truncate */
@@ -1752,11 +1754,11 @@ int open_namei(int dfd, const char *pathname, int flag,
1752 if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len]) 1754 if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len])
1753 goto exit; 1755 goto exit;
1754 1756
1755 dir = nd->dentry; 1757 dir = nd->path.dentry;
1756 nd->flags &= ~LOOKUP_PARENT; 1758 nd->flags &= ~LOOKUP_PARENT;
1757 mutex_lock(&dir->d_inode->i_mutex); 1759 mutex_lock(&dir->d_inode->i_mutex);
1758 path.dentry = lookup_hash(nd); 1760 path.dentry = lookup_hash(nd);
1759 path.mnt = nd->mnt; 1761 path.mnt = nd->path.mnt;
1760 1762
1761do_last: 1763do_last:
1762 error = PTR_ERR(path.dentry); 1764 error = PTR_ERR(path.dentry);
@@ -1812,11 +1814,11 @@ ok:
1812 return 0; 1814 return 0;
1813 1815
1814exit_dput: 1816exit_dput:
1815 dput_path(&path, nd); 1817 path_put_conditional(&path, nd);
1816exit: 1818exit:
1817 if (!IS_ERR(nd->intent.open.file)) 1819 if (!IS_ERR(nd->intent.open.file))
1818 release_open_intent(nd); 1820 release_open_intent(nd);
1819 path_release(nd); 1821 path_put(&nd->path);
1820 return error; 1822 return error;
1821 1823
1822do_link: 1824do_link:
@@ -1861,10 +1863,10 @@ do_link:
1861 __putname(nd->last.name); 1863 __putname(nd->last.name);
1862 goto exit; 1864 goto exit;
1863 } 1865 }
1864 dir = nd->dentry; 1866 dir = nd->path.dentry;
1865 mutex_lock(&dir->d_inode->i_mutex); 1867 mutex_lock(&dir->d_inode->i_mutex);
1866 path.dentry = lookup_hash(nd); 1868 path.dentry = lookup_hash(nd);
1867 path.mnt = nd->mnt; 1869 path.mnt = nd->path.mnt;
1868 __putname(nd->last.name); 1870 __putname(nd->last.name);
1869 goto do_last; 1871 goto do_last;
1870} 1872}
@@ -1877,13 +1879,13 @@ do_link:
1877 * Simple function to lookup and return a dentry and create it 1879 * Simple function to lookup and return a dentry and create it
1878 * if it doesn't exist. Is SMP-safe. 1880 * if it doesn't exist. Is SMP-safe.
1879 * 1881 *
1880 * Returns with nd->dentry->d_inode->i_mutex locked. 1882 * Returns with nd->path.dentry->d_inode->i_mutex locked.
1881 */ 1883 */
1882struct dentry *lookup_create(struct nameidata *nd, int is_dir) 1884struct dentry *lookup_create(struct nameidata *nd, int is_dir)
1883{ 1885{
1884 struct dentry *dentry = ERR_PTR(-EEXIST); 1886 struct dentry *dentry = ERR_PTR(-EEXIST);
1885 1887
1886 mutex_lock_nested(&nd->dentry->d_inode->i_mutex, I_MUTEX_PARENT); 1888 mutex_lock_nested(&nd->path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
1887 /* 1889 /*
1888 * Yucky last component or no last component at all? 1890 * Yucky last component or no last component at all?
1889 * (foo/., foo/.., /////) 1891 * (foo/., foo/.., /////)
@@ -1962,19 +1964,19 @@ asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
1962 dentry = lookup_create(&nd, 0); 1964 dentry = lookup_create(&nd, 0);
1963 error = PTR_ERR(dentry); 1965 error = PTR_ERR(dentry);
1964 1966
1965 if (!IS_POSIXACL(nd.dentry->d_inode)) 1967 if (!IS_POSIXACL(nd.path.dentry->d_inode))
1966 mode &= ~current->fs->umask; 1968 mode &= ~current->fs->umask;
1967 if (!IS_ERR(dentry)) { 1969 if (!IS_ERR(dentry)) {
1968 switch (mode & S_IFMT) { 1970 switch (mode & S_IFMT) {
1969 case 0: case S_IFREG: 1971 case 0: case S_IFREG:
1970 error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd); 1972 error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);
1971 break; 1973 break;
1972 case S_IFCHR: case S_IFBLK: 1974 case S_IFCHR: case S_IFBLK:
1973 error = vfs_mknod(nd.dentry->d_inode,dentry,mode, 1975 error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,
1974 new_decode_dev(dev)); 1976 new_decode_dev(dev));
1975 break; 1977 break;
1976 case S_IFIFO: case S_IFSOCK: 1978 case S_IFIFO: case S_IFSOCK:
1977 error = vfs_mknod(nd.dentry->d_inode,dentry,mode,0); 1979 error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,0);
1978 break; 1980 break;
1979 case S_IFDIR: 1981 case S_IFDIR:
1980 error = -EPERM; 1982 error = -EPERM;
@@ -1984,8 +1986,8 @@ asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
1984 } 1986 }
1985 dput(dentry); 1987 dput(dentry);
1986 } 1988 }
1987 mutex_unlock(&nd.dentry->d_inode->i_mutex); 1989 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
1988 path_release(&nd); 1990 path_put(&nd.path);
1989out: 1991out:
1990 putname(tmp); 1992 putname(tmp);
1991 1993
@@ -2039,13 +2041,13 @@ asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode)
2039 if (IS_ERR(dentry)) 2041 if (IS_ERR(dentry))
2040 goto out_unlock; 2042 goto out_unlock;
2041 2043
2042 if (!IS_POSIXACL(nd.dentry->d_inode)) 2044 if (!IS_POSIXACL(nd.path.dentry->d_inode))
2043 mode &= ~current->fs->umask; 2045 mode &= ~current->fs->umask;
2044 error = vfs_mkdir(nd.dentry->d_inode, dentry, mode); 2046 error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode);
2045 dput(dentry); 2047 dput(dentry);
2046out_unlock: 2048out_unlock:
2047 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2049 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2048 path_release(&nd); 2050 path_put(&nd.path);
2049out: 2051out:
2050 putname(tmp); 2052 putname(tmp);
2051out_err: 2053out_err:
@@ -2143,17 +2145,17 @@ static long do_rmdir(int dfd, const char __user *pathname)
2143 error = -EBUSY; 2145 error = -EBUSY;
2144 goto exit1; 2146 goto exit1;
2145 } 2147 }
2146 mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2148 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
2147 dentry = lookup_hash(&nd); 2149 dentry = lookup_hash(&nd);
2148 error = PTR_ERR(dentry); 2150 error = PTR_ERR(dentry);
2149 if (IS_ERR(dentry)) 2151 if (IS_ERR(dentry))
2150 goto exit2; 2152 goto exit2;
2151 error = vfs_rmdir(nd.dentry->d_inode, dentry); 2153 error = vfs_rmdir(nd.path.dentry->d_inode, dentry);
2152 dput(dentry); 2154 dput(dentry);
2153exit2: 2155exit2:
2154 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2156 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2155exit1: 2157exit1:
2156 path_release(&nd); 2158 path_put(&nd.path);
2157exit: 2159exit:
2158 putname(name); 2160 putname(name);
2159 return error; 2161 return error;
@@ -2219,7 +2221,7 @@ static long do_unlinkat(int dfd, const char __user *pathname)
2219 error = -EISDIR; 2221 error = -EISDIR;
2220 if (nd.last_type != LAST_NORM) 2222 if (nd.last_type != LAST_NORM)
2221 goto exit1; 2223 goto exit1;
2222 mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); 2224 mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
2223 dentry = lookup_hash(&nd); 2225 dentry = lookup_hash(&nd);
2224 error = PTR_ERR(dentry); 2226 error = PTR_ERR(dentry);
2225 if (!IS_ERR(dentry)) { 2227 if (!IS_ERR(dentry)) {
@@ -2229,15 +2231,15 @@ static long do_unlinkat(int dfd, const char __user *pathname)
2229 inode = dentry->d_inode; 2231 inode = dentry->d_inode;
2230 if (inode) 2232 if (inode)
2231 atomic_inc(&inode->i_count); 2233 atomic_inc(&inode->i_count);
2232 error = vfs_unlink(nd.dentry->d_inode, dentry); 2234 error = vfs_unlink(nd.path.dentry->d_inode, dentry);
2233 exit2: 2235 exit2:
2234 dput(dentry); 2236 dput(dentry);
2235 } 2237 }
2236 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2238 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2237 if (inode) 2239 if (inode)
2238 iput(inode); /* truncate the inode here */ 2240 iput(inode); /* truncate the inode here */
2239exit1: 2241exit1:
2240 path_release(&nd); 2242 path_put(&nd.path);
2241exit: 2243exit:
2242 putname(name); 2244 putname(name);
2243 return error; 2245 return error;
@@ -2310,11 +2312,11 @@ asmlinkage long sys_symlinkat(const char __user *oldname,
2310 if (IS_ERR(dentry)) 2312 if (IS_ERR(dentry))
2311 goto out_unlock; 2313 goto out_unlock;
2312 2314
2313 error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO); 2315 error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO);
2314 dput(dentry); 2316 dput(dentry);
2315out_unlock: 2317out_unlock:
2316 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2318 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2317 path_release(&nd); 2319 path_put(&nd.path);
2318out: 2320out:
2319 putname(to); 2321 putname(to);
2320out_putname: 2322out_putname:
@@ -2399,20 +2401,20 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
2399 if (error) 2401 if (error)
2400 goto out; 2402 goto out;
2401 error = -EXDEV; 2403 error = -EXDEV;
2402 if (old_nd.mnt != nd.mnt) 2404 if (old_nd.path.mnt != nd.path.mnt)
2403 goto out_release; 2405 goto out_release;
2404 new_dentry = lookup_create(&nd, 0); 2406 new_dentry = lookup_create(&nd, 0);
2405 error = PTR_ERR(new_dentry); 2407 error = PTR_ERR(new_dentry);
2406 if (IS_ERR(new_dentry)) 2408 if (IS_ERR(new_dentry))
2407 goto out_unlock; 2409 goto out_unlock;
2408 error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); 2410 error = vfs_link(old_nd.path.dentry, nd.path.dentry->d_inode, new_dentry);
2409 dput(new_dentry); 2411 dput(new_dentry);
2410out_unlock: 2412out_unlock:
2411 mutex_unlock(&nd.dentry->d_inode->i_mutex); 2413 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
2412out_release: 2414out_release:
2413 path_release(&nd); 2415 path_put(&nd.path);
2414out: 2416out:
2415 path_release(&old_nd); 2417 path_put(&old_nd.path);
2416exit: 2418exit:
2417 putname(to); 2419 putname(to);
2418 2420
@@ -2588,15 +2590,15 @@ static int do_rename(int olddfd, const char *oldname,
2588 goto exit1; 2590 goto exit1;
2589 2591
2590 error = -EXDEV; 2592 error = -EXDEV;
2591 if (oldnd.mnt != newnd.mnt) 2593 if (oldnd.path.mnt != newnd.path.mnt)
2592 goto exit2; 2594 goto exit2;
2593 2595
2594 old_dir = oldnd.dentry; 2596 old_dir = oldnd.path.dentry;
2595 error = -EBUSY; 2597 error = -EBUSY;
2596 if (oldnd.last_type != LAST_NORM) 2598 if (oldnd.last_type != LAST_NORM)
2597 goto exit2; 2599 goto exit2;
2598 2600
2599 new_dir = newnd.dentry; 2601 new_dir = newnd.path.dentry;
2600 if (newnd.last_type != LAST_NORM) 2602 if (newnd.last_type != LAST_NORM)
2601 goto exit2; 2603 goto exit2;
2602 2604
@@ -2640,9 +2642,9 @@ exit4:
2640exit3: 2642exit3:
2641 unlock_rename(new_dir, old_dir); 2643 unlock_rename(new_dir, old_dir);
2642exit2: 2644exit2:
2643 path_release(&newnd); 2645 path_put(&newnd.path);
2644exit1: 2646exit1:
2645 path_release(&oldnd); 2647 path_put(&oldnd.path);
2646exit: 2648exit:
2647 return error; 2649 return error;
2648} 2650}
@@ -2816,7 +2818,6 @@ EXPORT_SYMBOL(page_symlink);
2816EXPORT_SYMBOL(page_symlink_inode_operations); 2818EXPORT_SYMBOL(page_symlink_inode_operations);
2817EXPORT_SYMBOL(path_lookup); 2819EXPORT_SYMBOL(path_lookup);
2818EXPORT_SYMBOL(vfs_path_lookup); 2820EXPORT_SYMBOL(vfs_path_lookup);
2819EXPORT_SYMBOL(path_release);
2820EXPORT_SYMBOL(permission); 2821EXPORT_SYMBOL(permission);
2821EXPORT_SYMBOL(vfs_permission); 2822EXPORT_SYMBOL(vfs_permission);
2822EXPORT_SYMBOL(file_permission); 2823EXPORT_SYMBOL(file_permission);
diff --git a/fs/namespace.c b/fs/namespace.c
index 63ced21c12dc..7953c96a2071 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -157,13 +157,13 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns)
157 157
158static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd) 158static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd)
159{ 159{
160 old_nd->dentry = mnt->mnt_mountpoint; 160 old_nd->path.dentry = mnt->mnt_mountpoint;
161 old_nd->mnt = mnt->mnt_parent; 161 old_nd->path.mnt = mnt->mnt_parent;
162 mnt->mnt_parent = mnt; 162 mnt->mnt_parent = mnt;
163 mnt->mnt_mountpoint = mnt->mnt_root; 163 mnt->mnt_mountpoint = mnt->mnt_root;
164 list_del_init(&mnt->mnt_child); 164 list_del_init(&mnt->mnt_child);
165 list_del_init(&mnt->mnt_hash); 165 list_del_init(&mnt->mnt_hash);
166 old_nd->dentry->d_mounted--; 166 old_nd->path.dentry->d_mounted--;
167} 167}
168 168
169void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry, 169void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
@@ -176,10 +176,10 @@ void mnt_set_mountpoint(struct vfsmount *mnt, struct dentry *dentry,
176 176
177static void attach_mnt(struct vfsmount *mnt, struct nameidata *nd) 177static void attach_mnt(struct vfsmount *mnt, struct nameidata *nd)
178{ 178{
179 mnt_set_mountpoint(nd->mnt, nd->dentry, mnt); 179 mnt_set_mountpoint(nd->path.mnt, nd->path.dentry, mnt);
180 list_add_tail(&mnt->mnt_hash, mount_hashtable + 180 list_add_tail(&mnt->mnt_hash, mount_hashtable +
181 hash(nd->mnt, nd->dentry)); 181 hash(nd->path.mnt, nd->path.dentry));
182 list_add_tail(&mnt->mnt_child, &nd->mnt->mnt_mounts); 182 list_add_tail(&mnt->mnt_child, &nd->path.mnt->mnt_mounts);
183} 183}
184 184
185/* 185/*
@@ -408,10 +408,11 @@ static int show_vfsmnt(struct seq_file *m, void *v)
408 { 0, NULL } 408 { 0, NULL }
409 }; 409 };
410 struct proc_fs_info *fs_infop; 410 struct proc_fs_info *fs_infop;
411 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
411 412
412 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none"); 413 mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
413 seq_putc(m, ' '); 414 seq_putc(m, ' ');
414 seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); 415 seq_path(m, &mnt_path, " \t\n\\");
415 seq_putc(m, ' '); 416 seq_putc(m, ' ');
416 mangle(m, mnt->mnt_sb->s_type->name); 417 mangle(m, mnt->mnt_sb->s_type->name);
417 if (mnt->mnt_sb->s_subtype && mnt->mnt_sb->s_subtype[0]) { 418 if (mnt->mnt_sb->s_subtype && mnt->mnt_sb->s_subtype[0]) {
@@ -443,6 +444,7 @@ struct seq_operations mounts_op = {
443static int show_vfsstat(struct seq_file *m, void *v) 444static int show_vfsstat(struct seq_file *m, void *v)
444{ 445{
445 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list); 446 struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
447 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
446 int err = 0; 448 int err = 0;
447 449
448 /* device */ 450 /* device */
@@ -454,7 +456,7 @@ static int show_vfsstat(struct seq_file *m, void *v)
454 456
455 /* mount point */ 457 /* mount point */
456 seq_puts(m, " mounted on "); 458 seq_puts(m, " mounted on ");
457 seq_path(m, mnt, mnt->mnt_root, " \t\n\\"); 459 seq_path(m, &mnt_path, " \t\n\\");
458 seq_putc(m, ' '); 460 seq_putc(m, ' ');
459 461
460 /* file system type */ 462 /* file system type */
@@ -593,7 +595,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
593 * (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount] 595 * (2) the usage count == 1 [parent vfsmount] + 1 [sys_umount]
594 */ 596 */
595 if (flags & MNT_EXPIRE) { 597 if (flags & MNT_EXPIRE) {
596 if (mnt == current->fs->rootmnt || 598 if (mnt == current->fs->root.mnt ||
597 flags & (MNT_FORCE | MNT_DETACH)) 599 flags & (MNT_FORCE | MNT_DETACH))
598 return -EINVAL; 600 return -EINVAL;
599 601
@@ -628,7 +630,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
628 * /reboot - static binary that would close all descriptors and 630 * /reboot - static binary that would close all descriptors and
629 * call reboot(9). Then init(8) could umount root and exec /reboot. 631 * call reboot(9). Then init(8) could umount root and exec /reboot.
630 */ 632 */
631 if (mnt == current->fs->rootmnt && !(flags & MNT_DETACH)) { 633 if (mnt == current->fs->root.mnt && !(flags & MNT_DETACH)) {
632 /* 634 /*
633 * Special case for "unmounting" root ... 635 * Special case for "unmounting" root ...
634 * we just try to remount it readonly. 636 * we just try to remount it readonly.
@@ -679,18 +681,20 @@ asmlinkage long sys_umount(char __user * name, int flags)
679 if (retval) 681 if (retval)
680 goto out; 682 goto out;
681 retval = -EINVAL; 683 retval = -EINVAL;
682 if (nd.dentry != nd.mnt->mnt_root) 684 if (nd.path.dentry != nd.path.mnt->mnt_root)
683 goto dput_and_out; 685 goto dput_and_out;
684 if (!check_mnt(nd.mnt)) 686 if (!check_mnt(nd.path.mnt))
685 goto dput_and_out; 687 goto dput_and_out;
686 688
687 retval = -EPERM; 689 retval = -EPERM;
688 if (!capable(CAP_SYS_ADMIN)) 690 if (!capable(CAP_SYS_ADMIN))
689 goto dput_and_out; 691 goto dput_and_out;
690 692
691 retval = do_umount(nd.mnt, flags); 693 retval = do_umount(nd.path.mnt, flags);
692dput_and_out: 694dput_and_out:
693 path_release_on_umount(&nd); 695 /* we mustn't call path_put() as that would clear mnt_expiry_mark */
696 dput(nd.path.dentry);
697 mntput_no_expire(nd.path.mnt);
694out: 698out:
695 return retval; 699 return retval;
696} 700}
@@ -713,10 +717,10 @@ static int mount_is_safe(struct nameidata *nd)
713 return 0; 717 return 0;
714 return -EPERM; 718 return -EPERM;
715#ifdef notyet 719#ifdef notyet
716 if (S_ISLNK(nd->dentry->d_inode->i_mode)) 720 if (S_ISLNK(nd->path.dentry->d_inode->i_mode))
717 return -EPERM; 721 return -EPERM;
718 if (nd->dentry->d_inode->i_mode & S_ISVTX) { 722 if (nd->path.dentry->d_inode->i_mode & S_ISVTX) {
719 if (current->uid != nd->dentry->d_inode->i_uid) 723 if (current->uid != nd->path.dentry->d_inode->i_uid)
720 return -EPERM; 724 return -EPERM;
721 } 725 }
722 if (vfs_permission(nd, MAY_WRITE)) 726 if (vfs_permission(nd, MAY_WRITE))
@@ -765,8 +769,8 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
765 q = q->mnt_parent; 769 q = q->mnt_parent;
766 } 770 }
767 p = s; 771 p = s;
768 nd.mnt = q; 772 nd.path.mnt = q;
769 nd.dentry = p->mnt_mountpoint; 773 nd.path.dentry = p->mnt_mountpoint;
770 q = clone_mnt(p, p->mnt_root, flag); 774 q = clone_mnt(p, p->mnt_root, flag);
771 if (!q) 775 if (!q)
772 goto Enomem; 776 goto Enomem;
@@ -875,8 +879,8 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
875 struct nameidata *nd, struct nameidata *parent_nd) 879 struct nameidata *nd, struct nameidata *parent_nd)
876{ 880{
877 LIST_HEAD(tree_list); 881 LIST_HEAD(tree_list);
878 struct vfsmount *dest_mnt = nd->mnt; 882 struct vfsmount *dest_mnt = nd->path.mnt;
879 struct dentry *dest_dentry = nd->dentry; 883 struct dentry *dest_dentry = nd->path.dentry;
880 struct vfsmount *child, *p; 884 struct vfsmount *child, *p;
881 885
882 if (propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list)) 886 if (propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list))
@@ -911,13 +915,13 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
911 if (mnt->mnt_sb->s_flags & MS_NOUSER) 915 if (mnt->mnt_sb->s_flags & MS_NOUSER)
912 return -EINVAL; 916 return -EINVAL;
913 917
914 if (S_ISDIR(nd->dentry->d_inode->i_mode) != 918 if (S_ISDIR(nd->path.dentry->d_inode->i_mode) !=
915 S_ISDIR(mnt->mnt_root->d_inode->i_mode)) 919 S_ISDIR(mnt->mnt_root->d_inode->i_mode))
916 return -ENOTDIR; 920 return -ENOTDIR;
917 921
918 err = -ENOENT; 922 err = -ENOENT;
919 mutex_lock(&nd->dentry->d_inode->i_mutex); 923 mutex_lock(&nd->path.dentry->d_inode->i_mutex);
920 if (IS_DEADDIR(nd->dentry->d_inode)) 924 if (IS_DEADDIR(nd->path.dentry->d_inode))
921 goto out_unlock; 925 goto out_unlock;
922 926
923 err = security_sb_check_sb(mnt, nd); 927 err = security_sb_check_sb(mnt, nd);
@@ -925,10 +929,10 @@ static int graft_tree(struct vfsmount *mnt, struct nameidata *nd)
925 goto out_unlock; 929 goto out_unlock;
926 930
927 err = -ENOENT; 931 err = -ENOENT;
928 if (IS_ROOT(nd->dentry) || !d_unhashed(nd->dentry)) 932 if (IS_ROOT(nd->path.dentry) || !d_unhashed(nd->path.dentry))
929 err = attach_recursive_mnt(mnt, nd, NULL); 933 err = attach_recursive_mnt(mnt, nd, NULL);
930out_unlock: 934out_unlock:
931 mutex_unlock(&nd->dentry->d_inode->i_mutex); 935 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
932 if (!err) 936 if (!err)
933 security_sb_post_addmount(mnt, nd); 937 security_sb_post_addmount(mnt, nd);
934 return err; 938 return err;
@@ -940,14 +944,14 @@ out_unlock:
940 */ 944 */
941static noinline int do_change_type(struct nameidata *nd, int flag) 945static noinline int do_change_type(struct nameidata *nd, int flag)
942{ 946{
943 struct vfsmount *m, *mnt = nd->mnt; 947 struct vfsmount *m, *mnt = nd->path.mnt;
944 int recurse = flag & MS_REC; 948 int recurse = flag & MS_REC;
945 int type = flag & ~MS_REC; 949 int type = flag & ~MS_REC;
946 950
947 if (!capable(CAP_SYS_ADMIN)) 951 if (!capable(CAP_SYS_ADMIN))
948 return -EPERM; 952 return -EPERM;
949 953
950 if (nd->dentry != nd->mnt->mnt_root) 954 if (nd->path.dentry != nd->path.mnt->mnt_root)
951 return -EINVAL; 955 return -EINVAL;
952 956
953 down_write(&namespace_sem); 957 down_write(&namespace_sem);
@@ -979,17 +983,17 @@ static noinline int do_loopback(struct nameidata *nd, char *old_name,
979 983
980 down_write(&namespace_sem); 984 down_write(&namespace_sem);
981 err = -EINVAL; 985 err = -EINVAL;
982 if (IS_MNT_UNBINDABLE(old_nd.mnt)) 986 if (IS_MNT_UNBINDABLE(old_nd.path.mnt))
983 goto out; 987 goto out;
984 988
985 if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) 989 if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
986 goto out; 990 goto out;
987 991
988 err = -ENOMEM; 992 err = -ENOMEM;
989 if (recurse) 993 if (recurse)
990 mnt = copy_tree(old_nd.mnt, old_nd.dentry, 0); 994 mnt = copy_tree(old_nd.path.mnt, old_nd.path.dentry, 0);
991 else 995 else
992 mnt = clone_mnt(old_nd.mnt, old_nd.dentry, 0); 996 mnt = clone_mnt(old_nd.path.mnt, old_nd.path.dentry, 0);
993 997
994 if (!mnt) 998 if (!mnt)
995 goto out; 999 goto out;
@@ -1005,7 +1009,7 @@ static noinline int do_loopback(struct nameidata *nd, char *old_name,
1005 1009
1006out: 1010out:
1007 up_write(&namespace_sem); 1011 up_write(&namespace_sem);
1008 path_release(&old_nd); 1012 path_put(&old_nd.path);
1009 return err; 1013 return err;
1010} 1014}
1011 1015
@@ -1019,24 +1023,24 @@ static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags,
1019 void *data) 1023 void *data)
1020{ 1024{
1021 int err; 1025 int err;
1022 struct super_block *sb = nd->mnt->mnt_sb; 1026 struct super_block *sb = nd->path.mnt->mnt_sb;
1023 1027
1024 if (!capable(CAP_SYS_ADMIN)) 1028 if (!capable(CAP_SYS_ADMIN))
1025 return -EPERM; 1029 return -EPERM;
1026 1030
1027 if (!check_mnt(nd->mnt)) 1031 if (!check_mnt(nd->path.mnt))
1028 return -EINVAL; 1032 return -EINVAL;
1029 1033
1030 if (nd->dentry != nd->mnt->mnt_root) 1034 if (nd->path.dentry != nd->path.mnt->mnt_root)
1031 return -EINVAL; 1035 return -EINVAL;
1032 1036
1033 down_write(&sb->s_umount); 1037 down_write(&sb->s_umount);
1034 err = do_remount_sb(sb, flags, data, 0); 1038 err = do_remount_sb(sb, flags, data, 0);
1035 if (!err) 1039 if (!err)
1036 nd->mnt->mnt_flags = mnt_flags; 1040 nd->path.mnt->mnt_flags = mnt_flags;
1037 up_write(&sb->s_umount); 1041 up_write(&sb->s_umount);
1038 if (!err) 1042 if (!err)
1039 security_sb_post_remount(nd->mnt, flags, data); 1043 security_sb_post_remount(nd->path.mnt, flags, data);
1040 return err; 1044 return err;
1041} 1045}
1042 1046
@@ -1067,61 +1071,65 @@ static noinline int do_move_mount(struct nameidata *nd, char *old_name)
1067 return err; 1071 return err;
1068 1072
1069 down_write(&namespace_sem); 1073 down_write(&namespace_sem);
1070 while (d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 1074 while (d_mountpoint(nd->path.dentry) &&
1075 follow_down(&nd->path.mnt, &nd->path.dentry))
1071 ; 1076 ;
1072 err = -EINVAL; 1077 err = -EINVAL;
1073 if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) 1078 if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
1074 goto out; 1079 goto out;
1075 1080
1076 err = -ENOENT; 1081 err = -ENOENT;
1077 mutex_lock(&nd->dentry->d_inode->i_mutex); 1082 mutex_lock(&nd->path.dentry->d_inode->i_mutex);
1078 if (IS_DEADDIR(nd->dentry->d_inode)) 1083 if (IS_DEADDIR(nd->path.dentry->d_inode))
1079 goto out1; 1084 goto out1;
1080 1085
1081 if (!IS_ROOT(nd->dentry) && d_unhashed(nd->dentry)) 1086 if (!IS_ROOT(nd->path.dentry) && d_unhashed(nd->path.dentry))
1082 goto out1; 1087 goto out1;
1083 1088
1084 err = -EINVAL; 1089 err = -EINVAL;
1085 if (old_nd.dentry != old_nd.mnt->mnt_root) 1090 if (old_nd.path.dentry != old_nd.path.mnt->mnt_root)
1086 goto out1; 1091 goto out1;
1087 1092
1088 if (old_nd.mnt == old_nd.mnt->mnt_parent) 1093 if (old_nd.path.mnt == old_nd.path.mnt->mnt_parent)
1089 goto out1; 1094 goto out1;
1090 1095
1091 if (S_ISDIR(nd->dentry->d_inode->i_mode) != 1096 if (S_ISDIR(nd->path.dentry->d_inode->i_mode) !=
1092 S_ISDIR(old_nd.dentry->d_inode->i_mode)) 1097 S_ISDIR(old_nd.path.dentry->d_inode->i_mode))
1093 goto out1; 1098 goto out1;
1094 /* 1099 /*
1095 * Don't move a mount residing in a shared parent. 1100 * Don't move a mount residing in a shared parent.
1096 */ 1101 */
1097 if (old_nd.mnt->mnt_parent && IS_MNT_SHARED(old_nd.mnt->mnt_parent)) 1102 if (old_nd.path.mnt->mnt_parent &&
1103 IS_MNT_SHARED(old_nd.path.mnt->mnt_parent))
1098 goto out1; 1104 goto out1;
1099 /* 1105 /*
1100 * Don't move a mount tree containing unbindable mounts to a destination 1106 * Don't move a mount tree containing unbindable mounts to a destination
1101 * mount which is shared. 1107 * mount which is shared.
1102 */ 1108 */
1103 if (IS_MNT_SHARED(nd->mnt) && tree_contains_unbindable(old_nd.mnt)) 1109 if (IS_MNT_SHARED(nd->path.mnt) &&
1110 tree_contains_unbindable(old_nd.path.mnt))
1104 goto out1; 1111 goto out1;
1105 err = -ELOOP; 1112 err = -ELOOP;
1106 for (p = nd->mnt; p->mnt_parent != p; p = p->mnt_parent) 1113 for (p = nd->path.mnt; p->mnt_parent != p; p = p->mnt_parent)
1107 if (p == old_nd.mnt) 1114 if (p == old_nd.path.mnt)
1108 goto out1; 1115 goto out1;
1109 1116
1110 if ((err = attach_recursive_mnt(old_nd.mnt, nd, &parent_nd))) 1117 err = attach_recursive_mnt(old_nd.path.mnt, nd, &parent_nd);
1118 if (err)
1111 goto out1; 1119 goto out1;
1112 1120
1113 spin_lock(&vfsmount_lock); 1121 spin_lock(&vfsmount_lock);
1114 /* if the mount is moved, it should no longer be expire 1122 /* if the mount is moved, it should no longer be expire
1115 * automatically */ 1123 * automatically */
1116 list_del_init(&old_nd.mnt->mnt_expire); 1124 list_del_init(&old_nd.path.mnt->mnt_expire);
1117 spin_unlock(&vfsmount_lock); 1125 spin_unlock(&vfsmount_lock);
1118out1: 1126out1:
1119 mutex_unlock(&nd->dentry->d_inode->i_mutex); 1127 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
1120out: 1128out:
1121 up_write(&namespace_sem); 1129 up_write(&namespace_sem);
1122 if (!err) 1130 if (!err)
1123 path_release(&parent_nd); 1131 path_put(&parent_nd.path);
1124 path_release(&old_nd); 1132 path_put(&old_nd.path);
1125 return err; 1133 return err;
1126} 1134}
1127 1135
@@ -1160,16 +1168,17 @@ int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
1160 1168
1161 down_write(&namespace_sem); 1169 down_write(&namespace_sem);
1162 /* Something was mounted here while we slept */ 1170 /* Something was mounted here while we slept */
1163 while (d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 1171 while (d_mountpoint(nd->path.dentry) &&
1172 follow_down(&nd->path.mnt, &nd->path.dentry))
1164 ; 1173 ;
1165 err = -EINVAL; 1174 err = -EINVAL;
1166 if (!check_mnt(nd->mnt)) 1175 if (!check_mnt(nd->path.mnt))
1167 goto unlock; 1176 goto unlock;
1168 1177
1169 /* Refuse the same filesystem on the same mount point */ 1178 /* Refuse the same filesystem on the same mount point */
1170 err = -EBUSY; 1179 err = -EBUSY;
1171 if (nd->mnt->mnt_sb == newmnt->mnt_sb && 1180 if (nd->path.mnt->mnt_sb == newmnt->mnt_sb &&
1172 nd->mnt->mnt_root == nd->dentry) 1181 nd->path.mnt->mnt_root == nd->path.dentry)
1173 goto unlock; 1182 goto unlock;
1174 1183
1175 err = -EINVAL; 1184 err = -EINVAL;
@@ -1505,7 +1514,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
1505 retval = do_new_mount(&nd, type_page, flags, mnt_flags, 1514 retval = do_new_mount(&nd, type_page, flags, mnt_flags,
1506 dev_name, data_page); 1515 dev_name, data_page);
1507dput_out: 1516dput_out:
1508 path_release(&nd); 1517 path_put(&nd.path);
1509 return retval; 1518 return retval;
1510} 1519}
1511 1520
@@ -1552,17 +1561,17 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
1552 while (p) { 1561 while (p) {
1553 q->mnt_ns = new_ns; 1562 q->mnt_ns = new_ns;
1554 if (fs) { 1563 if (fs) {
1555 if (p == fs->rootmnt) { 1564 if (p == fs->root.mnt) {
1556 rootmnt = p; 1565 rootmnt = p;
1557 fs->rootmnt = mntget(q); 1566 fs->root.mnt = mntget(q);
1558 } 1567 }
1559 if (p == fs->pwdmnt) { 1568 if (p == fs->pwd.mnt) {
1560 pwdmnt = p; 1569 pwdmnt = p;
1561 fs->pwdmnt = mntget(q); 1570 fs->pwd.mnt = mntget(q);
1562 } 1571 }
1563 if (p == fs->altrootmnt) { 1572 if (p == fs->altroot.mnt) {
1564 altrootmnt = p; 1573 altrootmnt = p;
1565 fs->altrootmnt = mntget(q); 1574 fs->altroot.mnt = mntget(q);
1566 } 1575 }
1567 } 1576 }
1568 p = next_mnt(p, mnt_ns->root); 1577 p = next_mnt(p, mnt_ns->root);
@@ -1643,44 +1652,35 @@ out1:
1643 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. 1652 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
1644 * It can block. Requires the big lock held. 1653 * It can block. Requires the big lock held.
1645 */ 1654 */
1646void set_fs_root(struct fs_struct *fs, struct vfsmount *mnt, 1655void set_fs_root(struct fs_struct *fs, struct path *path)
1647 struct dentry *dentry)
1648{ 1656{
1649 struct dentry *old_root; 1657 struct path old_root;
1650 struct vfsmount *old_rootmnt; 1658
1651 write_lock(&fs->lock); 1659 write_lock(&fs->lock);
1652 old_root = fs->root; 1660 old_root = fs->root;
1653 old_rootmnt = fs->rootmnt; 1661 fs->root = *path;
1654 fs->rootmnt = mntget(mnt); 1662 path_get(path);
1655 fs->root = dget(dentry);
1656 write_unlock(&fs->lock); 1663 write_unlock(&fs->lock);
1657 if (old_root) { 1664 if (old_root.dentry)
1658 dput(old_root); 1665 path_put(&old_root);
1659 mntput(old_rootmnt);
1660 }
1661} 1666}
1662 1667
1663/* 1668/*
1664 * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. 1669 * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
1665 * It can block. Requires the big lock held. 1670 * It can block. Requires the big lock held.
1666 */ 1671 */
1667void set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, 1672void set_fs_pwd(struct fs_struct *fs, struct path *path)
1668 struct dentry *dentry)
1669{ 1673{
1670 struct dentry *old_pwd; 1674 struct path old_pwd;
1671 struct vfsmount *old_pwdmnt;
1672 1675
1673 write_lock(&fs->lock); 1676 write_lock(&fs->lock);
1674 old_pwd = fs->pwd; 1677 old_pwd = fs->pwd;
1675 old_pwdmnt = fs->pwdmnt; 1678 fs->pwd = *path;
1676 fs->pwdmnt = mntget(mnt); 1679 path_get(path);
1677 fs->pwd = dget(dentry);
1678 write_unlock(&fs->lock); 1680 write_unlock(&fs->lock);
1679 1681
1680 if (old_pwd) { 1682 if (old_pwd.dentry)
1681 dput(old_pwd); 1683 path_put(&old_pwd);
1682 mntput(old_pwdmnt);
1683 }
1684} 1684}
1685 1685
1686static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd) 1686static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd)
@@ -1695,12 +1695,12 @@ static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd)
1695 if (fs) { 1695 if (fs) {
1696 atomic_inc(&fs->count); 1696 atomic_inc(&fs->count);
1697 task_unlock(p); 1697 task_unlock(p);
1698 if (fs->root == old_nd->dentry 1698 if (fs->root.dentry == old_nd->path.dentry
1699 && fs->rootmnt == old_nd->mnt) 1699 && fs->root.mnt == old_nd->path.mnt)
1700 set_fs_root(fs, new_nd->mnt, new_nd->dentry); 1700 set_fs_root(fs, &new_nd->path);
1701 if (fs->pwd == old_nd->dentry 1701 if (fs->pwd.dentry == old_nd->path.dentry
1702 && fs->pwdmnt == old_nd->mnt) 1702 && fs->pwd.mnt == old_nd->path.mnt)
1703 set_fs_pwd(fs, new_nd->mnt, new_nd->dentry); 1703 set_fs_pwd(fs, &new_nd->path);
1704 put_fs_struct(fs); 1704 put_fs_struct(fs);
1705 } else 1705 } else
1706 task_unlock(p); 1706 task_unlock(p);
@@ -1750,7 +1750,7 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1750 if (error) 1750 if (error)
1751 goto out0; 1751 goto out0;
1752 error = -EINVAL; 1752 error = -EINVAL;
1753 if (!check_mnt(new_nd.mnt)) 1753 if (!check_mnt(new_nd.path.mnt))
1754 goto out1; 1754 goto out1;
1755 1755
1756 error = __user_walk(put_old, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &old_nd); 1756 error = __user_walk(put_old, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &old_nd);
@@ -1759,74 +1759,78 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
1759 1759
1760 error = security_sb_pivotroot(&old_nd, &new_nd); 1760 error = security_sb_pivotroot(&old_nd, &new_nd);
1761 if (error) { 1761 if (error) {
1762 path_release(&old_nd); 1762 path_put(&old_nd.path);
1763 goto out1; 1763 goto out1;
1764 } 1764 }
1765 1765
1766 read_lock(&current->fs->lock); 1766 read_lock(&current->fs->lock);
1767 user_nd.mnt = mntget(current->fs->rootmnt); 1767 user_nd.path = current->fs->root;
1768 user_nd.dentry = dget(current->fs->root); 1768 path_get(&current->fs->root);
1769 read_unlock(&current->fs->lock); 1769 read_unlock(&current->fs->lock);
1770 down_write(&namespace_sem); 1770 down_write(&namespace_sem);
1771 mutex_lock(&old_nd.dentry->d_inode->i_mutex); 1771 mutex_lock(&old_nd.path.dentry->d_inode->i_mutex);
1772 error = -EINVAL; 1772 error = -EINVAL;
1773 if (IS_MNT_SHARED(old_nd.mnt) || 1773 if (IS_MNT_SHARED(old_nd.path.mnt) ||
1774 IS_MNT_SHARED(new_nd.mnt->mnt_parent) || 1774 IS_MNT_SHARED(new_nd.path.mnt->mnt_parent) ||
1775 IS_MNT_SHARED(user_nd.mnt->mnt_parent)) 1775 IS_MNT_SHARED(user_nd.path.mnt->mnt_parent))
1776 goto out2; 1776 goto out2;
1777 if (!check_mnt(user_nd.mnt)) 1777 if (!check_mnt(user_nd.path.mnt))
1778 goto out2; 1778 goto out2;
1779 error = -ENOENT; 1779 error = -ENOENT;
1780 if (IS_DEADDIR(new_nd.dentry->d_inode)) 1780 if (IS_DEADDIR(new_nd.path.dentry->d_inode))
1781 goto out2; 1781 goto out2;
1782 if (d_unhashed(new_nd.dentry) && !IS_ROOT(new_nd.dentry)) 1782 if (d_unhashed(new_nd.path.dentry) && !IS_ROOT(new_nd.path.dentry))
1783 goto out2; 1783 goto out2;
1784 if (d_unhashed(old_nd.dentry) && !IS_ROOT(old_nd.dentry)) 1784 if (d_unhashed(old_nd.path.dentry) && !IS_ROOT(old_nd.path.dentry))
1785 goto out2; 1785 goto out2;
1786 error = -EBUSY; 1786 error = -EBUSY;
1787 if (new_nd.mnt == user_nd.mnt || old_nd.mnt == user_nd.mnt) 1787 if (new_nd.path.mnt == user_nd.path.mnt ||
1788 old_nd.path.mnt == user_nd.path.mnt)
1788 goto out2; /* loop, on the same file system */ 1789 goto out2; /* loop, on the same file system */
1789 error = -EINVAL; 1790 error = -EINVAL;
1790 if (user_nd.mnt->mnt_root != user_nd.dentry) 1791 if (user_nd.path.mnt->mnt_root != user_nd.path.dentry)
1791 goto out2; /* not a mountpoint */ 1792 goto out2; /* not a mountpoint */
1792 if (user_nd.mnt->mnt_parent == user_nd.mnt) 1793 if (user_nd.path.mnt->mnt_parent == user_nd.path.mnt)
1793 goto out2; /* not attached */ 1794 goto out2; /* not attached */
1794 if (new_nd.mnt->mnt_root != new_nd.dentry) 1795 if (new_nd.path.mnt->mnt_root != new_nd.path.dentry)
1795 goto out2; /* not a mountpoint */ 1796 goto out2; /* not a mountpoint */
1796 if (new_nd.mnt->mnt_parent == new_nd.mnt) 1797 if (new_nd.path.mnt->mnt_parent == new_nd.path.mnt)
1797 goto out2; /* not attached */ 1798 goto out2; /* not attached */
1798 tmp = old_nd.mnt; /* make sure we can reach put_old from new_root */ 1799 /* make sure we can reach put_old from new_root */
1800 tmp = old_nd.path.mnt;
1799 spin_lock(&vfsmount_lock); 1801 spin_lock(&vfsmount_lock);
1800 if (tmp != new_nd.mnt) { 1802 if (tmp != new_nd.path.mnt) {
1801 for (;;) { 1803 for (;;) {
1802 if (tmp->mnt_parent == tmp) 1804 if (tmp->mnt_parent == tmp)
1803 goto out3; /* already mounted on put_old */ 1805 goto out3; /* already mounted on put_old */
1804 if (tmp->mnt_parent == new_nd.mnt) 1806 if (tmp->mnt_parent == new_nd.path.mnt)
1805 break; 1807 break;
1806 tmp = tmp->mnt_parent; 1808 tmp = tmp->mnt_parent;
1807 } 1809 }
1808 if (!is_subdir(tmp->mnt_mountpoint, new_nd.dentry)) 1810 if (!is_subdir(tmp->mnt_mountpoint, new_nd.path.dentry))
1809 goto out3; 1811 goto out3;
1810 } else if (!is_subdir(old_nd.dentry, new_nd.dentry)) 1812 } else if (!is_subdir(old_nd.path.dentry, new_nd.path.dentry))
1811 goto out3; 1813 goto out3;
1812 detach_mnt(new_nd.mnt, &parent_nd); 1814 detach_mnt(new_nd.path.mnt, &parent_nd);
1813 detach_mnt(user_nd.mnt, &root_parent); 1815 detach_mnt(user_nd.path.mnt, &root_parent);
1814 attach_mnt(user_nd.mnt, &old_nd); /* mount old root on put_old */ 1816 /* mount old root on put_old */
1815 attach_mnt(new_nd.mnt, &root_parent); /* mount new_root on / */ 1817 attach_mnt(user_nd.path.mnt, &old_nd);
1818 /* mount new_root on / */
1819 attach_mnt(new_nd.path.mnt, &root_parent);
1816 touch_mnt_namespace(current->nsproxy->mnt_ns); 1820 touch_mnt_namespace(current->nsproxy->mnt_ns);
1817 spin_unlock(&vfsmount_lock); 1821 spin_unlock(&vfsmount_lock);
1818 chroot_fs_refs(&user_nd, &new_nd); 1822 chroot_fs_refs(&user_nd, &new_nd);
1819 security_sb_post_pivotroot(&user_nd, &new_nd); 1823 security_sb_post_pivotroot(&user_nd, &new_nd);
1820 error = 0; 1824 error = 0;
1821 path_release(&root_parent); 1825 path_put(&root_parent.path);
1822 path_release(&parent_nd); 1826 path_put(&parent_nd.path);
1823out2: 1827out2:
1824 mutex_unlock(&old_nd.dentry->d_inode->i_mutex); 1828 mutex_unlock(&old_nd.path.dentry->d_inode->i_mutex);
1825 up_write(&namespace_sem); 1829 up_write(&namespace_sem);
1826 path_release(&user_nd); 1830 path_put(&user_nd.path);
1827 path_release(&old_nd); 1831 path_put(&old_nd.path);
1828out1: 1832out1:
1829 path_release(&new_nd); 1833 path_put(&new_nd.path);
1830out0: 1834out0:
1831 unlock_kernel(); 1835 unlock_kernel();
1832 return error; 1836 return error;
@@ -1839,6 +1843,7 @@ static void __init init_mount_tree(void)
1839{ 1843{
1840 struct vfsmount *mnt; 1844 struct vfsmount *mnt;
1841 struct mnt_namespace *ns; 1845 struct mnt_namespace *ns;
1846 struct path root;
1842 1847
1843 mnt = do_kern_mount("rootfs", 0, "rootfs", NULL); 1848 mnt = do_kern_mount("rootfs", 0, "rootfs", NULL);
1844 if (IS_ERR(mnt)) 1849 if (IS_ERR(mnt))
@@ -1857,8 +1862,11 @@ static void __init init_mount_tree(void)
1857 init_task.nsproxy->mnt_ns = ns; 1862 init_task.nsproxy->mnt_ns = ns;
1858 get_mnt_ns(ns); 1863 get_mnt_ns(ns);
1859 1864
1860 set_fs_pwd(current->fs, ns->root, ns->root->mnt_root); 1865 root.mnt = ns->root;
1861 set_fs_root(current->fs, ns->root, ns->root->mnt_root); 1866 root.dentry = ns->root->mnt_root;
1867
1868 set_fs_pwd(current->fs, &root);
1869 set_fs_root(current->fs, &root);
1862} 1870}
1863 1871
1864void __init mnt_init(void) 1872void __init mnt_init(void)
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index bd185a572a23..66648dd92d97 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -93,6 +93,7 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
93 svc_process(rqstp); 93 svc_process(rqstp);
94 } 94 }
95 95
96 flush_signals(current);
96 svc_exit_thread(rqstp); 97 svc_exit_thread(rqstp);
97 nfs_callback_info.pid = 0; 98 nfs_callback_info.pid = 0;
98 complete(&nfs_callback_info.stopped); 99 complete(&nfs_callback_info.stopped);
@@ -105,7 +106,7 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
105 */ 106 */
106int nfs_callback_up(void) 107int nfs_callback_up(void)
107{ 108{
108 struct svc_serv *serv; 109 struct svc_serv *serv = NULL;
109 int ret = 0; 110 int ret = 0;
110 111
111 lock_kernel(); 112 lock_kernel();
@@ -122,24 +123,30 @@ int nfs_callback_up(void)
122 ret = svc_create_xprt(serv, "tcp", nfs_callback_set_tcpport, 123 ret = svc_create_xprt(serv, "tcp", nfs_callback_set_tcpport,
123 SVC_SOCK_ANONYMOUS); 124 SVC_SOCK_ANONYMOUS);
124 if (ret <= 0) 125 if (ret <= 0)
125 goto out_destroy; 126 goto out_err;
126 nfs_callback_tcpport = ret; 127 nfs_callback_tcpport = ret;
127 dprintk("Callback port = 0x%x\n", nfs_callback_tcpport); 128 dprintk("Callback port = 0x%x\n", nfs_callback_tcpport);
128 129
129 ret = svc_create_thread(nfs_callback_svc, serv); 130 ret = svc_create_thread(nfs_callback_svc, serv);
130 if (ret < 0) 131 if (ret < 0)
131 goto out_destroy; 132 goto out_err;
132 nfs_callback_info.serv = serv; 133 nfs_callback_info.serv = serv;
133 wait_for_completion(&nfs_callback_info.started); 134 wait_for_completion(&nfs_callback_info.started);
134out: 135out:
136 /*
137 * svc_create creates the svc_serv with sv_nrthreads == 1, and then
138 * svc_create_thread increments that. So we need to call svc_destroy
139 * on both success and failure so that the refcount is 1 when the
140 * thread exits.
141 */
142 if (serv)
143 svc_destroy(serv);
135 mutex_unlock(&nfs_callback_mutex); 144 mutex_unlock(&nfs_callback_mutex);
136 unlock_kernel(); 145 unlock_kernel();
137 return ret; 146 return ret;
138out_destroy: 147out_err:
139 dprintk("Couldn't create callback socket or server thread; err = %d\n", 148 dprintk("Couldn't create callback socket or server thread; err = %d\n",
140 ret); 149 ret);
141 svc_destroy(serv);
142out_err:
143 nfs_callback_info.users--; 150 nfs_callback_info.users--;
144 goto out; 151 goto out;
145} 152}
@@ -165,7 +172,7 @@ void nfs_callback_down(void)
165static int nfs_callback_authenticate(struct svc_rqst *rqstp) 172static int nfs_callback_authenticate(struct svc_rqst *rqstp)
166{ 173{
167 struct nfs_client *clp; 174 struct nfs_client *clp;
168 char buf[RPC_MAX_ADDRBUFLEN]; 175 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
169 176
170 /* Don't talk to strangers */ 177 /* Don't talk to strangers */
171 clp = nfs_find_client(svc_addr(rqstp), 4); 178 clp = nfs_find_client(svc_addr(rqstp), 4);
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index c63eb720b68b..13619d24f023 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -254,7 +254,7 @@ static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap,
254 if (!(bitmap[0] & FATTR4_WORD0_CHANGE)) 254 if (!(bitmap[0] & FATTR4_WORD0_CHANGE))
255 return 0; 255 return 0;
256 p = xdr_reserve_space(xdr, 8); 256 p = xdr_reserve_space(xdr, 8);
257 if (unlikely(p == 0)) 257 if (unlikely(!p))
258 return htonl(NFS4ERR_RESOURCE); 258 return htonl(NFS4ERR_RESOURCE);
259 p = xdr_encode_hyper(p, change); 259 p = xdr_encode_hyper(p, change);
260 return 0; 260 return 0;
@@ -267,7 +267,7 @@ static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, u
267 if (!(bitmap[0] & FATTR4_WORD0_SIZE)) 267 if (!(bitmap[0] & FATTR4_WORD0_SIZE))
268 return 0; 268 return 0;
269 p = xdr_reserve_space(xdr, 8); 269 p = xdr_reserve_space(xdr, 8);
270 if (unlikely(p == 0)) 270 if (unlikely(!p))
271 return htonl(NFS4ERR_RESOURCE); 271 return htonl(NFS4ERR_RESOURCE);
272 p = xdr_encode_hyper(p, size); 272 p = xdr_encode_hyper(p, size);
273 return 0; 273 return 0;
@@ -278,7 +278,7 @@ static __be32 encode_attr_time(struct xdr_stream *xdr, const struct timespec *ti
278 __be32 *p; 278 __be32 *p;
279 279
280 p = xdr_reserve_space(xdr, 12); 280 p = xdr_reserve_space(xdr, 12);
281 if (unlikely(p == 0)) 281 if (unlikely(!p))
282 return htonl(NFS4ERR_RESOURCE); 282 return htonl(NFS4ERR_RESOURCE);
283 p = xdr_encode_hyper(p, time->tv_sec); 283 p = xdr_encode_hyper(p, time->tv_sec);
284 *p = htonl(time->tv_nsec); 284 *p = htonl(time->tv_nsec);
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index b9eadd18ba70..00a5e4405e16 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -49,7 +49,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_
49 struct file_lock *fl; 49 struct file_lock *fl;
50 int status; 50 int status;
51 51
52 for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) { 52 for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
53 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) 53 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
54 continue; 54 continue;
55 if (nfs_file_open_context(fl->fl_file) != ctx) 55 if (nfs_file_open_context(fl->fl_file) != ctx)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 476cb0f837fd..ae04892a5e5d 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -154,7 +154,6 @@ typedef struct {
154 struct nfs_entry *entry; 154 struct nfs_entry *entry;
155 decode_dirent_t decode; 155 decode_dirent_t decode;
156 int plus; 156 int plus;
157 int error;
158 unsigned long timestamp; 157 unsigned long timestamp;
159 int timestamp_valid; 158 int timestamp_valid;
160} nfs_readdir_descriptor_t; 159} nfs_readdir_descriptor_t;
@@ -213,7 +212,6 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
213 return 0; 212 return 0;
214 error: 213 error:
215 unlock_page(page); 214 unlock_page(page);
216 desc->error = error;
217 return -EIO; 215 return -EIO;
218} 216}
219 217
@@ -483,13 +481,13 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
483 goto out; 481 goto out;
484 } 482 }
485 timestamp = jiffies; 483 timestamp = jiffies;
486 desc->error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, *desc->dir_cookie, 484 status = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred,
487 page, 485 *desc->dir_cookie, page,
488 NFS_SERVER(inode)->dtsize, 486 NFS_SERVER(inode)->dtsize,
489 desc->plus); 487 desc->plus);
490 desc->page = page; 488 desc->page = page;
491 desc->ptr = kmap(page); /* matching kunmap in nfs_do_filldir */ 489 desc->ptr = kmap(page); /* matching kunmap in nfs_do_filldir */
492 if (desc->error >= 0) { 490 if (status >= 0) {
493 desc->timestamp = timestamp; 491 desc->timestamp = timestamp;
494 desc->timestamp_valid = 1; 492 desc->timestamp_valid = 1;
495 if ((status = dir_decode(desc)) == 0) 493 if ((status = dir_decode(desc)) == 0)
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 8ae5dba2d4e5..86147b0ab2cf 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -309,7 +309,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable *h,
309 mutex_lock(&idmap->idmap_im_lock); 309 mutex_lock(&idmap->idmap_im_lock);
310 310
311 he = idmap_lookup_id(h, id); 311 he = idmap_lookup_id(h, id);
312 if (he != 0) { 312 if (he) {
313 memcpy(name, he->ih_name, he->ih_namelen); 313 memcpy(name, he->ih_name, he->ih_namelen);
314 ret = he->ih_namelen; 314 ret = he->ih_namelen;
315 goto out; 315 goto out;
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index be4ce1c3a3d8..607f6eb9cdb5 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -107,38 +107,40 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
107 107
108 BUG_ON(IS_ROOT(dentry)); 108 BUG_ON(IS_ROOT(dentry));
109 dprintk("%s: enter\n", __FUNCTION__); 109 dprintk("%s: enter\n", __FUNCTION__);
110 dput(nd->dentry); 110 dput(nd->path.dentry);
111 nd->dentry = dget(dentry); 111 nd->path.dentry = dget(dentry);
112 112
113 /* Look it up again */ 113 /* Look it up again */
114 parent = dget_parent(nd->dentry); 114 parent = dget_parent(nd->path.dentry);
115 err = server->nfs_client->rpc_ops->lookup(parent->d_inode, 115 err = server->nfs_client->rpc_ops->lookup(parent->d_inode,
116 &nd->dentry->d_name, 116 &nd->path.dentry->d_name,
117 &fh, &fattr); 117 &fh, &fattr);
118 dput(parent); 118 dput(parent);
119 if (err != 0) 119 if (err != 0)
120 goto out_err; 120 goto out_err;
121 121
122 if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) 122 if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL)
123 mnt = nfs_do_refmount(nd->mnt, nd->dentry); 123 mnt = nfs_do_refmount(nd->path.mnt, nd->path.dentry);
124 else 124 else
125 mnt = nfs_do_submount(nd->mnt, nd->dentry, &fh, &fattr); 125 mnt = nfs_do_submount(nd->path.mnt, nd->path.dentry, &fh,
126 &fattr);
126 err = PTR_ERR(mnt); 127 err = PTR_ERR(mnt);
127 if (IS_ERR(mnt)) 128 if (IS_ERR(mnt))
128 goto out_err; 129 goto out_err;
129 130
130 mntget(mnt); 131 mntget(mnt);
131 err = do_add_mount(mnt, nd, nd->mnt->mnt_flags|MNT_SHRINKABLE, &nfs_automount_list); 132 err = do_add_mount(mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
133 &nfs_automount_list);
132 if (err < 0) { 134 if (err < 0) {
133 mntput(mnt); 135 mntput(mnt);
134 if (err == -EBUSY) 136 if (err == -EBUSY)
135 goto out_follow; 137 goto out_follow;
136 goto out_err; 138 goto out_err;
137 } 139 }
138 mntput(nd->mnt); 140 mntput(nd->path.mnt);
139 dput(nd->dentry); 141 dput(nd->path.dentry);
140 nd->mnt = mnt; 142 nd->path.mnt = mnt;
141 nd->dentry = dget(mnt->mnt_root); 143 nd->path.dentry = dget(mnt->mnt_root);
142 schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout); 144 schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);
143out: 145out:
144 dprintk("%s: done, returned %d\n", __FUNCTION__, err); 146 dprintk("%s: done, returned %d\n", __FUNCTION__, err);
@@ -146,10 +148,11 @@ out:
146 dprintk("<-- nfs_follow_mountpoint() = %d\n", err); 148 dprintk("<-- nfs_follow_mountpoint() = %d\n", err);
147 return ERR_PTR(err); 149 return ERR_PTR(err);
148out_err: 150out_err:
149 path_release(nd); 151 path_put(&nd->path);
150 goto out; 152 goto out;
151out_follow: 153out_follow:
152 while(d_mountpoint(nd->dentry) && follow_down(&nd->mnt, &nd->dentry)) 154 while (d_mountpoint(nd->path.dentry) &&
155 follow_down(&nd->path.mnt, &nd->path.dentry))
153 ; 156 ;
154 err = 0; 157 err = 0;
155 goto out; 158 goto out;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 027e1095256e..7ce07862c2fb 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1384,11 +1384,11 @@ out_close:
1384struct dentry * 1384struct dentry *
1385nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 1385nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1386{ 1386{
1387 struct dentry *parent;
1388 struct path path = { 1387 struct path path = {
1389 .mnt = nd->mnt, 1388 .mnt = nd->path.mnt,
1390 .dentry = dentry, 1389 .dentry = dentry,
1391 }; 1390 };
1391 struct dentry *parent;
1392 struct iattr attr; 1392 struct iattr attr;
1393 struct rpc_cred *cred; 1393 struct rpc_cred *cred;
1394 struct nfs4_state *state; 1394 struct nfs4_state *state;
@@ -1433,7 +1433,7 @@ int
1433nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, struct nameidata *nd) 1433nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, struct nameidata *nd)
1434{ 1434{
1435 struct path path = { 1435 struct path path = {
1436 .mnt = nd->mnt, 1436 .mnt = nd->path.mnt,
1437 .dentry = dentry, 1437 .dentry = dentry,
1438 }; 1438 };
1439 struct rpc_cred *cred; 1439 struct rpc_cred *cred;
@@ -1885,7 +1885,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
1885 int flags, struct nameidata *nd) 1885 int flags, struct nameidata *nd)
1886{ 1886{
1887 struct path path = { 1887 struct path path = {
1888 .mnt = nd->mnt, 1888 .mnt = nd->path.mnt,
1889 .dentry = dentry, 1889 .dentry = dentry,
1890 }; 1890 };
1891 struct nfs4_state *state; 1891 struct nfs4_state *state;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index f9c7432471dc..b962397004c1 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -682,8 +682,8 @@ static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
682 if (seqid->sequence->flags & NFS_SEQID_CONFIRMED) 682 if (seqid->sequence->flags & NFS_SEQID_CONFIRMED)
683 return; 683 return;
684 printk(KERN_WARNING "NFS: v4 server returned a bad" 684 printk(KERN_WARNING "NFS: v4 server returned a bad"
685 "sequence-id error on an" 685 " sequence-id error on an"
686 "unconfirmed sequence %p!\n", 686 " unconfirmed sequence %p!\n",
687 seqid->sequence); 687 seqid->sequence);
688 case -NFS4ERR_STALE_CLIENTID: 688 case -NFS4ERR_STALE_CLIENTID:
689 case -NFS4ERR_STALE_STATEID: 689 case -NFS4ERR_STALE_STATEID:
@@ -785,7 +785,7 @@ static int nfs4_reclaim_locks(struct nfs4_state_recovery_ops *ops, struct nfs4_s
785 struct file_lock *fl; 785 struct file_lock *fl;
786 int status = 0; 786 int status = 0;
787 787
788 for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) { 788 for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
789 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK))) 789 if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
790 continue; 790 continue;
791 if (nfs_file_open_context(fl->fl_file)->state != state) 791 if (nfs_file_open_context(fl->fl_file)->state != state)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 7f4505f6ac6f..1fb381843650 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -190,6 +190,10 @@ static match_table_t nfs_secflavor_tokens = {
190 { Opt_sec_lkeyi, "lkeyi" }, 190 { Opt_sec_lkeyi, "lkeyi" },
191 { Opt_sec_lkeyp, "lkeyp" }, 191 { Opt_sec_lkeyp, "lkeyp" },
192 192
193 { Opt_sec_spkm, "spkm3" },
194 { Opt_sec_spkmi, "spkm3i" },
195 { Opt_sec_spkmp, "spkm3p" },
196
193 { Opt_sec_err, NULL } 197 { Opt_sec_err, NULL }
194}; 198};
195 199
diff --git a/fs/nfsctl.c b/fs/nfsctl.c
index 51f1b31acbf6..aed8145d9087 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -41,9 +41,9 @@ static struct file *do_open(char *name, int flags)
41 error = may_open(&nd, MAY_WRITE, FMODE_WRITE); 41 error = may_open(&nd, MAY_WRITE, FMODE_WRITE);
42 42
43 if (!error) 43 if (!error)
44 return dentry_open(nd.dentry, nd.mnt, flags); 44 return dentry_open(nd.path.dentry, nd.path.mnt, flags);
45 45
46 path_release(&nd); 46 path_put(&nd.path);
47 return ERR_PTR(error); 47 return ERR_PTR(error);
48} 48}
49 49
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 346570f6d848..8a6f7c924c75 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -63,10 +63,8 @@ static void expkey_put(struct kref *ref)
63 struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref); 63 struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
64 64
65 if (test_bit(CACHE_VALID, &key->h.flags) && 65 if (test_bit(CACHE_VALID, &key->h.flags) &&
66 !test_bit(CACHE_NEGATIVE, &key->h.flags)) { 66 !test_bit(CACHE_NEGATIVE, &key->h.flags))
67 dput(key->ek_dentry); 67 path_put(&key->ek_path);
68 mntput(key->ek_mnt);
69 }
70 auth_domain_put(key->ek_client); 68 auth_domain_put(key->ek_client);
71 kfree(key); 69 kfree(key);
72} 70}
@@ -169,15 +167,14 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
169 goto out; 167 goto out;
170 168
171 dprintk("Found the path %s\n", buf); 169 dprintk("Found the path %s\n", buf);
172 key.ek_mnt = nd.mnt; 170 key.ek_path = nd.path;
173 key.ek_dentry = nd.dentry; 171
174
175 ek = svc_expkey_update(&key, ek); 172 ek = svc_expkey_update(&key, ek);
176 if (ek) 173 if (ek)
177 cache_put(&ek->h, &svc_expkey_cache); 174 cache_put(&ek->h, &svc_expkey_cache);
178 else 175 else
179 err = -ENOMEM; 176 err = -ENOMEM;
180 path_release(&nd); 177 path_put(&nd.path);
181 } 178 }
182 cache_flush(); 179 cache_flush();
183 out: 180 out:
@@ -206,7 +203,7 @@ static int expkey_show(struct seq_file *m,
206 if (test_bit(CACHE_VALID, &h->flags) && 203 if (test_bit(CACHE_VALID, &h->flags) &&
207 !test_bit(CACHE_NEGATIVE, &h->flags)) { 204 !test_bit(CACHE_NEGATIVE, &h->flags)) {
208 seq_printf(m, " "); 205 seq_printf(m, " ");
209 seq_path(m, ek->ek_mnt, ek->ek_dentry, "\\ \t\n"); 206 seq_path(m, &ek->ek_path, "\\ \t\n");
210 } 207 }
211 seq_printf(m, "\n"); 208 seq_printf(m, "\n");
212 return 0; 209 return 0;
@@ -243,8 +240,8 @@ static inline void expkey_update(struct cache_head *cnew,
243 struct svc_expkey *new = container_of(cnew, struct svc_expkey, h); 240 struct svc_expkey *new = container_of(cnew, struct svc_expkey, h);
244 struct svc_expkey *item = container_of(citem, struct svc_expkey, h); 241 struct svc_expkey *item = container_of(citem, struct svc_expkey, h);
245 242
246 new->ek_mnt = mntget(item->ek_mnt); 243 new->ek_path = item->ek_path;
247 new->ek_dentry = dget(item->ek_dentry); 244 path_get(&item->ek_path);
248} 245}
249 246
250static struct cache_head *expkey_alloc(void) 247static struct cache_head *expkey_alloc(void)
@@ -332,10 +329,9 @@ static void nfsd4_fslocs_free(struct nfsd4_fs_locations *fsloc)
332static void svc_export_put(struct kref *ref) 329static void svc_export_put(struct kref *ref)
333{ 330{
334 struct svc_export *exp = container_of(ref, struct svc_export, h.ref); 331 struct svc_export *exp = container_of(ref, struct svc_export, h.ref);
335 dput(exp->ex_dentry); 332 path_put(&exp->ex_path);
336 mntput(exp->ex_mnt);
337 auth_domain_put(exp->ex_client); 333 auth_domain_put(exp->ex_client);
338 kfree(exp->ex_path); 334 kfree(exp->ex_pathname);
339 nfsd4_fslocs_free(&exp->ex_fslocs); 335 nfsd4_fslocs_free(&exp->ex_fslocs);
340 kfree(exp); 336 kfree(exp);
341} 337}
@@ -349,7 +345,7 @@ static void svc_export_request(struct cache_detail *cd,
349 char *pth; 345 char *pth;
350 346
351 qword_add(bpp, blen, exp->ex_client->name); 347 qword_add(bpp, blen, exp->ex_client->name);
352 pth = d_path(exp->ex_dentry, exp->ex_mnt, *bpp, *blen); 348 pth = d_path(&exp->ex_path, *bpp, *blen);
353 if (IS_ERR(pth)) { 349 if (IS_ERR(pth)) {
354 /* is this correct? */ 350 /* is this correct? */
355 (*bpp)[0] = '\n'; 351 (*bpp)[0] = '\n';
@@ -507,8 +503,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
507 struct svc_export exp, *expp; 503 struct svc_export exp, *expp;
508 int an_int; 504 int an_int;
509 505
510 nd.dentry = NULL; 506 nd.path.dentry = NULL;
511 exp.ex_path = NULL; 507 exp.ex_pathname = NULL;
512 508
513 /* fs locations */ 509 /* fs locations */
514 exp.ex_fslocs.locations = NULL; 510 exp.ex_fslocs.locations = NULL;
@@ -547,11 +543,11 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
547 543
548 exp.h.flags = 0; 544 exp.h.flags = 0;
549 exp.ex_client = dom; 545 exp.ex_client = dom;
550 exp.ex_mnt = nd.mnt; 546 exp.ex_path.mnt = nd.path.mnt;
551 exp.ex_dentry = nd.dentry; 547 exp.ex_path.dentry = nd.path.dentry;
552 exp.ex_path = kstrdup(buf, GFP_KERNEL); 548 exp.ex_pathname = kstrdup(buf, GFP_KERNEL);
553 err = -ENOMEM; 549 err = -ENOMEM;
554 if (!exp.ex_path) 550 if (!exp.ex_pathname)
555 goto out; 551 goto out;
556 552
557 /* expiry */ 553 /* expiry */
@@ -610,7 +606,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
610 goto out; 606 goto out;
611 } 607 }
612 608
613 err = check_export(nd.dentry->d_inode, exp.ex_flags, 609 err = check_export(nd.path.dentry->d_inode, exp.ex_flags,
614 exp.ex_uuid); 610 exp.ex_uuid);
615 if (err) goto out; 611 if (err) goto out;
616 } 612 }
@@ -628,9 +624,9 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
628 out: 624 out:
629 nfsd4_fslocs_free(&exp.ex_fslocs); 625 nfsd4_fslocs_free(&exp.ex_fslocs);
630 kfree(exp.ex_uuid); 626 kfree(exp.ex_uuid);
631 kfree(exp.ex_path); 627 kfree(exp.ex_pathname);
632 if (nd.dentry) 628 if (nd.path.dentry)
633 path_release(&nd); 629 path_put(&nd.path);
634 out_no_path: 630 out_no_path:
635 if (dom) 631 if (dom)
636 auth_domain_put(dom); 632 auth_domain_put(dom);
@@ -653,7 +649,7 @@ static int svc_export_show(struct seq_file *m,
653 return 0; 649 return 0;
654 } 650 }
655 exp = container_of(h, struct svc_export, h); 651 exp = container_of(h, struct svc_export, h);
656 seq_path(m, exp->ex_mnt, exp->ex_dentry, " \t\n\\"); 652 seq_path(m, &exp->ex_path, " \t\n\\");
657 seq_putc(m, '\t'); 653 seq_putc(m, '\t');
658 seq_escape(m, exp->ex_client->name, " \t\n\\"); 654 seq_escape(m, exp->ex_client->name, " \t\n\\");
659 seq_putc(m, '('); 655 seq_putc(m, '(');
@@ -680,8 +676,8 @@ static int svc_export_match(struct cache_head *a, struct cache_head *b)
680 struct svc_export *orig = container_of(a, struct svc_export, h); 676 struct svc_export *orig = container_of(a, struct svc_export, h);
681 struct svc_export *new = container_of(b, struct svc_export, h); 677 struct svc_export *new = container_of(b, struct svc_export, h);
682 return orig->ex_client == new->ex_client && 678 return orig->ex_client == new->ex_client &&
683 orig->ex_dentry == new->ex_dentry && 679 orig->ex_path.dentry == new->ex_path.dentry &&
684 orig->ex_mnt == new->ex_mnt; 680 orig->ex_path.mnt == new->ex_path.mnt;
685} 681}
686 682
687static void svc_export_init(struct cache_head *cnew, struct cache_head *citem) 683static void svc_export_init(struct cache_head *cnew, struct cache_head *citem)
@@ -691,9 +687,9 @@ static void svc_export_init(struct cache_head *cnew, struct cache_head *citem)
691 687
692 kref_get(&item->ex_client->ref); 688 kref_get(&item->ex_client->ref);
693 new->ex_client = item->ex_client; 689 new->ex_client = item->ex_client;
694 new->ex_dentry = dget(item->ex_dentry); 690 new->ex_path.dentry = dget(item->ex_path.dentry);
695 new->ex_mnt = mntget(item->ex_mnt); 691 new->ex_path.mnt = mntget(item->ex_path.mnt);
696 new->ex_path = NULL; 692 new->ex_pathname = NULL;
697 new->ex_fslocs.locations = NULL; 693 new->ex_fslocs.locations = NULL;
698 new->ex_fslocs.locations_count = 0; 694 new->ex_fslocs.locations_count = 0;
699 new->ex_fslocs.migrated = 0; 695 new->ex_fslocs.migrated = 0;
@@ -711,8 +707,8 @@ static void export_update(struct cache_head *cnew, struct cache_head *citem)
711 new->ex_fsid = item->ex_fsid; 707 new->ex_fsid = item->ex_fsid;
712 new->ex_uuid = item->ex_uuid; 708 new->ex_uuid = item->ex_uuid;
713 item->ex_uuid = NULL; 709 item->ex_uuid = NULL;
714 new->ex_path = item->ex_path; 710 new->ex_pathname = item->ex_pathname;
715 item->ex_path = NULL; 711 item->ex_pathname = NULL;
716 new->ex_fslocs.locations = item->ex_fslocs.locations; 712 new->ex_fslocs.locations = item->ex_fslocs.locations;
717 item->ex_fslocs.locations = NULL; 713 item->ex_fslocs.locations = NULL;
718 new->ex_fslocs.locations_count = item->ex_fslocs.locations_count; 714 new->ex_fslocs.locations_count = item->ex_fslocs.locations_count;
@@ -755,8 +751,8 @@ svc_export_lookup(struct svc_export *exp)
755 struct cache_head *ch; 751 struct cache_head *ch;
756 int hash; 752 int hash;
757 hash = hash_ptr(exp->ex_client, EXPORT_HASHBITS); 753 hash = hash_ptr(exp->ex_client, EXPORT_HASHBITS);
758 hash ^= hash_ptr(exp->ex_dentry, EXPORT_HASHBITS); 754 hash ^= hash_ptr(exp->ex_path.dentry, EXPORT_HASHBITS);
759 hash ^= hash_ptr(exp->ex_mnt, EXPORT_HASHBITS); 755 hash ^= hash_ptr(exp->ex_path.mnt, EXPORT_HASHBITS);
760 756
761 ch = sunrpc_cache_lookup(&svc_export_cache, &exp->h, 757 ch = sunrpc_cache_lookup(&svc_export_cache, &exp->h,
762 hash); 758 hash);
@@ -772,8 +768,8 @@ svc_export_update(struct svc_export *new, struct svc_export *old)
772 struct cache_head *ch; 768 struct cache_head *ch;
773 int hash; 769 int hash;
774 hash = hash_ptr(old->ex_client, EXPORT_HASHBITS); 770 hash = hash_ptr(old->ex_client, EXPORT_HASHBITS);
775 hash ^= hash_ptr(old->ex_dentry, EXPORT_HASHBITS); 771 hash ^= hash_ptr(old->ex_path.dentry, EXPORT_HASHBITS);
776 hash ^= hash_ptr(old->ex_mnt, EXPORT_HASHBITS); 772 hash ^= hash_ptr(old->ex_path.mnt, EXPORT_HASHBITS);
777 773
778 ch = sunrpc_cache_update(&svc_export_cache, &new->h, 774 ch = sunrpc_cache_update(&svc_export_cache, &new->h,
779 &old->h, 775 &old->h,
@@ -815,8 +811,7 @@ static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv,
815 key.ek_client = clp; 811 key.ek_client = clp;
816 key.ek_fsidtype = fsid_type; 812 key.ek_fsidtype = fsid_type;
817 memcpy(key.ek_fsid, fsidv, key_len(fsid_type)); 813 memcpy(key.ek_fsid, fsidv, key_len(fsid_type));
818 key.ek_mnt = exp->ex_mnt; 814 key.ek_path = exp->ex_path;
819 key.ek_dentry = exp->ex_dentry;
820 key.h.expiry_time = NEVER; 815 key.h.expiry_time = NEVER;
821 key.h.flags = 0; 816 key.h.flags = 0;
822 817
@@ -865,13 +860,13 @@ static svc_export *exp_get_by_name(svc_client *clp, struct vfsmount *mnt,
865{ 860{
866 struct svc_export *exp, key; 861 struct svc_export *exp, key;
867 int err; 862 int err;
868 863
869 if (!clp) 864 if (!clp)
870 return ERR_PTR(-ENOENT); 865 return ERR_PTR(-ENOENT);
871 866
872 key.ex_client = clp; 867 key.ex_client = clp;
873 key.ex_mnt = mnt; 868 key.ex_path.mnt = mnt;
874 key.ex_dentry = dentry; 869 key.ex_path.dentry = dentry;
875 870
876 exp = svc_export_lookup(&key); 871 exp = svc_export_lookup(&key);
877 if (exp == NULL) 872 if (exp == NULL)
@@ -968,7 +963,7 @@ static int exp_fsid_hash(svc_client *clp, struct svc_export *exp)
968static int exp_hash(struct auth_domain *clp, struct svc_export *exp) 963static int exp_hash(struct auth_domain *clp, struct svc_export *exp)
969{ 964{
970 u32 fsid[2]; 965 u32 fsid[2];
971 struct inode *inode = exp->ex_dentry->d_inode; 966 struct inode *inode = exp->ex_path.dentry->d_inode;
972 dev_t dev = inode->i_sb->s_dev; 967 dev_t dev = inode->i_sb->s_dev;
973 968
974 if (old_valid_dev(dev)) { 969 if (old_valid_dev(dev)) {
@@ -982,7 +977,7 @@ static int exp_hash(struct auth_domain *clp, struct svc_export *exp)
982static void exp_unhash(struct svc_export *exp) 977static void exp_unhash(struct svc_export *exp)
983{ 978{
984 struct svc_expkey *ek; 979 struct svc_expkey *ek;
985 struct inode *inode = exp->ex_dentry->d_inode; 980 struct inode *inode = exp->ex_path.dentry->d_inode;
986 981
987 ek = exp_get_key(exp->ex_client, inode->i_sb->s_dev, inode->i_ino); 982 ek = exp_get_key(exp->ex_client, inode->i_sb->s_dev, inode->i_ino);
988 if (!IS_ERR(ek)) { 983 if (!IS_ERR(ek)) {
@@ -1030,15 +1025,16 @@ exp_export(struct nfsctl_export *nxp)
1030 goto out_unlock; 1025 goto out_unlock;
1031 err = -EINVAL; 1026 err = -EINVAL;
1032 1027
1033 exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL); 1028 exp = exp_get_by_name(clp, nd.path.mnt, nd.path.dentry, NULL);
1034 1029
1035 memset(&new, 0, sizeof(new)); 1030 memset(&new, 0, sizeof(new));
1036 1031
1037 /* must make sure there won't be an ex_fsid clash */ 1032 /* must make sure there won't be an ex_fsid clash */
1038 if ((nxp->ex_flags & NFSEXP_FSID) && 1033 if ((nxp->ex_flags & NFSEXP_FSID) &&
1039 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) && 1034 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) &&
1040 fsid_key->ek_mnt && 1035 fsid_key->ek_path.mnt &&
1041 (fsid_key->ek_mnt != nd.mnt || fsid_key->ek_dentry != nd.dentry) ) 1036 (fsid_key->ek_path.mnt != nd.path.mnt ||
1037 fsid_key->ek_path.dentry != nd.path.dentry))
1042 goto finish; 1038 goto finish;
1043 1039
1044 if (!IS_ERR(exp)) { 1040 if (!IS_ERR(exp)) {
@@ -1054,7 +1050,7 @@ exp_export(struct nfsctl_export *nxp)
1054 goto finish; 1050 goto finish;
1055 } 1051 }
1056 1052
1057 err = check_export(nd.dentry->d_inode, nxp->ex_flags, NULL); 1053 err = check_export(nd.path.dentry->d_inode, nxp->ex_flags, NULL);
1058 if (err) goto finish; 1054 if (err) goto finish;
1059 1055
1060 err = -ENOMEM; 1056 err = -ENOMEM;
@@ -1063,12 +1059,11 @@ exp_export(struct nfsctl_export *nxp)
1063 1059
1064 new.h.expiry_time = NEVER; 1060 new.h.expiry_time = NEVER;
1065 new.h.flags = 0; 1061 new.h.flags = 0;
1066 new.ex_path = kstrdup(nxp->ex_path, GFP_KERNEL); 1062 new.ex_pathname = kstrdup(nxp->ex_path, GFP_KERNEL);
1067 if (!new.ex_path) 1063 if (!new.ex_pathname)
1068 goto finish; 1064 goto finish;
1069 new.ex_client = clp; 1065 new.ex_client = clp;
1070 new.ex_mnt = nd.mnt; 1066 new.ex_path = nd.path;
1071 new.ex_dentry = nd.dentry;
1072 new.ex_flags = nxp->ex_flags; 1067 new.ex_flags = nxp->ex_flags;
1073 new.ex_anon_uid = nxp->ex_anon_uid; 1068 new.ex_anon_uid = nxp->ex_anon_uid;
1074 new.ex_anon_gid = nxp->ex_anon_gid; 1069 new.ex_anon_gid = nxp->ex_anon_gid;
@@ -1089,15 +1084,14 @@ exp_export(struct nfsctl_export *nxp)
1089 } else 1084 } else
1090 err = 0; 1085 err = 0;
1091finish: 1086finish:
1092 if (new.ex_path) 1087 kfree(new.ex_pathname);
1093 kfree(new.ex_path);
1094 if (exp) 1088 if (exp)
1095 exp_put(exp); 1089 exp_put(exp);
1096 if (fsid_key && !IS_ERR(fsid_key)) 1090 if (fsid_key && !IS_ERR(fsid_key))
1097 cache_put(&fsid_key->h, &svc_expkey_cache); 1091 cache_put(&fsid_key->h, &svc_expkey_cache);
1098 if (clp) 1092 if (clp)
1099 auth_domain_put(clp); 1093 auth_domain_put(clp);
1100 path_release(&nd); 1094 path_put(&nd.path);
1101out_unlock: 1095out_unlock:
1102 exp_writeunlock(); 1096 exp_writeunlock();
1103out: 1097out:
@@ -1148,8 +1142,8 @@ exp_unexport(struct nfsctl_export *nxp)
1148 goto out_domain; 1142 goto out_domain;
1149 1143
1150 err = -EINVAL; 1144 err = -EINVAL;
1151 exp = exp_get_by_name(dom, nd.mnt, nd.dentry, NULL); 1145 exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL);
1152 path_release(&nd); 1146 path_put(&nd.path);
1153 if (IS_ERR(exp)) 1147 if (IS_ERR(exp))
1154 goto out_domain; 1148 goto out_domain;
1155 1149
@@ -1185,12 +1179,12 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1185 printk("nfsd: exp_rootfh path not found %s", path); 1179 printk("nfsd: exp_rootfh path not found %s", path);
1186 return err; 1180 return err;
1187 } 1181 }
1188 inode = nd.dentry->d_inode; 1182 inode = nd.path.dentry->d_inode;
1189 1183
1190 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", 1184 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
1191 path, nd.dentry, clp->name, 1185 path, nd.path.dentry, clp->name,
1192 inode->i_sb->s_id, inode->i_ino); 1186 inode->i_sb->s_id, inode->i_ino);
1193 exp = exp_parent(clp, nd.mnt, nd.dentry, NULL); 1187 exp = exp_parent(clp, nd.path.mnt, nd.path.dentry, NULL);
1194 if (IS_ERR(exp)) { 1188 if (IS_ERR(exp)) {
1195 err = PTR_ERR(exp); 1189 err = PTR_ERR(exp);
1196 goto out; 1190 goto out;
@@ -1200,7 +1194,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1200 * fh must be initialized before calling fh_compose 1194 * fh must be initialized before calling fh_compose
1201 */ 1195 */
1202 fh_init(&fh, maxsize); 1196 fh_init(&fh, maxsize);
1203 if (fh_compose(&fh, exp, nd.dentry, NULL)) 1197 if (fh_compose(&fh, exp, nd.path.dentry, NULL))
1204 err = -EINVAL; 1198 err = -EINVAL;
1205 else 1199 else
1206 err = 0; 1200 err = 0;
@@ -1208,7 +1202,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1208 fh_put(&fh); 1202 fh_put(&fh);
1209 exp_put(exp); 1203 exp_put(exp);
1210out: 1204out:
1211 path_release(&nd); 1205 path_put(&nd.path);
1212 return err; 1206 return err;
1213} 1207}
1214 1208
@@ -1220,7 +1214,7 @@ static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
1220 if (IS_ERR(ek)) 1214 if (IS_ERR(ek))
1221 return ERR_CAST(ek); 1215 return ERR_CAST(ek);
1222 1216
1223 exp = exp_get_by_name(clp, ek->ek_mnt, ek->ek_dentry, reqp); 1217 exp = exp_get_by_name(clp, ek->ek_path.mnt, ek->ek_path.dentry, reqp);
1224 cache_put(&ek->h, &svc_expkey_cache); 1218 cache_put(&ek->h, &svc_expkey_cache);
1225 1219
1226 if (IS_ERR(exp)) 1220 if (IS_ERR(exp))
@@ -1359,7 +1353,7 @@ exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
1359 exp = rqst_exp_find(rqstp, FSID_NUM, fsidv); 1353 exp = rqst_exp_find(rqstp, FSID_NUM, fsidv);
1360 if (IS_ERR(exp)) 1354 if (IS_ERR(exp))
1361 return nfserrno(PTR_ERR(exp)); 1355 return nfserrno(PTR_ERR(exp));
1362 rv = fh_compose(fhp, exp, exp->ex_dentry, NULL); 1356 rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL);
1363 if (rv) 1357 if (rv)
1364 goto out; 1358 goto out;
1365 rv = check_nfsd_access(exp, rqstp); 1359 rv = check_nfsd_access(exp, rqstp);
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index eac82830bfd7..c721a1e6e9dd 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -67,7 +67,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
67 if (nfserr) 67 if (nfserr)
68 RETURN_STATUS(nfserr); 68 RETURN_STATUS(nfserr);
69 69
70 err = vfs_getattr(resp->fh.fh_export->ex_mnt, 70 err = vfs_getattr(resp->fh.fh_export->ex_path.mnt,
71 resp->fh.fh_dentry, &resp->stat); 71 resp->fh.fh_dentry, &resp->stat);
72 nfserr = nfserrno(err); 72 nfserr = nfserrno(err);
73 73
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index d7647f70e02b..17d0dd997204 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -218,7 +218,7 @@ encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
218 int err; 218 int err;
219 struct kstat stat; 219 struct kstat stat;
220 220
221 err = vfs_getattr(fhp->fh_export->ex_mnt, dentry, &stat); 221 err = vfs_getattr(fhp->fh_export->ex_path.mnt, dentry, &stat);
222 if (!err) { 222 if (!err) {
223 *p++ = xdr_one; /* attributes follow */ 223 *p++ = xdr_one; /* attributes follow */
224 lease_get_mtime(dentry->d_inode, &stat.mtime); 224 lease_get_mtime(dentry->d_inode, &stat.mtime);
@@ -270,7 +270,7 @@ void fill_post_wcc(struct svc_fh *fhp)
270 if (fhp->fh_post_saved) 270 if (fhp->fh_post_saved)
271 printk("nfsd: inode locked twice during operation.\n"); 271 printk("nfsd: inode locked twice during operation.\n");
272 272
273 err = vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, 273 err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry,
274 &fhp->fh_post_attr); 274 &fhp->fh_post_attr);
275 if (err) 275 if (err)
276 fhp->fh_post_saved = 0; 276 fhp->fh_post_saved = 0;
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 1602cd00dd45..1ff90625860f 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -120,9 +120,9 @@ out_no_tfm:
120static void 120static void
121nfsd4_sync_rec_dir(void) 121nfsd4_sync_rec_dir(void)
122{ 122{
123 mutex_lock(&rec_dir.dentry->d_inode->i_mutex); 123 mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
124 nfsd_sync_dir(rec_dir.dentry); 124 nfsd_sync_dir(rec_dir.path.dentry);
125 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); 125 mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
126} 126}
127 127
128int 128int
@@ -142,9 +142,9 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
142 nfs4_save_user(&uid, &gid); 142 nfs4_save_user(&uid, &gid);
143 143
144 /* lock the parent */ 144 /* lock the parent */
145 mutex_lock(&rec_dir.dentry->d_inode->i_mutex); 145 mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
146 146
147 dentry = lookup_one_len(dname, rec_dir.dentry, HEXDIR_LEN-1); 147 dentry = lookup_one_len(dname, rec_dir.path.dentry, HEXDIR_LEN-1);
148 if (IS_ERR(dentry)) { 148 if (IS_ERR(dentry)) {
149 status = PTR_ERR(dentry); 149 status = PTR_ERR(dentry);
150 goto out_unlock; 150 goto out_unlock;
@@ -154,11 +154,11 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
154 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n"); 154 dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
155 goto out_put; 155 goto out_put;
156 } 156 }
157 status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU); 157 status = vfs_mkdir(rec_dir.path.dentry->d_inode, dentry, S_IRWXU);
158out_put: 158out_put:
159 dput(dentry); 159 dput(dentry);
160out_unlock: 160out_unlock:
161 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); 161 mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
162 if (status == 0) { 162 if (status == 0) {
163 clp->cl_firststate = 1; 163 clp->cl_firststate = 1;
164 nfsd4_sync_rec_dir(); 164 nfsd4_sync_rec_dir();
@@ -221,7 +221,7 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
221 221
222 nfs4_save_user(&uid, &gid); 222 nfs4_save_user(&uid, &gid);
223 223
224 filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY); 224 filp = dentry_open(dget(dir), mntget(rec_dir.path.mnt), O_RDONLY);
225 status = PTR_ERR(filp); 225 status = PTR_ERR(filp);
226 if (IS_ERR(filp)) 226 if (IS_ERR(filp))
227 goto out; 227 goto out;
@@ -286,9 +286,9 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
286 286
287 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); 287 dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
288 288
289 mutex_lock(&rec_dir.dentry->d_inode->i_mutex); 289 mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
290 dentry = lookup_one_len(name, rec_dir.dentry, namlen); 290 dentry = lookup_one_len(name, rec_dir.path.dentry, namlen);
291 mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); 291 mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
292 if (IS_ERR(dentry)) { 292 if (IS_ERR(dentry)) {
293 status = PTR_ERR(dentry); 293 status = PTR_ERR(dentry);
294 return status; 294 return status;
@@ -297,7 +297,7 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
297 if (!dentry->d_inode) 297 if (!dentry->d_inode)
298 goto out; 298 goto out;
299 299
300 status = nfsd4_clear_clid_dir(rec_dir.dentry, dentry); 300 status = nfsd4_clear_clid_dir(rec_dir.path.dentry, dentry);
301out: 301out:
302 dput(dentry); 302 dput(dentry);
303 return status; 303 return status;
@@ -347,12 +347,12 @@ nfsd4_recdir_purge_old(void) {
347 347
348 if (!rec_dir_init) 348 if (!rec_dir_init)
349 return; 349 return;
350 status = nfsd4_list_rec_dir(rec_dir.dentry, purge_old); 350 status = nfsd4_list_rec_dir(rec_dir.path.dentry, purge_old);
351 if (status == 0) 351 if (status == 0)
352 nfsd4_sync_rec_dir(); 352 nfsd4_sync_rec_dir();
353 if (status) 353 if (status)
354 printk("nfsd4: failed to purge old clients from recovery" 354 printk("nfsd4: failed to purge old clients from recovery"
355 " directory %s\n", rec_dir.dentry->d_name.name); 355 " directory %s\n", rec_dir.path.dentry->d_name.name);
356 return; 356 return;
357} 357}
358 358
@@ -373,10 +373,10 @@ int
373nfsd4_recdir_load(void) { 373nfsd4_recdir_load(void) {
374 int status; 374 int status;
375 375
376 status = nfsd4_list_rec_dir(rec_dir.dentry, load_recdir); 376 status = nfsd4_list_rec_dir(rec_dir.path.dentry, load_recdir);
377 if (status) 377 if (status)
378 printk("nfsd4: failed loading clients from recovery" 378 printk("nfsd4: failed loading clients from recovery"
379 " directory %s\n", rec_dir.dentry->d_name.name); 379 " directory %s\n", rec_dir.path.dentry->d_name.name);
380 return status; 380 return status;
381} 381}
382 382
@@ -415,5 +415,5 @@ nfsd4_shutdown_recdir(void)
415 if (!rec_dir_init) 415 if (!rec_dir_init)
416 return; 416 return;
417 rec_dir_init = 0; 417 rec_dir_init = 0;
418 path_release(&rec_dir); 418 path_put(&rec_dir.path);
419} 419}
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index f6744bc03dae..bcb97d8e8b8b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3261,11 +3261,11 @@ nfs4_reset_recoverydir(char *recdir)
3261 if (status) 3261 if (status)
3262 return status; 3262 return status;
3263 status = -ENOTDIR; 3263 status = -ENOTDIR;
3264 if (S_ISDIR(nd.dentry->d_inode->i_mode)) { 3264 if (S_ISDIR(nd.path.dentry->d_inode->i_mode)) {
3265 nfs4_set_recdir(recdir); 3265 nfs4_set_recdir(recdir);
3266 status = 0; 3266 status = 0;
3267 } 3267 }
3268 path_release(&nd); 3268 path_put(&nd.path);
3269 return status; 3269 return status;
3270} 3270}
3271 3271
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b0592e7c378d..0e6a179eccaf 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1330,9 +1330,9 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 *
1330 *stat = exp_pseudoroot(rqstp, &tmp_fh); 1330 *stat = exp_pseudoroot(rqstp, &tmp_fh);
1331 if (*stat) 1331 if (*stat)
1332 return NULL; 1332 return NULL;
1333 rootpath = tmp_fh.fh_export->ex_path; 1333 rootpath = tmp_fh.fh_export->ex_pathname;
1334 1334
1335 path = exp->ex_path; 1335 path = exp->ex_pathname;
1336 1336
1337 if (strncmp(path, rootpath, strlen(rootpath))) { 1337 if (strncmp(path, rootpath, strlen(rootpath))) {
1338 dprintk("nfsd: fs_locations failed;" 1338 dprintk("nfsd: fs_locations failed;"
@@ -1481,7 +1481,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1481 goto out; 1481 goto out;
1482 } 1482 }
1483 1483
1484 err = vfs_getattr(exp->ex_mnt, dentry, &stat); 1484 err = vfs_getattr(exp->ex_path.mnt, dentry, &stat);
1485 if (err) 1485 if (err)
1486 goto out_nfserr; 1486 goto out_nfserr;
1487 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | 1487 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
@@ -1838,9 +1838,9 @@ out_acl:
1838 * and this is the root of a cross-mounted filesystem. 1838 * and this is the root of a cross-mounted filesystem.
1839 */ 1839 */
1840 if (ignore_crossmnt == 0 && 1840 if (ignore_crossmnt == 0 &&
1841 exp->ex_mnt->mnt_root->d_inode == dentry->d_inode) { 1841 exp->ex_path.mnt->mnt_root->d_inode == dentry->d_inode) {
1842 err = vfs_getattr(exp->ex_mnt->mnt_parent, 1842 err = vfs_getattr(exp->ex_path.mnt->mnt_parent,
1843 exp->ex_mnt->mnt_mountpoint, &stat); 1843 exp->ex_path.mnt->mnt_mountpoint, &stat);
1844 if (err) 1844 if (err)
1845 goto out_nfserr; 1845 goto out_nfserr;
1846 } 1846 }
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 8fbd2dc08a92..1eb771d79cca 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -47,7 +47,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
47 return 1; 47 return 1;
48 48
49 tdentry = dget(dentry); 49 tdentry = dget(dentry);
50 while (tdentry != exp->ex_dentry && ! IS_ROOT(tdentry)) { 50 while (tdentry != exp->ex_path.dentry && !IS_ROOT(tdentry)) {
51 /* make sure parents give x permission to user */ 51 /* make sure parents give x permission to user */
52 int err; 52 int err;
53 parent = dget_parent(tdentry); 53 parent = dget_parent(tdentry);
@@ -59,9 +59,9 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
59 dput(tdentry); 59 dput(tdentry);
60 tdentry = parent; 60 tdentry = parent;
61 } 61 }
62 if (tdentry != exp->ex_dentry) 62 if (tdentry != exp->ex_path.dentry)
63 dprintk("nfsd_acceptable failed at %p %s\n", tdentry, tdentry->d_name.name); 63 dprintk("nfsd_acceptable failed at %p %s\n", tdentry, tdentry->d_name.name);
64 rv = (tdentry == exp->ex_dentry); 64 rv = (tdentry == exp->ex_path.dentry);
65 dput(tdentry); 65 dput(tdentry);
66 return rv; 66 return rv;
67} 67}
@@ -101,7 +101,7 @@ static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
101{ 101{
102 /* Check if the request originated from a secure port. */ 102 /* Check if the request originated from a secure port. */
103 if (!rqstp->rq_secure && EX_SECURE(exp)) { 103 if (!rqstp->rq_secure && EX_SECURE(exp)) {
104 char buf[RPC_MAX_ADDRBUFLEN]; 104 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
105 dprintk(KERN_WARNING 105 dprintk(KERN_WARNING
106 "nfsd: request from insecure port %s!\n", 106 "nfsd: request from insecure port %s!\n",
107 svc_print_addr(rqstp, buf, sizeof(buf))); 107 svc_print_addr(rqstp, buf, sizeof(buf)));
@@ -209,9 +209,9 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
209 fileid_type = fh->fh_fileid_type; 209 fileid_type = fh->fh_fileid_type;
210 210
211 if (fileid_type == FILEID_ROOT) 211 if (fileid_type == FILEID_ROOT)
212 dentry = dget(exp->ex_dentry); 212 dentry = dget(exp->ex_path.dentry);
213 else { 213 else {
214 dentry = exportfs_decode_fh(exp->ex_mnt, fid, 214 dentry = exportfs_decode_fh(exp->ex_path.mnt, fid,
215 data_left, fileid_type, 215 data_left, fileid_type,
216 nfsd_acceptable, exp); 216 nfsd_acceptable, exp);
217 } 217 }
@@ -299,7 +299,7 @@ out:
299static void _fh_update(struct svc_fh *fhp, struct svc_export *exp, 299static void _fh_update(struct svc_fh *fhp, struct svc_export *exp,
300 struct dentry *dentry) 300 struct dentry *dentry)
301{ 301{
302 if (dentry != exp->ex_dentry) { 302 if (dentry != exp->ex_path.dentry) {
303 struct fid *fid = (struct fid *) 303 struct fid *fid = (struct fid *)
304 (fhp->fh_handle.fh_auth + fhp->fh_handle.fh_size/4 - 1); 304 (fhp->fh_handle.fh_auth + fhp->fh_handle.fh_size/4 - 1);
305 int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4; 305 int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4;
@@ -344,12 +344,12 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
344 struct inode * inode = dentry->d_inode; 344 struct inode * inode = dentry->d_inode;
345 struct dentry *parent = dentry->d_parent; 345 struct dentry *parent = dentry->d_parent;
346 __u32 *datap; 346 __u32 *datap;
347 dev_t ex_dev = exp->ex_dentry->d_inode->i_sb->s_dev; 347 dev_t ex_dev = exp->ex_path.dentry->d_inode->i_sb->s_dev;
348 int root_export = (exp->ex_dentry == exp->ex_dentry->d_sb->s_root); 348 int root_export = (exp->ex_path.dentry == exp->ex_path.dentry->d_sb->s_root);
349 349
350 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n", 350 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n",
351 MAJOR(ex_dev), MINOR(ex_dev), 351 MAJOR(ex_dev), MINOR(ex_dev),
352 (long) exp->ex_dentry->d_inode->i_ino, 352 (long) exp->ex_path.dentry->d_inode->i_ino,
353 parent->d_name.name, dentry->d_name.name, 353 parent->d_name.name, dentry->d_name.name,
354 (inode ? inode->i_ino : 0)); 354 (inode ? inode->i_ino : 0));
355 355
@@ -391,7 +391,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
391 /* FALL THROUGH */ 391 /* FALL THROUGH */
392 case FSID_MAJOR_MINOR: 392 case FSID_MAJOR_MINOR:
393 case FSID_ENCODE_DEV: 393 case FSID_ENCODE_DEV:
394 if (!(exp->ex_dentry->d_inode->i_sb->s_type->fs_flags 394 if (!(exp->ex_path.dentry->d_inode->i_sb->s_type->fs_flags
395 & FS_REQUIRES_DEV)) 395 & FS_REQUIRES_DEV))
396 goto retry; 396 goto retry;
397 break; 397 break;
@@ -454,7 +454,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
454 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); 454 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev);
455 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; 455 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev;
456 fhp->fh_handle.ofh_xino = 456 fhp->fh_handle.ofh_xino =
457 ino_t_to_u32(exp->ex_dentry->d_inode->i_ino); 457 ino_t_to_u32(exp->ex_path.dentry->d_inode->i_ino);
458 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); 458 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry));
459 if (inode) 459 if (inode)
460 _fh_update_old(dentry, exp, &fhp->fh_handle); 460 _fh_update_old(dentry, exp, &fhp->fh_handle);
@@ -465,7 +465,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
465 datap = fhp->fh_handle.fh_auth+0; 465 datap = fhp->fh_handle.fh_auth+0;
466 fhp->fh_handle.fh_fsid_type = fsid_type; 466 fhp->fh_handle.fh_fsid_type = fsid_type;
467 mk_fsid(fsid_type, datap, ex_dev, 467 mk_fsid(fsid_type, datap, ex_dev,
468 exp->ex_dentry->d_inode->i_ino, 468 exp->ex_path.dentry->d_inode->i_ino,
469 exp->ex_fsid, exp->ex_uuid); 469 exp->ex_fsid, exp->ex_uuid);
470 470
471 len = key_len(fsid_type); 471 len = key_len(fsid_type);
@@ -571,7 +571,7 @@ enum fsid_source fsid_source(struct svc_fh *fhp)
571 case FSID_DEV: 571 case FSID_DEV:
572 case FSID_ENCODE_DEV: 572 case FSID_ENCODE_DEV:
573 case FSID_MAJOR_MINOR: 573 case FSID_MAJOR_MINOR:
574 if (fhp->fh_export->ex_dentry->d_inode->i_sb->s_type->fs_flags 574 if (fhp->fh_export->ex_path.dentry->d_inode->i_sb->s_type->fs_flags
575 & FS_REQUIRES_DEV) 575 & FS_REQUIRES_DEV)
576 return FSIDSOURCE_DEV; 576 return FSIDSOURCE_DEV;
577 break; 577 break;
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 977a71f64e19..6cfc96a12483 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -41,7 +41,7 @@ static __be32
41nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp) 41nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp)
42{ 42{
43 if (err) return err; 43 if (err) return err;
44 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 44 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt,
45 resp->fh.fh_dentry, 45 resp->fh.fh_dentry,
46 &resp->stat)); 46 &resp->stat));
47} 47}
@@ -49,7 +49,7 @@ static __be32
49nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp) 49nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp)
50{ 50{
51 if (err) return err; 51 if (err) return err;
52 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 52 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt,
53 resp->fh.fh_dentry, 53 resp->fh.fh_dentry,
54 &resp->stat)); 54 &resp->stat));
55} 55}
@@ -164,7 +164,7 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
164 &resp->count); 164 &resp->count);
165 165
166 if (nfserr) return nfserr; 166 if (nfserr) return nfserr;
167 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, 167 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt,
168 resp->fh.fh_dentry, 168 resp->fh.fh_dentry,
169 &resp->stat)); 169 &resp->stat));
170} 170}
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 61ad61743d94..afd08e2c90a5 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -207,7 +207,7 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
207__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) 207__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
208{ 208{
209 struct kstat stat; 209 struct kstat stat;
210 vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat); 210 vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, &stat);
211 return encode_fattr(rqstp, p, fhp, &stat); 211 return encode_fattr(rqstp, p, fhp, &stat);
212} 212}
213 213
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index cc75e4fcd02b..46f59d5365a0 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -101,7 +101,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
101{ 101{
102 struct svc_export *exp = *expp, *exp2 = NULL; 102 struct svc_export *exp = *expp, *exp2 = NULL;
103 struct dentry *dentry = *dpp; 103 struct dentry *dentry = *dpp;
104 struct vfsmount *mnt = mntget(exp->ex_mnt); 104 struct vfsmount *mnt = mntget(exp->ex_path.mnt);
105 struct dentry *mounts = dget(dentry); 105 struct dentry *mounts = dget(dentry);
106 int err = 0; 106 int err = 0;
107 107
@@ -156,15 +156,15 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
156 if (isdotent(name, len)) { 156 if (isdotent(name, len)) {
157 if (len==1) 157 if (len==1)
158 dentry = dget(dparent); 158 dentry = dget(dparent);
159 else if (dparent != exp->ex_dentry) { 159 else if (dparent != exp->ex_path.dentry)
160 dentry = dget_parent(dparent); 160 dentry = dget_parent(dparent);
161 } else if (!EX_NOHIDE(exp)) 161 else if (!EX_NOHIDE(exp))
162 dentry = dget(dparent); /* .. == . just like at / */ 162 dentry = dget(dparent); /* .. == . just like at / */
163 else { 163 else {
164 /* checking mountpoint crossing is very different when stepping up */ 164 /* checking mountpoint crossing is very different when stepping up */
165 struct svc_export *exp2 = NULL; 165 struct svc_export *exp2 = NULL;
166 struct dentry *dp; 166 struct dentry *dp;
167 struct vfsmount *mnt = mntget(exp->ex_mnt); 167 struct vfsmount *mnt = mntget(exp->ex_path.mnt);
168 dentry = dget(dparent); 168 dentry = dget(dparent);
169 while(dentry == mnt->mnt_root && follow_up(&mnt, &dentry)) 169 while(dentry == mnt->mnt_root && follow_up(&mnt, &dentry))
170 ; 170 ;
@@ -721,7 +721,8 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
721 721
722 DQUOT_INIT(inode); 722 DQUOT_INIT(inode);
723 } 723 }
724 *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags); 724 *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt),
725 flags);
725 if (IS_ERR(*filp)) 726 if (IS_ERR(*filp))
726 host_err = PTR_ERR(*filp); 727 host_err = PTR_ERR(*filp);
727out_nfserr: 728out_nfserr:
@@ -1462,7 +1463,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1462 if (!inode->i_op || !inode->i_op->readlink) 1463 if (!inode->i_op || !inode->i_op->readlink)
1463 goto out; 1464 goto out;
1464 1465
1465 touch_atime(fhp->fh_export->ex_mnt, dentry); 1466 touch_atime(fhp->fh_export->ex_path.mnt, dentry);
1466 /* N.B. Why does this call need a get_fs()?? 1467 /* N.B. Why does this call need a get_fs()??
1467 * Remove the set_fs and watch the fireworks:-) --okir 1468 * Remove the set_fs and watch the fireworks:-) --okir
1468 */ 1469 */
diff --git a/fs/open.c b/fs/open.c
index 43fcd6031969..54198538b67e 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -127,10 +127,10 @@ asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
127 error = user_path_walk(path, &nd); 127 error = user_path_walk(path, &nd);
128 if (!error) { 128 if (!error) {
129 struct statfs tmp; 129 struct statfs tmp;
130 error = vfs_statfs_native(nd.dentry, &tmp); 130 error = vfs_statfs_native(nd.path.dentry, &tmp);
131 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 131 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
132 error = -EFAULT; 132 error = -EFAULT;
133 path_release(&nd); 133 path_put(&nd.path);
134 } 134 }
135 return error; 135 return error;
136} 136}
@@ -146,10 +146,10 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64
146 error = user_path_walk(path, &nd); 146 error = user_path_walk(path, &nd);
147 if (!error) { 147 if (!error) {
148 struct statfs64 tmp; 148 struct statfs64 tmp;
149 error = vfs_statfs64(nd.dentry, &tmp); 149 error = vfs_statfs64(nd.path.dentry, &tmp);
150 if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) 150 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
151 error = -EFAULT; 151 error = -EFAULT;
152 path_release(&nd); 152 path_put(&nd.path);
153 } 153 }
154 return error; 154 return error;
155} 155}
@@ -233,7 +233,7 @@ static long do_sys_truncate(const char __user * path, loff_t length)
233 error = user_path_walk(path, &nd); 233 error = user_path_walk(path, &nd);
234 if (error) 234 if (error)
235 goto out; 235 goto out;
236 inode = nd.dentry->d_inode; 236 inode = nd.path.dentry->d_inode;
237 237
238 /* For directories it's -EISDIR, for other non-regulars - -EINVAL */ 238 /* For directories it's -EISDIR, for other non-regulars - -EINVAL */
239 error = -EISDIR; 239 error = -EISDIR;
@@ -271,13 +271,13 @@ static long do_sys_truncate(const char __user * path, loff_t length)
271 error = locks_verify_truncate(inode, NULL, length); 271 error = locks_verify_truncate(inode, NULL, length);
272 if (!error) { 272 if (!error) {
273 DQUOT_INIT(inode); 273 DQUOT_INIT(inode);
274 error = do_truncate(nd.dentry, length, 0, NULL); 274 error = do_truncate(nd.path.dentry, length, 0, NULL);
275 } 275 }
276 276
277put_write_and_out: 277put_write_and_out:
278 put_write_access(inode); 278 put_write_access(inode);
279dput_and_out: 279dput_and_out:
280 path_release(&nd); 280 path_put(&nd.path);
281out: 281out:
282 return error; 282 return error;
283} 283}
@@ -455,14 +455,14 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
455 res = vfs_permission(&nd, mode); 455 res = vfs_permission(&nd, mode);
456 /* SuS v2 requires we report a read only fs too */ 456 /* SuS v2 requires we report a read only fs too */
457 if(res || !(mode & S_IWOTH) || 457 if(res || !(mode & S_IWOTH) ||
458 special_file(nd.dentry->d_inode->i_mode)) 458 special_file(nd.path.dentry->d_inode->i_mode))
459 goto out_path_release; 459 goto out_path_release;
460 460
461 if(IS_RDONLY(nd.dentry->d_inode)) 461 if(IS_RDONLY(nd.path.dentry->d_inode))
462 res = -EROFS; 462 res = -EROFS;
463 463
464out_path_release: 464out_path_release:
465 path_release(&nd); 465 path_put(&nd.path);
466out: 466out:
467 current->fsuid = old_fsuid; 467 current->fsuid = old_fsuid;
468 current->fsgid = old_fsgid; 468 current->fsgid = old_fsgid;
@@ -490,10 +490,10 @@ asmlinkage long sys_chdir(const char __user * filename)
490 if (error) 490 if (error)
491 goto dput_and_out; 491 goto dput_and_out;
492 492
493 set_fs_pwd(current->fs, nd.mnt, nd.dentry); 493 set_fs_pwd(current->fs, &nd.path);
494 494
495dput_and_out: 495dput_and_out:
496 path_release(&nd); 496 path_put(&nd.path);
497out: 497out:
498 return error; 498 return error;
499} 499}
@@ -501,9 +501,7 @@ out:
501asmlinkage long sys_fchdir(unsigned int fd) 501asmlinkage long sys_fchdir(unsigned int fd)
502{ 502{
503 struct file *file; 503 struct file *file;
504 struct dentry *dentry;
505 struct inode *inode; 504 struct inode *inode;
506 struct vfsmount *mnt;
507 int error; 505 int error;
508 506
509 error = -EBADF; 507 error = -EBADF;
@@ -511,9 +509,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
511 if (!file) 509 if (!file)
512 goto out; 510 goto out;
513 511
514 dentry = file->f_path.dentry; 512 inode = file->f_path.dentry->d_inode;
515 mnt = file->f_path.mnt;
516 inode = dentry->d_inode;
517 513
518 error = -ENOTDIR; 514 error = -ENOTDIR;
519 if (!S_ISDIR(inode->i_mode)) 515 if (!S_ISDIR(inode->i_mode))
@@ -521,7 +517,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
521 517
522 error = file_permission(file, MAY_EXEC); 518 error = file_permission(file, MAY_EXEC);
523 if (!error) 519 if (!error)
524 set_fs_pwd(current->fs, mnt, dentry); 520 set_fs_pwd(current->fs, &file->f_path);
525out_putf: 521out_putf:
526 fput(file); 522 fput(file);
527out: 523out:
@@ -545,11 +541,11 @@ asmlinkage long sys_chroot(const char __user * filename)
545 if (!capable(CAP_SYS_CHROOT)) 541 if (!capable(CAP_SYS_CHROOT))
546 goto dput_and_out; 542 goto dput_and_out;
547 543
548 set_fs_root(current->fs, nd.mnt, nd.dentry); 544 set_fs_root(current->fs, &nd.path);
549 set_fs_altroot(); 545 set_fs_altroot();
550 error = 0; 546 error = 0;
551dput_and_out: 547dput_and_out:
552 path_release(&nd); 548 path_put(&nd.path);
553out: 549out:
554 return error; 550 return error;
555} 551}
@@ -602,7 +598,7 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
602 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd); 598 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd);
603 if (error) 599 if (error)
604 goto out; 600 goto out;
605 inode = nd.dentry->d_inode; 601 inode = nd.path.dentry->d_inode;
606 602
607 error = -EROFS; 603 error = -EROFS;
608 if (IS_RDONLY(inode)) 604 if (IS_RDONLY(inode))
@@ -617,11 +613,11 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
617 mode = inode->i_mode; 613 mode = inode->i_mode;
618 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); 614 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
619 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; 615 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
620 error = notify_change(nd.dentry, &newattrs); 616 error = notify_change(nd.path.dentry, &newattrs);
621 mutex_unlock(&inode->i_mutex); 617 mutex_unlock(&inode->i_mutex);
622 618
623dput_and_out: 619dput_and_out:
624 path_release(&nd); 620 path_put(&nd.path);
625out: 621out:
626 return error; 622 return error;
627} 623}
@@ -675,8 +671,8 @@ asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
675 error = user_path_walk(filename, &nd); 671 error = user_path_walk(filename, &nd);
676 if (error) 672 if (error)
677 goto out; 673 goto out;
678 error = chown_common(nd.dentry, user, group); 674 error = chown_common(nd.path.dentry, user, group);
679 path_release(&nd); 675 path_put(&nd.path);
680out: 676out:
681 return error; 677 return error;
682} 678}
@@ -695,8 +691,8 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
695 error = __user_walk_fd(dfd, filename, follow, &nd); 691 error = __user_walk_fd(dfd, filename, follow, &nd);
696 if (error) 692 if (error)
697 goto out; 693 goto out;
698 error = chown_common(nd.dentry, user, group); 694 error = chown_common(nd.path.dentry, user, group);
699 path_release(&nd); 695 path_put(&nd.path);
700out: 696out:
701 return error; 697 return error;
702} 698}
@@ -709,8 +705,8 @@ asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group
709 error = user_path_walk_link(filename, &nd); 705 error = user_path_walk_link(filename, &nd);
710 if (error) 706 if (error)
711 goto out; 707 goto out;
712 error = chown_common(nd.dentry, user, group); 708 error = chown_common(nd.path.dentry, user, group);
713 path_release(&nd); 709 path_put(&nd.path);
714out: 710out:
715 return error; 711 return error;
716} 712}
@@ -863,7 +859,7 @@ struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry
863 goto out; 859 goto out;
864 if (IS_ERR(dentry)) 860 if (IS_ERR(dentry))
865 goto out_err; 861 goto out_err;
866 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->mnt), 862 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->path.mnt),
867 nd->intent.open.flags - 1, 863 nd->intent.open.flags - 1,
868 nd->intent.open.file, 864 nd->intent.open.file,
869 open); 865 open);
@@ -891,9 +887,10 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)
891 filp = nd->intent.open.file; 887 filp = nd->intent.open.file;
892 /* Has the filesystem initialised the file for us? */ 888 /* Has the filesystem initialised the file for us? */
893 if (filp->f_path.dentry == NULL) 889 if (filp->f_path.dentry == NULL)
894 filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL); 890 filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp,
891 NULL);
895 else 892 else
896 path_release(nd); 893 path_put(&nd->path);
897 return filp; 894 return filp;
898} 895}
899 896
diff --git a/fs/pipe.c b/fs/pipe.c
index a07e9a542064..3c185b6527bc 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -171,7 +171,7 @@ static void anon_pipe_buf_release(struct pipe_inode_info *pipe,
171 * 171 *
172 * Description: 172 * Description:
173 * This function returns a kernel virtual address mapping for the 173 * This function returns a kernel virtual address mapping for the
174 * passed in @pipe_buffer. If @atomic is set, an atomic map is provided 174 * pipe_buffer passed in @buf. If @atomic is set, an atomic map is provided
175 * and the caller has to be careful not to fault before calling 175 * and the caller has to be careful not to fault before calling
176 * the unmap function. 176 * the unmap function.
177 * 177 *
@@ -208,15 +208,15 @@ void generic_pipe_buf_unmap(struct pipe_inode_info *pipe,
208} 208}
209 209
210/** 210/**
211 * generic_pipe_buf_steal - attempt to take ownership of a @pipe_buffer 211 * generic_pipe_buf_steal - attempt to take ownership of a &pipe_buffer
212 * @pipe: the pipe that the buffer belongs to 212 * @pipe: the pipe that the buffer belongs to
213 * @buf: the buffer to attempt to steal 213 * @buf: the buffer to attempt to steal
214 * 214 *
215 * Description: 215 * Description:
216 * This function attempts to steal the @struct page attached to 216 * This function attempts to steal the &struct page attached to
217 * @buf. If successful, this function returns 0 and returns with 217 * @buf. If successful, this function returns 0 and returns with
218 * the page locked. The caller may then reuse the page for whatever 218 * the page locked. The caller may then reuse the page for whatever
219 * he wishes, the typical use is insertion into a different file 219 * he wishes; the typical use is insertion into a different file
220 * page cache. 220 * page cache.
221 */ 221 */
222int generic_pipe_buf_steal(struct pipe_inode_info *pipe, 222int generic_pipe_buf_steal(struct pipe_inode_info *pipe,
@@ -238,7 +238,7 @@ int generic_pipe_buf_steal(struct pipe_inode_info *pipe,
238} 238}
239 239
240/** 240/**
241 * generic_pipe_buf_get - get a reference to a @struct pipe_buffer 241 * generic_pipe_buf_get - get a reference to a &struct pipe_buffer
242 * @pipe: the pipe that the buffer belongs to 242 * @pipe: the pipe that the buffer belongs to
243 * @buf: the buffer to get a reference to 243 * @buf: the buffer to get a reference to
244 * 244 *
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 7c6b4ec83cb7..96ee899d6502 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -153,7 +153,7 @@ static int get_nr_threads(struct task_struct *tsk)
153 return count; 153 return count;
154} 154}
155 155
156static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 156static int proc_cwd_link(struct inode *inode, struct path *path)
157{ 157{
158 struct task_struct *task = get_proc_task(inode); 158 struct task_struct *task = get_proc_task(inode);
159 struct fs_struct *fs = NULL; 159 struct fs_struct *fs = NULL;
@@ -165,8 +165,8 @@ static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfs
165 } 165 }
166 if (fs) { 166 if (fs) {
167 read_lock(&fs->lock); 167 read_lock(&fs->lock);
168 *mnt = mntget(fs->pwdmnt); 168 *path = fs->pwd;
169 *dentry = dget(fs->pwd); 169 path_get(&fs->pwd);
170 read_unlock(&fs->lock); 170 read_unlock(&fs->lock);
171 result = 0; 171 result = 0;
172 put_fs_struct(fs); 172 put_fs_struct(fs);
@@ -174,7 +174,7 @@ static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfs
174 return result; 174 return result;
175} 175}
176 176
177static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 177static int proc_root_link(struct inode *inode, struct path *path)
178{ 178{
179 struct task_struct *task = get_proc_task(inode); 179 struct task_struct *task = get_proc_task(inode);
180 struct fs_struct *fs = NULL; 180 struct fs_struct *fs = NULL;
@@ -186,8 +186,8 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
186 } 186 }
187 if (fs) { 187 if (fs) {
188 read_lock(&fs->lock); 188 read_lock(&fs->lock);
189 *mnt = mntget(fs->rootmnt); 189 *path = fs->root;
190 *dentry = dget(fs->root); 190 path_get(&fs->root);
191 read_unlock(&fs->lock); 191 read_unlock(&fs->lock);
192 result = 0; 192 result = 0;
193 put_fs_struct(fs); 193 put_fs_struct(fs);
@@ -416,6 +416,7 @@ static const struct limit_names lnames[RLIM_NLIMITS] = {
416 [RLIMIT_MSGQUEUE] = {"Max msgqueue size", "bytes"}, 416 [RLIMIT_MSGQUEUE] = {"Max msgqueue size", "bytes"},
417 [RLIMIT_NICE] = {"Max nice priority", NULL}, 417 [RLIMIT_NICE] = {"Max nice priority", NULL},
418 [RLIMIT_RTPRIO] = {"Max realtime priority", NULL}, 418 [RLIMIT_RTPRIO] = {"Max realtime priority", NULL},
419 [RLIMIT_RTTIME] = {"Max realtime timeout", "us"},
419}; 420};
420 421
421/* Display limits for a process */ 422/* Display limits for a process */
@@ -1164,39 +1165,36 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
1164 int error = -EACCES; 1165 int error = -EACCES;
1165 1166
1166 /* We don't need a base pointer in the /proc filesystem */ 1167 /* We don't need a base pointer in the /proc filesystem */
1167 path_release(nd); 1168 path_put(&nd->path);
1168 1169
1169 /* Are we allowed to snoop on the tasks file descriptors? */ 1170 /* Are we allowed to snoop on the tasks file descriptors? */
1170 if (!proc_fd_access_allowed(inode)) 1171 if (!proc_fd_access_allowed(inode))
1171 goto out; 1172 goto out;
1172 1173
1173 error = PROC_I(inode)->op.proc_get_link(inode, &nd->dentry, &nd->mnt); 1174 error = PROC_I(inode)->op.proc_get_link(inode, &nd->path);
1174 nd->last_type = LAST_BIND; 1175 nd->last_type = LAST_BIND;
1175out: 1176out:
1176 return ERR_PTR(error); 1177 return ERR_PTR(error);
1177} 1178}
1178 1179
1179static int do_proc_readlink(struct dentry *dentry, struct vfsmount *mnt, 1180static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
1180 char __user *buffer, int buflen)
1181{ 1181{
1182 struct inode * inode;
1183 char *tmp = (char*)__get_free_page(GFP_TEMPORARY); 1182 char *tmp = (char*)__get_free_page(GFP_TEMPORARY);
1184 char *path; 1183 char *pathname;
1185 int len; 1184 int len;
1186 1185
1187 if (!tmp) 1186 if (!tmp)
1188 return -ENOMEM; 1187 return -ENOMEM;
1189 1188
1190 inode = dentry->d_inode; 1189 pathname = d_path(path, tmp, PAGE_SIZE);
1191 path = d_path(dentry, mnt, tmp, PAGE_SIZE); 1190 len = PTR_ERR(pathname);
1192 len = PTR_ERR(path); 1191 if (IS_ERR(pathname))
1193 if (IS_ERR(path))
1194 goto out; 1192 goto out;
1195 len = tmp + PAGE_SIZE - 1 - path; 1193 len = tmp + PAGE_SIZE - 1 - pathname;
1196 1194
1197 if (len > buflen) 1195 if (len > buflen)
1198 len = buflen; 1196 len = buflen;
1199 if (copy_to_user(buffer, path, len)) 1197 if (copy_to_user(buffer, pathname, len))
1200 len = -EFAULT; 1198 len = -EFAULT;
1201 out: 1199 out:
1202 free_page((unsigned long)tmp); 1200 free_page((unsigned long)tmp);
@@ -1207,20 +1205,18 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
1207{ 1205{
1208 int error = -EACCES; 1206 int error = -EACCES;
1209 struct inode *inode = dentry->d_inode; 1207 struct inode *inode = dentry->d_inode;
1210 struct dentry *de; 1208 struct path path;
1211 struct vfsmount *mnt = NULL;
1212 1209
1213 /* Are we allowed to snoop on the tasks file descriptors? */ 1210 /* Are we allowed to snoop on the tasks file descriptors? */
1214 if (!proc_fd_access_allowed(inode)) 1211 if (!proc_fd_access_allowed(inode))
1215 goto out; 1212 goto out;
1216 1213
1217 error = PROC_I(inode)->op.proc_get_link(inode, &de, &mnt); 1214 error = PROC_I(inode)->op.proc_get_link(inode, &path);
1218 if (error) 1215 if (error)
1219 goto out; 1216 goto out;
1220 1217
1221 error = do_proc_readlink(de, mnt, buffer, buflen); 1218 error = do_proc_readlink(&path, buffer, buflen);
1222 dput(de); 1219 path_put(&path);
1223 mntput(mnt);
1224out: 1220out:
1225 return error; 1221 return error;
1226} 1222}
@@ -1447,8 +1443,7 @@ out:
1447 1443
1448#define PROC_FDINFO_MAX 64 1444#define PROC_FDINFO_MAX 64
1449 1445
1450static int proc_fd_info(struct inode *inode, struct dentry **dentry, 1446static int proc_fd_info(struct inode *inode, struct path *path, char *info)
1451 struct vfsmount **mnt, char *info)
1452{ 1447{
1453 struct task_struct *task = get_proc_task(inode); 1448 struct task_struct *task = get_proc_task(inode);
1454 struct files_struct *files = NULL; 1449 struct files_struct *files = NULL;
@@ -1467,10 +1462,10 @@ static int proc_fd_info(struct inode *inode, struct dentry **dentry,
1467 spin_lock(&files->file_lock); 1462 spin_lock(&files->file_lock);
1468 file = fcheck_files(files, fd); 1463 file = fcheck_files(files, fd);
1469 if (file) { 1464 if (file) {
1470 if (mnt) 1465 if (path) {
1471 *mnt = mntget(file->f_path.mnt); 1466 *path = file->f_path;
1472 if (dentry) 1467 path_get(&file->f_path);
1473 *dentry = dget(file->f_path.dentry); 1468 }
1474 if (info) 1469 if (info)
1475 snprintf(info, PROC_FDINFO_MAX, 1470 snprintf(info, PROC_FDINFO_MAX,
1476 "pos:\t%lli\n" 1471 "pos:\t%lli\n"
@@ -1487,10 +1482,9 @@ static int proc_fd_info(struct inode *inode, struct dentry **dentry,
1487 return -ENOENT; 1482 return -ENOENT;
1488} 1483}
1489 1484
1490static int proc_fd_link(struct inode *inode, struct dentry **dentry, 1485static int proc_fd_link(struct inode *inode, struct path *path)
1491 struct vfsmount **mnt)
1492{ 1486{
1493 return proc_fd_info(inode, dentry, mnt, NULL); 1487 return proc_fd_info(inode, path, NULL);
1494} 1488}
1495 1489
1496static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) 1490static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
@@ -1684,7 +1678,7 @@ static ssize_t proc_fdinfo_read(struct file *file, char __user *buf,
1684 size_t len, loff_t *ppos) 1678 size_t len, loff_t *ppos)
1685{ 1679{
1686 char tmp[PROC_FDINFO_MAX]; 1680 char tmp[PROC_FDINFO_MAX];
1687 int err = proc_fd_info(file->f_path.dentry->d_inode, NULL, NULL, tmp); 1681 int err = proc_fd_info(file->f_path.dentry->d_inode, NULL, tmp);
1688 if (!err) 1682 if (!err)
1689 err = simple_read_from_buffer(buf, len, ppos, tmp, strlen(tmp)); 1683 err = simple_read_from_buffer(buf, len, ppos, tmp, strlen(tmp));
1690 return err; 1684 return err;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index ea496ffeabe7..1c81c8f1aeed 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -48,7 +48,7 @@ extern int maps_protect;
48 48
49extern void create_seq_entry(char *name, mode_t mode, 49extern void create_seq_entry(char *name, mode_t mode,
50 const struct file_operations *f); 50 const struct file_operations *f);
51extern int proc_exe_link(struct inode *, struct dentry **, struct vfsmount **); 51extern int proc_exe_link(struct inode *, struct path *);
52extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, 52extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
53 struct pid *pid, struct task_struct *task); 53 struct pid *pid, struct task_struct *task);
54extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, 54extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index 5d9147b9d738..941e95114b5a 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -67,7 +67,7 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
67 if (len < 1) 67 if (len < 1)
68 len = 1; 68 len = 1;
69 seq_printf(m, "%*c", len, ' '); 69 seq_printf(m, "%*c", len, ' ');
70 seq_path(m, file->f_path.mnt, file->f_path.dentry, ""); 70 seq_path(m, &file->f_path, "");
71 } 71 }
72 72
73 seq_putc(m, '\n'); 73 seq_putc(m, '\n');
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index b9cb23c08f63..614c34b6d1c2 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -407,7 +407,7 @@ static int proc_sys_permission(struct inode *inode, int mask, struct nameidata *
407 if (!nd || !depth) 407 if (!nd || !depth)
408 goto out; 408 goto out;
409 409
410 dentry = nd->dentry; 410 dentry = nd->path.dentry;
411 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); 411 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
412 412
413 /* If the entry does not exist deny permission */ 413 /* If the entry does not exist deny permission */
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index ae4d3f2c8cb2..6dc0334815f7 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -75,7 +75,7 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
75 return mm->total_vm; 75 return mm->total_vm;
76} 76}
77 77
78int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 78int proc_exe_link(struct inode *inode, struct path *path)
79{ 79{
80 struct vm_area_struct * vma; 80 struct vm_area_struct * vma;
81 int result = -ENOENT; 81 int result = -ENOENT;
@@ -98,8 +98,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
98 } 98 }
99 99
100 if (vma) { 100 if (vma) {
101 *mnt = mntget(vma->vm_file->f_path.mnt); 101 *path = vma->vm_file->f_path;
102 *dentry = dget(vma->vm_file->f_path.dentry); 102 path_get(&vma->vm_file->f_path);
103 result = 0; 103 result = 0;
104 } 104 }
105 105
@@ -271,7 +271,7 @@ static int show_map(struct seq_file *m, void *v)
271 */ 271 */
272 if (file) { 272 if (file) {
273 pad_len_spaces(m, len); 273 pad_len_spaces(m, len);
274 seq_path(m, file->f_path.mnt, file->f_path.dentry, "\n"); 274 seq_path(m, &file->f_path, "\n");
275 } else { 275 } else {
276 const char *name = arch_vma_name(vma); 276 const char *name = arch_vma_name(vma);
277 if (!name) { 277 if (!name) {
@@ -531,7 +531,7 @@ struct pagemapread {
531#define PM_RESERVED_BITS 3 531#define PM_RESERVED_BITS 3
532#define PM_RESERVED_OFFSET (64 - PM_RESERVED_BITS) 532#define PM_RESERVED_OFFSET (64 - PM_RESERVED_BITS)
533#define PM_RESERVED_MASK (((1LL<<PM_RESERVED_BITS)-1) << PM_RESERVED_OFFSET) 533#define PM_RESERVED_MASK (((1LL<<PM_RESERVED_BITS)-1) << PM_RESERVED_OFFSET)
534#define PM_SPECIAL(nr) (((nr) << PM_RESERVED_OFFSET) | PM_RESERVED_MASK) 534#define PM_SPECIAL(nr) (((nr) << PM_RESERVED_OFFSET) & PM_RESERVED_MASK)
535#define PM_NOT_PRESENT PM_SPECIAL(1LL) 535#define PM_NOT_PRESENT PM_SPECIAL(1LL)
536#define PM_SWAP PM_SPECIAL(2LL) 536#define PM_SWAP PM_SPECIAL(2LL)
537#define PM_END_OF_BUFFER 1 537#define PM_END_OF_BUFFER 1
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index abfc6f5e56ca..8011528518bd 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -103,7 +103,7 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
103 return size; 103 return size;
104} 104}
105 105
106int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) 106int proc_exe_link(struct inode *inode, struct path *path)
107{ 107{
108 struct vm_list_struct *vml; 108 struct vm_list_struct *vml;
109 struct vm_area_struct *vma; 109 struct vm_area_struct *vma;
@@ -126,8 +126,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
126 } 126 }
127 127
128 if (vma) { 128 if (vma) {
129 *mnt = mntget(vma->vm_file->f_path.mnt); 129 *path = vma->vm_file->f_path;
130 *dentry = dget(vma->vm_file->f_path.dentry); 130 path_get(&vma->vm_file->f_path);
131 result = 0; 131 result = 0;
132 } 132 }
133 133
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 6033f0c3bd0b..6841452e0dea 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2026,29 +2026,29 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2026 if (err) 2026 if (err)
2027 return err; 2027 return err;
2028 /* Quotafile not on the same filesystem? */ 2028 /* Quotafile not on the same filesystem? */
2029 if (nd.mnt->mnt_sb != sb) { 2029 if (nd.path.mnt->mnt_sb != sb) {
2030 path_release(&nd); 2030 path_put(&nd.path);
2031 return -EXDEV; 2031 return -EXDEV;
2032 } 2032 }
2033 /* We must not pack tails for quota files on reiserfs for quota IO to work */ 2033 /* We must not pack tails for quota files on reiserfs for quota IO to work */
2034 if (!REISERFS_I(nd.dentry->d_inode)->i_flags & i_nopack_mask) { 2034 if (!REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask) {
2035 reiserfs_warning(sb, 2035 reiserfs_warning(sb,
2036 "reiserfs: Quota file must have tail packing disabled."); 2036 "reiserfs: Quota file must have tail packing disabled.");
2037 path_release(&nd); 2037 path_put(&nd.path);
2038 return -EINVAL; 2038 return -EINVAL;
2039 } 2039 }
2040 /* Not journalling quota? No more tests needed... */ 2040 /* Not journalling quota? No more tests needed... */
2041 if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && 2041 if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] &&
2042 !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { 2042 !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) {
2043 path_release(&nd); 2043 path_put(&nd.path);
2044 return vfs_quota_on(sb, type, format_id, path); 2044 return vfs_quota_on(sb, type, format_id, path);
2045 } 2045 }
2046 /* Quotafile not of fs root? */ 2046 /* Quotafile not of fs root? */
2047 if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) 2047 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
2048 reiserfs_warning(sb, 2048 reiserfs_warning(sb,
2049 "reiserfs: Quota file not on filesystem root. " 2049 "reiserfs: Quota file not on filesystem root. "
2050 "Journalled quota will not work."); 2050 "Journalled quota will not work.");
2051 path_release(&nd); 2051 path_put(&nd.path);
2052 return vfs_quota_on(sb, type, format_id, path); 2052 return vfs_quota_on(sb, type, format_id, path);
2053} 2053}
2054 2054
diff --git a/fs/seq_file.c b/fs/seq_file.c
index ca71c115bdaa..853770274f20 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -342,13 +342,11 @@ int seq_printf(struct seq_file *m, const char *f, ...)
342} 342}
343EXPORT_SYMBOL(seq_printf); 343EXPORT_SYMBOL(seq_printf);
344 344
345int seq_path(struct seq_file *m, 345int seq_path(struct seq_file *m, struct path *path, char *esc)
346 struct vfsmount *mnt, struct dentry *dentry,
347 char *esc)
348{ 346{
349 if (m->count < m->size) { 347 if (m->count < m->size) {
350 char *s = m->buf + m->count; 348 char *s = m->buf + m->count;
351 char *p = d_path(dentry, mnt, s, m->size - m->count); 349 char *p = d_path(path, s, m->size - m->count);
352 if (!IS_ERR(p)) { 350 if (!IS_ERR(p)) {
353 while (s <= p) { 351 while (s <= p) {
354 char c = *p++; 352 char c = *p++;
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c
index 4e5c22ca802e..376ef3ee6ed7 100644
--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -505,7 +505,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
505 if (warn_count < 5) { 505 if (warn_count < 5) {
506 warn_count++; 506 warn_count++;
507 printk(KERN_EMERG "smbfs is deprecated and will be removed" 507 printk(KERN_EMERG "smbfs is deprecated and will be removed"
508 "from the 2.6.27 kernel. Please migrate to cifs\n"); 508 " from the 2.6.27 kernel. Please migrate to cifs\n");
509 } 509 }
510 510
511 if (!raw_data) 511 if (!raw_data)
diff --git a/fs/stat.c b/fs/stat.c
index 68510068a641..9cf41f719d50 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -62,8 +62,8 @@ int vfs_stat_fd(int dfd, char __user *name, struct kstat *stat)
62 62
63 error = __user_walk_fd(dfd, name, LOOKUP_FOLLOW, &nd); 63 error = __user_walk_fd(dfd, name, LOOKUP_FOLLOW, &nd);
64 if (!error) { 64 if (!error) {
65 error = vfs_getattr(nd.mnt, nd.dentry, stat); 65 error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat);
66 path_release(&nd); 66 path_put(&nd.path);
67 } 67 }
68 return error; 68 return error;
69} 69}
@@ -82,8 +82,8 @@ int vfs_lstat_fd(int dfd, char __user *name, struct kstat *stat)
82 82
83 error = __user_walk_fd(dfd, name, 0, &nd); 83 error = __user_walk_fd(dfd, name, 0, &nd);
84 if (!error) { 84 if (!error) {
85 error = vfs_getattr(nd.mnt, nd.dentry, stat); 85 error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat);
86 path_release(&nd); 86 path_put(&nd.path);
87 } 87 }
88 return error; 88 return error;
89} 89}
@@ -302,17 +302,18 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *path,
302 302
303 error = __user_walk_fd(dfd, path, 0, &nd); 303 error = __user_walk_fd(dfd, path, 0, &nd);
304 if (!error) { 304 if (!error) {
305 struct inode * inode = nd.dentry->d_inode; 305 struct inode *inode = nd.path.dentry->d_inode;
306 306
307 error = -EINVAL; 307 error = -EINVAL;
308 if (inode->i_op && inode->i_op->readlink) { 308 if (inode->i_op && inode->i_op->readlink) {
309 error = security_inode_readlink(nd.dentry); 309 error = security_inode_readlink(nd.path.dentry);
310 if (!error) { 310 if (!error) {
311 touch_atime(nd.mnt, nd.dentry); 311 touch_atime(nd.path.mnt, nd.path.dentry);
312 error = inode->i_op->readlink(nd.dentry, buf, bufsiz); 312 error = inode->i_op->readlink(nd.path.dentry,
313 buf, bufsiz);
313 } 314 }
314 } 315 }
315 path_release(&nd); 316 path_put(&nd.path);
316 } 317 }
317 return error; 318 return error;
318} 319}
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index d721a1af1972..f855dcbbdfb8 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -145,7 +145,7 @@ static bool udf_add_free_space(struct udf_sb_info *sbi,
145{ 145{
146 struct logicalVolIntegrityDesc *lvid; 146 struct logicalVolIntegrityDesc *lvid;
147 147
148 if (sbi->s_lvid_bh) 148 if (sbi->s_lvid_bh == NULL)
149 return false; 149 return false;
150 150
151 lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data; 151 lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data;
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 4b44e23caa12..8d8643ada199 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -43,13 +43,13 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
43 struct fileIdentDesc *fi = NULL; 43 struct fileIdentDesc *fi = NULL;
44 struct fileIdentDesc cfi; 44 struct fileIdentDesc cfi;
45 int block, iblock; 45 int block, iblock;
46 loff_t nf_pos = filp->f_pos - 1; 46 loff_t nf_pos = (filp->f_pos - 1) << 2;
47 int flen; 47 int flen;
48 char fname[UDF_NAME_LEN]; 48 char fname[UDF_NAME_LEN];
49 char *nameptr; 49 char *nameptr;
50 uint16_t liu; 50 uint16_t liu;
51 uint8_t lfi; 51 uint8_t lfi;
52 loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; 52 loff_t size = udf_ext0_offset(dir) + dir->i_size;
53 struct buffer_head *tmp, *bha[16]; 53 struct buffer_head *tmp, *bha[16];
54 kernel_lb_addr eloc; 54 kernel_lb_addr eloc;
55 uint32_t elen; 55 uint32_t elen;
@@ -63,13 +63,13 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
63 return 0; 63 return 0;
64 64
65 if (nf_pos == 0) 65 if (nf_pos == 0)
66 nf_pos = (udf_ext0_offset(dir) >> 2); 66 nf_pos = udf_ext0_offset(dir);
67 67
68 fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; 68 fibh.soffset = fibh.eoffset = nf_pos & (dir->i_sb->s_blocksize - 1);
69 iinfo = UDF_I(dir); 69 iinfo = UDF_I(dir);
70 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { 70 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
71 fibh.sbh = fibh.ebh = NULL; 71 fibh.sbh = fibh.ebh = NULL;
72 } else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2), 72 } else if (inode_bmap(dir, nf_pos >> dir->i_sb->s_blocksize_bits,
73 &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) { 73 &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) {
74 block = udf_get_lb_pblock(dir->i_sb, eloc, offset); 74 block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
75 if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 75 if ((++offset << dir->i_sb->s_blocksize_bits) < elen) {
@@ -111,7 +111,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
111 } 111 }
112 112
113 while (nf_pos < size) { 113 while (nf_pos < size) {
114 filp->f_pos = nf_pos + 1; 114 filp->f_pos = (nf_pos >> 2) + 1;
115 115
116 fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc, 116 fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
117 &elen, &offset); 117 &elen, &offset);
@@ -178,7 +178,7 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
178 } 178 }
179 } /* end while */ 179 } /* end while */
180 180
181 filp->f_pos = nf_pos + 1; 181 filp->f_pos = (nf_pos >> 2) + 1;
182 182
183 if (fibh.sbh != fibh.ebh) 183 if (fibh.sbh != fibh.ebh)
184 brelse(fibh.ebh); 184 brelse(fibh.ebh);
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index b26fc4dec1e7..23ceed8c8fb9 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -58,7 +58,7 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1,
58{ 58{
59 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { 59 switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) {
60 case UFS_ST_SUNOS: 60 case UFS_ST_SUNOS:
61 if (fs32_to_cpu(sb, usb3->fs_postblformat == UFS_42POSTBLFMT)) { 61 if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT) {
62 usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value); 62 usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value);
63 break; 63 break;
64 } 64 }
diff --git a/fs/utimes.c b/fs/utimes.c
index e5588cd8530e..b18da9c0b97f 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -84,7 +84,7 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
84 if (error) 84 if (error)
85 goto out; 85 goto out;
86 86
87 dentry = nd.dentry; 87 dentry = nd.path.dentry;
88 } 88 }
89 89
90 inode = dentry->d_inode; 90 inode = dentry->d_inode;
@@ -138,7 +138,7 @@ dput_and_out:
138 if (f) 138 if (f)
139 fput(f); 139 fput(f);
140 else 140 else
141 path_release(&nd); 141 path_put(&nd.path);
142out: 142out:
143 return error; 143 return error;
144} 144}
diff --git a/fs/xattr.c b/fs/xattr.c
index f7c8f87bb390..3acab1615460 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -262,8 +262,8 @@ sys_setxattr(char __user *path, char __user *name, void __user *value,
262 error = user_path_walk(path, &nd); 262 error = user_path_walk(path, &nd);
263 if (error) 263 if (error)
264 return error; 264 return error;
265 error = setxattr(nd.dentry, name, value, size, flags); 265 error = setxattr(nd.path.dentry, name, value, size, flags);
266 path_release(&nd); 266 path_put(&nd.path);
267 return error; 267 return error;
268} 268}
269 269
@@ -277,8 +277,8 @@ sys_lsetxattr(char __user *path, char __user *name, void __user *value,
277 error = user_path_walk_link(path, &nd); 277 error = user_path_walk_link(path, &nd);
278 if (error) 278 if (error)
279 return error; 279 return error;
280 error = setxattr(nd.dentry, name, value, size, flags); 280 error = setxattr(nd.path.dentry, name, value, size, flags);
281 path_release(&nd); 281 path_put(&nd.path);
282 return error; 282 return error;
283} 283}
284 284
@@ -347,8 +347,8 @@ sys_getxattr(char __user *path, char __user *name, void __user *value,
347 error = user_path_walk(path, &nd); 347 error = user_path_walk(path, &nd);
348 if (error) 348 if (error)
349 return error; 349 return error;
350 error = getxattr(nd.dentry, name, value, size); 350 error = getxattr(nd.path.dentry, name, value, size);
351 path_release(&nd); 351 path_put(&nd.path);
352 return error; 352 return error;
353} 353}
354 354
@@ -362,8 +362,8 @@ sys_lgetxattr(char __user *path, char __user *name, void __user *value,
362 error = user_path_walk_link(path, &nd); 362 error = user_path_walk_link(path, &nd);
363 if (error) 363 if (error)
364 return error; 364 return error;
365 error = getxattr(nd.dentry, name, value, size); 365 error = getxattr(nd.path.dentry, name, value, size);
366 path_release(&nd); 366 path_put(&nd.path);
367 return error; 367 return error;
368} 368}
369 369
@@ -421,8 +421,8 @@ sys_listxattr(char __user *path, char __user *list, size_t size)
421 error = user_path_walk(path, &nd); 421 error = user_path_walk(path, &nd);
422 if (error) 422 if (error)
423 return error; 423 return error;
424 error = listxattr(nd.dentry, list, size); 424 error = listxattr(nd.path.dentry, list, size);
425 path_release(&nd); 425 path_put(&nd.path);
426 return error; 426 return error;
427} 427}
428 428
@@ -435,8 +435,8 @@ sys_llistxattr(char __user *path, char __user *list, size_t size)
435 error = user_path_walk_link(path, &nd); 435 error = user_path_walk_link(path, &nd);
436 if (error) 436 if (error)
437 return error; 437 return error;
438 error = listxattr(nd.dentry, list, size); 438 error = listxattr(nd.path.dentry, list, size);
439 path_release(&nd); 439 path_put(&nd.path);
440 return error; 440 return error;
441} 441}
442 442
@@ -482,8 +482,8 @@ sys_removexattr(char __user *path, char __user *name)
482 error = user_path_walk(path, &nd); 482 error = user_path_walk(path, &nd);
483 if (error) 483 if (error)
484 return error; 484 return error;
485 error = removexattr(nd.dentry, name); 485 error = removexattr(nd.path.dentry, name);
486 path_release(&nd); 486 path_put(&nd.path);
487 return error; 487 return error;
488} 488}
489 489
@@ -496,8 +496,8 @@ sys_lremovexattr(char __user *path, char __user *name)
496 error = user_path_walk_link(path, &nd); 496 error = user_path_walk_link(path, &nd);
497 if (error) 497 if (error)
498 return error; 498 return error;
499 error = removexattr(nd.dentry, name); 499 error = removexattr(nd.path.dentry, name);
500 path_release(&nd); 500 path_put(&nd.path);
501 return error; 501 return error;
502} 502}
503 503
diff --git a/fs/xfs/Kbuild b/fs/xfs/Kbuild
deleted file mode 100644
index 2566e96706f1..000000000000
--- a/fs/xfs/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
1#
2# The xfs people like to share Makefile with 2.6 and 2.4.
3# Utilise file named Kbuild file which has precedence over Makefile.
4#
5
6include $(srctree)/$(obj)/Makefile-linux-2.6
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 49e3e7e5e3dc..36ec614e699a 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -1 +1,117 @@
1include $(TOPDIR)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL) 1#
2# Copyright (c) 2000-2005 Silicon Graphics, Inc.
3# All Rights Reserved.
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it would 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 the Free Software Foundation,
16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18
19EXTRA_CFLAGS += -I$(src) -I$(src)/linux-2.6 -funsigned-char
20
21XFS_LINUX := linux-2.6
22
23ifeq ($(CONFIG_XFS_DEBUG),y)
24 EXTRA_CFLAGS += -g
25endif
26
27obj-$(CONFIG_XFS_FS) += xfs.o
28
29xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \
30 xfs_dquot.o \
31 xfs_dquot_item.o \
32 xfs_trans_dquot.o \
33 xfs_qm_syscalls.o \
34 xfs_qm_bhv.o \
35 xfs_qm.o)
36
37ifeq ($(CONFIG_XFS_QUOTA),y)
38xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o
39endif
40
41xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
42xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o
43xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o
44xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o
45xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o
46
47
48xfs-y += xfs_alloc.o \
49 xfs_alloc_btree.o \
50 xfs_attr.o \
51 xfs_attr_leaf.o \
52 xfs_bit.o \
53 xfs_bmap.o \
54 xfs_bmap_btree.o \
55 xfs_btree.o \
56 xfs_buf_item.o \
57 xfs_da_btree.o \
58 xfs_dir2.o \
59 xfs_dir2_block.o \
60 xfs_dir2_data.o \
61 xfs_dir2_leaf.o \
62 xfs_dir2_node.o \
63 xfs_dir2_sf.o \
64 xfs_error.o \
65 xfs_extfree_item.o \
66 xfs_filestream.o \
67 xfs_fsops.o \
68 xfs_ialloc.o \
69 xfs_ialloc_btree.o \
70 xfs_iget.o \
71 xfs_inode.o \
72 xfs_inode_item.o \
73 xfs_iomap.o \
74 xfs_itable.o \
75 xfs_dfrag.o \
76 xfs_log.o \
77 xfs_log_recover.o \
78 xfs_mount.o \
79 xfs_mru_cache.o \
80 xfs_rename.o \
81 xfs_trans.o \
82 xfs_trans_ail.o \
83 xfs_trans_buf.o \
84 xfs_trans_extfree.o \
85 xfs_trans_inode.o \
86 xfs_trans_item.o \
87 xfs_utils.o \
88 xfs_vfsops.o \
89 xfs_vnodeops.o \
90 xfs_rw.o \
91 xfs_dmops.o \
92 xfs_qmops.o
93
94xfs-$(CONFIG_XFS_TRACE) += xfs_dir2_trace.o
95
96# Objects in linux/
97xfs-y += $(addprefix $(XFS_LINUX)/, \
98 kmem.o \
99 xfs_aops.o \
100 xfs_buf.o \
101 xfs_export.o \
102 xfs_file.o \
103 xfs_fs_subr.o \
104 xfs_globals.o \
105 xfs_ioctl.o \
106 xfs_iops.o \
107 xfs_lrw.o \
108 xfs_super.o \
109 xfs_vnode.o)
110
111# Objects in support/
112xfs-y += $(addprefix support/, \
113 debug.o \
114 uuid.o)
115
116xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o
117
diff --git a/fs/xfs/Makefile-linux-2.6 b/fs/xfs/Makefile-linux-2.6
deleted file mode 100644
index 97316451fc6d..000000000000
--- a/fs/xfs/Makefile-linux-2.6
+++ /dev/null
@@ -1,117 +0,0 @@
1#
2# Copyright (c) 2000-2005 Silicon Graphics, Inc.
3# All Rights Reserved.
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it would 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 the Free Software Foundation,
16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18
19EXTRA_CFLAGS += -Ifs/xfs -Ifs/xfs/linux-2.6 -funsigned-char
20
21XFS_LINUX := linux-2.6
22
23ifeq ($(CONFIG_XFS_DEBUG),y)
24 EXTRA_CFLAGS += -g
25endif
26
27obj-$(CONFIG_XFS_FS) += xfs.o
28
29xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \
30 xfs_dquot.o \
31 xfs_dquot_item.o \
32 xfs_trans_dquot.o \
33 xfs_qm_syscalls.o \
34 xfs_qm_bhv.o \
35 xfs_qm.o)
36
37ifeq ($(CONFIG_XFS_QUOTA),y)
38xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o
39endif
40
41xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
42xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o
43xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o
44xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o
45xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o
46
47
48xfs-y += xfs_alloc.o \
49 xfs_alloc_btree.o \
50 xfs_attr.o \
51 xfs_attr_leaf.o \
52 xfs_bit.o \
53 xfs_bmap.o \
54 xfs_bmap_btree.o \
55 xfs_btree.o \
56 xfs_buf_item.o \
57 xfs_da_btree.o \
58 xfs_dir2.o \
59 xfs_dir2_block.o \
60 xfs_dir2_data.o \
61 xfs_dir2_leaf.o \
62 xfs_dir2_node.o \
63 xfs_dir2_sf.o \
64 xfs_error.o \
65 xfs_extfree_item.o \
66 xfs_filestream.o \
67 xfs_fsops.o \
68 xfs_ialloc.o \
69 xfs_ialloc_btree.o \
70 xfs_iget.o \
71 xfs_inode.o \
72 xfs_inode_item.o \
73 xfs_iomap.o \
74 xfs_itable.o \
75 xfs_dfrag.o \
76 xfs_log.o \
77 xfs_log_recover.o \
78 xfs_mount.o \
79 xfs_mru_cache.o \
80 xfs_rename.o \
81 xfs_trans.o \
82 xfs_trans_ail.o \
83 xfs_trans_buf.o \
84 xfs_trans_extfree.o \
85 xfs_trans_inode.o \
86 xfs_trans_item.o \
87 xfs_utils.o \
88 xfs_vfsops.o \
89 xfs_vnodeops.o \
90 xfs_rw.o \
91 xfs_dmops.o \
92 xfs_qmops.o
93
94xfs-$(CONFIG_XFS_TRACE) += xfs_dir2_trace.o
95
96# Objects in linux/
97xfs-y += $(addprefix $(XFS_LINUX)/, \
98 kmem.o \
99 xfs_aops.o \
100 xfs_buf.o \
101 xfs_export.o \
102 xfs_file.o \
103 xfs_fs_subr.o \
104 xfs_globals.o \
105 xfs_ioctl.o \
106 xfs_iops.o \
107 xfs_lrw.o \
108 xfs_super.o \
109 xfs_vnode.o)
110
111# Objects in support/
112xfs-y += $(addprefix support/, \
113 debug.o \
114 uuid.o)
115
116xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o
117
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 4c82a050a3a8..a9952e490ac9 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -91,10 +91,10 @@ xfs_find_handle(
91 if (error) 91 if (error)
92 return error; 92 return error;
93 93
94 ASSERT(nd.dentry); 94 ASSERT(nd.path.dentry);
95 ASSERT(nd.dentry->d_inode); 95 ASSERT(nd.path.dentry->d_inode);
96 inode = igrab(nd.dentry->d_inode); 96 inode = igrab(nd.path.dentry->d_inode);
97 path_release(&nd); 97 path_put(&nd.path);
98 break; 98 break;
99 } 99 }
100 100
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 35582fe9d648..1f3da5b8657b 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1648,14 +1648,14 @@ xfs_qm_quotacheck_dqadjust(
1648 * Adjust the inode count and the block count to reflect this inode's 1648 * Adjust the inode count and the block count to reflect this inode's
1649 * resource usage. 1649 * resource usage.
1650 */ 1650 */
1651 be64_add(&dqp->q_core.d_icount, 1); 1651 be64_add_cpu(&dqp->q_core.d_icount, 1);
1652 dqp->q_res_icount++; 1652 dqp->q_res_icount++;
1653 if (nblks) { 1653 if (nblks) {
1654 be64_add(&dqp->q_core.d_bcount, nblks); 1654 be64_add_cpu(&dqp->q_core.d_bcount, nblks);
1655 dqp->q_res_bcount += nblks; 1655 dqp->q_res_bcount += nblks;
1656 } 1656 }
1657 if (rtblks) { 1657 if (rtblks) {
1658 be64_add(&dqp->q_core.d_rtbcount, rtblks); 1658 be64_add_cpu(&dqp->q_core.d_rtbcount, rtblks);
1659 dqp->q_res_rtbcount += rtblks; 1659 dqp->q_res_rtbcount += rtblks;
1660 } 1660 }
1661 1661
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index 7de6874bf1b8..f441f836ca8b 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -421,13 +421,13 @@ xfs_trans_apply_dquot_deltas(
421 (xfs_qcnt_t) -qtrx->qt_icount_delta); 421 (xfs_qcnt_t) -qtrx->qt_icount_delta);
422#endif 422#endif
423 if (totalbdelta) 423 if (totalbdelta)
424 be64_add(&d->d_bcount, (xfs_qcnt_t)totalbdelta); 424 be64_add_cpu(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
425 425
426 if (qtrx->qt_icount_delta) 426 if (qtrx->qt_icount_delta)
427 be64_add(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta); 427 be64_add_cpu(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
428 428
429 if (totalrtbdelta) 429 if (totalrtbdelta)
430 be64_add(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta); 430 be64_add_cpu(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
431 431
432 /* 432 /*
433 * Get any default limits in use. 433 * Get any default limits in use.
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index ea6aa60ace06..bdbfbbee4959 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -592,7 +592,7 @@ xfs_alloc_ag_vextent(
592 if (!(args->wasfromfl)) { 592 if (!(args->wasfromfl)) {
593 593
594 agf = XFS_BUF_TO_AGF(args->agbp); 594 agf = XFS_BUF_TO_AGF(args->agbp);
595 be32_add(&agf->agf_freeblks, -(args->len)); 595 be32_add_cpu(&agf->agf_freeblks, -(args->len));
596 xfs_trans_agblocks_delta(args->tp, 596 xfs_trans_agblocks_delta(args->tp,
597 -((long)(args->len))); 597 -((long)(args->len)));
598 args->pag->pagf_freeblks -= args->len; 598 args->pag->pagf_freeblks -= args->len;
@@ -1720,7 +1720,7 @@ xfs_free_ag_extent(
1720 1720
1721 agf = XFS_BUF_TO_AGF(agbp); 1721 agf = XFS_BUF_TO_AGF(agbp);
1722 pag = &mp->m_perag[agno]; 1722 pag = &mp->m_perag[agno];
1723 be32_add(&agf->agf_freeblks, len); 1723 be32_add_cpu(&agf->agf_freeblks, len);
1724 xfs_trans_agblocks_delta(tp, len); 1724 xfs_trans_agblocks_delta(tp, len);
1725 pag->pagf_freeblks += len; 1725 pag->pagf_freeblks += len;
1726 XFS_WANT_CORRUPTED_GOTO( 1726 XFS_WANT_CORRUPTED_GOTO(
@@ -2008,18 +2008,18 @@ xfs_alloc_get_freelist(
2008 * Get the block number and update the data structures. 2008 * Get the block number and update the data structures.
2009 */ 2009 */
2010 bno = be32_to_cpu(agfl->agfl_bno[be32_to_cpu(agf->agf_flfirst)]); 2010 bno = be32_to_cpu(agfl->agfl_bno[be32_to_cpu(agf->agf_flfirst)]);
2011 be32_add(&agf->agf_flfirst, 1); 2011 be32_add_cpu(&agf->agf_flfirst, 1);
2012 xfs_trans_brelse(tp, agflbp); 2012 xfs_trans_brelse(tp, agflbp);
2013 if (be32_to_cpu(agf->agf_flfirst) == XFS_AGFL_SIZE(mp)) 2013 if (be32_to_cpu(agf->agf_flfirst) == XFS_AGFL_SIZE(mp))
2014 agf->agf_flfirst = 0; 2014 agf->agf_flfirst = 0;
2015 pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)]; 2015 pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)];
2016 be32_add(&agf->agf_flcount, -1); 2016 be32_add_cpu(&agf->agf_flcount, -1);
2017 xfs_trans_agflist_delta(tp, -1); 2017 xfs_trans_agflist_delta(tp, -1);
2018 pag->pagf_flcount--; 2018 pag->pagf_flcount--;
2019 2019
2020 logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT; 2020 logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT;
2021 if (btreeblk) { 2021 if (btreeblk) {
2022 be32_add(&agf->agf_btreeblks, 1); 2022 be32_add_cpu(&agf->agf_btreeblks, 1);
2023 pag->pagf_btreeblks++; 2023 pag->pagf_btreeblks++;
2024 logflags |= XFS_AGF_BTREEBLKS; 2024 logflags |= XFS_AGF_BTREEBLKS;
2025 } 2025 }
@@ -2117,17 +2117,17 @@ xfs_alloc_put_freelist(
2117 be32_to_cpu(agf->agf_seqno), &agflbp))) 2117 be32_to_cpu(agf->agf_seqno), &agflbp)))
2118 return error; 2118 return error;
2119 agfl = XFS_BUF_TO_AGFL(agflbp); 2119 agfl = XFS_BUF_TO_AGFL(agflbp);
2120 be32_add(&agf->agf_fllast, 1); 2120 be32_add_cpu(&agf->agf_fllast, 1);
2121 if (be32_to_cpu(agf->agf_fllast) == XFS_AGFL_SIZE(mp)) 2121 if (be32_to_cpu(agf->agf_fllast) == XFS_AGFL_SIZE(mp))
2122 agf->agf_fllast = 0; 2122 agf->agf_fllast = 0;
2123 pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)]; 2123 pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)];
2124 be32_add(&agf->agf_flcount, 1); 2124 be32_add_cpu(&agf->agf_flcount, 1);
2125 xfs_trans_agflist_delta(tp, 1); 2125 xfs_trans_agflist_delta(tp, 1);
2126 pag->pagf_flcount++; 2126 pag->pagf_flcount++;
2127 2127
2128 logflags = XFS_AGF_FLLAST | XFS_AGF_FLCOUNT; 2128 logflags = XFS_AGF_FLLAST | XFS_AGF_FLCOUNT;
2129 if (btreeblk) { 2129 if (btreeblk) {
2130 be32_add(&agf->agf_btreeblks, -1); 2130 be32_add_cpu(&agf->agf_btreeblks, -1);
2131 pag->pagf_btreeblks--; 2131 pag->pagf_btreeblks--;
2132 logflags |= XFS_AGF_BTREEBLKS; 2132 logflags |= XFS_AGF_BTREEBLKS;
2133 } 2133 }
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c
index 1603ce595853..3ce2645508ae 100644
--- a/fs/xfs/xfs_alloc_btree.c
+++ b/fs/xfs/xfs_alloc_btree.c
@@ -221,7 +221,7 @@ xfs_alloc_delrec(
221 */ 221 */
222 bno = be32_to_cpu(agf->agf_roots[cur->bc_btnum]); 222 bno = be32_to_cpu(agf->agf_roots[cur->bc_btnum]);
223 agf->agf_roots[cur->bc_btnum] = *lpp; 223 agf->agf_roots[cur->bc_btnum] = *lpp;
224 be32_add(&agf->agf_levels[cur->bc_btnum], -1); 224 be32_add_cpu(&agf->agf_levels[cur->bc_btnum], -1);
225 mp->m_perag[be32_to_cpu(agf->agf_seqno)].pagf_levels[cur->bc_btnum]--; 225 mp->m_perag[be32_to_cpu(agf->agf_seqno)].pagf_levels[cur->bc_btnum]--;
226 /* 226 /*
227 * Put this buffer/block on the ag's freelist. 227 * Put this buffer/block on the ag's freelist.
@@ -1256,9 +1256,9 @@ xfs_alloc_lshift(
1256 /* 1256 /*
1257 * Bump and log left's numrecs, decrement and log right's numrecs. 1257 * Bump and log left's numrecs, decrement and log right's numrecs.
1258 */ 1258 */
1259 be16_add(&left->bb_numrecs, 1); 1259 be16_add_cpu(&left->bb_numrecs, 1);
1260 xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1260 xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1261 be16_add(&right->bb_numrecs, -1); 1261 be16_add_cpu(&right->bb_numrecs, -1);
1262 xfs_alloc_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS); 1262 xfs_alloc_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS);
1263 /* 1263 /*
1264 * Slide the contents of right down one entry. 1264 * Slide the contents of right down one entry.
@@ -1346,7 +1346,7 @@ xfs_alloc_newroot(
1346 1346
1347 agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp); 1347 agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp);
1348 agf->agf_roots[cur->bc_btnum] = cpu_to_be32(nbno); 1348 agf->agf_roots[cur->bc_btnum] = cpu_to_be32(nbno);
1349 be32_add(&agf->agf_levels[cur->bc_btnum], 1); 1349 be32_add_cpu(&agf->agf_levels[cur->bc_btnum], 1);
1350 seqno = be32_to_cpu(agf->agf_seqno); 1350 seqno = be32_to_cpu(agf->agf_seqno);
1351 mp->m_perag[seqno].pagf_levels[cur->bc_btnum]++; 1351 mp->m_perag[seqno].pagf_levels[cur->bc_btnum]++;
1352 xfs_alloc_log_agf(cur->bc_tp, cur->bc_private.a.agbp, 1352 xfs_alloc_log_agf(cur->bc_tp, cur->bc_private.a.agbp,
@@ -1558,9 +1558,9 @@ xfs_alloc_rshift(
1558 /* 1558 /*
1559 * Decrement and log left's numrecs, bump and log right's numrecs. 1559 * Decrement and log left's numrecs, bump and log right's numrecs.
1560 */ 1560 */
1561 be16_add(&left->bb_numrecs, -1); 1561 be16_add_cpu(&left->bb_numrecs, -1);
1562 xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1562 xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1563 be16_add(&right->bb_numrecs, 1); 1563 be16_add_cpu(&right->bb_numrecs, 1);
1564 xfs_alloc_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS); 1564 xfs_alloc_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS);
1565 /* 1565 /*
1566 * Using a temporary cursor, update the parent key values of the 1566 * Using a temporary cursor, update the parent key values of the
@@ -1643,7 +1643,7 @@ xfs_alloc_split(
1643 */ 1643 */
1644 if ((be16_to_cpu(left->bb_numrecs) & 1) && 1644 if ((be16_to_cpu(left->bb_numrecs) & 1) &&
1645 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1) 1645 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1)
1646 be16_add(&right->bb_numrecs, 1); 1646 be16_add_cpu(&right->bb_numrecs, 1);
1647 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1; 1647 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1;
1648 /* 1648 /*
1649 * For non-leaf blocks, copy keys and addresses over to the new block. 1649 * For non-leaf blocks, copy keys and addresses over to the new block.
@@ -1689,7 +1689,7 @@ xfs_alloc_split(
1689 * Adjust numrecs, sibling pointers. 1689 * Adjust numrecs, sibling pointers.
1690 */ 1690 */
1691 lbno = XFS_DADDR_TO_AGBNO(cur->bc_mp, XFS_BUF_ADDR(lbp)); 1691 lbno = XFS_DADDR_TO_AGBNO(cur->bc_mp, XFS_BUF_ADDR(lbp));
1692 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs))); 1692 be16_add_cpu(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs)));
1693 right->bb_rightsib = left->bb_rightsib; 1693 right->bb_rightsib = left->bb_rightsib;
1694 left->bb_rightsib = cpu_to_be32(rbno); 1694 left->bb_rightsib = cpu_to_be32(rbno);
1695 right->bb_leftsib = cpu_to_be32(lbno); 1695 right->bb_leftsib = cpu_to_be32(lbno);
diff --git a/fs/xfs/xfs_arch.h b/fs/xfs/xfs_arch.h
index c4836890b726..f9472a2076d4 100644
--- a/fs/xfs/xfs_arch.h
+++ b/fs/xfs/xfs_arch.h
@@ -170,21 +170,6 @@
170 } \ 170 } \
171} 171}
172 172
173static inline void be16_add(__be16 *a, __s16 b)
174{
175 *a = cpu_to_be16(be16_to_cpu(*a) + b);
176}
177
178static inline void be32_add(__be32 *a, __s32 b)
179{
180 *a = cpu_to_be32(be32_to_cpu(*a) + b);
181}
182
183static inline void be64_add(__be64 *a, __s64 b)
184{
185 *a = cpu_to_be64(be64_to_cpu(*a) + b);
186}
187
188/* 173/*
189 * In directories inode numbers are stored as unaligned arrays of unsigned 174 * In directories inode numbers are stored as unaligned arrays of unsigned
190 * 8bit integers on disk. 175 * 8bit integers on disk.
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index eb3815ebb7aa..b08e2a2a8add 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -317,7 +317,7 @@ xfs_attr_shortform_add(xfs_da_args_t *args, int forkoff)
317 memcpy(sfe->nameval, args->name, args->namelen); 317 memcpy(sfe->nameval, args->name, args->namelen);
318 memcpy(&sfe->nameval[args->namelen], args->value, args->valuelen); 318 memcpy(&sfe->nameval[args->namelen], args->value, args->valuelen);
319 sf->hdr.count++; 319 sf->hdr.count++;
320 be16_add(&sf->hdr.totsize, size); 320 be16_add_cpu(&sf->hdr.totsize, size);
321 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); 321 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
322 322
323 xfs_sbversion_add_attr2(mp, args->trans); 323 xfs_sbversion_add_attr2(mp, args->trans);
@@ -363,7 +363,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
363 if (end != totsize) 363 if (end != totsize)
364 memmove(&((char *)sf)[base], &((char *)sf)[end], totsize - end); 364 memmove(&((char *)sf)[base], &((char *)sf)[end], totsize - end);
365 sf->hdr.count--; 365 sf->hdr.count--;
366 be16_add(&sf->hdr.totsize, -size); 366 be16_add_cpu(&sf->hdr.totsize, -size);
367 367
368 /* 368 /*
369 * Fix up the start offset of the attribute fork 369 * Fix up the start offset of the attribute fork
@@ -1133,7 +1133,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1133 xfs_da_log_buf(args->trans, bp, 1133 xfs_da_log_buf(args->trans, bp,
1134 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry))); 1134 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry)));
1135 } 1135 }
1136 be16_add(&hdr->count, 1); 1136 be16_add_cpu(&hdr->count, 1);
1137 1137
1138 /* 1138 /*
1139 * Allocate space for the new string (at the end of the run). 1139 * Allocate space for the new string (at the end of the run).
@@ -1147,7 +1147,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1147 mp->m_sb.sb_blocksize, NULL)); 1147 mp->m_sb.sb_blocksize, NULL));
1148 ASSERT(be16_to_cpu(map->size) < XFS_LBSIZE(mp)); 1148 ASSERT(be16_to_cpu(map->size) < XFS_LBSIZE(mp));
1149 ASSERT((be16_to_cpu(map->size) & 0x3) == 0); 1149 ASSERT((be16_to_cpu(map->size) & 0x3) == 0);
1150 be16_add(&map->size, 1150 be16_add_cpu(&map->size,
1151 -xfs_attr_leaf_newentsize(args->namelen, args->valuelen, 1151 -xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
1152 mp->m_sb.sb_blocksize, &tmp)); 1152 mp->m_sb.sb_blocksize, &tmp));
1153 entry->nameidx = cpu_to_be16(be16_to_cpu(map->base) + 1153 entry->nameidx = cpu_to_be16(be16_to_cpu(map->base) +
@@ -1214,12 +1214,12 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1214 map = &hdr->freemap[0]; 1214 map = &hdr->freemap[0];
1215 for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; map++, i++) { 1215 for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; map++, i++) {
1216 if (be16_to_cpu(map->base) == tmp) { 1216 if (be16_to_cpu(map->base) == tmp) {
1217 be16_add(&map->base, sizeof(xfs_attr_leaf_entry_t)); 1217 be16_add_cpu(&map->base, sizeof(xfs_attr_leaf_entry_t));
1218 be16_add(&map->size, 1218 be16_add_cpu(&map->size,
1219 -((int)sizeof(xfs_attr_leaf_entry_t))); 1219 -((int)sizeof(xfs_attr_leaf_entry_t)));
1220 } 1220 }
1221 } 1221 }
1222 be16_add(&hdr->usedbytes, xfs_attr_leaf_entsize(leaf, args->index)); 1222 be16_add_cpu(&hdr->usedbytes, xfs_attr_leaf_entsize(leaf, args->index));
1223 xfs_da_log_buf(args->trans, bp, 1223 xfs_da_log_buf(args->trans, bp,
1224 XFS_DA_LOGRANGE(leaf, hdr, sizeof(*hdr))); 1224 XFS_DA_LOGRANGE(leaf, hdr, sizeof(*hdr)));
1225 return(0); 1225 return(0);
@@ -1727,9 +1727,9 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1727 ASSERT(be16_to_cpu(map->base) < XFS_LBSIZE(mp)); 1727 ASSERT(be16_to_cpu(map->base) < XFS_LBSIZE(mp));
1728 ASSERT(be16_to_cpu(map->size) < XFS_LBSIZE(mp)); 1728 ASSERT(be16_to_cpu(map->size) < XFS_LBSIZE(mp));
1729 if (be16_to_cpu(map->base) == tablesize) { 1729 if (be16_to_cpu(map->base) == tablesize) {
1730 be16_add(&map->base, 1730 be16_add_cpu(&map->base,
1731 -((int)sizeof(xfs_attr_leaf_entry_t))); 1731 -((int)sizeof(xfs_attr_leaf_entry_t)));
1732 be16_add(&map->size, sizeof(xfs_attr_leaf_entry_t)); 1732 be16_add_cpu(&map->size, sizeof(xfs_attr_leaf_entry_t));
1733 } 1733 }
1734 1734
1735 if ((be16_to_cpu(map->base) + be16_to_cpu(map->size)) 1735 if ((be16_to_cpu(map->base) + be16_to_cpu(map->size))
@@ -1751,19 +1751,19 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1751 if ((before >= 0) || (after >= 0)) { 1751 if ((before >= 0) || (after >= 0)) {
1752 if ((before >= 0) && (after >= 0)) { 1752 if ((before >= 0) && (after >= 0)) {
1753 map = &hdr->freemap[before]; 1753 map = &hdr->freemap[before];
1754 be16_add(&map->size, entsize); 1754 be16_add_cpu(&map->size, entsize);
1755 be16_add(&map->size, 1755 be16_add_cpu(&map->size,
1756 be16_to_cpu(hdr->freemap[after].size)); 1756 be16_to_cpu(hdr->freemap[after].size));
1757 hdr->freemap[after].base = 0; 1757 hdr->freemap[after].base = 0;
1758 hdr->freemap[after].size = 0; 1758 hdr->freemap[after].size = 0;
1759 } else if (before >= 0) { 1759 } else if (before >= 0) {
1760 map = &hdr->freemap[before]; 1760 map = &hdr->freemap[before];
1761 be16_add(&map->size, entsize); 1761 be16_add_cpu(&map->size, entsize);
1762 } else { 1762 } else {
1763 map = &hdr->freemap[after]; 1763 map = &hdr->freemap[after];
1764 /* both on-disk, don't endian flip twice */ 1764 /* both on-disk, don't endian flip twice */
1765 map->base = entry->nameidx; 1765 map->base = entry->nameidx;
1766 be16_add(&map->size, entsize); 1766 be16_add_cpu(&map->size, entsize);
1767 } 1767 }
1768 } else { 1768 } else {
1769 /* 1769 /*
@@ -1788,7 +1788,7 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1788 * Compress the remaining entries and zero out the removed stuff. 1788 * Compress the remaining entries and zero out the removed stuff.
1789 */ 1789 */
1790 memset(XFS_ATTR_LEAF_NAME(leaf, args->index), 0, entsize); 1790 memset(XFS_ATTR_LEAF_NAME(leaf, args->index), 0, entsize);
1791 be16_add(&hdr->usedbytes, -entsize); 1791 be16_add_cpu(&hdr->usedbytes, -entsize);
1792 xfs_da_log_buf(args->trans, bp, 1792 xfs_da_log_buf(args->trans, bp,
1793 XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index), 1793 XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index),
1794 entsize)); 1794 entsize));
@@ -1796,7 +1796,7 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1796 tmp = (be16_to_cpu(hdr->count) - args->index) 1796 tmp = (be16_to_cpu(hdr->count) - args->index)
1797 * sizeof(xfs_attr_leaf_entry_t); 1797 * sizeof(xfs_attr_leaf_entry_t);
1798 memmove((char *)entry, (char *)(entry+1), tmp); 1798 memmove((char *)entry, (char *)(entry+1), tmp);
1799 be16_add(&hdr->count, -1); 1799 be16_add_cpu(&hdr->count, -1);
1800 xfs_da_log_buf(args->trans, bp, 1800 xfs_da_log_buf(args->trans, bp,
1801 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry))); 1801 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry)));
1802 entry = &leaf->entries[be16_to_cpu(hdr->count)]; 1802 entry = &leaf->entries[be16_to_cpu(hdr->count)];
@@ -2182,15 +2182,15 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2182 */ 2182 */
2183 if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */ 2183 if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */
2184 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); 2184 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp);
2185 be16_add(&hdr_s->usedbytes, -tmp); 2185 be16_add_cpu(&hdr_s->usedbytes, -tmp);
2186 be16_add(&hdr_s->count, -1); 2186 be16_add_cpu(&hdr_s->count, -1);
2187 entry_d--; /* to compensate for ++ in loop hdr */ 2187 entry_d--; /* to compensate for ++ in loop hdr */
2188 desti--; 2188 desti--;
2189 if ((start_s + i) < offset) 2189 if ((start_s + i) < offset)
2190 result++; /* insertion index adjustment */ 2190 result++; /* insertion index adjustment */
2191 } else { 2191 } else {
2192#endif /* GROT */ 2192#endif /* GROT */
2193 be16_add(&hdr_d->firstused, -tmp); 2193 be16_add_cpu(&hdr_d->firstused, -tmp);
2194 /* both on-disk, don't endian flip twice */ 2194 /* both on-disk, don't endian flip twice */
2195 entry_d->hashval = entry_s->hashval; 2195 entry_d->hashval = entry_s->hashval;
2196 /* both on-disk, don't endian flip twice */ 2196 /* both on-disk, don't endian flip twice */
@@ -2203,10 +2203,10 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2203 ASSERT(be16_to_cpu(entry_s->nameidx) + tmp 2203 ASSERT(be16_to_cpu(entry_s->nameidx) + tmp
2204 <= XFS_LBSIZE(mp)); 2204 <= XFS_LBSIZE(mp));
2205 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); 2205 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp);
2206 be16_add(&hdr_s->usedbytes, -tmp); 2206 be16_add_cpu(&hdr_s->usedbytes, -tmp);
2207 be16_add(&hdr_d->usedbytes, tmp); 2207 be16_add_cpu(&hdr_d->usedbytes, tmp);
2208 be16_add(&hdr_s->count, -1); 2208 be16_add_cpu(&hdr_s->count, -1);
2209 be16_add(&hdr_d->count, 1); 2209 be16_add_cpu(&hdr_d->count, 1);
2210 tmp = be16_to_cpu(hdr_d->count) 2210 tmp = be16_to_cpu(hdr_d->count)
2211 * sizeof(xfs_attr_leaf_entry_t) 2211 * sizeof(xfs_attr_leaf_entry_t)
2212 + sizeof(xfs_attr_leaf_hdr_t); 2212 + sizeof(xfs_attr_leaf_hdr_t);
@@ -2247,7 +2247,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2247 * Fill in the freemap information 2247 * Fill in the freemap information
2248 */ 2248 */
2249 hdr_d->freemap[0].base = cpu_to_be16(sizeof(xfs_attr_leaf_hdr_t)); 2249 hdr_d->freemap[0].base = cpu_to_be16(sizeof(xfs_attr_leaf_hdr_t));
2250 be16_add(&hdr_d->freemap[0].base, be16_to_cpu(hdr_d->count) * 2250 be16_add_cpu(&hdr_d->freemap[0].base, be16_to_cpu(hdr_d->count) *
2251 sizeof(xfs_attr_leaf_entry_t)); 2251 sizeof(xfs_attr_leaf_entry_t));
2252 hdr_d->freemap[0].size = cpu_to_be16(be16_to_cpu(hdr_d->firstused) 2252 hdr_d->freemap[0].size = cpu_to_be16(be16_to_cpu(hdr_d->firstused)
2253 - be16_to_cpu(hdr_d->freemap[0].base)); 2253 - be16_to_cpu(hdr_d->freemap[0].base));
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index c4181d85605c..bd18987326a3 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -631,7 +631,7 @@ xfs_bmbt_delrec(
631 memcpy(lrp, rrp, numrrecs * sizeof(*lrp)); 631 memcpy(lrp, rrp, numrrecs * sizeof(*lrp));
632 xfs_bmbt_log_recs(cur, lbp, numlrecs + 1, numlrecs + numrrecs); 632 xfs_bmbt_log_recs(cur, lbp, numlrecs + 1, numlrecs + numrrecs);
633 } 633 }
634 be16_add(&left->bb_numrecs, numrrecs); 634 be16_add_cpu(&left->bb_numrecs, numrrecs);
635 left->bb_rightsib = right->bb_rightsib; 635 left->bb_rightsib = right->bb_rightsib;
636 xfs_bmbt_log_block(cur, lbp, XFS_BB_RIGHTSIB | XFS_BB_NUMRECS); 636 xfs_bmbt_log_block(cur, lbp, XFS_BB_RIGHTSIB | XFS_BB_NUMRECS);
637 if (be64_to_cpu(left->bb_rightsib) != NULLDFSBNO) { 637 if (be64_to_cpu(left->bb_rightsib) != NULLDFSBNO) {
@@ -924,7 +924,7 @@ xfs_bmbt_killroot(
924 xfs_iroot_realloc(ip, i, cur->bc_private.b.whichfork); 924 xfs_iroot_realloc(ip, i, cur->bc_private.b.whichfork);
925 block = ifp->if_broot; 925 block = ifp->if_broot;
926 } 926 }
927 be16_add(&block->bb_numrecs, i); 927 be16_add_cpu(&block->bb_numrecs, i);
928 ASSERT(block->bb_numrecs == cblock->bb_numrecs); 928 ASSERT(block->bb_numrecs == cblock->bb_numrecs);
929 kp = XFS_BMAP_KEY_IADDR(block, 1, cur); 929 kp = XFS_BMAP_KEY_IADDR(block, 1, cur);
930 ckp = XFS_BMAP_KEY_IADDR(cblock, 1, cur); 930 ckp = XFS_BMAP_KEY_IADDR(cblock, 1, cur);
@@ -947,7 +947,7 @@ xfs_bmbt_killroot(
947 XFS_TRANS_DQ_BCOUNT, -1L); 947 XFS_TRANS_DQ_BCOUNT, -1L);
948 xfs_trans_binval(cur->bc_tp, cbp); 948 xfs_trans_binval(cur->bc_tp, cbp);
949 cur->bc_bufs[level - 1] = NULL; 949 cur->bc_bufs[level - 1] = NULL;
950 be16_add(&block->bb_level, -1); 950 be16_add_cpu(&block->bb_level, -1);
951 xfs_trans_log_inode(cur->bc_tp, ip, 951 xfs_trans_log_inode(cur->bc_tp, ip,
952 XFS_ILOG_CORE | XFS_ILOG_FBROOT(cur->bc_private.b.whichfork)); 952 XFS_ILOG_CORE | XFS_ILOG_FBROOT(cur->bc_private.b.whichfork));
953 cur->bc_nlevels--; 953 cur->bc_nlevels--;
@@ -1401,9 +1401,9 @@ xfs_bmbt_rshift(
1401 key.br_startoff = cpu_to_be64(xfs_bmbt_disk_get_startoff(rrp)); 1401 key.br_startoff = cpu_to_be64(xfs_bmbt_disk_get_startoff(rrp));
1402 rkp = &key; 1402 rkp = &key;
1403 } 1403 }
1404 be16_add(&left->bb_numrecs, -1); 1404 be16_add_cpu(&left->bb_numrecs, -1);
1405 xfs_bmbt_log_block(cur, lbp, XFS_BB_NUMRECS); 1405 xfs_bmbt_log_block(cur, lbp, XFS_BB_NUMRECS);
1406 be16_add(&right->bb_numrecs, 1); 1406 be16_add_cpu(&right->bb_numrecs, 1);
1407#ifdef DEBUG 1407#ifdef DEBUG
1408 if (level > 0) 1408 if (level > 0)
1409 xfs_btree_check_key(XFS_BTNUM_BMAP, rkp, rkp + 1); 1409 xfs_btree_check_key(XFS_BTNUM_BMAP, rkp, rkp + 1);
@@ -1535,7 +1535,7 @@ xfs_bmbt_split(
1535 right->bb_numrecs = cpu_to_be16(be16_to_cpu(left->bb_numrecs) / 2); 1535 right->bb_numrecs = cpu_to_be16(be16_to_cpu(left->bb_numrecs) / 2);
1536 if ((be16_to_cpu(left->bb_numrecs) & 1) && 1536 if ((be16_to_cpu(left->bb_numrecs) & 1) &&
1537 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1) 1537 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1)
1538 be16_add(&right->bb_numrecs, 1); 1538 be16_add_cpu(&right->bb_numrecs, 1);
1539 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1; 1539 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1;
1540 if (level > 0) { 1540 if (level > 0) {
1541 lkp = XFS_BMAP_KEY_IADDR(left, i, cur); 1541 lkp = XFS_BMAP_KEY_IADDR(left, i, cur);
@@ -1562,7 +1562,7 @@ xfs_bmbt_split(
1562 xfs_bmbt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs)); 1562 xfs_bmbt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1563 *startoff = xfs_bmbt_disk_get_startoff(rrp); 1563 *startoff = xfs_bmbt_disk_get_startoff(rrp);
1564 } 1564 }
1565 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs))); 1565 be16_add_cpu(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs)));
1566 right->bb_rightsib = left->bb_rightsib; 1566 right->bb_rightsib = left->bb_rightsib;
1567 left->bb_rightsib = cpu_to_be64(args.fsbno); 1567 left->bb_rightsib = cpu_to_be64(args.fsbno);
1568 right->bb_leftsib = cpu_to_be64(lbno); 1568 right->bb_leftsib = cpu_to_be64(lbno);
@@ -2240,7 +2240,7 @@ xfs_bmbt_newroot(
2240 bp = xfs_btree_get_bufl(args.mp, cur->bc_tp, args.fsbno, 0); 2240 bp = xfs_btree_get_bufl(args.mp, cur->bc_tp, args.fsbno, 0);
2241 cblock = XFS_BUF_TO_BMBT_BLOCK(bp); 2241 cblock = XFS_BUF_TO_BMBT_BLOCK(bp);
2242 *cblock = *block; 2242 *cblock = *block;
2243 be16_add(&block->bb_level, 1); 2243 be16_add_cpu(&block->bb_level, 1);
2244 block->bb_numrecs = cpu_to_be16(1); 2244 block->bb_numrecs = cpu_to_be16(1);
2245 cur->bc_nlevels++; 2245 cur->bc_nlevels++;
2246 cur->bc_ptrs[level + 1] = 1; 2246 cur->bc_ptrs[level + 1] = 1;
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 1b446849fb3d..021a8f7e563f 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -511,12 +511,12 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
511 * Move the req'd B-tree elements from high in node1 to 511 * Move the req'd B-tree elements from high in node1 to
512 * low in node2. 512 * low in node2.
513 */ 513 */
514 be16_add(&node2->hdr.count, count); 514 be16_add_cpu(&node2->hdr.count, count);
515 tmp = count * (uint)sizeof(xfs_da_node_entry_t); 515 tmp = count * (uint)sizeof(xfs_da_node_entry_t);
516 btree_s = &node1->btree[be16_to_cpu(node1->hdr.count) - count]; 516 btree_s = &node1->btree[be16_to_cpu(node1->hdr.count) - count];
517 btree_d = &node2->btree[0]; 517 btree_d = &node2->btree[0];
518 memcpy(btree_d, btree_s, tmp); 518 memcpy(btree_d, btree_s, tmp);
519 be16_add(&node1->hdr.count, -count); 519 be16_add_cpu(&node1->hdr.count, -count);
520 } else { 520 } else {
521 /* 521 /*
522 * Move the req'd B-tree elements from low in node2 to 522 * Move the req'd B-tree elements from low in node2 to
@@ -527,7 +527,7 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
527 btree_s = &node2->btree[0]; 527 btree_s = &node2->btree[0];
528 btree_d = &node1->btree[be16_to_cpu(node1->hdr.count)]; 528 btree_d = &node1->btree[be16_to_cpu(node1->hdr.count)];
529 memcpy(btree_d, btree_s, tmp); 529 memcpy(btree_d, btree_s, tmp);
530 be16_add(&node1->hdr.count, count); 530 be16_add_cpu(&node1->hdr.count, count);
531 xfs_da_log_buf(tp, blk1->bp, 531 xfs_da_log_buf(tp, blk1->bp,
532 XFS_DA_LOGRANGE(node1, btree_d, tmp)); 532 XFS_DA_LOGRANGE(node1, btree_d, tmp));
533 533
@@ -539,7 +539,7 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
539 btree_s = &node2->btree[count]; 539 btree_s = &node2->btree[count];
540 btree_d = &node2->btree[0]; 540 btree_d = &node2->btree[0];
541 memmove(btree_d, btree_s, tmp); 541 memmove(btree_d, btree_s, tmp);
542 be16_add(&node2->hdr.count, -count); 542 be16_add_cpu(&node2->hdr.count, -count);
543 } 543 }
544 544
545 /* 545 /*
@@ -604,7 +604,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
604 btree->before = cpu_to_be32(newblk->blkno); 604 btree->before = cpu_to_be32(newblk->blkno);
605 xfs_da_log_buf(state->args->trans, oldblk->bp, 605 xfs_da_log_buf(state->args->trans, oldblk->bp,
606 XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree))); 606 XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree)));
607 be16_add(&node->hdr.count, 1); 607 be16_add_cpu(&node->hdr.count, 1);
608 xfs_da_log_buf(state->args->trans, oldblk->bp, 608 xfs_da_log_buf(state->args->trans, oldblk->bp,
609 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr))); 609 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr)));
610 610
@@ -959,7 +959,7 @@ xfs_da_node_remove(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk)
959 memset((char *)btree, 0, sizeof(xfs_da_node_entry_t)); 959 memset((char *)btree, 0, sizeof(xfs_da_node_entry_t));
960 xfs_da_log_buf(state->args->trans, drop_blk->bp, 960 xfs_da_log_buf(state->args->trans, drop_blk->bp,
961 XFS_DA_LOGRANGE(node, btree, sizeof(*btree))); 961 XFS_DA_LOGRANGE(node, btree, sizeof(*btree)));
962 be16_add(&node->hdr.count, -1); 962 be16_add_cpu(&node->hdr.count, -1);
963 xfs_da_log_buf(state->args->trans, drop_blk->bp, 963 xfs_da_log_buf(state->args->trans, drop_blk->bp,
964 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr))); 964 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr)));
965 965
@@ -1018,7 +1018,7 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
1018 */ 1018 */
1019 tmp = be16_to_cpu(drop_node->hdr.count) * (uint)sizeof(xfs_da_node_entry_t); 1019 tmp = be16_to_cpu(drop_node->hdr.count) * (uint)sizeof(xfs_da_node_entry_t);
1020 memcpy(btree, &drop_node->btree[0], tmp); 1020 memcpy(btree, &drop_node->btree[0], tmp);
1021 be16_add(&save_node->hdr.count, be16_to_cpu(drop_node->hdr.count)); 1021 be16_add_cpu(&save_node->hdr.count, be16_to_cpu(drop_node->hdr.count));
1022 1022
1023 xfs_da_log_buf(tp, save_blk->bp, 1023 xfs_da_log_buf(tp, save_blk->bp,
1024 XFS_DA_LOGRANGE(save_node, &save_node->hdr, 1024 XFS_DA_LOGRANGE(save_node, &save_node->hdr,
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index a5f4f4fb8868..fb5a556725b3 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -271,7 +271,7 @@ xfs_dir2_block_addname(
271 } 271 }
272 lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1); 272 lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1);
273 lfloghigh -= be32_to_cpu(btp->stale) - 1; 273 lfloghigh -= be32_to_cpu(btp->stale) - 1;
274 be32_add(&btp->count, -(be32_to_cpu(btp->stale) - 1)); 274 be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1));
275 xfs_dir2_data_make_free(tp, bp, 275 xfs_dir2_data_make_free(tp, bp,
276 (xfs_dir2_data_aoff_t)((char *)blp - (char *)block), 276 (xfs_dir2_data_aoff_t)((char *)blp - (char *)block),
277 (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)), 277 (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)),
@@ -326,7 +326,7 @@ xfs_dir2_block_addname(
326 /* 326 /*
327 * Update the tail (entry count). 327 * Update the tail (entry count).
328 */ 328 */
329 be32_add(&btp->count, 1); 329 be32_add_cpu(&btp->count, 1);
330 /* 330 /*
331 * If we now need to rebuild the bestfree map, do so. 331 * If we now need to rebuild the bestfree map, do so.
332 * This needs to happen before the next call to use_free. 332 * This needs to happen before the next call to use_free.
@@ -387,7 +387,7 @@ xfs_dir2_block_addname(
387 lfloglow = MIN(mid, lfloglow); 387 lfloglow = MIN(mid, lfloglow);
388 lfloghigh = MAX(highstale, lfloghigh); 388 lfloghigh = MAX(highstale, lfloghigh);
389 } 389 }
390 be32_add(&btp->stale, -1); 390 be32_add_cpu(&btp->stale, -1);
391 } 391 }
392 /* 392 /*
393 * Point to the new data entry. 393 * Point to the new data entry.
@@ -767,7 +767,7 @@ xfs_dir2_block_removename(
767 /* 767 /*
768 * Fix up the block tail. 768 * Fix up the block tail.
769 */ 769 */
770 be32_add(&btp->stale, 1); 770 be32_add_cpu(&btp->stale, 1);
771 xfs_dir2_block_log_tail(tp, bp); 771 xfs_dir2_block_log_tail(tp, bp);
772 /* 772 /*
773 * Remove the leaf entry by marking it stale. 773 * Remove the leaf entry by marking it stale.
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index d2452699e9b1..fb8c9e08b23d 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -587,7 +587,7 @@ xfs_dir2_data_make_free(
587 /* 587 /*
588 * Fix up the new big freespace. 588 * Fix up the new big freespace.
589 */ 589 */
590 be16_add(&prevdup->length, len + be16_to_cpu(postdup->length)); 590 be16_add_cpu(&prevdup->length, len + be16_to_cpu(postdup->length));
591 *xfs_dir2_data_unused_tag_p(prevdup) = 591 *xfs_dir2_data_unused_tag_p(prevdup) =
592 cpu_to_be16((char *)prevdup - (char *)d); 592 cpu_to_be16((char *)prevdup - (char *)d);
593 xfs_dir2_data_log_unused(tp, bp, prevdup); 593 xfs_dir2_data_log_unused(tp, bp, prevdup);
@@ -621,7 +621,7 @@ xfs_dir2_data_make_free(
621 */ 621 */
622 else if (prevdup) { 622 else if (prevdup) {
623 dfp = xfs_dir2_data_freefind(d, prevdup); 623 dfp = xfs_dir2_data_freefind(d, prevdup);
624 be16_add(&prevdup->length, len); 624 be16_add_cpu(&prevdup->length, len);
625 *xfs_dir2_data_unused_tag_p(prevdup) = 625 *xfs_dir2_data_unused_tag_p(prevdup) =
626 cpu_to_be16((char *)prevdup - (char *)d); 626 cpu_to_be16((char *)prevdup - (char *)d);
627 xfs_dir2_data_log_unused(tp, bp, prevdup); 627 xfs_dir2_data_log_unused(tp, bp, prevdup);
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 0ca0020ba09f..bc52b803d79b 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -359,7 +359,7 @@ xfs_dir2_leaf_addname(
359 bestsp--; 359 bestsp--;
360 memmove(&bestsp[0], &bestsp[1], 360 memmove(&bestsp[0], &bestsp[1],
361 be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0])); 361 be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0]));
362 be32_add(&ltp->bestcount, 1); 362 be32_add_cpu(&ltp->bestcount, 1);
363 xfs_dir2_leaf_log_tail(tp, lbp); 363 xfs_dir2_leaf_log_tail(tp, lbp);
364 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 364 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
365 } 365 }
@@ -445,7 +445,7 @@ xfs_dir2_leaf_addname(
445 */ 445 */
446 lfloglow = index; 446 lfloglow = index;
447 lfloghigh = be16_to_cpu(leaf->hdr.count); 447 lfloghigh = be16_to_cpu(leaf->hdr.count);
448 be16_add(&leaf->hdr.count, 1); 448 be16_add_cpu(&leaf->hdr.count, 1);
449 } 449 }
450 /* 450 /*
451 * There are stale entries. 451 * There are stale entries.
@@ -523,7 +523,7 @@ xfs_dir2_leaf_addname(
523 lfloglow = MIN(index, lfloglow); 523 lfloglow = MIN(index, lfloglow);
524 lfloghigh = MAX(highstale, lfloghigh); 524 lfloghigh = MAX(highstale, lfloghigh);
525 } 525 }
526 be16_add(&leaf->hdr.stale, -1); 526 be16_add_cpu(&leaf->hdr.stale, -1);
527 } 527 }
528 /* 528 /*
529 * Fill in the new leaf entry. 529 * Fill in the new leaf entry.
@@ -626,7 +626,7 @@ xfs_dir2_leaf_compact(
626 * Update and log the header, log the leaf entries. 626 * Update and log the header, log the leaf entries.
627 */ 627 */
628 ASSERT(be16_to_cpu(leaf->hdr.stale) == from - to); 628 ASSERT(be16_to_cpu(leaf->hdr.stale) == from - to);
629 be16_add(&leaf->hdr.count, -(be16_to_cpu(leaf->hdr.stale))); 629 be16_add_cpu(&leaf->hdr.count, -(be16_to_cpu(leaf->hdr.stale)));
630 leaf->hdr.stale = 0; 630 leaf->hdr.stale = 0;
631 xfs_dir2_leaf_log_header(args->trans, bp); 631 xfs_dir2_leaf_log_header(args->trans, bp);
632 if (loglow != -1) 632 if (loglow != -1)
@@ -728,7 +728,7 @@ xfs_dir2_leaf_compact_x1(
728 /* 728 /*
729 * Adjust the leaf header values. 729 * Adjust the leaf header values.
730 */ 730 */
731 be16_add(&leaf->hdr.count, -(from - to)); 731 be16_add_cpu(&leaf->hdr.count, -(from - to));
732 leaf->hdr.stale = cpu_to_be16(1); 732 leaf->hdr.stale = cpu_to_be16(1);
733 /* 733 /*
734 * Remember the low/high stale value only in the "right" 734 * Remember the low/high stale value only in the "right"
@@ -1470,7 +1470,7 @@ xfs_dir2_leaf_removename(
1470 /* 1470 /*
1471 * We just mark the leaf entry stale by putting a null in it. 1471 * We just mark the leaf entry stale by putting a null in it.
1472 */ 1472 */
1473 be16_add(&leaf->hdr.stale, 1); 1473 be16_add_cpu(&leaf->hdr.stale, 1);
1474 xfs_dir2_leaf_log_header(tp, lbp); 1474 xfs_dir2_leaf_log_header(tp, lbp);
1475 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); 1475 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
1476 xfs_dir2_leaf_log_ents(tp, lbp, index, index); 1476 xfs_dir2_leaf_log_ents(tp, lbp, index, index);
@@ -1531,7 +1531,7 @@ xfs_dir2_leaf_removename(
1531 */ 1531 */
1532 memmove(&bestsp[db - i], bestsp, 1532 memmove(&bestsp[db - i], bestsp,
1533 (be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp)); 1533 (be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp));
1534 be32_add(&ltp->bestcount, -(db - i)); 1534 be32_add_cpu(&ltp->bestcount, -(db - i));
1535 xfs_dir2_leaf_log_tail(tp, lbp); 1535 xfs_dir2_leaf_log_tail(tp, lbp);
1536 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 1536 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
1537 } else 1537 } else
@@ -1712,7 +1712,7 @@ xfs_dir2_leaf_trim_data(
1712 * Eliminate the last bests entry from the table. 1712 * Eliminate the last bests entry from the table.
1713 */ 1713 */
1714 bestsp = xfs_dir2_leaf_bests_p(ltp); 1714 bestsp = xfs_dir2_leaf_bests_p(ltp);
1715 be32_add(&ltp->bestcount, -1); 1715 be32_add_cpu(&ltp->bestcount, -1);
1716 memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp)); 1716 memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp));
1717 xfs_dir2_leaf_log_tail(tp, lbp); 1717 xfs_dir2_leaf_log_tail(tp, lbp);
1718 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 1718 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index eb18e399e836..8dade711f099 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -254,7 +254,7 @@ xfs_dir2_leafn_add(
254 (be16_to_cpu(leaf->hdr.count) - index) * sizeof(*lep)); 254 (be16_to_cpu(leaf->hdr.count) - index) * sizeof(*lep));
255 lfloglow = index; 255 lfloglow = index;
256 lfloghigh = be16_to_cpu(leaf->hdr.count); 256 lfloghigh = be16_to_cpu(leaf->hdr.count);
257 be16_add(&leaf->hdr.count, 1); 257 be16_add_cpu(&leaf->hdr.count, 1);
258 } 258 }
259 /* 259 /*
260 * There are stale entries. We'll use one for the new entry. 260 * There are stale entries. We'll use one for the new entry.
@@ -322,7 +322,7 @@ xfs_dir2_leafn_add(
322 lfloglow = MIN(index, lfloglow); 322 lfloglow = MIN(index, lfloglow);
323 lfloghigh = MAX(highstale, lfloghigh); 323 lfloghigh = MAX(highstale, lfloghigh);
324 } 324 }
325 be16_add(&leaf->hdr.stale, -1); 325 be16_add_cpu(&leaf->hdr.stale, -1);
326 } 326 }
327 /* 327 /*
328 * Insert the new entry, log everything. 328 * Insert the new entry, log everything.
@@ -697,10 +697,10 @@ xfs_dir2_leafn_moveents(
697 /* 697 /*
698 * Update the headers and log them. 698 * Update the headers and log them.
699 */ 699 */
700 be16_add(&leaf_s->hdr.count, -(count)); 700 be16_add_cpu(&leaf_s->hdr.count, -(count));
701 be16_add(&leaf_s->hdr.stale, -(stale)); 701 be16_add_cpu(&leaf_s->hdr.stale, -(stale));
702 be16_add(&leaf_d->hdr.count, count); 702 be16_add_cpu(&leaf_d->hdr.count, count);
703 be16_add(&leaf_d->hdr.stale, stale); 703 be16_add_cpu(&leaf_d->hdr.stale, stale);
704 xfs_dir2_leaf_log_header(tp, bp_s); 704 xfs_dir2_leaf_log_header(tp, bp_s);
705 xfs_dir2_leaf_log_header(tp, bp_d); 705 xfs_dir2_leaf_log_header(tp, bp_d);
706 xfs_dir2_leafn_check(args->dp, bp_s); 706 xfs_dir2_leafn_check(args->dp, bp_s);
@@ -885,7 +885,7 @@ xfs_dir2_leafn_remove(
885 * Kill the leaf entry by marking it stale. 885 * Kill the leaf entry by marking it stale.
886 * Log the leaf block changes. 886 * Log the leaf block changes.
887 */ 887 */
888 be16_add(&leaf->hdr.stale, 1); 888 be16_add_cpu(&leaf->hdr.stale, 1);
889 xfs_dir2_leaf_log_header(tp, bp); 889 xfs_dir2_leaf_log_header(tp, bp);
890 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); 890 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
891 xfs_dir2_leaf_log_ents(tp, bp, index, index); 891 xfs_dir2_leaf_log_ents(tp, bp, index, index);
@@ -971,7 +971,7 @@ xfs_dir2_leafn_remove(
971 /* 971 /*
972 * One less used entry in the free table. 972 * One less used entry in the free table.
973 */ 973 */
974 be32_add(&free->hdr.nused, -1); 974 be32_add_cpu(&free->hdr.nused, -1);
975 xfs_dir2_free_log_header(tp, fbp); 975 xfs_dir2_free_log_header(tp, fbp);
976 /* 976 /*
977 * If this was the last entry in the table, we can 977 * If this was the last entry in the table, we can
@@ -1642,7 +1642,7 @@ xfs_dir2_node_addname_int(
1642 * (this should always be true) then update the header. 1642 * (this should always be true) then update the header.
1643 */ 1643 */
1644 if (be16_to_cpu(free->bests[findex]) == NULLDATAOFF) { 1644 if (be16_to_cpu(free->bests[findex]) == NULLDATAOFF) {
1645 be32_add(&free->hdr.nused, 1); 1645 be32_add_cpu(&free->hdr.nused, 1);
1646 xfs_dir2_free_log_header(tp, fbp); 1646 xfs_dir2_free_log_header(tp, fbp);
1647 } 1647 }
1648 /* 1648 /*
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index b8de7f3cc17e..eadc1591c795 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -318,7 +318,7 @@ xfs_growfs_data_private(
318 } 318 }
319 ASSERT(bp); 319 ASSERT(bp);
320 agi = XFS_BUF_TO_AGI(bp); 320 agi = XFS_BUF_TO_AGI(bp);
321 be32_add(&agi->agi_length, new); 321 be32_add_cpu(&agi->agi_length, new);
322 ASSERT(nagcount == oagcount || 322 ASSERT(nagcount == oagcount ||
323 be32_to_cpu(agi->agi_length) == mp->m_sb.sb_agblocks); 323 be32_to_cpu(agi->agi_length) == mp->m_sb.sb_agblocks);
324 xfs_ialloc_log_agi(tp, bp, XFS_AGI_LENGTH); 324 xfs_ialloc_log_agi(tp, bp, XFS_AGI_LENGTH);
@@ -331,7 +331,7 @@ xfs_growfs_data_private(
331 } 331 }
332 ASSERT(bp); 332 ASSERT(bp);
333 agf = XFS_BUF_TO_AGF(bp); 333 agf = XFS_BUF_TO_AGF(bp);
334 be32_add(&agf->agf_length, new); 334 be32_add_cpu(&agf->agf_length, new);
335 ASSERT(be32_to_cpu(agf->agf_length) == 335 ASSERT(be32_to_cpu(agf->agf_length) ==
336 be32_to_cpu(agi->agi_length)); 336 be32_to_cpu(agi->agi_length));
337 xfs_alloc_log_agf(tp, bp, XFS_AGF_LENGTH); 337 xfs_alloc_log_agf(tp, bp, XFS_AGF_LENGTH);
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 1409c2d61c11..c5836b951d0c 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -301,8 +301,8 @@ xfs_ialloc_ag_alloc(
301 } 301 }
302 xfs_trans_inode_alloc_buf(tp, fbuf); 302 xfs_trans_inode_alloc_buf(tp, fbuf);
303 } 303 }
304 be32_add(&agi->agi_count, newlen); 304 be32_add_cpu(&agi->agi_count, newlen);
305 be32_add(&agi->agi_freecount, newlen); 305 be32_add_cpu(&agi->agi_freecount, newlen);
306 agno = be32_to_cpu(agi->agi_seqno); 306 agno = be32_to_cpu(agi->agi_seqno);
307 down_read(&args.mp->m_peraglock); 307 down_read(&args.mp->m_peraglock);
308 args.mp->m_perag[agno].pagi_freecount += newlen; 308 args.mp->m_perag[agno].pagi_freecount += newlen;
@@ -885,7 +885,7 @@ nextag:
885 if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount, 885 if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount,
886 rec.ir_free))) 886 rec.ir_free)))
887 goto error0; 887 goto error0;
888 be32_add(&agi->agi_freecount, -1); 888 be32_add_cpu(&agi->agi_freecount, -1);
889 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT); 889 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT);
890 down_read(&mp->m_peraglock); 890 down_read(&mp->m_peraglock);
891 mp->m_perag[tagno].pagi_freecount--; 891 mp->m_perag[tagno].pagi_freecount--;
@@ -1065,8 +1065,8 @@ xfs_difree(
1065 * to be freed when the transaction is committed. 1065 * to be freed when the transaction is committed.
1066 */ 1066 */
1067 ilen = XFS_IALLOC_INODES(mp); 1067 ilen = XFS_IALLOC_INODES(mp);
1068 be32_add(&agi->agi_count, -ilen); 1068 be32_add_cpu(&agi->agi_count, -ilen);
1069 be32_add(&agi->agi_freecount, -(ilen - 1)); 1069 be32_add_cpu(&agi->agi_freecount, -(ilen - 1));
1070 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT); 1070 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT);
1071 down_read(&mp->m_peraglock); 1071 down_read(&mp->m_peraglock);
1072 mp->m_perag[agno].pagi_freecount -= ilen - 1; 1072 mp->m_perag[agno].pagi_freecount -= ilen - 1;
@@ -1095,7 +1095,7 @@ xfs_difree(
1095 /* 1095 /*
1096 * Change the inode free counts and log the ag/sb changes. 1096 * Change the inode free counts and log the ag/sb changes.
1097 */ 1097 */
1098 be32_add(&agi->agi_freecount, 1); 1098 be32_add_cpu(&agi->agi_freecount, 1);
1099 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT); 1099 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT);
1100 down_read(&mp->m_peraglock); 1100 down_read(&mp->m_peraglock);
1101 mp->m_perag[agno].pagi_freecount++; 1101 mp->m_perag[agno].pagi_freecount++;
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c
index 8cdeeaf8632b..e5310c90e50f 100644
--- a/fs/xfs/xfs_ialloc_btree.c
+++ b/fs/xfs/xfs_ialloc_btree.c
@@ -189,7 +189,7 @@ xfs_inobt_delrec(
189 */ 189 */
190 bno = be32_to_cpu(agi->agi_root); 190 bno = be32_to_cpu(agi->agi_root);
191 agi->agi_root = *pp; 191 agi->agi_root = *pp;
192 be32_add(&agi->agi_level, -1); 192 be32_add_cpu(&agi->agi_level, -1);
193 /* 193 /*
194 * Free the block. 194 * Free the block.
195 */ 195 */
@@ -1132,7 +1132,7 @@ xfs_inobt_lshift(
1132 /* 1132 /*
1133 * Bump and log left's numrecs, decrement and log right's numrecs. 1133 * Bump and log left's numrecs, decrement and log right's numrecs.
1134 */ 1134 */
1135 be16_add(&left->bb_numrecs, 1); 1135 be16_add_cpu(&left->bb_numrecs, 1);
1136 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1136 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1137#ifdef DEBUG 1137#ifdef DEBUG
1138 if (level > 0) 1138 if (level > 0)
@@ -1140,7 +1140,7 @@ xfs_inobt_lshift(
1140 else 1140 else
1141 xfs_btree_check_rec(cur->bc_btnum, lrp - 1, lrp); 1141 xfs_btree_check_rec(cur->bc_btnum, lrp - 1, lrp);
1142#endif 1142#endif
1143 be16_add(&right->bb_numrecs, -1); 1143 be16_add_cpu(&right->bb_numrecs, -1);
1144 xfs_inobt_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS); 1144 xfs_inobt_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS);
1145 /* 1145 /*
1146 * Slide the contents of right down one entry. 1146 * Slide the contents of right down one entry.
@@ -1232,7 +1232,7 @@ xfs_inobt_newroot(
1232 * Set the root data in the a.g. inode structure. 1232 * Set the root data in the a.g. inode structure.
1233 */ 1233 */
1234 agi->agi_root = cpu_to_be32(args.agbno); 1234 agi->agi_root = cpu_to_be32(args.agbno);
1235 be32_add(&agi->agi_level, 1); 1235 be32_add_cpu(&agi->agi_level, 1);
1236 xfs_ialloc_log_agi(args.tp, cur->bc_private.i.agbp, 1236 xfs_ialloc_log_agi(args.tp, cur->bc_private.i.agbp,
1237 XFS_AGI_ROOT | XFS_AGI_LEVEL); 1237 XFS_AGI_ROOT | XFS_AGI_LEVEL);
1238 /* 1238 /*
@@ -1426,9 +1426,9 @@ xfs_inobt_rshift(
1426 /* 1426 /*
1427 * Decrement and log left's numrecs, bump and log right's numrecs. 1427 * Decrement and log left's numrecs, bump and log right's numrecs.
1428 */ 1428 */
1429 be16_add(&left->bb_numrecs, -1); 1429 be16_add_cpu(&left->bb_numrecs, -1);
1430 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1430 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1431 be16_add(&right->bb_numrecs, 1); 1431 be16_add_cpu(&right->bb_numrecs, 1);
1432#ifdef DEBUG 1432#ifdef DEBUG
1433 if (level > 0) 1433 if (level > 0)
1434 xfs_btree_check_key(cur->bc_btnum, rkp, rkp + 1); 1434 xfs_btree_check_key(cur->bc_btnum, rkp, rkp + 1);
@@ -1529,7 +1529,7 @@ xfs_inobt_split(
1529 */ 1529 */
1530 if ((be16_to_cpu(left->bb_numrecs) & 1) && 1530 if ((be16_to_cpu(left->bb_numrecs) & 1) &&
1531 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1) 1531 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1)
1532 be16_add(&right->bb_numrecs, 1); 1532 be16_add_cpu(&right->bb_numrecs, 1);
1533 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1; 1533 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1;
1534 /* 1534 /*
1535 * For non-leaf blocks, copy keys and addresses over to the new block. 1535 * For non-leaf blocks, copy keys and addresses over to the new block.
@@ -1565,7 +1565,7 @@ xfs_inobt_split(
1565 * Find the left block number by looking in the buffer. 1565 * Find the left block number by looking in the buffer.
1566 * Adjust numrecs, sibling pointers. 1566 * Adjust numrecs, sibling pointers.
1567 */ 1567 */
1568 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs))); 1568 be16_add_cpu(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs)));
1569 right->bb_rightsib = left->bb_rightsib; 1569 right->bb_rightsib = left->bb_rightsib;
1570 left->bb_rightsib = cpu_to_be32(args.agbno); 1570 left->bb_rightsib = cpu_to_be32(args.agbno);
1571 right->bb_leftsib = cpu_to_be32(lbno); 1571 right->bb_leftsib = cpu_to_be32(lbno);
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index b3ac3805d3c4..a75edca1860f 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1509,9 +1509,9 @@ xlog_sync(xlog_t *log,
1509 * case, though. 1509 * case, though.
1510 */ 1510 */
1511 for (i = 0; i < split; i += BBSIZE) { 1511 for (i = 0; i < split; i += BBSIZE) {
1512 be32_add((__be32 *)dptr, 1); 1512 be32_add_cpu((__be32 *)dptr, 1);
1513 if (be32_to_cpu(*(__be32 *)dptr) == XLOG_HEADER_MAGIC_NUM) 1513 if (be32_to_cpu(*(__be32 *)dptr) == XLOG_HEADER_MAGIC_NUM)
1514 be32_add((__be32 *)dptr, 1); 1514 be32_add_cpu((__be32 *)dptr, 1);
1515 dptr += BBSIZE; 1515 dptr += BBSIZE;
1516 } 1516 }
1517 1517
@@ -1600,7 +1600,7 @@ xlog_state_finish_copy(xlog_t *log,
1600{ 1600{
1601 spin_lock(&log->l_icloglock); 1601 spin_lock(&log->l_icloglock);
1602 1602
1603 be32_add(&iclog->ic_header.h_num_logops, record_cnt); 1603 be32_add_cpu(&iclog->ic_header.h_num_logops, record_cnt);
1604 iclog->ic_offset += copy_bytes; 1604 iclog->ic_offset += copy_bytes;
1605 1605
1606 spin_unlock(&log->l_icloglock); 1606 spin_unlock(&log->l_icloglock);
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 71e4c8dcc69b..140386434aa3 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -567,26 +567,26 @@ xfs_trans_apply_sb_deltas(
567 */ 567 */
568 if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) { 568 if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) {
569 if (tp->t_icount_delta) 569 if (tp->t_icount_delta)
570 be64_add(&sbp->sb_icount, tp->t_icount_delta); 570 be64_add_cpu(&sbp->sb_icount, tp->t_icount_delta);
571 if (tp->t_ifree_delta) 571 if (tp->t_ifree_delta)
572 be64_add(&sbp->sb_ifree, tp->t_ifree_delta); 572 be64_add_cpu(&sbp->sb_ifree, tp->t_ifree_delta);
573 if (tp->t_fdblocks_delta) 573 if (tp->t_fdblocks_delta)
574 be64_add(&sbp->sb_fdblocks, tp->t_fdblocks_delta); 574 be64_add_cpu(&sbp->sb_fdblocks, tp->t_fdblocks_delta);
575 if (tp->t_res_fdblocks_delta) 575 if (tp->t_res_fdblocks_delta)
576 be64_add(&sbp->sb_fdblocks, tp->t_res_fdblocks_delta); 576 be64_add_cpu(&sbp->sb_fdblocks, tp->t_res_fdblocks_delta);
577 } 577 }
578 578
579 if (tp->t_frextents_delta) 579 if (tp->t_frextents_delta)
580 be64_add(&sbp->sb_frextents, tp->t_frextents_delta); 580 be64_add_cpu(&sbp->sb_frextents, tp->t_frextents_delta);
581 if (tp->t_res_frextents_delta) 581 if (tp->t_res_frextents_delta)
582 be64_add(&sbp->sb_frextents, tp->t_res_frextents_delta); 582 be64_add_cpu(&sbp->sb_frextents, tp->t_res_frextents_delta);
583 583
584 if (tp->t_dblocks_delta) { 584 if (tp->t_dblocks_delta) {
585 be64_add(&sbp->sb_dblocks, tp->t_dblocks_delta); 585 be64_add_cpu(&sbp->sb_dblocks, tp->t_dblocks_delta);
586 whole = 1; 586 whole = 1;
587 } 587 }
588 if (tp->t_agcount_delta) { 588 if (tp->t_agcount_delta) {
589 be32_add(&sbp->sb_agcount, tp->t_agcount_delta); 589 be32_add_cpu(&sbp->sb_agcount, tp->t_agcount_delta);
590 whole = 1; 590 whole = 1;
591 } 591 }
592 if (tp->t_imaxpct_delta) { 592 if (tp->t_imaxpct_delta) {
@@ -594,19 +594,19 @@ xfs_trans_apply_sb_deltas(
594 whole = 1; 594 whole = 1;
595 } 595 }
596 if (tp->t_rextsize_delta) { 596 if (tp->t_rextsize_delta) {
597 be32_add(&sbp->sb_rextsize, tp->t_rextsize_delta); 597 be32_add_cpu(&sbp->sb_rextsize, tp->t_rextsize_delta);
598 whole = 1; 598 whole = 1;
599 } 599 }
600 if (tp->t_rbmblocks_delta) { 600 if (tp->t_rbmblocks_delta) {
601 be32_add(&sbp->sb_rbmblocks, tp->t_rbmblocks_delta); 601 be32_add_cpu(&sbp->sb_rbmblocks, tp->t_rbmblocks_delta);
602 whole = 1; 602 whole = 1;
603 } 603 }
604 if (tp->t_rblocks_delta) { 604 if (tp->t_rblocks_delta) {
605 be64_add(&sbp->sb_rblocks, tp->t_rblocks_delta); 605 be64_add_cpu(&sbp->sb_rblocks, tp->t_rblocks_delta);
606 whole = 1; 606 whole = 1;
607 } 607 }
608 if (tp->t_rextents_delta) { 608 if (tp->t_rextents_delta) {
609 be64_add(&sbp->sb_rextents, tp->t_rextents_delta); 609 be64_add_cpu(&sbp->sb_rextents, tp->t_rextents_delta);
610 whole = 1; 610 whole = 1;
611 } 611 }
612 if (tp->t_rextslog_delta) { 612 if (tp->t_rextslog_delta) {
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 022a5fd80c8e..4839f2af94c3 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -222,7 +222,7 @@ acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width);
222 */ 222 */
223acpi_status 223acpi_status
224acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, 224acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
225 u32 reg, void *value, u32 width); 225 u32 reg, u32 *value, u32 width);
226 226
227acpi_status 227acpi_status
228acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, 228acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index cdc8004cfd12..06480bcabfdc 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -32,9 +32,11 @@
32#define DOMAIN_COORD_TYPE_SW_ANY 0xfd 32#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
33#define DOMAIN_COORD_TYPE_HW_ALL 0xfe 33#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
34 34
35#define ACPI_CSTATE_SYSTEMIO (0) 35#define ACPI_CSTATE_SYSTEMIO 0
36#define ACPI_CSTATE_FFH (1) 36#define ACPI_CSTATE_FFH 1
37#define ACPI_CSTATE_HALT (2) 37#define ACPI_CSTATE_HALT 2
38
39#define ACPI_CX_DESC_LEN 32
38 40
39/* Power Management */ 41/* Power Management */
40 42
@@ -74,6 +76,7 @@ struct acpi_processor_cx {
74 u64 time; 76 u64 time;
75 struct acpi_processor_cx_policy promotion; 77 struct acpi_processor_cx_policy promotion;
76 struct acpi_processor_cx_policy demotion; 78 struct acpi_processor_cx_policy demotion;
79 char desc[ACPI_CX_DESC_LEN];
77}; 80};
78 81
79struct acpi_processor_power { 82struct acpi_processor_power {
diff --git a/include/asm-arm/arch-pxa/regs-ssp.h b/include/asm-arm/arch-pxa/regs-ssp.h
index 991cb688db75..0255328c3c18 100644
--- a/include/asm-arm/arch-pxa/regs-ssp.h
+++ b/include/asm-arm/arch-pxa/regs-ssp.h
@@ -85,6 +85,7 @@
85#define SSCR1_RSRE (1 << 20) /* Receive Service Request Enable */ 85#define SSCR1_RSRE (1 << 20) /* Receive Service Request Enable */
86#define SSCR1_TINTE (1 << 19) /* Receiver Time-out Interrupt enable */ 86#define SSCR1_TINTE (1 << 19) /* Receiver Time-out Interrupt enable */
87#define SSCR1_PINTE (1 << 18) /* Peripheral Trailing Byte Interupt Enable */ 87#define SSCR1_PINTE (1 << 18) /* Peripheral Trailing Byte Interupt Enable */
88#define SSCR1_IFS (1 << 16) /* Invert Frame Signal */
88#define SSCR1_STRF (1 << 15) /* Select FIFO or EFWR */ 89#define SSCR1_STRF (1 << 15) /* Select FIFO or EFWR */
89#define SSCR1_EFWR (1 << 14) /* Enable FIFO Write/Read */ 90#define SSCR1_EFWR (1 << 14) /* Enable FIFO Write/Read */
90 91
diff --git a/include/asm-arm/mach/arch.h b/include/asm-arm/mach/arch.h
index c59fad18e73b..bcc8aed7c9a9 100644
--- a/include/asm-arm/mach/arch.h
+++ b/include/asm-arm/mach/arch.h
@@ -17,7 +17,7 @@ struct sys_timer;
17struct machine_desc { 17struct machine_desc {
18 /* 18 /*
19 * Note! The first four elements are used 19 * Note! The first four elements are used
20 * by assembler code in head-armv.S 20 * by assembler code in head.S, head-common.S
21 */ 21 */
22 unsigned int nr; /* architecture number */ 22 unsigned int nr; /* architecture number */
23 unsigned int phys_io; /* start of physical io */ 23 unsigned int phys_io; /* start of physical io */
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index e8c986667532..f184eb8c047c 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -328,9 +328,11 @@
328#define __NR_epoll_pwait 319 328#define __NR_epoll_pwait 319
329#define __NR_utimensat 320 329#define __NR_utimensat 320
330#define __NR_signalfd 321 330#define __NR_signalfd 321
331/* #define __NR_timerfd 322 removed */ 331#define __NR_timerfd_create 322
332#define __NR_eventfd 323 332#define __NR_eventfd 323
333#define __NR_fallocate 324 333#define __NR_fallocate 324
334#define __NR_timerfd_settime 325
335#define __NR_timerfd_gettime 326
334 336
335#ifdef __KERNEL__ 337#ifdef __KERNEL__
336 338
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 4b8d31cda1a0..b0e63c672ebd 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -32,6 +32,8 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
32 */ 32 */
33#ifndef __my_cpu_offset 33#ifndef __my_cpu_offset
34#define __my_cpu_offset per_cpu_offset(raw_smp_processor_id()) 34#define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
35#endif
36#ifdef CONFIG_DEBUG_PREEMPT
35#define my_cpu_offset per_cpu_offset(smp_processor_id()) 37#define my_cpu_offset per_cpu_offset(smp_processor_id())
36#else 38#else
37#define my_cpu_offset __my_cpu_offset 39#define my_cpu_offset __my_cpu_offset
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f784d2f34149..f054778e916c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -238,6 +238,9 @@
238 *(.kprobes.text) \ 238 *(.kprobes.text) \
239 VMLINUX_SYMBOL(__kprobes_text_end) = .; 239 VMLINUX_SYMBOL(__kprobes_text_end) = .;
240 240
241/* Section used for early init (in .S files) */
242#define HEAD_TEXT *(.head.text)
243
241/* init and exit section handling */ 244/* init and exit section handling */
242#define INIT_DATA \ 245#define INIT_DATA \
243 *(.init.data) \ 246 *(.init.data) \
diff --git a/include/asm-h8300/hardirq.h b/include/asm-h8300/hardirq.h
index 18fa7931e09f..9d7f7a7462b2 100644
--- a/include/asm-h8300/hardirq.h
+++ b/include/asm-h8300/hardirq.h
@@ -12,6 +12,8 @@ typedef struct {
12 12
13#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 13#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
14 14
15extern void ack_bad_irq(unsigned int irq);
16
15#define HARDIRQ_BITS 8 17#define HARDIRQ_BITS 8
16 18
17/* 19/*
diff --git a/include/asm-h8300/irq.h b/include/asm-h8300/irq.h
index 56eec28cc2c4..13d7c601cd0a 100644
--- a/include/asm-h8300/irq.h
+++ b/include/asm-h8300/irq.h
@@ -3,7 +3,7 @@
3 3
4#include <asm/ptrace.h> 4#include <asm/ptrace.h>
5 5
6#if defined(__H8300H__) 6#if defined(CONFIG_CPU_H8300H)
7#define NR_IRQS 64 7#define NR_IRQS 64
8#define EXT_IRQ0 12 8#define EXT_IRQ0 12
9#define EXT_IRQ1 13 9#define EXT_IRQ1 13
@@ -14,14 +14,6 @@
14#define EXT_IRQ6 18 14#define EXT_IRQ6 18
15#define EXT_IRQ7 19 15#define EXT_IRQ7 19
16#define EXT_IRQS 5 16#define EXT_IRQS 5
17
18#include <asm/regs306x.h>
19#define h8300_clear_isr(irq) \
20do { \
21 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ5) \
22 *(volatile unsigned char *)ISR &= ~(1 << (irq - EXT_IRQ0)); \
23} while(0)
24
25#define IER_REGS *(volatile unsigned char *)IER 17#define IER_REGS *(volatile unsigned char *)IER
26#endif 18#endif
27#if defined(CONFIG_CPU_H8S) 19#if defined(CONFIG_CPU_H8S)
@@ -44,13 +36,6 @@ do { \
44#define EXT_IRQ15 31 36#define EXT_IRQ15 31
45#define EXT_IRQS 15 37#define EXT_IRQS 15
46 38
47#include <asm/regs267x.h>
48#define h8300_clear_isr(irq) \
49do { \
50 if (irq >= EXT_IRQ0 && irq <= EXT_IRQ15) \
51 *(volatile unsigned short *)ISR &= ~(1 << (irq - EXT_IRQ0)); \
52} while(0)
53
54#define IER_REGS *(volatile unsigned short *)IER 39#define IER_REGS *(volatile unsigned short *)IER
55#endif 40#endif
56 41
@@ -59,4 +44,6 @@ static __inline__ int irq_canonicalize(int irq)
59 return irq; 44 return irq;
60} 45}
61 46
47typedef void (*h8300_vector)(void);
48
62#endif /* _H8300_IRQ_H_ */ 49#endif /* _H8300_IRQ_H_ */
diff --git a/include/asm-h8300/uaccess.h b/include/asm-h8300/uaccess.h
index ebe58c6c8387..a22350ec271a 100644
--- a/include/asm-h8300/uaccess.h
+++ b/include/asm-h8300/uaccess.h
@@ -91,7 +91,7 @@ extern int __put_user_bad(void);
91#define get_user(x, ptr) \ 91#define get_user(x, ptr) \
92({ \ 92({ \
93 int __gu_err = 0; \ 93 int __gu_err = 0; \
94 typeof(*(ptr)) __gu_val = 0; \ 94 uint32_t __gu_val = 0; \
95 switch (sizeof(*(ptr))) { \ 95 switch (sizeof(*(ptr))) { \
96 case 1: \ 96 case 1: \
97 case 2: \ 97 case 2: \
@@ -106,7 +106,7 @@ extern int __put_user_bad(void);
106 __gu_err = __get_user_bad(); \ 106 __gu_err = __get_user_bad(); \
107 break; \ 107 break; \
108 } \ 108 } \
109 (x) = __gu_val; \ 109 (x) = (typeof(*(ptr)))__gu_val; \
110 __gu_err; \ 110 __gu_err; \
111}) 111})
112#define __get_user(x, ptr) get_user(x, ptr) 112#define __get_user(x, ptr) get_user(x, ptr)
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
index 29bc0aad2ebc..87e5dc0413b4 100644
--- a/include/asm-m68knommu/cacheflush.h
+++ b/include/asm-m68knommu/cacheflush.h
@@ -54,28 +54,28 @@ static inline void __flush_cache_all(void)
54#if defined(CONFIG_M527x) || defined(CONFIG_M528x) 54#if defined(CONFIG_M527x) || defined(CONFIG_M528x)
55 __asm__ __volatile__ ( 55 __asm__ __volatile__ (
56 "movel #0x81000200, %%d0\n\t" 56 "movel #0x81000200, %%d0\n\t"
57 "movec %%d0, %%CACR\n\t" 57 "movec %%d0, %%CACR\n\t"
58 "nop\n\t" 58 "nop\n\t"
59 : : : "d0" ); 59 : : : "d0" );
60#endif /* CONFIG_M527x || CONFIG_M528x */ 60#endif /* CONFIG_M527x || CONFIG_M528x */
61#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || defined(CONFIG_M5272) 61#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || defined(CONFIG_M5272)
62 __asm__ __volatile__ ( 62 __asm__ __volatile__ (
63 "movel #0x81000100, %%d0\n\t" 63 "movel #0x81000100, %%d0\n\t"
64 "movec %%d0, %%CACR\n\t" 64 "movec %%d0, %%CACR\n\t"
65 "nop\n\t" 65 "nop\n\t"
66 : : : "d0" ); 66 : : : "d0" );
67#endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */ 67#endif /* CONFIG_M5206 || CONFIG_M5206e || CONFIG_M5272 */
68#ifdef CONFIG_M5249 68#ifdef CONFIG_M5249
69 __asm__ __volatile__ ( 69 __asm__ __volatile__ (
70 "movel #0xa1000200, %%d0\n\t" 70 "movel #0xa1000200, %%d0\n\t"
71 "movec %%d0, %%CACR\n\t" 71 "movec %%d0, %%CACR\n\t"
72 "nop\n\t" 72 "nop\n\t"
73 : : : "d0" ); 73 : : : "d0" );
74#endif /* CONFIG_M5249 */ 74#endif /* CONFIG_M5249 */
75#ifdef CONFIG_M532x 75#ifdef CONFIG_M532x
76 __asm__ __volatile__ ( 76 __asm__ __volatile__ (
77 "movel #0x81000200, %%d0\n\t" 77 "movel #0x81000200, %%d0\n\t"
78 "movec %%d0, %%CACR\n\t" 78 "movec %%d0, %%CACR\n\t"
79 "nop\n\t" 79 "nop\n\t"
80 : : : "d0" ); 80 : : : "d0" );
81#endif /* CONFIG_M532x */ 81#endif /* CONFIG_M532x */
diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h
index 039ab3f81732..64c64432bbb8 100644
--- a/include/asm-m68knommu/system.h
+++ b/include/asm-m68knommu/system.h
@@ -104,7 +104,7 @@ asmlinkage void resume(void);
104#define mb() asm volatile ("" : : :"memory") 104#define mb() asm volatile ("" : : :"memory")
105#define rmb() asm volatile ("" : : :"memory") 105#define rmb() asm volatile ("" : : :"memory")
106#define wmb() asm volatile ("" : : :"memory") 106#define wmb() asm volatile ("" : : :"memory")
107#define set_mb(var, value) do { xchg(&var, value); } while (0) 107#define set_mb(var, value) ({ (var) = (value); wmb(); })
108 108
109#ifdef CONFIG_SMP 109#ifdef CONFIG_SMP
110#define smp_mb() mb() 110#define smp_mb() mb()
diff --git a/include/asm-mips/mach-ip27/dma-coherence.h b/include/asm-mips/mach-ip27/dma-coherence.h
index 3fdbbf68e952..ed7e6222dc15 100644
--- a/include/asm-mips/mach-ip27/dma-coherence.h
+++ b/include/asm-mips/mach-ip27/dma-coherence.h
@@ -35,7 +35,7 @@ static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
35 35
36static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr) 36static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
37{ 37{
38 return dma_addr & (0xffUL << 56); 38 return dma_addr & ~(0xffUL << 56);
39} 39}
40 40
41static inline void plat_unmap_dma_mem(dma_addr_t dma_addr) 41static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
diff --git a/include/asm-mips/qemu.h b/include/asm-mips/qemu.h
deleted file mode 100644
index 487ced4a40de..000000000000
--- a/include/asm-mips/qemu.h
+++ /dev/null
@@ -1,30 +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 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_QEMU_H
9#define __ASM_QEMU_H
10
11/*
12 * Interrupt numbers
13 */
14#define Q_PIC_IRQ_BASE 0
15#define Q_COUNT_COMPARE_IRQ 23
16
17/*
18 * Qemu clock rate. Unlike on real MIPS this has no relation to the
19 * instruction issue rate, so the choosen value is pure fiction, just needs
20 * to match the value in Qemu itself.
21 */
22#define QEMU_C0_COUNTER_CLOCK 100000000
23
24/*
25 * Magic qemu system control location.
26 */
27#define QEMU_RESTART_REG 0xBFBF0000
28#define QEMU_HALT_REG 0xBFBF0004
29
30#endif /* __ASM_QEMU_H */
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index e716447e5e03..8c1eb02c6d16 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -228,7 +228,14 @@ extern void sni_pcimt_irq_init(void);
228extern void sni_cpu_time_init(void); 228extern void sni_cpu_time_init(void);
229 229
230/* eisa init for RM200/400 */ 230/* eisa init for RM200/400 */
231#ifdef CONFIG_EISA
231extern int sni_eisa_root_init(void); 232extern int sni_eisa_root_init(void);
233#else
234static inline int sni_eisa_root_init(void)
235{
236 return 0;
237}
238#endif
232 239
233/* common irq stuff */ 240/* common irq stuff */
234extern void (*sni_hwint)(void); 241extern void (*sni_hwint)(void);
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index fa9a587b3bf1..4964c82f85f9 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -341,16 +341,19 @@
341#define __NR_timerfd (__NR_Linux + 318) 341#define __NR_timerfd (__NR_Linux + 318)
342#define __NR_eventfd (__NR_Linux + 319) 342#define __NR_eventfd (__NR_Linux + 319)
343#define __NR_fallocate (__NR_Linux + 320) 343#define __NR_fallocate (__NR_Linux + 320)
344#define __NR_timerfd_create (__NR_Linux + 321)
345#define __NR_timerfd_gettime (__NR_Linux + 322)
346#define __NR_timerfd_settime (__NR_Linux + 323)
344 347
345/* 348/*
346 * Offset of the last Linux o32 flavoured syscall 349 * Offset of the last Linux o32 flavoured syscall
347 */ 350 */
348#define __NR_Linux_syscalls 320 351#define __NR_Linux_syscalls 323
349 352
350#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 353#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
351 354
352#define __NR_O32_Linux 4000 355#define __NR_O32_Linux 4000
353#define __NR_O32_Linux_syscalls 320 356#define __NR_O32_Linux_syscalls 323
354 357
355#if _MIPS_SIM == _MIPS_SIM_ABI64 358#if _MIPS_SIM == _MIPS_SIM_ABI64
356 359
@@ -638,16 +641,19 @@
638#define __NR_timerfd (__NR_Linux + 277) 641#define __NR_timerfd (__NR_Linux + 277)
639#define __NR_eventfd (__NR_Linux + 278) 642#define __NR_eventfd (__NR_Linux + 278)
640#define __NR_fallocate (__NR_Linux + 279) 643#define __NR_fallocate (__NR_Linux + 279)
644#define __NR_timerfd_create (__NR_Linux + 280)
645#define __NR_timerfd_gettime (__NR_Linux + 281)
646#define __NR_timerfd_settime (__NR_Linux + 282)
641 647
642/* 648/*
643 * Offset of the last Linux 64-bit flavoured syscall 649 * Offset of the last Linux 64-bit flavoured syscall
644 */ 650 */
645#define __NR_Linux_syscalls 279 651#define __NR_Linux_syscalls 282
646 652
647#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 653#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
648 654
649#define __NR_64_Linux 5000 655#define __NR_64_Linux 5000
650#define __NR_64_Linux_syscalls 279 656#define __NR_64_Linux_syscalls 282
651 657
652#if _MIPS_SIM == _MIPS_SIM_NABI32 658#if _MIPS_SIM == _MIPS_SIM_NABI32
653 659
@@ -939,16 +945,19 @@
939#define __NR_timerfd (__NR_Linux + 281) 945#define __NR_timerfd (__NR_Linux + 281)
940#define __NR_eventfd (__NR_Linux + 282) 946#define __NR_eventfd (__NR_Linux + 282)
941#define __NR_fallocate (__NR_Linux + 283) 947#define __NR_fallocate (__NR_Linux + 283)
948#define __NR_timerfd_create (__NR_Linux + 284)
949#define __NR_timerfd_gettime (__NR_Linux + 285)
950#define __NR_timerfd_settime (__NR_Linux + 286)
942 951
943/* 952/*
944 * Offset of the last N32 flavoured syscall 953 * Offset of the last N32 flavoured syscall
945 */ 954 */
946#define __NR_Linux_syscalls 283 955#define __NR_Linux_syscalls 286
947 956
948#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 957#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
949 958
950#define __NR_N32_Linux 6000 959#define __NR_N32_Linux 6000
951#define __NR_N32_Linux_syscalls 283 960#define __NR_N32_Linux_syscalls 286
952 961
953#ifdef __KERNEL__ 962#ifdef __KERNEL__
954 963
diff --git a/include/asm-mn10300/highmem.h b/include/asm-mn10300/highmem.h
index 383c0c42982e..5256854c0453 100644
--- a/include/asm-mn10300/highmem.h
+++ b/include/asm-mn10300/highmem.h
@@ -42,8 +42,8 @@ extern void __init kmap_init(void);
42#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT) 42#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
43#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 43#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
44 44
45extern unsigned long __fastcall kmap_high(struct page *page); 45extern unsigned long kmap_high(struct page *page);
46extern void __fastcall kunmap_high(struct page *page); 46extern void kunmap_high(struct page *page);
47 47
48static inline unsigned long kmap(struct page *page) 48static inline unsigned long kmap(struct page *page)
49{ 49{
diff --git a/include/asm-mn10300/linkage.h b/include/asm-mn10300/linkage.h
index 29a32e467523..dda3002a5dfa 100644
--- a/include/asm-mn10300/linkage.h
+++ b/include/asm-mn10300/linkage.h
@@ -13,8 +13,6 @@
13 13
14/* don't override anything */ 14/* don't override anything */
15#define asmlinkage 15#define asmlinkage
16#define FASTCALL(x) x
17#define fastcall
18 16
19#define __ALIGN .align 4,0xcb 17#define __ALIGN .align 4,0xcb
20#define __ALIGN_STR ".align 4,0xcb" 18#define __ALIGN_STR ".align 4,0xcb"
diff --git a/include/asm-mn10300/param.h b/include/asm-mn10300/param.h
index 54b883ec3906..789b1df41fcb 100644
--- a/include/asm-mn10300/param.h
+++ b/include/asm-mn10300/param.h
@@ -12,7 +12,7 @@
12#define _ASM_PARAM_H 12#define _ASM_PARAM_H
13 13
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15#define HZ 1000 /* Internal kernel timer frequency */ 15#define HZ CONFIG_HZ /* Internal kernel timer frequency */
16#define USER_HZ 100 /* .. some user interfaces are in 16#define USER_HZ 100 /* .. some user interfaces are in
17 * "ticks" */ 17 * "ticks" */
18#define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 18#define CLOCKS_PER_SEC (USER_HZ) /* like times() */
diff --git a/include/asm-mn10300/socket.h b/include/asm-mn10300/socket.h
index 99ca648b94c5..80af9c4ccad7 100644
--- a/include/asm-mn10300/socket.h
+++ b/include/asm-mn10300/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index ccb0523eb3b4..f879252b7ea6 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -13,7 +13,7 @@
13#include <asm/paca.h> 13#include <asm/paca.h>
14 14
15#define __per_cpu_offset(cpu) (paca[cpu].data_offset) 15#define __per_cpu_offset(cpu) (paca[cpu].data_offset)
16#define __my_cpu_offset get_paca()->data_offset 16#define __my_cpu_offset local_paca->data_offset
17#define per_cpu_offset(x) (__per_cpu_offset(x)) 17#define per_cpu_offset(x) (__per_cpu_offset(x))
18 18
19#endif /* CONFIG_SMP */ 19#endif /* CONFIG_SMP */
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index f07c99ba5d13..e3c845b0f764 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -98,9 +98,8 @@
98#define MFC_PRIV_ATTN_EVENT 0x00000800 98#define MFC_PRIV_ATTN_EVENT 0x00000800
99#define MFC_MULTI_SRC_EVENT 0x00001000 99#define MFC_MULTI_SRC_EVENT 0x00001000
100 100
101/* Flags indicating progress during context switch. */ 101/* Flag indicating progress during context switch. */
102#define SPU_CONTEXT_SWITCH_PENDING 0UL 102#define SPU_CONTEXT_SWITCH_PENDING 0UL
103#define SPU_CONTEXT_SWITCH_ACTIVE 1UL
104 103
105struct spu_context; 104struct spu_context;
106struct spu_runqueue; 105struct spu_runqueue;
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index e996521fb3a6..ae7085c65692 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -309,8 +309,10 @@ SYSCALL_SPU(getcpu)
309COMPAT_SYS(epoll_pwait) 309COMPAT_SYS(epoll_pwait)
310COMPAT_SYS_SPU(utimensat) 310COMPAT_SYS_SPU(utimensat)
311COMPAT_SYS_SPU(signalfd) 311COMPAT_SYS_SPU(signalfd)
312SYSCALL(ni_syscall) 312SYSCALL_SPU(timerfd_create)
313SYSCALL_SPU(eventfd) 313SYSCALL_SPU(eventfd)
314COMPAT_SYS_SPU(sync_file_range2) 314COMPAT_SYS_SPU(sync_file_range2)
315COMPAT_SYS(fallocate) 315COMPAT_SYS(fallocate)
316SYSCALL(subpage_prot) 316SYSCALL(subpage_prot)
317COMPAT_SYS_SPU(timerfd_settime)
318COMPAT_SYS_SPU(timerfd_gettime)
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index fedc4b8e49e2..ce91bb662063 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -328,15 +328,17 @@
328#define __NR_epoll_pwait 303 328#define __NR_epoll_pwait 303
329#define __NR_utimensat 304 329#define __NR_utimensat 304
330#define __NR_signalfd 305 330#define __NR_signalfd 305
331#define __NR_timerfd 306 331#define __NR_timerfd_create 306
332#define __NR_eventfd 307 332#define __NR_eventfd 307
333#define __NR_sync_file_range2 308 333#define __NR_sync_file_range2 308
334#define __NR_fallocate 309 334#define __NR_fallocate 309
335#define __NR_subpage_prot 310 335#define __NR_subpage_prot 310
336#define __NR_timerfd_settime 311
337#define __NR_timerfd_gettime 312
336 338
337#ifdef __KERNEL__ 339#ifdef __KERNEL__
338 340
339#define __NR_syscalls 311 341#define __NR_syscalls 313
340 342
341#define __NR__exit __NR_exit 343#define __NR__exit __NR_exit
342#define NR_syscalls __NR_syscalls 344#define NR_syscalls __NR_syscalls
diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h
index ad4c5a1bc9d6..37e4756b6b2d 100644
--- a/include/asm-ppc/page.h
+++ b/include/asm-ppc/page.h
@@ -125,6 +125,8 @@ extern __inline__ int get_order(unsigned long size)
125 return 32 - lz; 125 return 32 - lz;
126} 126}
127 127
128typedef struct page *pgtable_t;
129
128#endif /* __ASSEMBLY__ */ 130#endif /* __ASSEMBLY__ */
129 131
130#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 132#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index ab83c844d04c..965394e69452 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -456,16 +456,18 @@ static inline unsigned long __ffz_word_loop(const unsigned long *addr,
456 456
457 asm volatile( 457 asm volatile(
458#ifndef __s390x__ 458#ifndef __s390x__
459 " ahi %1,31\n" 459 " ahi %1,-1\n"
460 " srl %1,5\n" 460 " sra %1,5\n"
461 " jz 1f\n"
461 "0: c %2,0(%0,%3)\n" 462 "0: c %2,0(%0,%3)\n"
462 " jne 1f\n" 463 " jne 1f\n"
463 " la %0,4(%0)\n" 464 " la %0,4(%0)\n"
464 " brct %1,0b\n" 465 " brct %1,0b\n"
465 "1:\n" 466 "1:\n"
466#else 467#else
467 " aghi %1,63\n" 468 " aghi %1,-1\n"
468 " srlg %1,%1,6\n" 469 " srag %1,%1,6\n"
470 " jz 1f\n"
469 "0: cg %2,0(%0,%3)\n" 471 "0: cg %2,0(%0,%3)\n"
470 " jne 1f\n" 472 " jne 1f\n"
471 " la %0,8(%0)\n" 473 " la %0,8(%0)\n"
@@ -491,16 +493,18 @@ static inline unsigned long __ffs_word_loop(const unsigned long *addr,
491 493
492 asm volatile( 494 asm volatile(
493#ifndef __s390x__ 495#ifndef __s390x__
494 " ahi %1,31\n" 496 " ahi %1,-1\n"
495 " srl %1,5\n" 497 " sra %1,5\n"
498 " jz 1f\n"
496 "0: c %2,0(%0,%3)\n" 499 "0: c %2,0(%0,%3)\n"
497 " jne 1f\n" 500 " jne 1f\n"
498 " la %0,4(%0)\n" 501 " la %0,4(%0)\n"
499 " brct %1,0b\n" 502 " brct %1,0b\n"
500 "1:\n" 503 "1:\n"
501#else 504#else
502 " aghi %1,63\n" 505 " aghi %1,-1\n"
503 " srlg %1,%1,6\n" 506 " srag %1,%1,6\n"
507 " jz 1f\n"
504 "0: cg %2,0(%0,%3)\n" 508 "0: cg %2,0(%0,%3)\n"
505 " jne 1f\n" 509 " jne 1f\n"
506 " la %0,8(%0)\n" 510 " la %0,8(%0)\n"
diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h
index def8128b8b78..cfda7d5bf026 100644
--- a/include/asm-sh/bugs.h
+++ b/include/asm-sh/bugs.h
@@ -39,7 +39,7 @@ static void __init check_bugs(void)
39 *p++ = '4'; 39 *p++ = '4';
40 *p++ = 'a'; 40 *p++ = 'a';
41 break; 41 break;
42 case CPU_SH7343 ... CPU_SH7722: 42 case CPU_SH7343 ... CPU_SH7366:
43 *p++ = '4'; 43 *p++ = '4';
44 *p++ = 'a'; 44 *p++ = 'a';
45 *p++ = 'l'; 45 *p++ = 'l';
diff --git a/include/asm-sh/cpu-sh4/freq.h b/include/asm-sh/cpu-sh4/freq.h
index 1ac10b9a078f..ec028c649215 100644
--- a/include/asm-sh/cpu-sh4/freq.h
+++ b/include/asm-sh/cpu-sh4/freq.h
@@ -10,12 +10,14 @@
10#ifndef __ASM_CPU_SH4_FREQ_H 10#ifndef __ASM_CPU_SH4_FREQ_H
11#define __ASM_CPU_SH4_FREQ_H 11#define __ASM_CPU_SH4_FREQ_H
12 12
13#if defined(CONFIG_CPU_SUBTYPE_SH7722) 13#if defined(CONFIG_CPU_SUBTYPE_SH7722) || defined(CONFIG_CPU_SUBTYPE_SH7366)
14#define FRQCR 0xa4150000 14#define FRQCR 0xa4150000
15#define VCLKCR 0xa4150004 15#define VCLKCR 0xa4150004
16#define SCLKACR 0xa4150008 16#define SCLKACR 0xa4150008
17#define SCLKBCR 0xa415000c 17#define SCLKBCR 0xa415000c
18#if defined(CONFIG_CPU_SUBTYPE_SH7722)
18#define IrDACLKCR 0xa4150010 19#define IrDACLKCR 0xa4150010
20#endif
19#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \ 21#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
20 defined(CONFIG_CPU_SUBTYPE_SH7780) 22 defined(CONFIG_CPU_SUBTYPE_SH7780)
21#define FRQCR 0xffc80000 23#define FRQCR 0xffc80000
diff --git a/include/asm-sh/cpu-sh5/cacheflush.h b/include/asm-sh/cpu-sh5/cacheflush.h
index 98edb5b1da32..5a11f0b7e66a 100644
--- a/include/asm-sh/cpu-sh5/cacheflush.h
+++ b/include/asm-sh/cpu-sh5/cacheflush.h
@@ -3,15 +3,13 @@
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6#include <asm/page.h>
7
8struct vm_area_struct; 6struct vm_area_struct;
9struct page; 7struct page;
10struct mm_struct; 8struct mm_struct;
11 9
12extern void flush_cache_all(void); 10extern void flush_cache_all(void);
13extern void flush_cache_mm(struct mm_struct *mm); 11extern void flush_cache_mm(struct mm_struct *mm);
14extern void flush_cache_sigtramp(unsigned long start, unsigned long end); 12extern void flush_cache_sigtramp(unsigned long vaddr);
15extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 13extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
16 unsigned long end); 14 unsigned long end);
17extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); 15extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
@@ -27,7 +25,7 @@ extern void flush_icache_user_range(struct vm_area_struct *vma,
27#define flush_dcache_mmap_unlock(mapping) do { } while (0) 25#define flush_dcache_mmap_unlock(mapping) do { } while (0)
28 26
29#define flush_icache_page(vma, page) do { } while (0) 27#define flush_icache_page(vma, page) do { } while (0)
30#define p3_cache_init() do { } while (0) 28void p3_cache_init(void);
31 29
32#endif /* __ASSEMBLY__ */ 30#endif /* __ASSEMBLY__ */
33 31
diff --git a/include/asm-sh/cpu-sh5/mmu_context.h b/include/asm-sh/cpu-sh5/mmu_context.h
index df857fc09960..68a1d2cff457 100644
--- a/include/asm-sh/cpu-sh5/mmu_context.h
+++ b/include/asm-sh/cpu-sh5/mmu_context.h
@@ -16,12 +16,6 @@
16/* This has to be a common function because the next location to fill 16/* This has to be a common function because the next location to fill
17 * information is shared. */ 17 * information is shared. */
18extern void __do_tlb_refill(unsigned long address, unsigned long long is_text_not_data, pte_t *pte); 18extern void __do_tlb_refill(unsigned long address, unsigned long long is_text_not_data, pte_t *pte);
19
20/* Profiling counter. */
21#ifdef CONFIG_SH64_PROC_TLB
22extern unsigned long long calls_to_do_fast_page_fault;
23#endif
24
25#endif /* __ASSEMBLY__ */ 19#endif /* __ASSEMBLY__ */
26 20
27#endif /* __ASM_SH_CPU_SH5_MMU_CONTEXT_H */ 21#endif /* __ASM_SH_CPU_SH5_MMU_CONTEXT_H */
diff --git a/include/asm-sh/hp6xx.h b/include/asm-sh/hp6xx.h
index 53ca5643d9c7..0d4165a32dcd 100644
--- a/include/asm-sh/hp6xx.h
+++ b/include/asm-sh/hp6xx.h
@@ -10,9 +10,9 @@
10 * 10 *
11 */ 11 */
12 12
13#define HP680_BTN_IRQ 32 /* IRQ0_IRQ */ 13#define HP680_BTN_IRQ 32 /* IRQ0_IRQ */
14#define HP680_TS_IRQ 35 /* IRQ3_IRQ */ 14#define HP680_TS_IRQ 35 /* IRQ3_IRQ */
15#define HP680_HD64461_IRQ 36 /* IRQ4_IRQ */ 15#define HP680_HD64461_IRQ 36 /* IRQ4_IRQ */
16 16
17#define DAC_LCD_BRIGHTNESS 0 17#define DAC_LCD_BRIGHTNESS 0
18#define DAC_SPEAKER_VOLUME 1 18#define DAC_SPEAKER_VOLUME 1
@@ -55,26 +55,4 @@
55#define PJDR 0xa4000130 55#define PJDR 0xa4000130
56#define PKDR 0xa4000132 56#define PKDR 0xa4000132
57 57
58static inline void hp6xx_led_red(int on)
59{
60 u16 v16;
61 v16 = ctrl_inw(CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000);
62 if (on)
63 ctrl_outw(v16 & (~HD64461_GPBDR_LED_RED), CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000);
64 else
65 ctrl_outw(v16 | HD64461_GPBDR_LED_RED, CONFIG_HD64461_IOBASE + HD64461_GPBDR - 0x10000);
66}
67
68static inline void hp6xx_led_green(int on)
69{
70 u8 v8;
71
72 v8 = ctrl_inb(PKDR);
73 if (on)
74 ctrl_outb(v8 & (~PKDR_LED_GREEN), PKDR);
75 else
76 ctrl_outb(v8 | PKDR_LED_GREEN, PKDR);
77}
78
79
80#endif /* __ASM_SH_HP6XX_H */ 58#endif /* __ASM_SH_HP6XX_H */
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index 94900c089519..356e50d06745 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -38,6 +38,7 @@
38 */ 38 */
39#define __IO_PREFIX generic 39#define __IO_PREFIX generic
40#include <asm/io_generic.h> 40#include <asm/io_generic.h>
41#include <asm/io_trapped.h>
41 42
42#define maybebadio(port) \ 43#define maybebadio(port) \
43 printk(KERN_ERR "bad PC-like io %s:%u for port 0x%lx at 0x%08x\n", \ 44 printk(KERN_ERR "bad PC-like io %s:%u for port 0x%lx at 0x%08x\n", \
@@ -181,13 +182,13 @@ __BUILD_MEMORY_STRING(w, u16)
181#define iowrite32(v,a) writel((v),(a)) 182#define iowrite32(v,a) writel((v),(a))
182#define iowrite32be(v,a) __raw_writel(cpu_to_be32((v)),(a)) 183#define iowrite32be(v,a) __raw_writel(cpu_to_be32((v)),(a))
183 184
184#define ioread8_rep(a,d,c) insb((a),(d),(c)) 185#define ioread8_rep(a, d, c) readsb((a), (d), (c))
185#define ioread16_rep(a,d,c) insw((a),(d),(c)) 186#define ioread16_rep(a, d, c) readsw((a), (d), (c))
186#define ioread32_rep(a,d,c) insl((a),(d),(c)) 187#define ioread32_rep(a, d, c) readsl((a), (d), (c))
187 188
188#define iowrite8_rep(a,s,c) outsb((a),(s),(c)) 189#define iowrite8_rep(a, s, c) writesb((a), (s), (c))
189#define iowrite16_rep(a,s,c) outsw((a),(s),(c)) 190#define iowrite16_rep(a, s, c) writesw((a), (s), (c))
190#define iowrite32_rep(a,s,c) outsl((a),(s),(c)) 191#define iowrite32_rep(a, s, c) writesl((a), (s), (c))
191 192
192#define mmiowb() wmb() /* synco on SH-4A, otherwise a nop */ 193#define mmiowb() wmb() /* synco on SH-4A, otherwise a nop */
193 194
@@ -207,6 +208,8 @@ static inline void __set_io_port_base(unsigned long pbase)
207 generic_io_base = pbase; 208 generic_io_base = pbase;
208} 209}
209 210
211#define __ioport_map(p, n) sh_mv.mv_ioport_map((p), (n))
212
210/* We really want to try and get these to memcpy etc */ 213/* We really want to try and get these to memcpy etc */
211extern void memcpy_fromio(void *, volatile void __iomem *, unsigned long); 214extern void memcpy_fromio(void *, volatile void __iomem *, unsigned long);
212extern void memcpy_toio(volatile void __iomem *, const void *, unsigned long); 215extern void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
@@ -309,7 +312,14 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
309{ 312{
310#ifdef CONFIG_SUPERH32 313#ifdef CONFIG_SUPERH32
311 unsigned long last_addr = offset + size - 1; 314 unsigned long last_addr = offset + size - 1;
315#endif
316 void __iomem *ret;
312 317
318 ret = __ioremap_trapped(offset, size);
319 if (ret)
320 return ret;
321
322#ifdef CONFIG_SUPERH32
313 /* 323 /*
314 * For P1 and P2 space this is trivial, as everything is already 324 * For P1 and P2 space this is trivial, as everything is already
315 * mapped. Uncached access for P1 addresses are done through P2. 325 * mapped. Uncached access for P1 addresses are done through P2.
diff --git a/include/asm-sh/io_trapped.h b/include/asm-sh/io_trapped.h
new file mode 100644
index 000000000000..f1251d4f0ba9
--- /dev/null
+++ b/include/asm-sh/io_trapped.h
@@ -0,0 +1,58 @@
1#ifndef __ASM_SH_IO_TRAPPED_H
2#define __ASM_SH_IO_TRAPPED_H
3
4#include <linux/list.h>
5#include <linux/ioport.h>
6#include <asm/page.h>
7
8#define IO_TRAPPED_MAGIC 0xfeedbeef
9
10struct trapped_io {
11 unsigned int magic;
12 struct resource *resource;
13 unsigned int num_resources;
14 unsigned int minimum_bus_width;
15 struct list_head list;
16 void __iomem *virt_base;
17} __aligned(PAGE_SIZE);
18
19#ifdef CONFIG_IO_TRAPPED
20int register_trapped_io(struct trapped_io *tiop);
21int handle_trapped_io(struct pt_regs *regs, unsigned long address);
22
23void __iomem *match_trapped_io_handler(struct list_head *list,
24 unsigned long offset,
25 unsigned long size);
26
27#ifdef CONFIG_HAS_IOMEM
28extern struct list_head trapped_mem;
29
30static inline void __iomem *
31__ioremap_trapped(unsigned long offset, unsigned long size)
32{
33 return match_trapped_io_handler(&trapped_mem, offset, size);
34}
35#else
36#define __ioremap_trapped(offset, size) NULL
37#endif
38
39#ifdef CONFIG_HAS_IOPORT
40extern struct list_head trapped_io;
41
42static inline void __iomem *
43__ioport_map_trapped(unsigned long offset, unsigned long size)
44{
45 return match_trapped_io_handler(&trapped_io, offset, size);
46}
47#else
48#define __ioport_map_trapped(offset, size) NULL
49#endif
50
51#else
52#define register_trapped_io(tiop) (-1)
53#define handle_trapped_io(tiop, address) 0
54#define __ioremap_trapped(offset, size) NULL
55#define __ioport_map_trapped(offset, size) NULL
56#endif
57
58#endif /* __ASM_SH_IO_TRAPPED_H */
diff --git a/include/asm-sh/ioctls.h b/include/asm-sh/ioctls.h
index 35805df010a0..c212c371a4a5 100644
--- a/include/asm-sh/ioctls.h
+++ b/include/asm-sh/ioctls.h
@@ -78,6 +78,10 @@
78#define TIOCSBRK _IO('T', 39) /* 0x5427 */ /* BSD compatibility */ 78#define TIOCSBRK _IO('T', 39) /* 0x5427 */ /* BSD compatibility */
79#define TIOCCBRK _IO('T', 40) /* 0x5428 */ /* BSD compatibility */ 79#define TIOCCBRK _IO('T', 40) /* 0x5428 */ /* BSD compatibility */
80#define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */ 80#define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */
81#define TCGETS2 _IOR('T', 42, struct termios2)
82#define TCSETS2 _IOW('T', 43, struct termios2)
83#define TCSETSW2 _IOW('T', 44, struct termios2)
84#define TCSETSF2 _IOW('T', 45, struct termios2)
81#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 85#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
82#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 86#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
83 87
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index 11850f65c922..ca66e5df69dc 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -50,4 +50,8 @@ extern void irq_ctx_exit(int cpu);
50# define irq_ctx_exit(cpu) do { } while (0) 50# define irq_ctx_exit(cpu) do { } while (0)
51#endif 51#endif
52 52
53#ifdef CONFIG_CPU_SH5
54#include <asm/cpu/irq.h>
55#endif
56
53#endif /* __ASM_SH_IRQ_H */ 57#endif /* __ASM_SH_IRQ_H */
diff --git a/include/asm-sh/mmu_context_64.h b/include/asm-sh/mmu_context_64.h
index 020be744b088..9649f1c07caf 100644
--- a/include/asm-sh/mmu_context_64.h
+++ b/include/asm-sh/mmu_context_64.h
@@ -66,6 +66,9 @@ static inline void set_asid(unsigned long asid)
66 : "=r" (sr), "=r" (pc) : "0" (sr)); 66 : "=r" (sr), "=r" (pc) : "0" (sr));
67} 67}
68 68
69/* arch/sh/kernel/cpu/sh5/entry.S */
70extern unsigned long switch_and_save_asid(unsigned long new_asid);
71
69/* No spare register to twiddle, so use a software cache */ 72/* No spare register to twiddle, so use a software cache */
70extern pgd_t *mmu_pdtp_cache; 73extern pgd_t *mmu_pdtp_cache;
71 74
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 134562dc8c45..304c30b5d947 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -55,11 +55,14 @@ extern void clear_page(void *to);
55extern void copy_page(void *to, void *from); 55extern void copy_page(void *to, void *from);
56 56
57#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \ 57#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
58 (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)) 58 (defined(CONFIG_CPU_SH5) || defined(CONFIG_CPU_SH4) || \
59 defined(CONFIG_SH7705_CACHE_32KB))
59struct page; 60struct page;
60struct vm_area_struct; 61struct vm_area_struct;
61extern void clear_user_page(void *to, unsigned long address, struct page *page); 62extern void clear_user_page(void *to, unsigned long address, struct page *page);
62#ifdef CONFIG_CPU_SH4 63extern void copy_user_page(void *to, void *from, unsigned long address,
64 struct page *page);
65#if defined(CONFIG_CPU_SH4)
63extern void copy_user_highpage(struct page *to, struct page *from, 66extern void copy_user_highpage(struct page *to, struct page *from,
64 unsigned long vaddr, struct vm_area_struct *vma); 67 unsigned long vaddr, struct vm_area_struct *vma);
65#define __HAVE_ARCH_COPY_USER_HIGHPAGE 68#define __HAVE_ARCH_COPY_USER_HIGHPAGE
diff --git a/include/asm-sh/pgtable_64.h b/include/asm-sh/pgtable_64.h
index 972211671c9a..f9dd9d311441 100644
--- a/include/asm-sh/pgtable_64.h
+++ b/include/asm-sh/pgtable_64.h
@@ -138,6 +138,14 @@ static __inline__ void pmd_set(pmd_t *pmdp,pte_t *ptep)
138#endif 138#endif
139 139
140/* 140/*
141 * Stub out _PAGE_SZHUGE if we don't have a good definition for it,
142 * to make pte_mkhuge() happy.
143 */
144#ifndef _PAGE_SZHUGE
145# define _PAGE_SZHUGE (0)
146#endif
147
148/*
141 * Default flags for a Kernel page. 149 * Default flags for a Kernel page.
142 * This is fundametally also SHARED because the main use of this define 150 * This is fundametally also SHARED because the main use of this define
143 * (other than for PGD/PMD entries) is for the VMALLOC pool which is 151 * (other than for PGD/PMD entries) is for the VMALLOC pool which is
@@ -179,6 +187,11 @@ static __inline__ void pmd_set(pmd_t *pmdp,pte_t *ptep)
179 _PAGE_WRITE | _PAGE_EXECUTE) 187 _PAGE_WRITE | _PAGE_EXECUTE)
180#define PAGE_KERNEL __pgprot(_KERNPG_TABLE) 188#define PAGE_KERNEL __pgprot(_KERNPG_TABLE)
181 189
190#define PAGE_KERNEL_NOCACHE \
191 __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
192 _PAGE_EXECUTE | _PAGE_ACCESSED | \
193 _PAGE_DIRTY | _PAGE_SHARED)
194
182/* Make it a device mapping for maximum safety (e.g. for mapping device 195/* Make it a device mapping for maximum safety (e.g. for mapping device
183 registers into user-space via /dev/map). */ 196 registers into user-space via /dev/map). */
184#define pgprot_noncached(x) __pgprot(((x).pgprot & ~(_PAGE_CACHABLE)) | _PAGE_DEVICE) 197#define pgprot_noncached(x) __pgprot(((x).pgprot & ~(_PAGE_CACHABLE)) | _PAGE_DEVICE)
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index c9b14161f73d..19fe47c1ca17 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -33,7 +33,7 @@ enum cpu_type {
33 CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SHX3, 33 CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SHX3,
34 34
35 /* SH4AL-DSP types */ 35 /* SH4AL-DSP types */
36 CPU_SH7343, CPU_SH7722, 36 CPU_SH7343, CPU_SH7722, CPU_SH7366,
37 37
38 /* SH-5 types */ 38 /* SH-5 types */
39 CPU_SH5_101, CPU_SH5_103, 39 CPU_SH5_101, CPU_SH5_103,
diff --git a/include/asm-sh/r7780rp.h b/include/asm-sh/r7780rp.h
index bdecea0840a0..1770460a4616 100644
--- a/include/asm-sh/r7780rp.h
+++ b/include/asm-sh/r7780rp.h
@@ -195,7 +195,4 @@ unsigned char *highlander_init_irq_r7780mp(void);
195unsigned char *highlander_init_irq_r7780rp(void); 195unsigned char *highlander_init_irq_r7780rp(void);
196unsigned char *highlander_init_irq_r7785rp(void); 196unsigned char *highlander_init_irq_r7785rp(void);
197 197
198#define __IO_PREFIX r7780rp
199#include <asm/io_generic.h>
200
201#endif /* __ASM_SH_RENESAS_R7780RP */ 198#endif /* __ASM_SH_RENESAS_R7780RP */
diff --git a/include/asm-sh/rts7751r2d.h b/include/asm-sh/rts7751r2d.h
index 83b9c111f171..0a800157b826 100644
--- a/include/asm-sh/rts7751r2d.h
+++ b/include/asm-sh/rts7751r2d.h
@@ -67,7 +67,4 @@
67void init_rts7751r2d_IRQ(void); 67void init_rts7751r2d_IRQ(void);
68int rts7751r2d_irq_demux(int); 68int rts7751r2d_irq_demux(int);
69 69
70#define __IO_PREFIX rts7751r2d
71#include <asm/io_generic.h>
72
73#endif /* __ASM_SH_RENESAS_RTS7751R2D */ 70#endif /* __ASM_SH_RENESAS_RTS7751R2D */
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index 772cd1a0a674..5145aa2a0ce9 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -182,6 +182,11 @@ BUILD_TRAP_HANDLER(fpu_state_restore);
182 182
183#define arch_align_stack(x) (x) 183#define arch_align_stack(x) (x)
184 184
185struct mem_access {
186 unsigned long (*from)(void *dst, const void *src, unsigned long cnt);
187 unsigned long (*to)(void *dst, const void *src, unsigned long cnt);
188};
189
185#ifdef CONFIG_SUPERH32 190#ifdef CONFIG_SUPERH32
186# include "system_32.h" 191# include "system_32.h"
187#else 192#else
diff --git a/include/asm-sh/system_32.h b/include/asm-sh/system_32.h
index 7ff08d956ba8..f11bcf0855ed 100644
--- a/include/asm-sh/system_32.h
+++ b/include/asm-sh/system_32.h
@@ -96,4 +96,7 @@ do { \
96 : "=&r" (__dummy)); \ 96 : "=&r" (__dummy)); \
97} while (0) 97} while (0)
98 98
99int handle_unaligned_access(opcode_t instruction, struct pt_regs *regs,
100 struct mem_access *ma);
101
99#endif /* __ASM_SH_SYSTEM_32_H */ 102#endif /* __ASM_SH_SYSTEM_32_H */
diff --git a/include/asm-sh/termbits.h b/include/asm-sh/termbits.h
index 7ee1b42eeab0..77db116948cf 100644
--- a/include/asm-sh/termbits.h
+++ b/include/asm-sh/termbits.h
@@ -140,6 +140,7 @@ struct ktermios {
140#define HUPCL 0002000 140#define HUPCL 0002000
141#define CLOCAL 0004000 141#define CLOCAL 0004000
142#define CBAUDEX 0010000 142#define CBAUDEX 0010000
143#define BOTHER 0010000
143#define B57600 0010001 144#define B57600 0010001
144#define B115200 0010002 145#define B115200 0010002
145#define B230400 0010003 146#define B230400 0010003
@@ -155,10 +156,12 @@ struct ktermios {
155#define B3000000 0010015 156#define B3000000 0010015
156#define B3500000 0010016 157#define B3500000 0010016
157#define B4000000 0010017 158#define B4000000 0010017
158#define CIBAUD 002003600000 /* input baud rate (not used) */ 159#define CIBAUD 002003600000 /* input baud rate */
159#define CMSPAR 010000000000 /* mark or space (stick) parity */ 160#define CMSPAR 010000000000 /* mark or space (stick) parity */
160#define CRTSCTS 020000000000 /* flow control */ 161#define CRTSCTS 020000000000 /* flow control */
161 162
163#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
164
162/* c_lflag bits */ 165/* c_lflag bits */
163#define ISIG 0000001 166#define ISIG 0000001
164#define ICANON 0000002 167#define ICANON 0000002
diff --git a/include/asm-sh/termios.h b/include/asm-sh/termios.h
index e7c8f86ef890..0a8c793c76f2 100644
--- a/include/asm-sh/termios.h
+++ b/include/asm-sh/termios.h
@@ -80,8 +80,10 @@ struct termio {
80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
81}) 81})
82 82
83#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 83#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
84#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 84#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
85#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
86#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
85 87
86#endif /* __KERNEL__ */ 88#endif /* __KERNEL__ */
87 89
diff --git a/include/asm-sh/tlb.h b/include/asm-sh/tlb.h
index 56ad1fb888a2..88ff1ae8a6b8 100644
--- a/include/asm-sh/tlb.h
+++ b/include/asm-sh/tlb.h
@@ -20,6 +20,7 @@
20 */ 20 */
21#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) 21#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
22 22
23#include <linux/pagemap.h>
23#include <asm-generic/tlb.h> 24#include <asm-generic/tlb.h>
24 25
25#endif /* __ASSEMBLY__ */ 26#endif /* __ASSEMBLY__ */
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index ff24ce95b238..b3440c305b5d 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -1,5 +1,34 @@
1#ifndef __ASM_SH_UACCESS_H
2#define __ASM_SH_UACCESS_H
3
1#ifdef CONFIG_SUPERH32 4#ifdef CONFIG_SUPERH32
2# include "uaccess_32.h" 5# include "uaccess_32.h"
3#else 6#else
4# include "uaccess_64.h" 7# include "uaccess_64.h"
5#endif 8#endif
9
10static inline unsigned long
11copy_from_user(void *to, const void __user *from, unsigned long n)
12{
13 unsigned long __copy_from = (unsigned long) from;
14 __kernel_size_t __copy_size = (__kernel_size_t) n;
15
16 if (__copy_size && __access_ok(__copy_from, __copy_size))
17 return __copy_user(to, from, __copy_size);
18
19 return __copy_size;
20}
21
22static inline unsigned long
23copy_to_user(void __user *to, const void *from, unsigned long n)
24{
25 unsigned long __copy_to = (unsigned long) to;
26 __kernel_size_t __copy_size = (__kernel_size_t) n;
27
28 if (__copy_size && __access_ok(__copy_to, __copy_size))
29 return __copy_user(to, from, __copy_size);
30
31 return __copy_size;
32}
33
34#endif /* __ASM_SH_UACCESS_H */
diff --git a/include/asm-sh/uaccess_32.h b/include/asm-sh/uaccess_32.h
index b6082f3c1dc4..c0318b608893 100644
--- a/include/asm-sh/uaccess_32.h
+++ b/include/asm-sh/uaccess_32.h
@@ -10,8 +10,8 @@
10 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle 10 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
11 * and i386 version. 11 * and i386 version.
12 */ 12 */
13#ifndef __ASM_SH_UACCESS_H 13#ifndef __ASM_SH_UACCESS_32_H
14#define __ASM_SH_UACCESS_H 14#define __ASM_SH_UACCESS_32_H
15 15
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
@@ -302,24 +302,6 @@ extern void __put_user_unknown(void);
302/* Return the number of bytes NOT copied */ 302/* Return the number of bytes NOT copied */
303__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); 303__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n);
304 304
305#define copy_to_user(to,from,n) ({ \
306void *__copy_to = (void *) (to); \
307__kernel_size_t __copy_size = (__kernel_size_t) (n); \
308__kernel_size_t __copy_res; \
309if(__copy_size && __access_ok((unsigned long)__copy_to, __copy_size)) { \
310__copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \
311} else __copy_res = __copy_size; \
312__copy_res; })
313
314#define copy_from_user(to,from,n) ({ \
315void *__copy_to = (void *) (to); \
316void *__copy_from = (void *) (from); \
317__kernel_size_t __copy_size = (__kernel_size_t) (n); \
318__kernel_size_t __copy_res; \
319if(__copy_size && __access_ok((unsigned long)__copy_from, __copy_size)) { \
320__copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \
321} else __copy_res = __copy_size; \
322__copy_res; })
323 305
324static __always_inline unsigned long 306static __always_inline unsigned long
325__copy_from_user(void *to, const void __user *from, unsigned long n) 307__copy_from_user(void *to, const void __user *from, unsigned long n)
@@ -507,4 +489,4 @@ struct exception_table_entry
507 489
508extern int fixup_exception(struct pt_regs *regs); 490extern int fixup_exception(struct pt_regs *regs);
509 491
510#endif /* __ASM_SH_UACCESS_H */ 492#endif /* __ASM_SH_UACCESS_32_H */
diff --git a/include/asm-sh/uaccess_64.h b/include/asm-sh/uaccess_64.h
index d54ec082d25a..f956b7b316c7 100644
--- a/include/asm-sh/uaccess_64.h
+++ b/include/asm-sh/uaccess_64.h
@@ -202,15 +202,6 @@ extern void __put_user_unknown(void);
202/* XXX: should be such that: 4byte and the rest. */ 202/* XXX: should be such that: 4byte and the rest. */
203extern __kernel_size_t __copy_user(void *__to, const void *__from, __kernel_size_t __n); 203extern __kernel_size_t __copy_user(void *__to, const void *__from, __kernel_size_t __n);
204 204
205#define copy_to_user(to,from,n) ({ \
206void *__copy_to = (void *) (to); \
207__kernel_size_t __copy_size = (__kernel_size_t) (n); \
208__kernel_size_t __copy_res; \
209if(__copy_size && __access_ok((unsigned long)__copy_to, __copy_size)) { \
210__copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \
211} else __copy_res = __copy_size; \
212__copy_res; })
213
214#define copy_to_user_ret(to,from,n,retval) ({ \ 205#define copy_to_user_ret(to,from,n,retval) ({ \
215if (copy_to_user(to,from,n)) \ 206if (copy_to_user(to,from,n)) \
216 return retval; \ 207 return retval; \
@@ -225,16 +216,6 @@ if (__copy_to_user(to,from,n)) \
225 return retval; \ 216 return retval; \
226}) 217})
227 218
228#define copy_from_user(to,from,n) ({ \
229void *__copy_to = (void *) (to); \
230void *__copy_from = (void *) (from); \
231__kernel_size_t __copy_size = (__kernel_size_t) (n); \
232__kernel_size_t __copy_res; \
233if(__copy_size && __access_ok((unsigned long)__copy_from, __copy_size)) { \
234__copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \
235} else __copy_res = __copy_size; \
236__copy_res; })
237
238#define copy_from_user_ret(to,from,n,retval) ({ \ 219#define copy_from_user_ret(to,from,n,retval) ({ \
239if (copy_from_user(to,from,n)) \ 220if (copy_from_user(to,from,n)) \
240 return retval; \ 221 return retval; \
diff --git a/include/asm-sh/unistd_32.h b/include/asm-sh/unistd_32.h
index 433fd1b48fa2..0b07212ec659 100644
--- a/include/asm-sh/unistd_32.h
+++ b/include/asm-sh/unistd_32.h
@@ -330,11 +330,13 @@
330#define __NR_epoll_pwait 319 330#define __NR_epoll_pwait 319
331#define __NR_utimensat 320 331#define __NR_utimensat 320
332#define __NR_signalfd 321 332#define __NR_signalfd 321
333/* #define __NR_timerfd 322 removed */ 333#define __NR_timerfd_create 322
334#define __NR_eventfd 323 334#define __NR_eventfd 323
335#define __NR_fallocate 324 335#define __NR_fallocate 324
336#define __NR_timerfd_settime 325
337#define __NR_timerfd_gettime 326
336 338
337#define NR_syscalls 325 339#define NR_syscalls 327
338 340
339#ifdef __KERNEL__ 341#ifdef __KERNEL__
340 342
diff --git a/include/asm-sh/unistd_64.h b/include/asm-sh/unistd_64.h
index 108d2ba897fe..9d21eab52427 100644
--- a/include/asm-sh/unistd_64.h
+++ b/include/asm-sh/unistd_64.h
@@ -90,7 +90,7 @@
90#define __NR_sigpending 73 90#define __NR_sigpending 73
91#define __NR_sethostname 74 91#define __NR_sethostname 74
92#define __NR_setrlimit 75 92#define __NR_setrlimit 75
93#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ 93#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
94#define __NR_getrusage 77 94#define __NR_getrusage 77
95#define __NR_gettimeofday 78 95#define __NR_gettimeofday 78
96#define __NR_settimeofday 79 96#define __NR_settimeofday 79
@@ -370,9 +370,11 @@
370#define __NR_epoll_pwait 347 370#define __NR_epoll_pwait 347
371#define __NR_utimensat 348 371#define __NR_utimensat 348
372#define __NR_signalfd 349 372#define __NR_signalfd 349
373/* #define __NR_timerfd 350 removed */ 373#define __NR_timerfd_create 350
374#define __NR_eventfd 351 374#define __NR_eventfd 351
375#define __NR_fallocate 352 375#define __NR_fallocate 352
376#define __NR_timerfd_settime 353
377#define __NR_timerfd_gettime 354
376 378
377#ifdef __KERNEL__ 379#ifdef __KERNEL__
378 380
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h
index 8617c3a5143b..67341cff2e6b 100644
--- a/include/asm-sparc64/ptrace.h
+++ b/include/asm-sparc64/ptrace.h
@@ -102,6 +102,7 @@ do { current_thread_info()->syscall_noerror = 1; \
102} while (0) 102} while (0)
103#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV)) 103#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
104#define instruction_pointer(regs) ((regs)->tpc) 104#define instruction_pointer(regs) ((regs)->tpc)
105#define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
105#ifdef CONFIG_SMP 106#ifdef CONFIG_SMP
106extern unsigned long profile_pc(struct pt_regs *); 107extern unsigned long profile_pc(struct pt_regs *);
107#else 108#else
diff --git a/include/asm-x86/cacheflush.h b/include/asm-x86/cacheflush.h
index 6a22212b4b20..5396c212d8c0 100644
--- a/include/asm-x86/cacheflush.h
+++ b/include/asm-x86/cacheflush.h
@@ -48,12 +48,15 @@ void cpa_init(void);
48 48
49#ifdef CONFIG_DEBUG_RODATA 49#ifdef CONFIG_DEBUG_RODATA
50void mark_rodata_ro(void); 50void mark_rodata_ro(void);
51extern const int rodata_test_data;
51#endif 52#endif
53
52#ifdef CONFIG_DEBUG_RODATA_TEST 54#ifdef CONFIG_DEBUG_RODATA_TEST
53void rodata_test(void); 55int rodata_test(void);
54#else 56#else
55static inline void rodata_test(void) 57static inline int rodata_test(void)
56{ 58{
59 return 0;
57} 60}
58#endif 61#endif
59 62
diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h
deleted file mode 100644
index 8b137891791f..000000000000
--- a/include/asm-x86/desc_64.h
+++ /dev/null
@@ -1 +0,0 @@
1
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h
index 6b1895ccd6b7..f377b76b2f34 100644
--- a/include/asm-x86/i387.h
+++ b/include/asm-x86/i387.h
@@ -20,7 +20,6 @@
20#include <asm/uaccess.h> 20#include <asm/uaccess.h>
21 21
22extern void fpu_init(void); 22extern void fpu_init(void);
23extern unsigned int mxcsr_feature_mask;
24extern void mxcsr_feature_mask_init(void); 23extern void mxcsr_feature_mask_init(void);
25extern void init_fpu(struct task_struct *child); 24extern void init_fpu(struct task_struct *child);
26extern asmlinkage void math_state_restore(void); 25extern asmlinkage void math_state_restore(void);
diff --git a/include/asm-x86/kdebug.h b/include/asm-x86/kdebug.h
index dd442a1632c0..99dcbafa1511 100644
--- a/include/asm-x86/kdebug.h
+++ b/include/asm-x86/kdebug.h
@@ -31,7 +31,6 @@ extern void show_trace(struct task_struct *t, struct pt_regs *regs,
31 unsigned long *sp, unsigned long bp); 31 unsigned long *sp, unsigned long bp);
32extern void __show_regs(struct pt_regs *regs); 32extern void __show_regs(struct pt_regs *regs);
33extern void show_regs(struct pt_regs *regs); 33extern void show_regs(struct pt_regs *regs);
34extern void dump_pagetable(unsigned long);
35extern unsigned long oops_begin(void); 34extern unsigned long oops_begin(void);
36extern void oops_end(unsigned long, struct pt_regs *, int signr); 35extern void oops_end(unsigned long, struct pt_regs *, int signr);
37 36
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index bd4740a60f29..0a0b77bc736a 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -188,6 +188,7 @@ static inline unsigned long pmd_bad(pmd_t pmd)
188#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) 188#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
189#define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) 189#define pgd_offset_k(address) (init_level4_pgt + pgd_index(address))
190#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT) 190#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT)
191static inline int pgd_large(pgd_t pgd) { return 0; }
191#define mk_kernel_pgd(address) ((pgd_t){ (address) | _KERNPG_TABLE }) 192#define mk_kernel_pgd(address) ((pgd_t){ (address) | _KERNPG_TABLE })
192 193
193/* PUD - Level3 access */ 194/* PUD - Level3 access */
@@ -246,6 +247,7 @@ static inline int pud_large(pud_t pte)
246#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val }) 247#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val })
247 248
248extern int kern_addr_valid(unsigned long addr); 249extern int kern_addr_valid(unsigned long addr);
250extern void cleanup_highmap(void);
249 251
250#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ 252#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
251 remap_pfn_range(vma, vaddr, pfn, size, prot) 253 remap_pfn_range(vma, vaddr, pfn, size, prot)
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index 149920dcd341..45a2f0ab33d0 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -302,10 +302,6 @@ union i387_union {
302}; 302};
303 303
304#ifdef CONFIG_X86_32 304#ifdef CONFIG_X86_32
305/*
306 * the following now lives in the per cpu area:
307 * extern int cpu_llc_id[NR_CPUS];
308 */
309DECLARE_PER_CPU(u8, cpu_llc_id); 305DECLARE_PER_CPU(u8, cpu_llc_id);
310#else 306#else
311DECLARE_PER_CPU(struct orig_ist, orig_ist); 307DECLARE_PER_CPU(struct orig_ist, orig_ist);
@@ -671,7 +667,6 @@ extern void init_gdt(int cpu);
671extern unsigned int machine_id; 667extern unsigned int machine_id;
672extern unsigned int machine_submodel_id; 668extern unsigned int machine_submodel_id;
673extern unsigned int BIOS_revision; 669extern unsigned int BIOS_revision;
674extern unsigned int mca_pentium_flag;
675 670
676/* Boot loader type from the setup header */ 671/* Boot loader type from the setup header */
677extern int bootloader_type; 672extern int bootloader_type;
diff --git a/include/asm-x86/sigcontext.h b/include/asm-x86/sigcontext.h
index 681deade5f00..d743947f4c77 100644
--- a/include/asm-x86/sigcontext.h
+++ b/include/asm-x86/sigcontext.h
@@ -58,6 +58,7 @@ struct _fpstate {
58 58
59#define X86_FXSR_MAGIC 0x0000 59#define X86_FXSR_MAGIC 0x0000
60 60
61#ifdef __KERNEL__
61struct sigcontext { 62struct sigcontext {
62 unsigned short gs, __gsh; 63 unsigned short gs, __gsh;
63 unsigned short fs, __fsh; 64 unsigned short fs, __fsh;
@@ -82,6 +83,35 @@ struct sigcontext {
82 unsigned long oldmask; 83 unsigned long oldmask;
83 unsigned long cr2; 84 unsigned long cr2;
84}; 85};
86#else /* __KERNEL__ */
87/*
88 * User-space might still rely on the old definition:
89 */
90struct sigcontext {
91 unsigned short gs, __gsh;
92 unsigned short fs, __fsh;
93 unsigned short es, __esh;
94 unsigned short ds, __dsh;
95 unsigned long edi;
96 unsigned long esi;
97 unsigned long ebp;
98 unsigned long esp;
99 unsigned long ebx;
100 unsigned long edx;
101 unsigned long ecx;
102 unsigned long eax;
103 unsigned long trapno;
104 unsigned long err;
105 unsigned long eip;
106 unsigned short cs, __csh;
107 unsigned long eflags;
108 unsigned long esp_at_signal;
109 unsigned short ss, __ssh;
110 struct _fpstate __user * fpstate;
111 unsigned long oldmask;
112 unsigned long cr2;
113};
114#endif /* !__KERNEL__ */
85 115
86#else /* __i386__ */ 116#else /* __i386__ */
87 117
@@ -102,6 +132,7 @@ struct _fpstate {
102 __u32 reserved2[24]; 132 __u32 reserved2[24];
103}; 133};
104 134
135#ifdef __KERNEL__
105struct sigcontext { 136struct sigcontext {
106 unsigned long r8; 137 unsigned long r8;
107 unsigned long r9; 138 unsigned long r9;
@@ -132,6 +163,41 @@ struct sigcontext {
132 struct _fpstate __user *fpstate; /* zero when no FPU context */ 163 struct _fpstate __user *fpstate; /* zero when no FPU context */
133 unsigned long reserved1[8]; 164 unsigned long reserved1[8];
134}; 165};
166#else /* __KERNEL__ */
167/*
168 * User-space might still rely on the old definition:
169 */
170struct sigcontext {
171 unsigned long r8;
172 unsigned long r9;
173 unsigned long r10;
174 unsigned long r11;
175 unsigned long r12;
176 unsigned long r13;
177 unsigned long r14;
178 unsigned long r15;
179 unsigned long rdi;
180 unsigned long rsi;
181 unsigned long rbp;
182 unsigned long rbx;
183 unsigned long rdx;
184 unsigned long rax;
185 unsigned long rcx;
186 unsigned long rsp;
187 unsigned long rip;
188 unsigned long eflags; /* RFLAGS */
189 unsigned short cs;
190 unsigned short gs;
191 unsigned short fs;
192 unsigned short __pad0;
193 unsigned long err;
194 unsigned long trapno;
195 unsigned long oldmask;
196 unsigned long cr2;
197 struct _fpstate __user *fpstate; /* zero when no FPU context */
198 unsigned long reserved1[8];
199};
200#endif /* !__KERNEL__ */
135 201
136#endif /* !__i386__ */ 202#endif /* !__i386__ */
137 203
diff --git a/include/asm-xtensa/cacheflush.h b/include/asm-xtensa/cacheflush.h
index b773c57e75a5..94c4c53a099e 100644
--- a/include/asm-xtensa/cacheflush.h
+++ b/include/asm-xtensa/cacheflush.h
@@ -70,6 +70,8 @@ extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long);
70#endif 70#endif
71#if (ICACHE_WAY_SIZE > PAGE_SIZE) 71#if (ICACHE_WAY_SIZE > PAGE_SIZE)
72extern void __invalidate_icache_page_alias(unsigned long, unsigned long); 72extern void __invalidate_icache_page_alias(unsigned long, unsigned long);
73#else
74# define __invalidate_icache_page_alias(v,p) do { } while(0)
73#endif 75#endif
74 76
75/* 77/*
diff --git a/include/asm-xtensa/coprocessor.h b/include/asm-xtensa/coprocessor.h
index aa2121034558..1cbcf9001a41 100644
--- a/include/asm-xtensa/coprocessor.h
+++ b/include/asm-xtensa/coprocessor.h
@@ -5,81 +5,173 @@
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) 2003 - 2005 Tensilica Inc. 8 * Copyright (C) 2003 - 2007 Tensilica Inc.
9 */ 9 */
10 10
11
11#ifndef _XTENSA_COPROCESSOR_H 12#ifndef _XTENSA_COPROCESSOR_H
12#define _XTENSA_COPROCESSOR_H 13#define _XTENSA_COPROCESSOR_H
13 14
14#include <asm/variant/core.h> 15#include <linux/stringify.h>
15#include <asm/variant/tie.h> 16#include <asm/variant/tie.h>
17#include <asm/types.h>
18
19#ifdef __ASSEMBLY__
20# include <asm/variant/tie-asm.h>
21
22.macro xchal_sa_start a b
23 .set .Lxchal_pofs_, 0
24 .set .Lxchal_ofs_, 0
25.endm
26
27.macro xchal_sa_align ptr minofs maxofs ofsalign totalign
28 .set .Lxchal_ofs_, .Lxchal_ofs_ + .Lxchal_pofs_ + \totalign - 1
29 .set .Lxchal_ofs_, (.Lxchal_ofs_ & -\totalign) - .Lxchal_pofs_
30.endm
31
32#define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \
33 | XTHAL_SAS_CC \
34 | XTHAL_SAS_CALR | XTHAL_SAS_CALE )
35
36.macro save_xtregs_opt ptr clb at1 at2 at3 at4 offset
37 .if XTREGS_OPT_SIZE > 0
38 addi \clb, \ptr, \offset
39 xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT
40 .endif
41.endm
42
43.macro load_xtregs_opt ptr clb at1 at2 at3 at4 offset
44 .if XTREGS_OPT_SIZE > 0
45 addi \clb, \ptr, \offset
46 xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT
47 .endif
48.endm
49#undef _SELECT
50
51#define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \
52 | XTHAL_SAS_NOCC \
53 | XTHAL_SAS_CALR | XTHAL_SAS_CALE | XTHAL_SAS_GLOB )
54
55.macro save_xtregs_user ptr clb at1 at2 at3 at4 offset
56 .if XTREGS_USER_SIZE > 0
57 addi \clb, \ptr, \offset
58 xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT
59 .endif
60.endm
61
62.macro load_xtregs_user ptr clb at1 at2 at3 at4 offset
63 .if XTREGS_USER_SIZE > 0
64 addi \clb, \ptr, \offset
65 xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT
66 .endif
67.endm
68#undef _SELECT
69
70
71
72#endif /* __ASSEMBLY__ */
16 73
17#if !XCHAL_HAVE_CP
18
19#define XTENSA_CP_EXTRA_OFFSET 0
20#define XTENSA_CP_EXTRA_ALIGN 1 /* must be a power of 2 */
21#define XTENSA_CP_EXTRA_SIZE 0
22
23#else
24
25#define XTOFS(last_start,last_size,align) \
26 ((last_start+last_size+align-1) & -align)
27
28#define XTENSA_CP_EXTRA_OFFSET 0
29#define XTENSA_CP_EXTRA_ALIGN XCHAL_EXTRA_SA_ALIGN
30
31#define XTENSA_CPE_CP0_OFFSET \
32 XTOFS(XTENSA_CP_EXTRA_OFFSET, XCHAL_EXTRA_SA_SIZE, XCHAL_CP0_SA_ALIGN)
33#define XTENSA_CPE_CP1_OFFSET \
34 XTOFS(XTENSA_CPE_CP0_OFFSET, XCHAL_CP0_SA_SIZE, XCHAL_CP1_SA_ALIGN)
35#define XTENSA_CPE_CP2_OFFSET \
36 XTOFS(XTENSA_CPE_CP1_OFFSET, XCHAL_CP1_SA_SIZE, XCHAL_CP2_SA_ALIGN)
37#define XTENSA_CPE_CP3_OFFSET \
38 XTOFS(XTENSA_CPE_CP2_OFFSET, XCHAL_CP2_SA_SIZE, XCHAL_CP3_SA_ALIGN)
39#define XTENSA_CPE_CP4_OFFSET \
40 XTOFS(XTENSA_CPE_CP3_OFFSET, XCHAL_CP3_SA_SIZE, XCHAL_CP4_SA_ALIGN)
41#define XTENSA_CPE_CP5_OFFSET \
42 XTOFS(XTENSA_CPE_CP4_OFFSET, XCHAL_CP4_SA_SIZE, XCHAL_CP5_SA_ALIGN)
43#define XTENSA_CPE_CP6_OFFSET \
44 XTOFS(XTENSA_CPE_CP5_OFFSET, XCHAL_CP5_SA_SIZE, XCHAL_CP6_SA_ALIGN)
45#define XTENSA_CPE_CP7_OFFSET \
46 XTOFS(XTENSA_CPE_CP6_OFFSET, XCHAL_CP6_SA_SIZE, XCHAL_CP7_SA_ALIGN)
47#define XTENSA_CP_EXTRA_SIZE \
48 XTOFS(XTENSA_CPE_CP7_OFFSET, XCHAL_CP7_SA_SIZE, 16)
49
50#if XCHAL_CP_NUM > 0
51# ifndef __ASSEMBLY__
52/* 74/*
53 * Tasks that own contents of (last user) each coprocessor. 75 * XTENSA_HAVE_COPROCESSOR(x) returns 1 if coprocessor x is configured.
54 * Entries are 0 for not-owned or non-existent coprocessors. 76 *
55 * Note: The size of this structure is fixed to 8 bytes in entry.S 77 * XTENSA_HAVE_IO_PORT(x) returns 1 if io-port x is configured.
78 *
56 */ 79 */
57typedef struct {
58 struct task_struct *owner; /* owner */
59 int offset; /* offset in cpextra space. */
60} coprocessor_info_t;
61# else
62# define COPROCESSOR_INFO_OWNER 0
63# define COPROCESSOR_INFO_OFFSET 4
64# define COPROCESSOR_INFO_SIZE 8
65# endif
66#endif
67#endif /* XCHAL_HAVE_CP */
68 80
81#define XTENSA_HAVE_COPROCESSOR(x) \
82 ((XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK) & (1 << (x)))
83#define XTENSA_HAVE_COPROCESSORS \
84 (XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK)
85#define XTENSA_HAVE_IO_PORT(x) \
86 (XCHAL_CP_PORT_MASK & (1 << (x)))
87#define XTENSA_HAVE_IO_PORTS \
88 XCHAL_CP_PORT_MASK
69 89
70#ifndef __ASSEMBLY__ 90#ifndef __ASSEMBLY__
71# if XCHAL_CP_NUM > 0
72struct task_struct;
73extern void release_coprocessors (struct task_struct*);
74extern void save_coprocessor_registers(void*, int);
75# else
76# define release_coprocessors(task)
77# endif
78 91
79typedef unsigned char cp_state_t[XTENSA_CP_EXTRA_SIZE]
80 __attribute__ ((aligned (XTENSA_CP_EXTRA_ALIGN)));
81 92
82#endif /* !__ASSEMBLY__ */ 93#if XCHAL_HAVE_CP
94
95#define RSR_CPENABLE(x) do { \
96 __asm__ __volatile__("rsr %0," __stringify(CPENABLE) : "=a" (x)); \
97 } while(0);
98#define WSR_CPENABLE(x) do { \
99 __asm__ __volatile__("wsr %0," __stringify(CPENABLE) "; rsync" \
100 :: "a" (x)); \
101 } while(0);
83 102
103#endif /* XCHAL_HAVE_CP */
84 104
105
106/*
107 * Additional registers.
108 * We define three types of additional registers:
109 * ext: extra registers that are used by the compiler
110 * cpn: optional registers that can be used by a user application
111 * cpX: coprocessor registers that can only be used if the corresponding
112 * CPENABLE bit is set.
113 */
114
115#define XCHAL_SA_REG(list,cc,abi,type,y,name,z,align,size,...) \
116 __REG ## list (cc, abi, type, name, size, align)
117
118#define __REG0(cc,abi,t,name,s,a) __REG0_ ## cc (abi,name)
119#define __REG1(cc,abi,t,name,s,a) __REG1_ ## cc (name)
120#define __REG2(cc,abi,type,...) __REG2_ ## type (__VA_ARGS__)
121
122#define __REG0_0(abi,name)
123#define __REG0_1(abi,name) __REG0_1 ## abi (name)
124#define __REG0_10(name) __u32 name;
125#define __REG0_11(name) __u32 name;
126#define __REG0_12(name)
127
128#define __REG1_0(name) __u32 name;
129#define __REG1_1(name)
130
131#define __REG2_0(n,s,a) __u32 name;
132#define __REG2_1(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));
133#define __REG2_2(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));
134
135typedef struct { XCHAL_NCP_SA_LIST(0) } xtregs_opt_t
136 __attribute__ ((aligned (XCHAL_NCP_SA_ALIGN)));
137typedef struct { XCHAL_NCP_SA_LIST(1) } xtregs_user_t
138 __attribute__ ((aligned (XCHAL_NCP_SA_ALIGN)));
139
140#if XTENSA_HAVE_COPROCESSORS
141
142typedef struct { XCHAL_CP0_SA_LIST(2) } xtregs_cp0_t
143 __attribute__ ((aligned (XCHAL_CP0_SA_ALIGN)));
144typedef struct { XCHAL_CP1_SA_LIST(2) } xtregs_cp1_t
145 __attribute__ ((aligned (XCHAL_CP1_SA_ALIGN)));
146typedef struct { XCHAL_CP2_SA_LIST(2) } xtregs_cp2_t
147 __attribute__ ((aligned (XCHAL_CP2_SA_ALIGN)));
148typedef struct { XCHAL_CP3_SA_LIST(2) } xtregs_cp3_t
149 __attribute__ ((aligned (XCHAL_CP3_SA_ALIGN)));
150typedef struct { XCHAL_CP4_SA_LIST(2) } xtregs_cp4_t
151 __attribute__ ((aligned (XCHAL_CP4_SA_ALIGN)));
152typedef struct { XCHAL_CP5_SA_LIST(2) } xtregs_cp5_t
153 __attribute__ ((aligned (XCHAL_CP5_SA_ALIGN)));
154typedef struct { XCHAL_CP6_SA_LIST(2) } xtregs_cp6_t
155 __attribute__ ((aligned (XCHAL_CP6_SA_ALIGN)));
156typedef struct { XCHAL_CP7_SA_LIST(2) } xtregs_cp7_t
157 __attribute__ ((aligned (XCHAL_CP7_SA_ALIGN)));
158
159extern struct thread_info* coprocessor_owner[XCHAL_CP_MAX];
160extern void coprocessor_save(void*, int);
161extern void coprocessor_load(void*, int);
162extern void coprocessor_flush(struct thread_info*, int);
163extern void coprocessor_restore(struct thread_info*, int);
164
165extern void coprocessor_release_all(struct thread_info*);
166extern void coprocessor_flush_all(struct thread_info*);
167
168static inline void coprocessor_clear_cpenable(void)
169{
170 unsigned long i = 0;
171 WSR_CPENABLE(i);
172}
173
174#endif /* XTENSA_HAVE_COPROCESSORS */
175
176#endif /* !__ASSEMBLY__ */
85#endif /* _XTENSA_COPROCESSOR_H */ 177#endif /* _XTENSA_COPROCESSOR_H */
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h
index 467384542502..ca6e5101a2cb 100644
--- a/include/asm-xtensa/elf.h
+++ b/include/asm-xtensa/elf.h
@@ -72,115 +72,32 @@
72 72
73/* ELF register definitions. This is needed for core dump support. */ 73/* ELF register definitions. This is needed for core dump support. */
74 74
75/*
76 * elf_gregset_t contains the application-level state in the following order:
77 * Processor info: config_version, cpuxy
78 * Processor state: pc, ps, exccause, excvaddr, wb, ws,
79 * lbeg, lend, lcount, sar
80 * GP regs: ar0 - arXX
81 */
82
83typedef unsigned long elf_greg_t; 75typedef unsigned long elf_greg_t;
84 76
85typedef struct { 77typedef struct {
86 elf_greg_t xchal_config_id0;
87 elf_greg_t xchal_config_id1;
88 elf_greg_t cpux;
89 elf_greg_t cpuy;
90 elf_greg_t pc; 78 elf_greg_t pc;
91 elf_greg_t ps; 79 elf_greg_t ps;
92 elf_greg_t exccause;
93 elf_greg_t excvaddr;
94 elf_greg_t windowbase;
95 elf_greg_t windowstart;
96 elf_greg_t lbeg; 80 elf_greg_t lbeg;
97 elf_greg_t lend; 81 elf_greg_t lend;
98 elf_greg_t lcount; 82 elf_greg_t lcount;
99 elf_greg_t sar; 83 elf_greg_t sar;
100 elf_greg_t syscall; 84 elf_greg_t windowstart;
101 elf_greg_t ar[64]; 85 elf_greg_t windowbase;
86 elf_greg_t reserved[8+48];
87 elf_greg_t a[64];
102} xtensa_gregset_t; 88} xtensa_gregset_t;
103 89
104#define ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t)) 90#define ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(elf_greg_t))
105 91
106typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 92typedef elf_greg_t elf_gregset_t[ELF_NGREG];
107 93
108/* 94#define ELF_NFPREG 18
109 * Compute the size of the coprocessor and extra state layout (register info)
110 * table (in bytes).
111 * This is actually the maximum size of the table, as opposed to the size,
112 * which is available from the _xtensa_reginfo_table_size global variable.
113 *
114 * (See also arch/xtensa/kernel/coprocessor.S)
115 *
116 */
117
118#ifndef XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM
119# define XTENSA_CPE_LTABLE_SIZE 0
120#else
121# define XTENSA_CPE_SEGMENT(num) (num ? (1+num) : 0)
122# define XTENSA_CPE_LTABLE_ENTRIES \
123 ( XTENSA_CPE_SEGMENT(XCHAL_EXTRA_SA_CONTENTS_LIBDB_NUM) \
124 + XTENSA_CPE_SEGMENT(XCHAL_CP0_SA_CONTENTS_LIBDB_NUM) \
125 + XTENSA_CPE_SEGMENT(XCHAL_CP1_SA_CONTENTS_LIBDB_NUM) \
126 + XTENSA_CPE_SEGMENT(XCHAL_CP2_SA_CONTENTS_LIBDB_NUM) \
127 + XTENSA_CPE_SEGMENT(XCHAL_CP3_SA_CONTENTS_LIBDB_NUM) \
128 + XTENSA_CPE_SEGMENT(XCHAL_CP4_SA_CONTENTS_LIBDB_NUM) \
129 + XTENSA_CPE_SEGMENT(XCHAL_CP5_SA_CONTENTS_LIBDB_NUM) \
130 + XTENSA_CPE_SEGMENT(XCHAL_CP6_SA_CONTENTS_LIBDB_NUM) \
131 + XTENSA_CPE_SEGMENT(XCHAL_CP7_SA_CONTENTS_LIBDB_NUM) \
132 + 1 /* final entry */ \
133 )
134# define XTENSA_CPE_LTABLE_SIZE (XTENSA_CPE_LTABLE_ENTRIES * 8)
135#endif
136
137
138/*
139 * Instantiations of the elf_fpregset_t type contain, in most
140 * architectures, the floating point (FPU) register set.
141 * For Xtensa, this type is extended to contain all custom state,
142 * ie. coprocessor and "extra" (non-coprocessor) state (including,
143 * for example, TIE-defined states and register files; as well
144 * as other optional processor state).
145 * This includes FPU state if a floating-point coprocessor happens
146 * to have been configured within the Xtensa processor.
147 *
148 * TOTAL_FPREGS_SIZE is the required size (without rounding)
149 * of elf_fpregset_t. It provides space for the following:
150 *
151 * a) 32-bit mask of active coprocessors for this task (similar
152 * to CPENABLE in single-threaded Xtensa processor systems)
153 *
154 * b) table describing the layout of custom states (ie. of
155 * individual registers, etc) within the save areas
156 *
157 * c) save areas for each coprocessor and for non-coprocessor
158 * ("extra") state
159 *
160 * Note that save areas may require up to 16-byte alignment when
161 * accessed by save/restore sequences. We do not need to ensure
162 * such alignment in an elf_fpregset_t structure because custom
163 * state is not directly loaded/stored into it; rather, save area
164 * contents are copied to elf_fpregset_t from the active save areas
165 * (see 'struct task_struct' definition in processor.h for that)
166 * using memcpy(). But we do allow space for such alignment,
167 * to allow optimizations of layout and copying.
168 */
169#if 0
170#define TOTAL_FPREGS_SIZE \
171 (4 + XTENSA_CPE_LTABLE_SIZE + XTENSA_CP_EXTRA_SIZE)
172#define ELF_NFPREG \
173 ((TOTAL_FPREGS_SIZE + sizeof(elf_fpreg_t) - 1) / sizeof(elf_fpreg_t))
174#else
175#define TOTAL_FPREGS_SIZE 0
176#define ELF_NFPREG 0
177#endif
178 95
179typedef unsigned int elf_fpreg_t; 96typedef unsigned int elf_fpreg_t;
180typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; 97typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
181 98
182#define ELF_CORE_COPY_REGS(_eregs, _pregs) \ 99#define ELF_CORE_COPY_REGS(_eregs, _pregs) \
183 xtensa_elf_core_copy_regs (&_eregs, _pregs); 100 xtensa_elf_core_copy_regs ((xtensa_gregset_t*)&(_eregs), _pregs);
184 101
185extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *); 102extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *);
186 103
@@ -257,6 +174,21 @@ extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *);
257 _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \ 174 _r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \
258 } while (0) 175 } while (0)
259 176
177typedef struct {
178 xtregs_opt_t opt;
179 xtregs_user_t user;
180#if XTENSA_HAVE_COPROCESSORS
181 xtregs_cp0_t cp0;
182 xtregs_cp1_t cp1;
183 xtregs_cp2_t cp2;
184 xtregs_cp3_t cp3;
185 xtregs_cp4_t cp4;
186 xtregs_cp5_t cp5;
187 xtregs_cp6_t cp6;
188 xtregs_cp7_t cp7;
189#endif
190} elf_xtregs_t;
191
260#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 192#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
261 193
262struct task_struct; 194struct task_struct;
diff --git a/include/asm-xtensa/module.h b/include/asm-xtensa/module.h
index ffb25bfdf6a1..d9b34bee4d42 100644
--- a/include/asm-xtensa/module.h
+++ b/include/asm-xtensa/module.h
@@ -15,9 +15,11 @@
15 15
16struct mod_arch_specific 16struct mod_arch_specific
17{ 17{
18 /* Module support is not completely implemented. */ 18 /* No special elements, yet. */
19}; 19};
20 20
21#define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " "
22
21#define Elf_Shdr Elf32_Shdr 23#define Elf_Shdr Elf32_Shdr
22#define Elf_Sym Elf32_Sym 24#define Elf_Sym Elf32_Sym
23#define Elf_Ehdr Elf32_Ehdr 25#define Elf_Ehdr Elf32_Ehdr
diff --git a/include/asm-xtensa/pgalloc.h b/include/asm-xtensa/pgalloc.h
index 8d1544eb461e..4f4a7987eded 100644
--- a/include/asm-xtensa/pgalloc.h
+++ b/include/asm-xtensa/pgalloc.h
@@ -47,7 +47,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
47 return kmem_cache_alloc(pgtable_cache, GFP_KERNEL|__GFP_REPEAT); 47 return kmem_cache_alloc(pgtable_cache, GFP_KERNEL|__GFP_REPEAT);
48} 48}
49 49
50static inline pte_token_t pte_alloc_one(struct mm_struct *mm, 50static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
51 unsigned long addr) 51 unsigned long addr)
52{ 52{
53 struct page *page; 53 struct page *page;
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
index c0fcc1c9660c..c8b024a48b4d 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/include/asm-xtensa/pgtable.h
@@ -66,11 +66,9 @@
66 */ 66 */
67 67
68#define VMALLOC_START 0xC0000000 68#define VMALLOC_START 0xC0000000
69#define VMALLOC_END 0xC6FEFFFF 69#define VMALLOC_END 0xC7FEFFFF
70#define TLBTEMP_BASE_1 0xC6FF0000 70#define TLBTEMP_BASE_1 0xC7FF0000
71#define TLBTEMP_BASE_2 0xC6FF8000 71#define TLBTEMP_BASE_2 0xC7FF8000
72#define MODULE_START 0xC7000000
73#define MODULE_END 0xC7FFFFFF
74 72
75/* 73/*
76 * Xtensa Linux config PTE layout (when present): 74 * Xtensa Linux config PTE layout (when present):
diff --git a/include/asm-xtensa/processor.h b/include/asm-xtensa/processor.h
index 96408f436624..4918a4e96d42 100644
--- a/include/asm-xtensa/processor.h
+++ b/include/asm-xtensa/processor.h
@@ -103,10 +103,6 @@ struct thread_struct {
103 unsigned long dbreaka[XCHAL_NUM_DBREAK]; 103 unsigned long dbreaka[XCHAL_NUM_DBREAK];
104 unsigned long dbreakc[XCHAL_NUM_DBREAK]; 104 unsigned long dbreakc[XCHAL_NUM_DBREAK];
105 105
106 /* Allocate storage for extra state and coprocessor state. */
107 unsigned char cp_save[XTENSA_CP_EXTRA_SIZE]
108 __attribute__ ((aligned(XTENSA_CP_EXTRA_ALIGN)));
109
110 /* Make structure 16 bytes aligned. */ 106 /* Make structure 16 bytes aligned. */
111 int align[0] __attribute__ ((aligned(16))); 107 int align[0] __attribute__ ((aligned(16)));
112}; 108};
@@ -162,21 +158,16 @@ struct thread_struct {
162struct task_struct; 158struct task_struct;
163struct mm_struct; 159struct mm_struct;
164 160
165// FIXME: do we need release_thread for CP??
166/* Free all resources held by a thread. */ 161/* Free all resources held by a thread. */
167#define release_thread(thread) do { } while(0) 162#define release_thread(thread) do { } while(0)
168 163
169// FIXME: do we need prepare_to_copy (lazy status) for CP??
170/* Prepare to copy thread state - unlazy all lazy status */ 164/* Prepare to copy thread state - unlazy all lazy status */
171#define prepare_to_copy(tsk) do { } while (0) 165extern void prepare_to_copy(struct task_struct*);
172 166
173/* 167/* Create a kernel thread without removing it from tasklists */
174 * create a kernel thread without removing it from tasklists
175 */
176extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); 168extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
177 169
178/* Copy and release all segment info associated with a VM */ 170/* Copy and release all segment info associated with a VM */
179
180#define copy_segments(p, mm) do { } while(0) 171#define copy_segments(p, mm) do { } while(0)
181#define release_segments(mm) do { } while(0) 172#define release_segments(mm) do { } while(0)
182#define forget_segments() do { } while (0) 173#define forget_segments() do { } while (0)
diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h
index 77ff02d307bb..422c73e26937 100644
--- a/include/asm-xtensa/ptrace.h
+++ b/include/asm-xtensa/ptrace.h
@@ -53,33 +53,30 @@
53 53
54/* Registers used by strace */ 54/* Registers used by strace */
55 55
56#define REG_A_BASE 0xfc000000 56#define REG_A_BASE 0x0000
57#define REG_AR_BASE 0x04000000 57#define REG_AR_BASE 0x0100
58#define REG_PC 0x14000000 58#define REG_PC 0x0020
59#define REG_PS 0x080000e6 59#define REG_PS 0x02e6
60#define REG_WB 0x08000048 60#define REG_WB 0x0248
61#define REG_WS 0x08000049 61#define REG_WS 0x0249
62#define REG_LBEG 0x08000000 62#define REG_LBEG 0x0200
63#define REG_LEND 0x08000001 63#define REG_LEND 0x0201
64#define REG_LCOUNT 0x08000002 64#define REG_LCOUNT 0x0202
65#define REG_SAR 0x08000003 65#define REG_SAR 0x0203
66#define REG_DEPC 0x080000c0 66
67#define REG_EXCCAUSE 0x080000e8 67#define SYSCALL_NR 0x00ff
68#define REG_EXCVADDR 0x080000ee
69#define SYSCALL_NR 0x1
70
71#define AR_REGNO_TO_A_REGNO(ar, wb) (ar - wb*4) & ~(XCHAL_NUM_AREGS - 1)
72 68
73/* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */ 69/* Other PTRACE_ values defined in <linux/ptrace.h> using values 0-9,16,17,24 */
74 70
75#define PTRACE_GETREGS 12 71#define PTRACE_GETREGS 12
76#define PTRACE_SETREGS 13 72#define PTRACE_SETREGS 13
77#define PTRACE_GETFPREGS 14 73#define PTRACE_GETXTREGS 18
78#define PTRACE_SETFPREGS 15 74#define PTRACE_SETXTREGS 19
79#define PTRACE_GETFPREGSIZE 18
80 75
81#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
82 77
78#ifdef __KERNEL__
79
83/* 80/*
84 * This struct defines the way the registers are stored on the 81 * This struct defines the way the registers are stored on the
85 * kernel stack during a system call or other kernel entry. 82 * kernel stack during a system call or other kernel entry.
@@ -102,6 +99,9 @@ struct pt_regs {
102 unsigned long icountlevel; /* 60 */ 99 unsigned long icountlevel; /* 60 */
103 int reserved[1]; /* 64 */ 100 int reserved[1]; /* 64 */
104 101
102 /* Additional configurable registers that are used by the compiler. */
103 xtregs_opt_t xtregs_opt;
104
105 /* Make sure the areg field is 16 bytes aligned. */ 105 /* Make sure the areg field is 16 bytes aligned. */
106 int align[0] __attribute__ ((aligned(16))); 106 int align[0] __attribute__ ((aligned(16)));
107 107
@@ -111,8 +111,6 @@ struct pt_regs {
111 unsigned long areg[16]; /* 128 (64) */ 111 unsigned long areg[16]; /* 128 (64) */
112}; 112};
113 113
114#ifdef __KERNEL__
115
116#include <asm/variant/core.h> 114#include <asm/variant/core.h>
117 115
118# define task_pt_regs(tsk) ((struct pt_regs*) \ 116# define task_pt_regs(tsk) ((struct pt_regs*) \
diff --git a/include/asm-xtensa/regs.h b/include/asm-xtensa/regs.h
index c913d259faaa..d4baed246928 100644
--- a/include/asm-xtensa/regs.h
+++ b/include/asm-xtensa/regs.h
@@ -100,7 +100,14 @@
100#define EXCCAUSE_DTLB_SIZE_RESTRICTION 27 100#define EXCCAUSE_DTLB_SIZE_RESTRICTION 27
101#define EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28 101#define EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28
102#define EXCCAUSE_STORE_CACHE_ATTRIBUTE 29 102#define EXCCAUSE_STORE_CACHE_ATTRIBUTE 29
103#define EXCCAUSE_FLOATING_POINT 40 103#define EXCCAUSE_COPROCESSOR0_DISABLED 32
104#define EXCCAUSE_COPROCESSOR1_DISABLED 33
105#define EXCCAUSE_COPROCESSOR2_DISABLED 34
106#define EXCCAUSE_COPROCESSOR3_DISABLED 35
107#define EXCCAUSE_COPROCESSOR4_DISABLED 36
108#define EXCCAUSE_COPROCESSOR5_DISABLED 37
109#define EXCCAUSE_COPROCESSOR6_DISABLED 38
110#define EXCCAUSE_COPROCESSOR7_DISABLED 39
104 111
105/* PS register fields. */ 112/* PS register fields. */
106 113
diff --git a/include/asm-xtensa/sigcontext.h b/include/asm-xtensa/sigcontext.h
index e3381cee5059..03383af8c3b7 100644
--- a/include/asm-xtensa/sigcontext.h
+++ b/include/asm-xtensa/sigcontext.h
@@ -13,9 +13,6 @@
13 13
14 14
15struct sigcontext { 15struct sigcontext {
16 unsigned long oldmask;
17
18 /* CPU registers */
19 unsigned long sc_pc; 16 unsigned long sc_pc;
20 unsigned long sc_ps; 17 unsigned long sc_ps;
21 unsigned long sc_lbeg; 18 unsigned long sc_lbeg;
@@ -25,6 +22,7 @@ struct sigcontext {
25 unsigned long sc_acclo; 22 unsigned long sc_acclo;
26 unsigned long sc_acchi; 23 unsigned long sc_acchi;
27 unsigned long sc_a[16]; 24 unsigned long sc_a[16];
25 void *sc_xtregs;
28}; 26};
29 27
30#endif /* _XTENSA_SIGCONTEXT_H */ 28#endif /* _XTENSA_SIGCONTEXT_H */
diff --git a/include/asm-xtensa/stat.h b/include/asm-xtensa/stat.h
index 149f4bce092f..c4992038cee0 100644
--- a/include/asm-xtensa/stat.h
+++ b/include/asm-xtensa/stat.h
@@ -5,25 +5,23 @@
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) 2001 - 2005 Tensilica Inc. 8 * Copyright (C) 2001 - 2007 Tensilica Inc.
9 */ 9 */
10 10
11#ifndef _XTENSA_STAT_H 11#ifndef _XTENSA_STAT_H
12#define _XTENSA_STAT_H 12#define _XTENSA_STAT_H
13 13
14#include <linux/types.h>
15
16#define STAT_HAVE_NSEC 1 14#define STAT_HAVE_NSEC 1
17 15
18struct stat { 16struct stat {
19 unsigned long st_dev; 17 unsigned long st_dev;
20 ino_t st_ino; 18 unsigned long st_ino;
21 mode_t st_mode; 19 unsigned int st_mode;
22 nlink_t st_nlink; 20 unsigned int st_nlink;
23 uid_t st_uid; 21 unsigned int st_uid;
24 gid_t st_gid; 22 unsigned int st_gid;
25 unsigned int st_rdev; 23 unsigned long st_rdev;
26 off_t st_size; 24 long st_size;
27 unsigned long st_blksize; 25 unsigned long st_blksize;
28 unsigned long st_blocks; 26 unsigned long st_blocks;
29 unsigned long st_atime; 27 unsigned long st_atime;
@@ -36,8 +34,6 @@ struct stat {
36 unsigned long __unused5; 34 unsigned long __unused5;
37}; 35};
38 36
39/* This matches struct stat64 in glibc-2.3 */
40
41struct stat64 { 37struct stat64 {
42 unsigned long long st_dev; /* Device */ 38 unsigned long long st_dev; /* Device */
43 unsigned long long st_ino; /* File serial number */ 39 unsigned long long st_ino; /* File serial number */
@@ -47,20 +43,14 @@ struct stat64 {
47 unsigned int st_gid; /* Group ID of the file's group. */ 43 unsigned int st_gid; /* Group ID of the file's group. */
48 unsigned long long st_rdev; /* Device number, if device. */ 44 unsigned long long st_rdev; /* Device number, if device. */
49 long long st_size; /* Size of file, in bytes. */ 45 long long st_size; /* Size of file, in bytes. */
50 long st_blksize; /* Optimal block size for I/O. */ 46 unsigned long st_blksize; /* Optimal block size for I/O. */
51 unsigned long __unused2; 47 unsigned long __unused2;
52#ifdef __XTENSA_EB__ 48 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
53 unsigned long __unused3; 49 unsigned long st_atime; /* Time of last access. */
54 long st_blocks; /* Number 512-byte blocks allocated. */
55#else
56 long st_blocks; /* Number 512-byte blocks allocated. */
57 unsigned long __unused3;
58#endif
59 long st_atime; /* Time of last access. */
60 unsigned long st_atime_nsec; 50 unsigned long st_atime_nsec;
61 long st_mtime; /* Time of last modification. */ 51 unsigned long st_mtime; /* Time of last modification. */
62 unsigned long st_mtime_nsec; 52 unsigned long st_mtime_nsec;
63 long st_ctime; /* Time of last status change. */ 53 unsigned long st_ctime; /* Time of last status change. */
64 unsigned long st_ctime_nsec; 54 unsigned long st_ctime_nsec;
65 unsigned long __unused4; 55 unsigned long __unused4;
66 unsigned long __unused5; 56 unsigned long __unused5;
diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h
index e0cb9116d8ab..62b1e8f3c13c 100644
--- a/include/asm-xtensa/system.h
+++ b/include/asm-xtensa/system.h
@@ -46,42 +46,6 @@ static inline int irqs_disabled(void)
46 return flags & 0xf; 46 return flags & 0xf;
47} 47}
48 48
49#define RSR_CPENABLE(x) do { \
50 __asm__ __volatile__("rsr %0," __stringify(CPENABLE) : "=a" (x)); \
51 } while(0);
52#define WSR_CPENABLE(x) do { \
53 __asm__ __volatile__("wsr %0," __stringify(CPENABLE)";rsync" \
54 :: "a" (x));} while(0);
55
56#define clear_cpenable() __clear_cpenable()
57
58static inline void __clear_cpenable(void)
59{
60#if XCHAL_HAVE_CP
61 unsigned long i = 0;
62 WSR_CPENABLE(i);
63#endif
64}
65
66static inline void enable_coprocessor(int i)
67{
68#if XCHAL_HAVE_CP
69 int cp;
70 RSR_CPENABLE(cp);
71 cp |= 1 << i;
72 WSR_CPENABLE(cp);
73#endif
74}
75
76static inline void disable_coprocessor(int i)
77{
78#if XCHAL_HAVE_CP
79 int cp;
80 RSR_CPENABLE(cp);
81 cp &= ~(1 << i);
82 WSR_CPENABLE(cp);
83#endif
84}
85 49
86#define smp_read_barrier_depends() do { } while(0) 50#define smp_read_barrier_depends() do { } while(0)
87#define read_barrier_depends() do { } while(0) 51#define read_barrier_depends() do { } while(0)
@@ -111,7 +75,6 @@ extern void *_switch_to(void *last, void *next);
111 75
112#define switch_to(prev,next,last) \ 76#define switch_to(prev,next,last) \
113do { \ 77do { \
114 clear_cpenable(); \
115 (last) = _switch_to(prev, next); \ 78 (last) = _switch_to(prev, next); \
116} while(0) 79} while(0)
117 80
@@ -244,7 +207,7 @@ static inline void spill_registers(void)
244 "wsr a13," __stringify(SAR) "\n\t" 207 "wsr a13," __stringify(SAR) "\n\t"
245 "wsr a14," __stringify(PS) "\n\t" 208 "wsr a14," __stringify(PS) "\n\t"
246 :: "a" (&a0), "a" (&ps) 209 :: "a" (&a0), "a" (&ps)
247 : "a2", "a3", "a12", "a13", "a14", "a15", "memory"); 210 : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15", "memory");
248} 211}
249 212
250#define arch_align_stack(x) (x) 213#define arch_align_stack(x) (x)
diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h
index 52c958285bcb..a2c640682ed9 100644
--- a/include/asm-xtensa/thread_info.h
+++ b/include/asm-xtensa/thread_info.h
@@ -27,6 +27,21 @@
27 27
28#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
29 29
30#if XTENSA_HAVE_COPROCESSORS
31
32typedef struct xtregs_coprocessor {
33 xtregs_cp0_t cp0;
34 xtregs_cp1_t cp1;
35 xtregs_cp2_t cp2;
36 xtregs_cp3_t cp3;
37 xtregs_cp4_t cp4;
38 xtregs_cp5_t cp5;
39 xtregs_cp6_t cp6;
40 xtregs_cp7_t cp7;
41} xtregs_coprocessor_t;
42
43#endif
44
30struct thread_info { 45struct thread_info {
31 struct task_struct *task; /* main task structure */ 46 struct task_struct *task; /* main task structure */
32 struct exec_domain *exec_domain; /* execution domain */ 47 struct exec_domain *exec_domain; /* execution domain */
@@ -38,7 +53,13 @@ struct thread_info {
38 mm_segment_t addr_limit; /* thread address space */ 53 mm_segment_t addr_limit; /* thread address space */
39 struct restart_block restart_block; 54 struct restart_block restart_block;
40 55
56 unsigned long cpenable;
41 57
58 /* Allocate storage for extra user states and coprocessor states. */
59#if XTENSA_HAVE_COPROCESSORS
60 xtregs_coprocessor_t xtregs_cp;
61#endif
62 xtregs_user_t xtregs_user;
42}; 63};
43 64
44#else /* !__ASSEMBLY__ */ 65#else /* !__ASSEMBLY__ */
diff --git a/include/asm-xtensa/timex.h b/include/asm-xtensa/timex.h
index a5fca59fba9e..b83a8181d448 100644
--- a/include/asm-xtensa/timex.h
+++ b/include/asm-xtensa/timex.h
@@ -63,10 +63,10 @@ extern cycles_t cacheflush_time;
63 * Register access. 63 * Register access.
64 */ 64 */
65 65
66#define WSR_CCOUNT(r) __asm__("wsr %0,"__stringify(CCOUNT) :: "a" (r)) 66#define WSR_CCOUNT(r) asm volatile ("wsr %0,"__stringify(CCOUNT) :: "a" (r))
67#define RSR_CCOUNT(r) __asm__("rsr %0,"__stringify(CCOUNT) : "=a" (r)) 67#define RSR_CCOUNT(r) asm volatile ("rsr %0,"__stringify(CCOUNT) : "=a" (r))
68#define WSR_CCOMPARE(x,r) __asm__("wsr %0,"__stringify(CCOMPARE)"+"__stringify(x) :: "a"(r)) 68#define WSR_CCOMPARE(x,r) asm volatile ("wsr %0,"__stringify(CCOMPARE)"+"__stringify(x) :: "a"(r))
69#define RSR_CCOMPARE(x,r) __asm__("rsr %0,"__stringify(CCOMPARE)"+"__stringify(x) : "=a"(r)) 69#define RSR_CCOMPARE(x,r) asm volatile ("rsr %0,"__stringify(CCOMPARE)"+"__stringify(x) : "=a"(r))
70 70
71static inline unsigned long get_ccount (void) 71static inline unsigned long get_ccount (void)
72{ 72{
diff --git a/include/asm-xtensa/uaccess.h b/include/asm-xtensa/uaccess.h
index d6352da05b10..b8528426ab1f 100644
--- a/include/asm-xtensa/uaccess.h
+++ b/include/asm-xtensa/uaccess.h
@@ -26,6 +26,7 @@
26#include <asm/current.h> 26#include <asm/current.h>
27#include <asm/asm-offsets.h> 27#include <asm/asm-offsets.h>
28#include <asm/processor.h> 28#include <asm/processor.h>
29#include <asm/types.h>
29 30
30/* 31/*
31 * These assembly macros mirror the C macros that follow below. They 32 * These assembly macros mirror the C macros that follow below. They
@@ -118,7 +119,7 @@
118 * <at> destroyed (actually, (TASK_SIZE + 1 - size)) 119 * <at> destroyed (actually, (TASK_SIZE + 1 - size))
119 */ 120 */
120 .macro user_ok aa, as, at, error 121 .macro user_ok aa, as, at, error
121 movi \at, (TASK_SIZE+1) 122 movi \at, __XTENSA_UL_CONST(TASK_SIZE)
122 bgeu \as, \at, \error 123 bgeu \as, \at, \error
123 sub \at, \at, \as 124 sub \at, \at, \as
124 bgeu \aa, \at, \error 125 bgeu \aa, \at, \error
@@ -226,20 +227,21 @@ extern long __put_user_bad(void);
226 __pu_err; \ 227 __pu_err; \
227}) 228})
228 229
229#define __put_user_size(x,ptr,size,retval) \ 230#define __put_user_size(x,ptr,size,retval) \
230do { \ 231do { \
231 retval = 0; \ 232 int __cb; \
232 switch (size) { \ 233 retval = 0; \
233 case 1: __put_user_asm(x,ptr,retval,1,"s8i"); break; \ 234 switch (size) { \
234 case 2: __put_user_asm(x,ptr,retval,2,"s16i"); break; \ 235 case 1: __put_user_asm(x,ptr,retval,1,"s8i",__cb); break; \
235 case 4: __put_user_asm(x,ptr,retval,4,"s32i"); break; \ 236 case 2: __put_user_asm(x,ptr,retval,2,"s16i",__cb); break; \
236 case 8: { \ 237 case 4: __put_user_asm(x,ptr,retval,4,"s32i",__cb); break; \
237 __typeof__(*ptr) __v64 = x; \ 238 case 8: { \
238 retval = __copy_to_user(ptr,&__v64,8); \ 239 __typeof__(*ptr) __v64 = x; \
239 break; \ 240 retval = __copy_to_user(ptr,&__v64,8); \
240 } \ 241 break; \
241 default: __put_user_bad(); \ 242 } \
242 } \ 243 default: __put_user_bad(); \
244 } \
243} while (0) 245} while (0)
244 246
245 247
@@ -267,14 +269,14 @@ do { \
267#define __check_align_1 "" 269#define __check_align_1 ""
268 270
269#define __check_align_2 \ 271#define __check_align_2 \
270 " _bbci.l %2, 0, 1f \n" \ 272 " _bbci.l %3, 0, 1f \n" \
271 " movi %0, %3 \n" \ 273 " movi %0, %4 \n" \
272 " _j 2f \n" 274 " _j 2f \n"
273 275
274#define __check_align_4 \ 276#define __check_align_4 \
275 " _bbsi.l %2, 0, 0f \n" \ 277 " _bbsi.l %3, 0, 0f \n" \
276 " _bbci.l %2, 1, 1f \n" \ 278 " _bbci.l %3, 1, 1f \n" \
277 "0: movi %0, %3 \n" \ 279 "0: movi %0, %4 \n" \
278 " _j 2f \n" 280 " _j 2f \n"
279 281
280 282
@@ -286,24 +288,24 @@ do { \
286 * WARNING: If you modify this macro at all, verify that the 288 * WARNING: If you modify this macro at all, verify that the
287 * __check_align_* macros still work. 289 * __check_align_* macros still work.
288 */ 290 */
289#define __put_user_asm(x, addr, err, align, insn) \ 291#define __put_user_asm(x, addr, err, align, insn, cb) \
290 __asm__ __volatile__( \ 292 __asm__ __volatile__( \
291 __check_align_##align \ 293 __check_align_##align \
292 "1: "insn" %1, %2, 0 \n" \ 294 "1: "insn" %2, %3, 0 \n" \
293 "2: \n" \ 295 "2: \n" \
294 " .section .fixup,\"ax\" \n" \ 296 " .section .fixup,\"ax\" \n" \
295 " .align 4 \n" \ 297 " .align 4 \n" \
296 "4: \n" \ 298 "4: \n" \
297 " .long 2b \n" \ 299 " .long 2b \n" \
298 "5: \n" \ 300 "5: \n" \
299 " l32r %2, 4b \n" \ 301 " l32r %1, 4b \n" \
300 " movi %0, %3 \n" \ 302 " movi %0, %4 \n" \
301 " jx %2 \n" \ 303 " jx %1 \n" \
302 " .previous \n" \ 304 " .previous \n" \
303 " .section __ex_table,\"a\" \n" \ 305 " .section __ex_table,\"a\" \n" \
304 " .long 1b, 5b \n" \ 306 " .long 1b, 5b \n" \
305 " .previous" \ 307 " .previous" \
306 :"=r" (err) \ 308 :"=r" (err), "=r" (cb) \
307 :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err)) 309 :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err))
308 310
309#define __get_user_nocheck(x,ptr,size) \ 311#define __get_user_nocheck(x,ptr,size) \
@@ -328,11 +330,12 @@ extern long __get_user_bad(void);
328 330
329#define __get_user_size(x,ptr,size,retval) \ 331#define __get_user_size(x,ptr,size,retval) \
330do { \ 332do { \
333 int __cb; \
331 retval = 0; \ 334 retval = 0; \
332 switch (size) { \ 335 switch (size) { \
333 case 1: __get_user_asm(x,ptr,retval,1,"l8ui"); break; \ 336 case 1: __get_user_asm(x,ptr,retval,1,"l8ui",__cb); break; \
334 case 2: __get_user_asm(x,ptr,retval,2,"l16ui"); break; \ 337 case 2: __get_user_asm(x,ptr,retval,2,"l16ui",__cb); break; \
335 case 4: __get_user_asm(x,ptr,retval,4,"l32i"); break; \ 338 case 4: __get_user_asm(x,ptr,retval,4,"l32i",__cb); break; \
336 case 8: retval = __copy_from_user(&x,ptr,8); break; \ 339 case 8: retval = __copy_from_user(&x,ptr,8); break; \
337 default: (x) = __get_user_bad(); \ 340 default: (x) = __get_user_bad(); \
338 } \ 341 } \
@@ -343,25 +346,25 @@ do { \
343 * WARNING: If you modify this macro at all, verify that the 346 * WARNING: If you modify this macro at all, verify that the
344 * __check_align_* macros still work. 347 * __check_align_* macros still work.
345 */ 348 */
346#define __get_user_asm(x, addr, err, align, insn) \ 349#define __get_user_asm(x, addr, err, align, insn, cb) \
347 __asm__ __volatile__( \ 350 __asm__ __volatile__( \
348 __check_align_##align \ 351 __check_align_##align \
349 "1: "insn" %1, %2, 0 \n" \ 352 "1: "insn" %2, %3, 0 \n" \
350 "2: \n" \ 353 "2: \n" \
351 " .section .fixup,\"ax\" \n" \ 354 " .section .fixup,\"ax\" \n" \
352 " .align 4 \n" \ 355 " .align 4 \n" \
353 "4: \n" \ 356 "4: \n" \
354 " .long 2b \n" \ 357 " .long 2b \n" \
355 "5: \n" \ 358 "5: \n" \
356 " l32r %2, 4b \n" \ 359 " l32r %1, 4b \n" \
357 " movi %1, 0 \n" \ 360 " movi %2, 0 \n" \
358 " movi %0, %3 \n" \ 361 " movi %0, %4 \n" \
359 " jx %2 \n" \ 362 " jx %1 \n" \
360 " .previous \n" \ 363 " .previous \n" \
361 " .section __ex_table,\"a\" \n" \ 364 " .section __ex_table,\"a\" \n" \
362 " .long 1b, 5b \n" \ 365 " .long 1b, 5b \n" \
363 " .previous" \ 366 " .previous" \
364 :"=r" (err), "=r" (x) \ 367 :"=r" (err), "=r" (cb), "=r" (x) \
365 :"r" (addr), "i" (-EFAULT), "0" (err)) 368 :"r" (addr), "i" (-EFAULT), "0" (err))
366 369
367 370
diff --git a/include/asm-xtensa/variant-fsf/tie-asm.h b/include/asm-xtensa/variant-fsf/tie-asm.h
new file mode 100644
index 000000000000..68a73bf4ffc5
--- /dev/null
+++ b/include/asm-xtensa/variant-fsf/tie-asm.h
@@ -0,0 +1,70 @@
1/*
2 * This header file contains assembly-language definitions (assembly
3 * macros, etc.) for this specific Xtensa processor's TIE extensions
4 * and options. It is customized to this Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2008 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_ASM_H
14#define _XTENSA_CORE_TIE_ASM_H
15
16/* Selection parameter values for save-area save/restore macros: */
17/* Option vs. TIE: */
18#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */
19#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */
20/* Whether used automatically by compiler: */
21#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */
22#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */
23/* ABI handling across function calls: */
24#define XTHAL_SAS_CALR 0x0010 /* caller-saved */
25#define XTHAL_SAS_CALE 0x0020 /* callee-saved */
26#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */
27/* Misc */
28#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */
29
30
31
32/* Macro to save all non-coprocessor (extra) custom TIE and optional state
33 * (not including zero-overhead loop registers).
34 * Save area ptr (clobbered): ptr (1 byte aligned)
35 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
36 */
37 .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
38 xchal_sa_start \continue, \ofs
39 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
40 xchal_sa_align \ptr, 0, 1024-4, 4, 4
41 rur \at1, THREADPTR // threadptr option
42 s32i \at1, \ptr, .Lxchal_ofs_ + 0
43 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
44 .endif
45 .endm // xchal_ncp_store
46
47/* Macro to save all non-coprocessor (extra) custom TIE and optional state
48 * (not including zero-overhead loop registers).
49 * Save area ptr (clobbered): ptr (1 byte aligned)
50 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
51 */
52 .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
53 xchal_sa_start \continue, \ofs
54 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
55 xchal_sa_align \ptr, 0, 1024-4, 4, 4
56 l32i \at1, \ptr, .Lxchal_ofs_ + 0
57 wur \at1, THREADPTR // threadptr option
58 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
59 .endif
60 .endm // xchal_ncp_load
61
62
63
64#define XCHAL_NCP_NUM_ATMPS 1
65
66
67#define XCHAL_SA_NUM_ATMPS 1
68
69#endif /*_XTENSA_CORE_TIE_ASM_H*/
70
diff --git a/include/asm-xtensa/variant-fsf/tie.h b/include/asm-xtensa/variant-fsf/tie.h
index a73c71664918..bf4020116df5 100644
--- a/include/asm-xtensa/variant-fsf/tie.h
+++ b/include/asm-xtensa/variant-fsf/tie.h
@@ -1,22 +1,77 @@
1/* 1/*
2 * Xtensa processor core configuration information. 2 * This header file describes this specific Xtensa processor's TIE extensions
3 * that extend basic Xtensa core functionality. It is customized to this
4 * Xtensa processor configuration.
3 * 5 *
4 * This file is subject to the terms and conditions of the GNU General Public 6 * 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 7 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 8 * for more details.
7 * 9 *
8 * Copyright (C) 1999-2006 Tensilica Inc. 10 * Copyright (C) 1999-2007 Tensilica Inc.
9 */ 11 */
10 12
11#ifndef XTENSA_TIE_H 13#ifndef _XTENSA_CORE_TIE_H
12#define XTENSA_TIE_H 14#define _XTENSA_CORE_TIE_H
13
14/*----------------------------------------------------------------------
15 COPROCESSORS and EXTRA STATE
16 ----------------------------------------------------------------------*/
17 15
18#define XCHAL_CP_NUM 0 /* number of coprocessors */ 16#define XCHAL_CP_NUM 0 /* number of coprocessors */
19#define XCHAL_CP_MASK 0x00 17#define XCHAL_CP_MAX 0 /* max CP ID + 1 (0 if none) */
18#define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */
19#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */
20
21/* Basic parameters of each coprocessor: */
22#define XCHAL_CP7_NAME "XTIOP"
23#define XCHAL_CP7_IDENT XTIOP
24#define XCHAL_CP7_SA_SIZE 0 /* size of state save area */
25#define XCHAL_CP7_SA_ALIGN 1 /* min alignment of save area */
26#define XCHAL_CP_ID_XTIOP 7 /* coprocessor ID (0..7) */
27
28/* Filler info for unassigned coprocessors, to simplify arrays etc: */
29#define XCHAL_NCP_SA_SIZE 0
30#define XCHAL_NCP_SA_ALIGN 1
31#define XCHAL_CP0_SA_SIZE 0
32#define XCHAL_CP0_SA_ALIGN 1
33#define XCHAL_CP1_SA_SIZE 0
34#define XCHAL_CP1_SA_ALIGN 1
35#define XCHAL_CP2_SA_SIZE 0
36#define XCHAL_CP2_SA_ALIGN 1
37#define XCHAL_CP3_SA_SIZE 0
38#define XCHAL_CP3_SA_ALIGN 1
39#define XCHAL_CP4_SA_SIZE 0
40#define XCHAL_CP4_SA_ALIGN 1
41#define XCHAL_CP5_SA_SIZE 0
42#define XCHAL_CP5_SA_ALIGN 1
43#define XCHAL_CP6_SA_SIZE 0
44#define XCHAL_CP6_SA_ALIGN 1
45
46/* Save area for non-coprocessor optional and custom (TIE) state: */
47#define XCHAL_NCP_SA_SIZE 0
48#define XCHAL_NCP_SA_ALIGN 1
49
50/* Total save area for optional and custom state (NCP + CPn): */
51#define XCHAL_TOTAL_SA_SIZE 0 /* with 16-byte align padding */
52#define XCHAL_TOTAL_SA_ALIGN 1 /* actual minimum alignment */
53
54#define XCHAL_NCP_SA_NUM 0
55#define XCHAL_NCP_SA_LIST(s)
56#define XCHAL_CP0_SA_NUM 0
57#define XCHAL_CP0_SA_LIST(s)
58#define XCHAL_CP1_SA_NUM 0
59#define XCHAL_CP1_SA_LIST(s)
60#define XCHAL_CP2_SA_NUM 0
61#define XCHAL_CP2_SA_LIST(s)
62#define XCHAL_CP3_SA_NUM 0
63#define XCHAL_CP3_SA_LIST(s)
64#define XCHAL_CP4_SA_NUM 0
65#define XCHAL_CP4_SA_LIST(s)
66#define XCHAL_CP5_SA_NUM 0
67#define XCHAL_CP5_SA_LIST(s)
68#define XCHAL_CP6_SA_NUM 0
69#define XCHAL_CP6_SA_LIST(s)
70#define XCHAL_CP7_SA_NUM 0
71#define XCHAL_CP7_SA_LIST(s)
72
73/* Byte length of instruction from its first nibble (op0 field), per FLIX. */
74#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3
20 75
21#endif /*XTENSA_CONFIG_TIE_H*/ 76#endif /*_XTENSA_CORE_TIE_H*/
22 77
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 5cae9b5960ea..aada32fffec2 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -70,7 +70,6 @@ header-y += fuse.h
70header-y += genetlink.h 70header-y += genetlink.h
71header-y += gen_stats.h 71header-y += gen_stats.h
72header-y += gigaset_dev.h 72header-y += gigaset_dev.h
73header-y += hdsmart.h
74header-y += hysdn_if.h 73header-y += hysdn_if.h
75header-y += i2o-dev.h 74header-y += i2o-dev.h
76header-y += i8k.h 75header-y += i8k.h
@@ -211,6 +210,7 @@ unifdef-y += hayesesp.h
211unifdef-y += hdlcdrv.h 210unifdef-y += hdlcdrv.h
212unifdef-y += hdlc.h 211unifdef-y += hdlc.h
213unifdef-y += hdreg.h 212unifdef-y += hdreg.h
213unifdef-y += hdsmart.h
214unifdef-y += hiddev.h 214unifdef-y += hiddev.h
215unifdef-y += hpet.h 215unifdef-y += hpet.h
216unifdef-y += i2c.h 216unifdef-y += i2c.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ddbe7efe590e..2c7e003356ac 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -203,6 +203,7 @@ extern bool wmi_has_guid(const char *guid);
203extern int acpi_blacklisted(void); 203extern int acpi_blacklisted(void);
204#ifdef CONFIG_DMI 204#ifdef CONFIG_DMI
205extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); 205extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
206extern int acpi_osi_setup(char *str);
206#endif 207#endif
207 208
208#ifdef CONFIG_ACPI_NUMA 209#ifdef CONFIG_ACPI_NUMA
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 7ef8de662001..0d0b7f629bd3 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -105,7 +105,6 @@ struct kiocb {
105 wait_queue_t ki_wait; 105 wait_queue_t ki_wait;
106 loff_t ki_pos; 106 loff_t ki_pos;
107 107
108 atomic_t ki_bio_count; /* num bio used for this iocb */
109 void *private; 108 void *private;
110 /* State that we remember to be able to restart/retry */ 109 /* State that we remember to be able to restart/retry */
111 unsigned short ki_opcode; 110 unsigned short ki_opcode;
@@ -206,21 +205,21 @@ struct kioctx {
206/* prototypes */ 205/* prototypes */
207extern unsigned aio_max_size; 206extern unsigned aio_max_size;
208 207
209extern ssize_t FASTCALL(wait_on_sync_kiocb(struct kiocb *iocb)); 208extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
210extern int FASTCALL(aio_put_req(struct kiocb *iocb)); 209extern int aio_put_req(struct kiocb *iocb);
211extern void FASTCALL(kick_iocb(struct kiocb *iocb)); 210extern void kick_iocb(struct kiocb *iocb);
212extern int FASTCALL(aio_complete(struct kiocb *iocb, long res, long res2)); 211extern int aio_complete(struct kiocb *iocb, long res, long res2);
213extern void FASTCALL(__put_ioctx(struct kioctx *ctx)); 212extern void __put_ioctx(struct kioctx *ctx);
214struct mm_struct; 213struct mm_struct;
215extern void FASTCALL(exit_aio(struct mm_struct *mm)); 214extern void exit_aio(struct mm_struct *mm);
216extern struct kioctx *lookup_ioctx(unsigned long ctx_id); 215extern struct kioctx *lookup_ioctx(unsigned long ctx_id);
217extern int FASTCALL(io_submit_one(struct kioctx *ctx, 216extern int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
218 struct iocb __user *user_iocb, struct iocb *iocb)); 217 struct iocb *iocb);
219 218
220/* semi private, but used by the 32bit emulations: */ 219/* semi private, but used by the 32bit emulations: */
221struct kioctx *lookup_ioctx(unsigned long ctx_id); 220struct kioctx *lookup_ioctx(unsigned long ctx_id);
222int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, 221int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
223 struct iocb *iocb)); 222 struct iocb *iocb);
224 223
225#define get_ioctx(kioctx) do { \ 224#define get_ioctx(kioctx) do { \
226 BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ 225 BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 97153027207a..2af9ec025015 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -534,8 +534,7 @@ extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
534 const char *string); 534 const char *string);
535extern void audit_log_d_path(struct audit_buffer *ab, 535extern void audit_log_d_path(struct audit_buffer *ab,
536 const char *prefix, 536 const char *prefix,
537 struct dentry *dentry, 537 struct path *path);
538 struct vfsmount *vfsmnt);
539extern void audit_log_lost(const char *message); 538extern void audit_log_lost(const char *message);
540 /* Private API (for audit.c only) */ 539 /* Private API (for audit.c only) */
541extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 540extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
@@ -552,7 +551,7 @@ extern int audit_enabled;
552#define audit_log_hex(a,b,l) do { ; } while (0) 551#define audit_log_hex(a,b,l) do { ; } while (0)
553#define audit_log_untrustedstring(a,s) do { ; } while (0) 552#define audit_log_untrustedstring(a,s) do { ; } while (0)
554#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0) 553#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0)
555#define audit_log_d_path(b,p,d,v) do { ; } while (0) 554#define audit_log_d_path(b, p, d) do { ; } while (0)
556#define audit_enabled 0 555#define audit_enabled 0
557#endif 556#endif
558#endif 557#endif
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4da441337d6e..4c59bdccd3ee 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -326,7 +326,6 @@ extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
326 gfp_t); 326 gfp_t);
327extern void bio_set_pages_dirty(struct bio *bio); 327extern void bio_set_pages_dirty(struct bio *bio);
328extern void bio_check_pages_dirty(struct bio *bio); 328extern void bio_check_pages_dirty(struct bio *bio);
329extern void bio_release_pages(struct bio *bio);
330extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); 329extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
331extern int bio_uncopy_user(struct bio *); 330extern int bio_uncopy_user(struct bio *);
332void zero_fill_bio(struct bio *bio); 331void zero_fill_bio(struct bio *bio);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e1888cc5b8ae..6fe67d1939c2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -216,6 +216,7 @@ struct request {
216 unsigned int cmd_len; 216 unsigned int cmd_len;
217 unsigned char cmd[BLK_MAX_CDB]; 217 unsigned char cmd[BLK_MAX_CDB];
218 218
219 unsigned int raw_data_len;
219 unsigned int data_len; 220 unsigned int data_len;
220 unsigned int sense_len; 221 unsigned int sense_len;
221 void *data; 222 void *data;
@@ -258,6 +259,7 @@ struct bio_vec;
258typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); 259typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *);
259typedef void (prepare_flush_fn) (struct request_queue *, struct request *); 260typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
260typedef void (softirq_done_fn)(struct request *); 261typedef void (softirq_done_fn)(struct request *);
262typedef int (dma_drain_needed_fn)(struct request *);
261 263
262enum blk_queue_state { 264enum blk_queue_state {
263 Queue_down, 265 Queue_down,
@@ -294,6 +296,7 @@ struct request_queue
294 merge_bvec_fn *merge_bvec_fn; 296 merge_bvec_fn *merge_bvec_fn;
295 prepare_flush_fn *prepare_flush_fn; 297 prepare_flush_fn *prepare_flush_fn;
296 softirq_done_fn *softirq_done_fn; 298 softirq_done_fn *softirq_done_fn;
299 dma_drain_needed_fn *dma_drain_needed;
297 300
298 /* 301 /*
299 * Dispatch queue sorting 302 * Dispatch queue sorting
@@ -698,8 +701,9 @@ extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
698extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 701extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
699extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); 702extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
700extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 703extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
701extern int blk_queue_dma_drain(struct request_queue *q, void *buf, 704extern int blk_queue_dma_drain(struct request_queue *q,
702 unsigned int size); 705 dma_drain_needed_fn *dma_drain_needed,
706 void *buf, unsigned int size);
703extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 707extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
704extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 708extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
705extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 709extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index e98801f06dcc..932eb02a2753 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -144,7 +144,7 @@ BUFFER_FNS(Unwritten, unwritten)
144 * Declarations 144 * Declarations
145 */ 145 */
146 146
147void FASTCALL(mark_buffer_dirty(struct buffer_head *bh)); 147void mark_buffer_dirty(struct buffer_head *bh);
148void init_buffer(struct buffer_head *, bh_end_io_t *, void *); 148void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
149void set_bh_page(struct buffer_head *bh, 149void set_bh_page(struct buffer_head *bh,
150 struct page *page, unsigned long offset); 150 struct page *page, unsigned long offset);
@@ -185,8 +185,8 @@ struct buffer_head *__bread(struct block_device *, sector_t block, unsigned size
185void invalidate_bh_lrus(void); 185void invalidate_bh_lrus(void);
186struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); 186struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
187void free_buffer_head(struct buffer_head * bh); 187void free_buffer_head(struct buffer_head * bh);
188void FASTCALL(unlock_buffer(struct buffer_head *bh)); 188void unlock_buffer(struct buffer_head *bh);
189void FASTCALL(__lock_buffer(struct buffer_head *bh)); 189void __lock_buffer(struct buffer_head *bh);
190void ll_rw_block(int, int, struct buffer_head * bh[]); 190void ll_rw_block(int, int, struct buffer_head * bh[]);
191int sync_dirty_buffer(struct buffer_head *bh); 191int sync_dirty_buffer(struct buffer_head *bh);
192int submit_bh(int, struct buffer_head *); 192int submit_bh(int, struct buffer_head *);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index ff9055fc3d2a..028ba3b523b1 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -175,7 +175,7 @@ struct css_set {
175 * 175 *
176 * 176 *
177 * When reading/writing to a file: 177 * When reading/writing to a file:
178 * - the cgroup to use in file->f_dentry->d_parent->d_fsdata 178 * - the cgroup to use is file->f_dentry->d_parent->d_fsdata
179 * - the 'cftype' of the file is file->f_dentry->d_fsdata 179 * - the 'cftype' of the file is file->f_dentry->d_fsdata
180 */ 180 */
181 181
@@ -186,15 +186,15 @@ struct cftype {
186 char name[MAX_CFTYPE_NAME]; 186 char name[MAX_CFTYPE_NAME];
187 int private; 187 int private;
188 int (*open) (struct inode *inode, struct file *file); 188 int (*open) (struct inode *inode, struct file *file);
189 ssize_t (*read) (struct cgroup *cont, struct cftype *cft, 189 ssize_t (*read) (struct cgroup *cgrp, struct cftype *cft,
190 struct file *file, 190 struct file *file,
191 char __user *buf, size_t nbytes, loff_t *ppos); 191 char __user *buf, size_t nbytes, loff_t *ppos);
192 /* 192 /*
193 * read_uint() is a shortcut for the common case of returning a 193 * read_uint() is a shortcut for the common case of returning a
194 * single integer. Use it in place of read() 194 * single integer. Use it in place of read()
195 */ 195 */
196 u64 (*read_uint) (struct cgroup *cont, struct cftype *cft); 196 u64 (*read_uint) (struct cgroup *cgrp, struct cftype *cft);
197 ssize_t (*write) (struct cgroup *cont, struct cftype *cft, 197 ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft,
198 struct file *file, 198 struct file *file,
199 const char __user *buf, size_t nbytes, loff_t *ppos); 199 const char __user *buf, size_t nbytes, loff_t *ppos);
200 200
@@ -203,7 +203,7 @@ struct cftype {
203 * a single integer (as parsed by simple_strtoull) from 203 * a single integer (as parsed by simple_strtoull) from
204 * userspace. Use in place of write(); return 0 or error. 204 * userspace. Use in place of write(); return 0 or error.
205 */ 205 */
206 int (*write_uint) (struct cgroup *cont, struct cftype *cft, u64 val); 206 int (*write_uint) (struct cgroup *cgrp, struct cftype *cft, u64 val);
207 207
208 int (*release) (struct inode *inode, struct file *file); 208 int (*release) (struct inode *inode, struct file *file);
209}; 209};
@@ -218,41 +218,41 @@ struct cgroup_scanner {
218 218
219/* Add a new file to the given cgroup directory. Should only be 219/* Add a new file to the given cgroup directory. Should only be
220 * called by subsystems from within a populate() method */ 220 * called by subsystems from within a populate() method */
221int cgroup_add_file(struct cgroup *cont, struct cgroup_subsys *subsys, 221int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
222 const struct cftype *cft); 222 const struct cftype *cft);
223 223
224/* Add a set of new files to the given cgroup directory. Should 224/* Add a set of new files to the given cgroup directory. Should
225 * only be called by subsystems from within a populate() method */ 225 * only be called by subsystems from within a populate() method */
226int cgroup_add_files(struct cgroup *cont, 226int cgroup_add_files(struct cgroup *cgrp,
227 struct cgroup_subsys *subsys, 227 struct cgroup_subsys *subsys,
228 const struct cftype cft[], 228 const struct cftype cft[],
229 int count); 229 int count);
230 230
231int cgroup_is_removed(const struct cgroup *cont); 231int cgroup_is_removed(const struct cgroup *cgrp);
232 232
233int cgroup_path(const struct cgroup *cont, char *buf, int buflen); 233int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
234 234
235int cgroup_task_count(const struct cgroup *cont); 235int cgroup_task_count(const struct cgroup *cgrp);
236 236
237/* Return true if the cgroup is a descendant of the current cgroup */ 237/* Return true if the cgroup is a descendant of the current cgroup */
238int cgroup_is_descendant(const struct cgroup *cont); 238int cgroup_is_descendant(const struct cgroup *cgrp);
239 239
240/* Control Group subsystem type. See Documentation/cgroups.txt for details */ 240/* Control Group subsystem type. See Documentation/cgroups.txt for details */
241 241
242struct cgroup_subsys { 242struct cgroup_subsys {
243 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, 243 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
244 struct cgroup *cont); 244 struct cgroup *cgrp);
245 void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cont); 245 void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
246 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont); 246 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
247 int (*can_attach)(struct cgroup_subsys *ss, 247 int (*can_attach)(struct cgroup_subsys *ss,
248 struct cgroup *cont, struct task_struct *tsk); 248 struct cgroup *cgrp, struct task_struct *tsk);
249 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cont, 249 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
250 struct cgroup *old_cont, struct task_struct *tsk); 250 struct cgroup *old_cgrp, struct task_struct *tsk);
251 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 251 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
252 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); 252 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task);
253 int (*populate)(struct cgroup_subsys *ss, 253 int (*populate)(struct cgroup_subsys *ss,
254 struct cgroup *cont); 254 struct cgroup *cgrp);
255 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cont); 255 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
256 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); 256 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
257 int subsys_id; 257 int subsys_id;
258 int active; 258 int active;
@@ -273,9 +273,9 @@ struct cgroup_subsys {
273#undef SUBSYS 273#undef SUBSYS
274 274
275static inline struct cgroup_subsys_state *cgroup_subsys_state( 275static inline struct cgroup_subsys_state *cgroup_subsys_state(
276 struct cgroup *cont, int subsys_id) 276 struct cgroup *cgrp, int subsys_id)
277{ 277{
278 return cont->subsys[subsys_id]; 278 return cgrp->subsys[subsys_id];
279} 279}
280 280
281static inline struct cgroup_subsys_state *task_subsys_state( 281static inline struct cgroup_subsys_state *task_subsys_state(
@@ -290,8 +290,6 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
290 return task_subsys_state(task, subsys_id)->cgroup; 290 return task_subsys_state(task, subsys_id)->cgroup;
291} 291}
292 292
293int cgroup_path(const struct cgroup *cont, char *buf, int buflen);
294
295int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss); 293int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss);
296 294
297/* A cgroup_iter should be treated as an opaque object */ 295/* A cgroup_iter should be treated as an opaque object */
@@ -313,10 +311,10 @@ struct cgroup_iter {
313 * - cgroup_scan_tasks() holds the css_set_lock when calling the test_task() 311 * - cgroup_scan_tasks() holds the css_set_lock when calling the test_task()
314 * callback, but not while calling the process_task() callback. 312 * callback, but not while calling the process_task() callback.
315 */ 313 */
316void cgroup_iter_start(struct cgroup *cont, struct cgroup_iter *it); 314void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
317struct task_struct *cgroup_iter_next(struct cgroup *cont, 315struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
318 struct cgroup_iter *it); 316 struct cgroup_iter *it);
319void cgroup_iter_end(struct cgroup *cont, struct cgroup_iter *it); 317void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
320int cgroup_scan_tasks(struct cgroup_scanner *scan); 318int cgroup_scan_tasks(struct cgroup_scanner *scan);
321int cgroup_attach_task(struct cgroup *, struct task_struct *); 319int cgroup_attach_task(struct cgroup *, struct task_struct *);
322 320
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 228235c5ae53..ac6aad98b607 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -25,7 +25,7 @@ SUBSYS(ns)
25 25
26/* */ 26/* */
27 27
28#ifdef CONFIG_FAIR_CGROUP_SCHED 28#ifdef CONFIG_CGROUP_SCHED
29SUBSYS(cpu_cgroup) 29SUBSYS(cpu_cgroup)
30#endif 30#endif
31 31
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 8c6967f3fb11..4b287ad9371a 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -37,6 +37,7 @@
37 37
38#ifdef __KERNEL__ 38#ifdef __KERNEL__
39 39
40#include <linux/kernel.h>
40#include <linux/types.h> 41#include <linux/types.h>
41#include <linux/list.h> 42#include <linux/list.h>
42#include <linux/kref.h> 43#include <linux/kref.h>
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 385d45b616db..6b72a4584086 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -19,6 +19,7 @@
19 19
20#define CPUIDLE_STATE_MAX 8 20#define CPUIDLE_STATE_MAX 8
21#define CPUIDLE_NAME_LEN 16 21#define CPUIDLE_NAME_LEN 16
22#define CPUIDLE_DESC_LEN 32
22 23
23struct cpuidle_device; 24struct cpuidle_device;
24 25
@@ -29,6 +30,7 @@ struct cpuidle_device;
29 30
30struct cpuidle_state { 31struct cpuidle_state {
31 char name[CPUIDLE_NAME_LEN]; 32 char name[CPUIDLE_NAME_LEN];
33 char desc[CPUIDLE_DESC_LEN];
32 void *driver_data; 34 void *driver_data;
33 35
34 unsigned int flags; 36 unsigned int flags;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index c2c153f97e8f..6bd646096fa6 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -10,6 +10,7 @@
10#include <linux/rcupdate.h> 10#include <linux/rcupdate.h>
11 11
12struct nameidata; 12struct nameidata;
13struct path;
13struct vfsmount; 14struct vfsmount;
14 15
15/* 16/*
@@ -300,8 +301,8 @@ extern int d_validate(struct dentry *, struct dentry *);
300 */ 301 */
301extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 302extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
302 303
303extern char * d_path(struct dentry *, struct vfsmount *, char *, int); 304extern char *d_path(struct path *, char *, int);
304 305
305/* Allocation counts.. */ 306/* Allocation counts.. */
306 307
307/** 308/**
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h
index 98c69ab80c84..24c806f12a6c 100644
--- a/include/linux/dcookies.h
+++ b/include/linux/dcookies.h
@@ -13,6 +13,7 @@
13#ifdef CONFIG_PROFILING 13#ifdef CONFIG_PROFILING
14 14
15#include <linux/dcache.h> 15#include <linux/dcache.h>
16#include <linux/path.h>
16#include <linux/types.h> 17#include <linux/types.h>
17 18
18struct dcookie_user; 19struct dcookie_user;
@@ -43,8 +44,7 @@ void dcookie_unregister(struct dcookie_user * user);
43 * 44 *
44 * Returns 0 on success, with *cookie filled in 45 * Returns 0 on success, with *cookie filled in
45 */ 46 */
46int get_dcookie(struct dentry * dentry, struct vfsmount * vfsmnt, 47int get_dcookie(struct path *path, unsigned long *cookie);
47 unsigned long * cookie);
48 48
49#else 49#else
50 50
@@ -57,13 +57,12 @@ static inline void dcookie_unregister(struct dcookie_user * user)
57{ 57{
58 return; 58 return;
59} 59}
60 60
61static inline int get_dcookie(struct dentry * dentry, 61static inline int get_dcookie(struct path *path, unsigned long *cookie)
62 struct vfsmount * vfsmnt, unsigned long * cookie)
63{ 62{
64 return -ENOSYS; 63 return -ENOSYS;
65} 64}
66 65
67#endif /* CONFIG_PROFILING */ 66#endif /* CONFIG_PROFILING */
68 67
69#endif /* DCOOKIES_H */ 68#endif /* DCOOKIES_H */
diff --git a/include/linux/efs_dir.h b/include/linux/efs_dir.h
deleted file mode 100644
index a09ec010569c..000000000000
--- a/include/linux/efs_dir.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * efs_dir.h
3 *
4 * Copyright (c) 1999 Al Smith
5 */
6
7#ifndef __EFS_DIR_H__
8#define __EFS_DIR_H__
9
10#define EFS_DIRBSIZE_BITS EFS_BLOCKSIZE_BITS
11#define EFS_DIRBSIZE (1 << EFS_DIRBSIZE_BITS)
12
13struct efs_dentry {
14 __be32 inode;
15 unsigned char namelen;
16 char name[3];
17};
18
19#define EFS_DENTSIZE (sizeof(struct efs_dentry) - 3 + 1)
20#define EFS_MAXNAMELEN ((1 << (sizeof(char) * 8)) - 1)
21
22#define EFS_DIRBLK_HEADERSIZE 4
23#define EFS_DIRBLK_MAGIC 0xbeef /* moo */
24
25struct efs_dir {
26 __be16 magic;
27 unsigned char firstused;
28 unsigned char slots;
29
30 unsigned char space[EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE];
31};
32
33#define EFS_MAXENTS \
34 ((EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE) / \
35 (EFS_DENTSIZE + sizeof(char)))
36
37#define EFS_SLOTAT(dir, slot) EFS_REALOFF((dir)->space[slot])
38
39#define EFS_REALOFF(offset) ((offset << 1))
40
41#endif /* __EFS_DIR_H__ */
42
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
deleted file mode 100644
index a695d63a07af..000000000000
--- a/include/linux/efs_fs.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * efs_fs.h
3 *
4 * Copyright (c) 1999 Al Smith
5 *
6 * Portions derived from work (c) 1995,1996 Christian Vogelgsang.
7 */
8
9#ifndef __EFS_FS_H__
10#define __EFS_FS_H__
11
12#define EFS_VERSION "1.0a"
13
14static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aeschi.ch.eu.org>";
15
16#include <asm/uaccess.h>
17
18/* 1 block is 512 bytes */
19#define EFS_BLOCKSIZE_BITS 9
20#define EFS_BLOCKSIZE (1 << EFS_BLOCKSIZE_BITS)
21
22#include <linux/fs.h>
23#include <linux/efs_fs_i.h>
24#include <linux/efs_fs_sb.h>
25#include <linux/efs_dir.h>
26
27static inline struct efs_inode_info *INODE_INFO(struct inode *inode)
28{
29 return container_of(inode, struct efs_inode_info, vfs_inode);
30}
31
32static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
33{
34 return sb->s_fs_info;
35}
36
37struct statfs;
38struct fid;
39
40extern const struct inode_operations efs_dir_inode_operations;
41extern const struct file_operations efs_dir_operations;
42extern const struct address_space_operations efs_symlink_aops;
43
44extern struct inode *efs_iget(struct super_block *, unsigned long);
45extern efs_block_t efs_map_block(struct inode *, efs_block_t);
46extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int);
47
48extern struct dentry *efs_lookup(struct inode *, struct dentry *, struct nameidata *);
49extern struct dentry *efs_fh_to_dentry(struct super_block *sb, struct fid *fid,
50 int fh_len, int fh_type);
51extern struct dentry *efs_fh_to_parent(struct super_block *sb, struct fid *fid,
52 int fh_len, int fh_type);
53extern struct dentry *efs_get_parent(struct dentry *);
54extern int efs_bmap(struct inode *, int);
55
56#endif /* __EFS_FS_H__ */
diff --git a/include/linux/efs_fs_i.h b/include/linux/efs_fs_i.h
deleted file mode 100644
index 617c474ca659..000000000000
--- a/include/linux/efs_fs_i.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * efs_fs_i.h
3 *
4 * Copyright (c) 1999 Al Smith
5 *
6 * Portions derived from IRIX header files (c) 1988 Silicon Graphics
7 */
8
9#ifndef __EFS_FS_I_H__
10#define __EFS_FS_I_H__
11
12typedef int32_t efs_block_t;
13typedef uint32_t efs_ino_t;
14
15#define EFS_DIRECTEXTENTS 12
16
17/*
18 * layout of an extent, in memory and on disk. 8 bytes exactly.
19 */
20typedef union extent_u {
21 unsigned char raw[8];
22 struct extent_s {
23 unsigned int ex_magic:8; /* magic # (zero) */
24 unsigned int ex_bn:24; /* basic block */
25 unsigned int ex_length:8; /* numblocks in this extent */
26 unsigned int ex_offset:24; /* logical offset into file */
27 } cooked;
28} efs_extent;
29
30typedef struct edevs {
31 __be16 odev;
32 __be32 ndev;
33} efs_devs;
34
35/*
36 * extent based filesystem inode as it appears on disk. The efs inode
37 * is exactly 128 bytes long.
38 */
39struct efs_dinode {
40 __be16 di_mode; /* mode and type of file */
41 __be16 di_nlink; /* number of links to file */
42 __be16 di_uid; /* owner's user id */
43 __be16 di_gid; /* owner's group id */
44 __be32 di_size; /* number of bytes in file */
45 __be32 di_atime; /* time last accessed */
46 __be32 di_mtime; /* time last modified */
47 __be32 di_ctime; /* time created */
48 __be32 di_gen; /* generation number */
49 __be16 di_numextents; /* # of extents */
50 u_char di_version; /* version of inode */
51 u_char di_spare; /* spare - used by AFS */
52 union di_addr {
53 efs_extent di_extents[EFS_DIRECTEXTENTS];
54 efs_devs di_dev; /* device for IFCHR/IFBLK */
55 } di_u;
56};
57
58/* efs inode storage in memory */
59struct efs_inode_info {
60 int numextents;
61 int lastextent;
62
63 efs_extent extents[EFS_DIRECTEXTENTS];
64 struct inode vfs_inode;
65};
66
67#endif /* __EFS_FS_I_H__ */
68
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index b7558ec81ed5..25d62e6e3290 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -70,8 +70,7 @@ static inline int is_multicast_ether_addr(const u8 *addr)
70} 70}
71 71
72/** 72/**
73 * is_local_ether_addr - Determine if the Ethernet address is locally-assigned 73 * is_local_ether_addr - Determine if the Ethernet address is locally-assigned one (IEEE 802).
74 * one (IEEE 802).
75 * @addr: Pointer to a six-byte array containing the Ethernet address 74 * @addr: Pointer to a six-byte array containing the Ethernet address
76 * 75 *
77 * Return true if the address is a local address. 76 * Return true if the address is a local address.
diff --git a/include/linux/file.h b/include/linux/file.h
index 56023c74e9fd..7239baac81a9 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -59,8 +59,8 @@ struct files_struct {
59 59
60extern struct kmem_cache *filp_cachep; 60extern struct kmem_cache *filp_cachep;
61 61
62extern void FASTCALL(__fput(struct file *)); 62extern void __fput(struct file *);
63extern void FASTCALL(fput(struct file *)); 63extern void fput(struct file *);
64 64
65struct file_operations; 65struct file_operations;
66struct vfsmount; 66struct vfsmount;
@@ -77,13 +77,13 @@ static inline void fput_light(struct file *file, int fput_needed)
77 fput(file); 77 fput(file);
78} 78}
79 79
80extern struct file * FASTCALL(fget(unsigned int fd)); 80extern struct file *fget(unsigned int fd);
81extern struct file * FASTCALL(fget_light(unsigned int fd, int *fput_needed)); 81extern struct file *fget_light(unsigned int fd, int *fput_needed);
82extern void FASTCALL(set_close_on_exec(unsigned int fd, int flag)); 82extern void set_close_on_exec(unsigned int fd, int flag);
83extern void put_filp(struct file *); 83extern void put_filp(struct file *);
84extern int get_unused_fd(void); 84extern int get_unused_fd(void);
85extern int get_unused_fd_flags(int flags); 85extern int get_unused_fd_flags(int flags);
86extern void FASTCALL(put_unused_fd(unsigned int fd)); 86extern void put_unused_fd(unsigned int fd);
87struct kmem_cache; 87struct kmem_cache;
88 88
89extern int expand_files(struct files_struct *, int nr); 89extern int expand_files(struct files_struct *, int nr);
@@ -110,12 +110,12 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned in
110 */ 110 */
111#define fcheck(fd) fcheck_files(current->files, fd) 111#define fcheck(fd) fcheck_files(current->files, fd)
112 112
113extern void FASTCALL(fd_install(unsigned int fd, struct file * file)); 113extern void fd_install(unsigned int fd, struct file *file);
114 114
115struct task_struct; 115struct task_struct;
116 116
117struct files_struct *get_files_struct(struct task_struct *); 117struct files_struct *get_files_struct(struct task_struct *);
118void FASTCALL(put_files_struct(struct files_struct *fs)); 118void put_files_struct(struct files_struct *fs);
119void reset_files_struct(struct task_struct *, struct files_struct *); 119void reset_files_struct(struct task_struct *, struct files_struct *);
120 120
121extern struct kmem_cache *files_cachep; 121extern struct kmem_cache *files_cachep;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 18cfbf76ec5b..b84b848431f2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1284,8 +1284,10 @@ struct super_operations {
1284 * 1284 *
1285 * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on 1285 * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on
1286 * fdatasync(). i_atime is the usual cause. 1286 * fdatasync(). i_atime is the usual cause.
1287 * I_DIRTY_DATASYNC Inode is dirty and must be written on fdatasync(), f.e. 1287 * I_DIRTY_DATASYNC Data-related inode changes pending. We keep track of
1288 * because i_size changed. 1288 * these changes separately from I_DIRTY_SYNC so that we
1289 * don't have to write inode on fdatasync() when only
1290 * mtime has changed in it.
1289 * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. 1291 * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean.
1290 * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both 1292 * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both
1291 * are cleared by unlock_new_inode(), called from iget(). 1293 * are cleared by unlock_new_inode(), called from iget().
@@ -1588,7 +1590,6 @@ extern void bd_set_size(struct block_device *, loff_t size);
1588extern void bd_forget(struct inode *inode); 1590extern void bd_forget(struct inode *inode);
1589extern void bdput(struct block_device *); 1591extern void bdput(struct block_device *);
1590extern struct block_device *open_by_devnum(dev_t, unsigned); 1592extern struct block_device *open_by_devnum(dev_t, unsigned);
1591extern const struct address_space_operations def_blk_aops;
1592#else 1593#else
1593static inline void bd_forget(struct inode *inode) {} 1594static inline void bd_forget(struct inode *inode) {}
1594#endif 1595#endif
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 11a36ceddf73..282f54219129 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -1,15 +1,13 @@
1#ifndef _LINUX_FS_STRUCT_H 1#ifndef _LINUX_FS_STRUCT_H
2#define _LINUX_FS_STRUCT_H 2#define _LINUX_FS_STRUCT_H
3 3
4struct dentry; 4#include <linux/path.h>
5struct vfsmount;
6 5
7struct fs_struct { 6struct fs_struct {
8 atomic_t count; 7 atomic_t count;
9 rwlock_t lock; 8 rwlock_t lock;
10 int umask; 9 int umask;
11 struct dentry * root, * pwd, * altroot; 10 struct path root, pwd, altroot;
12 struct vfsmount * rootmnt, * pwdmnt, * altrootmnt;
13}; 11};
14 12
15#define INIT_FS { \ 13#define INIT_FS { \
@@ -22,8 +20,8 @@ extern struct kmem_cache *fs_cachep;
22 20
23extern void exit_fs(struct task_struct *); 21extern void exit_fs(struct task_struct *);
24extern void set_fs_altroot(void); 22extern void set_fs_altroot(void);
25extern void set_fs_root(struct fs_struct *, struct vfsmount *, struct dentry *); 23extern void set_fs_root(struct fs_struct *, struct path *);
26extern void set_fs_pwd(struct fs_struct *, struct vfsmount *, struct dentry *); 24extern void set_fs_pwd(struct fs_struct *, struct path *);
27extern struct fs_struct *copy_fs_struct(struct fs_struct *); 25extern struct fs_struct *copy_fs_struct(struct fs_struct *);
28extern void put_fs_struct(struct fs_struct *); 26extern void put_fs_struct(struct fs_struct *);
29 27
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 90048fb28a38..586ab56a3ec3 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -167,6 +167,7 @@ union futex_key {
167#ifdef CONFIG_FUTEX 167#ifdef CONFIG_FUTEX
168extern void exit_robust_list(struct task_struct *curr); 168extern void exit_robust_list(struct task_struct *curr);
169extern void exit_pi_state_list(struct task_struct *curr); 169extern void exit_pi_state_list(struct task_struct *curr);
170extern int futex_cmpxchg_enabled;
170#else 171#else
171static inline void exit_robust_list(struct task_struct *curr) 172static inline void exit_robust_list(struct task_struct *curr)
172{ 173{
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 0c6ce515185d..164be9da3c1b 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -172,8 +172,7 @@ static inline void arch_free_page(struct page *page, int order) { }
172static inline void arch_alloc_page(struct page *page, int order) { } 172static inline void arch_alloc_page(struct page *page, int order) { }
173#endif 173#endif
174 174
175extern struct page * 175extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *);
176FASTCALL(__alloc_pages(gfp_t, unsigned int, struct zonelist *));
177 176
178static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, 177static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
179 unsigned int order) 178 unsigned int order)
@@ -209,8 +208,8 @@ extern struct page *alloc_page_vma(gfp_t gfp_mask,
209#endif 208#endif
210#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) 209#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
211 210
212extern unsigned long FASTCALL(__get_free_pages(gfp_t gfp_mask, unsigned int order)); 211extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
213extern unsigned long FASTCALL(get_zeroed_page(gfp_t gfp_mask)); 212extern unsigned long get_zeroed_page(gfp_t gfp_mask);
214 213
215#define __get_free_page(gfp_mask) \ 214#define __get_free_page(gfp_mask) \
216 __get_free_pages((gfp_mask),0) 215 __get_free_pages((gfp_mask),0)
@@ -218,10 +217,10 @@ extern unsigned long FASTCALL(get_zeroed_page(gfp_t gfp_mask));
218#define __get_dma_pages(gfp_mask, order) \ 217#define __get_dma_pages(gfp_mask, order) \
219 __get_free_pages((gfp_mask) | GFP_DMA,(order)) 218 __get_free_pages((gfp_mask) | GFP_DMA,(order))
220 219
221extern void FASTCALL(__free_pages(struct page *page, unsigned int order)); 220extern void __free_pages(struct page *page, unsigned int order);
222extern void FASTCALL(free_pages(unsigned long addr, unsigned int order)); 221extern void free_pages(unsigned long addr, unsigned int order);
223extern void FASTCALL(free_hot_page(struct page *page)); 222extern void free_hot_page(struct page *page);
224extern void FASTCALL(free_cold_page(struct page *page)); 223extern void free_cold_page(struct page *page);
225 224
226#define __free_page(page) __free_pages((page), 0) 225#define __free_page(page) __free_pages((page), 0)
227#define free_page(addr) free_pages((addr),0) 226#define free_page(addr) free_pages((addr),0)
diff --git a/include/linux/hdsmart.h b/include/linux/hdsmart.h
index e69192159d40..4f4faf9d4238 100644
--- a/include/linux/hdsmart.h
+++ b/include/linux/hdsmart.h
@@ -17,7 +17,7 @@
17#ifndef _LINUX_HDSMART_H 17#ifndef _LINUX_HDSMART_H
18#define _LINUX_HDSMART_H 18#define _LINUX_HDSMART_H
19 19
20#ifndef __KERNEL 20#ifndef __KERNEL__
21#define OFFLINE_FULL_SCAN 0 21#define OFFLINE_FULL_SCAN 0
22#define SHORT_SELF_TEST 1 22#define SHORT_SELF_TEST 1
23#define EXTEND_SELF_TEST 2 23#define EXTEND_SELF_TEST 2
@@ -121,6 +121,6 @@ typedef struct ata_smart_selftestlog_s {
121 unsigned char resevered[2]; 121 unsigned char resevered[2];
122 unsigned char chksum; 122 unsigned char chksum;
123} __attribute__ ((packed)) ata_smart_selftestlog_t; 123} __attribute__ ((packed)) ata_smart_selftestlog_t;
124#endif /* __KERNEL__ * 124#endif /* __KERNEL__ */
125 125
126#endif /* _LINUX_HDSMART_H */ 126#endif /* _LINUX_HDSMART_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 3902690647b0..74ff57596eb1 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -528,7 +528,7 @@ int hid_set_field(struct hid_field *, unsigned, __s32);
528int hid_input_report(struct hid_device *, int type, u8 *, int, int); 528int hid_input_report(struct hid_device *, int type, u8 *, int, int);
529int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 529int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
530int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *); 530int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
531void hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 531int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
532int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32); 532int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
533void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt); 533void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt);
534void hid_output_report(struct hid_report *report, __u8 *data); 534void hid_output_report(struct hid_report *report, __u8 *data);
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 7ca198b379af..addca4cd4f11 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -33,8 +33,8 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to);
33void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 33void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
34 34
35extern unsigned long max_huge_pages; 35extern unsigned long max_huge_pages;
36extern unsigned long sysctl_overcommit_huge_pages;
36extern unsigned long hugepages_treat_as_movable; 37extern unsigned long hugepages_treat_as_movable;
37extern unsigned long nr_overcommit_huge_pages;
38extern const unsigned long hugetlb_zero, hugetlb_infinity; 38extern const unsigned long hugetlb_zero, hugetlb_infinity;
39extern int sysctl_hugetlb_shm_group; 39extern int sysctl_hugetlb_shm_group;
40 40
diff --git a/include/linux/init.h b/include/linux/init.h
index a404a0055dd7..fb58c0493cf2 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -42,6 +42,7 @@
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __section(.init.text) __cold 43#define __init __section(.init.text) __cold
44#define __initdata __section(.init.data) 44#define __initdata __section(.init.data)
45#define __initconst __section(.init.rodata)
45#define __exitdata __section(.exit.data) 46#define __exitdata __section(.exit.data)
46#define __exit_call __used __section(.exitcall.exit) 47#define __exit_call __used __section(.exitcall.exit)
47 48
@@ -106,6 +107,7 @@
106#define __memexitconst __section(.memexit.rodata) 107#define __memexitconst __section(.memexit.rodata)
107 108
108/* For assembly routines */ 109/* For assembly routines */
110#define __HEAD .section ".head.text","ax"
109#define __INIT .section ".init.text","ax" 111#define __INIT .section ".init.text","ax"
110#define __FINIT .previous 112#define __FINIT .previous
111 113
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index dea7598aeff4..f8ab4ce70564 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -273,8 +273,8 @@ asmlinkage void do_softirq(void);
273extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); 273extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
274extern void softirq_init(void); 274extern void softirq_init(void);
275#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) 275#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
276extern void FASTCALL(raise_softirq_irqoff(unsigned int nr)); 276extern void raise_softirq_irqoff(unsigned int nr);
277extern void FASTCALL(raise_softirq(unsigned int nr)); 277extern void raise_softirq(unsigned int nr);
278 278
279 279
280/* Tasklets --- multithreaded analogue of BHs. 280/* Tasklets --- multithreaded analogue of BHs.
@@ -341,7 +341,7 @@ static inline void tasklet_unlock_wait(struct tasklet_struct *t)
341#define tasklet_unlock(t) do { } while (0) 341#define tasklet_unlock(t) do { } while (0)
342#endif 342#endif
343 343
344extern void FASTCALL(__tasklet_schedule(struct tasklet_struct *t)); 344extern void __tasklet_schedule(struct tasklet_struct *t);
345 345
346static inline void tasklet_schedule(struct tasklet_struct *t) 346static inline void tasklet_schedule(struct tasklet_struct *t)
347{ 347{
@@ -349,7 +349,7 @@ static inline void tasklet_schedule(struct tasklet_struct *t)
349 __tasklet_schedule(t); 349 __tasklet_schedule(t);
350} 350}
351 351
352extern void FASTCALL(__tasklet_hi_schedule(struct tasklet_struct *t)); 352extern void __tasklet_hi_schedule(struct tasklet_struct *t);
353 353
354static inline void tasklet_hi_schedule(struct tasklet_struct *t) 354static inline void tasklet_hi_schedule(struct tasklet_struct *t)
355{ 355{
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 593b222d9dcc..1b4ccf25b4d2 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -50,6 +50,7 @@ struct cfq_io_context {
50 sector_t seek_mean; 50 sector_t seek_mean;
51 51
52 struct list_head queue_list; 52 struct list_head queue_list;
53 struct hlist_node cic_list;
53 54
54 void (*dtor)(struct io_context *); /* destructor */ 55 void (*dtor)(struct io_context *); /* destructor */
55 void (*exit)(struct io_context *); /* called on task exit */ 56 void (*exit)(struct io_context *); /* called on task exit */
@@ -77,6 +78,7 @@ struct io_context {
77 78
78 struct as_io_context *aic; 79 struct as_io_context *aic;
79 struct radix_tree_root radix_root; 80 struct radix_tree_root radix_root;
81 struct hlist_head cic_list;
80 void *ioc_data; 82 void *ioc_data;
81}; 83};
82 84
diff --git a/include/linux/irq.h b/include/linux/irq.h
index bfd9efb5cb49..176e5e790a44 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -285,7 +285,6 @@ extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
285 285
286/* 286/*
287 * Monolithic do_IRQ implementation. 287 * Monolithic do_IRQ implementation.
288 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
289 */ 288 */
290#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ 289#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
291extern unsigned int __do_IRQ(unsigned int irq); 290extern unsigned int __do_IRQ(unsigned int irq);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 36c542b70c6d..2cd7fa73d1af 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -310,6 +310,8 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
310 return ktime_sub_ns(kt, usec * 1000); 310 return ktime_sub_ns(kt, usec * 1000);
311} 311}
312 312
313extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
314
313/* 315/*
314 * The resolution of the clocks. The resolution value is returned in 316 * The resolution of the clocks. The resolution value is returned in
315 * the clock_getres() system call to give application programmers an 317 * the clock_getres() system call to give application programmers an
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bc5a8d0c7090..ce7603a73156 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -278,7 +278,6 @@ enum {
278 278
279 /* size of buffer to pad xfers ending on unaligned boundaries */ 279 /* size of buffer to pad xfers ending on unaligned boundaries */
280 ATA_DMA_PAD_SZ = 4, 280 ATA_DMA_PAD_SZ = 4,
281 ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE,
282 281
283 /* ering size */ 282 /* ering size */
284 ATA_ERING_SIZE = 32, 283 ATA_ERING_SIZE = 32,
@@ -457,24 +456,18 @@ struct ata_queued_cmd {
457 unsigned long flags; /* ATA_QCFLAG_xxx */ 456 unsigned long flags; /* ATA_QCFLAG_xxx */
458 unsigned int tag; 457 unsigned int tag;
459 unsigned int n_elem; 458 unsigned int n_elem;
460 unsigned int mapped_n_elem;
461 459
462 int dma_dir; 460 int dma_dir;
463 461
464 unsigned int pad_len;
465 unsigned int sect_size; 462 unsigned int sect_size;
466 463
467 unsigned int nbytes; 464 unsigned int nbytes;
468 unsigned int raw_nbytes;
469 unsigned int curbytes; 465 unsigned int curbytes;
470 466
471 struct scatterlist *cursg; 467 struct scatterlist *cursg;
472 unsigned int cursg_ofs; 468 unsigned int cursg_ofs;
473 469
474 struct scatterlist *last_sg;
475 struct scatterlist saved_last_sg;
476 struct scatterlist sgent; 470 struct scatterlist sgent;
477 struct scatterlist extra_sg[2];
478 471
479 struct scatterlist *sg; 472 struct scatterlist *sg;
480 473
@@ -619,9 +612,6 @@ struct ata_port {
619 struct ata_prd *prd; /* our SG list */ 612 struct ata_prd *prd; /* our SG list */
620 dma_addr_t prd_dma; /* and its DMA mapping */ 613 dma_addr_t prd_dma; /* and its DMA mapping */
621 614
622 void *pad; /* array of DMA pad buffers */
623 dma_addr_t pad_dma;
624
625 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 615 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
626 616
627 u8 ctl; /* cache of ATA control register */ 617 u8 ctl; /* cache of ATA control register */
@@ -1207,7 +1197,7 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1207 return ap->pmp_link; 1197 return ap->pmp_link;
1208 } 1198 }
1209 1199
1210 if (++link - ap->pmp_link < ap->nr_pmp_links) 1200 if (++link < ap->nr_pmp_links + ap->pmp_link)
1211 return link; 1201 return link;
1212 return NULL; 1202 return NULL;
1213} 1203}
@@ -1363,12 +1353,9 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1363 qc->flags = 0; 1353 qc->flags = 0;
1364 qc->cursg = NULL; 1354 qc->cursg = NULL;
1365 qc->cursg_ofs = 0; 1355 qc->cursg_ofs = 0;
1366 qc->nbytes = qc->raw_nbytes = qc->curbytes = 0; 1356 qc->nbytes = qc->curbytes = 0;
1367 qc->n_elem = 0; 1357 qc->n_elem = 0;
1368 qc->mapped_n_elem = 0;
1369 qc->err_mask = 0; 1358 qc->err_mask = 0;
1370 qc->pad_len = 0;
1371 qc->last_sg = NULL;
1372 qc->sect_size = ATA_SECT_SIZE; 1359 qc->sect_size = ATA_SECT_SIZE;
1373 1360
1374 ata_tf_init(qc->dev, &qc->tf); 1361 ata_tf_init(qc->dev, &qc->tf);
@@ -1423,19 +1410,6 @@ static inline unsigned int __ac_err_mask(u8 status)
1423 return mask; 1410 return mask;
1424} 1411}
1425 1412
1426static inline int ata_pad_alloc(struct ata_port *ap, struct device *dev)
1427{
1428 ap->pad_dma = 0;
1429 ap->pad = dmam_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ,
1430 &ap->pad_dma, GFP_KERNEL);
1431 return (ap->pad == NULL) ? -ENOMEM : 0;
1432}
1433
1434static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
1435{
1436 dmam_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma);
1437}
1438
1439static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) 1413static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1440{ 1414{
1441 return *(struct ata_port **)&host->hostdata[0]; 1415 return *(struct ata_port **)&host->hostdata[0];
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 3faf599ea58e..0592936344c4 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -73,9 +73,4 @@
73#define ATTRIB_NORET __attribute__((noreturn)) 73#define ATTRIB_NORET __attribute__((noreturn))
74#define NORET_AND noreturn, 74#define NORET_AND noreturn,
75 75
76#ifndef FASTCALL
77#define FASTCALL(x) x
78#define fastcall
79#endif
80
81#endif 76#endif
diff --git a/include/linux/maple.h b/include/linux/maple.h
index bad9a7b319de..3f01e2bae1a1 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -7,74 +7,74 @@ extern struct bus_type maple_bus_type;
7 7
8/* Maple Bus command and response codes */ 8/* Maple Bus command and response codes */
9enum maple_code { 9enum maple_code {
10 MAPLE_RESPONSE_FILEERR = -5, 10 MAPLE_RESPONSE_FILEERR = -5,
11 MAPLE_RESPONSE_AGAIN = -4, /* request should be retransmitted */ 11 MAPLE_RESPONSE_AGAIN = -4, /* request should be retransmitted */
12 MAPLE_RESPONSE_BADCMD = -3, 12 MAPLE_RESPONSE_BADCMD = -3,
13 MAPLE_RESPONSE_BADFUNC = -2, 13 MAPLE_RESPONSE_BADFUNC = -2,
14 MAPLE_RESPONSE_NONE = -1, /* unit didn't respond at all */ 14 MAPLE_RESPONSE_NONE = -1, /* unit didn't respond at all */
15 MAPLE_COMMAND_DEVINFO = 1, 15 MAPLE_COMMAND_DEVINFO = 1,
16 MAPLE_COMMAND_ALLINFO = 2, 16 MAPLE_COMMAND_ALLINFO = 2,
17 MAPLE_COMMAND_RESET = 3, 17 MAPLE_COMMAND_RESET = 3,
18 MAPLE_COMMAND_KILL = 4, 18 MAPLE_COMMAND_KILL = 4,
19 MAPLE_RESPONSE_DEVINFO = 5, 19 MAPLE_RESPONSE_DEVINFO = 5,
20 MAPLE_RESPONSE_ALLINFO = 6, 20 MAPLE_RESPONSE_ALLINFO = 6,
21 MAPLE_RESPONSE_OK = 7, 21 MAPLE_RESPONSE_OK = 7,
22 MAPLE_RESPONSE_DATATRF = 8, 22 MAPLE_RESPONSE_DATATRF = 8,
23 MAPLE_COMMAND_GETCOND = 9, 23 MAPLE_COMMAND_GETCOND = 9,
24 MAPLE_COMMAND_GETMINFO = 10, 24 MAPLE_COMMAND_GETMINFO = 10,
25 MAPLE_COMMAND_BREAD = 11, 25 MAPLE_COMMAND_BREAD = 11,
26 MAPLE_COMMAND_BWRITE = 12, 26 MAPLE_COMMAND_BWRITE = 12,
27 MAPLE_COMMAND_SETCOND = 14 27 MAPLE_COMMAND_SETCOND = 14
28}; 28};
29 29
30struct mapleq { 30struct mapleq {
31 struct list_head list; 31 struct list_head list;
32 struct maple_device *dev; 32 struct maple_device *dev;
33 void *sendbuf, *recvbuf, *recvbufdcsp; 33 void *sendbuf, *recvbuf, *recvbufdcsp;
34 unsigned char length; 34 unsigned char length;
35 enum maple_code command; 35 enum maple_code command;
36}; 36};
37 37
38struct maple_devinfo { 38struct maple_devinfo {
39 unsigned long function; 39 unsigned long function;
40 unsigned long function_data[3]; 40 unsigned long function_data[3];
41 unsigned char area_code; 41 unsigned char area_code;
42 unsigned char connector_directon; 42 unsigned char connector_direction;
43 char product_name[31]; 43 char product_name[31];
44 char product_licence[61]; 44 char product_licence[61];
45 unsigned short standby_power; 45 unsigned short standby_power;
46 unsigned short max_power; 46 unsigned short max_power;
47}; 47};
48 48
49struct maple_device { 49struct maple_device {
50 struct maple_driver *driver; 50 struct maple_driver *driver;
51 struct mapleq *mq; 51 struct mapleq *mq;
52 void *private_data; 52 void *private_data;
53 void (*callback) (struct mapleq * mq); 53 void (*callback) (struct mapleq * mq);
54 unsigned long when, interval, function; 54 unsigned long when, interval, function;
55 struct maple_devinfo devinfo; 55 struct maple_devinfo devinfo;
56 unsigned char port, unit; 56 unsigned char port, unit;
57 char product_name[32]; 57 char product_name[32];
58 char product_licence[64]; 58 char product_licence[64];
59 int registered; 59 struct device dev;
60 struct device dev;
61}; 60};
62 61
63struct maple_driver { 62struct maple_driver {
64 unsigned long function; 63 unsigned long function;
65 int (*connect) (struct maple_device * dev); 64 int (*connect) (struct maple_device * dev);
66 void (*disconnect) (struct maple_device * dev); 65 void (*disconnect) (struct maple_device * dev);
67 struct device_driver drv; 66 struct device_driver drv;
67 int registered;
68}; 68};
69 69
70void maple_getcond_callback(struct maple_device *dev, 70void maple_getcond_callback(struct maple_device *dev,
71 void (*callback) (struct mapleq * mq), 71 void (*callback) (struct mapleq * mq),
72 unsigned long interval, 72 unsigned long interval,
73 unsigned long function); 73 unsigned long function);
74int maple_driver_register(struct device_driver *drv); 74int maple_driver_register(struct device_driver *drv);
75void maple_add_packet(struct mapleq *mq); 75void maple_add_packet(struct mapleq *mq);
76 76
77#define to_maple_dev(n) container_of(n, struct maple_device, dev) 77#define to_maple_dev(n) container_of(n, struct maple_device, dev)
78#define to_maple_driver(n) container_of(n, struct maple_driver, drv) 78#define to_maple_driver(n) container_of(n, struct maple_driver, drv)
79 79
80#endif /* __LINUX_MAPLE_H */ 80#endif /* __LINUX_MAPLE_H */
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 5f36cf946bcb..5df879dc3776 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -19,16 +19,23 @@ struct marker;
19 19
20/** 20/**
21 * marker_probe_func - Type of a marker probe function 21 * marker_probe_func - Type of a marker probe function
22 * @mdata: pointer of type struct marker 22 * @probe_private: probe private data
23 * @private_data: caller site private data 23 * @call_private: call site private data
24 * @fmt: format string 24 * @fmt: format string
25 * @...: variable argument list 25 * @args: variable argument list pointer. Use a pointer to overcome C's
26 * inability to pass this around as a pointer in a portable manner in
27 * the callee otherwise.
26 * 28 *
27 * Type of marker probe functions. They receive the mdata and need to parse the 29 * Type of marker probe functions. They receive the mdata and need to parse the
28 * format string to recover the variable argument list. 30 * format string to recover the variable argument list.
29 */ 31 */
30typedef void marker_probe_func(const struct marker *mdata, 32typedef void marker_probe_func(void *probe_private, void *call_private,
31 void *private_data, const char *fmt, ...); 33 const char *fmt, va_list *args);
34
35struct marker_probe_closure {
36 marker_probe_func *func; /* Callback */
37 void *probe_private; /* Private probe data */
38};
32 39
33struct marker { 40struct marker {
34 const char *name; /* Marker name */ 41 const char *name; /* Marker name */
@@ -36,8 +43,11 @@ struct marker {
36 * variable argument list. 43 * variable argument list.
37 */ 44 */
38 char state; /* Marker state. */ 45 char state; /* Marker state. */
39 marker_probe_func *call;/* Probe handler function pointer */ 46 char ptype; /* probe type : 0 : single, 1 : multi */
40 void *private; /* Private probe data */ 47 void (*call)(const struct marker *mdata, /* Probe wrapper */
48 void *call_private, const char *fmt, ...);
49 struct marker_probe_closure single;
50 struct marker_probe_closure *multi;
41} __attribute__((aligned(8))); 51} __attribute__((aligned(8)));
42 52
43#ifdef CONFIG_MARKERS 53#ifdef CONFIG_MARKERS
@@ -49,35 +59,31 @@ struct marker {
49 * not add unwanted padding between the beginning of the section and the 59 * not add unwanted padding between the beginning of the section and the
50 * structure. Force alignment to the same alignment as the section start. 60 * structure. Force alignment to the same alignment as the section start.
51 */ 61 */
52#define __trace_mark(name, call_data, format, args...) \ 62#define __trace_mark(name, call_private, format, args...) \
53 do { \ 63 do { \
54 static const char __mstrtab_name_##name[] \ 64 static const char __mstrtab_##name[] \
55 __attribute__((section("__markers_strings"))) \
56 = #name; \
57 static const char __mstrtab_format_##name[] \
58 __attribute__((section("__markers_strings"))) \ 65 __attribute__((section("__markers_strings"))) \
59 = format; \ 66 = #name "\0" format; \
60 static struct marker __mark_##name \ 67 static struct marker __mark_##name \
61 __attribute__((section("__markers"), aligned(8))) = \ 68 __attribute__((section("__markers"), aligned(8))) = \
62 { __mstrtab_name_##name, __mstrtab_format_##name, \ 69 { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \
63 0, __mark_empty_function, NULL }; \ 70 0, 0, marker_probe_cb, \
71 { __mark_empty_function, NULL}, NULL }; \
64 __mark_check_format(format, ## args); \ 72 __mark_check_format(format, ## args); \
65 if (unlikely(__mark_##name.state)) { \ 73 if (unlikely(__mark_##name.state)) { \
66 preempt_disable(); \
67 (*__mark_##name.call) \ 74 (*__mark_##name.call) \
68 (&__mark_##name, call_data, \ 75 (&__mark_##name, call_private, \
69 format, ## args); \ 76 format, ## args); \
70 preempt_enable(); \
71 } \ 77 } \
72 } while (0) 78 } while (0)
73 79
74extern void marker_update_probe_range(struct marker *begin, 80extern void marker_update_probe_range(struct marker *begin,
75 struct marker *end, struct module *probe_module, int *refcount); 81 struct marker *end);
76#else /* !CONFIG_MARKERS */ 82#else /* !CONFIG_MARKERS */
77#define __trace_mark(name, call_data, format, args...) \ 83#define __trace_mark(name, call_private, format, args...) \
78 __mark_check_format(format, ## args) 84 __mark_check_format(format, ## args)
79static inline void marker_update_probe_range(struct marker *begin, 85static inline void marker_update_probe_range(struct marker *begin,
80 struct marker *end, struct module *probe_module, int *refcount) 86 struct marker *end)
81{ } 87{ }
82#endif /* CONFIG_MARKERS */ 88#endif /* CONFIG_MARKERS */
83 89
@@ -92,8 +98,6 @@ static inline void marker_update_probe_range(struct marker *begin,
92#define trace_mark(name, format, args...) \ 98#define trace_mark(name, format, args...) \
93 __trace_mark(name, NULL, format, ## args) 99 __trace_mark(name, NULL, format, ## args)
94 100
95#define MARK_MAX_FORMAT_LEN 1024
96
97/** 101/**
98 * MARK_NOARGS - Format string for a marker with no argument. 102 * MARK_NOARGS - Format string for a marker with no argument.
99 */ 103 */
@@ -106,24 +110,30 @@ static inline void __printf(1, 2) __mark_check_format(const char *fmt, ...)
106 110
107extern marker_probe_func __mark_empty_function; 111extern marker_probe_func __mark_empty_function;
108 112
113extern void marker_probe_cb(const struct marker *mdata,
114 void *call_private, const char *fmt, ...);
115extern void marker_probe_cb_noarg(const struct marker *mdata,
116 void *call_private, const char *fmt, ...);
117
109/* 118/*
110 * Connect a probe to a marker. 119 * Connect a probe to a marker.
111 * private data pointer must be a valid allocated memory address, or NULL. 120 * private data pointer must be a valid allocated memory address, or NULL.
112 */ 121 */
113extern int marker_probe_register(const char *name, const char *format, 122extern int marker_probe_register(const char *name, const char *format,
114 marker_probe_func *probe, void *private); 123 marker_probe_func *probe, void *probe_private);
115 124
116/* 125/*
117 * Returns the private data given to marker_probe_register. 126 * Returns the private data given to marker_probe_register.
118 */ 127 */
119extern void *marker_probe_unregister(const char *name); 128extern int marker_probe_unregister(const char *name,
129 marker_probe_func *probe, void *probe_private);
120/* 130/*
121 * Unregister a marker by providing the registered private data. 131 * Unregister a marker by providing the registered private data.
122 */ 132 */
123extern void *marker_probe_unregister_private_data(void *private); 133extern int marker_probe_unregister_private_data(marker_probe_func *probe,
134 void *probe_private);
124 135
125extern int marker_arm(const char *name); 136extern void *marker_get_private_data(const char *name, marker_probe_func *probe,
126extern int marker_disarm(const char *name); 137 int num);
127extern void *marker_get_private_data(const char *name);
128 138
129#endif 139#endif
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 925d57b236aa..04075628cb9a 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -20,9 +20,6 @@
20#ifndef _LINUX_MEMCONTROL_H 20#ifndef _LINUX_MEMCONTROL_H
21#define _LINUX_MEMCONTROL_H 21#define _LINUX_MEMCONTROL_H
22 22
23#include <linux/rcupdate.h>
24#include <linux/mm.h>
25
26struct mem_cgroup; 23struct mem_cgroup;
27struct page_cgroup; 24struct page_cgroup;
28struct page; 25struct page;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e8abb3814209..3f3ccfe42de0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -235,6 +235,7 @@ static inline int get_page_unless_zero(struct page *page)
235struct page *vmalloc_to_page(const void *addr); 235struct page *vmalloc_to_page(const void *addr);
236unsigned long vmalloc_to_pfn(const void *addr); 236unsigned long vmalloc_to_pfn(const void *addr);
237 237
238#ifdef CONFIG_MMU
238/* Determine if an address is within the vmalloc range */ 239/* Determine if an address is within the vmalloc range */
239static inline int is_vmalloc_addr(const void *x) 240static inline int is_vmalloc_addr(const void *x)
240{ 241{
@@ -242,6 +243,7 @@ static inline int is_vmalloc_addr(const void *x)
242 243
243 return addr >= VMALLOC_START && addr < VMALLOC_END; 244 return addr >= VMALLOC_START && addr < VMALLOC_END;
244} 245}
246#endif
245 247
246static inline struct page *compound_head(struct page *page) 248static inline struct page *compound_head(struct page *page)
247{ 249{
@@ -786,7 +788,7 @@ int __set_page_dirty_nobuffers(struct page *page);
786int __set_page_dirty_no_writeback(struct page *page); 788int __set_page_dirty_no_writeback(struct page *page);
787int redirty_page_for_writepage(struct writeback_control *wbc, 789int redirty_page_for_writepage(struct writeback_control *wbc,
788 struct page *page); 790 struct page *page);
789int FASTCALL(set_page_dirty(struct page *page)); 791int set_page_dirty(struct page *page);
790int set_page_dirty_lock(struct page *page); 792int set_page_dirty_lock(struct page *page);
791int clear_page_dirty_for_io(struct page *page); 793int clear_page_dirty_for_io(struct page *page);
792 794
@@ -829,7 +831,7 @@ extern void unregister_shrinker(struct shrinker *);
829 831
830int vma_wants_writenotify(struct vm_area_struct *vma); 832int vma_wants_writenotify(struct vm_area_struct *vma);
831 833
832extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); 834extern pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl);
833 835
834#ifdef __PAGETABLE_PUD_FOLDED 836#ifdef __PAGETABLE_PUD_FOLDED
835static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, 837static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
@@ -1171,12 +1173,18 @@ static inline void enable_debug_pagealloc(void)
1171{ 1173{
1172 debug_pagealloc_enabled = 1; 1174 debug_pagealloc_enabled = 1;
1173} 1175}
1176#ifdef CONFIG_HIBERNATION
1177extern bool kernel_page_present(struct page *page);
1178#endif /* CONFIG_HIBERNATION */
1174#else 1179#else
1175static inline void 1180static inline void
1176kernel_map_pages(struct page *page, int numpages, int enable) {} 1181kernel_map_pages(struct page *page, int numpages, int enable) {}
1177static inline void enable_debug_pagealloc(void) 1182static inline void enable_debug_pagealloc(void)
1178{ 1183{
1179} 1184}
1185#ifdef CONFIG_HIBERNATION
1186static inline bool kernel_page_present(struct page *page) { return true; }
1187#endif /* CONFIG_HIBERNATION */
1180#endif 1188#endif
1181 1189
1182extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); 1190extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
diff --git a/include/linux/module.h b/include/linux/module.h
index ac28e8761e84..819c4e889bf1 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -465,7 +465,7 @@ int unregister_module_notifier(struct notifier_block * nb);
465 465
466extern void print_modules(void); 466extern void print_modules(void);
467 467
468extern void module_update_markers(struct module *probe_module, int *refcount); 468extern void module_update_markers(void);
469 469
470#else /* !CONFIG_MODULES... */ 470#else /* !CONFIG_MODULES... */
471#define EXPORT_SYMBOL(sym) 471#define EXPORT_SYMBOL(sym)
@@ -567,8 +567,7 @@ static inline void print_modules(void)
567{ 567{
568} 568}
569 569
570static inline void module_update_markers(struct module *probe_module, 570static inline void module_update_markers(void)
571 int *refcount)
572{ 571{
573} 572}
574 573
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 8126e55c5bdc..ec624381c844 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -62,6 +62,16 @@ struct kparam_array
62 void *elem; 62 void *elem;
63}; 63};
64 64
65/* On alpha, ia64 and ppc64 relocations to global data cannot go into
66 read-only sections (which is part of respective UNIX ABI on these
67 platforms). So 'const' makes no sense and even causes compile failures
68 with some compilers. */
69#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
70#define __moduleparam_const
71#else
72#define __moduleparam_const const
73#endif
74
65/* This is the fundamental function for registering boot/module 75/* This is the fundamental function for registering boot/module
66 parameters. perm sets the visibility in sysfs: 000 means it's 76 parameters. perm sets the visibility in sysfs: 000 means it's
67 not there, read bits mean it's readable, write bits mean it's 77 not there, read bits mean it's readable, write bits mean it's
@@ -71,7 +81,7 @@ struct kparam_array
71 static int __param_perm_check_##name __attribute__((unused)) = \ 81 static int __param_perm_check_##name __attribute__((unused)) = \
72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ 82 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
73 static const char __param_str_##name[] = prefix #name; \ 83 static const char __param_str_##name[] = prefix #name; \
74 static struct kernel_param const __param_##name \ 84 static struct kernel_param __moduleparam_const __param_##name \
75 __used \ 85 __used \
76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 86 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
77 = { __param_str_##name, perm, set, get, { arg } } 87 = { __param_str_##name, perm, set, get, { arg } }
diff --git a/include/linux/mutex-debug.h b/include/linux/mutex-debug.h
index 2537285e1064..731d77d6e155 100644
--- a/include/linux/mutex-debug.h
+++ b/include/linux/mutex-debug.h
@@ -18,6 +18,6 @@ do { \
18 __mutex_init((mutex), #mutex, &__key); \ 18 __mutex_init((mutex), #mutex, &__key); \
19} while (0) 19} while (0)
20 20
21extern void FASTCALL(mutex_destroy(struct mutex *lock)); 21extern void mutex_destroy(struct mutex *lock);
22 22
23#endif 23#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 4cb4f8d2f78d..24d88e98a626 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/dcache.h> 4#include <linux/dcache.h>
5#include <linux/linkage.h> 5#include <linux/linkage.h>
6#include <linux/path.h>
6 7
7struct vfsmount; 8struct vfsmount;
8 9
@@ -15,8 +16,7 @@ struct open_intent {
15enum { MAX_NESTED_LINKS = 8 }; 16enum { MAX_NESTED_LINKS = 8 };
16 17
17struct nameidata { 18struct nameidata {
18 struct dentry *dentry; 19 struct path path;
19 struct vfsmount *mnt;
20 struct qstr last; 20 struct qstr last;
21 unsigned int flags; 21 unsigned int flags;
22 int last_type; 22 int last_type;
@@ -29,11 +29,6 @@ struct nameidata {
29 } intent; 29 } intent;
30}; 30};
31 31
32struct path {
33 struct vfsmount *mnt;
34 struct dentry *dentry;
35};
36
37/* 32/*
38 * Type of the last component on LOOKUP_PARENT 33 * Type of the last component on LOOKUP_PARENT
39 */ 34 */
@@ -62,17 +57,15 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
62#define LOOKUP_ACCESS (0x0400) 57#define LOOKUP_ACCESS (0x0400)
63#define LOOKUP_CHDIR (0x0800) 58#define LOOKUP_CHDIR (0x0800)
64 59
65extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *)); 60extern int __user_walk(const char __user *, unsigned, struct nameidata *);
66extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *)); 61extern int __user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *);
67#define user_path_walk(name,nd) \ 62#define user_path_walk(name,nd) \
68 __user_walk_fd(AT_FDCWD, name, LOOKUP_FOLLOW, nd) 63 __user_walk_fd(AT_FDCWD, name, LOOKUP_FOLLOW, nd)
69#define user_path_walk_link(name,nd) \ 64#define user_path_walk_link(name,nd) \
70 __user_walk_fd(AT_FDCWD, name, 0, nd) 65 __user_walk_fd(AT_FDCWD, name, 0, nd)
71extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); 66extern int path_lookup(const char *, unsigned, struct nameidata *);
72extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 67extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
73 const char *, unsigned int, struct nameidata *); 68 const char *, unsigned int, struct nameidata *);
74extern void path_release(struct nameidata *);
75extern void path_release_on_umount(struct nameidata *);
76 69
77extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags); 70extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags);
78extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags); 71extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4ffa49dbb66f..a2f003239c85 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -322,7 +322,7 @@ enum
322 NAPI_STATE_DISABLE, /* Disable pending */ 322 NAPI_STATE_DISABLE, /* Disable pending */
323}; 323};
324 324
325extern void FASTCALL(__napi_schedule(struct napi_struct *n)); 325extern void __napi_schedule(struct napi_struct *n);
326 326
327static inline int napi_disable_pending(struct napi_struct *n) 327static inline int napi_disable_pending(struct napi_struct *n)
328{ 328{
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 3a1687251367..5431512b2757 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -84,9 +84,8 @@ struct svc_export {
84 struct cache_head h; 84 struct cache_head h;
85 struct auth_domain * ex_client; 85 struct auth_domain * ex_client;
86 int ex_flags; 86 int ex_flags;
87 struct vfsmount * ex_mnt; 87 struct path ex_path;
88 struct dentry * ex_dentry; 88 char *ex_pathname;
89 char * ex_path;
90 uid_t ex_anon_uid; 89 uid_t ex_anon_uid;
91 gid_t ex_anon_gid; 90 gid_t ex_anon_gid;
92 int ex_fsid; 91 int ex_fsid;
@@ -107,8 +106,7 @@ struct svc_expkey {
107 int ek_fsidtype; 106 int ek_fsidtype;
108 u32 ek_fsid[6]; 107 u32 ek_fsid[6];
109 108
110 struct vfsmount * ek_mnt; 109 struct path ek_path;
111 struct dentry * ek_dentry;
112}; 110};
113 111
114#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) 112#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index bbad43fb8181..b5b30f1c1e59 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -266,7 +266,7 @@ static inline void SetPageUptodate(struct page *page)
266 266
267#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) 267#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
268 268
269#define PageTail(page) ((page->flags & PG_head_tail_mask) \ 269#define PageTail(page) (((page)->flags & PG_head_tail_mask) \
270 == PG_head_tail_mask) 270 == PG_head_tail_mask)
271 271
272static inline void __SetPageTail(struct page *page) 272static inline void __SetPageTail(struct page *page)
@@ -279,7 +279,7 @@ static inline void __ClearPageTail(struct page *page)
279 page->flags &= ~PG_head_tail_mask; 279 page->flags &= ~PG_head_tail_mask;
280} 280}
281 281
282#define PageHead(page) ((page->flags & PG_head_tail_mask) \ 282#define PageHead(page) (((page)->flags & PG_head_tail_mask) \
283 == (1L << PG_compound)) 283 == (1L << PG_compound))
284#define __SetPageHead(page) __SetPageCompound(page) 284#define __SetPageHead(page) __SetPageCompound(page)
285#define __ClearPageHead(page) __ClearPageCompound(page) 285#define __ClearPageHead(page) __ClearPageCompound(page)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 4b62a105622b..d2fca802f809 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -156,10 +156,10 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
156 return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT); 156 return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT);
157} 157}
158 158
159extern void FASTCALL(__lock_page(struct page *page)); 159extern void __lock_page(struct page *page);
160extern int FASTCALL(__lock_page_killable(struct page *page)); 160extern int __lock_page_killable(struct page *page);
161extern void FASTCALL(__lock_page_nosync(struct page *page)); 161extern void __lock_page_nosync(struct page *page);
162extern void FASTCALL(unlock_page(struct page *page)); 162extern void unlock_page(struct page *page);
163 163
164/* 164/*
165 * lock_page may only be called if we have the page's inode pinned. 165 * lock_page may only be called if we have the page's inode pinned.
@@ -199,7 +199,7 @@ static inline void lock_page_nosync(struct page *page)
199 * This is exported only for wait_on_page_locked/wait_on_page_writeback. 199 * This is exported only for wait_on_page_locked/wait_on_page_writeback.
200 * Never use this directly! 200 * Never use this directly!
201 */ 201 */
202extern void FASTCALL(wait_on_page_bit(struct page *page, int bit_nr)); 202extern void wait_on_page_bit(struct page *page, int bit_nr);
203 203
204/* 204/*
205 * Wait for a page to be unlocked. 205 * Wait for a page to be unlocked.
diff --git a/include/linux/path.h b/include/linux/path.h
new file mode 100644
index 000000000000..915e0c382a51
--- /dev/null
+++ b/include/linux/path.h
@@ -0,0 +1,15 @@
1#ifndef _LINUX_PATH_H
2#define _LINUX_PATH_H
3
4struct dentry;
5struct vfsmount;
6
7struct path {
8 struct vfsmount *mnt;
9 struct dentry *dentry;
10};
11
12extern void path_get(struct path *);
13extern void path_put(struct path *);
14
15#endif /* _LINUX_PATH_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index df6dd79a0d3b..effdb558a588 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1351,6 +1351,7 @@
1351#define PCI_DEVICE_ID_VIA_8231_4 0x8235 1351#define PCI_DEVICE_ID_VIA_8231_4 0x8235
1352#define PCI_DEVICE_ID_VIA_8365_1 0x8305 1352#define PCI_DEVICE_ID_VIA_8365_1 0x8305
1353#define PCI_DEVICE_ID_VIA_CX700 0x8324 1353#define PCI_DEVICE_ID_VIA_CX700 0x8324
1354#define PCI_DEVICE_ID_VIA_CX700_IDE 0x0581
1354#define PCI_DEVICE_ID_VIA_VX800 0x8353 1355#define PCI_DEVICE_ID_VIA_VX800 0x8353
1355#define PCI_DEVICE_ID_VIA_8371_1 0x8391 1356#define PCI_DEVICE_ID_VIA_8371_1 0x8391
1356#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 1357#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
@@ -2373,6 +2374,12 @@
2373#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a 2374#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a
2374#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e 2375#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
2375#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b 2376#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b
2377#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14
2378#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16
2379#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18
2380#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a
2381#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
2382#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2376#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2383#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2377#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff 2384#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
2378#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 2385#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031
diff --git a/include/linux/pid.h b/include/linux/pid.h
index f84d532b5d23..c7980810eb09 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -79,10 +79,9 @@ static inline struct pid *get_pid(struct pid *pid)
79 return pid; 79 return pid;
80} 80}
81 81
82extern void FASTCALL(put_pid(struct pid *pid)); 82extern void put_pid(struct pid *pid);
83extern struct task_struct *FASTCALL(pid_task(struct pid *pid, enum pid_type)); 83extern struct task_struct *pid_task(struct pid *pid, enum pid_type);
84extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid, 84extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type);
85 enum pid_type));
86 85
87extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); 86extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
88 87
@@ -90,11 +89,11 @@ extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
90 * attach_pid() and detach_pid() must be called with the tasklist_lock 89 * attach_pid() and detach_pid() must be called with the tasklist_lock
91 * write-held. 90 * write-held.
92 */ 91 */
93extern int FASTCALL(attach_pid(struct task_struct *task, 92extern int attach_pid(struct task_struct *task, enum pid_type type,
94 enum pid_type type, struct pid *pid)); 93 struct pid *pid);
95extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); 94extern void detach_pid(struct task_struct *task, enum pid_type);
96extern void FASTCALL(transfer_pid(struct task_struct *old, 95extern void transfer_pid(struct task_struct *old, struct task_struct *new,
97 struct task_struct *new, enum pid_type)); 96 enum pid_type);
98 97
99struct pid_namespace; 98struct pid_namespace;
100extern struct pid_namespace init_pid_ns; 99extern struct pid_namespace init_pid_ns;
@@ -109,7 +108,7 @@ extern struct pid_namespace init_pid_ns;
109 * 108 *
110 * see also find_task_by_pid() set in include/linux/sched.h 109 * see also find_task_by_pid() set in include/linux/sched.h
111 */ 110 */
112extern struct pid *FASTCALL(find_pid_ns(int nr, struct pid_namespace *ns)); 111extern struct pid *find_pid_ns(int nr, struct pid_namespace *ns);
113extern struct pid *find_vpid(int nr); 112extern struct pid *find_vpid(int nr);
114extern struct pid *find_pid(int nr); 113extern struct pid *find_pid(int nr);
115 114
@@ -121,7 +120,7 @@ extern struct pid *find_ge_pid(int nr, struct pid_namespace *);
121int next_pidmap(struct pid_namespace *pid_ns, int last); 120int next_pidmap(struct pid_namespace *pid_ns, int last);
122 121
123extern struct pid *alloc_pid(struct pid_namespace *ns); 122extern struct pid *alloc_pid(struct pid_namespace *ns);
124extern void FASTCALL(free_pid(struct pid *pid)); 123extern void free_pid(struct pid *pid);
125 124
126/* 125/*
127 * the helpers to get the pid's id seen from different namespaces 126 * the helpers to get the pid's id seen from different namespaces
diff --git a/include/linux/pm.h b/include/linux/pm.h
index eccf59ea2a77..015b735811b4 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -143,6 +143,9 @@ typedef struct pm_message {
143 * the upcoming system state (such as PCI_D3hot), and enable 143 * the upcoming system state (such as PCI_D3hot), and enable
144 * wakeup events as appropriate. 144 * wakeup events as appropriate.
145 * 145 *
146 * HIBERNATE Enter a low power device state appropriate for the hibernation
147 * state (eg. ACPI S4) and enable wakeup events as appropriate.
148 *
146 * FREEZE Quiesce operations so that a consistent image can be saved; 149 * FREEZE Quiesce operations so that a consistent image can be saved;
147 * but do NOT otherwise enter a low power device state, and do 150 * but do NOT otherwise enter a low power device state, and do
148 * NOT emit system wakeup events. 151 * NOT emit system wakeup events.
@@ -166,11 +169,15 @@ typedef struct pm_message {
166#define PM_EVENT_ON 0 169#define PM_EVENT_ON 0
167#define PM_EVENT_FREEZE 1 170#define PM_EVENT_FREEZE 1
168#define PM_EVENT_SUSPEND 2 171#define PM_EVENT_SUSPEND 2
169#define PM_EVENT_PRETHAW 3 172#define PM_EVENT_HIBERNATE 4
173#define PM_EVENT_PRETHAW 8
174
175#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
170 176
171#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) 177#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
172#define PMSG_PRETHAW ((struct pm_message){ .event = PM_EVENT_PRETHAW, }) 178#define PMSG_PRETHAW ((struct pm_message){ .event = PM_EVENT_PRETHAW, })
173#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) 179#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
180#define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
174#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) 181#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
175 182
176struct dev_pm_info { 183struct dev_pm_info {
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index d6a4f69bdc92..d9a9e718ad19 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -269,7 +269,7 @@ extern void kclist_add(struct kcore_list *, void *, size_t);
269#endif 269#endif
270 270
271union proc_op { 271union proc_op {
272 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); 272 int (*proc_get_link)(struct inode *, struct path *);
273 int (*proc_read)(struct task_struct *task, char *page); 273 int (*proc_read)(struct task_struct *task, char *page);
274 int (*proc_show)(struct seq_file *m, 274 int (*proc_show)(struct seq_file *m,
275 struct pid_namespace *ns, struct pid *pid, 275 struct pid_namespace *ns, struct pid *pid,
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index 813cee13da0d..6c3c0f6c261f 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -60,14 +60,14 @@ do { \
60 __init_rwsem((sem), #sem, &__key); \ 60 __init_rwsem((sem), #sem, &__key); \
61} while (0) 61} while (0)
62 62
63extern void FASTCALL(__down_read(struct rw_semaphore *sem)); 63extern void __down_read(struct rw_semaphore *sem);
64extern int FASTCALL(__down_read_trylock(struct rw_semaphore *sem)); 64extern int __down_read_trylock(struct rw_semaphore *sem);
65extern void FASTCALL(__down_write(struct rw_semaphore *sem)); 65extern void __down_write(struct rw_semaphore *sem);
66extern void FASTCALL(__down_write_nested(struct rw_semaphore *sem, int subclass)); 66extern void __down_write_nested(struct rw_semaphore *sem, int subclass);
67extern int FASTCALL(__down_write_trylock(struct rw_semaphore *sem)); 67extern int __down_write_trylock(struct rw_semaphore *sem);
68extern void FASTCALL(__up_read(struct rw_semaphore *sem)); 68extern void __up_read(struct rw_semaphore *sem);
69extern void FASTCALL(__up_write(struct rw_semaphore *sem)); 69extern void __up_write(struct rw_semaphore *sem);
70extern void FASTCALL(__downgrade_write(struct rw_semaphore *sem)); 70extern void __downgrade_write(struct rw_semaphore *sem);
71 71
72static inline int rwsem_is_locked(struct rw_semaphore *sem) 72static inline int rwsem_is_locked(struct rw_semaphore *sem)
73{ 73{
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 00e144117326..e217d188a102 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -323,7 +323,7 @@ extern char __sched_text_start[], __sched_text_end[];
323extern int in_sched_functions(unsigned long addr); 323extern int in_sched_functions(unsigned long addr);
324 324
325#define MAX_SCHEDULE_TIMEOUT LONG_MAX 325#define MAX_SCHEDULE_TIMEOUT LONG_MAX
326extern signed long FASTCALL(schedule_timeout(signed long timeout)); 326extern signed long schedule_timeout(signed long timeout);
327extern signed long schedule_timeout_interruptible(signed long timeout); 327extern signed long schedule_timeout_interruptible(signed long timeout);
328extern signed long schedule_timeout_killable(signed long timeout); 328extern signed long schedule_timeout_killable(signed long timeout);
329extern signed long schedule_timeout_uninterruptible(signed long timeout); 329extern signed long schedule_timeout_uninterruptible(signed long timeout);
@@ -590,7 +590,7 @@ struct user_struct {
590 struct hlist_node uidhash_node; 590 struct hlist_node uidhash_node;
591 uid_t uid; 591 uid_t uid;
592 592
593#ifdef CONFIG_FAIR_USER_SCHED 593#ifdef CONFIG_USER_SCHED
594 struct task_group *tg; 594 struct task_group *tg;
595#ifdef CONFIG_SYSFS 595#ifdef CONFIG_SYSFS
596 struct kobject kobj; 596 struct kobject kobj;
@@ -973,7 +973,7 @@ struct sched_rt_entity {
973 unsigned long timeout; 973 unsigned long timeout;
974 int nr_cpus_allowed; 974 int nr_cpus_allowed;
975 975
976#ifdef CONFIG_FAIR_GROUP_SCHED 976#ifdef CONFIG_RT_GROUP_SCHED
977 struct sched_rt_entity *parent; 977 struct sched_rt_entity *parent;
978 /* rq on which this entity is (to be) queued: */ 978 /* rq on which this entity is (to be) queued: */
979 struct rt_rq *rt_rq; 979 struct rt_rq *rt_rq;
@@ -1541,8 +1541,6 @@ extern unsigned int sysctl_sched_child_runs_first;
1541extern unsigned int sysctl_sched_features; 1541extern unsigned int sysctl_sched_features;
1542extern unsigned int sysctl_sched_migration_cost; 1542extern unsigned int sysctl_sched_migration_cost;
1543extern unsigned int sysctl_sched_nr_migrate; 1543extern unsigned int sysctl_sched_nr_migrate;
1544extern unsigned int sysctl_sched_rt_period;
1545extern unsigned int sysctl_sched_rt_ratio;
1546#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP) 1544#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
1547extern unsigned int sysctl_sched_min_bal_int_shares; 1545extern unsigned int sysctl_sched_min_bal_int_shares;
1548extern unsigned int sysctl_sched_max_bal_int_shares; 1546extern unsigned int sysctl_sched_max_bal_int_shares;
@@ -1552,6 +1550,8 @@ int sched_nr_latency_handler(struct ctl_table *table, int write,
1552 struct file *file, void __user *buffer, size_t *length, 1550 struct file *file, void __user *buffer, size_t *length,
1553 loff_t *ppos); 1551 loff_t *ppos);
1554#endif 1552#endif
1553extern unsigned int sysctl_sched_rt_period;
1554extern int sysctl_sched_rt_runtime;
1555 1555
1556extern unsigned int sysctl_sched_compat_yield; 1556extern unsigned int sysctl_sched_compat_yield;
1557 1557
@@ -1648,10 +1648,10 @@ extern void release_uids(struct user_namespace *ns);
1648 1648
1649extern void do_timer(unsigned long ticks); 1649extern void do_timer(unsigned long ticks);
1650 1650
1651extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state)); 1651extern int wake_up_state(struct task_struct *tsk, unsigned int state);
1652extern int FASTCALL(wake_up_process(struct task_struct * tsk)); 1652extern int wake_up_process(struct task_struct *tsk);
1653extern void FASTCALL(wake_up_new_task(struct task_struct * tsk, 1653extern void wake_up_new_task(struct task_struct *tsk,
1654 unsigned long clone_flags)); 1654 unsigned long clone_flags);
1655#ifdef CONFIG_SMP 1655#ifdef CONFIG_SMP
1656 extern void kick_process(struct task_struct *tsk); 1656 extern void kick_process(struct task_struct *tsk);
1657#else 1657#else
@@ -1741,7 +1741,7 @@ static inline int sas_ss_flags(unsigned long sp)
1741extern struct mm_struct * mm_alloc(void); 1741extern struct mm_struct * mm_alloc(void);
1742 1742
1743/* mmdrop drops the mm and the page tables */ 1743/* mmdrop drops the mm and the page tables */
1744extern void FASTCALL(__mmdrop(struct mm_struct *)); 1744extern void __mmdrop(struct mm_struct *);
1745static inline void mmdrop(struct mm_struct * mm) 1745static inline void mmdrop(struct mm_struct * mm)
1746{ 1746{
1747 if (unlikely(atomic_dec_and_test(&mm->mm_count))) 1747 if (unlikely(atomic_dec_and_test(&mm->mm_count)))
@@ -1925,7 +1925,7 @@ static inline int signal_pending(struct task_struct *p)
1925 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 1925 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
1926} 1926}
1927 1927
1928extern int FASTCALL(__fatal_signal_pending(struct task_struct *p)); 1928extern int __fatal_signal_pending(struct task_struct *p);
1929 1929
1930static inline int fatal_signal_pending(struct task_struct *p) 1930static inline int fatal_signal_pending(struct task_struct *p)
1931{ 1931{
@@ -2027,16 +2027,22 @@ extern int sched_mc_power_savings, sched_smt_power_savings;
2027 2027
2028extern void normalize_rt_tasks(void); 2028extern void normalize_rt_tasks(void);
2029 2029
2030#ifdef CONFIG_FAIR_GROUP_SCHED 2030#ifdef CONFIG_GROUP_SCHED
2031 2031
2032extern struct task_group init_task_group; 2032extern struct task_group init_task_group;
2033 2033
2034extern struct task_group *sched_create_group(void); 2034extern struct task_group *sched_create_group(void);
2035extern void sched_destroy_group(struct task_group *tg); 2035extern void sched_destroy_group(struct task_group *tg);
2036extern void sched_move_task(struct task_struct *tsk); 2036extern void sched_move_task(struct task_struct *tsk);
2037#ifdef CONFIG_FAIR_GROUP_SCHED
2037extern int sched_group_set_shares(struct task_group *tg, unsigned long shares); 2038extern int sched_group_set_shares(struct task_group *tg, unsigned long shares);
2038extern unsigned long sched_group_shares(struct task_group *tg); 2039extern unsigned long sched_group_shares(struct task_group *tg);
2039 2040#endif
2041#ifdef CONFIG_RT_GROUP_SCHED
2042extern int sched_group_set_rt_runtime(struct task_group *tg,
2043 long rt_runtime_us);
2044extern long sched_group_rt_runtime(struct task_group *tg);
2045#endif
2040#endif 2046#endif
2041 2047
2042#ifdef CONFIG_TASK_XACCT 2048#ifdef CONFIG_TASK_XACCT
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 648dfeb444db..67c2563961f3 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -8,8 +8,7 @@
8 8
9struct seq_operations; 9struct seq_operations;
10struct file; 10struct file;
11struct vfsmount; 11struct path;
12struct dentry;
13struct inode; 12struct inode;
14 13
15struct seq_file { 14struct seq_file {
@@ -42,7 +41,7 @@ int seq_puts(struct seq_file *m, const char *s);
42int seq_printf(struct seq_file *, const char *, ...) 41int seq_printf(struct seq_file *, const char *, ...)
43 __attribute__ ((format (printf,2,3))); 42 __attribute__ ((format (printf,2,3)));
44 43
45int seq_path(struct seq_file *, struct vfsmount *, struct dentry *, char *); 44int seq_path(struct seq_file *, struct path *, char *);
46 45
47int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 46int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
48int single_release(struct inode *, struct file *); 47int single_release(struct inode *, struct file *);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 1a0b6cf83ff1..289942fc6655 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -149,6 +149,8 @@
149/* Freescale ColdFire */ 149/* Freescale ColdFire */
150#define PORT_MCF 78 150#define PORT_MCF 78
151 151
152#define PORT_SC26XX 79
153
152 154
153/* MN10300 on-chip UART numbers */ 155/* MN10300 on-chip UART numbers */
154#define PORT_MN10300 80 156#define PORT_MN10300 80
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 5e6d3d634d5b..57deecc79d52 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -71,6 +71,7 @@ struct kmem_cache {
71 71
72 /* Allocation and freeing of slabs */ 72 /* Allocation and freeing of slabs */
73 int objects; /* Number of objects in slab */ 73 int objects; /* Number of objects in slab */
74 gfp_t allocflags; /* gfp flags to use on each alloc */
74 int refcount; /* Refcount for slab cache destroy */ 75 int refcount; /* Refcount for slab cache destroy */
75 void (*ctor)(struct kmem_cache *, void *); 76 void (*ctor)(struct kmem_cache *, void *);
76 int inuse; /* Offset to metadata */ 77 int inuse; /* Offset to metadata */
@@ -110,7 +111,7 @@ struct kmem_cache {
110 * We keep the general caches in an array of slab caches that are used for 111 * We keep the general caches in an array of slab caches that are used for
111 * 2^x bytes of allocations. 112 * 2^x bytes of allocations.
112 */ 113 */
113extern struct kmem_cache kmalloc_caches[PAGE_SHIFT]; 114extern struct kmem_cache kmalloc_caches[PAGE_SHIFT + 1];
114 115
115/* 116/*
116 * Sorry that the following has to be that ugly but some versions of GCC 117 * Sorry that the following has to be that ugly but some versions of GCC
@@ -188,12 +189,16 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
188void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 189void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
189void *__kmalloc(size_t size, gfp_t flags); 190void *__kmalloc(size_t size, gfp_t flags);
190 191
192static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
193{
194 return (void *)__get_free_pages(flags | __GFP_COMP, get_order(size));
195}
196
191static __always_inline void *kmalloc(size_t size, gfp_t flags) 197static __always_inline void *kmalloc(size_t size, gfp_t flags)
192{ 198{
193 if (__builtin_constant_p(size)) { 199 if (__builtin_constant_p(size)) {
194 if (size > PAGE_SIZE / 2) 200 if (size > PAGE_SIZE)
195 return (void *)__get_free_pages(flags | __GFP_COMP, 201 return kmalloc_large(size, flags);
196 get_order(size));
197 202
198 if (!(flags & SLUB_DMA)) { 203 if (!(flags & SLUB_DMA)) {
199 struct kmem_cache *s = kmalloc_slab(size); 204 struct kmem_cache *s = kmalloc_slab(size);
@@ -214,7 +219,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
214static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) 219static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
215{ 220{
216 if (__builtin_constant_p(size) && 221 if (__builtin_constant_p(size) &&
217 size <= PAGE_SIZE / 2 && !(flags & SLUB_DMA)) { 222 size <= PAGE_SIZE && !(flags & SLUB_DMA)) {
218 struct kmem_cache *s = kmalloc_slab(size); 223 struct kmem_cache *s = kmalloc_slab(size);
219 224
220 if (!s) 225 if (!s)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 3ca5c4bd6d3f..878459ae0454 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -171,10 +171,10 @@ extern unsigned int nr_free_pagecache_pages(void);
171 171
172 172
173/* linux/mm/swap.c */ 173/* linux/mm/swap.c */
174extern void FASTCALL(lru_cache_add(struct page *)); 174extern void lru_cache_add(struct page *);
175extern void FASTCALL(lru_cache_add_active(struct page *)); 175extern void lru_cache_add_active(struct page *);
176extern void FASTCALL(activate_page(struct page *)); 176extern void activate_page(struct page *);
177extern void FASTCALL(mark_page_accessed(struct page *)); 177extern void mark_page_accessed(struct page *);
178extern void lru_add_drain(void); 178extern void lru_add_drain(void);
179extern int lru_add_drain_all(void); 179extern int lru_add_drain_all(void);
180extern int rotate_reclaimable_page(struct page *page); 180extern int rotate_reclaimable_page(struct page *page);
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 52e3d5fd5be4..9385a566aed8 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -12,6 +12,7 @@
12#ifndef __LINUX_VIDEODEV_H 12#ifndef __LINUX_VIDEODEV_H
13#define __LINUX_VIDEODEV_H 13#define __LINUX_VIDEODEV_H
14 14
15#include <linux/ioctl.h>
15#include <linux/videodev2.h> 16#include <linux/videodev2.h>
16 17
17#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) 18#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 439474f24e34..17a80177a674 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -62,6 +62,7 @@
62#define __user 62#define __user
63#include <sys/time.h> 63#include <sys/time.h>
64#endif 64#endif
65#include <linux/ioctl.h>
65#include <linux/types.h> 66#include <linux/types.h>
66 67
67/* 68/*
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 33a2aa9e02f2..0081147a9fe8 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -117,9 +117,9 @@ static inline int waitqueue_active(wait_queue_head_t *q)
117 */ 117 */
118#define is_sync_wait(wait) (!(wait) || ((wait)->private)) 118#define is_sync_wait(wait) (!(wait) || ((wait)->private))
119 119
120extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); 120extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
121extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)); 121extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait);
122extern void FASTCALL(remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)); 122extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
123 123
124static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new) 124static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new)
125{ 125{
@@ -141,16 +141,16 @@ static inline void __remove_wait_queue(wait_queue_head_t *head,
141 list_del(&old->task_list); 141 list_del(&old->task_list);
142} 142}
143 143
144void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key)); 144void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
145extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode)); 145extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode);
146extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr)); 146extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
147void FASTCALL(__wake_up_bit(wait_queue_head_t *, void *, int)); 147void __wake_up_bit(wait_queue_head_t *, void *, int);
148int FASTCALL(__wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned)); 148int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
149int FASTCALL(__wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned)); 149int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
150void FASTCALL(wake_up_bit(void *, int)); 150void wake_up_bit(void *, int);
151int FASTCALL(out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned)); 151int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned);
152int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned)); 152int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned);
153wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int)); 153wait_queue_head_t *bit_waitqueue(void *, int);
154 154
155#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) 155#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
156#define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) 156#define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL)
@@ -437,11 +437,9 @@ extern long interruptible_sleep_on_timeout(wait_queue_head_t *q,
437/* 437/*
438 * Waitqueues which are removed from the waitqueue_head at wakeup time 438 * Waitqueues which are removed from the waitqueue_head at wakeup time
439 */ 439 */
440void FASTCALL(prepare_to_wait(wait_queue_head_t *q, 440void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
441 wait_queue_t *wait, int state)); 441void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state);
442void FASTCALL(prepare_to_wait_exclusive(wait_queue_head_t *q, 442void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
443 wait_queue_t *wait, int state));
444void FASTCALL(finish_wait(wait_queue_head_t *q, wait_queue_t *wait));
445int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 443int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
446int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 444int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
447 445
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 7f28c32d9aca..542526c6e8ef 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -178,18 +178,17 @@ __create_workqueue_key(const char *name, int singlethread,
178 178
179extern void destroy_workqueue(struct workqueue_struct *wq); 179extern void destroy_workqueue(struct workqueue_struct *wq);
180 180
181extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work)); 181extern int queue_work(struct workqueue_struct *wq, struct work_struct *work);
182extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, 182extern int queue_delayed_work(struct workqueue_struct *wq,
183 struct delayed_work *work, unsigned long delay)); 183 struct delayed_work *work, unsigned long delay);
184extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 184extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
185 struct delayed_work *work, unsigned long delay); 185 struct delayed_work *work, unsigned long delay);
186 186
187extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq)); 187extern void flush_workqueue(struct workqueue_struct *wq);
188extern void flush_scheduled_work(void); 188extern void flush_scheduled_work(void);
189 189
190extern int FASTCALL(schedule_work(struct work_struct *work)); 190extern int schedule_work(struct work_struct *work);
191extern int FASTCALL(schedule_delayed_work(struct delayed_work *work, 191extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay);
192 unsigned long delay));
193extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, 192extern int schedule_delayed_work_on(int cpu, struct delayed_work *work,
194 unsigned long delay); 193 unsigned long delay);
195extern int schedule_on_each_cpu(work_func_t func); 194extern int schedule_on_each_cpu(work_func_t func);
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 831547d79683..a4274203f252 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -142,6 +142,7 @@ extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE];
142extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE]; 142extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE];
143extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE]; 143extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE];
144extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE]; 144extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE];
145extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE];
145 146
146#endif 147#endif
147 148
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 475d0d8275e0..316a58453134 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -61,8 +61,6 @@
61 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \ 61 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
62 } while (0) 62 } while (0)
63 63
64/* Prints the ioctl in a human-readable format */
65extern void v4l_printk_ioctl(unsigned int cmd);
66 64
67/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ 65/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
68#define v4l_print_ioctl(name, cmd) \ 66#define v4l_print_ioctl(name, cmd) \
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index c544c6f90893..f2114459995d 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -44,6 +44,8 @@ extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
44extern char *v4l2_norm_to_name(v4l2_std_id id); 44extern char *v4l2_norm_to_name(v4l2_std_id id);
45extern int v4l2_video_std_construct(struct v4l2_standard *vs, 45extern int v4l2_video_std_construct(struct v4l2_standard *vs,
46 int id, char *name); 46 int id, char *name);
47/* Prints the ioctl in a human-readable format */
48extern void v4l_printk_ioctl(unsigned int cmd);
47 49
48/* prority handling */ 50/* prority handling */
49struct v4l2_prio_state { 51struct v4l2_prio_state {
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 97f14d469595..99033945cdee 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -149,7 +149,7 @@ struct videobuf_qtype_ops {
149}; 149};
150 150
151struct videobuf_queue { 151struct videobuf_queue {
152 struct mutex lock; 152 struct mutex vb_lock;
153 spinlock_t *irqlock; 153 spinlock_t *irqlock;
154 void *dev; /* on pci, points to struct pci_dev */ 154 void *dev; /* on pci, points to struct pci_dev */
155 155
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h
index 26a8958d23d1..ec63ab0fab93 100644
--- a/include/media/videobuf-vmalloc.h
+++ b/include/media/videobuf-vmalloc.h
@@ -17,7 +17,7 @@
17 17
18/* --------------------------------------------------------------------- */ 18/* --------------------------------------------------------------------- */
19 19
20struct videbuf_vmalloc_memory 20struct videobuf_vmalloc_memory
21{ 21{
22 u32 magic; 22 u32 magic;
23 23
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index d1299e999723..530ff4c553f8 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -6,6 +6,7 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/mutex.h> 8#include <linux/mutex.h>
9#include <scsi/scsi.h>
9 10
10struct request_queue; 11struct request_queue;
11struct block_device; 12struct block_device;
@@ -25,12 +26,15 @@ struct blk_queue_tags;
25 * NONE: Self evident. Host adapter is not capable of scatter-gather. 26 * NONE: Self evident. Host adapter is not capable of scatter-gather.
26 * ALL: Means that the host adapter module can do scatter-gather, 27 * ALL: Means that the host adapter module can do scatter-gather,
27 * and that there is no limit to the size of the table to which 28 * and that there is no limit to the size of the table to which
28 * we scatter/gather data. 29 * we scatter/gather data. The value we set here is the maximum
30 * single element sglist. To use chained sglists, the adapter
31 * has to set a value beyond ALL (and correctly use the chain
32 * handling API.
29 * Anything else: Indicates the maximum number of chains that can be 33 * Anything else: Indicates the maximum number of chains that can be
30 * used in one scatter-gather request. 34 * used in one scatter-gather request.
31 */ 35 */
32#define SG_NONE 0 36#define SG_NONE 0
33#define SG_ALL 0xff 37#define SG_ALL SCSI_MAX_SG_SEGMENTS
34 38
35#define MODE_UNKNOWN 0x00 39#define MODE_UNKNOWN 0x00
36#define MODE_INITIATOR 0x01 40#define MODE_INITIATOR 0x01
diff --git a/include/sound/opl3.h b/include/sound/opl3.h
index a0c5febdc4ea..6ba670707831 100644
--- a/include/sound/opl3.h
+++ b/include/sound/opl3.h
@@ -370,12 +370,13 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device,
370int snd_opl3_open(struct snd_hwdep * hw, struct file *file); 370int snd_opl3_open(struct snd_hwdep * hw, struct file *file);
371int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, 371int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
372 unsigned int cmd, unsigned long arg); 372 unsigned int cmd, unsigned long arg);
373long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count,
374 loff_t *offset);
375int snd_opl3_release(struct snd_hwdep * hw, struct file *file); 373int snd_opl3_release(struct snd_hwdep * hw, struct file *file);
376 374
377void snd_opl3_reset(struct snd_opl3 * opl3); 375void snd_opl3_reset(struct snd_opl3 * opl3);
378 376
377#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
378long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count,
379 loff_t *offset);
379int snd_opl3_load_patch(struct snd_opl3 *opl3, 380int snd_opl3_load_patch(struct snd_opl3 *opl3,
380 int prog, int bank, int type, 381 int prog, int bank, int type,
381 const char *name, 382 const char *name,
@@ -384,5 +385,9 @@ int snd_opl3_load_patch(struct snd_opl3 *opl3,
384struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank, 385struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank,
385 int create_patch); 386 int create_patch);
386void snd_opl3_clear_patches(struct snd_opl3 *opl3); 387void snd_opl3_clear_patches(struct snd_opl3 *opl3);
388#else
389#define snd_opl3_write NULL
390static inline void snd_opl3_clear_patches(struct snd_opl3 *opl3) {}
391#endif
387 392
388#endif /* __SOUND_OPL3_H */ 393#endif /* __SOUND_OPL3_H */
diff --git a/init/Kconfig b/init/Kconfig
index 824d48cb67bf..f698a5af5007 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -311,25 +311,36 @@ config CPUSETS
311 311
312 Say N if unsure. 312 Say N if unsure.
313 313
314config FAIR_GROUP_SCHED 314config GROUP_SCHED
315 bool "Fair group CPU scheduler" 315 bool "Group CPU scheduler"
316 default y 316 default y
317 help 317 help
318 This feature lets CPU scheduler recognize task groups and control CPU 318 This feature lets CPU scheduler recognize task groups and control CPU
319 bandwidth allocation to such task groups. 319 bandwidth allocation to such task groups.
320 320
321config FAIR_GROUP_SCHED
322 bool "Group scheduling for SCHED_OTHER"
323 depends on GROUP_SCHED
324 default y
325
326config RT_GROUP_SCHED
327 bool "Group scheduling for SCHED_RR/FIFO"
328 depends on EXPERIMENTAL
329 depends on GROUP_SCHED
330 default n
331
321choice 332choice
322 depends on FAIR_GROUP_SCHED 333 depends on GROUP_SCHED
323 prompt "Basis for grouping tasks" 334 prompt "Basis for grouping tasks"
324 default FAIR_USER_SCHED 335 default USER_SCHED
325 336
326config FAIR_USER_SCHED 337config USER_SCHED
327 bool "user id" 338 bool "user id"
328 help 339 help
329 This option will choose userid as the basis for grouping 340 This option will choose userid as the basis for grouping
330 tasks, thus providing equal CPU bandwidth to each user. 341 tasks, thus providing equal CPU bandwidth to each user.
331 342
332config FAIR_CGROUP_SCHED 343config CGROUP_SCHED
333 bool "Control groups" 344 bool "Control groups"
334 depends on CGROUPS 345 depends on CGROUPS
335 help 346 help
@@ -383,6 +394,14 @@ config CGROUP_MEM_CONT
383 Provides a memory controller that manages both page cache and 394 Provides a memory controller that manages both page cache and
384 RSS memory. 395 RSS memory.
385 396
397 Note that setting this option increases fixed memory overhead
398 associated with each page of memory in the system by 4/8 bytes
399 and also increases cache misses because struct page on many 64bit
400 systems will not fit into a single cache line anymore.
401
402 Only enable when you're ok with these trade offs and really
403 sure you need the memory controller.
404
386config PROC_PID_CPUSET 405config PROC_PID_CPUSET
387 bool "Include legacy /proc/<pid>/cpuset file" 406 bool "Include legacy /proc/<pid>/cpuset file"
388 depends on CPUSETS 407 depends on CPUSETS
diff --git a/init/do_mounts.c b/init/do_mounts.c
index f86573126f83..3885e70e7759 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -193,10 +193,10 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)
193 return err; 193 return err;
194 194
195 sys_chdir("/root"); 195 sys_chdir("/root");
196 ROOT_DEV = current->fs->pwdmnt->mnt_sb->s_dev; 196 ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev;
197 printk("VFS: Mounted root (%s filesystem)%s.\n", 197 printk("VFS: Mounted root (%s filesystem)%s.\n",
198 current->fs->pwdmnt->mnt_sb->s_type->name, 198 current->fs->pwd.mnt->mnt_sb->s_type->name,
199 current->fs->pwdmnt->mnt_sb->s_flags & MS_RDONLY ? 199 current->fs->pwd.mnt->mnt_sb->s_flags & MS_RDONLY ?
200 " readonly" : ""); 200 " readonly" : "");
201 return 0; 201 return 0;
202} 202}
diff --git a/kernel/audit.c b/kernel/audit.c
index c8555b180213..2eeea9a14240 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1312,26 +1312,26 @@ void audit_log_untrustedstring(struct audit_buffer *ab, const char *string)
1312 1312
1313/* This is a helper-function to print the escaped d_path */ 1313/* This is a helper-function to print the escaped d_path */
1314void audit_log_d_path(struct audit_buffer *ab, const char *prefix, 1314void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
1315 struct dentry *dentry, struct vfsmount *vfsmnt) 1315 struct path *path)
1316{ 1316{
1317 char *p, *path; 1317 char *p, *pathname;
1318 1318
1319 if (prefix) 1319 if (prefix)
1320 audit_log_format(ab, " %s", prefix); 1320 audit_log_format(ab, " %s", prefix);
1321 1321
1322 /* We will allow 11 spaces for ' (deleted)' to be appended */ 1322 /* We will allow 11 spaces for ' (deleted)' to be appended */
1323 path = kmalloc(PATH_MAX+11, ab->gfp_mask); 1323 pathname = kmalloc(PATH_MAX+11, ab->gfp_mask);
1324 if (!path) { 1324 if (!pathname) {
1325 audit_log_format(ab, "<no memory>"); 1325 audit_log_format(ab, "<no memory>");
1326 return; 1326 return;
1327 } 1327 }
1328 p = d_path(dentry, vfsmnt, path, PATH_MAX+11); 1328 p = d_path(path, pathname, PATH_MAX+11);
1329 if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */ 1329 if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */
1330 /* FIXME: can we save some information here? */ 1330 /* FIXME: can we save some information here? */
1331 audit_log_format(ab, "<too long>"); 1331 audit_log_format(ab, "<too long>");
1332 } else 1332 } else
1333 audit_log_untrustedstring(ab, p); 1333 audit_log_untrustedstring(ab, p);
1334 kfree(path); 1334 kfree(pathname);
1335} 1335}
1336 1336
1337/** 1337/**
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index f4fcf58f20f8..9ef5e0aacc3c 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -549,8 +549,8 @@ void audit_trim_trees(void)
549 if (err) 549 if (err)
550 goto skip_it; 550 goto skip_it;
551 551
552 root_mnt = collect_mounts(nd.mnt, nd.dentry); 552 root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
553 path_release(&nd); 553 path_put(&nd.path);
554 if (!root_mnt) 554 if (!root_mnt)
555 goto skip_it; 555 goto skip_it;
556 556
@@ -583,17 +583,17 @@ skip_it:
583static int is_under(struct vfsmount *mnt, struct dentry *dentry, 583static int is_under(struct vfsmount *mnt, struct dentry *dentry,
584 struct nameidata *nd) 584 struct nameidata *nd)
585{ 585{
586 if (mnt != nd->mnt) { 586 if (mnt != nd->path.mnt) {
587 for (;;) { 587 for (;;) {
588 if (mnt->mnt_parent == mnt) 588 if (mnt->mnt_parent == mnt)
589 return 0; 589 return 0;
590 if (mnt->mnt_parent == nd->mnt) 590 if (mnt->mnt_parent == nd->path.mnt)
591 break; 591 break;
592 mnt = mnt->mnt_parent; 592 mnt = mnt->mnt_parent;
593 } 593 }
594 dentry = mnt->mnt_mountpoint; 594 dentry = mnt->mnt_mountpoint;
595 } 595 }
596 return is_subdir(dentry, nd->dentry); 596 return is_subdir(dentry, nd->path.dentry);
597} 597}
598 598
599int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op) 599int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op)
@@ -641,8 +641,8 @@ int audit_add_tree_rule(struct audit_krule *rule)
641 err = path_lookup(tree->pathname, 0, &nd); 641 err = path_lookup(tree->pathname, 0, &nd);
642 if (err) 642 if (err)
643 goto Err; 643 goto Err;
644 mnt = collect_mounts(nd.mnt, nd.dentry); 644 mnt = collect_mounts(nd.path.mnt, nd.path.dentry);
645 path_release(&nd); 645 path_put(&nd.path);
646 if (!mnt) { 646 if (!mnt) {
647 err = -ENOMEM; 647 err = -ENOMEM;
648 goto Err; 648 goto Err;
@@ -701,8 +701,8 @@ int audit_tag_tree(char *old, char *new)
701 err = path_lookup(new, 0, &nd); 701 err = path_lookup(new, 0, &nd);
702 if (err) 702 if (err)
703 return err; 703 return err;
704 tagged = collect_mounts(nd.mnt, nd.dentry); 704 tagged = collect_mounts(nd.path.mnt, nd.path.dentry);
705 path_release(&nd); 705 path_put(&nd.path);
706 if (!tagged) 706 if (!tagged)
707 return -ENOMEM; 707 return -ENOMEM;
708 708
@@ -711,9 +711,9 @@ int audit_tag_tree(char *old, char *new)
711 drop_collected_mounts(tagged); 711 drop_collected_mounts(tagged);
712 return err; 712 return err;
713 } 713 }
714 mnt = mntget(nd.mnt); 714 mnt = mntget(nd.path.mnt);
715 dentry = dget(nd.dentry); 715 dentry = dget(nd.path.dentry);
716 path_release(&nd); 716 path_put(&nd.path);
717 717
718 if (dentry == tagged->mnt_root && dentry == mnt->mnt_root) 718 if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)
719 follow_up(&mnt, &dentry); 719 follow_up(&mnt, &dentry);
@@ -744,13 +744,13 @@ int audit_tag_tree(char *old, char *new)
744 spin_lock(&vfsmount_lock); 744 spin_lock(&vfsmount_lock);
745 if (!is_under(mnt, dentry, &nd)) { 745 if (!is_under(mnt, dentry, &nd)) {
746 spin_unlock(&vfsmount_lock); 746 spin_unlock(&vfsmount_lock);
747 path_release(&nd); 747 path_put(&nd.path);
748 put_tree(tree); 748 put_tree(tree);
749 mutex_lock(&audit_filter_mutex); 749 mutex_lock(&audit_filter_mutex);
750 continue; 750 continue;
751 } 751 }
752 spin_unlock(&vfsmount_lock); 752 spin_unlock(&vfsmount_lock);
753 path_release(&nd); 753 path_put(&nd.path);
754 754
755 list_for_each_entry(p, &list, mnt_list) { 755 list_for_each_entry(p, &list, mnt_list) {
756 failed = tag_chunk(p->mnt_root->d_inode, tree); 756 failed = tag_chunk(p->mnt_root->d_inode, tree);
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 6f19fd477aac..2f2914b7cc30 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -169,8 +169,8 @@ static struct audit_parent *audit_init_parent(struct nameidata *ndp)
169 inotify_init_watch(&parent->wdata); 169 inotify_init_watch(&parent->wdata);
170 /* grab a ref so inotify watch hangs around until we take audit_filter_mutex */ 170 /* grab a ref so inotify watch hangs around until we take audit_filter_mutex */
171 get_inotify_watch(&parent->wdata); 171 get_inotify_watch(&parent->wdata);
172 wd = inotify_add_watch(audit_ih, &parent->wdata, ndp->dentry->d_inode, 172 wd = inotify_add_watch(audit_ih, &parent->wdata,
173 AUDIT_IN_WATCH); 173 ndp->path.dentry->d_inode, AUDIT_IN_WATCH);
174 if (wd < 0) { 174 if (wd < 0) {
175 audit_free_parent(&parent->wdata); 175 audit_free_parent(&parent->wdata);
176 return ERR_PTR(wd); 176 return ERR_PTR(wd);
@@ -1161,11 +1161,11 @@ static int audit_get_nd(char *path, struct nameidata **ndp,
1161static void audit_put_nd(struct nameidata *ndp, struct nameidata *ndw) 1161static void audit_put_nd(struct nameidata *ndp, struct nameidata *ndw)
1162{ 1162{
1163 if (ndp) { 1163 if (ndp) {
1164 path_release(ndp); 1164 path_put(&ndp->path);
1165 kfree(ndp); 1165 kfree(ndp);
1166 } 1166 }
1167 if (ndw) { 1167 if (ndw) {
1168 path_release(ndw); 1168 path_put(&ndw->path);
1169 kfree(ndw); 1169 kfree(ndw);
1170 } 1170 }
1171} 1171}
@@ -1214,8 +1214,8 @@ static int audit_add_watch(struct audit_krule *krule, struct nameidata *ndp,
1214 1214
1215 /* update watch filter fields */ 1215 /* update watch filter fields */
1216 if (ndw) { 1216 if (ndw) {
1217 watch->dev = ndw->dentry->d_inode->i_sb->s_dev; 1217 watch->dev = ndw->path.dentry->d_inode->i_sb->s_dev;
1218 watch->ino = ndw->dentry->d_inode->i_ino; 1218 watch->ino = ndw->path.dentry->d_inode->i_ino;
1219 } 1219 }
1220 1220
1221 /* The audit_filter_mutex must not be held during inotify calls because 1221 /* The audit_filter_mutex must not be held during inotify calls because
@@ -1225,7 +1225,8 @@ static int audit_add_watch(struct audit_krule *krule, struct nameidata *ndp,
1225 */ 1225 */
1226 mutex_unlock(&audit_filter_mutex); 1226 mutex_unlock(&audit_filter_mutex);
1227 1227
1228 if (inotify_find_watch(audit_ih, ndp->dentry->d_inode, &i_watch) < 0) { 1228 if (inotify_find_watch(audit_ih, ndp->path.dentry->d_inode,
1229 &i_watch) < 0) {
1229 parent = audit_init_parent(ndp); 1230 parent = audit_init_parent(ndp);
1230 if (IS_ERR(parent)) { 1231 if (IS_ERR(parent)) {
1231 /* caller expects mutex locked */ 1232 /* caller expects mutex locked */
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 1c06ecf38d7b..2087d6de67ea 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -208,8 +208,7 @@ struct audit_context {
208 int name_count; 208 int name_count;
209 struct audit_names names[AUDIT_NAMES]; 209 struct audit_names names[AUDIT_NAMES];
210 char * filterkey; /* key for rule that triggered record */ 210 char * filterkey; /* key for rule that triggered record */
211 struct dentry * pwd; 211 struct path pwd;
212 struct vfsmount * pwdmnt;
213 struct audit_context *previous; /* For nested syscalls */ 212 struct audit_context *previous; /* For nested syscalls */
214 struct audit_aux_data *aux; 213 struct audit_aux_data *aux;
215 struct audit_aux_data *aux_pids; 214 struct audit_aux_data *aux_pids;
@@ -786,12 +785,9 @@ static inline void audit_free_names(struct audit_context *context)
786 __putname(context->names[i].name); 785 __putname(context->names[i].name);
787 } 786 }
788 context->name_count = 0; 787 context->name_count = 0;
789 if (context->pwd) 788 path_put(&context->pwd);
790 dput(context->pwd); 789 context->pwd.dentry = NULL;
791 if (context->pwdmnt) 790 context->pwd.mnt = NULL;
792 mntput(context->pwdmnt);
793 context->pwd = NULL;
794 context->pwdmnt = NULL;
795} 791}
796 792
797static inline void audit_free_aux(struct audit_context *context) 793static inline void audit_free_aux(struct audit_context *context)
@@ -930,8 +926,7 @@ static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk
930 if ((vma->vm_flags & VM_EXECUTABLE) && 926 if ((vma->vm_flags & VM_EXECUTABLE) &&
931 vma->vm_file) { 927 vma->vm_file) {
932 audit_log_d_path(ab, "exe=", 928 audit_log_d_path(ab, "exe=",
933 vma->vm_file->f_path.dentry, 929 &vma->vm_file->f_path);
934 vma->vm_file->f_path.mnt);
935 break; 930 break;
936 } 931 }
937 vma = vma->vm_next; 932 vma = vma->vm_next;
@@ -1005,9 +1000,10 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1005 * for strings that are too long, we should not have created 1000 * for strings that are too long, we should not have created
1006 * any. 1001 * any.
1007 */ 1002 */
1008 if (unlikely((len = -1) || len > MAX_ARG_STRLEN - 1)) { 1003 if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) {
1009 WARN_ON(1); 1004 WARN_ON(1);
1010 send_sig(SIGKILL, current, 0); 1005 send_sig(SIGKILL, current, 0);
1006 return -1;
1011 } 1007 }
1012 1008
1013 /* walk the whole argument looking for non-ascii chars */ 1009 /* walk the whole argument looking for non-ascii chars */
@@ -1025,6 +1021,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1025 if (ret) { 1021 if (ret) {
1026 WARN_ON(1); 1022 WARN_ON(1);
1027 send_sig(SIGKILL, current, 0); 1023 send_sig(SIGKILL, current, 0);
1024 return -1;
1028 } 1025 }
1029 buf[to_send] = '\0'; 1026 buf[to_send] = '\0';
1030 has_cntl = audit_string_contains_control(buf, to_send); 1027 has_cntl = audit_string_contains_control(buf, to_send);
@@ -1088,6 +1085,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1088 if (ret) { 1085 if (ret) {
1089 WARN_ON(1); 1086 WARN_ON(1);
1090 send_sig(SIGKILL, current, 0); 1087 send_sig(SIGKILL, current, 0);
1088 return -1;
1091 } 1089 }
1092 buf[to_send] = '\0'; 1090 buf[to_send] = '\0';
1093 1091
@@ -1341,10 +1339,10 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1341 context->target_sid, context->target_comm)) 1339 context->target_sid, context->target_comm))
1342 call_panic = 1; 1340 call_panic = 1;
1343 1341
1344 if (context->pwd && context->pwdmnt) { 1342 if (context->pwd.dentry && context->pwd.mnt) {
1345 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD); 1343 ab = audit_log_start(context, GFP_KERNEL, AUDIT_CWD);
1346 if (ab) { 1344 if (ab) {
1347 audit_log_d_path(ab, "cwd=", context->pwd, context->pwdmnt); 1345 audit_log_d_path(ab, "cwd=", &context->pwd);
1348 audit_log_end(ab); 1346 audit_log_end(ab);
1349 } 1347 }
1350 } 1348 }
@@ -1367,8 +1365,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
1367 case 0: 1365 case 0:
1368 /* name was specified as a relative path and the 1366 /* name was specified as a relative path and the
1369 * directory component is the cwd */ 1367 * directory component is the cwd */
1370 audit_log_d_path(ab, " name=", context->pwd, 1368 audit_log_d_path(ab, " name=", &context->pwd);
1371 context->pwdmnt);
1372 break; 1369 break;
1373 default: 1370 default:
1374 /* log the name's directory component */ 1371 /* log the name's directory component */
@@ -1695,10 +1692,10 @@ void __audit_getname(const char *name)
1695 context->names[context->name_count].ino = (unsigned long)-1; 1692 context->names[context->name_count].ino = (unsigned long)-1;
1696 context->names[context->name_count].osid = 0; 1693 context->names[context->name_count].osid = 0;
1697 ++context->name_count; 1694 ++context->name_count;
1698 if (!context->pwd) { 1695 if (!context->pwd.dentry) {
1699 read_lock(&current->fs->lock); 1696 read_lock(&current->fs->lock);
1700 context->pwd = dget(current->fs->pwd); 1697 context->pwd = current->fs->pwd;
1701 context->pwdmnt = mntget(current->fs->pwdmnt); 1698 path_get(&current->fs->pwd);
1702 read_unlock(&current->fs->lock); 1699 read_unlock(&current->fs->lock);
1703 } 1700 }
1704 1701
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4766bb65e4d9..d8abe996e009 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -113,9 +113,9 @@ static int root_count;
113#define dummytop (&rootnode.top_cgroup) 113#define dummytop (&rootnode.top_cgroup)
114 114
115/* This flag indicates whether tasks in the fork and exit paths should 115/* This flag indicates whether tasks in the fork and exit paths should
116 * take callback_mutex and check for fork/exit handlers to call. This 116 * check for fork/exit handlers to call. This avoids us having to do
117 * avoids us having to do extra work in the fork/exit path if none of the 117 * extra work in the fork/exit path if none of the subsystems need to
118 * subsystems need to be called. 118 * be called.
119 */ 119 */
120static int need_forkexit_callback; 120static int need_forkexit_callback;
121 121
@@ -307,7 +307,6 @@ static inline void put_css_set_taskexit(struct css_set *cg)
307 * template: location in which to build the desired set of subsystem 307 * template: location in which to build the desired set of subsystem
308 * state objects for the new cgroup group 308 * state objects for the new cgroup group
309 */ 309 */
310
311static struct css_set *find_existing_css_set( 310static struct css_set *find_existing_css_set(
312 struct css_set *oldcg, 311 struct css_set *oldcg,
313 struct cgroup *cgrp, 312 struct cgroup *cgrp,
@@ -320,7 +319,7 @@ static struct css_set *find_existing_css_set(
320 /* Built the set of subsystem state objects that we want to 319 /* Built the set of subsystem state objects that we want to
321 * see in the new css_set */ 320 * see in the new css_set */
322 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { 321 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
323 if (root->subsys_bits & (1ull << i)) { 322 if (root->subsys_bits & (1UL << i)) {
324 /* Subsystem is in this hierarchy. So we want 323 /* Subsystem is in this hierarchy. So we want
325 * the subsystem state from the new 324 * the subsystem state from the new
326 * cgroup */ 325 * cgroup */
@@ -354,7 +353,6 @@ static struct css_set *find_existing_css_set(
354 * and chains them on tmp through their cgrp_link_list fields. Returns 0 on 353 * and chains them on tmp through their cgrp_link_list fields. Returns 0 on
355 * success or a negative error 354 * success or a negative error
356 */ 355 */
357
358static int allocate_cg_links(int count, struct list_head *tmp) 356static int allocate_cg_links(int count, struct list_head *tmp)
359{ 357{
360 struct cg_cgroup_link *link; 358 struct cg_cgroup_link *link;
@@ -396,7 +394,6 @@ static void free_cg_links(struct list_head *tmp)
396 * substituted into the appropriate hierarchy. Must be called with 394 * substituted into the appropriate hierarchy. Must be called with
397 * cgroup_mutex held 395 * cgroup_mutex held
398 */ 396 */
399
400static struct css_set *find_css_set( 397static struct css_set *find_css_set(
401 struct css_set *oldcg, struct cgroup *cgrp) 398 struct css_set *oldcg, struct cgroup *cgrp)
402{ 399{
@@ -473,7 +470,6 @@ static struct css_set *find_css_set(
473 /* Link this cgroup group into the list */ 470 /* Link this cgroup group into the list */
474 list_add(&res->list, &init_css_set.list); 471 list_add(&res->list, &init_css_set.list);
475 css_set_count++; 472 css_set_count++;
476 INIT_LIST_HEAD(&res->tasks);
477 write_unlock(&css_set_lock); 473 write_unlock(&css_set_lock);
478 474
479 return res; 475 return res;
@@ -507,8 +503,8 @@ static struct css_set *find_css_set(
507 * critical pieces of code here. The exception occurs on cgroup_exit(), 503 * critical pieces of code here. The exception occurs on cgroup_exit(),
508 * when a task in a notify_on_release cgroup exits. Then cgroup_mutex 504 * when a task in a notify_on_release cgroup exits. Then cgroup_mutex
509 * is taken, and if the cgroup count is zero, a usermode call made 505 * is taken, and if the cgroup count is zero, a usermode call made
510 * to /sbin/cgroup_release_agent with the name of the cgroup (path 506 * to the release agent with the name of the cgroup (path relative to
511 * relative to the root of cgroup file system) as the argument. 507 * the root of cgroup file system) as the argument.
512 * 508 *
513 * A cgroup can only be deleted if both its 'count' of using tasks 509 * A cgroup can only be deleted if both its 'count' of using tasks
514 * is zero, and its list of 'children' cgroups is empty. Since all 510 * is zero, and its list of 'children' cgroups is empty. Since all
@@ -521,7 +517,7 @@ static struct css_set *find_css_set(
521 * 517 *
522 * The need for this exception arises from the action of 518 * The need for this exception arises from the action of
523 * cgroup_attach_task(), which overwrites one tasks cgroup pointer with 519 * cgroup_attach_task(), which overwrites one tasks cgroup pointer with
524 * another. It does so using cgroup_mutexe, however there are 520 * another. It does so using cgroup_mutex, however there are
525 * several performance critical places that need to reference 521 * several performance critical places that need to reference
526 * task->cgroup without the expense of grabbing a system global 522 * task->cgroup without the expense of grabbing a system global
527 * mutex. Therefore except as noted below, when dereferencing or, as 523 * mutex. Therefore except as noted below, when dereferencing or, as
@@ -537,7 +533,6 @@ static struct css_set *find_css_set(
537 * cgroup_lock - lock out any changes to cgroup structures 533 * cgroup_lock - lock out any changes to cgroup structures
538 * 534 *
539 */ 535 */
540
541void cgroup_lock(void) 536void cgroup_lock(void)
542{ 537{
543 mutex_lock(&cgroup_mutex); 538 mutex_lock(&cgroup_mutex);
@@ -548,7 +543,6 @@ void cgroup_lock(void)
548 * 543 *
549 * Undo the lock taken in a previous cgroup_lock() call. 544 * Undo the lock taken in a previous cgroup_lock() call.
550 */ 545 */
551
552void cgroup_unlock(void) 546void cgroup_unlock(void)
553{ 547{
554 mutex_unlock(&cgroup_mutex); 548 mutex_unlock(&cgroup_mutex);
@@ -590,7 +584,6 @@ static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb)
590 * Call subsys's pre_destroy handler. 584 * Call subsys's pre_destroy handler.
591 * This is called before css refcnt check. 585 * This is called before css refcnt check.
592 */ 586 */
593
594static void cgroup_call_pre_destroy(struct cgroup *cgrp) 587static void cgroup_call_pre_destroy(struct cgroup *cgrp)
595{ 588{
596 struct cgroup_subsys *ss; 589 struct cgroup_subsys *ss;
@@ -600,7 +593,6 @@ static void cgroup_call_pre_destroy(struct cgroup *cgrp)
600 return; 593 return;
601} 594}
602 595
603
604static void cgroup_diput(struct dentry *dentry, struct inode *inode) 596static void cgroup_diput(struct dentry *dentry, struct inode *inode)
605{ 597{
606 /* is dentry a directory ? if so, kfree() associated cgroup */ 598 /* is dentry a directory ? if so, kfree() associated cgroup */
@@ -696,7 +688,7 @@ static int rebind_subsystems(struct cgroupfs_root *root,
696 added_bits = final_bits & ~root->actual_subsys_bits; 688 added_bits = final_bits & ~root->actual_subsys_bits;
697 /* Check that any added subsystems are currently free */ 689 /* Check that any added subsystems are currently free */
698 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { 690 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
699 unsigned long long bit = 1ull << i; 691 unsigned long bit = 1UL << i;
700 struct cgroup_subsys *ss = subsys[i]; 692 struct cgroup_subsys *ss = subsys[i];
701 if (!(bit & added_bits)) 693 if (!(bit & added_bits))
702 continue; 694 continue;
@@ -927,7 +919,6 @@ static int cgroup_get_rootdir(struct super_block *sb)
927 if (!inode) 919 if (!inode)
928 return -ENOMEM; 920 return -ENOMEM;
929 921
930 inode->i_op = &simple_dir_inode_operations;
931 inode->i_fop = &simple_dir_operations; 922 inode->i_fop = &simple_dir_operations;
932 inode->i_op = &cgroup_dir_inode_operations; 923 inode->i_op = &cgroup_dir_inode_operations;
933 /* directories start off with i_nlink == 2 (for "." entry) */ 924 /* directories start off with i_nlink == 2 (for "." entry) */
@@ -961,8 +952,11 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
961 } 952 }
962 953
963 root = kzalloc(sizeof(*root), GFP_KERNEL); 954 root = kzalloc(sizeof(*root), GFP_KERNEL);
964 if (!root) 955 if (!root) {
956 if (opts.release_agent)
957 kfree(opts.release_agent);
965 return -ENOMEM; 958 return -ENOMEM;
959 }
966 960
967 init_cgroup_root(root); 961 init_cgroup_root(root);
968 root->subsys_bits = opts.subsys_bits; 962 root->subsys_bits = opts.subsys_bits;
@@ -1129,8 +1123,13 @@ static inline struct cftype *__d_cft(struct dentry *dentry)
1129 return dentry->d_fsdata; 1123 return dentry->d_fsdata;
1130} 1124}
1131 1125
1132/* 1126/**
1133 * Called with cgroup_mutex held. Writes path of cgroup into buf. 1127 * cgroup_path - generate the path of a cgroup
1128 * @cgrp: the cgroup in question
1129 * @buf: the buffer to write the path into
1130 * @buflen: the length of the buffer
1131 *
1132 * Called with cgroup_mutex held. Writes path of cgroup into buf.
1134 * Returns 0 on success, -errno on error. 1133 * Returns 0 on success, -errno on error.
1135 */ 1134 */
1136int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) 1135int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
@@ -1188,11 +1187,13 @@ static void get_first_subsys(const struct cgroup *cgrp,
1188 *subsys_id = test_ss->subsys_id; 1187 *subsys_id = test_ss->subsys_id;
1189} 1188}
1190 1189
1191/* 1190/**
1192 * Attach task 'tsk' to cgroup 'cgrp' 1191 * cgroup_attach_task - attach task 'tsk' to cgroup 'cgrp'
1192 * @cgrp: the cgroup the task is attaching to
1193 * @tsk: the task to be attached
1193 * 1194 *
1194 * Call holding cgroup_mutex. May take task_lock of 1195 * Call holding cgroup_mutex. May take task_lock of
1195 * the task 'pid' during call. 1196 * the task 'tsk' during call.
1196 */ 1197 */
1197int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk) 1198int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
1198{ 1199{
@@ -1293,7 +1294,6 @@ static int attach_task_by_pid(struct cgroup *cgrp, char *pidbuf)
1293} 1294}
1294 1295
1295/* The various types of files and directories in a cgroup file system */ 1296/* The various types of files and directories in a cgroup file system */
1296
1297enum cgroup_filetype { 1297enum cgroup_filetype {
1298 FILE_ROOT, 1298 FILE_ROOT,
1299 FILE_DIR, 1299 FILE_DIR,
@@ -1584,12 +1584,11 @@ static int cgroup_create_file(struct dentry *dentry, int mode,
1584} 1584}
1585 1585
1586/* 1586/*
1587 * cgroup_create_dir - create a directory for an object. 1587 * cgroup_create_dir - create a directory for an object.
1588 * cgrp: the cgroup we create the directory for. 1588 * @cgrp: the cgroup we create the directory for. It must have a valid
1589 * It must have a valid ->parent field 1589 * ->parent field. And we are going to fill its ->dentry field.
1590 * And we are going to fill its ->dentry field. 1590 * @dentry: dentry of the new cgroup
1591 * dentry: dentry of the new cgroup 1591 * @mode: mode to set on new directory.
1592 * mode: mode to set on new directory.
1593 */ 1592 */
1594static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry, 1593static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
1595 int mode) 1594 int mode)
@@ -1651,8 +1650,12 @@ int cgroup_add_files(struct cgroup *cgrp,
1651 return 0; 1650 return 0;
1652} 1651}
1653 1652
1654/* Count the number of tasks in a cgroup. */ 1653/**
1655 1654 * cgroup_task_count - count the number of tasks in a cgroup.
1655 * @cgrp: the cgroup in question
1656 *
1657 * Return the number of tasks in the cgroup.
1658 */
1656int cgroup_task_count(const struct cgroup *cgrp) 1659int cgroup_task_count(const struct cgroup *cgrp)
1657{ 1660{
1658 int count = 0; 1661 int count = 0;
@@ -1962,12 +1965,13 @@ static int pid_array_load(pid_t *pidarray, int npids, struct cgroup *cgrp)
1962} 1965}
1963 1966
1964/** 1967/**
1965 * Build and fill cgroupstats so that taskstats can export it to user 1968 * cgroupstats_build - build and fill cgroupstats
1966 * space.
1967 *
1968 * @stats: cgroupstats to fill information into 1969 * @stats: cgroupstats to fill information into
1969 * @dentry: A dentry entry belonging to the cgroup for which stats have 1970 * @dentry: A dentry entry belonging to the cgroup for which stats have
1970 * been requested. 1971 * been requested.
1972 *
1973 * Build and fill cgroupstats so that taskstats can export it to user
1974 * space.
1971 */ 1975 */
1972int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry) 1976int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry)
1973{ 1977{
@@ -2199,14 +2203,13 @@ static void init_cgroup_css(struct cgroup_subsys_state *css,
2199} 2203}
2200 2204
2201/* 2205/*
2202 * cgroup_create - create a cgroup 2206 * cgroup_create - create a cgroup
2203 * parent: cgroup that will be parent of the new cgroup. 2207 * @parent: cgroup that will be parent of the new cgroup
2204 * name: name of the new cgroup. Will be strcpy'ed. 2208 * @dentry: dentry of the new cgroup
2205 * mode: mode to set on new inode 2209 * @mode: mode to set on new inode
2206 * 2210 *
2207 * Must be called with the mutex on the parent inode held 2211 * Must be called with the mutex on the parent inode held
2208 */ 2212 */
2209
2210static long cgroup_create(struct cgroup *parent, struct dentry *dentry, 2213static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
2211 int mode) 2214 int mode)
2212{ 2215{
@@ -2349,13 +2352,12 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
2349 parent = cgrp->parent; 2352 parent = cgrp->parent;
2350 root = cgrp->root; 2353 root = cgrp->root;
2351 sb = root->sb; 2354 sb = root->sb;
2355
2352 /* 2356 /*
2353 * Call pre_destroy handlers of subsys 2357 * Call pre_destroy handlers of subsys. Notify subsystems
2358 * that rmdir() request comes.
2354 */ 2359 */
2355 cgroup_call_pre_destroy(cgrp); 2360 cgroup_call_pre_destroy(cgrp);
2356 /*
2357 * Notify subsyses that rmdir() request comes.
2358 */
2359 2361
2360 if (cgroup_has_css_refs(cgrp)) { 2362 if (cgroup_has_css_refs(cgrp)) {
2361 mutex_unlock(&cgroup_mutex); 2363 mutex_unlock(&cgroup_mutex);
@@ -2431,8 +2433,10 @@ static void cgroup_init_subsys(struct cgroup_subsys *ss)
2431} 2433}
2432 2434
2433/** 2435/**
2434 * cgroup_init_early - initialize cgroups at system boot, and 2436 * cgroup_init_early - cgroup initialization at system boot
2435 * initialize any subsystems that request early init. 2437 *
2438 * Initialize cgroups at system boot, and initialize any
2439 * subsystems that request early init.
2436 */ 2440 */
2437int __init cgroup_init_early(void) 2441int __init cgroup_init_early(void)
2438{ 2442{
@@ -2474,8 +2478,10 @@ int __init cgroup_init_early(void)
2474} 2478}
2475 2479
2476/** 2480/**
2477 * cgroup_init - register cgroup filesystem and /proc file, and 2481 * cgroup_init - cgroup initialization
2478 * initialize any subsystems that didn't request early init. 2482 *
2483 * Register cgroup filesystem and /proc file, and initialize
2484 * any subsystems that didn't request early init.
2479 */ 2485 */
2480int __init cgroup_init(void) 2486int __init cgroup_init(void)
2481{ 2487{
@@ -2618,7 +2624,7 @@ static struct file_operations proc_cgroupstats_operations = {
2618 2624
2619/** 2625/**
2620 * cgroup_fork - attach newly forked task to its parents cgroup. 2626 * cgroup_fork - attach newly forked task to its parents cgroup.
2621 * @tsk: pointer to task_struct of forking parent process. 2627 * @child: pointer to task_struct of forking parent process.
2622 * 2628 *
2623 * Description: A task inherits its parent's cgroup at fork(). 2629 * Description: A task inherits its parent's cgroup at fork().
2624 * 2630 *
@@ -2642,9 +2648,12 @@ void cgroup_fork(struct task_struct *child)
2642} 2648}
2643 2649
2644/** 2650/**
2645 * cgroup_fork_callbacks - called on a new task very soon before 2651 * cgroup_fork_callbacks - run fork callbacks
2646 * adding it to the tasklist. No need to take any locks since no-one 2652 * @child: the new task
2647 * can be operating on this task 2653 *
2654 * Called on a new task very soon before adding it to the
2655 * tasklist. No need to take any locks since no-one can
2656 * be operating on this task.
2648 */ 2657 */
2649void cgroup_fork_callbacks(struct task_struct *child) 2658void cgroup_fork_callbacks(struct task_struct *child)
2650{ 2659{
@@ -2659,11 +2668,14 @@ void cgroup_fork_callbacks(struct task_struct *child)
2659} 2668}
2660 2669
2661/** 2670/**
2662 * cgroup_post_fork - called on a new task after adding it to the 2671 * cgroup_post_fork - called on a new task after adding it to the task list
2663 * task list. Adds the task to the list running through its css_set 2672 * @child: the task in question
2664 * if necessary. Has to be after the task is visible on the task list 2673 *
2665 * in case we race with the first call to cgroup_iter_start() - to 2674 * Adds the task to the list running through its css_set if necessary.
2666 * guarantee that the new task ends up on its list. */ 2675 * Has to be after the task is visible on the task list in case we race
2676 * with the first call to cgroup_iter_start() - to guarantee that the
2677 * new task ends up on its list.
2678 */
2667void cgroup_post_fork(struct task_struct *child) 2679void cgroup_post_fork(struct task_struct *child)
2668{ 2680{
2669 if (use_task_css_set_links) { 2681 if (use_task_css_set_links) {
@@ -2676,6 +2688,7 @@ void cgroup_post_fork(struct task_struct *child)
2676/** 2688/**
2677 * cgroup_exit - detach cgroup from exiting task 2689 * cgroup_exit - detach cgroup from exiting task
2678 * @tsk: pointer to task_struct of exiting process 2690 * @tsk: pointer to task_struct of exiting process
2691 * @run_callback: run exit callbacks?
2679 * 2692 *
2680 * Description: Detach cgroup from @tsk and release it. 2693 * Description: Detach cgroup from @tsk and release it.
2681 * 2694 *
@@ -2706,7 +2719,6 @@ void cgroup_post_fork(struct task_struct *child)
2706 * top_cgroup isn't going away, and either task has PF_EXITING set, 2719 * top_cgroup isn't going away, and either task has PF_EXITING set,
2707 * which wards off any cgroup_attach_task() attempts, or task is a failed 2720 * which wards off any cgroup_attach_task() attempts, or task is a failed
2708 * fork, never visible to cgroup_attach_task. 2721 * fork, never visible to cgroup_attach_task.
2709 *
2710 */ 2722 */
2711void cgroup_exit(struct task_struct *tsk, int run_callbacks) 2723void cgroup_exit(struct task_struct *tsk, int run_callbacks)
2712{ 2724{
@@ -2743,9 +2755,13 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
2743} 2755}
2744 2756
2745/** 2757/**
2746 * cgroup_clone - duplicate the current cgroup in the hierarchy 2758 * cgroup_clone - clone the cgroup the given subsystem is attached to
2747 * that the given subsystem is attached to, and move this task into 2759 * @tsk: the task to be moved
2748 * the new child 2760 * @subsys: the given subsystem
2761 *
2762 * Duplicate the current cgroup in the hierarchy that the given
2763 * subsystem is attached to, and move this task into the new
2764 * child.
2749 */ 2765 */
2750int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys) 2766int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2751{ 2767{
@@ -2858,9 +2874,12 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2858 return ret; 2874 return ret;
2859} 2875}
2860 2876
2861/* 2877/**
2862 * See if "cgrp" is a descendant of the current task's cgroup in 2878 * cgroup_is_descendant - see if @cgrp is a descendant of current task's cgrp
2863 * the appropriate hierarchy 2879 * @cgrp: the cgroup in question
2880 *
2881 * See if @cgrp is a descendant of the current task's cgroup in
2882 * the appropriate hierarchy.
2864 * 2883 *
2865 * If we are sending in dummytop, then presumably we are creating 2884 * If we are sending in dummytop, then presumably we are creating
2866 * the top cgroup in the subsystem. 2885 * the top cgroup in the subsystem.
@@ -2939,9 +2958,7 @@ void __css_put(struct cgroup_subsys_state *css)
2939 * release agent task. We don't bother to wait because the caller of 2958 * release agent task. We don't bother to wait because the caller of
2940 * this routine has no use for the exit status of the release agent 2959 * this routine has no use for the exit status of the release agent
2941 * task, so no sense holding our caller up for that. 2960 * task, so no sense holding our caller up for that.
2942 *
2943 */ 2961 */
2944
2945static void cgroup_release_agent(struct work_struct *work) 2962static void cgroup_release_agent(struct work_struct *work)
2946{ 2963{
2947 BUG_ON(work != &release_agent_work); 2964 BUG_ON(work != &release_agent_work);
diff --git a/kernel/exit.c b/kernel/exit.c
index 3b893e78ce61..506a957b665a 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -512,14 +512,10 @@ static void __put_fs_struct(struct fs_struct *fs)
512{ 512{
513 /* No need to hold fs->lock if we are killing it */ 513 /* No need to hold fs->lock if we are killing it */
514 if (atomic_dec_and_test(&fs->count)) { 514 if (atomic_dec_and_test(&fs->count)) {
515 dput(fs->root); 515 path_put(&fs->root);
516 mntput(fs->rootmnt); 516 path_put(&fs->pwd);
517 dput(fs->pwd); 517 if (fs->altroot.dentry)
518 mntput(fs->pwdmnt); 518 path_put(&fs->altroot);
519 if (fs->altroot) {
520 dput(fs->altroot);
521 mntput(fs->altrootmnt);
522 }
523 kmem_cache_free(fs_cachep, fs); 519 kmem_cache_free(fs_cachep, fs);
524 } 520 }
525} 521}
diff --git a/kernel/fork.c b/kernel/fork.c
index 4363a4eb84e3..dd249c37b3a3 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -600,16 +600,16 @@ static struct fs_struct *__copy_fs_struct(struct fs_struct *old)
600 rwlock_init(&fs->lock); 600 rwlock_init(&fs->lock);
601 fs->umask = old->umask; 601 fs->umask = old->umask;
602 read_lock(&old->lock); 602 read_lock(&old->lock);
603 fs->rootmnt = mntget(old->rootmnt); 603 fs->root = old->root;
604 fs->root = dget(old->root); 604 path_get(&old->root);
605 fs->pwdmnt = mntget(old->pwdmnt); 605 fs->pwd = old->pwd;
606 fs->pwd = dget(old->pwd); 606 path_get(&old->pwd);
607 if (old->altroot) { 607 if (old->altroot.dentry) {
608 fs->altrootmnt = mntget(old->altrootmnt); 608 fs->altroot = old->altroot;
609 fs->altroot = dget(old->altroot); 609 path_get(&old->altroot);
610 } else { 610 } else {
611 fs->altrootmnt = NULL; 611 fs->altroot.mnt = NULL;
612 fs->altroot = NULL; 612 fs->altroot.dentry = NULL;
613 } 613 }
614 read_unlock(&old->lock); 614 read_unlock(&old->lock);
615 } 615 }
diff --git a/kernel/futex.c b/kernel/futex.c
index a6baaec44b8f..06968cd79200 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -60,6 +60,8 @@
60 60
61#include "rtmutex_common.h" 61#include "rtmutex_common.h"
62 62
63int __read_mostly futex_cmpxchg_enabled;
64
63#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8) 65#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)
64 66
65/* 67/*
@@ -469,6 +471,8 @@ void exit_pi_state_list(struct task_struct *curr)
469 struct futex_hash_bucket *hb; 471 struct futex_hash_bucket *hb;
470 union futex_key key; 472 union futex_key key;
471 473
474 if (!futex_cmpxchg_enabled)
475 return;
472 /* 476 /*
473 * We are a ZOMBIE and nobody can enqueue itself on 477 * We are a ZOMBIE and nobody can enqueue itself on
474 * pi_state_list anymore, but we have to be careful 478 * pi_state_list anymore, but we have to be careful
@@ -1870,6 +1874,8 @@ asmlinkage long
1870sys_set_robust_list(struct robust_list_head __user *head, 1874sys_set_robust_list(struct robust_list_head __user *head,
1871 size_t len) 1875 size_t len)
1872{ 1876{
1877 if (!futex_cmpxchg_enabled)
1878 return -ENOSYS;
1873 /* 1879 /*
1874 * The kernel knows only one size for now: 1880 * The kernel knows only one size for now:
1875 */ 1881 */
@@ -1894,6 +1900,9 @@ sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,
1894 struct robust_list_head __user *head; 1900 struct robust_list_head __user *head;
1895 unsigned long ret; 1901 unsigned long ret;
1896 1902
1903 if (!futex_cmpxchg_enabled)
1904 return -ENOSYS;
1905
1897 if (!pid) 1906 if (!pid)
1898 head = current->robust_list; 1907 head = current->robust_list;
1899 else { 1908 else {
@@ -1997,6 +2006,9 @@ void exit_robust_list(struct task_struct *curr)
1997 unsigned long futex_offset; 2006 unsigned long futex_offset;
1998 int rc; 2007 int rc;
1999 2008
2009 if (!futex_cmpxchg_enabled)
2010 return;
2011
2000 /* 2012 /*
2001 * Fetch the list head (which was registered earlier, via 2013 * Fetch the list head (which was registered earlier, via
2002 * sys_set_robust_list()): 2014 * sys_set_robust_list()):
@@ -2051,7 +2063,7 @@ void exit_robust_list(struct task_struct *curr)
2051long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, 2063long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
2052 u32 __user *uaddr2, u32 val2, u32 val3) 2064 u32 __user *uaddr2, u32 val2, u32 val3)
2053{ 2065{
2054 int ret; 2066 int ret = -ENOSYS;
2055 int cmd = op & FUTEX_CMD_MASK; 2067 int cmd = op & FUTEX_CMD_MASK;
2056 struct rw_semaphore *fshared = NULL; 2068 struct rw_semaphore *fshared = NULL;
2057 2069
@@ -2083,13 +2095,16 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
2083 ret = futex_wake_op(uaddr, fshared, uaddr2, val, val2, val3); 2095 ret = futex_wake_op(uaddr, fshared, uaddr2, val, val2, val3);
2084 break; 2096 break;
2085 case FUTEX_LOCK_PI: 2097 case FUTEX_LOCK_PI:
2086 ret = futex_lock_pi(uaddr, fshared, val, timeout, 0); 2098 if (futex_cmpxchg_enabled)
2099 ret = futex_lock_pi(uaddr, fshared, val, timeout, 0);
2087 break; 2100 break;
2088 case FUTEX_UNLOCK_PI: 2101 case FUTEX_UNLOCK_PI:
2089 ret = futex_unlock_pi(uaddr, fshared); 2102 if (futex_cmpxchg_enabled)
2103 ret = futex_unlock_pi(uaddr, fshared);
2090 break; 2104 break;
2091 case FUTEX_TRYLOCK_PI: 2105 case FUTEX_TRYLOCK_PI:
2092 ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1); 2106 if (futex_cmpxchg_enabled)
2107 ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
2093 break; 2108 break;
2094 default: 2109 default:
2095 ret = -ENOSYS; 2110 ret = -ENOSYS;
@@ -2116,7 +2131,7 @@ asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
2116 2131
2117 t = timespec_to_ktime(ts); 2132 t = timespec_to_ktime(ts);
2118 if (cmd == FUTEX_WAIT) 2133 if (cmd == FUTEX_WAIT)
2119 t = ktime_add(ktime_get(), t); 2134 t = ktime_add_safe(ktime_get(), t);
2120 tp = &t; 2135 tp = &t;
2121 } 2136 }
2122 /* 2137 /*
@@ -2145,8 +2160,29 @@ static struct file_system_type futex_fs_type = {
2145 2160
2146static int __init init(void) 2161static int __init init(void)
2147{ 2162{
2148 int i = register_filesystem(&futex_fs_type); 2163 u32 curval;
2164 int i;
2165
2166 /*
2167 * This will fail and we want it. Some arch implementations do
2168 * runtime detection of the futex_atomic_cmpxchg_inatomic()
2169 * functionality. We want to know that before we call in any
2170 * of the complex code paths. Also we want to prevent
2171 * registration of robust lists in that case. NULL is
2172 * guaranteed to fault and we get -EFAULT on functional
2173 * implementation, the non functional ones will return
2174 * -ENOSYS.
2175 */
2176 curval = cmpxchg_futex_value_locked(NULL, 0, 0);
2177 if (curval == -EFAULT)
2178 futex_cmpxchg_enabled = 1;
2149 2179
2180 for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2181 plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2182 spin_lock_init(&futex_queues[i].lock);
2183 }
2184
2185 i = register_filesystem(&futex_fs_type);
2150 if (i) 2186 if (i)
2151 return i; 2187 return i;
2152 2188
@@ -2156,10 +2192,6 @@ static int __init init(void)
2156 return PTR_ERR(futex_mnt); 2192 return PTR_ERR(futex_mnt);
2157 } 2193 }
2158 2194
2159 for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2160 plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2161 spin_lock_init(&futex_queues[i].lock);
2162 }
2163 return 0; 2195 return 0;
2164} 2196}
2165__initcall(init); 2197__initcall(init);
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 133d558db452..ff90f049f8f6 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -54,6 +54,9 @@ void compat_exit_robust_list(struct task_struct *curr)
54 compat_long_t futex_offset; 54 compat_long_t futex_offset;
55 int rc; 55 int rc;
56 56
57 if (!futex_cmpxchg_enabled)
58 return;
59
57 /* 60 /*
58 * Fetch the list head (which was registered earlier, via 61 * Fetch the list head (which was registered earlier, via
59 * sys_set_robust_list()): 62 * sys_set_robust_list()):
@@ -115,6 +118,9 @@ asmlinkage long
115compat_sys_set_robust_list(struct compat_robust_list_head __user *head, 118compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
116 compat_size_t len) 119 compat_size_t len)
117{ 120{
121 if (!futex_cmpxchg_enabled)
122 return -ENOSYS;
123
118 if (unlikely(len != sizeof(*head))) 124 if (unlikely(len != sizeof(*head)))
119 return -EINVAL; 125 return -EINVAL;
120 126
@@ -130,6 +136,9 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
130 struct compat_robust_list_head __user *head; 136 struct compat_robust_list_head __user *head;
131 unsigned long ret; 137 unsigned long ret;
132 138
139 if (!futex_cmpxchg_enabled)
140 return -ENOSYS;
141
133 if (!pid) 142 if (!pid)
134 head = current->compat_robust_list; 143 head = current->compat_robust_list;
135 else { 144 else {
@@ -176,7 +185,7 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
176 185
177 t = timespec_to_ktime(ts); 186 t = timespec_to_ktime(ts);
178 if (cmd == FUTEX_WAIT) 187 if (cmd == FUTEX_WAIT)
179 t = ktime_add(ktime_get(), t); 188 t = ktime_add_safe(ktime_get(), t);
180 tp = &t; 189 tp = &t;
181 } 190 }
182 if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE) 191 if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 3f4a57c7895d..98bee013f71f 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -326,6 +326,23 @@ u64 ktime_divns(const ktime_t kt, s64 div)
326#endif /* BITS_PER_LONG >= 64 */ 326#endif /* BITS_PER_LONG >= 64 */
327 327
328/* 328/*
329 * Add two ktime values and do a safety check for overflow:
330 */
331ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs)
332{
333 ktime_t res = ktime_add(lhs, rhs);
334
335 /*
336 * We use KTIME_SEC_MAX here, the maximum timeout which we can
337 * return to user space in a timespec:
338 */
339 if (res.tv64 < 0 || res.tv64 < lhs.tv64 || res.tv64 < rhs.tv64)
340 res = ktime_set(KTIME_SEC_MAX, 0);
341
342 return res;
343}
344
345/*
329 * Check, whether the timer is on the callback pending list 346 * Check, whether the timer is on the callback pending list
330 */ 347 */
331static inline int hrtimer_cb_pending(const struct hrtimer *timer) 348static inline int hrtimer_cb_pending(const struct hrtimer *timer)
@@ -425,6 +442,8 @@ static int hrtimer_reprogram(struct hrtimer *timer,
425 ktime_t expires = ktime_sub(timer->expires, base->offset); 442 ktime_t expires = ktime_sub(timer->expires, base->offset);
426 int res; 443 int res;
427 444
445 WARN_ON_ONCE(timer->expires.tv64 < 0);
446
428 /* 447 /*
429 * When the callback is running, we do not reprogram the clock event 448 * When the callback is running, we do not reprogram the clock event
430 * device. The timer callback is either running on a different CPU or 449 * device. The timer callback is either running on a different CPU or
@@ -435,6 +454,15 @@ static int hrtimer_reprogram(struct hrtimer *timer,
435 if (hrtimer_callback_running(timer)) 454 if (hrtimer_callback_running(timer))
436 return 0; 455 return 0;
437 456
457 /*
458 * CLOCK_REALTIME timer might be requested with an absolute
459 * expiry time which is less than base->offset. Nothing wrong
460 * about that, just avoid to call into the tick code, which
461 * has now objections against negative expiry values.
462 */
463 if (expires.tv64 < 0)
464 return -ETIME;
465
438 if (expires.tv64 >= expires_next->tv64) 466 if (expires.tv64 >= expires_next->tv64)
439 return 0; 467 return 0;
440 468
@@ -682,13 +710,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
682 */ 710 */
683 orun++; 711 orun++;
684 } 712 }
685 timer->expires = ktime_add(timer->expires, interval); 713 timer->expires = ktime_add_safe(timer->expires, interval);
686 /*
687 * Make sure, that the result did not wrap with a very large
688 * interval.
689 */
690 if (timer->expires.tv64 < 0)
691 timer->expires = ktime_set(KTIME_SEC_MAX, 0);
692 714
693 return orun; 715 return orun;
694} 716}
@@ -839,7 +861,7 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
839 new_base = switch_hrtimer_base(timer, base); 861 new_base = switch_hrtimer_base(timer, base);
840 862
841 if (mode == HRTIMER_MODE_REL) { 863 if (mode == HRTIMER_MODE_REL) {
842 tim = ktime_add(tim, new_base->get_time()); 864 tim = ktime_add_safe(tim, new_base->get_time());
843 /* 865 /*
844 * CONFIG_TIME_LOW_RES is a temporary way for architectures 866 * CONFIG_TIME_LOW_RES is a temporary way for architectures
845 * to signal that they simply return xtime in 867 * to signal that they simply return xtime in
@@ -848,16 +870,8 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
848 * timeouts. This will go away with the GTOD framework. 870 * timeouts. This will go away with the GTOD framework.
849 */ 871 */
850#ifdef CONFIG_TIME_LOW_RES 872#ifdef CONFIG_TIME_LOW_RES
851 tim = ktime_add(tim, base->resolution); 873 tim = ktime_add_safe(tim, base->resolution);
852#endif 874#endif
853 /*
854 * Careful here: User space might have asked for a
855 * very long sleep, so the add above might result in a
856 * negative number, which enqueues the timer in front
857 * of the queue.
858 */
859 if (tim.tv64 < 0)
860 tim.tv64 = KTIME_MAX;
861 } 875 }
862 timer->expires = tim; 876 timer->expires = tim;
863 877
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index cc54c6276356..fdb3fbe2b0c4 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -246,6 +246,17 @@ static unsigned int default_startup(unsigned int irq)
246} 246}
247 247
248/* 248/*
249 * default shutdown function
250 */
251static void default_shutdown(unsigned int irq)
252{
253 struct irq_desc *desc = irq_desc + irq;
254
255 desc->chip->mask(irq);
256 desc->status |= IRQ_MASKED;
257}
258
259/*
249 * Fixup enable/disable function pointers 260 * Fixup enable/disable function pointers
250 */ 261 */
251void irq_chip_set_defaults(struct irq_chip *chip) 262void irq_chip_set_defaults(struct irq_chip *chip)
@@ -256,8 +267,15 @@ void irq_chip_set_defaults(struct irq_chip *chip)
256 chip->disable = default_disable; 267 chip->disable = default_disable;
257 if (!chip->startup) 268 if (!chip->startup)
258 chip->startup = default_startup; 269 chip->startup = default_startup;
270 /*
271 * We use chip->disable, when the user provided its own. When
272 * we have default_disable set for chip->disable, then we need
273 * to use default_shutdown, otherwise the irq line is not
274 * disabled on free_irq():
275 */
259 if (!chip->shutdown) 276 if (!chip->shutdown)
260 chip->shutdown = chip->disable; 277 chip->shutdown = chip->disable != default_disable ?
278 chip->disable : default_shutdown;
261 if (!chip->name) 279 if (!chip->name)
262 chip->name = chip->typename; 280 chip->name = chip->typename;
263 if (!chip->end) 281 if (!chip->end)
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index a6b2bc831dd0..088dabbf2d6a 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -6,6 +6,7 @@
6 * This file contains spurious interrupt handling. 6 * This file contains spurious interrupt handling.
7 */ 7 */
8 8
9#include <linux/jiffies.h>
9#include <linux/irq.h> 10#include <linux/irq.h>
10#include <linux/module.h> 11#include <linux/module.h>
11#include <linux/kallsyms.h> 12#include <linux/kallsyms.h>
@@ -179,7 +180,7 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
179 * otherwise the couter becomes a doomsday timer for otherwise 180 * otherwise the couter becomes a doomsday timer for otherwise
180 * working systems 181 * working systems
181 */ 182 */
182 if (jiffies - desc->last_unhandled > HZ/10) 183 if (time_after(jiffies, desc->last_unhandled + HZ/10))
183 desc->irqs_unhandled = 1; 184 desc->irqs_unhandled = 1;
184 else 185 else
185 desc->irqs_unhandled++; 186 desc->irqs_unhandled++;
diff --git a/kernel/kmod.c b/kernel/kmod.c
index bb7df2a28bd7..22be3ff3f363 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -173,10 +173,7 @@ static int ____call_usermodehelper(void *data)
173 */ 173 */
174 set_user_nice(current, 0); 174 set_user_nice(current, 0);
175 175
176 retval = -EPERM; 176 retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp);
177 if (current->fs->root)
178 retval = kernel_execve(sub_info->path,
179 sub_info->argv, sub_info->envp);
180 177
181 /* Exec failed? */ 178 /* Exec failed? */
182 sub_info->retval = retval; 179 sub_info->retval = retval;
diff --git a/kernel/marker.c b/kernel/marker.c
index 5323cfaedbce..50effc01d9a2 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -27,35 +27,42 @@
27extern struct marker __start___markers[]; 27extern struct marker __start___markers[];
28extern struct marker __stop___markers[]; 28extern struct marker __stop___markers[];
29 29
30/* Set to 1 to enable marker debug output */
31const int marker_debug;
32
30/* 33/*
31 * markers_mutex nests inside module_mutex. Markers mutex protects the builtin 34 * markers_mutex nests inside module_mutex. Markers mutex protects the builtin
32 * and module markers, the hash table and deferred_sync. 35 * and module markers and the hash table.
33 */ 36 */
34static DEFINE_MUTEX(markers_mutex); 37static DEFINE_MUTEX(markers_mutex);
35 38
36/* 39/*
37 * Marker deferred synchronization.
38 * Upon marker probe_unregister, we delay call to synchronize_sched() to
39 * accelerate mass unregistration (only when there is no more reference to a
40 * given module do we call synchronize_sched()). However, we need to make sure
41 * every critical region has ended before we re-arm a marker that has been
42 * unregistered and then registered back with a different probe data.
43 */
44static int deferred_sync;
45
46/*
47 * Marker hash table, containing the active markers. 40 * Marker hash table, containing the active markers.
48 * Protected by module_mutex. 41 * Protected by module_mutex.
49 */ 42 */
50#define MARKER_HASH_BITS 6 43#define MARKER_HASH_BITS 6
51#define MARKER_TABLE_SIZE (1 << MARKER_HASH_BITS) 44#define MARKER_TABLE_SIZE (1 << MARKER_HASH_BITS)
52 45
46/*
47 * Note about RCU :
48 * It is used to make sure every handler has finished using its private data
49 * between two consecutive operation (add or remove) on a given marker. It is
50 * also used to delay the free of multiple probes array until a quiescent state
51 * is reached.
52 * marker entries modifications are protected by the markers_mutex.
53 */
53struct marker_entry { 54struct marker_entry {
54 struct hlist_node hlist; 55 struct hlist_node hlist;
55 char *format; 56 char *format;
56 marker_probe_func *probe; 57 void (*call)(const struct marker *mdata, /* Probe wrapper */
57 void *private; 58 void *call_private, const char *fmt, ...);
59 struct marker_probe_closure single;
60 struct marker_probe_closure *multi;
58 int refcount; /* Number of times armed. 0 if disarmed. */ 61 int refcount; /* Number of times armed. 0 if disarmed. */
62 struct rcu_head rcu;
63 void *oldptr;
64 unsigned char rcu_pending:1;
65 unsigned char ptype:1;
59 char name[0]; /* Contains name'\0'format'\0' */ 66 char name[0]; /* Contains name'\0'format'\0' */
60}; 67};
61 68
@@ -63,7 +70,8 @@ static struct hlist_head marker_table[MARKER_TABLE_SIZE];
63 70
64/** 71/**
65 * __mark_empty_function - Empty probe callback 72 * __mark_empty_function - Empty probe callback
66 * @mdata: pointer of type const struct marker 73 * @probe_private: probe private data
74 * @call_private: call site private data
67 * @fmt: format string 75 * @fmt: format string
68 * @...: variable argument list 76 * @...: variable argument list
69 * 77 *
@@ -72,13 +80,267 @@ static struct hlist_head marker_table[MARKER_TABLE_SIZE];
72 * though the function pointer change and the marker enabling are two distinct 80 * though the function pointer change and the marker enabling are two distinct
73 * operations that modifies the execution flow of preemptible code. 81 * operations that modifies the execution flow of preemptible code.
74 */ 82 */
75void __mark_empty_function(const struct marker *mdata, void *private, 83void __mark_empty_function(void *probe_private, void *call_private,
76 const char *fmt, ...) 84 const char *fmt, va_list *args)
77{ 85{
78} 86}
79EXPORT_SYMBOL_GPL(__mark_empty_function); 87EXPORT_SYMBOL_GPL(__mark_empty_function);
80 88
81/* 89/*
90 * marker_probe_cb Callback that prepares the variable argument list for probes.
91 * @mdata: pointer of type struct marker
92 * @call_private: caller site private data
93 * @fmt: format string
94 * @...: Variable argument list.
95 *
96 * Since we do not use "typical" pointer based RCU in the 1 argument case, we
97 * need to put a full smp_rmb() in this branch. This is why we do not use
98 * rcu_dereference() for the pointer read.
99 */
100void marker_probe_cb(const struct marker *mdata, void *call_private,
101 const char *fmt, ...)
102{
103 va_list args;
104 char ptype;
105
106 /*
107 * disabling preemption to make sure the teardown of the callbacks can
108 * be done correctly when they are in modules and they insure RCU read
109 * coherency.
110 */
111 preempt_disable();
112 ptype = ACCESS_ONCE(mdata->ptype);
113 if (likely(!ptype)) {
114 marker_probe_func *func;
115 /* Must read the ptype before ptr. They are not data dependant,
116 * so we put an explicit smp_rmb() here. */
117 smp_rmb();
118 func = ACCESS_ONCE(mdata->single.func);
119 /* Must read the ptr before private data. They are not data
120 * dependant, so we put an explicit smp_rmb() here. */
121 smp_rmb();
122 va_start(args, fmt);
123 func(mdata->single.probe_private, call_private, fmt, &args);
124 va_end(args);
125 } else {
126 struct marker_probe_closure *multi;
127 int i;
128 /*
129 * multi points to an array, therefore accessing the array
130 * depends on reading multi. However, even in this case,
131 * we must insure that the pointer is read _before_ the array
132 * data. Same as rcu_dereference, but we need a full smp_rmb()
133 * in the fast path, so put the explicit barrier here.
134 */
135 smp_read_barrier_depends();
136 multi = ACCESS_ONCE(mdata->multi);
137 for (i = 0; multi[i].func; i++) {
138 va_start(args, fmt);
139 multi[i].func(multi[i].probe_private, call_private, fmt,
140 &args);
141 va_end(args);
142 }
143 }
144 preempt_enable();
145}
146EXPORT_SYMBOL_GPL(marker_probe_cb);
147
148/*
149 * marker_probe_cb Callback that does not prepare the variable argument list.
150 * @mdata: pointer of type struct marker
151 * @call_private: caller site private data
152 * @fmt: format string
153 * @...: Variable argument list.
154 *
155 * Should be connected to markers "MARK_NOARGS".
156 */
157void marker_probe_cb_noarg(const struct marker *mdata,
158 void *call_private, const char *fmt, ...)
159{
160 va_list args; /* not initialized */
161 char ptype;
162
163 preempt_disable();
164 ptype = ACCESS_ONCE(mdata->ptype);
165 if (likely(!ptype)) {
166 marker_probe_func *func;
167 /* Must read the ptype before ptr. They are not data dependant,
168 * so we put an explicit smp_rmb() here. */
169 smp_rmb();
170 func = ACCESS_ONCE(mdata->single.func);
171 /* Must read the ptr before private data. They are not data
172 * dependant, so we put an explicit smp_rmb() here. */
173 smp_rmb();
174 func(mdata->single.probe_private, call_private, fmt, &args);
175 } else {
176 struct marker_probe_closure *multi;
177 int i;
178 /*
179 * multi points to an array, therefore accessing the array
180 * depends on reading multi. However, even in this case,
181 * we must insure that the pointer is read _before_ the array
182 * data. Same as rcu_dereference, but we need a full smp_rmb()
183 * in the fast path, so put the explicit barrier here.
184 */
185 smp_read_barrier_depends();
186 multi = ACCESS_ONCE(mdata->multi);
187 for (i = 0; multi[i].func; i++)
188 multi[i].func(multi[i].probe_private, call_private, fmt,
189 &args);
190 }
191 preempt_enable();
192}
193EXPORT_SYMBOL_GPL(marker_probe_cb_noarg);
194
195static void free_old_closure(struct rcu_head *head)
196{
197 struct marker_entry *entry = container_of(head,
198 struct marker_entry, rcu);
199 kfree(entry->oldptr);
200 /* Make sure we free the data before setting the pending flag to 0 */
201 smp_wmb();
202 entry->rcu_pending = 0;
203}
204
205static void debug_print_probes(struct marker_entry *entry)
206{
207 int i;
208
209 if (!marker_debug)
210 return;
211
212 if (!entry->ptype) {
213 printk(KERN_DEBUG "Single probe : %p %p\n",
214 entry->single.func,
215 entry->single.probe_private);
216 } else {
217 for (i = 0; entry->multi[i].func; i++)
218 printk(KERN_DEBUG "Multi probe %d : %p %p\n", i,
219 entry->multi[i].func,
220 entry->multi[i].probe_private);
221 }
222}
223
224static struct marker_probe_closure *
225marker_entry_add_probe(struct marker_entry *entry,
226 marker_probe_func *probe, void *probe_private)
227{
228 int nr_probes = 0;
229 struct marker_probe_closure *old, *new;
230
231 WARN_ON(!probe);
232
233 debug_print_probes(entry);
234 old = entry->multi;
235 if (!entry->ptype) {
236 if (entry->single.func == probe &&
237 entry->single.probe_private == probe_private)
238 return ERR_PTR(-EBUSY);
239 if (entry->single.func == __mark_empty_function) {
240 /* 0 -> 1 probes */
241 entry->single.func = probe;
242 entry->single.probe_private = probe_private;
243 entry->refcount = 1;
244 entry->ptype = 0;
245 debug_print_probes(entry);
246 return NULL;
247 } else {
248 /* 1 -> 2 probes */
249 nr_probes = 1;
250 old = NULL;
251 }
252 } else {
253 /* (N -> N+1), (N != 0, 1) probes */
254 for (nr_probes = 0; old[nr_probes].func; nr_probes++)
255 if (old[nr_probes].func == probe
256 && old[nr_probes].probe_private
257 == probe_private)
258 return ERR_PTR(-EBUSY);
259 }
260 /* + 2 : one for new probe, one for NULL func */
261 new = kzalloc((nr_probes + 2) * sizeof(struct marker_probe_closure),
262 GFP_KERNEL);
263 if (new == NULL)
264 return ERR_PTR(-ENOMEM);
265 if (!old)
266 new[0] = entry->single;
267 else
268 memcpy(new, old,
269 nr_probes * sizeof(struct marker_probe_closure));
270 new[nr_probes].func = probe;
271 new[nr_probes].probe_private = probe_private;
272 entry->refcount = nr_probes + 1;
273 entry->multi = new;
274 entry->ptype = 1;
275 debug_print_probes(entry);
276 return old;
277}
278
279static struct marker_probe_closure *
280marker_entry_remove_probe(struct marker_entry *entry,
281 marker_probe_func *probe, void *probe_private)
282{
283 int nr_probes = 0, nr_del = 0, i;
284 struct marker_probe_closure *old, *new;
285
286 old = entry->multi;
287
288 debug_print_probes(entry);
289 if (!entry->ptype) {
290 /* 0 -> N is an error */
291 WARN_ON(entry->single.func == __mark_empty_function);
292 /* 1 -> 0 probes */
293 WARN_ON(probe && entry->single.func != probe);
294 WARN_ON(entry->single.probe_private != probe_private);
295 entry->single.func = __mark_empty_function;
296 entry->refcount = 0;
297 entry->ptype = 0;
298 debug_print_probes(entry);
299 return NULL;
300 } else {
301 /* (N -> M), (N > 1, M >= 0) probes */
302 for (nr_probes = 0; old[nr_probes].func; nr_probes++) {
303 if ((!probe || old[nr_probes].func == probe)
304 && old[nr_probes].probe_private
305 == probe_private)
306 nr_del++;
307 }
308 }
309
310 if (nr_probes - nr_del == 0) {
311 /* N -> 0, (N > 1) */
312 entry->single.func = __mark_empty_function;
313 entry->refcount = 0;
314 entry->ptype = 0;
315 } else if (nr_probes - nr_del == 1) {
316 /* N -> 1, (N > 1) */
317 for (i = 0; old[i].func; i++)
318 if ((probe && old[i].func != probe) ||
319 old[i].probe_private != probe_private)
320 entry->single = old[i];
321 entry->refcount = 1;
322 entry->ptype = 0;
323 } else {
324 int j = 0;
325 /* N -> M, (N > 1, M > 1) */
326 /* + 1 for NULL */
327 new = kzalloc((nr_probes - nr_del + 1)
328 * sizeof(struct marker_probe_closure), GFP_KERNEL);
329 if (new == NULL)
330 return ERR_PTR(-ENOMEM);
331 for (i = 0; old[i].func; i++)
332 if ((probe && old[i].func != probe) ||
333 old[i].probe_private != probe_private)
334 new[j++] = old[i];
335 entry->refcount = nr_probes - nr_del;
336 entry->ptype = 1;
337 entry->multi = new;
338 }
339 debug_print_probes(entry);
340 return old;
341}
342
343/*
82 * Get marker if the marker is present in the marker hash table. 344 * Get marker if the marker is present in the marker hash table.
83 * Must be called with markers_mutex held. 345 * Must be called with markers_mutex held.
84 * Returns NULL if not present. 346 * Returns NULL if not present.
@@ -102,8 +364,7 @@ static struct marker_entry *get_marker(const char *name)
102 * Add the marker to the marker hash table. Must be called with markers_mutex 364 * Add the marker to the marker hash table. Must be called with markers_mutex
103 * held. 365 * held.
104 */ 366 */
105static int add_marker(const char *name, const char *format, 367static struct marker_entry *add_marker(const char *name, const char *format)
106 marker_probe_func *probe, void *private)
107{ 368{
108 struct hlist_head *head; 369 struct hlist_head *head;
109 struct hlist_node *node; 370 struct hlist_node *node;
@@ -118,9 +379,8 @@ static int add_marker(const char *name, const char *format,
118 hlist_for_each_entry(e, node, head, hlist) { 379 hlist_for_each_entry(e, node, head, hlist) {
119 if (!strcmp(name, e->name)) { 380 if (!strcmp(name, e->name)) {
120 printk(KERN_NOTICE 381 printk(KERN_NOTICE
121 "Marker %s busy, probe %p already installed\n", 382 "Marker %s busy\n", name);
122 name, e->probe); 383 return ERR_PTR(-EBUSY); /* Already there */
123 return -EBUSY; /* Already there */
124 } 384 }
125 } 385 }
126 /* 386 /*
@@ -130,34 +390,42 @@ static int add_marker(const char *name, const char *format,
130 e = kmalloc(sizeof(struct marker_entry) + name_len + format_len, 390 e = kmalloc(sizeof(struct marker_entry) + name_len + format_len,
131 GFP_KERNEL); 391 GFP_KERNEL);
132 if (!e) 392 if (!e)
133 return -ENOMEM; 393 return ERR_PTR(-ENOMEM);
134 memcpy(&e->name[0], name, name_len); 394 memcpy(&e->name[0], name, name_len);
135 if (format) { 395 if (format) {
136 e->format = &e->name[name_len]; 396 e->format = &e->name[name_len];
137 memcpy(e->format, format, format_len); 397 memcpy(e->format, format, format_len);
398 if (strcmp(e->format, MARK_NOARGS) == 0)
399 e->call = marker_probe_cb_noarg;
400 else
401 e->call = marker_probe_cb;
138 trace_mark(core_marker_format, "name %s format %s", 402 trace_mark(core_marker_format, "name %s format %s",
139 e->name, e->format); 403 e->name, e->format);
140 } else 404 } else {
141 e->format = NULL; 405 e->format = NULL;
142 e->probe = probe; 406 e->call = marker_probe_cb;
143 e->private = private; 407 }
408 e->single.func = __mark_empty_function;
409 e->single.probe_private = NULL;
410 e->multi = NULL;
411 e->ptype = 0;
144 e->refcount = 0; 412 e->refcount = 0;
413 e->rcu_pending = 0;
145 hlist_add_head(&e->hlist, head); 414 hlist_add_head(&e->hlist, head);
146 return 0; 415 return e;
147} 416}
148 417
149/* 418/*
150 * Remove the marker from the marker hash table. Must be called with mutex_lock 419 * Remove the marker from the marker hash table. Must be called with mutex_lock
151 * held. 420 * held.
152 */ 421 */
153static void *remove_marker(const char *name) 422static int remove_marker(const char *name)
154{ 423{
155 struct hlist_head *head; 424 struct hlist_head *head;
156 struct hlist_node *node; 425 struct hlist_node *node;
157 struct marker_entry *e; 426 struct marker_entry *e;
158 int found = 0; 427 int found = 0;
159 size_t len = strlen(name) + 1; 428 size_t len = strlen(name) + 1;
160 void *private = NULL;
161 u32 hash = jhash(name, len-1, 0); 429 u32 hash = jhash(name, len-1, 0);
162 430
163 head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)]; 431 head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
@@ -167,12 +435,16 @@ static void *remove_marker(const char *name)
167 break; 435 break;
168 } 436 }
169 } 437 }
170 if (found) { 438 if (!found)
171 private = e->private; 439 return -ENOENT;
172 hlist_del(&e->hlist); 440 if (e->single.func != __mark_empty_function)
173 kfree(e); 441 return -EBUSY;
174 } 442 hlist_del(&e->hlist);
175 return private; 443 /* Make sure the call_rcu has been executed */
444 if (e->rcu_pending)
445 rcu_barrier();
446 kfree(e);
447 return 0;
176} 448}
177 449
178/* 450/*
@@ -184,6 +456,7 @@ static int marker_set_format(struct marker_entry **entry, const char *format)
184 size_t name_len = strlen((*entry)->name) + 1; 456 size_t name_len = strlen((*entry)->name) + 1;
185 size_t format_len = strlen(format) + 1; 457 size_t format_len = strlen(format) + 1;
186 458
459
187 e = kmalloc(sizeof(struct marker_entry) + name_len + format_len, 460 e = kmalloc(sizeof(struct marker_entry) + name_len + format_len,
188 GFP_KERNEL); 461 GFP_KERNEL);
189 if (!e) 462 if (!e)
@@ -191,11 +464,20 @@ static int marker_set_format(struct marker_entry **entry, const char *format)
191 memcpy(&e->name[0], (*entry)->name, name_len); 464 memcpy(&e->name[0], (*entry)->name, name_len);
192 e->format = &e->name[name_len]; 465 e->format = &e->name[name_len];
193 memcpy(e->format, format, format_len); 466 memcpy(e->format, format, format_len);
194 e->probe = (*entry)->probe; 467 if (strcmp(e->format, MARK_NOARGS) == 0)
195 e->private = (*entry)->private; 468 e->call = marker_probe_cb_noarg;
469 else
470 e->call = marker_probe_cb;
471 e->single = (*entry)->single;
472 e->multi = (*entry)->multi;
473 e->ptype = (*entry)->ptype;
196 e->refcount = (*entry)->refcount; 474 e->refcount = (*entry)->refcount;
475 e->rcu_pending = 0;
197 hlist_add_before(&e->hlist, &(*entry)->hlist); 476 hlist_add_before(&e->hlist, &(*entry)->hlist);
198 hlist_del(&(*entry)->hlist); 477 hlist_del(&(*entry)->hlist);
478 /* Make sure the call_rcu has been executed */
479 if ((*entry)->rcu_pending)
480 rcu_barrier();
199 kfree(*entry); 481 kfree(*entry);
200 *entry = e; 482 *entry = e;
201 trace_mark(core_marker_format, "name %s format %s", 483 trace_mark(core_marker_format, "name %s format %s",
@@ -206,7 +488,8 @@ static int marker_set_format(struct marker_entry **entry, const char *format)
206/* 488/*
207 * Sets the probe callback corresponding to one marker. 489 * Sets the probe callback corresponding to one marker.
208 */ 490 */
209static int set_marker(struct marker_entry **entry, struct marker *elem) 491static int set_marker(struct marker_entry **entry, struct marker *elem,
492 int active)
210{ 493{
211 int ret; 494 int ret;
212 WARN_ON(strcmp((*entry)->name, elem->name) != 0); 495 WARN_ON(strcmp((*entry)->name, elem->name) != 0);
@@ -226,9 +509,43 @@ static int set_marker(struct marker_entry **entry, struct marker *elem)
226 if (ret) 509 if (ret)
227 return ret; 510 return ret;
228 } 511 }
229 elem->call = (*entry)->probe; 512
230 elem->private = (*entry)->private; 513 /*
231 elem->state = 1; 514 * probe_cb setup (statically known) is done here. It is
515 * asynchronous with the rest of execution, therefore we only
516 * pass from a "safe" callback (with argument) to an "unsafe"
517 * callback (does not set arguments).
518 */
519 elem->call = (*entry)->call;
520 /*
521 * Sanity check :
522 * We only update the single probe private data when the ptr is
523 * set to a _non_ single probe! (0 -> 1 and N -> 1, N != 1)
524 */
525 WARN_ON(elem->single.func != __mark_empty_function
526 && elem->single.probe_private
527 != (*entry)->single.probe_private &&
528 !elem->ptype);
529 elem->single.probe_private = (*entry)->single.probe_private;
530 /*
531 * Make sure the private data is valid when we update the
532 * single probe ptr.
533 */
534 smp_wmb();
535 elem->single.func = (*entry)->single.func;
536 /*
537 * We also make sure that the new probe callbacks array is consistent
538 * before setting a pointer to it.
539 */
540 rcu_assign_pointer(elem->multi, (*entry)->multi);
541 /*
542 * Update the function or multi probe array pointer before setting the
543 * ptype.
544 */
545 smp_wmb();
546 elem->ptype = (*entry)->ptype;
547 elem->state = active;
548
232 return 0; 549 return 0;
233} 550}
234 551
@@ -240,8 +557,12 @@ static int set_marker(struct marker_entry **entry, struct marker *elem)
240 */ 557 */
241static void disable_marker(struct marker *elem) 558static void disable_marker(struct marker *elem)
242{ 559{
560 /* leave "call" as is. It is known statically. */
243 elem->state = 0; 561 elem->state = 0;
244 elem->call = __mark_empty_function; 562 elem->single.func = __mark_empty_function;
563 /* Update the function before setting the ptype */
564 smp_wmb();
565 elem->ptype = 0; /* single probe */
245 /* 566 /*
246 * Leave the private data and id there, because removal is racy and 567 * Leave the private data and id there, because removal is racy and
247 * should be done only after a synchronize_sched(). These are never used 568 * should be done only after a synchronize_sched(). These are never used
@@ -253,14 +574,11 @@ static void disable_marker(struct marker *elem)
253 * marker_update_probe_range - Update a probe range 574 * marker_update_probe_range - Update a probe range
254 * @begin: beginning of the range 575 * @begin: beginning of the range
255 * @end: end of the range 576 * @end: end of the range
256 * @probe_module: module address of the probe being updated
257 * @refcount: number of references left to the given probe_module (out)
258 * 577 *
259 * Updates the probe callback corresponding to a range of markers. 578 * Updates the probe callback corresponding to a range of markers.
260 */ 579 */
261void marker_update_probe_range(struct marker *begin, 580void marker_update_probe_range(struct marker *begin,
262 struct marker *end, struct module *probe_module, 581 struct marker *end)
263 int *refcount)
264{ 582{
265 struct marker *iter; 583 struct marker *iter;
266 struct marker_entry *mark_entry; 584 struct marker_entry *mark_entry;
@@ -268,15 +586,12 @@ void marker_update_probe_range(struct marker *begin,
268 mutex_lock(&markers_mutex); 586 mutex_lock(&markers_mutex);
269 for (iter = begin; iter < end; iter++) { 587 for (iter = begin; iter < end; iter++) {
270 mark_entry = get_marker(iter->name); 588 mark_entry = get_marker(iter->name);
271 if (mark_entry && mark_entry->refcount) { 589 if (mark_entry) {
272 set_marker(&mark_entry, iter); 590 set_marker(&mark_entry, iter,
591 !!mark_entry->refcount);
273 /* 592 /*
274 * ignore error, continue 593 * ignore error, continue
275 */ 594 */
276 if (probe_module)
277 if (probe_module ==
278 __module_text_address((unsigned long)mark_entry->probe))
279 (*refcount)++;
280 } else { 595 } else {
281 disable_marker(iter); 596 disable_marker(iter);
282 } 597 }
@@ -289,20 +604,27 @@ void marker_update_probe_range(struct marker *begin,
289 * Issues a synchronize_sched() when no reference to the module passed 604 * Issues a synchronize_sched() when no reference to the module passed
290 * as parameter is found in the probes so the probe module can be 605 * as parameter is found in the probes so the probe module can be
291 * safely unloaded from now on. 606 * safely unloaded from now on.
607 *
608 * Internal callback only changed before the first probe is connected to it.
609 * Single probe private data can only be changed on 0 -> 1 and 2 -> 1
610 * transitions. All other transitions will leave the old private data valid.
611 * This makes the non-atomicity of the callback/private data updates valid.
612 *
613 * "special case" updates :
614 * 0 -> 1 callback
615 * 1 -> 0 callback
616 * 1 -> 2 callbacks
617 * 2 -> 1 callbacks
618 * Other updates all behave the same, just like the 2 -> 3 or 3 -> 2 updates.
619 * Site effect : marker_set_format may delete the marker entry (creating a
620 * replacement).
292 */ 621 */
293static void marker_update_probes(struct module *probe_module) 622static void marker_update_probes(void)
294{ 623{
295 int refcount = 0;
296
297 /* Core kernel markers */ 624 /* Core kernel markers */
298 marker_update_probe_range(__start___markers, 625 marker_update_probe_range(__start___markers, __stop___markers);
299 __stop___markers, probe_module, &refcount);
300 /* Markers in modules. */ 626 /* Markers in modules. */
301 module_update_markers(probe_module, &refcount); 627 module_update_markers();
302 if (probe_module && refcount == 0) {
303 synchronize_sched();
304 deferred_sync = 0;
305 }
306} 628}
307 629
308/** 630/**
@@ -310,33 +632,49 @@ static void marker_update_probes(struct module *probe_module)
310 * @name: marker name 632 * @name: marker name
311 * @format: format string 633 * @format: format string
312 * @probe: probe handler 634 * @probe: probe handler
313 * @private: probe private data 635 * @probe_private: probe private data
314 * 636 *
315 * private data must be a valid allocated memory address, or NULL. 637 * private data must be a valid allocated memory address, or NULL.
316 * Returns 0 if ok, error value on error. 638 * Returns 0 if ok, error value on error.
639 * The probe address must at least be aligned on the architecture pointer size.
317 */ 640 */
318int marker_probe_register(const char *name, const char *format, 641int marker_probe_register(const char *name, const char *format,
319 marker_probe_func *probe, void *private) 642 marker_probe_func *probe, void *probe_private)
320{ 643{
321 struct marker_entry *entry; 644 struct marker_entry *entry;
322 int ret = 0; 645 int ret = 0;
646 struct marker_probe_closure *old;
323 647
324 mutex_lock(&markers_mutex); 648 mutex_lock(&markers_mutex);
325 entry = get_marker(name); 649 entry = get_marker(name);
326 if (entry && entry->refcount) { 650 if (!entry) {
327 ret = -EBUSY; 651 entry = add_marker(name, format);
328 goto end; 652 if (IS_ERR(entry)) {
329 } 653 ret = PTR_ERR(entry);
330 if (deferred_sync) { 654 goto end;
331 synchronize_sched(); 655 }
332 deferred_sync = 0;
333 } 656 }
334 ret = add_marker(name, format, probe, private); 657 /*
335 if (ret) 658 * If we detect that a call_rcu is pending for this marker,
659 * make sure it's executed now.
660 */
661 if (entry->rcu_pending)
662 rcu_barrier();
663 old = marker_entry_add_probe(entry, probe, probe_private);
664 if (IS_ERR(old)) {
665 ret = PTR_ERR(old);
336 goto end; 666 goto end;
667 }
337 mutex_unlock(&markers_mutex); 668 mutex_unlock(&markers_mutex);
338 marker_update_probes(NULL); 669 marker_update_probes(); /* may update entry */
339 return ret; 670 mutex_lock(&markers_mutex);
671 entry = get_marker(name);
672 WARN_ON(!entry);
673 entry->oldptr = old;
674 entry->rcu_pending = 1;
675 /* write rcu_pending before calling the RCU callback */
676 smp_wmb();
677 call_rcu(&entry->rcu, free_old_closure);
340end: 678end:
341 mutex_unlock(&markers_mutex); 679 mutex_unlock(&markers_mutex);
342 return ret; 680 return ret;
@@ -346,171 +684,166 @@ EXPORT_SYMBOL_GPL(marker_probe_register);
346/** 684/**
347 * marker_probe_unregister - Disconnect a probe from a marker 685 * marker_probe_unregister - Disconnect a probe from a marker
348 * @name: marker name 686 * @name: marker name
687 * @probe: probe function pointer
688 * @probe_private: probe private data
349 * 689 *
350 * Returns the private data given to marker_probe_register, or an ERR_PTR(). 690 * Returns the private data given to marker_probe_register, or an ERR_PTR().
691 * We do not need to call a synchronize_sched to make sure the probes have
692 * finished running before doing a module unload, because the module unload
693 * itself uses stop_machine(), which insures that every preempt disabled section
694 * have finished.
351 */ 695 */
352void *marker_probe_unregister(const char *name) 696int marker_probe_unregister(const char *name,
697 marker_probe_func *probe, void *probe_private)
353{ 698{
354 struct module *probe_module;
355 struct marker_entry *entry; 699 struct marker_entry *entry;
356 void *private; 700 struct marker_probe_closure *old;
701 int ret = 0;
357 702
358 mutex_lock(&markers_mutex); 703 mutex_lock(&markers_mutex);
359 entry = get_marker(name); 704 entry = get_marker(name);
360 if (!entry) { 705 if (!entry) {
361 private = ERR_PTR(-ENOENT); 706 ret = -ENOENT;
362 goto end; 707 goto end;
363 } 708 }
364 entry->refcount = 0; 709 if (entry->rcu_pending)
365 /* In what module is the probe handler ? */ 710 rcu_barrier();
366 probe_module = __module_text_address((unsigned long)entry->probe); 711 old = marker_entry_remove_probe(entry, probe, probe_private);
367 private = remove_marker(name);
368 deferred_sync = 1;
369 mutex_unlock(&markers_mutex); 712 mutex_unlock(&markers_mutex);
370 marker_update_probes(probe_module); 713 marker_update_probes(); /* may update entry */
371 return private; 714 mutex_lock(&markers_mutex);
715 entry = get_marker(name);
716 entry->oldptr = old;
717 entry->rcu_pending = 1;
718 /* write rcu_pending before calling the RCU callback */
719 smp_wmb();
720 call_rcu(&entry->rcu, free_old_closure);
721 remove_marker(name); /* Ignore busy error message */
372end: 722end:
373 mutex_unlock(&markers_mutex); 723 mutex_unlock(&markers_mutex);
374 return private; 724 return ret;
375} 725}
376EXPORT_SYMBOL_GPL(marker_probe_unregister); 726EXPORT_SYMBOL_GPL(marker_probe_unregister);
377 727
378/** 728static struct marker_entry *
379 * marker_probe_unregister_private_data - Disconnect a probe from a marker 729get_marker_from_private_data(marker_probe_func *probe, void *probe_private)
380 * @private: probe private data
381 *
382 * Unregister a marker by providing the registered private data.
383 * Returns the private data given to marker_probe_register, or an ERR_PTR().
384 */
385void *marker_probe_unregister_private_data(void *private)
386{ 730{
387 struct module *probe_module;
388 struct hlist_head *head;
389 struct hlist_node *node;
390 struct marker_entry *entry; 731 struct marker_entry *entry;
391 int found = 0;
392 unsigned int i; 732 unsigned int i;
733 struct hlist_head *head;
734 struct hlist_node *node;
393 735
394 mutex_lock(&markers_mutex);
395 for (i = 0; i < MARKER_TABLE_SIZE; i++) { 736 for (i = 0; i < MARKER_TABLE_SIZE; i++) {
396 head = &marker_table[i]; 737 head = &marker_table[i];
397 hlist_for_each_entry(entry, node, head, hlist) { 738 hlist_for_each_entry(entry, node, head, hlist) {
398 if (entry->private == private) { 739 if (!entry->ptype) {
399 found = 1; 740 if (entry->single.func == probe
400 goto iter_end; 741 && entry->single.probe_private
742 == probe_private)
743 return entry;
744 } else {
745 struct marker_probe_closure *closure;
746 closure = entry->multi;
747 for (i = 0; closure[i].func; i++) {
748 if (closure[i].func == probe &&
749 closure[i].probe_private
750 == probe_private)
751 return entry;
752 }
401 } 753 }
402 } 754 }
403 } 755 }
404iter_end: 756 return NULL;
405 if (!found) {
406 private = ERR_PTR(-ENOENT);
407 goto end;
408 }
409 entry->refcount = 0;
410 /* In what module is the probe handler ? */
411 probe_module = __module_text_address((unsigned long)entry->probe);
412 private = remove_marker(entry->name);
413 deferred_sync = 1;
414 mutex_unlock(&markers_mutex);
415 marker_update_probes(probe_module);
416 return private;
417end:
418 mutex_unlock(&markers_mutex);
419 return private;
420} 757}
421EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data);
422 758
423/** 759/**
424 * marker_arm - Arm a marker 760 * marker_probe_unregister_private_data - Disconnect a probe from a marker
425 * @name: marker name 761 * @probe: probe function
762 * @probe_private: probe private data
426 * 763 *
427 * Activate a marker. It keeps a reference count of the number of 764 * Unregister a probe by providing the registered private data.
428 * arming/disarming done. 765 * Only removes the first marker found in hash table.
429 * Returns 0 if ok, error value on error. 766 * Return 0 on success or error value.
767 * We do not need to call a synchronize_sched to make sure the probes have
768 * finished running before doing a module unload, because the module unload
769 * itself uses stop_machine(), which insures that every preempt disabled section
770 * have finished.
430 */ 771 */
431int marker_arm(const char *name) 772int marker_probe_unregister_private_data(marker_probe_func *probe,
773 void *probe_private)
432{ 774{
433 struct marker_entry *entry; 775 struct marker_entry *entry;
434 int ret = 0; 776 int ret = 0;
777 struct marker_probe_closure *old;
435 778
436 mutex_lock(&markers_mutex); 779 mutex_lock(&markers_mutex);
437 entry = get_marker(name); 780 entry = get_marker_from_private_data(probe, probe_private);
438 if (!entry) { 781 if (!entry) {
439 ret = -ENOENT; 782 ret = -ENOENT;
440 goto end; 783 goto end;
441 } 784 }
442 /* 785 if (entry->rcu_pending)
443 * Only need to update probes when refcount passes from 0 to 1. 786 rcu_barrier();
444 */ 787 old = marker_entry_remove_probe(entry, NULL, probe_private);
445 if (entry->refcount++)
446 goto end;
447end:
448 mutex_unlock(&markers_mutex); 788 mutex_unlock(&markers_mutex);
449 marker_update_probes(NULL); 789 marker_update_probes(); /* may update entry */
450 return ret;
451}
452EXPORT_SYMBOL_GPL(marker_arm);
453
454/**
455 * marker_disarm - Disarm a marker
456 * @name: marker name
457 *
458 * Disarm a marker. It keeps a reference count of the number of arming/disarming
459 * done.
460 * Returns 0 if ok, error value on error.
461 */
462int marker_disarm(const char *name)
463{
464 struct marker_entry *entry;
465 int ret = 0;
466
467 mutex_lock(&markers_mutex); 790 mutex_lock(&markers_mutex);
468 entry = get_marker(name); 791 entry = get_marker_from_private_data(probe, probe_private);
469 if (!entry) { 792 WARN_ON(!entry);
470 ret = -ENOENT; 793 entry->oldptr = old;
471 goto end; 794 entry->rcu_pending = 1;
472 } 795 /* write rcu_pending before calling the RCU callback */
473 /* 796 smp_wmb();
474 * Only permit decrement refcount if higher than 0. 797 call_rcu(&entry->rcu, free_old_closure);
475 * Do probe update only on 1 -> 0 transition. 798 remove_marker(entry->name); /* Ignore busy error message */
476 */
477 if (entry->refcount) {
478 if (--entry->refcount)
479 goto end;
480 } else {
481 ret = -EPERM;
482 goto end;
483 }
484end: 799end:
485 mutex_unlock(&markers_mutex); 800 mutex_unlock(&markers_mutex);
486 marker_update_probes(NULL);
487 return ret; 801 return ret;
488} 802}
489EXPORT_SYMBOL_GPL(marker_disarm); 803EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data);
490 804
491/** 805/**
492 * marker_get_private_data - Get a marker's probe private data 806 * marker_get_private_data - Get a marker's probe private data
493 * @name: marker name 807 * @name: marker name
808 * @probe: probe to match
809 * @num: get the nth matching probe's private data
494 * 810 *
811 * Returns the nth private data pointer (starting from 0) matching, or an
812 * ERR_PTR.
495 * Returns the private data pointer, or an ERR_PTR. 813 * Returns the private data pointer, or an ERR_PTR.
496 * The private data pointer should _only_ be dereferenced if the caller is the 814 * The private data pointer should _only_ be dereferenced if the caller is the
497 * owner of the data, or its content could vanish. This is mostly used to 815 * owner of the data, or its content could vanish. This is mostly used to
498 * confirm that a caller is the owner of a registered probe. 816 * confirm that a caller is the owner of a registered probe.
499 */ 817 */
500void *marker_get_private_data(const char *name) 818void *marker_get_private_data(const char *name, marker_probe_func *probe,
819 int num)
501{ 820{
502 struct hlist_head *head; 821 struct hlist_head *head;
503 struct hlist_node *node; 822 struct hlist_node *node;
504 struct marker_entry *e; 823 struct marker_entry *e;
505 size_t name_len = strlen(name) + 1; 824 size_t name_len = strlen(name) + 1;
506 u32 hash = jhash(name, name_len-1, 0); 825 u32 hash = jhash(name, name_len-1, 0);
507 int found = 0; 826 int i;
508 827
509 head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)]; 828 head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
510 hlist_for_each_entry(e, node, head, hlist) { 829 hlist_for_each_entry(e, node, head, hlist) {
511 if (!strcmp(name, e->name)) { 830 if (!strcmp(name, e->name)) {
512 found = 1; 831 if (!e->ptype) {
513 return e->private; 832 if (num == 0 && e->single.func == probe)
833 return e->single.probe_private;
834 else
835 break;
836 } else {
837 struct marker_probe_closure *closure;
838 int match = 0;
839 closure = e->multi;
840 for (i = 0; closure[i].func; i++) {
841 if (closure[i].func != probe)
842 continue;
843 if (match++ == num)
844 return closure[i].probe_private;
845 }
846 }
514 } 847 }
515 } 848 }
516 return ERR_PTR(-ENOENT); 849 return ERR_PTR(-ENOENT);
diff --git a/kernel/module.c b/kernel/module.c
index 4202da97a1da..901cd6ac2f11 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -987,12 +987,11 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
987 return ret; 987 return ret;
988} 988}
989 989
990
991/* 990/*
992 * /sys/module/foo/sections stuff 991 * /sys/module/foo/sections stuff
993 * J. Corbet <corbet@lwn.net> 992 * J. Corbet <corbet@lwn.net>
994 */ 993 */
995#ifdef CONFIG_KALLSYMS 994#if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS)
996static ssize_t module_sect_show(struct module_attribute *mattr, 995static ssize_t module_sect_show(struct module_attribute *mattr,
997 struct module *mod, char *buf) 996 struct module *mod, char *buf)
998{ 997{
@@ -1188,7 +1187,7 @@ static inline void add_notes_attrs(struct module *mod, unsigned int nsect,
1188static inline void remove_notes_attrs(struct module *mod) 1187static inline void remove_notes_attrs(struct module *mod)
1189{ 1188{
1190} 1189}
1191#endif /* CONFIG_KALLSYMS */ 1190#endif
1192 1191
1193#ifdef CONFIG_SYSFS 1192#ifdef CONFIG_SYSFS
1194int module_add_modinfo_attrs(struct module *mod) 1193int module_add_modinfo_attrs(struct module *mod)
@@ -1231,9 +1230,7 @@ void module_remove_modinfo_attrs(struct module *mod)
1231 } 1230 }
1232 kfree(mod->modinfo_attrs); 1231 kfree(mod->modinfo_attrs);
1233} 1232}
1234#endif
1235 1233
1236#ifdef CONFIG_SYSFS
1237int mod_sysfs_init(struct module *mod) 1234int mod_sysfs_init(struct module *mod)
1238{ 1235{
1239 int err; 1236 int err;
@@ -2038,7 +2035,7 @@ static struct module *load_module(void __user *umod,
2038#ifdef CONFIG_MARKERS 2035#ifdef CONFIG_MARKERS
2039 if (!mod->taints) 2036 if (!mod->taints)
2040 marker_update_probe_range(mod->markers, 2037 marker_update_probe_range(mod->markers,
2041 mod->markers + mod->num_markers, NULL, NULL); 2038 mod->markers + mod->num_markers);
2042#endif 2039#endif
2043 err = module_finalize(hdr, sechdrs, mod); 2040 err = module_finalize(hdr, sechdrs, mod);
2044 if (err < 0) 2041 if (err < 0)
@@ -2564,7 +2561,7 @@ EXPORT_SYMBOL(struct_module);
2564#endif 2561#endif
2565 2562
2566#ifdef CONFIG_MARKERS 2563#ifdef CONFIG_MARKERS
2567void module_update_markers(struct module *probe_module, int *refcount) 2564void module_update_markers(void)
2568{ 2565{
2569 struct module *mod; 2566 struct module *mod;
2570 2567
@@ -2572,8 +2569,7 @@ void module_update_markers(struct module *probe_module, int *refcount)
2572 list_for_each_entry(mod, &modules, list) 2569 list_for_each_entry(mod, &modules, list)
2573 if (!mod->taints) 2570 if (!mod->taints)
2574 marker_update_probe_range(mod->markers, 2571 marker_update_probe_range(mod->markers,
2575 mod->markers + mod->num_markers, 2572 mod->markers + mod->num_markers);
2576 probe_module, refcount);
2577 mutex_unlock(&module_mutex); 2573 mutex_unlock(&module_mutex);
2578} 2574}
2579#endif 2575#endif
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 022c9c3cee6f..a9b04203a66d 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -767,9 +767,11 @@ common_timer_set(struct k_itimer *timr, int flags,
767 /* SIGEV_NONE timers are not queued ! See common_timer_get */ 767 /* SIGEV_NONE timers are not queued ! See common_timer_get */
768 if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) { 768 if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) {
769 /* Setup correct expiry time for relative timers */ 769 /* Setup correct expiry time for relative timers */
770 if (mode == HRTIMER_MODE_REL) 770 if (mode == HRTIMER_MODE_REL) {
771 timer->expires = ktime_add(timer->expires, 771 timer->expires =
772 timer->base->get_time()); 772 ktime_add_safe(timer->expires,
773 timer->base->get_time());
774 }
773 return 0; 775 return 0;
774 } 776 }
775 777
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 859a8e59773a..14a656cdc652 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -391,7 +391,7 @@ int hibernation_platform_enter(void)
391 goto Close; 391 goto Close;
392 392
393 suspend_console(); 393 suspend_console();
394 error = device_suspend(PMSG_SUSPEND); 394 error = device_suspend(PMSG_HIBERNATE);
395 if (error) 395 if (error)
396 goto Resume_console; 396 goto Resume_console;
397 397
@@ -404,7 +404,7 @@ int hibernation_platform_enter(void)
404 goto Finish; 404 goto Finish;
405 405
406 local_irq_disable(); 406 local_irq_disable();
407 error = device_power_down(PMSG_SUSPEND); 407 error = device_power_down(PMSG_HIBERNATE);
408 if (!error) { 408 if (!error) {
409 hibernation_ops->enter(); 409 hibernation_ops->enter();
410 /* We should never get here */ 410 /* We should never get here */
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 95250d7c8d91..72a020cabb4c 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -875,8 +875,8 @@ static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; }
875#endif /* CONFIG_HIGHMEM */ 875#endif /* CONFIG_HIGHMEM */
876 876
877/** 877/**
878 * saveable - Determine whether a non-highmem page should be included in 878 * saveable_page - Determine whether a non-highmem page should be included
879 * the suspend image. 879 * in the suspend image.
880 * 880 *
881 * We should save the page if it isn't Nosave, and is not in the range 881 * We should save the page if it isn't Nosave, and is not in the range
882 * of pages statically defined as 'unsaveable', and it isn't a part of 882 * of pages statically defined as 'unsaveable', and it isn't a part of
@@ -897,7 +897,8 @@ static struct page *saveable_page(unsigned long pfn)
897 if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) 897 if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page))
898 return NULL; 898 return NULL;
899 899
900 if (PageReserved(page) && pfn_is_nosave(pfn)) 900 if (PageReserved(page)
901 && (!kernel_page_present(page) || pfn_is_nosave(pfn)))
901 return NULL; 902 return NULL;
902 903
903 return page; 904 return page;
@@ -938,6 +939,25 @@ static inline void do_copy_page(long *dst, long *src)
938 *dst++ = *src++; 939 *dst++ = *src++;
939} 940}
940 941
942
943/**
944 * safe_copy_page - check if the page we are going to copy is marked as
945 * present in the kernel page tables (this always is the case if
946 * CONFIG_DEBUG_PAGEALLOC is not set and in that case
947 * kernel_page_present() always returns 'true').
948 */
949static void safe_copy_page(void *dst, struct page *s_page)
950{
951 if (kernel_page_present(s_page)) {
952 do_copy_page(dst, page_address(s_page));
953 } else {
954 kernel_map_pages(s_page, 1, 1);
955 do_copy_page(dst, page_address(s_page));
956 kernel_map_pages(s_page, 1, 0);
957 }
958}
959
960
941#ifdef CONFIG_HIGHMEM 961#ifdef CONFIG_HIGHMEM
942static inline struct page * 962static inline struct page *
943page_is_saveable(struct zone *zone, unsigned long pfn) 963page_is_saveable(struct zone *zone, unsigned long pfn)
@@ -946,8 +966,7 @@ page_is_saveable(struct zone *zone, unsigned long pfn)
946 saveable_highmem_page(pfn) : saveable_page(pfn); 966 saveable_highmem_page(pfn) : saveable_page(pfn);
947} 967}
948 968
949static inline void 969static void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
950copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
951{ 970{
952 struct page *s_page, *d_page; 971 struct page *s_page, *d_page;
953 void *src, *dst; 972 void *src, *dst;
@@ -961,29 +980,26 @@ copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
961 kunmap_atomic(src, KM_USER0); 980 kunmap_atomic(src, KM_USER0);
962 kunmap_atomic(dst, KM_USER1); 981 kunmap_atomic(dst, KM_USER1);
963 } else { 982 } else {
964 src = page_address(s_page);
965 if (PageHighMem(d_page)) { 983 if (PageHighMem(d_page)) {
966 /* Page pointed to by src may contain some kernel 984 /* Page pointed to by src may contain some kernel
967 * data modified by kmap_atomic() 985 * data modified by kmap_atomic()
968 */ 986 */
969 do_copy_page(buffer, src); 987 safe_copy_page(buffer, s_page);
970 dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0); 988 dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0);
971 memcpy(dst, buffer, PAGE_SIZE); 989 memcpy(dst, buffer, PAGE_SIZE);
972 kunmap_atomic(dst, KM_USER0); 990 kunmap_atomic(dst, KM_USER0);
973 } else { 991 } else {
974 dst = page_address(d_page); 992 safe_copy_page(page_address(d_page), s_page);
975 do_copy_page(dst, src);
976 } 993 }
977 } 994 }
978} 995}
979#else 996#else
980#define page_is_saveable(zone, pfn) saveable_page(pfn) 997#define page_is_saveable(zone, pfn) saveable_page(pfn)
981 998
982static inline void 999static inline void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
983copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
984{ 1000{
985 do_copy_page(page_address(pfn_to_page(dst_pfn)), 1001 safe_copy_page(page_address(pfn_to_page(dst_pfn)),
986 page_address(pfn_to_page(src_pfn))); 1002 pfn_to_page(src_pfn));
987} 1003}
988#endif /* CONFIG_HIGHMEM */ 1004#endif /* CONFIG_HIGHMEM */
989 1005
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 760dfc233a00..c09605f8d16c 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -56,7 +56,10 @@ static atomic_t rcu_barrier_cpu_count;
56static DEFINE_MUTEX(rcu_barrier_mutex); 56static DEFINE_MUTEX(rcu_barrier_mutex);
57static struct completion rcu_barrier_completion; 57static struct completion rcu_barrier_completion;
58 58
59/* Because of FASTCALL declaration of complete, we use this wrapper */ 59/*
60 * Awaken the corresponding synchronize_rcu() instance now that a
61 * grace period has elapsed.
62 */
60static void wakeme_after_rcu(struct rcu_head *head) 63static void wakeme_after_rcu(struct rcu_head *head)
61{ 64{
62 struct rcu_synchronize *rcu; 65 struct rcu_synchronize *rcu;
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 0deef71ff8d2..6522ae5b14a2 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -630,9 +630,12 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
630 set_current_state(state); 630 set_current_state(state);
631 631
632 /* Setup the timer, when timeout != NULL */ 632 /* Setup the timer, when timeout != NULL */
633 if (unlikely(timeout)) 633 if (unlikely(timeout)) {
634 hrtimer_start(&timeout->timer, timeout->timer.expires, 634 hrtimer_start(&timeout->timer, timeout->timer.expires,
635 HRTIMER_MODE_ABS); 635 HRTIMER_MODE_ABS);
636 if (!hrtimer_active(&timeout->timer))
637 timeout->task = NULL;
638 }
636 639
637 for (;;) { 640 for (;;) {
638 /* Try to acquire the lock: */ 641 /* Try to acquire the lock: */
diff --git a/kernel/sched.c b/kernel/sched.c
index 3eedd5260907..b387a8de26a5 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -155,7 +155,7 @@ struct rt_prio_array {
155 struct list_head queue[MAX_RT_PRIO]; 155 struct list_head queue[MAX_RT_PRIO];
156}; 156};
157 157
158#ifdef CONFIG_FAIR_GROUP_SCHED 158#ifdef CONFIG_GROUP_SCHED
159 159
160#include <linux/cgroup.h> 160#include <linux/cgroup.h>
161 161
@@ -165,19 +165,16 @@ static LIST_HEAD(task_groups);
165 165
166/* task group related information */ 166/* task group related information */
167struct task_group { 167struct task_group {
168#ifdef CONFIG_FAIR_CGROUP_SCHED 168#ifdef CONFIG_CGROUP_SCHED
169 struct cgroup_subsys_state css; 169 struct cgroup_subsys_state css;
170#endif 170#endif
171
172#ifdef CONFIG_FAIR_GROUP_SCHED
171 /* schedulable entities of this group on each cpu */ 173 /* schedulable entities of this group on each cpu */
172 struct sched_entity **se; 174 struct sched_entity **se;
173 /* runqueue "owned" by this group on each cpu */ 175 /* runqueue "owned" by this group on each cpu */
174 struct cfs_rq **cfs_rq; 176 struct cfs_rq **cfs_rq;
175 177
176 struct sched_rt_entity **rt_se;
177 struct rt_rq **rt_rq;
178
179 unsigned int rt_ratio;
180
181 /* 178 /*
182 * shares assigned to a task group governs how much of cpu bandwidth 179 * shares assigned to a task group governs how much of cpu bandwidth
183 * is allocated to the group. The more shares a group has, the more is 180 * is allocated to the group. The more shares a group has, the more is
@@ -213,33 +210,46 @@ struct task_group {
213 * 210 *
214 */ 211 */
215 unsigned long shares; 212 unsigned long shares;
213#endif
214
215#ifdef CONFIG_RT_GROUP_SCHED
216 struct sched_rt_entity **rt_se;
217 struct rt_rq **rt_rq;
218
219 u64 rt_runtime;
220#endif
216 221
217 struct rcu_head rcu; 222 struct rcu_head rcu;
218 struct list_head list; 223 struct list_head list;
219}; 224};
220 225
226#ifdef CONFIG_FAIR_GROUP_SCHED
221/* Default task group's sched entity on each cpu */ 227/* Default task group's sched entity on each cpu */
222static DEFINE_PER_CPU(struct sched_entity, init_sched_entity); 228static DEFINE_PER_CPU(struct sched_entity, init_sched_entity);
223/* Default task group's cfs_rq on each cpu */ 229/* Default task group's cfs_rq on each cpu */
224static DEFINE_PER_CPU(struct cfs_rq, init_cfs_rq) ____cacheline_aligned_in_smp; 230static DEFINE_PER_CPU(struct cfs_rq, init_cfs_rq) ____cacheline_aligned_in_smp;
225 231
226static DEFINE_PER_CPU(struct sched_rt_entity, init_sched_rt_entity);
227static DEFINE_PER_CPU(struct rt_rq, init_rt_rq) ____cacheline_aligned_in_smp;
228
229static struct sched_entity *init_sched_entity_p[NR_CPUS]; 232static struct sched_entity *init_sched_entity_p[NR_CPUS];
230static struct cfs_rq *init_cfs_rq_p[NR_CPUS]; 233static struct cfs_rq *init_cfs_rq_p[NR_CPUS];
234#endif
235
236#ifdef CONFIG_RT_GROUP_SCHED
237static DEFINE_PER_CPU(struct sched_rt_entity, init_sched_rt_entity);
238static DEFINE_PER_CPU(struct rt_rq, init_rt_rq) ____cacheline_aligned_in_smp;
231 239
232static struct sched_rt_entity *init_sched_rt_entity_p[NR_CPUS]; 240static struct sched_rt_entity *init_sched_rt_entity_p[NR_CPUS];
233static struct rt_rq *init_rt_rq_p[NR_CPUS]; 241static struct rt_rq *init_rt_rq_p[NR_CPUS];
242#endif
234 243
235/* task_group_mutex serializes add/remove of task groups and also changes to 244/* task_group_lock serializes add/remove of task groups and also changes to
236 * a task group's cpu shares. 245 * a task group's cpu shares.
237 */ 246 */
238static DEFINE_MUTEX(task_group_mutex); 247static DEFINE_SPINLOCK(task_group_lock);
239 248
240/* doms_cur_mutex serializes access to doms_cur[] array */ 249/* doms_cur_mutex serializes access to doms_cur[] array */
241static DEFINE_MUTEX(doms_cur_mutex); 250static DEFINE_MUTEX(doms_cur_mutex);
242 251
252#ifdef CONFIG_FAIR_GROUP_SCHED
243#ifdef CONFIG_SMP 253#ifdef CONFIG_SMP
244/* kernel thread that runs rebalance_shares() periodically */ 254/* kernel thread that runs rebalance_shares() periodically */
245static struct task_struct *lb_monitor_task; 255static struct task_struct *lb_monitor_task;
@@ -248,35 +258,40 @@ static int load_balance_monitor(void *unused);
248 258
249static void set_se_shares(struct sched_entity *se, unsigned long shares); 259static void set_se_shares(struct sched_entity *se, unsigned long shares);
250 260
261#ifdef CONFIG_USER_SCHED
262# define INIT_TASK_GROUP_LOAD (2*NICE_0_LOAD)
263#else
264# define INIT_TASK_GROUP_LOAD NICE_0_LOAD
265#endif
266
267#define MIN_GROUP_SHARES 2
268
269static int init_task_group_load = INIT_TASK_GROUP_LOAD;
270#endif
271
251/* Default task group. 272/* Default task group.
252 * Every task in system belong to this group at bootup. 273 * Every task in system belong to this group at bootup.
253 */ 274 */
254struct task_group init_task_group = { 275struct task_group init_task_group = {
276#ifdef CONFIG_FAIR_GROUP_SCHED
255 .se = init_sched_entity_p, 277 .se = init_sched_entity_p,
256 .cfs_rq = init_cfs_rq_p, 278 .cfs_rq = init_cfs_rq_p,
279#endif
257 280
281#ifdef CONFIG_RT_GROUP_SCHED
258 .rt_se = init_sched_rt_entity_p, 282 .rt_se = init_sched_rt_entity_p,
259 .rt_rq = init_rt_rq_p, 283 .rt_rq = init_rt_rq_p,
260};
261
262#ifdef CONFIG_FAIR_USER_SCHED
263# define INIT_TASK_GROUP_LOAD (2*NICE_0_LOAD)
264#else
265# define INIT_TASK_GROUP_LOAD NICE_0_LOAD
266#endif 284#endif
267 285};
268#define MIN_GROUP_SHARES 2
269
270static int init_task_group_load = INIT_TASK_GROUP_LOAD;
271 286
272/* return group to which a task belongs */ 287/* return group to which a task belongs */
273static inline struct task_group *task_group(struct task_struct *p) 288static inline struct task_group *task_group(struct task_struct *p)
274{ 289{
275 struct task_group *tg; 290 struct task_group *tg;
276 291
277#ifdef CONFIG_FAIR_USER_SCHED 292#ifdef CONFIG_USER_SCHED
278 tg = p->user->tg; 293 tg = p->user->tg;
279#elif defined(CONFIG_FAIR_CGROUP_SCHED) 294#elif defined(CONFIG_CGROUP_SCHED)
280 tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id), 295 tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id),
281 struct task_group, css); 296 struct task_group, css);
282#else 297#else
@@ -288,21 +303,15 @@ static inline struct task_group *task_group(struct task_struct *p)
288/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */ 303/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
289static inline void set_task_rq(struct task_struct *p, unsigned int cpu) 304static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
290{ 305{
306#ifdef CONFIG_FAIR_GROUP_SCHED
291 p->se.cfs_rq = task_group(p)->cfs_rq[cpu]; 307 p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
292 p->se.parent = task_group(p)->se[cpu]; 308 p->se.parent = task_group(p)->se[cpu];
309#endif
293 310
311#ifdef CONFIG_RT_GROUP_SCHED
294 p->rt.rt_rq = task_group(p)->rt_rq[cpu]; 312 p->rt.rt_rq = task_group(p)->rt_rq[cpu];
295 p->rt.parent = task_group(p)->rt_se[cpu]; 313 p->rt.parent = task_group(p)->rt_se[cpu];
296} 314#endif
297
298static inline void lock_task_group_list(void)
299{
300 mutex_lock(&task_group_mutex);
301}
302
303static inline void unlock_task_group_list(void)
304{
305 mutex_unlock(&task_group_mutex);
306} 315}
307 316
308static inline void lock_doms_cur(void) 317static inline void lock_doms_cur(void)
@@ -318,12 +327,10 @@ static inline void unlock_doms_cur(void)
318#else 327#else
319 328
320static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { } 329static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
321static inline void lock_task_group_list(void) { }
322static inline void unlock_task_group_list(void) { }
323static inline void lock_doms_cur(void) { } 330static inline void lock_doms_cur(void) { }
324static inline void unlock_doms_cur(void) { } 331static inline void unlock_doms_cur(void) { }
325 332
326#endif /* CONFIG_FAIR_GROUP_SCHED */ 333#endif /* CONFIG_GROUP_SCHED */
327 334
328/* CFS-related fields in a runqueue */ 335/* CFS-related fields in a runqueue */
329struct cfs_rq { 336struct cfs_rq {
@@ -363,7 +370,7 @@ struct cfs_rq {
363struct rt_rq { 370struct rt_rq {
364 struct rt_prio_array active; 371 struct rt_prio_array active;
365 unsigned long rt_nr_running; 372 unsigned long rt_nr_running;
366#if defined CONFIG_SMP || defined CONFIG_FAIR_GROUP_SCHED 373#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
367 int highest_prio; /* highest queued rt task prio */ 374 int highest_prio; /* highest queued rt task prio */
368#endif 375#endif
369#ifdef CONFIG_SMP 376#ifdef CONFIG_SMP
@@ -373,7 +380,9 @@ struct rt_rq {
373 int rt_throttled; 380 int rt_throttled;
374 u64 rt_time; 381 u64 rt_time;
375 382
376#ifdef CONFIG_FAIR_GROUP_SCHED 383#ifdef CONFIG_RT_GROUP_SCHED
384 unsigned long rt_nr_boosted;
385
377 struct rq *rq; 386 struct rq *rq;
378 struct list_head leaf_rt_rq_list; 387 struct list_head leaf_rt_rq_list;
379 struct task_group *tg; 388 struct task_group *tg;
@@ -447,6 +456,8 @@ struct rq {
447#ifdef CONFIG_FAIR_GROUP_SCHED 456#ifdef CONFIG_FAIR_GROUP_SCHED
448 /* list of leaf cfs_rq on this cpu: */ 457 /* list of leaf cfs_rq on this cpu: */
449 struct list_head leaf_cfs_rq_list; 458 struct list_head leaf_cfs_rq_list;
459#endif
460#ifdef CONFIG_RT_GROUP_SCHED
450 struct list_head leaf_rt_rq_list; 461 struct list_head leaf_rt_rq_list;
451#endif 462#endif
452 463
@@ -652,19 +663,21 @@ const_debug unsigned int sysctl_sched_features =
652const_debug unsigned int sysctl_sched_nr_migrate = 32; 663const_debug unsigned int sysctl_sched_nr_migrate = 32;
653 664
654/* 665/*
655 * period over which we measure -rt task cpu usage in ms. 666 * period over which we measure -rt task cpu usage in us.
656 * default: 1s 667 * default: 1s
657 */ 668 */
658const_debug unsigned int sysctl_sched_rt_period = 1000; 669unsigned int sysctl_sched_rt_period = 1000000;
659 670
660#define SCHED_RT_FRAC_SHIFT 16 671/*
661#define SCHED_RT_FRAC (1UL << SCHED_RT_FRAC_SHIFT) 672 * part of the period that we allow rt tasks to run in us.
673 * default: 0.95s
674 */
675int sysctl_sched_rt_runtime = 950000;
662 676
663/* 677/*
664 * ratio of time -rt tasks may consume. 678 * single value that denotes runtime == period, ie unlimited time.
665 * default: 95%
666 */ 679 */
667const_debug unsigned int sysctl_sched_rt_ratio = 62259; 680#define RUNTIME_INF ((u64)~0ULL)
668 681
669/* 682/*
670 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu 683 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
@@ -1818,6 +1831,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
1818 long old_state; 1831 long old_state;
1819 struct rq *rq; 1832 struct rq *rq;
1820 1833
1834 smp_wmb();
1821 rq = task_rq_lock(p, &flags); 1835 rq = task_rq_lock(p, &flags);
1822 old_state = p->state; 1836 old_state = p->state;
1823 if (!(old_state & state)) 1837 if (!(old_state & state))
@@ -3753,7 +3767,7 @@ void scheduler_tick(void)
3753 3767
3754#if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT) 3768#if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT)
3755 3769
3756void add_preempt_count(int val) 3770void __kprobes add_preempt_count(int val)
3757{ 3771{
3758 /* 3772 /*
3759 * Underflow? 3773 * Underflow?
@@ -3769,7 +3783,7 @@ void add_preempt_count(int val)
3769} 3783}
3770EXPORT_SYMBOL(add_preempt_count); 3784EXPORT_SYMBOL(add_preempt_count);
3771 3785
3772void sub_preempt_count(int val) 3786void __kprobes sub_preempt_count(int val)
3773{ 3787{
3774 /* 3788 /*
3775 * Underflow? 3789 * Underflow?
@@ -4571,6 +4585,15 @@ recheck:
4571 return -EPERM; 4585 return -EPERM;
4572 } 4586 }
4573 4587
4588#ifdef CONFIG_RT_GROUP_SCHED
4589 /*
4590 * Do not allow realtime tasks into groups that have no runtime
4591 * assigned.
4592 */
4593 if (rt_policy(policy) && task_group(p)->rt_runtime == 0)
4594 return -EPERM;
4595#endif
4596
4574 retval = security_task_setscheduler(p, policy, param); 4597 retval = security_task_setscheduler(p, policy, param);
4575 if (retval) 4598 if (retval)
4576 return retval; 4599 return retval;
@@ -7112,7 +7135,7 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
7112 /* delimiter for bitsearch: */ 7135 /* delimiter for bitsearch: */
7113 __set_bit(MAX_RT_PRIO, array->bitmap); 7136 __set_bit(MAX_RT_PRIO, array->bitmap);
7114 7137
7115#if defined CONFIG_SMP || defined CONFIG_FAIR_GROUP_SCHED 7138#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
7116 rt_rq->highest_prio = MAX_RT_PRIO; 7139 rt_rq->highest_prio = MAX_RT_PRIO;
7117#endif 7140#endif
7118#ifdef CONFIG_SMP 7141#ifdef CONFIG_SMP
@@ -7123,7 +7146,8 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
7123 rt_rq->rt_time = 0; 7146 rt_rq->rt_time = 0;
7124 rt_rq->rt_throttled = 0; 7147 rt_rq->rt_throttled = 0;
7125 7148
7126#ifdef CONFIG_FAIR_GROUP_SCHED 7149#ifdef CONFIG_RT_GROUP_SCHED
7150 rt_rq->rt_nr_boosted = 0;
7127 rt_rq->rq = rq; 7151 rt_rq->rq = rq;
7128#endif 7152#endif
7129} 7153}
@@ -7146,7 +7170,9 @@ static void init_tg_cfs_entry(struct rq *rq, struct task_group *tg,
7146 se->load.inv_weight = div64_64(1ULL<<32, se->load.weight); 7170 se->load.inv_weight = div64_64(1ULL<<32, se->load.weight);
7147 se->parent = NULL; 7171 se->parent = NULL;
7148} 7172}
7173#endif
7149 7174
7175#ifdef CONFIG_RT_GROUP_SCHED
7150static void init_tg_rt_entry(struct rq *rq, struct task_group *tg, 7176static void init_tg_rt_entry(struct rq *rq, struct task_group *tg,
7151 struct rt_rq *rt_rq, struct sched_rt_entity *rt_se, 7177 struct rt_rq *rt_rq, struct sched_rt_entity *rt_se,
7152 int cpu, int add) 7178 int cpu, int add)
@@ -7175,7 +7201,7 @@ void __init sched_init(void)
7175 init_defrootdomain(); 7201 init_defrootdomain();
7176#endif 7202#endif
7177 7203
7178#ifdef CONFIG_FAIR_GROUP_SCHED 7204#ifdef CONFIG_GROUP_SCHED
7179 list_add(&init_task_group.list, &task_groups); 7205 list_add(&init_task_group.list, &task_groups);
7180#endif 7206#endif
7181 7207
@@ -7196,7 +7222,10 @@ void __init sched_init(void)
7196 &per_cpu(init_cfs_rq, i), 7222 &per_cpu(init_cfs_rq, i),
7197 &per_cpu(init_sched_entity, i), i, 1); 7223 &per_cpu(init_sched_entity, i), i, 1);
7198 7224
7199 init_task_group.rt_ratio = sysctl_sched_rt_ratio; /* XXX */ 7225#endif
7226#ifdef CONFIG_RT_GROUP_SCHED
7227 init_task_group.rt_runtime =
7228 sysctl_sched_rt_runtime * NSEC_PER_USEC;
7200 INIT_LIST_HEAD(&rq->leaf_rt_rq_list); 7229 INIT_LIST_HEAD(&rq->leaf_rt_rq_list);
7201 init_tg_rt_entry(rq, &init_task_group, 7230 init_tg_rt_entry(rq, &init_task_group,
7202 &per_cpu(init_rt_rq, i), 7231 &per_cpu(init_rt_rq, i),
@@ -7303,7 +7332,7 @@ void normalize_rt_tasks(void)
7303 unsigned long flags; 7332 unsigned long flags;
7304 struct rq *rq; 7333 struct rq *rq;
7305 7334
7306 read_lock_irq(&tasklist_lock); 7335 read_lock_irqsave(&tasklist_lock, flags);
7307 do_each_thread(g, p) { 7336 do_each_thread(g, p) {
7308 /* 7337 /*
7309 * Only normalize user tasks: 7338 * Only normalize user tasks:
@@ -7329,16 +7358,16 @@ void normalize_rt_tasks(void)
7329 continue; 7358 continue;
7330 } 7359 }
7331 7360
7332 spin_lock_irqsave(&p->pi_lock, flags); 7361 spin_lock(&p->pi_lock);
7333 rq = __task_rq_lock(p); 7362 rq = __task_rq_lock(p);
7334 7363
7335 normalize_task(rq, p); 7364 normalize_task(rq, p);
7336 7365
7337 __task_rq_unlock(rq); 7366 __task_rq_unlock(rq);
7338 spin_unlock_irqrestore(&p->pi_lock, flags); 7367 spin_unlock(&p->pi_lock);
7339 } while_each_thread(g, p); 7368 } while_each_thread(g, p);
7340 7369
7341 read_unlock_irq(&tasklist_lock); 7370 read_unlock_irqrestore(&tasklist_lock, flags);
7342} 7371}
7343 7372
7344#endif /* CONFIG_MAGIC_SYSRQ */ 7373#endif /* CONFIG_MAGIC_SYSRQ */
@@ -7387,9 +7416,9 @@ void set_curr_task(int cpu, struct task_struct *p)
7387 7416
7388#endif 7417#endif
7389 7418
7390#ifdef CONFIG_FAIR_GROUP_SCHED 7419#ifdef CONFIG_GROUP_SCHED
7391 7420
7392#ifdef CONFIG_SMP 7421#if defined CONFIG_FAIR_GROUP_SCHED && defined CONFIG_SMP
7393/* 7422/*
7394 * distribute shares of all task groups among their schedulable entities, 7423 * distribute shares of all task groups among their schedulable entities,
7395 * to reflect load distribution across cpus. 7424 * to reflect load distribution across cpus.
@@ -7540,7 +7569,8 @@ static int load_balance_monitor(void *unused)
7540} 7569}
7541#endif /* CONFIG_SMP */ 7570#endif /* CONFIG_SMP */
7542 7571
7543static void free_sched_group(struct task_group *tg) 7572#ifdef CONFIG_FAIR_GROUP_SCHED
7573static void free_fair_sched_group(struct task_group *tg)
7544{ 7574{
7545 int i; 7575 int i;
7546 7576
@@ -7549,49 +7579,27 @@ static void free_sched_group(struct task_group *tg)
7549 kfree(tg->cfs_rq[i]); 7579 kfree(tg->cfs_rq[i]);
7550 if (tg->se) 7580 if (tg->se)
7551 kfree(tg->se[i]); 7581 kfree(tg->se[i]);
7552 if (tg->rt_rq)
7553 kfree(tg->rt_rq[i]);
7554 if (tg->rt_se)
7555 kfree(tg->rt_se[i]);
7556 } 7582 }
7557 7583
7558 kfree(tg->cfs_rq); 7584 kfree(tg->cfs_rq);
7559 kfree(tg->se); 7585 kfree(tg->se);
7560 kfree(tg->rt_rq);
7561 kfree(tg->rt_se);
7562 kfree(tg);
7563} 7586}
7564 7587
7565/* allocate runqueue etc for a new task group */ 7588static int alloc_fair_sched_group(struct task_group *tg)
7566struct task_group *sched_create_group(void)
7567{ 7589{
7568 struct task_group *tg;
7569 struct cfs_rq *cfs_rq; 7590 struct cfs_rq *cfs_rq;
7570 struct sched_entity *se; 7591 struct sched_entity *se;
7571 struct rt_rq *rt_rq;
7572 struct sched_rt_entity *rt_se;
7573 struct rq *rq; 7592 struct rq *rq;
7574 int i; 7593 int i;
7575 7594
7576 tg = kzalloc(sizeof(*tg), GFP_KERNEL);
7577 if (!tg)
7578 return ERR_PTR(-ENOMEM);
7579
7580 tg->cfs_rq = kzalloc(sizeof(cfs_rq) * NR_CPUS, GFP_KERNEL); 7595 tg->cfs_rq = kzalloc(sizeof(cfs_rq) * NR_CPUS, GFP_KERNEL);
7581 if (!tg->cfs_rq) 7596 if (!tg->cfs_rq)
7582 goto err; 7597 goto err;
7583 tg->se = kzalloc(sizeof(se) * NR_CPUS, GFP_KERNEL); 7598 tg->se = kzalloc(sizeof(se) * NR_CPUS, GFP_KERNEL);
7584 if (!tg->se) 7599 if (!tg->se)
7585 goto err; 7600 goto err;
7586 tg->rt_rq = kzalloc(sizeof(rt_rq) * NR_CPUS, GFP_KERNEL);
7587 if (!tg->rt_rq)
7588 goto err;
7589 tg->rt_se = kzalloc(sizeof(rt_se) * NR_CPUS, GFP_KERNEL);
7590 if (!tg->rt_se)
7591 goto err;
7592 7601
7593 tg->shares = NICE_0_LOAD; 7602 tg->shares = NICE_0_LOAD;
7594 tg->rt_ratio = 0; /* XXX */
7595 7603
7596 for_each_possible_cpu(i) { 7604 for_each_possible_cpu(i) {
7597 rq = cpu_rq(i); 7605 rq = cpu_rq(i);
@@ -7606,6 +7614,79 @@ struct task_group *sched_create_group(void)
7606 if (!se) 7614 if (!se)
7607 goto err; 7615 goto err;
7608 7616
7617 init_tg_cfs_entry(rq, tg, cfs_rq, se, i, 0);
7618 }
7619
7620 return 1;
7621
7622 err:
7623 return 0;
7624}
7625
7626static inline void register_fair_sched_group(struct task_group *tg, int cpu)
7627{
7628 list_add_rcu(&tg->cfs_rq[cpu]->leaf_cfs_rq_list,
7629 &cpu_rq(cpu)->leaf_cfs_rq_list);
7630}
7631
7632static inline void unregister_fair_sched_group(struct task_group *tg, int cpu)
7633{
7634 list_del_rcu(&tg->cfs_rq[cpu]->leaf_cfs_rq_list);
7635}
7636#else
7637static inline void free_fair_sched_group(struct task_group *tg)
7638{
7639}
7640
7641static inline int alloc_fair_sched_group(struct task_group *tg)
7642{
7643 return 1;
7644}
7645
7646static inline void register_fair_sched_group(struct task_group *tg, int cpu)
7647{
7648}
7649
7650static inline void unregister_fair_sched_group(struct task_group *tg, int cpu)
7651{
7652}
7653#endif
7654
7655#ifdef CONFIG_RT_GROUP_SCHED
7656static void free_rt_sched_group(struct task_group *tg)
7657{
7658 int i;
7659
7660 for_each_possible_cpu(i) {
7661 if (tg->rt_rq)
7662 kfree(tg->rt_rq[i]);
7663 if (tg->rt_se)
7664 kfree(tg->rt_se[i]);
7665 }
7666
7667 kfree(tg->rt_rq);
7668 kfree(tg->rt_se);
7669}
7670
7671static int alloc_rt_sched_group(struct task_group *tg)
7672{
7673 struct rt_rq *rt_rq;
7674 struct sched_rt_entity *rt_se;
7675 struct rq *rq;
7676 int i;
7677
7678 tg->rt_rq = kzalloc(sizeof(rt_rq) * NR_CPUS, GFP_KERNEL);
7679 if (!tg->rt_rq)
7680 goto err;
7681 tg->rt_se = kzalloc(sizeof(rt_se) * NR_CPUS, GFP_KERNEL);
7682 if (!tg->rt_se)
7683 goto err;
7684
7685 tg->rt_runtime = 0;
7686
7687 for_each_possible_cpu(i) {
7688 rq = cpu_rq(i);
7689
7609 rt_rq = kmalloc_node(sizeof(struct rt_rq), 7690 rt_rq = kmalloc_node(sizeof(struct rt_rq),
7610 GFP_KERNEL|__GFP_ZERO, cpu_to_node(i)); 7691 GFP_KERNEL|__GFP_ZERO, cpu_to_node(i));
7611 if (!rt_rq) 7692 if (!rt_rq)
@@ -7616,20 +7697,75 @@ struct task_group *sched_create_group(void)
7616 if (!rt_se) 7697 if (!rt_se)
7617 goto err; 7698 goto err;
7618 7699
7619 init_tg_cfs_entry(rq, tg, cfs_rq, se, i, 0);
7620 init_tg_rt_entry(rq, tg, rt_rq, rt_se, i, 0); 7700 init_tg_rt_entry(rq, tg, rt_rq, rt_se, i, 0);
7621 } 7701 }
7622 7702
7623 lock_task_group_list(); 7703 return 1;
7704
7705 err:
7706 return 0;
7707}
7708
7709static inline void register_rt_sched_group(struct task_group *tg, int cpu)
7710{
7711 list_add_rcu(&tg->rt_rq[cpu]->leaf_rt_rq_list,
7712 &cpu_rq(cpu)->leaf_rt_rq_list);
7713}
7714
7715static inline void unregister_rt_sched_group(struct task_group *tg, int cpu)
7716{
7717 list_del_rcu(&tg->rt_rq[cpu]->leaf_rt_rq_list);
7718}
7719#else
7720static inline void free_rt_sched_group(struct task_group *tg)
7721{
7722}
7723
7724static inline int alloc_rt_sched_group(struct task_group *tg)
7725{
7726 return 1;
7727}
7728
7729static inline void register_rt_sched_group(struct task_group *tg, int cpu)
7730{
7731}
7732
7733static inline void unregister_rt_sched_group(struct task_group *tg, int cpu)
7734{
7735}
7736#endif
7737
7738static void free_sched_group(struct task_group *tg)
7739{
7740 free_fair_sched_group(tg);
7741 free_rt_sched_group(tg);
7742 kfree(tg);
7743}
7744
7745/* allocate runqueue etc for a new task group */
7746struct task_group *sched_create_group(void)
7747{
7748 struct task_group *tg;
7749 unsigned long flags;
7750 int i;
7751
7752 tg = kzalloc(sizeof(*tg), GFP_KERNEL);
7753 if (!tg)
7754 return ERR_PTR(-ENOMEM);
7755
7756 if (!alloc_fair_sched_group(tg))
7757 goto err;
7758
7759 if (!alloc_rt_sched_group(tg))
7760 goto err;
7761
7762 spin_lock_irqsave(&task_group_lock, flags);
7624 for_each_possible_cpu(i) { 7763 for_each_possible_cpu(i) {
7625 rq = cpu_rq(i); 7764 register_fair_sched_group(tg, i);
7626 cfs_rq = tg->cfs_rq[i]; 7765 register_rt_sched_group(tg, i);
7627 list_add_rcu(&cfs_rq->leaf_cfs_rq_list, &rq->leaf_cfs_rq_list);
7628 rt_rq = tg->rt_rq[i];
7629 list_add_rcu(&rt_rq->leaf_rt_rq_list, &rq->leaf_rt_rq_list);
7630 } 7766 }
7631 list_add_rcu(&tg->list, &task_groups); 7767 list_add_rcu(&tg->list, &task_groups);
7632 unlock_task_group_list(); 7768 spin_unlock_irqrestore(&task_group_lock, flags);
7633 7769
7634 return tg; 7770 return tg;
7635 7771
@@ -7648,21 +7784,16 @@ static void free_sched_group_rcu(struct rcu_head *rhp)
7648/* Destroy runqueue etc associated with a task group */ 7784/* Destroy runqueue etc associated with a task group */
7649void sched_destroy_group(struct task_group *tg) 7785void sched_destroy_group(struct task_group *tg)
7650{ 7786{
7651 struct cfs_rq *cfs_rq = NULL; 7787 unsigned long flags;
7652 struct rt_rq *rt_rq = NULL;
7653 int i; 7788 int i;
7654 7789
7655 lock_task_group_list(); 7790 spin_lock_irqsave(&task_group_lock, flags);
7656 for_each_possible_cpu(i) { 7791 for_each_possible_cpu(i) {
7657 cfs_rq = tg->cfs_rq[i]; 7792 unregister_fair_sched_group(tg, i);
7658 list_del_rcu(&cfs_rq->leaf_cfs_rq_list); 7793 unregister_rt_sched_group(tg, i);
7659 rt_rq = tg->rt_rq[i];
7660 list_del_rcu(&rt_rq->leaf_rt_rq_list);
7661 } 7794 }
7662 list_del_rcu(&tg->list); 7795 list_del_rcu(&tg->list);
7663 unlock_task_group_list(); 7796 spin_unlock_irqrestore(&task_group_lock, flags);
7664
7665 BUG_ON(!cfs_rq);
7666 7797
7667 /* wait for possible concurrent references to cfs_rqs complete */ 7798 /* wait for possible concurrent references to cfs_rqs complete */
7668 call_rcu(&tg->rcu, free_sched_group_rcu); 7799 call_rcu(&tg->rcu, free_sched_group_rcu);
@@ -7703,6 +7834,7 @@ void sched_move_task(struct task_struct *tsk)
7703 task_rq_unlock(rq, &flags); 7834 task_rq_unlock(rq, &flags);
7704} 7835}
7705 7836
7837#ifdef CONFIG_FAIR_GROUP_SCHED
7706/* rq->lock to be locked by caller */ 7838/* rq->lock to be locked by caller */
7707static void set_se_shares(struct sched_entity *se, unsigned long shares) 7839static void set_se_shares(struct sched_entity *se, unsigned long shares)
7708{ 7840{
@@ -7728,13 +7860,14 @@ static void set_se_shares(struct sched_entity *se, unsigned long shares)
7728 } 7860 }
7729} 7861}
7730 7862
7863static DEFINE_MUTEX(shares_mutex);
7864
7731int sched_group_set_shares(struct task_group *tg, unsigned long shares) 7865int sched_group_set_shares(struct task_group *tg, unsigned long shares)
7732{ 7866{
7733 int i; 7867 int i;
7734 struct cfs_rq *cfs_rq; 7868 unsigned long flags;
7735 struct rq *rq;
7736 7869
7737 lock_task_group_list(); 7870 mutex_lock(&shares_mutex);
7738 if (tg->shares == shares) 7871 if (tg->shares == shares)
7739 goto done; 7872 goto done;
7740 7873
@@ -7746,10 +7879,10 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
7746 * load_balance_fair) from referring to this group first, 7879 * load_balance_fair) from referring to this group first,
7747 * by taking it off the rq->leaf_cfs_rq_list on each cpu. 7880 * by taking it off the rq->leaf_cfs_rq_list on each cpu.
7748 */ 7881 */
7749 for_each_possible_cpu(i) { 7882 spin_lock_irqsave(&task_group_lock, flags);
7750 cfs_rq = tg->cfs_rq[i]; 7883 for_each_possible_cpu(i)
7751 list_del_rcu(&cfs_rq->leaf_cfs_rq_list); 7884 unregister_fair_sched_group(tg, i);
7752 } 7885 spin_unlock_irqrestore(&task_group_lock, flags);
7753 7886
7754 /* wait for any ongoing reference to this group to finish */ 7887 /* wait for any ongoing reference to this group to finish */
7755 synchronize_sched(); 7888 synchronize_sched();
@@ -7769,13 +7902,12 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
7769 * Enable load balance activity on this group, by inserting it back on 7902 * Enable load balance activity on this group, by inserting it back on
7770 * each cpu's rq->leaf_cfs_rq_list. 7903 * each cpu's rq->leaf_cfs_rq_list.
7771 */ 7904 */
7772 for_each_possible_cpu(i) { 7905 spin_lock_irqsave(&task_group_lock, flags);
7773 rq = cpu_rq(i); 7906 for_each_possible_cpu(i)
7774 cfs_rq = tg->cfs_rq[i]; 7907 register_fair_sched_group(tg, i);
7775 list_add_rcu(&cfs_rq->leaf_cfs_rq_list, &rq->leaf_cfs_rq_list); 7908 spin_unlock_irqrestore(&task_group_lock, flags);
7776 }
7777done: 7909done:
7778 unlock_task_group_list(); 7910 mutex_unlock(&shares_mutex);
7779 return 0; 7911 return 0;
7780} 7912}
7781 7913
@@ -7783,35 +7915,84 @@ unsigned long sched_group_shares(struct task_group *tg)
7783{ 7915{
7784 return tg->shares; 7916 return tg->shares;
7785} 7917}
7918#endif
7786 7919
7920#ifdef CONFIG_RT_GROUP_SCHED
7787/* 7921/*
7788 * Ensure the total rt_ratio <= sysctl_sched_rt_ratio 7922 * Ensure that the real time constraints are schedulable.
7789 */ 7923 */
7790int sched_group_set_rt_ratio(struct task_group *tg, unsigned long rt_ratio) 7924static DEFINE_MUTEX(rt_constraints_mutex);
7925
7926static unsigned long to_ratio(u64 period, u64 runtime)
7927{
7928 if (runtime == RUNTIME_INF)
7929 return 1ULL << 16;
7930
7931 runtime *= (1ULL << 16);
7932 div64_64(runtime, period);
7933 return runtime;
7934}
7935
7936static int __rt_schedulable(struct task_group *tg, u64 period, u64 runtime)
7791{ 7937{
7792 struct task_group *tgi; 7938 struct task_group *tgi;
7793 unsigned long total = 0; 7939 unsigned long total = 0;
7940 unsigned long global_ratio =
7941 to_ratio(sysctl_sched_rt_period,
7942 sysctl_sched_rt_runtime < 0 ?
7943 RUNTIME_INF : sysctl_sched_rt_runtime);
7794 7944
7795 rcu_read_lock(); 7945 rcu_read_lock();
7796 list_for_each_entry_rcu(tgi, &task_groups, list) 7946 list_for_each_entry_rcu(tgi, &task_groups, list) {
7797 total += tgi->rt_ratio; 7947 if (tgi == tg)
7798 rcu_read_unlock(); 7948 continue;
7799 7949
7800 if (total + rt_ratio - tg->rt_ratio > sysctl_sched_rt_ratio) 7950 total += to_ratio(period, tgi->rt_runtime);
7801 return -EINVAL; 7951 }
7952 rcu_read_unlock();
7802 7953
7803 tg->rt_ratio = rt_ratio; 7954 return total + to_ratio(period, runtime) < global_ratio;
7804 return 0;
7805} 7955}
7806 7956
7807unsigned long sched_group_rt_ratio(struct task_group *tg) 7957int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us)
7808{ 7958{
7809 return tg->rt_ratio; 7959 u64 rt_runtime, rt_period;
7960 int err = 0;
7961
7962 rt_period = sysctl_sched_rt_period * NSEC_PER_USEC;
7963 rt_runtime = (u64)rt_runtime_us * NSEC_PER_USEC;
7964 if (rt_runtime_us == -1)
7965 rt_runtime = rt_period;
7966
7967 mutex_lock(&rt_constraints_mutex);
7968 if (!__rt_schedulable(tg, rt_period, rt_runtime)) {
7969 err = -EINVAL;
7970 goto unlock;
7971 }
7972 if (rt_runtime_us == -1)
7973 rt_runtime = RUNTIME_INF;
7974 tg->rt_runtime = rt_runtime;
7975 unlock:
7976 mutex_unlock(&rt_constraints_mutex);
7977
7978 return err;
7810} 7979}
7811 7980
7812#endif /* CONFIG_FAIR_GROUP_SCHED */ 7981long sched_group_rt_runtime(struct task_group *tg)
7982{
7983 u64 rt_runtime_us;
7984
7985 if (tg->rt_runtime == RUNTIME_INF)
7986 return -1;
7987
7988 rt_runtime_us = tg->rt_runtime;
7989 do_div(rt_runtime_us, NSEC_PER_USEC);
7990 return rt_runtime_us;
7991}
7992#endif
7993#endif /* CONFIG_GROUP_SCHED */
7813 7994
7814#ifdef CONFIG_FAIR_CGROUP_SCHED 7995#ifdef CONFIG_CGROUP_SCHED
7815 7996
7816/* return corresponding task_group object of a cgroup */ 7997/* return corresponding task_group object of a cgroup */
7817static inline struct task_group *cgroup_tg(struct cgroup *cgrp) 7998static inline struct task_group *cgroup_tg(struct cgroup *cgrp)
@@ -7857,9 +8038,15 @@ static int
7857cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, 8038cpu_cgroup_can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
7858 struct task_struct *tsk) 8039 struct task_struct *tsk)
7859{ 8040{
8041#ifdef CONFIG_RT_GROUP_SCHED
8042 /* Don't accept realtime tasks when there is no way for them to run */
8043 if (rt_task(tsk) && cgroup_tg(cgrp)->rt_runtime == 0)
8044 return -EINVAL;
8045#else
7860 /* We don't support RT-tasks being in separate groups */ 8046 /* We don't support RT-tasks being in separate groups */
7861 if (tsk->sched_class != &fair_sched_class) 8047 if (tsk->sched_class != &fair_sched_class)
7862 return -EINVAL; 8048 return -EINVAL;
8049#endif
7863 8050
7864 return 0; 8051 return 0;
7865} 8052}
@@ -7871,6 +8058,7 @@ cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
7871 sched_move_task(tsk); 8058 sched_move_task(tsk);
7872} 8059}
7873 8060
8061#ifdef CONFIG_FAIR_GROUP_SCHED
7874static int cpu_shares_write_uint(struct cgroup *cgrp, struct cftype *cftype, 8062static int cpu_shares_write_uint(struct cgroup *cgrp, struct cftype *cftype,
7875 u64 shareval) 8063 u64 shareval)
7876{ 8064{
@@ -7883,31 +8071,70 @@ static u64 cpu_shares_read_uint(struct cgroup *cgrp, struct cftype *cft)
7883 8071
7884 return (u64) tg->shares; 8072 return (u64) tg->shares;
7885} 8073}
8074#endif
7886 8075
7887static int cpu_rt_ratio_write_uint(struct cgroup *cgrp, struct cftype *cftype, 8076#ifdef CONFIG_RT_GROUP_SCHED
7888 u64 rt_ratio_val) 8077static int cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft,
8078 struct file *file,
8079 const char __user *userbuf,
8080 size_t nbytes, loff_t *unused_ppos)
7889{ 8081{
7890 return sched_group_set_rt_ratio(cgroup_tg(cgrp), rt_ratio_val); 8082 char buffer[64];
8083 int retval = 0;
8084 s64 val;
8085 char *end;
8086
8087 if (!nbytes)
8088 return -EINVAL;
8089 if (nbytes >= sizeof(buffer))
8090 return -E2BIG;
8091 if (copy_from_user(buffer, userbuf, nbytes))
8092 return -EFAULT;
8093
8094 buffer[nbytes] = 0; /* nul-terminate */
8095
8096 /* strip newline if necessary */
8097 if (nbytes && (buffer[nbytes-1] == '\n'))
8098 buffer[nbytes-1] = 0;
8099 val = simple_strtoll(buffer, &end, 0);
8100 if (*end)
8101 return -EINVAL;
8102
8103 /* Pass to subsystem */
8104 retval = sched_group_set_rt_runtime(cgroup_tg(cgrp), val);
8105 if (!retval)
8106 retval = nbytes;
8107 return retval;
7891} 8108}
7892 8109
7893static u64 cpu_rt_ratio_read_uint(struct cgroup *cgrp, struct cftype *cft) 8110static ssize_t cpu_rt_runtime_read(struct cgroup *cgrp, struct cftype *cft,
8111 struct file *file,
8112 char __user *buf, size_t nbytes,
8113 loff_t *ppos)
7894{ 8114{
7895 struct task_group *tg = cgroup_tg(cgrp); 8115 char tmp[64];
8116 long val = sched_group_rt_runtime(cgroup_tg(cgrp));
8117 int len = sprintf(tmp, "%ld\n", val);
7896 8118
7897 return (u64) tg->rt_ratio; 8119 return simple_read_from_buffer(buf, nbytes, ppos, tmp, len);
7898} 8120}
8121#endif
7899 8122
7900static struct cftype cpu_files[] = { 8123static struct cftype cpu_files[] = {
8124#ifdef CONFIG_FAIR_GROUP_SCHED
7901 { 8125 {
7902 .name = "shares", 8126 .name = "shares",
7903 .read_uint = cpu_shares_read_uint, 8127 .read_uint = cpu_shares_read_uint,
7904 .write_uint = cpu_shares_write_uint, 8128 .write_uint = cpu_shares_write_uint,
7905 }, 8129 },
8130#endif
8131#ifdef CONFIG_RT_GROUP_SCHED
7906 { 8132 {
7907 .name = "rt_ratio", 8133 .name = "rt_runtime_us",
7908 .read_uint = cpu_rt_ratio_read_uint, 8134 .read = cpu_rt_runtime_read,
7909 .write_uint = cpu_rt_ratio_write_uint, 8135 .write = cpu_rt_runtime_write,
7910 }, 8136 },
8137#endif
7911}; 8138};
7912 8139
7913static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont) 8140static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont)
@@ -7926,7 +8153,7 @@ struct cgroup_subsys cpu_cgroup_subsys = {
7926 .early_init = 1, 8153 .early_init = 1,
7927}; 8154};
7928 8155
7929#endif /* CONFIG_FAIR_CGROUP_SCHED */ 8156#endif /* CONFIG_CGROUP_SCHED */
7930 8157
7931#ifdef CONFIG_CGROUP_CPUACCT 8158#ifdef CONFIG_CGROUP_CPUACCT
7932 8159
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 274b40d7bef2..f54792b175b2 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -55,14 +55,14 @@ static inline int on_rt_rq(struct sched_rt_entity *rt_se)
55 return !list_empty(&rt_se->run_list); 55 return !list_empty(&rt_se->run_list);
56} 56}
57 57
58#ifdef CONFIG_FAIR_GROUP_SCHED 58#ifdef CONFIG_RT_GROUP_SCHED
59 59
60static inline unsigned int sched_rt_ratio(struct rt_rq *rt_rq) 60static inline u64 sched_rt_runtime(struct rt_rq *rt_rq)
61{ 61{
62 if (!rt_rq->tg) 62 if (!rt_rq->tg)
63 return SCHED_RT_FRAC; 63 return RUNTIME_INF;
64 64
65 return rt_rq->tg->rt_ratio; 65 return rt_rq->tg->rt_runtime;
66} 66}
67 67
68#define for_each_leaf_rt_rq(rt_rq, rq) \ 68#define for_each_leaf_rt_rq(rt_rq, rq) \
@@ -89,7 +89,7 @@ static inline struct rt_rq *group_rt_rq(struct sched_rt_entity *rt_se)
89static void enqueue_rt_entity(struct sched_rt_entity *rt_se); 89static void enqueue_rt_entity(struct sched_rt_entity *rt_se);
90static void dequeue_rt_entity(struct sched_rt_entity *rt_se); 90static void dequeue_rt_entity(struct sched_rt_entity *rt_se);
91 91
92static void sched_rt_ratio_enqueue(struct rt_rq *rt_rq) 92static void sched_rt_rq_enqueue(struct rt_rq *rt_rq)
93{ 93{
94 struct sched_rt_entity *rt_se = rt_rq->rt_se; 94 struct sched_rt_entity *rt_se = rt_rq->rt_se;
95 95
@@ -102,7 +102,7 @@ static void sched_rt_ratio_enqueue(struct rt_rq *rt_rq)
102 } 102 }
103} 103}
104 104
105static void sched_rt_ratio_dequeue(struct rt_rq *rt_rq) 105static void sched_rt_rq_dequeue(struct rt_rq *rt_rq)
106{ 106{
107 struct sched_rt_entity *rt_se = rt_rq->rt_se; 107 struct sched_rt_entity *rt_se = rt_rq->rt_se;
108 108
@@ -110,11 +110,31 @@ static void sched_rt_ratio_dequeue(struct rt_rq *rt_rq)
110 dequeue_rt_entity(rt_se); 110 dequeue_rt_entity(rt_se);
111} 111}
112 112
113static inline int rt_rq_throttled(struct rt_rq *rt_rq)
114{
115 return rt_rq->rt_throttled && !rt_rq->rt_nr_boosted;
116}
117
118static int rt_se_boosted(struct sched_rt_entity *rt_se)
119{
120 struct rt_rq *rt_rq = group_rt_rq(rt_se);
121 struct task_struct *p;
122
123 if (rt_rq)
124 return !!rt_rq->rt_nr_boosted;
125
126 p = rt_task_of(rt_se);
127 return p->prio != p->normal_prio;
128}
129
113#else 130#else
114 131
115static inline unsigned int sched_rt_ratio(struct rt_rq *rt_rq) 132static inline u64 sched_rt_runtime(struct rt_rq *rt_rq)
116{ 133{
117 return sysctl_sched_rt_ratio; 134 if (sysctl_sched_rt_runtime == -1)
135 return RUNTIME_INF;
136
137 return (u64)sysctl_sched_rt_runtime * NSEC_PER_USEC;
118} 138}
119 139
120#define for_each_leaf_rt_rq(rt_rq, rq) \ 140#define for_each_leaf_rt_rq(rt_rq, rq) \
@@ -141,19 +161,23 @@ static inline struct rt_rq *group_rt_rq(struct sched_rt_entity *rt_se)
141 return NULL; 161 return NULL;
142} 162}
143 163
144static inline void sched_rt_ratio_enqueue(struct rt_rq *rt_rq) 164static inline void sched_rt_rq_enqueue(struct rt_rq *rt_rq)
145{ 165{
146} 166}
147 167
148static inline void sched_rt_ratio_dequeue(struct rt_rq *rt_rq) 168static inline void sched_rt_rq_dequeue(struct rt_rq *rt_rq)
149{ 169{
150} 170}
151 171
172static inline int rt_rq_throttled(struct rt_rq *rt_rq)
173{
174 return rt_rq->rt_throttled;
175}
152#endif 176#endif
153 177
154static inline int rt_se_prio(struct sched_rt_entity *rt_se) 178static inline int rt_se_prio(struct sched_rt_entity *rt_se)
155{ 179{
156#ifdef CONFIG_FAIR_GROUP_SCHED 180#ifdef CONFIG_RT_GROUP_SCHED
157 struct rt_rq *rt_rq = group_rt_rq(rt_se); 181 struct rt_rq *rt_rq = group_rt_rq(rt_se);
158 182
159 if (rt_rq) 183 if (rt_rq)
@@ -163,28 +187,26 @@ static inline int rt_se_prio(struct sched_rt_entity *rt_se)
163 return rt_task_of(rt_se)->prio; 187 return rt_task_of(rt_se)->prio;
164} 188}
165 189
166static int sched_rt_ratio_exceeded(struct rt_rq *rt_rq) 190static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
167{ 191{
168 unsigned int rt_ratio = sched_rt_ratio(rt_rq); 192 u64 runtime = sched_rt_runtime(rt_rq);
169 u64 period, ratio;
170 193
171 if (rt_ratio == SCHED_RT_FRAC) 194 if (runtime == RUNTIME_INF)
172 return 0; 195 return 0;
173 196
174 if (rt_rq->rt_throttled) 197 if (rt_rq->rt_throttled)
175 return 1; 198 return rt_rq_throttled(rt_rq);
176
177 period = (u64)sysctl_sched_rt_period * NSEC_PER_MSEC;
178 ratio = (period * rt_ratio) >> SCHED_RT_FRAC_SHIFT;
179 199
180 if (rt_rq->rt_time > ratio) { 200 if (rt_rq->rt_time > runtime) {
181 struct rq *rq = rq_of_rt_rq(rt_rq); 201 struct rq *rq = rq_of_rt_rq(rt_rq);
182 202
183 rq->rt_throttled = 1; 203 rq->rt_throttled = 1;
184 rt_rq->rt_throttled = 1; 204 rt_rq->rt_throttled = 1;
185 205
186 sched_rt_ratio_dequeue(rt_rq); 206 if (rt_rq_throttled(rt_rq)) {
187 return 1; 207 sched_rt_rq_dequeue(rt_rq);
208 return 1;
209 }
188 } 210 }
189 211
190 return 0; 212 return 0;
@@ -196,17 +218,16 @@ static void update_sched_rt_period(struct rq *rq)
196 u64 period; 218 u64 period;
197 219
198 while (rq->clock > rq->rt_period_expire) { 220 while (rq->clock > rq->rt_period_expire) {
199 period = (u64)sysctl_sched_rt_period * NSEC_PER_MSEC; 221 period = (u64)sysctl_sched_rt_period * NSEC_PER_USEC;
200 rq->rt_period_expire += period; 222 rq->rt_period_expire += period;
201 223
202 for_each_leaf_rt_rq(rt_rq, rq) { 224 for_each_leaf_rt_rq(rt_rq, rq) {
203 unsigned long rt_ratio = sched_rt_ratio(rt_rq); 225 u64 runtime = sched_rt_runtime(rt_rq);
204 u64 ratio = (period * rt_ratio) >> SCHED_RT_FRAC_SHIFT;
205 226
206 rt_rq->rt_time -= min(rt_rq->rt_time, ratio); 227 rt_rq->rt_time -= min(rt_rq->rt_time, runtime);
207 if (rt_rq->rt_throttled) { 228 if (rt_rq->rt_throttled && rt_rq->rt_time < runtime) {
208 rt_rq->rt_throttled = 0; 229 rt_rq->rt_throttled = 0;
209 sched_rt_ratio_enqueue(rt_rq); 230 sched_rt_rq_enqueue(rt_rq);
210 } 231 }
211 } 232 }
212 233
@@ -239,12 +260,7 @@ static void update_curr_rt(struct rq *rq)
239 cpuacct_charge(curr, delta_exec); 260 cpuacct_charge(curr, delta_exec);
240 261
241 rt_rq->rt_time += delta_exec; 262 rt_rq->rt_time += delta_exec;
242 /* 263 if (sched_rt_runtime_exceeded(rt_rq))
243 * might make it a tad more accurate:
244 *
245 * update_sched_rt_period(rq);
246 */
247 if (sched_rt_ratio_exceeded(rt_rq))
248 resched_task(curr); 264 resched_task(curr);
249} 265}
250 266
@@ -253,7 +269,7 @@ void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
253{ 269{
254 WARN_ON(!rt_prio(rt_se_prio(rt_se))); 270 WARN_ON(!rt_prio(rt_se_prio(rt_se)));
255 rt_rq->rt_nr_running++; 271 rt_rq->rt_nr_running++;
256#if defined CONFIG_SMP || defined CONFIG_FAIR_GROUP_SCHED 272#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
257 if (rt_se_prio(rt_se) < rt_rq->highest_prio) 273 if (rt_se_prio(rt_se) < rt_rq->highest_prio)
258 rt_rq->highest_prio = rt_se_prio(rt_se); 274 rt_rq->highest_prio = rt_se_prio(rt_se);
259#endif 275#endif
@@ -265,6 +281,10 @@ void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
265 281
266 update_rt_migration(rq_of_rt_rq(rt_rq)); 282 update_rt_migration(rq_of_rt_rq(rt_rq));
267#endif 283#endif
284#ifdef CONFIG_RT_GROUP_SCHED
285 if (rt_se_boosted(rt_se))
286 rt_rq->rt_nr_boosted++;
287#endif
268} 288}
269 289
270static inline 290static inline
@@ -273,7 +293,7 @@ void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
273 WARN_ON(!rt_prio(rt_se_prio(rt_se))); 293 WARN_ON(!rt_prio(rt_se_prio(rt_se)));
274 WARN_ON(!rt_rq->rt_nr_running); 294 WARN_ON(!rt_rq->rt_nr_running);
275 rt_rq->rt_nr_running--; 295 rt_rq->rt_nr_running--;
276#if defined CONFIG_SMP || defined CONFIG_FAIR_GROUP_SCHED 296#if defined CONFIG_SMP || defined CONFIG_RT_GROUP_SCHED
277 if (rt_rq->rt_nr_running) { 297 if (rt_rq->rt_nr_running) {
278 struct rt_prio_array *array; 298 struct rt_prio_array *array;
279 299
@@ -295,6 +315,12 @@ void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
295 315
296 update_rt_migration(rq_of_rt_rq(rt_rq)); 316 update_rt_migration(rq_of_rt_rq(rt_rq));
297#endif /* CONFIG_SMP */ 317#endif /* CONFIG_SMP */
318#ifdef CONFIG_RT_GROUP_SCHED
319 if (rt_se_boosted(rt_se))
320 rt_rq->rt_nr_boosted--;
321
322 WARN_ON(!rt_rq->rt_nr_running && rt_rq->rt_nr_boosted);
323#endif
298} 324}
299 325
300static void enqueue_rt_entity(struct sched_rt_entity *rt_se) 326static void enqueue_rt_entity(struct sched_rt_entity *rt_se)
@@ -303,7 +329,7 @@ static void enqueue_rt_entity(struct sched_rt_entity *rt_se)
303 struct rt_prio_array *array = &rt_rq->active; 329 struct rt_prio_array *array = &rt_rq->active;
304 struct rt_rq *group_rq = group_rt_rq(rt_se); 330 struct rt_rq *group_rq = group_rt_rq(rt_se);
305 331
306 if (group_rq && group_rq->rt_throttled) 332 if (group_rq && rt_rq_throttled(group_rq))
307 return; 333 return;
308 334
309 list_add_tail(&rt_se->run_list, array->queue + rt_se_prio(rt_se)); 335 list_add_tail(&rt_se->run_list, array->queue + rt_se_prio(rt_se));
@@ -496,7 +522,7 @@ static struct task_struct *pick_next_task_rt(struct rq *rq)
496 if (unlikely(!rt_rq->rt_nr_running)) 522 if (unlikely(!rt_rq->rt_nr_running))
497 return NULL; 523 return NULL;
498 524
499 if (sched_rt_ratio_exceeded(rt_rq)) 525 if (rt_rq_throttled(rt_rq))
500 return NULL; 526 return NULL;
501 527
502 do { 528 do {
diff --git a/kernel/signal.c b/kernel/signal.c
index 2c1f08defac2..84917fe507f7 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -972,7 +972,7 @@ void zap_other_threads(struct task_struct *p)
972 } 972 }
973} 973}
974 974
975int fastcall __fatal_signal_pending(struct task_struct *tsk) 975int __fatal_signal_pending(struct task_struct *tsk)
976{ 976{
977 return sigismember(&tsk->pending.signal, SIGKILL); 977 return sigismember(&tsk->pending.signal, SIGKILL);
978} 978}
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d41ef6b4cf72..8b7e95411795 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -311,22 +311,6 @@ static struct ctl_table kern_table[] = {
311 .mode = 0644, 311 .mode = 0644,
312 .proc_handler = &proc_dointvec, 312 .proc_handler = &proc_dointvec,
313 }, 313 },
314 {
315 .ctl_name = CTL_UNNUMBERED,
316 .procname = "sched_rt_period_ms",
317 .data = &sysctl_sched_rt_period,
318 .maxlen = sizeof(unsigned int),
319 .mode = 0644,
320 .proc_handler = &proc_dointvec,
321 },
322 {
323 .ctl_name = CTL_UNNUMBERED,
324 .procname = "sched_rt_ratio",
325 .data = &sysctl_sched_rt_ratio,
326 .maxlen = sizeof(unsigned int),
327 .mode = 0644,
328 .proc_handler = &proc_dointvec,
329 },
330#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP) 314#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
331 { 315 {
332 .ctl_name = CTL_UNNUMBERED, 316 .ctl_name = CTL_UNNUMBERED,
@@ -348,6 +332,22 @@ static struct ctl_table kern_table[] = {
348#endif 332#endif
349 { 333 {
350 .ctl_name = CTL_UNNUMBERED, 334 .ctl_name = CTL_UNNUMBERED,
335 .procname = "sched_rt_period_us",
336 .data = &sysctl_sched_rt_period,
337 .maxlen = sizeof(unsigned int),
338 .mode = 0644,
339 .proc_handler = &proc_dointvec,
340 },
341 {
342 .ctl_name = CTL_UNNUMBERED,
343 .procname = "sched_rt_runtime_us",
344 .data = &sysctl_sched_rt_runtime,
345 .maxlen = sizeof(int),
346 .mode = 0644,
347 .proc_handler = &proc_dointvec,
348 },
349 {
350 .ctl_name = CTL_UNNUMBERED,
351 .procname = "sched_compat_yield", 351 .procname = "sched_compat_yield",
352 .data = &sysctl_sched_compat_yield, 352 .data = &sysctl_sched_compat_yield,
353 .maxlen = sizeof(unsigned int), 353 .maxlen = sizeof(unsigned int),
@@ -978,8 +978,8 @@ static struct ctl_table vm_table[] = {
978 { 978 {
979 .ctl_name = CTL_UNNUMBERED, 979 .ctl_name = CTL_UNNUMBERED,
980 .procname = "nr_overcommit_hugepages", 980 .procname = "nr_overcommit_hugepages",
981 .data = &nr_overcommit_huge_pages, 981 .data = &sysctl_overcommit_huge_pages,
982 .maxlen = sizeof(nr_overcommit_huge_pages), 982 .maxlen = sizeof(sysctl_overcommit_huge_pages),
983 .mode = 0644, 983 .mode = 0644,
984 .proc_handler = &hugetlb_overcommit_handler, 984 .proc_handler = &hugetlb_overcommit_handler,
985 }, 985 },
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index d3d94c1a0fd2..67fe8fc21fb1 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -65,9 +65,9 @@ print_timer(struct seq_file *m, struct hrtimer *timer, int idx, u64 now)
65 SEQ_printf(m, ", %s/%d", tmp, timer->start_pid); 65 SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
66#endif 66#endif
67 SEQ_printf(m, "\n"); 67 SEQ_printf(m, "\n");
68 SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n", 68 SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
69 (unsigned long long)ktime_to_ns(timer->expires), 69 (unsigned long long)ktime_to_ns(timer->expires),
70 (unsigned long long)(ktime_to_ns(timer->expires) - now)); 70 (long long)(ktime_to_ns(timer->expires) - now));
71} 71}
72 72
73static void 73static void
diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl
index 62b1287932ed..41468035473c 100644
--- a/kernel/timeconst.pl
+++ b/kernel/timeconst.pl
@@ -339,7 +339,7 @@ sub output($@)
339 print "\n"; 339 print "\n";
340 340
341 foreach $pfx ('HZ_TO_MSEC','MSEC_TO_HZ', 341 foreach $pfx ('HZ_TO_MSEC','MSEC_TO_HZ',
342 'USEC_TO_HZ','HZ_TO_USEC') { 342 'HZ_TO_USEC','USEC_TO_HZ') {
343 foreach $bit (32, 64) { 343 foreach $bit (32, 64) {
344 foreach $suf ('MUL', 'ADJ', 'SHR') { 344 foreach $suf ('MUL', 'ADJ', 'SHR') {
345 printf "#define %-23s %s\n", 345 printf "#define %-23s %s\n",
diff --git a/kernel/user.c b/kernel/user.c
index 7d7900c5a1fd..7132022a040c 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -57,7 +57,7 @@ struct user_struct root_user = {
57 .uid_keyring = &root_user_keyring, 57 .uid_keyring = &root_user_keyring,
58 .session_keyring = &root_session_keyring, 58 .session_keyring = &root_session_keyring,
59#endif 59#endif
60#ifdef CONFIG_FAIR_USER_SCHED 60#ifdef CONFIG_USER_SCHED
61 .tg = &init_task_group, 61 .tg = &init_task_group,
62#endif 62#endif
63}; 63};
@@ -90,7 +90,7 @@ static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
90 return NULL; 90 return NULL;
91} 91}
92 92
93#ifdef CONFIG_FAIR_USER_SCHED 93#ifdef CONFIG_USER_SCHED
94 94
95static void sched_destroy_user(struct user_struct *up) 95static void sched_destroy_user(struct user_struct *up)
96{ 96{
@@ -113,15 +113,15 @@ static void sched_switch_user(struct task_struct *p)
113 sched_move_task(p); 113 sched_move_task(p);
114} 114}
115 115
116#else /* CONFIG_FAIR_USER_SCHED */ 116#else /* CONFIG_USER_SCHED */
117 117
118static void sched_destroy_user(struct user_struct *up) { } 118static void sched_destroy_user(struct user_struct *up) { }
119static int sched_create_user(struct user_struct *up) { return 0; } 119static int sched_create_user(struct user_struct *up) { return 0; }
120static void sched_switch_user(struct task_struct *p) { } 120static void sched_switch_user(struct task_struct *p) { }
121 121
122#endif /* CONFIG_FAIR_USER_SCHED */ 122#endif /* CONFIG_USER_SCHED */
123 123
124#if defined(CONFIG_FAIR_USER_SCHED) && defined(CONFIG_SYSFS) 124#if defined(CONFIG_USER_SCHED) && defined(CONFIG_SYSFS)
125 125
126static struct kset *uids_kset; /* represents the /sys/kernel/uids/ directory */ 126static struct kset *uids_kset; /* represents the /sys/kernel/uids/ directory */
127static DEFINE_MUTEX(uids_mutex); 127static DEFINE_MUTEX(uids_mutex);
@@ -137,6 +137,7 @@ static inline void uids_mutex_unlock(void)
137} 137}
138 138
139/* uid directory attributes */ 139/* uid directory attributes */
140#ifdef CONFIG_FAIR_GROUP_SCHED
140static ssize_t cpu_shares_show(struct kobject *kobj, 141static ssize_t cpu_shares_show(struct kobject *kobj,
141 struct kobj_attribute *attr, 142 struct kobj_attribute *attr,
142 char *buf) 143 char *buf)
@@ -163,10 +164,45 @@ static ssize_t cpu_shares_store(struct kobject *kobj,
163 164
164static struct kobj_attribute cpu_share_attr = 165static struct kobj_attribute cpu_share_attr =
165 __ATTR(cpu_share, 0644, cpu_shares_show, cpu_shares_store); 166 __ATTR(cpu_share, 0644, cpu_shares_show, cpu_shares_store);
167#endif
168
169#ifdef CONFIG_RT_GROUP_SCHED
170static ssize_t cpu_rt_runtime_show(struct kobject *kobj,
171 struct kobj_attribute *attr,
172 char *buf)
173{
174 struct user_struct *up = container_of(kobj, struct user_struct, kobj);
175
176 return sprintf(buf, "%lu\n", sched_group_rt_runtime(up->tg));
177}
178
179static ssize_t cpu_rt_runtime_store(struct kobject *kobj,
180 struct kobj_attribute *attr,
181 const char *buf, size_t size)
182{
183 struct user_struct *up = container_of(kobj, struct user_struct, kobj);
184 unsigned long rt_runtime;
185 int rc;
186
187 sscanf(buf, "%lu", &rt_runtime);
188
189 rc = sched_group_set_rt_runtime(up->tg, rt_runtime);
190
191 return (rc ? rc : size);
192}
193
194static struct kobj_attribute cpu_rt_runtime_attr =
195 __ATTR(cpu_rt_runtime, 0644, cpu_rt_runtime_show, cpu_rt_runtime_store);
196#endif
166 197
167/* default attributes per uid directory */ 198/* default attributes per uid directory */
168static struct attribute *uids_attributes[] = { 199static struct attribute *uids_attributes[] = {
200#ifdef CONFIG_FAIR_GROUP_SCHED
169 &cpu_share_attr.attr, 201 &cpu_share_attr.attr,
202#endif
203#ifdef CONFIG_RT_GROUP_SCHED
204 &cpu_rt_runtime_attr.attr,
205#endif
170 NULL 206 NULL
171}; 207};
172 208
@@ -269,7 +305,7 @@ static inline void free_user(struct user_struct *up, unsigned long flags)
269 schedule_work(&up->work); 305 schedule_work(&up->work);
270} 306}
271 307
272#else /* CONFIG_FAIR_USER_SCHED && CONFIG_SYSFS */ 308#else /* CONFIG_USER_SCHED && CONFIG_SYSFS */
273 309
274int uids_sysfs_init(void) { return 0; } 310int uids_sysfs_init(void) { return 0; }
275static inline int uids_user_create(struct user_struct *up) { return 0; } 311static inline int uids_user_create(struct user_struct *up) { return 0; }
@@ -373,7 +409,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
373 spin_lock_irq(&uidhash_lock); 409 spin_lock_irq(&uidhash_lock);
374 up = uid_hash_find(uid, hashent); 410 up = uid_hash_find(uid, hashent);
375 if (up) { 411 if (up) {
376 /* This case is not possible when CONFIG_FAIR_USER_SCHED 412 /* This case is not possible when CONFIG_USER_SCHED
377 * is defined, since we serialize alloc_uid() using 413 * is defined, since we serialize alloc_uid() using
378 * uids_mutex. Hence no need to call 414 * uids_mutex. Hence no need to call
379 * sched_destroy_user() or remove_user_sysfs_dir(). 415 * sched_destroy_user() or remove_user_sysfs_dir().
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index a370fe828a79..0796c1a090c0 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -82,6 +82,9 @@ config HEADERS_CHECK
82config DEBUG_SECTION_MISMATCH 82config DEBUG_SECTION_MISMATCH
83 bool "Enable full Section mismatch analysis" 83 bool "Enable full Section mismatch analysis"
84 depends on UNDEFINED 84 depends on UNDEFINED
85 # This option is on purpose disabled for now.
86 # It will be enabled when we are down to a resonable number
87 # of section mismatch warnings (< 10 for an allyesconfig build)
85 help 88 help
86 The section mismatch analysis checks if there are illegal 89 The section mismatch analysis checks if there are illegal
87 references from one section to another section. 90 references from one section to another section.
@@ -524,6 +527,7 @@ config LKDTM
524 tristate "Linux Kernel Dump Test Tool Module" 527 tristate "Linux Kernel Dump Test Tool Module"
525 depends on DEBUG_KERNEL 528 depends on DEBUG_KERNEL
526 depends on KPROBES 529 depends on KPROBES
530 depends on BLOCK
527 default n 531 default n
528 help 532 help
529 This module enables testing of the different dumping mechanisms by 533 This module enables testing of the different dumping mechanisms by
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index fd987b17bda7..6021757a4496 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -234,7 +234,7 @@ int strict_strto##type(const char *cp, unsigned int base, valtype *res) \
234 int ret; \ 234 int ret; \
235 if (*cp == '-') { \ 235 if (*cp == '-') { \
236 ret = strict_strtou##type(cp+1, base, res); \ 236 ret = strict_strtou##type(cp+1, base, res); \
237 if (ret != 0) \ 237 if (!ret) \
238 *res = -(*res); \ 238 *res = -(*res); \
239 } else \ 239 } else \
240 ret = strict_strtou##type(cp, base, res); \ 240 ret = strict_strtou##type(cp, base, res); \
diff --git a/mm/filemap.c b/mm/filemap.c
index b7b1be6dbd83..5c74b68935ac 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -604,7 +604,7 @@ void __lock_page(struct page *page)
604} 604}
605EXPORT_SYMBOL(__lock_page); 605EXPORT_SYMBOL(__lock_page);
606 606
607int fastcall __lock_page_killable(struct page *page) 607int __lock_page_killable(struct page *page)
608{ 608{
609 DEFINE_WAIT_BIT(wait, &page->flags, PG_locked); 609 DEFINE_WAIT_BIT(wait, &page->flags, PG_locked);
610 610
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index d9a380312467..89e6286a7f57 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -24,14 +24,15 @@
24const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL; 24const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
25static unsigned long nr_huge_pages, free_huge_pages, resv_huge_pages; 25static unsigned long nr_huge_pages, free_huge_pages, resv_huge_pages;
26static unsigned long surplus_huge_pages; 26static unsigned long surplus_huge_pages;
27static unsigned long nr_overcommit_huge_pages;
27unsigned long max_huge_pages; 28unsigned long max_huge_pages;
29unsigned long sysctl_overcommit_huge_pages;
28static struct list_head hugepage_freelists[MAX_NUMNODES]; 30static struct list_head hugepage_freelists[MAX_NUMNODES];
29static unsigned int nr_huge_pages_node[MAX_NUMNODES]; 31static unsigned int nr_huge_pages_node[MAX_NUMNODES];
30static unsigned int free_huge_pages_node[MAX_NUMNODES]; 32static unsigned int free_huge_pages_node[MAX_NUMNODES];
31static unsigned int surplus_huge_pages_node[MAX_NUMNODES]; 33static unsigned int surplus_huge_pages_node[MAX_NUMNODES];
32static gfp_t htlb_alloc_mask = GFP_HIGHUSER; 34static gfp_t htlb_alloc_mask = GFP_HIGHUSER;
33unsigned long hugepages_treat_as_movable; 35unsigned long hugepages_treat_as_movable;
34unsigned long nr_overcommit_huge_pages;
35static int hugetlb_next_nid; 36static int hugetlb_next_nid;
36 37
37/* 38/*
@@ -119,6 +120,7 @@ static void free_huge_page(struct page *page)
119 struct address_space *mapping; 120 struct address_space *mapping;
120 121
121 mapping = (struct address_space *) page_private(page); 122 mapping = (struct address_space *) page_private(page);
123 set_page_private(page, 0);
122 BUG_ON(page_count(page)); 124 BUG_ON(page_count(page));
123 INIT_LIST_HEAD(&page->lru); 125 INIT_LIST_HEAD(&page->lru);
124 126
@@ -133,7 +135,6 @@ static void free_huge_page(struct page *page)
133 spin_unlock(&hugetlb_lock); 135 spin_unlock(&hugetlb_lock);
134 if (mapping) 136 if (mapping)
135 hugetlb_put_quota(mapping, 1); 137 hugetlb_put_quota(mapping, 1);
136 set_page_private(page, 0);
137} 138}
138 139
139/* 140/*
@@ -609,8 +610,9 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
609 struct file *file, void __user *buffer, 610 struct file *file, void __user *buffer,
610 size_t *length, loff_t *ppos) 611 size_t *length, loff_t *ppos)
611{ 612{
612 spin_lock(&hugetlb_lock);
613 proc_doulongvec_minmax(table, write, file, buffer, length, ppos); 613 proc_doulongvec_minmax(table, write, file, buffer, length, ppos);
614 spin_lock(&hugetlb_lock);
615 nr_overcommit_huge_pages = sysctl_overcommit_huge_pages;
614 spin_unlock(&hugetlb_lock); 616 spin_unlock(&hugetlb_lock);
615 return 0; 617 return 0;
616} 618}
diff --git a/mm/internal.h b/mm/internal.h
index 5a9a6200e034..789727309f4d 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -47,4 +47,17 @@ static inline unsigned long page_order(struct page *page)
47 VM_BUG_ON(!PageBuddy(page)); 47 VM_BUG_ON(!PageBuddy(page));
48 return page_private(page); 48 return page_private(page);
49} 49}
50
51/*
52 * FLATMEM and DISCONTIGMEM configurations use alloc_bootmem_node,
53 * so all functions starting at paging_init should be marked __init
54 * in those cases. SPARSEMEM, however, allows for memory hotplug,
55 * and alloc_bootmem_node is not used.
56 */
57#ifdef CONFIG_SPARSEMEM
58#define __paginginit __meminit
59#else
60#define __paginginit __init
61#endif
62
50#endif 63#endif
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6bded84c20c8..631002d085d1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
534 if (scan >= nr_to_scan) 534 if (scan >= nr_to_scan)
535 break; 535 break;
536 page = pc->page; 536 page = pc->page;
537 VM_BUG_ON(!pc);
538 537
539 if (unlikely(!PageLRU(page))) 538 if (unlikely(!PageLRU(page)))
540 continue; 539 continue;
@@ -1101,7 +1100,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
1101 mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL); 1100 mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL);
1102 1101
1103 if (mem == NULL) 1102 if (mem == NULL)
1104 return NULL; 1103 return ERR_PTR(-ENOMEM);
1105 1104
1106 res_counter_init(&mem->res); 1105 res_counter_init(&mem->res);
1107 1106
@@ -1117,7 +1116,7 @@ free_out:
1117 free_mem_cgroup_per_zone_info(mem, node); 1116 free_mem_cgroup_per_zone_info(mem, node);
1118 if (cont->parent != NULL) 1117 if (cont->parent != NULL)
1119 kfree(mem); 1118 kfree(mem);
1120 return NULL; 1119 return ERR_PTR(-ENOMEM);
1121} 1120}
1122 1121
1123static void mem_cgroup_pre_destroy(struct cgroup_subsys *ss, 1122static void mem_cgroup_pre_destroy(struct cgroup_subsys *ss,
diff --git a/mm/memory.c b/mm/memory.c
index 717aa0e3be2d..ce3c9e4492d8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2711,6 +2711,13 @@ void print_vma_addr(char *prefix, unsigned long ip)
2711 struct mm_struct *mm = current->mm; 2711 struct mm_struct *mm = current->mm;
2712 struct vm_area_struct *vma; 2712 struct vm_area_struct *vma;
2713 2713
2714 /*
2715 * Do not print if we are in atomic
2716 * contexts (in exception stacks, etc.):
2717 */
2718 if (preempt_count())
2719 return;
2720
2714 down_read(&mm->mmap_sem); 2721 down_read(&mm->mmap_sem);
2715 vma = find_vma(mm, ip); 2722 vma = find_vma(mm, ip);
2716 if (vma && vma->vm_file) { 2723 if (vma && vma->vm_file) {
@@ -2719,7 +2726,7 @@ void print_vma_addr(char *prefix, unsigned long ip)
2719 if (buf) { 2726 if (buf) {
2720 char *p, *s; 2727 char *p, *s;
2721 2728
2722 p = d_path(f->f_dentry, f->f_vfsmnt, buf, PAGE_SIZE); 2729 p = d_path(&f->f_path, buf, PAGE_SIZE);
2723 if (IS_ERR(p)) 2730 if (IS_ERR(p))
2724 p = "?"; 2731 p = "?";
2725 s = strrchr(p, '/'); 2732 s = strrchr(p, '/');
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 8d246c3b340f..6c7ba1a63d23 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1996,7 +1996,7 @@ int show_numa_map(struct seq_file *m, void *v)
1996 1996
1997 if (file) { 1997 if (file) {
1998 seq_printf(m, " file="); 1998 seq_printf(m, " file=");
1999 seq_path(m, file->f_path.mnt, file->f_path.dentry, "\n\t= "); 1999 seq_path(m, &file->f_path, "\n\t= ");
2000 } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { 2000 } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) {
2001 seq_printf(m, " heap"); 2001 seq_printf(m, " heap");
2002 } else if (vma->vm_start <= mm->start_stack && 2002 } else if (vma->vm_start <= mm->start_stack &&
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 75b979313346..8896e874a67d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3314,7 +3314,7 @@ static inline int pageblock_default_order(unsigned int order)
3314 * - mark all memory queues empty 3314 * - mark all memory queues empty
3315 * - clear the memory bitmaps 3315 * - clear the memory bitmaps
3316 */ 3316 */
3317static void __meminit free_area_init_core(struct pglist_data *pgdat, 3317static void __paginginit free_area_init_core(struct pglist_data *pgdat,
3318 unsigned long *zones_size, unsigned long *zholes_size) 3318 unsigned long *zones_size, unsigned long *zholes_size)
3319{ 3319{
3320 enum zone_type j; 3320 enum zone_type j;
@@ -3438,7 +3438,7 @@ static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat)
3438#endif /* CONFIG_FLAT_NODE_MEM_MAP */ 3438#endif /* CONFIG_FLAT_NODE_MEM_MAP */
3439} 3439}
3440 3440
3441void __meminit free_area_init_node(int nid, struct pglist_data *pgdat, 3441void __paginginit free_area_init_node(int nid, struct pglist_data *pgdat,
3442 unsigned long *zones_size, unsigned long node_start_pfn, 3442 unsigned long *zones_size, unsigned long node_start_pfn,
3443 unsigned long *zholes_size) 3443 unsigned long *zholes_size)
3444{ 3444{
diff --git a/mm/slab.c b/mm/slab.c
index 40c00dacbe4b..473e6c2eaefb 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2630,6 +2630,7 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp,
2630 slabp->colouroff = colour_off; 2630 slabp->colouroff = colour_off;
2631 slabp->s_mem = objp + colour_off; 2631 slabp->s_mem = objp + colour_off;
2632 slabp->nodeid = nodeid; 2632 slabp->nodeid = nodeid;
2633 slabp->free = 0;
2633 return slabp; 2634 return slabp;
2634} 2635}
2635 2636
@@ -2683,7 +2684,6 @@ static void cache_init_objs(struct kmem_cache *cachep,
2683 slab_bufctl(slabp)[i] = i + 1; 2684 slab_bufctl(slabp)[i] = i + 1;
2684 } 2685 }
2685 slab_bufctl(slabp)[i - 1] = BUFCTL_END; 2686 slab_bufctl(slabp)[i - 1] = BUFCTL_END;
2686 slabp->free = 0;
2687} 2687}
2688 2688
2689static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags) 2689static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags)
@@ -2816,7 +2816,6 @@ static int cache_grow(struct kmem_cache *cachep,
2816 if (!slabp) 2816 if (!slabp)
2817 goto opps1; 2817 goto opps1;
2818 2818
2819 slabp->nodeid = nodeid;
2820 slab_map_pages(cachep, slabp, objp); 2819 slab_map_pages(cachep, slabp, objp);
2821 2820
2822 cache_init_objs(cachep, slabp); 2821 cache_init_objs(cachep, slabp);
diff --git a/mm/slub.c b/mm/slub.c
index e2989ae243b5..74c65af0a54f 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -149,13 +149,6 @@ static inline void ClearSlabDebug(struct page *page)
149/* Enable to test recovery from slab corruption on boot */ 149/* Enable to test recovery from slab corruption on boot */
150#undef SLUB_RESILIENCY_TEST 150#undef SLUB_RESILIENCY_TEST
151 151
152/*
153 * Currently fastpath is not supported if preemption is enabled.
154 */
155#if defined(CONFIG_FAST_CMPXCHG_LOCAL) && !defined(CONFIG_PREEMPT)
156#define SLUB_FASTPATH
157#endif
158
159#if PAGE_SHIFT <= 12 152#if PAGE_SHIFT <= 12
160 153
161/* 154/*
@@ -211,6 +204,8 @@ static inline void ClearSlabDebug(struct page *page)
211/* Internal SLUB flags */ 204/* Internal SLUB flags */
212#define __OBJECT_POISON 0x80000000 /* Poison object */ 205#define __OBJECT_POISON 0x80000000 /* Poison object */
213#define __SYSFS_ADD_DEFERRED 0x40000000 /* Not yet visible via sysfs */ 206#define __SYSFS_ADD_DEFERRED 0x40000000 /* Not yet visible via sysfs */
207#define __KMALLOC_CACHE 0x20000000 /* objects freed using kfree */
208#define __PAGE_ALLOC_FALLBACK 0x10000000 /* Allow fallback to page alloc */
214 209
215/* Not all arches define cache_line_size */ 210/* Not all arches define cache_line_size */
216#ifndef cache_line_size 211#ifndef cache_line_size
@@ -308,7 +303,7 @@ static inline int is_end(void *addr)
308 return (unsigned long)addr & PAGE_MAPPING_ANON; 303 return (unsigned long)addr & PAGE_MAPPING_ANON;
309} 304}
310 305
311void *slab_address(struct page *page) 306static void *slab_address(struct page *page)
312{ 307{
313 return page->end - PAGE_MAPPING_ANON; 308 return page->end - PAGE_MAPPING_ANON;
314} 309}
@@ -1078,14 +1073,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
1078 struct page *page; 1073 struct page *page;
1079 int pages = 1 << s->order; 1074 int pages = 1 << s->order;
1080 1075
1081 if (s->order) 1076 flags |= s->allocflags;
1082 flags |= __GFP_COMP;
1083
1084 if (s->flags & SLAB_CACHE_DMA)
1085 flags |= SLUB_DMA;
1086
1087 if (s->flags & SLAB_RECLAIM_ACCOUNT)
1088 flags |= __GFP_RECLAIMABLE;
1089 1077
1090 if (node == -1) 1078 if (node == -1)
1091 page = alloc_pages(flags, s->order); 1079 page = alloc_pages(flags, s->order);
@@ -1519,11 +1507,7 @@ static void *__slab_alloc(struct kmem_cache *s,
1519{ 1507{
1520 void **object; 1508 void **object;
1521 struct page *new; 1509 struct page *new;
1522#ifdef SLUB_FASTPATH
1523 unsigned long flags;
1524 1510
1525 local_irq_save(flags);
1526#endif
1527 if (!c->page) 1511 if (!c->page)
1528 goto new_slab; 1512 goto new_slab;
1529 1513
@@ -1546,10 +1530,6 @@ load_freelist:
1546unlock_out: 1530unlock_out:
1547 slab_unlock(c->page); 1531 slab_unlock(c->page);
1548 stat(c, ALLOC_SLOWPATH); 1532 stat(c, ALLOC_SLOWPATH);
1549out:
1550#ifdef SLUB_FASTPATH
1551 local_irq_restore(flags);
1552#endif
1553 return object; 1533 return object;
1554 1534
1555another_slab: 1535another_slab:
@@ -1581,8 +1561,22 @@ new_slab:
1581 c->page = new; 1561 c->page = new;
1582 goto load_freelist; 1562 goto load_freelist;
1583 } 1563 }
1584 object = NULL; 1564
1585 goto out; 1565 /*
1566 * No memory available.
1567 *
1568 * If the slab uses higher order allocs but the object is
1569 * smaller than a page size then we can fallback in emergencies
1570 * to the page allocator via kmalloc_large. The page allocator may
1571 * have failed to obtain a higher order page and we can try to
1572 * allocate a single page if the object fits into a single page.
1573 * That is only possible if certain conditions are met that are being
1574 * checked when a slab is created.
1575 */
1576 if (!(gfpflags & __GFP_NORETRY) && (s->flags & __PAGE_ALLOC_FALLBACK))
1577 return kmalloc_large(s->objsize, gfpflags);
1578
1579 return NULL;
1586debug: 1580debug:
1587 object = c->page->freelist; 1581 object = c->page->freelist;
1588 if (!alloc_debug_processing(s, c->page, object, addr)) 1582 if (!alloc_debug_processing(s, c->page, object, addr))
@@ -1609,34 +1603,6 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
1609{ 1603{
1610 void **object; 1604 void **object;
1611 struct kmem_cache_cpu *c; 1605 struct kmem_cache_cpu *c;
1612
1613/*
1614 * The SLUB_FASTPATH path is provisional and is currently disabled if the
1615 * kernel is compiled with preemption or if the arch does not support
1616 * fast cmpxchg operations. There are a couple of coming changes that will
1617 * simplify matters and allow preemption. Ultimately we may end up making
1618 * SLUB_FASTPATH the default.
1619 *
1620 * 1. The introduction of the per cpu allocator will avoid array lookups
1621 * through get_cpu_slab(). A special register can be used instead.
1622 *
1623 * 2. The introduction of per cpu atomic operations (cpu_ops) means that
1624 * we can realize the logic here entirely with per cpu atomics. The
1625 * per cpu atomic ops will take care of the preemption issues.
1626 */
1627
1628#ifdef SLUB_FASTPATH
1629 c = get_cpu_slab(s, raw_smp_processor_id());
1630 do {
1631 object = c->freelist;
1632 if (unlikely(is_end(object) || !node_match(c, node))) {
1633 object = __slab_alloc(s, gfpflags, node, addr, c);
1634 break;
1635 }
1636 stat(c, ALLOC_FASTPATH);
1637 } while (cmpxchg_local(&c->freelist, object, object[c->offset])
1638 != object);
1639#else
1640 unsigned long flags; 1606 unsigned long flags;
1641 1607
1642 local_irq_save(flags); 1608 local_irq_save(flags);
@@ -1651,7 +1617,6 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
1651 stat(c, ALLOC_FASTPATH); 1617 stat(c, ALLOC_FASTPATH);
1652 } 1618 }
1653 local_irq_restore(flags); 1619 local_irq_restore(flags);
1654#endif
1655 1620
1656 if (unlikely((gfpflags & __GFP_ZERO) && object)) 1621 if (unlikely((gfpflags & __GFP_ZERO) && object))
1657 memset(object, 0, c->objsize); 1622 memset(object, 0, c->objsize);
@@ -1688,11 +1653,6 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
1688 void **object = (void *)x; 1653 void **object = (void *)x;
1689 struct kmem_cache_cpu *c; 1654 struct kmem_cache_cpu *c;
1690 1655
1691#ifdef SLUB_FASTPATH
1692 unsigned long flags;
1693
1694 local_irq_save(flags);
1695#endif
1696 c = get_cpu_slab(s, raw_smp_processor_id()); 1656 c = get_cpu_slab(s, raw_smp_processor_id());
1697 stat(c, FREE_SLOWPATH); 1657 stat(c, FREE_SLOWPATH);
1698 slab_lock(page); 1658 slab_lock(page);
@@ -1724,9 +1684,6 @@ checks_ok:
1724 1684
1725out_unlock: 1685out_unlock:
1726 slab_unlock(page); 1686 slab_unlock(page);
1727#ifdef SLUB_FASTPATH
1728 local_irq_restore(flags);
1729#endif
1730 return; 1687 return;
1731 1688
1732slab_empty: 1689slab_empty:
@@ -1739,9 +1696,6 @@ slab_empty:
1739 } 1696 }
1740 slab_unlock(page); 1697 slab_unlock(page);
1741 stat(c, FREE_SLAB); 1698 stat(c, FREE_SLAB);
1742#ifdef SLUB_FASTPATH
1743 local_irq_restore(flags);
1744#endif
1745 discard_slab(s, page); 1699 discard_slab(s, page);
1746 return; 1700 return;
1747 1701
@@ -1767,34 +1721,6 @@ static __always_inline void slab_free(struct kmem_cache *s,
1767{ 1721{
1768 void **object = (void *)x; 1722 void **object = (void *)x;
1769 struct kmem_cache_cpu *c; 1723 struct kmem_cache_cpu *c;
1770
1771#ifdef SLUB_FASTPATH
1772 void **freelist;
1773
1774 c = get_cpu_slab(s, raw_smp_processor_id());
1775 debug_check_no_locks_freed(object, s->objsize);
1776 do {
1777 freelist = c->freelist;
1778 barrier();
1779 /*
1780 * If the compiler would reorder the retrieval of c->page to
1781 * come before c->freelist then an interrupt could
1782 * change the cpu slab before we retrieve c->freelist. We
1783 * could be matching on a page no longer active and put the
1784 * object onto the freelist of the wrong slab.
1785 *
1786 * On the other hand: If we already have the freelist pointer
1787 * then any change of cpu_slab will cause the cmpxchg to fail
1788 * since the freelist pointers are unique per slab.
1789 */
1790 if (unlikely(page != c->page || c->node < 0)) {
1791 __slab_free(s, page, x, addr, c->offset);
1792 break;
1793 }
1794 object[c->offset] = freelist;
1795 stat(c, FREE_FASTPATH);
1796 } while (cmpxchg_local(&c->freelist, freelist, object) != freelist);
1797#else
1798 unsigned long flags; 1724 unsigned long flags;
1799 1725
1800 local_irq_save(flags); 1726 local_irq_save(flags);
@@ -1808,7 +1734,6 @@ static __always_inline void slab_free(struct kmem_cache *s,
1808 __slab_free(s, page, x, addr, c->offset); 1734 __slab_free(s, page, x, addr, c->offset);
1809 1735
1810 local_irq_restore(flags); 1736 local_irq_restore(flags);
1811#endif
1812} 1737}
1813 1738
1814void kmem_cache_free(struct kmem_cache *s, void *x) 1739void kmem_cache_free(struct kmem_cache *s, void *x)
@@ -2329,10 +2254,33 @@ static int calculate_sizes(struct kmem_cache *s)
2329 size = ALIGN(size, align); 2254 size = ALIGN(size, align);
2330 s->size = size; 2255 s->size = size;
2331 2256
2332 s->order = calculate_order(size); 2257 if ((flags & __KMALLOC_CACHE) &&
2258 PAGE_SIZE / size < slub_min_objects) {
2259 /*
2260 * Kmalloc cache that would not have enough objects in
2261 * an order 0 page. Kmalloc slabs can fallback to
2262 * page allocator order 0 allocs so take a reasonably large
2263 * order that will allows us a good number of objects.
2264 */
2265 s->order = max(slub_max_order, PAGE_ALLOC_COSTLY_ORDER);
2266 s->flags |= __PAGE_ALLOC_FALLBACK;
2267 s->allocflags |= __GFP_NOWARN;
2268 } else
2269 s->order = calculate_order(size);
2270
2333 if (s->order < 0) 2271 if (s->order < 0)
2334 return 0; 2272 return 0;
2335 2273
2274 s->allocflags = 0;
2275 if (s->order)
2276 s->allocflags |= __GFP_COMP;
2277
2278 if (s->flags & SLAB_CACHE_DMA)
2279 s->allocflags |= SLUB_DMA;
2280
2281 if (s->flags & SLAB_RECLAIM_ACCOUNT)
2282 s->allocflags |= __GFP_RECLAIMABLE;
2283
2336 /* 2284 /*
2337 * Determine the number of objects per slab 2285 * Determine the number of objects per slab
2338 */ 2286 */
@@ -2484,11 +2432,11 @@ EXPORT_SYMBOL(kmem_cache_destroy);
2484 * Kmalloc subsystem 2432 * Kmalloc subsystem
2485 *******************************************************************/ 2433 *******************************************************************/
2486 2434
2487struct kmem_cache kmalloc_caches[PAGE_SHIFT] __cacheline_aligned; 2435struct kmem_cache kmalloc_caches[PAGE_SHIFT + 1] __cacheline_aligned;
2488EXPORT_SYMBOL(kmalloc_caches); 2436EXPORT_SYMBOL(kmalloc_caches);
2489 2437
2490#ifdef CONFIG_ZONE_DMA 2438#ifdef CONFIG_ZONE_DMA
2491static struct kmem_cache *kmalloc_caches_dma[PAGE_SHIFT]; 2439static struct kmem_cache *kmalloc_caches_dma[PAGE_SHIFT + 1];
2492#endif 2440#endif
2493 2441
2494static int __init setup_slub_min_order(char *str) 2442static int __init setup_slub_min_order(char *str)
@@ -2536,7 +2484,7 @@ static struct kmem_cache *create_kmalloc_cache(struct kmem_cache *s,
2536 2484
2537 down_write(&slub_lock); 2485 down_write(&slub_lock);
2538 if (!kmem_cache_open(s, gfp_flags, name, size, ARCH_KMALLOC_MINALIGN, 2486 if (!kmem_cache_open(s, gfp_flags, name, size, ARCH_KMALLOC_MINALIGN,
2539 flags, NULL)) 2487 flags | __KMALLOC_CACHE, NULL))
2540 goto panic; 2488 goto panic;
2541 2489
2542 list_add(&s->list, &slab_caches); 2490 list_add(&s->list, &slab_caches);
@@ -2670,9 +2618,8 @@ void *__kmalloc(size_t size, gfp_t flags)
2670{ 2618{
2671 struct kmem_cache *s; 2619 struct kmem_cache *s;
2672 2620
2673 if (unlikely(size > PAGE_SIZE / 2)) 2621 if (unlikely(size > PAGE_SIZE))
2674 return (void *)__get_free_pages(flags | __GFP_COMP, 2622 return kmalloc_large(size, flags);
2675 get_order(size));
2676 2623
2677 s = get_slab(size, flags); 2624 s = get_slab(size, flags);
2678 2625
@@ -2688,9 +2635,8 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
2688{ 2635{
2689 struct kmem_cache *s; 2636 struct kmem_cache *s;
2690 2637
2691 if (unlikely(size > PAGE_SIZE / 2)) 2638 if (unlikely(size > PAGE_SIZE))
2692 return (void *)__get_free_pages(flags | __GFP_COMP, 2639 return kmalloc_large(size, flags);
2693 get_order(size));
2694 2640
2695 s = get_slab(size, flags); 2641 s = get_slab(size, flags);
2696 2642
@@ -3001,7 +2947,7 @@ void __init kmem_cache_init(void)
3001 caches++; 2947 caches++;
3002 } 2948 }
3003 2949
3004 for (i = KMALLOC_SHIFT_LOW; i < PAGE_SHIFT; i++) { 2950 for (i = KMALLOC_SHIFT_LOW; i <= PAGE_SHIFT; i++) {
3005 create_kmalloc_cache(&kmalloc_caches[i], 2951 create_kmalloc_cache(&kmalloc_caches[i],
3006 "kmalloc", 1 << i, GFP_KERNEL); 2952 "kmalloc", 1 << i, GFP_KERNEL);
3007 caches++; 2953 caches++;
@@ -3028,7 +2974,7 @@ void __init kmem_cache_init(void)
3028 slab_state = UP; 2974 slab_state = UP;
3029 2975
3030 /* Provide the correct kmalloc names now that the caches are up */ 2976 /* Provide the correct kmalloc names now that the caches are up */
3031 for (i = KMALLOC_SHIFT_LOW; i < PAGE_SHIFT; i++) 2977 for (i = KMALLOC_SHIFT_LOW; i <= PAGE_SHIFT; i++)
3032 kmalloc_caches[i]. name = 2978 kmalloc_caches[i]. name =
3033 kasprintf(GFP_KERNEL, "kmalloc-%d", 1 << i); 2979 kasprintf(GFP_KERNEL, "kmalloc-%d", 1 << i);
3034 2980
@@ -3057,6 +3003,9 @@ static int slab_unmergeable(struct kmem_cache *s)
3057 if (slub_nomerge || (s->flags & SLUB_NEVER_MERGE)) 3003 if (slub_nomerge || (s->flags & SLUB_NEVER_MERGE))
3058 return 1; 3004 return 1;
3059 3005
3006 if ((s->flags & __PAGE_ALLOC_FALLBACK))
3007 return 1;
3008
3060 if (s->ctor) 3009 if (s->ctor)
3061 return 1; 3010 return 1;
3062 3011
@@ -3218,9 +3167,9 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, void *caller)
3218{ 3167{
3219 struct kmem_cache *s; 3168 struct kmem_cache *s;
3220 3169
3221 if (unlikely(size > PAGE_SIZE / 2)) 3170 if (unlikely(size > PAGE_SIZE))
3222 return (void *)__get_free_pages(gfpflags | __GFP_COMP, 3171 return kmalloc_large(size, gfpflags);
3223 get_order(size)); 3172
3224 s = get_slab(size, gfpflags); 3173 s = get_slab(size, gfpflags);
3225 3174
3226 if (unlikely(ZERO_OR_NULL_PTR(s))) 3175 if (unlikely(ZERO_OR_NULL_PTR(s)))
@@ -3234,9 +3183,9 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
3234{ 3183{
3235 struct kmem_cache *s; 3184 struct kmem_cache *s;
3236 3185
3237 if (unlikely(size > PAGE_SIZE / 2)) 3186 if (unlikely(size > PAGE_SIZE))
3238 return (void *)__get_free_pages(gfpflags | __GFP_COMP, 3187 return kmalloc_large(size, gfpflags);
3239 get_order(size)); 3188
3240 s = get_slab(size, gfpflags); 3189 s = get_slab(size, gfpflags);
3241 3190
3242 if (unlikely(ZERO_OR_NULL_PTR(s))) 3191 if (unlikely(ZERO_OR_NULL_PTR(s)))
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 02ccab5ad9d9..2da149cfc9ac 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1394,7 +1394,7 @@ static int swap_show(struct seq_file *swap, void *v)
1394 } 1394 }
1395 1395
1396 file = ptr->swap_file; 1396 file = ptr->swap_file;
1397 len = seq_path(swap, file->f_path.mnt, file->f_path.dentry, " \t\n\\"); 1397 len = seq_path(swap, &file->f_path, " \t\n\\");
1398 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n", 1398 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
1399 len < 40 ? 40 - len : 1, " ", 1399 len < 40 ? 40 - len : 1, " ",
1400 S_ISBLK(file->f_path.dentry->d_inode->i_mode) ? 1400 S_ISBLK(file->f_path.dentry->d_inode->i_mode) ?
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index d3e4e1877e6a..0c2c93735e93 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -465,7 +465,7 @@ int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb)
465 return len; 465 return len;
466} 466}
467 467
468void fastcall __rfcomm_dlc_throttle(struct rfcomm_dlc *d) 468void __rfcomm_dlc_throttle(struct rfcomm_dlc *d)
469{ 469{
470 BT_DBG("dlc %p state %ld", d, d->state); 470 BT_DBG("dlc %p state %ld", d, d->state);
471 471
@@ -476,7 +476,7 @@ void fastcall __rfcomm_dlc_throttle(struct rfcomm_dlc *d)
476 rfcomm_schedule(RFCOMM_SCHED_TX); 476 rfcomm_schedule(RFCOMM_SCHED_TX);
477} 477}
478 478
479void fastcall __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d) 479void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)
480{ 480{
481 BT_DBG("dlc %p state %ld", d, d->state); 481 BT_DBG("dlc %p state %ld", d, d->state);
482 482
diff --git a/net/core/dev.c b/net/core/dev.c
index 95161054c4d1..fcdf03cf3b3f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2143,7 +2143,7 @@ static int process_backlog(struct napi_struct *napi, int quota)
2143 * 2143 *
2144 * The entry's receive function will be scheduled to run 2144 * The entry's receive function will be scheduled to run
2145 */ 2145 */
2146void fastcall __napi_schedule(struct napi_struct *n) 2146void __napi_schedule(struct napi_struct *n)
2147{ 2147{
2148 unsigned long flags; 2148 unsigned long flags;
2149 2149
@@ -3038,8 +3038,7 @@ int dev_unicast_sync(struct net_device *to, struct net_device *from)
3038EXPORT_SYMBOL(dev_unicast_sync); 3038EXPORT_SYMBOL(dev_unicast_sync);
3039 3039
3040/** 3040/**
3041 * dev_unicast_unsync - Remove synchronized addresses from the destination 3041 * dev_unicast_unsync - Remove synchronized addresses from the destination device
3042 * device
3043 * @to: destination device 3042 * @to: destination device
3044 * @from: source device 3043 * @from: source device
3045 * 3044 *
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 40dddcc6dc32..0d0fd28a9041 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1907,11 +1907,11 @@ void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
1907 * of bytes already consumed and the next call to 1907 * of bytes already consumed and the next call to
1908 * skb_seq_read() will return the remaining part of the block. 1908 * skb_seq_read() will return the remaining part of the block.
1909 * 1909 *
1910 * Note: The size of each block of data returned can be arbitary, 1910 * Note 1: The size of each block of data returned can be arbitary,
1911 * this limitation is the cost for zerocopy seqeuental 1911 * this limitation is the cost for zerocopy seqeuental
1912 * reads of potentially non linear data. 1912 * reads of potentially non linear data.
1913 * 1913 *
1914 * Note: Fragment lists within fragments are not implemented 1914 * Note 2: Fragment lists within fragments are not implemented
1915 * at the moment, state->root_skb could be replaced with 1915 * at the moment, state->root_skb could be replaced with
1916 * a stack for this purpose. 1916 * a stack for this purpose.
1917 */ 1917 */
diff --git a/net/core/sock.c b/net/core/sock.c
index 433715fb141a..09cb3a74de7f 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1731,7 +1731,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1731 atomic_set(&sk->sk_drops, 0); 1731 atomic_set(&sk->sk_drops, 0);
1732} 1732}
1733 1733
1734void fastcall lock_sock_nested(struct sock *sk, int subclass) 1734void lock_sock_nested(struct sock *sk, int subclass)
1735{ 1735{
1736 might_sleep(); 1736 might_sleep();
1737 spin_lock_bh(&sk->sk_lock.slock); 1737 spin_lock_bh(&sk->sk_lock.slock);
@@ -1748,7 +1748,7 @@ void fastcall lock_sock_nested(struct sock *sk, int subclass)
1748 1748
1749EXPORT_SYMBOL(lock_sock_nested); 1749EXPORT_SYMBOL(lock_sock_nested);
1750 1750
1751void fastcall release_sock(struct sock *sk) 1751void release_sock(struct sock *sk)
1752{ 1752{
1753 /* 1753 /*
1754 * The sk_lock has mutex_unlock() semantics: 1754 * The sk_lock has mutex_unlock() semantics:
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 1a47f5d1be17..140a0a8c6b02 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -232,7 +232,7 @@ static int rfkill_suspend(struct device *dev, pm_message_t state)
232 struct rfkill *rfkill = to_rfkill(dev); 232 struct rfkill *rfkill = to_rfkill(dev);
233 233
234 if (dev->power.power_state.event != state.event) { 234 if (dev->power.power_state.event != state.event) {
235 if (state.event == PM_EVENT_SUSPEND) { 235 if (state.event & PM_EVENT_SLEEP) {
236 mutex_lock(&rfkill->mutex); 236 mutex_lock(&rfkill->mutex);
237 237
238 if (rfkill->state == RFKILL_STATE_ON) 238 if (rfkill->state == RFKILL_STATE_ON)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 0998e6d09664..8c6a7f1a25e9 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -464,9 +464,9 @@ rpc_release_client(struct rpc_clnt *clnt)
464 464
465/** 465/**
466 * rpc_bind_new_program - bind a new RPC program to an existing client 466 * rpc_bind_new_program - bind a new RPC program to an existing client
467 * @old - old rpc_client 467 * @old: old rpc_client
468 * @program - rpc program to set 468 * @program: rpc program to set
469 * @vers - rpc program version 469 * @vers: rpc program version
470 * 470 *
471 * Clones the rpc client and sets up a new RPC program. This is mainly 471 * Clones the rpc client and sets up a new RPC program. This is mainly
472 * of use for enabling different RPC programs to share the same transport. 472 * of use for enabling different RPC programs to share the same transport.
@@ -575,7 +575,7 @@ EXPORT_SYMBOL_GPL(rpc_call_sync);
575 * @clnt: pointer to RPC client 575 * @clnt: pointer to RPC client
576 * @msg: RPC call parameters 576 * @msg: RPC call parameters
577 * @flags: RPC call flags 577 * @flags: RPC call flags
578 * @ops: RPC call ops 578 * @tk_ops: RPC call ops
579 * @data: user call data 579 * @data: user call data
580 */ 580 */
581int 581int
@@ -610,7 +610,7 @@ EXPORT_SYMBOL_GPL(rpc_call_start);
610 * rpc_peeraddr - extract remote peer address from clnt's xprt 610 * rpc_peeraddr - extract remote peer address from clnt's xprt
611 * @clnt: RPC client structure 611 * @clnt: RPC client structure
612 * @buf: target buffer 612 * @buf: target buffer
613 * @size: length of target buffer 613 * @bufsize: length of target buffer
614 * 614 *
615 * Returns the number of bytes that are actually in the stored address. 615 * Returns the number of bytes that are actually in the stored address.
616 */ 616 */
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 7e197168a245..1b395a41a8b2 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -495,7 +495,7 @@ rpc_lookup_parent(char *path, struct nameidata *nd)
495static void 495static void
496rpc_release_path(struct nameidata *nd) 496rpc_release_path(struct nameidata *nd)
497{ 497{
498 path_release(nd); 498 path_put(&nd->path);
499 rpc_put_mount(); 499 rpc_put_mount();
500} 500}
501 501
@@ -668,7 +668,8 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
668 668
669 if ((error = rpc_lookup_parent(path, nd)) != 0) 669 if ((error = rpc_lookup_parent(path, nd)) != 0)
670 return ERR_PTR(error); 670 return ERR_PTR(error);
671 dentry = rpc_lookup_create(nd->dentry, nd->last.name, nd->last.len, 1); 671 dentry = rpc_lookup_create(nd->path.dentry, nd->last.name, nd->last.len,
672 1);
672 if (IS_ERR(dentry)) 673 if (IS_ERR(dentry))
673 rpc_release_path(nd); 674 rpc_release_path(nd);
674 return dentry; 675 return dentry;
@@ -677,7 +678,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
677/** 678/**
678 * rpc_mkdir - Create a new directory in rpc_pipefs 679 * rpc_mkdir - Create a new directory in rpc_pipefs
679 * @path: path from the rpc_pipefs root to the new directory 680 * @path: path from the rpc_pipefs root to the new directory
680 * @rpc_clnt: rpc client to associate with this directory 681 * @rpc_client: rpc client to associate with this directory
681 * 682 *
682 * This creates a directory at the given @path associated with 683 * This creates a directory at the given @path associated with
683 * @rpc_clnt, which will contain a file named "info" with some basic 684 * @rpc_clnt, which will contain a file named "info" with some basic
@@ -695,7 +696,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
695 dentry = rpc_lookup_negative(path, &nd); 696 dentry = rpc_lookup_negative(path, &nd);
696 if (IS_ERR(dentry)) 697 if (IS_ERR(dentry))
697 return dentry; 698 return dentry;
698 dir = nd.dentry->d_inode; 699 dir = nd.path.dentry->d_inode;
699 if ((error = __rpc_mkdir(dir, dentry)) != 0) 700 if ((error = __rpc_mkdir(dir, dentry)) != 0)
700 goto err_dput; 701 goto err_dput;
701 RPC_I(dentry->d_inode)->private = rpc_client; 702 RPC_I(dentry->d_inode)->private = rpc_client;
@@ -748,6 +749,7 @@ rpc_rmdir(struct dentry *dentry)
748 * @private: private data to associate with the pipe, for the caller's use 749 * @private: private data to associate with the pipe, for the caller's use
749 * @ops: operations defining the behavior of the pipe: upcall, downcall, 750 * @ops: operations defining the behavior of the pipe: upcall, downcall,
750 * release_pipe, and destroy_msg. 751 * release_pipe, and destroy_msg.
752 * @flags: rpc_inode flags
751 * 753 *
752 * Data is made available for userspace to read by calls to 754 * Data is made available for userspace to read by calls to
753 * rpc_queue_upcall(). The actual reads will result in calls to 755 * rpc_queue_upcall(). The actual reads will result in calls to
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 1d3e5fcc2cc4..c475977de05a 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -175,7 +175,7 @@ static int svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
175 size_t base = xdr->page_base; 175 size_t base = xdr->page_base;
176 unsigned int pglen = xdr->page_len; 176 unsigned int pglen = xdr->page_len;
177 unsigned int flags = MSG_MORE; 177 unsigned int flags = MSG_MORE;
178 char buf[RPC_MAX_ADDRBUFLEN]; 178 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
179 179
180 slen = xdr->len; 180 slen = xdr->len;
181 181
@@ -716,7 +716,7 @@ static struct svc_xprt *svc_tcp_accept(struct svc_xprt *xprt)
716 struct socket *newsock; 716 struct socket *newsock;
717 struct svc_sock *newsvsk; 717 struct svc_sock *newsvsk;
718 int err, slen; 718 int err, slen;
719 char buf[RPC_MAX_ADDRBUFLEN]; 719 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
720 720
721 dprintk("svc: tcp_accept %p sock %p\n", svsk, sock); 721 dprintk("svc: tcp_accept %p sock %p\n", svsk, sock);
722 if (!sock) 722 if (!sock)
@@ -1206,10 +1206,10 @@ static struct svc_xprt *svc_create_socket(struct svc_serv *serv,
1206 struct socket *sock; 1206 struct socket *sock;
1207 int error; 1207 int error;
1208 int type; 1208 int type;
1209 char buf[RPC_MAX_ADDRBUFLEN];
1210 struct sockaddr_storage addr; 1209 struct sockaddr_storage addr;
1211 struct sockaddr *newsin = (struct sockaddr *)&addr; 1210 struct sockaddr *newsin = (struct sockaddr *)&addr;
1212 int newlen; 1211 int newlen;
1212 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
1213 1213
1214 dprintk("svc: svc_create_socket(%s, %d, %s)\n", 1214 dprintk("svc: svc_create_socket(%s, %d, %s)\n",
1215 serv->sv_program->pg_name, protocol, 1215 serv->sv_program->pg_name, protocol,
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index cfcade906a56..d5553b8179f9 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -124,7 +124,7 @@ EXPORT_SYMBOL_GPL(xprt_register_transport);
124 124
125/** 125/**
126 * xprt_unregister_transport - unregister a transport implementation 126 * xprt_unregister_transport - unregister a transport implementation
127 * transport: transport to unregister 127 * @transport: transport to unregister
128 * 128 *
129 * Returns: 129 * Returns:
130 * 0: transport successfully unregistered 130 * 0: transport successfully unregistered
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index eea75888805e..b8788fd5e3c6 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -718,16 +718,16 @@ static struct sock *unix_find_other(struct net *net,
718 goto put_fail; 718 goto put_fail;
719 719
720 err = -ECONNREFUSED; 720 err = -ECONNREFUSED;
721 if (!S_ISSOCK(nd.dentry->d_inode->i_mode)) 721 if (!S_ISSOCK(nd.path.dentry->d_inode->i_mode))
722 goto put_fail; 722 goto put_fail;
723 u=unix_find_socket_byinode(net, nd.dentry->d_inode); 723 u = unix_find_socket_byinode(net, nd.path.dentry->d_inode);
724 if (!u) 724 if (!u)
725 goto put_fail; 725 goto put_fail;
726 726
727 if (u->sk_type == type) 727 if (u->sk_type == type)
728 touch_atime(nd.mnt, nd.dentry); 728 touch_atime(nd.path.mnt, nd.path.dentry);
729 729
730 path_release(&nd); 730 path_put(&nd.path);
731 731
732 err=-EPROTOTYPE; 732 err=-EPROTOTYPE;
733 if (u->sk_type != type) { 733 if (u->sk_type != type) {
@@ -748,7 +748,7 @@ static struct sock *unix_find_other(struct net *net,
748 return u; 748 return u;
749 749
750put_fail: 750put_fail:
751 path_release(&nd); 751 path_put(&nd.path);
752fail: 752fail:
753 *error=err; 753 *error=err;
754 return NULL; 754 return NULL;
@@ -819,12 +819,12 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
819 */ 819 */
820 mode = S_IFSOCK | 820 mode = S_IFSOCK |
821 (SOCK_INODE(sock)->i_mode & ~current->fs->umask); 821 (SOCK_INODE(sock)->i_mode & ~current->fs->umask);
822 err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); 822 err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0);
823 if (err) 823 if (err)
824 goto out_mknod_dput; 824 goto out_mknod_dput;
825 mutex_unlock(&nd.dentry->d_inode->i_mutex); 825 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
826 dput(nd.dentry); 826 dput(nd.path.dentry);
827 nd.dentry = dentry; 827 nd.path.dentry = dentry;
828 828
829 addr->hash = UNIX_HASH_SIZE; 829 addr->hash = UNIX_HASH_SIZE;
830 } 830 }
@@ -842,8 +842,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
842 list = &unix_socket_table[addr->hash]; 842 list = &unix_socket_table[addr->hash];
843 } else { 843 } else {
844 list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; 844 list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)];
845 u->dentry = nd.dentry; 845 u->dentry = nd.path.dentry;
846 u->mnt = nd.mnt; 846 u->mnt = nd.path.mnt;
847 } 847 }
848 848
849 err = 0; 849 err = 0;
@@ -861,8 +861,8 @@ out:
861out_mknod_dput: 861out_mknod_dput:
862 dput(dentry); 862 dput(dentry);
863out_mknod_unlock: 863out_mknod_unlock:
864 mutex_unlock(&nd.dentry->d_inode->i_mutex); 864 mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
865 path_release(&nd); 865 path_put(&nd.path);
866out_mknod_parent: 866out_mknod_parent:
867 if (err==-EEXIST) 867 if (err==-EEXIST)
868 err=-EADDRINUSE; 868 err=-EADDRINUSE;
diff --git a/samples/markers/probe-example.c b/samples/markers/probe-example.c
index a36797535615..c8e099d4d1fd 100644
--- a/samples/markers/probe-example.c
+++ b/samples/markers/probe-example.c
@@ -20,31 +20,27 @@ struct probe_data {
20 marker_probe_func *probe_func; 20 marker_probe_func *probe_func;
21}; 21};
22 22
23void probe_subsystem_event(const struct marker *mdata, void *private, 23void probe_subsystem_event(void *probe_data, void *call_data,
24 const char *format, ...) 24 const char *format, va_list *args)
25{ 25{
26 va_list ap;
27 /* Declare args */ 26 /* Declare args */
28 unsigned int value; 27 unsigned int value;
29 const char *mystr; 28 const char *mystr;
30 29
31 /* Assign args */ 30 /* Assign args */
32 va_start(ap, format); 31 value = va_arg(*args, typeof(value));
33 value = va_arg(ap, typeof(value)); 32 mystr = va_arg(*args, typeof(mystr));
34 mystr = va_arg(ap, typeof(mystr));
35 33
36 /* Call printk */ 34 /* Call printk */
37 printk(KERN_DEBUG "Value %u, string %s\n", value, mystr); 35 printk(KERN_INFO "Value %u, string %s\n", value, mystr);
38 36
39 /* or count, check rights, serialize data in a buffer */ 37 /* or count, check rights, serialize data in a buffer */
40
41 va_end(ap);
42} 38}
43 39
44atomic_t eventb_count = ATOMIC_INIT(0); 40atomic_t eventb_count = ATOMIC_INIT(0);
45 41
46void probe_subsystem_eventb(const struct marker *mdata, void *private, 42void probe_subsystem_eventb(void *probe_data, void *call_data,
47 const char *format, ...) 43 const char *format, va_list *args)
48{ 44{
49 /* Increment counter */ 45 /* Increment counter */
50 atomic_inc(&eventb_count); 46 atomic_inc(&eventb_count);
@@ -72,10 +68,6 @@ static int __init probe_init(void)
72 if (result) 68 if (result)
73 printk(KERN_INFO "Unable to register probe %s\n", 69 printk(KERN_INFO "Unable to register probe %s\n",
74 probe_array[i].name); 70 probe_array[i].name);
75 result = marker_arm(probe_array[i].name);
76 if (result)
77 printk(KERN_INFO "Unable to arm probe %s\n",
78 probe_array[i].name);
79 } 71 }
80 return 0; 72 return 0;
81} 73}
@@ -85,7 +77,8 @@ static void __exit probe_fini(void)
85 int i; 77 int i;
86 78
87 for (i = 0; i < ARRAY_SIZE(probe_array); i++) 79 for (i = 0; i < ARRAY_SIZE(probe_array); i++)
88 marker_probe_unregister(probe_array[i].name); 80 marker_probe_unregister(probe_array[i].name,
81 probe_array[i].probe_func, &probe_array[i]);
89 printk(KERN_INFO "Number of event b : %u\n", 82 printk(KERN_INFO "Number of event b : %u\n",
90 atomic_read(&eventb_count)); 83 atomic_read(&eventb_count));
91} 84}
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 65e707e1ffc3..cfc004e04417 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -13,6 +13,7 @@
13# 2) modpost is then used to 13# 2) modpost is then used to
14# 3) create one <module>.mod.c file pr. module 14# 3) create one <module>.mod.c file pr. module
15# 4) create one Module.symvers file with CRC for all exported symbols 15# 4) create one Module.symvers file with CRC for all exported symbols
16# 4a) [CONFIG_MARKERS] create one Module.markers file listing defined markers
16# 5) compile all <module>.mod.c files 17# 5) compile all <module>.mod.c files
17# 6) final link of the module to a <module.ko> file 18# 6) final link of the module to a <module.ko> file
18 19
@@ -45,6 +46,10 @@ include scripts/Makefile.lib
45 46
46kernelsymfile := $(objtree)/Module.symvers 47kernelsymfile := $(objtree)/Module.symvers
47modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers 48modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers
49kernelmarkersfile := $(objtree)/Module.markers
50modulemarkersfile := $(firstword $(KBUILD_EXTMOD))/Module.markers
51
52markersfile = $(if $(KBUILD_EXTMOD),$(modulemarkersfile),$(kernelmarkersfile))
48 53
49# Step 1), find all modules listed in $(MODVERDIR)/ 54# Step 1), find all modules listed in $(MODVERDIR)/
50__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) 55__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
@@ -63,6 +68,8 @@ modpost = scripts/mod/modpost \
63 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 68 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
64 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 69 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
65 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 70 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
71 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \
72 $(if $(CONFIG_MARKERS),-M $(markersfile)) \
66 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 73 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
67 74
68quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules 75quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
@@ -82,6 +89,10 @@ vmlinux.o: FORCE
82$(symverfile): __modpost ; 89$(symverfile): __modpost ;
83$(modules:.ko=.mod.c): __modpost ; 90$(modules:.ko=.mod.c): __modpost ;
84 91
92ifdef CONFIG_MARKERS
93$(markersfile): __modpost ;
94endif
95
85 96
86# Step 5), compile all *.mod.c files 97# Step 5), compile all *.mod.c files
87 98
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 3929e5b35e79..4a03191ad176 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -298,22 +298,30 @@ void sym_calc_value(struct symbol *sym)
298 if (sym_is_choice_value(sym) && sym->visible == yes) { 298 if (sym_is_choice_value(sym) && sym->visible == yes) {
299 prop = sym_get_choice_prop(sym); 299 prop = sym_get_choice_prop(sym);
300 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; 300 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
301 } else if (EXPR_OR(sym->visible, sym->rev_dep.tri) != no) { 301 } else {
302 sym->flags |= SYMBOL_WRITE; 302 if (sym->visible != no) {
303 if (sym_has_value(sym)) 303 /* if the symbol is visible use the user value
304 newval.tri = sym->def[S_DEF_USER].tri; 304 * if available, otherwise try the default value
305 else if (!sym_is_choice(sym)) { 305 */
306 prop = sym_get_default_prop(sym); 306 sym->flags |= SYMBOL_WRITE;
307 if (prop) 307 if (sym_has_value(sym)) {
308 newval.tri = expr_calc_value(prop->expr); 308 newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
309 sym->visible);
310 goto calc_newval;
311 }
309 } 312 }
310 newval.tri = EXPR_OR(EXPR_AND(newval.tri, sym->visible), sym->rev_dep.tri); 313 if (sym->rev_dep.tri != no)
311 } else if (!sym_is_choice(sym)) {
312 prop = sym_get_default_prop(sym);
313 if (prop) {
314 sym->flags |= SYMBOL_WRITE; 314 sym->flags |= SYMBOL_WRITE;
315 newval.tri = expr_calc_value(prop->expr); 315 if (!sym_is_choice(sym)) {
316 prop = sym_get_default_prop(sym);
317 if (prop) {
318 sym->flags |= SYMBOL_WRITE;
319 newval.tri = EXPR_AND(expr_calc_value(prop->expr),
320 prop->visible.tri);
321 }
316 } 322 }
323 calc_newval:
324 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
317 } 325 }
318 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) 326 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
319 newval.tri = yes; 327 newval.tri = yes;
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 6c18a14386a4..74c2f9db2aac 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1512,13 +1512,13 @@ sub create_parameterlist($$$) {
1512 # corresponding data structures "correctly". Catch it later in 1512 # corresponding data structures "correctly". Catch it later in
1513 # output_* subs. 1513 # output_* subs.
1514 push_parameter($arg, "", $file); 1514 push_parameter($arg, "", $file);
1515 } elsif ($arg =~ m/\(.*\*/) { 1515 } elsif ($arg =~ m/\(.+\)\s*\(/) {
1516 # pointer-to-function 1516 # pointer-to-function
1517 $arg =~ tr/#/,/; 1517 $arg =~ tr/#/,/;
1518 $arg =~ m/[^\(]+\(\*\s*([^\)]+)\)/; 1518 $arg =~ m/[^\(]+\(\*?\s*(\w*)\s*\)/;
1519 $param = $1; 1519 $param = $1;
1520 $type = $arg; 1520 $type = $arg;
1521 $type =~ s/([^\(]+\(\*)$param/$1/; 1521 $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
1522 push_parameter($param, $type, $file); 1522 push_parameter($param, $type, $file);
1523 } elsif ($arg) { 1523 } elsif ($arg) {
1524 $arg =~ s/\s*:\s*/:/g; 1524 $arg =~ s/\s*:\s*/:/g;
@@ -1624,7 +1624,6 @@ sub dump_function($$) {
1624 1624
1625 $prototype =~ s/^static +//; 1625 $prototype =~ s/^static +//;
1626 $prototype =~ s/^extern +//; 1626 $prototype =~ s/^extern +//;
1627 $prototype =~ s/^fastcall +//;
1628 $prototype =~ s/^asmlinkage +//; 1627 $prototype =~ s/^asmlinkage +//;
1629 $prototype =~ s/^inline +//; 1628 $prototype =~ s/^inline +//;
1630 $prototype =~ s/^__inline__ +//; 1629 $prototype =~ s/^__inline__ +//;
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index dbe1fb5e8cc0..695b5d657cf5 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -11,6 +11,8 @@
11 * Usage: modpost vmlinux module1.o module2.o ... 11 * Usage: modpost vmlinux module1.o module2.o ...
12 */ 12 */
13 13
14#define _GNU_SOURCE
15#include <stdio.h>
14#include <ctype.h> 16#include <ctype.h>
15#include "modpost.h" 17#include "modpost.h"
16#include "../../include/linux/license.h" 18#include "../../include/linux/license.h"
@@ -435,6 +437,8 @@ static int parse_elf(struct elf_info *info, const char *filename)
435 info->export_unused_gpl_sec = i; 437 info->export_unused_gpl_sec = i;
436 else if (strcmp(secname, "__ksymtab_gpl_future") == 0) 438 else if (strcmp(secname, "__ksymtab_gpl_future") == 0)
437 info->export_gpl_future_sec = i; 439 info->export_gpl_future_sec = i;
440 else if (strcmp(secname, "__markers_strings") == 0)
441 info->markers_strings_sec = i;
438 442
439 if (sechdrs[i].sh_type != SHT_SYMTAB) 443 if (sechdrs[i].sh_type != SHT_SYMTAB)
440 continue; 444 continue;
@@ -1196,7 +1200,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
1196 "annotate %s with a matching annotation.\n", 1200 "annotate %s with a matching annotation.\n",
1197 from, sec2annotation(fromsec), fromsym, from_p, 1201 from, sec2annotation(fromsec), fromsym, from_p,
1198 to, sec2annotation(tosec), tosym, to_p, 1202 to, sec2annotation(tosec), tosym, to_p,
1199 fromsym, tosym, fromsym); 1203 tosym, fromsym, tosym);
1200 break; 1204 break;
1201 case INIT_TO_EXIT: 1205 case INIT_TO_EXIT:
1202 fprintf(stderr, 1206 fprintf(stderr,
@@ -1470,6 +1474,62 @@ static void check_sec_ref(struct module *mod, const char *modname,
1470 } 1474 }
1471} 1475}
1472 1476
1477static void get_markers(struct elf_info *info, struct module *mod)
1478{
1479 const Elf_Shdr *sh = &info->sechdrs[info->markers_strings_sec];
1480 const char *strings = (const char *) info->hdr + sh->sh_offset;
1481 const Elf_Sym *sym, *first_sym, *last_sym;
1482 size_t n;
1483
1484 if (!info->markers_strings_sec)
1485 return;
1486
1487 /*
1488 * First count the strings. We look for all the symbols defined
1489 * in the __markers_strings section named __mstrtab_*. For
1490 * these local names, the compiler puts a random .NNN suffix on,
1491 * so the names don't correspond exactly.
1492 */
1493 first_sym = last_sym = NULL;
1494 n = 0;
1495 for (sym = info->symtab_start; sym < info->symtab_stop; sym++)
1496 if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT &&
1497 sym->st_shndx == info->markers_strings_sec &&
1498 !strncmp(info->strtab + sym->st_name,
1499 "__mstrtab_", sizeof "__mstrtab_" - 1)) {
1500 if (first_sym == NULL)
1501 first_sym = sym;
1502 last_sym = sym;
1503 ++n;
1504 }
1505
1506 if (n == 0)
1507 return;
1508
1509 /*
1510 * Now collect each name and format into a line for the output.
1511 * Lines look like:
1512 * marker_name vmlinux marker %s format %d
1513 * The format string after the second \t can use whitespace.
1514 */
1515 mod->markers = NOFAIL(malloc(sizeof mod->markers[0] * n));
1516 mod->nmarkers = n;
1517
1518 n = 0;
1519 for (sym = first_sym; sym <= last_sym; sym++)
1520 if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT &&
1521 sym->st_shndx == info->markers_strings_sec &&
1522 !strncmp(info->strtab + sym->st_name,
1523 "__mstrtab_", sizeof "__mstrtab_" - 1)) {
1524 const char *name = strings + sym->st_value;
1525 const char *fmt = strchr(name, '\0') + 1;
1526 char *line = NULL;
1527 asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt);
1528 NOFAIL(line);
1529 mod->markers[n++] = line;
1530 }
1531}
1532
1473static void read_symbols(char *modname) 1533static void read_symbols(char *modname)
1474{ 1534{
1475 const char *symname; 1535 const char *symname;
@@ -1521,6 +1581,8 @@ static void read_symbols(char *modname)
1521 get_src_version(modname, mod->srcversion, 1581 get_src_version(modname, mod->srcversion,
1522 sizeof(mod->srcversion)-1); 1582 sizeof(mod->srcversion)-1);
1523 1583
1584 get_markers(&info, mod);
1585
1524 parse_elf_finish(&info); 1586 parse_elf_finish(&info);
1525 1587
1526 /* Our trick to get versioning for struct_module - it's 1588 /* Our trick to get versioning for struct_module - it's
@@ -1867,16 +1929,104 @@ static void write_dump(const char *fname)
1867 write_if_changed(&buf, fname); 1929 write_if_changed(&buf, fname);
1868} 1930}
1869 1931
1932static void add_marker(struct module *mod, const char *name, const char *fmt)
1933{
1934 char *line = NULL;
1935 asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt);
1936 NOFAIL(line);
1937
1938 mod->markers = NOFAIL(realloc(mod->markers, ((mod->nmarkers + 1) *
1939 sizeof mod->markers[0])));
1940 mod->markers[mod->nmarkers++] = line;
1941}
1942
1943static void read_markers(const char *fname)
1944{
1945 unsigned long size, pos = 0;
1946 void *file = grab_file(fname, &size);
1947 char *line;
1948
1949 if (!file) /* No old markers, silently ignore */
1950 return;
1951
1952 while ((line = get_next_line(&pos, file, size))) {
1953 char *marker, *modname, *fmt;
1954 struct module *mod;
1955
1956 marker = line;
1957 modname = strchr(marker, '\t');
1958 if (!modname)
1959 goto fail;
1960 *modname++ = '\0';
1961 fmt = strchr(modname, '\t');
1962 if (!fmt)
1963 goto fail;
1964 *fmt++ = '\0';
1965 if (*marker == '\0' || *modname == '\0')
1966 goto fail;
1967
1968 mod = find_module(modname);
1969 if (!mod) {
1970 if (is_vmlinux(modname))
1971 have_vmlinux = 1;
1972 mod = new_module(NOFAIL(strdup(modname)));
1973 mod->skip = 1;
1974 }
1975
1976 add_marker(mod, marker, fmt);
1977 }
1978 return;
1979fail:
1980 fatal("parse error in markers list file\n");
1981}
1982
1983static int compare_strings(const void *a, const void *b)
1984{
1985 return strcmp(*(const char **) a, *(const char **) b);
1986}
1987
1988static void write_markers(const char *fname)
1989{
1990 struct buffer buf = { };
1991 struct module *mod;
1992 size_t i;
1993
1994 for (mod = modules; mod; mod = mod->next)
1995 if ((!external_module || !mod->skip) && mod->markers != NULL) {
1996 /*
1997 * Sort the strings so we can skip duplicates when
1998 * we write them out.
1999 */
2000 qsort(mod->markers, mod->nmarkers,
2001 sizeof mod->markers[0], &compare_strings);
2002 for (i = 0; i < mod->nmarkers; ++i) {
2003 char *line = mod->markers[i];
2004 buf_write(&buf, line, strlen(line));
2005 while (i + 1 < mod->nmarkers &&
2006 !strcmp(mod->markers[i],
2007 mod->markers[i + 1]))
2008 free(mod->markers[i++]);
2009 free(mod->markers[i]);
2010 }
2011 free(mod->markers);
2012 mod->markers = NULL;
2013 }
2014
2015 write_if_changed(&buf, fname);
2016}
2017
1870int main(int argc, char **argv) 2018int main(int argc, char **argv)
1871{ 2019{
1872 struct module *mod; 2020 struct module *mod;
1873 struct buffer buf = { }; 2021 struct buffer buf = { };
1874 char *kernel_read = NULL, *module_read = NULL; 2022 char *kernel_read = NULL, *module_read = NULL;
1875 char *dump_write = NULL; 2023 char *dump_write = NULL;
2024 char *markers_read = NULL;
2025 char *markers_write = NULL;
1876 int opt; 2026 int opt;
1877 int err; 2027 int err;
1878 2028
1879 while ((opt = getopt(argc, argv, "i:I:msSo:aw")) != -1) { 2029 while ((opt = getopt(argc, argv, "i:I:msSo:awM:K:")) != -1) {
1880 switch (opt) { 2030 switch (opt) {
1881 case 'i': 2031 case 'i':
1882 kernel_read = optarg; 2032 kernel_read = optarg;
@@ -1903,6 +2053,12 @@ int main(int argc, char **argv)
1903 case 'w': 2053 case 'w':
1904 warn_unresolved = 1; 2054 warn_unresolved = 1;
1905 break; 2055 break;
2056 case 'M':
2057 markers_write = optarg;
2058 break;
2059 case 'K':
2060 markers_read = optarg;
2061 break;
1906 default: 2062 default:
1907 exit(1); 2063 exit(1);
1908 } 2064 }
@@ -1950,5 +2106,11 @@ int main(int argc, char **argv)
1950 "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", 2106 "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
1951 sec_mismatch_count); 2107 sec_mismatch_count);
1952 2108
2109 if (markers_read)
2110 read_markers(markers_read);
2111
2112 if (markers_write)
2113 write_markers(markers_write);
2114
1953 return err; 2115 return err;
1954} 2116}
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 999f15e0e008..565c5872407e 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -112,6 +112,8 @@ struct module {
112 int has_init; 112 int has_init;
113 int has_cleanup; 113 int has_cleanup;
114 struct buffer dev_table_buf; 114 struct buffer dev_table_buf;
115 char **markers;
116 size_t nmarkers;
115 char srcversion[25]; 117 char srcversion[25];
116}; 118};
117 119
@@ -126,6 +128,7 @@ struct elf_info {
126 Elf_Section export_gpl_sec; 128 Elf_Section export_gpl_sec;
127 Elf_Section export_unused_gpl_sec; 129 Elf_Section export_unused_gpl_sec;
128 Elf_Section export_gpl_future_sec; 130 Elf_Section export_gpl_future_sec;
131 Elf_Section markers_strings_sec;
129 const char *strtab; 132 const char *strtab;
130 char *modinfo; 133 char *modinfo;
131 unsigned int modinfo_len; 134 unsigned int modinfo_len;
diff --git a/security/commoncap.c b/security/commoncap.c
index 5aba82679a0b..bb0c095f5761 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -552,7 +552,7 @@ int cap_task_kill(struct task_struct *p, struct siginfo *info,
552 * allowed. 552 * allowed.
553 * We must preserve legacy signal behavior in this case. 553 * We must preserve legacy signal behavior in this case.
554 */ 554 */
555 if (p->euid == 0 && p->uid == current->uid) 555 if (p->uid == current->uid)
556 return 0; 556 return 0;
557 557
558 /* sigcont is permitted within same session */ 558 /* sigcont is permitted within same session */
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index e8529e2f51e5..187964e88af1 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -568,10 +568,11 @@ void avc_audit(u32 ssid, u32 tsid,
568 audit_log_format(ab, " capability=%d", a->u.cap); 568 audit_log_format(ab, " capability=%d", a->u.cap);
569 break; 569 break;
570 case AVC_AUDIT_DATA_FS: 570 case AVC_AUDIT_DATA_FS:
571 if (a->u.fs.dentry) { 571 if (a->u.fs.path.dentry) {
572 struct dentry *dentry = a->u.fs.dentry; 572 struct dentry *dentry = a->u.fs.path.dentry;
573 if (a->u.fs.mnt) { 573 if (a->u.fs.path.mnt) {
574 audit_log_d_path(ab, "path=", dentry, a->u.fs.mnt); 574 audit_log_d_path(ab, "path=",
575 &a->u.fs.path);
575 } else { 576 } else {
576 audit_log_format(ab, " name="); 577 audit_log_format(ab, " name=");
577 audit_log_untrustedstring(ab, dentry->d_name.name); 578 audit_log_untrustedstring(ab, dentry->d_name.name);
@@ -626,8 +627,12 @@ void avc_audit(u32 ssid, u32 tsid,
626 case AF_UNIX: 627 case AF_UNIX:
627 u = unix_sk(sk); 628 u = unix_sk(sk);
628 if (u->dentry) { 629 if (u->dentry) {
630 struct path path = {
631 .dentry = u->dentry,
632 .mnt = u->mnt
633 };
629 audit_log_d_path(ab, "path=", 634 audit_log_d_path(ab, "path=",
630 u->dentry, u->mnt); 635 &path);
631 break; 636 break;
632 } 637 }
633 if (!u->addr) 638 if (!u->addr)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 44f16d9041e3..75c2e99bfb81 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1356,8 +1356,8 @@ static inline int dentry_has_perm(struct task_struct *tsk,
1356 struct inode *inode = dentry->d_inode; 1356 struct inode *inode = dentry->d_inode;
1357 struct avc_audit_data ad; 1357 struct avc_audit_data ad;
1358 AVC_AUDIT_DATA_INIT(&ad,FS); 1358 AVC_AUDIT_DATA_INIT(&ad,FS);
1359 ad.u.fs.mnt = mnt; 1359 ad.u.fs.path.mnt = mnt;
1360 ad.u.fs.dentry = dentry; 1360 ad.u.fs.path.dentry = dentry;
1361 return inode_has_perm(tsk, inode, av, &ad); 1361 return inode_has_perm(tsk, inode, av, &ad);
1362} 1362}
1363 1363
@@ -1375,15 +1375,12 @@ static int file_has_perm(struct task_struct *tsk,
1375{ 1375{
1376 struct task_security_struct *tsec = tsk->security; 1376 struct task_security_struct *tsec = tsk->security;
1377 struct file_security_struct *fsec = file->f_security; 1377 struct file_security_struct *fsec = file->f_security;
1378 struct vfsmount *mnt = file->f_path.mnt; 1378 struct inode *inode = file->f_path.dentry->d_inode;
1379 struct dentry *dentry = file->f_path.dentry;
1380 struct inode *inode = dentry->d_inode;
1381 struct avc_audit_data ad; 1379 struct avc_audit_data ad;
1382 int rc; 1380 int rc;
1383 1381
1384 AVC_AUDIT_DATA_INIT(&ad, FS); 1382 AVC_AUDIT_DATA_INIT(&ad, FS);
1385 ad.u.fs.mnt = mnt; 1383 ad.u.fs.path = file->f_path;
1386 ad.u.fs.dentry = dentry;
1387 1384
1388 if (tsec->sid != fsec->sid) { 1385 if (tsec->sid != fsec->sid) {
1389 rc = avc_has_perm(tsec->sid, fsec->sid, 1386 rc = avc_has_perm(tsec->sid, fsec->sid,
@@ -1418,7 +1415,7 @@ static int may_create(struct inode *dir,
1418 sbsec = dir->i_sb->s_security; 1415 sbsec = dir->i_sb->s_security;
1419 1416
1420 AVC_AUDIT_DATA_INIT(&ad, FS); 1417 AVC_AUDIT_DATA_INIT(&ad, FS);
1421 ad.u.fs.dentry = dentry; 1418 ad.u.fs.path.dentry = dentry;
1422 1419
1423 rc = avc_has_perm(tsec->sid, dsec->sid, SECCLASS_DIR, 1420 rc = avc_has_perm(tsec->sid, dsec->sid, SECCLASS_DIR,
1424 DIR__ADD_NAME | DIR__SEARCH, 1421 DIR__ADD_NAME | DIR__SEARCH,
@@ -1476,7 +1473,7 @@ static int may_link(struct inode *dir,
1476 isec = dentry->d_inode->i_security; 1473 isec = dentry->d_inode->i_security;
1477 1474
1478 AVC_AUDIT_DATA_INIT(&ad, FS); 1475 AVC_AUDIT_DATA_INIT(&ad, FS);
1479 ad.u.fs.dentry = dentry; 1476 ad.u.fs.path.dentry = dentry;
1480 1477
1481 av = DIR__SEARCH; 1478 av = DIR__SEARCH;
1482 av |= (kind ? DIR__REMOVE_NAME : DIR__ADD_NAME); 1479 av |= (kind ? DIR__REMOVE_NAME : DIR__ADD_NAME);
@@ -1523,7 +1520,7 @@ static inline int may_rename(struct inode *old_dir,
1523 1520
1524 AVC_AUDIT_DATA_INIT(&ad, FS); 1521 AVC_AUDIT_DATA_INIT(&ad, FS);
1525 1522
1526 ad.u.fs.dentry = old_dentry; 1523 ad.u.fs.path.dentry = old_dentry;
1527 rc = avc_has_perm(tsec->sid, old_dsec->sid, SECCLASS_DIR, 1524 rc = avc_has_perm(tsec->sid, old_dsec->sid, SECCLASS_DIR,
1528 DIR__REMOVE_NAME | DIR__SEARCH, &ad); 1525 DIR__REMOVE_NAME | DIR__SEARCH, &ad);
1529 if (rc) 1526 if (rc)
@@ -1539,7 +1536,7 @@ static inline int may_rename(struct inode *old_dir,
1539 return rc; 1536 return rc;
1540 } 1537 }
1541 1538
1542 ad.u.fs.dentry = new_dentry; 1539 ad.u.fs.path.dentry = new_dentry;
1543 av = DIR__ADD_NAME | DIR__SEARCH; 1540 av = DIR__ADD_NAME | DIR__SEARCH;
1544 if (new_dentry->d_inode) 1541 if (new_dentry->d_inode)
1545 av |= DIR__REMOVE_NAME; 1542 av |= DIR__REMOVE_NAME;
@@ -1918,8 +1915,7 @@ static int selinux_bprm_set_security(struct linux_binprm *bprm)
1918 } 1915 }
1919 1916
1920 AVC_AUDIT_DATA_INIT(&ad, FS); 1917 AVC_AUDIT_DATA_INIT(&ad, FS);
1921 ad.u.fs.mnt = bprm->file->f_path.mnt; 1918 ad.u.fs.path = bprm->file->f_path;
1922 ad.u.fs.dentry = bprm->file->f_path.dentry;
1923 1919
1924 if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) 1920 if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
1925 newsid = tsec->sid; 1921 newsid = tsec->sid;
@@ -2315,7 +2311,7 @@ static int selinux_sb_kern_mount(struct super_block *sb, void *data)
2315 return rc; 2311 return rc;
2316 2312
2317 AVC_AUDIT_DATA_INIT(&ad,FS); 2313 AVC_AUDIT_DATA_INIT(&ad,FS);
2318 ad.u.fs.dentry = sb->s_root; 2314 ad.u.fs.path.dentry = sb->s_root;
2319 return superblock_has_perm(current, sb, FILESYSTEM__MOUNT, &ad); 2315 return superblock_has_perm(current, sb, FILESYSTEM__MOUNT, &ad);
2320} 2316}
2321 2317
@@ -2324,7 +2320,7 @@ static int selinux_sb_statfs(struct dentry *dentry)
2324 struct avc_audit_data ad; 2320 struct avc_audit_data ad;
2325 2321
2326 AVC_AUDIT_DATA_INIT(&ad,FS); 2322 AVC_AUDIT_DATA_INIT(&ad,FS);
2327 ad.u.fs.dentry = dentry->d_sb->s_root; 2323 ad.u.fs.path.dentry = dentry->d_sb->s_root;
2328 return superblock_has_perm(current, dentry->d_sb, FILESYSTEM__GETATTR, &ad); 2324 return superblock_has_perm(current, dentry->d_sb, FILESYSTEM__GETATTR, &ad);
2329} 2325}
2330 2326
@@ -2341,10 +2337,10 @@ static int selinux_mount(char * dev_name,
2341 return rc; 2337 return rc;
2342 2338
2343 if (flags & MS_REMOUNT) 2339 if (flags & MS_REMOUNT)
2344 return superblock_has_perm(current, nd->mnt->mnt_sb, 2340 return superblock_has_perm(current, nd->path.mnt->mnt_sb,
2345 FILESYSTEM__REMOUNT, NULL); 2341 FILESYSTEM__REMOUNT, NULL);
2346 else 2342 else
2347 return dentry_has_perm(current, nd->mnt, nd->dentry, 2343 return dentry_has_perm(current, nd->path.mnt, nd->path.dentry,
2348 FILE__MOUNTON); 2344 FILE__MOUNTON);
2349} 2345}
2350 2346
@@ -2587,7 +2583,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, char *name, void *value
2587 return -EPERM; 2583 return -EPERM;
2588 2584
2589 AVC_AUDIT_DATA_INIT(&ad,FS); 2585 AVC_AUDIT_DATA_INIT(&ad,FS);
2590 ad.u.fs.dentry = dentry; 2586 ad.u.fs.path.dentry = dentry;
2591 2587
2592 rc = avc_has_perm(tsec->sid, isec->sid, isec->sclass, 2588 rc = avc_has_perm(tsec->sid, isec->sid, isec->sclass,
2593 FILE__RELABELFROM, &ad); 2589 FILE__RELABELFROM, &ad);
diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h
index 80c28fa6621c..8e23d7a873a4 100644
--- a/security/selinux/include/avc.h
+++ b/security/selinux/include/avc.h
@@ -13,6 +13,7 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/in6.h> 15#include <linux/in6.h>
16#include <linux/path.h>
16#include <asm/system.h> 17#include <asm/system.h>
17#include "flask.h" 18#include "flask.h"
18#include "av_permissions.h" 19#include "av_permissions.h"
@@ -30,8 +31,6 @@ extern int selinux_enforcing;
30struct avc_entry; 31struct avc_entry;
31 32
32struct task_struct; 33struct task_struct;
33struct vfsmount;
34struct dentry;
35struct inode; 34struct inode;
36struct sock; 35struct sock;
37struct sk_buff; 36struct sk_buff;
@@ -46,8 +45,7 @@ struct avc_audit_data {
46 struct task_struct *tsk; 45 struct task_struct *tsk;
47 union { 46 union {
48 struct { 47 struct {
49 struct vfsmount *mnt; 48 struct path path;
50 struct dentry *dentry;
51 struct inode *inode; 49 struct inode *inode;
52 } fs; 50 } fs;
53 struct { 51 struct {
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 1c11e4245859..770eb067e165 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -325,7 +325,7 @@ static int smack_sb_statfs(struct dentry *dentry)
325static int smack_sb_mount(char *dev_name, struct nameidata *nd, 325static int smack_sb_mount(char *dev_name, struct nameidata *nd,
326 char *type, unsigned long flags, void *data) 326 char *type, unsigned long flags, void *data)
327{ 327{
328 struct superblock_smack *sbp = nd->mnt->mnt_sb->s_security; 328 struct superblock_smack *sbp = nd->path.mnt->mnt_sb->s_security;
329 329
330 return smk_curacc(sbp->smk_floor, MAY_WRITE); 330 return smk_curacc(sbp->smk_floor, MAY_WRITE);
331} 331}
@@ -584,14 +584,20 @@ static int smack_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
584static int smack_inode_setxattr(struct dentry *dentry, char *name, 584static int smack_inode_setxattr(struct dentry *dentry, char *name,
585 void *value, size_t size, int flags) 585 void *value, size_t size, int flags)
586{ 586{
587 if (!capable(CAP_MAC_ADMIN)) { 587 int rc = 0;
588 if (strcmp(name, XATTR_NAME_SMACK) == 0 ||
589 strcmp(name, XATTR_NAME_SMACKIPIN) == 0 ||
590 strcmp(name, XATTR_NAME_SMACKIPOUT) == 0)
591 return -EPERM;
592 }
593 588
594 return smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE); 589 if (strcmp(name, XATTR_NAME_SMACK) == 0 ||
590 strcmp(name, XATTR_NAME_SMACKIPIN) == 0 ||
591 strcmp(name, XATTR_NAME_SMACKIPOUT) == 0) {
592 if (!capable(CAP_MAC_ADMIN))
593 rc = -EPERM;
594 } else
595 rc = cap_inode_setxattr(dentry, name, value, size, flags);
596
597 if (rc == 0)
598 rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE);
599
600 return rc;
595} 601}
596 602
597/** 603/**
@@ -658,10 +664,20 @@ static int smack_inode_getxattr(struct dentry *dentry, char *name)
658 */ 664 */
659static int smack_inode_removexattr(struct dentry *dentry, char *name) 665static int smack_inode_removexattr(struct dentry *dentry, char *name)
660{ 666{
661 if (strcmp(name, XATTR_NAME_SMACK) == 0 && !capable(CAP_MAC_ADMIN)) 667 int rc = 0;
662 return -EPERM;
663 668
664 return smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE); 669 if (strcmp(name, XATTR_NAME_SMACK) == 0 ||
670 strcmp(name, XATTR_NAME_SMACKIPIN) == 0 ||
671 strcmp(name, XATTR_NAME_SMACKIPOUT) == 0) {
672 if (!capable(CAP_MAC_ADMIN))
673 rc = -EPERM;
674 } else
675 rc = cap_inode_removexattr(dentry, name);
676
677 if (rc == 0)
678 rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE);
679
680 return rc;
665} 681}
666 682
667/** 683/**
@@ -701,7 +717,7 @@ static int smack_inode_getsecurity(const struct inode *inode,
701 return -EOPNOTSUPP; 717 return -EOPNOTSUPP;
702 718
703 sock = SOCKET_I(ip); 719 sock = SOCKET_I(ip);
704 if (sock == NULL) 720 if (sock == NULL || sock->sk == NULL)
705 return -EOPNOTSUPP; 721 return -EOPNOTSUPP;
706 722
707 ssp = sock->sk->sk_security; 723 ssp = sock->sk->sk_security;
@@ -1016,7 +1032,12 @@ static void smack_task_getsecid(struct task_struct *p, u32 *secid)
1016 */ 1032 */
1017static int smack_task_setnice(struct task_struct *p, int nice) 1033static int smack_task_setnice(struct task_struct *p, int nice)
1018{ 1034{
1019 return smk_curacc(p->security, MAY_WRITE); 1035 int rc;
1036
1037 rc = cap_task_setnice(p, nice);
1038 if (rc == 0)
1039 rc = smk_curacc(p->security, MAY_WRITE);
1040 return rc;
1020} 1041}
1021 1042
1022/** 1043/**
@@ -1028,7 +1049,12 @@ static int smack_task_setnice(struct task_struct *p, int nice)
1028 */ 1049 */
1029static int smack_task_setioprio(struct task_struct *p, int ioprio) 1050static int smack_task_setioprio(struct task_struct *p, int ioprio)
1030{ 1051{
1031 return smk_curacc(p->security, MAY_WRITE); 1052 int rc;
1053
1054 rc = cap_task_setioprio(p, ioprio);
1055 if (rc == 0)
1056 rc = smk_curacc(p->security, MAY_WRITE);
1057 return rc;
1032} 1058}
1033 1059
1034/** 1060/**
@@ -1053,7 +1079,12 @@ static int smack_task_getioprio(struct task_struct *p)
1053static int smack_task_setscheduler(struct task_struct *p, int policy, 1079static int smack_task_setscheduler(struct task_struct *p, int policy,
1054 struct sched_param *lp) 1080 struct sched_param *lp)
1055{ 1081{
1056 return smk_curacc(p->security, MAY_WRITE); 1082 int rc;
1083
1084 rc = cap_task_setscheduler(p, policy, lp);
1085 if (rc == 0)
1086 rc = smk_curacc(p->security, MAY_WRITE);
1087 return rc;
1057} 1088}
1058 1089
1059/** 1090/**
@@ -1093,6 +1124,11 @@ static int smack_task_movememory(struct task_struct *p)
1093static int smack_task_kill(struct task_struct *p, struct siginfo *info, 1124static int smack_task_kill(struct task_struct *p, struct siginfo *info,
1094 int sig, u32 secid) 1125 int sig, u32 secid)
1095{ 1126{
1127 int rc;
1128
1129 rc = cap_task_kill(p, info, sig, secid);
1130 if (rc != 0)
1131 return rc;
1096 /* 1132 /*
1097 * Special cases where signals really ought to go through 1133 * Special cases where signals really ought to go through
1098 * in spite of policy. Stephen Smalley suggests it may 1134 * in spite of policy. Stephen Smalley suggests it may
@@ -1251,9 +1287,8 @@ static void smack_to_secattr(char *smack, struct netlbl_lsm_secattr *nlsp)
1251 1287
1252 switch (smack_net_nltype) { 1288 switch (smack_net_nltype) {
1253 case NETLBL_NLTYPE_CIPSOV4: 1289 case NETLBL_NLTYPE_CIPSOV4:
1254 nlsp->domain = NULL; 1290 nlsp->domain = kstrdup(smack, GFP_ATOMIC);
1255 nlsp->flags = NETLBL_SECATTR_DOMAIN; 1291 nlsp->flags = NETLBL_SECATTR_DOMAIN | NETLBL_SECATTR_MLS_LVL;
1256 nlsp->flags |= NETLBL_SECATTR_MLS_LVL;
1257 1292
1258 rc = smack_to_cipso(smack, &cipso); 1293 rc = smack_to_cipso(smack, &cipso);
1259 if (rc == 0) { 1294 if (rc == 0) {
@@ -1280,16 +1315,16 @@ static void smack_to_secattr(char *smack, struct netlbl_lsm_secattr *nlsp)
1280 */ 1315 */
1281static int smack_netlabel(struct sock *sk) 1316static int smack_netlabel(struct sock *sk)
1282{ 1317{
1283 struct socket_smack *ssp = sk->sk_security; 1318 struct socket_smack *ssp;
1284 struct netlbl_lsm_secattr secattr; 1319 struct netlbl_lsm_secattr secattr;
1285 int rc = 0; 1320 int rc;
1286 1321
1322 ssp = sk->sk_security;
1287 netlbl_secattr_init(&secattr); 1323 netlbl_secattr_init(&secattr);
1288 smack_to_secattr(ssp->smk_out, &secattr); 1324 smack_to_secattr(ssp->smk_out, &secattr);
1289 if (secattr.flags != NETLBL_SECATTR_NONE) 1325 rc = netlbl_sock_setattr(sk, &secattr);
1290 rc = netlbl_sock_setattr(sk, &secattr);
1291
1292 netlbl_secattr_destroy(&secattr); 1326 netlbl_secattr_destroy(&secattr);
1327
1293 return rc; 1328 return rc;
1294} 1329}
1295 1330
@@ -1312,6 +1347,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,
1312 struct inode_smack *nsp = inode->i_security; 1347 struct inode_smack *nsp = inode->i_security;
1313 struct socket_smack *ssp; 1348 struct socket_smack *ssp;
1314 struct socket *sock; 1349 struct socket *sock;
1350 int rc = 0;
1315 1351
1316 if (value == NULL || size > SMK_LABELLEN) 1352 if (value == NULL || size > SMK_LABELLEN)
1317 return -EACCES; 1353 return -EACCES;
@@ -1331,7 +1367,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,
1331 return -EOPNOTSUPP; 1367 return -EOPNOTSUPP;
1332 1368
1333 sock = SOCKET_I(inode); 1369 sock = SOCKET_I(inode);
1334 if (sock == NULL) 1370 if (sock == NULL || sock->sk == NULL)
1335 return -EOPNOTSUPP; 1371 return -EOPNOTSUPP;
1336 1372
1337 ssp = sock->sk->sk_security; 1373 ssp = sock->sk->sk_security;
@@ -1340,7 +1376,10 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,
1340 ssp->smk_in = sp; 1376 ssp->smk_in = sp;
1341 else if (strcmp(name, XATTR_SMACK_IPOUT) == 0) { 1377 else if (strcmp(name, XATTR_SMACK_IPOUT) == 0) {
1342 ssp->smk_out = sp; 1378 ssp->smk_out = sp;
1343 return smack_netlabel(sock->sk); 1379 rc = smack_netlabel(sock->sk);
1380 if (rc != 0)
1381 printk(KERN_WARNING "Smack: \"%s\" netlbl error %d.\n",
1382 __func__, -rc);
1344 } else 1383 } else
1345 return -EOPNOTSUPP; 1384 return -EOPNOTSUPP;
1346 1385
@@ -1362,7 +1401,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,
1362static int smack_socket_post_create(struct socket *sock, int family, 1401static int smack_socket_post_create(struct socket *sock, int family,
1363 int type, int protocol, int kern) 1402 int type, int protocol, int kern)
1364{ 1403{
1365 if (family != PF_INET) 1404 if (family != PF_INET || sock->sk == NULL)
1366 return 0; 1405 return 0;
1367 /* 1406 /*
1368 * Set the outbound netlbl. 1407 * Set the outbound netlbl.
@@ -1775,6 +1814,27 @@ static int smack_ipc_permission(struct kern_ipc_perm *ipp, short flag)
1775 return smk_curacc(isp, may); 1814 return smk_curacc(isp, may);
1776} 1815}
1777 1816
1817/* module stacking operations */
1818
1819/**
1820 * smack_register_security - stack capability module
1821 * @name: module name
1822 * @ops: module operations - ignored
1823 *
1824 * Allow the capability module to register.
1825 */
1826static int smack_register_security(const char *name,
1827 struct security_operations *ops)
1828{
1829 if (strcmp(name, "capability") != 0)
1830 return -EINVAL;
1831
1832 printk(KERN_INFO "%s: Registering secondary module %s\n",
1833 __func__, name);
1834
1835 return 0;
1836}
1837
1778/** 1838/**
1779 * smack_d_instantiate - Make sure the blob is correct on an inode 1839 * smack_d_instantiate - Make sure the blob is correct on an inode
1780 * @opt_dentry: unused 1840 * @opt_dentry: unused
@@ -2213,6 +2273,9 @@ static void smack_sock_graft(struct sock *sk, struct socket *parent)
2213 ssp->smk_packet[0] = '\0'; 2273 ssp->smk_packet[0] = '\0';
2214 2274
2215 rc = smack_netlabel(sk); 2275 rc = smack_netlabel(sk);
2276 if (rc != 0)
2277 printk(KERN_WARNING "Smack: \"%s\" netlbl error %d.\n",
2278 __func__, -rc);
2216} 2279}
2217 2280
2218/** 2281/**
@@ -2345,6 +2408,20 @@ static int smack_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2345} 2408}
2346 2409
2347/* 2410/*
2411 * smack_secctx_to_secid - return the secid for a smack label
2412 * @secdata: smack label
2413 * @seclen: how long result is
2414 * @secid: outgoing integer
2415 *
2416 * Exists for audit and networking code.
2417 */
2418static int smack_secctx_to_secid(char *secdata, u32 seclen, u32 *secid)
2419{
2420 *secid = smack_to_secid(secdata);
2421 return 0;
2422}
2423
2424/*
2348 * smack_release_secctx - don't do anything. 2425 * smack_release_secctx - don't do anything.
2349 * @key_ref: unused 2426 * @key_ref: unused
2350 * @context: unused 2427 * @context: unused
@@ -2392,6 +2469,8 @@ static struct security_operations smack_ops = {
2392 .inode_post_setxattr = smack_inode_post_setxattr, 2469 .inode_post_setxattr = smack_inode_post_setxattr,
2393 .inode_getxattr = smack_inode_getxattr, 2470 .inode_getxattr = smack_inode_getxattr,
2394 .inode_removexattr = smack_inode_removexattr, 2471 .inode_removexattr = smack_inode_removexattr,
2472 .inode_need_killpriv = cap_inode_need_killpriv,
2473 .inode_killpriv = cap_inode_killpriv,
2395 .inode_getsecurity = smack_inode_getsecurity, 2474 .inode_getsecurity = smack_inode_getsecurity,
2396 .inode_setsecurity = smack_inode_setsecurity, 2475 .inode_setsecurity = smack_inode_setsecurity,
2397 .inode_listsecurity = smack_inode_listsecurity, 2476 .inode_listsecurity = smack_inode_listsecurity,
@@ -2451,6 +2530,8 @@ static struct security_operations smack_ops = {
2451 .netlink_send = cap_netlink_send, 2530 .netlink_send = cap_netlink_send,
2452 .netlink_recv = cap_netlink_recv, 2531 .netlink_recv = cap_netlink_recv,
2453 2532
2533 .register_security = smack_register_security,
2534
2454 .d_instantiate = smack_d_instantiate, 2535 .d_instantiate = smack_d_instantiate,
2455 2536
2456 .getprocattr = smack_getprocattr, 2537 .getprocattr = smack_getprocattr,
@@ -2474,6 +2555,7 @@ static struct security_operations smack_ops = {
2474 .key_permission = smack_key_permission, 2555 .key_permission = smack_key_permission,
2475#endif /* CONFIG_KEYS */ 2556#endif /* CONFIG_KEYS */
2476 .secid_to_secctx = smack_secid_to_secctx, 2557 .secid_to_secctx = smack_secid_to_secctx,
2558 .secctx_to_secid = smack_secctx_to_secid,
2477 .release_secctx = smack_release_secctx, 2559 .release_secctx = smack_release_secctx,
2478}; 2560};
2479 2561
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 15aa37f65b39..358c92c1a153 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -24,6 +24,7 @@
24#include <net/cipso_ipv4.h> 24#include <net/cipso_ipv4.h>
25#include <linux/seq_file.h> 25#include <linux/seq_file.h>
26#include <linux/ctype.h> 26#include <linux/ctype.h>
27#include <linux/audit.h>
27#include "smack.h" 28#include "smack.h"
28 29
29/* 30/*
@@ -45,6 +46,7 @@ enum smk_inos {
45 */ 46 */
46static DEFINE_MUTEX(smack_list_lock); 47static DEFINE_MUTEX(smack_list_lock);
47static DEFINE_MUTEX(smack_cipso_lock); 48static DEFINE_MUTEX(smack_cipso_lock);
49static DEFINE_MUTEX(smack_ambient_lock);
48 50
49/* 51/*
50 * This is the "ambient" label for network traffic. 52 * This is the "ambient" label for network traffic.
@@ -342,6 +344,9 @@ void smk_cipso_doi(void)
342 struct cipso_v4_doi *doip; 344 struct cipso_v4_doi *doip;
343 struct netlbl_audit audit_info; 345 struct netlbl_audit audit_info;
344 346
347 audit_info.loginuid = audit_get_loginuid(current);
348 audit_info.secid = smack_to_secid(current->security);
349
345 rc = netlbl_cfg_map_del(NULL, &audit_info); 350 rc = netlbl_cfg_map_del(NULL, &audit_info);
346 if (rc != 0) 351 if (rc != 0)
347 printk(KERN_WARNING "%s:%d remove rc = %d\n", 352 printk(KERN_WARNING "%s:%d remove rc = %d\n",
@@ -363,6 +368,30 @@ void smk_cipso_doi(void)
363 __func__, __LINE__, rc); 368 __func__, __LINE__, rc);
364} 369}
365 370
371/**
372 * smk_unlbl_ambient - initialize the unlabeled domain
373 */
374void smk_unlbl_ambient(char *oldambient)
375{
376 int rc;
377 struct netlbl_audit audit_info;
378
379 audit_info.loginuid = audit_get_loginuid(current);
380 audit_info.secid = smack_to_secid(current->security);
381
382 if (oldambient != NULL) {
383 rc = netlbl_cfg_map_del(oldambient, &audit_info);
384 if (rc != 0)
385 printk(KERN_WARNING "%s:%d remove rc = %d\n",
386 __func__, __LINE__, rc);
387 }
388
389 rc = netlbl_cfg_unlbl_add_map(smack_net_ambient, &audit_info);
390 if (rc != 0)
391 printk(KERN_WARNING "%s:%d add rc = %d\n",
392 __func__, __LINE__, rc);
393}
394
366/* 395/*
367 * Seq_file read operations for /smack/cipso 396 * Seq_file read operations for /smack/cipso
368 */ 397 */
@@ -709,7 +738,6 @@ static ssize_t smk_read_ambient(struct file *filp, char __user *buf,
709 size_t cn, loff_t *ppos) 738 size_t cn, loff_t *ppos)
710{ 739{
711 ssize_t rc; 740 ssize_t rc;
712 char out[SMK_LABELLEN];
713 int asize; 741 int asize;
714 742
715 if (*ppos != 0) 743 if (*ppos != 0)
@@ -717,23 +745,18 @@ static ssize_t smk_read_ambient(struct file *filp, char __user *buf,
717 /* 745 /*
718 * Being careful to avoid a problem in the case where 746 * Being careful to avoid a problem in the case where
719 * smack_net_ambient gets changed in midstream. 747 * smack_net_ambient gets changed in midstream.
720 * Since smack_net_ambient is always set with a value
721 * from the label list, including initially, and those
722 * never get freed, the worst case is that the pointer
723 * gets changed just after this strncpy, in which case
724 * the value passed up is incorrect. Locking around
725 * smack_net_ambient wouldn't be any better than this
726 * copy scheme as by the time the caller got to look
727 * at the ambient value it would have cleared the lock
728 * and been changed.
729 */ 748 */
730 strncpy(out, smack_net_ambient, SMK_LABELLEN); 749 mutex_lock(&smack_ambient_lock);
731 asize = strlen(out) + 1;
732 750
733 if (cn < asize) 751 asize = strlen(smack_net_ambient) + 1;
734 return -EINVAL; 752
753 if (cn >= asize)
754 rc = simple_read_from_buffer(buf, cn, ppos,
755 smack_net_ambient, asize);
756 else
757 rc = -EINVAL;
735 758
736 rc = simple_read_from_buffer(buf, cn, ppos, out, asize); 759 mutex_unlock(&smack_ambient_lock);
737 760
738 return rc; 761 return rc;
739} 762}
@@ -751,6 +774,7 @@ static ssize_t smk_write_ambient(struct file *file, const char __user *buf,
751 size_t count, loff_t *ppos) 774 size_t count, loff_t *ppos)
752{ 775{
753 char in[SMK_LABELLEN]; 776 char in[SMK_LABELLEN];
777 char *oldambient;
754 char *smack; 778 char *smack;
755 779
756 if (!capable(CAP_MAC_ADMIN)) 780 if (!capable(CAP_MAC_ADMIN))
@@ -766,7 +790,13 @@ static ssize_t smk_write_ambient(struct file *file, const char __user *buf,
766 if (smack == NULL) 790 if (smack == NULL)
767 return -EINVAL; 791 return -EINVAL;
768 792
793 mutex_lock(&smack_ambient_lock);
794
795 oldambient = smack_net_ambient;
769 smack_net_ambient = smack; 796 smack_net_ambient = smack;
797 smk_unlbl_ambient(oldambient);
798
799 mutex_unlock(&smack_ambient_lock);
770 800
771 return count; 801 return count;
772} 802}
@@ -974,6 +1004,7 @@ static int __init init_smk_fs(void)
974 1004
975 sema_init(&smack_write_sem, 1); 1005 sema_init(&smack_write_sem, 1);
976 smk_cipso_doi(); 1006 smk_cipso_doi();
1007 smk_unlbl_ambient(NULL);
977 1008
978 return err; 1009 return err;
979} 1010}
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index f97c1ba43a28..47cfa5186e34 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -149,13 +149,13 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid)
149 } 149 }
150 spin_unlock_irqrestore(&clients_lock, flags); 150 spin_unlock_irqrestore(&clients_lock, flags);
151#ifdef CONFIG_KMOD 151#ifdef CONFIG_KMOD
152 if (!in_interrupt() && current->fs->root) { 152 if (!in_interrupt()) {
153 static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS]; 153 static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS];
154 static char card_requested[SNDRV_CARDS]; 154 static char card_requested[SNDRV_CARDS];
155 if (clientid < SNDRV_SEQ_GLOBAL_CLIENTS) { 155 if (clientid < SNDRV_SEQ_GLOBAL_CLIENTS) {
156 int idx; 156 int idx;
157 157
158 if (! client_requested[clientid] && current->fs->root) { 158 if (!client_requested[clientid]) {
159 client_requested[clientid] = 1; 159 client_requested[clientid] = 1;
160 for (idx = 0; idx < 15; idx++) { 160 for (idx = 0; idx < 15; idx++) {
161 if (seq_client_load[idx] < 0) 161 if (seq_client_load[idx] < 0)
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 155dc7da4722..2f00ad28a2b7 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -149,9 +149,6 @@ void snd_seq_device_load_drivers(void)
149 if (snd_seq_in_init) 149 if (snd_seq_in_init)
150 return; 150 return;
151 151
152 if (! current->fs->root)
153 return;
154
155 mutex_lock(&ops_mutex); 152 mutex_lock(&ops_mutex);
156 list_for_each_entry(ops, &opslist, list) { 153 list_for_each_entry(ops, &opslist, list) {
157 if (! (ops->driver & DRIVER_LOADED) && 154 if (! (ops->driver & DRIVER_LOADED) &&
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 00cca4d6e562..812f91b3de5b 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -71,8 +71,6 @@ static DEFINE_MUTEX(sound_mutex);
71 */ 71 */
72void snd_request_card(int card) 72void snd_request_card(int card)
73{ 73{
74 if (! current->fs->root)
75 return;
76 if (snd_card_locked(card)) 74 if (snd_card_locked(card))
77 return; 75 return;
78 if (card < 0 || card >= cards_limit) 76 if (card < 0 || card >= cards_limit)
@@ -86,8 +84,6 @@ static void snd_request_other(int minor)
86{ 84{
87 char *str; 85 char *str;
88 86
89 if (! current->fs->root)
90 return;
91 switch (minor) { 87 switch (minor) {
92 case SNDRV_MINOR_SEQUENCER: str = "snd-seq"; break; 88 case SNDRV_MINOR_SEQUENCER: str = "snd-seq"; break;
93 case SNDRV_MINOR_TIMER: str = "snd-timer"; break; 89 case SNDRV_MINOR_TIMER: str = "snd-timer"; break;
diff --git a/sound/core/timer.c b/sound/core/timer.c
index aece465934b8..9d8184a2c2d0 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -150,8 +150,6 @@ static struct snd_timer *snd_timer_find(struct snd_timer_id *tid)
150 150
151static void snd_timer_request(struct snd_timer_id *tid) 151static void snd_timer_request(struct snd_timer_id *tid)
152{ 152{
153 if (! current->fs->root)
154 return;
155 switch (tid->dev_class) { 153 switch (tid->dev_class) {
156 case SNDRV_TIMER_CLASS_GLOBAL: 154 case SNDRV_TIMER_CLASS_GLOBAL:
157 if (tid->device < timer_limit) 155 if (tid->device < timer_limit)
diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c
index a7bf7a4b1f85..fb64c890109b 100644
--- a/sound/drivers/opl3/opl3_synth.c
+++ b/sound/drivers/opl3/opl3_synth.c
@@ -22,6 +22,10 @@
22#include <sound/opl3.h> 22#include <sound/opl3.h>
23#include <sound/asound_fm.h> 23#include <sound/asound_fm.h>
24 24
25#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
26#define OPL3_SUPPORT_SYNTH
27#endif
28
25/* 29/*
26 * There is 18 possible 2 OP voices 30 * There is 18 possible 2 OP voices
27 * (9 in the left and 9 in the right). 31 * (9 in the left and 9 in the right).
@@ -155,9 +159,11 @@ int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
155#endif 159#endif
156 return snd_opl3_set_connection(opl3, (int) arg); 160 return snd_opl3_set_connection(opl3, (int) arg);
157 161
162#ifdef OPL3_SUPPORT_SYNTH
158 case SNDRV_DM_FM_IOCTL_CLEAR_PATCHES: 163 case SNDRV_DM_FM_IOCTL_CLEAR_PATCHES:
159 snd_opl3_clear_patches(opl3); 164 snd_opl3_clear_patches(opl3);
160 return 0; 165 return 0;
166#endif
161 167
162#ifdef CONFIG_SND_DEBUG 168#ifdef CONFIG_SND_DEBUG
163 default: 169 default:
@@ -178,6 +184,7 @@ int snd_opl3_release(struct snd_hwdep * hw, struct file *file)
178 return 0; 184 return 0;
179} 185}
180 186
187#ifdef OPL3_SUPPORT_SYNTH
181/* 188/*
182 * write the device - load patches 189 * write the device - load patches
183 */ 190 */
@@ -341,6 +348,7 @@ void snd_opl3_clear_patches(struct snd_opl3 *opl3)
341 } 348 }
342 memset(opl3->patch_table, 0, sizeof(opl3->patch_table)); 349 memset(opl3->patch_table, 0, sizeof(opl3->patch_table));
343} 350}
351#endif /* OPL3_SUPPORT_SYNTH */
344 352
345/* ------------------------------ */ 353/* ------------------------------ */
346 354
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index c9a2421cf6f0..4ecdd635ed1d 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -681,15 +681,12 @@ static struct snd_kcontrol_new snd_bt87x_capture_source = {
681 681
682static int snd_bt87x_free(struct snd_bt87x *chip) 682static int snd_bt87x_free(struct snd_bt87x *chip)
683{ 683{
684 if (chip->mmio) { 684 if (chip->mmio)
685 snd_bt87x_stop(chip); 685 snd_bt87x_stop(chip);
686 if (chip->irq >= 0)
687 synchronize_irq(chip->irq);
688
689 iounmap(chip->mmio);
690 }
691 if (chip->irq >= 0) 686 if (chip->irq >= 0)
692 free_irq(chip->irq, chip); 687 free_irq(chip->irq, chip);
688 if (chip->mmio)
689 iounmap(chip->mmio);
693 pci_release_regions(chip->pci); 690 pci_release_regions(chip->pci);
694 pci_disable_device(chip->pci); 691 pci_disable_device(chip->pci);
695 kfree(chip); 692 kfree(chip);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 26812dc2b7f2..37c413923db8 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1055,6 +1055,12 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
1055 const char **s; 1055 const char **s;
1056 int err; 1056 int err;
1057 1057
1058 for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++)
1059 ;
1060 if (!*s) {
1061 snd_printdd("No slave found for %s\n", name);
1062 return 0;
1063 }
1058 kctl = snd_ctl_make_virtual_master(name, tlv); 1064 kctl = snd_ctl_make_virtual_master(name, tlv);
1059 if (!kctl) 1065 if (!kctl)
1060 return -ENOMEM; 1066 return -ENOMEM;
@@ -1197,8 +1203,8 @@ int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol,
1197 struct hda_bind_ctls *c; 1203 struct hda_bind_ctls *c;
1198 int err; 1204 int err;
1199 1205
1200 c = (struct hda_bind_ctls *)kcontrol->private_value;
1201 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1206 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1207 c = (struct hda_bind_ctls *)kcontrol->private_value;
1202 kcontrol->private_value = *c->values; 1208 kcontrol->private_value = *c->values;
1203 err = c->ops->info(kcontrol, uinfo); 1209 err = c->ops->info(kcontrol, uinfo);
1204 kcontrol->private_value = (long)c; 1210 kcontrol->private_value = (long)c;
@@ -1213,8 +1219,8 @@ int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
1213 struct hda_bind_ctls *c; 1219 struct hda_bind_ctls *c;
1214 int err; 1220 int err;
1215 1221
1216 c = (struct hda_bind_ctls *)kcontrol->private_value;
1217 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1222 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1223 c = (struct hda_bind_ctls *)kcontrol->private_value;
1218 kcontrol->private_value = *c->values; 1224 kcontrol->private_value = *c->values;
1219 err = c->ops->get(kcontrol, ucontrol); 1225 err = c->ops->get(kcontrol, ucontrol);
1220 kcontrol->private_value = (long)c; 1226 kcontrol->private_value = (long)c;
@@ -1230,8 +1236,8 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
1230 unsigned long *vals; 1236 unsigned long *vals;
1231 int err = 0, change = 0; 1237 int err = 0, change = 0;
1232 1238
1233 c = (struct hda_bind_ctls *)kcontrol->private_value;
1234 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1239 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1240 c = (struct hda_bind_ctls *)kcontrol->private_value;
1235 for (vals = c->values; *vals; vals++) { 1241 for (vals = c->values; *vals; vals++) {
1236 kcontrol->private_value = *vals; 1242 kcontrol->private_value = *vals;
1237 err = c->ops->put(kcontrol, ucontrol); 1243 err = c->ops->put(kcontrol, ucontrol);
@@ -1251,8 +1257,8 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1251 struct hda_bind_ctls *c; 1257 struct hda_bind_ctls *c;
1252 int err; 1258 int err;
1253 1259
1254 c = (struct hda_bind_ctls *)kcontrol->private_value;
1255 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1260 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */
1261 c = (struct hda_bind_ctls *)kcontrol->private_value;
1256 kcontrol->private_value = *c->values; 1262 kcontrol->private_value = *c->values;
1257 err = c->ops->tlv(kcontrol, op_flag, size, tlv); 1263 err = c->ops->tlv(kcontrol, op_flag, size, tlv);
1258 kcontrol->private_value = (long)c; 1264 kcontrol->private_value = (long)c;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 56f8a3050751..4be36c84b36c 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -275,6 +275,11 @@ enum {
275#define NVIDIA_HDA_TRANSREG_ADDR 0x4e 275#define NVIDIA_HDA_TRANSREG_ADDR 0x4e
276#define NVIDIA_HDA_ENABLE_COHBITS 0x0f 276#define NVIDIA_HDA_ENABLE_COHBITS 0x0f
277 277
278/* Defines for Intel SCH HDA snoop control */
279#define INTEL_SCH_HDA_DEVC 0x78
280#define INTEL_SCH_HDA_DEVC_NOSNOOP (0x1<<11)
281
282
278/* 283/*
279 */ 284 */
280 285
@@ -868,6 +873,8 @@ static void update_pci_byte(struct pci_dev *pci, unsigned int reg,
868 873
869static void azx_init_pci(struct azx *chip) 874static void azx_init_pci(struct azx *chip)
870{ 875{
876 unsigned short snoop;
877
871 /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) 878 /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44)
872 * TCSEL == Traffic Class Select Register, which sets PCI express QOS 879 * TCSEL == Traffic Class Select Register, which sets PCI express QOS
873 * Ensuring these bits are 0 clears playback static on some HD Audio 880 * Ensuring these bits are 0 clears playback static on some HD Audio
@@ -888,6 +895,19 @@ static void azx_init_pci(struct azx *chip)
888 NVIDIA_HDA_TRANSREG_ADDR, 895 NVIDIA_HDA_TRANSREG_ADDR,
889 0x0f, NVIDIA_HDA_ENABLE_COHBITS); 896 0x0f, NVIDIA_HDA_ENABLE_COHBITS);
890 break; 897 break;
898 case AZX_DRIVER_SCH:
899 pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop);
900 if (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP) {
901 pci_write_config_word(chip->pci, INTEL_SCH_HDA_DEVC, \
902 snoop & (~INTEL_SCH_HDA_DEVC_NOSNOOP));
903 pci_read_config_word(chip->pci,
904 INTEL_SCH_HDA_DEVC, &snoop);
905 snd_printdd("HDA snoop disabled, enabling ... %s\n",\
906 (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP) \
907 ? "Failed" : "OK");
908 }
909 break;
910
891 } 911 }
892} 912}
893 913
@@ -1040,6 +1060,7 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
1040 1060
1041static unsigned int azx_max_codecs[] __devinitdata = { 1061static unsigned int azx_max_codecs[] __devinitdata = {
1042 [AZX_DRIVER_ICH] = 3, 1062 [AZX_DRIVER_ICH] = 3,
1063 [AZX_DRIVER_SCH] = 3,
1043 [AZX_DRIVER_ATI] = 4, 1064 [AZX_DRIVER_ATI] = 4,
1044 [AZX_DRIVER_ATIHDMI] = 4, 1065 [AZX_DRIVER_ATIHDMI] = 4,
1045 [AZX_DRIVER_VIA] = 3, /* FIXME: correct? */ 1066 [AZX_DRIVER_VIA] = 3, /* FIXME: correct? */
@@ -1797,7 +1818,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
1797 */ 1818 */
1798 chip->playback_streams = (gcap & (0xF << 12)) >> 12; 1819 chip->playback_streams = (gcap & (0xF << 12)) >> 12;
1799 chip->capture_streams = (gcap & (0xF << 8)) >> 8; 1820 chip->capture_streams = (gcap & (0xF << 8)) >> 8;
1800 chip->playback_index_offset = (gcap & (0xF << 12)) >> 12; 1821 chip->playback_index_offset = chip->capture_streams;
1801 chip->capture_index_offset = 0; 1822 chip->capture_index_offset = 0;
1802 } else { 1823 } else {
1803 /* gcap didn't give any info, switching to old method */ 1824 /* gcap didn't give any info, switching to old method */
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 35a630d1770f..5633f77f8f3b 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -584,7 +584,8 @@ static void print_codec_info(struct snd_info_entry *entry,
584 print_amp_caps(buffer, codec, nid, HDA_INPUT); 584 print_amp_caps(buffer, codec, nid, HDA_INPUT);
585 snd_iprintf(buffer, " Amp-In vals: "); 585 snd_iprintf(buffer, " Amp-In vals: ");
586 print_amp_vals(buffer, codec, nid, HDA_INPUT, 586 print_amp_vals(buffer, codec, nid, HDA_INPUT,
587 wid_caps & AC_WCAP_STEREO, conn_len); 587 wid_caps & AC_WCAP_STEREO,
588 wid_type == AC_WID_PIN ? 1 : conn_len);
588 } 589 }
589 if (wid_caps & AC_WCAP_OUT_AMP) { 590 if (wid_caps & AC_WCAP_OUT_AMP) {
590 snd_iprintf(buffer, " Amp-Out caps: "); 591 snd_iprintf(buffer, " Amp-Out caps: ");
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index f6dd51cda7b2..f7cd3a804b11 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -488,7 +488,7 @@ static int conexant_ch_mode_put(struct snd_kcontrol *kcontrol,
488static hda_nid_t cxt5045_dac_nids[1] = { 0x19 }; 488static hda_nid_t cxt5045_dac_nids[1] = { 0x19 };
489static hda_nid_t cxt5045_adc_nids[1] = { 0x1a }; 489static hda_nid_t cxt5045_adc_nids[1] = { 0x1a };
490static hda_nid_t cxt5045_capsrc_nids[1] = { 0x1a }; 490static hda_nid_t cxt5045_capsrc_nids[1] = { 0x1a };
491#define CXT5045_SPDIF_OUT 0x13 491#define CXT5045_SPDIF_OUT 0x18
492 492
493static struct hda_channel_mode cxt5045_modes[1] = { 493static struct hda_channel_mode cxt5045_modes[1] = {
494 { 2, NULL }, 494 { 2, NULL },
@@ -658,6 +658,7 @@ static struct hda_verb cxt5045_init_verbs[] = {
658 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 658 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE,
659 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17}, 659 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17},
660 /* SPDIF route: PCM */ 660 /* SPDIF route: PCM */
661 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
661 { 0x13, AC_VERB_SET_CONNECT_SEL, 0x0 }, 662 { 0x13, AC_VERB_SET_CONNECT_SEL, 0x0 },
662 /* EAPD */ 663 /* EAPD */
663 {0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x2 }, /* default on */ 664 {0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x2 }, /* default on */
@@ -683,6 +684,7 @@ static struct hda_verb cxt5045_benq_init_verbs[] = {
683 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 684 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE,
684 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17}, 685 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17},
685 /* SPDIF route: PCM */ 686 /* SPDIF route: PCM */
687 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
686 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, 688 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
687 /* EAPD */ 689 /* EAPD */
688 {0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ 690 {0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */
@@ -781,7 +783,8 @@ static struct hda_verb cxt5045_test_init_verbs[] = {
781 * PCM format, copyright asserted, no pre-emphasis and no validity 783 * PCM format, copyright asserted, no pre-emphasis and no validity
782 * control. 784 * control.
783 */ 785 */
784 {0x13, AC_VERB_SET_DIGI_CONVERT_1, 0}, 786 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
787 {0x18, AC_VERB_SET_DIGI_CONVERT_1, 0},
785 788
786 /* Start with output sum widgets muted and their output gains at min */ 789 /* Start with output sum widgets muted and their output gains at min */
787 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 790 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 586d98f1b63d..777f8c01ca7a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5227,10 +5227,14 @@ static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5227 const struct hda_input_mux *imux = spec->input_mux; 5227 const struct hda_input_mux *imux = spec->input_mux;
5228 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 5228 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5229 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; 5229 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 };
5230 hda_nid_t nid = capture_mixers[adc_idx]; 5230 hda_nid_t nid;
5231 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 5231 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5232 unsigned int i, idx; 5232 unsigned int i, idx;
5233 5233
5234 if (spec->num_adc_nids < 3)
5235 nid = capture_mixers[adc_idx + 1];
5236 else
5237 nid = capture_mixers[adc_idx];
5234 idx = ucontrol->value.enumerated.item[0]; 5238 idx = ucontrol->value.enumerated.item[0];
5235 if (idx >= imux->num_items) 5239 if (idx >= imux->num_items)
5236 idx = imux->num_items - 1; 5240 idx = imux->num_items - 1;
@@ -6457,7 +6461,7 @@ static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
6457 struct alc_spec *spec = codec->spec; 6461 struct alc_spec *spec = codec->spec;
6458 const struct hda_input_mux *imux = spec->input_mux; 6462 const struct hda_input_mux *imux = spec->input_mux;
6459 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 6463 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
6460 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; 6464 static hda_nid_t capture_mixers[2] = { 0x23, 0x22 };
6461 hda_nid_t nid = capture_mixers[adc_idx]; 6465 hda_nid_t nid = capture_mixers[adc_idx];
6462 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 6466 unsigned int *cur_val = &spec->cur_mux[adc_idx];
6463 unsigned int i, idx; 6467 unsigned int i, idx;
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index f31a0eb409b0..9a9941bb0460 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -28,7 +28,9 @@
28 * GPIO 1 -> DFS1 of AK5385 28 * GPIO 1 -> DFS1 of AK5385
29 */ 29 */
30 30
31#include <linux/mutex.h>
31#include <linux/pci.h> 32#include <linux/pci.h>
33#include <sound/ac97_codec.h>
32#include <sound/control.h> 34#include <sound/control.h>
33#include <sound/core.h> 35#include <sound/core.h>
34#include <sound/initval.h> 36#include <sound/initval.h>
@@ -37,6 +39,7 @@
37#include <sound/tlv.h> 39#include <sound/tlv.h>
38#include "oxygen.h" 40#include "oxygen.h"
39#include "ak4396.h" 41#include "ak4396.h"
42#include "cm9780.h"
40 43
41MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); 44MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
42MODULE_DESCRIPTION("C-Media CMI8788 driver"); 45MODULE_DESCRIPTION("C-Media CMI8788 driver");
@@ -75,6 +78,8 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids);
75#define GPIO_AK5385_DFS_DOUBLE 0x0001 78#define GPIO_AK5385_DFS_DOUBLE 0x0001
76#define GPIO_AK5385_DFS_QUAD 0x0002 79#define GPIO_AK5385_DFS_QUAD 0x0002
77 80
81#define GPIO_LINE_MUTE CM9780_GPO0
82
78#define WM8785_R0 0 83#define WM8785_R0 0
79#define WM8785_R1 1 84#define WM8785_R1 1
80#define WM8785_R2 2 85#define WM8785_R2 2
@@ -180,16 +185,23 @@ static void wm8785_init(struct oxygen *chip)
180 snd_component_add(chip->card, "WM8785"); 185 snd_component_add(chip->card, "WM8785");
181} 186}
182 187
188static void cmi9780_init(struct oxygen *chip)
189{
190 oxygen_ac97_clear_bits(chip, 0, CM9780_GPIO_STATUS, GPIO_LINE_MUTE);
191}
192
183static void generic_init(struct oxygen *chip) 193static void generic_init(struct oxygen *chip)
184{ 194{
185 ak4396_init(chip); 195 ak4396_init(chip);
186 wm8785_init(chip); 196 wm8785_init(chip);
197 cmi9780_init(chip);
187} 198}
188 199
189static void meridian_init(struct oxygen *chip) 200static void meridian_init(struct oxygen *chip)
190{ 201{
191 ak4396_init(chip); 202 ak4396_init(chip);
192 ak5385_init(chip); 203 ak5385_init(chip);
204 cmi9780_init(chip);
193} 205}
194 206
195static void generic_cleanup(struct oxygen *chip) 207static void generic_cleanup(struct oxygen *chip)
@@ -285,6 +297,27 @@ static void set_ak5385_params(struct oxygen *chip,
285 value, GPIO_AK5385_DFS_MASK); 297 value, GPIO_AK5385_DFS_MASK);
286} 298}
287 299
300static void cmi9780_switch_hook(struct oxygen *chip, unsigned int codec,
301 unsigned int reg, int mute)
302{
303 if (codec != 0)
304 return;
305 switch (reg) {
306 case AC97_LINE:
307 oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
308 mute ? GPIO_LINE_MUTE : 0,
309 GPIO_LINE_MUTE);
310 break;
311 case AC97_MIC:
312 case AC97_CD:
313 case AC97_AUX:
314 if (!mute)
315 oxygen_ac97_set_bits(chip, 0, CM9780_GPIO_STATUS,
316 GPIO_LINE_MUTE);
317 break;
318 }
319}
320
288static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); 321static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
289 322
290static int ak4396_control_filter(struct snd_kcontrol_new *template) 323static int ak4396_control_filter(struct snd_kcontrol_new *template)
@@ -308,6 +341,7 @@ static const struct oxygen_model model_generic = {
308 .set_adc_params = set_wm8785_params, 341 .set_adc_params = set_wm8785_params,
309 .update_dac_volume = update_ak4396_volume, 342 .update_dac_volume = update_ak4396_volume,
310 .update_dac_mute = update_ak4396_mute, 343 .update_dac_mute = update_ak4396_mute,
344 .ac97_switch_hook = cmi9780_switch_hook,
311 .model_data_size = sizeof(struct generic_data), 345 .model_data_size = sizeof(struct generic_data),
312 .dac_channels = 8, 346 .dac_channels = 8,
313 .used_channels = OXYGEN_CHANNEL_A | 347 .used_channels = OXYGEN_CHANNEL_A |
@@ -331,6 +365,7 @@ static const struct oxygen_model model_meridian = {
331 .set_adc_params = set_ak5385_params, 365 .set_adc_params = set_ak5385_params,
332 .update_dac_volume = update_ak4396_volume, 366 .update_dac_volume = update_ak4396_volume,
333 .update_dac_mute = update_ak4396_mute, 367 .update_dac_mute = update_ak4396_mute,
368 .ac97_switch_hook = cmi9780_switch_hook,
334 .model_data_size = sizeof(struct generic_data), 369 .model_data_size = sizeof(struct generic_data),
335 .dac_channels = 8, 370 .dac_channels = 8,
336 .used_channels = OXYGEN_CHANNEL_B | 371 .used_channels = OXYGEN_CHANNEL_B |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 6eb36dd11476..78c21155218e 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -204,7 +204,7 @@ static void oxygen_proc_read(struct snd_info_entry *entry,
204 mutex_unlock(&chip->mutex); 204 mutex_unlock(&chip->mutex);
205} 205}
206 206
207static void __devinit oxygen_proc_init(struct oxygen *chip) 207static void oxygen_proc_init(struct oxygen *chip)
208{ 208{
209 struct snd_info_entry *entry; 209 struct snd_info_entry *entry;
210 210
@@ -215,7 +215,7 @@ static void __devinit oxygen_proc_init(struct oxygen *chip)
215#define oxygen_proc_init(chip) 215#define oxygen_proc_init(chip)
216#endif 216#endif
217 217
218static void __devinit oxygen_init(struct oxygen *chip) 218static void oxygen_init(struct oxygen *chip)
219{ 219{
220 unsigned int i; 220 unsigned int i;
221 221
@@ -399,8 +399,8 @@ static void oxygen_card_free(struct snd_card *card)
399 pci_disable_device(chip->pci); 399 pci_disable_device(chip->pci);
400} 400}
401 401
402int __devinit oxygen_pci_probe(struct pci_dev *pci, int index, char *id, 402int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
403 int midi, const struct oxygen_model *model) 403 int midi, const struct oxygen_model *model)
404{ 404{
405 struct snd_card *card; 405 struct snd_card *card;
406 struct oxygen *chip; 406 struct oxygen *chip;
@@ -507,7 +507,7 @@ err_card:
507} 507}
508EXPORT_SYMBOL(oxygen_pci_probe); 508EXPORT_SYMBOL(oxygen_pci_probe);
509 509
510void __devexit oxygen_pci_remove(struct pci_dev *pci) 510void oxygen_pci_remove(struct pci_dev *pci)
511{ 511{
512 snd_card_free(pci_get_drvdata(pci)); 512 snd_card_free(pci_get_drvdata(pci));
513 pci_set_drvdata(pci, NULL); 513 pci_set_drvdata(pci, NULL);
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c
index dfad3db35c82..b70046aca657 100644
--- a/sound/pci/oxygen/oxygen_pcm.c
+++ b/sound/pci/oxygen/oxygen_pcm.c
@@ -634,7 +634,7 @@ static void oxygen_pcm_free(struct snd_pcm *pcm)
634 snd_pcm_lib_preallocate_free_for_all(pcm); 634 snd_pcm_lib_preallocate_free_for_all(pcm);
635} 635}
636 636
637int __devinit oxygen_pcm_init(struct oxygen *chip) 637int oxygen_pcm_init(struct oxygen *chip)
638{ 638{
639 struct snd_pcm *pcm; 639 struct snd_pcm *pcm;
640 int outs, ins; 640 int outs, ins;
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index c2bd4384316a..1be84f22d0de 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -745,7 +745,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
745 745
746 746
747#ifdef HDSP_FW_LOADER 747#ifdef HDSP_FW_LOADER
748static int __devinit hdsp_request_fw_loader(struct hdsp *hdsp); 748static int hdsp_request_fw_loader(struct hdsp *hdsp);
749#endif 749#endif
750 750
751static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand) 751static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand)
@@ -4688,8 +4688,7 @@ static struct snd_pcm_ops snd_hdsp_capture_ops = {
4688 .copy = snd_hdsp_capture_copy, 4688 .copy = snd_hdsp_capture_copy,
4689}; 4689};
4690 4690
4691static int __devinit snd_hdsp_create_hwdep(struct snd_card *card, 4691static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp)
4692 struct hdsp *hdsp)
4693{ 4692{
4694 struct snd_hwdep *hw; 4693 struct snd_hwdep *hw;
4695 int err; 4694 int err;
@@ -4857,7 +4856,7 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp
4857 4856
4858#ifdef HDSP_FW_LOADER 4857#ifdef HDSP_FW_LOADER
4859/* load firmware via hotplug fw loader */ 4858/* load firmware via hotplug fw loader */
4860static int __devinit hdsp_request_fw_loader(struct hdsp *hdsp) 4859static int hdsp_request_fw_loader(struct hdsp *hdsp)
4861{ 4860{
4862 const char *fwfile; 4861 const char *fwfile;
4863 const struct firmware *fw; 4862 const struct firmware *fw;
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c
index 8432c16cd6ff..ca9452901a50 100644
--- a/sound/ppc/daca.c
+++ b/sound/ppc/daca.c
@@ -250,9 +250,8 @@ int __init snd_pmac_daca_init(struct snd_pmac *chip)
250 struct pmac_daca *mix; 250 struct pmac_daca *mix;
251 251
252#ifdef CONFIG_KMOD 252#ifdef CONFIG_KMOD
253 if (current->fs->root) 253 request_module("i2c-powermac");
254 request_module("i2c-powermac"); 254#endif /* CONFIG_KMOD */
255#endif /* CONFIG_KMOD */
256 255
257 mix = kzalloc(sizeof(*mix), GFP_KERNEL); 256 mix = kzalloc(sizeof(*mix), GFP_KERNEL);
258 if (! mix) 257 if (! mix)
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 71a7a9765429..3f8d7164cef9 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -1351,9 +1351,8 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
1351 char *chipname; 1351 char *chipname;
1352 1352
1353#ifdef CONFIG_KMOD 1353#ifdef CONFIG_KMOD
1354 if (current->fs->root) 1354 request_module("i2c-powermac");
1355 request_module("i2c-powermac"); 1355#endif /* CONFIG_KMOD */
1356#endif /* CONFIG_KMOD */
1357 1356
1358 mix = kzalloc(sizeof(*mix), GFP_KERNEL); 1357 mix = kzalloc(sizeof(*mix), GFP_KERNEL);
1359 if (! mix) 1358 if (! mix)
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index f26c4b2e8b6e..a00aac7a71f1 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -315,7 +315,7 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev,
315 machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; 315 machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J;
316 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 316 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
317 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 317 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
318 } else if (strcasecmp(sprop, "rj-master") == 0) { 318 } else if (strcasecmp(sprop, "rj-slave") == 0) {
319 machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; 319 machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J;
320 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 320 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
321 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 321 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c
index 58d25e4e7d6c..7c44a2c7f963 100644
--- a/sound/usb/caiaq/caiaq-device.c
+++ b/sound/usb/caiaq/caiaq-device.c
@@ -245,7 +245,7 @@ int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev,
245 tmp, sizeof(tmp)); 245 tmp, sizeof(tmp));
246} 246}
247 247
248static void setup_card(struct snd_usb_caiaqdev *dev) 248static void __devinit setup_card(struct snd_usb_caiaqdev *dev)
249{ 249{
250 int ret; 250 int ret;
251 char val[4]; 251 char val[4];
@@ -359,7 +359,7 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
359 return card; 359 return card;
360} 360}
361 361
362static int init_card(struct snd_usb_caiaqdev *dev) 362static int __devinit init_card(struct snd_usb_caiaqdev *dev)
363{ 363{
364 char *c; 364 char *c;
365 struct usb_device *usb_dev = dev->chip.dev; 365 struct usb_device *usb_dev = dev->chip.dev;
@@ -428,7 +428,7 @@ static int init_card(struct snd_usb_caiaqdev *dev)
428 return 0; 428 return 0;
429} 429}
430 430
431static int snd_probe(struct usb_interface *intf, 431static int __devinit snd_probe(struct usb_interface *intf,
432 const struct usb_device_id *id) 432 const struct usb_device_id *id)
433{ 433{
434 int ret; 434 int ret;
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 750e929d5870..6676a177c99e 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -104,12 +104,14 @@ struct snd_usb_midi {
104 struct usb_protocol_ops* usb_protocol_ops; 104 struct usb_protocol_ops* usb_protocol_ops;
105 struct list_head list; 105 struct list_head list;
106 struct timer_list error_timer; 106 struct timer_list error_timer;
107 spinlock_t disc_lock;
107 108
108 struct snd_usb_midi_endpoint { 109 struct snd_usb_midi_endpoint {
109 struct snd_usb_midi_out_endpoint *out; 110 struct snd_usb_midi_out_endpoint *out;
110 struct snd_usb_midi_in_endpoint *in; 111 struct snd_usb_midi_in_endpoint *in;
111 } endpoints[MIDI_MAX_ENDPOINTS]; 112 } endpoints[MIDI_MAX_ENDPOINTS];
112 unsigned long input_triggered; 113 unsigned long input_triggered;
114 unsigned char disconnected;
113}; 115};
114 116
115struct snd_usb_midi_out_endpoint { 117struct snd_usb_midi_out_endpoint {
@@ -306,6 +308,11 @@ static void snd_usbmidi_error_timer(unsigned long data)
306 struct snd_usb_midi *umidi = (struct snd_usb_midi *)data; 308 struct snd_usb_midi *umidi = (struct snd_usb_midi *)data;
307 int i; 309 int i;
308 310
311 spin_lock(&umidi->disc_lock);
312 if (umidi->disconnected) {
313 spin_unlock(&umidi->disc_lock);
314 return;
315 }
309 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 316 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
310 struct snd_usb_midi_in_endpoint *in = umidi->endpoints[i].in; 317 struct snd_usb_midi_in_endpoint *in = umidi->endpoints[i].in;
311 if (in && in->error_resubmit) { 318 if (in && in->error_resubmit) {
@@ -316,6 +323,7 @@ static void snd_usbmidi_error_timer(unsigned long data)
316 if (umidi->endpoints[i].out) 323 if (umidi->endpoints[i].out)
317 snd_usbmidi_do_output(umidi->endpoints[i].out); 324 snd_usbmidi_do_output(umidi->endpoints[i].out);
318 } 325 }
326 spin_unlock(&umidi->disc_lock);
319} 327}
320 328
321/* helper function to send static data that may not DMA-able */ 329/* helper function to send static data that may not DMA-able */
@@ -1049,7 +1057,14 @@ void snd_usbmidi_disconnect(struct list_head* p)
1049 int i; 1057 int i;
1050 1058
1051 umidi = list_entry(p, struct snd_usb_midi, list); 1059 umidi = list_entry(p, struct snd_usb_midi, list);
1052 del_timer_sync(&umidi->error_timer); 1060 /*
1061 * an URB's completion handler may start the timer and
1062 * a timer may submit an URB. To reliably break the cycle
1063 * a flag under lock must be used
1064 */
1065 spin_lock_irq(&umidi->disc_lock);
1066 umidi->disconnected = 1;
1067 spin_unlock_irq(&umidi->disc_lock);
1053 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 1068 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
1054 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; 1069 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
1055 if (ep->out) 1070 if (ep->out)
@@ -1062,6 +1077,7 @@ void snd_usbmidi_disconnect(struct list_head* p)
1062 if (ep->in) 1077 if (ep->in)
1063 usb_kill_urb(ep->in->urb); 1078 usb_kill_urb(ep->in->urb);
1064 } 1079 }
1080 del_timer_sync(&umidi->error_timer);
1065} 1081}
1066 1082
1067static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi) 1083static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi)
@@ -1685,6 +1701,7 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip,
1685 umidi->quirk = quirk; 1701 umidi->quirk = quirk;
1686 umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; 1702 umidi->usb_protocol_ops = &snd_usbmidi_standard_ops;
1687 init_timer(&umidi->error_timer); 1703 init_timer(&umidi->error_timer);
1704 spin_lock_init(&umidi->disc_lock);
1688 umidi->error_timer.function = snd_usbmidi_error_timer; 1705 umidi->error_timer.function = snd_usbmidi_error_timer;
1689 umidi->error_timer.data = (unsigned long)umidi; 1706 umidi->error_timer.data = (unsigned long)umidi;
1690 1707